1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9806],{5964:(t,e,i)=>{i.d(e,{A:()=>a});var r=i(76422),s=i(64657),o=i(16100),n=i(46693);r.A.Expect={each:function(t,e,i){var r,o,n=[];if(s.A.exists(t.length))for(r=0,o=t.length;r<o;r++)n.push(e.call(this,t[r],i));return n},coords:function(t,e){var i=t;return t&&t.elementClass===o.A.OBJECT_CLASS_POINT?i=t.coords:t.usrCoords&&t.scrCoords&&t.usr2screen&&(i=t),e&&(i=new n.A(o.A.COORDS_BY_USER,i.usrCoords,i.board)),i},coordsArray:function(t,e){var i;return(i=s.A.isArray(t)?t:this.coords(t).usrCoords).length<3&&i.unshift(1),e&&(i=[i[0],i[1],i[2]]),i}};let a=r.A.Expect},11701:(t,e,i)=>{i.d(e,{A:()=>u});var r=i(76422),s=i(16100),o=i(46693),n=i(97272),a=i(86385),h=i(28279),l=i(13291),c=i(20708),d=i(64657);r.A.GeometryElement=function(t,e,i,r){var o,n,a;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.transformations=[],this.baseElement=null,this.descendants={},this.ancestors={},this.parents=[],this.symbolic={},this.rendNode=null,this.elType="",this.dump=!0,this.subs={},this.inherits=[],this._pos=-1,this.stdform=[1,0,0,0,1,1,0,0],this.methodMap={setLabel:"setLabel",label:"label",setName:"setName",getName:"getName",Name:"getName",addTransform:"addTransform",setProperty:"setAttribute",setAttribute:"setAttribute",addChild:"addChild",animate:"animate",on:"on",off:"off",trigger:"trigger",addTicks:"addTicks",removeTicks:"removeTicks",removeAllTicks:"removeAllTicks",Bounds:"bounds"},this.quadraticform=[[1,0,0],[0,1,0],[0,0,1]],this.visProp={},this.visPropCalc={visible:!1},l.A.eventify(this),this.mouseover=!1,this.lastDragTime=new Date,this.view=null,arguments.length>0){for(n in this.board=t,this.type=i,this._org_type=i,this.elementClass=r||s.A.OBJECT_CLASS_OTHER,this.id=e.id,o=e.name,d.A.exists(o)||(o=this.board.generateName(this)),""!==o&&(this.board.elementsByName[o]=this),this.name=o,this.needsRegularUpdate=e.needsregularupdate,d.A.clearVisPropOld(this),a=this.resolveShortcuts(e))a.hasOwnProperty(n)&&this._set(n,a[n]);this.visProp.draft=a.draft&&a.draft.draft}},r.A.extend(r.A.GeometryElement.prototype,{addChild:function(t){var e,i;for(e in this.childElements[t.id]=t,this.addDescendants(t),t.ancestors[this.id]=this,this.descendants)if(this.descendants.hasOwnProperty(e))for(i in this.descendants[e].ancestors[this.id]=this,this.ancestors)this.ancestors.hasOwnProperty(i)&&(this.descendants[e].ancestors[this.ancestors[i].id]=this.ancestors[i]);for(e in this.ancestors)if(this.ancestors.hasOwnProperty(e))for(i in this.descendants)this.descendants.hasOwnProperty(i)&&(this.ancestors[e].descendants[this.descendants[i].id]=this.descendants[i]);return this},addDescendants:function(t){var e;for(e in this.descendants[t.id]=t,t.childElements)t.childElements.hasOwnProperty(e)&&this.addDescendants(t.childElements[e]);return this},addParents:function(t){var e,i,r;for(e=0,r=d.A.isArray(t)?t:arguments,i=r.length;e<i;++e)d.A.exists(r[e])&&(d.A.isId(this.board,r[e])?this.parents.push(r[e]):d.A.exists(r[e].id)&&this.parents.push(r[e].id));this.parents=d.A.uniqueArray(this.parents)},setParents:function(t){this.parents=[],this.addParents(t)},addParentsFromJCFunctions:function(t){var e,i,r;for(e=0;e<t.length;e++)for(i in t[e].deps)r=t[e].deps[i],this.addParents(r),r.addChild(this);return this},removeChild:function(t){return delete this.childElements[t.id],this.removeDescendants(t),delete t.ancestors[this.id],this},removeDescendants:function(t){var e;for(e in delete this.descendants[t.id],t.childElements)t.childElements.hasOwnProperty(e)&&this.removeDescendants(t.childElements[e]);return this},countChildren:function(){var t,e,i=0;for(t in e=this.childElements)e.hasOwnProperty(t)&&0>t.indexOf("Label")&&i++;return i},getName:function(){return this.name},addTransform:function(t){return this},draggable:function(){return this.isDraggable&&!this.evalVisProp("fixed")&&this.type!==s.A.OBJECT_TYPE_GLIDER},setPosition:function(t,e){var i,r,o,n,a=[];if(!d.A.exists(this.parents))return this;for(r=0,o=this.parents.length;r<o;
1++r)if(i=this.board.select(this.parents[r]),d.A.isPoint(i)){if(!i.draggable())return this;a.push(i)}if(3===e.length&&(e=e.slice(1)),n=this.board.create("transform",e,{type:"translate"}),(o=a.length)>0){if(n.applyOnce(a),d.A.exists(this.view)&&"view3d"===this.view.elType)for(r=0;r<this.parents.length;++r)i=this.view.select(this.parents[r]),d.A.exists(i.setPosition2D)&&i.setPosition2D(n)}else this.transformations.length>0&&this.transformations[this.transformations.length-1].isNumericMatrix?this.transformations[this.transformations.length-1].melt(n):this.addTransform(n);for(r=0;r<o;++r)a[r].type===s.A.OBJECT_TYPE_GLIDER&&a[r].updateGlider();return this},setPositionDirectly:function(t,e,i){var r=new o.A(t,e,this.board,!1),n=new o.A(t,i,this.board,!1),h=a.A.subtract(r.usrCoords,n.usrCoords);return this.setPosition(s.A.COORDS_BY_USER,h),this},generatePolynomial:function(){return[]},animate:function(t,e,i){i=i||{};var r,s,o,n=Math.ceil(e/this.board.attr.animationdelay),a=this,h=function(t,e,i){var r,s,h,l,d;for(o=0,r=c.A.rgb2hsv(t),h=((s=c.A.rgb2hsv(e))[0]-r[0])/n,l=(s[1]-r[1])/n,d=(s[2]-r[2])/n,a.animationData[i]=[];o<n;o++)a.animationData[i][n-o-1]=c.A.hsv2rgb(r[0]+(o+1)*h,r[1]+(o+1)*l,r[2]+(o+1)*d)},l=function(t,e,i,r){var s,h;if(t=parseFloat(t),e=parseFloat(e),!(isNaN(t)||isNaN(e)))for(o=0,h=(e-t)/n,a.animationData[i]=[];o<n;o++)s=t+(o+1)*h,a.animationData[i][n-o-1]=r?Math.floor(s):s};for(r in this.animationData={},t)if(t.hasOwnProperty(r))switch(s=r.toLowerCase()){case"strokecolor":case"fillcolor":h(this.visProp[s],t[r],s);break;case"size":if(!d.A.isPoint(this))break;l(this.visProp[s],t[r],s,!0);break;case"strokeopacity":case"strokewidth":case"fillopacity":l(this.visProp[s],t[r],s,!1)}return this.animationCallback=i.callback,this.board.addAnimation(this),this},update:function(){return this.evalVisProp("trace")&&this.cloneToBackground(),this},updateRenderer:function(){return this},fullUpdate:function(t){return this.prepareUpdate().update().updateVisibility(t).updateRenderer()},setDisplayRendNode:function(t){var e,i,r,s,o;if(void 0===t&&(t=this.visPropCalc.visible),t===this.visPropOld.visible)return this;for(this.board.renderer.display(this,t),i=this.inherits.length,r=0;r<i;r++)if(o=this.inherits[r],d.A.isArray(o))for(e=0,s=o.length;e<s;e++)d.A.exists(o[e])&&d.A.exists(o[e].rendNode)&&"inherit"===o[e].evalVisProp("visible")&&o[e].setDisplayRendNode(t);else d.A.exists(o)&&d.A.exists(o.rendNode)&&"inherit"===o.evalVisProp("visible")&&o.setDisplayRendNode(t);return this.hasLabel&&d.A.exists(this.label)&&d.A.exists(this.label.rendNode)&&"inherit"===this.label.evalVisProp("visible")&&this.label.setDisplayRendNode(t),this},hide:function(){return this.setAttribute({visible:!1}),this},hideElement:function(){return this.hide(),this},show:function(){return this.setAttribute({visible:!0}),this},showElement:function(){return this.show(),this},updateVisibility:function(t){var e,i,r,s,o,n;if(this.needsUpdate){if(d.A.exists(this.view)&&!1===this.view.evalVisProp("visible"))this.visPropCalc.visible=!1;else for(void 0!==t?this.visPropCalc.visible=t:(n=this.evalVisProp("visible"),d.A.exists(this.hiddenByParent)&&this.hiddenByParent&&(n=!1),"inherit"!==n&&(this.visPropCalc.visible=n)),i=this.inherits.length,r=0;r<i;r++)if(o=this.inherits[r],d.A.isArray(o))for(e=0,s=o.length;e<s;e++)d.A.exists(o[e])&&"inherit"===o[e].evalVisProp("visible")&&o[e].prepareUpdate().updateVisibility(this.visPropCalc.visible);else d.A.exists(o)&&"inherit"===o.evalVisProp("visible")&&o.prepareUpdate().updateVisibility(this.visPropCalc.visible);d.A.exists(this.label)&&d.A.exists(this.label.visProp)&&this.label.evalVisProp("visible")&&this.label.prepareUpdate().updateVisibility(this.visPropCalc.visible)}return this},_set:function(t,e){var i;if(t=t.toLocaleLowerCase(),this.visProp.hasOwnProperty(t)&&t.indexOf("color")>=0&&d.A.isString(e)&&9===e.length&&"#"===e.charAt(0))e=c.A.rgba2rgbo(e),this.visProp[t]=e[0],this.visProp[t.replace("color","opacity")]=e[1];else if(null!==e&&d.A.isObject(e)&&!d.A.exists(e.id)&&!d.A.exists(e.name))for(i in this.visProp[t]={},e)e.hasOwnProperty(i)&&(this.visProp[t][i.toLocaleLowerCase()]=e[i]);else this.visProp[t]=e},resolveShortcuts:function(t){var e,i,r,s=["traceattributes","traceAttributes"];for(e in h.A.shortcuts)if(h.A.shortcuts.hasOwnProperty(e)){if(d.A.exists(t[e]))for(i=0;i<h.A.shortcuts[e].length;i++)d.A.exists(t[h.A.shortcuts[e][i]])||(t[h.A.shortcuts[e][i]]=t[e]);for(r=0;r<s.length;r++)d.A.isObject(t[s[r]])&&(t[s[r]]=this.resolveShortcuts(t[s[r]]))}return t},setLabel:function(t){this.hasLabel||this.setAttribute({withlabel:!0}),this.setLabelText(t)}
1,setLabelText:function(t){return d.A.exists(this.label)&&(t=t.replace(/</g,"<").replace(/>/g,">"),this.label.setText(t)),this},setName:function(t){t=t.replace(/</g,"<").replace(/>/g,">"),"slider"!==this.elType&&this.setLabelText(t),this.setAttribute({name:t})},setProperty:function(){r.A.deprecated("setProperty()","setAttribute()"),this.setAttribute.apply(this,arguments)},setAttribute:function(t){var e,i,o,n,a,l,u,p,f,A={};for(e=0;e<arguments.length;e++)l=arguments[e],d.A.isString(l)?(p=l.split(":"),A[d.A.trim(p[0])]=d.A.trim(p[1])):d.A.isArray(l)?A[l[0]]=l[1]:r.A.extend(A,l);for(e in A=this.resolveShortcuts(A))if(A.hasOwnProperty(e)){if(n=e.replace(/\s+/g,"").toLowerCase(),a=A[e],d.A.isObject(a)&&d.A.exists(this.visProp[n])){if(!d.A.isObject(this.visProp[n])&&null!==a&&d.A.isObject(a)&&(this.visProp[n]={}),d.A.mergeAttr(this.visProp[n],a),this.type===s.A.OBJECT_TYPE_TICKS&&d.A.exists(this.labels))for(i=0,o=this.labels.length;i<o;i++)this.labels[i].setAttribute(a);else if(d.A.exists(this[n]))if(d.A.isArray(this[n]))for(i=0;i<this[n].length;i++)this[n][i].setAttribute(a);else this[n].setAttribute(a);else f=null,this.triggerEventHandlers(["attribute:"+n],[f,a,this]);continue}switch(f=this.visProp[n],n){case"checked":d.A.exists(this.rendNodeTag)&&(this.rendNodeCheckbox.checked=!!a);break;case"disabled":d.A.exists(this.rendNodeTag)&&(this.rendNodeTag.disabled=!!a);break;case"face":d.A.isPoint(this)&&(this.visProp.face=a,this.board.renderer.changePointStyle(this));break;case"generatelabelvalue":this.type===s.A.OBJECT_TYPE_TICKS&&d.A.isFunction(a)&&(this.generateLabelValue=a);break;case"gradient":this.visProp.gradient=a,this.board.renderer.setGradient(this);break;case"gradientsecondcolor":a=c.A.rgba2rgbo(a),this.visProp.gradientsecondcolor=a[0],this.visProp.gradientsecondopacity=a[1],this.board.renderer.updateGradient(this);break;case"gradientsecondopacity":this.visProp.gradientsecondopacity=a,this.board.renderer.updateGradient(this);break;case"infoboxtext":d.A.isString(a)?this.infoboxText=a:this.infoboxText=!1;break;case"labelcolor":u=(a=c.A.rgba2rgbo(a))[1],a=a[0],0===u&&d.A.exists(this.label)&&this.hasLabel&&this.label.hideElement(),d.A.exists(this.label)&&this.hasLabel&&(this.label.visProp.strokecolor=a,this.board.renderer.setObjectStrokeColor(this.label,a,u)),this.elementClass===s.A.OBJECT_CLASS_TEXT&&(this.visProp.strokecolor=a,this.visProp.strokeopacity=u,this.board.renderer.setObjectStrokeColor(this,a,u));break;case"layer":this.board.renderer.setLayer(this,this.eval(a)),this._set(n,a);break;case"maxlength":d.A.exists(this.rendNodeTag)&&(this.rendNodeTag.maxlength=!!a);break;case"name":f=this.name,delete this.board.elementsByName[this.name],this.name=a,this.board.elementsByName[this.name]=this;break;case"needsregularupdate":this.needsRegularUpdate="false"!==a&&!1!==a,this.board.renderer.setBuffering(this,this.needsRegularUpdate?"auto":"static");break;case"onpolygon":this.type===s.A.OBJECT_TYPE_GLIDER&&(this.onPolygon=!!a);break;case"radius":(this.type===s.A.OBJECT_TYPE_ANGLE||this.type===s.A.OBJECT_TYPE_SECTOR)&&this.setRadius(a);break;case"rotate":(this.elementClass===s.A.OBJECT_CLASS_TEXT&&"internal"===this.evalVisProp("display")||this.type===s.A.OBJECT_TYPE_IMAGE)&&this.addRotation(a);break;case"tabindex":d.A.exists(this.rendNode)&&(this.rendNode.setAttribute("tabindex",a),this._set(n,a));break;case"trace":"false"===a||!1===a?(this.clearTrace(),this.visProp.trace=!1):"pause"===a?this.visProp.trace=!1:this.visProp.trace=!0;break;case"visible":"false"===a?this.visProp.visible=!1:"true"===a?this.visProp.visible=!0:this.visProp.visible=a,this.setDisplayRendNode(this.evalVisProp("visible")),this.evalVisProp("visible")&&d.A.exists(this.updateSize)&&this.updateSize();break;case"withlabel":this.visProp.withlabel=a,this.evalVisProp("withlabel")?(this.label||this.createLabel(),this.label.setAttribute({visible:"inherit"})):this.label&&this.hasLabel&&this.label.setAttribute({visible:!1}),this.hasLabel=a;break;case"straightfirst":case"straightlast":for(i in this._set(n,a),this.childElements)this.childElements.hasOwnProperty(i)&&"glider"===this.childElements[i].elType&&this.childElements[i].fullUpdate();break;default:d.A.exists(this.visProp[n])&&(!r.A.Validator[n]||r.A.Validator[n]&&r.A.Validator[n](a)||r.A.Validator[n]&&d.A.isFunction(a)&&r.A.Validator[n](a(this)))?(a=(!a.toLowerCase||"false"!==a.toLowerCase())&&a,this._set(n,a)):n in h.A.shortcuts||r.A.warn("attribute '"+n+"' does not accept type '"+typeof a+"' of value "+a+".")}this.triggerEventHandlers(["attribute:"+n],[f,a,this])}return this.triggerEventHandlers(["attribute"],[A,this]),this.evalVisProp("needsregularupdate")?this.board.update(this):this.board.fullUpdate(),this.elementClass===s.A.OBJECT_CLASS_TEXT&&this.updateSize(),this},getProperty:function(){r.A.deprecated("getProperty()","getAttribute()"),this.getProperty.apply(this,arguments)},getAttribute:function(t){var e;switch(t=t.toLowerCase()){case"needsregularupdate":e=this.needsRegularUpdate;break;case"labelcolor":e=this.label.visProp.strokecolor;break;case"infoboxtext":e=this.infoboxText;break;case"withlabel":e=this.hasLabel;break;default:e=this.visProp[t]}return e},evalVisProp:function(t){var e,i,s,o;if(-1===(t=t.toLowerCase()).indexOf("."))e=this.visProp[t];else for(s=0,o=(i=t.split(".")).length,e=this.visProp;s<o;s++)e=e[i[s]];if(r.A.isFunction(e))return!0===this.visProp.islabel&&d.A.exists(this.visProp.anchor)?e(null!==this.visProp.anchor.visProp.element3d?this.visProp.anchor.visProp.element3d:this.visProp.anchor):e(r.A.exists(this.visProp.element3d)?this.visProp.element3d:this);return e},eval:function(t){if(r.A.isFunction(t))return!0===this.visProp.islabel&&d.A.exists(this.visProp.anchor)?t(null!==this.visProp.anchor.visProp.element3d?this.visProp.anchor.visProp.element3d:this.visProp.anchor):t(null!==this.visProp.element3d?this.visProp.element3d:this);return t},setDash:function(t){return this.setAttribute({dash:t}),this},prepareUpdate:function(){return this.needsUpdate=!0,this},remove:function(){return this.board.renderer.remove(this.rendNode),this.hasLabel&&this.board.renderer.remove(this.board.renderer.getElementById(this.label.id)),this},getTextAnchor:function(){return new o.A(s.A.COORDS_BY_USER,[0,0],this.board)},getLabelAnchor:function(){return new o.A(s.A.COORDS_BY_USER,[0,0],this.board)},setArrow:function(t,e){return this.visProp.firstarrow=t,this.visProp.lastarrow=e,e&&(this.t
1ype=s.A.OBJECT_TYPE_VECTOR,this.elType="arrow"),this.prepareUpdate().update().updateVisibility().updateRenderer(),this},createGradient:function(){var t=this.evalVisProp("gradient");("linear"===t||"radial"===t)&&this.board.renderer.setGradient(this)},createLabel:function(){var t,e=this;return r.A.elements.text?((t=d.A.deepCopy(this.visProp.label,null)).id=this.id+"Label",t.isLabel=!0,t.anchor=this,t.priv=this.visProp.priv,this.visProp.withlabel&&(this.label=r.A.elements.text(this.board,[0,0,function(){return d.A.isFunction(e.name)?e.name(e):e.name}],t),this.label.needsUpdate=!0,this.label.dump=!1,this.label.fullUpdate(),this.hasLabel=!0)):r.A.debug("JSXGraph: Can't create label: text element is not available. Make sure you include base/text"),this},highlight:function(t){return t=d.A.def(t,!1),this.evalVisProp("highlight")&&(!this.highlighted||t)&&(this.highlighted=!0,this.board.highlightedObjects[this.id]=this,this.board.renderer.highlight(this)),this},noHighlight:function(){return this.highlighted&&(this.highlighted=!1,delete this.board.highlightedObjects[this.id],this.board.renderer.noHighlight(this)),this},clearTrace:function(){var t;for(t in this.traces)this.traces.hasOwnProperty(t)&&this.board.renderer.remove(this.traces[t]);return this.numTraces=0,this},cloneToBackground:function(){return this},bounds:function(){return[0,0,0,0]},normalize:function(){return this.stdform=n.A.normalize(this.stdform),this},toJSON:function(){var t,e,i=['{"name":',this.name];for(e in i.push(', "id":'+this.id),t=[],this.visProp)this.visProp.hasOwnProperty(e)&&d.A.exists(this.visProp[e])&&t.push('"'+e+'":'+this.visProp[e]);return i.push(', "visProp":{'+t.toString()+"}"),i.push("}"),i.join("")},addRotation:function(t){var e,i,r,o,n,a=this;return(this.elementClass===s.A.OBJECT_CLASS_TEXT||this.type===s.A.OBJECT_TYPE_IMAGE)&&0!==t&&(e=this.board.create("transform",[function(){return-a.X()},function(){return-a.Y()}],{type:"translate"}),i=this.board.create("transform",[function(){return a.X()},function(){return a.Y()}],{type:"translate"}),r=this.board.create("transform",[function(){return a.board.unitX/a.board.unitY},function(){return 1}],{type:"scale"}),o=this.board.create("transform",[function(){return a.board.unitY/a.board.unitX},function(){return 1}],{type:"scale"}),n=this.board.create("transform",[function(){return a.eval(t)*Math.PI/180}],{type:"rotate"}),e.bindTo(this),r.bindTo(this),n.bindTo(this),o.bindTo(this),i.bindTo(this)),this},highlightStrokeColor:function(t){return r.A.deprecated("highlightStrokeColor()","setAttribute()"),this.setAttribute({highlightStrokeColor:t}),this},strokeColor:function(t){return r.A.deprecated("strokeColor()","setAttribute()"),this.setAttribute({strokeColor:t}),this},strokeWidth:function(t){return r.A.deprecated("strokeWidth()","setAttribute()"),this.setAttribute({strokeWidth:t}),this},fillColor:function(t){return r.A.deprecated("fillColor()","setAttribute()"),this.setAttribute({fillColor:t}),this},highlightFillColor:function(t){return r.A.deprecated("highlightFillColor()","setAttribute()"),this.setAttribute({highlightFillColor:t}),this},labelColor:function(t){return r.A.deprecated("labelColor()","setAttribute()"),this.setAttribute({labelColor:t}),this},dash:function(t){return r.A.deprecated("dash()","setAttribute()"),this.setAttribute({dash:t}),this},visible:function(t){return r.A.deprecated("visible()","setAttribute()"),this.setAttribute({visible:t}),this},shadow:function(t){return r.A.deprecated("shadow()","setAttribute()"),this.setAttribute({shadow:t}),this},getType:function(){return this.elType},getParents:function(){return d.A.isArray(this.parents)?this.parents:[]},snapToGrid:function(){return this},snapToPoints:function(){return this},getAttributes:function(){var t,e=d.A.deepCopy(this.visProp),i=[],r=i.length;for(t=0,e.id=this.id,e.name=this.name;t<r;t++)delete e[i[t]];return e},hasPoint:function(t,e){return!1},addTicks:function(t){return""!==t.id&&d.A.exists(t.id)||(t.id=this.id+"_ticks_"+(this.ticks.length+1)),this.board.renderer.drawTicks(t),this.ticks.push(t),t.id},removeAllTicks:function(){var t;if(d.A.exists(this.ticks)){for(t=this.ticks.length-1;t>=0;t--)this.removeTicks(this.ticks[t]);this.ticks=[],this.board.update()}},removeTicks:function(t){var e,i;if(d.A.exists(this.defaultTicks)&&this.defaultTicks===t&&(this.defaultTicks=null),d.A.exists(this.ticks)){for(e=this.ticks.length-1;e>=0;e--)if(this.ticks[e]===t){if(this.board.removeObject(this.ticks[e]),this.ticks[e].ticks)for(i=0;i<this.ticks[e].ticks.length;i++)d.A.exists(this.ticks[e].labels[i])&&this.board.removeObject(this.ticks[e].labels[i]);delete this.ticks[e];break}}},getSnapSizes:function(){var t,e,i;return t=this.evalVisProp("snapsizex"),e=this.evalVisProp("snapsizey"),t<=0&&this.board.defaultAxes&&this.board.defaultAxes.x.defaultTicks&&(t=(i=this.board.defaultAxes.x.defaultTicks).ticksDelta*(i.evalVisProp("minorticks")+1)),e<=0&&this.board.defaultAxes&&this.board.defaultAxes.y.defaultTicks&&(e=(i=this.board.defaultAxes.y.defaultTicks).ticksDelta*(i.evalVisProp("minorticks")+1)),[t,e]}
1,handleSnapToGrid:function(t,e){var i,o,n,a,h,l,c,u,p,f,A,m=!1,b=this.evalVisProp("attracttogrid"),g=this.evalVisProp("attractorunit"),v=this.evalVisProp("attractordistance");return!d.A.exists(this.coords)||this.evalVisProp("fixed")||(m=this.evalVisProp("snaptogrid")||b||!0===t)&&(i=this.coords.usrCoords[1],o=this.coords.usrCoords[2],f=(p=this.getSnapSizes())[0],A=p[1],f>0&&A>0&&(u=this.board.getBoundingBox(),n=Math.round(i/f)*f,a=Math.round(o/A)*A,h=new r.A.Coords(s.A.COORDS_BY_USER,[n,a],this.board),(!b||h.distance("screen"===g?s.A.COORDS_BY_SCREEN:s.A.COORDS_BY_USER,this.coords)<v)&&(i=n,o=a,!e&&(l=Math.min(u[0],u[2]),c=Math.max(u[0],u[2]),i<l&&i>l-f?i+=f:i>c&&i<c+f&&(i-=f),l=Math.min(u[1],u[3]),c=Math.max(u[1],u[3]),o<l&&o>l-A?o+=A:o>c&&o<c+A&&(o-=A)),this.coords.setCoordinates(s.A.COORDS_BY_USER,[i,o])))),this},getBoundingBox:function(){var t,e,i,r,o,n,a=[1/0,1/0,-1/0,-1/0];if(this.type===s.A.OBJECT_TYPE_POLYGON){if((e=this.vertices.length-1)<=0)return a;for(t=0;t<e;t++)i=this.vertices[t].X(),a[0]=i<a[0]?i:a[0],a[2]=i>a[2]?i:a[2],i=this.vertices[t].Y(),a[1]=i<a[1]?i:a[1],a[3]=i>a[3]?i:a[3]}else if(this.elementClass===s.A.OBJECT_CLASS_CIRCLE)r=this.center.X(),o=this.center.Y(),a=[r-this.radius,o+this.radius,r+this.radius,o-this.radius];else if(this.elementClass===s.A.OBJECT_CLASS_CURVE){if(0===(e=this.points.length))return a;for(t=0;t<e;t++)i=this.points[t].usrCoords[1],a[0]=i<a[0]?i:a[0],a[2]=i>a[2]?i:a[2],i=this.points[t].usrCoords[1],a[1]=i<a[1]?i:a[1],a[3]=i>a[3]?i:a[3]}else this.elementClass===s.A.OBJECT_CLASS_POINT&&(r=this.X(),o=this.Y(),a=[r-(n=this.evalVisProp("size"))/this.board.unitX,o-n/this.board.unitY,r+n/this.board.unitX,o+n/this.board.unitY]);return a},addEvent:r.A.shortcut(r.A.GeometryElement.prototype,"on"),removeEvent:r.A.shortcut(r.A.GeometryElement.prototype,"off"),formatNumberLocale:function(t,e){var i,r,s,o={},n={maximumfractiondigits:"maximumFractionDigits",minimumfractiondigits:"minimumFractionDigits",compactdisplay:"compactDisplay",currencydisplay:"currencyDisplay",currencysign:"currencySign",localematcher:"localeMatcher",numberingsystem:"numberingSystem",signdisplay:"signDisplay",unitdisplay:"unitDisplay",usegrouping:"useGrouping",roundingmode:"roundingMode",roundingpriority:"roundingPriority",roundingincrement:"roundingIncrement",trailingzerodisplay:"trailingZeroDisplay",minimumintegerdigits:"minimumIntegerDigits",minimumsignificantdigits:"minimumSignificantDigits",maximumsignificantdigits:"maximumSignificantDigits"};if(d.A.exists(Intl)&&this.useLocale()){for(s in i=this.evalVisProp("intl.locale")||this.eval(this.board.attr.intl.locale),r=this.evalVisProp("intl.options")||{})r.hasOwnProperty(s)&&(n.hasOwnProperty(s)?o[n[s]]=this.eval(r[s]):o[s]=this.eval(r[s]));return s="maximumfractiondigits",d.A.exists(r[s])||(o[n[s]]=e),Intl.NumberFormat(i,o).format(t)}return t},useLocale:function(){var t;return!!d.A.exists(this.visProp.intl)&&!!d.A.exists(this.visProp.intl.enabled)&&(!0===(t=this.evalVisProp("intl.enabled"))||"inherit"===t&&!0===this.eval(this.board.attr.intl.enabled))},__evt__over:function(t){},__evt__mouseover:function(t){},__evt__out:function(t){},__evt__mouseout:function(t){},__evt__move:function(t){},__evt__mousemove:function(t){},__evt__drag:function(t){},__evt__mousedrag:function(t){},__evt__pendrag:function(t){},__evt__touchdrag:function(t){},__evt__keydrag:function(t){},__evt__down:function(t){},__evt__mousedown:function(t){},__evt__pendown:function(t){},__evt__touchdown:function(t){},__evt__click:function(t){},__evt__dblclick:function(t){},__evt__mouseclick:function(t){},__evt__mousedblclick:function(t){},__evt__pointerclick:function(t){},__evt__pointerdblclick:function(t){},__evt__up:function(t){},__evt__mouseup:function(t){},__evt__penup:function(t){},__evt__touchup:function(t){},__evt__attribute:function(t,e){},__evt__attribute_:function(t,e,i){},__evt:function(){}});let u=r.A.GeometryElement},13291:(t,e,i)=>{i.d(e,{A:()=>o});var r=i(76422),s=i(64657);r.A.EventEmitter={eventHandlers:{},suspended:{},trigger:function(t,e){var i,r,s,o,n,a;for(r=0,n=t.length;r<n;r++)if(o=this.eventHandlers[t[r]],!this.suspended[t[r]]){if(this.suspended[t[r]]=!0,o)for(i=0,a=o.length;i<a;i++)(s=o[i]).handler.apply(s.context,e);this.suspended[t[r]]=!1}return this}
1,on:function(t,e,i){return s.A.isArray(this.eventHandlers[t])||(this.eventHandlers[t]=[]),i=s.A.def(i,this),this.eventHandlers[t].push({handler:e,context:i}),this},off:function(t,e){var i;return t&&s.A.isArray(this.eventHandlers[t])&&(e?((i=s.A.indexOf(this.eventHandlers[t],e,"handler"))>-1&&this.eventHandlers[t].splice(i,1),0===this.eventHandlers[t].length&&delete this.eventHandlers[t]):delete this.eventHandlers[t]),this},eventify:function(t){t.eventHandlers={clicks:0},t.on=this.on,t.off=this.off,t.triggerEventHandlers=this.trigger,t.trigger=this.trigger,t.suspended={}}};let o=r.A.EventEmitter},16100:(t,e,i)=>{i.d(e,{A:()=>a});var r,s=i(76422),o="",n="1.11.1"+(o?"-"+o:"");r={version:n,licenseText:"JSXGraph v"+n+" Copyright (C) see https://jsxgraph.org",COORDS_BY_USER:1,COORDS_BY_SCREEN:2,OBJECT_TYPE_ARC:1,OBJECT_TYPE_ARROW:2,OBJECT_TYPE_AXIS:3,OBJECT_TYPE_AXISPOINT:4,OBJECT_TYPE_TICKS:5,OBJECT_TYPE_CIRCLE:6,OBJECT_TYPE_CONIC:7,OBJECT_TYPE_CURVE:8,OBJECT_TYPE_GLIDER:9,OBJECT_TYPE_IMAGE:10,OBJECT_TYPE_LINE:11,OBJECT_TYPE_POINT:12,OBJECT_TYPE_SLIDER:13,OBJECT_TYPE_CAS:14,OBJECT_TYPE_GXTCAS:15,OBJECT_TYPE_POLYGON:16,OBJECT_TYPE_SECTOR:17,OBJECT_TYPE_TEXT:18,OBJECT_TYPE_ANGLE:19,OBJECT_TYPE_INTERSECTION:20,OBJECT_TYPE_TURTLE:21,OBJECT_TYPE_VECTOR:22,OBJECT_TYPE_OPROJECT:23,OBJECT_TYPE_GRID:24,OBJECT_TYPE_TANGENT:25,OBJECT_TYPE_HTMLSLIDER:26,OBJECT_TYPE_CHECKBOX:27,OBJECT_TYPE_INPUT:28,OBJECT_TYPE_BUTTON:29,OBJECT_TYPE_TRANSFORMATION:30,OBJECT_TYPE_FOREIGNOBJECT:31,OBJECT_TYPE_VIEW3D:32,OBJECT_TYPE_POINT3D:33,OBJECT_TYPE_LINE3D:34,OBJECT_TYPE_PLANE3D:35,OBJECT_TYPE_CURVE3D:36,OBJECT_TYPE_SURFACE3D:37,OBJECT_TYPE_MEASUREMENT:38,OBJECT_TYPE_INTERSECTION_LINE3D:39,OBJECT_TYPE_SPHERE3D:40,OBJECT_TYPE_CIRCLE3D:41,OBJECT_TYPE_INTERSECTION_CIRCLE3D:42,OBJECT_TYPE_TEXT3D:43,OBJECT_TYPE_FACE3D:44,OBJECT_TYPE_POLYHEDRON3D:45,OBJECT_TYPE_POLYGON3D:46,OBJECT_CLASS_POINT:1,OBJECT_CLASS_LINE:2,OBJECT_CLASS_CIRCLE:3,OBJECT_CLASS_CURVE:4,OBJECT_CLASS_AREA:5,OBJECT_CLASS_OTHER:6,OBJECT_CLASS_TEXT:7,OBJECT_CLASS_3D:8},s.A.extendConstants(s.A,r);let a=r},19806:(t,e,i)=>{i.r(e),i.d(e,{Board:()=>tm,COORDS_BY_SCREEN:()=>to,COORDS_BY_USER:()=>tn,Chart:()=>tb,Circle:()=>tg,Complex:()=>tv,Composition:()=>ty,Coords:()=>tC,CoordsElement:()=>t_,Curve:()=>tP,Dump:()=>ta,Expect:()=>th,GeometryElement:()=>tx,Group:()=>tE,Image:()=>tS,JSXGraph:()=>tl,JessieCode:()=>tN,LMS2rgb:()=>tI,Line:()=>tw,Mat:()=>tc,Options:()=>td,Point:()=>tO,Polygon:()=>tM,Prefix:()=>tT,Text:()=>tk,Ticks:()=>tD,Transformation:()=>tR,Turtle:()=>tL,View3D:()=>tB,addEvent:()=>tV,autoDigits:()=>tY,autoHighlight:()=>tj,bind:()=>tX,boards:()=>tu,capitalize:()=>tF,clearVisPropOld:()=>tJ,clone:()=>tU,cloneAndCopy:()=>tz,cmpArrays:()=>tG,coordsArrayToMatrix:()=>tH,copyAttributes:()=>t$,createEvalFunction:()=>tW,createFunction:()=>tq,createHTMLSlider:()=>tZ,darkenColor:()=>tQ,debug:()=>tK,debugInt:()=>t0,debugLine:()=>t1,debugWST:()=>t2,deepCopy:()=>t3,def:()=>t5,default:()=>ic,deprecated:()=>t4,elements:()=>tp,eliminateDuplicates:()=>t6,escapeHTML:()=>t7,evalSlider:()=>t8,evaluate:()=>t9,filterElements:()=>et,getBoardByContainerId:()=>ee,getCSSTransform:()=>er,getCSSTransformMatrix:()=>ei,getDimensions:()=>es,getOffset:()=>eo,getPosition:()=>en,getProp:()=>ea,hex2rgb:()=>eh,hsv2rgb:()=>el,isAndroid:()=>ec,isApple:()=>ed,isArray:()=>eu,isBoard:()=>ev,isDesktop:()=>ep,isInArray:()=>ef,isInObject:()=>eA,isMetroApp:()=>em,isMobile:()=>eb,isMozilla:()=>eg,isName:()=>ey,isNode:()=>eC,isNumber:()=>e_,isObject:()=>eP,isPoint:()=>ex,isPoint3D:()=>eE,isPointType:()=>eS,isPointType3D:()=>eN,isString:()=>eT,isTouchDevice:()=>ew,isTransformationOrArray:()=>eO,isWebWorker:()=>eM,isWebkitAndroid:()=>ek,isWebkitApple:()=>eD,keys:()=>eR,lightenColor:()=>eL,merge:()=>eB,normalizePointFace:()=>eI,palette:()=>tf,paletteWong:()=>tA,providePoints:()=>eV,registerElement:()=>eY,registerReader:()=>ej,removeAllEvents:()=>eX,removeElementFromArray:()=>eF,removeEvent:()=>eJ,rgb2LMS:()=>eU,rgb2bw:()=>ez,rgb2cb:()=>eG,rgb2css:()=>eH,rgb2hex:()=>e$,rgb2hsv:()=>eW,rgb2rgba:()=>eQ,rgb2rgbo:()=>eZ,rgbParser:()=>eq,sanitizeHTML:()=>eK,shortcut:()=>e0,strBool:()=>e1,supportsCanvas:()=>e2,supportsPointerEvents:()=>e3,supportsSVG:()=>e5,supportsVML:()=>e4,swap:()=>e6,timeChunk:()=>e7,toFixed:()=>e8,toFullscreen:()=>e9,toJSON:()=>it,trim:()=>ie,trimNumber:()=>ii,truncate:()=>ir,unescapeHTML:()=>is,uniqueArray:()=>io,useBlackWhiteOptions:()=>ia,useStandardOptions:()=>ih,warn:()=>il});var r=i(76422),s=i(94768),o=i(16100),n=i(64657);r.A.XML={cleanWhitespace:function(t){for(var e=t.firstChild;n.A.exists(e);
1)3!==e.nodeType||/\S/.test(e.nodeValue)?1===e.nodeType&&this.cleanWhitespace(e):t.removeChild(e),e=e.nextSibling},parse:function(t){var e,i;return e=new(i="function"==typeof DOMParser||"object"==typeof DOMParser?DOMParser:function(){this.parseFromString=function(t){var e;return"function"==typeof ActiveXObject&&(e=new ActiveXObject("MSXML.DomDocument")).loadXML(t),e}})().parseFromString(t,"text/xml"),this.cleanWhitespace(e),e}},r.A.XML,i(13291),i(5964);var a=i(97272);a.A.ProbFuncs={MAXNUM:17014118346046923e22,SQRTH:.7071067811865476,SQRT2:1.4142135623730951,MAXLOG:708.3964185322641,P:[2461969814735305e-25,.5641895648310689,7.463210564422699,48.63719709856814,196.5208329560771,526.4451949954773,934.5285271719576,1027.5518868951572,557.5353353693994],Q:[13.228195115474499,86.70721408859897,354.9377788878199,975.7085017432055,1823.9091668790973,2246.3376081871097,1656.6630919416134,557.5353408177277],R:[.5641895835477551,1.275366707599781,5.019050422511805,6.160210979930536,7.4097426995044895,2.9788666537210022],S:[2.2605286322011726,9.396035249380015,12.048953980809666,17.08144507475659,9.608968090632859,3.369076451000815],T:[9.604973739870516,90.02601972038427,2232.005345946843,7003.325141128051,55592.30130103949],U:[33.56171416475031,521.3579497801527,4594.323829709801,22629.000061389095,49267.39426086359],M:128,MINV:.0078125,expx2:function(t,e){var i,r,s,o;return(t=Math.abs(t),e<0&&(t=-t),s=this.MINV*Math.floor(this.M*t+.5),o=t-s,i=s*s,r=2*s*o+o*o,e<0&&(i=-i,r=-r),i+r>this.MAXLOG)?1/0:i=Math.exp(i)*Math.exp(r)},polevl:function(t,e,i){var r,s;if(n.A.exists(e.reduce))return e.reduce(function(e,i){return e*t+i},0);for(s=0,r=0;s<=i;s++)r=r*t+e[s];return r},p1evl:function(t,e,i){var r,s;if(n.A.exists(e.reduce))return e.reduce(function(e,i){return e*t+i},1);for(s=0,r=1;s<i;s++)r=r*t+e[s];return r},ndtr:function(t){var e,i,r;return(r=Math.abs(e=t*this.SQRTH))<1?i=.5+.5*this.erf(e):(i=.5*this.erfce(r)*Math.sqrt(r=this.expx2(t,-1)),e>0&&(i=1-i)),i},_underflow:function(t){return 2*(console.log("erfc","UNDERFLOW"),t<0)},erfc:function(t){var e,i,r,s,o;return(r=t<0?-t:t)<1?1-this.erf(t):(o=-t*t)<-this.MAXLOG||(o=this.expx2(t,-1),r<8?(e=this.polevl(r,this.P,8),i=this.p1evl(r,this.Q,8)):(e=this.polevl(r,this.R,5),i=this.p1evl(r,this.S,6)),s=o*e/i,t<0&&(s=2-s),0===s)?this._underflow(t):s},erfce:function(t){var e,i;return t<8?(e=this.polevl(t,this.P,8),i=this.p1evl(t,this.Q,8)):(e=this.polevl(t,this.R,5),i=this.p1evl(t,this.S,6)),e/i},erf:function(t){var e;return Math.abs(t)>1?1-this.erfc(t):(e=t*t,t*this.polevl(e,this.T,4)/this.p1evl(e,this.U,5))},s2pi:2.5066282746310007,P0:[-59.96335010141079,98.00107541859997,-56.67628574690703,13.931260938727968,-1.2391658386738125],Q0:[1.9544885833814176,4.676279128988815,86.36024213908905,-225.46268785411937,200.26021238006066,-82.03722561683334,15.90562251262
1117,-1.1833162112133],P1:[4.0554489230596245,31.525109459989388,57.16281922464213,44.08050738932008,14.684956192885803,2.1866330685079025,-.1402560791713545,-.03504246268278482,-8574567851546854e-19],Q1:[15.779988325646675,45.39076351288792,41.3172038254672,15.04253856929075,2.504649462083094,-.14218292285478779,-.03808064076915783,-9332594808954574e-19],P2:[3.2377489177694603,6.915228890689842,3.9388102529247444,1.3330346081580755,.20148538954917908,.012371663481782003,30158155350823543e-20,26580697468673755e-22,6239745391849833e-24],Q2:[6.02427039364742,3.6798356385616087,1.3770209948908132,.21623699359449663,.013420400608854318,32801446468212774e-20,28924786474538068e-22,6790194080099813e-24],ndtri:function(t){var e,i,r,s,o,n,a;return t<=0?-1/0:t>=1?1/0:(a=1,(i=t)>.8646647167633873&&(i=1-i,a=0),i>.1353352832366127)?(i-=.5,s=i*i,e=(i+i*(s*this.polevl(s,this.P0,4)/this.p1evl(s,this.Q0,8)))*this.s2pi):(o=(e=Math.sqrt(-2*Math.log(i)))-Math.log(e)/e,r=1/e,e=o-(n=e<8?r*this.polevl(r,this.P1,8)/this.p1evl(r,this.Q1,8):r*this.polevl(r,this.P2,8)/this.p1evl(r,this.Q2,8)),0!==a&&(e=-e),e)},erfi:function(t){return this.ndtri((t+1)*.5)*this.SQRTH}},a.A.ProbFuncs;var h=i(63640);a.A.Extrapolate={upper:15,infty:1e4,wynnEps:function(t,e,i){var r,s,o,n,a,h,l=1e20,c=1e-15,d=1;if(i[e]=t,0===e)h=t;else{for(n=0,s=e;s>0;s--)o=n,n=i[s-1],Math.abs(a=i[s]-n)<=c?i[s-1]=l:(r=(e-s+1)%2==1?d:1,i[s-1]=o*r+1/a);h=i[e%2]}return h},aitken:function(t,e,i){var r,s,o,n,a,h,l=1e20,c=1e-15;if(i[e]=t,e<2)r=t;else{for(a=1,n=e/2;a<=n;a++)Math.abs(s=i[(h=e-2*a)+2]-2*i[h+1]+i[h])<c?i[h]=l:(o=i[h]-i[h+1],i[h]-=o*o/s);r=i[e%2]}return r},brezinski:function(t,e,i){var r,s,o,n,a,h,l,c,d=1e20,u=1e-15;if(i[e]=t,e<3)r=t;else{for(l=1,h=e/3,c=e;l<=h;l++)c-=3,o=i[c+1]-i[c],n=i[c+2]-i[c+1],Math.abs(s=(a=i[c+3]-i[c+2])*(n-o)-o*(a-n))<u?i[c]=d:i[c]=i[c+1]-o*n*(a-n)/s;r=i[e%3]}return r},iteration:function(t,e,i,r,s){var o,n,a,h=NaN,l=.5,c=[],d="finite",u=e;for(o=1,s=s||0;o<=this.upper;o++){if(n=i(t+(u=0===s?e/(o+1):u*l),!0),isNaN(a=this[r](n,o-1,c))){d="NaN";break}if(0!==n&&a/n>this.infty){h=a,d="infinite";break}if(1e-7>Math.abs(a-h))break;h=a}return[h,d,1-(o-1)/this.upper]},levin:function(t,e,i,r,s,o){var n,a,h,l,c=1e20,d=1e-15;if(l=1/(r+e),s[e]=t/i,o[e]=1/i,e>0&&(s[e-1]=s[e]-s[e-1],o[e-1]=o[e]-o[e-1],e>1))for(n=2,h=(r+e-1)*l;n<=e;n++)a=(r+e-n)*Math.pow(h,n-2)*l,s[e-n]=s[e-n+1]-a*s[e-n],o[e-n]=o[e-n+1]-a*o[e-n],l*=h;return Math.abs(o[0])<d?c:s[0]/o[0]},iteration_levin:function(t,e,i,r){var s,o,n,a,h,l,c,d=NaN,u=1,p=.5,f=[],A=[],m="finite",b=e,g="u";for(s=1,r=r||0,a=i(t+e,!0);s<=this.upper;s++){if(c="u"==(g=1>Math.abs(h=(o=i(t+(b=0===r?e/(s+1):b*p),!0))-a)?"u":"t")?(u+s)*h:h,a=o,l=(n=this.levin(o,s-1,c,u,f,A))-d,isNaN(n)){m="NaN";break}if(0!==o&&n/o>this.infty){d=n,m="infinite";break}if(1e-7>Math.abs(l))break;d=n}return[d,m,1-(s-1)/this.upper]},limit:function(t,e,i){return this.iteration_levin(t,e,i,0)}};let l=a.A.Extrapolate;var c=i(1006);a.A.Quadtree=function(t,e,i){e=e||{capacity:10,pointType:"coords"},this.config={},this.config.capacity=e.capacity||10,this.config.pointType=e.pointType||"coords",this.points=[],this.xlb=t[0],this.xub=t[2],this.ylb=t[3],this.yub=t[1],this.parent=i||null,this.northWest=null,this.northEast=null,this.southEast=null,this.southWest=null},n.A.extend(a.A.Quadtree.prototype,{contains:function(t,e){return this.xlb<t&&t<=this.xub&&this.ylb<e&&e<=this.yub},insert:function(t){switch(this.config.pointType){case"coords":if(!this.contains(t.usrCoords[1],t.usrCoords[2]))return!1;break;case"object":if(!this.contains(t.x,t.y))return!1}return this.points.length<this.config.capacity&&null===this.northWest?(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=this.xlb+(this.xub-this.xlb)*.5,e=this.ylb+(this.yub-this.ylb)*.5;this.northWest=new a.A.Quadtree([this.xlb,this.yub,t,e],this.config,this),this.northEast=new a.A.Quadtree([t,this.yub,this.xub,e],this.config,this),this.southEast=new a.A.Quadtree([this.xlb,e,t,this.ylb],this.config,this),this.southWest=new a.A.Quadtree([t,e,this.xub,this.ylb],this.config,this)},_query:function(t,e){var i;if(this.contains(t,e)){if(null===this.northWest)return this;if((i=this.northWest._query(t,e))||(i=this.northEast._query(t,e))||(i=this.southEast._query(t,e))||(i=this.southWest._query(t,e)))return i}return!1},query:function(t,e){var i,r;return n.A.exists(e)?(i=t,r=e):(i=t.usrCoords[1],r=t.usrCoords[2]),this._query(i,r)}
1,hasPoint:function(t,e,i){var r,s,o;if(this.contains(t,e)){switch(o=this.points.length,this.config.pointType){case"coords":for(s=0;s<o;s++)if(c.A.distance([t,e],this.points[s].usrCoords.slice(1),2)<i)return!0;break;case"object":for(s=0;s<o;s++)if(c.A.distance([t,e],[this.points[s].x,this.points[s].y],2)<i)return!0}if(null===this.northWest)return!1;if((r=this.northWest.hasPoint(t,e,i))||(r=this.northEast.hasPoint(t,e,i))||(r=this.southEast.hasPoint(t,e,i))||(r=this.southWest.hasPoint(t,e,i)))return r}return!1},getAllPoints:function(){var t=[];return this.getAllPointsRecursive(t),t},getAllPointsRecursive(t){Array.prototype.push.apply(t,this.points.slice()),null!==this.northWest&&(this.northWest.getAllPointsRecursive(t),this.northEast.getAllPointsRecursive(t),this.southEast.getAllPointsRecursive(t),this.southWest.getAllPointsRecursive(t))}});let d=a.A.Quadtree;a.A.BoxQuadtree=function(t,e,i){var r,s,o,n;t--,this.depth=t,this.capacity=e,this.items=[],this.northWest=null,this.northEast=null,this.southEast=null,this.southWest=null,this.bbox=null,this.cx=null,this.cy=null,i&&(r=i[0],s=i[1],o=i[2],n=i[3],this.cx=(r+o)*.5,this.cy=(s+n)*.5,this.bbox=[r,s,o,n])},n.A.extend(a.A.BoxQuadtree.prototype,{insert:function(t){var e,i,r,s,o,n,a,h,l,c,d,u=[],p=[],f=[],A=[];if(null===this.bbox){for(e=0,i=t.length,r=n=1/0,o=s=-1/0;e<t.length;e++)r=(a=t[e]).xlb<r?a.xlb:r,s=a.yub>s?a.yub:s,o=a.xub>o?a.xub:o,n=a.ylb<n?a.ylb:n;this.cx=(r+o)*.5,this.cy=(s+n)*.5,this.bbox=[r,s,o,n]}else r=this.bbox[0],s=this.bbox[1],o=this.bbox[2],n=this.bbox[3];if(0===this.depth||this.items.length+t.length<this.capacity)return this.items=this.items.concat(t),this;for(e=0,i=t.length;e<i;e++)h=(a=t[e]).xlb<=this.cx&&a.yub>this.cy,c=a.xlb<=this.cx&&a.ylb<=this.cy,l=a.xub>this.cx&&a.yub>this.cy,d=a.xub>this.cx&&a.ylb<=this.cy,h&&l&&d&&c?this.items.push(a):(h&&u.push(a),c&&f.push(a),l&&p.push(a),d&&A.push(a));return this.subdivide(u,f,p,A,r,s,o,n),this},insertItem:function(t){var e,i,r,s,o,n,a,h,l=[],c=[],d=[],u=[];return(null===this.bbox?(e=s=1/0,r=i=-1/0,e=t.xlb<e?t.xlb:e,i=t.yub>i?t.yub:i,r=t.xub>r?t.xub:r,s=t.ylb<s?t.ylb:s,this.cx=(e+r)*.5,this.cy=(i+s)*.5,this.bbox=[e,i,r,s]):(e=this.bbox[0],i=this.bbox[1],r=this.bbox[2],s=this.bbox[3]),0===this.depth||this.items.length+1<this.capacity)?this.items.push(t):(o=t.xlb<=this.cx&&t.yub>this.cy,a=t.xlb<=this.cx&&t.ylb<=this.cy,n=t.xub>this.cx&&t.yub>this.cy,h=t.xub>this.cx&&t.ylb<=this.cy,o&&n&&h&&a?this.items.push(t):(o&&l.push(t),a&&d.push(t),n&&c.push(t),h&&u.push(t)),this.subdivide(l,d,c,u,e,i,r,s)),this},subdivide:function(t,e,i,r,s,o,n,a){return t.length>0&&(null===this.northWest&&(this.northWest=new JXG.Math.BoxQuadtree(this.depth,this.capacity,[s,o,this.cx,this.cy])),this.northWest.insert(t)),e.length>0&&(null===this.southWest&&(this.southWest=new JXG.Math.BoxQuadtree(this.depth,this.capacity,[s,this.cy,this.cx,a])),this.southWest.insert(e)),i.length>0&&(null===this.northEast&&(this.northEast=new JXG.Math.BoxQuadtree(this.depth,this.capacity,[this.cx,o,n,this.cy])),this.northEast.insert(i)),r.length>0&&(null===this.southEast&&(this.southEast=new JXG.Math.BoxQuadtree(this.depth,this.capacity,[this.cx,this.cy,n,a])),this.southEast.insert(r)),this},find:function(t){var e,i,r=function(e){return t[2]>=e.xlb&&t[0]<=e.xub&&t[3]<=e.yub&&t[1]>=e.ylb},s=[];for(e=0,i=this.items.length;e<i;e++)r(this.items[e])&&s.push(this.items[e]);return null!==this.northWest&&t[0]<=this.cx&t[1]>=this.cy&&n.A.concat(s,this.northWest.find(t)),null!==this.southWest&&t[0]<=this.cx&t[3]<=this.cy&&n.A.concat(s,this.southWest.find(t)),null!==this.northEast&&t[2]>=this.cx&t[1]>=this.cy&&n.A.concat(s,this.northEast.find(t)),null!==this.southEast&&t[2]>=this.cx&t[3]<=this.cy&&n.A.concat(s,this.southEast.find(t)),s},analyzeTree:function(){var t,e={number_items:this.items.length,depth:1};return null!==this.northWest&&(t=this.northWest.analyzeTree(),e.number_items+=t.number_items,e.depth=Math.max(e.depth,1+t.depth)),null!==this.southWest&&(t=this.southWest.analyzeTree(),e.number_items+=t.number_items,e.depth=Math.max(e.depth,1+t.depth)),null!==this.northEast&&(t=this.northEast.analyzeTree(),e.number_items+=t.number_items,e.depth=Math.max(e.depth,1+t.depth)),null!==this.southEast&&(t=this.southEast.analyzeTree(),e.number_items+=t.number_items,e.depth=Math.max(e.depth,1+t.depth)),e},plot:function(){var t,e=[],i=[];return e.push(this.bbox[0]),i.push(this.bbox[3]),e.push(this.bbox[2]),i.push(this.bbox[3]),e.push(this.bbox[2]),i.push(this.bbox[1]),e.push(this.bbox[0]),i.push(this.bbox[1]),e.push(this.bbox[0]),i.push(this.bbox[3]),e.push(NaN),i.push(NaN),null!==this.northWest&&(t=this.northWest.plot(),n.A.concat(e,t[0]),n.A.concat(i,t[1])),null!==this.northEast&&(t=this.northEast.plot(),n.A.concat(e,t[0]),n.A.concat(i,t[1])),null!==this.southEast&&(t=this.southEast.plot(),n.A.concat(e,t[0]),n.A.concat(i,t[1])),null!==this.southWest&&(t=this.southWest.plot(),n.A.concat(e,t[0]),n.A.concat(i,t[1])),[e,i]}});
1let u=a.A.BoxQuadtree;var p=i(97878);r.A.Math.Nlp={arr:function(t){return new Float64Array(t)},arr2:function(t,e){for(var i=0,r=Array(t);i<t;)r[i]=this.arr(e),i++;return r},arraycopy:function(t,e,i,r,s){for(var o=0;o<s;)i[o+r]=t[o+e],o++},lastNumberOfEvaluations:0,GetLastNumberOfEvaluations:function(){return this.lastNumberOfEvaluations},Normal:0,MaxIterationsReached:1,DivergingRoundingErrors:2,FindMinimum:function(t,e,i,r,s,o,n,a,h){var l,c,d=i+2,u=this.arr(e+1),p=this;return this.lastNumberOfEvaluations=0,h&&console.log("Experimental feature 'testForRoundingErrors' is activated."),u[0]=0,this.arraycopy(r,0,u,1,e),c=function(e,i,r,s){var o,n,a=p.arr(e);return p.lastNumberOfEvaluations=p.lastNumberOfEvaluations+1,p.arraycopy(r,1,a,0,e),o=p.arr(i),n=t(e,i,a,o),p.arraycopy(o,0,s,1,i),n},l=this.cobylb(c,e,i,d,u,s,o,n,a,h),this.arraycopy(u,1,r,0,e),l},cobylb:function(t,e,i,r,s,o,n,a,h,l){var c,d,u,p,f,A,m,b,g,v,y,C,_,P,x,E,S,N,T,w,O,M,k,D,R,L,B,I,V,Y=-1,j=.25,X=2.1,F=.5,J=1.1,U=0,z=0,G=e+1,H=i+1,$=o,W=0,q=!1,Z=!1,Q=0,K=0,tt=0,te=this.arr(1+r),ti=this.arr2(1+e,1+G),tr=this.arr2(1+e,1+e),ts=this.arr2(1+r,1+G),to=this.arr2(1+e,1+H),tn=this.arr(1+e),ta=this.arr(1+e),th=this.arr(1+e),tl=this.arr(1+e),tc=this.arr(1+e),td=!0;for(a>=2&&console.log("The initial value of RHO is "+$+" and PARMU is set to zero."),b=0,A=1/$,d=1;d<=e;++d)ti[d][G]=s[d],ti[d][d]=$,tr[d][d]=A;g=G,v=!1;t:do{if(b>=h&&b>0){Y=this.MaxIterationsReached;break}for(++b,U=t(e,i,s,te),z=0,p=1;p<=i;++p)z=Math.max(z,-te[p]);if((b===a-1||3===a)&&this.PrintIterationResult(b,U,z,s,e,a),te[H]=U,te[r]=z,y=!0,!v){for(d=1,y=!1;d<=r;++d)ts[d][g]=te[d];if(b<=G){if(g<=e)if(ts[H][G]<=U)s[g]=ti[g][G];else{for(p=1,ti[g][G]=s[g];p<=r;++p)ts[p][g]=ts[p][G],ts[p][G]=te[p];for(p=1;p<=g;++p){for(ti[g][p]=-$,A=0,d=p;d<=g;++d)A-=tr[d][p];tr[g][p]=A}}if(b<=e){g=b,s[g]+=$;continue}}v=!0}e:do{do{if(!y){for(u=1,C=ts[H][G]+W*ts[r][G],_=G;u<=e;++u)(A=ts[H][u]+W*ts[r][u])<C?(_=u,C=A):A===C&&0===W&&ts[r][u]<ts[r][_]&&(_=u);if(_<=e){for(d=1;d<=r;++d)A=ts[d][G],ts[d][G]=ts[d][_],ts[d][_]=A;for(d=1;d<=e;++d){for(A=ti[d][_],ti[d][_]=0,ti[d][G]+=A,m=0,p=1;p<=e;++p)ti[d][p]-=A,m-=tr[p][d];tr[_][d]=m}}if(P=0,l)for(d=1;d<=e;++d)for(u=1;u<=e;++u)P=Math.max(P,Math.abs(A=this.DOT_PRODUCT_ROW_COL(tr,d,ti,u,1,e)-(d===u)));if(P>
1.1){Y=this.DivergingRoundingErrors;break t}for(p=1;p<=H;++p){for(u=1,te[p]=-ts[p][G];u<=e;++u)tc[u]=ts[p][u]+te[p];for(d=1;d<=e;++d)to[d][p]=(p===H?-1:1)*this.DOT_PRODUCT_ROW_COL(tc,-1,tr,d,1,e)}for(u=1,q=!0,Q=j*$,x=X*$;u<=e;++u){for(p=1,E=0,S=0;p<=e;++p)E+=tr[u][p]*tr[u][p],S+=ti[p][u]*ti[p][u];tn[u]=1/Math.sqrt(E),ta[u]=Math.sqrt(S),(tn[u]<Q||ta[u]>x)&&(q=!1)}if(!v&&!q){for(u=1,g=0,A=x;u<=e;++u)ta[u]>A&&(g=u,A=ta[u]);if(0===g)for(u=1;u<=e;++u)tn[u]<A&&(g=u,A=tn[u]);for(p=1,A=F*$*tn[g];p<=e;++p)tl[p]=A*tr[g][p];for(p=1,N=0,T=0,c=0;p<=H;++p)c=this.DOT_PRODUCT_ROW_COL(tl,-1,to,p,1,e),p<H&&(N=Math.max(N,-c-(A=ts[p][G])),T=Math.max(T,c-A));for(d=1,w=W*(N-T)>2*c?-1:1,A=0;d<=e;++d)tl[d]=w*tl[d],ti[d][g]=tl[d],A+=tr[g][d]*tl[d];for(p=1;p<=e;++p)tr[g][p]/=A;for(u=1;u<=e;++u){if(u!==g)for(p=1,A=this.DOT_PRODUCT_ROW_COL(tr,u,tl,-1,1,e);p<=e;++p)tr[u][p]-=A*tr[g][p];s[u]=ti[u][G]+tl[u]}continue t}if(!(Z=this.trstlp(e,i,to,te,$,tl))){for(p=1,A=0;p<=e;++p)A+=tl[p]*tl[p];if(A<.25*$*$){v=!0;break}}for(p=1,c=0,O=0,te[H]=0;p<=H;++p)c=te[p]-this.DOT_PRODUCT_ROW_COL(tl,-1,to,p,1,e),p<H&&(O=Math.max(O,c));if(W<1.5*(M=(K=ts[r][G]-O)>0?c/K:0)){for(W=2*M,a>=2&&console.log("Increase in PARMU to "+W),k=ts[H][G]+W*ts[r][G],u=1;u<=e;++u)if((A=ts[H][u]+W*ts[r][u])<k||A===k&&0===W&&ts[r][u]<ts[r][G])continue e}for(p=1,tt=W*K-c;p<=e;++p)s[p]=ti[p][G]+tl[p];v=!0;continue t}for(y=!1,D=ts[H][G]+W*ts[r][G]-(U+W*z),0===W&&U===ts[H][G]&&(tt=K,D=ts[r][G]-z),R=+(D<=0),g=0,u=1;u<=e;++u)(A=Math.abs(this.DOT_PRODUCT_ROW_COL(tr,u,tl,-1,1,e)))>R&&(g=u,R=A),th[u]=A*tn[u];for(u=1,L=J*$,f=0;u<=e;++u)if(th[u]>=Q||th[u]>=tn[u]){if(A=ta[u],D>0){for(p=1,A=0;p<=e;++p)A+=Math.pow(tl[p]-ti[p][u],2);A=Math.sqrt(A)}A>L&&(f=u,L=A)}if(f>0&&(g=f),0!==g){for(d=1,A=0;d<=e;++d)ti[d][g]=tl[d],A+=tr[g][d]*tl[d];for(p=1;p<=e;++p)tr[g][p]/=A;for(u=1;u<=e;++u)if(u!==g)for(p=1,A=this.DOT_PRODUCT_ROW_COL(tr,u,tl,-1,1,e);p<=e;++p)tr[u][p]-=A*tr[g][p];for(p=1;p<=r;++p)ts[p][g]=te[p];if(D>0&&D>=.1*tt)continue e}}while(!td);if(!q){v=!1;continue}if($<=n){Y=this.Normal;break t}if(B=0,I=0,($*=.5)<=1.5*n&&($=n),W>0){for(p=1,V=0;p<=H;++p){for(d=1,I=B=ts[p][G];d<=e;++d)B=Math.min(B,ts[p][d]),I=Math.max(I,ts[p][d]);p<=i&&B<.5*I&&(A=Math.max(I,0)-B,V=V<=0?A:Math.min(V,A))}0===V?W=0:I-B<W*V&&(W=(I-B)/V)}a>=2&&console.log("Reduction in RHO to "+$+" and PARMU = "+W),2===a&&this.PrintIterationResult(b,ts[H][G],ts[r][G],this.COL(ti,G),e,a)}while(td)}while(td);switch(Y){case this.Normal:if(a>=1&&console.log("%nNormal return from subroutine COBYLA%n"),Z)return a>=1&&this.PrintIterationResult(b,U,z,s,e,a),Y;break;case this.MaxIterationsReached:a>=1&&console.log("%nReturn from subroutine COBYLA because the MAXFUN limit has been reached.%n");break;case this.DivergingRoundingErrors:a>=1&&console.log("%nReturn from subroutine COBYLA because rounding errors are becoming damaging.%n")}for(p=1;p<=e;++p)s[p]=ti[p][G];return U=ts[H][G],z=ts[r][G],a>=1&&this.PrintIterationResult(b,U,z,s,e,a),Y},trstlp:function(t,e,i,r,s,o){var n,h,l,c,d,u,p,f,A,m,b,g,v,y,C,_,P,x,E,S,N,T,w,O,M,k,D,R,L,B,I,V,Y,j,X=0,F=0,J=0,U=this.arr2(1+t,1+t),z=this.arr(2+e),G=this.arr(2+e),H=this.arr(1+t),$=this.arr(1+t),W=this.arr(2+e),q=this.arr(2+e),Z=e,Q=0,K=!0;for(l=1;l<=t;++l)U[l][l]=1,o[l]=0;if(n=0,h=0,e>=1){for(c=1;c<=e;++c)r[c]>h&&(h=r[c],n=c);for(c=1;c<=e;++c)q[c]=c,G[c]=h-r[c]}d=!0;do i:do{(!d||d&&0===h)&&(n=Z=e+1,q[Z]=Z,G[Z]=0),d=!1,u=0,p=0,f=0,A=0;do{if(m=Z===e?h:-this.DOT_PRODUCT_ROW_COL(o,-1,i,Z,1,t),0===p||m<u?(u=m,F=Q,p=3):Q>F?(F=Q,p=3):--p,0===p)break i;if(b=0,n<=Q){if(n<Q){g=q[n],v=G[n],c=n;do{for(l=1,_=q[C=c+1],P=this.DOT_PRODUCT(this.PART(this.COL(U,c),1,t),this.PART(this.COL(i,_),1,t)),X=a.A.hypot(P,z[C]),x=z[C]/X,E=P/X,z[C]=x*z[c],z[c]=X;l<=t;++l)X=x*U[l][C]+E*U[l][c],U[l][C]=x*U[l][c]-E*U[l][C],U[l][c]=X;q[c]=_,G[c]=G[C],c=C}while(c<Q);q[c]=g,G[c]=v}if(--Q,Z>e)for(c=1,X=1/z[Q];c<=t;++c)H[c]=X*U[c][Q];else for(c=1,X=this.DOT_PRODUCT_ROW_COL(H,-1,U,Q+1,1,t);c<=t;++c)H[c]-=X*U[c][Q+1]}else{for(c=1,_=q[n];c<=t;++c)$[c]=i[c][_];for(S=0,c=t;c>Q;){for(l=1,P=0,N=0;l<=t;++l)P+=X=U[l][c]*$[l],N+=Math.abs(X);if(T=N+.1*Math.abs(P),w=N+.2*Math.abs(P),(N>=T||T>=w)&&(P=0),0===S)S=P;else for(l=1,C=c+1,X=a.A.hypot(P,S),x=P/X,E=S/X,S=X;l<=t;++l)X=x*U[l][c]+E*U[l][C],U[l][C]=x*U[l][C]-E*U[l][c],U[l][c]=X;--c}if(0===S){b=-1,c=Q;do{for(l=1,O=0,M=0;l<=t;++l)O+=X=U[l][c]*$[l],M+=Math.abs(X);
1if(T=M+.1*Math.abs(O),w=M+.2*Math.abs(O),M<T&&T<w){if((X=O/z[c])>0&&q[c]<=e&&(j=G[c]/X,(b<0||j<b)&&(b=j)),c>=2)for(l=1,k=q[c];l<=t;++l)$[l]-=X*i[l][k];W[c]=X}else W[c]=0}while(--c>0);if(b<0)break i;for(c=1;c<=Q;++c)G[c]=Math.max(0,G[c]-b*W[c]);if(n<Q){g=q[n],v=G[n],c=n;do{for(l=1,k=q[C=c+1],P=this.DOT_PRODUCT(this.PART(this.COL(U,c),1,t),this.PART(this.COL(i,k),1,t)),X=a.A.hypot(P,z[C]),x=z[C]/X,E=P/X,z[C]=x*z[c],z[c]=X;l<=t;++l)X=x*U[l][C]+E*U[l][c],U[l][C]=x*U[l][c]-E*U[l][C],U[l][c]=X;q[c]=k,G[c]=G[C],c=C}while(c<Q);q[c]=g,G[c]=v}if(0===(X=this.DOT_PRODUCT(this.PART(this.COL(U,Q),1,t),this.PART(this.COL(i,_),1,t))))break i;z[Q]=X,G[n]=0,G[Q]=b}else z[++Q]=S,G[n]=G[Q],G[Q]=0;if(q[n]=q[Q],q[Q]=_,Z>e&&_!==Z){for(l=1,c=Q-1,P=this.DOT_PRODUCT(this.PART(this.COL(U,c),1,t),this.PART(this.COL(i,_),1,t)),X=a.A.hypot(P,z[Q]),x=z[Q]/X,E=P/X,z[Q]=x*z[c],z[c]=X;l<=t;++l)X=x*U[l][Q]+E*U[l][c],U[l][Q]=x*U[l][c]-E*U[l][Q],U[l][c]=X;q[Q]=q[c],q[c]=_,X=G[c],G[c]=G[Q],G[Q]=X}if(Z>e)for(c=1,X=1/z[Q];c<=t;++c)H[c]=X*U[c][Q];else for(c=1,_=q[Q],X=(this.DOT_PRODUCT_ROW_COL(H,-1,i,_,1,t)-1)/z[Q];c<=t;++c)H[c]-=X*U[c][Q]}for(l=1,D=s*s,L=0,R=0;l<=t;++l)Math.abs(o[l])>=1e-6*s&&(D-=o[l]*o[l]),L+=o[l]*H[l],R+=H[l]*H[l];if(D<=0)break i;if(Math.abs(L)>=1e-6*(X=Math.sqrt(R*D))&&(X=Math.sqrt(R*D+L*L)),f=A=D/(X+L),Z===e){if(T=f+.1*h,w=f+.2*h,f>=T||T>=w)break;f=Math.min(f,h)}for(c=1;c<=t;++c)$[c]=o[c]+f*H[c];if(Z===e)for(c=1,J=h,h=0;c<=Q;++c)h=Math.max(h,X=r[_=q[c]]-this.DOT_PRODUCT_ROW_COL($,-1,i,_,1,t));c=Q;do{for(l=1,B=0,I=0;l<=t;++l)B+=X=U[l][c]*$[l],I+=Math.abs(X);if(T=I+.1*Math.abs(B),w=I+.2*Math.abs(B),(I>=T||T>=w)&&(B=0),W[c]=B/z[c],c>=2)for(l=1,_=q[c];l<=t;++l)$[l]-=W[c]*i[l][_]}while(c-- >=2);for(Z>e&&(W[Q]=Math.max(0,W[Q])),c=1;c<=t;++c)$[c]=o[c]+f*H[c];if(Z>Q)for(c=V=Q+1;c<=Z;++c){for(l=1,y=h-r[_=q[c]],Y=h+Math.abs(r[_]);l<=t;++l)y+=X=i[l][_]*$[l],Y+=Math.abs(X);T=Y+.1*Math.abs(y),w=Y+.2*Math.abs(y),(Y>=T||T>=w)&&(y=0),W[c]=y}for(c=1,b=1,n=0;c<=Z;++c)W[c]<0&&(X=G[c]/(G[c]-W[c]))<b&&(b=X,n=c);for(c=1,X=1-b;c<=t;++c)o[c]=X*o[c]+b*$[c];for(c=1;c<=Z;++c)G[c]=Math.max(0,X*G[c]+b*W[c]);Z===e&&(h=J+b*(h-J))}while(n>0);if(f===A)return!0}while(K);while(Z===e);return!1},PrintIterationResult:function(t,e,i,r,s,o){o>1&&console.log("NFVALS = "+t+" F = "+e+" MAXCV = "+i),o>1&&console.log("X = "+this.PART(r,1,s))},ROW:function(t,e){return t[e].slice()},COL:function(t,e){var i,r=t.length,s=[];for(i=0;i<r;++i)s[i]=t[i][e];return s},PART:function(t,e,i){return t.slice(e,i+1)},FORMAT:function(t){return t.join(",")},DOT_PRODUCT:function(t,e){var i,r=0,s=t.length;for(i=0;i<s;++i)r+=t[i]*e[i];return r},DOT_PRODUCT_ROW_COL:function(t,e,i,r,s,o){var n,a=0;if(-1===e)for(n=s;n<=o;++n)a+=t[n]*i[n][r];else if(-1===r)for(n=s;n<=o;++n)a+=t[e][n]*i[n];else for(n=s;n<=o;++n)a+=t[e][n]*i[n][r];return a}},r.A.Math.Nlp;var f=i(46693),A=i(86385);a.A.Plot={checkReal:function(t){var e,i,r=!1,s=t.length;for(e=0;e<s;e++)if(!isNaN((i=t[e].usrCoords)[1])&&!isNaN(i[2])&&Math.abs(i[0])>a.A.eps){r=!0;break}return r},updateParametricCurveNaive:function(t,e,i,r){var s,n,a=!1,h=(i-e)/r;for(s=0;s<r;s++)n=e+s*h,t.points[s].setCoordinates(o.A.COORDS_BY_USER,[t.X(n,a),t.Y(n,a)],!1),t.points[s]._t=n,a=!0;return t},isSegmentOutside:function(t,e,i,r,s){return e<0&&r<0||e>s.canvasHeight&&r>s.canvasHeight||t<0&&i<0||t>s.canvasWidth&&i>s.canvasWidth},isDistOK:function(t,e,i,r){return Math.abs(t)<i&&Math.abs(e)<r&&!isNaN(t+e)},isSegmentDefined:function(t,e,i,r){return!(isNaN(t+e)&&isNaN(i+r))},updateParametricCurveOld:function(t,e,i){var s,n,h,l,c,d,u,p,A,m,b,g=!1,v=new f.A(o.A.COORDS_BY_USER,[0,0],t.board,!1),y=[],C=[],_=[],P=[],x=!1,E=0,S=function(t,e,i){var r,s=i[1]-t[1],o=i[2]-t[2],n=e[0]-t[1],h=e[1]-t[2],l=n*n+h*h;return l>=a.A.eps&&(r=(s*n+o*h)/l)>0&&(r<=1?(s-=r*n,o-=r*h):(s-=n,o-=h)),a.A.hypot(s,o)};for(r.A.deprecated("Curve.updateParametricCurveOld()"),t.board.updateQuality===t.board.BOARD_QUALITY_LOW?(A=15,m=10,b=10):(A=21,m=.7,b=.7),P[0]=i-e,s=1;s<A;s++)P[s]=.5*P[s-1];s=1,y[0]=1,C[0]=0,n=e,v.setCoordinates(o.A.COORDS_BY_USER,[t.X(n,g),t.Y(n,g)],!1),g=!0,c=v.scrCoords[1],d=v.scrCoords[2],n=i,v.setCoordinates(o.A.COORDS_BY_USER,[t.X(n,g),t.Y(n,g)],!1),h=v.scrCoords[1],l=v.scrCoords[2],_[0]=[h,l],u=1,p=0,t.points=[],t.points[E++]=new f.A(o.A.COORDS_BY_SCREEN,[c,d],t.board,!1);do{for(x=this.isDistOK(h-c,l-d,m,b)||this.isSegmentOutside(c,d,h,l,t.board);p<A&&(!x||p<6)&&(p<=7||this.isSegmentDefined(c,d,h,l));)y[u]=s,C[u]=p,_[u]=[h,l],u+=1,n=e+(s=2*s-1)*P[++p],v.setCoordinates(o.A.COORDS_BY_USER,[t.X(n,g),t.Y(n,g)],!1,!0),h=v.scrCoords[1],l=v.scrCoords[2],x=this.isDistOK(h-c,l-d,m,b)||this.isSegmentOutside(c,d,h,l,t.board);E>1&&.015>S(t.points[E-2].scrCoords,[h,l],t.points[E-1].scrCoords)&&(E-=1),t.points[E]=new f.A(o.A.COORDS_BY_SCREEN,[h,l],t.board,!1),t.points[E]._t=n,E+=1,c=h,d=l,u-=1,h=_[u][0],l=_[u][1],p=C[u]+1,s=2*y[u]}while(u>0&&E<5e5);return t.numberPoints=t.points.length,t}
1,_insertPoint_v2:function(t,e,i){var r=!isNaN(this._lastCrds[1]+this._lastCrds[2]),s=!isNaN(e.scrCoords[1]+e.scrCoords[2]),o=t.board.canvasWidth,n=t.board.canvasHeight,a=500;(!(s=s&&e.scrCoords[1]>-a&&e.scrCoords[2]>-a&&e.scrCoords[1]<o+a&&e.scrCoords[2]<n+a)&&r||s&&(!r||Math.abs(e.scrCoords[1]-this._lastCrds[1])>.7||Math.abs(e.scrCoords[2]-this._lastCrds[2])>.7))&&(e._t=i,t.points.push(e),this._lastCrds=e.copy("scrCoords"))},neighborhood_isNaN_v2:function(t,e){var i,r,s,n=new f.A(o.A.COORDS_BY_USER,[0,0],t.board,!1);return r=e+a.A.eps,n.setCoordinates(o.A.COORDS_BY_USER,[t.X(r,!0),t.Y(r,!0)],!1),(!!(i=isNaN((s=n.usrCoords)[1]+s[2]))||(r=e-a.A.eps,n.setCoordinates(o.A.COORDS_BY_USER,[t.X(r,!0),t.Y(r,!0)],!1),!!(i=isNaN((s=n.usrCoords)[1]+s[2]))))&&!0},_borderCase:function(t,e,i,r,s,n,a,h){var l,c,d,u,p,A,m=null,b=30,g=!1;if(h<=1){if(c=new f.A(o.A.COORDS_BY_USER,[0,0],t.board,!1),isNaN(e[1]+e[2])&&!isNaN(r[1]+r[2])&&!this.neighborhood_isNaN_v2(t,s)||isNaN(i[1]+i[2])&&!isNaN(r[1]+r[2])&&!this.neighborhood_isNaN_v2(t,n)||isNaN(r[1]+r[2])&&(!isNaN(e[1]+e[2])||!isNaN(i[1]+i[2]))&&!this.neighborhood_isNaN_v2(t,a))return!1;u=0;do{if(isNaN(e[1]+e[2])&&!isNaN(r[1]+r[2]))p=s,A=a;else if(isNaN(i[1]+i[2])&&!isNaN(r[1]+r[2]))p=n,A=a;else if(isNaN(r[1]+r[2])&&!isNaN(i[1]+i[2]))p=a,A=n;else{if(!isNaN(r[1]+r[2])||isNaN(e[1]+e[2]))return!1;p=a,A=s}l=.5*(p+A),c.setCoordinates(o.A.COORDS_BY_USER,[t.X(l,!0),t.Y(l,!0)],!1),(g=isNaN((d=c.usrCoords)[1]+d[2]))?p=l:A=l,++u}while(g&&u<b);if(u<b&&(m=d.slice(),r=d.slice(),A=l),null!==m)return this._insertPoint_v2(t,new f.A(o.A.COORDS_BY_USER,m,t.board,!1)),!0}return!1},_plotRecursive_v2:function(t,e,i,r,s,n,a){var h,l,c,d,u,p=0,A=.5,m=.99,b=new f.A(o.A.COORDS_BY_USER,[0,0],t.board,!1);if(!(t.numberPoints>65536))return n<this.nanLevel&&this._isUndefined(t,e,i,r,s)||n<this.nanLevel&&this._isOutside(e,i,r,s,t.board)||(h=(i+s)*.5,b.setCoordinates(o.A.COORDS_BY_USER,[t.X(h,!0),t.Y(h,!0)],!1),l=b.scrCoords,this._borderCase(t,e,r,l,i,s,h,n)||(c=this._triangleDists(e,r,l),d=n<this.smoothLevel&&c[3]<a,u=n<=this.jumpLevel&&(isNaN(c[0])||isNaN(c[1])||isNaN(c[2]))||n<this.jumpLevel&&(c[2]>m*c[0]||c[1]>m*c[0]||c[0]===1/0||c[1]===1/0||c[2]===1/0),n<this.smoothLevel+2&&c[0]<A*(c[1]+c[2])&&(p=0,d=!1),--n,u?this._insertPoint_v2(t,new f.A(o.A.COORDS_BY_SCREEN,[NaN,NaN],t.board,!1),h):n<=p||d?this._insertPoint_v2(t,b,h):(this._plotRecursive_v2(t,e,i,l,h,n,a),isNaN(b.scrCoords[1]+b.scrCoords[2])||this._insertPoint_v2(t,b,h),this._plotRecursive_v2(t,l,h,r,s,n,a)))),this},updateParametricCurve_v2:function(t,e,i){var r,s,n,a,h,l,c,d,u,p=!1,A=new f.A(o.A.COORDS_BY_USER,[0,0],t.board,!1),m=new f.A(o.A.COORDS_BY_USER,[0,0],t.board,!1);return t.board.updateQuality===t.board.BOARD_QUALITY_LOW?(h=t.evalVisProp("recursiondepthlow")||13,l=2,this.smoothLevel=h-6,this.jumpLevel=3):(h=t.evalVisProp("recursiondepthhigh")||17,l=2,this.smoothLevel=h-9,this.jumpLevel=2),this.nanLevel=h-4,t.points=[],"x"===this.xterm?(c=((d=t.board.getBoundingBox())[2]-d[0])*.3,r=Math.max(e,d[0]-c),s=Math.min(i,d[2]+c)):(r=e,s=i),A.setCoordinates(o.A.COORDS_BY_USER,[t.X(r,p),t.Y(r,p)],!1),p=!0,m.setCoordinates(o.A.COORDS_BY_USER,[t.X(s,p),t.Y(s,p)],!1),u=this._findStartPoint(t,A.scrCoords,r,m.scrCoords,s),A.setCoordinates(o.A.COORDS_BY_SCREEN,u[0],!1),r=u[1],u=this._findStartPoint(t,m.scrCoords,s,A.scrCoords,r),m.setCoordinates(o.A.COORDS_BY_SCREEN,u[0],!1),s=u[1],this._visibleArea=[r,s],n=A.copy("scrCoords"),a=m.copy("scrCoords"),A._t=r,t.points.push(A),this._lastCrds=A.copy("scrCoords"),this._plotRecursive_v2(t,n,r,a,s,h,l),m._t=s,t.points.push(m),t.numberPoints=t.points.length,t},_insertLimesPoint:function(t,e,i,r,s){var n,h,l;(Math.abs(this._lastUsrCrds[1])!==1/0||Math.abs(s.left_x)!==1/0)&&(Math.abs(this._lastUsrCrds[2])!==1/0||Math.abs(s.left_y)!==1/0)&&((n=new f.A(o.A.COORDS_BY_USER,[s.left_x,s.left_y],t.board))._t=i,t.points.push(n),!isNaN(s.left_x)&&!isNaN(s.left_y)&&!isNaN(s.right_x)&&!isNaN(s.right_y)&&(Math.abs(s.left_x-s.right_x)>a.A.eps||Math.abs(s.left_y-s.right_y)>a.A.eps)&&((h=new f.A(o.A.COORDS_BY_SCREEN,e,t.board))._t=i,t.points.push(h)),(l=new f.A(o.A.COORDS_BY_USER,[s.right_x,s.right_y],t.board))._t=i,t.points.push(l),this._lastScrCrds=l.copy("scrCoords"),this._lastUsrCrds=l.copy("usrCoords"))}
1,_insertPoint:function(t,e,i,r,s){var a,h=!isNaN(this._lastScrCrds[1]+this._lastScrCrds[2]),l=!isNaN(e[1]+e[2]),c=t.board.canvasWidth,d=t.board.canvasHeight,u=.8,p=500;if(n.A.exists(s))return void this._insertLimesPoint(t,e,i,r,s);l=l&&e[1]>-p&&e[2]>-p&&e[1]<c+p&&e[2]<d+p,!h&&!l||l&&h&&Math.abs(e[1]-this._lastScrCrds[1])<u&&Math.abs(e[2]-this._lastScrCrds[2])<u||(Math.abs(e[1])!==1/0||Math.abs(this._lastUsrCrds[1])!==1/0)&&(Math.abs(e[2])!==1/0||Math.abs(this._lastUsrCrds[2])!==1/0)&&((a=new f.A(o.A.COORDS_BY_SCREEN,e,t.board))._t=i,t.points.push(a),this._lastScrCrds=a.copy("scrCoords"),this._lastUsrCrds=a.copy("usrCoords"))},_triangleDists:function(t,e,i){var r,s,o;return r=[t[0]*e[0],(t[1]+e[1])*.5,(t[2]+e[2])*.5],s=c.A.distance(t,e,3),o=c.A.distance(t,i,3),[s,o,c.A.distance(i,e,3),c.A.distance(i,r,3)]},_isUndefined:function(t,e,i,r,s){var n,a,h;if(!isNaN(e[1]+e[2])||!isNaN(r[1]+r[2]))return!1;for(a=0,h=new f.A(o.A.COORDS_BY_USER,[0,0],t.board,!1);a<20;++a)if(n=i+Math.random()*(s-i),h.setCoordinates(o.A.COORDS_BY_USER,[t.X(n,!0),t.Y(n,!0)],!1),!isNaN(h.scrCoords[0]+h.scrCoords[1]+h.scrCoords[2]))return!1;return!0},_isOutside:function(t,e,i,r,s){var o=500,n=s.canvasWidth,a=s.canvasHeight;return!!(t[1]<-o&&i[1]<-o||t[2]<-o&&i[2]<-o||t[1]>n+o&&i[1]>n+o||t[2]>a+o&&i[2]>a+o)},_isOutsidePoint:function(t,e){var i=500,r=e.canvasWidth,s=e.canvasHeight;return!!(t[1]<-i||t[2]<-i||t[1]>r+i||t[2]>s+i)},_findStartPoint:function(t,e,i,r,s){return[e,i]},_getBorderPos:function(t,e,i,r,s,n,h){var l,c,d,u,p,A,m=30,b=!1;if(c=new f.A(o.A.COORDS_BY_USER,[0,0],t.board,!1),u=0,isNaN(i[1]+i[2])&&!isNaN(s[1]+s[2]))A=e,p=r;else if(isNaN(h[1]+h[2])&&!isNaN(s[1]+s[2]))A=n,p=r;else if(isNaN(s[1]+s[2])&&!isNaN(h[1]+h[2]))A=r,p=n;else{if(!isNaN(s[1]+s[2])||isNaN(i[1]+i[2]))return!1;A=r,p=e}do l=.5*(p+A),c.setCoordinates(o.A.COORDS_BY_USER,[t.X(l,!0),t.Y(l,!0)],!1),(b=isNaN((d=c.usrCoords)[1]+d[2]))?A=l:p=l,++u;while(u<m&&Math.abs(p-A)>a.A.eps);return l},_getCuspPos:function(t,e,i){var r=[t.X(e,!0),t.Y(e,!0)],s=[t.X(i,!0),t.Y(i,!0)],o=function(e){var i=[t.X(e,!0),t.Y(e,!0)];return-(a.A.hypot(r[0]-i[0],r[1]-i[1])+a.A.hypot(s[0]-i[0],s[1]-i[1]))};return p.A.fminbr(o,[e,i],t)},_getJumpPos:function(t,e,i){var r=function(e){var i=a.A.eps*a.A.eps,r=[t.X(e,!0),t.Y(e,!0)],s=[t.X(e+i,!0),t.Y(e+i,!0)];return-Math.abs((s[1]-r[1])/(s[0]-r[0]))};return p.A.fminbr(r,[e,i],t)},_getLimits:function(t,e){var i,r,s,o,n,a=2/(t.maxX()-t.minX());return r=(i=l.limit(e,-a,t.X))[0],"infinite"===i[1]&&(r=1/0*Math.sign(r)),o=(i=l.limit(e,-a,t.Y))[0],"infinite"===i[1]&&(o=1/0*Math.sign(o)),s=(i=l.limit(e,a,t.X))[0],"infinite"===i[1]&&(s=1/0*Math.sign(s)),n=(i=l.limit(e,a,t.Y))[0],"infinite"===i[1]&&(n=1/0*Math.sign(n)),{left_x:r,left_y:o,right_x:s,right_y:n,t:e}},_getLimes:function(t,e,i,r,s,o,n,a,h){var l;return"border"===a?l=this._getBorderPos(t,e,i,r,s,o,n):"cusp"===a?l=this._getCuspPos(t,e,o):"jump"===a&&(l=this._getJumpPos(t,e,o)),this._getLimits(t,l)},_plotNonRecursive:function(t,e,i,r,s,o){var n,a,h,l,c,d,u,p,f,A,m,b=0,g=null,v=!1,y="",C=[],_=0;for(p=t.board.origin.scrCoords,C[_++]=[e,i,r,s,o,1/0];_>0;){if(e=(m=C[--_])[0],i=m[1],r=m[2],s=m[3],f=m[4],A=m[5],v=!1,y="",g=null,t.points.length>65536)return;f<this.nanLevel&&(this._isUndefined(t,e,i,r,s)||this._isOutside(e,i,r,s,t.board))||(n=(i+s)*.5,d=t.X(n,!0),u=t.Y(n,!0),a=[1,p[1]+d*t.board.unitX,p[2]-u*t.board.unitY],h=this._triangleDists(e,r,a),l=isNaN(e[1]+e[2]),c=isNaN(r[1]+r[2]),l&&!c||!l&&c?y="border":h[0]>.66*A||h[0]<this.cusp_threshold*(h[1]+h[2])||h[1]>5*h[2]||h[2]>5*h[1]?y="cusp":(h[2]>this.jump_threshold*h[0]||h[1]>this.jump_threshold*h[0]||h[0]===1/0||h[1]===1/0||h[2]===1/0)&&(y="jump"),v=""===y&&f<this.smoothLevel&&h[3]<this.smooth_threshold,f<this.testLevel&&!v&&(""===y?v=!0:g=this._getLimes(t,i,e,n,a,s,r,y,f)),null!==g?(a=[1,NaN,NaN],this._insertPoint(t,a,n,f,g)):f<=b||v?this._insertPoint(t,a,n,f,null):(C[_++]=[a,n,r,s,f-1,h[0]],C[_++]=[e,i,a,n,f-1,h[0]]))}return this},updateParametricCurve_v3:function(t,e,i){var r,s,n,a,h,l,c,d,u=!1,p=new f.A(o.A.COORDS_BY_USER,[0,0],t.board,!1),A=new f.A(o.A.COORDS_BY_USER,[0,0],t.board,!1);return h=t.board.updateQuality===t.board.BOARD_QUALITY_LOW?t.evalVisProp("recursiondepthlow")||14:t.evalVisProp("recursiondepthhigh")||17,this.smoothLevel=7,this.nanLevel=h-4,this.testLevel=4,this.cusp_threshold=.5,this.jump_threshold=.99,this.smooth_threshold=2,t.points=[],"x"===t.xterm?(l=((c=t.board.getBoundingBox())[2]-c[0])*.3,r=Math.max(e,c[0]-l),s=Math.min(i,c[2]+l)):(r=e,s=i),p.setCoordinates(o.A.COORDS_BY_USER,[t.X(r,u),t.Y(r,u)],!1),u=!0,A.setCoordinates(o.A.COORDS_BY_USER,[t.X(s,u),t.Y(s,u)],!1),d=this._findStartPoint(t,p.scrCoords,r,A.scrCoords,s),p.setCoordinates(o.A.COORDS_BY_SCREEN,d[0],!1),r=d[1],d=this._findStartPoint(t,A.scrCoords,s,p.scrCoords,r),A.setCoordinates(o.A.COORDS_BY_SCREEN,d[0],!1),s=d[1],this._visibleArea=[r,s],n=p.copy("scrCoords"),a=A.copy("scrCoords"),p._t=r,t.points.push(p),this._lastScrCrds=p.copy("scrCoords"),this._lastUsrCrds=p.copy("usrCoords"),this._plotNonRecursive(t,n,r,a,s,h),A._t=s,t.points.push(A),t.numberPoints=t.points.length,t}
1,_criticalInterval:function(t,e,i){var r,s,o,n,a,h,l,c=!1,d=-1/0,u=!1,p=!1,f=0,m=[],b=[],g=[];for(l=A.A.abs(t),(n=A.A.median(l))<1e-7?(n=1e-7,u=!0):n*=this.criticalThreshold,r=0;r<e;r++)l[r]>n?(g.push({i:r,v:t[r],group:f}),d=r,c||(c=!0)):c&&r>d+4&&(g.length>0&&m.push(g.slice(0)),g=[],c=!1,f++);for(c&&g.length>1&&m.push(g.slice(0)),u&&0===m.length&&(p=!0),s=0;s<m.length;s++)if(b[s]="point",!((o=m[s].length)<64)){for(r=1,h=0,a=Math.sign(m[s][0].v);r<o;r++)Math.sign(m[s][r].v)!==a&&(h++,a=Math.sign(m[s][r].v));6*h>o&&(b[s]="interval")}return{smooth:p,groups:m,types:b}},Component:function(){this.left_isNaN=!1,this.right_isNaN=!1,this.left_t=null,this.right_t=null,this.t_values=[],this.x_values=[],this.y_values=[],this.len=0},findComponents:function(t,e,i,r){var s,o,n,a,h,l,c=[],d=0,u=0,p=0,f=!1,A=!1;for(s=0,n=(i-e)/r,c[d]=new this.Component,l=c[d],o=e;s<=r;s++,o+=n)a=t.X(o,A),h=t.Y(o,A),isNaN(a)||isNaN(h)?++p>1&&f&&(l.right_isNaN=!0,l.right_t=o-n,l.len=u,f=!1,c[++d]=new this.Component,l=c[d],p=0):(!f&&(f=!0,u=0,p>0&&(l.left_t=o-n,l.left_isNaN=!0)),p=0,l.t_values[u]=o,l.x_values[u]=a,l.y_values[u]=h,u++),0===s&&(A=!0);return f?l.len=u:c.pop(),c},getPointType:function(t,e,i,r,s,o,n){var a=s[0],h=o[0],l=r.length,c={idx:e,t:i,x:a[e],y:h[e],type:"other"};return e<5?(c.type="borderleft",c.idx=0,c.t=r[0],c.x=a[0],c.y=h[0]):e>n-6&&(c.type="borderright",c.idx=l-1,c.t=r[l-1],c.x=a[l-1],c.y=h[l-1]),c},newtonApprox:function(t,e,i,r,s){var o,n=0;for(o=r;o>0;o--)n=(n+s[o][t])*(e-(o-1)*i)/o;return n+s[0][t]},thiele:function(t,e,i,r,s){var o,n=0;for(o=s;o>1;o--)n=(t-i[r+o])/(e[o][r+1]-e[o-2][r+1]+n);return e[0][r+1]+(t-i[r+1])/(e[1][r+1]+n)},differenceMethodExperiments:function(t,e){var i,r,s,o,n,a,h,l,c,d,u,p=t.t_values,f=t.x_values,A=t.y_values,m=[],b=[],g=[],v=[],y=[],C=[],_=[],P=[],x=0,E=[];for(n=p[1]-p[0],y.push([]),C.push([]),_.push([]),P.push([]),s=A.length,i=0;i<s;i++)y[0][i]=f[i],C[0][i]=A[i],_[0][i]=f[i],P[0][i]=A[i];for(y.push([]),C.push([]),_.push([]),P.push([]),a=n,s=A.length-1,i=0;i<s;i++)m[i]=f[i+1]-f[i],b[i]=A[i+1]-A[i],g[i]=m[i],v[i]=b[i],y[1][i]=m[i],C[1][i]=b[i],_[1][i]=a/m[i],P[1][i]=a/b[i];for(s--,o=Math.min(8,A.length-1),r=1;r<o;r++){for(y.push([]),C.push([]),_.push([]),P.push([]),a*=n,i=0;i<s;i++)m[i]=m[i+1]-m[i],b[i]=b[i+1]-b[i],y[r+1][i]=m[i],C[r+1][i]=b[i],_[r+1][i]=a/(_[r][i+1]-_[r][i])+_[r-1][i+1],P[r+1][i]=a/(P[r][i+1]-P[r][i])+P[r-1][i+1];if(!1===(u=this._criticalPoints(b,s,r))){console.log("Polynomial of degree",r),u=[];break}if(u.length>0&&++x>1&&r%2==0)break;s--}for(i=0;i<u.length;i++){for(c=0,l=-1/0;c<u[i].length;c++)(d=Math.abs(u[i][c].v))>l&&(l=d,h=c);h=Math.floor(u[i][h].i+r/2),E.push(this.getPointType(e,h,p,f,A,g,v,s+1))}return[E,y,C,_,P]},getCenterOfCriticalInterval:function(t,e,i){var r,s,o,n,a,h=0,l=0,c=i[1]-i[0],d=[];for(s=0,r=-1/0,d=[];s<t.length;s++)(n=Math.abs(t[s].v))>r?(d=[s],r=n,o=s):r===n&&d.push(s);if(d.length>0&&(o=Math.floor(a=d.reduce(function(t,e){return t+e},0)/d.length),a+=t[0].i),r<1/0){for(s=0;s<t.length;s++)h+=Math.abs(t[s].v)*t[s].i,l+=Math.abs(t[s].v);a=h/l}return a+=e/2,[t[o].i+e/2,a,i[Math.floor(a)]+c*(a-Math.floor(a))]},differenceMethod:function(t,e){var i,r,s,o,n,a,h,l,c,d,u=t.t_values,p=t.x_values,f=t.y_values,A=[],m=[],b=0,g=-1,v=-1,y=[],C=[];for(s=f.length,A.push(new Float64Array(p)),m.push(new Float64Array(f)),o=Math.min(12,--s),r=0;r<o&&(A.push(new Float64Array(s)),m.push(new Float64Array(s)),A[r+1]=A[r].map(function(t,e,i){return i[e+1]-t}),m[r+1]=m[r].map(function(t,e,i){return i[e+1]-t}),!0===(l=this._criticalInterval(m[r+1],s,r)).smooth&&(v=r,y=[]),h=this._criticalInterval(A[r+1],s,r),-1===g&&!0===h.smooth&&(g=r),!(v>=0));r++){if(l.groups.length>0&&++b>2&&(r+1)%2==0){y=l.groups,d=l.types;break}s--}for(i=0;i<y.length;i++)"interval"!==d[i]&&(a=this.getCenterOfCriticalInterval(y[i],r+1,u),n=l[0],n=Math.floor(a[1]),c=a[2],C.push(this.getPointType(e,n,c,u,A,m,s+1)));return[C,A,m,g,v]},_insertPoint_v4:function(t,e,i,r){var s,n,a,h=null,l=.8;t.points.length>0&&(h=t.points[t.points.length-1].scrCoords),s=new f.A(o.A.COORDS_BY_USER,e,t.board),null!==h&&(n=s.scrCoords[1]-h[1])*n+(a=s.scrCoords[2]-h[2])*a<l*l||(s._t=i,t.points.push(s))}
1,getInterval:function(t,e,i){var s,o;return h.A.disable(),s=h.A.Interval(e,i),t.board.mathLib=h.A,t.board.mathLibJXG=h.A,o=t.Y(s,!0),t.board.mathLib=Math,t.board.mathLibJXG=r.A.Math,o},sign:function(t){return t<0?-1:+(t>0)},handleBorder:function(t,e,i,r,s){var o,a,h,l,c,d,u,p,f,A,m,b,g=i.idx,v=32;if(b=e.t_values[1]-e.t_values[0],"borderleft"===i.type?h=(a=o=e.left_isNaN?e.left_t:i.t-b)+b:"borderright"===i.type?a=(h=o=e.right_isNaN?e.right_t:i.t+b)-b:console.log("No bordercase!!!"),0!==(A=this.findComponents(t,a,h,v)).length){for("borderleft"===i.type&&(a=A[0].left_t,h=A[0].t_values[0],b=A[0].t_values[1]-A[0].t_values[0],o=a=null===a?h-b:a,l=this.getInterval(t,a,h),n.A.isObject(l)&&(u=l.lo,p=l.hi,c=t.X(o,!0),d=s[1][g]<0?p:u,this._insertPoint_v4(t,[1,c,d],o))),m=A[0].t_values.length,f=0;f<m;f++)o=A[0].t_values[f],c=A[0].x_values[f],d=A[0].y_values[f],this._insertPoint_v4(t,[1,c,d],o);"borderright"===i.type&&(a=A[0].t_values[m-1],h=A[0].right_t,b=A[0].t_values[1]-A[0].t_values[0],o=h=null===h?a+b:h,l=this.getInterval(t,a,h),n.A.isObject(l)&&(u=l.lo,p=l.hi,c=t.X(o,!0),d=s[1][g]>0?p:u,this._insertPoint_v4(t,[1,c,d],o)))}},_seconditeration_v4:function(t,e,i,r,s){var o,n,a,h,l,c,d,u,p,f,A,m,b;for(d=0,n=e.t_values[i.idx-2],a=e.t_values[i.idx+2],l=this.findComponents(t,n,a,64);d<l.length;d++){for(p=0,c=l[d],u=(h=this.differenceMethod(c,t))[0],f=h[1],A=h[2],m=0;p<=u.length;p++){for(b=p===u.length?c.len:u[p].idx,o=m;o<b;o++)isNaN(c.x_values[o])||isNaN(c.y_values[o])||this._insertPoint_v4(t,[1,c.x_values[o],c.y_values[o]],c.t_values[o]);p<u.length&&(this.handleSingularity(t,c,u[p],f,A),m=u[p].idx+1)}b=c.len,d<l.length-1&&this._insertPoint_v4(t,[1,NaN,NaN],c.right_t)}return this},_recurse_v4:function(t,e,i,r,s,o,n,h){var l,c,d=2,u=(e+i)*.5,p=t.X(u,!0),f=t.Y(u,!0);if(0===h)return void this._insertPoint_v4(t,[1,NaN,NaN],u);l=(p-r)*t.board.unitX,c=(f-s)*t.board.unitY,a.A.hypot(l,c)>d?this._recurse_v4(t,e,u,r,s,p,f,h-1):this._insertPoint_v4(t,[1,p,f],u),l=(p-o)*t.board.unitX,c=(f-n)*t.board.unitY,a.A.hypot(l,c)>d?this._recurse_v4(t,u,i,p,f,o,n,h-1):this._insertPoint_v4(t,[1,p,f],u)},handleSingularity:function(t,e,i,r,s){var o,a,h,l,c,d,u,p,f,A,m,b=i.idx,g=100,v=5,y=3;console.log("HandleSingularity at t =",o=i.t),a=e.t_values[b-v],h=e.t_values[b+v],l=this.getInterval(t,a,h),n.A.isObject(l)?(p=l.lo,f=l.hi):s[0][b-1]<s[0][b+1]?(p=s[0][b-1],f=s[0][b+1]):(p=s[0][b+1],f=s[0][b-1]),u=t.X(o,!0),console.log(":::",A=(s[0][b-y]-s[0][b-v])/(e.t_values[b-y]-e.t_values[b-v]),m=(s[0][b+y]-s[0][b+v])/(e.t_values[b+y]-e.t_values[b+v])),A<-g?(this._insertPoint_v4(t,[1,u,p],o,!0),m<=g&&this._insertPoint_v4(t,[1,NaN,NaN],o)):A>g?(this._insertPoint_v4(t,[1,u,f],o),m>=-g&&this._insertPoint_v4(t,[1,NaN,NaN],o)):(p===-1/0&&(this._insertPoint_v4(t,[1,u,p],o,!0),this._insertPoint_v4(t,[1,NaN,NaN],o)),f===1/0&&(this._insertPoint_v4(t,[1,NaN,NaN],o),this._insertPoint_v4(t,[1,u,f],o,!0)),i.t<e.t_values[b]?(c=b-1,d=b):(c=b,d=b+1),a=e.t_values[c],h=e.t_values[d],this._recurse_v4(t,a,h,r[0][c],s[0][c],r[0][d],s[0][d],10)),m<-g?this._insertPoint_v4(t,[1,u,f],o):m>g&&this._insertPoint_v4(t,[1,u,p],o)},steps:1021,criticalThreshold:1e3,plot_v4:function(t,e,i,r){var s,o,a,h,l,c,d,u,f,A,m,b,g,v,y,C=(i-e)/r,_=function(e){return t.Y(e,!0)},P=function(e){return-t.Y(e,!0)},x=.5*C;for(h=0,a=this.findComponents(t,e,i,r);h<a.length;h++){for(l=a[h],c=(f=this.differenceMethod(l,t))[0],A=f[1],m=f[2],(0===c.length||"borderleft"!==c[0].type)&&c.unshift({idx:0,t:l.t_values[0],x:l.x_values[0],y:l.y_values[0],type:"borderleft"}),"borderright"!==c[c.length-1].type&&(o=l.t_values.length,c.push({idx:o-1,t:l.t_values[o-1],x:l.x_values[o-1],y:l.y_values[o-1],type:"borderright"})),u=0,d=0;d<=c.length;d++){for(o=d===c.length?l.len:c[d].idx-1,s=u;s<o-2;s++)this._insertPoint_v4(t,[1,l.x_values[s],l.y_values[s]],l.t_values[s]),s>=u+3&&s<o-3&&m.length>3&&Math.abs(m[2][s])>.2*Math.abs(m[0][s])&&(b=l.t_values[s],x=.25*C,y=this.getInterval(t,b,b+C),n.A.isObject(y)?m[2][s]>0?this._insertPoint_v4(t,[1,b+x,y.lo],b+x):this._insertPoint_v4(t,[1,b+C-x,y.hi],b+C-x):(g=p.A.fminbr(_,[b,b+C]))<(v=p.A.fminbr(P,[b,b+C]))?(this._insertPoint_v4(t,[1,t.X(g,!0),t.Y(g,!0)],g),this._insertPoint_v4(t,[1,t.X(v,!0),t.Y(v,!0)],v)):(this._insertPoint_v4(t,[1,t.X(v,!0),t.Y(v,!0)],v),this._insertPoint_v4(t,[1,t.X(g,!0),t.Y(g,!0)],g)));d<c.length&&(s=c[d].idx,"borderleft"===c[d].type||"borderright"===c[d].type?this.handleBorder(t,l,c[d],A,m):this._seconditeration_v4(t,l,c[d],A,m),u=c[d].idx+1+1)}o=l.len,h<a.length-1&&this._insertPoint_v4(t,[1,NaN,NaN],l.right_t)}}
1,updateParametricCurve_v4:function(t,e,i){var r,s,o,n;"x"===t.xterm?(o=((n=t.board.getBoundingBox())[2]-n[0])*.3,r=Math.max(e,n[0]-o),s=Math.min(i,n[2]+o)):(r=e,s=i),t.points=[],this.plot_v4(t,r,s,this.steps),t.numberPoints=t.points.length},updateParametricCurve:function(t,e,i){return this.updateParametricCurve_v2(t,e,i)}};let m=a.A.Plot;a.A.ImplicitPlot=function(t,e,i,r,s){var o={resolution_out:5,resolution_in:5,max_steps:1024,alpha_0:.05,tol_u0:a.A.eps,tol_newton:1e-7,tol_cusp:.05,tol_progress:1e-4,qdt_box:.2,kappa_0:.2,delta_0:.05,h_initial:.1,h_critical:.001,h_max:1,loop_dist:.09,loop_dir:.99,loop_detection:!0,unitX:10,unitY:10};this.config=n.A.merge(o,e),this.f=i,this.dfx=null,this.dfy=null,n.A.isFunction(r)?this.dfx=r:this.dfx=function(t,e){var i=a.A.eps*a.A.eps;return(this.f(t+i,e)-this.f(t-i,e))*.5/i},n.A.isFunction(s)?this.dfy=s:this.dfy=function(t,e){var i=a.A.eps*a.A.eps;return(this.f(t,e+i)-this.f(t,e-i))*.5/i},this.bbox=t,this.qdt=new u(20,5,t),this.components=[]},n.A.extend(a.A.ImplicitPlot.prototype,{plot:function(){var t,e,i,r,s,o,n,h=!0,l=!0,c=[],d=[],u=[],p=0,f=this,A=function(e){return f.f(t,e)},m=function(e){return-f.f(t,e)},b=function(t){return f.f(t,e)},g=function(t){return-f.f(t,e)};if(i=Math.min(this.bbox[0],this.bbox[2])-a.A.eps,r=Math.max(this.bbox[0],this.bbox[2]),s=Math.min(this.bbox[1],this.bbox[3])+a.A.eps,o=Math.max(this.bbox[1],this.bbox[3]),h)for(n=this.config.resolution_out/this.config.unitX*(1+a.A.eps),t=i;t<r;t+=n)!1!==(u=this.searchLine(A,m,t,[s,o],"vertical",p,c,d,20))&&(c=u[0],d=u[1],p=u[2]);if(l)for(n=this.config.resolution_out/this.config.unitY*(1+a.A.eps),e=s;e<o;e+=n)!1!==(u=this.searchLine(b,g,e,[i,r],"horizontal",p,c,d,20))&&(c=u[0],d=u[1],p=u[2]);return[c,d,p]},searchLine:function(t,e,i,r,s,o,h,l,c){var d,u,f,A,m,b,g,v,y,C,_,P,x,E=this.config.tol_u0,S=!1,N=r[0],T=r[1];if(d=p.A.fminbr(t,[N,T]),A=t(d),m=t(u=p.A.fminbr(e,[N,T])),A<E&&m>-E){if(d=Math.min(b=d,u),u=Math.max(b,u),f=p.A.fzero(t,[d,u]),Math.abs(t(f))>Math.max((m-A)*a.A.eps,.001))return!1;if("vertical"===s?(v=[1,i,f],x=this.config.resolution_in/this.config.unitY):(v=[1,f,i],x=this.config.resolution_in/this.config.unitX),x*=1+a.A.eps,this.curveContainsPoint(v,h,l,2*x,this.config.qdt_box))S&&console.log("Found in quadtree",v);else if(S&&console.log("Not in quadtree",v,h.length),(_=this.traceComponent(v,1))[0].length>0){for(o>0&&(h.push(NaN),l.push(NaN)),P=h.length,C=_[0].length,y=1;y<C;
1y++)this.qdt.insertItem({xlb:Math.min(_[0][y-1],_[0][y]),xub:Math.max(_[0][y-1],_[0][y]),ylb:Math.min(_[1][y-1],_[1][y]),yub:Math.max(_[1][y-1],_[1][y]),idx1:P+y-1,idx2:P+y,comp:o});o++,n.A.concat(h,_[0]),n.A.concat(l,_[1])}return(g=f-.01*x)-N>x&&c>0&&!1!==(_=this.searchLine(t,e,i,[N,g],s,o,h,l,c-1))&&(h=_[0],l=_[1],o=_[2]),T-(g=f+.01*x)>x&&c>0&&!1!==(_=this.searchLine(t,e,i,[g,T],s,o,h,l,c-1))&&(h=_[0],l=_[1],o=_[2]),[h,l,o]}return!1},curveContainsPoint:function(t,e,i,r,s){var o,n,a,h=t[1],l=t[2];for(o=0,n=(a=this.qdt.find([h-s,l+s,h+s,l-s])).length;o<n;o++)if(c.A.distPointSegment(t,[1,e[a[o].idx1],i[a[o].idx1]],[1,e[a[o].idx2],i[a[o].idx2]])<r)return!0;return!1},traceComponent:function(t){var e=[],i=[],r=[];return 0===(r=this.tracing(t,1)).length||(e=r[0],i=r[1]),r[2]||0===(r=this.tracing(t,-1)).length||(e=r[0].reverse().concat(e.slice(1)),i=r[1].reverse().concat(i.slice(1))),e.length>0&&e.length<6&&(e.push(e[e.length-1]),i.push(i[i.length-1])),[e,i]},tracing:function(t,e){var i,r,s,o,n,h,l,d,u,p,f,A,m,b,g,v,y,C,_,P=[],x=[],E=[],S=[],N=0,T=0,w=!1,O=!1,M=!1,k=!1,D=this.config.kappa_0,R=this.config.delta_0,L=this.config.alpha_0,B=this.config.h_initial,I=this.config.max_steps,V=e,Y=[],j=[],X=[];if(P=t.slice(1),Y.push(P[0]),j.push(P[1]),!1===(i=this.tangent(P)))return[];o=[this.dfx(P[0],P[1]),this.dfy(P[0],P[1])];do{if(!1===(i=M?this.tangent_A(o):this.tangent(P))){P=x.slice(),Y.push(P[0]),j.push(P[1]);break}if(1===Y.length)s=i.slice();else if(2===Y.length)X.push(Y.length-1);else if(O&&Y.length>2&&!k){if((f=c.A.distPointSegment([1,P[0],P[1]],[1,Y[0],j[0]],[1,Y[1],j[1]]))<this.config.loop_dist*B&&a.A.innerProduct(i,s,2)>this.config.loop_dir){P=t.slice(1),Y.push(P[0]),j.push(P[1]),w=!0;break}if(this.config.loop_detection){for(C=0,v=Y.length-1,y=Math.floor(a.A.log2(v));C<=y&&!((f=c.A.distPointSegment([1,P[0],P[1]],[1,Y[X[C]-1],j[X[C]-1]],[1,Y[X[C]],j[X[C]]]))<this.config.loop_dist*B&&(r=this.tangent([Y[X[C]],j[X[C]]]),a.A.innerProduct(i,r,2)>this.config.loop_dir));C++);if(C<=y){w=!0;break}for(C=0,y=1,_=0;C<100&&(v+1)%y==0;C++)y*=2,_++;X[_]=v}}x[0]=P[0]+B*V*i[0],x[1]=P[1]+B*V*i[1],M&&(o=this.updateA(o,P,x),E=x.slice()),T=0;do p=(n=M?o:[this.dfx(x[0],x[1]),this.dfy(x[0],x[1])])[0]*n[0]+n[1]*n[1],h=this.f(x[0],x[1])/p,S[0]=x[0]-n[0]*h,S[1]=x[1]-n[1]*h,0===T?d=Math.abs(h)*Math.sqrt(p):1===T&&(u=Math.abs(h)*Math.sqrt(p)),x[0]=S[0],x[1]=S[1],T++;while(T<20&&Math.abs(this.f(x[0],x[1]))>this.config.tol_newton);if(m=d,A=T>1?u/d:0,M?(o=this.updateA(o,E,x),r=this.tangent_A(o)):r=this.tangent(x),b=Math.acos(l=Math.max(-1,Math.min(1,l=a.A.innerProduct(i,r,2)))),k=!1,c.A.distance(P,x,2)<this.config.tol_progress){P=x.slice(),Y.push(P[0]),j.push(P[1]);break}if(l<0)if(B>this.config.h_critical);else if(k=!0,this.isBifurcation(P,this.config.tol_cusp))V*=-1,b=0;else{P=x.slice(),Y.push(P[0]),j.push(P[1]);break}if(!k&&(isNaN(g=Math.max(Math.sqrt(A/D),Math.sqrt(m/R),b/L))&&(g=1),B/=g=Math.max(Math.min(g,2),.5),B=Math.min(this.config.h_max,B),g>=2)){if(++N>=3*I)break;O=!1;continue}P=x.slice(),Y.push(P[0]),j.push(P[1]),O=!0,N++}while(N<I&&P[0]>=this.bbox[0]&&P[1]<=this.bbox[1]&&P[0]<=this.bbox[2]&&P[1]>=this.bbox[3]);return[Y,j,w]},isBifurcation:function(t,e){var i,r,s,o,n,h,l,c,d,u,p=a.A.eps*a.A.eps*100;return i=t[0],r=t[1],s=.5*(this.dfx(i+p,r)-this.dfx(i-p,r))/p,o=.5*(this.dfx(i,r+p)-this.dfx(i,r-p))/p,n=.5*(this.dfy(i+p,r)-this.dfy(i-p,r))/p,u=(l=s+(h=.5*(this.dfy(i,r+p)-this.dfy(i,r-p))/p))*l-4*(s*h-o*n),c=.5*(l+Math.sqrt(u)),d=.5*(l-Math.sqrt(u)),!!(Math.abs(c)>e&&Math.abs(d)>e)},handleCriticalPoint:function(t,e,i,r){var s,o=Math.atan2(r*e[1],r*e[0]),n=function(e){var r=t[0]+i*Math.cos(e),s=t[1]+i*Math.sin(e);return this.f(r,s)};return s=p.A.root(n,o),[t[0]+i*Math.cos(s),t[1]+i*Math.sin(s)]},updateA:function(t,e,i){var r,s,o=[i[0]-e[0],i[1]-e[1]],n=this.f(i[0],i[1])-this.f(e[0],e[1]);return s=o[0]*o[0]+o[1]*o[1],r=(n-(t[0]*o[0]+t[1]*o[1]))/s,t[0]+=r*o[0],t[1]+=r*o[1],t},tangent_A:function(t){var e=[-t[1],t[0]],i=a.A.norm(e,2);return a.A.eps,[e[0]/i,e[1]/i]},tangent:function(t){var e=[-this.dfy(t[0],t[1]),this.dfx(t[0],t[1])],i=a.A.norm(e,2);return!(i<a.A.eps*a.A.eps)&&[e[0]/i,e[1]/i]}});let b=a.A.ImplicitPlot;a.A.Metapost={MP_ENDPOINT:0,MP_EXPLICIT:1,MP_GIVEN:2,MP_CURL:3,MP_OPEN:4,MP_END_CYCLE:5,UNITY:1,FRACTION_ONE:1,FRACTION_THREE:3,ONE_EIGHTY_DEG:Math.PI,THREE_SIXTY_DEG:2*Math.PI,EPS_SQ:1e-5*1e-5,make_choices:function(t){var e,i,r,s,o,n,a,h,l,c,d,u,p,f,A,m=!0;a=t[0];do{if(!a)break;n=a.next,a.rtype>this.MP_EXPLICIT&&(a.x-n.x)*(a.x-n.x)+(a.y-n.y)*(a.y-n.y)<this.EPS_
1SQ&&(a.rtype=this.MP_EXPLICIT,a.ltype===this.MP_OPEN&&(a.ltype=this.MP_CURL,a.set_left_curl(this.UNITY)),n.ltype=this.MP_EXPLICIT,n.rtype===this.MP_OPEN&&(n.rtype=this.MP_CURL,n.set_right_curl(this.UNITY)),a.rx=a.x,n.lx=a.x,a.ry=a.y,n.ly=a.y),a=n}while(a!==t[0]);for(i=t[0];m&&i.ltype===this.MP_OPEN&&i.rtype===this.MP_OPEN;)if((i=i.next)===t[0]){i.ltype=this.MP_END_CYCLE;break}for(a=i;m&&a;){if(n=a.next,a.rtype>=this.MP_GIVEN){for(;n.ltype===this.MP_OPEN&&n.rtype===this.MP_OPEN;)n=n.next;for(r=0,h=a,o=t.length,u=[],p=[],f=[],A=[null];m&&(c=h.next,u.push(c.x-h.x),p.push(c.y-h.y),f.push(this.mp_pyth_add(u[r],p[r])),r>0&&(d=p[r-1]/f[r-1],l=u[r-1]/f[r-1],A.push(Math.atan2(p[r]*l-u[r]*d,u[r]*l+p[r]*d))),r++,(h=c)===n&&(o=r),!(r>=o)||h.ltype===this.MP_END_CYCLE););r===o?A.push(0):A.push(A[1]),n.ltype===this.MP_OPEN&&((s=n.rx-n.x)*s+(e=n.ry-n.y)*e<this.EPS_SQ?(n.ltype=this.MP_CURL,n.set_left_curl(this.UNITY)):(n.ltype=this.MP_GIVEN,n.set_left_given(Math.atan2(e,s)))),a.rtype===this.MP_OPEN&&a.ltype===this.MP_EXPLICIT&&((s=a.x-a.lx)*s+(e=a.y-a.ly)*e<this.EPS_SQ?(a.rtype=this.MP_CURL,a.set_right_curl(this.UNITY)):(a.rtype=this.MP_GIVEN,a.set_right_given(Math.atan2(e,s)))),this.mp_
1solve_choices(a,n,o,u,p,f,A)}else a.rtype===this.MP_ENDPOINT&&(a.rx=a.x,a.ry=a.y,n.lx=n.x,n.ly=n.y);if((a=n)===i)break}},mp_solve_choices:function(t,e,i,r,s,o,n){var a,h,l,c,d,u,p,f,A,m,b,g,v,y,C,_,P,x,E,S,N,T,w,O,M,k,D=!0;for(M=0,m=Array(d=o.length+1),A=Array(d),l=Array(d),C=Array(d);M<d;M++)C[M]=l[M]=A[M]=m[M]=0;for(p=0,f=t,g=0;D;){if(v=f.next,0===p)if(f.rtype===this.MP_GIVEN){if(v.ltype===this.MP_GIVEN){a=Math.atan2(s[0],r[0]),S=(E=this.mp_n_sin_cos(t.right_given()-a))[0],N=E[1],w=(T=this.mp_n_sin_cos(e.left_given()-a))[0],O=T[1],this.mp_set_controls(t,e,r[0],s[0],N,S,-O,w);return}l[0]=f.right_given()-Math.atan2(s[0],r[0]),l[0]=this.reduce_angle(l[0]),m[0]=0,A[0]=0}else if(f.rtype===this.MP_CURL){if(v.ltype===this.MP_CURL){t.rtype=this.MP_EXPLICIT,e.ltype=this.MP_EXPLICIT,b=Math.abs(e.left_tension()),_=Math.abs(t.right_tension()),y=this.UNITY/(3*_),t.rx=t.x+r[0]*y,t.ry=t.y+s[0]*y,y=this.UNITY/(3*b),e.lx=e.x-r[0]*y,e.ly=e.y-s[0]*y;return}x=f.right_curl(),b=Math.abs(v.left_tension()),_=Math.abs(f.right_tension()),m[0]=this.mp_curl_ratio(x,_,b),l[0]=-n[1]*m[0],A[0]=0}else f.rtype===this.MP_OPEN&&(m[0]=0,l[0]=0,A[0]=this.FRACTION_ONE);else if(f.ltype===this.MP_END_CYCLE||f.ltype===this.MP_OPEN){if(a=this.UNITY/(3*Math.abs(g.right_tension())-this.UNITY),P=o[p]*(this.FRACTION_THREE-this.UNITY/Math.abs(g.right_tension())),c=this.UNITY/(3*Math.abs(v.left_tension())-this.UNITY),u=o[p-1]*(this.FRACTION_THREE-this.UNITY/Math.abs(v.left_tension())),P*=x=this.FRACTION_ONE-m[p-1]*a,(b=Math.abs(f.left_tension()))<(_=Math.abs(f.right_tension()))?P*=Math.pow(b/_,2):b>_&&(u*=Math.pow(_/b,2)),y=u/(u+P),m[p]=y*c,h=-n[p+1]*m[p],g.rtype===this.MP_CURL?(A[p]=0,l[p]=h-n[1]*(this.FRACTION_ONE-y)):(y=(this.FRACTION_ONE-y)/x,h-=n[p]*y,y*=a,l[p]=h-l[p-1]*y,A[p]=-A[p-1]*y),f.ltype===this.MP_END_CYCLE){for(a=0,c=this.FRACTION_ONE;D&&(0==(p-=1)&&(p=i),a=l[p]-a*m[p],c=A[p]-c*m[p],p!==i););for(a/=this.FRACTION_ONE-c,C[i]=a,l[0]=a,k=1;k<i;k++)l[k]=l[k]+a*A[k];break}}else{if(f.ltype===this.MP_CURL){x=f.left_curl(),b=Math.abs(f.left_tension()),_=Math.abs(g.right_tension()),y=this.mp_curl_ratio(x,b,_),C[i]=-(l[i-1]*y)/(this.FRACTION_ONE-y*m[i-1]);break}if(f.ltype===this.MP_GIVEN){C[i]=f.left_given()-Math.atan2(s[i-1],r[i-1]),C[i]=this.reduce_angle(C[i]);break}}g=f,f=v,p+=1}for(p=i-1;p>-1;p--)C[p]=l[p]-C[p+1]*m[p];for(f=t,p=0;D&&(v=f.next,S=(E=this.mp_n_sin_cos(C[p]))[0],N=E[1],w=(T=this.mp_n_sin_cos(-n[p+1]-C[p+1]))[0],O=T[1],this.mp_set_controls(f,v,r[p],s[p],N,S,O,w),p++,f=v,p!==i););},mp_n_sin_cos:function(t){return[Math.cos(t),Math.sin(t)]},mp_set_controls:function(t,e,i,r,s,o,n,a){var h,l,c,d,u;c=Math.abs(e.left_tension()),h=Math.abs(t.right_tension()),u=this.mp_velocity(s,o,n,a,h),l=this.mp_velocity(n,a,s,o,c),(0>t.right_tension()||0>e.left_tension())&&(s>=0&&n>=0||s<=0&&n<=0)&&(d=Math.abs(s)*a+Math.abs(n)*o)>0&&(d*=1.00024414062,0>t.right_tension()&&0>this.mp_ab_vs_cd(Math.abs(n),this.FRACTION_ONE,u,d)&&(u=Math.abs(n)/d),0>e.left_tension()&&0>this.mp_ab_vs_cd(Math.abs(s),this.FRACTION_ONE,l,d)&&(l=Math.abs(s)/d)),t.rx=t.x+(i*o-r*s)*u,t.ry=t.y+(r*o+i*s)*u,e.lx=e.x-(i*a+r*n)*l,e.ly=e.y-(r*a-i*n)*l,t.rtype=this.MP_EXPLICIT,e.ltype=this.MP_EXPLICIT},mp_pyth_add:function(t,e){return a.A.hypot(t,e)},mp_curl_ratio:function(t,e,i){var r=1/e,s=1/i;return Math.min(4,((3-r)*r*r*t+s*s*s)/(r*r*r*t+(3-s)*s*s))},mp_ab_vs_cd:function(t,e,i,r){return t*e==i*r?0:t*e>i*r?1:-1},mp_velocity:function(t,e,i,r,s){return Math.min(4,(2+Math.sqrt(2)*(t-i/16)*(i-t/16)*(e-r))/(1.5*s*(2+(Math.sqrt(5)-1)*e+(3-Math.sqrt(5))*r)))},reduce_angle:function(t){return Math.abs(t)>this.ONE_EIGHTY_DEG&&(t>0?t-=this.THREE_SIXTY_DEG:t+=this.THREE_SIXTY_DEG),t},makeknots:function(t,e){var i,r,s=[];for(i=0,r=t.length;i<r;i++)s.push({x:t[i][0],y:t[i][1],ltype:this.MP_OPEN,rtype:this.MP_OPEN,lx:!1,rx:!1,ly:e,ry:e,left_curl:function(){return this.lx||0},right_curl:function(){return this.rx||0},left_tension:function(){return this.ly||1},right_tension:function(){return this.ry||1},set_right_curl:function(t){this.rx=t||0},set_left_curl:function(t){this.lx=t||0}});for(i=0,r=s.length;i<r;i++)s[i].next=s[i+1]||s[i],s[i].set_right_given=s[i].set_right_curl,s[i].set_left_given=s[i].set_left_curl,s[i].right_given=s[i].right_curl,s[i].left_given=s[i].left_curl;return s[r-1].next=s[0],s},curve:function(t,e){var i,r,s,o,a,h,l=!1,c=[],d=[];for(o in a=1,(e=e||{tension:1,direction:{},curl:{},isClosed:!1}
1).hasOwnProperty("tension")&&(a=n.A.evaluate(e.tension)),r=(i=this.makeknots(t,a)).length,n.A.exists(e.isClosed)&&n.A.evaluate(e.isClosed)&&(l=!0),l||(i[0].ltype=this.MP_ENDPOINT,i[0].rtype=this.MP_CURL,i[r-1].rtype=this.MP_ENDPOINT,i[r-1].ltype=this.MP_CURL),e)if(e.hasOwnProperty(o)){if(isNaN(s=parseInt(o,10))||s<0||s>=r)continue;h=e[s],n.A.exists(h.type)&&"curl"===h.type&&(a=n.A.evaluate(h.curl),0===s?(i[s].rtype=this.MP_CURL,i[s].set_right_curl(a)):s===r-1?(i[s].ltype=this.MP_CURL,i[s].set_left_curl(a)):(i[s].ltype=this.MP_CURL,i[s].rtype=this.MP_CURL,i[s].lx=a,i[s].rx=a)),n.A.exists(h.direction)&&(a=n.A.evaluate(h.direction),n.A.isArray(a)?(!1!==a[0]&&(i[s].lx=a[0]*Math.PI/180,i[s].ltype=this.MP_GIVEN),!1!==a[1]&&(i[s].rx=a[1]*Math.PI/180,i[s].rtype=this.MP_GIVEN)):(i[s].lx=a*Math.PI/180,i[s].rx=a*Math.PI/180,i[s].ltype=i[s].rtype=this.MP_GIVEN)),n.A.exists(h.tension)&&(a=n.A.evaluate(h.tension),n.A.isArray(a)?(!1!==a[0]&&(i[s].ly=n.A.evaluate(a[0])),!1!==a[1]&&(i[s].ry=n.A.evaluate(a[1]))):(i[s].ly=a,i[s].ry=a))}for(this.make_choices(i),s=0;s<r-1;s++)c.push(i[s].x),c.push(i[s].rx),c.push(i[s+1].lx),d.push(i[s].y),d.push(i[s].ry),d.push(i[s+1].ly);return c.push(i[r-1].x),d.push(i[r-1].y),l&&(c.push(i[r-1].rx),d.push(i[r-1].ry),c.push(i[0].lx),d.push(i[0].ly),c.push(i[0].x),d.push(i[0].y)),[c,d]}};let g=a.A.Metapost;a.A.Clip={_isSeparator:function(t){return isNaN(t.coords.usrCoords[1])&&isNaN(t.coords.usrCoords[2])},makeDoublyLinkedList:function(t){var e,i=null,r=[],s=t.length;if(s>0)for(e=0;e<s;e++){if(this._isSeparator(t[e])){t[e]._next=t[(e+1)%s],t[e]._prev=t[(s+e-1)%s];continue}null===i&&(i=e,r.push(i)),this._isSeparator(t[(e+1)%s])||e===s-1?(t[e]._next=t[i],t[i]._prev=t[e],t[e]._end=!0,i=null):(t[e]._next=t[(e+1)%s],t[i]._prev=t[e]),this._isSeparator(t[(s+e-1)%s])||(t[e]._prev=t[(s+e-1)%s])}return r},Vertex:function(t,e,i,r,s,n){this.pos=e,this.intersection=!0,this.coords=t,this.elementClass=o.A.OBJECT_CLASS_POINT,this.data={alpha:i,path:r,pathname:s,done:!1,type:n,idx:0},this.neighbour=null,this.entry_exit=!1},_addToList:function(t,e,i){var r=t.length,s=a.A.eps*a.A.eps;r>0&&Math.abs(t[r-1].coords.usrCoords[0]-e.usrCoords[0])<s&&Math.abs(t[r-1].coords.usrCoords[1]-e.usrCoords[1])<s&&Math.abs(t[r-1].coords.usrCoords[2]-e.usrCoords[2])<s||t.push({pos:i,intersection:!1,coords:e,elementClass:o.A.OBJECT_CLASS_POINT})},sortIntersections:function(t){var e,i,r,s,o,n,a=[],h=t.length;for(e=0;e<h;e++)if(t[e].sort(function(t,e){return t.data.alpha>e.data.alpha?1:-1}),t[e].length>0){for(o=t[e].length-1,n=(s=(r=t[e][0]).data.path[r.pos])._next,e===h-1&&(s._end=!1),0===r.data.alpha&&"T"===r.data.type?(s.intersection=!0,s.data=r.data,s.neighbour=r.neighbour,s.neighbour.neighbour=s,s.entry_exit=!1,t[e][0]=s):(r._prev=s,r._prev._next=r),i=1;i<=o;i++)(r=t[e][i])._prev=t[e][i-1],r._prev._next=r;(r=t[e][o])._next=n,r._next._prev=r,e===h-1&&(r._end=!0),a=a.concat(t[e])}return a},_inbetween:function(t,e,i){var r,s=a.A.eps*a.A.eps,o=i[1]-e[1],n=i[2]-e[2],h=t[1]-e[1],l=t[2]-e[2];return 0===o&&0===n&&0===h&&0===l||(Math.abs(r=Math.abs(h)<s&&Math.abs(o)<s?l/n:h/o)<s&&(r=0),r)},_print_array:function(t){var e,i;for(e=0;e<t.length;e++)try{i="",t[e]._end&&(i=" end"),console.log(e,t[e].coords.usrCoords,t[e].data.type," ","prev",t[e]._prev.coords.usrCoords,"next",t[e]._next.coords.usrCoords+i)}catch(i){console.log(e,t[e].coords.usrCoords)}},_print_list:function(t){for(var e,i=0;i<100&&(e=t.data?t.data.alpha:"-",console.log(" ",t.coords.usrCoords,"\n is:",t.intersection,"end:",t._end,e,"\n -:",t._prev.coords.usrCoords,"\n +:",t._next.coords.usrCoords,"\n n:",t.intersection?t.neighbour.coords.usrCoords:"-"),!t._end);)t=t._next,i++},_noOverlap:function(t,e,i,r){var s,o,n,h,l,c=Math.sqrt(a.A.eps),d=!1;for(s=0;s<3;s++)if(o=Math.min(t[s],e[s]),n=Math.max(t[s],e[s]),h=Math.min(i[s],r[s]),l=Math.max(i[s],r[s]),n<h-c||o>l+c){d=!0;break}return d},findIntersections:function(t,e,i){var r,s,n,h,l,d,u,p,A,m,b,g,v,y=[],C=100*a.A.eps,_=t.length,P=e.length,x=[],E=[],S=[],N=[],T=!1,w=!1,O=!1;for(s=0;s<P;s++)N.push([]);for(r=0;r<_;r++){if(S.push([]),this._isSeparator(t[r])||this._isSeparator(t[(r
1+1)%_])){T=!0;continue}if(T&&r===_-1)break;for(s=0,h=t[r].coords.usrCoords,l=t[(r+1)%_].coords.usrCoords;s<P;s++){if(this._isSeparator(e[s])||this._isSeparator(e[(s+1)%P])){w=!0;continue}if(w&&s===P-1)break;if(d=e[s].coords.usrCoords,u=e[(s+1)%P].coords.usrCoords,!this._noOverlap(h,l,d,u)&&(y=c.A.meetSegmentSegment(h,l,d,u),p=c.A.distance(h,l,3),A=c.A.distance(d,u,3),y[1]*p>-C&&y[1]<1-C/p&&y[2]*A>-C&&y[2]<1-C/A||y[1]===1/0&&y[2]===1/0&&a.A.norm(y[0],3)<C)){if(n=new f.A(o.A.COORDS_BY_USER,y[0],i),b="X",Math.abs(y[1])*p<C||Math.abs(y[2])*A<C)b="T",Math.abs(y[1])*p<C&&(y[1]=0),Math.abs(y[2])*A<C&&(y[2]=0),n=0===y[1]?new f.A(o.A.COORDS_BY_USER,h,i):new f.A(o.A.COORDS_BY_USER,d,i),O&&console.log("Degenerate case I",y[1],y[2],n.usrCoords,"type",b);else if(y[1]===1/0&&y[2]===1/0&&a.A.norm(y[0],3)<C){(m=this._inbetween(h,d,u))>=0&&m<1&&(b="T",n=new f.A(o.A.COORDS_BY_USER,h,i),y[1]=0,y[2]=m,g=new this.Vertex(n,r,y[1],t,"S",b),v=new this.Vertex(n,s,y[2],e,"C",b),g.neighbour=v,v.neighbour=g,S[r].push(g),N[s].push(v),O&&console.log("Degenerate case II",y[1],y[2],n.usrCoords,"type T")),m=this._inbetween(d,h,l),c.A.distance(h,d,3)>C&&m>=0&&m<1&&(b="T",n=new f.A(o.A.COORDS_BY_USER,d,i),y[1]=m,y[2]=0,g=new this.Vertex(n,r,y[1],t,"S",b),v=new this.Vertex(n,s,y[2],e,"C",b),g.neighbour=v,v.neighbour=g,S[r].push(g),N[s].push(v),O&&console.log("Degenerate case III",y[1],y[2],n.usrCoords,"type T"));continue}O&&console.log("IS",r,s,n.usrCoords,b),g=new this.Vertex(n,r,y[1],t,"S",b),v=new this.Vertex(n,s,y[2],e,"C",b),g.neighbour=v,v.neighbour=g,S[r].push(g),N[s].push(v)}}}for(x=this.sortIntersections(S),O&&(console.log(">>>>>> Intersections "),console.log("S_intersect"),this._print_array(x),console.log("----------")),r=0;r<x.length;r++)x[r].data.idx=r,x[r].neighbour.data.idx=r;return E=this.sortIntersections(N),O&&(console.log("C_intersect"),this._print_array(E),console.log("<<<<<< Phase 1 done")),[x,E]},_getPosition:function(t,e,i,r){var s=c.A.det3p(t,e,i),o=c.A.det3p(t,i,r);return c.A.det3p(e,i,r)>=0?s>=0&&o>=0?"left":"right":s>=0||o>=0?"left":"right"},_classifyDegenerateIntersections:function(t){var e,i,r,s,o,h,l,d,u,p,f,A,m,b,g=!0,v=!1;for(u=c.A.det3p,l=0,t._tours=0;g;){if(v&&console.log("Inspect P:",t.coords.usrCoords,t.data?t.data.type:" "),t.intersection&&"T"===t.data.type&&(e=t._next.coords.usrCoords,i=t._prev.coords.usrCoords,c.A.distance(t.coords.usrCoords,e,3)<a.A.eps&&(e=t._next._next.coords.usrCoords),c.A.distance(t.coords.usrCoords,i,3)<a.A.eps&&(i=t._prev._prev.coords.usrCoords),s=(o=t.neighbour)._prev.coords.usrCoords,r=o._next.coords.usrCoords,c.A.distance(o.coords.usrCoords,r,3)<a.A.eps&&(r=o._next._next.coords.usrCoords),c.A.distance(o.coords.usrCoords,s,3)<a.A.eps&&(s=o._prev._prev.coords.usrCoords),v&&(console.log("P chain:",i,t.coords.usrCoords,e),console.log("Q chain:",s,t.neighbour.coords.usrCoords,r),console.log("Pm",this._getPosition(i,s,o.coords.usrCoords,r)),console.log("Pp",this._getPosition(e,s,o.coords.usrCoords,r))),f=u(t.coords.usrCoords,i,s),A=u(t.coords.usrCoords,e,r),m=u(t.coords.usrCoords,i,r),b=u(t.coords.usrCoords,e,s),0===f&&0===A&&0===m&&0===b&&(t.coords.usrCoords[1]*=1+Math.random()*a.A.eps,t.coords.usrCoords[2]*=1+Math.random()*a.A.eps,o.coords.usrCoords[1]=t.coords.usrCoords[1],o.coords.usrCoords[2]=t.coords.usrCoords[2],f=u(t.coords.usrCoords,i,s),A=u(t.coords.usrCoords,e,r),m=u(t.coords.usrCoords,i,r),b=u(t.coords.usrCoords,e,s),v&&(console.log("Random shift",t.coords.usrCoords),console.log(f,A,m,b,0===A),console.log(this._getPosition(i,s,o.coords.usrCoords,r),this._getPosition(e,s,o.coords.usrCoords,r)))),p=!1,0===f?0>c.A.affineRatio(t.coords.usrCoords,i,s)&&(p=!0):0===A?0>c.A.affineRatio(t.coords.usrCoords,e,r)&&(p=!0):0===m?c.A.affineRatio(t.coords.usrCoords,i,r)>0&&(p=!0):0===b&&c.A.affineRatio(t.coords.usrCoords,e,s)>0&&(p=!0),p&&(d=s,s=r,r=d,d=f,f=m,m=d,d=A,A=b,b=d),v&&console.log(f,A,m,b,p),n.A.exists(t.delayedStatus)||(t.delayedStatus=[]),0===f&&0===A?t.delayedStatus=["on","on"]:0===f?(h=this._getPosition(e,s,o.coords.usrCoords,r),t.delayedStatus=["on",h]):0===A?(h=this._getPosition(i,s,o.coords.usrCoords,r),t.delayedStatus=[h,"on"]):0===t.delayedStatus.length&&(this._getPosition(i,s,o.coords.usrCoords,r)!==this._getPosition(e,s,o.coords.usrCoords,r)?t.data.type="X":t.data.type="B"),v&&console.log(">>>> P:",t.coords.usrCoords,"delayedStatus:",t.delayedStatus.toString(),t.data?t.data.type:" ","\n---")),n.A.exists(t._tours)&&t._tours++,t._tours>3||t._end||l>1e3){l>
11e3&&console.log("Clipping: _classifyDegenerateIntersections exit"),n.A.exists(t._tours)&&delete t._tours;break}t.intersection&&l++,t=t._next}v&&console.log("------------------------")},_handleIntersectionChains:function(t){for(var e,i=0,r="Null",s=!0,o=!1,n=!1,a=!1;s&&(!0===t.intersection&&(a&&("T"===t.data.type?console.log("Degenerate point",t.coords.usrCoords,t.data.type,"T"===t.data.type?t.delayedStatus:" "):console.log("Intersection point",t.coords.usrCoords,t.data.type)),"T"===t.data.type&&("on"!==t.delayedStatus[0]&&"on"===t.delayedStatus[1]?(o=!0,e=t,r=t.delayedStatus[0]):o&&"on"===t.delayedStatus[0]&&"on"===t.delayedStatus[1]?(t.data.type="B",a&&console.log("Interior",t.coords.usrCoords)):o&&"on"===t.delayedStatus[0]&&"on"!==t.delayedStatus[1]&&(o=!1,r===t.delayedStatus[1]?(e.data.type="DB",t.data.type="DB",a&&console.log("Chain: delayed bouncing",e.coords.usrCoords,"...",t.coords.usrCoords)):(e.data.type="DX",t.data.type="DX",a&&console.log("Chain: delayed crossing",e.coords.usrCoords,"...",t.coords.usrCoords)))),i++),t._end&&(n=!0),!n||o);){if(i>1e3){console.log("Warning: _handleIntersectionChains: intersection chain reached maximum numbers of iterations");break}t=t._next}},_handleFullyDegenerateCase:function(t,e,i){var r,s,n,h,l,d,u,p,A,m,b,g,v,y,C=[t,e];for(n=0;n<2;n++){for(p=0,m=(r=C[n]).length,y=!0;p<m;p++)if(!r[p].intersection){y=!1;break}if(y)for(p=0,b=(s=C[(n+1)%2]).length;p<m;p++){for(A=0,l=r[p].coords.usrCoords,d=r[p]._next.coords.usrCoords,h=[(l[0]+d[0])*.5,(l[1]+d[1])*.5,(l[2]+d[2])*.5],g=!1;A<b;A++)if(Math.abs(c.A.det3p(s[A].coords.usrCoords,s[(A+1)%b].coords.usrCoords,h))<a.A.eps){g=!0;break}if(!g){u={pos:p,intersection:!1,coords:new f.A(o.A.COORDS_BY_USER,h,i),elementClass:o.A.OBJECT_CLASS_POINT},v=r[p]._next,r[p]._next=u,u._prev=r[p],u._next=v,v._prev=u,r[p]._end&&(r[p]._end=!1,u._end=!0);break}}}},_getStatus:function(t,e){for(var i;t.intersection&&!t._end;)t=t._next;return i=0===c.A.windingNumber(t.coords.usrCoords,e)?"entry":"exit",[t,i]},markEntryExit:function(t,e,i){var r,s,o,a,h,l,c,d=!0,u=null,p=0,f=!1;for(h=0,l=i.length;h<l;h++)for(c=i[h],f&&console.log("\n;;;;;;;;;; Labelling phase",n.A.exists(t[c].data)?t[c].data.pathname:" ",t[c].coords.usrCoords),this._classifyDegenerateIntersections(t[c]),this._handleIntersectionChains(t[c]),f&&console.log("\n---- back to markEntryExit"),s=(a=this._getStatus(t[c],e))[0],r=a[1],f&&console.log("Start node:",s.coords.usrCoords,r),s._starter=!0,o=0,u=null,p=0;d&&(!0===s.intersection&&("X"===s.data.type&&1===p&&(u.entry_exit=r,"exit"===r&&(u.data.type="X"),p=2),("X"===s.data.type||"DB"===s.data.type)&&(s.entry_exit=r,r="entry"===r?"exit":"entry",f&&console.log("mark:",s.coords.usrCoords,s.data.type,s.entry_exit)),"DX"===s.data.type&&(0===p?(u=s,p=1,f&&console.log("Start intersection chain:",s.coords.usrCoords,s.data.type,r)):1===p?(s.entry_exit=r,u.entry_exit=r,"exit"===r?u.data.type="X":s.data.type="X",r="entry"===r?"exit":"entry",f&&(console.log("mark':",u.coords.usrCoords,u.data.type,u.entry_exit),console.log("mark:",s.coords.usrCoords,s.data.type,s.entry_exit)),u=null,p=0):2===p&&(s.entry_exit=r,s.data.type="X",r="entry"===r?"exit":"entry",u=null,p=0))),s=s._next,!n.A.exists(s._starter)&&!(o>1e4));)o++},_stayOnPath:function(t,e){var i=!0;return t.intersection&&"B"!==t.data.type&&(i=e===t.entry_exit),i},_addVertex:function(t,e,i){return(isNaN(e.coords.usrCoords[1])||isNaN(e.coords.usrCoords[2])||t.push(e),e.intersection&&e.data.done)?(i&&console.log("Add last intersection point",e.coords.usrCoords,"on",e.data.pathname,e.entry_exit,e.data.type),!0):(e.intersection&&(e.data.done=!0,i&&console.log("Add intersection point",e.coords.usrCoords,"on",e.data.pathname,e.entry_exit,e.data.type)),!1)},tracing:function(t,e,i){for(var r,s,o,n,a=0,h=1e4,l=0,c=[],d=!1,u=!1;l<e.length&&a<h;){if((o=e[l]).data.done||"X"!==o.data.type){l++;continue}u&&console.log("\nStart",o.data.pathname,o.coords.usrCoords,o.data.type,o.entry_exit,l),c.length>0&&c.push([NaN,NaN]),n=o.data.idx,r=t,d=this._addVertex(c,o,u),s=o.entry_exit;do{if(d)break;if("intersection"===i&&"entry"===o.entry_exit||"union"===i&&"exit"===o.entry_exit||"difference"===i&&r===t==("exit"===o.entry_exit)){u&&console.log("Go forward on",o.data.pathname,o.entry_exit);do if(o=o._next,d=this._addVertex(c,o,u))break;while(this._stayOnPath(o,s));a++}else{u&&console.log("Go backward on",o.data.pathname);do if(o=o._prev,d=this._addVertex(c,o,u))break;while(this._stayOnPath(o,s));a++}if(d)break;if(!o.neighbour)return console.log("Tracing: emergency break - no neighbour!!!!!!!!!!!!!!!!!",a),[[0],[0]];if(u&&console.log("Switch from",o.coords.usrCoords,o.data.pathname,"to",o.neighbour.coords.usrCoords,"on",o.neighbour.data.pathname),(o=o.neighbour).data.done)break;o.data.done=!0,s=o.entry_exit,r=o.data.path}while(o.data.idx!==n&&a<h);a>=h&&console.log("Tracing: stopping an infinite loop!",a),l++}return this._getCoordsArrays(c,!1)}
1,isEmptyCase:function(t,e,i){return"intersection"===i&&(0===t.length||0===e.length)||"union"===i&&0===t.length&&0===e.length||"difference"===i&&0===t.length},_getCoordsArrays:function(t,e){var i,r=[],s=[],o=t.length;for(i=0;i<o;i++)t[i].coords?(r.push(t[i].coords.usrCoords[1]),s.push(t[i].coords.usrCoords[2])):(r.push(t[i][0]),s.push(t[i][1]));return e&&o>0&&(t[0].coords?(r.push(t[0].coords.usrCoords[1]),s.push(t[0].coords.usrCoords[2])):(r.push(t[0][0]),s.push(t[0][1]))),[r,s]},handleEmptyIntersection:function(t,e,i){var r,s,o=!1,a=[];if(0===t.length)return a="union"===i?e:[],this._getCoordsArrays(a,!0);if(0===e.length)return a="intersection"===i?[]:t,this._getCoordsArrays(a,!0);if(t.length>0)for(r=t[0];r.intersection&&!(r=r._next)._end;);if(e.length>0)for(s=e[0];s.intersection&&!(s=s._next)._end;);return 0===c.A.windingNumber(r.coords.usrCoords,e)?0!==c.A.windingNumber(s.coords.usrCoords,t)?("union"===i?(n.A.concat(a,t),a.push(t[0])):"difference"===i&&(n.A.concat(a,t),a.push(t[0]),c.A.signedPolygon(t)*c.A.signedPolygon(e)>0&&a.reverse(),a.push([NaN,NaN])),("difference"===i||"intersection"===i)&&(n.A.concat(a,e),a.push(e[0]),o=!1)):"difference"===i?(n.A.concat(a,t),o=!0):"union"===i&&(n.A.concat(a,t),a.push(t[0]),a.push([NaN,NaN]),n.A.concat(a,e),a.push(e[0])):"intersection"===i?(n.A.concat(a,t),o=!0):"union"===i&&(n.A.concat(a,e),a.push(e[0])),this._getCoordsArrays(a,o)},_countCrossingIntersections:function(t){var e,i=t.length,r=0;for(e=0;e<i;e++)"X"===t[e].data.type&&r++;return r},_getPath:function(t,e){var i,r,s,a,h,l,d,u=[];if(t.elementClass===o.A.OBJECT_CLASS_CURVE&&(t.type===o.A.OBJECT_TYPE_ARC||t.type===o.A.OBJECT_TYPE_SECTOR)){for(d=Math.floor(180*(h=c.A.rad(t.radiuspoint,t.center,t.anglepoint))/Math.PI),s=t.Radius(),a=h/d,l=Math.atan2(t.radiuspoint.coords.usrCoords[2]-t.center.coords.usrCoords[2],t.radiuspoint.coords.usrCoords[1]-t.center.coords.usrCoords[1]),t.type===o.A.OBJECT_TYPE_SECTOR&&this._addToList(u,t.center.coords,0),i=0;i<=d;i++)this._addToList(u,new f.A(o.A.COORDS_BY_USER,[t.center.coords.usrCoords[0],t.center.coords.usrCoords[1]+Math.cos(i*a+l)*s,t.center.coords.usrCoords[2]+Math.sin(i*a+l)*s],e),i+1);t.type===o.A.OBJECT_TYPE_SECTOR&&this._addToList(u,t.center.coords,d+2)}else if(t.elementClass===o.A.OBJECT_CLASS_CURVE&&n.A.exists(t.points))for(i=0,r=t.numberPoints;i<r;i++)this._addToList(u,t.points[i],i);else if(t.type===o.A.OBJECT_TYPE_POLYGON)for(i=0;i<t.vertices.length;i++)this._addToList(u,t.vertices[i].coords,i);else if(t.elementClass===o.A.OBJECT_CLASS_CIRCLE)for(i=0,d=359,s=t.Radius(),a=2*Math.PI/d;i<=d;i++)this._addToList(u,new f.A(o.A.COORDS_BY_USER,[t.center.coords.usrCoords[0],t.center.coords.usrCoords[1]+Math.cos(i*a)*s,t.center.coords.usrCoords[2]+Math.sin(i*a)*s],e),i);else if(n.A.isArray(t))for(i=0,r=t.length;i<r;i++)n.A.exists(t[i].coords)?this._addToList(u,t[i].coords,i):n.A.isArray(t[i])?this._addToList(u,new f.A(o.A.COORDS_BY_USER,t[i],e),i):n.A.exists(t[i].usrCoords)&&this._addToList(u,t[i],i);return u},greinerHormann:function(t,e,i,r){var s,o,n,h=[],l=[],d=[],u=[],p=!1;return((s=(h=this._getPath(t,r)).length)>0&&c.A.distance(h[0].coords.usrCoords,h[s-1].coords.usrCoords,3)<a.A.eps&&h.pop(),(s=(l=this._getPath(e,r)).length)>0&&c.A.distance(l[0].coords.usrCoords,l[s-1].coords.usrCoords,3)<a.A.eps*a.A.eps&&l.pop(),this.isEmptyCase(h,l,i))?[[],[]]:(o=this.makeDoublyLinkedList(h),n=this.makeDoublyLinkedList(l),p&&(this._print_array(h),console.log("Components:",o),this._print_array(l),console.log("Components:",n)),d=(u=this.findIntersections(h,l,r))[0],this._handleFullyDegenerateCase(h,l,r),this.markEntryExit(h,l,o),this.markEntryExit(l,h,n),0===this._countCrossingIntersections(d))?this.handleEmptyIntersection(h,l,i):this.tracing(h,d,i)},union:function(t,e,i){return this.greinerHormann(t,e,"union",i)},intersection:function(t,e,i){return this.greinerHormann(t,e,"intersection",i)},difference:function(t,e,i){return this.greinerHormann(t,e,"difference",i)}};let v=a.A.Clip;a.A.Poly={},a.A.Poly.Ring=function(t){this.vars=t},r.A.extend(a.A.Poly.Ring.prototype,{}
1),a.A.Poly.Monomial=function(t,e,i){var r;if(!n.A.exists(t))throw Error("JSXGraph error: In JXG.Math.Poly.monomial missing parameter 'ring'.");for(n.A.isArray(i)||(i=[]),r=(i=i.slice(0,t.vars.length)).length;r<t.vars.length;r++)i.push(0);this.ring=t,this.coefficient=e||0,this.exponents=n.A.deepCopy(i)},r.A.extend(a.A.Poly.Monomial.prototype,{copy:function(){return new a.A.Poly.Monomial(this.ring,this.coefficient,this.exponents)},print:function(){var t,e=[];for(t=0;t<this.ring.vars.length;t++)e.push(this.ring.vars[t]+"^"+this.exponents[t]);return this.coefficient+"*"+e.join("*")}}),a.A.Poly.Polynomial=function(t,e){var i,r=function(){};if(!n.A.exists(t))throw Error("JSXGraph error: In JXG.Math.Poly.polynomial missing parameter 'ring'.");i=n.A.exists(e)&&n.A.isString(e)?r(e):[],this.ring=t,this.monomials=i},r.A.extend(a.A.Poly.Polynomial.prototype,{findSignature:function(t){var e;for(e=0;e<this.monomials.length;e++)if(n.A.cmpArrays(this.monomials[e].exponents,t))return e;return -1},addSubMonomial:function(t,e){var i;(i=this.findSignature(t.exponents))>-1?this.monomials[i].coefficient+=e*t.coefficient:(t.coefficient*=e,this.monomials.push(t))},add:function(t){var e;if(n.A.exists(t)&&t.ring===this.ring)if(n.A.isArray(t.exponents))this.addSubMonomial(t,1);else for(e=0;e<t.monomials.length;e++)this.addSubMonomial(t.monomials[e],1);else throw Error("JSXGraph error: In JXG.Math.Poly.polynomial.add either summand is undefined or rings don't match.")},sub:function(t){var e;if(n.A.exists(t)&&t.ring===this.ring)if(n.A.isArray(t.exponents))this.addSubMonomial(t,-1);else for(e=0;e<t.monomials.length;e++)this.addSubMonomial(t.monomials[e],-1);else throw Error("JSXGraph error: In JXG.Math.Poly.polynomial.sub either summand is undefined or rings don't match.")},copy:function(){var t,e;for(t=0,e=new a.A.Poly.Polynomial(this.ring);t<this.monomials.length;t++)e.monomials.push(this.monomials[t].copy());return e},print:function(){var t,e=[];for(t=0;t<this.monomials.length;t++)e.push("("+this.monomials[t].print()+")");return e.join("+")}}),a.A.Poly,i(87490);var y=i(28279);r.A.AbstractRenderer=function(){this.vOffsetText=0,this.enhancedRendering=!0,this.container=null,this.type="",this.supportsForeignObject=!1,this.dashArray=[[2,2],[5,5],[10,10],[20,20],[20,10,10,10],[20,5,10,5],[0,5]]},r.A.extend(r.A.AbstractRenderer.prototype,{_updateVisual:function(t,e,i){(i||this.enhancedRendering)&&(e=e||{},this.setObjectTransition(t),t.evalVisProp("draft")?this.setDraft(t):(e.stroke||(t.highlighted?(this.setObjectStrokeColor(t,t.evalVisProp("highlightstrokecolor"),t.evalVisProp("highlightstrokeopacity")),this.setObjectStrokeWidth(t,t.evalVisProp("highlightstrokewidth"))):(this.setObjectStrokeColor(t,t.evalVisProp("strokecolor"),t.evalVisProp("strokeopacity")),this.setObjectStrokeWidth(t,t.evalVisProp("strokewidth")))),e.fill||(t.highlighted?this.setObjectFillColor(t,t.evalVisProp("highlightfillcolor"),t.evalVisProp("highlightfillopacity")):this.setObjectFillColor(t,t.evalVisProp("fillcolor"),t.evalVisProp("fillopacity"))),e.dash||this.setDashStyle(t,t.visProp),e.shadow||this.setShadow(t),e.tabindex||this.setTabindex(t)),t.highlighted?this.setCssClass(t,t.evalVisProp("highlightcssclass")):this.setCssClass(t,t.evalVisProp("cssclass")),t.evalVisProp("aria.enabled")&&this.setARIA(t))},_getHighlighted:function(t){var e,i=!1;return n.A.exists(t.board)&&n.A.exists(t.board.highlightedObjects)||(i=!0),e=!i&&n.A.exists(t.board.highlightedObjects[t.id])?"highlight":""},drawPoint:function(t){var e,i=y.A.normalizePointFace(t.evalVisProp("face"));e="o"===i?"ellipse":"[]"===i?"rect":"path",t.rendNode=this.appendChildPrim(this.createPrim(e,t.id),t.evalVisProp("layer")),this.appendNodesToElement(t,e),this._updateVisual(t,{dash:!0,shadow:!0},!0),this.updatePoint(t)},updatePoint:function(t){var e,i=t.evalVisProp("size"),r=y.A.normalizePointFace(t.evalVisProp("face")),s=t.evalVisProp("sizeunit"),o=t.evalVisProp("zoom");isNaN(t.coords.scrCoords[2]+t.coords.scrCoords[1])||("user"===s&&(i*=Math.sqrt(Math.abs(t.board.unitX*t.board.unitY))),i*=t.board&&o?Math.sqrt(t.board.zoomX*t.board.zoomY):1,e=0===i?0:i+1,"o"===r?this.updateEllipsePrim(t.rendNode,t.coords.scrCoords[1],t.coords.scrCoords[2],e,e):"[]"===r?this.updateRectPrim(t.rendNode,t.coords.scrCoords[1]-i,t.coords.scrCoords[2]-i,2*i,2*i):this.updatePathPrim(t.rendNode,this.updatePathStringPoint(t,i,r),t.board),this._updateVisual(t,{dash:!1,shadow:!1}),this.setShadow(t))},changePointStyle:function(t){var e=this.getElementById(t.id);n.A.exists(e)&&this.remove(e),this.drawPoint(t),n.A.clearVisPropOld(t),t.visPropCalc.visible||this.display(t,!1),t.evalVisProp("draft")&&this.setDraft(t)}
1,drawLine:function(t){t.rendNode=this.appendChildPrim(this.createPrim("line",t.id),t.evalVisProp("layer")),this.appendNodesToElement(t,"lines"),this.updateLine(t)},updateLine:function(t){this._updateVisual(t),this.updatePathWithArrowHeads(t),this.setLineCap(t)},drawCurve:function(t){t.rendNode=this.appendChildPrim(this.createPrim("path",t.id),t.evalVisProp("layer")),this.appendNodesToElement(t,"path"),this.updateCurve(t)},updateCurve:function(t){this._updateVisual(t),this.updatePathWithArrowHeads(t),this.setLineCap(t)},updatePathWithArrowHeads:function(t,e){var i,r,s=e?"highlight":"";i=e&&t.evalVisProp("highlightstrokewidth")?Math.max(t.evalVisProp("highlightstrokewidth"),t.evalVisProp("strokewidth")):t.evalVisProp("strokewidth"),r=this.getArrowHeadData(t,i,s),this.makeArrows(t,r),t.elementClass===o.A.OBJECT_CLASS_LINE?this.updateLineWithEndings(t,r):t.elementClass===o.A.OBJECT_CLASS_CURVE&&this.updatePath(t),this.setArrowSize(t,r)},getArrowHeadData:function(t,e,i){var r,s,h,l,c=a.A.eps,d=0,u=0,p=0,f=0,A=t.evalVisProp("firstarrow"),m=t.evalVisProp("lastarrow");return(A||m)&&(r=n.A.exists(A.type)?t.eval(A.type):t.elementClass===o.A.OBJECT_CLASS_LINE?1:7,s=n.A.exists(m.type)?t.eval(m.type):t.elementClass===o.A.OBJECT_CLASS_LINE?1:7,A&&(l=6,n.A.exists(A.size)&&(l=t.eval(A.size)),""!==i&&n.A.exists(A[i+"size"])&&(l=t.eval(A[i+"size"])),h=e*l,2===r?(h*=.5,c+=e*l):3===r?(h=e*l/3,c+=e):4===r||5===r||6===r?(h=e*l/1.5,c+=e*l):7===r?(h=0,l=10,c+=e):c+=e*l,d+=h,p=l),m&&(l=6,n.A.exists(m.size)&&(l=t.eval(m.size)),""!==i&&n.A.exists(m[i+"size"])&&(l=t.eval(m[i+"size"])),h=e*l,2===s?(h*=.5,c+=e*l):3===s?(h=e*l/3,c+=e):4===s||5===s||6===s?(h=e*l/1.5,c+=e*l):7===s?(h=0,l=10,c+=e):c+=e*l,u+=h,f=l)),t.visPropCalc.typeFirst=r,t.visPropCalc.typeLast=s,{evFirst:A,evLast:m,typeFirst:r,typeLast:s,offFirst:d,offLast:u,sizeFirst:p,sizeLast:f,showFirst:1,showLast:1,minLen:c,strokeWidth:e}},updateLineWithEndings:function(t,e){var i,r,s=null;return i=new f.A(o.A.COORDS_BY_USER,t.point1.coords.usrCoords,t.board),r=new f.A(o.A.COORDS_BY_USER,t.point2.coords.usrCoords,t.board),s=t.evalVisProp("margin"),c.A.calcStraight(t,i,r,s),this.handleTouchpoints(t,i,r,e),this.getPositionArrowHead(t,i,r,e),this.updateLinePrim(t.rendNode,i.scrCoords[1],i.scrCoords[2],r.scrCoords[1],r.scrCoords[2],t.board),this},updatePath:function(t){return t.evalVisProp("handdrawing")?this.updatePathPrim(t.rendNode,this.updatePathStringBezierPrim(t),t.board):this.updatePathPrim(t.rendNode,this.updatePathStringPrim(t),t.board),this},getPositionArrowHead:function(t,e,i,r){var s,n,a,h,l;return(r.evFirst||r.evLast)&&(n=a=h=l=0,s=e.distance(o.A.COORDS_BY_SCREEN,i),r.evFirst&&"vml"!==t.board.renderer.type&&(s>=r.minLen?(n=(i.scrCoords[1]-e.scrCoords[1])*r.offFirst/s,a=(i.scrCoords[2]-e.scrCoords[2])*r.offFirst/s):r.showFirst=0),r.evLast&&"vml"!==t.board.renderer.type&&(s>=r.minLen?(h=(i.scrCoords[1]-e.scrCoords[1])*r.offLast/s,l=(i.scrCoords[2]-e.scrCoords[2])*r.offLast/s):r.showLast=0),e.setCoordinates(o.A.COORDS_BY_SCREEN,[e.scrCoords[1]+n,e.scrCoords[2]+a],!1,!0),i.setCoordinates(o.A.COORDS_BY_SCREEN,[i.scrCoords[1]-h,i.scrCoords[2]-l],!1,!0)),this},handleTouchpoints:function(t,e,i,r){var s,n,a,h,l,c,d;return(r.evFirst||r.evLast)&&(a=h=l=c=d=0,s=t.point1.evalVisProp("size")+t.point1.evalVisProp("strokewidth"),n=t.point2.evalVisProp("size")+t.point2.evalVisProp("strokewidth"),r.evFirst&&t.evalVisProp("touchfirstpoint")&&t.point1.evalVisProp("visible")&&(a=e.distance(o.A.COORDS_BY_SCREEN,i),h=(i.scrCoords[1]-e.scrCoords[1])*s/a,l=(i.scrCoords[2]-e.scrCoords[2])*s/a),r.evLast&&t.evalVisProp("touchlastpoint")&&t.point2.evalVisProp("visible")&&(a=e.distance(o.A.COORDS_BY_SCREEN,i),c=(i.scrCoords[1]-e.scrCoords[1])*n/a,d=(i.scrCoords[2]-e.scrCoords[2])*n/a),e.setCoordinates(o.A.COORDS_BY_SCREEN,[e.scrCoords[1]+h,e.scrCoords[2]+l],!1,!0),i.setCoordinates(o.A.COORDS_BY_SCREEN,[i.scrCoords[1]-c,i.scrCoords[2]-d],!1,!0)),this},setArrowSize:function(t,e){return e.evFirst&&this._setArrowWidth(t.rendNodeTriangleStart,e.showFirst*e.strokeWidth,t.rendNode,e.sizeFirst),e.evLast&&this._setArrowWidth(t.rendNodeTriangleEnd,e.showLast*e.strokeWidth,t.rendNode,e.sizeLast),this},setLineCap:function(t){},drawTicks:function(t){t.rendNode=this.appendChildPrim(this.createPrim("path",t.id),t.evalVisProp("layer")),this.appendNodesToElement(t,"path")},updateTicks:function(t){},drawEllipse:function(t){t.rendNode=this.appendChildPrim(this.createPrim("ellipse",t.id),t.evalVisProp("layer")),this.appendNodesToElement(t,"ellipse"),this.updateEllipse(t)},updateEllipse:function(t){this._updateVisual(t);var e=t.Radius();Math.abs(t.center.coords.usrCoords[0])>a.A.eps&&!isNaN(e+t.center.coords.scrCoords[1]+t.center.coords.scrCoords[2])&&e*t.board.unitX<2e6&&this.updateEllipsePrim(t.rendNode,t.center.coords.scrCoords[1],t.center.coords.scrCoords[2],e*t.board.unitX,e*t.board.unitY),this.setLineCap(t)},drawPolygon:function(t){t.rendNode=this.appendChildPrim(this.createPrim("polygon",t.id),t.evalVisProp("layer")),this.appendNodesToElement(t,"polygon"),this.updatePolygon(t)},updatePolygon:function(t){this._updateVisual(t,{stroke:!0,dash:!0}),this.updatePolygonPrim(t.rendNode,t)},displayCopyright:function(t,e){},drawInternalText:function(t){},updateInternalText:function(t){},drawText:function(t){var e,i,r,o;"html"===t.evalVisProp("display")&&s.A.isBrowser&&"no"!==this.type?((e=this.container.ownerDocument.createElement("div")).style.position="absolute",e.className=t.evalVisProp("cssclass"),r=t.evalVisProp("layer"),n.A.exists(r)||(r=0),i=""===this.container.style.zIndex?0:parseInt(this.container.style.zIndex,10),e.style.zIndex=i+r,this.container.appendChild(e),e.setAttribute("id",this.container.id+"_"+t.id)):e=this.drawInternalText(t),t.rendNode=e,t.htmlStr="",t.visProp.islabel&&n.A.exists(t.visProp.anchor)?(o=t.visProp.anchor.evalVisProp("visible"),t.prepareUpdate().updateVisibility(o)):t.prepareUpdate().updateVisibility(),this.updateText(t)}
1,updateText:function(t){var e,i,s,o,a,h,l,c,d,u,p,f=t.plaintext;if(t.visPropCalc.visible)if(this.updateTextStyle(t,!1),"html"===t.evalVisProp("display")&&"no"!==this.type){if(isNaN(t.coords.scrCoords[1]+t.coords.scrCoords[2])||(i=1e6>Math.abs(i=t.coords.scrCoords[1])?i:1e6,"right"===(a=t.getAnchorX())?(e=t.board.canvasWidth-i,u="right"):"middle"===a?(e=i-.5*t.size[0],u="center"):(e=i,u="left"),t.visPropOld.left!==a+e&&("right"===a?(t.rendNode.style.right=e+"px",t.rendNode.style.left="auto"):(t.rendNode.style.left=e+"px",t.rendNode.style.right="auto"),t.visPropOld.left=a+e),i=1e6>Math.abs(i=t.coords.scrCoords[2]+this.vOffsetText)?i:1e6,"bottom"===(h=t.getAnchorY())?(e=t.board.canvasHeight-i,p="bottom"):"middle"===h?(e=i-.5*t.size[1],p="center"):(e=i,p="top"),t.visPropOld.top!==h+e&&("bottom"===h?(t.rendNode.style.top="auto",t.rendNode.style.bottom=e+"px"):(t.rendNode.style.bottom="auto",t.rendNode.style.top=e+"px"),t.visPropOld.top=h+e)),t.htmlStr!==f){try{t.type===n.A.OBJECT_TYPE_BUTTON?t.rendNodeButton.innerHTML=f:t.type===n.A.OBJECT_TYPE_CHECKBOX||t.type===n.A.OBJECT_TYPE_INPUT?t.rendNodeLabel.innerHTML=f:t.rendNode.innerHTML=f}catch(e){s=t.rendNode.parentNode,t.rendNode.parentNode.removeChild(t.rendNode),t.rendNode.innerHTML=f,s.appendChild(t.rendNode)}if(t.htmlStr=f,t.evalVisProp("usemathjax"))try{MathJax.typeset?MathJax.typeset([t.rendNode]):MathJax.Hub.Queue(["Typeset",MathJax.Hub,t.rendNode])}catch(t){r.A.debug("MathJax (not yet) loaded")}else if(t.evalVisProp("usekatex"))try{(o=0===t.rendNode.innerHTML.indexOf("<span")&&t.rendNode.innerHTML.indexOf("<label")>0&&(t.rendNode.innerHTML.indexOf("<checkbox")>0||t.rendNode.innerHTML.indexOf("<input")>0)?t.rendNodeLabel:0===t.rendNode.innerHTML.indexOf("<button")?t.rendNodeButton:t.rendNode)&&katex.render(f,o,{macros:t.evalVisProp("katexmacros"),throwOnError:!1})}catch(t){r.A.debug("KaTeX not loaded (yet)")}else if(t.evalVisProp("useasciimathml"))try{AMprocessNode(t.rendNode,!1)}catch(t){r.A.debug("AsciiMathML not loaded (yet)")}}0!==(l=t.evalVisProp("rotate"))&&(l*=Math.PI/180,c=Math.cos(l),d=Math.sin(l),t.rendNode.style.transform="matrix("+[c,-1*d,d,c,0,0].join(",")+")",t.rendNode.style["transform-origin"]=u+" "+p),this.transformRect(t,t.transformations)}else this.updateInternalText(t)},_css2js:function(t){var e,i,r,s,o=[],a=n.A.trim(t).replace(/;$/,"").split(";");for(e=0,i=a.length;e<i;++e)""!==n.A.trim(a[e])&&(s=a[e].split(":"),r=n.A.trim(s[0].replace(/-([a-z])/gi,function(t,e){return e.toUpperCase()})),o.push({key:r,val:n.A.trim(s[1])}));return o},updateTextStyle:function(t,e){var i,r,o,a,h,l,c,d,u,p=s.A.isBrowser?t.visProp.display:"internal",f=["rendNode","rendNodeTag","rendNodeLabel"],A=f.length,m=t.evalVisProp("fontunit"),b=["cssdefaultstyle","cssstyle"],g=b.length;if(e?(o=t.evalVisProp("highlightstrokecolor"),r=t.evalVisProp("highlightstrokeopacity"),a=t.evalVisProp("highlightcssclass")):(o=t.evalVisProp("strokecolor"),r=t.evalVisProp("strokeopacity"),a=t.evalVisProp("cssclass")),"no"!==this.type&&("html"===p||"canvas"!==this.type)){for(d=0;d<g;d++)if(""!==(u=t.evalVisProp((e?"highlight":"")+b[d]))&&t.visPropOld[b[d]]!==u){for(h=0,l=this._css2js(u);h<A;h++)if(n.A.exists(t[f[h]]))for(c in l)l.hasOwnProperty(c)&&(t[f[h]].style[l[c].key]=l[c].val);t.visPropOld[b[d]]=u}if(i=t.evalVisProp("fontsize"),t.visPropOld.fontsize!==i){t.needsSizeUpdate=!0;try{for(h=0;h<A;h++)n.A.exists(t[f[h]])&&(t[f[h]].style.fontSize=i+m)}catch(e){for(h=0;h<A;h++)n.A.exists(t[f[h]])&&(t[f[h]].style.fontSize=i)}t.visPropOld.fontsize=i}}return this.setTabindex(t),this.setObjectTransition(t),"html"===p&&"no"!==this.type?(t.visPropOld.cssclass!==a&&(t.rendNode.className=a,t.visPropOld.cssclass=a,t.needsSizeUpdate=!0),this.setObjectStrokeColor(t,o,r)):this.updateInternalTextStyle(t,o,r),t.evalVisProp("aria.enabled")&&this.setARIA(t),this},updateInternalTextStyle:function(t,e,i){this.setObjectStrokeColor(t,e,i)},drawImage:function(t){},updateImage:function(t){this.updateRectPrim(t.rendNode,t.coords.scrCoords[1],t.coords.scrCoords[2]-t.size[1],t.size[0],t.size[1]),this.updateImageURL(t),this.transformRect
1(t,t.transformations),this._updateVisual(t,{stroke:!0,dash:!0},!0)},joinTransforms:function(t,e){var i,r=t.board.origin.scrCoords[1],s=t.board.origin.scrCoords[2],o=t.board.unitX,n=t.board.unitY,h=e.length,l=[[1,0,0],[-r/o,1/o,0],[s/n,0,-1/n]];for(i=0;i<h;i++)l=a.A.matMatMult(e[i].matrix,l);return a.A.matMatMult([[1,0,0],[r,o,0],[s,0,-n]],l)},transformRect:function(t,e){},updateImageURL:function(t){},updateImageStyle:function(t,e){t.rendNode.className=t.evalVisProp(e?"highlightcssclass":"cssclass")},drawForeignObject:function(t){},updateForeignObject:function(t){},appendChildPrim:function(t,e){},appendNodesToElement:function(t,e){},createPrim:function(t,e){return null},remove:function(t){},makeArrows:function(t,e){},_setArrowWidth:function(t,e,i){},updateEllipsePrim:function(t,e,i,r,s){},updateLinePrim:function(t,e,i,r,s,o){},updatePathPrim:function(t,e,i){},updatePathStringPoint:function(t,e,i){},updatePathStringPrim:function(t){},updatePathStringBezierPrim:function(t){},updatePolygonPrim:function(t,e){},updateRectPrim:function(t,e,i,r,s){},display:function(t,e){t&&(t.visPropOld.visible=e)},hide:function(t){},highlight:function(t,e){var i,r,s;if(this.setObjectTransition(t),!t.visProp.draft){if(t.type===o.A.OBJECT_TYPE_POLYGON)for(this.setObjectFillColor(t,t.evalVisProp("highlightfillcolor"),t.evalVisProp("highlightfillopacity")),r=t.evalVisProp("highlightbystrokewidth"),i=0;i<t.borders.length;i++)this.highlight(t.borders[i],!r);else t.elementClass===o.A.OBJECT_CLASS_TEXT?this.updateTextStyle(t,!0):(t.type===o.A.OBJECT_TYPE_IMAGE?this.updateImageStyle(t,!0):this.setObjectStrokeColor(t,t.evalVisProp("highlightstrokecolor"),t.evalVisProp("highlightstrokeopacity")),this.setObjectFillColor(t,t.evalVisProp("highlightfillcolor"),t.evalVisProp("highlightfillopacity")));!e&&t.evalVisProp("highlightstrokewidth")&&(s=Math.max(t.evalVisProp("highlightstrokewidth"),t.evalVisProp("strokewidth")),this.setObjectStrokeWidth(t,s),(t.elementClass===o.A.OBJECT_CLASS_LINE||t.elementClass===o.A.OBJECT_CLASS_CURVE)&&this.updatePathWithArrowHeads(t,!0))}return this.setCssClass(t,t.evalVisProp("highlightcssclass")),this},noHighlight:function(t){var e,i;if(this.setObjectTransition(t),!t.evalVisProp("draft")){if(t.type===o.A.OBJECT_TYPE_POLYGON)for(this.setObjectFillColor(t,t.evalVisProp("fillcolor"),t.evalVisProp("fillopacity")),e=0;e<t.borders.length;e++)this.noHighlight(t.borders[e]);else t.elementClass===o.A.OBJECT_CLASS_TEXT?this.updateTextStyle(t,!1):(t.type===o.A.OBJECT_TYPE_IMAGE?this.updateImageStyle(t,!1):this.setObjectStrokeColor(t,t.evalVisProp("strokecolor"),t.evalVisProp("strokeopacity")),this.setObjectFillColor(t,t.evalVisProp("fillcolor"),t.evalVisProp("fillopacity")));i=t.evalVisProp("strokewidth"),this.setObjectStrokeWidth(t,i),(t.elementClass===o.A.OBJECT_CLASS_LINE||t.elementClass===o.A.OBJECT_CLASS_CURVE)&&this.updatePathWithArrowHeads(t,!1)}return this.setCssClass(t,t.evalVisProp("cssclass")),this},removeDraft:function(t){this.setObjectTransition(t),t.type===o.A.OBJECT_TYPE_POLYGON?this.setObjectFillColor(t,t.evalVisProp("fillcolor"),t.evalVisProp("fillopacity")):(t.type===o.A.OBJECT_CLASS_POINT&&this.setObjectFillColor(t,t.evalVisProp("fillcolor"),t.evalVisProp("fillopacity")),this.setObjectStrokeColor(t,t.evalVisProp("strokecolor"),t.evalVisProp("strokeopacity")),this.setObjectStrokeWidth(t,t.evalVisProp("strokewidth")))},setARIA:function(t){},setBuffering:function(t,e){},setCssClass:function(t,e){},setDashStyle:function(t){},setDraft:function(t){if(t.evalVisProp("draft")){var e=t.board.options.elements.draft.color,i=t.board.options.elements.draft.opacity;this.setObjectTransition(t),t.type===o.A.OBJECT_TYPE_POLYGON?this.setObjectFillColor(t,e,i):(t.elementClass===o.A.OBJECT_CLASS_POINT?this.setObjectFillColor(t,e,i):this.setObjectFillColor(t,"none",0),this.setObjectStrokeColor(t,e,i),this.setObjectStrokeWidth(t,t.board.options.elements.draft.strokeWidth))}},setGradient:function(t){},setLayer:function(t,e){},setObjectFillColor:function(t,e,i){},setObjectStrokeColor:function(t,e,i){},setObjectStrokeWidth:function(t,e){},setObjectTransition:function(t,e){}
1,setPropertyPrim:function(t,e,i){},setShadow:function(t){},setTabindex:function(t){},show:function(t){},updateGradient:function(t){},suspendRedraw:function(){},unsuspendRedraw:function(){},drawNavigationBar:function(t,e){var i,r,o=function(t){t||(t=window.event),t.stopPropagation?t.stopPropagation():t.cancelBubble=!0},a=function(e,a,h,l){var c;h=h||"",(c=i.createElement("span")).innerHTML=e,c.style.paddingLeft="7px",c.style.paddingRight="7px",void 0!==c.classList&&(c.classList.add("JXG_navigation_button"),c.classList.add("JXG_navigation_button_"+l)),c.setAttribute("id",h+"_navigation_"+l),c.setAttribute("aria-hidden","true"),r.appendChild(c),s.A.addEvent(c,"click",function(e){return n.A.bind(a,t)(),!1},t),s.A.addEvent(c,"pointerup",o,t),s.A.addEvent(c,"pointerdown",o,t),s.A.addEvent(c,"pointerleave",o,t),s.A.addEvent(c,"mouseup",o,t),s.A.addEvent(c,"mousedown",o,t),s.A.addEvent(c,"touchend",o,t),s.A.addEvent(c,"touchstart",o,t)};s.A.isBrowser&&"no"!==this.type&&((r=(i=t.containerObj.ownerDocument).createElement("div")).setAttribute("id",t.container+"_navigationbar"),r.style.color=e.strokecolor,r.style.backgroundColor=e.fillcolor,r.style.padding=e.padding,r.style.position=e.position,r.style.fontSize=e.fontsize,r.style.cursor=e.cursor,r.style.zIndex=e.zindex,t.containerObj.appendChild(r),r.style.right=e.right,r.style.bottom=e.bottom,void 0!==r.classList&&r.classList.add("JXG_navigation"),t.attr.showfullscreen&&a(t.attr.fullscreen.symbol,function(){t.toFullscreen(t.attr.fullscreen.id)},t.container,"fullscreen"),t.attr.showscreenshot&&a(t.attr.screenshot.symbol,function(){window.setTimeout(function(){t.renderer.screenshot(t,"",!1)},330)},t.container,"screenshot"),t.attr.showreload&&a("â»",function(){t.reload()},t.container,"reload"),t.attr.showcleartraces&&a("â",function(){t.clearTraces()},t.container,"cleartraces"),t.attr.shownavigation&&(t.attr.showzoom&&(a("â",t.zoomOut,t.container,"out"),a("o",t.zoom100,t.container,"100"),a("+",t.zoomIn,t.container,"in")),a("â",t.clickLeftArrow,t.container,"left"),a("â",t.clickUpArrow,t.container,"down"),a("â",t.clickDownArrow,t.container,"up"),a("â",t.clickRightArrow,t.container,"right")))},getElementById:function(t){var e;return n.A.exists(this.container)?(e=this.container.id+"_"+t,n.A.exists(CSS)&&n.A.exists(CSS.escape)&&(e=CSS.escape(e)),this.container.querySelector("#"+e)):""},removeToInsertLater:function(t){var e=t.parentNode,i=t.nextSibling;if(null!==e)return e.removeChild(t),function(){i?e.insertBefore(t,i):e.appendChild(t)}},resize:function(t,e){},createTouchpoints:function(t){},showTouchpoint:function(t){},hideTouchpoint:function(t){},updateTouchpoint:function(t,e){},dumpToDataURI:function(t){},dumpToCanvas:function(t,e,i,r){},screenshot:function(t){}});let C=r.A.AbstractRenderer;var _=0,P=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,8,8,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,10,3,3,3,3,3,3,3,3,3,3,3,3,4,3,3,11,6,6,6,5,8,8,8,8,8,8,8,8,8,8,8,0,12,24,36,60,96,84,12,12,12,48,72,12,12,12,12,12,12,12,12,12,12,12,12,12,0,12,12,12,12,12,0,12,0,12,12,12,24,12,12,12,12,12,24,12,24,12,12,12,12,12,12,12,12,12,24,12,12,12,12,12,24,12,12,12,12,12,12,12,24,12,12,12,12,12,12,12,12,12,36,12,36,12,12,12,36,12,12,12,12,12,36,12,36,12,12,12,36,12,12,12,12,12,12,12,12,12,12];r.A.Util=r.A.Util||{},r.A.Util.UTF8={encode:function(t){var e,i,r="",s=t.length;if(t=t.replace(/\r\n/g,"\n"),"function"==typeof unescape&&"function"==typeof encodeURIComponent)return unescape(encodeURIComponent(t));for(e=0;e<s;e++)(i=t.charCodeAt(e))<128?r+=String.fromCharCode(i):(i>127&&i<2048?r+=String.fromCharCode(i>>6|192):(r+=String.fromCharCode(i>>12|224),r+=String.fromCharCode(i>>6&63|128)),r+=String.fromCharCode(63&i|128));return r},decode:function(t){var e,i,r,s=0,o=0,n=_,a=[],h=t.length,l=[];for(e=0;e<h;e++)r=P[i=t.charCodeAt(e)],o=n!==_?63&i|o<<6:255>>r&i,(n=P[256+n+r])===_&&(o>65535?a.push(55232+(o>>10),56320+(1023&o)):a.push(o),++s%1e4==0&&(l.push(String.fromCharCode.apply(null,a)),a=[]));return l.push(String.fromCharCode.apply(null,a)),l.join("")},asciiCharCodeAt:function(t,e){var i=t.charCodeAt(e);if(i>255)switch(i){case 8364:i=128;break;case 8218:i=130;break;case 402:i=131;break;case 8222:i=132;break;case 8230:i=133;break;case 8224:i=134;break;case 8225:i=135;break;case 710:i=136;break;case 8240:i=137;break;case 352:i=138;break;case 8249:i=139;break;case 338:i=140;break;case 381:i=142;break;case 8216:i=145;break;case 8217:i=146;break;case 8220:i=147;break;case 8221:i=148;break;case 8226:i=149;break;case 8211:i=150;break;case 8212:i=151;break;case 732:i=152;break;
1case 8482:i=153;break;case 353:i=154;break;case 8250:i=155;break;case 339:i=156;break;case 382:i=158;break;case 376:i=159}return i}};let x=r.A.Util.UTF8;var E="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",S="=";r.A.Util=r.A.Util||{},r.A.Util.Base64={_getByte:function(t,e){return 255&t.charCodeAt(e)},_getIndex:function(t,e){return E.indexOf(t.charAt(e))},encode:function(t){var e,i,r,s,o,n=[];for(e=0,s=(r=(o=x.encode(t)).length)%3;e<r-s;e+=3)i=this._getByte(o,e)<<16|this._getByte(o,e+1)<<8|this._getByte(o,e+2),n.push(E.charAt(i>>18),E.charAt(i>>12&63),E.charAt(i>>6&63),E.charAt(63&i));switch(s){case 1:i=this._getByte(o,r-1),n.push(E.charAt(i>>2),E.charAt(i<<4&63),S,S);break;case 2:i=this._getByte(o,r-2)<<8|this._getByte(o,r-1),n.push(E.charAt(i>>10),E.charAt(i>>4&63),E.charAt(i<<2&63),S)}return n.join("")},decode:function(t,e){var i,r,s,o,n,a,h=[],l=[];if((s=(i=t.replace(/[^A-Za-z0-9+/=]/g,"")).length)%4!=0)throw Error("JSXGraph/utils/base64: Can't decode string (invalid input length).");for(i.charAt(s-1)===S&&(o=1,i.charAt(s-2)===S&&(o=2),s-=4),r=0;r<s;r+=4)n=this._getIndex(i,r)<<18|this._getIndex(i,r+1)<<12|this._getIndex(i,r+2)<<6|this._getIndex(i,r+3),l.push(n>>16,n>>8&255,255&n),r%1e4==0&&(h.push(String.fromCharCode.apply(null,l)),l=[]);switch(o){case 1:n=this._getIndex(i,s)<<12|this._getIndex(i,s+1)<<6|this._getIndex(i,s+2),l.push(n>>10,n>>2&255);break;case 2:n=this._getIndex(i,r)<<6|this._getIndex(i,r+1),l.push(n>>4)}return h.push(String.fromCharCode.apply(null,l)),a=h.join(""),e&&(a=x.decode(a)),a},decodeAsArray:function(t){var e,i=this.decode(t),r=[],s=i.length;for(e=0;e<s;e++)r[e]=i.charCodeAt(e);return r}};let N=r.A.Util.Base64;r.A.FileReader={handleRemoteFile:function(t,e,i,s,o,a){var h=!1;try{h=new XMLHttpRequest,"raw"===i.toLowerCase()?h.overrideMimeType("text/plain; charset="+o):h.overrideMimeType("text/xml; charset="+o)}catch(t){try{h=new ActiveXObject("Msxml2.XMLHTTP")}catch(t){try{h=new ActiveXObject("Microsoft.XMLHTTP")}catch(t){h=!1}}}if(!h)return void r.A.debug("AJAX not activated!");h.open("GET",t,s),"raw"===i.toLowerCase()?this.cbp=function(){var t=h;4===t.readyState&&e(t.responseText)}:this.cbp=function(){var t=h,r="";4===t.readyState&&(r=n.A.exists(t.responseStream)&&("PK"===t.responseText.slice(0,2)||31===x.asciiCharCodeAt(t.responseText.slice(0,1),0))?N.decode(jxgBinFileReader(t)):t.responseText,this.parseString(r,e,i,a))},this.cb=n.A.bind(this.cbp,this),h.onreadystatechange=this.cb;try{h.send(null)}catch(e){throw Error("JSXGraph: A problem occurred while trying to read remote file '"+t+"'.")}},handleLocalFile:function(t,e,i,r,s,o){n.A.exists(r)||(r=!0),"raw"===i.toLowerCase()?this.cbp=function(t){e(t.target.result)}:this.cbp=function(t){var r=t.target.result;this.parseString(r,e,i,o)},this.cb=n.A.bind(this.cbp,this);var a=new FileReader;a.onload=this.cb,"raw"===i.toLowerCase()?a.readAsText(t):a.readAsText(t,s)},parseFileContent:function(t,e,i,r,s,o){n.A.isString(t)||void 0===FileReader?this.handleRemoteFile(t,e,i,r,s,o):this.handleLocalFile(t,e,i,r,s,o)},parseString:function(t,e,i,s){var o;if(i=i.toLowerCase(),o=r.A.readers[i],n.A.exists(o))new o(e,t).read();else if("jessiecode"===i);else throw Error("JSXGraph: There is no reader available for '"+i+"'.");n.A.isFunction(s)&&s(e)}},!s.A.isMetroApp()&&s.A.isBrowser&&"object"==typeof navigator&&/msie/i.test(navigator.userAgent)&&!/opera/i.test(navigator.userAgent)&&document&&document.write&&document.write('
1<script type="text/vbscript">\nFunction Base64Encode(inData)\n Const Base64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"\n Dim cOut, sOut, I\n For I = 1 To LenB(inData) Step 3\n Dim nGroup, pOut, sGroup\n nGroup = &H10000 * AscB(MidB(inData, I, 1)) + _\n &H100 * MyASC(MidB(inData, I + 1, 1)) + MyASC(MidB(inData, I + 2, 1))\n nGroup = Oct(nGroup)\n nGroup = String(8 - Len(nGroup), "0") & nGroup\n pOut = Mid(Base64, CLng("&o" & Mid(nGroup, 1, 2)) + 1, 1) + _\n Mid(Base64, CLng("&o" & Mid(nGroup, 3, 2)) + 1, 1) + _\n Mid(Base64, CLng("&o" & Mid(nGroup, 5, 2)) + 1, 1) + _\n Mid(Base64, CLng("&o" & Mid(nGroup, 7, 2)) + 1, 1)\n sOut = sOut + pOut\n Next\n Select Case LenB(inData) Mod 3\n Case 1: \'8 bit final\n sOut = Left(sOut, Len(sOut) - 2) + "=="\n Case 2: \'16 bit final\n sOut = Left(sOut, Len(sOut) - 1) + "="\n End Select\n Base64Encode = sOut\nEnd Function\n\nFunction MyASC(OneChar)\n If OneChar = "" Then MyASC = 0 Else MyASC = AscB(OneChar)\nEnd Function\n\nFunction jxgBinFileReader(xhr)\n Dim byteString\n Dim b64String\n Dim i\n byteString = xhr.responseBody\n ReDim byteArray(LenB(byteString))\n For i = 1 To LenB(byteString)\n byteArray(i-1) = AscB(MidB(byteString, i, 1))\n Next\n b64String = Base64Encode(byteString)\n jxgBinFileReader = b64String\nEnd Function\n<\/script>\n');let T=r.A.FileReader;var w=i(35283),O=i(70593),M=i(20708);r.A.SVGRenderer=function(t,e){var i;for(this.type="svg",this.isIE=-1!==navigator.appVersion.indexOf("MSIE")||navigator.userAgent.match(/Trident\//),this.svgRoot=null,this.svgNamespace="http://www.w3.org/2000/svg",this.xlinkNamespace="http://www.w3.org/1999/xlink",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.svgRoot=this.container.ownerDocument.createElementNS(this.svgNamespace,"svg"),this.svgRoot.style.overflow="hidden",this.svgRoot.style.display="block",this.resize(e.width,e.height),this.container.appendChild(this.svgRoot),this.defs=this.container.ownerDocument.createElementNS(this.svgNamespace,"defs"),this.svgRoot.appendChild(this.defs),this.createShadowFilter=function(t,e,i,r,s,o){var a,h,l,c,d,u=this.container.ownerDocument.createElementNS(this.svgNamespace,"filter");return u.setAttributeNS(null,"id",t),u.setAttributeNS(null,"width","300%"),u.setAttributeNS(null,"height","300%"),u.setAttributeNS(null,"filterUnits","userSpaceOnUse"),(a=this.container.ownerDocument.createElementNS(this.svgNamespace,"feOffset")).setAttributeNS(null,"in","SourceGraphic"),a.setAttributeNS(null,"result","offOut"),a.setAttributeNS(null,"dx",o[0]),a.setAttributeNS(null,"dy",o[1]),u.appendChild(a),(h=this.container.ownerDocument.createElementNS(this.svgNamespace,"feColorMatrix")).setAttributeNS(null,"in","offOut"),h.setAttributeNS(null,"result","colorOut"),h.setAttributeNS(null,"type","matrix"),"none"===e||!n.A.isArray(e)||e.length<3?h.setAttributeNS(null,"values","0.1 0 0 0 0 0 0.1 0 0 0 0 0 0.1 0 0 0 0 0 "+i+" 0"):(e[0]/=255,e[1]/=255,e[2]/=255,d=r+" 0 0 0 "+e[0]+" 0 "+r+" 0 0 "+e[1]+" 0 0 "+r+" 0 "+e[2]+" 0 0 0 "+i+" 0",h.setAttributeNS(null,"values",d)),u.appendChild(h),(l=this.container.ownerDocument.createElementNS(this.svgNamespace,"feGaussianBlur")).setAttributeNS(null,"in","colorOut"),l.setAttributeNS(null,"result","blurOut"),l.setAttributeNS(null,"stdDeviation",s),u.appendChild(l),(c=this.container.ownerDocument.createElementNS(this.svgNamespace,"feBlend")).setAttributeNS(null,"in","SourceGraphic"),c.setAttributeNS(null,"in2","blurOut"),c.setAttributeNS(null,"mode","normal"),u.appendChild(c),u},this.uniqName=function(){return this.container.id+"_"+Array.prototype.slice.call(arguments).join("_")},this.toStr=function(){var t=Array.prototype.slice.call(arguments).join("");return n.A.exists(CSS)&&n.A.exists(CSS.escape)&&(t=CSS.escape(t)),t},this.toURL=function(){return"url(#"+this.toStr.apply(this,arguments)+")"},this.defs.appendChild(this.createShadowFilter(this.uniqName("f1"),"none",1,.1,3,[5,5])),this.layer=[],i=0;i<y.A.layer.numlayers;i++)this.layer[i]=this.container.ownerDocument.createElementNS(this.svgNamespace,"g"),this.svgRoot.appendChild(this.layer[i]);try{this.foreignObjLayer=this.container.ownerDocument.createElementNS(this.svgNamespace,"foreignObject"),this.foreignObjLayer.setAttribute("display","none"),this.foreignObjLayer.setAttribute("x",0),this.foreignObjLayer.setAttribute("y",0),this.foreignObjLayer.setAttribute("width","100%"),this.foreignObjLayer.setAttribute("height","100%"),this.foreignObjLayer.setAttribute("id",this.uniqName("foreignObj")),this.svgRoot.appendChild(this.foreignObjLayer),this.supportsForeignObject=!0}catch(t){this.supportsForeignObject=!1}},r.A.SVGRenderer.prototype=new C,r.A.extend(r.A.SVGRenderer.prototype,{_createArrowHead:function(t,e,
1i){var r,s,a,h,l=t.id+"Triangle";return n.A.exists(e)&&(l+=e),n.A.exists(i)&&(l+=i),(r=this.createPrim("marker",l)).setAttributeNS(null,"stroke",t.evalVisProp("strokecolor")),r.setAttributeNS(null,"stroke-opacity",t.evalVisProp("strokeopacity")),r.setAttributeNS(null,"fill",t.evalVisProp("strokecolor")),r.setAttributeNS(null,"fill-opacity",t.evalVisProp("strokeopacity")),r.setAttributeNS(null,"stroke-width",0),r.setAttributeNS(null,"orient","auto"),r.setAttributeNS(null,"markerUnits","strokeWidth"),s=this.container.ownerDocument.createElementNS(this.svgNamespace,"path"),h=5,"Start"===e?(a=0,2===i?s.setAttributeNS(null,"d","M 10,0 L 0,5 L 10,10 L 5,5 z"):3===i?s.setAttributeNS(null,"d","M 0,0 L 3.33,0 L 3.33,10 L 0,10 z"):4===i?(h=3.31,s.setAttributeNS(null,"d","M 0.00,3.31 C 3.53,3.84 7.13,4.50 10.00,6.63 C 9.33,5.52 8.67,4.42 8.00,3.31 C 8.67,2.21 9.33,1.10 10.00,0.00 C 7.13,2.13 3.53,2.79 0.00,3.31")):5===i?(h=3.28,s.setAttributeNS(null,"d","M 0.00,3.28 C 3.39,4.19 6.81,5.07 10.00,6.55 C 9.38,5.56 9.00,4.44 9.00,3.28 C 9.00,2.11 9.38,0.99 10.00,0.00 C 6.81,1.49 3.39,2.37 0.00,3.28")):6===i?(h=2.84,s.setAttributeNS(null,"d","M 0.00,2.84 C 3.39,3.59 6.79,4.35 10.00,5.68 C 9.67,4.73 9.33,3.78 9.00,2.84 C 9.33,1.89 9.67,0.95 10.00,0.00 C 6.79,1.33 3.39,2.09 0.00,2.84")):7===i?(h=5.2,s.setAttributeNS(null,"d","M 0.00,5.20 C 4.04,5.20 7.99,6.92 10.00,10.39 M 10.00,0.00 C 7.99,3.47 4.04,5.20 0.00,5.20")):s.setAttributeNS(null,"d","M 10,0 L 0,5 L 10,10 z"),t.elementClass===o.A.OBJECT_CLASS_LINE&&(a=2===i?4.9:3===i?3.3:4===i||5===i||6===i?6.66:10*(7!==i))):(a=10,2===i?s.setAttributeNS(null,"d","M 0,0 L 10,5 L 0,10 L 5,5 z"):3===i?(a=3.3,s.setAttributeNS(null,"d","M 0,0 L 3.33,0 L 3.33,10 L 0,10 z")):4===i?(h=3.31,s.setAttributeNS(null,"d","M 10.00,3.31 C 6.47,3.84 2.87,4.50 0.00,6.63 C 0.67,5.52 1.33,4.42 2.00,3.31 C 1.33,2.21 0.67,1.10 0.00,0.00 C 2.87,2.13 6.47,2.79 10.00,3.31")):5===i?(h=3.28,s.setAttributeNS(null,"d","M 10.00,3.28 C 6.61,4.19 3.19,5.07 0.00,6.55 C 0.62,5.56 1.00,4.44 1.00,3.28 C 1.00,2.11 0.62,0.99 0.00,0.00 C 3.19,1.49 6.61,2.37 10.00,3.28")):6===i?(h=2.84,s.setAttributeNS(null,"d","M 10.00,2.84 C 6.61,3.59 3.21,4.35 0.00,5.68 C 0.33,4.73 0.67,3.78 1.00,2.84 C 0.67,1.89 0.33,0.95 0.00,0.00 C 3.21,1.33 6.61,2.09 10.00,2.84")):7===i?(h=5.2,s.setAttributeNS(null,"d","M 10.00,5.20 C 5.96,5.20 2.01,6.92 0.00,10.39 M 0.00,0.00 C 2.01,3.47 5.96,5.20 10.00,5.20")):s.setAttributeNS(null,"d","M 0,0 L 10,5 L 0,10 z"),t.elementClass===o.A.OBJECT_CLASS_LINE&&(a=2===i?5.1:3===i?.02:4===i||5===i||6===i?3.33:7===i?10:.05)),7===i&&(r.setAttributeNS(null,"fill","none"),r.setAttributeNS(null,"stroke-width",1)),r.setAttributeNS(null,"refY",h),r.setAttributeNS(null,"refX",a),r.appendChild(s),r},_setArrowColor:function(t,e,i,r,s){t&&(n.A.isString(e)&&(7!==s?this._setAttribute(function(){t.setAttributeNS(null,"stroke",e),t.setAttributeNS(null,"fill",e),t.setAttributeNS(null,"stroke-opacity",i),t.setAttributeNS(null,"fill-opacity",i)},r.visPropOld.fillcolor):this._setAttribute(function(){t.setAttributeNS(null,"fill","none"),t.setAttributeNS(null,"stroke",e),t.setAttributeNS(null,"stroke-opacity",i)},r.visPropOld.fillcolor)),r.rendNode.parentNode.insertBefore(r.rendNode,r.rendNode))},_setArrowWidth:function(t,e,i,r){var s,o;t&&(o=(s=e)*r,t.setAttributeNS(null,"viewBox","0 0 "+10*s+" "+10*s),t.setAttributeNS(null,"markerHeight",o),t.setAttributeNS(null,"markerWidth",o),t.setAttributeNS(null,"display","inherit"),i.parentNode.insertBefore(i,i))},updateTicks:function(t){var e,i,r,s,o,a,h,l,c="",d=t.ticks.length,u=!0;for(e=0;e<d;e++){for(o=(r=t.ticks[e])[0],a=r[1],h=o.length,l=" M "+o[0]+" "+a[0],n.A.isNumber(o[0])||(u=!1),i=1;u&&i<h;++i)n.A.isNumber(o[i])?l+=" L "+o[i]+" "+a[i]:u=!1;u&&(c+=l)}s=t.rendNode,n.A.exists(s)||(s=this.createPrim("path",t.id),this.appendChildPrim(s,t.evalVisProp("layer")),t.rendNode=s),s.setAttributeNS(null,"stroke",t.evalVisProp("strokecolor")),s.setAttributeNS(null,"fill","none"),s.setAttributeNS(null,"stroke-opacity",t.evalVisProp("strokeopacity")),s.setAttributeNS(null,"stroke-width",t.evalVisProp("strokewidth")),this.updatePathPrim(s,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,"
1style","font-family:Arial,Helvetica,sans-serif; font-size:"+e+"px; fill:#356AA0; opacity:0.3;"),i=this.container.ownerDocument.createTextNode(t),r.setAttributeNS(null,"aria-hidden","true"),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,t.evalVisProp("layer")),e},updateInternalText:function(t){var e,i,r=t.plaintext,s=t.getAnchorX(),o=t.getAnchorY();i=t.evalVisProp("cssclass"),t.rendNode.getAttributeNS(null,"class")!==i&&(t.rendNode.setAttributeNS(null,"class",i),t.needsSizeUpdate=!0),isNaN(t.coords.scrCoords[1]+t.coords.scrCoords[2])||(e=t.coords.scrCoords[1],t.visPropOld.left!==s+e&&(t.rendNode.setAttributeNS(null,"x",e+"px"),"left"===s?t.rendNode.setAttributeNS(null,"text-anchor","start"):"right"===s?t.rendNode.setAttributeNS(null,"text-anchor","end"):"middle"===s&&t.rendNode.setAttributeNS(null,"text-anchor","middle"),t.visPropOld.left=s+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,"dy","0"),t.rendNode.setAttributeNS(null,"dominant-baseline","auto")):"top"===o?(t.rendNode.setAttributeNS(null,"dy","1.6ex"),t.rendNode.setAttributeNS(null,"dominant-baseline","auto")):"middle"===o&&(t.rendNode.setAttributeNS(null,"dy","0.6ex"),t.rendNode.setAttributeNS(null,"dominant-baseline","auto")),t.visPropOld.top=o+e)),t.htmlStr!==r&&(t.rendNodeText.data=r,t.htmlStr=r),this.transformRect(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,t.evalVisProp("layer")),t.rendNode=e,this.updateImage(t)},transformRect:function(t,e){var i,r,s,n,a,h="";if(e.length>0&&(s=t.rendNode,-1===(i=[(r=this.joinTransforms(t,e))[1][1],r[2][1],r[1][2],r[2][2],r[1][0],r[2][0]].join(",")).indexOf("NaN")))if(h+=" matrix("+i+") ",t.elementClass===o.A.OBJECT_CLASS_TEXT&&"html"===t.visProp.display){switch(s.style.transform=h,n=-t.coords.scrCoords[1],a=-t.coords.scrCoords[2],t.evalVisProp("anchorx")){case"right":n+=t.size[0];break;case"middle":n+=.5*t.size[0]}switch(t.evalVisProp("anchory")){case"bottom":a+=t.size[1];break;case"middle":a+=.5*t.size[1]}s.style["transform-origin"]=n+"px "+a+"px"}else s.setAttributeNS(null,"transform",h)},updateImageURL:function(t){var e=t.eval(t.url);return t._src!==e&&(t.imgIsLoaded=!1,t.rendNode.setAttributeNS(this.xlinkNamespace,"xlink:href",e),t._src=e,!0)},updateImageStyle:function(t,e){var i=t.evalVisProp(e?"highlightcssclass":"cssclass");t.rendNode.setAttributeNS(null,"class",i)},drawForeignObject:function(t){t.rendNode=this.appendChildPrim(this.createPrim("foreignObject",t.id),t.evalVisProp("layer")),this.appendNodesToElement(t,"foreignObject"),this.updateForeignObject(t)},updateForeignObject:function(t){t._useUserSize?t.rendNode.style.overflow="hidden":t.rendNode.style.overflow="visible",this.updateRectPrim(t.rendNode,t.coords.scrCoords[1],t.coords.scrCoords[2]-t.size[1],t.size[0],t.size[1]),!0===t.evalVisProp("evaluateOnlyOnce")&&t.renderedOnce||(t.rendNode.innerHTML=t.content,t.renderedOnce=!0),this._updateVisual(t,{stroke:!0,dash:!0},!0)},appendChildPrim:function(t,e){return n.A.exists(e)?e>=y.A.layer.numlayers&&(e=y.A.layer.numlayers-1):e=0,this.layer[e].appendChild(t),t},createPrim:function(t,e){var i=this.container.ownerDocument.createElementNS(this.svgNamespace,t);return i.setAttributeNS(null,"id",this.uniqName(e)),i.style.position="absolute","path"===t&&(i.setAttributeNS(null,"stroke-linecap","round"),i.setAttributeNS(null,"stroke-linejoin","round"),i.setAttributeNS(null,"fill-rule","evenodd")),i},remove:function(t){n.A.exists(t)&&n.A.exists(t.parentNode)&&t.parentNode.removeChild(t)},setLayer:function(t,e){n.A.exists(e)?e>=y.A.layer.numlayers&&(e=y.A.layer.numlayers-1):e=0,this.layer[e].appendChild(t.rendNode)},makeArrows:function(t,e){var i,r,s=e.evFirst,o=e.evLast;if(this.isIE&&t.visPropCalc.visible&&(s||o))return void t.rendNode.parentNode.insertBefore(t.rendNode,t.rendNode);i=t.rendNodeTriangleStart,s?(r=this.toStr(this.container.id,"_",t.id,"TriangleStart",e.typeFirst),n.A.exists(i)&&i.id===r||(null===(i=this.container.ownerDocument.getElementById(r))&&(i=this._createArrowHead(t,"Start",e.typeFirst),this.defs.appendChild(i)),t.rendNodeTriangleStart=i,t.rendNode.setAttributeNS(null,"marker-start",this.toURL(r)))):(n.A.exists(i)&&(this.remove(i),t.rendNodeTriangleStart=null),t.rendNode.setAttributeNS(null,"marker-start",null)),i=t.rendNodeTriangleEnd,o?(r=this.toStr(this.container.id,"_",t.id,"TriangleEnd",e.typeLast),n.A.exists(i)&&i.id===r||(null===(i=this.container.ownerDocument.getElementById(r))&&(i=this._createArrowHead(t,"End",e.typeLast),this.defs.appendChild(i)),t.rendNodeTriangleEnd=i,t.rendNode.setAttributeNS(null,"marker-end",this.toURL(r)))):(n.A.exists(i)&&(this.remove(i),t.rendNodeTriangleEnd=null),t.rendNode.setAttributeNS(null,"marker-end",null))}
1,updateEllipsePrim:function(t,e,i,r,s){var o=1e6;e=Math.abs(e)<(o=2e5)?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){var r="",s=t.coords.scrCoords,o=e*Math.sqrt(3)*.5,n=.5*e;return"x"===i?r=" M "+(s[1]-e)+" "+(s[2]-e)+" L "+(s[1]+e)+" "+(s[2]+e)+" M "+(s[1]+e)+" "+(s[2]-e)+" L "+(s[1]-e)+" "+(s[2]+e):"+"===i?r=" M "+(s[1]-e)+" "+s[2]+" L "+(s[1]+e)+" "+s[2]+" M "+s[1]+" "+(s[2]-e)+" L "+s[1]+" "+(s[2]+e):"|"===i?r=" M "+s[1]+" "+(s[2]-e)+" L "+s[1]+" "+(s[2]+e):"-"===i?r=" M "+(s[1]-e)+" "+s[2]+" L "+(s[1]+e)+" "+s[2]:"<>"===i||"<<>>"===i?("<<>>"===i&&(e*=1.41),r=" M "+(s[1]-e)+" "+s[2]+" L "+s[1]+" "+(s[2]+e)+" L "+(s[1]+e)+" "+s[2]+" L "+s[1]+" "+(s[2]-e)+" Z "):"^"===i?r=" M "+s[1]+" "+(s[2]-e)+" L "+(s[1]-o)+" "+(s[2]+n)+" L "+(s[1]+o)+" "+(s[2]+n)+" Z ":"v"===i?r=" M "+s[1]+" "+(s[2]+e)+" L "+(s[1]-o)+" "+(s[2]-n)+" L "+(s[1]+o)+" "+(s[2]-n)+" Z ":">"===i?r=" M "+(s[1]+e)+" "+s[2]+" L "+(s[1]-n)+" "+(s[2]-o)+" L "+(s[1]-n)+" "+(s[2]+o)+" Z ":"<"===i&&(r=" M "+(s[1]-e)+" "+s[2]+" L "+(s[1]+n)+" "+(s[2]-o)+" L "+(s[1]+n)+" "+(s[2]+o)+" Z "),r},updatePathStringPrim:function(t){var e,i,r,s=" M ",o=" L ",n=" C ",a=s,h=5e3,l="";if(t.numberPoints<=0)return"";if(r=Math.min(t.points.length,t.numberPoints),1===t.bezierDegree)for(e=0;e<r;e++)isNaN((i=t.points[e].scrCoords)[1])||isNaN(i[2])?a=s:(i[1]=Math.max(Math.min(i[1],h),-h),i[2]=Math.max(Math.min(i[2],h),-h),l+=a+i[1]+" "+i[2],a=o);else if(3===t.bezierDegree)for(e=0;e<r;)isNaN((i=t.points[e].scrCoords)[1])||isNaN(i[2])?a=s:(l+=a+i[1]+" "+i[2],a===n&&(e+=1,l+=" "+(i=t.points[e].scrCoords)[1]+" "+i[2],e+=1,l+=" "+(i=t.points[e].scrCoords)[1]+" "+i[2]),a=n),e+=1;return l},updatePathStringBezierPrim:function(t){var e,i,r,s,o,n,a,h=" M ",l=" C ",c=h,d=5e3,u="",f=t.evalVisProp("strokewidth"),A="plot"!==t.evalVisProp("curvetype");if(t.numberPoints<=0)return"";for(A&&t.board.options.curve.RDPsmoothing&&(t.points=p.A.RamerDouglasPeucker(t.points,.5)),a=Math.min(t.points.length,t.numberPoints),i=1;i<3;i++)for(e=0,c=h;e<a;e++)isNaN((s=t.points[e].scrCoords)[1])||isNaN(s[2])?c=h:(s[1]=Math.max(Math.min(s[1],d),-d),s[2]=Math.max(Math.min(s[2],d),-d),c===h?u+=c+s[1]+" "+s[2]:(r=2*i,u+=""+c+(o+(s[1]-o)*.333+f*(r*Math.random()-i))+" "+(n+(s[2]-n)*.333+f*(r*Math.random()-i))+" "+(o+(s[1]-o)*.666+f*(r*Math.random()-i))+" "+(n+(s[2]-n)*.666+f*(r*Math.random()-i))+" "+s[1]+" "+s[2]),c=l,o=s[1],n=s[2]);return u},updatePolygonPrim:function(t,e){var i,r,s="",o=e.vertices.length;for(t.setAttributeNS(null,"stroke","none"),t.setAttributeNS(null,"fill-rule","evenodd"),"polygonalchain"===e.elType&&o++,i=0;i<o-1;i++){if(!e.vertices[i].isReal)return void t.setAttributeNS(null,"points","");s=s+(r=e.vertices[i].coords.scrCoords)[1]+","+r[2],i<o-2&&(s+=" ")}-1===s.indexOf("NaN")&&t.setAttributeNS(null,"points",s)},updateRectPrim:function(t,e,i,r,s){t.setAttributeNS(null,"x",e),t.setAttributeNS(null,"y",i),t.setAttributeNS(null,"width",r),t.setAttributeNS(null,"height",s)},_setAttribute:function(t,e){""===e?t():window.setTimeout(t,1)},display:function(t,e){var i;t&&t.rendNode&&(t.visPropOld.visible=e,i=t.rendNode,e?(i.setAttributeNS(null,"display","inline"),i.style.visibility="inherit"):(i.setAttributeNS(null,"display","none"),i.style.visibility="hidden"))},hide:function(t){r.A.deprecated("Board.renderer.hide()","Board.renderer.display()"),this.display(t,!1)},setARIA:function(t){var e,i,r;for(e in t.visProp.aria)t.visProp.aria.hasOwnProperty(e)&&"enabled"!==e&&(i="aria."+e,r=t.evalVisProp("aria."+e),t.visPropOld[i]!==r&&(this.setPropertyPrim(t.rendNode,"aria-"+e,r),t.visPropOld[i]=r))},setBuffering:function(t,e){t.rendNode.setAttribute("buffered-rendering",e)},setCssClass(t,e){t.visPropOld.cssclass!==e&&(this.setPropertyPrim(t.rendNode,"class",e),t.visPropOld.cssclass=e)},setDashStyle:function(t){var e=t.evalVisProp("dash"),i=t.evalVisProp("dashscale")?.5*t.evalVisProp("strokewidth"):1,r=t.rendNode;e>
10?r.setAttributeNS(null,"stroke-dasharray",this.dashArray[e-1].map(function(t){return t*i}).join(",")):r.hasAttributeNS(null,"stroke-dasharray")&&r.removeAttributeNS(null,"stroke-dasharray")},setGradient:function(t){var e,i,r,s=t.rendNode,o=t.evalVisProp("gradient");"linear"===o||"radial"===o?(e=this.createPrim(o+"Gradient",t.id+"_gradient"),i=this.createPrim("stop",t.id+"_gradient1"),r=this.createPrim("stop",t.id+"_gradient2"),e.appendChild(i),e.appendChild(r),this.defs.appendChild(e),s.setAttributeNS(null,"style","fill:"+this.toURL(this.container.id+"_"+t.id+"_gradient")),t.gradNode1=i,t.gradNode2=r,t.gradNode=e):s.removeAttributeNS(null,"style")},setLineCap:function(t){var e=t.evalVisProp("linecap");void 0!==e&&""!==e&&t.visPropOld.linecap!==e&&n.A.exists(t.rendNode)&&(this.setPropertyPrim(t.rendNode,"stroke-linecap",e),t.visPropOld.linecap=e)},setObjectFillColor:function(t,e,i,s){var o,a,h,l,c=e,d=i,u=t.evalVisProp("gradient");d=d>0?d:0,(t.visPropOld.fillcolor!==c||t.visPropOld.fillopacity!==d||null!==u)&&(n.A.exists(c)&&!1!==c&&(9!==c.length?(a=c,l=d):(a=(h=M.A.rgba2rgbo(c))[0],l=d*h[1]),o=void 0===s?t.rendNode:s,"none"!==a&&this._setAttribute(function(){o.setAttributeNS(null,"fill",a)},t.visPropOld.fillcolor),t.type===r.A.OBJECT_TYPE_IMAGE?this._setAttribute(function(){o.setAttributeNS(null,"opacity",l)},t.visPropOld.fillopacity):("none"===a?(l=0,o.setAttributeNS(null,"pointer-events","visibleStroke")):o.setAttributeNS(null,"pointer-events","visiblePainted"),this._setAttribute(function(){o.setAttributeNS(null,"fill-opacity",l)},t.visPropOld.fillopacity)),("linear"===u||"radial"===u)&&this.updateGradient(t)),t.visPropOld.fillcolor=c,t.visPropOld.fillopacity=d)},setObjectStrokeColor:function(t,e,i){var r,s,a,h,l=e,c=i;c=c>0?c:0,(t.visPropOld.strokecolor!==l||t.visPropOld.strokeopacity!==c)&&(n.A.exists(l)&&!1!==l&&(9!==l.length?(r=l,a=c):(r=(s=M.A.rgba2rgbo(l))[0],a=c*s[1]),h=t.rendNode,t.elementClass===o.A.OBJECT_CLASS_TEXT?"html"===t.evalVisProp("display")?this._setAttribute(function(){h.style.color=r,h.style.opacity=a},t.visPropOld.strokecolor):this._setAttribute(function(){h.setAttributeNS(null,"style","fill:"+r),h.setAttributeNS(null,"style","fill-opacity:"+a)},t.visPropOld.strokecolor):this._setAttribute(function(){h.setAttributeNS(null,"stroke",r),h.setAttributeNS(null,"stroke-opacity",a)},t.visPropOld.strokecolor),(t.elementClass===o.A.OBJECT_CLASS_CURVE||t.elementClass===o.A.OBJECT_CLASS_LINE)&&(t.evalVisProp("firstarrow")&&this._setArrowColor(t.rendNodeTriangleStart,r,a,t,t.visPropCalc.typeFirst),t.evalVisProp("lastarrow")&&this._setArrowColor(t.rendNodeTriangleEnd,r,a,t,t.visPropCalc.typeLast))),t.visPropOld.strokecolor=l,t.visPropOld.strokeopacity=c)},setObjectStrokeWidth:function(t,e){var i,r=e;isNaN(r)||t.visPropOld.strokewidth===r||(i=t.rendNode,this.setPropertyPrim(i,"stroked","true"),n.A.exists(r)&&this.setPropertyPrim(i,"stroke-width",r+"px"),t.visPropOld.strokewidth=r)},setObjectTransition:function(t,e){var i,r,s,o=[],a=0,h=["rendNode","rendNodeTriangleStart","rendNodeTriangleEnd"];if(void 0===e&&(e=t.evalVisProp("transitionduration")),i=t.evalVisProp("transitionproperties"),e!==t.visPropOld.transitionduration||i!==t.visPropOld.transitionproperties){for(n.A.exists(i)&&(a=i.length),s=0;s<a;s++)o.push(i[s]+" "+e+"ms");for(s=0,r=o.join(", "),a=h.length;s<a;++s)t[h[s]]&&(t[h[s]].style.transition=r);t.visPropOld.transitionduration=e,t.visPropOld.transitionproperties=i}},setShadow:function(t){var e,i,s,o,a,h,l,c,d=t.evalVisProp("shadow"),u=!0,p=!1;(e=JSON.stringify(d))!==t.visPropOld.shadow&&("boolean"==typeof d?(u=!0,p=d,i="none",s=3,o=.1,a=[5,5],h=1):t.evalVisProp("shadow.enabled")?(u=!1,p=!0,i=r.A.rgbParser(t.evalVisProp("shadow.color")),s=t.evalVisProp("shadow.blur"),o=t.evalVisProp("shadow.blend"),a=t.evalVisProp("shadow.offset"),h=t.evalVisProp("shadow.opacity")):p=!1,n.A.exists(t.rendNode)&&(p?u?t.rendNode.setAttributeNS(null,"filter",this.toURL(this.container.id+"_f1")):((c=this.container.ownerDocument.getElementById(l))&&this.defs.removeChild(c),l=t.rendNode.id+"_f1",this.defs.appendChild(this.createShadowFilter(l,i,h,o,s,a)),t.rendNode.setAttributeNS(null,"filter",this.toURL(l))):t.rendNode.removeAttributeNS(null,"filter")),t.visPropOld.shadow=e)},setTabindex:function(t){var e;t.board.attr.keyboard.enabled&&n.A.exists(t.rendNode)&&(e=t.evalVisProp("tabindex"),t.visPropCalc.visible||(e=null),e!==t.visPropOld.tabindex&&(t.rendNode.setAttribute("tabindex",e),t.visPropOld.tabindex=e))}
1,setPropertyPrim:function(t,e,i){"stroked"!==e&&t.setAttributeNS(null,e,i)},show:function(t){r.A.deprecated("Board.renderer.show()","Board.renderer.display()"),this.display(t,!0)},updateGradient:function(t){var e,i,r=t.gradNode1,s=t.gradNode2,o=t.evalVisProp("gradient");n.A.exists(r)&&n.A.exists(s)&&(i=(i=t.evalVisProp("fillopacity"))>0?i:0,e=t.evalVisProp("fillcolor"),r.setAttributeNS(null,"style","stop-color:"+e+";stop-opacity:"+i),s.setAttributeNS(null,"style","stop-color:"+t.evalVisProp("gradientsecondcolor")+";stop-opacity:"+t.evalVisProp("gradientsecondopacity")),r.setAttributeNS(null,"offset",100*t.evalVisProp("gradientstartoffset")+"%"),s.setAttributeNS(null,"offset",100*t.evalVisProp("gradientendoffset")+"%"),"linear"===o?this.updateGradientAngle(t.gradNode,t.evalVisProp("gradientangle")):"radial"===o&&this.updateGradientCircle(t.gradNode,t.evalVisProp("gradientcx"),t.evalVisProp("gradientcy"),t.evalVisProp("gradientr"),t.evalVisProp("gradientfx"),t.evalVisProp("gradientfy"),t.evalVisProp("gradientfr")))},updateGradientAngle:function(t,e){var i=1,r=Math.cos(e),s=Math.sin(e);Math.abs(r)>Math.abs(s)?i/=Math.abs(r):i/=Math.abs(s),r>=0?(t.setAttributeNS(null,"x1",0),t.setAttributeNS(null,"x2",r*i)):(t.setAttributeNS(null,"x1",-r*i),t.setAttributeNS(null,"x2",0)),s>=0?(t.setAttributeNS(null,"y1",0),t.setAttributeNS(null,"y2",s*i)):(t.setAttributeNS(null,"y1",-s*i),t.setAttributeNS(null,"y2",0))},updateGradientCircle:function(t,e,i,r,s,o,n){t.setAttributeNS(null,"cx",100*e+"%"),t.setAttributeNS(null,"cy",100*i+"%"),t.setAttributeNS(null,"r",100*r+"%"),t.setAttributeNS(null,"fx",100*s+"%"),t.setAttributeNS(null,"fy",100*o+"%"),t.setAttributeNS(null,"fr",100*n+"%")},suspendRedraw:function(){this.suspendHandle=this.svgRoot.suspendRedraw(1e4)}
1,unsuspendRedraw:function(){this.svgRoot.unsuspendRedraw(this.suspendHandle)},resize:function(t,e){this.svgRoot.setAttribute("width",parseFloat(t)),this.svgRoot.setAttribute("height",parseFloat(e))},createTouchpoints:function(t){var e,i,r,s;for(e=0,this.touchpoints=[];e<t;e++)i="touchpoint1_"+e,s=this.createPrim("path",i),this.appendChildPrim(s,19),s.setAttributeNS(null,"d","M 0 0"),this.touchpoints.push(s),this.setPropertyPrim(s,"stroked","true"),this.setPropertyPrim(s,"stroke-width","1px"),s.setAttributeNS(null,"stroke","#000000"),s.setAttributeNS(null,"stroke-opacity",1),s.setAttributeNS(null,"display","none"),r="touchpoint2_"+e,s=this.createPrim("ellipse",r),this.appendChildPrim(s,19),this.updateEllipsePrim(s,0,0,0,0),this.touchpoints.push(s),this.setPropertyPrim(s,"stroked","true"),this.setPropertyPrim(s,"stroke-width","1px"),s.setAttributeNS(null,"stroke","#000000"),s.setAttributeNS(null,"stroke-opacity",1),s.setAttributeNS(null,"fill","#ffffff"),s.setAttributeNS(null,"fill-opacity",0),s.setAttributeNS(null,"display","none")},showTouchpoint:function(t){this.touchpoints&&t>=0&&2*t<this.touchpoints.length&&(this.touchpoints[2*t].setAttributeNS(null,"display","inline"),this.touchpoints[2*t+1].setAttributeNS(null,"display","inline"))},hideTouchpoint:function(t){this.touchpoints&&t>=0&&2*t<this.touchpoints.length&&(this.touchpoints[2*t].setAttributeNS(null,"display","none"),this.touchpoints[2*t+1].setAttributeNS(null,"display","none"))},updateTouchpoint:function(t,e){var i,r,s=37;this.touchpoints&&t>=0&&2*t<this.touchpoints.length&&(i=e[0],r=e[1],this.touchpoints[2*t].setAttributeNS(null,"d","M "+(i-s)+" "+r+" L "+(i+s)+" "+r+" M "+i+" "+(r-s)+" L "+i+" "+(r+s)),this.updateEllipsePrim(this.touchpoints[2*t+1],e[0],e[1],25,25))},_getValuesOfDOMElements:function(t){var e=[];if(1===t.nodeType)for(t=t.firstChild;t;)void 0!==t.id&&void 0!==t.value&&e.push([t.id,t.value]),n.A.concat(e,this._getValuesOfDOMElements(t)),t=t.nextSibling;return e},_getImgDataURL:function(t){var e,i,r,s,o,n;if((i=(e=t.getElementsByTagName("image")).length)>0)for(n=0,r=document.createElement("canvas");n<i;n++){e[n].setAttribute("crossorigin","anonymous"),s=r.getContext("2d"),r.width=e[n].getAttribute("width"),r.height=e[n].getAttribute("height");try{s.drawImage(e[n],0,0,r.width,r.height),o=r.toDataURL(),e[n].setAttribute("xlink:href",o)}catch(t){console.log("CORS problem! Image can not be used",t)}}return!0},dumpToDataURI:function(t){var e,i,r,s=this.svgRoot,o=window.btoa||N.encode,a=[];if(this.container.hasChildNodes()&&n.A.exists(this.foreignObjLayer))for(t||this.foreignObjLayer.setAttribute("display","inline");s.nextSibling;)n.A.concat(a,this._getValuesOfDOMElements(s.nextSibling)),this.foreignObjLayer.appendChild(s.nextSibling);if(this._getImgDataURL(s),s.setAttribute("xmlns","http://www.w3.org/2000/svg"),e=new XMLSerializer().serializeToString(s),!0!==t)for(i=0,r=a.length;i<r;i++)e=e.replace('id="'+a[i][0]+'"','id="'+a[i][0]+'" value="'+a[i][1]+'"');if(this.isIE&&(e.match(/xmlns="http:\/\/www.w3.org\/2000\/svg"\s+xmlns="http:\/\/www.w3.org\/2000\/svg"/g)||[]).length>1&&(e=e.replace(/xmlns="http:\/\/www.w3.org\/2000\/svg"\s+xmlns="http:\/\/www.w3.org\/2000\/svg"/g,"")),e=e.replace(/ /g," "),n.A.exists(this.foreignObjLayer)&&this.foreignObjLayer.hasChildNodes()){for(;this.foreignObjLayer.firstChild;)this.container.appendChild(this.foreignObjLayer.firstChild);this.foreignObjLayer.setAttribute("display","none")}return"data:image/svg+xml;base64,"+o(unescape(encodeURIComponent(e)))},dumpToCanvas:function(t,e,i,r){var s,o,n;return((o=this.container.ownerDocument.getElementById(t)).width=o.width,n=o.getContext("2d"),void 0!==e&&void 0!==i&&(o.style.width=parseFloat(e)+"px",o.style.height=parseFloat(i)+"px",o.setAttribute("width",parseFloat(e)),o.setAttribute("height",parseFloat(i))),(s=new Image).src=this.dumpToDataURI(r),"Promise"in window)?new Promise(function(t,r){try{s.onload=function(){n.drawImage(s,0,0,e,i),t()}}catch(t){r(t)}}):(s.onload=function(){window.setTimeout(function(){try{n.drawImage(s,0,0,e,i)}catch(t){console.log("screenshots not longer supported on IE")}},200)},this)}
1,screenshot:function(t,e,i){var r,s,o,a,h,l,c,d,u,p,f,A,m=this.container.ownerDocument,b=this.container.parentNode,g=t.attr.screenshot,v=!1,y=!1;return"no"===this.type||(c=g.scale*this.container.getBoundingClientRect().width,d=g.scale*this.container.getBoundingClientRect().height,void 0===e||""===e?(v=!0,(a=new Image).style.width=c+"px",a.style.height=d+"px"):(v=!1,a=m.getElementById(e)),v&&((r=m.createElement("div")).style.cssText=g.css,r.style.width=c+"px",r.style.height=d+"px",r.style.zIndex=this.container.style.zIndex+120,r.style.position="absolute",r.style.top=this.container.offsetTop+"px",r.style.left=this.container.offsetLeft+"px"),y?(o="jxgbox_canvas",s=m.getElementById(o)):(s=m.createElement("canvas"),o=Math.random().toString(36).slice(2,7),s.setAttribute("id",o),s.setAttribute("width",c),s.setAttribute("height",d),s.style.width=c+"px",s.style.height=c+"px",s.style.display="none",b.appendChild(s)),v&&(h=m.createElement("span"),l=m.createTextNode("â"),h.style.cssText=g.cssButton,h.appendChild(l),h.onclick=function(){r.parentNode.removeChild(r)},r.appendChild(a),r.appendChild(h),b.insertBefore(r,this.container.nextSibling)),u=m.getElementById(this.uniqName("navigationbar")),n.A.exists(u)&&(p=u.style.display,u.style.display="none",f=this.removeToInsertLater(u)),A=function(){a.src=s.toDataURL("image/png"),y||b.removeChild(s)},"Promise"in window?this.dumpToCanvas(o,c,d,i).then(A):(this.dumpToCanvas(o,c,d,i),window.setTimeout(A,200)),n.A.exists(u)&&(u.style.display=p,f())),this}});let k=r.A.SVGRenderer;r.A.VMLRenderer=function(t){this.type="vml",this.container=t,this.container.style.overflow="hidden",""===this.container.style.position&&(this.container.style.position="relative"),this.container.onselectstart=function(){return!1},this.resolution=10,n.A.exists(r.A.vmlStylesheet)||(t.ownerDocument.namespaces.add("jxgvml","urn:schemas-microsoft-com:vml"),r.A.vmlStylesheet=this.container.ownerDocument.createStyleSheet(),r.A.vmlStylesheet.addRule(".jxgvml","behavior:url(#default#VML)"));try{t.ownerDocument.namespaces.jxgvml||t.ownerDocument.namespaces.add("jxgvml","urn:schemas-microsoft-com:vml"),this.createNode=function(e){return t.ownerDocument.createElement("<jxgvml:"+e+' class="jxgvml">')}}catch(e){this.createNode=function(e){return t.ownerDocument.createElement("<"+e+' xmlns="urn:schemas-microsoft.com:vml" class="jxgvml">')}}this.dashArray=["Solid","1 1","ShortDash","Dash","LongDash","ShortDashDot","LongDashDot"]},r.A.VMLRenderer.prototype=new C,r.A.extend(r.A.VMLRenderer.prototype,{_setAttr:function(t,e,i,s){try{8===this.container.ownerDocument.documentMode?t[e]=i:t.setAttribute(e,i,s)}catch(t){r.A.debug("_setAttr: "+e+" "+i+"<br>\n")}},updateTicks:function(t){var e,i,r,s,o,a=this.resolution,h=[];for(e=0,i=t.ticks.length;e<i;e++)s=(r=t.ticks[e])[0],o=r[1],n.A.isNumber(s[0])&&n.A.isNumber(s[1])&&h.push(" m "+Math.round(a*s[0])+", "+
1Math.round(a*o[0])+" l "+Math.round(a*s[1])+", "+Math.round(a*o[1])+" ");n.A.exists(t.rendNode)||(t.rendNode=this.createPrim("path",t.id),this.appendChildPrim(t.rendNode,t.evalVisProp("layer"))),this._setAttr(t.rendNode,"stroked","true"),this._setAttr(t.rendNode,"strokecolor",t.evalVisProp("strokecolor"),1),this._setAttr(t.rendNode,"strokeweight",t.evalVisProp("strokewidth")),this._setAttr(t.rendNodeStroke,"opacity",100*t.evalVisProp("strokeopacity")+"%"),this.updatePathPrim(t.rendNode,h,t.board)},displayCopyright:function(t,e){var i,r;(i=this.createNode("textbox")).style.position="absolute",this._setAttr(i,"id",this.container.id+"_licenseText"),i.style.left=20,i.style.top=2,i.style.fontSize=e,i.style.color="#356AA0",i.style.fontFamily="Arial,Helvetica,sans-serif",this._setAttr(i,"opacity","30%"),i.style.filter="progid:DXImageTransform.Microsoft.Matrix(M11='1.0', sizingMethod='auto expand', enabled = false) progid:DXImageTransform.Microsoft.Alpha(opacity = 30, enabled = true)",r=this.container.ownerDocument.createTextNode(t),i.appendChild(r),this.appendChildPrim(i,0)},drawInternalText:function(t){var e;return(e=this.createNode("textbox")).style.position="absolute",t.rendNodeText=this.container.ownerDocument.createTextNode(""),e.appendChild(t.rendNodeText),this.appendChildPrim(e,9),e.style.filter="progid:DXImageTransform.Microsoft.Matrix(M11='1.0', sizingMethod='auto expand', enabled = false) progid:DXImageTransform.Microsoft.Alpha(opacity = 100, enabled = false)",e},updateInternalText:function(t){var e,i,r,s,o,n,h=t.plaintext,l=this.joinTransforms(t,t.transformations),c=[0,0],d=t.rendNode,u=[],p=t.getAnchorX(),f=t.getAnchorY();if(!isNaN(t.coords.scrCoords[1]+t.coords.scrCoords[2])){for("right"===p?c[0]=1:"middle"===p&&(c[0]=.5),"bottom"===f?c[
11]=1:"middle"===f&&(c[1]=.5),u[0]=a.A.matVecMult(l,[1,t.coords.scrCoords[1]-c[0]*t.size[0],t.coords.scrCoords[2]+(1-c[1])*t.size[1]+this.vOffsetText]),u[0][1]/=u[0][0],u[0][2]/=u[0][0],u[1]=a.A.matVecMult(l,[1,t.coords.scrCoords[1]+(1-c[0])*t.size[0],t.coords.scrCoords[2]+(1-c[1])*t.size[1]+this.vOffsetText]),u[1][1]/=u[1][0],u[1][2]/=u[1][0],u[2]=a.A.matVecMult(l,[1,t.coords.scrCoords[1]+(1-c[0])*t.size[0],t.coords.scrCoords[2]-c[1]*t.size[1]+this.vOffsetText]),u[2][1]/=u[2][0],u[2][2]/=u[2][0],u[3]=a.A.matVecMult(l,[1,t.coords.scrCoords[1]-c[0]*t.size[0],t.coords.scrCoords[2]-c[1]*t.size[1]+this.vOffsetText]),u[3][1]/=u[3][0],u[3][2]/=u[3][0],i=u[0][1],s=u[0][1],r=u[0][2],o=u[0][2],n=1;n<4;n++)i=Math.max(i,u[n][1]),s=Math.min(s,u[n][1]),r=Math.max(r,u[n][2]),o=Math.min(o,u[n][2]);e=1===c[0]?Math.floor(t.board.canvasWidth-i):Math.floor(s),t.visPropOld.left!==p+e&&(1===c[0]?(t.rendNode.style.right=e+"px",t.rendNode.style.left="auto"):(t.rendNode.style.left=e+"px",t.rendNode.style.right="auto"),t.visPropOld.left=p+e),e=1===c[1]?Math.floor(t.board.canvasHeight-r):Math.floor(o),t.visPropOld.top!==f+e&&(1===c[1]?(t.rendNode.style.bottom=e+"px",t.rendNode.style.top="auto"):(t.rendNode.style.top=e+"px",t.rendNode.style.bottom="auto"),t.visPropOld.top=f+e)}t.htmlStr!==h&&(t.rendNodeText.data=h,t.htmlStr=h),d.filters.item(0).M11=l[1][1],d.filters.item(0).M12=l[1][2],d.filters.item(0).M21=l[2][1],d.filters.item(0).M22=l[2][2],d.filters.item(0).enabled=!0},drawImage:function(t){var e;(e=this.container.ownerDocument.createElement("img")).style.position="absolute",this._setAttr(e,"id",this.container.id+"_"+t.id),this.container.appendChild(e),this.appendChildPrim(e,t.evalVisProp("layer")),e.style.filter="progid:DXImageTransform.Microsoft.Matrix(M11='1.0', sizingMethod='auto expand') progid:DXImageTransform.Microsoft.Alpha(opacity = 100, enabled = false)",t.rendNode=e,this.updateImage(t)},transformRect:function(t,e){var i,r,s,o,n,h,l=t.rendNode,c=[];if(e.length>0){for(i=this.joinTransforms(t,e),c[0]=a.A.matVecMult(i,t.coords.scrCoords),c[0][1]/=c[0][0],c[0][2]/=c[0][0],c[1]=a.A.matVecMult(i,[1,t.coords.scrCoords[1]+t.size[0],t.coords.scrCoords[2]]),c[1][1]/=c[1][0],c[1][2]/=c[1][0],c[2]=a.A.matVecMult(i,[1,t.coords.scrCoords[1]+t.size[0],t.coords.scrCoords[2]-t.size[1]]),c[2][1]/=c[2][0],c[2][2]/=c[2][0],c[3]=a.A.matVecMult(i,[1,t.coords.scrCoords[1],t.coords.scrCoords[2]-t.size[1]]),c[3][1]/=c[3][0],c[3][2]/=c[3][0],r=c[0][1],o=c[0][1],s=c[0][2],n=c[0][2],h=1;h<4;h++)r=Math.max(r,c[h][1]),o=Math.min(o,c[h][1]),s=Math.max(s,c[h][2]),n=Math.min(n,c[h][2]);l.style.left=Math.floor(o)+"px",l.style.top=Math.floor(n)+"px",l.filters.item(0).M11=i[1][1],l.filters.item(0).M12=i[1][2],l.filters.item(0).M21=i[2][1],l.filters.item(0).M22=i[2][2],l.filters.item(0).enabled=!0}},updateImageURL:function(t){var e=t.eval(t.url);this._setAttr(t.rendNode,"src",e)},appendChildPrim:function(t,e){return n.A.exists(e)||(e=0),t.style.zIndex=e,this.container.appendChild(t),t},appendNodesToElement:function(t,e){("shape"===e||"path"===e||"polygon"===e)&&(t.rendNodePath=this.getElementById(t.id+"_path")),t.rendNodeFill=this.getElementById(t.id+"_fill"),t.rendNodeStroke=this.getElementById(t.id+"_stroke"),t.rendNodeShadow=this.getElementById(t.id+"_shadow"),t.rendNode=this.getElementById(t.id)},createPrim:function(t,e){var i,r,s=this.createNode("fill"),o=this.createNode("stroke"),n=this.createNode("shadow");return this._setAttr(s,"id",this.container.id+"_"+e+"_fill"),this._setAttr(o,"id",this.container.id+"_"+e+"_stroke"),this._setAttr(n,"id",this.container.id+"_"+e+"_shadow"),"circle"===t||"ellipse"===t?((i=this.createNode("oval")).appendChild(s),i.appendChild(o),i.appendChild(n)):"polygon"===t||"path"===t||"shape"===t||"line"===t?((i=this.createNode("shape")).appendChild(s),i.appendChild(o),i.appendChild(n),r=this.createNode("path"),this._setAttr(r,"id",this.container.id+"_"+e+"_path"),i.appendChild(r)):((i=this.createNode(t)).appendChild(s),i.appendChild(o),i.appendChild(n)),i.style.position="absolute",i.style.left="0px",i.style.top="0px",this._setAttr(i,"id",this.container.id+"_"+e),i},remove:function(t){n.A.exists(t)&&t.removeNode(!0)},makeArrows:function(t){var e,i=t.evalVisProp("firstarrow"),r=t.evalVisProp("lastarrow");(t.visPropOld.firstarrow!==i||t.visPropOld.lastarrow!==r)&&(i?(e=t.rendNodeStroke,this._setAttr(e,"startarrow","block"),this._setAttr(e,"startarrowlength","long")):(e=t.rendNodeStroke,n.A.exists(e)&&this._setAttr(e,"startarrow","none")),r?(e=t.rendNodeStroke,this._setAttr(e,"id",this.container.id+"_"+t.id+"stroke"),this._setAttr(e,"endarrow","block"),this._setAttr(e,"endarrowlength","long")):(e=t.rendNodeStroke,n.A.exists(e)&&this._setAttr(e,"endarrow","none")),t.visPropOld.firstarrow=i,t.visPropOld.lastarrow=r)}
1,updateEllipsePrim:function(t,e,i,r,s){t.style.left=Math.floor(e-r)+"px",t.style.top=Math.floor(i-s)+"px",t.style.width=Math.floor(2*Math.abs(r))+"px",t.style.height=Math.floor(2*Math.abs(s))+"px"},updateLinePrim:function(t,e,i,r,s,o){var n,a=this.resolution;isNaN(e+i+r+s)||(n=["m ",Math.floor(a*e),", ",Math.floor(a*i)," l ",Math.floor(a*r),", ",Math.floor(a*s)],this.updatePathPrim(t,n,o))},updatePathPrim:function(t,e,i){var r=i.canvasWidth,s=i.canvasHeight;e.length<=0&&(e=["m 0,0"]),t.style.width=r,t.style.height=s,this._setAttr(t,"coordsize",[Math.floor(this.resolution*r),Math.floor(this.resolution*s)].join(",")),this._setAttr(t,"path",e.join(""))},updatePathStringPoint:function(t,e,i){var r=[],s=Math.round,o=t.coords.scrCoords,n=e*Math.sqrt(3)*.5,a=.5*e,h=this.resolution;return"x"===i?r.push(" m "+s(h*(o[1]-e))+", "+s(h*(o[2]-e))+" l "+s(h*(o[1]+e))+", "+s(h*(o[2]+e))+" m "+s(h*(o[1]+e))+", "+s(h*(o[2]-e))+" l "+s(h*(o[1]-e))+", "+s(h*(o[2]+e))):"+"===i?r.push(" m "+s(h*(o[1]-e))+", "+s(h*o[2])+" l "+s(h*(o[1]+e))+", "+s(h*o[2])+" m "+s(h*o[1])+", "+s(h*(o[2]-e))+" l "+s(h*o[1])+", "+s(h*(o[2]+e))):"<>"===i||"<<>>"===i?("<<>>"===i&&(e*=1.41),r.push(" m "+s(h*(o[1]-e))+", "+s(h*o[2])+" l "+s(h*o[1])+", "+s(h*(o[2]+e))+" l "+s(h*(o[1]+e))+", "+s(h*o[2])+" l "+s(h*o[1])+", "+s(h*(o[2]-e))+" x e ")):"^"===i?r.push(" m "+s(h*o[1])+", "+s(h*(o[2]-e))+" l "+s(h*(o[1]-n))+", "+s(h*(o[2]+a))+" l "+s(h*(o[1]+n))+", "+s(h*(o[2]+a))+" x e "):"v"===i?r.push(" m "+s(h*o[1])+", "+s(h*(o[2]+e))+" l "+s(h*(o[1]-n))+", "+s(h*(o[2]-a))+" l "+s(h*(o[1]+n))+", "+s(h*(o[2]-a))+" x e "):">"===i?r.push(" m "+s(h*(o[1]+e))+", "+s(h*o[2])+" l "+s(h*(o[1]-a))+", "+s(h*(o[2]-n))+" l "+s(h*(o[1]-a))+", "+s(h*(o[2]+n))+" l "+s(h*(o[1]+e))+", "+s(h*o[2])):"<"===i&&r.push(" m "+s(h*(o[1]-e))+", "+s(h*o[2])+" l "+s(h*(o[1]+a))+", "+s(h*(o[2]-n))+" l "+s(h*(o[1]+a))+", "+s(h*(o[2]+n))+" x e "),r},updatePathStringPrim:function(t){var e,i,r=[],s=this.resolution,o=Math.round,n=" m ",a=" l ",h=" c ",l=n,c=Math.min(t.numberPoints,8192);if(t.numberPoints<=0)return"";if(c=Math.min(c,t.points.length),1===t.bezierDegree)for(e=0;e<c;e++)isNaN((i=t.points[e].scrCoords)[1])||isNaN(i[2])?l=n:(i[1]>2e4?i[1]=2e4:i[1]<-2e4&&(i[1]=-2e4),i[2]>2e4?i[2]=2e4:i[2]<-2e4&&(i[2]=-2e4),r.push(""+l+o(s*i[1])+", "+o(s*i[2])),l=a);else if(3===t.bezierDegree)for(e=0;e<c;)isNaN((i=t.points[e].scrCoords)[1])||isNaN(i[2])?l=n:(r.push(""+l+o(s*i[1])+", "+o(s*i[2])),l===h&&(e+=1,r.push(" "+o(s*(i=t.points[e].scrCoords)[1])+", "+o(s*i[2])),e+=1,r.push(" "+o(s*(i=t.points[e].scrCoords)[1])+", "+o(s*i[2]))),l=h),e+=1;return r.push(" e"),r},updatePathStringBezierPrim:function(t){var e,i,r,s,o,n,a=[],h=t.evalVisProp("strokewidth"),l=this.resolution,c=Math.round,d=" m ",u=" c ",f=d,A="plot"!==t.evalVisProp("curvetype"),m=Math.min(t.numberPoints,8192);if(t.numberPoints<=0)return"";for(A&&t.board.options.curve.RDPsmoothing&&(t.points=p.A.RamerDouglasPeucker(t.points,1)),m=Math.min(m,t.points.length),i=1;i<3;i++)for(e=0,f=d;e<m;e++)isNaN((s=t.points[e].scrCoords)[1])||isNaN(s[2])?f=d:(s[1]>2e4?s[1]=2e4:s[1]<-2e4&&(s[1]=-2e4),s[2]>2e4?s[2]=2e4:s[2]<-2e4&&(s[2]=-2e4),f===d?a.push(""+f+c(l*s[1])+" "+c(l*s[2])):(r=2*i,a.push(""+f+c(l*(o+(s[1]-o)*.333+h*(r*Math.random()-i)))+" "+c(l*(n+(s[2]-n)*.333+h*(r*Math.random()-i)))+" "+c(l*(o+(s[1]-o)*.666+h*(r*Math.random()-i)))+" "+c(l*(n+(s[2]-n)*.666+h*(r*Math.random()-i)))+" "+c(l*s[1])+" "+c(l*s[2]))),f=u,o=s[1],n=s[2]);return a.push(" e"),a},updatePolygonPrim:function(t,e){var i,r,s=e.vertices.length,o=this.resolution,n=[];if(this._setAttr(t,"stroked","false"),!isNaN((r=e.vertices[0].coords.scrCoords)[1]+r[2])){for(n.push("m "+Math.floor(o*r[1])+","+Math.floor(o*r[2])+" l "),i=1;i<s-1;i++){if(!e.vertices[i].isReal)return void this.updatePathPrim(t,"",e.board);if(isNaN((r=e.vertices[i].coords.scrCoords)[1]+r[2]))return;n.push(Math.floor(o*r[1])+","+Math.floor(o*r[2])),i<s-2&&n.push(", ")}n.push(" x e"),this.updatePathPrim(t,n,e.board)}},updateRectPrim:function(t,e,i,r,s){t.style.left=Math.floor(e)+"px",t.style.top=Math.floor(i)+"px",r>=0&&(t.style.width=r+"px"),s>=0&&(t.style.height=s+"px")}
1,setPropertyPrim:function(t,e,i){var r,s="";switch(e){case"stroke":s="strokecolor";break;case"stroke-width":s="strokeweight";break;case"stroke-dasharray":s="dashstyle"}""!==s&&(r=i,this._setAttr(t,s,r))},display:function(t,e){t&&t.rendNode&&(t.visPropOld.visible=e,e?t.rendNode.style.visibility="inherit":t.rendNode.style.visibility="hidden")},show:function(t){r.A.deprecated("Board.renderer.show()","Board.renderer.display()"),t&&t.rendNode&&(t.rendNode.style.visibility="inherit")},hide:function(t){r.A.deprecated("Board.renderer.hide()","Board.renderer.display()"),t&&t.rendNode&&(t.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=t.evalVisProp("gradient");"linear"===i?(this._setAttr(e,"type","gradient"),this._setAttr(e,"color2",t.evalVisProp("gradientsecondcolor")),this._setAttr(e,"opacity2",t.evalVisProp("gradientsecondopacity")),this._setAttr(e,"angle",t.evalVisProp("gradientangle"))):"radial"===i?(this._setAttr(e,"type","gradientradial"),this._setAttr(e,"color2",t.evalVisProp("gradientsecondcolor")),this._setAttr(e,"opacity2",t.evalVisProp("gradientsecondopacity")),this._setAttr(e,"focusposition",100*t.evalVisProp("gradientpositionx")+"%,"+100*t.evalVisProp("gradientpositiony")+"%"),this._setAttr(e,"focussize","0,0")):this._setAttr(e,"type","solid")},setObjectFillColor:function(t,e,i){var r,s,a,h=e,l=i,c=t.rendNode;l=l>0?l:0,(t.visPropOld.fillcolor!==h||t.visPropOld.fillopacity!==l)&&(n.A.exists(h)&&!1!==h&&(9!==h.length?(r=h,a=l):(r=(s=M.A.rgba2rgbo(h))[0],a=l*s[1]),"none"===r||!1===r?this._setAttr(t.rendNode,"filled","false"):(this._setAttr(t.rendNode,"filled","true"),this._setAttr(t.rendNode,"fillcolor",r),n.A.exists(a)&&t.rendNodeFill&&this._setAttr(t.rendNodeFill,"opacity",100*a+"%")),t.type===o.A.OBJECT_TYPE_IMAGE&&c.filters.length>1&&(c.filters.item(1).opacity=Math.round(100*a),c.filters.item(1).enabled=!0)),t.visPropOld.fillcolor=h,t.visPropOld.fillopacity=l)},setObjectStrokeColor:function(t,e,i){var r,s,a,h,l=e,c=i,d=t.rendNode;c=c>0?c:0,(t.visPropOld.strokecolor!==l||t.visPropOld.strokeopacity!==c)&&(n.A.exists(l)&&!1!==l&&(9!==l.length?(r=l,a=c):(r=(s=e.rgba2rgbo(l))[0],a=c*s[1]),t.elementClass===o.A.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=r):(!1!==r&&(this._setAttr(d,"stroked","true"),this._setAttr(d,"strokecolor",r)),h=t.rendNodeStroke,n.A.exists(a)&&t.type!==o.A.OBJECT_TYPE_IMAGE&&this._setAttr(h,"opacity",100*a+"%"))),t.visPropOld.strokecolor=l,t.visPropOld.strokeopacity=c)},setObjectStrokeWidth:function(t,e){var i,r=n.A.evaluate(e);isNaN(r)||t.visPropOld.strokewidth===r||(i=t.rendNode,this.setPropertyPrim(i,"stroked","true"),n.A.exists(r)&&(this.setPropertyPrim(i,"stroke-width",r),0===r&&n.A.exists(t.rendNodeStroke)&&this._setAttr(i,"stroked","false")),t.visPropOld.strokewidth=r)},setShadow:function(t){var e=t.rendNodeShadow,i=t.evalVisProp("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=""}});let D=r.A.VMLRenderer;var R="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split("");r.A.Util=r.A.Util||{},r.A.Util.genUUID=function(t){var e,i,r=[],s=0;for(""!==(t=t||"")&&"-"!==t.slice(t.length-1)&&(t+="-"),i=0;i<36;i++)8===i||13===i||18===i||23===i?r[i]="-":14===i?r[i]="4":(s<=2&&(s=0x2000000+0x1000000*Math.random()|0),e=15&s,s>>=4,r[i]=R[19===i?3&e|8:e]);return t+r.join("")};let L=r.A.Util;r.A.CanvasRenderer=function(t,e){if(this.type="canvas",this.canvasRoot=null,this.suspendHandle=null,this.canvasId=L.genUUID(),this.canvasNamespace=null,s.A.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 i
1d="'+this.canvasId+'" width="'+e.width+'px" height="'+e.height+'px"></canvas>',this.canvasRoot=this.container.ownerDocument.getElementById(this.canvasId),this.canvasRoot.style.display="block",this.context=this.canvasRoot.getContext("2d");else if(s.A.isNode())try{this.canvasRoot=r.A.createCanvas(500,500),this.context=this.canvasRoot.getContext("2d")}catch(t){throw Error('JXG.createCanvas not available.\nInstall the npm package `canvas`\nand call:\n import { createCanvas } from "canvas.js";\n JXG.createCanvas = createCanvas;\n')}},r.A.CanvasRenderer.prototype=new C,r.A.extend(r.A.CanvasRenderer.prototype,{_drawPolygon:function(t,e,i){var r,s=t.length,o=this.context;if(s>0){if(i&&(o.lineWidth=0),o.beginPath(),o.moveTo(t[0][0],t[0][1]),1===e)for(r=1;r<s;r++)o.lineTo(t[r][0],t[r][1]);else for(r=1;r<s;r+=3)o.bezierCurveTo(t[r][0],t[r][1],t[r+1][0],t[r+1][1],t[r+2][0],t[r+2][1]);i?(o.lineTo(t[0][0],t[0][1]),o.closePath(),o.fill("evenodd")):o.stroke()}},_fill:function(t){var e=this.context;e.save(),this._setColor(t,"fill")&&e.fill("evenodd"),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 i,r,s,n,a,h,l,c,d,u,p,A,m=1,b=Math.cos(-e),g=Math.sin(-e),v=t.getBoundingBox();return Math.abs(b)>Math.abs(g)?m/=Math.abs(b):m/=Math.abs(g),b>=0?(s=0,n=b*m):(s=-b*m,n=0),g>=0?(a=0,h=g*m):(a=-g*m,h=0),i=new f.A(o.A.COORDS_BY_USER,[v[0],v[1]],t.board),p=(r=new f.A(o.A.COORDS_BY_USER,[v[2],v[3]],t.board)).scrCoords[1]-i.scrCoords[1],A=r.scrCoords[2]-i.scrCoords[2],l=i.scrCoords[1]+p*s,d=i.scrCoords[2]+A*a,c=i.scrCoords[1]+p*n,u=i.scrCoords[2]+A*h,this.context.createLinearGradient(l,d,c,u)},updateGradientCircle:function(t,e,i,r,s,n,a){var h,l,c,d,u,p,A,m,b,g,v=t.getBoundingBox();return h=new f.A(o.A.COORDS_BY_USER,[v[0],v[1]],t.board),b=(l=new f.A(o.A.COORDS_BY_USER,[v[2],v[3]],t.board)).scrCoords[1]-h.scrCoords[1],g=h.scrCoords[2]-l.scrCoords[2],c=h.scrCoords[1]+b*e,d=l.scrCoords[2]+g*i,p=h.scrCoords[1]+b*s,A=l.scrCoords[2]+g*n,u=r*(b+g)*.5,m=a*(b+g)*.5,this.context.createRadialGradient(p,A,m,c,d,u)},updateGradient:function(t){var e,i,r=t.evalVisProp("gradient");return e=t.evalVisProp("fillcolor"),"linear"===r?i=this.updateGradientAngle(t,t.evalVisProp("gradientangle")):"radial"===r&&(i=this.updateGradientCircle(t,t.evalVisProp("gradientcx"),t.evalVisProp("gradientcy"),t.evalVisProp("gradientr"),t.evalVisProp("gradientfx"),t.evalVisProp("gradientfy"),t.evalVisProp("gradientfr"))),i.addColorStop(t.evalVisProp("gradientstartoffset"),e),i.addColorStop(t.evalVisProp("gradientendoffset"),t.evalVisProp("gradientsecondcolor")),i},_setColor:function(t,e,i){var r,s,o,n,a,h,l,c,d,u=!0;return(e=e||"stroke",i=i||e,s=this._getHighlighted(t),"none"!==(n=t.evalVisProp(s+e+"color"))&&!1!==n?(l=(l=t.evalVisProp(s+e+"opacity"))>0?l:0,9!==n.length?(h=n,c=l):(h=(a=M.A.rgba2rgbo(n))[0],c=l*a[1]),this.context.globalAlpha=c,this.context[i+"Style"]=h):u=!1,"linear"===(d=t.evalVisProp("gradient"))||"radial"===d)?(this.context.globalAlpha=c,this.context[i+"Style"]=this.updateGradient(t)):(o=parseFloat(t.evalVisProp(s+"strokewidth")),"stroke"!==e||isNaN(o)||(0===o?this.context.globalAlpha=0:this.context.lineWidth=o),r=t.evalVisProp("linecap"),"stroke"===e&&void 0!==r&&""!==r&&(this.context.lineCap=r)),u},_stroke:function(t){var e=this.context,i=t.evalVisProp("dash"),r=t.evalVisProp("dashscale")?.5*t.evalVisProp("strokewidth"):1;e.save(),i>0?e.setLineDash&&e.setLineDash(this.dashArray[i-1].map(function(t){return t*r})):this.context.lineDashArray=[],this._setColor(t,"stroke")&&e.stroke(),e.restore()},_translateShape:function(t,e,i){var r,s=[],o=t.length;if(o<=0)return t;for(r=0;r<o;r++)s.push([t[r][0]+e,t[r][1]+i]);return s},drawPoint:function(t){var e=t.evalVisProp("face"),i=t.evalVisProp("size"),r=t.coords.scrCoords,s=i*Math.sqrt(3)*.5,o=.5*i,n=parseFloat(t.evalVisProp("strokewidth"))/2,a=this.context;if(t.visPropCalc.visible)switch(e){case"cross":case"x":a.beginPath(),a.moveTo(r[1]-i,r[2]-i),a.lineTo(r[1]+i,r[2]+i),a.moveTo(r[1]+i,r[2]-i),a.lineTo(r[1]-i,r[2]+i),a.lineCap="round",a.lineJoin="round",a.closePath(),this._stroke(t);break;case"circle":case"o":a.beginPath(),a.arc(r[1],r[2],i+1+n,0,2*Math.PI,!1),a.closePath(),this._fill(t),this._stroke(t);break;case"square":case"[]":if(i<=0)break;a.save(),this._setColor(t,"stroke","fill")&&a.fillRect(r[1]-i-n,r[2]-i-n,2*i+3*n,2*i+3*n),a.restore(
1),a.save(),this._setColor(t,"fill"),a.fillRect(r[1]-i+n,r[2]-i+n,2*i-n,2*i-n),a.restore();break;case"plus":case"+":a.beginPath(),a.moveTo(r[1]-i,r[2]),a.lineTo(r[1]+i,r[2]),a.moveTo(r[1],r[2]-i),a.lineTo(r[1],r[2]+i),a.lineCap="round",a.lineJoin="round",a.closePath(),this._stroke(t);break;case"divide":case"|":a.beginPath(),a.moveTo(r[1],r[2]-i),a.lineTo(r[1],r[2]+i),a.lineCap="round",a.lineJoin="round",a.closePath(),this._stroke(t);break;case"minus":case"-":a.beginPath(),a.moveTo(r[1]-i,r[2]),a.lineTo(r[1]+i,r[2]),a.lineCap="round",a.lineJoin="round",a.closePath(),this._stroke(t);break;case"diamond2":case"<<>>":i*=1.41;case"diamond":case"<>":a.beginPath(),a.moveTo(r[1]-i,r[2]),a.lineTo(r[1],r[2]+i),a.lineTo(r[1]+i,r[2]),a.lineTo(r[1],r[2]-i),a.closePath(),this._fill(t),this._stroke(t);break;case"triangleup":case"A":case"a":case"^":a.beginPath(),a.moveTo(r[1],r[2]-i),a.lineTo(r[1]-s,r[2]+o),a.lineTo(r[1]+s,r[2]+o),a.closePath(),this._fill(t),this._stroke(t);break;case"triangledown":case"v":a.beginPath(),a.moveTo(r[1],r[2]+i),a.lineTo(r[1]-s,r[2]-o),a.lineTo(r[1]+s,r[2]-o),a.closePath(),this._fill(t),this._stroke(t);break;case"triangleleft":case"<":a.beginPath(),a.moveTo(r[1]-i,r[2]),a.lineTo(r[1]+o,r[2]-s),a.lineTo(r[1]+o,r[2]+s),a.closePath(),this._fill(t),this._stroke(t);break;case"triangleright":case">":a.beginPath(),a.moveTo(r[1]+i,r[2]),a.lineTo(r[1]-o,r[2]-s),a.lineTo(r[1]-o,r[2]+s),a.closePath(),this._fill(t),this._stroke(t)}},updatePoint:function(t){this.drawPoint(t)},drawArrows:function(t,e,i,r,s){var n,a,h,l,c,d,u,p,f,A,m,b,g,v,y,C,_,P,x,E,S=this.context,N=6,T=1,w=1,O=1,M=s.evFirst,k=s.evLast;if("none"!==t.evalVisProp("strokecolor")&&(M||k)){if(t.elementClass===o.A.OBJECT_CLASS_LINE)n=e.scrCoords[1],a=e.scrCoords[2],h=i.scrCoords[1],x=E=Math.atan2((l=i.scrCoords[2])-a,h-n);else{if(n=t.points[0].scrCoords[1],a=t.points[0].scrCoords[2],(P=t.points.length-1)<1)return;h=t.points[t.points.length-1].scrCoords[1],l=t.points[t.points.length-1].scrCoords[2],v=t.points[1].scrCoords[1]-t.points[0].scrCoords[1],y=t.points[1].scrCoords[2]-t.points[0].scrCoords[2],C=t.points[P].scrCoords[1]-t.points[P-1].scrCoords[1],_=t.points[P].scrCoords[2]-t.points[P-1].scrCoords[2],M&&(x=Math.atan2(y,v)),k&&(E=Math.atan2(_,C))}if(d=t.evalVisProp(r+"strokewidth"),M)if(c=d*(N=s.sizeFirst),f=T=s.typeFirst,2===T)p=[[c,-(.5*c)],[0,0],[c,.5*c],[.5*c,0]];else if(3===T)p=[[c/3,-(.5*c)],[0,-(.5*c)],[0,.5*c],[c/3,.5*c]];else if(4===T)for(c/=10,w=3,g=(p=[[10,3.31],[6.47,3.84],[2.87,4.5],[0,6.63],[.67,5.52],[1.33,4.42],[2,3.31],[1.33,2.21],[.67,1.1],[0,0],[2.87,2.13],[6.47,2.79],[10,3.31]]).length,b=0;b<g;b++)p[b][0]*=-c,p[b][1]*=c,p[b][0]+=10*c,p[b][1]-=3.31*c;else if(5===T)for(c/=10,w=3,g=(p=[[10,3.28],[6.61,4.19],[3.19,5.07],[0,6.55],[.62,5.56],[1,4.44],[1,3.28],[1,2.11],[.62,.99],[0,0],[3.19,1.49],[6.61,2.37],[10,3.28]]).length,b=0;b<g;b++)p[b][0]*=-c,p[b][1]*=c,p[b][0]+=10*c,p[b][1]-=3.28*c;else if(6===T)for(c/=10,w=3,g=(p=[[10,2.84],[6.61,3.59],[3.21,4.35],[0,5.68],[.33,4.73],[.67,3.78],[1,2.84],[.67,1.89],[.33,.95],[0,0],[3.21,1.33],[6.61,2.09],[10,2.84]]).length,b=0;b<g;b++)p[b][0]*=-c,p[b][1]*=c,p[b][0]+=10*c,p[b][1]-=2.84*c;else if(7===T)for(b=0,c=d,w=3,g=(p=[[0,10.39],[2.01,6.92],[5.96,5.2],[10,5.2],[5.96,5.2],[2.01,3.47],[0,0]]).length;b<g;b++)p[b][0]*=-c,p[b][1]*=c,p[b][0]+=10*c,p[b][1]-=5.2*c;else p=[[c,-(.5*c)],[0,0],[c,.5*c]];if(k)if(c=d*(N=s.sizeLast),A=T=s.typeLast,2===T)u=[[-c,-(.5*c)],[0,0],[-c,.5*c],[-(.5*c),0]];else if(3===T)u=[[-c/3,-(.5*c)],[0,-(.5*c)],[0,.5*c],[-c/3,.5*c]];else if(4===T)for(c/=10,O=3,g=(u=[[10,3.31],[6.47,3.84],[2.87,4.5],[0,6.63],[.67,5.52],[1.33,4.42],[2,3.31],[1.33,2.21],[.67,1.1],[0,0],[2.87,2.13],[6.47,2.79],[10,3.31]]).length,b=0;b<g;b++)u[b][0]*=c,u[b][1]*=c,u[b][0]-=10*c,u[b][1]-=3.31*c;else if(5===T)for(c/=10,O=3,g=(u=[[10,3.28],[6.61,4.19],[3.19,5.07],[0,6.55],[.62,5.56],[1,4.44],[1,3.28],[1,2.11],[.62,.99],[0,0],[3.19,1.49],[6.61,2.37],[10,3.28]]).length,b=0;b<g;b++)u[b][0]*=c,u[b][1]*=c,u[b][0]-=10*c,u[b][1]-=3.28*c;else if(6===T)for(c/=10,O=3,g=(u=[[10,2.84],[6.61,3.59],[3.21,4.35],[0,5.68],[.33,4.73],[.67,3.78],[1,2.84],[.67,1.89],[.33,.95],[0,0],[3.21,1.33],[6.61,2.09],[10,2.84]]).length,b=0;b<g;b++)u[b][0]*=c,u[b][1]*=c,u[b][0]-=10*c,u[b][1]-=2.84*c;else if(7===T)for(b=0,c=d,O=3,g=(u=[[0,10.39],[2.01,6.92],[5.96,5.2],[10,5.2],[5.96,5.2],[2.01,3.47],[0,0]]).length;b<g;b++)u[b][0]*=c,u[b][1]*=c,u[b][0]-=10*c,u[b][1]-=5.2*c;else u=[[-c,-(.5*c)],[0,0],[-c,.5*c]];S.save(),this._setColor(t,"stroke","fill")&&(this._setColor(t,"stroke"),M&&(m=7!==f,this._drawPolygon(this._translateShape(this._rotateShape(p,x),n,a),w,m)),k&&(m=7!==A,this._drawPolygon(this._translateShape(this._rotateShape(u,E),h,l),O,m))),S.restore(
1)}},drawLine:function(t){var e,i,r,s,n,a=new f.A(o.A.COORDS_BY_USER,t.point1.coords.usrCoords,t.board),h=new f.A(o.A.COORDS_BY_USER,t.point2.coords.usrCoords,t.board),l=null;t.visPropCalc.visible&&(r=this._getHighlighted(t),s=t.evalVisProp(r+"strokewidth"),((n=this.getArrowHeadData(t,s,r)).evFirst||n.evLast)&&(l=-4),c.A.calcStraight(t,a,h,l),this.handleTouchpoints(t,a,h,n),e=new f.A(o.A.COORDS_BY_USER,a.usrCoords,t.board),i=new f.A(o.A.COORDS_BY_USER,h.usrCoords,t.board),this.getPositionArrowHead(t,a,h,n),this.context.beginPath(),this.context.moveTo(a.scrCoords[1],a.scrCoords[2]),this.context.lineTo(h.scrCoords[1],h.scrCoords[2]),this._stroke(t),(n.evFirst||n.evLast)&&this.drawArrows(t,e,i,r,n))},updateLine:function(t){this.drawLine(t)},drawTicks:function(){},updateTicks:function(t){var e,i,r,s,o,n,a=t.ticks.length,h=this.context;for(h.beginPath(),e=0;e<a;e++)for(r=(i=t.ticks[e])[0],s=i[1],o=r.length,h.moveTo(r[0],s[0]),n=1;n<o;++n)h.lineTo(r[n],s[n]);h.lineCap="round",this._stroke(t)},drawCurve:function(t){var e,i,r;t.evalVisProp("handdrawing")?this.updatePathStringBezierPrim(t):this.updatePathStringPrim(t),t.numberPoints>1&&(e=this._getHighlighted(t),i=t.evalVisProp(e+"strokewidth"),((r=this.getArrowHeadData(t,i,e)).evFirst||r.evLast)&&this.drawArrows(t,null,null,e,r))},updateCurve:function(t){this.drawCurve(t)},drawEllipse:function(t){var e=t.center.coords.scrCoords[1],i=t.center.coords.scrCoords[2],r=t.board.unitX,s=t.board.unitY,o=2*t.Radius(),n=2*t.Radius(),a=o*r,h=n*s,l=e-a/2,c=i-h/2,d=a/2*.5522848,u=h/2*.5522848,p=l+a,f=c+h,A=l+a/2,m=c+h/2,b=this.context;o>0&&n>0&&!isNaN(e+i)&&(b.beginPath(),b.moveTo(l,m),b.bezierCurveTo(l,m-u,A-d,c,A,c),b.bezierCurveTo(A+d,c,p,m-u,p,m),b.bezierCurveTo(p,m+u,A+d,f,A,f),b.bezierCurveTo(A-d,f,l,m+u,l,m),b.closePath(),this._fill(t),this._stroke(t))},updateEllipse:function(t){return this.drawEllipse(t)},displayCopyright:function(t,e){var i=this.context;i.save(),i.font=e+"px Arial",i.fillStyle="#aaa",i.lineWidth=.5,i.fillText(t,10,2+e),i.restore()},drawInternalText:function(t){var e=t.evalVisProp("fontsize"),i=t.evalVisProp("fontunit"),r=t.getAnchorX(),s=t.getAnchorY(),o=this.context;return o.save(),this._setColor(t,"stroke","fill")&&!isNaN(t.coords.scrCoords[1]+t.coords.scrCoords[2])&&(o.font=(e>0?e:0)+i+" Arial",this.transformRect(t,t.transformations),"left"===r?o.textAlign="left":"right"===r?o.textAlign="right":"middle"===r&&(o.textAlign="center"),"bottom"===s?o.textBaseline="bottom":"top"===s?o.textBaseline="top":"middle"===s&&(o.textBaseline="middle"),o.fillText(t.plaintext,t.coords.scrCoords[1],t.coords.scrCoords[2])),o.restore(),null},updateInternalText:function(t){this.drawInternalText(t)},setObjectStrokeColor:function(t,e,i){var r,s,a,h,l=e,c=i;c=c>0?c:0,(t.visPropOld.strokecolor!==l||t.visPropOld.strokeopacity!==c)&&(n.A.exists(l)&&!1!==l&&(9!==l.length?(r=l,a=c):(r=(s=M.A.rgba2rgbo(l))[0],a=c*s[1]),h=t.rendNode,t.elementClass===o.A.OBJECT_CLASS_TEXT&&"html"===t.evalVisProp("display")&&(h.style.color=r,h.style.opacity=a)),t.visPropOld.strokecolor=l,t.visPropOld.strokeopacity=c)},drawImage:function(t){t.rendNode=new Image,t._src="",this.updateImage(t)},updateImage:function(t){var e=this.context,i=t.evalVisProp("fillopacity"),r=n.A.bind(function(){t.imgIsLoaded=!0,t.size[0]<=0||t.size[1]<=0||(e.save(),e.globalAlpha=i,this.transformRect(t,t.transformations),e.drawImage(t.rendNode,t.coords.scrCoords[1],t.coords.scrCoords[2]-t.size[1],t.size[0],t.size[1]),e.restore())},this);this.updateImageURL(t)?t.rendNode.onload=r:t.imgIsLoaded&&r()},transformRect:function(t,e){var i,r,s,n,h,l=e.length,c=this.context;if(l>0)if(i=this.joinTransforms(t,e),t.elementClass===o.A.OBJECT_CLASS_TEXT&&"html"===t.visProp.display){if(-1===(r=" matrix("+[i[1][1],i[2][1],i[1][2],i[2][2],i[1][0],i[2][0]].join(",")+") ").indexOf("NaN")){switch((h=t.rendNode).style.transform=r,s=-t.coords.scrCoords[1],n=-t.coords.scrCoords[2],t.evalVisProp("anchorx")){case"right":s+=t.size[0];break;case"middle":s+=.5*t.size[0]}switch(t.evalVisProp("anchory")){case"bottom":n+=t.size[1];break;case"middle":n+=.5*t.size[1]}h.style["transform-origin"]=s+"px "+n+"px"}}else Math.abs(p.A.det(i))>=a.A.eps&&c.transform(i[1][1],i[2][1],i[1][2],i[2][2],i[1][0],i[2][0])},updateImageURL:function(t){var e;return e=t.eval(t.url),t._src!==e&&(t.imgIsLoaded=!1,t.rendNode.src=e,t._src=e,!0)},remove:function(t){n.A.exists(t)&&n.A.exists(t.parentNode)&&t.parentNode.removeChild(t)},updatePathStringPrim:function(t){var e,i,r,s,o,n="M",a="L",h="C",l=n,c=5e3,d=this.context;if(!(t.numberPoints<=0)){if(o=Math.min(t.points.length,t.numberPoints),d.beginPath(),1===t.bezierDegree)for(e=0;e<o;e++)isNaN((i=t.points[e].scrCoords)[1])||isNaN(i[2])?l=n:(i[1]>c?i[1]=c:i[1]<-c&&(i[1]=-c),i[2]>c?i[2]=c:i[2]<-c&&(i[2]=-c),l===n?d.moveTo(i[1],i[2]):d.lineTo(i[1],i[2]),l=a);else if(3===t.bezierDegree)for(e=0;e<o;)isNaN((i=t.points[e].scrCoords)[1])||isNaN(i[2])?l=n:(l===n?d.moveTo(i[1],i[2]):(e+=1,r=t.points[e].scrCoords,e+=1,s=t.points[e].scrCoords,d.bezierCurveTo(i[1],i[2],r[1],r[2],s[1],s[2])),l=h),e+=1;d.lineCap="round",d.lineJoin="round",this._fill(t),this._stroke(t)}},updatePathStringBezierPrim:function(t){var e,i,r,s,o,n,a,h="M",l="C",c=h,d=5e3,u=t.evalVisProp("strokewidth"),f="plot"!==t.evalVisProp("curvetype"),A=this.context;if(!(t.numberPoints<=0)){for(f&&t.board.options.curve.RDPsmoothing&&(t.points=p.A.RamerDouglasPeucker(t.points,.5)),a=Math.min(t.points.length,t.numberPoints),A.beginPath(),i=1;i<3;i++)for(e=0,c=h;
1e<a;e++)isNaN((s=t.points[e].scrCoords)[1])||isNaN(s[2])?c=h:(s[1]>d?s[1]=d:s[1]<-d&&(s[1]=-d),s[2]>d?s[2]=d:s[2]<-d&&(s[2]=-d),c===h?A.moveTo(s[1],s[2]):(r=2*i,A.bezierCurveTo(o+(s[1]-o)*.333+u*(r*Math.random()-i),n+(s[2]-n)*.333+u*(r*Math.random()-i),o+(s[1]-o)*.666+u*(r*Math.random()-i),n+(s[2]-n)*.666+u*(r*Math.random()-i),s[1],s[2])),c=l,o=s[1],n=s[2]);A.lineCap="round",A.lineJoin="round",this._fill(t),this._stroke(t)}},updatePolygonPrim:function(t,e){var i,r,s,o=e.vertices.length,n=this.context,a=!0;if(!(o<=0)&&e.visPropCalc.visible){for("polygonalchain"===e.elType&&o++,n.beginPath(),r=0;!e.vertices[r].isReal&&r<o-1;)r++,a=!1;for(i=e.vertices[r].coords.scrCoords,n.moveTo(i[1],i[2]),s=r;s<o-1;s++)e.vertices[s].isReal||(a=!1),i=e.vertices[s].coords.scrCoords,n.lineTo(i[1],i[2]);n.closePath(),a&&this._fill(e)}},display:function(t,e){t&&t.rendNode&&(t.visPropOld.visible=e,e?t.rendNode.style.visibility="inherit":t.rendNode.style.visibility="hidden")},show:function(t){r.A.deprecated("Board.renderer.show()","Board.renderer.display()"),n.A.exists(t.rendNode)&&(t.rendNode.style.visibility="inherit")},hide:function(t){r.A.deprecated("Board.renderer.hide()","Board.renderer.display()"),n.A.exists(t.rendNode)&&(t.rendNode.style.visibility="hidden")},setGradient:function(t){},setShadow:function(t){t.visPropOld.shadow!==t.visProp.shadow&&(t.visPropOld.shadow=t.visProp.shadow)},highlight:function(t){return t.elementClass===o.A.OBJECT_CLASS_TEXT&&"html"===t.evalVisProp("display")?this.updateTextStyle(t,!0):(t.board.prepareUpdate(),t.board.renderer.suspendRedraw(t.board),t.board.updateRenderer(),t.board.renderer.unsuspendRedraw()),this},noHighlight:function(t){return t.elementClass===o.A.OBJECT_CLASS_TEXT&&"html"===t.evalVisProp("display")?this.updateTextStyle(t,!1):(t.board.prepareUpdate(),t.board.renderer.suspendRedraw(t.board),t.board.updateRenderer(),t.board.renderer.unsuspendRedraw()),this},suspendRedraw:function(t){this.context.save(),this.context.clearRect(0,0,this.canvasRoot.width,this.canvasRoot.height),t&&t.attr.showcopyright&&this.displayCopyright(r.A.licenseText,12)},unsuspendRedraw:function(){this.context.restore()},resize:function(t,e){this.container?(this.canvasRoot.style.width=parseFloat(t)+"px",this.canvasRoot.style.height=parseFloat(e)+"px",this.canvasRoot.setAttribute("width",2*parseFloat(t)+"px"),this.canvasRoot.setAttribute("height",2*parseFloat(e)+"px")):(this.canvasRoot.width=2*parseFloat(t),this.canvasRoot.height=2*parseFloat(e)),this.context=this.canvasRoot.getContext("2d"),this.context.scale(2,2)},removeToInsertLater:function(){return function(){}}});let B=r.A.CanvasRenderer;r.A.NoRenderer=function(){this.enhancedRendering=!1,this.type="no"},r.A.extend(r.A.NoRenderer.prototype,{drawPoint:function(t){},updatePoint:function(t){},changePointStyle:function(t){},drawLine:function(t){},updateLine:function(t){},drawTicks:function(t){},updateTicks:function(t){},drawCurve:function(t){},updateCurve:function(t){},drawEllipse:function(t){},updateEllipse:function(t){},drawPolygon:function(t){},updatePolygon:function(t){},displayCopyright:function(t,e){},drawInternalText:function(t){},updateInternalText:function(t){},drawText:function(t){},updateText:function(t){},updateTextStyle:function(t,e){},updateInternalTextStyle:function(t,e,i){},drawImage:function(t){},updateImage:function(t){},updateImageURL:function(t){},appendChildPrim:function(t,e){},appendNodesToElement:function(t,e){},remove:function(t){},makeArrows:function(t){},updateEllipsePrim:function(t,e,i,r,s){},updateLinePrim:function(t,e,i,r,s,o){},updatePathPrim:function(t,e,i){},updatePathStringPoint:function(t,e,i){},updatePathStringPrim:function(t){},updatePathStringBezierPrim:function(t){},updatePolygonPrim:function(t,e){},updateRectPrim:function(t,e,i,r,s){},setPropertyPrim:function(t,e,i){},show:function(t){},hide:function(t){},setBuffering:function(t,e){},setDashStyle:function(t){},setDraft:function(t){},removeDraft:function(t){},setGradient:function(t){},updateGradient:function(t){},setObjectTransition:function(t,e){},setObjectFillColor:function(t,e,i){}
1,setObjectStrokeColor:function(t,e,i){},setObjectStrokeWidth:function(t,e){},setShadow:function(t){},highlight:function(t){},noHighlight:function(t){},suspendRedraw:function(){},unsuspendRedraw:function(){},drawNavigationBar:function(t){},getElementById:function(t){return null},resize:function(t,e){},removeToInsertLater:function(){return function(){}}}),r.A.NoRenderer.prototype=new C;let I=r.A.NoRenderer;r.A.JSXGraph={rendererType:function(){return y.A.board.renderer="no",s.A.supportsVML()&&(y.A.board.renderer="vml",document.onmousemove=function(){var t;return document.body&&(t=document.body.scrollLeft+document.body.scrollTop),t}),s.A.supportsCanvas()&&(y.A.board.renderer="canvas"),s.A.supportsSVG()&&(y.A.board.renderer="svg"),s.A.isNode()&&s.A.supportsCanvas()&&(y.A.board.renderer="canvas"),(s.A.isNode()||"no"===y.A.renderer)&&(y.A.text.display="internal",y.A.infobox.display="internal"),y.A.board.renderer}(),initRenderer:function(t,e,i,r){var s,o;if(n.A.exists(i)&&!1!==i||"object"!=typeof document||(i=document),"object"==typeof i&&null!==t)for(s=n.A.isString(t)?i.getElementById(t):t;s.firstChild;)s.removeChild(s.firstChild);else s=t;return(void 0===r||"auto"===r)&&(r=this.rendererType),o="svg"===r?new k(s,e):"vml"===r?new D(s):"canvas"===r?new B(s,e):new I},_setAttributes:function(t,e){var i,r,s=n.A.copyAttributes(t,e,"board"),o=["drag","fullscreen","intl","keyboard","logging","pan","resize","screenshot","selection","zoom"],a=o.length;for(i=0;i<a;i++)s[r=o[i]]=n.A.copyAttributes(s,e,"board",r);return s.navbar=n.A.copyAttributes(s.navbar,e,"navbar"),s.movetarget=t.moveTarget||t.movetarget||e.board.moveTarget,s},_fillBoard:function(t,e,i){t.initInfobox(e.infobox),t.maxboundingbox=e.maxboundingbox,t.resizeContainer(i.width,i.height,!0,!0),t._createSelectionPolygon(e),t.renderer.drawNavigationBar(t,e.navbar),r.A.boards[t.id]=t},_setARIA:function(t,e){var i,r=e.document;if("object"!=typeof r){if(!s.A.isBrowser)return;r=document}(i=n.A.isString(t)?r.getElementById(t):t).setAttribute("role","region"),i.setAttribute("aria-label",e.title)}
1,_removeARIANodes:function(t){var e,i,r;"object"==typeof(r=t.document||document)&&(i=t.containerObj.getAttribute("aria-labelledby"),(e=r.getElementById(i))&&e.parentNode&&e.parentNode.removeChild(e),i=t.containerObj.getAttribute("aria-describedby"),(e=r.getElementById(i))&&e.parentNode&&e.parentNode.removeChild(e))},initBoard:function(t,e){var i,o,a,h,l,c,d,u,p,f,A,m,b,g,v,C=0,_=0,P={};return"default"!==(e=e||{}).theme&&n.A.exists(r.A.themes[e.theme])&&(P=r.A.themes[e.theme]),g=n.A.deepCopy(y.A,P,!0),f=this._setAttributes(e,g),u=s.A.getDimensions(t,f.document),f.unitx||f.unity?(i=n.A.def(f.originx,150),o=n.A.def(f.originy,150),a=n.A.def(f.unitx,50),h=n.A.def(f.unity,50)):((p=f.boundingbox)[0]<f.maxboundingbox[0]&&(p[0]=f.maxboundingbox[0]),p[1]>f.maxboundingbox[1]&&(p[1]=f.maxboundingbox[1]),p[2]>f.maxboundingbox[2]&&(p[2]=f.maxboundingbox[2]),p[3]<f.maxboundingbox[3]&&(p[3]=f.maxboundingbox[3]),l=parseInt(u.width,10),c=parseInt(u.height,10),n.A.exists(p)&&f.keepaspectratio?Math.abs(a=l/(p[2]-p[0]))<Math.abs(h=c/(p[1]-p[3]))?_=(c/(h=Math.abs(a)*h/Math.abs(h))-(p[1]-p[3]))*.5:C=(l/(a=Math.abs(h)*a/Math.abs(a))-(p[2]-p[0]))*.5:(a=l/(p[2]-p[0]),h=c/(p[1]-p[3])),i=-a*(p[0]-C),o=h*(p[1]+_)),d=this.initRenderer(t,u,f.document,f.renderer),this._setARIA(t,f),(v=new O.A(t,d,f.id,[i,o],f.zoomx,f.zoomy,a,h,u.width,u.height,f)).keepaspectratio=f.keepaspectratio,this._fillBoard(v,f,u),v.suspendUpdate(),(f=v.attr).axis&&(A="object"==typeof f.axis?f.axis:{},m=n.A.deepCopy(g.board.defaultaxes.x,A),b=n.A.deepCopy(g.board.defaultaxes.y,A),f.defaultaxes.x&&(m=n.A.deepCopy(m,f.defaultaxes.x)),f.defaultaxes.y&&(b=n.A.deepCopy(b,f.defaultaxes.y)),v.defaultAxes={},v.defaultAxes.x=v.create("axis",[[0,0],[1,0]],m),v.defaultAxes.y=v.create("axis",[[0,0],[0,1]],b)),f.grid&&v.create("grid",[],"object"==typeof f.grid?f.grid:{}),v.unsuspendUpdate(),v},loadBoardFromFile:function(t,e,i,r,o){var n,a,h,l,c;return r=r||{},n=this._setAttributes(r),l=s.A.getDimensions(t,n.document),a=this.initRenderer(t,l,n.document,n.renderer),this._setARIA(t,n),h=new O.A(t,a,"",[150,150],1,1,50,50,l.width,l.height,n),this._fillBoard(h,n,l),c=n.encoding||"iso-8859-1",T.parseFileContent(e,h,i,!0,c,o),h},loadBoardFromString:function(t,e,i,r,o){var n,a,h,l;return r=r||{},n=this._setAttributes(r),l=s.A.getDimensions(t,n.document),a=this.initRenderer(t,l,n.document,n.renderer),this._setARIA(t,n),h=new O.A(t,a,"",[150,150],1,1,50,50,l.width,l.height,n),this._fillBoard(h,n,l),T.parseString(e,h,i,!0,o),h},freeBoard:function(t){var e;for(e in"string"==typeof t&&(t=r.A.boards[t]),this._removeARIANo
1des(t),t.removeEventHandlers(),t.suspendUpdate(),t.objects)t.objects.hasOwnProperty(e)&&t.objects[e].remove();for(;t.containerObj.firstChild;)t.containerObj.removeChild(t.containerObj.firstChild);for(e in t.objects)t.objects.hasOwnProperty(e)&&delete t.objects[e];delete t.renderer,t.jc.creator.clearCache(),delete t.jc,delete r.A.boards[t.id]},registerElement:function(t,e){r.A.deprecated("JXG.JSXGraph.registerElement()","JXG.registerElement()"),r.A.registerElement(t,e)}},s.A.isBrowser&&"object"==typeof window&&"object"==typeof document&&s.A.addEvent(window,"load",function(){var t,e,i,s,o,a,h,l,c,d,u,p,f,A,m,b,g,v,y=!1,C=document.getElementsByTagName("script"),_=function(t,e,i){var s=r.A.JSXGraph.initBoard(o,{boundingbox:i,keepaspectratio:!0,grid:m,axis:A,showReload:!0});if(e.toLowerCase().indexOf("script")>-1)s.construct(t);else try{s.jc.parse(t)}catch(t){r.A.debug(t)}return s},P=function(t,e,i,s){return function(){var o;r.A.JSXGraph.freeBoard(t),(o=_(e,i,s)).reload=P(o,e,i,s)}};for(e=0;e<C.length;e++)if(t=C[e].getAttribute("type",!1),n.A.exists(t)&&("text/jessiescript"===t.toLowerCase()||"jessiescript"===t.toLowerCase()||"text/jessiecode"===t.toLowerCase()||"jessiecode"===t.toLowerCase())){if(p=C[e].getAttribute("class",!1)||"",l=C[e].getAttribute("width",!1)||"",c=C[e].getAttribute("height",!1)||"",d=C[e].getAttribute("maxwidth",!1)||"100%",u=C[e].getAttribute("aspectratio",!1)||"1/1",f=C[e].getAttribute("boundingbox",!1)||"-5, 5, 5, -5",o=C[e].getAttribute("container",!1),g=C[e].getAttribute("src",!1),4!==(f=f.split(",")).length)f=[-5,5,5,-5];else for(i=0;i<f.length;i++)f[i]=parseFloat(f[i]);if(A=n.A.str2Bool(C[e].getAttribute("axis",!1)||"false"),m=n.A.str2Bool(C[e].getAttribute("grid",!1)||"false"),n.A.exists(o))s=document.getElementById(o);else{o="jessiescript_autgen_jxg_"+e,(s=document.createElement("div")).setAttribute("id",o),h=(""!==l?"width:"+l+";":"")+(""!==c?"height:"+c+";":"")+(""!==d?"max-width:"+d+";":"")+(""!==u?"aspect-ratio:"+u+";":""),s.setAttribute("style",h),s.setAttribute("class","jxgbox "+p);try{document.body.insertBefore(s,C[e])}catch(t){"object"==typeof jQuery&&jQuery(s).insertBefore(C[e])}}b="",n.A.exists(g)?(y=!0,(v=new XMLHttpRequest).open("GET",g),v.overrideMimeType("text/plain; charset=x-user-defined"),v.addEventListener("load",function(){if(this.status<400)(a=_(b=this.responseText+"\n"+b,t,f)).reload=P(a,b,t,f);else throw Error("\nJSXGraph: failed to load file",g,":",this.responseText)}),v.addEventListener("error",function(t){throw Error("\nJSXGraph: failed to load file",g,":",t)}),v.send()):y=!1,document.getElementById(o)?(b=(b=C[e].innerHTML).replace(/<!\[CDATA\[/g,"").replace(/\]\]>/g,""),C[e].innerHTML=b,y||((a=_(b,t,f)).reload=P(a,b,t,f))):r.A.debug("JSXGraph: Apparently the div injection failed. Can't create a board, sorry.")}},window),r.A.JSXGraph;var V=i(11701),Y=i(57571);r.A.Point=function(t,e,i){this.constructor(t,i,o.A.OBJECT_TYPE_POINT,o.A.OBJECT_CLASS_POINT),this.element=this.board.select(i.anchor),this.coordsConstructor(e),this.elType="point",this.id=this.board.setId(this,"P"),this.board.renderer.drawPoint(this),this.board.finalizeAdding(this),this.createGradient(),this.createLabel()},r.A.Point.prototype=new V.A,n.A.copyPrototypeMethods(r.A.Point,Y.A,"coordsConstructor"),r.A.extend(r.A.Point.prototype,{hasPoint:function(t,e){var i,r,s,o=this.coords.scrCoords,a=this.evalVisProp("sizeunit");return n.A.isObject(this.evalVisProp("precision"))?(s=this.board._inputDevice,r=this.evalVisProp("precision."+s)):r=this.board.options.precision.hasPoint,i=parseFloat(this.evalVisProp("size")),"user"===a&&(i*=Math.sqrt(Math.abs(this.board.unitX*this.board.unitY))),(i+=.5*parseFloat(this.evalVisProp("strokewidth")))<r&&(i=r),Math.abs(o[1]-t)<i+2&&Math.abs(o[2]-e)<i+2},update:function(t){return this.needsUpdate&&(this.updateCoords(t),this.evalVisProp("trace")&&this.cloneToBackground(!0)),this},updateTransform:function(t){var e,i;if(0===this.transformations.length||null===this.baseElement)return this;for(this.transformations[0].update(),e=this===this.baseElement?this.transformations[0].apply(this,"self"):this.transformations[0].apply(this.baseElement),i=1;i<this.transformations.length;i++)this.transformations[i].update(),e=a.A.matVecMult(this.transformations[i].matrix,e);return this.coords.setCoordinates(o.A.COORDS_BY_USER,e),this},updateRenderer:function(){return this.updateRendererGeneric("updatePoint"),this},bounds:function(){return this.coords.usrCoords.slice(1).concat(this.coords.usrCoords.slice(1))}
1,makeIntersection:function(t,e,i,r){var s;t=this.board.select(t),e=this.board.select(e),s=c.A.intersectionFunction(this.board,t,e,i,r,this.visProp.alwaysintersect),this.addConstraint([s]);try{t.addChild(this),e.addChild(this)}catch(i){throw Error("JSXGraph: Can't create 'intersection' with parent types '"+typeof t+"' and '"+typeof e+"'.")}this.type=o.A.OBJECT_TYPE_INTERSECTION,this.elType="intersection",this.parents=[t.id,e.id,i,r],this.generatePolynomial=function(){var i=t.generatePolynomial(this),r=e.generatePolynomial(this);return 0===i.length||0===r.length?[]:[i[0],r[0]]},this.prepareUpdate().update()},setStyle:function(t){var e=["cross","cross","cross","circle","circle","circle","circle","square","square","square","plus","plus","plus"],i=[2,3,4,1,2,3,4,2,3,4,2,3,4];return this.visProp.face=e[t],this.visProp.size=i[t],this.board.renderer.changePointStyle(this),this},normalizeFace:function(t){return r.A.deprecated("Point.normalizeFace()","JXG.normalizePointFace()"),y.A.normalizePointFace(t)},face:function(t){r.A.deprecated("Point.face()","Point.setAttribute()"),this.setAttribute({face:t})},size:function(t){r.A.deprecated("Point.size()","Point.setAttribute()"),this.setAttribute({size:t})},isOn:function(t,e){var i,s;if(e=e||a.A.eps,n.A.isPoint(t))return this.Dist(t)<e;if(t.elementClass===o.A.OBJECT_CLASS_LINE){if("segment"!==t.elType||this.evalVisProp("alwaysintersect"))return c.A.distPointLine(this.coords.usrCoords,t.stdform)<e;else if((i=r.A.Math.Geometry.projectCoordsToSegment(this.coords.usrCoords,t.point1.coords.usrCoords,t.point2.coords.usrCoords))[1]>=0&&i[1]<=1&&c.A.distPointLine(this.coords.usrCoords,t.stdform)<e)return!0}else if(t.elementClass===o.A.OBJECT_CLASS_CIRCLE)return t.evalVisProp("hasinnerpoints")?this.Dist(t.center)<t.Radius()+e:Math.abs(this.Dist(t.center)-t.Radius())<e;else if(t.elementClass===o.A.OBJECT_CLASS_CURVE)return s=c.A.projectPointToCurve(this,t,this.board)[0],c.A.distance(this.coords.usrCoords,s.usrCoords,3)<e;else if(t.type===o.A.OBJECT_TYPE_POLYGON)return!!(t.evalVisProp("hasinnerpoints")&&t.pnpoly(this.coords.usrCoords[1],this.coords.usrCoords[2],r.A.COORDS_BY_USER))||(i=c.A.projectCoordsToPolygon(this.coords.usrCoords,t),c.A.distance(this.coords.usrCoords,i,3)<e);else if(t.type===o.A.OBJECT_TYPE_TURTLE)return s=c.A.projectPointToTurtle(this,t,this.board),c.A.distance(this.coords.usrCoords,s.usrCoords,3)<e;return!1},cloneToBackground:function(){var t=n.A.getCloneObject(this);return this.board.renderer.drawPoint(t),this.traces[t.id]=t.rendNode,this}}),r.A.createPoint=function(t,e,i){var s,o;if(o=n.A.copyAttributes(i,t.options,"point"),!(s=Y.A.create(r.A.Point,t,e,o)))throw Error("JSXGraph: Can't create point with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [x,y], [z,x,y], [element,transformation]");return s},r.A.createGlider=function(t,e,i){var r,s,o=n.A.copyAttributes(i,t.options,"glider");return s=1===e.length?[0,0]:e.slice(0,2),(r=t.create("point",s,o)).makeGlider(e[e.length-1]),r},r.A.createIntersectionPoint=function(t,e,i){var r,s,a,h,l,d,u=n.A.copyAttributes(i,t.options,"intersection");e.push(0,0),s=t.select(e[0]),a=t.select(e[1]),l=e[2]||0,d=e[3]||0,r=t.create("point",[0,0,0],u),h=c.A.intersectionFunction(t,s,a,l,d,r.visProp.alwaysintersect),r.addConstraint([h]);try{s.addChild(r),a.addChild(r)}catch(t){throw Error("JSXGraph: Can't create 'intersection' with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.")}return r.type=o.A.OBJECT_TYPE_INTERSECTION,r.elType="intersection",r.setParents([s.id,a.id]),r.intersectionNumbers=[l,d],r.getParents=function(){return this.parents.concat(this.intersectionNumbers)},r.generatePolynomial=function(){var t=s.generatePolynomial(r),e=a.generatePolynomial(r);return 0===t.length||0===e.length?[]:[t[0],e[0]]},r},r.A.createOtherIntersectionPoint=function(t,e,i){var r,s,a,h,l,d,u,p=!0,f=n.A.copyAttributes(i,t.options,"otherintersection");if(3!==e.length)p=!1;else{for(h=0,s=t.select(e[0]),a=t.select(e[1]),l=n.A.isArray(e[2])?e[2]:[e[2]];h<l.length;h++)if(l[h]=t.select(l[h]),!n.A.isPoint(l[h])){p=!1;break}p&&((u=[s,a]).sort(function(t,e){return e.elementClass-t.elementClass}),0>[o.A.OBJECT_CLASS_CIRCLE,o.A.OBJECT_CLASS_CURVE].indexOf(u[0].elementClass)?p=!1:0>[o.A.OBJECT_CLASS_CIRCLE,o.A.OBJECT_CLASS_CURVE,o.A.OBJECT_CLASS_LINE].indexOf(u[1].elementClass)&&(p=!1))}if(!p)throw Error("JSXGraph: Can't create 'other intersection point' with parent types '"+typeof e[0]+"', '"+typeof e[1]+"'and '"+typeof e[2]+"'.\nPossible parent types: [circle|curve|line,circle|curve|line, point], not tw
1o lines");return r=t.create("point",[0,0,0],f),d=c.A.otherIntersectionFunction(u,l,r.visProp.alwaysintersect,r.visProp.precision),r.addConstraint([d]),r.type=o.A.OBJECT_TYPE_INTERSECTION,r.elType="otherintersection",r.setParents([s.id,a.id]),r.addParents(l),s.addChild(r),a.addChild(r),s.elementClass===o.A.OBJECT_CLASS_CIRCLE&&(r.generatePolynomial=function(){var t=s.generatePolynomial(r),e=a.generatePolynomial(r);return 0===t.length||0===e.length?[]:[t[0],e[0]]}),r},r.A.createPolePoint=function(t,e,i){var s,n,a,h,l,c,d;if(e.length>1&&(h=e[0].type===o.A.OBJECT_TYPE_CONIC||e[0].elementClass===o.A.OBJECT_CLASS_CIRCLE,l=e[1].type===o.A.OBJECT_TYPE_CONIC||e[1].elementClass===o.A.OBJECT_CLASS_CIRCLE,c=e[0].elementClass===o.A.OBJECT_CLASS_LINE,d=e[1].elementClass===o.A.OBJECT_CLASS_LINE),2!==e.length||!(h&&d||c&&l))throw Error("JSXGraph: Can't create 'pole point' with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent type: [conic|circle,line], [line,conic|circle]");return d?(n=t.select(e[0]),a=t.select(e[1])):(n=t.select(e[1]),a=t.select(e[0])),(s=t.create("point",[function(){var t=n.quadraticform,e=a.stdform.slice(0,3);return[r.A.Math.Numerics.det([e,t[1],t[2]]),r.A.Math.Numerics.det([t[0],e,t[2]]),r.A.Math.Numerics.det([t[0],t[1],e])]}],i)).elType="polepoint",s.setParents([n.id,a.id]),n.addChild(s),a.addChild(s),s},r.A.registerElement("point",r.A.createPoint),r.A.registerElement("glider",r.A.createGlider),r.A.registerElement("intersection",r.A.createIntersectionPoint),r.A.registerElement("otherintersection",r.A.createOtherIntersectionPoint),r.A.registerElement("polepoint",r.A.createPolePoint);let j=r.A.Point;r.A.Line=function(t,e,i,s){this.constructor(t,s,o.A.OBJECT_TYPE_LINE,o.A.OBJECT_CLASS_LINE),this.point1=this.board.select(e),this.point2=this.board.select(i),this.ticks=[],this.defaultTicks=null,this.parentPolygon=null,this.id=this.board.setId(this,"L"),this.board.renderer.drawLine(this),this.board.finalizeAdding(this),this.elType="line",this.point1._is_new?(this.addChild(this.point1),delete this.point1._is_new):this.point1.addChild(this),this.point2._is_new?(this.addChild(this.point2),delete this.point2._is_new):this.point2.addChild(this),this.inherits.push(this.point1,this.point2),this.updateStdform(),this.createLabel(),this.methodMap=r.A.deepCopy(this.methodMap,{point1:"point1",point2:"point2",getSlope:"Slope",Slope:"Slope",Direction:"Direction",getRise:"getRise",Rise:"getRise",getYIntersect:"getRise",YIntersect:"getRise",getAngle:"getAngle",Angle:"getAngle",L:"L",length:"L",setFixedLe
1ngth:"setFixedLength",setStraight:"setStraight"})},r.A.Line.prototype=new V.A,r.A.extend(r.A.Line.prototype,{hasPoint:function(t,e){var i,r,s,h,l,d,u,p,A,m=[],b=[1,t,e],g=this.evalVisProp("strokewidth");return n.A.isObject(this.evalVisProp("precision"))?(A=this.board._inputDevice,p=this.evalVisProp("precision."+A)):p=this.board.options.precision.hasPoint,p+=.5*g,m[0]=this.stdform[0]-this.stdform[1]*this.board.origin.scrCoords[1]/this.board.unitX+this.stdform[2]*this.board.origin.scrCoords[2]/this.board.unitY,m[1]=this.stdform[1]/this.board.unitX,m[2]=-(this.stdform[2]/this.board.unitY),!isNaN(i=c.A.distPointLine(b,m))&&!(i>p)&&(!!(this.evalVisProp("straightfirst")&&this.evalVisProp("straightlast"))||(s=this.point1.coords,h=this.point2.coords,r=[0,m[1],m[2]],r=a.A.crossProduct(r,b),r=a.A.crossProduct(r,m),r[1]/=r[0],r[2]/=r[0],r[0]=1,r=new f.A(o.A.COORDS_BY_SCREEN,r.slice(1),this.board).usrCoords,l=s.distance(o.A.COORDS_BY_USER,h),s=s.usrCoords.slice(0),h=h.usrCoords.slice(0),l<a.A.eps?d=0:(l===1/0&&(l=1/a.A.eps,Math.abs(h[0])<a.A.eps?(l/=c.A.distance([0,0,0],h),h=[1,s[1]+h[1]*l,s[2]+h[2]*l]):(l/=c.A.distance([0,0,0],s),s=[1,h[1]+s[1]*l,h[2]+s[2]*l])),Math.abs(l=h[u=1]-s[u])<a.A.eps&&(l=h[u=2]-s[u]),d=(r[u]-s[u])/l),(!!this.evalVisProp("straightfirst")||!(d<0))&&!(!this.evalVisProp("straightlast")&&d>1)))},update:function(){var t;return this.needsUpdate&&(this.constrained&&(n.A.isFunction(this.funps)?(t=this.funps())&&t.length&&2===t.length&&(this.point1=t[0],this.point2=t[1]):(n.A.isFunction(this.funp1)&&(t=this.funp1(),n.A.isPoint(t)?this.point1=t:t&&t.length&&2===t.length&&this.point1.setPositionDirectly(o.A.COORDS_BY_USER,t)),n.A.isFunction(this.funp2)&&(t=this.funp2(),n.A.isPoint(t)?this.point2=t:t&&t.length&&2===t.length&&this.point2.setPositionDirectly(o.A.COORDS_BY_USER,t)))),this.updateSegmentFixedLength(),this.updateStdform(),this.evalVisProp("trace")&&this.cloneToBackground(!0)),this},updateSegmentFixedLength:function(){var t,e,i,r,s,n,h,l;return this.hasFixedLength&&(t=this.point1.Dist(this.point2),e=this.evalVisProp("nonnegativeonly")?Math.max(0,this.fixedLength()):Math.abs(this.fixedLength()),i=this.fixedLengthOldCoords[0].distance(o.A.COORDS_BY_USER,this.point1.coords),r=this.fixedLengthOldCoords[1].distance(o.A.COORDS_BY_USER,this.point2.coords),(i>a.A.eps||r>a.A.eps||t!==e)&&(s=this.point1.isDraggable&&this.point1.type!==o.A.OBJECT_TYPE_GLIDER&&!this.point1.evalVisProp("fixed"),n=this.point2.isDraggable&&this.point2.type!==o.A.OBJECT_TYPE_GLIDER&&!this.point2.evalVisProp("fixed"),t>a.A.eps?i>r&&n||i<=r&&n&&!s?(this.point2.setPositionDirectly(o.A.COORDS_BY_USER,[this.point1.X()+(this.point2.X()-this.point1.X())*e/t,this.point1.Y()+(this.point2.Y()-this.point1.Y())*e/t]),this.point2.fullUpdate()):(i<=r&&s||i>r&&s&&!n)&&(this.point1.setPositionDirectly(o.A.COORDS_BY_USER,[this.point2.X()+(this.point1.X()-this.point2.X())*e/t,this.point2.Y()+(this.point1.Y()-this.point2.Y())*e/t]),this.point1.fullUpdate()):(h=Math.random()-.5,l=Math.random()-.5,t=a.A.hypot(h,l),n?(this.point2.setPositionDirectly(o.A.COORDS_BY_USER,[this.point1.X()+h*e/t,this.point1.Y()+l*e/t]),this.point2.fullUpdate()):s&&(this.point1.setPositionDirectly(o.A.COORDS_BY_USER,[this.point2.X()+h*e/t,this.point2.Y()+l*e/t]),this.point1.fullUpdate())),this.fixedLengthOldCoords[0].setCoordinates(o.A.COORDS_BY_USER,this.point1.coords.usrCoords),this.fixedLengthOldCoords[1].setCoordinates(o.A.COORDS_BY_USER,this.point2.coords.usrCoords))),this},updateStdform:function(){var t=a.A.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])&&a.A.innerProduct(this.stdform,this.stdform,3)>=a.A.eps*a.A.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(
1),this.board.renderer.updateText(this.label)),this.setDisplayRendNode(),this.needsUpdate=!1),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+")"]},getRise:function(){return Math.abs(this.stdform[2])>=a.A.eps?-this.stdform[0]/this.stdform[2]:1/0},Slope:function(){return Math.abs(this.stdform[2])>=a.A.eps?-this.stdform[1]/this.stdform[2]:1/0},getSlope:function(){return this.Slope()},getAngle:function(){return Math.atan2(-this.stdform[1],this.stdform[2])},Direction:function(){var t=this.point1.coords.usrCoords,e=this.point2.coords.usrCoords;return 0===e[0]&&0!==t[0]?e.slice(1):0===t[0]&&0!==e[0]?[-t[1],-t[2]]:[e[1]-t[1],e[2]-t[2]]},isVertical:function(){var t=this.Direction();return 0===t[0]&&0!==t[1]},isHorizontal:function(){var t=this.Direction();return 0===t[1]&&0!==t[0]},setStraight:function(t,e){return this.visProp.straightfirst=t,this.visProp.straightlast=e,this.board.renderer.updateLine(this),this},getTextAnchor:function(){return new f.A(o.A.COORDS_BY_USER,[.5*(this.point2.X()+this.point1.X()),.5*(this.point2.Y()+this.point1.Y())],this.board)},setLabelRelativeCoords:function(t){n.A.exists(this.label)&&(this.label.relativeCoords=new f.A(o.A.COORDS_BY_SCREEN,[t[0],-t[1]],this.board))},getLabelAnchor:function(){var t,e,i,r,s,h,l,d,u=1.5,p=0,A=new f.A(o.A.COORDS_BY_USER,this.point1.coords.usrCoords,this.board),m=new f.A(o.A.COORDS_BY_USER,this.point2.coords.usrCoords,this.board),b=this.evalVisProp("straightfirst"),g=this.evalVisProp("straightlast");
1if((b||g)&&c.A.calcStraight(this,A,m,0),A=A.scrCoords,m=m.scrCoords,!n.A.exists(this.label)||(i=this.label.evalVisProp("position"),!n.A.isString(i)))return new f.A(o.A.COORDS_BY_SCREEN,[NaN,NaN],this.board);if(0>i.indexOf("right")&&0>i.indexOf("left"))switch(i){case"last":t=m[1],e=m[2];break;case"first":t=A[1],e=A[2];break;case"lft":case"llft":case"ulft":A[1]<m[1]+a.A.eps?(t=A[1],e=A[2]):(t=m[1],e=m[2]);break;case"rt":case"lrt":case"urt":A[1]>m[1]+a.A.eps?(t=A[1],e=A[2]):(t=m[1],e=m[2]);break;default:t=.5*(A[1]+m[1]),e=.5*(A[2]+m[2])}else r=n.A.parsePosition(i),s=n.A.parseNumber(r.pos,1,1),h=m[1]-A[1],l=m[2]-A[2],d=a.A.hypot(h,l),r.pos.indexOf("px")>=0||r.pos.indexOf("fr")>=0||r.pos.indexOf("%")>=0?(r.pos.indexOf("px")>=0&&(s/=d),t=A[1]+s*h,e=A[2]+s*l):(t=A[1]+s*this.board.unitX*h/d,e=A[2]+s*this.board.unitY*l/d),"left"===r.side?h*=-1:l*=-1,n.A.exists(this.label)&&(u=.5*this.label.evalVisProp("distance")/d),t+=l*this.label.size[0]*u,e+=h*this.label.size[1]*u;return(b||g)&&(n.A.exists(this.label)&&(p=this.label.evalVisProp("fontsize")),Math.abs(t)<a.A.eps?t=p:this.board.canvasWidth+a.A.eps>t&&t>this.board.canvasWidth-p-a.A.eps&&(t=this.board.canvasWidth-p),a.A.eps+p>e&&e>-a.A.eps?e=p:this.board.canvasHeight+a.A.eps>e&&e>this.board.canvasHeight-p-a.A.eps&&(e=this.board.canvasHeight-p)),new f.A(o.A.COORDS_BY_SCREEN,[t,e],this.board)},cloneToBackground:function(){var t,e,i,r=n.A.getCloneObject(this);return r.point1=this.point1,r.point2=this.point2,r.stdform=this.stdform,e=this.getSlope(),t=this.getRise(),r.getSlope=function(){return e},r.getRise=function(){return t},i=this.board.renderer.enhancedRendering,this.board.renderer.enhancedRendering=!0,this.board.renderer.drawLine(r),this.board.renderer.enhancedRendering=i,this.traces[r.id]=r.rendNode,this},addTransform:function(t){var e,i=n.A.isArray(t)?t:[t],r=i.length;for(e=0;e<r;e++)this.point1.transformations.push(i[e]),this.point2.transformations.push(i[e]);return this},snapToGrid:function(t){var e,i,r,s,a,h,l,d;return this.evalVisProp("snaptogrid")?this.parents.length<3?(this.point1.handleSnapToGrid(!0,!0),this.point2.handleSnapToGrid(!0,!0)):n.A.exists(t)&&(l=this.evalVisProp("snapsizex"),d=this.evalVisProp("snapsizey"),a=(e=new f.A(o.A.COORDS_BY_SCREEN,[t.Xprev,t.Yprev],this.board)).usrCoords[1],h=e.usrCoords[2],l<=0&&this.board.defaultAxes&&this.board.defaultAxes.x.defaultTicks&&(l=(s=this.board.defaultAxes.x.defaultTicks).ticksDelta*(s.evalVisProp("minorticks")+1)),d<=0&&this.board.defaultAxes&&this.board.defaultAxes.y.defaultTicks&&(d=(s=this.board.defaultAxes.y.defaultTicks).ticksDelta*(s.evalVisProp("minorticks")+1)),l>0&&d>0&&(i=c.A.projectPointToLine({coords:e},this,this.board),r=A.A.subtract([1,Math.round(a/l)*l,Math.round(h/d)*d],i.usrCoords),this.board.create("transform",r.slice(1),{type:"translate"}).applyOnce([this.point1,this.point2]))):(this.point1.handleSnapToGrid(!1,!0),this.point2.handleSnapToGrid(!1,!0)),this},snapToPoints:function(){var t=this.evalVisProp("snaptopoints");return this.parents.length<3&&(this.point1.handleSnapToPoints(t),this.point2.handleSnapToPoints(t)),this},X:function(t){var e=this.stdform[2];return(1-Math.abs(t=(t-.5)*2))*(Math.abs(this.point1.coords.usrCoords[0])>a.A.eps?this.point1.coords.usrCoords[1]:this.point2.coords.usrCoords[1])-t*e},Y:function(t){var e=this.stdform[1];return(1-Math.abs(t=(t-.5)*2))*(Math.abs(this.point1.coords.usrCoords[0])>a.A.eps?this.point1.coords.usrCoords[2]:this.point2.coords.usrCoords[2])+t*e},Z:function(t){return(1-Math.abs(t=(t-.5)*2))*(Math.abs(this.point1.coords.usrCoords[0])>a.A.eps?this.point1.coords.usrCoords[0]:this.point2.coords.usrCoords[0])},L:function(){return this.point1.Dist(this.point2)},setFixedLength:function(t){return this.hasFixedLength&&(this.fixedLength=n.A.createFunction(t,this.board),this.hasFixedLength=!0,this.addParentsFromJCFunctions([this.fixedLength]),this.board.update()),this},minX:function(){return 0},maxX:function(){return 1},bounds:function(){var t=this.point1.coords.usrCoords,e=this.point2.coords.usrCoords;return[Math.min(t[1],e[1]),Math.max(t[2],e[2]),Math.max(t[1],e[1]),Math.min(t[2],e[2])]},remove:function(){this.removeAllTicks(),V.A.prototype.remove.call(this)}}
1),r.A.createLine=function(t,e,i){var s,o,a,h,l,c,d,u=[],p=!1,f=!1;if(2===e.length){if(c=n.A.copyAttributes(i,t.options,"line","point1"),n.A.isArray(e[0])&&e[0].length>1)a=t.create("point",e[0],c);else if(n.A.isString(e[0])||n.A.isPoint(e[0]))a=t.select(e[0]);else if(n.A.isFunction(e[0])&&n.A.isPoint(e[0]()))a=e[0](),f=!0;else if(n.A.isFunction(e[0])&&e[0]().length&&e[0]().length>=2)a=r.A.createPoint(t,e[0](),c),f=!0;else if(n.A.isObject(e[0])&&n.A.isTransformationOrArray(e[1]))p=!0,a=t.create("point",[e[0].point1,e[1]],c);else throw Error("JSXGraph: Can't create line with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [point,point], [[x1,y1],[x2,y2]], [a,b,c]");if(c=n.A.copyAttributes(i,t.options,"line","point2"),p)h=t.create("point",[e[0].point2,e[1]],c);else if(n.A.isArray(e[1])&&e[1].length>1)h=t.create("point",e[1],c);else if(n.A.isString(e[1])||n.A.isPoint(e[1]))h=t.select(e[1]);else if(n.A.isFunction(e[1])&&n.A.isPoint(e[1]()))h=e[1](),f=!0;else if(n.A.isFunction(e[1])&&e[1]().length&&e[1]().length>=2)h=r.A.createPoint(t,e[1](),c),f=!0;else throw Error("JSXGraph: Can't create line with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [point,point], [[x1,y1],[x2,y2]], [a,b,c]");c=n.A.copyAttributes(i,t.options,"line"),o=new r.A.Line(t,a,h,c),f?(o.constrained=!0,o.funp1=e[0],o.funp2=e[1]):p||(o.isDraggable=!0),o.setParents([a.id,h.id])}else if(3===e.length){for(l=0,d=!0;l<3;l++)if(n.A.isNumber(e[l]))u[l]=n.A.createFunction(e[l]);else if(n.A.isFunction(e[l]))u[l]=e[l],d=!1;else throw Error("JSXGraph: Can't create line with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"' and '"+typeof e[2]+"'.\nPossible parent types: [point,point], [[x1,y1],[x2,y2]], [a,b,c]");c=n.A.copyAttributes(i,t.options,"line","point1"),a=d?t.create("point",[u[2]()*u[2]()+u[1]()*u[1](),u[2]()-u[1]()*u[0]()+u[2](),-u[1]()-u[2]()*u[0]()-u[1]()],c):t.create("point",[function(){return(u[2]()*u[2]()+u[1]()*u[1]())*.5},function(){return(u[2]()-u[1]()*u[0]()+u[2]())*.5},function(){return(-u[1]()-u[2]()*u[0]()-u[1]())*.5}],c),c=n.A.copyAttributes(i,t.options,"line","point2"),h=d?t.create("point",[u[2]()*u[2]()+u[1]()*u[1](),-u[1]()*u[0]()+u[2](),-u[2]()*u[0]()-u[1]()],c):t.create("point",[function(){return u[2]()*u[2]()+u[1]()*u[1]()},function(){return-u[1]()*u[0]()+u[2]()},function(){return-u[2]()*u[0]()-u[1]()}],c),a.prepareUpdate().update(),h.prepareUpdate().update(),c=n.A.copyAttributes(i,t.options,"line"),(o=new r.A.Line(t,a,h,c)).isDraggable=d,o.setParents([a,h])}else if(1===e.length&&n.A.isFunction(e[0])&&2===e[0]().length&&n.A.isPoint(e[0]()[0])&&n.A.isPoint(e[0]()[1]))s=e[0](),c=n.A.copyAttributes(i,t.options,"line"),(o=new r.A.Line(t,s[0],s[1],c)).constrained=!0,o.funps=e[0],o.setParents(s);else if(1===e.length&&n.A.isFunction(e[0])&&3===e[0]().length&&n.A.isNumber(e[0]()[0])&&n.A.isNumber(e[0]()[1])&&n.A.isNumber(e[0]()[2]))s=e[0],c=n.A.copyAttributes(i,t.options,"line","point1"),a=t.create("point",[function(){var t=s();return[(t[2]*t[2]+t[1]*t[1])*.5,(t[2]-t[1]*t[0]+t[2])*.5,(-t[1]-t[2]*t[0]-t[1])*.5]}],c),c=n.A.copyAttributes(i,t.options,"line","point2"),h=t.create("point",[function(){var t=s();return[t[2]*t[2]+t[1]*t[1],-t[1]*t[0]+t[2],-t[2]*t[0]-t[1]]}],c),c=n.A.copyAttributes(i,t.options,"line"),(o=new r.A.Line(t,a,h,c)).constrained=!0,o.funps=e[0],o.setParents([a,h]);else throw Error("JSXGraph: Can't create line with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [point,point], [[x1,y1],[x2,y2]], [a,b,c]");return o},r.A.registerElement("line",r.A.createLine),r.A.createSegment=function(t,e,i){var r,s;if(i.straightFirst=!1,i.straightLast=!1,s=n.A.copyAttributes(i,t.options,"segment"),r=t.create("line",e.slice(0,2),s),3===e.length){try{r.hasFixedLength=!0,r.fixedLengthOldCoords=[],r.fixedLengthOldCoords[0]=new f.A(o.A.COORDS_BY_USER,r.point1.coords.usrCoords.slice(1,3),t),r.fixedLengthOldCoords[1]=new f.A(o.A.COORDS_BY_USER,r.point2.coords.usrCoords.slice(1,3),t),r.setFixedLength(e[2])}catch(t){throw Error("JSXGraph: Can't create segment with third parent type '"+typeof e[2]+"'.\nPossible third parent types: number or function")}r.getParents=function(){return this.parents.concat(this.fixedLength())}}return r.elType="segment",r},r.A.registerElement("segment",r.A.createSegment),r.A.createArrow=function(t,e,
1i){var r,s;return i.straightFirst=!1,i.straightLast=!1,s=n.A.copyAttributes(i,t.options,"arrow"),(r=t.create("line",e,s)).type=o.A.OBJECT_TYPE_VECTOR,r.elType="arrow",r},r.A.registerElement("arrow",r.A.createArrow),r.A.createAxis=function(t,e,i){var s,a,h,l;a=n.A.copyAttributes(i,t.options,"axis");try{s=t.create("line",e,a)}catch(t){throw Error("JSXGraph: Can't create axis with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [point,point], [[x1,y1],[x2,y2]]")}for(h in s.type=o.A.OBJECT_TYPE_AXIS,s.isDraggable=!1,s.point1.isDraggable=!1,s.point2.isDraggable=!1,s._point1UsrCoordsOrg=s.point1.coords.usrCoords.slice(),s._point2UsrCoordsOrg=s.point2.coords.usrCoords.slice(),s.ancestors)s.ancestors.hasOwnProperty(h)&&(s.ancestors[h].type=o.A.OBJECT_TYPE_AXISPOINT);return l=n.A.exists(a.ticks.ticksdistance)?a.ticks.ticksdistance:n.A.isArray(a.ticks.ticks)?a.ticks.ticks:1,s.defaultTicks=t.create("ticks",[s,l],a.ticks),s.defaultTicks.dump=!1,s.elType="axis",s.subs={ticks:s.defaultTicks},s.inherits.push(s.defaultTicks),s.update=function(){var t,e,i,o,a,h,l,c,d,u,p,f,A,m,b,g,v,y,C;if(!this.needsUpdate)return this;if(t=this.board.getBoundingBox(),e=this.evalVisProp("position"),o=this.Direction(),a=this.isHorizontal(),h=this.isVertical(),l=this.evalVisProp("ticksautopos"),c=this.evalVisProp("ticksautoposthreshold"),c=a?n.A.parseNumber(c,Math.abs(t[1]-t[3]),1/this.board.unitX)*this.board.unitX:h?n.A.parseNumber(c,Math.abs(t[1]-t[3]),1/this.board.unitY)*this.board.unitY:n.A.parseNumber(c,1,1),p=(u=this.evalVisProp("anchor")).indexOf("left")>-1,f=u.indexOf("right")>-1,A=this.evalVisProp("anchordist"),A=a?n.A.parseNumber(A,Math.abs(t[1]-t[3]),1/this.board.unitX):h?n.A.parseNumber(A,Math.abs(t[0]-t[2]),1/this.board.unitY):0,g=this.board.getPointLoc(this._point1UsrCoordsOrg,A),m=this.point1.coords.usrCoords.slice(),b=this.point2.coords.usrCoords.slice(),"static"!==e&&(h||a)&&("fixed"===e?(a&&(o[0]>0&&f||o[0]<0&&p?(m[2]=t[3]+A,b[2]=t[3]+A):o[0]>0&&p||o[0]<0&&f?(m[2]=t[1]-A,b[2]=t[1]-A):(m=this._point1UsrCoordsOrg.slice(),b=this._point2UsrCoordsOrg.slice())),h&&(o[1]>0&&p||o[1]<0&&f?(m[1]=t[0]+A,b[1]=t[0]+A):o[1]>0&&f||o[1]<0&&p?(m[1]=t[2]-A,b[1]=t[2]-A):(m=this._point1UsrCoordsOrg.slice(),b=this._point2UsrCoordsOrg.slice()))):"sticky"===e&&(a&&(g[1]<0&&(o[0]>0&&f||o[0]<0&&p)?(m[2]=t[3]+A,b[2]=t[3]+A):g[1]>0&&(o[0]>0&&p||o[0]<0&&f)?(m[2]=t[1]-A,b[2]=t[1]-A):(m=this._point1UsrCoordsOrg.slice(),b=this._point2UsrCoordsOrg.slice())),h&&(g[0]<0&&(o[1]>0&&p||o[1]<0&&f)?(m[1]=t[0]+A,b[1]=t[0]+A):g[0]>0&&(o[1]>0&&f||o[1]<0&&p)?(m[1]=t[2]-A,b[1]=t[2]-A):(m=this._point1UsrCoordsOrg.slice(),b=this._point2UsrCoordsOrg.slice())))),this.point1.setPositionDirectly(r.A.COORDS_BY_USER,m),this.point2.setPositionDirectly(r.A.COORDS_BY_USER,b),n.A.exists(this.defaultTicks)){if(v=this.defaultTicks.visProp.label,l&&(a||h)){if(n.A.exists(v._anchorx_org)||(v._anchorx_org=n.A.def(v.anchorx,this.board.options.text.anchorX)),n.A.exists(v._anchory_org)||(v._anchory_org=n.A.def(v.anchory,this.board.options.text.anchorY)),n.A.exists(v._offset_org)||(v._offset_org=v.offset.slice()),C=v.offset,a){for(d=s.point1.coords.scrCoords[2]-.5*this.board.canvasHeight,y=v.anchory,d<0&&Math.abs(d)>c?"bottom"===v._side&&("top"===v.anchory&&(y="bottom"),C[1]*=-1,v._side="top"):d>0&&Math.abs(d)>c?"top"===v._side&&("bottom"===v.anchory&&(y="top"),C[1]*=-1,v._side="bottom"):(y=v._anchory_org,C=v._offset_org.slice(),"top"===y?v._side="bottom":"bottom"===y?v._side="top":C[1]<0?v._side="bottom":v._side="top"),i=0;i<s.defaultTicks.labels.length;i++)this.defaultTicks.labels[i].visProp.anchory=y;v.anchory=y}else if(h){for((d=s.point1.coords.scrCoords[1]-.5*this.board.canvasWidth)<0&&Math.abs(d)>c?"right"===v._side&&("left"===v.anchorx&&(y="right"),C[0]*=-1,v._side="left"):d>0&&Math.abs(d)>c?"left"===v._side&&("right"===v.anchorx&&(y="left"),C[0]*=-1,v._side="right"):(y=v._anchorx_org,C=v._offset_org.slice(),"left"===y?v._side="right":"right"===y||C[0]<0?v._side="left":v._side="right"),i=0;i<s.defaultTicks.labels.length;i++)this.defaultTicks.labels[i].visProp.anchorx=y;v.anchorx=y}v.offset=C}
1else delete v._anchorx_org,delete v._anchory_org,delete v._offset_org;this.defaultTicks.needsUpdate=!0}return r.A.Line.prototype.update.call(this),this},s},r.A.registerElement("axis",r.A.createAxis),r.A.createTangent=function(t,e,i){var r,s,h,l,d,u,f,A,m,b=[];if(1===e.length)s=(r=e[0]).slideObject;else if(2===e.length)if(n.A.isPoint(e[0]))r=e[0],s=e[1];else if(n.A.isPoint(e[1]))s=e[0],r=e[1];else throw Error("JSXGraph: Can't create tangent with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [glider|point], [point,line|curve|circle|conic]");else throw Error("JSXGraph: Can't create tangent with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [glider|point], [point,line|curve|circle|conic]");if(u=n.A.copyAttributes(i,t.options,"tangent"),s.elementClass===o.A.OBJECT_CLASS_LINE)(d=t.create("line",[s.point1,s.point2],u)).glider=r;else if(s.elementClass===o.A.OBJECT_CLASS_CURVE&&s.type!==o.A.OBJECT_TYPE_CONIC){if(m=(A=s.getTransformationSource())[0])for(b.push(s);A[0]&&n.A.exists(A[1]._transformationSource);)b.push(A[1]),A=A[1].getTransformationSource();"plot"!==s.evalVisProp("curvetype")||m?d=t.create("line",[function(){var e,i,n,h,l,d,u,f,A=s.X,g=s.Y;if(f=r.type===o.A.OBJECT_TYPE_GLIDER?r.position:"functiongraph"===s.evalVisProp("curvetype")?r.X():c.A.projectPointToCurve(r,s,t)[1],u=r.Coords(!0),m){for(h=0,A=(l=b[b.length-1]._transformationSource).X,g=l.Y;h<b.length;h++)b[h].updateTransformMatrix(),d=a.A.inverse(b[h].transformMat),u=a.A.matVecMult(d,u);r.type!==o.A.OBJECT_TYPE_GLIDER&&(u[1]/=u[0],u[2]/=u[0],u[0]/=u[0],f=c.A.projectCoordsToCurve(u[1],u[2],0,l,t)[1])}if(e=p.A.D(g)(f),i=p.A.D(A)(f),n=[-u[1]*e+u[2]*i,u[0]*e,-u[0]*i],m)for(h=b.length-1;h>=0;h--)d=a.A.transpose(a.A.inverse(b[h].transformMat)),n=a.A.matVecMult(d,n);return n}],u):(f=function(t,e,i){var s,o,n,h,l,c,d,u,p,f,A,m,b=Math.floor(t);if(1===e.bezierDegree)b===e.numberPoints-1&&b--;else{if(3!==e.bezierDegree)return 0;b=3*Math.floor(t*((m="sector"===e.elType?(A=e.points.slice(3,e.numberPoints-3)).length:(A=e.points).length)-1)/3),n=(t*(m-1)-b)/3,b>=m-1&&(b=m-4,n=1)}if(b<0)return 1;switch(1===e.bezierDegree?(s=e.points[b].usrCoords,o=e.points[b+1].usrCoords):(h=A[b].usrCoords,l=A[b+1].usrCoords,c=A[b+2].usrCoords,d=A[b+3].usrCoords,u=(1-n)*(1-n)*(l[1]-h[1])+2*(1-n)*n*(c[1]-l[1])+n*n*(d[1]-c[1]),p=(1-n)*(1-n)*(l[2]-h[2])+2*(1-n)*n*(c[2]-l[2])+n*n*(d[2]-c[2]),f=a.A.hypot(u,p),u/=f,p/=f,o=[1,(s=r.coords.usrCoords)[1]+u,s[2]+p]),i){case 0:return s[2]*o[1]-s[1]*o[2];case 1:return o[2]-s[2];case 2:return s[1]-o[1];default:return[s[2]*o[1]-s[1]*o[2],o[2]-s[2],s[1]-o[1]]}},d=t.create("line",[function(){var e;return f(e=r.type===o.A.OBJECT_TYPE_GLIDER?r.position:c.A.projectPointToCurve(r,s,t)[1],s)}],u)),r.addChild(d),d.glider=r}else s.type===o.A.OBJECT_TYPE_TURTLE?(d=t.create("line",[function(){var e,i;for(h=0,e=Math.floor(i=r.type===o.A.OBJECT_TYPE_GLIDER?r.position:c.A.projectPointToTurtle(r,s,t)[1]);h<s.objects.length;h++)if((l=s.objects[h]).type===o.A.OBJECT_TYPE_CURVE){if(e<l.numberPoints)break;e-=l.numberPoints}return(e===l.numberPoints-1&&e--,e<0)?[1,0,0]:[l.Y(e)*l.X(e+1)-l.X(e)*l.Y(e+1),l.Y(e+1)-l.Y(e),l.X(e)-l.X(e+1)]}],u),r.addChild(d),d.glider=r):(s.elementClass===o.A.OBJECT_CLASS_CIRCLE||s.type===o.A.OBJECT_TYPE_CONIC)&&(d=t.create("line",[function(){return a.A.matVecMult(s.quadraticform,r.coords.usrCoords)}],u),r.addChild(d),d.glider=r);if(!n.A.exists(d))throw Error("JSXGraph: Couldn't create tangent with the given parents.");return d.elType="tangent",d.type=o.A.OBJECT_TYPE_TANGENT,d.setParents(e),d},r.A.createNormal=function(t,e,i){var r,s,h,l,d,u,f,A,m,b,g=[];for(l=0;l<e.length;++l)e[l]=t.select(e[l]);if(1===e.length)s=(r=e[0]).slideObject;else if(2===e.length)if(n.A.isPointType(t,e[0]))r=n.A.providePoints(t,[e[0]],i,"point")[0],s=e[1];else if(n.A.isPointType(t,e[1]))s=e[0],r=n.A.providePoints(t,[e[1]],i,"point")[0];else throw Error("JSXGraph: Can't create normal with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [point,line], [point,circle], [glider]");else throw Error("JSXGraph: Can't create normal with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [point,line], [point,circle], [glider]");if(d=n.A.copyAttributes(i,t.options,"normal"),s.elementClass===o.A.OBJECT_CLASS_LINE)f=n.A.copyAttributes(i,t.options,"normal","point"),(u=t.create("point",[function(){var t=a.A.crossProduct([1,0,0],s.stdform);return[t[0],-t[2],t[1]]}],f)).isDraggable=!0,(h=t.create("line",[r,u],d)).point=u,h.subs={point:u},h.inherits.push(u);else if(s.elementClass===o.A.OBJECT_CLASS_CIRCLE)h=t.create("line",[s.midpoint,r],d);
1else if(s.elementClass===o.A.OBJECT_CLASS_CURVE){if(b=(m=s.getTransformationSource())[0])for(g.push(s);m[0]&&n.A.exists(m[1]._transformationSource);)g.push(m[1]),m=m[1].getTransformationSource();"plot"!==s.evalVisProp("curvetype")||b?h=t.create("line",[function(){var e,i,n,h,l,d,u,f,A=s.X,m=s.Y;if(f=r.type===o.A.OBJECT_TYPE_GLIDER?r.position:"functiongraph"===s.evalVisProp("curvetype")?r.X():c.A.projectPointToCurve(r,s,t)[1],u=r.Coords(!0),b){for(h=0,A=(l=g[g.length-1]._transformationSource).X,m=l.Y;h<g.length;h++)g[h].updateTransformMatrix(),d=a.A.inverse(g[h].transformMat),u=a.A.matVecMult(d,u);r.type!==o.A.OBJECT_TYPE_GLIDER&&(u[1]/=u[0],u[2]/=u[0],u[0]/=u[0],f=c.A.projectCoordsToCurve(u[1],u[2],0,l,t)[1])}if(e=p.A.D(m)(f),i=p.A.D(A)(f),n=[-u[1]*i-u[2]*e,u[0]*i,u[0]*e],b)for(h=g.length-1;h>=0;h--)d=a.A.transpose(a.A.inverse(g[h].transformMat)),n=a.A.matVecMult(d,n);return n}],d):(A=function(t,e,i){var s,o,n,h,l,c,d,u,p,f,A,m,b,g,v,y,C=Math.floor(t);if(1===e.bezierDegree)C===e.numberPoints-1&&C--,h=t;else{if(3!==e.bezierDegree)return 0;C=3*Math.floor(t*((y="sector"===e.elType?(v=e.points.slice(3,e.numberPoints-3)).length:(v=e.points).length)-1)/3),h=(t*(y-1)-C)/3,C>=y-1&&(C=y-4,h=1)}if(C<0)return 1;switch(s=h-C,1===e.bezierDegree?(o=e.points[C].usrCoords,n=e.points[C+1].usrCoords,b=[o[0]+s*(n[0]-o[0]),o[1]+s*(n[1]-o[1]),o[2]+s*(n[2]-o[2])],m=a.A.crossProduct(o,n),g=[(g=a.A.crossProduct([1,0,0],m))[0],-g[2],g[1]],m=a.A.crossProduct(b,g)):(l=v[C].usrCoords,c=v[C+1].usrCoords,d=v[C+2].usrCoords,u=v[C+3].usrCoords,p=(1-h)*(1-h)*(c[1]-l[1])+2*(1-h)*h*(d[1]-c[1])+h*h*(u[1]-d[1]),f=(1-h)*(1-h)*(c[2]-l[2])+2*(1-h)*h*(d[2]-c[2])+h*h*(u[2]-d[2]),A=a.A.hypot(p,f),p/=A,f/=A,n=[1,(o=r.coords.usrCoords)[1]-f,o[2]+p],m=[o[2]*n[1]-o[1]*n[2],n[2]-o[2],o[1]-n[1]]),i){case 0:return m[0];case 1:return m[1];case 2:return m[2];default:return m}},h=t.create("line",[function(){var e;return A(e=r.type===o.A.OBJECT_TYPE_GLIDER?r.position:c.A.projectPointToCurve(r,s,t)[1],s)}],d),r.addChild(h),h.glider=r)}else if(s.type===o.A.OBJECT_TYPE_TURTLE)h=t.create("line",[function(){var t,e,i=Math.floor(r.position),n=r.position-i;for(e=0;e<s.objects.length;e++)if((t=s.objects[e]).type===o.A.OBJECT_TYPE_CURVE){if(i<t.numberPoints)break;i-=t.numberPoints}return(i===t.numberPoints-1&&(i-=1,n=1),i<0)?1:(t.Y(i)+n*(t.Y(i+1)-t.Y(i)))*(t.Y(i)-t.Y(i+1))-(t.X(i)+n*(t.X(i+1)-t.X(i)))*(t.X(i+1)-t.X(i))},function(){var t,e,i=Math.floor(r.position);for(e=0;e<s.objects.length;e++)if((t=s.objects[e]).type===o.A.OBJECT_TYPE_CURVE){if(i<t.numberPoints)break;i-=t.numberPoints}return(i===t.numberPoints-1&&(i-=1),i<0)?0:t.X(i+1)-t.X(i)},function(){var t,e,i=Math.floor(r.position);for(e=0;e<s.objects.length;e++)if((t=s.objects[e]).type===o.A.OBJECT_TYPE_CURVE){if(i<t.numberPoints)break;i-=t.numberPoints}return(i===t.numberPoints-1&&(i-=1),i<0)?0:t.Y(i+1)-t.Y(i)}],d);else throw Error("JSXGraph: Can't create normal with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [point,line], [point,circle], [glider]");return h.elType="normal",h.setParents(e),n.A.exists(r._is_new)?(h.addChild(r),delete r._is_new):r.addChild(h),s.addChild(h),h},r.A.createRadicalAxis=function(t,e,i){var r,s,n;if(2!==e.length||e[0].elementClass!==o.A.OBJECT_CLASS_CIRCLE||e[1].elementClass!==o.A.OBJECT_CLASS_CIRCLE)throw Error("JSXGraph: Can't create 'radical axis' with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent type: [circle,circle]");return s=t.select(e[0]),n=t.select(e[1]),(r=t.create("line",[function(){var t=s.stdform,e=n.stdform;return a.A.matVecMult(a.A.transpose([t.slice(0,3),e.slice(0,3)]),[e[3],-t[3]])}],i)).elType="radicalaxis",r.setParents([s.id,n.id]),s.addChild(r),n.addChild(r),r},r.A.createPolarLine=function(t,e,i){var r,s,a,h,l,c,d;if(e.length>1&&(h=e[0].type===o.A.OBJECT_TYPE_CONIC||e[0].elementClass===o.A.OBJECT_CLASS_CIRCLE,l=e[1].type===o.A.OBJECT_TYPE_CONIC||e[1].elementClass===o.A.OBJECT_CLASS_CIRCLE,c=n.A.isPoint(e[0]),d=n.A.isPoint(e[1])),2!==e.length||!(h&&d||c&&l))throw Error("JSXGraph: Can't create 'polar line' with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent type: [conic|circle,point], [point,conic|circle]");return d?(s=t.select(e[0]),a=t.select(e[1])):(s=t.select(e[1]),a=t.select(e[0])),(r=t.create("tangent",[s,a],i)).elType="polarline",r}
1,r.A.createTangentTo=function(t,e,i){var r,s,a,h,l,c,d;if(a=t.select(e[0]),h=n.A.providePoints(t,e[1],i,"point")[0],l=n.A.def(e[2],0),a.type!==o.A.OBJECT_TYPE_CIRCLE&&a.type!==o.A.OBJECT_TYPE_CONIC||h.elementClass!==o.A.OBJECT_CLASS_POINT)throw Error("JSXGraph: Can't create tangentto with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"' and '"+typeof e[2]+"'.\nPossible parent types: [circle|conic,point,number]");return s=n.A.copyAttributes(i,t.options,"tangentto"),d=t.create("polar",[a,h],s.polar),c=t.create("intersection",[d,a,l],s.point),(r=t.create("tangent",[a,c],s)).point=c,r.polar=d,r.elType="tangentto",r},r.A.registerElement("tangent",r.A.createTangent),r.A.registerElement("normal",r.A.createNormal),r.A.registerElement("tangentto",r.A.createTangentTo),r.A.registerElement("polar",r.A.createTangent),r.A.registerElement("radicalaxis",r.A.createRadicalAxis),r.A.registerElement("polarline",r.A.createPolarLine),r.A.Line,r.A.Group=function(t,e,i,r,s){var a,h,l,c;for(this.board=t,this.objects={},a=this.board.numObjects,this.board.numObjects+=1,""!==e&&n.A.exists(e)?this.id=e:this.id=this.board.id+"Group"+a,this.board.groups[this.id]=this,this.type=o.A.OBJECT_TYPE_POINT,this.elementClass=o.A.OBJECT_CLASS_POINT,""!==i&&n.A.exists(i)?this.name=i:this.name="group_"+this.board.generateName(this),delete this.type,this.coords={},this.needsRegularUpdate=s.needsregularupdate,this.rotationCenter="centroid",this.scaleCenter=null,this.rotationPoints=[],this.translationPoints=[],this.scalePoints=[],this.scaleDirections={},this.parents=[],h=n.A.isArray(r)?r:Array.prototype.slice.call(arguments,3),l=0;l<h.length;l++)!(c=this.board.select(h[l])).evalVisProp("fixed")&&n.A.exists(c.coords)&&this.addPoint(c);this.methodMap={ungroup:"ungroup",add:"addPoint",addPoint:"addPoint",addPoints:"addPoints",addGroup:"addGroup",remove:"removePoint",removePoint:"removePoint",setAttribute:"setAttribute",setProperty:"setAttribute"}},r.A.extend(r.A.Group.prototype,{ungroup:function(){var t,e,i;for(t in this.objects)this.objects.hasOwnProperty(t)&&(e=this.objects[t].point,n.A.isArray(e.groups)&&(i=n.A.indexOf(e.groups,this.id))>=0&&delete e.groups[i]);return this.objects={},this},addParents:function(t){var e,i,r;for(e=0,r=n.A.isArray(t)?t:arguments,i=r.length;e<i;++e)n.A.isId(this.board,r[e])?this.parents.push(r[e]):n.A.exists(r[e].id)&&this.parents.push(r[e].id);this.parents=n.A.uniqueArray(this.parents)},setParents:function(t){return this.parents=[],this.addParents(t),this},getParents:function(){return n.A.isArray(this.parents)?this.parents:[]},_updateCoordsCache:function(t){var e;""!==t&&n.A.exists(this.objects[t])&&(e=this.objects[t].point,this.coords[e.id]={usrCoords:e.coords.usrCoords.slice(0)})},update:function(){var t,e,i,s,h,l,d,u,p,f,A,m,b=null;if(!this.needsUpdate)return this;if("nothing"===(e=this._update_find_drag_type()).action)return this._updateCoordsCache(e.id),this;if(b=this.objects[e.id].point,"translation"===e.action){if(f=[b.coords.usrCoords[1]-this.coords[e.id].usrCoords[1],b.coords.usrCoords[2]-this.coords[e.id].usrCoords[2]],b.elementClass!==o.A.OBJECT_CLASS_POINT){for(f.unshift(0),t=0;t<b.transformations.length;t++)f=a.A.matVecMult(b.transformations[t].matrix,f);f.shift()}(A=this.board.create("transform",f,{type:"translate"})).update()}else if("rotation"===e.action||"scaling"===e.action){if(s="rotation"===e.action?"rotationCenter":"scaleCenter",n.A.exists(this[s].coords))m=this[s].coords.usrCoords.slice(1);else if("centroid"===this[s])m=this._update_centroid_center();else if(n.A.isArray(this[s]))m=this[s];else{if(!n.A.isFunction(this[s]))return r.A.debug("Group.update: No valid center for this transformation, get out of here."),this;m=this[s]()}if("rotation"===e.action)p=c.A.rad(this.coords[e.id].usrCoords.slice(1),m,this.objects[e.id].point),(f=this.board.create("transform",[p,m[0],m[1]],{type:"rotate"})).update();else{if("scaling"!==e.action||Math.abs(l=c.A.distance(this.coords[e.id].usrCoords.slice(1),m))<a.A.eps)return this;l=c.A.distance(b.coords.usrCoords.slice(1),m)/l,d=this.scaleDirections[e.id].indexOf("x")>=0?l:1,u=this.scaleDirections[e.id].indexOf("y")>=0?l:1,(f=this.board.create("transform",[1,0,0,m[0]*(1-d),d,0,m[1]*(1-u),0,u],{type:"generic"})).update()}}for(i in this.objects)(b=this.objects[i].point).elementClass!==o.A.OBJECT_CLASS_POINT&&(n.A.exists(f.board)?f.meltTo(b):e.id!==b.id&&A.meltTo(b));for(i in this._update_apply_transformation(e,f),this.needsUpdate=!1,this.objects)if(this.objects.hasOwnProperty(i))for(h in this.objects[i].descendants)this.objects[i].descendants.hasOwnProperty(h)&&(this.objects[i].descendants.needsUpdate=this.objects[i].descendants.needsRegularUpdate||this.board.needsFullUpdate);for(i in this.board.updateElements(e),this.objects)this.objects.hasOwnProperty(i)&&this._updateCoordsCache(i);return this},_update_find_drag_type:function(){var t,e,i,r="nothing",s=[];for(t in this.objects)this.objects.hasOwnProperty(t)&&(e=this.objects[t].point).coords.distance(o.A.COORDS_BY_USER,this.coords[t])>a.A.eps&&s.push(e.id);return 0===s.length?{action:r,id:"",changed:s}:(i=s[0],e=this.objects[i].point,s.length>1?r="translation":n.A.isInArray(this.rotationPoints,e)&&n.A.exists(this.rotationCenter)?r="rotation":n.A.isInArray(this.scalePoints,e)&&n.A.exists(this.scaleCenter)?r="scaling":n.A.isInArray(this.translationPoints,e)&&(r="translation"),{action:r,id:i,changed:s})},_update_centroid_center:function(){var t,e,i;for(i in t=[0,0],e=0,this.coords)this.coords.hasOwnProperty(i)&&(t[0]+=this.coords[i].usrCoords[1],t[1]+=this.coords[i].usrCoords[2],++e);return e>0&&(t[0]/=e,t[1]/=e),t},_update_apply_transformation:function(t,e){var i,r;for(i in this.objects)this.objects.hasOwnProperty(i)&&(n.A.exists(this.board.objects[i])?(r=this.objects[i].point).id!==t.id?"translation"===t.action?n.A.isInArray(t.changed,r.id)||r.elementClass!==o.A.OBJECT_CLASS_POINT||r.coords.setCoordinates(o.A.COORDS_BY_USER,[this.coords[i].usrCoords[1]+e[0],this.coords[i].usrCoords[2]+e[1]]):("rotation"===t.action||"scaling"===t.action)&&r.elementClass===o.A.OBJECT_CLASS_POINT&&e.applyOnce([r]):("rotation"===t.action||"scaling"===t.action)&&r.coords.setCoordinates(o.A.COORDS_BY_USER,a.A.matVecMult(e.matrix,this.coords[r.id].usrCoords)):delete this.objects[i])},addPoint:function(t){return this.objects[t.id]={point:this.board.select(t)},this._updateCoordsCache(t.id),this.translationPoints.push(t),t.groups.push(this.id),t.groups=n.A.uniqueArray(t.groups),this},addPoints:function(t){var e;
1for(e=0;e<t.length;e++)this.addPoint(t[e]);return this},addGroup:function(t){var e;for(e in t.objects)t.objects.hasOwnProperty(e)&&this.addPoint(t.objects[e].point);return this},removePoint:function(t){return delete this.objects[t.id],this},setRotationCenter:function(t){return this.rotationCenter=t,this},setRotationPoints:function(t){return this._setActionPoints("rotation",t)},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,s;for(r=0,i=n.A.isArray(t)?t:arguments,s=i.length;r<s;++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,s;for(r=0,i=n.A.isArray(e)?e:arguments,s=i.length,this[t+"Points"]=[];r<s;++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(){r.A.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}}),r.A.createGroup=function(t,e,i){var s=n.A.copyAttributes(i,t.options,"group"),o=new r.A.Group(t,s.id,s.name,e,s);return o.elType="group",o.setParents(e),o},r.A.registerElement("group",r.A.createGroup),r.A.Group,r.A.Circle=function(t,e,i,r,s){this.constructor(t,s,o.A.OBJECT_TYPE_CIRCLE,o.A.OBJECT_CLASS_CIRCLE),this.method=e,this.midpoint=this.board.select(i),this.center=this.board.select(i),this.point2=null,this.radius=0,this.line=null,this.circle=null,this.points=[],"twoPoints"===e?(this.point2=t.select(r),this.radius=this.Radius()):"pointRadius"===e?(this.gxtterm=r,this.updateRadius=n.A.createFunction(r,this.board),this.updateRadius(),this.addParentsFromJCFunctions([this.updateRadius])):"pointLine"===e?(this.line=t.select(r),this.radius=this.line.point1.coords.distance(o.A.COORDS_BY_USER,this.line.point2.coords)):"pointCircle"===e&&(this.circle=t.select(r),this.radius=this.circle.Radius()),this.id=this.board.setId(this,"C"),this.board.renderer.drawEllipse(this),this.board.finalizeAdding(this),this.createGradient(),this.elType="circle",this.createLabel(),n.A.exists(this.center._is_new)?(this.addChild(this.center),delete this.center._is_new):this.center.addChild(this),"pointRadius"===e?this.notifyParents(r):"pointLine"===e?this.line.addChild(this):"pointCircle"===e?this.circle.addChild(this):"twoPoints"===e&&(n.A.exists(this.point2._is_new)?(this.addChild(this.point2),delete this.point2._is_new):this.point2.addChild(this)),this.methodMap=n.A.deepCopy(this.methodMap,{setRadius:"setRadius",getRadius:"getRadius",Area:"Area",area:"Area",Perimeter:"Perimeter",Circumference:"Perimeter",radius:"Radius",Radius:"Radius",Diameter:"Diameter",center:"center",line:"line",point2:"point2"})},r.A.Circle.prototype=new V.A,r.A.extend(r.A.Circle.prototype,{hasPoint:function(t,e){var i,r,s,h,l,c=this.center.coords.usrCoords,d=new f.A(o.A.COORDS_BY_SCREEN,[t,e],this.board),u=this.Radius();return(n.A.isObject(this.evalVisProp("precision"))?(r=this.board._inputDevice,i=this.evalVisProp("precision."+r)):i=this.board.options.precision.hasPoint,s=c[1]-d.usrCoords[1],h=c[2]-d.usrCoords[2],l=a.A.hypot(s,h),i+=.5*this.evalVisProp("strokewidth"),i/=Math.sqrt(Math.abs(this.board.unitX*this.board.unitY)),this.evalVisProp("hasinnerpoints"))?l<u+i:Math.abs(l-u)<i},generatePolynomial:function(t){var e=this.center.symbolic.x,i=this.center.symbolic.y,r=t.symbolic.x,s=t.symbolic.y,o=this.generateRadiusSquared();return""===o?[]:["(("+r+")-("+e+"))^2 + (("+s+")-("+i+"))^2 - ("+o+")"]},generateRadiusSquared:function(){var t,e,i,r,s="";return"twoPoints"===this.method?(t=this.center.symbolic.x,e=this.center.symbolic.y,s="(("+(i=this.point2.symbolic.x)+")-("+t+"))^2 + (("+(r=this.point2.symbolic.y)+")-("+e+"))^2"):"pointRadius"===this.method?n.A.isNumber(this.radius)&&
1(s=(this.radius*this.radius).toString()):"pointLine"===this.method?(i=this.line.point1.symbolic.x,r=this.line.point1.symbolic.y,s="(("+i+")-("+this.line.point2.symbolic.x+"))^2 + (("+r+")-("+this.line.point2.symbolic.y+"))^2"):"pointCircle"===this.method&&(s=this.circle.Radius()),s},update:function(){var t,e,i,r,s,n;if(this.needsUpdate)for(this.evalVisProp("trace")&&this.cloneToBackground(!0),"pointLine"===this.method?this.radius=this.line.point1.coords.distance(o.A.COORDS_BY_USER,this.line.point2.coords):"pointCircle"===this.method?this.radius=this.circle.Radius():"pointRadius"===this.method&&(this.radius=this.updateRadius()),this.radius=Math.abs(this.radius),this.updateStdform(),this.updateQuadraticform(),i=this.center.coords.usrCoords[0],t=this.center.coords.usrCoords[1]/i,e=this.center.coords.usrCoords[2]/i,i/=i,r=this.Radius(),s=.551915024494,this.numberPoints=13,this.dataX=[t+r,t+r,t+r*s,t,t-r*s,t-r,t-r,t-r,t-r*s,t,t+r*s,t+r,t+r],this.dataY=[e,e+r*s,e+r,e+r,e+r,e+r*s,e,e-r*s,e-r,e-r,e-r,e-r*s,e],this.bezierDegree=3,n=0;n<this.numberPoints;n++)this.points[n]=new f.A(o.A.COORDS_BY_USER,[this.dataX[n],this.dataY[n]],this.board);return this},updateQuadraticform:function(){var t=this.center,e=t.X(),i=t.Y(),r=this.Radius();this.quadraticform=[[e*e+i*i-r*r,-e,-i],[-e,1,0],[-i,0,1]]},updateStdform:function(){this.stdform[3]=.5,this.stdform[4]=this.Radius(),this.stdform[1]=-this.center.coords.usrCoords[1],this.stdform[2]=-this.center.coords.usrCoords[2],isFinite(this.stdform[4])||(this.stdform[0]=n.A.exists(this.point2)?-(this.stdform[1]*this.point2.coords.usrCoords[1]+this.stdform[2]*this.point2.coords.usrCoords[2]):0),this.normalize()},updateRenderer:function(){return this.needsUpdate&&(this.visPropCalc.visible&&(this.isReal=!isNaN(this.center.coords.usrCoords[1]+this.center.coords.usrCoords[2]+this.Radius())&&this.center.isReal,this.isReal||this.updateVisibility(!1)),this.visPropCalc.visible&&this.board.renderer.updateEllipse(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},notifyParents:function(t){n.A.isString(t)&&w.A.findDependencies(this,t,this.board)},setRadius:function(t){return this.updateRadius=n.A.createFunction(t,this.board),this.addParentsFromJCFunctions([this.updateRadius]),this.board.update(),this},Radius:function(t){return n.A.exists(t)?(this.setRadius(t),this.Radius()):"twoPoints"===this.method?n.A.cmpArrays(this.point2.coords.usrCoords,[0,0,0])||n.A.cmpArrays(this.center.coords.usrCoords,[0,0,0])?NaN:this.center.Dist(this.point2):"pointLine"===this.method||"pointCircle"===this.method?this.radius:"pointRadius"===this.method?this.evalVisProp("nonnegativeonly")?Math.max(0,this.updateRadius()):Math.abs(this.updateRadius()):NaN},Diameter:function(){return 2*this.Radius()},getRadius:function(){return r.A.deprecated("Circle.getRadius()","Circle.Radius()"),this.Radius()},getTextAnchor:function(){return this.center.coords},getLabelAnchor:function(){var t,e,i,r,s,a,h=1.5,l=this.Radius(),c=this.center.coords.usrCoords,d=.7071067811865;if(!n.A.exists(this.label)||(i=this.label.evalVisProp("position"),!n.A.isString(i)))return new f.A(o.A.COORDS_BY_SCREEN,[NaN,NaN],this.board);if(!(0>i.indexOf("right")&&0>i.indexOf("left")))return c=this.center.coords.scrCoords,r=n.A.parsePosition(i),s=n.A.parseNumber(r.pos,2*Math.PI,1),0>r.pos.indexOf("fr")&&0>r.pos.indexOf("%")&&(r.pos.indexOf("px")>=0?s=0:s*=Math.PI/180),a=1,"left"===r.side&&(a=-1),n.A.exists(this.label)&&(h=.5*a*this.label.evalVisProp("distance")),t=c[1]+(l*this.board.unitX+this.label.size[0]*h)*Math.cos(s),e=c[2]-(l*this.board.unitY+this.label.size[1]*h)*Math.sin(s),new f.A(o.A.COORDS_BY_SCREEN,[t,e],this.board);switch(this.evalVisProp("label.position")){case"lft":t=c[1]-l,e=c[2];break;case"llft":t=c[1]-d*l,e=c[2]-d*l;break;case"rt":t=c[1]+l,e=c[2];break;case"lrt":t=c[1]+d*l,e=c[2]-d*l;break;case"urt":t=c[1]+d*l,e=c[2]+d*l;break;case"top":t=c[1],e=c[2]+l;break;case"bot":t=c[1],e=c[2]-l;break;default:t=c[1]-d*l,e=c[2]+d*l}return new f.A(o.A.COORDS_BY_USER,[t,e],this.board)}
1,cloneToBackground:function(){var t,e=this.Radius(),i=n.A.getCloneObject(this);return i.center={coords:this.center.coords},i.Radius=function(){return e},i.getRadius=function(){return e},t=this.board.renderer.enhancedRendering,this.board.renderer.enhancedRendering=!0,this.board.renderer.drawEllipse(i),this.board.renderer.enhancedRendering=t,this.traces[i.id]=i.rendNode,this},addTransform:function(t){var e,i=n.A.isArray(t)?t:[t],r=i.length;for(e=0;e<r;e++)this.center.transformations.push(i[e]),"twoPoints"===this.method&&this.point2.transformations.push(i[e]);return this},snapToGrid:function(){var t=this.evalVisProp("snaptogrid");return this.center.handleSnapToGrid(t,!0),"twoPoints"===this.method&&this.point2.handleSnapToGrid(t,!0),this},snapToPoints:function(){var t=this.evalVisProp("snaptopoints");return this.center.handleSnapToPoints(t),"twoPoints"===this.method&&this.point2.handleSnapToPoints(t),this},X:function(t){return this.Radius()*Math.cos(2*t*Math.PI)+this.center.coords.usrCoords[1]},Y:function(t){return this.Radius()*Math.sin(2*t*Math.PI)+this.center.coords.usrCoords[2]},Z:function(t){return 1},minX:function(){return 0},maxX:function(){return 1},Area:function(){var t=this.Radius();return t*t*Math.PI},Perimeter:function(){return 2*this.Radius()*Math.PI},bounds:function(){var t=this.center.coords.usrCoords,e=this.Radius();return[t[1]-e,t[2]+e,t[1]+e,t[2]-e]},getParents:function(){return 1===this.parents.length?this.parents.concat(this.radius):this.parents}}),r.A.createCircle=function(t,e,i){var s,a,h,l,c,d=!0,u=["center","point2"];if(a=[],c=t.select(e[0]),n.A.isObject(c)&&c.elementClass===o.A.OBJECT_CLASS_CIRCLE&&n.A.isTransformationOrArray(e[1]))return l=n.A.copyAttributes(i,t.options,"circle"),(s=r.A.createEllipse(t,[c.center,c.center,function(){return 2*c.Radius()}],l)).addTransform(e[1]),s;for(h=0;h<e.length;h++)if(n.A.isPointType(t,e[h])){if(e.length<3?a.push(n.A.providePoints(t,[e[h]],i,"circle",[u[h]])[0]):a.push(n.A.providePoints(t,[e[h]],i,"point")[0]),!1===a[a.length-1])throw Error("JSXGraph: Can't create circle from this type. Please provide a point type.")}else a.push(e[h]);if(l=n.A.copyAttributes(i,t.options,"circle"),2===a.length&&n.A.isPoint(a[0])&&n.A.isPoint(a[1]))s=new r.A.Circle(t,"twoPoints",a[0],a[1],l);else if((n.A.isNumber(a[0])||n.A.isFunction(a[0])||n.A.isString(a[0]))&&n.A.isPoint(a[1]))s=new r.A.Circle(t,"pointRadius",a[1],a[0],l);else if((n.A.isNumber(a[1])||n.A.isFunction(a[1])||n.A.isString(a[1]))&&n.A.isPoint(a[0]))s=new r.A.Circle(t,"pointRadius",a[0],a[1],l);else if(a[0].elementClass===o.A.OBJECT_CLASS_CIRCLE&&n.A.isPoint(a[1]))s=new r.A.Circle(t,"pointCircle",a[1],a[0],l);else if(a[1].elementClass===o.A.OBJECT_CLASS_CIRCLE&&n.A.isPoint(a[0]))s=new r.A.Circle(t,"pointCircle",a[0],a[1],l);else if(a[0].elementClass===o.A.OBJECT_CLASS_LINE&&n.A.isPoint(a[1]))s=new r.A.Circle(t,"pointLine",a[1],a[0],l);else if(a[1].elementClass===o.A.OBJECT_CLASS_LINE&&n.A.isPoint(a[0]))s=new r.A.Circle(t,"pointLine",a[0],a[1],l);else if(3===e.length&&n.A.isPoint(a[0])&&n.A.isPoint(a[1])&&n.A.isPoint(a[2]))if(r.A.elements.circumcircle)s=r.A.elements.circumcircle(t,a,l);else throw Error("JSXGraph: Can't create circle with three points. Please include the circumcircle element (element/composition).");else throw Error("JSXGraph: Can't create circle with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [point,point], [point,number], [point,function], [point,circle], [point,point,point], [circle,transformation]");for(s.isDraggable=d,s.setParents(a),s.elType="circle",h=0;h<a.length;h++)n.A.isPoint(a[h])&&s.inherits.push(a[h]);return s},r.A.registerElement("circle",r.A.createCircle);let X=r.A.Circle;r.A.createEllipse=function(t,e,i){var r,s,a,h,l,c,d,u=[],p=n.A.copyAttributes(i,t.options,"conic","foci"),A=n.A.copyAttributes(i,t.options,"conic","center"),m=n.A.copyAttributes(i,t.options,"conic");for(c=0;c<2;c++)if(e[c].length>1)u[c]=t.create("point",e[c],p);else if(n.A.isPoint(e[c]))u[c]=t.select(e[c]);else if(n.A.isFunction(e[c])&&n.A.isPoint(e[c]()))u[c]=e[c]();else if(n.A.isString(e[c]))u[c]=t.select(e[c]);else throw Error("JSXGraph: Can't create Ellipse with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [point,point,point], [point,point,number|function]");if(n.A.isNumber(e[2]))l=n.A.createFunction(e[2],t);else if(n.A.isFunction(e[2])&&n.A.isNumber(e[2]()))l=e[2];else{if(n.A.isPoint(e[2]))h=t.select(e[2]);else if(e[2].length>1)h=t.create("point",e[2],p);else if(n.A.isFunction(e[2])&&n.A.isPoint(e[2]()))h=e[2]();else if(n.A.isString(e[2]))h=t.select(e[2]);else throw Error("JSXGraph: Can't create Ellipse with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"' and '"+typeof e[2]+"'.\nPossible parent types: [point,point,point], [point,point,number|function]");l=function(){return h.Dist(u[0])+h.Dist(u[1])}}for(n.A.exists(e[4])||(e[4]=2*Math.PI),n.A.exists(e[3])||(e[3]=0),a=t.create("point",[function(){return(u[0].X()+u[1].X())*.5},function(){return(u[0].Y()+u[1].Y())*.5}],A),(s=t.create("curve",[function(t){return 0},function(t){return 0},e[3],e[4]],m)).majorAxis=l,d=s.hasPoint,r=function(t,e){var i,r,o,n,a,h,c,d,p;e||(r=(i=l())*i,o=u[0].X(),n=u[0].Y(),a=u[1].X(),h=u[1].Y(),c=o-a,d=n-h,s.quadraticform=[[(p=(r-o*o-n*n+a*a+h*h)/(2*i))*p-a*a-h*h,p*c/i+a,p*d/i+h],[p*c/i+a,c*c/r-1,c*d/r],[p*d/i+h,c*d/r,d*d/r-1]])},s.X=function(t,e){var i=l(),s=u[1].Dist(u[0]),o=.5*(s*s-i*i)/(s*Math.cos(t)-i),n=Math.atan2(u[1].Y()-u[0].Y(),u[1].X()-u[0].X());return e||r(t,e),u[0].X()+Math.cos(n+t)*o},s.Y=function(t,e){var i=l(),r=u[1].Dist(u[0]),s=.5*(r*r-i*i)/(r*Math.cos(t)-i),o=Math.atan2(u[1].Y()-u[0].Y(),u[1].X()-u[0].X());return u[0].Y()+Math.sin(o+t)*s},s.midpoint=s.center=a,s.type=o.A.OBJECT_TYPE_CONIC,s.subs={center:s.center},s.inherits.push(s.center,u[0],u[1]),n.A.isPoint(h)&&s.inherits.push(h),s.hasPoint=function(t,e){var i,r,s,n;return this.evalVisProp("hasinnerpoints")?(i=u[0].coords,r=u[1].coords,s=this.majorAxis(),(n=new f.A(o.A.COORDS_BY_SCREEN,[t,e],this.board)).distance(o.A.COORDS_BY_USER,i)+n.distance(o.A.COORDS_BY_USER,r)<=s):d.apply(this,arguments)},a.addChild(s),c=0;c<2;
1c++)n.A.isPoint(u[c])&&u[c].addChild(s);return n.A.isPoint(h)&&h.addChild(s),s.setParents(e),s},r.A.createHyperbola=function(t,e,i){var r,s,a,h,l,c,d=[],u=n.A.copyAttributes(i,t.options,"conic","foci"),p=n.A.copyAttributes(i,t.options,"conic","center"),f=n.A.copyAttributes(i,t.options,"conic");for(c=0;c<2;c++)if(e[c].length>1)d[c]=t.create("point",e[c],u);else if(n.A.isPoint(e[c]))d[c]=t.select(e[c]);else if(n.A.isFunction(e[c])&&n.A.isPoint(e[c]()))d[c]=e[c]();else if(n.A.isString(e[c]))d[c]=t.select(e[c]);else throw Error("JSXGraph: Can't create Hyperbola with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [point,point,point], [point,point,number|function]");if(n.A.isNumber(e[2]))l=n.A.createFunction(e[2],t);else if(n.A.isFunction(e[2])&&n.A.isNumber(e[2]()))l=e[2];else{if(n.A.isPoint(e[2]))h=t.select(e[2]);else if(e[2].length>1)h=t.create("point",e[2],u);else if(n.A.isFunction(e[2])&&n.A.isPoint(e[2]()))h=e[2]();else if(n.A.isString(e[2]))h=t.select(e[2]);else throw Error("JSXGraph: Can't create Hyperbola with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"' and '"+typeof e[2]+"'.\nPossible parent types: [point,point,point], [point,point,number|function]");l=function(){return h.Dist(d[0])-h.Dist(d[1])}}for(n.A.exists(e[4])||(e[4]=1.0001*Math.PI),n.A.exists(e[3])||(e[3]=-1.0001*Math.PI),a=t.create("point",[function(){return(d[0].X()+d[1].X())*.5},function(){return(d[0].Y()+d[1].Y())*.5}],p),(s=t.create("curve",[function(t){return 0},function(t){return 0},e[3],e[4]],f)).majorAxis=l,r=function(t,e){var i,r,o,n,a,h,c,u,p;e||(r=(i=l())*i,o=d[0].X(),n=d[0].Y(),a=d[1].X(),h=d[1].Y(),c=o-a,u=n-h,s.quadraticform=[[(p=(r-o*o-n*n+a*a+h*h)/(2*i))*p-a*a-h*h,p*c/i+a,p*u/i+h],[p*c/i+a,c*c/r-1,c*u/r],[p*u/i+h,c*u/r,u*u/r-1]])},s.X=function(t,e){var i=l(),s=d[1].Dist(d[0]),o=.5*(s*s-i*i)/(s*Math.cos(t)+i),n=Math.atan2(d[1].Y()-d[0].Y(),d[1].X()-d[0].X());return e||r(t,e),d[0].X()+Math.cos(n+t)*o},s.Y=function(t,e){var i=l(),r=d[1].Dist(d[0]),s=.5*(r*r-i*i)/(r*Math.cos(t)+i),o=Math.atan2(d[1].Y()-d[0].Y(),d[1].X()-d[0].X());return d[0].Y()+Math.sin(o+t)*s},s.midpoint=s.center=a,s.subs={center:s.center},s.inherits.push(s.center,d[0],d[1]),n.A.isPoint(h)&&s.inherits.push(h),s.type=o.A.OBJECT_TYPE_CONIC,a.addChild(s),c=0;c<2;
1c++)n.A.isPoint(d[c])&&d[c].addChild(s);return n.A.isPoint(h)&&h.addChild(s),s.setParents(e),s},r.A.createParabola=function(t,e,i){var r,s,a,h,l=e[0],d=e[1],u=n.A.copyAttributes(i,t.options,"conic","foci"),p=n.A.copyAttributes(i,t.options,"conic","center"),f=n.A.copyAttributes(i,t.options,"conic");if(e[0].length>1)l=t.create("point",e[0],u);else if(n.A.isPoint(e[0]))l=t.select(e[0]);else if(n.A.isFunction(e[0])&&n.A.isPoint(e[0]()))l=e[0]();else if(n.A.isString(e[0]))l=t.select(e[0]);else throw Error("JSXGraph: Can't create Parabola with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [point,line]");return n.A.isArray(d)&&2===d.length&&(h=n.A.copyAttributes(i,t.options,"conic","line"),d=t.create("line",d,h)),n.A.exists(e[3])||(e[3]=2*Math.PI),n.A.exists(e[2])||(e[2]=0),a=t.create("point",[function(){return c.A.projectPointToLine(l,d,t).usrCoords}],p),(s=t.create("curve",[function(t){return 0},function(t){return 0},e[2],e[3]],f)).midpoint=s.center=a,s.subs={center:s.center},s.inherits.push(s.center),r=function(t,e){var i,r,o,n,a,h;e||(i=d.stdform[1],r=d.stdform[2],o=d.stdform[0],s.quadraticform=[[o*o-(n=i*i+r*r)*((a=l.X())*a+(h=l.Y())*h),o*i+n*a,o*r+n*h],[o*i+n*a,-r*r,i*r],[o*r+n*h,i*r,-i*i]])},s.X=function(t,e){var i,s=d.getAngle(),o=c.A.distPointLine(l.coords.usrCoords,d.stdform),n=d.point1.coords.usrCoords,a=d.point2.coords.usrCoords,h=l.coords.usrCoords;return 0===n[0]?n=[1,a[1]+d.stdform[2],a[2]-d.stdform[1]]:0===a[0]&&(a=[1,n[1]+d.stdform[2],n[2]-d.stdform[1]]),i=((a[1]-n[1])*(h[2]-n[2])-(a[2]-n[2])*(h[1]-n[1])>=0?1:-1)*o/(1-Math.sin(t)),e||r(t,e),l.X()+Math.cos(t+s)*i},s.Y=function(t,e){var i,r=d.getAngle(),s=c.A.distPointLine(l.coords.usrCoords,d.stdform),o=d.point1.coords.usrCoords,n=d.point2.coords.usrCoords,a=l.coords.usrCoords;return 0===o[0]?o=[1,n[1]+d.stdform[2],n[2]-d.stdform[1]]:0===n[0]&&(n=[1,o[1]+d.stdform[2],o[2]-d.stdform[1]]),i=((n[1]-o[1])*(a[2]-o[2])-(n[2]-o[2])*(a[1]-o[1])>=0?1:-1)*s/(1-Math.sin(t)),l.Y()+Math.sin(t+r)*i},s.type=o.A.OBJECT_TYPE_CONIC,a.addChild(s),n.A.isPoint(l)&&(l.addChild(s),s.inherits.push(l)),d.addChild(s),s.setParents(e),s},r.A.createConic=function(t,e,i){var r,s,h,l,c,d,u,f,A,m,b,g,v=[[1,0,0],[0,1,0],[0,0,1]],y=[[1,0,0],[0,1,0],[0,0,1]],C=[],_=[],P=n.A.copyAttributes(i,t.options,"conic","point"),x=n.A.copyAttributes(i,t.options,"conic","center"),E=n.A.copyAttributes(i,t.options,"conic");if(5===e.length)g=!0;else if(6===e.length)g=!1;else throw Error("JSXGraph: Can't create generic Conic with "+e.length+" parameters.");if(g)for(m=0;m<5;m++)if(e[m].length>1)C[m]=t.create("point",e[m],P);else if(n.A.isPoint(e[m]))C[m]=t.select(e[m]);else if(n.A.isFunction(e[m])&&n.A.isPoint(e[m]()))C[m]=e[m]();else if(n.A.isString(e[m]))C[m]=t.select(e[m]);else throw Error("JSXGraph: Can't create Conic section with parent types '"+typeof e[m]+"'.\nPossible parent types: [point,point,point,point,point], [a00,a11,a22,a01,a02,a12]");else(b=[[0,0,0],[0,0,0],[0,0,0]])[0][0]=n.A.isFunction(e[2])?function(){return e[2]()}:function(){return e[2]},b[0][1]=n.A.isFunction(e[4])?function(){return e[4]()}:function(){return e[4]},b[0][2]=n.A.isFunction(e[5])?function(){return e[5]()}:function(){return e[5]},b[1][1]=n.A.isFunction(e[0])?function(){return e[0]()}:function(){return e[0]},b[1][2]=n.A.isFunction(e[3])?function(){return e[3]()}:function(){return e[3]},b[2][2]=n.A.isFunction(e[1])?function(){return e[1]()}:function(){return e[1]};if(c=function(t){var e,i;for(e=0;e<3;e++)for(i=e;i<3;i++)t[e][i]+=t[i][e];for(e=0;e<3;e++)for(i=0;i<e;i++)t[e][i]=t[i][e];return t},l=function(t,e){var i,r,s=[[0,0,0],[0,0,0],[0,0,0]];for(i=0;i<3;i++)for(r=0;r<3;r++)s[i][r]=t[i]*e[r];return c(s)},h=function(t,e,i){var r,s,o,n,h,l=[[0,0,0],[0,0,0],[0,0,0]];for(r=0,h=a.A.matVecMult(e,i),o=a.A.innerProduct(i,h),h=a.A.matVecMult(t,i),n=a.A.innerProduct(i,h);r<3;r++)for(s=0;s<3;s++)l[r][s]=o*t[r][s]-n*e[r][s];return l},s=t.create("curve",[function(t){return 0},function(t){return 0},0,2*Math.PI],E),r=function(t,e){var i,r,o;if(!e){if(g){for(i=0;i<5;i++)_[i]=C[i].coords.usrCoords;y=h(l(a.A.crossProduct(_[0],_[1]),a.A.crossProduct(_[2],_[3])),l(a.A.crossProduct(_[0],_[2]),a.A.crossProduct(_[1],_[3])),_[4])}else for(i=0;i<3;i++)for(r=i;r<3;r++)y[i][r]=b[i][r](),r>i&&(y[r][i]=y[i][r]);s.quadraticform=y,(d=p.A.Jacobi(y))[0][0][0]<0&&(d[0][0][0]*=-1,d[0][1][1]*=-1,d[0][2][2]*=-1),v=d[1],A=Math.sqrt(Math.abs(d[0][0][0])),u=Math.sqrt(Math.abs(d[0][1][1])),f=Math.sqrt(Math.abs(d[0][2][2]))}return d[0][1][1]<=0&&d[0][2][2]<=0?o=a.A.matVecMult(v,[1/A,Math.
1cos(t)/u,Math.sin(t)/f]):d[0][1][1]<=0&&d[0][2][2]>0?o=a.A.matVecMult(v,[Math.cos(t)/A,1/u,Math.sin(t)/f]):d[0][2][2]<0&&(o=a.A.matVecMult(v,[Math.sin(t)/A,Math.cos(t)/u,1/f])),n.A.exists(o)?(o[1]/=o[0],o[2]/=o[0],o[0]=1):o=[1,NaN,NaN],o},s.X=function(t,e){return r(t,e)[1]},s.Y=function(t,e){return r(t,e)[2]},s.midpoint=t.create("point",[function(){var t=s.quadraticform;return[t[1][1]*t[2][2]-t[1][2]*t[1][2],t[1][2]*t[0][2]-t[2][2]*t[0][1],t[0][1]*t[1][2]-t[1][1]*t[0][2]]}],x),s.type=o.A.OBJECT_TYPE_CONIC,s.center=s.midpoint,s.subs={center:s.center},s.inherits.push(s.center),s.inherits=s.inherits.concat(C),g){for(m=0;m<5;m++)n.A.isPoint(C[m])&&C[m].addChild(s);s.setParents(e)}return s.addChild(s.center),s},r.A.registerElement("ellipse",r.A.createEllipse),r.A.registerElement("hyperbola",r.A.createHyperbola),r.A.registerElement("parabola",r.A.createParabola),r.A.registerElement("conic",r.A.createConic),r.A.Polygon=function(t,e,i){this.constructor(t,i,o.A.OBJECT_TYPE_POLYGON,o.A.OBJECT_CLASS_AREA);var s,a,h,l,c,d=n.A.copyAttributes(i,t.options,"polygon","borders");for(s=0,this.withLines=i.withlines,this.attr_line=d,this.vertices=[];s<e.length;s++)this.vertices[s]=this.board.select(e[s]),this.vertices[s]._is_new&&(delete this.vertices[s]._is_new,this.vertices[s]._is_new_pol=!0);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(l=0,h=this.vertices.length-1;l<h;l++)s=(l+1)%h,d.id=d.ids&&d.ids[s],d.name=d.names&&d.names[s],d.strokecolor=n.A.isArray(d.colors)&&d.colors[s%d.colors.length]||d.strokecolor,d.visible=n.A.exists(i.borders.visible)?i.borders.visible:i.visible,!1===d.strokecolor&&(d.strokecolor="none"),(a=t.create("segment",[this.vertices[s],this.vertices[s+1]],d)).dump=!1,this.borders[s]=a,a.parentPolygon=this,this.addChild(a);for(this.inherits.push(this.vertices,this.borders),this.id=this.board.setId(this,"Py"),s=0;s<this.vertices.length-1;s++)c=this.board.select(this.vertices[s]),n.A.exists(c._is_new_pol)?(this.addChild(c),delete c._is_new_pol):c.addChild(this);this.board.renderer.drawPolygon(this),this.board.finalizeAdding(this),this.createGradient(),this.elType="polygon",this.createLabel(),this.methodMap=r.A.deepCopy(this.methodMap,{borders:"borders",vertices:"vertices",A:"Area",Area:"Area",Perimeter:"Perimeter",L:"Perimeter",boundingBox:"bounds",BoundingBox:"bounds",addPoints:"addPoints",insertPoints:"insertPoints",removePoints:"removePoints",Intersect:"intersect"})},r.A.Polygon.prototype=new V.A,r.A.extend(r.A.Polygon.prototype,{pnpoly:function(t,e,i){return c.A.pnpoly(t,e,this.vertices,i,this.board)},hasPoint:function(t,e){var i,r;if(this.evalVisProp("hasinnerpoints")&&this.pnpoly(t,e))return!0;for(i=0,r=this.borders.length;i<r;i++)if(this.borders[i].hasPoint(t,e))return!0;return!1},updateRenderer:function(){var t,e;if(!this.needsUpdate)return this;if(this.visPropCalc.visible){for(t=0,e=this.vertices.length-("polygonalchain"!==this.elType),this.isReal=!0;t<e;++t)if(!this.vertices[t].isReal){this.isReal=!1;break}if(!this.isReal)for(t in this.updateVisibility(!1),this.childElements)this.childElements.hasOwnProperty(t)&&this.childElements[t].setDisplayRendNode(!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,e,i,r,s;if(0===this.vertices.length)return new f.A(o.A.COORDS_BY_USER,[1,0,0],this.board);for(s=0,t=this.vertices[0].X(),e=this.vertices[0].Y(),i=t,r=e;s<this.vertices.length;s++)this.vertices[s].X()<t&&(t=this.vertices[s].X()),this.vertices[s].X()>i&&(i=this.vertices[s].X()),this.vertices[s].Y()>e&&(e=this.vertices[s].Y()),this.vertices[s].Y()<r&&(r=this.vertices[s].Y());return new f.A(o.A.COORDS_BY_USER,[(t+i)*.5,(e+r)*.5],this.board)},getLabelAnchor:r.A.shortcut(r.A.Polygon.prototype,"getTextAnchor"),cloneToBackground:function(){var t,e=n.A.getCloneObject(this);return e.vertices=this.vertices,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(t){var e;if(r.A.deprecated("Element.hideElement()","Element.setDisplayRendNode()"),this.visPropCalc.visible=!1,this.board.renderer.display(this,!1),!t)for(e=0;e<this.borders.length;e++)this.borders[e].hideElement();this.hasLabel&&n.A.exists(this.label)&&(this.label.hiddenByParent=!0,this.label.visPropCalc.visible&&this.label.hideElement())},showElement:function(t){var e;if(r.A.deprecated("Element.showElement()","Element.setDisplayRendNode()"),this.visPropCalc.visible=!0,this.board.renderer.display(this,!0),!t)for(e=0;e<this.borders.length;e++)this.borders[e].showElement().updateRenderer();return n.A.exists(this.label)&&this.hasLabel&&this.label.hiddenByParent&&(this.label.hiddenByParent=!1,this.label.visPropCalc.visible||this.label.showElement().updateRenderer()),this},Area:function(){return Math.abs(c.A.signedPolygon(this.vertices,!0))},Perimeter:function(){var t,e=this.vertices.length,i=0;for(t=1;t<e;++t)i+=this.vertices[t].Dist(this.vertices[t-1]);return i},L:function(){return this.Perimeter()},boundingBox:function(){var t,e,i=[0,0,0,0],r=this.vertices.length-1;if(0===r)return i;for(t=1,i[0]=this.vertices[0].X(),i[2]=i[0],i[1]=this.vertices[0].Y(),i[3]=i[1];t<r;++t)(e=this.vertices[t].X())<i[0]?i[0]=e:e>i[2]&&(i[2]=e),(e=this.vertices[t].Y())>i[1]?i[1]=e:e<i[3]&&(i[3]=e);return i},bounds:function(){return this.boundingBox()},remove:function(){var t;for(t=0;t<this.borders.length;t++)this.board.removeObject(this.borders[t]);V.A.prototype.remove.call(this)},findPoint:function(t){var e;if(!n.A.isPoint(t))return -1;for(e=0;e<this.vertices.length;e++)if(this.vertices[e].id===t.id)return e;return -1},addPoints:function(t){var e,i=Array.prototype.slice.call(arguments);return e="polygonalchain"===this.elType?this.vertices.length-1:this.vertices.length-2,this.insertPoints.apply(this,[e].
1concat(i))},insertPoints:function(t,e){var i,r,s,o,a;if(0==arguments.length||(s=this.vertices.length-1,"polygon"===this.elType&&s--,t<-1||t>s))return this;for(i=1,r=arguments.length-1;i<r+1;i++)a=n.A.providePoints(this.board,[arguments[i]],{},"polygon",["vertices"])[0],a._is_new&&(this.addChild(a),delete a._is_new),this.vertices.splice(t+i,0,a);if(this.withLines)for(o=t+1,"polygon"===this.elType?t<0?(this.vertices[this.vertices.length-1]=this.vertices[0],this.borders[this.borders.length-1].point2=this.vertices[this.vertices.length-1]):this.borders[t].point2=this.vertices[o]:t>=0&&(t<this.borders.length?this.borders[t].point2=this.vertices[o]:o=t),i=o;i<o+r;i++)this.borders.splice(i,0,this.board.create("segment",[this.vertices[i],this.vertices[i+1]],this.attr_line));return this.inherits=[],this.inherits.push(this.vertices,this.borders),this.board.update(),this},removePoints:function(t){var e,i,r,s,o=[],a=[],h=[],l=[];for("polygon"===this.elType&&(s=this.vertices.pop()),e=0;e<arguments.length;e++)r=arguments[e],n.A.isPoint(r)&&(r=this.findPoint(r)),n.A.isNumber(r)&&r>-1&&r<this.vertices.length&&-1===n.A.indexOf(h,r)&&h.push(r);if(0===h.length)return"polygon"===this.elType&&this.vertices.push(s),this;for(e=0;e<h.length;e++)this.vertices[h[e]].removeChild(this);for(h=h.sort(),o=this.vertices.slice(),a=this.borders.slice(),this.withLines&&l.push([h[h.length-1]]),e=h.length-1;e>-1;e--)o[h[e]]=-1,this.withLines&&h.length>1&&h[e]-1>h[e-1]&&(l[l.length-1][1]=h[e],l.push([h[e-1]]));for(this.withLines&&(l[l.length-1][1]=h[0]),this.vertices=[],e=0;e<o.length;e++)n.A.isPoint(o[e])&&this.vertices.push(o[e]);if("polygon"===this.elType&&this.vertices.length>1&&this.vertices[this.vertices.length-1].id!==this.vertices[0].id&&this.vertices.push(this.vertices[0]),this.withLines){for(e=0;e<l.length;e++){for(i=l[e][1]-1;i<l[e][0]+1;i++)i<0?"polygon"===this.elType&&(this.board.removeObject(this.borders[a.length-1]),a[a.length-1]=-1):i<a.length&&(this.board.removeObject(this.borders[i]),a[i]=-1);0!==l[e][1]&&l[e][0]!==o.length-1&&(a[l[e][0]-1]=this.board.create("segment",[o[l[e][1]-1],o[l[e][0]+1]],this.attr_line))}for(e=0,this.borders=[];e<a.length;e++)-1!==a[e]&&this.borders.push(a[e]);"polygon"===this.elType&&this.vertices.length>2&&(l[0][1]===this.vertices.length-1||0===l[l.length-1][1])&&this.borders.push(this.board.create("segment",[this.vertices[this.vertices.length-2],this.vertices[0]],this.attr_line))}return this.inherits=[],this.inherits.push(this.vertices,this.borders),this.board.update(),this},getParents:function(){return this.setParents(this.vertices),this.parents},getAttributes:function(){var t,e=V.A.prototype.getAttributes.call(this);if(this.withLines)for(t=0,e.lines=e.lines||{},e.lines.ids=[],e.lines.colors=[];t<this.borders.length;t++)e.lines.ids.push(this.borders[t].id),e.lines.colors.push(this.borders[t].visProp.strokecolor);return e}
1,snapToGrid:function(){var t,e;for(t=0,e=!!this.evalVisProp("snaptogrid");t<this.vertices.length;t++)this.vertices[t].handleSnapToGrid(e,!0)},setPositionDirectly:function(t,e,i){var r,s,o,n=new f.A(t,e,this.board),a=new f.A(t,i,this.board);for(s=0,o=this.vertices.length-1;s<o;s++)if(!this.vertices[s].draggable())return this;return r=A.A.subtract(n.usrCoords,a.usrCoords),this.board.create("transform",r.slice(1),{type:"translate"}).applyOnce(this.vertices.slice(0,-1)),this},sutherlandHodgman:function(t){var e,i,s,o,n,a,h,l=r.A.Math.Geometry.sortVertices(this.vertices),c=r.A.Math.Geometry.sortVertices(t.vertices),d=l.length-1,u=c.length-1,p=[],f=function(t,e,i){return(e[1]-t[1])*(i[2]-t[2])-(e[2]-t[2])*(i[1]-t[1])>=0};for(s=0;s<u;s++)p.push(c[s]);for(s=0;s<d;s++)for(o=0,e=(i=p.slice(0)).length,p=[],n=i[e-1];o<e;o++)a=i[o],f(l[s],l[s+1],a)?(f(l[s],l[s+1],n)||(h=r.A.Math.Geometry.meetSegmentSegment(n,a,l[s],l[s+1]),h[0][1]/=h[0][0],h[0][2]/=h[0][0],h[0][0]=1,p.push(h[0])),p.push(a)):f(l[s],l[s+1],n)&&(h=r.A.Math.Geometry.meetSegmentSegment(n,a,l[s],l[s+1]),h[0][1]/=h[0][0],h[0][2]/=h[0][0],h[0][0]=1,p.push(h[0])),n=a;return p},intersect:function(t){return this.sutherlandHodgman(t)}}),r.A.createPolygon=function(t,e,i){var s,a,h,l,c,d,u=[],p=!1;if(c=n.A.copyAttributes(i,t.options,"polygon"),null===(l=t.select(e[0]))&&(l=e[0]),n.A.isObject(l)&&l.type===o.A.OBJECT_TYPE_POLYGON&&n.A.isTransformationOrArray(e[1]))for(a=0,p=!0,h=l.vertices.length-1,d=n.A.copyAttributes(i,t.options,"polygon","vertices");a<h;a++)d.withlabel&&(d.name=""===l.vertices[a].name?"":l.vertices[a].name+"'"),u.push(t.create("point",[l.vertices[a],e[1]],d));else if(!1===(u=n.A.providePoints(t,e,i,"polygon",["vertices"])))throw Error("JSXGraph: Can't create polygon / polygonalchain with parent types other than 'point' and 'coordinate arrays' or a function returning an array of coordinates. Alternatively, a polygon and a transformation can be supplied");if(c=n.A.copyAttributes(i,t.options,"polygon"),(s=new r.A.Polygon(t,u,c)).isDraggable=!0,p)for(s.prepareUpdate().update().updateVisibility().updateRenderer(),h=l.vertices.length-1,a=0;a<h;a++)u[a].prepareUpdate().update().updateVisibility().updateRenderer();return s},r.A.createRegularPolygon=function(t,e,i){var r,s,a,h,l,c,d,u=[];if(l=e.length,a=e[l-1],n.A.isNumber(a)&&(3!==e.length||a<3))throw Error("JSXGraph: A regular polygon needs two point types and a number > 2 as input.");if(n.A.isNumber(t.select(a))?(l--,c=!1):(a=l,c=!0),!1===(u=n.A.providePoints(t,e.slice(0,l),i,"regularpolygon",["vertices"])))throw Error("JSXGraph: Can't create regular polygon with parent types other than 'point' and 'coordinate arrays' or a function returning an array of coordinates");for(s=2,d=n.A.copyAttributes(i,t.options,"regularpolygon","vertices");s<a;s++)h=t.create("transform",[Math.PI*(2-(a-2)/a),u[s-1]],{type:"rotate"}),c?(u[s].addTransform(u[s-2],h),u[s].fullUpdate()):(n.A.isArray(d.ids)&&d.ids.length>=a-2&&(d.id=d.ids[s-2]),u[s]=t.create("point",[u[s-2],h],d),u[s].type=o.A.OBJECT_TYPE_CAS,u[s].isDraggable=!0,u[s].visProp.fixed=!1);return d=n.A.copyAttributes(i,t.options,"regularpolygon"),(r=t.create("polygon",u,d)).elType="regularpolygon",r},r.A.createPolygonalChain=function(t,e,i){var r,s;return r=n.A.copyAttributes(i,t.options,"polygonalchain"),(s=t.create("polygon",e,r)).elType="polygonalchain",s.vertices.pop(),t.removeObject(s.borders[s.borders.length-1]),s.borders.pop(),s},r.A.createParallelogram=function(t,e,i){var r,s,o,a,h=[];if(!1===(h=n.A.providePoints(t,e,i,"polygon",["vertices"]))||h.length<3)throw Error("JSXGraph: Can't create parallelogram with parent types other than 'point' and 'coordinate arrays' or a function returning an array of coordinates.");return a=n.A.copyAttributes(i,t.options,"parallelogram","parallelpoint"),s=t.create("parallelpoint",h,a),o=n.A.copyAttributes(i,t.options,"parallelogram"),(r=t.create("polygon",[h[0],h[1],s,h[2]],o)).elType="parallelogram",r.parallelPoint=s,r.isDraggable=!0,s.isDraggable=!0,s.visProp.fixed=!1,r},r.A.registerElement("polygon",r.A.createPolygon),r.A.registerElement("regularpolygon",r.A.createRegularPolygon),r.A.registerElement("polygonalchain",r.A.createPolygonalChain),r.A.registerElement("parallelogram",r.A.createParallelogram);let F=r.A.Polygon;
1r.A.Curve=function(t,e,i){this.constructor(t,i,o.A.OBJECT_TYPE_CURVE,o.A.OBJECT_CLASS_CURVE),this.points=[],this.numberPoints=this.evalVisProp("numberpointshigh"),this.bezierDegree=1,this.dataX=null,this.dataY=null,this.ticks=[],this.qdt=null,n.A.exists(e[0])?this.varname=e[0]:this.varname="x",this.xterm=e[1],this.yterm=e[2],this.generateTerm(this.varname,this.xterm,this.yterm,e[3],e[4]),this.updateCurve(),this.id=this.board.setId(this,"G"),this.board.renderer.drawCurve(this),this.board.finalizeAdding(this),this.createGradient(),this.elType="curve",this.createLabel(),n.A.isString(this.xterm)&&this.notifyParents(this.xterm),n.A.isString(this.yterm)&&this.notifyParents(this.yterm),this.methodMap=n.A.deepCopy(this.methodMap,{generateTerm:"generateTerm",setTerm:"generateTerm",move:"moveTo",moveTo:"moveTo",MinX:"minX",MaxX:"maxX"})},r.A.Curve.prototype=new V.A,r.A.extend(r.A.Curve.prototype,{minX:function(){return"polar"===this.evalVisProp("curvetype")?0:new f.A(o.A.COORDS_BY_SCREEN,[-(.1*this.board.canvasWidth),0],this.board,!1).usrCoords[1]},maxX:function(){return"polar"===this.evalVisProp("curvetype")?2*Math.PI:new f.A(o.A.COORDS_BY_SCREEN,[1.1*this.board.canvasWidth,0],this.board,!1).usrCoords[1]},X:function(t){return NaN},Y:function(t){return NaN},Z:function(t){return 1},hasPoint:function(t,e,i){var r,s,h,l,d,u,p,A,m,b,g,v,y,C,_,P,x,E=[],S=this.evalVisProp("numberpointslow"),N=(this.maxX()-this.minX())/S,T=1/0,w=!0;if(n.A.isObject(this.evalVisProp("precision"))?(v=this.board._inputDevice,g=this.evalVisProp("precision."+v)):g=this.board.options.precision.hasPoint,t=(u=new f.A(o.A.COORDS_BY_SCREEN,[t,e],this.board,!1)).usrCoords[1],e=u.usrCoords[2],1===this.bezierDegree&&this.evalVisProp("hasinnerpoints")&&0!==c.A.windingNumber([1,t,e],this.points,!0))return!0;if(g+=.5*this.evalVisProp("strokewidth"),g*=g,y=this.board.unitX*this.board.unitX,C=this.board.unitY*this.board.unitY,P=this.minX(),x=this.maxX(),n.A.exists(this._visibleArea)&&(P=this._visibleArea[0],N=((x=this._visibleArea[1])-P)/S),"parameter"===(_=this.evalVisProp("curvetype"))||"polar"===_)for(this.transformations.length>0&&(this.updateTransformMatrix(),A=a.A.inverse(this.transformMat),t=(s=a.A.matVecMult(A,[1,t,e]))[1],e=s[2]),h=0,r=P;h<S;h++){if((T=(t-(l=this.X(r,w)))*(t-l)*y+(e-(d=this.Y(r,w)))*(e-d)*C)<=g)return!0;r+=N}else if("plot"===_||"functiongraph"===_){for((!n.A.exists(i)||i<0)&&(i=0),n.A.exists(this.qdt)&&this.evalVisProp("useqdt")&&3!==this.bezierDegree?p=(m=(b=this.qdt.query(new f.A(o.A.COORDS_BY_USER,[t,e],this.board))).points).length:(m=this.points,p=this.numberPoints-1),h=i;h<p;h++)if(3===this.bezierDegree?E=c.A.projectCoordsToBeziersegment([1,t,e],this,h):b?(m[h].prev&&(E=c.A.projectCoordsToSegment([1,t,e],m[h].prev.usrCoords,m[h].usrCoords)),m[h].next&&m[h+1]!==m[h].next&&(E=c.A.projectCoordsToSegment([1,t,e],m[h].usrCoords,m[h].next.usrCoords))):E=c.A.projectCoordsToSegment([1,t,e],m[h].usrCoords,m[h+1].usrCoords),E[1]>=0&&E[1]<=1&&(t-E[0][1])*(t-E[0][1])*y+(e-E[0][2])*(e-E[0][2])*C<=g)return!0;return!1}return T<g},allocatePoints:function(){var t,e;if(e=this.numberPoints,this.points.length<this.numberPoints)for(t=this.points.length;t<e;t++)this.points[t]=new f.A(o.A.COORDS_BY_USER,[0,0],this.board,!1)},update:function(){return this.needsUpdate&&(this.evalVisProp("trace")&&this.cloneToBackground(!0),this.updateCurve()),this},updateRenderer:function(){return this.needsUpdate&&(this.visPropCalc.visible&&(this.isReal=m.checkReal(this.points),this.isReal||this.updateVisibility(!1)),this.visPropCalc.visible&&this.board.renderer.updateCurve(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},updateDataArray:function(){},updateCurve:function(){var t,e,i,r,s,a,h=this.visProp.plotversion,l=!1;if(this.updateTransformMatrix(),this.updateDataArray(),i=this.minX(),r=this.maxX(),n.A.exists(this.dataX))for(this.numberPoints=this.dataX.length,e=this.numberPoints,this.allocatePoints(),t=0;t<e;t++)s=t,n.A.exists(this.dataY)?(a=t,this.points[t].setCoordinates(o.A.COORDS_BY_USER,[this.dataX[t],this.dataY[t]],!1)):(a=this.X(s),this.points[t].setCoordinates(o.A.COORDS_BY_USER,[this.dataX[t],this.Y(a,l)],!1)),this.points[t]._t=t,l=!0;else if(this.evalVisProp("doadvancedplot")?1===h||this.evalVisProp("doadvancedplotold")?m.updateParametricCurveOld(this,i,r):2===h?m.updateParametricCurve_v2(this,i,r):3===h?m.updateParametricCurve_v3(this,i,r):4===h?m.updateParametricCurve_v4(this,i,r):m.updateParametricCurve_v2(this,i,r):(this.board.updateQuality===this.board.BOARD_QUALITY_HIGH?this.numberPoints=this.evalVisProp("numberpointshigh"):this.numberPoints=this.evalVisProp("numberpointslow"),this.allocatePoints(),m.updateParametricCurveNaive(this,i,r,this.numberPoints)),e=this.numberPoints,this.evalVisProp("useqdt")&&this.board.updateQuality===this.board.BOARD_QUALITY_HIGH)for(t=0,this.qdt=new d(this.board.getBoundingBox());t<this.points.length;
1t++)this.qdt.insert(this.points[t]),t>0&&(this.points[t].prev=this.points[t-1]),t<e-1&&(this.points[t].next=this.points[t+1]);for("plot"!==this.evalVisProp("curvetype")&&this.evalVisProp("rdpsmoothing")&&(this.points=p.A.RamerDouglasPeucker(this.points,.2),this.numberPoints=this.points.length),e=this.numberPoints,t=0;t<e;t++)this.updateTransform(this.points[t]);return this},updateTransformMatrix:function(){var t,e,i=this.transformations.length;for(e=0,this.transformMat=[[1,0,0],[0,1,0],[0,0,1]];e<i;e++)(t=this.transformations[e]).update(),this.transformMat=a.A.matMatMult(t.matrix,this.transformMat);return this},updateTransform:function(t){var e;return this.transformations.length>0&&(e=a.A.matVecMult(this.transformMat,t.usrCoords),t.setCoordinates(o.A.COORDS_BY_USER,e,!1,!0)),t},addTransform:function(t){var e,i=n.A.isArray(t)?t:[t],r=i.length;for(e=0;e<r;e++)this.transformations.push(i[e]);return this},interpolationFunctionFromArray:function(t){var e="data"+t,i=this;return function(t,r){var s,o,a,h,l=i[e],c=l.length,d=[];if(isNaN(t))return NaN;if(t<0)return n.A.isFunction(l[0])?l[0]():l[0];if(3===i.bezierDegree){if(t>=(c-1)/3)return n.A.isFunction(l[l.length-1])?l[l.length-1]():l[l.length-1];for(o=0,s=3*Math.floor(t),h=1-(a=t%1);o<4;o++)n.A.isFunction(l[s+o])?d[o]=l[s+o]():d[o]=l[s+o];return h*h*(h*d[0]+3*a*d[1])+(3*h*d[2]+a*d[3])*a*a}if((s=t>c-2?c-2:parseInt(Math.floor(t),10))===t)return n.A.isFunction(l[s])?l[s]():l[s];for(o=0;o<2;o++)n.A.isFunction(l[s+o])?d[o]=l[s+o]():d[o]=l[s+o];return d[0]+(d[1]-d[0])*(t-s)}},generateTerm:function(t,e,i,r,s){var o,h,l;n.A.isArray(e)?(this.dataX=e,this.numberPoints=this.dataX.length,this.X=this.interpolationFunctionFromArray.apply(this,["X"]),this.visProp.curvetype="plot"):(this.X=n.A.createFunction(e,this.board,t),n.A.isString(e)?this.visProp.curvetype="functiongraph":(n.A.isFunction(e)||n.A.isNumber(e))&&(this.visProp.curvetype="parameter")),this.isDraggable=!0,n.A.isArray(i)?(this.dataY=i,this.Y=this.interpolationFunctionFromArray.apply(this,["Y"])):n.A.exists(i)?this.Y=n.A.createFunction(i,this.board,t):(l=a.A.transpose(e),this.dataX=l[0],this.dataY=l[1],this.numberPoints=this.dataX.length,this.Y=this.interpolationFunctionFromArray.apply(this,["Y"])),n.A.isFunction(e)&&n.A.isArray(i)&&(o=n.A.createFunction(i[0],this.board,""),h=n.A.createFunction(i[1],this.board,""),this.X=function(t){return e(t)*Math.cos(t)+o()},this.X.deps=o.deps,this.Y=function(t){return e(t)*Math.sin(t)+h()},this.Y.deps=h.deps,this.visProp.curvetype="polar"),n.A.exists(r)?this.minX=n.A.createFunction(r,this.board,""):delete this.minX,n.A.exists(s)?this.maxX=n.A.createFunction(s,this.board,""):delete this.maxX,this.addParentsFromJCFunctions([this.X,this.Y,this.minX,this.maxX])},notifyParents:function(t){var e,i,r,s=!1;for(e in r={xterm:1,yterm:1})if(r.hasOwnProperty(e)&&this.hasOwnProperty(e)&&this[e].origin)for(i in s=!0,this[e].origin.deps)this[e].origin.deps.hasOwnProperty(i)&&this[e].origin.deps[i].addChild(this);s||w.A.findDependencies(this,t,this.board)},getLabelPosition:function(t,e){var i,r,s,h,l,c,d,u,p,A,m=1.5;return s=n.A.parsePosition(t),d=n.A.parseNumber(s.pos,this.maxX()-this.minX(),1),0>s.pos.indexOf("fr")&&0>s.pos.indexOf("%")&&(d=0),u=this.minX()+d,i=this.X(u),r=this.Y(u),h=new f.A(o.A.COORDS_BY_USER,[i,r],this.board).scrCoords,c=a.A.eps,u<this.minX()+c?(p=(this.X(u+c)-this.X(u))/c,A=(this.Y(u+c)-this.Y(u))/c):u>this.maxX()-c?(p=(this.X(u)-this.X(u-c))/c,A=(this.Y(u)-this.Y(u-c))/c):(p=.5*(this.X(u+c)-this.X(u-c))/c,A=.5*(this.Y(u+c)-this.Y(u-c))/c),l=a.A.hypot(p,A),"left"===s.side?A*=-1:p*=-1,n.A.exists(this.label)&&(m=.5*e/l),i=h[1]+A*this.label.size[0]*m,r=h[2]-p*this.label.size[1]*m,new f.A(o.A.COORDS_BY_SCREEN,[i,r],this.board)},getLabelAnchor:function(){var t,e,i,r,s=.05*this.board.canvasWidth,a=.05*this.board.canvasHeight,h=.95*this.board.canvasWidth,l=.95*this.board.canvasHeight;if(!n.A.exists(this.label)||(i=this.label.evalVisProp("position"),!n.A.isString(i)))return new f.A(o.A.COORDS_BY_SCREEN,[NaN,NaN],this.board);if(!(0>i.indexOf("right")&&0>i.indexOf("left")))return this.getLabelPosition(i,this.label.evalVisProp("distance"));switch(this.evalVisProp("label.position")){case"ulft":t=s,e=a;break;case"llft":t=s,e=l;break;case"rt":t=h,e=.5*l;break;case"lrt":t=h,e=l;break;case"urt":t=h,e=a;break;case"top":t=.5*h,e=a;break;case"bot":t=.5*h,e=l;break;default:t=s,e=.5*l}return r=new f.A(o.A.COORDS_BY_SCREEN,[t,e],this.board,!1),c.A.projectCoordsToCurve(r.usrCoords[1],r.usrCoords[2],0,this,this.board)[0]}
1,cloneToBackground:function(){var t,e=n.A.getCloneObject(this);return e.points=this.points.slice(0),e.bezierDegree=this.bezierDegree,e.numberPoints=this.numberPoints,t=this.board.renderer.enhancedRendering,this.board.renderer.enhancedRendering=!0,this.board.renderer.drawCurve(e),this.board.renderer.enhancedRendering=t,this.traces[e.id]=e.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=n.A.bind(function(){return this.usrCoords[1]},this.points[t]),this.points[t].Y=n.A.bind(function(){return this.usrCoords[2]},this.points[t]);return i=(e=p.A.bezier(this.points))[3](),r=p.A.fminbr(function(t){return e[0](t)},[0,i]),s=p.A.fminbr(function(t){return-e[0](t)},[0,i]),o=p.A.fminbr(function(t){return e[1](t)},[0,i]),a=p.A.fminbr(function(t){return-e[1](t)},[0,i]),r=e[0](r),s=e[0](s),o=e[1](o),[r,a=e[1](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 e,i=[];return this.points.length>0&&!this.evalVisProp("fixed")?(e=this.points[0],i=3===t.length?[t[0]-e.usrCoords[0],t[1]-e.usrCoords[1],t[2]-e.usrCoords[2]]:[t[0]-e.usrCoords[1],t[1]-e.usrCoords[2]],this.setPosition(o.A.COORDS_BY_USER,i),this.board.update(this)):this},getTransformationSource:function(){var t,e;return n.A.exists(this._transformationSource)&&(e=this._transformationSource).elementClass===o.A.OBJECT_CLASS_CURVE&&(t=!0),[t,e]}}),r.A.createCurve=function(t,e,i){var s,a,h=n.A.copyAttributes(i,t.options,"curve");return(s=t.select(e[0],!0),n.A.isTransformationOrArray(e[1])&&n.A.isObject(s)&&(s.type===o.A.OBJECT_TYPE_CURVE||s.type===o.A.OBJECT_TYPE_ANGLE||s.type===o.A.OBJECT_TYPE_ARC||s.type===o.A.OBJECT_TYPE_CONIC||s.type===o.A.OBJECT_TYPE_SECTOR))?(s.type===o.A.OBJECT_TYPE_SECTOR?h=n.A.copyAttributes(i,t.options,"sector"):s.type===o.A.OBJECT_TYPE_ARC?h=n.A.copyAttributes(i,t.options,"arc"):s.type===o.A.OBJECT_TYPE_ANGLE?(n.A.exists(i.withLabel)||(i.withLabel=!1),h=n.A.copyAttributes(i,t.options,"angle")):h=n.A.copyAttributes(i,t.options,"curve"),h=n.A.copyAttributes(h,t.options,"curve"),(a=new r.A.Curve(t,["x",[],[]],h)).updateDataArray=function(){var t,e=s.numberPoints;for(t=0,this.bezierDegree=s.bezierDegree,this.dataX=[],this.dataY=[];t<e;t++)this.dataX.push(s.points[t].usrCoords[1]),this.dataY.push(s.points[t].usrCoords[2]);return this},a.addTransform(e[1]),s.addChild(a),a.setParents([s]),a._transformationSource=s,a):(h=n.A.copyAttributes(i,t.options,"curve"),new r.A.Curve(t,["x"].concat(e),h))},r.A.registerElement("curve",r.A.createCurve),r.A.createFunctiongraph=function(t,e,i){var s,o=["x","x"].concat(e);return s=n.A.copyAttributes(i,t.options,"functiongraph"),(s=n.A.copyAttributes(s,t.options,"curve")).curvetype="functiongraph",new r.A.Curve(t,o,s)},r.A.registerElement("functiongraph",r.A.createFunctiongraph),r.A.registerElement("plot",r.A.createFunctiongraph),r.A.createSpline=function(t,e,i){var s,o,a;return o=function(){var t,i=[],r=[];return[function(s,o){var a,h,l;if(!o){if(i=[],r=[],2===e.length&&n.A.isArray(e[0])&&n.A.isArray(e[1])&&e[0].length===e[1].length)for(a=0;a<e[0].length;a++)n.A.isFunction(e[0][a])?i.push(e[0][a]()):i.push(e[0][a]),n.A.isFunction(e[1][a])?r.push(e[1][a]()):r.push(e[1][a]);else for(a=0;a<e.length;a++)if(n.A.isPoint(e[a]))i.push(e[a].X()),r.push(e[a].Y());else if(n.A.isArray(e[a])&&2===e[a].length)for(h=0;h<e.length;h++)n.A.isFunction(e[h][0])?i.push(e[h][0]()):i.push(e[h][0]),n.A.isFunction(e[h][1])?r.push(e[h][1]()):r.push(e[h][1]);else n.A.isFunction(e[a])&&2===e[a]().length&&(l=e[a](),i.push(l[0]),r.push(l[1]));t=p.A.splineDef(i,r)}return p.A.splineEval(s,i,r,t)},function(){return i[0]},function(){return i[i.length-1]}]},(i=n.A.copyAttributes(i,t.options,"curve")).curvetype="functiongraph",a=o(),(s=new r.A.Curve(t,["x","x",a[0],a[1],a[2]],i)).setParents(e),s.elType="spline",s},r.A.registerElement("spline",r.A.createSpline),r.A.createCardinalSpline=function(t,e,
1i){var s,o,h,l,c,d,u,f,A,m,b="\nPossible parent types: [points:array, tau:number|function, type:string]";if(!n.A.exists(e[0])||!n.A.isArray(e[0]))throw Error("JSXGraph: JXG.createCardinalSpline: argument 1 'points' has to be array of points or coordinate pairs"+b);if(!n.A.exists(e[1])||!n.A.isNumber(e[1])&&!n.A.isFunction(e[1]))throw Error("JSXGraph: JXG.createCardinalSpline: argument 2 'tau' has to be number between [0,1] or function'"+b);if(c=n.A.exists(e[2])&&n.A.isString(e[2])?e[2]:"uniform",i=n.A.copyAttributes(i,t.options,"curve"),(i=n.A.copyAttributes(i,t.options,"cardinalspline")).curvetype="parameter",d=e[0],u=[],!i.isarrayofcoordinates&&2===d.length&&n.A.isArray(d[0])&&n.A.isArray(d[1])&&d[0].length===d[1].length)for(f=0;f<d[0].length;f++)u[f]=[],n.A.isFunction(d[0][f])?u[f].push(d[0][f]()):u[f].push(d[0][f]),n.A.isFunction(d[1][f])?u[f].push(d[1][f]()):u[f].push(d[1][f]);else for(f=0;f<d.length;f++)n.A.isString(d[f])?u.push(t.select(d[f])):n.A.isPoint(d[f])?u.push(d[f]):n.A.isArray(d[f])&&2===d[f].length?(u[f]=[],n.A.isFunction(d[f][0])?u[f].push(d[f][0]()):u[f].push(d[f][0]),n.A.isFunction(d[f][1])?u[f].push(d[f][1]()):u[f].push(d[f][1])):n.A.isFunction(d[f])&&2===d[f]().length&&u.push(e[f]());if(!0===i.createpoints)h=n.A.providePoints(t,u,i,"cardinalspline",["points"]);else for(f=0,h=[],o=function(t){return{X:function(){return u[t][0]},Y:function(){return u[t][1]},Dist:function(t){var e=this.X()-t.X(),i=this.Y()-t.Y();return a.A.hypot(e,i)}}};f<u.length;f++)n.A.isPoint(u[f])?h.push(u[f]):h.push(o(f));for(l=e[1],m=["x"].concat(p.A.CardinalSpline(h,l,c)),s=new r.A.Curve(t,m,i),A=h.length,s.setParents(h),f=0;f<A;f++)d=h[f],n.A.isPoint(d)&&(n.A.exists(d._is_new)?(s.addChild(d),delete d._is_new):d.addChild(s));return s.elType="cardinalspline",s},r.A.registerElement("cardinalspline",r.A.createCardinalSpline),r.A.createMetapostSpline=function(t,e,i){var s,o,a,h,l,c,d,u,p="\nPossible parent types: [points:array, controls:object";if(!n.A.exists(e[0])||!n.A.isArray(e[0]))throw Error("JSXGraph: JXG.createMetapostSpline: argument 1 'points' has to be array of points or coordinate pairs"+p);if(!n.A.exists(e[1])||!n.A.isObject(e[1]))throw Error("JSXGraph: JXG.createMetapostSpline: argument 2 'controls' has to be a JavaScript object'"+p);if(i=n.A.copyAttributes(i,t.options,"curve"),(i=n.A.copyAttributes(i,t.options,"metapostspline")).curvetype="parameter",l=e[0],c=[],!i.isarrayofcoordinates&&2===l.length&&n.A.isArray(l[0])&&n.A.isArray(l[1])&&l[0].length===l[1].length)for(d=0;d<l[0].length;d++)c[d]=[],n.A.isFunction(l[0][d])?c[d].push(l[0][d]()):c[d].push(l[0][d]),n.A.isFunction(l[1][d])?c[d].push(l[1][d]()):c[d].push(l[1][d]);else for(d=0;d<l.length;d++)n.A.isString(l[d])?c.push(t.select(l[d])):n.A.isPoint(l[d])?c.push(l[d]):n.A.isArray(l[d])&&2===l[d].length?(c[d]=[],n.A.isFunction(l[d][0])?c[d].push(l[d][0]()):c[d].push(l[d][0]),n.A.isFunction(l[d][1])?c[d].push(l[d][1]()):c[d].push(l[d][1])):n.A.isFunction(l[d])&&2===l[d]().length&&c.push(e[d]());if(!0===i.createpoints)a=n.A.providePoints(t,c,i,"metapostspline",["points"]);else for(d=0,a=[],o=function(t){return{X:function(){return c[t][0]},Y:function(){return c[t][1]}}};d<c.length;d++)n.A.isPoint(c[d])?a.push(c[d]):a.push(o);for(h=e[1],(s=new r.A.Curve(t,["t",[],[],0,l.length-1],i)).updateDataArray=function(){var t,e,i=a.length,r=[];for(e=0;e<i;e++)r.push([a[e].X(),a[e].Y()]);t=g.curve(r,h),this.dataX=t[0],this.dataY=t[1]},s.bezierDegree=3,u=a.length,s.setParents(a),d=0;d<u;d++)n.A.isPoint(a[d])&&a[d].addChild(s);return s.elType="metapostspline",s},r.A.registerElement("metapostspline",r.A.createMetapostSpline),r.A.createRiemannsum=function(t,e,i){var r,s,o,a,h,l;if((l=n.A.copyAttributes(i,t.options,"riemannsum")).curvetype="plot",o=e[0],r=n.A.createFunction(e[1],t,""),!n.A.exists(r))throw Error("JSXGraph: JXG.createRiemannsum: argument '2' n has to be number or function.\nPossible parent types: [function,n:number|function,type,start:number|function,end:number|function]");if("string"==typeof e[2]&&(e[2]="'"+e[2]+"'"),s=n.A.createFunction(e[2],t,""),!n.A.exists(s))throw Error("JSXGraph: JXG.createRiemannsum: argument 3 'type' has to be string or function.\nPossible parent types: [function,n:number|function,type,start:number|function,end:number|function]");return a=[[0],[0]].concat(e.slice(3)),(h=t.create("curve",a,l)).sum=0,h.Value=function(){return this.sum},h.updateDataArray=function(){var t=p.A.riemann(o,r(),s(),this.minX(),this.maxX());this.dataX=t[0],this.dataY=t[1],this.sum=t[2]},h.addParentsFromJCFunctions([r,s]),h},r.A.registerElement("riemannsum",r.A.createRiemannsum),r.A.createTracecurve=function(t,e,
1i){var r,s,a,h;if(2!==e.length)throw Error("JSXGraph: Can't create trace curve with given parent'\nPossible parent types: [glider, point]");if(s=t.select(e[0]),a=t.select(e[1]),s.type!==o.A.OBJECT_TYPE_GLIDER||!n.A.isPoint(a))throw Error("JSXGraph: Can't create trace curve with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [glider, point]");return(h=n.A.copyAttributes(i,t.options,"tracecurve")).curvetype="plot",(r=t.create("curve",[[0],[0]],h)).updateDataArray=function(){var t,e,i,r,n,h,l,c,d,u=this.visProp.numberpoints,p=s.position,f=s.slideObject,A=f.minX();for(e=(f.maxX()-A)/u,this.dataX=[],this.dataY=[],f.elementClass!==o.A.OBJECT_CLASS_CURVE&&u++,t=0;t<u;t++){for(r in i=A+t*e,h=f.X(i)/f.Z(i),l=f.Y(i)/f.Z(i),s.setPositionDirectly(o.A.COORDS_BY_USER,[h,l]),c=!1,this.board.objects)if(this.board.objects.hasOwnProperty(r)&&((n=this.board.objects[r])===s&&(c=!0),c&&n.needsRegularUpdate)&&(d=n.visProp.trace,n.visProp.trace=!1,n.needsUpdate=!0,n.update(!0),n.visProp.trace=d,n===a))break;this.dataX[t]=a.X(),this.dataY[t]=a.Y()}for(r in s.position=p,c=!1,this.board.objects)if(this.board.objects.hasOwnProperty(r)&&((n=this.board.objects[r])===s&&(c=!0),c&&n.needsRegularUpdate)&&(d=n.visProp.trace,n.visProp.trace=!1,n.needsUpdate=!0,n.update(!0),n.visProp.trace=d,n===a))break},r},r.A.registerElement("tracecurve",r.A.createTracecurve),r.A.createStepfunction=function(t,e,i){var r,s;if(2!==e.length)throw Error("JSXGraph: Can't create step function with given parent'\nPossible parent types: [array, array|function]");return s=n.A.copyAttributes(i,t.options,"stepfunction"),(r=t.create("curve",e,s)).updateDataArray=function(){var t,e=0,i=this.xterm.length;if(this.dataX=[],this.dataY=[],0!==i)for(this.dataX[e]=this.xterm[0],this.dataY[e]=this.yterm[0],++e,t=1;t<i;++t)this.dataX[e]=this.xterm[t],this.dataY[e]=this.dataY[e-1],++e,this.dataX[e]=this.xterm[t],this.dataY[e]=this.yterm[t],++e},r},r.A.registerElement("stepfunction",r.A.createStepfunction),r.A.createDerivative=function(t,e,i){var r,s,a,h,l;if(1!==e.length&&e[0].class!==o.A.OBJECT_CLASS_CURVE)throw Error("JSXGraph: Can't create derivative curve with given parent'\nPossible parent types: [curve]");return l=n.A.copyAttributes(i,t.options,"curve"),s=e[0],a=p.A.D(s.X),h=p.A.D(s.Y),(r=t.create("curve",[function(t){return s.X(t)},function(t){return h(t)/a(t)},s.minX(),s.maxX()],l)).setParents(s),r},r.A.registerElement("derivative",r.A.createDerivative),r.A.createCurveIntersection=function(t,e,i){var r;if(2!==e.length)throw Error("JSXGraph: Can't create curve intersection with given parent'\nPossible parent types: [array, array|function]");return(r=t.create("curve",[[],[]],i)).updateDataArray=function(){var t=v.intersection(e[0],e[1],this.board);this.dataX=t[0],this.dataY=t[1]},r},r.A.createCurveUnion=function(t,e,i){var r;if(2!==e.length)throw Error("JSXGraph: Can't create curve union with given parent'\nPossible parent types: [array, array|function]");return(r=t.create("curve",[[],[]],i)).updateDataArray=function(){var t=v.union(e[0],e[1],this.board);this.dataX=t[0],this.dataY=t[1]},r},r.A.createCurveDifference=function(t,e,i){var r;if(2!==e.length)throw Error("JSXGraph: Can't create curve difference with given parent'\nPossible parent types: [array, array|function]");return(r=t.create("curve",[[],[]],i)).updateDataArray=function(){var t=v.difference(e[0],e[1],this.board);this.dataX=t[0],this.dataY=t[1]},r},r.A.registerElement("curvedifference",r.A.createCurveDifference),r.A.registerElement("curveintersection",r.A.createCurveIntersection),r.A.registerElement("curveunion",r.A.createCurveUnion),r.A.createBoxPlot=function(t,e,i){var r,s,o,a=n.A.copyAttributes(i,t.options,"boxplot");if(3!==e.length)throw Error("JSXGraph: Can't create box plot with given parent'\nPossible parent types: [array, number|function, number|function] containing quantiles, axis, width");if(e[0].length<5)throw Error("JSXGraph: Can't create box plot with given parent[0]'\nparent[0] has to contain at least 5 quantiles.");for(s=0,r=t.create("curve",[[],[]],a),o=e[0].length,r.Q=[];s<o;s++)r.Q[s]=n.A.createFunction(e[0][s],t);return r.x=n.A.createFunction(e[1],t),r.w=n.A.createFunction(e[2],t),r.updateDataArray=function(){var t,e,i,r,s,o,n,a,h;n=this.evalVisProp("smallwidth"),a=this.evalVisProp("dir"),i=(h=this.x())-.5*this.w(),r=h-.5*this.w()*n,s=h+.5*this.w(),o=h+.5*this.w()*n,t=[h,r,o,h,h,i,i,s,s,h,NaN,i,s,NaN,h,h,r,o,h],e=[this.Q[0](),this.Q[0](),this.Q[0](),this.Q[0](),this.Q[1](),this.Q[1](),this.Q[3](),this.Q[3](),this.Q[1](),this.Q[1](),NaN,this.Q[2](),this.Q[2](),NaN,this.Q[3](),this.Q[4](),this.Q[4](),this.Q[4](),this.Q[4]()],"vertical"===a?(this.dataX=t,this.dataY=e):(this.dataX=e,this.dataY=t)},r.addParentsFromJCFunctions([r.Q,r.x,r.w]),r},r.A.registerElement("boxplot",r.A.createBoxPlot),r.A.createImplicitCurve=function(t,e,
1i){var r,s;if(0>[1,3,5].indexOf(e.length))throw Error("JSXGraph: Can't create curve implicitCurve with given parent'\nPossible parent types: [f], [f, rangex, rangey], [f, dfx, dfy] or [f, dfx, dfy, rangex, rangey]\nwith functions f, dfx, dfy and arrays of length 2 rangex, rangey.");return s=n.A.copyAttributes(i,t.options,"implicitcurve"),(r=t.create("curve",[[],[]],s)).f=n.A.createFunction(e[0],t,"x, y"),5===e.length||n.A.isString(e[1])||n.A.isFunction(e[1])?r.dfx=n.A.createFunction(e[1],t,"x, y"):r.dfx=null,5===e.length||n.A.isString(e[2])||n.A.isFunction(e[2])?r.dfy=n.A.createFunction(e[2],t,"x, y"):r.dfy=null,r.domain=null,5===e.length?r.domain=[e[3],e[4]]:3===e.length&&(r.domain=[e[1],e[2]]),r.updateDataArray=function(){var t,e,i,r,s,o,a=[];null===this.domain?(o=this.evalVisProp("margin"),t=this.board.getBoundingBox(),t[0]-=o,t[1]+=o,t[2]+=o,t[3]-=o):(e=n.A.evaluate(this.domain[0]),i=n.A.evaluate(this.domain[1]),t=[e[0],i[1],e[1],i[0]]),s={resolution_out:Math.max(.01,this.evalVisProp("resolution_outer")),resolution_in:Math.max(.01,this.evalVisProp("resolution_inner")),max_steps:this.evalVisProp("max_steps"),alpha_0:this.evalVisProp("alpha_0"),tol_u0:this.evalVisProp("tol_u0"),tol_newton:this.evalVisProp("tol_newton"),tol_cusp:this.evalVisProp("tol_cusp"),tol_progress:this.evalVisProp("tol_progress"),qdt_box:this.evalVisProp("qdt_box"),kappa_0:this.evalVisProp("kappa_0"),delta_0:this.evalVisProp("delta_0"),h_initial:this.evalVisProp("h_initial"),h_critical:this.evalVisProp("h_critical"),h_max:this.evalVisProp("h_max"),loop_dist:this.evalVisProp("loop_dist"),loop_dir:this.evalVisProp("loop_dir"),loop_detection:this.evalVisProp("loop_detection"),unitX:this.board.unitX,unitY:this.board.unitY},this.dataX=[],this.dataY=[],r=new b(t,s,this.f,this.dfx,this.dfy),this.qdt=r.qdt,a=r.plot(),this.dataX=a[0],this.dataY=a[1]},r.elType="implicitcurve",r},r.A.registerElement("implicitcurve",r.A.createImplicitCurve),r.A.Curve,r.A.createArc=function(t,e,i){var s,h,l;if(!1===(l=n.A.providePoints(t,e,i,"arc",["center","radiuspoint","anglepoint"]))||l.length<3)throw Error("JSXGraph: Can't create Arc with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"' and '"+typeof e[2]+"'.\nPossible parent types: [point,point,point], [arc, transformation]");return h=n.A.copyAttributes(i,t.options,"arc"),(s=t.create("curve",[[0],[0],0,4],h)).elType="arc",s.setParents(l),s.type=o.A.OBJECT_TYPE_ARC,s.center=l[0],s.radiuspoint=l[1],s.point2=s.radiuspoint,s.anglepoint=l[2],s.point3=s.anglepoint,n.A.exists(s.center._is_new)?(s.addChild(s.center),delete s.center._is_new):s.center.addChild(s),n.A.exists(s.radiuspoint._is_new)?(s.addChild(s.radiuspoint),delete s.radiuspoint._is_new):s.radiuspoint.addChild(s),n.A.exists(s.anglepoint._is_new)?(s.addChild(s.anglepoint),delete s.anglepoint._is_new):s.anglepoint.addChild(s),s.useDirection=h.usedirection,s.updateDataArray=function(){var t,e,i,r,s,o=1,n=this.radiuspoint,a=this.center,h=this.anglepoint,d=this.evalVisProp("selection");e=c.A.rad(n,a,h),("minor"===d&&e>Math.PI||"major"===d&&e<Math.PI)&&(o=-1),this.useDirection&&(i=l[1].coords.usrCoords,r=l[3].coords.usrCoords,s=l[2].coords.usrCoords,(i[1]-s[1])*(i[2]-r[2])-(i[2]-s[2])*(i[1]-r[1])<0?(this.radiuspoint=l[1],this.anglepoint=l[2]):(this.radiuspoint=l[2],this.anglepoint=l[1])),n=n.coords.usrCoords,a=a.coords.usrCoords,h=h.coords.usrCoords,t=c.A.bezierArc(n,a,h,!1,o),this.dataX=t[0],this.dataY=t[1],this.bezierDegree=3,this.updateStdform(),this.updateQuadraticform()},s.Radius=function(){return this.radiuspoint.Dist(this.center)},s.getRadius=function(){return r.A.deprecated("Arc.getRadius()","Arc.Radius()"),this.Radius()},s.Value=function(t,e){var i;return e=e||c.A.rad(this.radiuspoint,this.center,this.anglepoint),""===(t=(t=t||"length").toLocaleLowerCase())||0===t.indexOf("len")?i=e*this.Radius():0===t.indexOf("rad")?i=e:0===t.indexOf("deg")?i=180*e/Math.PI:0===t.indexOf("sem")?i=e/Math.PI:0===t.indexOf("cir")&&(i=.5*e/Math.PI),i},s.L=function(){return this.Value("length")},s.hasPoint=function(t,e){var i,r,s,h,l,d,u=this.Radius();return this.evalVisProp("hasinnerpoints")?this.hasPointSector(t,e):(n.A.isObject(this.evalVisProp("precision"))?(d=this.board._inputDevice,l=this.evalVisProp("precision."+d)):l=this.board.options.precision.hasPoint,l/=Math.min(Math.abs(this.board.unitX),Math.abs(this.board.unitY)),i=new f.A(o.A.COORDS_BY_SCREEN,[t,e],this.board),this.transformations.length>0&&(this.updateTransformMatrix(),s=a.A.inverse(this.transformMat),h=a.A.matVecMult(s,i.usrCoords),i=new f.A(o.A.COORDS_BY_USER,h,this.board)),(r=Math.abs(this.center.coords.distance(o.A.COORDS_BY_USER,i)-u)<l)&&(r=c.A.coordsOnArc(this,i)),r)},s.hasPointSector=function(t,e){var i=new f.A(o.A.COORDS_BY_SCREEN,[t,e],this.board),r=this.Radius(),s=this.center.coords.distance(o.A.COORDS_BY_USER,i)<r;return s&&(s=c.A.coordsOnArc(this,i)),s},s.getTextAnchor=function(){return this.center.coords},s.getLabelAnchor=function(){var t,e,i,r,s,h=this.label.evalVisProp("position"),l=c.A.rad(this.radiuspoint,this.center,this.anglepoint),d=10/this.board.unitX,u=10/this.board.unitY,p=this.point2.coords.usrCoords,A=this.center.coords.usrCoords,m=p[1]-A[1],b=p[2]-A[2],g=this.evalVisProp("selection"),v=this.label?this.label.visProp:this.visProp.label;return!n.A.isString(h)||0>h.indexOf("right")&&0>h.indexOf("left")?(("minor"===g&&l>Math.PI||"major"===g&&l<Math.PI)&&(l=-(2*Math.PI-l)),i=(t=new f.A(o.A.COORDS_BY_USER,[A[1]+Math.cos(.5*l)*m-Math.sin(.5*l)*b,A[2]+Math.sin(.5*l)*m+Math.cos(.5*l)*b],this.board)).usrCoords[1]-A[1],r=t.usrCoords[2]-A[2],s=a.A.hypot(i,r),i=i*(s+d)/s,r=r*(s+u)/s,e=[A[1]+i,A[2]+r],v.position=c.A.calcLabelQuadrant(c.A.rad([1,0],[0,0],e)),new f.A(o.A.COORDS_BY_USER,e,this.board)):this.getLabelPosition(h,this.label.evalVisProp("distance"))},s.updateQuadraticform=X.prototype.updateQuadraticform,s.updateStdform=X.prototype.updateStdform,s.methodMap=r.A.deepCopy(s.methodMap,{getRadius:"getRadius",radius:"Radius",Radius:"Radius",center:"center",radiu
1spoint:"radiuspoint",anglepoint:"anglepoint",Value:"Value",L:"L"}),s.prepareUpdate().update(),s},r.A.registerElement("arc",r.A.createArc),r.A.createSemicircle=function(t,e,i){var r,s,o,a;if(!1===(a=n.A.providePoints(t,e,i,"point"))||2!==a.length)throw Error("JSXGraph: Can't create Semicircle with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [point,point]");return o=n.A.copyAttributes(i,t.options,"semicircle","center"),(s=t.create("midpoint",a,o)).dump=!1,o=n.A.copyAttributes(i,t.options,"semicircle"),(r=t.create("arc",[s,a[1],a[0]],o)).elType="semicircle",r.setParents([a[0].id,a[1].id]),r.subs={midpoint:s},r.inherits.push(s),r.midpoint=r.center=s,r},r.A.registerElement("semicircle",r.A.createSemicircle),r.A.createCircumcircleArc=function(t,e,i){var r,s,o,a;if(!1===(a=n.A.providePoints(t,e,i,"point"))||3!==a.length)throw Error("JSXGraph: create Circumcircle Arc with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"' and '"+typeof e[2]+"'.\nPossible parent types: [point,point,point]");return o=n.A.copyAttributes(i,t.options,"circumcirclearc","center"),(s=t.create("circumcenter",a,o)).dump=!1,(o=n.A.copyAttributes(i,t.options,"circumcirclearc")).usedirection=!0,(r=t.create("arc",[s,a[0],a[2],a[1]],o)).elType="circumcirclearc",r.setParents([a[0].id,a[1].id,a[2].id]),r.subs={center:s},r.inherits.push(s),r.center=s,r},r.A.registerElement("circumcirclearc",r.A.createCircumcircleArc),r.A.createMinorArc=function(t,e,i){return i.selection="minor",r.A.createArc(t,e,i)},r.A.registerElement("minorarc",r.A.createMinorArc),r.A.createMajorArc=function(t,e,i){return i.selection="major",r.A.createArc(t,e,i)},r.A.registerElement("majorarc",r.A.createMajorArc),r.A.createSector=function(t,e,i){var s,h,l,d,u,p,m=1e-14,b="invalid",g=["center","radiusPoint","anglePoint"];if(e[0].elementClass===o.A.OBJECT_CLASS_LINE&&e[1].elementClass===o.A.OBJECT_CLASS_LINE&&(n.A.isArray(e[2])||n.A.isNumber(e[2]))&&(n.A.isArray(e[3])||n.A.isNumber(e[3]))&&(n.A.isNumber(e[4])||n.A.isFunction(e[4])||n.A.isString(e[4])))b="2lines";else{if(!1===(p=n.A.providePoints(t,e,i,"sector",g)))throw Error("JSXGraph: Can't create Sector with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"' and '"+typeof e[2]+"'.");b="3points"}if(h=n.A.copyAttributes(i,t.options,"sector"),(s=t.create("curve",[[0],[0],0,6],h)).type=o.A.OBJECT_TYPE_SECTOR,s.elType="sector",s.autoRadius=function(){var t=20/s.board.unitX,e=1/0,i=50/s.board.unitX;return n.A.isPoint(s.center)&&(e=.3333*s.center.Dist(s.point2)),Math.max(t,Math.min(e,i))},"2lines"===b)s.Radius=function(){var t=n.A.evaluate(e[4]);return"auto"===t?this.autoRadius():t},s.line1=t.select(e[0]),s.line2=t.select(e[1]),s.line1.addChild(s),s.line2.addChild(s),s.setParents(e),s.point1={visProp:{}},s.point2={visProp:{}},s.point3={visProp:{}},d=c.A.meetLineLine(s.line1.stdform,s.line2.stdform,0,t),c.A.distance(d.usrCoords,[0,0,0],3)<m&&(s.line1.point1.Dist(s.line2.point1)<m||s.line1.point1.Dist(s.line2.point2)<m?d=s.line1.point1.coords:s.line1.point2.Dist(s.line2.point1)<m||s.line1.point2.Dist(s.line2.point1)<m?d=s.line1.point2.coords:console.log("JSXGraph warning: Can't create Sector from parallel lines with no common defining point.")),n.A.isArray(e[2])?(2===e[2].length&&(e[2]=[1].concat(e[2])),u=c.A.projectPointToLine({coords:{usrCoords:e[2]}},s.line1,t),u=A.A.subtract(u.usrCoords,d.usrCoords),s.direction1=a.A.innerProduct(u,[0,s.line1.stdform[2],-s.line1.stdform[1]],3)>=0?1:-1):s.direction1=e[2]>=0?1:-1,n.A.isArray(e[3])?(2===e[3].length&&(e[3]=[1].concat(e[3])),u=c.A.projectPointToLine({coords:{usrCoords:e[3]}},s.line2,t),u=A.A.subtract(u.usrCoords,d.usrCoords),s.direction2=a.A.innerProduct(u,[0,s.line2.stdform[2],-s.line2.stdform[1]],3)>=0?1:-1):s.direction2=e[3]>=0?1:-1,s.methodMap=r.A.deepCopy(s.methodMap,{arc:"arc",center:"center",line1:"line1",line2:"line2"}),s.updateDataArray=function(){var t,e,i,r,n=1e-14,h=[0,0,0],l=[0,0,0],d=[0,0,0];if(e=this.line1,i=this.line2,l=a.A.crossProduct(e.stdform,i.stdform),c.A.distance(l,[0,0,0],3)<n&&(e.point1.Dist(i.point1)<n||e.point1.Dist(i.point2)<n?l=e.point1.coords.usrCoords:(e.point2.Dist(i.point1)<n||e.point2.Dist(i.point1)<n)&&(l=e.point2.coords.usrCoords)),Math.abs(l[0])>n&&(l[1]/=l[0],l[2]/=l[0],l[0]/=l[0]),t=this.direction1*this.Radius(),h=A.A.add(l,[0,t*e.stdform[2],-t*e.stdform[1]]),t=this.direction2*this.Radius(),d=A.A.add(l,[0,t*i.stdform[2],-t*i.stdform[1]]),this.point2.coords=new f.A(o.A.COORDS_BY_USER,h,s.board),this.point1.coords=new f.A(o.A.COORDS_BY_USER,l,s.board),this.point3.coords=new f.A(o.A.COORDS_BY_USER,d,s.board),Math.abs(h[0])<a.A.eps||Math.abs(l[0])<a.A.eps||Math.abs(d[0])<a.A.eps){this.dataX=[NaN],this.dataY=[NaN];return}r=c.A.bezierArc(h,l,d,!0,1),this.dataX=r[0],this.dataY=r[1],this.bezierDegree=3};else if("3points"===b){for(l=0,s.point1=p[0],s.point2=p[1],s.point3=p[2];l<3;l++)n.A.exists(p[l]._is_new)?(s.addChild(p[l]),delete p[l]._is_new):p[l].addChild(s);s.useDirection=i.usedirection,s.setParents(p),n.A.exists(p[3])&&(s.point4=p[3],s.point4.addChild(s)),s.methodMap=r.A.deepCopy(s.methodMap,{arc:"arc",center:"center",radiu
1spoint:"radiuspoint",anglepoint:"anglepoint"}),s.updateDataArray=function(){var t,e,i,r,s,o=this.point2,a=this.point1,h=this.point3,l=1,d=this.evalVisProp("selection");if(!o.isReal||!a.isReal||!h.isReal){this.dataX=[NaN],this.dataY=[NaN];return}s=c.A.rad(o,a,h),("minor"===d&&s>Math.PI||"major"===d&&s<Math.PI)&&(l=-1),this.useDirection&&n.A.exists(this.point4)&&(e=this.point2.coords.usrCoords,i=this.point4.coords.usrCoords,r=this.point3.coords.usrCoords,(e[1]-r[1])*(e[2]-i[2])-(e[2]-r[2])*(e[1]-i[1])>=0&&(h=this.point2,o=this.point3)),o=o.coords.usrCoords,a=a.coords.usrCoords,h=h.coords.usrCoords,t=c.A.bezierArc(o,a,h,!0,l),this.dataX=t[0],this.dataY=t[1],this.bezierDegree=3},s.Radius=function(){return this.point2.Dist(this.point1)}}return s.center=s.point1,s.radiuspoint=s.point2,s.anglepoint=s.point3,h=n.A.copyAttributes(i,t.options,"arc"),(h=n.A.copyAttributes(h,t.options,"sector","arc")).withlabel=!1,h.selection=s.visProp.selection,h.name+="_arc","2lines"===b?(s.updateDataArray(),s.arc=t.create("arc",[function(){return s.point1.coords.usrCoords},function(){var t=s.point2.coords.distance(o.A.COORDS_BY_USER,s.point1.coords);return 0===t?[s.point1.coords.usrCoords[1],s.point1.coords.usrCoords[2]]:[s.point1.coords.usrCoords[1]+s.Radius()*(s.point2.coords.usrCoords[1]-s.point1.coords.usrCoords[1])/t,s.point1.coords.usrCoords[2]+s.Radius()*(s.point2.coords.usrCoords[2]-s.point1.coords.usrCoords[2])/t]},function(){return s.point3.coords.usrCoords}],h)):s.arc=t.create("arc",[s.point1,function(){var t=s.point2.Dist(s.point1);return 0===t?[s.point1.X(),s.point1.Y()]:[s.point1.X()+s.Radius()*(s.point2.X()-s.point1.X())/t,s.point1.Y()+s.Radius()*(s.point2.Y()-s.point1.Y())/t]},s.point3],h),s.addChild(s.arc),s.hasPointCurve=function(t,e){var i,r,s,a,h,l,d=new f.A(o.A.COORDS_BY_SCREEN,[t,e],this.board),u=this.Radius(),p=this.center.coords.distance(o.A.COORDS_BY_USER,d),A=this.evalVisProp("selection");return n.A.isObject(this.evalVisProp("precision"))?(h=this.board._inputDevice,a=this.evalVisProp("precision."+h)):a=this.board.options.precision.hasPoint,a/=Math.min(Math.abs(this.board.unitX),Math.abs(this.board.unitY)),(l=Math.abs(p-u)<a)&&(i=c.A.rad(this.point2,this.center,d.usrCoords.slice(1)),r=0,s=c.A.rad(this.point2,this.center,this.point3),("minor"===A&&s>Math.PI||"major"===A&&s<Math.PI)&&(r=s,s=2*Math.PI),(i<r||i>s)&&(l=!1)),l},s.hasPointSector=function(t,e){var i,r,s,n=new f.A(o.A.COORDS_BY_SCREEN,[t,e],this.board),a=this.Radius(),h=this.point1.coords.distance(o.A.COORDS_BY_USER,n)<a,l=this.evalVisProp("selection");return h&&(i=c.A.rad(this.radiuspoint,this.center,n.usrCoords.slice(1)),r=0,s=c.A.rad(this.radiuspoint,this.center,this.anglepoint),("minor"===l&&s>Math.PI||"major"===l&&s<Math.PI)&&(r=s,s=2*Math.PI),(i<r||i>s)&&(h=!1)),h},s.hasPoint=function(t,e){return this.evalVisProp("highlightonsector")||this.evalVisProp("hasinnerpoints")?this.hasPointSector(t,e):this.hasPointCurve(t,e)},s.getTextAnchor=function(){return this.point1.coords},s.getLabelAnchor=function(){var t,e,i,r,s,h=this.label.evalVisProp("position"),l=c.A.rad(this.point2,this.point1,this.point3),d=13/this.board.unitX,u=13/this.board.unitY,p=this.point2.coords.usrCoords,A=this.point1.coords.usrCoords,m=p[1]-A[1],b=p[2]-A[2],g=this.evalVisProp("selection"),v=this.label?this.label.visProp:this.visProp.label;return!n.A.isString(h)||0>h.indexOf("right")&&0>h.indexOf("left")?(("minor"===g&&l>Math.PI||"major"===g&&l<Math.PI)&&(l=-(2*Math.PI-l)),i=(t=new f.A(o.A.COORDS_BY_USER,[A[1]+Math.cos(.5*l)*m-Math.sin(.5*l)*b,A[2]+Math.sin(.5*l)*m+Math.cos(.5*l)*b],this.board)).usrCoords[1]-A[1],r=t.usrCoords[2]-A[2],s=a.A.hypot(i,r),i=i*(s+d)/s,r=r*(s+u)/s,e=[A[1]+i,A[2]+r],v.position=c.A.calcLabelQuadrant(c.A.rad([1,0],[0,0],e)),new f.A(o.A.COORDS_BY_USER,e,this.board)):this.getLabelPosition(h,this.label.evalVisProp("distance"))},s.setRadius=function(t){var e,i=n.A.evaluate(t);"undefined"!=(e="auto"===t||"auto"===i?"auto":n.A.isNumber(t)?"number":n.A.isFunction(t)&&!n.A.isString(i)?"function":"undefined")&&(this.visProp.radius=t),s.Radius=function(){var e=n.A.evaluate(t);return"auto"===e?this.autoRadius():e}},s.getRadius=function(){return r.A.deprecated("Sector.getRadius()","Sector.Radius()"),this.Radius()},s.Value=function(t){return this.arc.Value(t)},s.L=function(){return this.arc.L()},s.Area=function(){var t=this.Radius();return .5*t*t*this.Value("radians")},s.Perimeter=function(){return this.L()+2*this.Radius()}
1,"3points"===b&&(s.setPositionDirectly=function(t,e,i){var r,o=new f.A(t,e,this.board),n=new f.A(t,i,this.board);return s.point1.draggable()&&s.point2.draggable()&&s.point3.draggable()&&(r=A.A.subtract(o.usrCoords,n.usrCoords),this.board.create("transform",r.slice(1),{type:"translate"}).applyOnce([s.point1,s.point2,s.point3])),this}),s.methodMap=r.A.deepCopy(s.methodMap,{radius:"Radius",Radius:"Radius",getRadius:"Radius",setRadius:"setRadius",Value:"Value",L:"L",Area:"Area",Perimeter:"Perimeter"}),s},r.A.registerElement("sector",r.A.createSector),r.A.createCircumcircleSector=function(t,e,i){var r,s,o,a;if(!1===(a=n.A.providePoints(t,e,i,"point")))throw Error("JSXGraph: Can't create circumcircle sector with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"' and '"+typeof e[2]+"'.");return(s=t.create("circumcenter",a.slice(0,3),o)).dump=!1,o=n.A.copyAttributes(i,t.options,"circumcirclesector"),(r=t.create("sector",[s,a[0],a[2],a[1]],o)).elType="circumcirclesector",r.setParents(a),r.center=s,r.subs={center:s},r},r.A.registerElement("circumcirclesector",r.A.createCircumcircleSector),r.A.createMinorSector=function(t,e,i){return i.selection="minor",r.A.createSector(t,e,i)},r.A.registerElement("minorsector",r.A.createMinorSector),r.A.createMajorSector=function(t,e,i){return i.selection="major",r.A.createSector(t,e,i)},r.A.registerElement("majorsector",r.A.createMajorSector),r.A.createAngle=function(t,e,i){var r,s,h,l,d,u,p="invalid";if(e[0].elementClass===o.A.OBJECT_CLASS_LINE&&e[1].elementClass===o.A.OBJECT_CLASS_LINE&&(n.A.isArray(e[2])||n.A.isNumber(e[2]))&&(n.A.isArray(e[3])||n.A.isNumber(e[3]))
1)p="2lines";else{if(h={name:""},!1===(u=n.A.providePoints(t,e,h,"point")))throw Error("JSXGraph: Can't create angle with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"' and '"+typeof e[2]+"'.");p="3points"}if(h=n.A.copyAttributes(i,t.options,"angle"),n.A.exists(h.name)||(h.name=t.generateName({type:o.A.OBJECT_TYPE_ANGLE})),s=n.A.exists(h.radius)?h.radius:0,t.suspendUpdate(),"2lines"===p?(e.push(s),(r=t.create("sector",e,h)).updateDataArraySector=r.updateDataArray,r.setAngle=function(t){},r.free=function(t){}):((r=t.create("sector",[u[1],u[0],u[2]],h)).arc.visProp.priv=!0,r.point=r.point2=r.radiuspoint=u[0],r.pointsquare=r.point3=r.anglepoint=u[2],r.Radius=function(){var t=n.A.evaluate(s);return"auto"===t?r.autoRadius():t},r.updateDataArraySector=function(){var t,e,i=this.point2,r=this.point1,s=this.point3,o=this.Radius(),n=r.Dist(i),a=1,h=this.evalVisProp("selection");e=c.A.rad(i,r,s),("minor"===h&&e>Math.PI||"major"===h&&e<Math.PI)&&(a=-1),i=i.coords.usrCoords,r=r.coords.usrCoords,s=s.coords.usrCoords,i=[1,r[1]+(i[1]-r[1])*o/n,r[2]+(i[2]-r[2])*o/n],s=[1,r[1]+(s[1]-r[1])*o/n,r[2]+(s[2]-r[2])*o/n],t=c.A.bezierArc(i,r,s,!0,a),this.dataX=t[0],this.dataY=t[1],this.bezierDegree=3},r.setAngle=function(t){var e,i,r,s=this.anglepoint,h=this.radiuspoint;return s.draggable()&&(e=this.board.create("transform",[t,this.center],{type:"rotate"}),s.addTransform(h,e),e.update(),s.moveTo(a.A.matVecMult(e.matrix,h.coords.usrCoords)),r=n.A.isFunction(t)?function(){return 2*Math.PI-t()}:function(){return 2*Math.PI-t},i=this.board.create("transform",[r,this.center],{type:"rotate"}),s.coords.on("update",function(){i.update(),h.setPositionDirectly(o.A.COORDS_BY_USER,a.A.matVecMult(i.matrix,s.coords.usrCoords))}),s.setParents(h),this.hasFixedAngle=!0),this},r.free=function(){var t=this.anglepoint;return t.transformations.length>0&&(t.transformations.pop(),t.isDraggable=!0,t.parents=[],t.coords.off("update")),this.hasFixedAngle=!1,this},r.setParents(u)),n.A.exists(r.visProp.text)&&r.label.setText(r.evalVisProp("text")),r.elType="angle",r.type=o.A.OBJECT_TYPE_ANGLE,r.subs={},r.updateDataArraySquare=function(){var t,e,i,r,s,o,n,h,l=this.Radius();"2lines"===p&&this.updateDataArraySector(),t=this.point2,e=this.point1,i=this.point3,t=t.coords.usrCoords,e=e.coords.usrCoords,i=i.coords.usrCoords,r=c.A.distance(t,e,3),s=c.A.distance(i,e,3),t=[1,e[1]+(t[1]-e[1])*l/r,e[2]+(t[2]-e[2])*l/r],i=[1,e[1]+(i[1]-e[1])*l/s,e[2]+(i[2]-e[2])*l/s],o=a.A.crossProduct(i,e),n=[-t[1]*o[1]-t[2]*o[2],t[0]*o[1],t[0]*o[2]],o=a.A.crossProduct(t,e),h=[-i[1]*o[1]-i[2]*o[2],i[0]*o[1],i[0]*o[2]],o=a.A.crossProduct(n,h),o[1]/=o[0],o[2]/=o[0],this.dataX=[e[1],t[1],o[1],i[1],e[1]],this.dataY=[e[2],t[2],o[2],i[2],e[2]],this.bezierDegree=1},r.updateDataArrayNone=function(){this.dataX=[NaN],this.dataY=[NaN],this.bezierDegree=1},r.updateDataArray=function(){var t=this.evalVisProp("type"),e=c.A.trueAngle(this.point2,this.point1,this.point3),i=this.evalVisProp("selection");("minor"===i&&e>180||"major"===i&&e<180)&&(e=360-e),Math.abs(e-90)<this.evalVisProp("orthosensitivity")+a.A.eps&&(t=this.evalVisProp("orthotype")),"none"===t?(this.updateDataArrayNone(),this.maxX=function(){return 0}):"square"===t?(this.updateDataArraySquare(),this.maxX=function(){return 4}):"sector"===t?(this.updateDataArraySector(),this.maxX=function(){return 6}):"sectordot"===t&&(this.updateDataArraySector(),this.maxX=function(){return 6},this.dot.visProp.visible||this.dot.setAttribute({visible:!0})),(!this.visProp.visible||"sectordot"!==t&&this.dot.visProp.visible)&&this.dot.setAttribute({visible:!1})},l=n.A.copyAttributes(i,t.options,"angle","dot"),r.dot=t.create("point",[function(){var t,e,i,s,o,h,l,d,u;return n.A.exists(r.dot)&&!r.dot.visProp.visible?[0,0]:(t=r.point2.coords.usrCoords,e=r.point1.coords.usrCoords,i=r.Radius(),s=c.A.distance(t,e,3),o=c.A.rad(r.point2,r.point1,r.point3),("minor"===(u=r.evalVisProp("selection"))&&o>Math.PI||"major"===u&&o<Math.PI)&&(o=-(2*Math.PI-o)),o*=.5,h=Math.cos(o),l=Math.sin(o),t=[1,e[1]+(t[1]-e[1])*i/s,e[2]+(t[2]-e[2])*i/s],d=[[1,0,0],[e[1]-.5*e[1]*h+.5*e[2]*l,.5*h,-(.5*l)],[e[2]-.5*e[1]*l-.5*e[2]*h,.5*l,.5*h]],a.A.matVecMult(d,t))}],l),r.dot.dump=!1,r.subs.dot=r.dot,"2lines"===p)for(d=0;d<2;d++)t.select(e[d]).addChild(r.dot);else for(d=0;d<3;d++)t.select(u[d]).addChild(r.dot);return t.unsuspendUpdate(),r.Value=function(t){return""===(t=t||"radians")&&(t="radians"),r.arc.Value(t)},r.getLabelAnchor=function(){var t,e,i,s,h,l,d,u,p,A=12,m=r.evalVisProp("selection"),b=this.label.evalVisProp("position"),g=this.label?this.label.visProp:this.visProp.label;return!n.A.isString(b)||0>b.indexOf("right")&&0>b.indexOf("left")?(n.A.exists(this.label)&&n.A.exists(this.label.visProp.fontsize)&&(A=this.label.evalVisProp("fontsize")),A/=this.board.unitX,e=r.point2.coords.usrCoords,i=r.point1.coords.usrCoords,s=r.Radius(),h=c.A.distance(e,i,3),l=c.A.rad(r.point2,r.point1,r.point3),("minor"===m&&l>Math.PI||"major"===m&&l<Math.PI)&&(l=-(2*Math.PI-l)),l*=.5,d=Math.cos(l),u=Math.sin(l),e=[1,i[1]+(e[1]-i[1])*s/h,i[2]+(e[2]-i[2])*s/h],p=[[1,0,0],[i[1]-.5*i[1]*d+.5*i[2]*u,.5*d,-(.5*u)],[i[2]-.5*i[1]*u-.5*i[2]*d,.5*u,.5*d]],t=a.A.matVecMult(p,e),t[1]/=t[0],t[2]/=t[0],t[0]/=t[0],h=c.A.distance(t,i,3),t=[t[0],i[1]+(t[1]-i[1])*(s+A)/h,i[2]+(t[2]-i[2])*(s+A)/h],g.position=c.A.calcLabelQuadrant(c.A.rad([1,0],[0,0],t)),new f.A(o.A.COORDS_BY_USER,t,this.board)):this.getLabelPosition(b,this.label.evalVisProp("distance"))},r.methodMap=n.A.deepCopy(r.methodMap,{setAngle:"setAngle",Value:"Value",free:"free"}),r},r.A.registerElement("angle",r.A.createAngle),r.A.createNonreflexAngle=function(t,e,
1i){var s;return i.selection="minor",i=n.A.copyAttributes(i,t.options,"nonreflexangle"),(s=r.A.createAngle(t,e,i)).Value=function(t){var e=c.A.rad(this.point2,this.point1,this.point3);return""===(t=t||"radians")&&(t="radians"),e=e<Math.PI?e:2*Math.PI-e,this.arc.Value(t,e)},s},r.A.registerElement("nonreflexangle",r.A.createNonreflexAngle),r.A.createReflexAngle=function(t,e,i){var s;return i.selection="major",i=n.A.copyAttributes(i,t.options,"reflexangle"),(s=r.A.createAngle(t,e,i)).Value=function(t){var e=c.A.rad(this.point2,this.point1,this.point3);return""===(t=t||"radians")&&(t="radians"),e=e>=Math.PI?e:2*Math.PI-e,this.arc.Value(t,e)},s},r.A.registerElement("reflexangle",r.A.createReflexAngle);var J=i(50547);r.A.createOrthogonalProjection=function(t,e,i){var r,s,a,h;if(e[0]=t.select(e[0]),e[1]=t.select(e[1]),n.A.isPointType(t,e[0])&&e[1].elementClass===o.A.OBJECT_CLASS_LINE)s=n.A.providePoints(t,[e[0]],i,"point")[0],r=e[1];else if(n.A.isPointType(t,e[1])&&e[0].elementClass===o.A.OBJECT_CLASS_LINE)s=n.A.providePoints(t,[e[1]],i,"point")[0],r=e[0];else throw Error("JSXGraph: Can't create perpendicular point with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [point,line]");return h=n.A.copyAttributes(i,t.options,"orthogonalprojection"),a=t.create("point",[function(){return c.A.projectPointToLine(s,r,t)}],h),n.A.exists(s._is_new)?(a.addChild(s),delete s._is_new):s.addChild(a),r.addChild(a),a.elType="orthogonalprojection",a.setParents([s.id,a.id]),a.update(),a.generatePolynomial=function(){var t=r.point1.symbolic.x,e=r.point1.symbolic.y,i=r.point2.symbolic.x,o=r.point2.symbolic.y,n=s.symbolic.x,h=s.symbolic.y,l=a.symbolic.x,c=a.symbolic.y;return["("+e+")*("+l+")-("+e+")*("+i+")+("+c+")*("+i+")-("+t+")*("+c+")+("+t+")*("+o+")-("+l+")*("+o+")","("+h+")*("+e+")-("+h+")*("+o+")-("+c+")*("+e+")+("+c+")*("+o+")+("+n+")*("+t+")-("+n+")*("+i+")-("+l+")*("+t+")+("+l+")*("+i+")"]},a},r.A.createPerpendicular=function(t,e,i){var s,a,h,l;if(e[0]=t.select(e[0]),e[1]=t.select(e[1]),n.A.isPointType(t,e[0])&&e[1].elementClass===o.A.OBJECT_CLASS_LINE)a=e[1],s=n.A.providePoints(t,[e[0]],i,"point")[0];else if(n.A.isPointType(t,e[1])&&e[0].elementClass===o.A.OBJECT_CLASS_LINE)a=e[0],s=n.A.providePoints(t,[e[1]],i,"point")[0];else throw Error("JSXGraph: Can't create perpendicular with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [line,point]");return l=n.A.copyAttributes(i,t.options,"perpendicular"),(h=r.A.createLine(t,[function(){return a.stdform[2]*s.X()-a.stdform[1]*s.Y()},function(){return-a.stdform[2]*s.Z()},function(){return a.stdform[1]*s.Z()}],l)).elType="perpendicular",h.setParents([a.id,s.id]),n.A.exists(s._is_new)?(h.addChild(s),delete s._is_new):s.addChild(h),a.addChild(h),h},r.A.createPerpendicularPoint=function(t,e,i){var r,s,a;if(e[0]=t.select(e[0]),e[1]=t.select(e[1]),n.A.isPointType(t,e[0])&&e[1].elementClass===o.A.OBJECT_CLASS_LINE)s=n.A.providePoints(t,[e[0]],i,"point")[0],r=e[1];else if(n.A.isPointType(t,e[1])&&e[0].elementClass===o.A.OBJECT_CLASS_LINE)s=n.A.providePoints(t,[e[1]],i,"point")[0],r=e[0];else throw Error("JSXGraph: Can't create perpendicular point with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [point,line]");return a=t.create("point",[function(){return c.A.perpendicular(r,s,t)[0]}],i),n.A.exists(s._is_new)?(a.addChild(s),delete s._is_new):s.addChild(a),r.addChild(a),a.elType="perpendicularpoint",a.setParents([s.id,r.id]),a.update(),a.generatePolynomial=function(){var t=r.point1.symbolic.x,e=r.point1.symbolic.y,i=r.point2.symbolic.x,o=r.point2.symbolic.y,n=s.symbolic.x,h=s.symbolic.y,l=a.symbolic.x,c=a.symbolic.y;return["("+e+")*("+l+")-("+e+")*("+i+")+("+c+")*("+i+")-("+t+")*("+c+")+("+t+")*("+o+")-("+l+")*("+o+")","("+h+")*("+e+")-("+h+")*("+o+")-("+c+")*("+e+")+("+c+")*("+o+")+("+n+")*("+t+")-("+n+")*("+i+")-("+l+")*("+t+")+("+l+")*("+i+")"]},a},r.A.createPerpendicularSegment=function(t,e,i){var s,a,h,l,d;if(e[0]=t.select(e[0]),e[1]=t.select(e[1]),n.A.isPointType(t,e[0])&&e[1].elementClass===o.A.OBJECT_CLASS_LINE)a=e[1],s=n.A.providePoints(t,[e[0]],i,"point")[0];else if(n.A.isPointType(t,e[1])&&e[0].elementClass===o.A.OBJECT_CLASS_LINE)a=e[0],s=n.A.providePoints(t,[e[1]],i,"point")[0];else throw Error("JSXGraph: Can't create perpendicular with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [line,point]");return d=n.A.copyAttributes(i,t.options,"perpendicularsegment","point"),(l=r.A.createPerpendicularPoint(t,[a,s],d)).dump=!1,n.A.exists(i.layer)||(i.layer=t.options.layer.line),d=n.A.copyAttributes(i,t.options,"perpendicularsegment"),(h=r.A.createLine(t,[function(){return c.A.perpendicular(a,s,t)[1]?[l,s]:[s,l]}],d)).point=l,n.A.exists(s._is_new)?(h.addChild(s),delete s._is_new):s.addChild(h),a.addChild(h),h.elType="perpendicularsegment",h.setParents([s.id,a.id]),h.subs={point:l},h.inherits.push(l),h}
1,r.A.createMidpoint=function(t,e,i){var r,s,h,l,c;for(l=0;l<e.length;++l)e[l]=t.select(e[l]);if(2===e.length&&n.A.isPointType(t,e[0])&&n.A.isPointType(t,e[1]))r=(e=n.A.providePoints(t,e,i,"point"))[0],s=e[1];else if(1===e.length&&e[0].elementClass===o.A.OBJECT_CLASS_LINE)r=e[0].point1,s=e[0].point2;else throw Error("JSXGraph: Can't create midpoint.\nPossible parent types: [point,point], [line]");return c=n.A.copyAttributes(i,t.options,"midpoint"),h=t.create("point",[function(){var t=r.coords.usrCoords[1]+s.coords.usrCoords[1];return isNaN(t)||Math.abs(r.coords.usrCoords[0])<a.A.eps||Math.abs(s.coords.usrCoords[0])<a.A.eps?NaN:.5*t},function(){var t=r.coords.usrCoords[2]+s.coords.usrCoords[2];return isNaN(t)||Math.abs(r.coords.usrCoords[0])<a.A.eps||Math.abs(s.coords.usrCoords[0])<a.A.eps?NaN:.5*t}],c),n.A.exists(r._is_new)?(h.addChild(r),delete r._is_new):r.addChild(h),n.A.exists(s._is_new)?(h.addChild(s),delete s._is_new):s.addChild(h),h.elType="midpoint",h.setParents([r.id,s.id]),h.prepareUpdate().update(),h.generatePolynomial=function(){var t=r.symbolic.x,e=r.symbolic.y,i=s.symbolic.x,o=s.symbolic.y,n=h.symbolic.x,a=h.symbolic.y;return["("+e+")*("+n+")-("+e+")*("+i+")+("+a+")*("+i+")-("+t+")*("+a+")+("+t+")*("+o+")-("+n+")*("+o+")","("+t+")^2 - 2*("+t+")*("+n+")+("+e+")^2-2*("+e+")*("+a+")-("+i+")^2+2*("+i+")*("+n+")-("+o+")^2+2*("+o+")*("+a+")"]},h},r.A.createParallelPoint=function(t,e,i){var r,s,a,h,l,c;for(l=0;l<e.length;++l)e[l]=t.select(e[l]);if(3===e.length&&n.A.isPointType(t,e[0])&&n.A.isPointType(t,e[1])&&n.A.isPointType(t,e[2]))r=(e=n.A.providePoints(t,e,i,"point"))[0],s=e[1],a=e[2];else if(n.A.isPointType(t,e[0])&&e[1].elementClass===o.A.OBJECT_CLASS_LINE)a=n.A.providePoints(t,[e[0]],i,"point")[0],r=e[1].point1,s=e[1].point2;else if(n.A.isPointType(t,e[1])&&e[0].elementClass===o.A.OBJECT_CLASS_LINE)a=n.A.providePoints(t,[e[1]],i,"point")[0],r=e[0].point1,s=e[0].point2;else throw Error("JSXGraph: Can't create parallel point with parent types '"+typeof e[0]+"', '"+typeof e[1]+"' and '"+typeof e[2]+"'.\nPossible parent types: [line,point], [point,point,point]");return c=n.A.copyAttributes(i,t.options,"parallelpoint"),h=t.create("point",[function(){return a.coords.usrCoords[1]+s.coords.usrCoords[1]-r.coords.usrCoords[1]},function(){return a.coords.usrCoords[2]+s.coords.usrCoords[2]-r.coords.usrCoords[2]}],c),n.A.exists(r._is_new)?(h.addChild(r),delete r._is_new):r.addChild(h),n.A.exists(s._is_new)?(h.addChild(s),delete s._is_new):s.addChild(h),n.A.exists(a._is_new)?(h.addChild(a),delete a._is_new):a.addChild(h),h.elType="parallelpoint",h.setParents([r.id,s.id,a.id]),h.prepareUpdate().update(),h.generatePolynomial=function(){var t=r.symbolic.x,e=r.symbolic.y,i=s.symbolic.x,o=s.symbolic.y,n=a.symbolic.x,l=a.symbolic.y,c=h.symbolic.x,d=h.symbolic.y;return["("+o+")*("+c+")-("+o+")*("+n+")-("+e+")*("+c+")+("+e+")*("+n+")-("+d+")*("+i+")+("+d+")*("+t+")+("+l+")*("+i+")-("+l+")*("+t+")","("+d+")*("+t+")-("+d+")*("+n+")-("+o+")*("+t+")+("+o+")*("+n+")-("+c+")*("+e+")+("+c+")*("+l+")+("+i+")*("+e+")-("+i+")*("+l+")"]},h},r.A.createParallel=function(t,e,i){var r,s,o,h,l,c,d=1;for(l=0;l<e.length;++l)e[l]=t.select(e[l]);return r=null,3===e.length?(r=(e=n.A.providePoints(t,e,i,"point"))[2],d=0):n.A.isPointType(t,e[0])?(r=n.A.providePoints(t,[e[0]],i,"point")[0],h=function(){return e[1].stdform}):n.A.isPointType(t,e[1])&&(r=n.A.providePoints(t,[e[1]],i,"point")[0],h=function(){return e[0].stdform}),n.A.exists(i.layer)||(i.layer=t.options.layer.line),c=n.A.copyAttributes(i,t.options,"parallel","point"),(s=1===d?t.create("point",[function(){return a.A.crossProduct([1,0,0],h())}],c):t.create("parallelpoint",e,c)).isDraggable=!0,c=n.A.copyAttributes(i,t.options,"parallel"),(o=t.create("line",[r,s],c)).elType="parallel",o.subs={point:s},o.inherits.push(s),o.setParents([e[0].id,e[1].id]),3===e.length&&o.addParents(e[2].id),o.point=s,o},r.A.createArrowParallel=function(t,e,i){var s,a;try{return a=n.A.copyAttributes(i,t.options,"arrowparallel"),!1===a.lastArrow&&(a.lastArrow=!0),(s=r.A.createParallel(t,e,a).setAttribute({straightFirst:!1,straightLast:!1})).type=o.A.OBJECT_TYPE_VECTOR,s.elType="arrowparallel",s}catch(t){throw Error("JSXGraph: Can't create arrowparallel with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [line,point], [point,point,point]")}}
1,r.A.createBisector=function(t,e,i){var s,o,a,h;if(e=n.A.providePoints(t,e,i,"point"),n.A.isPoint(e[0])&&n.A.isPoint(e[1])&&n.A.isPoint(e[2])){for(a=0,(h=n.A.copyAttributes(i,t.options,"bisector","point")).snapToGrid=!1,(s=t.create("point",[function(){return c.A.angleBisector(e[0],e[1],e[2],t)}],h)).dump=!1;a<3;a++)n.A.exists(e[a]._is_new)?(s.addChild(e[a]),delete e[a]._is_new):e[a].addChild(s);return n.A.exists(i.layer)||(i.layer=t.options.layer.line),h=n.A.copyAttributes(i,t.options,"bisector"),(o=r.A.createLine(t,[e[1],s],h)).point=s,o.elType="bisector",o.setParents(e),o.subs={point:s},o.inherits.push(s),o}throw Error("JSXGraph: Can't create angle bisector with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [point,point,point]")},r.A.createAngularBisectorsOfTwoLines=function(t,e,i){var r,s,h,l,c=t.select(e[0]),d=t.select(e[1]);if(c.elementClass!==o.A.OBJECT_CLASS_LINE||d.elementClass!==o.A.OBJECT_CLASS_LINE)throw Error("JSXGraph: Can't create angle bisectors of two lines with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [line,line]");return n.A.exists(i.layer)||(i.layer=t.options.layer.line),h=n.A.copyAttributes(i,t.options,"bisectorlines","line1"),r=t.create("line",[function(){var t=a.A.hypot(c.stdform[1],c.stdform[2]),e=a.A.hypot(d.stdform[1],d.stdform[2]);return c.stdform[0]/t-d.stdform[0]/e},function(){var t=a.A.hypot(c.stdform[1],c.stdform[2]),e=a.A.hypot(d.stdform[1],d.stdform[2]);return c.stdform[1]/t-d.stdform[1]/e},function(){var t=a.A.hypot(c.stdform[1],c.stdform[2]),e=a.A.hypot(d.stdform[1],d.stdform[2]);return c.stdform[2]/t-d.stdform[2]/e}],h),n.A.exists(i.layer)||(i.layer=t.options.layer.line),h=n.A.copyAttributes(i,t.options,"bisectorlines","line2"),s=t.create("line",[function(){var t=a.A.hypot(c.stdform[1],c.stdform[2]),e=a.A.hypot(d.stdform[1],d.stdform[2]);return c.stdform[0]/t+d.stdform[0]/e},function(){var t=a.A.hypot(c.stdform[1],c.stdform[2]),e=a.A.hypot(d.stdform[1],d.stdform[2]);return c.stdform[1]/t+d.stdform[1]/e},function(){var t=a.A.hypot(c.stdform[1],c.stdform[2]),e=a.A.hypot(d.stdform[1],d.stdform[2]);return c.stdform[2]/t+d.stdform[2]/e}],h),l=new J.A({line1:r,line2:s}),r.dump=!1,s.dump=!1,l.elType="bisectorlines",l.setParents([c.id,d.id]),l.subs={line1:r,line2:s},l},r.A.createCircumcenter=function(t,e,i){var s,o,a,h,l;if(e=n.A.providePoints(t,e,i,"point"),n.A.isPoint(e[0])&&n.A.isPoint(e[1])&&n.A.isPoint(e[2])){for(o=0,a=e[0],h=e[1],l=e[2],s=r.A.createPoint(t,[function(){return c.A.circumcenter(a,h,l,t)}],i);o<3;o++)n.A.exists(e[o]._is_new)?(s.addChild(e[o]),delete e[o]._is_new):e[o].addChild(s);return s.elType="circumcenter",s.setParents(e),s.generatePolynomial=function(){var t=a.symbolic.x,e=a.symbolic.y,i=h.symbolic.x,r=h.symbolic.y,o=l.symbolic.x,n=l.symbolic.y,c=s.symbolic.x,d=s.symbolic.y;return["(("+c+")-("+t+"))^2+(("+d+")-("+e+"))^2-(("+c+")-("+i+"))^2-(("+d+")-("+r+"))^2","(("+c+")-("+t+"))^2+(("+d+")-("+e+"))^2-(("+c+")-("+o+"))^2-(("+d+")-("+n+"))^2"]},s}throw Error("JSXGraph: Can't create circumcircle midpoint with parent types '"+typeof e[0]+"', '"+typeof e[1]+"' and '"+typeof e[2]+"'.\nPossible parent types: [point,point,point]")},r.A.createIncenter=function(t,e,i){var r,s,h,l,c;if((e=n.A.providePoints(t,e,i,"point")).length>=3&&n.A.isPoint(e[0])&&n.A.isPoint(e[1])&&n.A.isPoint(e[2])){for(c=0,s=e[0],h=e[1],l=e[2],r=t.create("point",[function(){var e,i,r;return e=a.A.hypot(h.X()-l.X(),h.Y()-l.Y()),i=a.A.hypot(s.X()-l.X(),s.Y()-l.Y()),r=a.A.hypot(h.X()-s.X(),h.Y()-s.Y()),new f.A(o.A.COORDS_BY_USER,[(e*s.X()+i*h.X()+r*l.X())/(e+i+r),(e*s.Y()+i*h.Y()+r*l.Y())/(e+i+r)],t)}],i);c<3;c++)n.A.exists(e[c]._is_new)?(r.addChild(e[c]),delete e[c]._is_new):e[c].addChild(r);r.elType="incenter",r.setParents(e)}else throw Error("JSXGraph: Can't create incenter with parent types '"+typeof e[0]+"', '"+typeof e[1]+"' and '"+typeof e[2]+"'.\nPossible parent types: [point,point,point]");return r},r.A.createCircumcircle=function(t,e,i){var s,o,a,h;if(!1===(e=n.A.providePoints(t,e,i,"point")))throw Error("JSXGraph: Can't create circumcircle with parent types '"+typeof e[0]+"', '"+typeof e[1]+"' and '"+typeof e[2]+"'.\nPossible parent types: [point,point,point]");
1try{for(a=n.A.copyAttributes(i,t.options,"circumcircle","center"),(s=r.A.createCircumcenter(t,e,a)).dump=!1,n.A.exists(i.layer)||(i.layer=t.options.layer.circle),a=n.A.copyAttributes(i,t.options,"circumcircle"),(o=r.A.createCircle(t,[s,e[0]],a)).elType="circumcircle",o.setParents(e),o.subs={center:s},o.inherits.push(o),h=0;h<3;h++)n.A.exists(e[h]._is_new)?(o.addChild(e[h]),delete e[h]._is_new):e[h].addChild(o)}catch(t){throw Error("JSXGraph: Can't create circumcircle with parent types '"+typeof e[0]+"', '"+typeof e[1]+"' and '"+typeof e[2]+"'.\nPossible parent types: [point,point,point]")}return o},r.A.createIncircle=function(t,e,i){var s,o,h,l;if(!1===(e=n.A.providePoints(t,e,i,"point")))throw Error("JSXGraph: Can't create circumcircle with parent types '"+typeof e[0]+"', '"+typeof e[1]+"' and '"+typeof e[2]+"'.\nPossible parent types: [point,point,point]");try{for(l=n.A.copyAttributes(i,t.options,"incircle","center"),(o=r.A.createIncenter(t,e,l)).dump=!1,n.A.exists(i.layer)||(i.layer=t.options.layer.circle),l=n.A.copyAttributes(i,t.options,"incircle"),(h=r.A.createCircle(t,[o,function(){var t=a.A.hypot(e[1].X()-e[2].X(),e[1].Y()-e[2].Y()),i=a.A.hypot(e[0].X()-e[2].X(),e[0].Y()-e[2].Y()),r=a.A.hypot(e[1].X()-e[0].X(),e[1].Y()-e[0].Y()),s=(t+i+r)/2;return Math.sqrt((s-t)*(s-i)*(s-r)/s)}],l)).elType="incircle",h.setParents(e),s=0;s<3;s++)n.A.exists(e[s]._is_new)?(h.addChild(e[s]),delete e[s]._is_new):e[s].addChild(h);h.center=o,h.subs={center:h.center},h.inherits.push(o)}catch(t){throw Error("JSXGraph: Can't create circumcircle with parent types '"+typeof e[0]+"', '"+typeof e[1]+"' and '"+typeof e[2]+"'.\nPossible parent types: [point,point,point]")}return h},r.A.createReflection=function(t,e,i){var s,a,h,l,c,d,u,p,f="\nPossible parent types: [point|line|curve|polygon|circle|arc|sector, line]";for(d=0;d<e.length;++d)e[d]=t.select(e[d]);if(u=n.A.copyAttributes(i,t.options,"reflection"),n.A.isPoint(e[0]))a=n.A.providePoints(t,[e[0]],p)[0];else if(e[0].elementClass===o.A.OBJECT_CLASS_CURVE||e[0].elementClass===o.A.OBJECT_CLASS_LINE||e[0].type===o.A.OBJECT_TYPE_POLYGON||e[0].elementClass===o.A.OBJECT_CLASS_CIRCLE)a=e[0];else throw Error("JSXGraph: Can't create reflection element with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'."+f);if(e[1].elementClass===o.A.OBJECT_CLASS_LINE)s=e[1];else throw Error("JSXGraph: Can't create reflected element with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'."+f);if(c=r.A.createTransform(t,[s],{type:"reflect"}),n.A.isPoint(a))h=r.A.createPoint(t,[a,c],u);else if(a.elementClass===o.A.OBJECT_CLASS_CURVE)h=r.A.createCurve(t,[a,c],u);else if(a.elementClass===o.A.OBJECT_CLASS_LINE)h=r.A.createLine(t,[a,c],u);else if(a.type===o.A.OBJECT_TYPE_POLYGON)h=r.A.createPolygon(t,[a,c],u);else if(a.elementClass===o.A.OBJECT_CLASS_CIRCLE)"euclidean"===u.type.toLowerCase()?(p=n.A.copyAttributes(i,t.options,"reflection","center"),(l=r.A.createPoint(t,[a.center,c],p)).prepareUpdate().update().updateVisibility(l.evalVisProp("visible")).updateRenderer(),h=r.A.createCircle(t,[l,function(){return a.Radius()}],u)):h=r.A.createCircle(t,[a,c],u);else throw Error("JSXGraph: Can't create reflected element with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'."+f);return n.A.exists(a._is_new)&&(h.addChild(a),delete a._is_new),s.addChild(h),h.elType="reflection",h.addParents(s),h.prepareUpdate().update(),n.A.isPoint(h)&&(h.generatePolynomial=function(){var t=s.point1.symbolic.x,e=s.point1.symbolic.y,i=s.point2.symbolic.x,r=s.point2.symbolic.y,o=a.symbolic.x,n=a.symbolic.y,l=h.symbolic.x,c=h.symbolic.y;return["(("+c+")-("+n+"))*(("+e+")-("+r+"))+(("+t+")-("+i+"))*(("+l+")-("+o+"))","(("+l+")-("+t+"))^2+(("+c+")-("+e+"))^2-(("+o+")-("+t+"))^2-(("+n+")-("+e+"))^2"]}),h},r.A.createMirrorElement=function(t,e,i){var s,a,h,l,c,d,u,p,f="\nPossible parent types: [point|line|curve|polygon|circle|arc|sector, point]";for(a=0;a<e.length;++a)e[a]=t.select(e[a]);if(u=n.A.copyAttributes(i,t.options,"mirrorelement"),n.A.isPoint(e[0]))s=n.A.providePoints(t,[e[0]],u)[0];else if(e[0].elementClass===o.A.OBJECT_CLASS_CURVE||e[0].elementClass===o.A.OBJECT_CLASS_LINE||e[0].type===o.A.OBJECT_TYPE_POLYGON||e[0].elementClass===o.A.OBJECT_CLASS_CIRCLE)s=e[0];else throw Error("JSXGraph: Can't create mirror element with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'."+f);if(n.A.isPoint(e[1]))p=n.A.copyAttributes(i,t.options,"mirrorelement","point"),h=n.A.providePoints(t,[e[1]],p)[0];else throw Error("JSXGraph: Can't create mirror element with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'."+f);if(d=r.A.createTransform(t,[Math.PI,h],{type:"rotate"}),n.A.isPoint(s))l=r.A.createPoint(t,[s,d],u);else if(s.elementClass===o.A.OBJECT_CLASS_CURVE)l=r.A.createCurve(t,[s,d],u);else if(s.elementClass===o.A.OBJECT_CLASS_LINE)l=r.A.createLine(t,[s,d],u);else if(s.type===o.A.OBJECT_TYPE_POLYGON)l=r.A.createPolygon(t,[s,d],u);else if(s.elementClass===o.A.OBJECT_CLASS_CIRCLE)"euclidean"===u.type.toLowerCase()?(p=n.A.copyAttributes(i,t.options,"mirrorelement","center"),(c=r.A.createPoint(t,[s.center,d],p)).prepareUpdate().update().updateVisibility(c.evalVisProp("visible")).updateRenderer(),l=r.A.createCircle(t,[c,function(){return s.Radius()}],u)):l=r.A.createCircle(t,[s,d],u);else throw Error("JSXGraph: Can't create mirror element with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'."+f);return n.A.exists(s._is_new)&&(l.addChild(s),delete s._is_new),h.addChild(l),l.elType="mirrorelement",l.addParents(h),l.prepareUpdate().update(),l}
1,r.A.createMirrorPoint=function(t,e,i){var s=r.A.createMirrorElement(t,e,i);return s.elType="mirrorpoint",s},r.A.createIntegral=function(t,e,i){var s,a,h,l,c,d,u,A,m,b,g,v,y,C,_,P=null;if(n.A.isArray(e[0])&&e[1].elementClass===o.A.OBJECT_CLASS_CURVE)s=e[0],a=e[1];else if(n.A.isArray(e[1])&&e[0].elementClass===o.A.OBJECT_CLASS_CURVE)s=e[1],a=e[0];else throw Error("JSXGraph: Can't create integral with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [[number|function,number|function],curve]");return(h=n.A.copyAttributes(i,t.options,"integral")).withlabel=!1,_=t.create("curve",[[0],[0]],h),t.objectsList.pop(),l=s[0],c=s[1],n.A.isFunction(l)?(d=l,u=function(){return a.Y(d())},l=d()):(d=l,u=a.Y(l)),n.A.isFunction(c)?(A=c,m=function(){return a.Y(A())},c=A()):(A=c,m=a.Y(c)),h=n.A.copyAttributes(i,t.options,"integral","curveleft"),b=t.create("glider",[d,u,a],h),n.A.isFunction(d)&&b.hideElement(),h=n.A.copyAttributes(i,t.options,"integral","baseleft"),g=t.create("point",[function(){return"y"===_.evalVisProp("axis")?0:b.X()},function(){return"y"===_.evalVisProp("axis")?b.Y():0}],h),h=n.A.copyAttributes(i,t.options,"integral","curveright"),v=t.create("glider",[A,m,a],h),n.A.isFunction(A)&&v.hideElement(),h=n.A.copyAttributes(i,t.options,"integral","baseright"),y=t.create("point",[function(){return"y"===_.evalVisProp("axis")?0:v.X()},function(){return"y"===_.evalVisProp("axis")?v.Y():0}],h),_._pos=t.objectsList.length,t.objectsList.push(_),!1!==(h=n.A.copyAttributes(i,t.options,"integral")).withlabel&&"y"!==h.axis&&(h=n.A.copyAttributes(i,t.options,"integral","label"),h=n.A.copyAttributes(h,t.options,"label"),P=t.create("text",[function(){var t=new f.A(o.A.COORDS_BY_SCREEN,[this.evalVisProp("offset.0")+this.board.origin.scrCoords[1],0],this.board,!1),e=this.board.getBoundingBox(),i=(e[2]-e[0])*.1,r=v.X();return r<e[0]?r=e[0]+i:r>e[2]&&(r=e[2]-i),r+t.usrCoords[1]},function(){var t=new f.A(o.A.COORDS_BY_SCREEN,[0,this.evalVisProp("offset.1")+this.board.origin.scrCoords[2]],this.board,!1),e=this.board.getBoundingBox(),i=(e[1]-e[3])*.1,r=v.Y();return r>e[1]?r=e[1]-i:r<e[3]&&(r=e[3]+i),r+t.usrCoords[2]},""],h),C=function(){var t,e="∫",i=p.A.NewtonCotes([g.X(),y.X()],a.Y),r=P.evalVisProp("digits");return t=P.useLocale()?P.formatNumberLocale(i,r):n.A.toFixed(i,r),(P.evalVisProp("usemathjax")||P.evalVisProp("usekatex"))&&(e="\\int"),e+" = "+t},P.setText(C),P.dump=!1,b.addChild(P),v.addChild(P)),b.dump=!1,g.dump=!1,v.dump=!1,y.dump=!1,_.elType="integral",_.setParents([a.id,s]),_.subs={curveLeft:b,baseLeft:g,curveRight:v,baseRight:y},_.inherits.push(b,g,v,y),h.withlabel&&(_.subs.label=P,_.inherits.push(P)),_.Value=function(){return p.A.I([g.X(),y.X()],a.Y)},_.updateDataArray=function(){var t,e,i,r,s,o,n,h,l;if("y"===this.evalVisProp("axis")){for(b.Y()<v.Y()?(o=b.X(),h=b.Y(),n=v.X(),l=v.Y()):(o=v.X(),h=v.Y(),n=b.X(),l=b.Y()),r=Math.min(o,n),s=Math.max(o,n),t=[0,o],e=[h,h],i=0;i<a.numberPoints;i++)h<=a.points[i].usrCoords[2]&&r<=a.points[i].usrCoords[1]&&a.points[i].usrCoords[2]<=l&&a.points[i].usrCoords[1]<=s&&(t.push(a.points[i].usrCoords[1]),e.push(a.points[i].usrCoords[2]));t.push(n),e.push(l),t.push(0),e.push(l),t.push(0),e.push(h)}else{for(g.X()<y.X()?(r=g.X(),s=y.X()):(r=y.X(),s=g.X()),t=[r,r],e=[0,a.Y(r)],i=0;i<a.numberPoints;i++)r<=a.points[i].usrCoords[1]&&a.points[i].usrCoords[1]<=s&&(t.push(a.points[i].usrCoords[1]),e.push(a.points[i].usrCoords[2]));t.push(s),e.push(a.Y(s)),t.push(s),e.push(0),t.push(r),e.push(0)}this.dataX=t,this.dataY=e},b.addChild(_),v.addChild(_),g.addChild(_),y.addChild(_),_.baseLeft=g,_.baseRight=y,_.curveLeft=b,_.curveRight=v,_.methodMap=r.A.deepCopy(_.methodMap,{curveLeft:"curveLeft",baseLeft:"baseLeft",curveRight:"curveRight",baseRight:"baseRight",Value:"Value"}),_.label=P,_},r.A.createInequality=function(t,e,i){var r,s,h;if(h=n.A.copyAttributes(i,t.options,"inequality"),e[0].elementClass===o.A.OBJECT_CLASS_LINE)(s=t.create("curve",[[],[]],h)).hasPoint=function(){return!1},s.updateDataArray=function(){var i,r,s,n=t.getBoundingBox(),h=this.evalVisProp("inverse"),l=h?-1:1,d=1.5,u=1.5*Math.max(n[2]-n[0],n[1]-n[3]),p={coords:{usrCoords:[1,(n[0]+n[2])*.5,h?n[1]:n[3]]}},f=e[0].stdform.slice(1),A=f;s=d*Math.max(c.A.perpendicular(e[0],p,t)[0].distance(o.A.COORDS_BY_USER,p.coords),u)*l,p={coords:{usrCoords:[1,(n[0]+n[2])*.5,(n[1]+n[3])*.5]}},i=[1,(p=Math.abs(a.A.innerProduct(p.coords.usrCoords,e[0].stdform,3))>=a.A.eps?c.A.perpendicular(e[0],p,t)[0].usrCoords:p.coords.usrCoords)[1]+f[1]*u,p[2]-f[0]*u],r=[1,p[1]-A[1]*u,p[2]+A[0]*u],this.dataX=[i[1],i[1]+f[0]*s,r[1]+A[0]*s,r[1],i[1]],this.dataY=[i[2],i[2]+f[1]*s,r[2]+A[1]*s,r[2],i[2]]};else if(e[0].elementClass===o.A.OBJECT_CLASS_CURVE&&"functiongraph"===e[0].visProp.curvetype)(s=t.create("curve",[[],[]],h)).updateDataArray=function(){var t,i,r,s,o,n,a,h,l,c=this.board.getBoundingBox(),d=[],u=e[0].minX(),p=e[0].maxX(),f=(c[1]-c[3])*.3;if(t=this.evalVisProp("inverse")?1:3,this.dataX=[],this.dataY=[],0!==(s=e[0].points.length))for(c[1]+=f,c[3]-=f,r=-1;r<s-1;){for(o=r+1,i=s;o<s;
1o++)if(e[0].points[o].isReal()){i=o;break}if(i>=s)break;for(o=i,r=s-1;o<s-1;o++)if(!e[0].points[o+1].isReal()){r=o;break}for(h=e[0].points[i].usrCoords[1],l=e[0].points[r].usrCoords[1],n=c[0]<u?u:c[0],a=c[2]>p?p:c[2],n=0===i?n:Math.max(n,h),a=r===s-1?a:Math.min(a,l),n=0===i?u:h,a=r===s-1?p:l,(d=[]).push([1,n,c[t]]),d.push([1,n,e[0].points[i].usrCoords[2]]),o=i;o<=r;o++)d.push(e[0].points[o].usrCoords);for(d.push([1,a,e[0].points[r].usrCoords[2]]),d.push([1,a,c[t]]),d.push(d[0]),o=0;o<d.length;o++)this.dataX.push(d[o][1]),this.dataY.push(d[o][2]);r<s-1&&(this.dataX.push(NaN),this.dataY.push(NaN))}},s.hasPoint=function(){return!1};else if(r=n.A.createFunction(e[0]),s.addParentsFromJCFunctions([r]),!n.A.exists(r))throw Error("JSXGraph: Can't create area with the given parents.\nPossible parent types: [line], [function]");return s.addParents(e[0]),s},r.A.registerElement("arrowparallel",r.A.createArrowParallel),r.A.registerElement("bisector",r.A.createBisector),r.A.registerElement("bisectorlines",r.A.createAngularBisectorsOfTwoLines),r.A.registerElement("msector",r.A.createMsector),r.A.registerElement("circumcircle",r.A.createCircumcircle),r.A.registerElement("circumcirclemidpoint",r.A.createCircumcenter),r.A.registerElement("circumcenter",r.A.createCircumcenter),r.A.registerElement("incenter",r.A.createIncenter),r.A.registerElement("incircle",r.A.createIncircle),r.A.registerElement("integral",r.A.createIntegral),r.A.registerElement("midpoint",r.A.createMidpoint),r.A.registerElement("mirrorelement",r.A.createMirrorElement),r.A.registerElement("mirrorpoint",r.A.createMirrorPoint),r.A.registerElement("orthogonalprojection",r.A.createOrthogonalProjection),r.A.registerElement("parallel",r.A.createParallel),r.A.registerElement("parallelpoint",r.A.createParallelPoint),r.A.registerElement("perpendicular",r.A.createPerpendicular),r.A.registerElement("perpendicularpoint",r.A.createPerpendicularPoint),r.A.registerElement("perpendicularsegment",r.A.createPerpendicularSegment),r.A.registerElement("reflection",r.A.createReflection),r.A.registerElement("inequality",r.A.createInequality),r.A.createGrid=function(t,e,i){var s,h,l,c,d,u,p,f,A=a.A.eps,m=5e3,b=[],g=[];if((l=e).length>2||l.length>=1&&"axis"!==l[0].elType||l.length>=2&&"axis"!==l[1].elType)throw Error("JSXGraph: Can't create 'grid' with parent type '"+e[0].elType+"'. Possible parent types: [axis,axis]");return!n.A.exists(l[0])&&n.A.exists(t.defaultAxes)&&(l[0]=t.defaultAxes.x),!n.A.exists(l[1])&&n.A.exists(t.defaultAxes)&&(l[1]=t.defaultAxes.y),f=function(t,e,i,r,s,o,n){var a,h,l,c,d,u,p;switch(t.toLowerCase()){case".":case"point":return e.visProp.linecap="round",e.visProp.strokewidth=s*e.board.unitX+o*e.board.unitY,[[i,i,NaN],[r,r,NaN]];case"o":case"circle":return e.visProp.linecap="square",e.bezierDegree=3,[[i+s,i+s,i+(h=4*Math.tan(Math.PI/8)/3)*s,i,i-h*s,i-s,i-s,i-s,i-h*s,i,i+h*s,i+s,i+s,NaN],[r,r+h*o,r+o,r+o,r+o,r+h*o,r,r-h*o,r-o,r-o,r-o,r-h*o,r,NaN]];case"regpol":case"regularpolygon":for(a=0,e.visProp.linecap="round",c=e.evalVisProp("polygonvertices"),d=[[],[]];a<=2*Math.PI;a+=2*Math.PI/c)d[0].push(i-s*Math.sin(a)),d[1].push(r-o*Math.cos(a));return d[0].push(NaN),d[1].push(NaN),d;case"[]":case"square":return e.visProp.linecap="square",[[i-s,i+s,i+s,i-s,i-s,NaN],[r+o,r+o,r-o,r-o,r+o,NaN]];case"<>":case"diamond":return e.visProp.linecap="square",[[i,i+s,i,i-s,i,NaN],[r+o,r,r-o,r,r+o,NaN]];case"<<>>":case"diamond2":return e.visProp.linecap="square",[[i,i+(u=s*Math.sqrt(2)),i,i-u,i,NaN],[r+(p=o*Math.sqrt(2)),r,r-p,r,r+p,NaN]];case"x":case"cross":return[[i-s,i+s,NaN,i-s,i+s,NaN],[r+o,r-o,NaN,r-o,r+o,NaN]];case"+":case"plus":return[[i-s,i+s,NaN,i,i,NaN],[r,r,NaN,r-o,r+o,NaN]];case"-":case"minus":return[[i-s,i+s,NaN],[r,r,NaN]];case"|":case"divide":return[[i,i,NaN],[r-o,r+o,NaN]];case"^":case"a":case"A":case"triangleup":return[[i-s,i,i+s,NaN],[r-o,r,r-o,NaN]];case"v":case"triangledown":return[[i-s,i,i+s,NaN],[r+o,r,r+o,NaN]];case"<":case"triangleleft":return[[i+s,i,i+s,NaN],[r+o,r,r-o,NaN]];case">":case"triangleright":return[[i-s,i,i-s,NaN],[r+o,r,r-o,NaN]];case"line":return l=e.evalVisProp("margin"),[[i,i,NaN,n[0]-l/e.board.unitX,n[2]+l/e.board.unitX,NaN],[n[1]+l/e.board.unitY,n[3]-l/e.board.unitY,NaN,r,r,NaN]];default:return[[],[]]}},c=n.A.copyAttributes(i,t.options,"grid"),n.A.mergeAttr(c,c.themes[c.theme],!1),d={},n.A.mergeAttr(d,c,!0,!0),n.A.mergeAttr(d,c.major,!0,!0),(s=t.create("curve",[[null],[null]],d)).elType="grid",s.type=o.A.OBJECT_TYPE_GRID,u={},n.A.mergeAttr(u,c,!0,!0),n.A.mergeAttr(u,c.minor,!0,!0),u.id===d.id&&(u.id=s.id+"_minor"),u.name===d.name&&(u.name=s.name+"_minor"),(h=t.create("curve",[[null],[null]],u)).elType="grid",h.type=o.A.OBJECT_TYPE_GRID,s.minorGrid=h,h.majorGrid=s,s.hasPoint=function(){return!1},h.hasPoint=function(){return!1},s.inherits.push(h),s.updateDataArray=function(){var t,e,i,o,h,c,d,u,v=this.board.getBoundingBox(),y=this.evalVisProp("gridx"),C=this.evalVisProp("gridy"),_=this.evalVisProp("face"),P=this.evalVisProp("drawzero"),x=!0===P||n.A.isObject(P)&&!0===this.eval(P.origin),E=!0===P||n.A.isObject(P)&&!0===this.eval(P.x),S=!0===P||n.A.isObject(P)&&!0===this.eval(P.y),N=this.evalVisProp("includeboundaries"),T=this.evalVisProp("forcesquare");if(this.dataX=[],this.dataY=[],p=this.evalVisProp("majorstep"),n.A.isArray(p)||(p=[p,p]),p.length<2&&(p=[p[0],p[0]]),n.A.exists(y)&&(r.A.deprecated("gridX","majorStep"),p[0]=y),n.A.exists(C)&&(r.A.deprecated("gridY","majorStep"),p[1]=C),"auto"===p[0]?(u=Math.pow(10,Math.floor(Math.log(50/this.board.unitX)/Math.LN10)),p[0]=u,n.A.exists(l[0])&&(p[0]=l[0].ticks[0].getDistanceMajorTicks())):p[0]=n.A.parseNumber(p[0],Math.abs(v[1]-v[3]),1/this.board.unitX),"auto"===p[1]?(u=Math.pow(10,Math.floor(Math.log(50/this.board.unitY)/Math.LN10)),p[1]=u,n.A.exists(l[1])&&(p[1]=l[1].ticks[0].getDistanceMajorTicks())):p[1]=n.A.parseNumber(p[1],Math.abs(v[0]-v[2]),1/this.board.unitY),"min"===T||!0===T?p[0]*this.board.unitX<=p[1]*this.board.unitY?p[1]=p[0]/this.board.unitY*this.board.unitX:p[0]=p[1]/this.board.unitX*this.board.unitY:"max"===T&&(p[0]*this.board.unitX<=p[1]*this.board.unitY?p[0]=p[1]/this.board.unitX*this.board.unitY:p[1]=p[0]/this.board.unitY*this.board.unitX),b=this.evalVisProp("size"),n.A.isArray(b)||(b=[b,b]),b.length<2&&(b=[b[0],b[0]]),n.A.isNumber(b[0],!0)&&(b[0]=b[0]+"px"),n.A.isNumber(b[1],!0)&&(b[1]=b[1]+"px"),b[0]=n.A.parseNumber(b[0],p[0],1/this.board.unitX),b[1]=n.A.parseNumber(b[1],p[1],1/this.board.unitY),g[0]=b[0]/2,g[1]=b[1]/2,t=a.A.roundToStep(v[0],p[0]),e=a.A.roundToStep(v[1],p[1]),d=isFinite(t)&&isFinite(e)&&isFinite(v[2])&&isFinite(v[3])&&Math.abs(v[2])<Math.abs(p[0]*m)&&Math.abs(v[3])<Math.abs(p[1]*m),"line"===_.toLowerCase()){for(h=s.evalVisProp("margin"),o=e;d&&o>=v[3];o-=p[1])!x&&Math.abs(o)<A||!S&&Math.abs(o)<A||!N&&(o<=v[3]+g[1]||o>=v[1]-g[1])||(c=[[v[0]-h/s.board.unitX,v[2]+h/s.board.unitX,NaN],[o,o,NaN]],n.A.concat(this.dataX,c[0]),n.A.concat(this.dataY,c[1]));for(i=t;d&&i<=v[2];i+=p[0])!x&&Math.abs(i)<A||!E&&Math.abs(i)<A||!N&&(i<=v[0]+g[0]||i>=v[2]-g[0])||(c=[[i,i,NaN],[v[1]+h/s.board.unitY,v[3]-h/s.board.unitY,NaN]],n.A.concat(this.dataX,c[0]),n.A.concat(this.dataY,c[1]))}else for(o=e;d&&o>=v[3];o-=p[1])for(i=t;d&&i<=v[2];i+=p[0])!x&&Math.abs(o)<A&&Math.abs(i)<A||!E&&Math.abs(o)<A&&Math.abs(i)>=A||!S&&Math.abs(i)<A&&Math.abs(o)>=A||!N&&(i<=v[0]+g[0]||i>=v[2]-g[0]||o<=v[3]+g[1]||o>=v[1]-g[1])||(c=f(_,s,i,o,g[0],g[1],v),n.A.concat(this.dataX,c[0]),n.A.concat(this.dataY,c[1]))},h.updateDataArray=function(){var t,e,i,r,s,o,c,d,u,b,v,y,C,_,P,x,E,S,N,T=this.board.getBoundingBox(),w=[],O=[],M=this.evalVisProp("minorelements"),k=this.evalVisProp("size"),D=this.evalVisProp("face"),R=this.evalVisProp("drawzero"),L=!0===R||n.A.isObject(R)&&!0===this.eval(R.x),B=!0===R||n.A.isObject(R)&&!0===this.eval(R.y),I=this.majorGrid.evalVisProp("face"),V=this.majorGrid.evalVisProp("drawzero"),Y=!0===V||n.A.isObject(V)&&!0===this.eval(V.origin),j=!0===V||n.A.isObject(V)&&!0===this.eval(V.x),X=!0===V||n.A.isObject(V)&&!0===this.eval(V.y),F=this.evalVisProp("includeboundaries");if(this.dataX=[],this.dataY=[],n.A.isArray(M)||(M=[M,M]),M.length<2&&(M=[M[0],M[0]]),n.A.isNumber(M[0],!0)?M[0]=parseFloat(M[0]):(M[0]=3,n.A.exists(l[0])&&(M[0]=l[0].eval(l[0].getAttribute("ticks").minorticks))),w[0]=p[0]/(M[0]+1),n.A.isNumber(M[1],!0)?M[1]=parseFloat(M[
11]):(M[1]=3,n.A.exists(l[1])&&(M[1]=l[1].eval(l[1].getAttribute("ticks").minorticks))),w[1]=p[1]/(M[1]+1),n.A.isArray(k)||(k=[k,k]),k.length<2&&(k=[k[0],k[0]]),n.A.isNumber(k[0],!0)&&(k[0]=k[0]+"px"),n.A.isNumber(k[1],!0)&&(k[1]=k[1]+"px"),k[0]=n.A.parseNumber(k[0],w[0],1/this.board.unitX),k[1]=n.A.parseNumber(k[1],w[1],1/this.board.unitY),O[0]=.5*k[0],O[1]=.5*k[1],t=a.A.roundToStep(T[0],w[0]),e=a.A.roundToStep(T[1],w[1]),c=isFinite(t)&&isFinite(e)&&isFinite(T[2])&&isFinite(T[3])&&Math.abs(T[2])<=Math.abs(w[0]*m)&&Math.abs(T[3])<Math.abs(w[1]*m),"line"!==D.toLowerCase())for(r=e;c&&r>=T[3];r-=w[1])for(i=t;c&&i<=T[2];i+=w[0]){if(d=Math.abs((d=a.A.roundToStep(Math.abs(i),p[0]))-Math.abs(i)),u=p[0]-d,b=Math.abs((b=a.A.roundToStep(Math.abs(r),p[1]))-Math.abs(r)),v=p[1]-b,"line"===I){if(d-O[0]-g[0]<A||u-O[0]-g[0]<A||b-O[1]-g[1]<A||v-O[1]-g[1]<A)continue}else if((d-O[0]-g[0]<A||u-O[0]-g[0]<A)&&(b-O[1]-g[1]<A||v-O[1]-g[1]<A)&&(Y||g[1]-Math.abs(r)+O[1]<A||g[0]-Math.abs(i)+O[0]<A)&&(j||g[1]-Math.abs(r)+O[1]<A||g[0]+Math.abs(i)-O[0]<A)&&(X||g[0]-Math.abs(i)+O[0]<A||g[1]+Math.abs(r)-O[1]<A))continue;!(!B&&Math.abs(i)<A||!L&&Math.abs(r)<A)&&(y=Math.abs(T[0]%p[0]),C=Math.abs(T[1]%p[1]),_=Math.abs(T[2]%p[0]),P=Math.abs(T[3]%p[1]),x=p[0]-y,E=p[1]-C,S=p[0]-_,N=p[1]-P,!F&&(i-O[0]-T[0]-g[0]+x<A&&x-g[0]<A||i-O[0]-T[0]-g[0]-y<A&&y-g[0]<A||-i-O[0]+T[2]-g[0]+S<A&&S-g[0]<A||-i-O[0]+T[2]-g[0]-_<A&&_-g[0]<A||-r-O[1]+T[1]-g[1]+E<A&&E-g[1]<A||-r-O[1]+T[1]-g[1]-C<A&&C-g[1]<A||r-O[1]-T[3]-g[1]+N<A&&N-g[1]<A||r-O[1]-T[3]-g[1]-P<A&&P-g[1]<A||-r-O[1]+T[1]<A||i-O[0]-T[0]<A||r-O[1]-T[3]<A||-i-O[0]+T[2]<A)||(o=f(D,h,i,r,O[0],O[1],T),n.A.concat(this.dataX,o[0]),n.A.concat(this.dataY,o[1])))}else{for(s=h.evalVisProp("margin"),r=e;c&&r>=T[3];r-=w[1]){if(b=Math.abs((b=a.A.roundToStep(Math.abs(r),p[1]))-Math.abs(r)),v=p[1]-b,"line"===I){if(b-O[1]-g[1]<A||v-O[1]-g[1]<A)continue}else if((b-O[1]-g[1]<A||v-O[1]-g[1]<A)&&(Y||g[1]-Math.abs(r)+O[1]<A)&&(j||g[1]-Math.abs(r)+O[1]<A)&&(X||g[1]+Math.abs(r)-O[1]<A))continue;!(!L&&Math.abs(r)<A)&&(y=Math.abs(T[0]%p[0]),C=Math.abs(T[1]%p[1]),_=Math.abs(T[2]%p[0]),P=Math.abs(T[3]%p[1]),x=p[0]-y,E=p[1]-C,S=p[0]-_,N=p[1]-P,!F&&(-r-O[1]+T[1]-g[1]+E<A&&E-g[1]<A||-r-O[1]+T[1]-g[1]-C<A&&C-g[1]<A||r-O[1]-T[3]-g[1]+N<A&&N-g[1]<A||r-O[1]-T[3]-g[1]-P<A&&P-g[1]<A||-r-O[1]+T[1]<A||r-O[1]-T[3]<A)||(o=[[T[0]-s/h.board.unitX,T[2]+s/h.board.unitX,NaN],[r,r,NaN]],n.A.concat(this.dataX,o[0]),n.A.concat(this.dataY,o[1])))}for(i=t;c&&i<=T[2];i+=w[0]){if(d=Math.abs((d=a.A.roundToStep(Math.abs(i),p[0]))-Math.abs(i)),u=p[0]-d,"line"===I){if(d-O[0]-g[0]<A||u-O[0]-g[0]<A)continue}else if((d-O[0]-g[0]<A||u-O[0]-g[0]<A)&&(Y||g[0]-Math.abs(i)+O[0]<A)&&(j||g[0]+Math.abs(i)-O[0]<A)&&(X||g[0]-Math.abs(i)+O[0]<A))continue;!(!B&&Math.abs(i)<A)&&(y=Math.abs(T[0]%p[0]),C=Math.abs(T[1]%p[1]),_=Math.abs(T[2]%p[0]),P=Math.abs(T[3]%p[1]),x=p[0]-y,E=p[1]-C,S=p[0]-_,N=p[1]-P,!F&&(i-O[0]-T[0]-g[0]+x<A&&x-g[0]<A||i-O[0]-T[0]-g[0]-y<A&&y-g[0]<A||-i-O[0]+T[2]-g[0]+S<A&&S-g[0]<A||-i-O[0]+T[2]-g[0]-_<A&&_-g[0]<A||i-O[0]-T[0]<A||-i-O[0]+T[2]<A)||(o=[[i,i,NaN],[T[1]+s/h.board.unitY,T[3]-s/h.board.unitY,NaN]],n.A.concat(this.dataX,o[0]),n.A.concat(this.dataY,o[1])))}}},t.grids.push(s),t.grids.push(h),h.dump=!1,s.getParents=h.getParents=function(){return l.slice()},s},r.A.registerElement("grid",r.A.createGrid),i(43464),r.A.Image=function(t,e,i,s,a){this.constructor(t,i,o.A.OBJECT_TYPE_IMAGE,o.A.OBJECT_CLASS_OTHER),this.element=this.board.select(i.anchor),this.coordsConstructor(e),this.W=n.A.createFunction(a[0],this.board,""),this.H=n.A.createFunction(a[1],this.board,""),this.addParentsFromJCFunctions([this.W,this.H]),this.usrSize=[this.W(),this.H()],this.size=[Math.abs(this.usrSize[0]*t.unitX),Math.abs(this.usrSize[1]*t.unitY)],this.url=s,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=r.A.deepCopy(this.methodMap,{addTransformation:"addTransform",trans:"addTransform",W:"W",Width:"W",H:"H",Height:"H",setSize:"setSize"})},r.A.Image.prototype=new V.A,n.A.copyPrototypeMethods(r.A.Image,Y.A,"coordsConstructor"),r.A.extend(r.A.Image.prototype,{hasPoint:function(t,e){var i,r,s,h,l,c,d,u,p,A=this.transformations.length;return(n.A.isObject(this.evalVisProp("precision"))?(h=this.board._inputDevice,l=this.evalVisProp("precision."+h)):l=this.board.options.precision.hasPoint,0===A)?(i=t-this.coords.scrCoords[1],r=this.coords.scrCoords[2]-e,i>=-(s=l)&&i-this.size[0]<=s&&r>=-s&&r-this.size[1]<=s):(d=[(c=(c=new f.A(o.A.COORDS_BY_SCREEN,[t,e],this.board)).usrCoords)[0]-this.span[0][0],c[1]-this.span[0][1],c[2]-this.span[0][2]],!!(0<=(u=(p=a.A.innerProduct)(d,this.span[1]))&&u<=p(this.span[1],this.span[1])&&0<=(u=p(d,this.span[2]))&&u<=p(this.span[2],this.span[2]))||!1)},update:function(t){return this.needsUpdate&&(this.updateCoords(t),this.updateSize(),this.updateSpan()),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(t=0,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<i;t++)for(e=0;e<3;e++)r[e]=a.A.matVecMult(this.transformations[t].matrix,r[e]);for(e=0;e<3;e++)r[e][1]/=r[e][0],r[e][2]/=r[e][0],r[e][0]/=r[e][0];for(e=1;e<3;e++)r[e][0]-=r[0][0],r[e][1]-=r[0][1],r[e][2]-=r[0][2];this.span=r}return this},addTransform:function(t){var e;if(n.A.isArray(t))for(e=0;e<t.length;e++)this.transformations.push(t[e]);else this.transformations.push(t);return this},getParents:function(){var t=[this.url,[this.Z(),this.X(),this.Y()],this.usrSize];return 0!==this.parents.length&&(t=this.parents),t},setSize:function(t,e){return this.W=n.A.createFunction(t,this.board,""),this.H=n.A.createFunction(e,this.board,""),this.addParentsFromJCFunctions([this.W,this.H]),this},W:function(){},H:function(){}}
1),r.A.createImage=function(t,e,i){var s,o,a=e[0],h=e[1],l=e[2];if(s=n.A.copyAttributes(i,t.options,"image"),!(o=Y.A.create(r.A.Image,t,h,s,a,l)))throw Error("JSXGraph: Can't create image with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [x,y], [z,x,y], [element,transformation]");return 0!==s.rotate&&o.addRotation(s.rotate),o},r.A.registerElement("image",r.A.createImage),r.A.Image,r.A.createSlider=function(t,e,i){var r,s,h,l,c,d,u,p,A,m,b,g,v,y,C,_,P,x,E,S,N,T,w,O;return x=(O=n.A.copyAttributes(i,t.options,"slider")).withticks,P=O.withlabel,N=O.snapwidth,E=O.snapvalues,S=O.snapvaluedistance,u=t.create("point",e[0],O.point1),p=t.create("point",e[1],O.point2),(m=t.create("segment",[u,p],O.baseline)).updateStdform(),r=u.coords.usrCoords.slice(1),s=p.coords.usrCoords.slice(1),h=e[2][0],l=e[2][1],d=(c=e[2][2])-h,w=-1===(T=n.A.evaluate(N))?l:Math.round((l-h)/T)*T+h,C=r[0]+(s[0]-r[0])*(w-h)/(c-h),_=r[1]+(s[1]-r[1])*(w-h)/(c-h),O.withlabel=!1,(A=t.create("glider",[C,_,m],O)).setAttribute({snapwidth:N,snapvalues:E,snapvaluedistance:S}),b=t.create("segment",[u,A],O.highline),A.Value=function(){var t=this._smax-this._smin,e=this.evalVisProp("snapwidth");return -1===e?this.position*t+this._smin:Math.round(this.position*t/e)*e+this._smin},A.methodMap=n.A.deepCopy(A.methodMap,{Value:"Value",setValue:"setValue",smax:"_smax",smin:"_smin",setMax:"setMax",setMin:"setMin",point1:"point1",point2:"point2",baseline:"baseline",highline:"highline",ticks:"ticks",label:"label"}),A._smax=c,A._smin=h,A.setMax=function(t){return this._smax=t,this},A.setValue=function(t){var e=this._smax-this._smin;return Math.abs(e)>a.A.eps?this.position=(t-this._smin)/e:this.position=0,this.position=Math.max(0,Math.min(1,this.position)),this},A.setMin=function(t){return this._smin=t,this},P&&(y=t.create("text",[function(){return(p.X()-u.X())*.05+p.X()},function(){return(p.Y()-u.Y())*.05+p.Y()},function(){var t,e=A.evalVisProp("digits"),i=A.evalVisProp("suffixlabel"),r=A.evalVisProp("unitlabel"),s=A.evalVisProp("postlabel");return 2===e&&2!==A.evalVisProp("precision")&&(e=A.evalVisProp("precision")),t=null!==i?i:A.name&&""!==A.name?A.name+" = ":"",A.useLocale()?t+=A.formatNumberLocale(A.Value(),e):t+=n.A.toFixed(A.Value(),e),null!==r&&(t+=r),null!==s&&(t+=s),t}],O.label),A.label=y,A.visProp.withlabel=!0,A.hasLabel=!0),A.point1=u,A.point2=p,A.baseline=m,A.highline=b,x&&(n.A.exists(O.generatelabeltext)||(O.ticks.generateLabelText=function(t,e,i){var r=A.point1.Dist(A.point2),s=A._smin,o=A._smax,n=this.getDistanceFromZero(e,t)*(o-s)/r+s;return r<a.A.eps||Math.abs(n)<a.A.eps?"0":this.formatLabelText(n)}),g=2,v=t.create("ticks",[A.baseline,A.point1.Dist(u)/g,function(t){var e=A.point1.Dist(A.point2),i=A.point1.coords.distance(o.A.COORDS_BY_USER,t);return e<a.A.eps?0:i/e*d+h}],O.ticks),A.ticks=v),A.remove=function(){P&&t.removeObject(y),t.removeObject(b),t.removeObject(m),t.removeObject(p),t.removeObject(u),j.prototype.remove.call(A)},u.dump=!1,p.dump=!1,m.dump=!1,b.dump=!1,P&&(y.dump=!1),A.elType="slider",A.parents=e,A.subs={point1:u,point2:p,baseLine:m,highLine:b},A.inherits.push(u,p,m,b),m.inherits=[],b.inherits=[],x&&(v.dump=!1,A.subs.ticks=v,A.inherits.push(v)),A.getParents=function(){return[this.point1.coords.usrCoords.slice(1),this.point2.coords.usrCoords.slice(1),[this._smin,this.position*(this._smax-this._smin)+this._smin,this._smax]]},A.baseline.on("up",function(t){var e,i;A.evalVisProp("moveonup")&&!A.evalVisProp("fixed")&&(e=m.board.getMousePosition(t,0),i=new f.A(o.A.COORDS_BY_SCREEN,e,this.board),A.moveTo([i.usrCoords[1],i.usrCoords[2]]),A.triggerEventHandlers(["drag"],[t]))}),A.prepareUpdate().update(),!t.isSuspendedUpdate&&(A.updateVisibility().updateRenderer(),A.baseline.updateVisibility().updateRenderer(),A.highline.updateVisibility().updateRenderer(),x&&A.ticks.updateVisibility().updateRenderer()),A},r.A.registerElement("slider",r.A.createSlider),r.A.PrefixParser={parse:function(t,e){var i,r,s,o,h,l;if(n.A.isNumber(t)||n.A.isString(t))return t;if(!n.A.isArray(t)||t.length<2)throw Error("prefixParser.parse: term is not an array, number or string");if(i=t[0],s=t.length,"execute"===e)if(n.A.isInArray(["+","-","*","/"],i))for(r=2,o=this.parse(t[1],e);r<s;r++)switch(l=this.parse(t[r],e),i){case"+":o+=l;break;case"-":o-=l;break;case"*":o*=l;break;case"/":o/=l}else if("exec"===i){for(r=2,h=t[1],l=[];r<s;r++)l.push(this.parse(t[r],e));if(n.A.exists(Math[h]))o=Math[h].apply(this,l);else if(n.A.exists(a.A[h]))o=a.A[h].apply(this,l);else throw Error("PrefixParser.parse: "+h+" is not allowed")}
1else{if("V"===(h=t[0])&&(h="Value"),"Coords"===h&&(t[2]="true"),!n.A.exists(t[1][h]))throw Error("PrefixParser.parse: "+h+" is not a method of "+t[1]);for(r=2,l=[];r<s;r++)l.push(this.parse(t[r],e));o=t[1][h].apply(t[1],l)}return o},dimension:function(t){var e,i,r,s,a,h,l,c;if(n.A.isNumber(t))return 0;if(!n.A.isArray(t)||t.length<2)throw Error("PrefixParser.dimension: term is not an array");if(e=t[0],r=t.length,n.A.isInArray(["+","-","*","/"],e))for(i=2,s=this.dimension(t[1]);i<r;i++)switch(l=this.dimension(t[i]),e){case"+":case"-":l!==s&&(s=NaN);break;case"*":s+=l;break;case"/":s-=l}else if("exec"===e)t[2].type===n.A.OBJECT_TYPE_MEASUREMENT?(s=t[2].Dimension(),n.A.exists(t[2].visProp.dim)&&null!==(h=t[2].evalVisProp("dim"))&&(s=h)):s=0;else switch(a=t[0]){case"L":case"Length":case"Perimeter":case"Radius":case"R":s=1;break;case"Area":case"A":s=2;break;default:t[1].type===n.A.OBJECT_TYPE_MEASUREMENT?(s=t[1].Dimension(),n.A.exists(t[1].visProp.dim)&&null!==(h=t[1].evalVisProp("dim"))&&(s=h)):(s=0,("Value"===a||"V"===a)&&[o.A.OBJECT_TYPE_ARC,o.A.OBJECT_TYPE_SECTOR,o.A.OBJECT_TYPE_ANGLE].indexOf(t[1].type)>=0&&(c="",3===t.length&&n.A.isString(t[2])&&(c=t[2].toLowerCase()),s=""===c?+(t[1].type!==o.A.OBJECT_TYPE_ANGLE):+(0===c.indexOf("len"))))}return s},toPrefix:function(t){var e,i,r,s;if(n.A.isNumber(t))return t;if(!n.A.isArray(t)||t.length<2)throw Error("PrefixParser.toPrefix: term is not an array");for(i=1,e=t[0],r=t.length,s=[e];i<r;i++)n.A.isInArray(["+","-","*","/"],e)?s.push(this.toPrefix(t[i])):"V"===e&&t[i].type===n.A.OBJECT_TYPE_MEASUREMENT?s=t[i].toPrefix():"exec"===e?1===i?s.push(t[i]):s.push(this.toPrefix(t[i])):s=[e,t[i].id];return s},getParents:function(t){var e,i,r,s;if(n.A.isNumber(t))return[];if(!n.A.isArray(t)||t.length<2)throw Error("PrefixParser.getParents: term is not an array");for(i=1,e=t[0],r=t.length,s=[];i<r;i++)n.A.isInArray(["+","-","*","/"],e)?n.A.concat(s,this.getParents(t[i])):"V"===e&&t[i].type===n.A.OBJECT_TYPE_MEASUREMENT?n.A.concat(s,t[i].getParents()):"exec"===e?i>1&&n.A.concat(s,this.getParents(t[i])):s.push(t[i]);return s}};let U=r.A.PrefixParser;r.A.createTapemeasure=function(t,e,i){var s,o,a,h,l,c,d,u,p,f,A;return s=e[0],o=e[1],a=n.A.copyAttributes(i,t.options,"tapemeasure","point1"),u=t.create("point",s,a),a=n.A.copyAttributes(i,t.options,"tapemeasure","point2"),p=t.create("point",o,a),u.setAttribute({ignoredSnapToPoints:[p.id]}),p.setAttribute({ignoredSnapToPoints:[u.id]}),h=(a=n.A.copyAttributes(i,t.options,"tapemeasure")).withticks,l=a.withlabel,2===(c=a.digits)&&2!==a.precision&&(c=a.precision),l&&(a.withlabel=!0),d=t.create("segment",[u,p],a),l&&(f=i.name&&""!==i.name?i.name+" = ":"",d.label.setText(function(){var t=d.label.evalVisProp("digits");return d.label.useLocale()?f+d.label.formatNumberLocale(u.Dist(p),t):f+n.A.toFixed(u.Dist(p),t)})),h&&(a=n.A.copyAttributes(i,t.options,"tapemeasure","ticks"),A=t.create("ticks",[d,.1],a),d.inherits.push(A)),d.remove=function(){h&&d.removeTicks(A),t.removeObject(p),t.removeObject(u),V.A.prototype.remove.call(this)},d.Value=function(){return u.Dist(p)},u.dump=!1,p.dump=!1,d.elType="tapemeasure",d.getParents=function(){return[[u.X(),u.Y()],[p.X(),p.Y()]]},d.subs={point1:u,point2:p},h&&(A.dump=!1),d.methodMap=r.A.deepCopy(d.methodMap,{Value:"Value"}),d.prepareUpdate().update(),t.isSuspendedUpdate||(d.updateVisibility().updateRenderer(),d.point1.updateVisibility().updateRenderer(),d.point2.updateVisibility().updateRenderer()),d},r.A.registerElement("tapemeasure",r.A.createTapemeasure),r.A.createMeasurement=function(t,e,i){var r,s,o,a,h,l;for(s=n.A.copyAttributes(i,t.options,"measurement"),o=e[0],a=e[1],h=e[2],(r=t.create("text",[o,a,""],s)).type=n.A.OBJECT_TYPE_MEASUREMENT,r.elType="measurement",r.Value=function(){return U.parse(h,"execute")},r.Dimension=function(){var t=r.evalVisProp("dim");return null!==t?t:U.dimension(h)},r.Unit=function(t){var e,i="",s=r.evalVisProp("units"),o=t,a={};if(n.A.exists(o)||(o=r.Dimension()),n.A.isArray(t)){for(e=0;e<t.length;e++)a["dim"+t[e]]=r.Unit(t[e]);return a}return n.A.isObject(s)&&n.A.exists(s[o])&&!1!==s[o]?i=r.eval(s[o]):n.A.isObject(s)&&n.A.exists(s["dim"+o])&&!1!==s["dim"+o]?i=r.eval(s["dim"+o]):(i=r.evalVisProp("baseunit"),0===o?i="":o>1&&""!==i&&(i=i+"^{"+o+"}")),i},r.getTerm=function(){return h},r.getMethod=function(){var t=h[0];return"V"===t&&(t="Value"),t},r.toPrefix=function(){return U.toPrefix(h)},r.getParents=function(){return U.getParents(h)},r.addParents(r.getParents()),l=0;l<r.parents.length;l++)t.select(r.parents[l]).addChild(r);return r.setText(function(){var t,e="",i="",s=r.Dimension(),o=r.evalVisProp("digits"),a=r.Unit(),h=r.Value();if(r.evalVisProp("showprefix")&&(e=r.evalVisProp("prefix")),r.evalVisProp("showsuffix")&&(i=r.evalVisProp("suffix")),n.A.isNumber(h))"none"===o||(h="auto"===o?r.useLocale()?r.formatNumberLocale(h):n.A.autoDigits(h):r.useLocale()?r.formatNumberLocale(h,o):n.A.toFixed(h,o));else if(n.A.isArray(h))for(t=0;t<h.length;t++)n.A.isNumber(h[t])&&("none"===o||("auto"===o?r.useLocale()?h[t]=r.formatNumberLocale(h[t]):h[t]=n.A.autoDigits(h[t]):r.useLocale()?h[t]=r.formatNumberLocale(h[t],o):h[t]=n.A.toFixed(h[t],o)));return("coords"===s&&n.A.isArray(h)&&(2===h.length&&h.unshift(void 0),h=r.visProp.formatcoords(r,h[1],h[2],h[0])),"direction"===s&&n.A.isArray(h)&&(h=r.visProp.formatdirection(r,h[0],h[1])),n.A.isString(s))?e+h+i:isNaN(s)?e+"NaN"+i:e+h+a+i}),r.methodMap=n.A.deepCopy(r.methodMap,{Value:"Value",Dimension:"Dimension",Unit:"Unit",getTerm:"getTerm",Term:"getTerm",getMethod:"getMethod",Method:"getMethod",getParents:"getParents",Parents:"getParents"}),r},r.A.registerElement("measurement",r.A.createMeasurement),r.A.DataSource=function(){return this.data=[],this.columnHeaders=[],this.rowHeaders=[],this},r.A.extend(r.A.DataSource.prototype,{loadFromArray:function(t,e,
1i){var r,s,o;if(n.A.isArray(e)&&(this.columnHeaders=e,e=!1),n.A.isArray(i)&&(this.rowHeaders=i,i=!1),this.data=[],e&&(this.columnHeaders=[]),i&&(this.rowHeaders=[]),n.A.exists(t)){for(r=0,this.data=[];r<t.length;r++)for(s=0,this.data[r]=[];s<t[r].length;s++)parseFloat(o=t[r][s]).toString()===o?this.data[r][s]=parseFloat(o):"-"!==o?this.data[r][s]=o:this.data[r][s]=NaN;if(e&&(this.columnHeaders=this.data[0].slice(1),this.data=this.data.slice(1)),i)for(r=0,this.rowHeaders=[];r<this.data.length;r++)this.rowHeaders.push(this.data[r][0]),this.data[r]=this.data[r].slice(1)}return this},loadFromTable:function(t,e,i){var r,s,o,a,h;if(n.A.isArray(e)&&(this.columnHeaders=e,e=!1),n.A.isArray(i)&&(this.rowHeaders=i,i=!1),this.data=[],e&&(this.columnHeaders=[]),i&&(this.rowHeaders=[]),t=document.getElementById(t),n.A.exists(t)){for(s=0,r=t.getElementsByTagName("tr"),this.data=[];s<r.length;s++)for(o=0,a=r[s].getElementsByTagName("td"),this.data[s]=[];o<a.length;o++)parseFloat(h=a[o].innerHTML).toString()===h?this.data[s][o]=parseFloat(h):"-"!==h?this.data[s][o]=h:this.data[s][o]=NaN;if(e&&(this.columnHeaders=this.data[0].slice(1),this.data=this.data.slice(1)),i)for(s=0,this.rowHeaders=[];s<this.data.length;s++)this.rowHeaders.push(this.data[s][0]),this.data[s]=this.data[s].slice(1)}return this},addColumn:function(t,e,i){throw Error("not implemented")},addRow:function(t,e,i){throw Error("not implemented")},getColumn:function(t){var e,i=[];if(n.A.isString(t)){for(e=0;e<this.columnHeaders.length;e++)if(t===this.columnHeaders[e]){t=e;break}}for(e=0;e<this.data.length;e++)this.data[e].length>t&&(i[e]=parseFloat(this.data[e][t]));return i},getRow:function(t){var e,i;if(n.A.isString(t)){for(i=0;i<this.rowHeaders.length;i++)if(t===this.rowHeaders[i]){t=i;break}}for(i=0,e=[];i<this.data[t].length;i++)e[i]=this.data[t][i];return e}});let z=r.A.DataSource;r.A.Chart=function(t,e,i){var r,s,o,a,h,l;if(this.constructor(t,i),!n.A.isArray(e)||0===e.length)throw Error("JSXGraph: Can't create a chart without data");if(this.elements=[],n.A.isNumber(e[0]))for(o=0,s=e,r=[];o<s.length;o++)r[o]=o+1;else if(1===e.length&&n.A.isArray(e[0]))for(o=0,s=e[0],r=[],l=n.A.evaluate(s).length;o<l;o++)r[o]=o+1;else 2===e.length&&(l=Math.min(e[0].length,e[1].length),r=e[0].slice(0,l),s=e[1].slice(0,l));if(n.A.isArray(s)&&0===s.length)throw Error("JSXGraph: Can't create charts without data.");for(o=0,h=i.chartstyle.replace(/ /g,"").split(",");o<h.length;o++){switch(h[o]){case"bar":a=this.drawBar(t,r,s,i);break;case"line":a=this.drawLine(t,r,s,i);break;case"fit":a=this.drawFit(t,r,s,i);break;case"spline":a=this.drawSpline(t,r,s,i);break;case"pie":a=this.drawPie(t,s,i);break;case"point":a=this.drawPoints(t,r,s,i);break;case"radar":a=this.drawRadar(t,e,i)}this.elements.push(a)}return this.id=this.board.setId(this,"Chart"),this.elements},r.A.Chart.prototype=new V.A,r.A.extend(r.A.Chart.prototype,{drawLine:function(t,e,i,r){return r.fillcolor="none",r.highlightfillcolor="none",t.create("curve",[e,i],r)},drawSpline:function(t,e,i,r){return r.fillColor="none",r.highlightfillcolor="none",t.create("spline",[e,i],r)},drawFit:function(t,e,i,r){var s=r.degree;return s=Math.max(parseInt(s,10),1)||1,r.fillcolor="none",r.highlightfillcolor="none",t.create("functiongraph",[p.A.regressionPolynomial(s,e,i)],r)},drawBar:function(t,e,i,r){var s,o,a,h,l,c,d,u,p,f,A=[],m=[],b=function(t,i){return function(){return e[t]()-i*a}},g={fixed:!0,withLabel:!1,visible:!1,name:""};if((p=n.A.copyAttributes(r,t.options,"chart"))&&p.width)a=p.width;else{if(e.length<=1)a=1;else for(s=1,a=e[1]-e[0];s<e.length-1;s++)a=e[s+1]-e[s]<a?e[s+1]-e[s]:a;a*=.8}for(s=0,f=n.A.copyAttributes(r,t.options,"chart","label");s<e.length;s++)n.A.isFunction(e[s])?(h=b(s,-.5),l=b(s,0),c=b(s,.5)):(h=e[s]-.5*a,l=e[s],c=e[s]+.5*a),d=n.A.isFunction(i[s])?i[s]():i[s],d=i[s],"horizontal"===p.dir?(m[0]=t.create("point",[0,h],g),m[1]=t.create("point",[d,h],g),m[2]=t.create("point",[d,c],g),m[3]=t.create("point",[0,c],g),n.A.exists(p.labels)&&n.A.exists(p.labels[s])&&(f.anchorX=function(t){return t.X()>=0?"left":"right"},f.anchorY="middle",o=t.create("text",[d,l,p.labels[s]],f))):(m[0]=t.create("point",[h,0],g),m[1]=t.create("point",[h,d],g),m[2]=t.create("point",[c,d],g),m[3]=t.create("point",[c,0],g),n.A.exists(p.labels)&&n.A.exists(p.labels[s])&&(f.anchorX="middle",f.anchorY=function(t){return t.Y()>=0?"bottom":"top"},o=t.create("text",[l,d,p.labels[s]],f))),n.A.isArray(p.colors)&&(u=p.colors,p.fillcolor=u[s%u.length]),A[s]=t.create("polygon",m,p),n.A.exists(p.labels)&&n.A.exists(p.labels[s])&&(A[s].text=o,A[s].addChild(o));return A}
1,drawPoints:function(t,e,i,r){var s,o=[],n=r.infoboxarray;for(s=0,r.fixed=!0,r.name="";s<e.length;s++)r.infoboxtext=!!n&&n[s%n.length],o[s]=t.create("point",[e[s],i[s]],r);return o},drawPie:function(t,e,i){var r,s,a=[],h=[],l=i.colors,c=i.highlightcolors,d=i.labels,u=i.radius||4,p=u,A=i.center||[0,0],m=A[0],b=A[1],g=function(t,i,r){return function(){var s,o,a,h=0;for(o=0;o<=t;o++)h+=parseFloat(n.A.evaluate(e[o]));for(s=h,o=t+1;o<e.length;o++)s+=parseFloat(n.A.evaluate(e[o]));return a=0!==s?2*Math.PI*h/s:0,p()*Math[i](a)+r}},v=function(t,e){var i=-this.point1.coords.usrCoords[1]+this.point2.coords.usrCoords[1],r=-this.point1.coords.usrCoords[2]+this.point2.coords.usrCoords[2];n.A.exists(this.label)&&(this.label.rendNode.style.fontSize=e*this.label.evalVisProp("fontsize")+"px",this.label.fullUpdate()),this.point2.coords=new f.A(o.A.COORDS_BY_USER,[this.point1.coords.usrCoords[1]+i*t,this.point1.coords.usrCoords[2]+r*t],this.board),this.fullUpdate()},y=function(){this.highlighted||(this.highlighted=!0,this.board.highlightedObjects[this.id]=this,this.board.renderer.highlight(this),v.call(this,1.1,2))},C=function(){this.highlighted&&(this.highlighted=!1,this.board.renderer.noHighlight(this),v.call(this,.9090909,1))},_={fixed:!0,withLabel:!1,visible:!1,name:""};if(!n.A.isArray(d))for(r=0,d=[];r<e.length;r++)d[r]="";for(n.A.isFunction(u)||(p=function(){return u}),i.highlightonsector=i.highlightonsector||!1,i.straightfirst=!1,i.straightlast=!1,s=t.create("point",[m,b],_),a[0]=t.create("point",[function(){return p()+m},function(){return b}],_),r=0;r<e.length;r++)a[r+1]=t.create("point",[g(r,"cos",m),g(r,"sin",b)],_),i.name=d[r],i.withlabel=""!==i.name,i.fillcolor=l&&l[r%l.length],i.labelcolor=l&&l[r%l.length],i.highlightfillcolor=c&&c[r%c.length],h[r]=t.create("sector",[s,a[r],a[r+1]],i),i.highlightonsector&&(h[r].hasPoint=h[r].hasPointSector),i.highlightbysize&&(h[r].highlight=y,h[r].noHighlight=C);return{sectors:h,points:a,midpoint:s}},drawRadar:function(t,e,i){var s,a,h,l,c,d,u,p,A,m,b,g,v,y,C,_,P,x,E,S,N,T,w,O,M,k,D,R,L,B,I,V,Y,j,X,F,J,U,z,G,H,$,W=e.length,q=function(){var t,e,i,r,s=this.evalVisProp("label.offset).slice(0");return t=this.point1.X(),e=this.point2.X(),i=this.point1.Y(),r=this.point2.Y(),e<t&&(s[0]=-s[0]),r<i&&(s[1]=-s[1]),this.setLabelRelativeCoords(s),new f.A(o.A.COORDS_BY_USER,[this.point2.X(),this.point2.Y()],this.board)},Z=function(e,i){var r,s,o;return r=t.create("transform",[-(C[i]-v[i]),0],{type:"translate"}),s=t.create("transform",[E/(_[i]+y[i]-(C[i]-v[i])),1],{type:"scale"}),r.melt(s),o=t.create("transform",[e],{type:"rotate"}),r.melt(o),r};if(W<=0)throw Error("JSXGraph radar chart: no data");if(h=i.paramarray,!n.A.exists(h))throw Error("JSXGraph radar chart: need paramArray attribute");if((l=h.length)<=1)throw Error("JSXGraph radar chart: need more than one param in paramArray");for(s=0;s<W;s++)if(l!==e[s].length)throw Error("JSXGraph radar chart: use data length equal to number of params ("+e[s].length+" != "+l+")");for(a=0,c=[],d=[];a<l;a++)c[a]=e[0][a],d[a]=c[a];for(s=1;s<W;s++)for(a=0;a<l;a++)e[s][a]>c[a]&&(c[a]=e[s][a]),e[s][a]<d[a]&&(d[a]=e[s][a]);for(s=0,u=[],p=[];s<W;s++)u[s]="",p[s]=[];for(s=0,A=[],m=[],b=i.startshiftratio||0,g=i.endshiftratio||0;s<l;s++)A[s]=(c[s]-d[s])*b,m[s]=(c[s]-d[s])*g;if(v=i.startshiftarray||A,y=i.endshiftarray||m,C=i.startarray||d,n.A.exists(i.start))for(s=0;s<l;s++)C[s]=i.start;if(_=i.endarray||c,n.A.exists(i.end))for(s=0;s<l;s++)_[s]=i.end;if(v.length!==l)throw Error("JSXGraph radar chart: start shifts length is not equal to number of parameters");if(y.length!==l)throw Error("JSXGraph radar chart: end shifts length is not equal to number of parameters");if(C.length!==l)throw Error("JSXGraph radar chart: starts length is not equal to number of parameters");if(_.length!==l)throw Error("JSXGraph radar chart: snds length is not equal to number of parameters");for(P=i.labelarray||u,x=i.colors,E=i.radius||10,H=i.strokewidth||1,n.A.exists(i.highlightonsector)||(i.highlightonsector=!1),S={name:i.name,id:i.id,strokewidth:H,polystrokewidth:i.polystrokewidth||H,strokecolor:i.strokecolor||"black",straightfirst:!1,straightlast:!1,fillcolor:i.fillColor||"#FFFF88",fillopacity:i.fillOpacity||.4,highlightfillcolor:i.highlightFillColor||"#FF7400",highlightstrokecolor:i.highlightStrokeColor||"black",gradient:i.gradient||"none"},T=(N=i.center||[0,0])[0],w=N[1],O=t.create("point",[T,w],{name:"",fixed:!0,withlabel:!1,visible:!1}),M=Math.PI/2-Math.PI/l,k=M=i.startangle||0,D=[],R=[],s=0;s<l;s++)for(k+=2*Math.PI/l,B=E*Math.cos(k)+T,I=E*Math.sin(k)+w,D[s]=t.create("point",[B,I],{name:"",fixed:!0,withlabel:!1,visible:!1}),R[s]=t.create("line",[O,D[s]],{name:h[s],strokeColor:S.strokecolor,strokeWidth:S.strokewidth,strokeOpacity:1,straightFirst:!1,straightLast:!1,withLabel:!0,highlightStrokeColor:S.highlightstrokecolor}),R[s].getLabelAnchor=q,L=Z(k,s),a=0;a<e.length;a++)$=e[a][s],p[a][s]=t.create("point",[$,0],{name:"",fixed:!0,withlabel:!1,visible:!1}),p[a][s].addTransform(p[a][s],L);for(s=0,V=[];s<W;s++)for(a=0,S.labelcolor=x&&x[s%x.length],S.strokecolor=x&&x[s%x.length],S.fillcolor=x&&x[s%x.length],V[s]=t.create("polygon",p[s],{withLines:!0,withLabel:!1,fillColor:S.fillcolor,fillOpacity:S.fillopacity,highlightFillColor:S.highlightfillcolor});a<l;a++)V[s].borders[a].setAttribute("strokecolor:"+x[s%x.length]),V[s].borders[a].setAttribute("strokewidth:"+S.polystrokewidth);switch(i.legendposition||"none"){case"right":j=i.legendleftoffset||2,X=i.legendtopoffset||1,this.legend=t.create("legend",[T+E+j,w+E-X],{labels:P,colors:x});break;case"none":break;default:r.A.debug("Unknown legend position")}if(Y=[],i.showcircles){for(s=0,F=[];s<6;s++)F[s]=20*s;if(F[0]="0",(U=(J=i.circlelabelarray||F).length)<2)throw Error("JSXGraph radar chart: too less circles in circleLabelArray");for(s=0,z=[],L=Z(M+Math.PI/l,0),S.fillcolor="none",S.highlightfillcolor="none",S.strokecolor=i.strokecolor||"black",S.strokewidth=i.circlestrokewidth||.5,S.layer=0,G=(_[0]-C[0])/(U-1);s<U;s++)z[s]=t.create("point",[C[0]+s*G,0],{name:J[s],size:0,fixed:!0,withLabel:!0,visible:!0}),z[s].addTransform(z[s],L),Y[s]=t.create("circle",[O,z[s]],S)}return this.rendNode=V[0].rendNode,{circles:Y,lines:R,points:p,midpoint:O,polygons:V}},updateRenderer:function(){return this},update:function(){return this.needsUpdate&&this.updateDataArray(),this},updateDataArray:function(){return this}}
1),r.A.createChart=function(t,e,i){var o,a,h,l,c,d,u,p,f,A,m,b,g,v,y,C,_=[],P=s.A.isBrowser?t.document.getElementById(e[0]):null;if(1===e.length&&n.A.isString(e[0])){if(n.A.exists(P)){if(f=n.A.copyAttributes(i,t.options,"chart"),o=(P=new z().loadFromTable(e[0],f.withheaders,f.withheaders)).data,c=P.columnHeaders,a=P.rowHeaders,A=f.width,m=f.name,b=f.strokecolor,g=f.fillcolor,v=f.highlightstrokecolor,y=f.highlightfillcolor,t.suspendUpdate(),C=o.length,p=[],f.rows&&n.A.isArray(f.rows)){for(h=0;h<C;h++)for(l=0;l<f.rows.length;l++)if(f.rows[l]===h||f.withheaders&&f.rows[l]===a[h]){p.push(o[h]);break}}else p=o;for(h=0,C=p.length;h<C;h++){if(u=[],f.chartstyle&&-1!==f.chartstyle.indexOf("bar")){for(d=A||.8,u.push(1-d/2+(h+.5)*d/C),l=1;l<p[h].length;l++)u.push(u[l-1]+1);f.width=d/C}m&&m.length===C?f.name=m[h]:f.withheaders&&(f.name=c[h]),b&&b.length===C?f.strokecolor=b[h]:f.strokecolor=M.A.hsv2rgb((h+1)/C*360,.9,.6),g&&g.length===C?f.fillcolor=g[h]:f.fillcolor=M.A.hsv2rgb((h+1)/C*360,.9,1),v&&v.length===C?f.highlightstrokecolor=v[h]:f.highlightstrokecolor=M.A.hsv2rgb((h+1)/C*360,.9,1),y&&y.length===C?f.highlightfillcolor=y[h]:f.highlightfillcolor=M.A.hsv2rgb((h+1)/C*360,.9,.6),f.chartstyle&&-1!==f.chartstyle.indexOf("bar")?_.push(new r.A.Chart(t,[u,p[h]],f)):_.push(new r.A.Chart(t,[p[h]],f))}t.unsuspendUpdate()}return _}return f=n.A.copyAttributes(i,t.options,"chart"),new r.A.Chart(t,e,f)},r.A.registerElement("chart",r.A.createChart),r.A.Legend=function(t,e,i){var r;if(this.constructor(),r=n.A.copyAttributes(i,t.options,"legend"),this.board=t,this.coords=new f.A(o.A.COORDS_BY_USER,e,this.board),this.myAtts={},this.label_array=r.labelarray||r.labels,this.color_array=r.colorarray||r.colors,this.opacy_array=r.strokeopacity||[1],this.lines=[],this.myAtts.strokewidth=r.strokewidth||5,this.myAtts.straightfirst=!1,this.myAtts.straightlast=!1,this.myAtts.withlabel=!0,this.myAtts.fixed=!0,this.myAtts.frozen=r.frozen||!1,this.style=r.legendstyle||r.style,"vertical"===this.style)this.drawVerticalLegend(t,r);else throw Error("JSXGraph: Unknown legend style: "+this.style);this.id=this.board.setId(this,"Leg")},r.A.Legend.prototype=new V.A,r.A.Legend.prototype.drawVerticalLegend=function(t,e){var i,r=e.linelength||1,s=(e.rowheight||20)/this.board.unitY,n=function(){return this.setLabelRelativeCoords(this.visProp.label.offset),new f.A(o.A.COORDS_BY_USER,[this.point2.X(),this.point2.Y()],this.board)};for(i=0;i<this.label_array.length;i++)this.myAtts.name=this.label_array[i],this.myAtts.strokecolor=this.color_array[i%this.color_array.length],this.myAtts.highlightstrokecolor=this.color_array[i%this.color_array.length],this.myAtts.strokeopacity=this.opacy_array[i%this.opacy_array.length],this.myAtts.highlightstrokeopacity=this.opacy_array[i%this.opacy_array.length],this.myAtts.label={offset:[10,0],strokeColor:this.color_array[i%this.color_array.length],strokeWidth:this.myAtts.strokewidth},this.lines[i]=t.create("line",[[this.coords.usrCoords[1],this.coords.usrCoords[2]-i*s],[this.coords.usrCoords[1]+r,this.coords.usrCoords[2]-i*s]],this.myAtts),this.myAtts.frozen&&this.lines[i].setAttribute({point1:{frozen:!0},point2:{frozen:!0}}),this.lines[i].getLabelAnchor=n,this.lines[i].prepareUpdate().update().updateVisibility(this.lines[i].evalVisProp("visible")).updateRenderer(),this.addChild(this.lines[i])},r.A.createLegend=function(t,e,i){var s=[0,0];if(n.A.exists(e)&&2===e.length)s=e;else throw Error("JSXGraph: Legend element needs two numbers as parameters");return new r.A.Legend(t,s,i)},r.A.registerElement("legend",r.A.createLegend),r.A.Chart,r.A.Legend,r.A.Transformation=function(t,e,i,r){this.elementClass=o.A.OBJECT_CLASS_OTHER,this.type=o.A.OBJECT_TYPE_TRANSFORMATION,r?(this.is3D=!0,this.matrix=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]]):(this.is3D=!1,this.matrix=[[1,0,0],[0,1,0],[0,0,1]]),this.board=t,this.isNumericMatrix=!1,this.is3D?this.setMatrix3D(i[0],e,i.slice(1)):this.setMatrix(t,e,i),this.methodMap={apply:"apply",applyOnce:"applyOnce",bindTo:"bindTo",bind:"bindTo",melt:"melt",meltTo:"meltTo"}},r.A.Transformation.prototype={},r.A.extend(r.A.Transformation.prototype,{update:function(){return this}
1,setMatrix:function(t,e,i){var r;for(r=0,this.isNumericMatrix=!0;r<i.length;r++)if("number"!=typeof i[r]){this.isNumericMatrix=!1;break}if("translate"===e){if(2!==i.length)throw Error("JSXGraph: translate transformation needs 2 parameters.");this.evalParam=n.A.createEvalFunction(t,i,2),this.update=function(){this.matrix[1][0]=this.evalParam(0),this.matrix[2][0]=this.evalParam(1)}}else if("scale"===e){if(2!==i.length)throw Error("JSXGraph: scale transformation needs 2 parameters.");this.evalParam=n.A.createEvalFunction(t,i,2),this.update=function(){this.matrix[1][1]=this.evalParam(0),this.matrix[2][2]=this.evalParam(1)}}else if("reflect"===e)i.length<4&&(i[0]=t.select(i[0])),2===i.length&&(i[1]=t.select(i[1])),4===i.length&&(this.evalParam=n.A.createEvalFunction(t,i,4)),this.update=function(){var t,e,r,s,o,n,h,l;1===i.length?h=i[0].stdform:2===i.length?h=a.A.crossProduct(i[1].coords.usrCoords,i[0].coords.usrCoords):4===i.length&&(h=a.A.crossProduct([1,this.evalParam(2),this.evalParam(3)],[1,this.evalParam(0),this.evalParam(1)])),t=h[1],e=h[2],n=(l=[-(r=h[0])*t,-r*e,t*t+e*e])[2],s=l[0]/l[2],o=l[1]/l[2],t=-h[2],e=h[1],this.matrix[1][1]=(t*t-e*e)/n,this.matrix[1][2]=2*t*e/n,this.matrix[2][1]=this.matrix[1][2],this.matrix[2][2]=-this.matrix[1][1],this.matrix[1][0]=s*(1-this.matrix[1][1])-o*this.matrix[1][2],this.matrix[2][0]=o*(1-this.matrix[2][2])-s*this.matrix[2][1]};else if("rotate"===e)3===i.length?this.evalParam=n.A.createEvalFunction(t,i,3):i.length>0&&i.length<=2&&(this.evalParam=n.A.createEvalFunction(t,i,1),2!==i.length||n.A.isArray(i[1])||(i[1]=t.select(i[1]))),this.update=function(){var t,e,r=this.evalParam(0),s=Math.cos(r),o=Math.sin(r);this.matrix[1][1]=s,this.matrix[1][2]=-o,this.matrix[2][1]=o,this.matrix[2][2]=s,i.length>1&&(3===i.length?(t=this.evalParam(1),e=this.evalParam(2)):n.A.isArray(i[1])?(t=i[1][0],e=i[1][1]):(t=i[1].X(),e=i[1].Y()),this.matrix[1][0]=t*(1-s)+e*o,this.matrix[2][0]=e*(1-s)-t*o)};else if("shear"===e){if(2!==i.length)throw Error("JSXGraph: shear transformation needs 2 parameters.");this.evalParam=n.A.createEvalFunction(t,i,2),this.update=function(){this.matrix[1][2]=this.evalParam(0),this.matrix[2][1]=this.evalParam(1)}}else if("generic"===e){if(9!==i.length)throw Error("JSXGraph: generic transformation needs 9 parameters.");this.evalParam=n.A.createEvalFunction(t,i,9),this.update=function(){this.matrix[0][0]=this.evalParam(0),this.matrix[0][1]=this.evalParam(1),this.matrix[0][2]=this.evalParam(2),this.matrix[1][0]=this.evalParam(3),this.matrix[1][1]=this.evalParam(4),this.matrix[1][2]=this.evalParam(5),this.matrix[2][0]=this.evalParam(6),this.matrix[2][1]=this.evalParam(7),this.matrix[2][2]=this.evalParam(8)}}else if("matrix"===e){if(1!==i.length)throw Error("JSXGraph: transformation of type 'matrix' needs 1 parameter.");this.evalParam=i[0].slice(),this.update=function(){var t,e;for(t=0;t<3;t++)for(e=0;e<3;e++)this.matrix[t][e]=n.A.evaluate(this.evalParam[t][e])}}},setMatrix3D:function(t,e,i){var r,s=t.board;for(r=0,this.isNumericMatrix=!0;r<i.length;r++)if("number"!=typeof i[r]){this.isNumericMatrix=!1;break}if("translate"===e){if(3!==i.length)throw Error("JSXGraph: 3D translate transformation needs 3 parameters.");this.evalParam=n.A.createEvalFunction(s,i,3),this.update=function(){this.matrix[1][0]=this.evalParam(0),this.matrix[2][0]=this.evalParam(1),this.matrix[3][0]=this.evalParam(2)}}else if("scale"===e){if(3!==i.length&&4!==i.length)throw Error("JSXGraph: 3D scale transformation needs either 3 or 4 parameters.");this.evalParam=n.A.createEvalFunction(s,i,3),this.update=function(){var t=this.evalParam(0),e=this.evalParam(1),i=this.evalParam(2);this.matrix[1][1]=t,this.matrix[2][2]=e,this.matrix[3][3]=i}}else"rotateX"===e?(i.length>0&&i.length<=2&&(this.evalParam=n.A.createEvalFunction(s,i,1)),this.update=function(){var t=this.evalParam(0),e=Math.cos(t),i=Math.sin(t);this.matrix[2][2]=e,this.matrix[2][3]=-i,this.matrix[3][2]=i,this.matrix[3][3]=e}):"rotateY"===e?(i.length>0&&i.length<=2&&(this.evalParam=n.A.createEvalFunction(s,i,1)),this.update=function(){var t=this.evalParam(0),e=Math.cos(t),i=Math.sin(t);
1this.matrix[1][1]=e,this.matrix[1][3]=i,this.matrix[3][1]=-i,this.matrix[3][3]=e}):"rotateZ"===e?(i.length>0&&i.length<=2&&(this.evalParam=n.A.createEvalFunction(s,i,1)),this.update=function(){var t=this.evalParam(0),e=Math.cos(t),i=Math.sin(t);this.matrix[1][1]=e,this.matrix[1][2]=-i,this.matrix[2][1]=i,this.matrix[2][2]=e}):"rotate"===e&&(2===i.length&&(this.evalParam=n.A.createEvalFunction(s,i,2)),this.update=function(){var t,e,i,r=this.evalParam(0),s=this.evalParam(1),o=Math.cos(r),n=Math.sin(r),h=a.A.norm(s);3===s.length?(t=s[0]/h,e=s[1]/h,i=s[2]/h):(t=s[1]/h,e=s[2]/h,i=s[3]/h),this.matrix=[[1,0,0,0],[0,t*t*(1-o)+o,t*e*(1-o)-i*n,t*i*(1-o)+e*n],[0,e*t*(1-o)+i*n,e*e*(1-o)+o,e*i*(1-o)-t*n],[0,i*t*(1-o)-e*n,i*e*(1-o)+t*n,i*i*(1-o)+o]]})},apply:function(t,e){var i;return this.update(),i=this.is3D?t.coords:n.A.exists(e)?t.initialCoords.usrCoords:t.coords.usrCoords,a.A.matVecMult(this.matrix,i)},applyOnce:function(t){var e,i,r;for(n.A.isArray(t)||(t=[t]),i=t.length,r=0;r<i;r++)this.update(),this.is3D?t[r].coords=a.A.matVecMult(this.matrix,t[r].coords):(e=a.A.matVecMult(this.matrix,t[r].coords.usrCoords),t[r].coords.setCoordinates(o.A.COORDS_BY_USER,e))},bindTo:function(t){var e,i;if(n.A.isArray(t))for(e=0,i=t.length;e<i;e++)t[e].transformations.push(this);else t.transformations.push(this)},meltTo:function(t){var e,i,r;if(n.A.isArray(t))for(e=0;e<t.length;e++)this.meltTo(t[e]);else(i=t.transformations).length>0&&i[i.length-1].isNumericMatrix&&this.isNumericMatrix?i[i.length-1].melt(this):(r=this.clone(),i.push(r))},clone:function(){var t=null;return this.isNumericMatrix&&((t=new r.A.Transformation(this.board,"none",[])).matrix=this.matrix.slice()),t},setProperty:function(t){r.A.deprecated("Transformation.setProperty()","Transformation.setAttribute()")},setAttribute:function(t){},melt:function(t){var e=[];return this.update(),t.update(),e=a.A.matMatMult(t.matrix,this.matrix),this.update=function(){this.matrix=e},this},getParents:function(){var t=[[].concat.apply([],this.matrix)];return 0!==this.parents.length&&(t=this.parents),t}}),r.A.createTransform=function(t,e,i){return new r.A.Transformation(t,i.type,e)},r.A.registerElement("transform",r.A.createTransform),r.A.createTransform3D=function(t,e,i){return new r.A.Transformation(t,i.type,e,!0)},r.A.registerElement("transform3d",r.A.createTransform3D),r.A.Transformation,r.A.Turtle=function(t,e,i){var r,s,a;return this.constructor(t,i,o.A.OBJECT_TYPE_TURTLE,o.A.OBJECT_CLASS_OTHER),this.turtleIsHidden=!1,this.board=t,this.visProp.curveType="plot",this._attributes=n.A.copyAttributes(this.visProp,t.options,"turtle"),delete this._attributes.id,r=0,s=0,a=90,0!==e.length&&(3===e.length?(r=e[0],s=e[1],a=e[2]):2===e.length?n.A.isArray(e[0])?(r=e[0][0],s=e[0][1],a=e[1]):(r=e[0],s=e[1]):(r=e[0][0],s=e[0][1])),this.init(r,s,a),this.methodMap=n.A.deepCopy(this.methodMap,{forward:"forward",fd:"forward",back:"back",bk:"back",right:"right",rt:"right",left:"left",lt:"left",penUp:"penUp",pu:"penUp",up:"penUp",penDown:"penDown",pd:"penDown",down:"penDown",clearScreen:"clearScreen",cs:"clearScreen",clean:"clean",setPos:"setPos",home:"home",hideTurtle:"hideTurtle",ht:"hideTurtle",hide:"hideTurtle",showTurtle:"showTurtle",st:"showTurtle",show:"showTurtle",penSize:"setPenSize",setPenSize:"setPenSize",penColor:"setPenColor",setPenColor:"setPenColor",highlightPenColor:"setHighlightPenColor",setHighlightPenColor:"setHighlightPenColor",getPenColor:"getPenColor",Color:"getPenColor",getHighlightPenColor:"getHighlightPenColor",HighlightColor:"getHighlightPenColor",getPenSize:"getPenSize",Size:"getPenSize",pushTurtle:"pushTurtle",push:"pushTurtle",popTurtle:"popTurtle",pop:"popTurtle",lookTo:"lookTo",pos:"pos",Pos:"pos",moveTo:"moveTo",X:"X",Y:"Y"}),this},r.A.Turtle.prototype=new V.A,r.A.extend(r.A.Turtle.prototype,{init:function(t,e,i){var r={fixed:!0,name:"",visible:!1,withLabel:!1};this.arrowLen=20/a.A.hypot(this.board.unitX,this.board.unitY),this.pos=[t,e],this.isPenDown=!0,this.dir=90,this.stack=[],this.objects=[],this.curve=this.board.create("curve",[[this.pos[0]],[this.pos[1]]],this._attributes),this.objects.push(this.curve),this.turtle=this.board.create("point",this.pos,r),this.objects.push(this.turtle),this.turtle2=this.board.create("point",[this.pos[0],this.pos[1]+this.arrowLen],r),this.objects.push(this.turtle2),this.visProp.arrow.lastArrow=!0,this.visProp.arrow.straightFirst=!1,this.visProp.arrow.straightLast=!1,this.arrow=this.board.create("line",[this.turtle,this.turtle2],this.visProp.arrow),this.objects.push(this.arrow),this.subs={arrow:this.arrow},this.inherits.push(this.arrow),this.right(90-i),this.board.update()},forward:function(t){if(0===t)return this;var e,i=t*Math.cos(this.dir*Math.PI/180),r=t*Math.sin(this.dir*Math.PI/180);
1return this.turtleIsHidden||((e=this.board.create("transform",[i,r],{type:"translate"})).applyOnce(this.turtle),e.applyOnce(this.turtle2)),this.isPenDown&&this.curve.dataX.length>=8192&&(this.curve=this.board.create("curve",[[this.pos[0]],[this.pos[1]]],this._attributes),this.objects.push(this.curve)),this.pos[0]+=i,this.pos[1]+=r,this.isPenDown&&(this.curve.dataX.push(this.pos[0]),this.curve.dataY.push(this.pos[1])),this.board.update(),this},back:function(t){return this.forward(-t)},right:function(t){return this.dir-=t,this.dir%=360,this.turtleIsHidden||this.board.create("transform",[-t*Math.PI/180,this.turtle],{type:"rotate"}).applyOnce(this.turtle2),this.board.update(),this},left:function(t){return this.right(-t)},penUp:function(){return this.isPenDown=!1,this},penDown:function(){return this.isPenDown=!0,this.curve=this.board.create("curve",[[this.pos[0]],[this.pos[1]]],this._attributes),this.objects.push(this.curve),this},clean:function(){var t,e;for(t=0;t<this.objects.length;t++)(e=this.objects[t]).type===o.A.OBJECT_TYPE_CURVE&&(this.board.removeObject(e),this.objects.splice(t,1));return this.curve=this.board.create("curve",[[this.pos[0]],[this.pos[1]]],this._attributes),this.objects.push(this.curve),this.board.update(),this},clearScreen:function(){var t,e,i=this.objects.length;for(t=0;t<i;t++)e=this.objects[t],this.board.removeObject(e);return this.init(0,0,90),this},setPos:function(t,e){return n.A.isArray(t)?this.pos=t:this.pos=[t,e],this.turtleIsHidden||(this.turtle.setPositionDirectly(o.A.COORDS_BY_USER,[t,e]),this.turtle2.setPositionDirectly(o.A.COORDS_BY_USER,[t,e+this.arrowLen]),this.board.create("transform",[-(this.dir-90)*Math.PI/180,this.turtle],{type:"rotate"}).applyOnce(this.turtle2)),this.curve=this.board.create("curve",[[this.pos[0]],[this.pos[1]]],this._attributes),this.objects.push(this.curve),this.board.update(),this},setPenSize:function(t){return this.curve=this.board.create("curve",[[this.pos[0]],[this.pos[1]]],this.copyAttr("strokeWidth",t)),this.objects.push(this.curve),this},setPenColor:function(t){return this.curve=this.board.create("curve",[[this.pos[0]],[this.pos[1]]],this.copyAttr("strokeColor",t)),this.objects.push(this.curve),this},getPenAttribute:function(t){var e,i=this.objects.length;return e=4===i?0:i-1,this.objects[e].evalVisProp(t)},getPenSize:function(){return this.getPenAttribute("strokewidth")},getPenColor:function(){return this.getPenAttribute("strokecolor")},getHighlightPenColor:function(){return this.getPenAttribute("highlightstrokecolor")},setHighlightPenColor:function(t){return this.curve=this.board.create("curve",[[this.pos[0]],[this.pos[1]]],this.copyAttr("highlightStrokeColor",t)),this.objects.push(this.curve),this},setAttribute:function(t){var e,i,r,s=this.objects.length;for(e=0;e<s;e++)(i=this.objects[e]).type===o.A.OBJECT_TYPE_CURVE&&i.setAttribute(t);return r=this.visProp.id,this.visProp=n.A.deepCopy(this.curve.visProp),this.visProp.id=r,this._attributes=n.A.deepCopy(this.visProp),delete this._attributes.id,this},copyAttr:function(t,e){return this._attributes[t.toLowerCase()]=e,this._attributes},showTurtle:function(){return this.turtleIsHidden=!1,this.arrow.setAttribute({visible:!0}),this.visProp.arrow.visible=!1,this.setPos(this.pos[0],this.pos[1]),this.board.update(),this},hideTurtle:function(){return this.turtleIsHidden=!0,this.arrow.setAttribute({visible:!1}),this.visProp.arrow.visible=!1,this.board.update(),this},home:function(){return this.pos=[0,0],this.setPos(this.pos[0],this.pos[1]),this},pushTurtle:function(){return this.stack.push([this.pos[0],this.pos[1],this.dir]),this},popTurtle:function(){var t=this.stack.pop();return this.pos[0]=t[0],this.pos[1]=t[1],this.dir=t[2],this.setPos(this.pos[0],this.pos[1]),this},lookTo:function(t){var e,i,r,s;return n.A.isArray(t)?(e=this.pos[0],i=this.pos[1],r=t[0],s=Math.atan2(t[1]-i,r-e),this.right(this.dir-180*s/Math.PI)):n.A.isNumber(t)&&this.right(this.dir-t),this},moveTo:function(t){var e,i,r;return n.A.isArray(t)&&(e=t[0]-this.pos[0],i=t[1]-this.pos[1],this.turtleIsHidden||((r=this.board.create("transform",[e,i],{type:"translate"})).applyOnce(this.turtle),r.applyOnce(this.turtle2)),this.isPenDown&&this.curve.dataX.length>=8192&&(this.curve=this.board.create("curve",[[this.pos[0]],[this.pos[1]]],this._attributes),this.objects.push(this.curve)),this.pos[0]=t[0],this.pos[1]=t[1],this.isPenDown&&(this.curve.dataX.push(this.pos[0]),this.curve.dataY.push(this.pos[1])),this.board.update()),this},fd:function(t){return this.forward(t)},bk:function(t){return this.back(t)},lt:function(t){return this.left(t)},rt:function(t){return this.right(t)},pu:function(){return this.penUp()},pd:function(){return this.penDown()},ht:function(){return this.hideTurtle()},st:function(){return this.showTurtle()},cs:function(){return this.clearScreen()},push:function(){return this.pushTurtle()},pop:function(){return this.popTurtle()},evalAt:function(t,e){var i,r,s,n,a=this.objects.length;for(i=0,r=0;i<a;i++)if((s=this.objects[i]).elementClass===o.A.OBJECT_CLASS_CURVE){
1if(r<=t&&t<r+s.numberPoints)return n=t-r,s[e](n);r+=s.numberPoints}return this[e]()},X:function(t){return n.A.exists(t)?this.evalAt(t,"X"):this.pos[0]},Y:function(t){return n.A.exists(t)?this.evalAt(t,"Y"):this.pos[1]},Z:function(t){return 1},minX:function(){return 0},maxX:function(){var t,e=this.objects.length,i=0;for(t=0;t<e;t++)this.objects[t].elementClass===o.A.OBJECT_CLASS_CURVE&&(i+=this.objects[t].numberPoints);return i},hasPoint:function(t,e){var i,r;for(i=0;i<this.objects.length;i++)if((r=this.objects[i]).type===o.A.OBJECT_TYPE_CURVE&&r.hasPoint(t,e))return!0;return!1}}),r.A.createTurtle=function(t,e,i){var s;return e=e||[],s=n.A.copyAttributes(i,t.options,"turtle"),new r.A.Turtle(t,e,s)},r.A.registerElement("turtle",r.A.createTurtle),r.A.Turtle,r.A.Ticks=function(t,e,i){if(this.constructor(t.board,i,o.A.OBJECT_TYPE_TICKS,o.A.OBJECT_CLASS_OTHER),this.line=t,this.board=this.line.board,this.fixedTicks=null,this.equidistant=!1,this.labelsData=[],n.A.isFunction(e))throw this.ticksFunction=e,Error("Function arguments are no longer supported.");n.A.isArray(e)?this.fixedTicks=e:this.equidistant=!0,this.ticks=[],this.labels=[],this.labelCounter=0,this.id=this.line.addTicks(this),this.elType="ticks",this.inherits.push(this.labels),this.board.setId(this,"Ti")},r.A.Ticks.prototype=new V.A,r.A.extend(r.A.Ticks.prototype,{hasPoint:function(t,e){var i,r,s,h,l=this.ticks&&this.ticks.length||0;if(!this.line.evalVisProp("scalable")||this.line.elementClass===o.A.OBJECT_CLASS_CURVE||(n.A.isObject(this.evalVisProp("precision"))?(h=this.board._inputDevice,s=this.evalVisProp("precision."+h)):s=this.board.options.precision.hasPoint,s+=.5*this.evalVisProp("strokewidth"),0!==this.line.stdform[1]&&0!==this.line.stdform[2]&&this.line.type!==o.A.OBJECT_TYPE_AXIS))return!1;for(i=0;i<l;i++)if((r=this.ticks[i])[2]&&!(0===this.line.stdform[1]&&Math.abs(r[0][0]-this.line.point1.coords.scrCoords[1])<a.A.eps||0===this.line.stdform[2]&&Math.abs(r[1][0]-this.line.point1.coords.scrCoords[2])<a.A.eps)&&(Math.abs(r[0][0]-r[0][1])>=1||Math.abs(r[1][0]-r[1][1])>=1)){if(0===this.line.stdform[1]){if(Math.abs(e-this.line.point1.coords.scrCoords[2])<2*s&&r[0][0]-s<t&&t<r[0][1]+s)return!0}else if(0===this.line.stdform[2]&&Math.abs(t-this.line.point1.coords.scrCoords[1])<2*s&&r[1][0]-s<e&&e<r[1][1]+s)return!0}return!1},setPositionDirectly:function(t,e,i){var r,s,n=new f.A(t,e,this.board),h=new f.A(t,i,this.board),l=this.board.getBoundingBox();return this.line.type===o.A.OBJECT_TYPE_AXIS&&this.line.evalVisProp("scalable")&&(Math.abs(this.line.stdform[1])<a.A.eps&&Math.abs(n.usrCoords[1]*h.usrCoords[1])>a.A.eps?(r=h.usrCoords[1]/n.usrCoords[1],l[0]*=r,l[2]*=r,this.board.setBoundingBox(l,this.board.keepaspectratio,"update")):Math.abs(this.line.stdform[2])<a.A.eps&&Math.abs(n.usrCoords[2]*h.usrCoords[2])>a.A.eps&&(s=h.usrCoords[2]/n.usrCoords[2],l[3]*=s,l[1]*=s,this.board.setBoundingBox(l,this.board.keepaspectratio,"update"))),this},calculateTicksCoordinates:function(){var t,e,i;if(!(this.line.elementClass===o.A.OBJECT_CLASS_LINE&&(this.setTicksSizeVariables(),Math.abs(this.dx)<a.A.eps&&Math.abs(this.dy)<a.A.eps)))return t=this.getZeroCoordinates(),e=this.line.elementClass===o.A.OBJECT_CLASS_LINE?this.getLowerAndUpperBounds(t,"ticksdistance"):{lower:this.line.minX(),upper:this.line.maxX(),a1:0,a2:0,m1:0,m2:0},"polar"===this.evalVisProp("type")&&(i=this.board.getBoundingBox(),e.upper=Math.max(a.A.hypot(i[0],i[1]),a.A.hypot(i[2],i[3]))),this.ticks=[],this.labelsData=[],this.equidistant?this.generateEquidistantTicks(t,e):this.generateFixedTicks(t,e),this},setTicksSizeVariables:function(t){var e,i,r,s,o=.5*this.evalVisProp("majorheight"),h=.5*this.evalVisProp("minorheight");n.A.exists(t)?(i=this.line.minX(),r=this.line.maxX(),(s=this.line.points.length)<2?(this.dxMaj=0,this.dyMaj=0):a.A.relDif(t,i)<a.A.eps?(this.dxMaj=this.line.points[0].usrCoords[2]-this.line.points[1].usrCoords[2],this.dyMaj=this.line.points[1].usrCoords[1]-this.line.points[0].usrCoords[1]):a.A.relDif(t,r)<a.A.eps?(this.dxMaj=this.line.points[s-2].usrCoords[2]-this.line.points[s-1].usrCoords[2],this.dyMaj=this.line.points[s-1].usrCoords[1]-this.line.points[s-2].usrCoords[1]):(this.dxMaj=-p.A.D(this.line.Y)(t),this.dyMaj=p.A.D(this.line.X)(t))):(this.dxMaj=this.line.stdform[1],this.dyMaj=this.line.stdform[2]),this.dxMin=this.dxMaj,this.dyMin=this.dyMaj,this.dx=this.dxMaj,this.dy=this.dyMaj,e=a.A.hypot(this.dxMaj*this.board.unitX,this.dyMaj*this.board.unitY),this.dxMaj*=o/e*this.board.unitX,this.dyMaj*=o/e*this.board.unitY,this.dxMin*=h/e*this.board.unitX,this.dyMin*=h/e*this.board.unitY,this.minStyle=0>this.evalVisProp("minorheight")?"infinite":"finite",this.majStyle=0>this.evalVisProp("majorheight")?"infinite":"finite"},getZeroCoordinates:function(){var t,e,i,r,s,a,h,l,d,u=this.evalVisProp("anchor");return this.line.elementClass===o.A.OBJECT_CLASS_LINE?this.line.type===o.A.OBJECT_TYPE_AXIS?c.A.projectPointToLine({coords:{usrCoords:[1,0,0]}},this.line,this.board):(i=this.line.point1.coords.usrCoords[0],t=this.line.point1.coords.usrCoords[1],e=this.line.point1.coords.usrCoords[2],a=this.line.point2.coords.usrCoords[0],r=this.line.point2.coords.usrCoords[1],s=this.line.point2.coords.usrCoords[2],"right"===u)?this.line.point2.coords:"middle"===u?new f.A(o.A.COORDS_BY_USER,[(i+a)*.5,(t+r)*.5,(e+s)*.5],this.board):n.A.isNumber(u)?new f.A(o.A.COORDS_BY_USER,[i+(a-i)*u,t+(r-t)*u,e+(s-e)*u],this.board):this.line.point1.coords:(l=this.line.minX(),d=this.line.maxX(),h="right"===u?d:"middle"===u?(l+d)*.5:n.A.isNumber(u)?l*(1-u)+d*u:l)},getLowerAndUpperBounds:function(t,e){var i,r,s,h,l,d,u,p,A,m,b,g,v,y,C,_=10*a.A.eps,P=this.line.evalVisProp("straightfirst"),x=this.line.evalVisProp("straightlast"),E=this.evalVisProp("includeboundaries");return this.line.elementClass===o.A.OBJECT_CLASS_CURVE?{lower:this.line.minX(),upper:this.line.maxX()}:(l=new f.A(o.A.COORDS_BY_USER,this.line.point1.coords.usrCoords,this.board),d=new f.A(o.A.COORDS_BY_USER,this.line.point2.coords.usrCoords,this.board),u=
1Math.abs(l.usrCoords[0])>=a.A.eps&&l.scrCoords[1]>=0&&l.scrCoords[1]<=this.board.canvasWidth&&l.scrCoords[2]>=0&&l.scrCoords[2]<=this.board.canvasHeight,p=Math.abs(d.usrCoords[0])>=a.A.eps&&d.scrCoords[1]>=0&&d.scrCoords[1]<=this.board.canvasWidth&&d.scrCoords[2]>=0&&d.scrCoords[2]<=this.board.canvasHeight,n.A.exists(e)&&"ticksdistance"===e?(c.A.calcStraight(this.line,l,d,0),y=this.getDistanceFromZero(t,l),C=this.getDistanceFromZero(t,d),c.A.calcStraight(this.line,l,d,this.line.evalVisProp("margin")),y=this.getDistanceFromZero(t,l)-y,C=this.getDistanceFromZero(t,d).m2):c.A.calcLineDelimitingPoints(this.line,l,d),s=this.line.evalVisProp("firstarrow"),h=this.line.evalVisProp("lastarrow"),g=this.getDistanceFromZero(t,l),v=this.getDistanceFromZero(t,d),(s||h)&&(b=this.board.renderer.getArrowHeadData(this.line,this.line.evalVisProp("strokewidth"),""),this.board.renderer.getPositionArrowHead(this.line,l,d,b)),A=this.getDistanceFromZero(t,l),m=this.getDistanceFromZero(t,d),g=A-g,v=A-v,A<m?(i=A,r=m,P||!u||E||(i+=_),x||!p||E||(r-=_)):m<A?(i=m,r=A,x||!p||E||(i+=_),P||!u||E||(r-=_)):(i=0,r=0),{lower:i,upper:r,a1:g,a2:v,m1:y,m2:C})},getDistanceFromZero:function(t,e){var i,r,s,n,h;return i=this.line.point1.coords,r=this.line.point2.coords,h=t.distance(o.A.COORDS_BY_USER,e),s=[r.usrCoords[0]-i.usrCoords[0],r.usrCoords[1]-i.usrCoords[1],r.usrCoords[2]-i.usrCoords[2]],n=[e.usrCoords[0]-t.usrCoords[0],e.usrCoords[1]-t.usrCoords[1],e.usrCoords[2]-t.usrCoords[2]],0>a.A.innerProduct(s,n,3)&&(h*=-1),h},generateEquidistantTicks:function(t,e){var i,s,n,h=a.A.eps,l=this.evalVisProp("minorticks");if(n=this.getDistanceMajorTicks(),this.line.elementClass===o.A.OBJECT_CLASS_LINE&&(s=this.getXandYdeltas()),n*=this.evalVisProp("scale"),n/=l+1,this.ticksDelta=n,!(n<a.A.eps)){if(Math.abs(e.upper-e.lower)>2048*n)return void r.A.warn("JSXGraph ticks: too many ticks (>2048). Please increase ticksDistance.");for(i=0,this.evalVisProp("drawzero")||(i=n),i<e.lower&&(i=Math.floor((e.lower-h)/n)*n);i<=e.upper+h&&(i>=e.lower-h&&this.processTickPosition(t,i,n,s),i+=n,!(e.upper-i>1e4*n)););for(i=-n,i>e.upper&&(i=-(Math.ceil(-((e.upper+h)/n))*n));i>=e.lower-h&&(i<=e.upper+h&&this.processTickPosition(t,i,n,s),!((i-=n)-e.lower>1e4*n)););}},getDistanceMajorTicks:function(){var t,e,i,r,s,o,n,h,l=5;return this.evalVisProp("insertticks")?(o=((i=this.getLowerAndUpperBounds(this.getZeroCoordinates(),"")).upper-i.lower)/(l+1)/(s=this.evalVisProp("scale")),n=this.evalVisProp("minticksdistance")/s,h=this.evalVisProp("minorticks"),r=this.getXandYdeltas(),r.x*=this.board.unitX,r.y*=this.board.unitY,n/=a.A.hypot(r.x,r.y),n*=h+1,2*(t=Math.pow(10,Math.floor(Math.log(n)/Math.LN10)))>=n?t*=2:5*t>=n&&(t*=5),5*(e=Math.pow(10,Math.floor(Math.log(o)/Math.LN10)))<o?e*=5:2*e<o&&(e*=2),t=Math.max(t,e)):this.evalVisProp("ticksdistance")},processTickPosition:function(t,e,i,r){var s,n,a,h,l,c=this.evalVisProp("ticksperlabel"),d=null;this.line.elementClass===o.A.OBJECT_CLASS_LINE?(s=t.usrCoords[1]+e*r.x,n=t.usrCoords[2]+e*r.y):(s=this.line.X(t+e),n=this.line.Y(t+e)),a=new f.A(o.A.COORDS_BY_USER,[s,n],this.board),this.line.elementClass===o.A.OBJECT_CLASS_CURVE&&(d=t+e,this.setTicksSizeVariables(d)),a.major=Math.round(e/i)%(this.evalVisProp("minorticks")+1)==0,c||(c=this.evalVisProp("minorticks")+1),l=Math.round(e/i)%c==0,3===(h=this.createTickPath(a,a.major)).length&&(this.ticks.push(h),l&&this.evalVisProp("drawlabels")?this.labelsData.push(this.generateLabelData(this.generateLabelText(a,t,d),a,this.ticks.length)):this.labelsData.push(null))},generateFixedTicks:function(t,e){var i,r,s,h,l,c,d,u,p=a.A.eps,A=n.A.isArray(this.visProp.labels),m=this.evalVisProp("drawlabels");for(this.line.elementClass===o.A.OBJECT_CLASS_LINE&&(u=this.getXandYdeltas()),s=0;s<this.fixedTicks.length;s++)this.line.elementClass===o.A.OBJECT_CLASS_LINE?(d=this.fixedTicks[s],l=t.usrCoords[1]+d*u.x,c=t.usrCoords[2]+d*u.y):(d=t+this.fixedTicks[s],l=this.line.X(d),c=this.line.Y(d)),i=new f.A(o.A.COORDS_BY_USER,[l,c],this.board),this.line.elementClass===o.A.OBJECT_CLASS_CURVE&&this.setTicksSizeVariables(d),3===(h=this.createTickPath(i,!0)).length&&d>
1=e.lower-p&&d<=e.upper+p&&(this.ticks.push(h),m&&(A||n.A.exists(this.visProp.labels[s]))?(r=A?this.evalVisProp("labels."+s):d,this.labelsData.push(this.generateLabelData(this.generateLabelText(i,t,r),i,s))):this.labelsData.push(null))},getXandYdeltas:function(){var t,e,i=this.line.point1.Dist(this.line.point2);return t=this.line.point1.coords.usrCoords,{x:((e=this.line.point2.coords.usrCoords)[1]-t[1])/i,y:(e[2]-t[2])/i}},_isInsideCanvas:function(t,e,i){var r=this.board.canvasWidth,s=this.board.canvasHeight;return void 0===i&&(i=0),t[0]>=i&&t[0]<=r-i&&e[0]>=i&&e[0]<=s-i||t[1]>=i&&t[1]<=r-i&&e[1]>=i&&e[1]<=s-i},createTickPath:function(t,e){var i,r,s,o,n,h,l,d,u,p,f,A,m,b,g,v,y,C=[-2e6,-2e6],_=[-2e6,-2e6];if(i=t.scrCoords,e?(o=this.dxMaj,n=this.dyMaj,u=this.majStyle,g=this.evalVisProp("majortickendings.0")>0,v=this.evalVisProp("majortickendings.1")>0):(o=this.dxMin,n=this.dyMin,u=this.minStyle,g=this.evalVisProp("tickendings.0")>0,v=this.evalVisProp("tickendings.1")>0),r=[-n*i[1]-o*i[2],n,o],e&&"polar"===this.evalVisProp("type")){if(A=this.board.getBoundingBox(),b=(m=2*Math.PI)/180,i=t.usrCoords,(f=a.A.hypot(i[1],i[2]))<Math.max(a.A.hypot(A[0],A[1]),a.A.hypot(A[2],A[3]))){for(p=0,C=[],_=[];p<=m;p+=b)C.push(this.board.origin.scrCoords[1]+f*Math.cos(p)*this.board.unitX),_.push(this.board.origin.scrCoords[2]+f*Math.sin(p)*this.board.unitY);return[C,_,e]}}else{if("infinite"===u){if(this.evalVisProp("ignoreinfinitetickendings")&&(g=v=!0),s=c.A.meetLineBoard(r,this.board),g&&v)C[0]=s[0].scrCoords[1],C[1]=s[1].scrCoords[1],_[0]=s[0].scrCoords[2],_[1]=s[1].scrCoords[2];else if((y=[a.A.innerProduct(s[0].usrCoords.slice(1,3),this.line.stdform.slice(1,3))+this.line.stdform[0],a.A.innerProduct(s[1].usrCoords.slice(1,3),this.line.stdform.slice(1,3))+this.line.stdform[0]])[0]<y[1]&&(s.reverse(),y.reverse()),g)if(y[0]<0)return[];else y[1]<0?(C[0]=s[0].scrCoords[1],_[0]=s[0].scrCoords[2],C[1]=i[1],_[1]=i[2]):(C[0]=s[0].scrCoords[1],_[0]=s[0].scrCoords[2],C[1]=s[1].scrCoords[1],_[1]=s[1].scrCoords[2]);else if(v)if(y[1]>0)return[];else y[0]>0?(C[0]=i[1],_[0]=i[2]):(C[0]=s[0].scrCoords[1],_[0]=s[0].scrCoords[2]),C[1]=s[1].scrCoords[1],_[1]=s[1].scrCoords[2]}else h=Math.cos(d=">"===this.evalVisProp("face")?Math.PI/4:"<"===this.evalVisProp("face")?-Math.PI/4:0)*o-Math.sin(d)*n,l=Math.sin(d)*o+Math.cos(d)*n,C[0]=i[1]+h*g,_[0]=i[2]-l*g,C[1]=i[1],_[1]=i[2],h=Math.cos(d=-d)*o-Math.sin(d)*n,l=Math.sin(d)*o+Math.cos(d)*n,C[2]=i[1]-h*v,_[2]=i[2]+l*v;if(this._isInsideCanvas(C,_))return[C,_,e]}return[]},formatLabelText:function(t){var e,i,r=this.evalVisProp("label.usemathjax"),s=this.evalVisProp("label.usekatex"),o=this.evalVisProp("scalesymbol");return n.A.isNumber(t)?(this.evalVisProp("label.tofraction")?e=r?"\\("+n.A.toFraction(t,!0)+"\\)":n.A.toFraction(t,s):(i=this.evalVisProp("digits"),this.useLocale()?e=this.formatNumberLocale(t,i):((e=(Math.round(1e11*t)/1e11).toString()).length>this.evalVisProp("maxlabellength")||-1!==e.indexOf("e"))&&(3!==this.evalVisProp("precision")&&3===i&&(i=this.evalVisProp("precision")),e=t.toExponential(i).toString())),this.evalVisProp("beautifulscientificticklabels")&&(e=this.beautifyScientificNotationLabel(e)),e.indexOf(".")>-1&&-1===e.indexOf("e")&&(e=(e=e.replace(/0+$/,"")).replace(/\.$/,""))):e=t.toString(),o.length>0&&("1"===e?e=o:"-1"===e?e="-"+o:"0"!==e&&(e+=o)),this.evalVisProp("useunicodeminus")&&(e=e.replace(/-/g,"â")),e},beautifyScientificNotationLabel:function(t){var e;return -1===t.indexOf("e")?t:e=(e=parseFloat(t.substring(0,t.indexOf("e")))+t.substring(t.indexOf("e"))).replace(/e(.*)$/g,function(t,e){var i="â¢10";return i+e.replace(/-/g,"â»").replace(/\+/g,"").replace(/0/g,"â°").replace(/1/g,"\xb9").replace(/2/g,"\xb2").replace(/3/g,"\xb3").replace(/4/g,"â´").replace(/5/g,"âµ").replace(/6/g,"â¶").replace(/7/g,"â·").replace(/8/g,"â¸").replace(/9/g,"â¹")})},generateLabelText:function(t,e,i){var r;if(!n.A.exists(i)){if(Math.abs(r=this.getDistanceFromZero(e,t))<a.A.eps)return"0";i=r/this.evalVisProp("scale")}return this.formatLabelText(i)},generateLabelData:function(t,e,i){var r,s,o,n;return(n=this.evalVisProp("label.fontsize"),r=[e.scrCoords[1],e.scrCoords[1]],s=[e.scrCoords[2],e.scrCoords[2]],o=(void 0===n?12:n)*.5,this._isInsideCanvas(r,s,o))?(r=this.evalVisProp("label.offset")[0],s=this.evalVisProp("label.offset")[1],{x:e.usrCoords[1]+r/this.board.unitX,y:e.usrCoords[2]+s/this.board.unitY,t:t,i:i}):null},update:function(){return this.needsUpdate&&0!==this.board.canvasWidth&&0!==this.board.canvasHeight&&this.calculateTicksCoordinates(),this},updateRenderer:function(){return this.needsUpdate&&(this.visPropCalc.visible&&this.board.renderer.updateTicks(this),this.updateRendererLabels(),this.setDisplayRendNode(),this.needsUpdate=!1),this},updateRendererLabels:function(){var t,e,i,s,o,a,h,l;for(t=0,i=this.labelsData.length,s=this.labels.length,e=0;t<i;t++)null!==this.labelsData[t]&&(h=this.labelsData[t],e<s?((a=this.labels[e]).setText(h.t),a.setCoords(h.x,h.y),e++):(this.labelCounter+=1,(o=n.A.deepCopy(this.visProp.label)).isLabel=!0,o.priv=this.visProp.priv,o.id=this.id+h.i+"Label"+this.labelCounter,a=r.A.createText(this.board,[h.x,h.y,h.t],o),this.addChild(a),a.setParents(this),a.isDraggable=!1,a.dump=!1,this.labels.push(a)),"inherit"===(l=this.evalVisProp("label.visible"))&&(l=this.visPropCalc.visible),a.prepareUpdate().updateVisibility(l).updateRenderer(),a.distanceX=this.evalVisProp("label.offset")[0],a.distanceY=this.evalVisProp("label.offset")[1]);for(e=i=e;e<s;e++)this.board.renderer.display(this.labels[e],!1),this.labels[e].visProp.visible=this.labels[e].visPropCalc.visible=!1;return this},hideElement:function(){var t;for(r.A.deprecated("Element.hideElement()","Element.setDisplayRendNode()"),this.visPropCalc.visible=!1,this.board.renderer.display(this,!1),t=0;t<this.labels.length;t++)n.A.exists(this.labels[t])&&this.labels[t].hideElement();return this},showElement:function(){var t;for(r.A.deprecated("Element.showElement()","Element.setDisplayRendNode()"),this.visPropCalc.visible=!0,this.board.renderer.display(this,!1),t=0;t<this.labels.length;t++)n.A.exists(this.labels[t])&&this.labels[t].showElement();return this}}
1),r.A.createTicks=function(t,e,i){var s,a,h=n.A.copyAttributes(i,t.options,"ticks");if(a=e.length<2?h.ticksdistance:e[1],e[0].elementClass===o.A.OBJECT_CLASS_LINE||e[0].elementClass===o.A.OBJECT_CLASS_CURVE)s=new r.A.Ticks(e[0],a,h);else throw Error("JSXGraph: Can't create Ticks with parent types '"+typeof e[0]+"'.");return n.A.isFunction(h.generatelabelvalue)&&(s.generateLabelText=h.generatelabelvalue),n.A.isFunction(h.generatelabeltext)&&(s.generateLabelText=h.generatelabeltext),s.setParents(e[0]),s.isDraggable=!0,s.fullUpdate(e[0].visPropCalc.visible),s},r.A.createHatchmark=function(t,e,i){var r,s,a,h,l,c=[],d=n.A.copyAttributes(i,t.options,"hatch");if(e[0].elementClass!==o.A.OBJECT_CLASS_LINE&&e[0].elementClass!==o.A.OBJECT_CLASS_CURVE||"number"!=typeof e[1])throw Error("JSXGraph: Can't create Hatch mark with parent types '"+typeof e[0]+"' and '"+typeof e[1]+" and ''"+typeof e[2]+"'.");for(s=0,a=-(.5*(((r=e[1])-1)*(h=d.ticksdistance)));s<r;s++)c[s]=a+s*h;return(l=t.create("ticks",[e[0],c],d)).elType="hatch",e[0].inherits.push(l),l},r.A.registerElement("ticks",r.A.createTicks),r.A.registerElement("hash",r.A.createHatchmark),r.A.registerElement("hatch",r.A.createHatchmark),r.A.Ticks;var G=[0,128,64,192,32,160,96,224,16,144,80,208,48,176,112,240,8,136,72,200,40,168,104,232,24,152,88,216,56,184,120,248,4,132,68,196,36,164,100,228,20,148,84,212,52,180,116,244,12,140,76,204,44,172,108,236,28,156,92,220,60,188,124,252,2,130,66,194,34,162,98,226,18,146,82,210,50,178,114,242,10,138,74,202,42,170,106,234,26,154,90,218,58,186,122,250,6,134,70,198,38,166,102,230,22,150,86,214,54,182,118,246,14,142,78,206,46,174,110,238,30,158,94,222,62,190,126,254,1,129,65,193,33,161,97,225,17,145,81,209,49,177,113,241,9,137,73,201,41,169,105,233,25,153,89,217,57,185,121,249,5,133,69,197,37,165,101,229,21,149,85,213,53,181,117,245,13,141,77,205,45,173,109,237,29,157,93,221,61,189,125,253,3,131,67,195,35,163,99,227,19,147,83,211,51,179,115,243,11,139,75,203,43,171,107,235,27,155,91,219,59,187,123,251,7,135,71,199,39,167,103,231,23,151,87,215,55,183,119,247,15,143,79,207,47,175,111,239,31,159,95,223,63,191,127,255],H=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],$=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,99,99],W=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],q=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],Z=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],Q=256;r.A.Util=r.A.Util||{},r.A.Util.Unzip=function(t){var e,i,s,o,n=[],a=0,h=[],l=Array(32768),c=0,d=!1,u=t.length,p=0,f=1,A=Array(288),m=Array(32),b=0,g=null,v=0,y=Array(17),C=[];function _(){return p<u?t[p++]:-1}function P(){f=1}function x(){var t;try{t=1&f,f>>=1,0===f&&(f=_(),t=1&f,f=f>>1|128)}catch(t){throw console.log("Probably problems on iOS7 with >>"),t}return t}function E(t){var e=0,i=t;try{for(;i--;)e=e<<1|x();t&&(e=G[e]>>8-t)}catch(t){throw console.log("Probably problems on iOS7 with >>"),t}return e}function S(){c=0}function N(t){l[c++]=t,n.push(String.fromCharCode(t)),32768===c&&(c=0)}function T(){this.b0=0,this.b1=0,this.jump=null,this.jumppos=-1}function w(){for(var t=!0;t;){if(y[v]>=o)return -1;if(s[y[v]]===v)return y[v]++;y[v]++}}function O(){var t,e=g[b];if(17===v)return -1;if(b++,v++,(t=w())>=0)e.b0=t;else if(e.b0=32768,O())return -1;if((t=w())>=0)e.b1=t,e.jump=null;else if(e.b1=32768,e.jump=g[b],e.jumppos=b,O())return -1;return v--,0}function M(t,e,i,r){var n;for(n=0,g=t,b=0,s=i,o=e;n<17;n++)y[n]=0;return(v=0,O())?-1:0}function k(t){for(var e,i,r=!0,s=0,o=t[0];r;)if(x()){if(!(32768&o.b1))return o.b1;for(i=0,o=o.jump,e=t.length;i<e;i++)if(t[i]===o){s=i;break}}else{if(!(32768&o.b0))return o.b0;o=t[++s]}}function D(){var t,e,i,s,o,n,a,h,d,u,p,f,b,g,v,y,C=!0;do if(t=x(),0===(i=E(2)))for(P(),((u=_()|_()<<8)^~(f=_()|_()<<8))&65535&&r.A.debug("BlockLen checksum mismatch\n");u--;)N(e=_());else if(1===i)for(;C;)if((o=G[E(7)]>>1)>23?(o=o<<1|x())>199?(o-=128,o=o<<1|x()):(o-=48)>143&&(o+=136):o+=256,o<256)N(o);else if(256===o)break;else for(o-=257,d=E($[o])+H[o],p=(q[o=G[E(5)]>>3]>8?E(8)|E(q[o]-8)<<8:E(q[o]))+W[o],o=0;o<d;o++)N(e=l[c-p&32767]);else if(2===i){for(o=0,a=Array(320),g=257+E(5),v=1+E(5),y=4+E(4);o<19;o++)a[o]=0;for(o=0;o<y;o++)a[Z[o]]=E(3);for(s=0,d=m.length;s<d;s++)m[s]=new T;if(M(m,19,a,0))return S(),1;for(b=g+v,s=0;s<b;)if((o=k(m))<16)a[s++]=o;else if(16===o){if(s+(o=3+E(2))>b)return S(),1;for(n=s?a[s-1]:0;o--;)a[s++]=n}else{if(s+(o=17===o?3+E(3):11+E(7))>b)return S(),1;for(;o--;)a[s++]=0}for(s=0,d=A.length;s<d;s++)A[s]=new T;if(M(A,g,a,0))return S(),1;for(s=0,d=A.length;s<d;s++)m[s]=new T;for(h=[],s=g;s<a.length;s++)h[s-g]=a[s];if(M(m,v,h,0))return S(),1;for(;C;)if((o=k(A))>=256){if(0==(o-=256))break;for(o-=1,d=E($[o])+H[o],p=(q[o=k(m)]>8?E(8)|E(q[o]-8)<<8:E(q[o]))+W[o];d--;)N(e=l[c-p&32767])}else N(o)}while(!t);return S(),P(),0}function R(){var t,r,s,o,l,c,u,p,f=[];try{if(n=[],d=!1,f[0]=_(),f[1]=_(),120===f[0]&&218===f[1]&&(D(),h[a]=[n.join(""),"geonext.gxt"],a++),31===f[0]&&139===f[1]&&(L(),h[a]=[n.join(""),"file"],a++),80===f[0]&&75===f[1]){if(d=!0,f[2]=_(),f[3]=_(),3===f[2]&&4===f[3]){for(f[0]=_(),f[1]=_(),e=_()|_()<<8,p=_()|_()<<8,_(),_(),_(),_(),u=_()|_()<<8|_()<<16|_()<<24,c=_()|_()<<8|_()<<16|_()<<24,l=_()|_()<<8|_()<<16|_()<<24,o=_()|_()<<8,s=_()|_()<<8,t=0,C=[];o--;)r=_(),"/"===r|":"===r?t=0:t<Q-1&&(C[t++]=String.fromCharCode(r));for(i||(i=C),t=0;t<s;)r=_(),t++;if(8===p&&(D(),h[a]=[,,],h[a][0]=n.join(""),h[a][1]=C.join(""),a++),L())return!1}return!0}}catch(t){throw console.log("Probably problems on iOS7 with >>"),t}return!1}function L(){var t,i,r,s,o,n,a=[];if(8&e&&(a[0]=_(),a[1]=_(),a[2]=_(),a[3]=_(),t=80===a[0]&&75===a[1]&&7===a[2]&&8===a[3]?_()|_()<<8|_()<<16|_()<<24:a[0]|a[1]<<8|a[2]<<16|a[3]<<24,i=_()|_()<<8|_()<<16|_()<<24,r=_()|_()<<8|_()<<16|_()<<24),d&&R())return!1;if(a[0]=_(),8!==a[0])return!0;
1if(e=_(),_(),_(),_(),_(),_(),s=_(),4&e)for(o=0,a[0]=_(),a[2]=_(),v=a[0]+256*a[1];o<v;o++)_();if(8&e)for(o=0,C=[],n=_();n;)("7"===n||":"===n)&&(o=0),o<Q-1&&(C[o++]=n),n=_();if(16&e)for(n=_();n;)n=_();return 2&e&&(_(),_()),D(),t=_()|_()<<8|_()<<16|_()<<24,r=_()|_()<<8|_()<<16|_()<<24,d&&R(),!1}y[0]=0,r.A.Util.Unzip.prototype.unzipFile=function(t){var e;for(this.unzip(),e=0;e<h.length;e++)if(h[e][1]===t)return h[e][0];return""},r.A.Util.Unzip.prototype.unzip=function(){return R(),h}},r.A.Util,i(43209),r.A.CA=function(t,e,i){this.node=t,this.createNode=e,this.parser=i},r.A.extend(r.A.CA.prototype,{findMapNode:function(t,e){var i,r,s;if("op_assign"===e.value&&e.children[0].value===t)return e.children[1];if(e.children){for(i=0,r=e.children.length;i<r;++i)if(null!==(s=this.findMapNode(t,e.children[i])))return s}return null},setMath:function(t){var e,i;if(("node_op"==t.type&&("op_add"==t.value||"op_sub"==t.value||"op_mul"==t.value||"op_div"==t.value||"op_neg"==t.value||"op_execfun"==t.value||"op_exp"==t.value)||"node_var"==t.type||"node_const"==t.type)&&(t.isMath=!0),t.children)for(e=0,i=t.children.length;e<i;++e)this.setMath(t.children[e])},deriveElementary:function(t,e){var i,r=t.children[0].value,s=t.children[1];switch(r){case"abs":i=this.createNode("node_op","op_div",s[0],this.createNode("node_op","op_execfun",this.createNode("node_var","sqrt"),[this.createNode("node_op","op_mul",n.A.deepCopy(s[0]),n.A.deepCopy(s[0]))]));break;case"sqrt":i=this.createNode("node_op","op_div",this.createNode("node_const",1),this.createNode("node_op","op_mul",this.createNode("node_const",2),this.createNode(t.type,t.value,n.A.deepCopy(t.children[0]),n.A.deepCopy(t.children[1]))));break;case"sin":i=this.createNode("node_op","op_execfun",this.createNode("node_var","cos"),n.A.deepCopy(s));break;case"cos":i=this.createNode("node_op","op_neg",this.createNode("node_op","op_execfun",this.createNode("node_var","sin"),n.A.deepCopy(s)));break;case"tan":i=this.createNode("node_op","op_div",this.createNode("node_const",1),this.createNode("node_op","op_exp",this.createNode("node_op","op_execfun",this.createNode("node_var","cos"),n.A.deepCopy(s)),this.createNode("node_const",2)));break;case"cot":i=this.createNode("node_op","op_neg",this.createNode("node_op","op_div",this.createNode("node_const",1),this.createNode("node_op","op_exp",this.createNode("node_op","op_execfun",this.createNode("node_var","sin"),n.A.deepCopy(s)),this.createNode("node_const",2))));break;case"exp":i=this.createNode(t.type,t.value,n.A.deepCopy(t.children[0]),n.A.deepCopy(t.children[1]));break;case"pow":i=this.createNode("node_op","op_mul",this.createNode("node_op","op_execfun",n.A.deepCopy(t.children[0]),n.A.deepCopy(t.children[1])),this.createNode("node_op","op_add",this.createNode("node_op","op_mul",this.derivative(t.children[1][0],e),this.createNode("node_op","op_div",n.A.deepCopy(t.children[1][1]),n.A.deepCopy(t.children[1][0]))),this.createNode("node_op","op_mul",this.derivative(t.children[1][1],e),this.createNode("node_op","op_execfun",this.createNode("node_var","log"),[n.A.deepCopy(t.children[1][0])]))));break;case"log":case"ln":i=this.createNode("node_op","op_div",this.createNode("node_const",1),n.A.deepCopy(s[0]));break;case"log2":case"lb":case"ld":i=this.createNode("node_op","op_mul",this.createNode("node_op","op_div",this.createNode("node_const",1),n.A.deepCopy(s[0])),this.createNode("node_const",1.4426950408889634));break;case"log10":case"lg":i=this.createNode("node_op","op_mul",this.createNode("node_op","op_div",this.createNode("node_const",1),n.A.deepCopy(s[0])),this.createNode("node_const",.43429448190325176));break;case"asin":i=this.createNode("node_op","op_div",this.createNode("node_const",1),this.createNode("node_op","op_execfun",this.createNode("node_var","sqrt"),[this.createNode("node_op","op_sub",this.createNode("node_const",1),this.createNode("node_op","op_mul",n.A.deepCopy(s[0]),n.A.deepCopy(s[0])))]));break;case"acos":i=this.createNode("node_op","op_neg",this.createNode("node_op","op_div",this.createNode("node_const",1),this.createNode("node_op","op_execfun",this.createNode("node_var","sqrt"),[this.createNode("node_op","op_sub",this.createNode("node_const",1),this.createNode("node_op","op_mul",n.A.deepCopy(s[0]),n.A.deepCopy(s[0])))])));break;case"atan":i=this.createNode("node_op","op_div",this.createNode("node_const",1),this.createNode("node_op","op_add",this.createNode("node_const",1),this.createNode("node_op","op_mul",n.A.deepCopy(s[0]),n.A.deepCopy(s[0]))));break;case"acot":i=this.createNode("node_op","op_neg",this.createNode("node_op","op_div",this.createNode("node_const",1),this.createNode("node_op","op_add",this.createNode("node_const",1),this.createNode("node_op","op_mul",n.A.deepCopy(s[0]),n.A.deepCopy(s[0])))));break;case"sinh":i=this.createNode("node_op","op_execfun",this.createNode("node_var","cosh"),[n.A.deepCopy(s[0])]);break;case"cosh":i=this.createNode("node_op","op_execfun",this.createNode("node_var","sinh"),[n.A.deepCopy(s[0])]);break;case"tanh":i=this.createNode("node_op","op_sub",this.createNode("node_const",1),this.createNode("node_op","op_exp",this.createNode("node_op","op_execfun",this.createNode("node_var","tanh"),[n.A.deepCopy(s[0])]),this.createNode("node_const",2)));break;
1case"asinh":i=this.createNode("node_op","op_div",this.createNode("node_const",1),this.createNode("node_op","op_execfun",this.createNode("node_var","sqrt"),[this.createNode("node_op","op_add",this.createNode("node_op","op_mul",n.A.deepCopy(s[0]),n.A.deepCopy(s[0])),this.createNode("node_const",1))]));break;case"acosh":i=this.createNode("node_op","op_div",this.createNode("node_const",1),this.createNode("node_op","op_execfun",this.createNode("node_var","sqrt"),[this.createNode("node_op","op_sub",this.createNode("node_op","op_mul",n.A.deepCopy(s[0]),n.A.deepCopy(s[0])),this.createNode("node_const",1))]));break;case"atanh":i=this.createNode("node_op","op_div",this.createNode("node_const",1),this.createNode("node_op","op_sub",this.createNode("node_const",1),this.createNode("node_op","op_mul",n.A.deepCopy(s[0]),n.A.deepCopy(s[0]))));break;default:throw i=this.createNode("node_const",0),console.log('Derivative of "'+r+'" not yet implemented'),Error("Error("+this.line+"): ")}return i},derivative:function(t,e){var i;switch(t.type){case"node_op":switch(t.value){case"op_execfun":i="pow"==t.children[0].value?this.deriveElementary(t,e):0===t.children[1].length?this.createNode("node_const",0):this.createNode("node_op","op_mul",this.deriveElementary(t,e),this.derivative(t.children[1][0],e));break;case"op_div":i=this.createNode("node_op","op_div",this.createNode("node_op","op_sub",this.createNode("node_op","op_mul",this.derivative(t.children[0],e),n.A.deepCopy(t.children[1])),this.createNode("node_op","op_mul",n.A.deepCopy(t.children[0]),this.derivative(t.children[1],e))),this.createNode("node_op","op_mul",n.A.deepCopy(t.children[1]),n.A.deepCopy(t.children[1])));break;case"op_mul":i=this.createNode("node_op","op_add",this.createNode("node_op","op_mul",n.A.deepCopy(t.children[0]),this.derivative(t.children[1],e)),this.createNode("node_op","op_mul",this.derivative(t.children[0],e),n.A.deepCopy(t.children[1])));break;case"op_neg":i=this.createNode("node_op","op_neg",this.derivative(t.children[0],e));break;case"op_add":case"op_sub":i=this.createNode("node_op",t.value,this.derivative(t.children[0],e),this.derivative(t.children[1],e));break;case"op_exp":i=this.createNode("node_op","op_mul",n.A.deepCopy(t),this.createNode("node_op","op_add",this.createNode("node_op","op_mul",this.derivative(t.children[0],e),this.createNode("node_op","op_div",n.A.deepCopy(t.children[1]),n.A.deepCopy(t.children[0]))),this.createNode("node_op","op_mul",this.derivative(t.children[1],e),this.createNode("node_op","op_execfun",this.createNode("node_var","log"),[n.A.deepCopy(t.children[0])]))))}break;case"node_var":i=t.value===e?this.createNode("node_const",1):this.createNode("node_const",0);break;case"node_const":i=this.createNode("node_const",0)}return i},expandDerivatives:function(t,e,i){var r,s,o,a,h,l,c,d,u,p,f,A,m;if(l=0,!t)return l;for(s=0,this.line=t.line,this.col=t.col,r=t.children.length;s<r;++s)if(t.children[s]&&t.children[s].type)t.children[s]=this.expandDerivatives(t.children[s],t,i);else if(n.A.isArray(t.children[s]))for(o=0;o<t.children[s].length;++o)t.children[s][o]&&t.children[s][o].type&&(t.children[s][o]=this.expandDerivatives(t.children[s][o],t,i));if("node_op"===t.type&&"op_execfun"===t.value&&t.children[0]&&"D"===t.children[0].value){if(m=!1,"node_var"==t.children[1][0].type&&(u=t.children[1][0].value,null!==(a=this.findMapNode(u,i))&&(m=!0)),m?(f=a.children[0],p=t.children[1].length>=2?t.children[1][1].value:a.children[0][0],h=a.children[1]):(h=t.children[1][0],f=["x"],p=t.children[1].length>=2?t.children[1][1].value:"x"),A=t.children[1].length>=3?t.children[1][2].value:1,d=h,A>=1)for(;A>=1;)d=this.derivative(d,p),d=this.removeTrivialNodes(d),A--;c="node_op"==e.type&&"op_assign"==e.value?this.createNode("node_op","op_map",f,d):d,this.setMath(c),t.type=c.type,t.value=c.value,c.children.length>0&&(t.children[0]=c.children[0]),c.children.length>1&&(t.children[1]=c.children[1])}return t},removeTrivialNodes:function(t){var e,i,r,s,o;if(n.A.isArray(t))for(e=0,i=t.length;e<i;++e)t[e]=this.removeTrivialNodes(t[e]);if("node_op"!=t.type||!t.children)return t;for(e=0,i=t.children.length;e<i;++e){this.mayNotBeSimplified=!1;
1do t.children[e]=this.removeTrivialNodes(t.children[e]);while(this.mayNotBeSimplified)}switch(t.value){case"op_map":if(r=t.children[0],"node_var"==(s=t.children[1]).type){for(e=0;e<r.length;++e)if(r[e]==s.value){s.isMath=!0;break}}break;case"op_add":if(r=t.children[0],s=t.children[1],"node_const"==r.type&&0===r.value)return s;if("node_const"==s.type&&0===s.value)return r;if("node_const"==r.type&&"node_const"==s.type)return r.value+=s.value,r;break;case"op_mul":if(r=t.children[0],s=t.children[1],"node_const"==r.type&&1==r.value)return s;if("node_const"==s.type&&1==s.value||"node_const"==r.type&&0===r.value)return r;if("node_const"==s.type&&0===s.value||"node_const"==s.type&&0===s.value)return s;if("node_op"==r.type&&"op_neg"==r.value&&"node_op"==s.type&&"op_neg"==s.value)return t.children=[r.children[0],s.children[0]],this.mayNotBeSimplified=!0,t;if("op_neg"==r.value&&"op_neg"!=s.value)return t.type="node_op",t.value="op_neg",t.children=[this.createNode("node_op","op_mul",r.children[0],s)],this.mayNotBeSimplified=!0,t;if("op_neg"!=r.value&&"op_neg"==s.value)return t.type="node_op",t.value="op_neg",t.children=[this.createNode("node_op","op_mul",r,s.children[0])],this.mayNotBeSimplified=!0,t;if("op_div"==r.value&&"node_const"==r.children[0].type&&1==r.children[0].value)return t.type="node_op",t.value="op_div",t.children=[s,r.children[1]],this.mayNotBeSimplified=!0,t;if("op_div"==s.value&&"node_const"==s.children[0].type&&1==s.children[0].value)return t.type="node_op",t.value="op_div",t.children=[r,s.children[1]],this.mayNotBeSimplified=!0,t;if("node_const"!=r.type&&"node_const"==s.type||"node_const"!=r.type&&"node_op"==s.type&&"op_neg"==s.value&&"node_const"==s.children[0].type||"node_op"==r.type&&"op_execfun"!=r.value&&("node_var"==s.type||"node_op"==s.type&&"op_execfun"==s.value)||"node_op"!=r.type&&"node_op"==s.type&&"op_neg"==s.value&&"node_var"==s.children[0].type)return t.children=[s,r],this.mayNotBeSimplified=!0,t;if("node_const"!=r.type&&"node_op"==s.type&&("op_mul"==s.value||"op_div"==s.value)&&"node_const"==s.children[0].type)return o=s.children[0],s.children[0]=r,t.children=[o,s],this.mayNotBeSimplified=!0,t;if("node_const"!=s.type&&"node_op"==r.type&&"op_mul"==r.value&&"node_const"==r.children[0].type)return t.children=[r.children[0],this.createNode("node_op","op_mul",r.children[1],s)],this.mayNotBeSimplified=!0,t;if("node_const"==r.type&&"node_const"==s.type)return r.value*=s.value,r;if("node_const"==r.type&&"node_op"==s.type&&("op_mul"==s.value||"op_div"==s.value)&&"node_const"==s.children[0].type)return s.children[0].value*=r.value,s;if(r.hash=this.parser.compile(r),s.hash=this.parser.compile(s),r.hash===s.hash)return t.value="op_exp",t.children[1]=this.createNode("node_const",2),t;if("node_const"==r.type&&"node_op"==s.type&&("op_mul"==s.value||"op_div"==s.value)&&"node_const"==s.children[0].type)return s.children[0].value*=r.value,s;if("node_op"==s.type&&"op_exp"==s.value&&(r.hash||(r.hash=this.parser.compile(r)),s.children[0].hash||(s.children[0].hash=this.parser.compile(s.children[0])),r.hash===s.children[0].hash))return s.children[1]=this.createNode("node_op","op_add",s.children[1],this.createNode("node_const",1)),this.mayNotBeSimplified=!0,s;if("node_op"==r.type&&"op_exp"==r.value&&"node_op"==s.type&&"op_exp"==s.value&&(r.children[0].hash=this.parser.compile(r.children[0]),s.children[0].hash=this.parser.compile(s.children[0]),r.children[0].hash===s.children[0].hash))return r.children[1]=this.createNode("node_op","op_add",r.children[1],s.children[1]),this.mayNotBeSimplified=!0,r;break;case"op_sub":if(r=t.children[0],s=t.children[1],"node_const"==r.type&&0===r.value)return t.value="op_neg",t.children[0]=s,t;if("node_const"==s.type&&0===s.value)return r;if("node_const"==r.type&&"node_const"==s.type&&r.value==s.value||"node_var"==r.type&&"node_var"==s.type&&r.value==s.value)return this.createNode("node_const",0);if("node_const"==r.type&&"node_const"==s.type)return r.value-=s.value,r;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_sub",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_sub",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_sub",this.createNode("node_const",1),s.children[0]),r],this.mayNotBeSimplified=!0,t;break;case"op_neg":if("node_const"==(r=t.children[0]).type&&0===r.value)return r;if("node_op"==r.type&&"op_neg"==r.value)return r.children[0];break;case"op_div":if(r=t.children[0],s=t.children[1],"node_const"==r.type&&"node_const"==s.type&&r.value==s.value&&0!==r.value)return r.value=1,r;if("node_const"==r.type&&0===r.value&&"node_const"==s.type&&0!==s.value)return r.value=0,r;if("node_const"==r.type&&0===r.value&&("node_op"==s.type||"node_var"==s.type))return t.type="node_const",t.value=0,t;if("node_var"==r.type&&"node_var"==s.type&&r.value==s.value)return this.createNode("node_const",1);if("node_const"==r.type&&0!==r.value&&"node_const"==s.type&&0===s.value)return r.value>0?r.value=1/0:r.value=-1/0,r;if("node_op"==r.type&&"op_neg"==r.value&&"node_op"==s.type&&"op_neg"==s.value)return t.children=[r.children[0],s.children[0]],this.mayNotBeSimplified=!0,t;if("op_neg"==r.value&&"op_neg"!=s.value)return t.type="node_op",t.value="op_neg",t.children=[this.createNode("node_op","op_div",r.children[0],s)],this.mayNotBeSimplified=!0,t;if("op_neg"!=r.value&&"op_neg"==s.value)return t.type="node_op",t.value="op_neg",t.children=[this.createNode("node_op","op_div",r,s.children[0])],this.mayNotBeSimplified=!0,t;if("node_op"==r.type&&"op_exp"==r.value&&(s.hash||(s.hash=this.parser.compile(s)),r.children[0].hash||(r.children[0].hash=this.parser.compile(r.children[0])),s.hash===r.children[0].hash))return r.children[1]=this.createNode("node_op","op_sub",r.children[1],this.createNode("node_const",1)),this.mayNotBeSimplified=!0,r;if("node_const"!=s.type&&"node_op"==r.type&&"op_mul"==r.value&&"node_const"==r.children[0].type)return t.value="op_mul",t.children=[r.children[0],this.createNode("node_op","op_div",r.children[1],s)],this.mayNotBeSimplified=!0,t;if("node_op"==r.type&&"op_exp"==r.value&&"node_op"==s.type&&"op_exp"==s.value&&(r.children[0].hash=this.parser.compile(r.children[0]),s.children[0].hash=this.parser.compile(s.children[0]),r.children[0].hash===s.children[0].hash))return r.children[1]=this.createNode("node_op","op_sub",r.children[1],s.children[1]),this.mayNotBeSimplified=!0,r;break;case"op_exp":if(r=t.children[0],"node_const"==(s=t.children[1]).type&&0===s.value)return s.value=1,s;if("node_const"==s.type&&1==s.value||"node_const"==r.type&&1==r.value||"node_const"==r.type&&0===r.value&&"node_const"==s.type&&0!==s.value)return r;if("node_op"==r.type&&"op_exp"==r.value)return t.children=[r.children[0],this.createNode("node_op","op_mul",r.children[1],s)],t}switch(t.value){case"op_add":if(r=t.children[0],s=t.children[1],"node_const"==r.type&&"node_const"==s.type&&r.value==s.value)return r.value+=s.value,r;if("node_var"==r.type&&"node_var"==s.type&&r.value==s.value){t.children[0]=this.createNode("node_const",2),t.value="op_mul";break}if("node_op"==r.type&&"op_neg"==r.value){t.value="op_sub",t.children[0]=s,t.children[1]=r.children[0],this.mayNotBeSimplified=!0;break}if("node_op"==s.type&&"op_neg"==s.value){t.value="op_sub",t.children[1]=s.children[0],this.mayNotBeSimplified=!0;break}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)){t.value="op_mul",t.children=[this.createNode("node_op","op_add",r.children[0],s.children[0]),r.children[1]],this.mayNotBeSimplified=!0;break}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)){t.value="op_mul",t.children=[this.createNode("node_op","op_add",r.children[0],this.createNode("node_const",1)),s],this.mayNotBeSimplified=!0;break}"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)&&(t.value="op_mul",t.children=[this.createNode("node_op","op_add",this.createNode("node_const",1),s.children[0]),r],this.mayNotBeSimplified=!0);break;case"op_sub":r=t.children[0],"node_op"==(s=t.children[1]).type&&"op_neg"==s.value&&(t.value="op_add",t.children[1]=s.children[0],this.mayNotBeSimplified=!0);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":("node_const"==i[0].type&&0===i[0].value||"node_var"==i[0].type&&"PI"==i[0].value||"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)&&(t.type="node_const",t.value=0);break;case"cos":if("node_const"==i[0].type&&0===i[0].value){t.type="node_const",t.value=1;break}"node_var"==i[0].type&&"PI"==i[0].value&&(t.type="node_op",t.value="op_neg",t.children=[this.createNode("node_const",1)]);break;case"exp":"node_const"==i[0].type&&0===i[0].value&&(t.type="node_const",t.value=1);break;case"pow":"node_const"==i[1].type&&0===i[1].value&&(t.type="node_const",t.value=1)}return t}}
1),r.A.CA,r.A.Dump={addMarkers:function(t,e,i){var r,s,o;for(r in n.A.isArray(e)||(e=[e]),n.A.isArray(i)||(i=[i]),s=Math.min(e.length,i.length),e.length=s,i.length=s,t.objects)if(t.objects.hasOwnProperty(r))for(o=0;o<s;o++)t.objects[r][e[o]]=i[o]},deleteMarkers:function(t,e){var i,r,s;for(i in n.A.isArray(e)||(e=[e]),r=e.length,e.length=r,t.objects)if(t.objects.hasOwnProperty(i))for(s=0;s<r;s++)delete t.objects[i][e[s]]},str:function(t){return"string"==typeof t&&"function"!==t.slice(0,7)&&(t='"'+t+'"'),t},minimizeObject:function(t,e){var i,s,o,a={},h=n.A.deepCopy(t),l=[];for(o=1;o<arguments.length;o++)l.push(arguments[o]);for(a=n.A.deepCopy(a,r.A.Options.elements,!0),o=l.length;o>0;o--)a=n.A.deepCopy(a,l[o-1],!0);for(i in a)a.hasOwnProperty(i)&&(s=i.toLowerCase(),"object"!=typeof a[i]&&a[i]===h[s]&&delete h[s]);return h},prepareAttributes:function(t,e){var i,s;for(s in i=this.minimizeObject(e.getAttributes(),r.A.Options[e.elType]),e.subs)e.subs.hasOwnProperty(s)&&(i[s]=this.minimizeObject(e.subs[s].getAttributes(),r.A.Options[e.elType][s],r.A.Options[e.subs[s].elType]),i[s].id=e.subs[s].id,i[s].name=e.subs[s].name);return i.id=e.id,i.name=e.name,i},setBoundingBox:function(t,e,i){return t.push({obj:i,method:"setBoundingBox",params:[e.getBoundingBox(),e.keepaspectratio]}),t},dump:function(t){var e,i,r,s,o=[],a=[],h=[],l=t.objectsList.length;for(this.addMarkers(t,"dumped",!1),e=0;e<l;e++)if(i=t.objectsList[e],r={},!i.dumped&&i.dump){for(r.type=i.getType(),r.parents=i.getParents().slice(),"point"===r.type&&1===r.parents[0]&&(r.parents=r.parents.slice(1)),s=0;s<r.parents.length;s++)n.A.isString(r.parents[s])&&"'"!==r.parents[s][0]&&'"'!==r.parents[s][0]?r.parents[s]='"'+r.parents[s]+'"':n.A.isArray(r.parents[s])&&(r.parents[s]="["+r.parents[s].toString()+"]");r.attributes=this.prepareAttributes(t,i),"glider"===r.type&&i.onPolygon&&o.push({obj:i.id,prop:"onPolygon",val:!0}),h.push(r)}return this.deleteMarkers(t,"dumped"),{elements:h,props:o,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 e,i,r;switch(typeof t){case"object":if(t){if(i=[],n.A.isArray(t)){for(e=0;e<t.length;e++)i.push(this.toJCAN(t[e]));return"["+i.join(",")+"]"}for(r in t)t.hasOwnProperty(r)&&i.push(r+": "+this.toJCAN(t[r]));return"<<"+i.join(", ")+">> "}return"null";case"string":return"'"+t.replace(/\\/g,"\\\\").replace(/(["'])/g,"\\$1")+"'";case"number":case"boolean":return t.toString();case"null":return"null"}},toJessie:function(t){var e,i,r,s=this.dump(t),o=[];for(e=0,s.methods=this.setBoundingBox(s.methods,t,"$board"),i=s.elements;e<i.length;e++)i[e].attributes.name.length>0&&o.push("// "+i[e].attributes.name),o.push("s"+e+" = "+i[e].type+"("+i[e].parents.join(", ")+") "+this.toJCAN(i[e].attributes).replace(/\n/,"\\n")+";"),"axis"===i[e].type&&(r=i[e].attributes.id,null===t.objects[r].defaultTicks&&o.push("s"+e+".removeAllTicks();")),o.push("");for(e=0;e<s.methods.length;e++)o.push(s.methods[e].obj+"."+s.methods[e].method+"("+this.arrayToParamStr(s.methods[e].params,this.toJCAN)+");"),o.push("");for(e=0;e<s.props.length;e++)o.push(s.props[e].obj+"."+s.props[e].prop+" = "+this.toJCAN(s.props[e].val)+";"),o.push("");return o.join("\n")},toJavaScript:function(t){var e,i,r,s=this.dump(t),o=[];for(e=0,s.methods=this.setBoundingBox(s.methods,t,"board"),i=s.elements;e<i.length;e++)o.push('board.create("'+i[e].type+'", ['+i[e].parents.join(", ")+"], "+n.A.toJSON(i[e].attributes)+");"),"axis"===i[e].type&&(r=i[e].attributes.id,null===t.objects[r].defaultTicks&&o.push('board.objects["'+r+'"].removeTicks(board.objects["'+r+'"].defaultTicks);'));for(e=0;e<s.methods.length;e++)o.push(s.methods[e].obj+"."+s.methods[e].method+"("+this.arrayToParamStr(s.methods[e].params,n.A.toJSON)+");"),o.push("");for(e=0;e<s.props.length;e++)o.push(s.props[e].obj+"."+s.props[e].prop+" = "+n.A.toJSON(s.props[e].val)+";"),o.push("");return o.join("\n")}},r.A.Dump,r.A.createComb=function(t,e,i){var s,o,a,h;if(2===e.length){if(n.A.isArray(e[0])&&e[0].length>1)h=n.A.copyAttributes(i,t.options,"comb","point1"),s=t.create("point",e[0],h);else if(n.A.isString(e[0])||n.A.isPoint(e[0]))s=t.select(e[0]);
1else if(n.A.isFunction(e[0])&&n.A.isPoint(e[0]()))s=e[0]();else if(n.A.isFunction(e[0])&&e[0]().length&&e[0]().length>=2)h=n.A.copyAttributes(i,t.options,"comb","point1"),s=r.A.createPoint(t,e[0](),h);else throw Error("JSXGraph: Can't create comb with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [point,point], [[x1,y1],[x2,y2]]");if(n.A.isArray(e[1])&&e[1].length>1)h=n.A.copyAttributes(i,t.options,"comb","point2"),o=t.create("point",e[1],h);else if(n.A.isString(e[1])||n.A.isPoint(e[1]))o=t.select(e[1]);else if(n.A.isFunction(e[1])&&n.A.isPoint(e[1]()))o=e[1]();else if(n.A.isFunction(e[1])&&e[1]().length&&e[1]().length>=2)h=n.A.copyAttributes(i,t.options,"comb","point2"),o=r.A.createPoint(t,e[1](),h);else throw Error("JSXGraph: Can't create comb with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [point,point], [[x1,y1],[x2,y2]]")}else throw Error("JSXGraph: Can't create comb with parent types "+e.map(function(t){return"'"+typeof t+"'"}).join(", ")+".\nPossible parent types: [point,point], [[x1,y1],[x2,y2]]");return h=n.A.copyAttributes(i,t.options,"comb"),(a=t.create("curve",[[0],[0]],h)).updateDataArray=function(){var t,e,i,r,n,h,l,c,d,u,p=0,f=s.Dist(o),A=s,m=o;for(c=a.evalVisProp("frequency"),d=-a.evalVisProp("angle"),u=a.evalVisProp("width"),a.evalVisProp("reverse")&&(A=o,m=s,d=-d),t=Math.cos(d),e=Math.sin(d),i=(m.X()-A.X())/f,r=(m.Y()-A.Y())/f,t*=u/Math.abs(e),e*=u/Math.abs(e),this.dataX=[],this.dataY=[];p<f;)n=A.X()+i*p,h=A.Y()+r*p,e*=l=Math.min(t,f-p)/Math.abs(t),t*=l,this.dataX.push(n),this.dataY.push(h),this.dataX.push(n+i*t+r*e),this.dataY.push(h-i*e+r*t),this.dataX.push(NaN),this.dataY.push(NaN),p+=c},a},r.A.registerElement("comb",r.A.createComb);var K={removeSlopeTriangle:function(){F.prototype.remove.call(this),this.board.removeObject(this.toppoint),this.board.removeObject(this.glider),this.board.removeObject(this.baseline),this.board.removeObject(this.basepoint),this.board.removeObject(this.label),this._isPrivateTangent&&this.board.removeObject(this.tangent)},Value:function(){return this.tangent.getSlope()},Direction:function(){return this.tangent.Direction()}};r.A.createSlopeTriangle=function(t,e,i){var s,a,h,l,c,d,u,p,f,A=!1;if(1===e.length&&e[0].type===o.A.OBJECT_TYPE_TANGENT)h=(a=e[0]).glider;else if(1===e.length&&e[0].type===o.A.OBJECT_TYPE_GLIDER)h=e[0],f=n.A.copyAttributes(i,t.options,"slopetriangle","tangent"),a=t.create("tangent",[h],f),A=!0;else if(2===e.length&&e[0].elementClass===o.A.OBJECT_CLASS_LINE&&n.A.isPoint(e[1]))a=e[0],h=e[1];else throw Error("JSXGraph: Can't create slope triangle with parent types '"+typeof e[0]+"'.");return f=n.A.copyAttributes(i,t.options,"slopetriangle","basepoint"),u=t.create("point",[function(){return[h.X()+1,h.Y()]}],f),f=n.A.copyAttributes(i,t.options,"slopetriangle","baseline"),d=t.create("line",[h,u],f),f=n.A.copyAttributes(i,t.options,"slopetriangle","glider"),l=t.create("glider",[h.X()+1,h.Y(),d],f),f=n.A.copyAttributes(i,t.options,"slopetriangle","toppoint"),c=t.create("point",[function(){return[l.X(),l.Y()+(l.X()-h.X())*a.getSlope()]}],f),f=n.A.copyAttributes(i,t.options,"slopetriangle"),(s=t.create("polygon",[h,l,c],f)).Value=K.Value,s.Direction=K.Direction,s.tangent=a,s._isPrivateTangent=A,s.borders[2].setArrow(!1,!1),f=n.A.copyAttributes(i,t.options,"slopetriangle","label"),(f=n.A.copyAttributes(f,t.options,"label")).isLabel=!0,f.anchor=s.borders[1],f.priv=s.borders[1].visProp.priv,f.id=s.borders[1].id+"Label",(p=t.create("text",[0,0,function(){return""}],f)).needsUpdate=!0,p.dump=!1,s.borders[1].label=p,s.borders[1].hasLabel=!0,s.borders[1].visProp.withlabel=!0,p._setText(function(){var t=p.evalVisProp("digits");return p.useLocale()?p.formatNumberLocale(s.Value(),t):n.A.toFixed(s.Value(),t)}),p.fullUpdate(),s.glider=l,s.basepoint=u,s.baseline=d,s.toppoint=c,s.label=p,s.subs={glider:l,basePoint:u,baseLine:d,topPoint:c,label:p},s.inherits.push(l,u,d,c,p),s.methodMap=r.A.deepCopy(s.methodMap,{tangent:"tangent",glider:"glider",basepoint:"basepoint",baseline:"baseline",toppoint:"toppoint",label:"label",Value:"Value",V:"Value",Direction:"Direction"}),s.remove=K.removeSlopeTriangle,s},r.A.registerElement("slopetriangle",r.A.createSlopeTriangle);var tt={CheckboxChangeEventHandler:function(){this._value=this.rendNodeCheckbox.checked,this.board.update()}};
1r.A.createCheckbox=function(t,e,i){var o,a,h=n.A.copyAttributes(i,t.options,"checkbox");return a=[e[0],e[1],'<span style="display:inline"><input type="checkbox" /><label for=""></label></span>'],(o=t.create("text",a,h)).type=n.A.OBJECT_TYPE_CHECKBOX,o.rendNodeCheckbox=o.rendNode.childNodes[0].childNodes[0],o.rendNodeLabel=o.rendNode.childNodes[0].childNodes[1],o.rendNodeTag=o.rendNodeCheckbox,o.rendNodeTag.disabled=!!h.disabled,o.rendNodeCheckbox.id=o.rendNode.id+"_checkbox",o.rendNodeLabel.id=o.rendNode.id+"_label",o.rendNodeLabel.setAttribute("for",o.rendNodeCheckbox.id),o.setText(e[2]),o.visPropOld.fontsize="0px",t.renderer.updateTextStyle(o,!1),o.rendNodeCheckbox.checked=h.checked,o._value=h.checked,o.Value=function(){return this._value},o.update=function(){return this.needsUpdate&&(r.A.Text.prototype.update.call(this),this._value=this.rendNodeCheckbox.checked),this},s.A.addEvent(o.rendNodeCheckbox,"change",tt.CheckboxChangeEventHandler,o),o},r.A.registerElement("checkbox",r.A.createCheckbox);var te={InputInputEventHandler:function(t){this._value=this.rendNodeInput.value,this.board.update()}};r.A.createInput=function(t,e,i){var o,a,h=n.A.copyAttributes(i,t.options,"input");return a=[e[0],e[1],'<span style="display:inline; white-space:nowrap; padding:0px;"><label></label><input type="text" maxlength="'+h.maxlength+'" style="width:100%"/></span>'],(o=t.create("text",a,h)).type=n.A.OBJECT_TYPE_INPUT,o.rendNodeLabel=o.rendNode.childNodes[0].childNodes[0],o.rendNodeInput=o.rendNode.childNodes[0].childNodes[1],o.rendNodeInput.value=e[2],o.rendNodeTag=o.rendNodeInput,o.rendNodeTag.disabled=!!h.disabled,o.rendNodeLabel.id=o.rendNode.id+"_label",o.rendNodeInput.id=o.rendNode.id+"_input",o.rendNodeInput.setAttribute("aria-labelledby",o.rendNodeLabel.id),o.setText(e[3]),o._value=e[2],o.update=function(){return this.needsUpdate&&(r.A.Text.prototype.update.call(this),this._value=this.rendNodeInput.value),this},o.Value=function(){return this._value},o.set=function(t){return this._value=t,this.rendNodeInput.value=t,this},s.A.addEvent(o.rendNodeInput,"input",te.InputInputEventHandler,o),s.A.addEvent(o.rendNodeInput,"mousedown",function(t){n.A.exists(t.stopPropagation)&&t.stopPropagation()},o),s.A.addEvent(o.rendNodeInput,"touchstart",function(t){n.A.exists(t.stopPropagation)&&t.stopPropagation()},o),s.A.addEvent(o.rendNodeInput,"pointerdown",function(t){n.A.exists(t.stopPropagation)&&t.stopPropagation()},o),o.visPropOld.fontsize="0px",t.renderer.updateTextStyle(o,!1),o},r.A.registerElement("input",r.A.createInput);var ti={ButtonClickEventHandler:function(){this._handler&&this._handler(),this.board.update()}};r.A.createButton=function(t,e,i){var o,a,h=n.A.copyAttributes(i,t.options,"button");return a=[e[0],e[1],'<button type="button" style="width:100%;" tabindex="0"></button>'],(o=t.create("text",a,h)).type=n.A.OBJECT_TYPE_BUTTON,o.rendNodeButton=o.rendNode.childNodes[0],o.rendNodeButton.id=o.rendNode.id+"_button",o.rendNodeTag=o.rendNodeButton,o.rendNodeTag.disabled=!!h.disabled,o.setText(e[2]),o.visPropOld.fontsize="0px",t.renderer.updateTextStyle(o,!1),e[3]&&(n.A.isString(e[3])?(o._jc=new r.A.JessieCode,o._jc.use(t),o._handler=function(){o._jc.parse(e[3])}):o._handler=e[3]),s.A.addEvent(o.rendNodeButton,"click",ti.ButtonClickEventHandler,o),s.A.addEvent(o.rendNodeButton,"mousedown",function(t){n.A.exists(t.stopPropagation)&&t.stopPropagation()},o),s.A.addEvent(o.rendNodeButton,"touchstart",function(t){n.A.exists(t.stopPropagation)&&t.stopPropagation()},o),s.A.addEvent(o.rendNodeButton,"pointerdown",function(t){n.A.exists(t.stopPropagation)&&t.stopPropagation()},o),o},r.A.registerElement("button",r.A.createButton),r.A.createVectorField=function(t,e,i){var r,s;if(!(e.length>=3&&(n.A.isArray(e[0])||n.A.isFunction(e[0])||n.A.isString(e[0]))&&n.A.isArray(e[1])&&3===e[1].length&&n.A.isArray(e[2])&&3===e[2].length))throw Error("JSXGraph: Can't create vector field with parent types '"+typeof e[0]+"', '"+typeof e[1]+"', '"+typeof e[2]+"'.");return s=n.A.copyAttributes(i,t.options,"vectorfield"),(r=t.create("curve",[[],[]],s)).elType="vectorfield",r.setF=function(t,e){var i,s;return n.A.isArray(t)?(i=n.A.createFunction(t[0],this.board,e),s=n.A.createFunction(t[1],this.board,e),this.F=function(t,e){return[i(t,e),s(t,e)]}):this.F=n.A.createFunction(t,r.board,e),this},r.setF(e[0],"x, y"),r.xData=e[1],r.yData=e[2],r.updateDataArray=function(){var e,i,r,s,o,a,h,l,c,d,u,p,f=this.evalVisProp("scale"),A=n.A.evaluate(this.xData[0]),m=n.A.evaluate(this.xData[1]),b=(n.A.evaluate(this.xData[2])-A)/m,g=n.A.evaluate(this.yData[0]),v=n.A.evaluate(this.yData[1]),y=(n.A.evaluate(this.yData[2])-g)/v,C=this.evalVisProp("arrowhead.enabled");for(C&&(d=(c=this.evalVisProp("arrowhead.size"))/t.unitX,u=c/t.unitY,p=this.evalVisProp("arrowhead.angle")),this.dataX=[],this.dataY=[],r=0,e=A;r<=m;e+=b,r++)for(s=0,i=g;s<=v;i+=y,s++)o=this.F(e,i),o[0]*=f,o[1]*=f,n.A.concat(this.dataX,[e,e+o[0],NaN]),n.A.concat(this.dataY,[i,i+o[1],NaN]),C&&Math.abs(o[0])+Math.abs(o[1])>0&&(h=(a=Math.atan2(o[1],o[0]))+p,l=a-p,n.A.concat(this.dataX,[e+o[0]-Math.cos(h)*d,e+o[0],e+o[0]-Math.cos(l)*d,NaN]),n.A.concat(this.dataY,[i+o[1]-Math.sin(h)*u,i+o[1],i+o[1]-Math.sin(l)*u,NaN]))},r.methodMap=n.A.deepCopy(r.methodMap,{setF:"setF"}),r},r.A.registerElement("vectorfield",r.A.createVectorField),r.A.createSlopeField=function(t,e,
1i){var r,s,o;if(!(e.length>=3&&(n.A.isFunction(e[0])||n.A.isString(e[0]))&&n.A.isArray(e[1])&&3===e[1].length&&n.A.isArray(e[2])&&3===e[2].length))throw Error("JSXGraph: Can't create slope field with parent types '"+typeof e[0]+"', '"+typeof e[1]+"', '"+typeof e[2]+"'.");return s=n.A.createFunction(e[0],t,"x, y"),e[0]=function(t,e){var i=s(t,e),r=Math.sqrt(1+i*i);return[1/r,i/r]},o=n.A.copyAttributes(i,t.options,"slopefield"),(r=t.create("vectorfield",e,o)).elType="slopefield",r.setF=function(t,e){var i=n.A.createFunction(t,r.board,e);this.F=function(t,e){var r=i(t,e),s=Math.sqrt(1+r*r);return[1/s,r/s]}},r.methodMap=n.A.deepCopy(r.methodMap,{setF:"setF"}),r},r.A.registerElement("slopefield",r.A.createSlopeField),r.A.createSmartLabel=function(t,e,i){var r,s,a,h,l,c;if(0===e.length||0>[o.A.OBJECT_CLASS_POINT,o.A.OBJECT_CLASS_LINE,o.A.OBJECT_CLASS_CIRCLE].indexOf(e[0].elementClass)&&0>[o.A.OBJECT_TYPE_POLYGON,o.A.OBJECT_TYPE_ANGLE].indexOf(e[0].type))throw Error("JSXGraph: Can't create smartlabel with parent types '"+typeof e[0]+"', '"+typeof e[1]+"'.");return a=e[0],h=e[1]||"",a.elementClass===o.A.OBJECT_CLASS_POINT?s=n.A.copyAttributes(i,t.options,"smartlabelpoint"):a.elementClass===o.A.OBJECT_CLASS_LINE?((s=n.A.copyAttributes(i,t.options,"smartlabelline")).rotate=function(){return 180*Math.atan(a.getSlope())/Math.PI},s.visible=function(){return!(1.5>a.L())}):a.elementClass===o.A.OBJECT_CLASS_CIRCLE?(s=n.A.copyAttributes(i,t.options,"smartlabelcircle")).visible=function(){return!(1.5>a.Radius())}:a.type===o.A.OBJECT_TYPE_POLYGON?s=n.A.copyAttributes(i,t.options,"smartlabelpolygon"):a.type===o.A.OBJECT_TYPE_ANGLE&&((s=n.A.copyAttributes(i,t.options,"smartlabelangle")).rotate=function(){var t=a.center.coords.usrCoords,e=a.getLabelAnchor().usrCoords,i=180*Math.atan2(e[2]-t[2],e[1]-t[1])/Math.PI;return i>90&&i<270?i+180:i},s.anchorX=function(){var t=a.center.coords.usrCoords,e=a.getLabelAnchor().usrCoords,i=180*Math.atan2(e[2]-t[2],e[1]-t[1])/Math.PI;return i>90&&i<270?"right":"left"}),l=function(t,e,i,r){var s;switch(r){case"length":s=function(){return e.L()};break;case"slope":s=function(){return e.Slope()};break;case"area":s=function(){return e.Area()};break;case"radius":s=function(){return e.Radius()};break;case"perimeter":s=function(){return e.Perimeter()};break;case"rad":s=function(){return e.Value()};break;case"deg":s=function(){return 180*e.Value()/Math.PI};break;default:s=function(){return 0}}return function(){var e,i="",r=n.A.evaluate(h),o=t.evalVisProp("digits"),a=t.evalVisProp("unit"),l=t.evalVisProp("prefix"),c=t.evalVisProp("suffix"),d=t.evalVisProp("usemathjax")||t.evalVisProp("usekatex");return""===r?(e=t.useLocale()?t.formatNumberLocale(s(),o):n.A.toFixed(s(),o),i=d?"\\("+l+e+"\\,"+a+c+"\\)":[l,e,a,c].join("")):i=r,i}},a.elementClass===o.A.OBJECT_CLASS_POINT?(r=t.create("text",[function(){return a.X()},function(){return a.Y()},""],s),c=function(){var t,e,i="",s=n.A.evaluate(h),o=r.evalVisProp("digits"),l=r.evalVisProp("unit"),c=r.evalVisProp("prefix"),d=r.evalVisProp("suffix"),u=r.evalVisProp("dir"),p=r.evalVisProp("usemathjax")||r.evalVisProp("usekatex");return r.useLocale()?(t=r.formatNumberLocale(a.X(),o),e=r.formatNumberLocale(a.Y(),o)):(t=n.A.toFixed(a.X(),o),e=n.A.toFixed(a.Y(),o)),""===s?"row"===u?i=p?"\\("+c+t+"\\,"+l+" / "+e+"\\,"+l+d+"\\)":""+c+t+" "+l+" / "+e+" "+l+d:0===u.indexOf("col")&&(i=p?"\\("+c+"\\left(\\array{"+t+"\\,"+l+"\\\\ "+e+"\\,"+l+"}\\right)"+d+"\\)":""+c+t+" "+l+"<br/>"+e+" "+l+d):i=s,i}):a.elementClass===o.A.OBJECT_CLASS_LINE?"length"===s.measure?c=l(r=t.create("text",[function(){return(a.point1.X()+a.point2.X())*.5},function(){return(a.point1.Y()+a.point2.Y())*.5},""],s),a,"line","length"):"slope"===s.measure&&(c=l(r=t.create("text",[function(){return .25*a.point1.X()+.75*a.point2.X()},function(){return .25*a.point1.Y()+.75*a.point2.Y()},""],s),a,"line","slope")):a.elementClass===o.A.OBJECT_CLASS_CIRCLE?"radius"===s.measure?c=l(r=t.create("text",[function(){return a.center.X()+.5*a.Radius()},function(){return a.center.Y()},""],s),a,"circle","radius"):"area"===s.measure?c=l(r=t.create("text",[function(){return a.center.X()},function(){return a.center.Y()+.5*a.Radius()},""],s),a,"circle","area"):("circumference"===s.measure||"perimeter"===s.measure)&&(c=l(r=t.create("text",[function(){return a.getLabelAnchor()},""],s),a,"circle","perimeter")):a.type===o.A.OBJECT_TYPE_POLYGON?"area"===s.measure?c=l(r=t.create("text",[function(){return a.getTextAnchor()},""],s),a,"polygon","area"):"perimeter"===s.measure&&(c=l(r=t.create("text",[function(){var t=a.borders.length-1;return t>
1=0?[(a.borders[t].point1.X()+a.borders[t].point2.X())*.5,(a.borders[t].point1.Y()+a.borders[t].point2.Y())*.5]:a.getTextAnchor()},""],s),a,"polygon","perimeter")):a.type===o.A.OBJECT_TYPE_ANGLE&&(c=l(r=t.create("text",[function(){return a.getLabelAnchor()},""],s),a,"angle",s.measure)),n.A.exists(r)&&(r.setText(c),a.addChild(r),r.setParents([a])),r},r.A.registerElement("smartlabel",r.A.createSmartLabel),r.A.ForeignObject=function(t,e,i,s,a){this.constructor(t,i,o.A.OBJECT_TYPE_FOREIGNOBJECT,o.A.OBJECT_CLASS_OTHER),this.element=this.board.select(i.anchor),this.coordsConstructor(e),this._useUserSize=!1,this.size=[1,1],n.A.exists(a)&&a.length>0&&(this._useUserSize=!0,this.W=n.A.createFunction(a[0],this.board,""),this.H=n.A.createFunction(a[1],this.board,""),this.addParentsFromJCFunctions([this.W,this.H]),this.usrSize=[this.W(),this.H()]),this.content=s,this.elType="foreignobject",this.id=this.board.setId(this,"Im"),this.board.renderer.drawForeignObject(this),this.board.finalizeAdding(this),this.methodMap=r.A.deepCopy(this.methodMap,{addTransformation:"addTransform",trans:"addTransform",W:"W",Width:"W",H:"H",Height:"H"})},r.A.ForeignObject.prototype=new V.A,n.A.copyPrototypeMethods(r.A.ForeignObject,Y.A,"coordsConstructor"),r.A.extend(r.A.ForeignObject.prototype,{hasPoint:function(t,e){var i,r,s,h,l,c,d,u,p,A=this.transformations.length;return(n.A.isObject(this.evalVisProp("precision"))?(h=this.board._inputDevice,l=this.evalVisProp("precision."+h)):l=this.board.options.precision.hasPoint,0===A)?(i=t-this.coords.scrCoords[1],r=this.coords.scrCoords[2]-e,i>=-(s=l)&&i-this.size[0]<=s&&r>=-s&&r-this.size[1]<=s):(d=[(c=(c=new f.A(o.A.COORDS_BY_SCREEN,[t,e],this.board)).usrCoords)[0]-this.span[0][0],c[1]-this.span[0][1],c[2]-this.span[0][2]],!!(0<=(u=(p=a.A.innerProduct)(d,this.span[1]))&&u<=p(this.span[1],this.span[1])&&0<=(u=p(d,this.span[2]))&&u<=p(this.span[2],this.span[2]))||!1)},update:function(t){return this.needsUpdate&&(this.updateCoords(t),this.updateSize()),this},updateRenderer:function(){return this.updateRendererGeneric("updateForeignObject")},updateSize:function(){var t=[0,0];return this._useUserSize?(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.rendNode.hasChildNodes()&&(t=this.rendNode.childNodes[0].getBoundingClientRect(),this.size=[t.width,t.height]),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(t=0,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<i;t++)for(e=0;e<3;e++)r[e]=a.A.matVecMult(this.transformations[t].matrix,r[e]);for(e=0;e<3;e++)r[e][1]/=r[e][0],r[e][2]/=r[e][0],r[e][0]/=r[e][0];for(e=1;e<3;e++)r[e][0]-=r[0][0],r[e][1]-=r[0][1],r[e][2]-=r[0][2];this.span=r}return this},addTransform:function(t){var e;if(n.A.isArray(t))for(e=0;e<t.length;e++)this.transformations.push(t[e]);else this.transformations.push(t);return this},getParents:function(){var t=[this.url,[this.Z(),this.X(),this.Y()],this.usrSize];return 0!==this.parents.length&&(t=this.parents),t},setSize:function(t,e){return this.W=n.A.createFunction(t,this.board,""),this.H=n.A.createFunction(e,this.board,""),this._useUserSize=!0,this.addParentsFromJCFunctions([this.W,this.H]),this},W:function(){},H:function(){}}),r.A.createForeignObject=function(t,e,i){var s,o,a=e[0],h=e[1],l=[];if(e.length>=2&&(l=e[2]),s=n.A.copyAttributes(i,t.options,"foreignobject"),!(o=Y.A.create(r.A.ForeignObject,t,h,s,a,l)))throw Error("JSXGraph: Can't create foreignObject with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [string, [x, y], [w, h]], [string, [x, y]], [element,transformation]");return o},r.A.registerElement("foreignobject",r.A.createForeignObject),r.A.registerElement("fo",r.A.createForeignObject),r.A.ForeignObject,r.A.extend(y.A,{axes3d:{axesPosition:"center",xAxis:{visible:!0,point2:{name:"x"},strokeColor:r.A.palette.red},yAxis:{visible:!0,point2:{name:"y"},strokeColor:r.A.palette.green},zAxis:{visible:!0,point2:{name:"z"},strokeColor:r.A.palette.blue},xAxisBorder:{name:"x",visible:"\xecnherit",withLabel:!1,label:{position:"50% left",offset:[30,0],fontsize:15},strokeWidth:1,lastArrow:!1,ticks3d:{visible:"\xecnherit",label:{anchorX:"middle",anchorY:"middle"}}},yAxisBorder:{name:"y",visible:"\xecnherit",withLabel:!1,label:{position:"50% right",offset:[0,-30],fontsize:15},strokeWidth:1,lastArrow:!1,ticks3d:{visible:"\xecnherit",label:{anchorX:"middle"}}},zAxisBorder:{name:"z",visible:"\xecnherit",withLabel:!1,label:{position:"50% right",offset:[30,0],fontsize:15},strokeWidth:1,lastArrow:!1,ticks3d:{visible:"\xecnherit",label:{anchorX:"middle",anchorY:"middle"}}},xPlaneRear:{visible:!0,layer:0,strokeWidth:1,strokeColor:"#dddddd",fillColor:"#dddddd",mesh3d:{layer:1}},yPlaneRear:{visible:!0,strokeWidth:1,strokeColor:"#dddddd",fillColor:"#dddddd",layer:0,mesh3d:{layer:1}},zPlaneRear:{visible:!0,strokeWidth:1,strokeColor:"#dddddd",fillColor:"#dddddd",layer:0,mesh3d:{layer:1}},xPlaneFront:{visible:!1,strokeWidth:1,strokeColor:"#dddddd",fillColor:"#dddddd",layer:0,mesh3d:{layer:1}},yPlaneFront:{visible:!1,strokeWidth:1,strokeColor:"#dddddd",fillColor:"#dddddd",layer:0,mesh3d:{layer:1}},zPlaneFront:{visible:!1,strokeWidth:1,strokeColor:"#dddddd",fillColor:"#dddddd",layer:0,mesh3d:{layer:1}},xPlaneRearYAxis:{visible:"inherit",strokeColor:"#888888",strokeWidth:1},xPlaneRearZAxis:{visible:"inherit",strokeColor:"#888888",strokeWidth:1},xPlaneFrontYAxis:{visible:"inherit",strokeColor:"#888888",strokeWidth:1},xPlaneFrontZAxis:{visible:"inherit",strokeColor:"#888888",strokeWidth:1},yPlaneRearXAxis:{visible:"inherit",strokeColor:"#888888",strokeWidth:1},yPlaneRearZAxis:{visible:"inherit",strokeColor:"#888888",strokeWidth:1},yPlaneFrontXAxis:{visible:"inherit",strokeColor:"#888888",strokeWidth:1},yPlaneFrontZAxis:{visible:"inherit",strokeColor:"#888888",strokeWidth:1},zPlaneRearXAxis:{visible:"inherit",strokeColor:"#888888",strokeWidth:1},zPlaneRearYAxis:{visible:"inherit",strokeColor:"#888888",strokeWidth:1},zPlaneFrontXAxis:{visible:"inherit",strokeColor:"#888888",strokeWidth:1},zPlaneFrontYAxis:{visible:"inherit",strokeColor:"#888888",strokeWidth:1}},axis3d:{highlight:!1,fixed:!0,strokeColor:"black",strokeWidth:1,tabindex:null,point1:{visible:!1,name:"",withLabel:!1},point2:{visible:!1,name:"",withLabel:!1,label:{visible:!0}}},circle3d:{layer:12,point:{visible:!1,name:""},needsRegularUpdate:!0},curve3d:{layer:12,highlight:!1,tabindex:-1,strokeWidth:1,numberPointsHigh:200,needsRegularUpdate:!0},face3d:{transitionProperties:[],layer:12,highlight:!1,tabindex:null,strokeWidth:1,fillColor:r.A.palette.yellow,fillOpacity:.4,needsRegularUpdate:!0,shader:{enabled:!1,type:"angle",hue:60,saturation:90,minLightness:30,maxLightness:90}},intersectionline3d:{point1:{visible:!1,name:""},point2:{visible:!1,name:""}},line3d:{layer:12,strokeWidth:1,strokeColor:"black",fixed:!0,tabindex:null,gradient:"linear",gradientSecondColor:"#ffffff",needsRegularUpdate:!0,point:{visible:!1,name:""},point1:{visible:!1,name:""},point2:{visible:!1,name:""},straightFirst:!1,straightLast:!1},mesh3d:{layer:12,strokeWidth:1,strokeColor:"#9a9a9a",strokeOpacity:.6,highlight:!1,tabindex:null,needsRegularUpdate:!0,stepWidthU:1,stepWidthV:1},plane3d:{layer:12,strokeWidth:0,strokeColor:"black",strokeOpacity:1,highlight:!1,tabindex:null,needsRegularUpdate:!0,visible:!0,gradient:"linear",gradientSecondColor:"#ffffff",gradientAngle:Math.PI,fillColor:"#a7a7a7",fillOpacity:.6,mesh3d:{visible:"inherit"},threePoints:!1,point:{visible:!1,name:"",fixed:!0},point1:{visible:!1,name:""},point2:{visible:!1,name:""},point3:{visible:!1,name:""}},point3d:{layer:13,infoboxDigits:"auto",strokeWidth:0,gradient:"radial",gradientSecondColor:"#555555",fillColor:"yellow",highlightStrokeColor:"#555555",gradientFX:.7,gradientFY:.3,needsRegularUpdate:!0},polygon3d:{layer:12,highlight:!1,tabindex:-1,strokeWidth:1,fillColor:"none",needsRegularUpdate:!0},polyhedron3d:{fillColorArray:["white","black"],needsRegularUpdate:!0},sphere3d:{layer:12,highlight:!1,strokeWidth:1,strokeColor:"#00ff80",fillColor:"white",gradient:"radial",gradientSecondColor:"#00ff80",gradientFX:.7,gradientFY:.3,fillOpacity:.4,needsRegularUpdate:!0},surface3d:{layer:12,highlight:!1,tabindex:-1,strokeWidth:1,stepsU:30,stepsV:30,needsRegularUpdate:!0},text3d:{withLabel:!1,needsRegularUpdate:!0},ticks3d:{visible:!0,ticksDistance:1,majorHeight:10,minorTicks:0,tickEndings:[0,1],drawLabels:!0,needsRegularUpdate:!0,label:{visible:!0,withLabel:!1}},vectorfield3d:{scale:1,arrowhead:{enabled:!0,size:5,angle:.125*Math.PI},needsRegularUpdate:!0},view3d:{needsRegularUpdate:!0,depthOrder:{enabled:!1,layers:[12,13]},projection:"parallel",verticalDrag:{enabled:!0,key:"shift"},az:{pointer:{enabled:!0,speed:1,outside:!0,button:-1,key:"none"},keyboard:{enabled:!0,step:10,key:"ctrl"},continuous:!0,slider:{visible:"inherit",style:6,point1:{pos:"auto",frozen:!1},point2:{pos:"auto",frozen:!1},min:0,max:2*Math.PI,start:1}},el:{pointer:{enabled:!0,speed:1,outside:!0,button:-1,key:"none"},keyboard:{enabled:!0,step:10,key:"ctrl"},continuous:!0,slider:{visible:"inherit",style:6,point1:{frozen:!1,pos:"auto"},point2:{frozen:!1,pos:"auto"},min:0,max:2*Math.PI,start:.3}},bank:{pointer:{enabled:!0,speed:.08,outside:!0,button:-1,key:"none"},keyboard:{enabled:!0,step:10,key:"ctrl"},continuous:!0,slider:{visible:"inherit",style:6,point1:{frozen:!1,pos:"auto"},point2:{frozen:!1,pos:"auto"},min:-Math.PI,max:Math.PI,start:0}},trackball:{enabled:!1,outside:!0,button:-1,key:"none"},r:"auto",fov:.4*Math.PI,values:[[0,1.57],[.78,.62],[0,0],[5.49,.62],[4.71,0],[3.93,.62],[3.14,0],[2.36,.62],[1.57,1.57]],infobox:{strokeColor:"#000000",fontSize:16,useKatex:!1,useMathjax:!1,intl:{enabled:!0,options:{minimumFractionDigits:2,maximumFractionDigits:3}}},_currentView:-1}}
1),r.A.Options,r.A.View3D=function(t,e,i){this.constructor(t,i,o.A.OBJECT_TYPE_VIEW3D,o.A.OBJECT_CLASS_3D),this.objects={},this.depthOrdered={},this.elementsByName={},this.defaultAxes=null,this.angles={az:null,el:null,bank:null},this.matrix3DRot=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]],this.matrix3DRotShift=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]],this.matrix3D=[[1,0,0,0],[0,1,0,0],[0,0,1,0]],this.boxToCam=[],this.llftCorner=e[0],this.size=e[1],this.bbox3D=e[2],this.r=-1,this.focalDist=-1,this.projectionType="parallel",this.trackballEnabled=!1,this.timeoutAzimuth=null,this.zIndexMin=1/0,this.zIndexMax=-1/0,this.id=this.board.setId(this,"V"),this.board.finalizeAdding(this),this.elType="view3d",this.methodMap=n.A.deepCopy(this.methodMap,{})},r.A.View3D.prototype=new V.A,r.A.extend(r.A.View3D.prototype,{create:function(t,e,i){var r=[];return t.indexOf("3d")>0&&r.push(this),this.board.create(t,r.concat(e),i)},select:function(t,e){var i,r,s,o,a=t;if(null===a)return a;if(n.A.isString(a)&&""!==a)n.A.exists(this.objects[a])?a=this.objects[a]:n.A.exists(this.elementsByName[a])&&(a=this.elementsByName[a]);else if(!e&&(n.A.isFunction(a)||n.A.isObject(a)&&!n.A.isFunction(a.setAttribute))){for(s=0,i=n.A.filterElements(this.objectsList,a),r={},o=i.length;s<o;s++)r[i[s].id]=i[s];a=new J.A(r)}else n.A.isObject(a)&&n.A.exists(a.id)&&!n.A.exists(this.objects[a.id])&&(a=null);return a},setAnglesFromRotation:function(){var t,e,i,r,s,o,n,h=this.matrix3DRot;(t=Math.sqrt(h[1][3]*h[1][3]+h[2][3]*h[2][3]))>a.A.eps?(e=h[2][3]/t,i=h[1][3]/t):(e=Math.cos(this.angles.bank),i=Math.sin(this.angles.bank)),h=a.A.matMatMult([[1,0,0,0],[0,e,-i,0],[0,i,e,0],[0,0,0,1]],h),this.angles.bank=Math.atan2(i,e),r=h[2][3],s=h[3][3],h=a.A.matMatMult([[1,0,0,0],[0,1,0,0],[0,0,r,s],[0,0,-s,r]],h),this.angles.el=Math.atan2(s,r),o=-h[1][1],n=h[3][1],this.angles.az=Math.atan2(n,o),this.angles.az<0&&(this.angles.az+=2*Math.PI),this.setSlidersFromAngles()},anglesHaveMoved:function(){return this._hasMoveAz||this._hasMoveEl||Math.abs(this.angles.az-this.az_slide.Value())>a.A.eps||Math.abs(this.angles.el-this.el_slide.Value())>a.A.eps||Math.abs(this.angles.bank-this.bank_slide.Value())>a.A.eps},getAnglesFromSliders:function(){this.angles.az=this.az_slide.Value(),this.angles.el=this.el_slide.Value(),this.angles.bank=this.bank_slide.Value()},setSlidersFromAngles:function(){this.az_slide.setValue(this.angles.az),this.el_slide.setValue(this.angles.el),this.bank_slide.setValue(this.angles.bank)},getRotationFromAngles:function(){var t,e,i,r,s,o,n=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]];return t=this.angles.az,e=this.angles.el,i=this.angles.bank,r=-Math.sin(e),n[1][1]=-Math.cos(t),n[1][2]=Math.sin(t),n[1][3]=0,n[2][1]=r*Math.sin(t),n[2][2]=r*Math.cos(t),n[2][3]=Math.cos(e),n[3][1]=Math.cos(e)*Math.sin(t),n[3][2]=Math.cos(e)*Math.cos(t),n[3][3]=Math.sin(e),s=Math.cos(i),o=Math.sin(i),n=a.A.matMatMult([[1,0,0,0],[0,s,o,0],[0,-o,s,0],[0,0,0,1]],n)},_projectToSphere:function(t,e,i){var r,s=a.A.hypot(e,i);return s<.7071067811865475*t?Math.sqrt(t*t-s*s):(r=t/1.414213562373095)*r/s},updateProjectionTrackball:function(t){var e,i,r,s,o,h,l,d,u,p,f,A,m=100,b=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]];return n.A.exists(this._trackball)?((e=this._trackball.dx)*e+(i=this._trackball.dy)*i>a.A.eps&&(m=(this.size[0]*this.board.unitX+this.size[1]*this.board.unitY)*.25,s=[o=this._trackball.x,h=this._trackball.y,this._projectToSphere(m,o,h)],o-=e,h-=i,r=[o,h,this._projectToSphere(m,o,h)],A=a.A.crossProduct(r,s),u=a.A.hypot(A[0],A[1],A[2]),A[0]/=u,A[1]/=u,A[2]/=u,d=1-(p=Math.cos(l=2*Math.asin(d=(d=(d=c.A.distance(s,r,3)/(2*m))>1?1:d)<-1?-1:d))),f=Math.sin(l),b[1][1]=p+A[0]*A[0]*d,b[2][1]=A[1]*A[0]*d+A[2]*f,b[3][1]=A[2]*A[0]*d-A[1]*f,b[1][2]=A[0]*A[1]*d-A[2]*f,b[2][2]=p+A[1]*A[1]*d,b[3][2]=A[2]*A[1]*d+A[0]*f,b[1][3]=A[0]*A[2]*d+A[1]*f,b[2][3]=A[1]*A[2]*d-A[0]*f,b[3][3]=p+A[2]*A[2]*d),b=a.A.matMatMult(b,this.matrix3DRot)):this.matrix3DRot},updateAngleSliderBounds:function(){var t,e,i,r,s,o,n,h,l,c,d;this.trackballEnabled=this.evalVisProp("trackball.enabled"),this.trackballEnabled?(this.az_slide.setMin(0),this.az_slide.setMax(2*Math.PI),this.el_slide.setMin(-.5*Math.PI),this.el_slide.setMax(.5*Math.PI),this.bank_slide.setMin(-Math.PI),this.bank_slide.setMax(Math.PI)):(this.az_slide.setMin(this.visProp.az.slider.min),this.az_slide.setMax(this.visProp.az.slider.max),this.el_slide.setMin(this.visProp.el.slider.min),this.el_slide.setMax(this.visProp.el.slider.max),this.bank_slide.setMin(this.visProp.bank.slider.min),this.bank_slide.setMax(this.visProp.bank.slider.max)),t=this.az_slide._smax,e=this.az_slide._smin,i=this.el_slide._smax,r=this.el_slide._smin,c=this.bank_slide._smax,d=this.bank_slide._smin,this.trackballEnabled?(.5*Math.PI<(s=a.A.mod(this.angles.el,2*Math.PI))&&s<1.5*Math.PI&&(this.angles.el=Math.PI-s,this.angles.az=a.A.wrap(this.angles.az+Math.PI,e,t),this.angles.bank=a.A.wrap(this.angles.bank+Math.PI,d,c)),this.angles.az=a.A.wrap(this.angles.az,e,t),this.angles.el=a.A.wrap(this.angles.el,r,i),this.angles.bank=a.A.wrap(this.angles.bank,d,c)):(l=function(t){return t<r?r-t:i<t?t-i:0},o=.5*(r+i),n=a.A.wrap(this.angles.el,o-Math.PI,o+Math.PI),h=a.A.wrap(Math.PI-this.angles.el,o-Math.PI,o+Math.PI),l(n)<=l(h)?this.angles.el=a.A.clamp(n,r,i):(this.angles.el=a.A.clamp(h,r,i),this.angles.az=a.A.wrap(this.angles.az+Math.PI,e,t),this.angles.bank=a.A.wrap(this.angles.bank+Math.PI,d,c)),this.angles.az=a.A.wrapAndClamp(this.angles.az,e,t,2*Math.PI),this.angles.bank=a.A.wrapAndClamp(this.angles.bank,d,c,2*Math.PI),this.matrix3DRot=this.getRotationFromAngles()),this.setSlidersFromAngles()},_updateCentralProjection:function(){var t,e,i=20,r=8;return"auto"===(t=this.evalVisProp("r"))&&(t=1.01*a.A.hypot(this.bbox3D[0][0]-this.bbox3D[0][1],this.bbox3D[1][0]-this.bbox3D[1][1],this.bbox3D[2][0]-this.bbox3D[2][1])),this.boxToCam=this.matrix3DRot.map(function(t){return t.slice()}),this.boxToCam[3][0]=-t,this.focalDist=1/Math.tan(.5*this.evalVisProp("fov")),e=[[0,0,0,-1],[0,this.focalDist,0,0],[0,0,this.focalDist,0],[2*i*r/(r-i),0,0,(i+r)/(r-i)]],a.A.matMatMult(e,this.boxToCam)},update:function(){var t,e,i,r,s,o=this.r,h=[[1,0,0,0],[0,-o,0,0],[0,0,-o,0],[0,0,0,1]];return n.A.exists(this.el_slide)&&n.A.exists(this.az_slide)&&n.A.exists(this.bank_slide)&&this.needsUpdate?(t=[[1,0,0],[0,1,0],[0,0,1]],this.projectionType=this.evalVisProp("projection").toLowerCase(),this.trackballEnabled!==this.evalVisProp("trackball.enabled")&&this.updateAngleSliderBounds(),this._hasMoveTrackball?(this.matrix3DRot=this.updateProjectionTrackball(),this.setAnglesFromRotation()):this.anglesHaveMoved()&&(this.getAnglesFromSliders(),this.matrix3DRot=this.getRotationFromAngles()),this.shift=[[1,0,0,0],[-.5*(this.bbox3D[0][0]+this.bbox3D[0][1]),1,0,0],[-.5*(this.bbox3D[1][0]+this.bbox3D[1][1]),0,1,0],[-.5*(this.bbox3D[2][0]+this.bbox3D[2][1]),0,0,1]],"central"===this.projectionType?(i=.8,t[1][1]=this.size[0]/i,t[2][2]=this.size[1]/i,t[1][0]=this.llftCorner[0]+.5*t[1][1]*i,t[2][0]=this.llftCorner[1]+.5*t[2][2]*i,this.viewPortTransform=t,e=this._updateCentralProjection(),this.matrix3D=a.A.matMatMult(e,this.shift)):(r=this.bbox3D[0][1]-this.bbox3D[0][0],s=this.bbox3D[1][1]-this.bbox3D[1][0],t[1][1]=this.size[0]/r,t[2][2]=this.size[1]/s,t[1][0]=this.llftCorner[0]+.5*t[1][1]*r,t[2][0]=this.llftCorner[1]+.5*t[2][2]*s,this.matrix3D=a.A.matMatMult(t,a.A.matMatMult(a.A.matMatMult(this.matrix3DRot,h),this.shift).slice(0,3))),this.matrix3DRotShift=a.A.matMatMult(this.matrix3DRot,this.shift)):this.needsUpdate=!1,this},compareDepth:function(t,e){return t.zIndex-e.zIndex},updateZIndices:function(){var t,e;for(t in this.objects)this.objects.hasOwnProperty(t)&&((e=this.objects[t]).type===o.A.OBJECT_TYPE_LINE3D||e.type===o.A.OBJECT_TYPE_POLYGON3D)&&n.A.exists(e.element2D)&&e.element2D.evalVisProp("visible")&&e.updateZIndex()},updateShaders:function(){var t,e,i;for(t in this.objects)this.objects.hasOwnProperty(t)&&(e=this.objects[t],n.A.exists(e.shader)&&((i=e.shader())<this.zIndexMin?this.zIndexMin=i:i>this.zIndexMax&&(this.zIndexMax=i)))},updateDepthOrdering:function(){var t,e,i,r,s;for(i=0,r=this.evalVisProp("depthorder.layers");i<r.length;i++)this.depthOrdered[r[i]]=[];for(t in this.objects)this.objects.hasOwnProperty(t)&&((e=this.objects[t]).type===o.A.OBJECT_TYPE_FACE3D||e.type===o.A.OBJECT_TYPE_LINE3D||e.type===o.A.OBJECT_TYPE_POINT3D||e.type===o.A.OBJECT_TYPE_POLYGON3D)&&n.A.exists(e.element2D)&&e.element2D.evalVisProp("visible")&&(s=e.element2D.evalVisProp("layer"),r.indexOf(s)>=0&&this.depthOrdered[s].push(e));if(this.board.renderer&&"svg"===this.board.renderer.type)for(i=0;i<r.length;i++)s=r[i],this.depthOrdered[s].sort(this.compareDepth.bind(this)),this.depthOrdered[s].forEac
1h(t=>this.board.renderer.setLayer(t.element2D,s));return this},updateRenderer:function(){return this.needsUpdate&&(this.depthOrdered={},void 0!==this.shift&&this.evalVisProp("depthorder.enabled")&&(this.updateZIndices(),this.updateShaders(),this.board.renderer&&"svg"===this.board.renderer.type&&this.updateDepthOrdering()),this.needsUpdate=!1),this},removeObject:function(t,e){var i,s;if(n.A.isArray(t)){for(i=0;i<t.length;i++)this.removeObject(t[i]);return this}if(t=this.select(t),!n.A.exists(t)||n.A.isString(t))return this;try{for(s in t.childElements)t.childElements.hasOwnProperty(s)&&this.removeObject(t.childElements[s]);delete this.objects[t.id]}catch(e){r.A.debug("View3D "+t.id+": Could not be removed: "+e)}return this.board.removeObject(t,e),this},worldToFocal:function(t,e=!0){var i,r=a.A.matVecMult(this.boxToCam,a.A.matVecMult(this.shift,t));if(r[3]-=r[0]*this.focalDist,e)return r;for(i=1;i<4;i++)r[i]/=r[0];return r.slice(1,4)},project3DTo2D:function(t,e,i){var r,s;return(3==arguments.length?r=[1,t,e,i]:3===t.length?(r=t.slice()).unshift(1):r=t,s=a.A.matVecMult(this.matrix3D,r),"central"===this.projectionType)?(s[1]/=s[0],s[2]/=s[0],s[3]/=s[0],s[0]/=s[0],a.A.matVecMult(this.viewPortTransform,s.slice(0,3))):s},_getW0:function(t,e,i){var r,s=a.A.inverse(t),o=s[0][0]+e[1]*s[0][1]+e[2]*s[0][2],n=s[3][0]+e[1]*s[3][1]+e[2]*s[3][2];return r=i*s[0][3]-s[3][3],[1/((n*s[0][3]-o*s[3][3])/r),(n-o*i)/r]},project2DTo3DPlane:function(t,e,i){var r,s,o,n,h,l,c,d,u=i.slice(1)||[0,0,0],p=e.slice(1);if(n=a.A.norm(p,3),o=a.A.innerProduct(u,p,3)/n,"parallel"===this.projectionType){(r=this.matrix3D.slice(0,3)).push([0,p[0],p[1],p[2]]),(s=t.coords.usrCoords.slice()).push(o);try{1===r[2][3]&&(r[2][1]=r[2][2]=.001*a.A.eps),h=a.A.Numerics.Gauss(r,s)}catch(t){h=[0,NaN,NaN,NaN]}}else{r=this.matrix3D,s=t.coords.usrCoords.slice(),l=a.A.Numerics.Gauss(this.viewPortTransform,s),c=(d=this._getW0(r,l,o))[0],s=[l[0]*c,l[1]*c,l[2]*c,d[1]*c];try{1===r[2][3]&&(r[2][1]=r[2][2]=.001*a.A.eps),h=a.A.Numerics.Gauss(r,s),h[1]/=h[0],h[2]/=h[0],h[3]/=h[0],h[0]/=h[0]}catch(t){h=[0,NaN,NaN,NaN]}}return h},projectScreenToSegment:function(t,e,i){var r,s,o,n,h,l,c,d=this.project3DTo2D(e).slice(1,3),u=this.project3DTo2D(i).slice(1,3),p=[u[0]-d[0],u[1]-d[1]],f=a.A.innerProduct(p,p),A=[t[0]-d[0],t[1]-d[1]],m=a.A.innerProduct(A,p)/f;return"central"===this.projectionType?(r=[.5*(e[0]+i[0]),.5*(e[1]+i[1]),.5*(e[2]+i[2])],o=[(s=this.project3DTo2D(r).slice(1,3))[0]-d[0],s[1]-d[1]],h=(1-(n=a.A.innerProduct(o,p)/f))*m/((1-2*n)*m+n)):h=m,[1,(c=1-(l=Math.min(Math.max(h,0),1)))*e[0]+l*i[0],c*e[1]+l*i[1],c*e[2]+l*i[2]]},project2DTo3DVertical:function(t,e){var i=t.coords.usrCoords.slice(1,3),r=[e[1],e[2],this.bbox3D[2][0]],s=[e[1],e[2],this.bbox3D[2][1]];return this.projectScreenToSegment(i,r,s)},project3DToCube:function(t){var e=this.bbox3D,i=!1;return t[1]<e[0][0]&&(t[1]=e[0][0],i=!0),t[1]>e[0][1]&&(t[1]=e[0][1],i=!0),t[2]<e[1][0]&&(t[2]=e[1][0],i=!0),t[2]>e[1][1]&&(t[2]=e[1][1],i=!0),t[3]<=e[2][0]&&(t[3]=e[2][0],i=!0),t[3]>=e[2][1]&&(t[3]=e[2][1],i=!0),[t,i]},intersectionLineCube:function(t,e,i){var r,s,o,n,a;for(s=0,a=3===e.length?e:e.slice(1),r=i;s<3;s++)0!==a[s]&&(o=(this.bbox3D[s][0]-t[s+1])/a[s],n=(this.bbox3D[s][1]-t[s+1])/a[s],r=i<0?Math.max(r,Math.min(o,n)):Math.min(r,Math.max(o,n)));return r},isInCube:function(t,e){var i;if(4===t.length){if(0===t[0])return!1;i=t.slice(1)}return i[0]>this.bbox3D[0][0]-a.A.eps&&i[0]<this.bbox3D[0][1]+a.A.eps&&i[1]>this.bbox3D[1][0]-a.A.eps&&i[1]<this.bbox3D[1][1]+a.A.eps&&i[2]>this.bbox3D[2][0]-a.A.eps&&i[2]<this.bbox3D[2][1]+a.A.eps},intersectionPlanePlane:function(t,e,i){var r,s,o,n,h,l=[!1,!1];return i=i||e.d,(n=a.A.crossProduct(t.normal.slice(1),e.normal.slice(1))).unshift(0),r=a.A.Geometry.meet3Planes(t.normal,t.d,e.normal,i,n,0),h=a.A.Geometry.meetPlanePlane(t.vec1,t.vec2,e.vec1,e.vec2),o=this.intersectionLineCube(r,h,1/0),s=a.A.axpy(o,h,r),this.isInCube(s)&&(l[0]=s),o=this.intersectionLineCube(r,h,-1/0),s=a.A.axpy(o,h,r),this.isInCube(s)&&(l[1]=s),l},intersectionPlaneFace:function(t,e){var i,r,s,o,n,h,l,d,u,f,A,m,b,g,v,y=[],C=[],_=[];for((v=a.A.crossProduct(t.normal.slice(1),e.normal.slice(1))).unshift(0),s=c.A.meet3Planes(t.normal,t.d,e.normal,e.d,v,0),b=c.A.meetPlanePlane(t.vec1,t.vec2,e.vec1,e.vec2),l=e.polyhedron.faces[e.faceNumber],o=e.polyhedron.coords,d=l.length,i=1;i<=d;i++)n=o[l[i-1]],g=[0,(h=o[l[i%d]])[1]-n[1],h[2]-n[2],h[3]-n[3]],u=Math.random(),f=Math.random(),A=Math.random(),m=Math.random(),C=[[u*b[1]+f*b[3],-(u*g[1])+-(f*g[3])],[A*b[2]+m*b[3],-(A*g[2])+-(m*g[3])]],_=[u*(n[1]-s[1])+f*(n[3]-s[3]),A*(n[2]-s[2])+m*(n[3]-s[3])],(r=p.A.Gauss(C,_)[1])>-a.A.eps&&r<1+a.A.eps&&y.push([1,n[1]+r*g[1],n[2]+r*g[2],n[3]+r*g[3]]);return y},intersectionPlanePolyhedron:function(t,e){var i,r,s,o,n,a,h,l=1e-12,d=[],u=[],p=[],f=[];for(i=0;i<e.numberFaces;i++)if(!(e.def.faces[i].length<3)&&!((s=this.intersectionPlaneFace(t,e.faces[i])).length<2)&&4
1===s[0].length&&4===s[1].length){for(r=0;r<d.length&&!(c.A.distance(s[0],d[r][0],4)<l&&c.A.distance(s[1],d[r][1],4)<l||c.A.distance(s[0],d[r][1],4)<l&&c.A.distance(s[1],d[r][0],4)<l);r++);r===d.length&&d.push(s.slice())}if(0===d.length)return{X:u,Y:p,Z:f};a=n=0,i=0;do{for(4===(o=d[a][i]).length&&(u.push(o[1]),p.push(o[2]),f.push(o[3])),i=(i+1)%2,o=d[a][i],h=a,r=0;r<d.length;r++){if(r!==a&&c.A.distance(o,d[r][0])<l){a=r,i=0;break}if(r!==a&&c.A.distance(o,d[r][1])<l){a=r,i=1;break}}if(a===h){console.log("Error face3d intersection update: did not find next",a,i);break}}while(a!==n);return u.push(u[0]),p.push(p[0]),f.push(f[0]),{X:u,Y:p,Z:f}},getMesh:function(t,e,i){var r,s,o,a,h,l,c,d=[0,0,0],u=n.A.evaluate(e[2]),p=n.A.evaluate(i[2]),f=[],A=[];for(r=0,l=(n.A.evaluate(e[1])-n.A.evaluate(e[0]))/u,c=(n.A.evaluate(i[1])-n.A.evaluate(i[0]))/p;r<=u;r++){for(s=0,o=e[0]+l*r;s<=p;s++)a=i[0]+c*s,d=n.A.isFunction(t)?t(o,a):[t[0](o,a),t[1](o,a),t[2](o,a)],h=this.project3DTo2D(d),f.push(h[1]),A.push(h[2]);f.push(NaN),A.push(NaN)}for(s=0;s<=p;s++){for(r=0,a=i[0]+c*s;r<=u;r++)o=e[0]+l*r,d=n.A.isFunction(t)?t(o,a):[t[0](o,a),t[1](o,a),t[2](o,a)],h=this.project3DTo2D(d),f.push(h[1]),A.push(h[2]);f.push(NaN),A.push(NaN)}return[f,A]},animateAzimuth:function(){var t=this.az_slide._smin,e=this.az_slide._smax-t,i=this.az_slide.Value()+.1;this.az_slide.position=(i-t)/e,this.az_slide.position>1&&(this.az_slide.position=0),this.board._change3DView=!0,this.board.update(),this.board._change3DView=!1,this.timeoutAzimuth=setTimeout((function(){this.animateAzimuth()}).bind(this),200)},stopAzimuth:function(){clearTimeout(this.timeoutAzimuth),this.timeoutAzimuth=null},isVerticalDrag:function(){var t=this.board;return!!this.evalVisProp("verticaldrag.enabled")&&t["_"+this.evalVisProp("verticaldrag.key")+"Key"]},setView:function(t,e,i){return i=i||this.r,this.az_slide.setValue(t),this.el_slide.setValue(e),this.r=i,this.board.update(),this},nextView:function(){var t=this.evalVisProp("values"),e=this.visProp._currentview;return e=(e+1)%t.length,this.setCurrentView(e),this},previousView:function(){var t=this.evalVisProp("values"),e=this.visProp._currentview;return e=(e+t.length-1)%t.length,this.setCurrentView(e),this},setCurrentView:function(t){var e=this.evalVisProp("values");return(t<0||t>=e.length)&&(t=(t%e.length+e.length)%e.length),this.setView(e[t][0],e[t][1],e[t][2]),this.visProp._currentview=t,this},_azEventHandler:function(t){var e=this.az_slide._smax,i=this.az_slide._smin,r=(e-i)/this.board.canvasWidth*this.evalVisProp("az.pointer.speed"),s=t.movementX,o=this.az_slide.Value(),n=this.el_slide.Value();return this.board.mode===this.board.BOARD_MODE_DRAG||(this.evalVisProp("az.keyboard.enabled")&&("ArrowRight"===t.key?o+=this.evalVisProp("az.keyboard.step")*Math.PI/180:"ArrowLeft"===t.key&&(o-=this.evalVisProp("az.keyboard.step")*Math.PI/180)),this.evalVisProp("az.pointer.enabled")&&0!==s&&null==t.key&&(o+=s*r),this.evalVisProp("az.continuous")?o=a.A.wrap(o,i,e):o>0?o=Math.min(e,o):o<0&&(o=Math.max(i,o)),this.setView(o,n)),this},_elEventHandler:function(t){var e=this.el_slide._smax,i=this.el_slide._smin,r=(e-i)/this.board.canvasHeight*this.evalVisProp("el.pointer.speed"),s=t.movementY,o=this.az_slide.Value(),n=this.el_slide.Value();return this.board.mode===this.board.BOARD_MODE_DRAG||(this.evalVisProp("el.keyboard.enabled")&&("ArrowUp"===t.key?n-=this.evalVisProp("el.keyboard.step")*Math.PI/180:"ArrowDown"===t.key&&(n+=this.evalVisProp("el.keyboard.step")*Math.PI/180)),this.evalVisProp("el.pointer.enabled")&&0!==s&&null==t.key&&(n+=s*r),this.evalVisProp("el.continuous")&&!this.trackballEnabled?n=a.A.wrap(n,i,e):n>0?n=Math.min(e,n):n<0&&(n=Math.max(i,n)),this.setView(o,n)),this},_bankEventHandler:function(t){var e,i=this.bank_slide._smax,r=this.bank_slide._smin,s=t.deltaY,o=this.bank_slide.Value();return this.board.mode===this.board.BOARD_MODE_DRAG||(this.evalVisProp("bank.keyboard.enabled")&&(e=this.evalVisProp("bank.keyboard.step")*Math.PI/180,"."===t.key||"<"===t.key?o-=e:(","===t.key||">"===t.key)&&(o+=e)),this.evalVisProp("bank.pointer.enabled")&&0!==s&&null==t.key&&(o+=s*((i-r)/this.board.canvasHeight*this.evalVisProp("bank.pointer.speed")),t.preventDefault()),o=this.evalVisProp("bank.continuous")?a.A.wrap(o,r,i):a.A.clamp(o,r,i),this.bank_slide.setValue(o),this.board.update()),this},_trackballHandler:function(t){var e,i,r,s=this.board.getMousePosition(t);return r=new f.A(o.A.COORDS_BY_USER,[this.llftCorner[0]+.5*this.size[0],this.llftCorner[1]+.5*this.size[1]],this.board),e=s[0]-r.scrCoords[1],i=s[1]-r.scrCoords[2],this._trackball={dx:t.movementX,dy:-t.movementY,x:e,y:-i},this.board.update(),this},pointerDownHandler:function(t){var e,i,r;this._hasMoveAz=!1,this._hasMoveEl=!1,this._hasMoveBank=!1,this._hasMoveTrackball=!1,this.board.mode===this.board.BOARD_MODE_NONE&&(this.board._change3DView=!0,this.evalVisProp("trackball.enabled")?(e=this.evalVisProp("trackball.button"),i=this.evalVisProp("trackball.key"),(-1===e||e===t.button)&&("none"===i||i.indexOf("shift")>-1&&t.shiftKey||i.indexOf("ctrl")>
1-1&&t.ctrlKey)&&(r=this.evalVisProp("trackball.outside")?document:this.board.containerObj,s.A.addEvent(r,"pointermove",this._trackballHandler,this),this._hasMoveTrackball=!0)):(this.evalVisProp("az.pointer.enabled")&&(e=this.evalVisProp("az.pointer.button"),i=this.evalVisProp("az.pointer.key"),(-1===e||e===t.button)&&("none"===i||i.indexOf("shift")>-1&&t.shiftKey||i.indexOf("ctrl")>-1&&t.ctrlKey)&&(r=this.evalVisProp("az.pointer.outside")?document:this.board.containerObj,s.A.addEvent(r,"pointermove",this._azEventHandler,this),this._hasMoveAz=!0)),this.evalVisProp("el.pointer.enabled")&&(e=this.evalVisProp("el.pointer.button"),i=this.evalVisProp("el.pointer.key"),(-1===e||e===t.button)&&("none"===i||i.indexOf("shift")>-1&&t.shiftKey||i.indexOf("ctrl")>-1&&t.ctrlKey)&&(r=this.evalVisProp("el.pointer.outside")?document:this.board.containerObj,s.A.addEvent(r,"pointermove",this._elEventHandler,this),this._hasMoveEl=!0)),this.evalVisProp("bank.pointer.enabled")&&(e=this.evalVisProp("bank.pointer.button"),i=this.evalVisProp("bank.pointer.key"),(-1===e||e===t.button)&&("none"===i||i.indexOf("shift")>-1&&t.shiftKey||i.indexOf("ctrl")>-1&&t.ctrlKey)&&(r=this.evalVisProp("bank.pointer.outside")?document:this.board.containerObj,s.A.addEvent(r,"wheel",this._bankEventHandler,this,{passive:!1}),this._hasMoveBank=!0))),s.A.addEvent(document,"pointerup",this.pointerUpHandler,this))},pointerUpHandler:function(t){var e;this._hasMoveAz&&(e=this.evalVisProp("az.pointer.outside")?document:this.board.containerObj,s.A.removeEvent(e,"pointermove",this._azEventHandler,this),this._hasMoveAz=!1),this._hasMoveEl&&(e=this.evalVisProp("el.pointer.outside")?document:this.board.containerObj,s.A.removeEvent(e,"pointermove",this._elEventHandler,this),this._hasMoveEl=!1),this._hasMoveBank&&(e=this.evalVisProp("bank.pointer.outside")?document:this.board.containerObj,s.A.removeEvent(e,"wheel",this._bankEventHandler,this),this._hasMoveBank=!1),this._hasMoveTrackball&&(e=this.evalVisProp("trackball.outside")?document:this.board.containerObj,s.A.removeEvent(e,"pointermove",this._trackballHandler,this),this._hasMoveTrackball=!1),s.A.removeEvent(document,"pointerup",this.pointerUpHandler,this),this.board._change3DView=!1}}),r.A.createView3D=function(t,e,i){var o,h,l,c,d,u,p,f,A,m,b,g,v=e[0],y=e[1];return h=n.A.copyAttributes(i,t.options,"view3d"),(o=new r.A.View3D(t,e,h)).defaultAxes=o.create("axes3d",[],h),u=v[0],p=v[1],f=y[0],A=y[1],(l=n.A.copyAttributes(h,t.options,"view3d","az","slider")).name="az",(c=n.A.copyAttributes(h,t.options,"view3d","el","slider")).name="el",(d=n.A.copyAttributes(h,t.options,"view3d","bank","slider")).name="bank",g=n.A.evaluate(l.point1.pos),m=n.A.isArray(g)?g:[u-1,p-2],g=n.A.evaluate(l.point2.pos),b=n.A.isArray(g)?g:[u+f+1,p-2],o.az_slide=t.create("slider",[m,b,[n.A.evaluate(l.min),n.A.evaluate(l.start),n.A.evaluate(l.max)]],l),o.inherits.push(o.az_slide),o.az_slide.elType="view3d_slider",g=n.A.evaluate(c.point1.pos),m=n.A.isArray(g)?g:[u-1,p],g=n.A.evaluate(c.point2.pos),b=n.A.isArray(g)?g:[u-1,p+A],o.el_slide=t.create("slider",[m,b,[n.A.evaluate(c.min),n.A.evaluate(c.start),n.A.evaluate(c.max)]],c),o.inherits.push(o.el_slide),o.el_slide.elType="view3d_slider",g=n.A.evaluate(d.point1.pos),m=n.A.isArray(g)?g:[u-1,p+A+2],g=n.A.evaluate(d.point2.pos),b=n.A.isArray(g)?g:[u+f+1,p+A+2],o.bank_slide=t.create("slider",[m,b,[n.A.evaluate(d.min),n.A.evaluate(d.start),n.A.evaluate(d.max)]],d),o.inherits.push(o.bank_slide),o.bank_slide.elType="view3d_slider",o.board.infobox.visProp=n.A.merge(o.board.infobox.visProp,h.infobox),o.board.highlightInfobox=function(t,e,i){var r,s,h,l,c,d,u="",p=i.board,f=null;for(this.mode===this.BOARD_MODE_DRAG&&(u=o.isVerticalDrag()?'<span style="color:black; font-size:200%">â
</span>':'<span style="color:black; font-size:200%">â </span>'),s=0;s<i.parents.length&&!(f=p.objects[i.parents[s]]).is3D;s++);if(f&&n.A.exists(f.element2D)){if(l=[1,0,0,f.coords[3]],o._w0=a.A.innerProduct(o.matrix3D[0],l,4),h=o.project2DTo3DPlane(f.element2D,[1,0,0,1],l),!o.isInCube(h))return void o.board.highlightCustomInfobox("",f);r=f.evalVisProp("infoboxdigits"),d=o.board.infobox,c="auto"===r?d.useLocale()?[u,"(",d.formatNumberLocale(f.X())," | ",d.formatNumberLocale(f.Y())," | ",d.formatNumberLocale(f.Z()),")"]:[u,"(",n.A.autoDigits(f.X())," | ",n.A.autoDigits(f.Y())," | ",n.A.autoDigits(f.Z()),")"]:d.useLocale()?[u,"(",d.formatNumberLocale(f.X(),r)," | ",d.formatNumberLocale(f.Y(),r)," | ",d.formatNumberLocale(f.Z(),r),")"]:[u,"(",n.A.toFixed(f.X(),r)," | ",n.A.toFixed(f.Y(),r)," | ",n.A.toFixed(f.Z(),r),")"],o.board.highlightCustomInfobox(c.join(""),f)}else o.board.highlightCustomInfobox("("+t+", "+e+")",i)},o.BOARD_MODE_NONE=0,s.A.addEvent(t.containerObj,"keydown",function(t){var e,i=!1;o.evalVisProp("el.keyboard.enabled")&&("ArrowUp"===t.key||"ArrowDown"===t.key)&&("none"===(e=o.evalVisProp("el.keyboard.key"))||e.indexOf("shift")>-1&&t.shiftKey||e.indexOf("ctrl")>
1-1&&t.ctrlKey)&&(o._elEventHandler(t),i=!0),o.evalVisProp("az.keyboard.enabled")&&("ArrowLeft"===t.key||"ArrowRight"===t.key)&&("none"===(e=o.evalVisProp("az.keyboard.key"))||e.indexOf("shift")>-1&&t.shiftKey||e.indexOf("ctrl")>-1&&t.ctrlKey)&&(o._azEventHandler(t),i=!0),o.evalVisProp("bank.keyboard.enabled")&&(","===t.key||"<"===t.key||"."===t.key||">"===t.key)&&("none"===(e=o.evalVisProp("bank.keyboard.key"))||e.indexOf("shift")>-1&&t.shiftKey||e.indexOf("ctrl")>-1&&t.ctrlKey)&&(o._bankEventHandler(t),i=!0),"PageUp"===t.key?(o.nextView(),i=!0):"PageDown"===t.key&&(o.previousView(),i=!0),i&&t.preventDefault(),this.board._change3DView=!1},o),s.A.addEvent(t.containerObj,"pointerdown",o.pointerDownHandler,o),o.getAnglesFromSliders(),o.matrix3DRot=o.getRotationFromAngles(),o.updateAngleSliderBounds(),o.board.update(),o},r.A.registerElement("view3d",r.A.createView3D),r.A.View3D,r.A.GeometryElement3D=function(t,e){this.elType=e,this.view=t,this.id=this.view.board.setId(this,e),this.element2D=null,this.is3D=!0,this.zIndex=0,this.view.objects[this.id]=this,""!==this.name&&(this.view.elementsByName[this.name]=this)},r.A.extend(r.A.GeometryElement3D.prototype,{setAttr2D:function(t){var e=t;return e.name=this.name,e.element3d=this,e.id=null,e},setAttribute:function(t){var e,i,s,o,a,h={};for(e=0;e<arguments.length;e++)o=arguments[e],n.A.isString(o)?(a=o.split(":"),h[n.A.trim(a[0])]=n.A.trim(a[1])):n.A.isArray(o)?h[o[0]]=o[1]:r.A.extend(h,o);for(e in h)if(h.hasOwnProperty(e))switch(i=e.replace(/\s+/g,"").toLowerCase(),s=h[e],i){case"numberpointshigh":case"stepsu":case"stepsv":n.A.exists(this.visProp[i])&&(!r.A.Validator[i]||r.A.Validator[i]&&r.A.Validator[i](s)||r.A.Validator[i]&&n.A.isFunction(s)&&r.A.Validator[i](s()))&&(s=(!s.toLowerCase||"false"!==s.toLowerCase())&&s,this._set(i,s));break;default:n.A.exists(this.element2D)&&this.element2D.setAttribute(h)}},getAttribute:function(t){var e;switch(t=t.toLowerCase()){case"numberpointshigh":case"stepsu":case"stepsv":e=this.visProp[t];break;default:n.A.exists(this.element2D)&&(e=this.element2D.getAttribute(t))}return e},getAttributes:function(){var t,e,i={},r=["numberpointshigh","stepsu","stepsv"],s=r.length;for(n.A.exists(this.element2D)&&(i=n.A.merge(this.element2D.getAttributes())),t=0;t<s;t++)e=r[t],n.A.exists(this.visProp[e])&&(i[e]=this.visProp[e]);return i},addTransformGeneric:function(t,e){var i,r=n.A.isArray(e)?e:[e],s=r.length;for(0===this.transformations.length&&(this.baseElement=t),i=0;i<s;i++)this.transformations.push(r[i]);return this},setPosition2D:function(t){},projectCoords:function(t,e){},remove:function(){}}),r.A.GeometryElement3D,r.A.createAxes3D=function(t,e,i){var r,s,o,a,h,l,c,d,u,p,f,A,m,b,g,v,y,C,_=e[0],P=["x","y","z"],x="Axis",E=["Rear","Front"],S=[0,0,0],N=[0,0,0],T={};if(n.A.exists(_.bbox3D))for(r=0;r<P.length;r++)S[r]=_.bbox3D[r][0],N[r]=_.bbox3D[r][1];else for(r=0;r<P.length;r++)S[r]=e[1][r],N[r]=e[2][1];for(r=0,c=(l=n.A.copyAttributes(i,t.options,"axes3d")).axesposition;r<P.length;r++)v=(d=P[r])+x,"center"===c?(p=[0,0,0],(f=[0,0,0])[r]=N[r],T[v]=_.create("axis3d",[p,f],l[v.toLowerCase()]),T[v].view=_):"border"===c&&(v+="Border",p=S.slice(),f=N.slice(),"z"===d?(p[1]=N[1],f[0]=S[0]):(p="x"===d?[S[0],N[1],S[2]]:[N[0],S[1],S[2]],f=[N[0],N[1],S[2]]),f[r]=N[r],T[v]=_.create("axis3d",[p,f],l[v.toLowerCase()]),T[v].view=_,(C=l[v.toLowerCase()].ticks3d).element3d=!0,u=N[r]-S[r],"x"===d?T[v+"Ticks"]=_.create("ticks3d",[p,[1,0,0],u,[0,1,0]],C):"y"===d?T[v+"Ticks"]=_.create("ticks3d",[p,[0,1,0],u,[1,0,0]],C):T[v+"Ticks"]=_.create("ticks3d",[p,[0,0,1],u,[0,1,0]],C),T[v+"Ticks"].view=_);for("center"===c?(T.O=_.create("intersection",[T[P[0]+x],T[P[1]+x]],{name:"",visible:!1,withLabel:!1}),T.O.view=_):T.O=null,r=0;r<P.length;r++)for(s=0,a=(r+1)%3,h=(r+2)%3,d=P[r];s<E.length;s++)v=d+"Plane"+E[s],(p=[0,0,0])[r]=0===s?S[r]:N[r],m=[0,0,0],(A=[0,0,0])[a]=1,m[h]=1,b=[S[a],N[a]],g=[S[h],N[h]],l=n.A.copyAttributes(i,t.options,"axes3d",v),T[v]=_.create("plane3d",[p,A,m,b,g],l),T[v].elType="axisplane3d";for(r=0;r<P.length;r++)for(s=0,d=P[r];s<E.length;s++)for(o=1;o<=2;o++)v=d+"Plane"+E[s]+P[a=(r+o)%3].toUpperCase()+"Axis",y=d+"Plane"+E[s],f=[0,0,0],(p=[0,0,0])[r]=f[r]=0===s?S[r]:N[r],p[a]=S[a],f[a]=N[a],l=n.A.copyAttributes(i,t.options,"axes3d",v),T[v]=_.create("axis3d",[p,f],l),T[v].view=_,T[y].addChild(T[v]),T[y].element2D.inherits.push(T[v]);return T},r.A.registerElement("axes3d",r.A.createAxes3D),r.A.createAxis3D=function(t,e,
1i){var r,s,o,a=e[0],h=e[1],l=e[2];return(r=n.A.copyAttributes(i.point1,t.options,"axis3d","point1")).element3d=!0,s=a.create("point",[function(t,e,i){return function(){return a.project3DTo2D(t,e,i)[1]}}(h[0],h[1],h[2]),function(t,e,i){return function(){return a.project3DTo2D(t,e,i)[2]}}(h[0],h[1],h[2])],r),(r=n.A.copyAttributes(i.point2,t.options,"axis3d","point2")).element3d=!0,o=a.create("point",[function(t,e,i){return function(){return a.project3DTo2D(t,e,i)[1]}}(l[0],l[1],l[2]),function(t,e,i){return function(){return a.project3DTo2D(t,e,i)[2]}}(l[0],l[1],l[2])],r),(r=n.A.copyAttributes(i,t.options,"axis3d")).element3d=!0,a.create("arrow",[s,o],r)},r.A.registerElement("axis3d",r.A.createAxis3D),r.A.createMesh3D=function(t,e,i){var s,o,a=e[0];return(s=n.A.copyAttributes(i,t.options,"mesh3d")).element3d=!0,(o=a.create("curve",[[],[]],s)).point=e[1],o.direction1=e[2],o.direction2=e[3],o.range1=e[4],o.range2=e[5],o.updateDataArray=function(){var t,e,i,s,o=n.A.evaluate(this.range1),h=n.A.evaluate(this.range2),l=o[0],c=o[1],d=h[0],u=h[1],p=[0,0,0],f=[0,0,0],A=this.evalVisProp("stepwidthu"),m=this.evalVisProp("stepwidthv"),b=[0,0,0];if(this.dataX=[],this.dataY=[],n.A.isFunction(this.point))b=this.point();else if(n.A.isPoint3D(this.point))b=this.point.coords;else for(s=0;s<this.point.length;s++)b[s]=n.A.evaluate(this.point[s]);if(n.A.isFunction(this.direction1))p=n.A.evaluate(this.direction1);else for(s=0;s<this.direction1.length;s++)p[s]=n.A.evaluate(this.direction1[s]);if(n.A.isFunction(this.direction2))f=n.A.evaluate(this.direction2);else for(s=0;s<this.direction2.length;s++)f[s]=n.A.evaluate(this.direction2[s]);for(4===b.length&&(b=b.slice(1)),4===p.length&&(p=p.slice(1)),4===f.length&&(f=f.slice(1)),t=r.A.Math.norm(p,3),e=r.A.Math.norm(f,3),s=0;s<3;s++)p[s]/=t,f[s]/=e;i=a.getMesh([function(t,e){return b[0]+t*p[0]+e*f[0]},function(t,e){return b[1]+t*p[1]+e*f[1]},function(t,e){return b[2]+t*p[2]+e*f[2]}],[Math.ceil(l),Math.floor(c),(Math.ceil(c)-Math.floor(l))/A],[Math.ceil(d),Math.floor(u),(Math.ceil(u)-Math.floor(d))/m]),this.dataX=i[0],this.dataY=i[1]},o},r.A.registerElement("mesh3d",r.A.createMesh3D),r.A.Circle3D=function(t,e,i,r,s){var h,l;this.constructor(t.board,s,o.A.OBJECT_TYPE_CIRCLE3D,o.A.OBJECT_CLASS_3D),this.constructor3D(t,"circle3d"),this.center=this.board.select(e),this.normalFunc=i,this.normal=[0,0,0,0],this.curve,this.frame1,this.frame2,n.A.exists(this.center._is_new)?(this.addChild(this.center),delete this.center._is_new):this.center.addChild(this),this.updateRadius=n.A.createFunction(r,this.board),this.addParentsFromJCFunctions([this.updateRadius]),this.updateNormal(),this.frame1=a.A.crossProduct(this.normal.slice(1),[1,0,0]),this.frame1.unshift(0),(h=a.A.crossProduct(this.normal.slice(1),[-.5,.8660254037844386,0])).unshift(0),a.A.norm(h)>a.A.norm(this.frame1)&&(this.frame1=h),this.frame2=a.A.crossProduct(this.normal.slice(1),this.frame1.slice(1)),this.frame2.unshift(0),this.normalizeFrame(),l=this,this.curve=t.create("curve3d",[function(t){var e=l.Radius(),i=Math.sin(t),r=Math.cos(t);return[l.center.coords[1]+e*(r*l.frame1[1]+i*l.frame2[1]),l.center.coords[2]+e*(r*l.frame1[2]+i*l.frame2[2]),l.center.coords[3]+e*(r*l.frame1[3]+i*l.frame2[3])]},[0,2*Math.PI]],s)},r.A.Circle3D.prototype=new r.A.GeometryElement,n.A.copyPrototypeMethods(r.A.Circle3D,r.A.GeometryElement3D,"constructor3D"),r.A.extend(r.A.Circle3D.prototype,{update:function(){return this.needsUpdate&&(this.updateNormal().updateFrame(),this.curve.visProp.visible=!isNaN(this.Radius())),this},updateRenderer:function(){return this.needsUpdate=!1,this},setRadius:function(t){return this.updateRadius=n.A.createFunction(t,this.board),this.addParentsFromJCFunctions([this.updateRadius]),this.board.update(),this},Radius:function(t){return n.A.exists(t)?(this.setRadius(t),this.Radius()):Math.abs(this.updateRadius())},normalizeFrame:function(){var t,e=a.A.norm(this.frame1),i=a.A.norm(this.frame2);for(t=0;t<4;t++)this.frame1[t]/=e,this.frame2[t]/=i;return this},updateNormal:function(){var t,e,i=1e-12;if(this.normal=n.A.evaluate(this.normalFunc),Math.abs(e=a.A.norm(this.normal))>i)for(t=0;t<4;t++)this.normal[t]/=e;return this},updateFrame:function(){return this.frame1=a.A.crossProduct(this.frame2.slice(1),this.normal.slice(1)),this.frame1.unshift(0),this.frame2=a.A.crossProduct(this.normal.slice(1),this.frame1.slice(1)),this.frame2.unshift(0),this.normalizeFrame(),this},projectCoords:function(t,e){return this.curve.projectCoords(t,e)}}
1),r.A.createCircle3D=function(t,e,i){var s,o=e[0],a=n.A.copyAttributes(i,t.options,"circle3d"),h=n.A.providePoints3D(o,[e[1]],i,"circle3d",["point"])[0],l=e[2],c=e[3];return(s=new r.A.Circle3D(o,h,l,c,a)).curve.addParents([s]),s.addChild(s.curve),s.update(),s},r.A.registerElement("circle3d",r.A.createCircle3D),r.A.createIntersectionCircle3D=function(t,e,i){var r,s,a,h=e[0],l=e[1],d=e[2],u=n.A.copyAttributes(i,t.options,"intersectioncircle3d");a=c.A.intersectionFunction3D(h,l,d),s=h.create("point3d",a[0],{visible:!1}),r=h.create("circle3d",[s,a[1],a[2]],u);try{l.addChild(r),d.addChild(r)}catch(t){throw Error("JSXGraph: Can't create 'intersection' with parent types '"+typeof e[1]+"' and '"+typeof e[2]+"'.")}return r.type=o.A.OBJECT_TYPE_INTERSECTION_CIRCLE3D,r.elType="intersectioncircle3d",r.setParents([l.id,d.id]),r},r.A.registerElement("intersectioncircle3d",r.A.createIntersectionCircle3D),r.A.Point3D=function(t,e,i,r){this.constructor(t.board,r,o.A.OBJECT_TYPE_POINT3D,o.A.OBJECT_CLASS_3D),this.constructor3D(t,"point3d"),this.board.finalizeAdding(this),this.coords=[0,0,0,0],this.initialCoords=[0,0,0,0],this.F=e,this.slide=i,this.position=[],this._c2d=null,this.methodMap=n.A.deepCopy(this.methodMap,{})},r.A.Point3D.prototype=new r.A.GeometryElement,n.A.copyPrototypeMethods(r.A.Point3D,r.A.GeometryElement3D,"constructor3D"),r.A.extend(r.A.Point3D.prototype,{X:function(){return this.coords[1]},Y:function(){return this.coords[2]},Z:function(){return this.coords[3]},W:function(){return this.coords[0]},updateCoords:function(){var t,e=0;if(n.A.isFunction(this.F))this.coords=n.A.evaluate(this.F),3===this.coords.length&&this.coords.unshift(1);else for(3===this.F.length&&(this.coords[0]=1,e=1),t=0;t<this.F.length;t++)n.A.isFunction(this.F[t])&&(this.coords[e+t]=n.A.evaluate(this.F[t]));return this},initCoords:function(){var t,e=0;if(n.A.isFunction(this.F))this.coords=n.A.evaluate(this.F),3===this.coords.length&&this.coords.unshift(1);else for(3===this.F.length&&(this.coords[0]=1,e=1),t=0;t<this.F.length;t++)this.coords[e+t]=n.A.evaluate(this.F[t]);return this.initialCoords=this.coords.slice(),this},normalizeCoords:function(){return Math.abs(this.coords[0])>1e-14&&(this.coords[1]/=this.coords[0],this.coords[2]/=this.coords[0],this.coords[3]/=this.coords[0],this.coords[0]=1),this},setPosition:function(t,e){var i=this.coords;return 3===t.length?(i[0]=1,i[1]=t[0],i[2]=t[1],i[3]=t[2]):(i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=t[2],this.normalizeCoords()),this},addTransform:function(t,e){return this.addTransformGeneric(t,e),this},updateTransform:function(){var t,e;if(0===this.transformations.length||null===this.baseElement)return this;for(e=0,t=this===this.baseElement?this.initialCoords:this.baseElement.coords;e<this.transformations.length;e++)this.transformations[e].update(),t=a.A.matVecMult(this.transformations[e].matrix,t);return this.coords=t,this},update:function(t){var e,i,r;return this.element2D.draggable()&&0!==c.A.distance(this._c2d,this.element2D.coords.usrCoords)?(this.view.isVerticalDrag()?e=this.view.project2DTo3DVertical(this.element2D,this.coords):(i=[1,0,0,this.coords[3]],e=this.view.project2DTo3DPlane(this.element2D,[1,0,0,1],i)),0!==e[0]&&(r=this.view.project3DToCube(e),this.coords=r[0],r[1]&&this.element2D.coords.setCoordinates(o.A.COORDS_BY_USER,this.view.project3DTo2D(this.coords)),this.slide&&(this.coords=this.slide.projectCoords([1,this.X(),this.Y(),this.Z()],this.position),this.element2D.coords.setCoordinates(o.A.COORDS_BY_USER,this.view.project3DTo2D(this.coords))))):(this.updateCoords().updateTransform(),this.slide&&(this.coords=this.slide.projectCoords([1,this.X(),this.Y(),this.Z()],this.position)),e=this.coords,this.element2D.coords.setCoordinates(o.A.COORDS_BY_USER,this.view.project3DTo2D(e)),this.zIndex=a.A.matVecMult(this.view.matrix3DRotShift,e)[3]),this._c2d=this.element2D.coords.usrCoords.slice(),this},updateRenderer:function(){return this.needsUpdate=!1,this},testIfFinite:function(){return Math.abs(this.coords[0])>1e-12},distance:function(t){var e=1e-12,i=this.coords,r=t.coords;return i[0]*i[0]>e&&r[0]*r[0]>e?a.A.hypot(r[1]-i[1],r[2]-i[2],r[3]-i[3]):1/0},__evt__update3D:function(t){}}
1),r.A.createPoint3D=function(t,e,i){var s,o,a,h,l,c=e[0],d=null,u=null;if(a=e.length>2&&n.A.exists(e[e.length-1].is3D)&&!n.A.isTransformationOrArray(e[e.length-1])?e.pop():null,2===e.length)o=e[1];else if(3===e.length&&n.A.isPoint3D(e[1])&&n.A.isTransformationOrArray(e[2]))o=[0,0,0],d=e[1],u=e[2];else if(4===e.length)o=e.slice(1);else if(5===e.length)o=e.slice(1);else throw Error("JSXGraph: Can't create point3d with parent types '"+typeof e[1]+"' and '"+typeof e[2]+"'.\nPossible parent types: [[x,y,z]], [x,y,z], or [[x,y,z], slide], () => [x, y, z], or [point, transformation(s)]");return s=n.A.copyAttributes(i,t.options,"point3d"),(l=new r.A.Point3D(c,o,a,s)).initCoords(),null!==d&&null!==u&&l.addTransform(d,u),h=c.project3DTo2D(l.coords),s=l.setAttr2D(s),l.element2D=c.create("point",h,s),l.element2D.view=c,l.addChild(l.element2D),l.inherits.push(l.element2D),l.element2D.setParents(l),l.slide&&(l.slide.addChild(l),l.setParents(l.slide)),d&&l.setParents(d),l._c2d=l.element2D.coords.usrCoords.slice(),l},r.A.registerElement("point3d",r.A.createPoint3D),r.A.Curve3D=function(t,e,i,r,s,a,h){this.constructor(t.board,h,o.A.OBJECT_TYPE_CURVE3D,o.A.OBJECT_CLASS_3D),this.constructor3D(t,"curve3d"),this.board.finalizeAdding(this),this._F=e,this._X=i,this._Y=r,this._Z=s,this.points=[],this.numberPoints=0,this.dataX=null,this.dataY=null,this.dataZ=null,null!==this._F?(this._X=function(t){return this._F(t)[0]},this._Y=function(t){return this._F(t)[1]},this._Z=function(t){return this._F(t)[2]}):n.A.isFunction(this._X)?this._F=function(t){return[this._X(t),this._Y(t),this._Z(t)]}:this._F=null,this.range=a,this.methodMap=n.A.deepCopy(this.methodMap,{})},r.A.Curve3D.prototype=new r.A.GeometryElement,n.A.copyPrototypeMethods(r.A.Curve3D,r.A.GeometryElement3D,"constructor3D"),r.A.extend(r.A.Curve3D.prototype,{updateCoords:function(){var t,e,i,r,s,o,a=this.evalVisProp("numberpointshigh"),h=[1,0,0,0];if(this.points=[],n.A.exists(this.dataX))for(s=0,a=this.dataX.length;s<a;s++)this.points.push([1,this.dataX[s],this.dataY[s],this.dataZ[s]]);else if(n.A.isArray(this._X))for(s=0,a=this._X.length;s<a;s++)this.points.push([1,this._X[s],this._Y[s],this._Z[s]]);else for(o=0,t=n.A.evaluate(this.range),e=n.A.evaluate(t[0]),r=((i=n.A.evaluate(t[1]))-e)/(a-1),s=e;o<a&&s<=i;o++,s+=r)(h=this.F(s)).unshift(1),this.points.push(h);return this.numberPoints=this.points.length,this},evalF:function(t){var e,i,r=[0,0,0,0];if(0===this.transformations.length||!n.A.exists(this.baseElement))return n.A.exists(this._F)?this._F(t):[this._X[t],this._Y[t],this._Z[t]];for(i=0,e=this.transformations;i<e.length;i++)e[i].update();for(3===r.length&&r.unshift(1),(r=this===this.baseElement?n.A.exists(this._F)?this._F(t):[this._X[t],this._Y[t],this._Z[t]]:this.baseElement.evalF(t)).unshift(1),r=a.A.matVecMult(e[0].matrix,r),i=1;i<e.length;i++)r=a.A.matVecMult(e[i].matrix,r);return r.slice(1)},F:function(t){return this.evalF(t)},X:function(t){return this.evalF(t)[0]},Y:function(t){return this.evalF(t)[1]},Z:function(t){return this.evalF(t)[2]},updateDataArray2D:function(){var t,e,i=[],r=[],s=this.points.length;for(t=0;t<s;t++)i.push((e=this.view.project3DTo2D(this.points[t]))[1]),r.push(e[2]);return{X:i,Y:r}},addTransform:function(t,e){return this.addTransformGeneric(t,e),this},updateTransform:function(){var t,e,i,r,s;if(0===this.transformations.length||null===this.baseElement||n.A.exists(this._F))return this;for(i=0,t=this.transformations;i<t.length;i++)t[i].update();for(i=0,s=this.baseElement.numberPoints;i<s;i++){for(r=0,e=this===this.baseElement?this.points[i]:this.baseElement.points[i];r<t.length;r++)e=a.A.matVecMult(t[r].matrix,e);this.points[i]=e}return this.numberPoints=s,this},updateDataArray:function(){},update:function(){return this.needsUpdate&&(this.updateDataArray(),this.updateCoords().updateTransform()),this},updateRenderer:function(){return this.needsUpdate=!1,this},projectCoords:function(t,e){return c.A.projectCoordsToParametric(t,this,1,e)}}),r.A.createCurve3D=function(t,e,i){var s,h,l,c,d,u,p,f,A=e[0],m=null,b=null;return 3===e.length?n.A.isTransformationOrArray(e[2])&&e[1].type===o.A.OBJECT_TYPE_CURVE3D?(m=e[1],b=e[2],s=null,h=[],l=[],c=[]):(s=e[1],d=e[2],h=null,l=null,c=null):(2===e.length&&n.A.isArray(e[1])?(h=(f=a.A.transpose(e[1]))[0],l=f[1],c=f[2]):(h=e[1],l=e[2],c=e[3],d=e[4]),s=null),u=n.A.copyAttributes(i,t.options,"curve3d"),u=(p=new r.A.Curve3D(A,s,h,l,c,d,u)).setAttr2D(u),p.element2D=A.create("curve",[[],[]],u),p.element2D.view=A,null!==m&&(p.addTransform(m,b),p.addParents(m)),p.element2D.updateDataArray=function(){var t=p.updateDataArray2D();this.dataX=t.X,this.dataY=t.Y},p.addChild(p.element2D),p.inherits.push(p.element2D),p.element2D.setParents(p),p.element2D.prepareUpdate().update(),t.isSuspendedUpdate||p.element2D.updateVisibility().updateRenderer(),p},r.A.registerElement("curve3d",r.A.createCurve3D),r.A.createVectorfield3D=function(t,e,
1i){var r,s,o=e[0];if(!(e.length>=5&&(n.A.isArray(e[1])||n.A.isFunction(e[1])||n.A.isString(e[1]))&&n.A.isArray(e[2])&&3===e[1].length&&n.A.isArray(e[3])&&3===e[2].length&&n.A.isArray(e[4])&&3===e[3].length))throw Error("JSXGraph: Can't create vector field 3D with parent types '"+typeof e[1]+"', '"+typeof e[2]+"', '"+typeof e[3]+"'.'"+typeof e[4]+"', ");return s=n.A.copyAttributes(i,t.options,"vectorfield3d"),(r=o.create("curve3d",[[],[],[]],s)).setF=function(t,e){var i,s,o;return n.A.isArray(t)?(i=n.A.createFunction(t[0],this.board,e),s=n.A.createFunction(t[1],this.board,e),o=n.A.createFunction(t[2],this.board,e),this.F=function(t,e,r){return[i(t,e,r),s(t,e,r),o(t,e,r)]}):this.F=n.A.createFunction(t,r.board,e),this},r.setF(e[1],"x, y, z"),r.xData=e[2],r.yData=e[3],r.zData=e[4],r.updateDataArray=function(){var e,i,r,s,o,h,l,c,d,u,p,f,A,m,b,g,v,y=this.evalVisProp("scale"),C=[n.A.evaluate(this.xData[0]),n.A.evaluate(this.yData[0]),n.A.evaluate(this.zData[0])],_=[n.A.evaluate(this.xData[1]),n.A.evaluate(this.yData[1]),n.A.evaluate(this.zData[1])],P=[n.A.evaluate(this.xData[2]),n.A.evaluate(this.yData[2]),n.A.evaluate(this.zData[2])],x=[(P[0]-C[0])/_[0],(P[1]-C[1])/_[1],(P[2]-C[2])/_[2]],E=this.evalVisProp("arrowhead.enabled");for(E&&(A=this.evalVisProp("arrowhead.size"),v=this.evalVisProp("arrowhead.angle"),m=A/t.unitX,b=A/t.unitY,g=A/Math.sqrt(t.unitX*t.unitY)),this.dataX=[],this.dataY=[],this.dataZ=[],i=0,h=C[0];i<=_[0];h+=x[0],i++)for(r=0,l=C[1];r<=_[1];l+=x[1],r++)for(e=0,c=C[2];e<=_[2];c+=x[2],e++)s=this.F(h,l,c),!((o=a.A.norm(s))<Number.EPSILON)&&(s[0]*=y,s[1]*=y,s[2]*=y,n.A.concat(this.dataX,[h,h+s[0],NaN]),n.A.concat(this.dataY,[l,l+s[1],NaN]),n.A.concat(this.dataZ,[c,c+s[2],NaN]),E&&(o*=y,d=Math.atan2(s[1],s[0]),u=(f=Math.asin(s[2]/o))-v,p=f+v,n.A.concat(this.dataX,[h+s[0]-m*Math.cos(d)*Math.cos(u),h+s[0],h+s[0]-m*Math.cos(d)*Math.cos(p),NaN]),n.A.concat(this.dataY,[l+s[1]-b*Math.sin(d)*Math.cos(u),l+s[1],l+s[1]-b*Math.sin(d)*Math.cos(p),NaN]),n.A.concat(this.dataZ,[c+s[2]-g*Math.sin(p),c+s[2],c+s[2]-g*Math.sin(u),NaN])))},r.methodMap=n.A.deepCopy(r.methodMap,{setF:"setF"}),r},r.A.registerElement("vectorfield3D",r.A.createVectorfield3D),r.A.Line3D=function(t,e,i,r,s){this.constructor(t.board,s,o.A.OBJECT_TYPE_LINE3D,o.A.OBJECT_CLASS_3D),this.constructor3D(t,"line3d"),this.point=e,this.direction=i,this.vec=[0,0,0,0],this.range=r||[-1/0,1/0],this.point1=null,this.point2=null,this.board.finalizeAdding(this),this.methodMap=n.A.deepCopy(this.methodMap,{})},r.A.Line3D.prototype=new r.A.GeometryElement,n.A.copyPrototypeMethods(r.A.Line3D,r.A.GeometryElement3D,"constructor3D"),r.A.extend(r.A.Line3D.prototype,{updateCoords:function(){var t,e=0;if(n.A.exists(this.direction.view)&&this.direction.type===o.A.OBJECT_TYPE_LINE3D)this.vec=this.direction.vec.slice();else if(n.A.isFunction(this.direction))this.vec=n.A.evaluate(this.direction),3===this.vec.length&&this.vec.unshift(0);else for(3===this.direction.length&&(this.vec[0]=0,e=1),t=0;t<this.direction.length;t++)this.vec[e+t]=n.A.evaluate(this.direction[t]);return this},getPointCoords:function(t){var e,i=[],r=[];return i=this.point.coords,r=this.vec,e=n.A.evaluate(t),t=this.view.intersectionLineCube(i,r,e),[i[0]+r[0]*t,i[1]+r[1]*t,i[2]+r[2]*t,i[3]+r[3]*t]},addTransform:function(t,e){return this.point.addTransform(t.point,e),this.addTransformGeneric(t,e),this},updateTransform:function(){var t,e;if(0===this.transformations.length||null===this.baseElement)return this;for(e=0,t=this===this.baseElement?this.vec:this.baseElement.vec;e<this.transformations.length;e++)this.transformations[e].update(),t=a.A.matVecMult(this.transformations[e].matrix,t);return this.vec=t,this},update:function(){return this.needsUpdate&&this.updateCoords().updateTransform(),this},setPosition2D:function(t){var e,i;for(e=0;e<this.parents.length;e++)"point3d"===(i=this.view.select(this.parents[e])).elType&&i.element2D.draggable()&&t.applyOnce(i.element2D);this.endpoints[0].update(),this.endpoints[1].update()},updateRenderer:function(){return this.needsUpdate=!1,this},projectCoords:function(t,e){var i,r=this.getPointCoords(0),s=this.getPointCoords(1),o=[s[0]-r[0],s[1]-r[1],s[2]-r[2]],h=[t[0]-r[0],t[1]-r[1],t[2]-r[2]],l=Math.min(Math.max(a.A.innerProduct(h,o)/a.A.innerProduct(o,o),n.A.evaluate(this.range[0])),n.A.evaluate(this.range[1]));return i=this.getPointCoords(l).slice(),e[0]=l,i},updateZIndex:function(){var t=this.endpoints[0],e=this.endpoints[1],i=[1,t.X()+e.X(),t.Y()+e.Y(),t.Z()+e.Z()];return i[1]*=.5,i[2]*=.5,i[3]*=.5,this.zIndex=a.A.matVecMult(this.view.matrix3DRotShift,i)[3],this}}
1),r.A.createLine3D=function(t,e,i){var s,a,h,l,c,d,u,p,f,A=e[0],m=null,b=null;if(s=n.A.copyAttributes(i,t.options,"line3d"),e[1].type===o.A.OBJECT_TYPE_LINE3D&&n.A.isTransformationOrArray(e[2])&&(m=e[1],b=e[2],a=n.A.providePoints3D(A,[[0,0,0,0],[0,0,0,0]],i,"line3d",["point1","point2"])),null===m&&(n.A.isPoint3D(e[2])||3===e.length&&(n.A.isArray(e[2])||n.A.isFunction(e[2]))))d=n.A.providePoints3D(A,[e[1]],i,"line3d",["point1"])[0],u=n.A.providePoints3D(A,[e[2]],i,"line3d",["point2"])[0],l=function(){return[0,u.X()-d.X(),u.Y()-d.Y(),u.Z()-d.Z()]},c=[0,1],(f=new r.A.Line3D(A,d,l,c,s)).prepareUpdate().update(),(p=n.A.providePoints3D(A,[[1,0,0,0],[1,0,0,0]],{visible:!0},"line3d",["point1","point2"]))[0].F=function(){var t=0;return f.evalVisProp("straightfirst")&&(t=-1/0),f.getPointCoords(t)},p[1].F=function(){var t=1;return f.evalVisProp("straightlast")&&(t=1/0),f.getPointCoords(t)},p[0].prepareUpdate().update(),p[1].prepareUpdate().update(),(s=f.setAttr2D(s)).straightfirst=!1,s.straightlast=!1,f.element2D=A.create("segment",[p[0].element2D,p[1].element2D],s),f.element2D.view=A,f.endpoints=p,f.addChild(p[0]),f.addChild(p[1]),f.addParents([d,u]);else{if(null!==m)h=n.A.providePoints3D(A,[[0,0,0]],i,"line3d",["point"])[0],l=[0,0,0,1e-4],c=e[3]||[-1/0,1/0];else if(n.A.exists(e[2].view)&&e[2].type===o.A.OBJECT_TYPE_LINE3D||n.A.isFunction(e[2])||3===e[2].length||4===e[2].length)h=n.A.providePoints3D(A,[e[1]],i,"line3d",["point"])[0],l=e[2],c=e[3];else throw Error("JSXGraph: Can't create line3d with parents of type '"+typeof e[1]+", "+typeof e[2]+", "+typeof e[3]+"'.");a=n.A.providePoints3D(A,[[1,0,0,0],[1,0,0,0]],i,"line3d",["point1","point2"]),(f=new r.A.Line3D(A,h,l,c,s)).prepareUpdate().update(),a[0].F=function(){return f.getPointCoords(n.A.evaluate(f.range[0]))},a[0].prepareUpdate().update(),d=a[0],a[1].F=function(){return f.getPointCoords(n.A.evaluate(f.range[1]))},a[1].prepareUpdate().update(),u=a[1],(s=f.setAttr2D(s)).straightfirst=!1,s.straightlast=!1,f.element2D=A.create("segment",[d.element2D,u.element2D],s),f.element2D.view=A,f.endpoints=a,f.addParents(h),null!==m&&null!==b&&(f.addTransform(m,b),f.addParents(m))}return f.addChild(f.element2D),f.inherits.push(f.element2D),f.element2D.addParents(f),f.point1=d,f.point2=u,f.point1._is_new?(f.addChild(f.point1),delete f.point1._is_new):f.point1.addChild(f),f.point2._is_new?(f.addChild(f.point2),delete f.point2._is_new):f.point2.addChild(f),n.A.exists(h)&&(h._is_new?(f.addChild(h),delete h._is_new):h.addChild(f)),f.update(),f.element2D.prepareUpdate().update().updateRenderer(),f},r.A.registerElement("line3d",r.A.createLine3D),r.A.Plane3D=function(t,e,i,r,s,a,h){this.constructor(t.board,h,o.A.OBJECT_TYPE_PLANE3D,o.A.OBJECT_CLASS_3D),this.constructor3D(t,"plane3d"),this.board.finalizeAdding(this),this.point=e,this.direction1=i,this.direction2=s,this.range_u=r||[-1/0,1/0],this.range_v=a||[-1/0,1/0],this.vec1=[0,0,0,0],this.vec2=[0,0,0,0],this.mesh3d=null,this.normal=[0,0,0,0],this.d=0,this.updateCoords(),this.updateNormal(),this.methodMap=n.A.deepCopy(this.methodMap,{})},r.A.Plane3D.prototype=new r.A.GeometryElement,n.A.copyPrototypeMethods(r.A.Plane3D,r.A.GeometryElement3D,"constructor3D"),r.A.extend(r.A.Plane3D.prototype,{F:function(t,e){var i,r,s,o,n;for(i=0,r=this.vec1.slice(),s=this.vec2.slice(),o=a.A.norm(r,3),n=a.A.norm(s,3);i<3;i++)r[i]/=o,s[i]/=n;return[this.point.X()+t*r[0]+e*s[0],this.point.Y()+t*r[1]+e*s[1],this.point.Z()+t*r[2]+e*s[2]]},X:function(t,e){return this.F(t,e)[0]},Y:function(t,e){return this.F(t,e)[1]},Z:function(t,e){return this.F(t,e)[2]},updateCoords:function(){var t,e;if(n.A.exists(this.direction1.view)&&this.direction1.type===o.A.OBJECT_TYPE_LINE3D)this.vec1=this.direction1.vec.slice();else if(n.A.isFunction(this.direction1))this.vec1=n.A.evaluate(this.direction1),3===this.vec1.length&&this.vec1.unshift(0);else for(e=0,3===this.direction1.length&&(this.vec1[0]=0,e=1),t=0;t<this.direction1.length;t++)this.vec1[e+t]=n.A.evaluate(this.direction1[t]);if(n.A.exists(this.direction2.view)&&this.direction2.type===o.A.OBJECT_TYPE_LINE3D)this.vec2=this.direction2.vec.slice();else if(n.A.isFunction(this.direction2))this.vec2=n.A.evaluate(this.direction2),3===this.vec2.length&&this.vec2.unshift(0);else for(e=0,3===this.direction2.length&&(this.vec2[0]=0,e=1),t=0;t<this.direction2.length;t++)this.vec2[e+t]=n.A.evaluate(this.direction2[t]);return this},updateNormal:function(){var t,e;if(!this.needsUpdate,this.normal=a.A.crossProduct(this.vec1.slice(1),this.vec2.slice(1)),Math.abs(e=a.A.norm(this.normal))>a.A.eps*a.A.eps)for(t=0;t<3;t++)this.normal[t]/=e;return this.normal.unshift(0),this.d=a.A.innerProduct(this.point.coords,this.normal,4),this},updateDataArray:function(){var t,e,i,r,s,o,h,l,d,u,p,f,A,m,b,g=["xPlaneRear","yPlaneRear","zPlaneRear"],v=[],y=[0,0,0],C=[0,0,0],_=[0,0,0],P=[0,0,0],x=1e-12,E=this.view;if(this.dataX=[],this.dataY=[],this.updateNormal(),"axisplane3d"!==this.elType&&E.defaultAxes&&n.A.evaluate(this.range_u[0])===-1/0&&n.A.evaluate(this.range_u[1])===1/0&&n.A.evaluate(this.range_v[0])===-1/0&&n.A.evaluate(this.range_v[1])===1/0){for(u=0;
1u<g.length;u++){if(!1!==(P=E.intersectionPlanePlane(this,E.defaultAxes[g[u]]))[0]&&!1!==P[1]){for(d=0;d<v.length&&!(c.A.distance(P[0],v[d][0],4)<x&&c.A.distance(P[1],v[d][1],4)<x||c.A.distance(P[0],v[d][1],4)<x&&c.A.distance(P[1],v[d][0],4)<x);d++);d===v.length&&v.push(P.slice())}if((P=[1,0,0,0])[u+1]=E.bbox3D[u][1],l=a.A.innerProduct(P,E.defaultAxes[g[u]].normal,4),!1!==(P=E.intersectionPlanePlane(this,E.defaultAxes[g[u]],l))[0]&&!1!==P[1]){for(d=0;d<v.length&&!(c.A.distance(P[0],v[d][0],4)<x&&c.A.distance(P[1],v[d][1],4)<x||c.A.distance(P[0],v[d][1],4)<x&&c.A.distance(P[1],v[d][0],4)<x);d++);d===v.length&&v.push(P.slice())}}if(0===v.length)return{X:this.dataX,Y:this.dataY};m=A=0,d=0;do{for(4===(P=v[m][d]).length&&(s=E.project3DTo2D(P),this.dataX.push(s[1]),this.dataY.push(s[2])),d=(d+1)%2,P=v[m][d],b=m,u=0;u<v.length;u++){if(u!==m&&c.A.distance(P,v[u][0])<x){m=u,d=0;break}if(u!==m&&c.A.distance(P,v[u][1])<x){m=u,d=1;break}}if(m===b){console.log("Error plane3d update: did not find next",m);break}}while(m!==A);s=E.project3DTo2D(v[A][0]),this.dataX.push(s[1]),this.dataY.push(s[2])}else{for(d=1,t=n.A.evaluate(this.range_u[0]),e=n.A.evaluate(this.range_u[1]),i=n.A.evaluate(this.range_v[0]),r=n.A.evaluate(this.range_v[1]),_=this.point.coords,y=this.vec1.slice(),C=this.vec2.slice(),o=a.A.norm(y,4),h=a.A.norm(C,4);d<4;d++)y[d]/=o,C[d]/=h;for(u=0;u<4;u++){switch(u){case 0:p=t,f=i;break;case 1:p=e,f=i;break;case 2:p=e,f=r;break;case 3:p=t,f=r}for(d=0;d<4;d++)P[d]=_[d]+p*y[d]+f*C[d];s=E.project3DTo2D(P),this.dataX.push(s[1]),this.dataY.push(s[2])}this.dataX.push(this.dataX[0]),this.dataY.push(this.dataY[0])}return{X:this.dataX,Y:this.dataY}},addTransform:function(t,e){return this.addTransformGeneric(t,e),this.point.addTransform(t.point,e),this},updateTransform:function(){var t,e,i;if(0===this.transformations.length||null===this.baseElement)return this;for(this===this.baseElement?(t=this.vec1,e=this.vec2):(t=this.baseElement.vec1,e=this.baseElement.vec2),i=0;i<this.transformations.length;i++)this.transformations[i].update(),t=a.A.matVecMult(this.transformations[i].matrix,t),e=a.A.matVecMult(this.transformations[i].matrix,e);return this.vec1=t,this.vec2=e,this},update:function(){return this.needsUpdate&&this.updateCoords().updateTransform(),this},updateRenderer:function(){return this.needsUpdate=!1,this},projectCoords:function(t,e){return c.A.projectCoordsToParametric(t,this,2,e)}}),r.A.createPlane3D=function(t,e,i){var s,a,h,l,c,d,u,p,f,A,m=e[0],b=null,g=null;if((s=n.A.copyAttributes(i,t.options,"plane3d")).threepoints||n.A.isPoint3D(e[2])||n.A.isPoint3D(e[3]))a=n.A.providePoints3D(m,[e[1]],i,"plane3d",["point1"])[0],h=n.A.providePoints3D(m,[e[2]],i,"plane3d",["point2"])[0],l=n.A.providePoints3D(m,[e[3]],i,"plane3d",["point3"])[0],c=function(){return[h.X()-a.X(),h.Y()-a.Y(),h.Z()-a.Z()]},d=function(){return[l.X()-a.X(),l.Y()-a.Y(),l.Z()-a.Z()]},u=e[4]||[-1/0,1/0],p=e[5]||[-1/0,1/0];else{if(e[1].type===o.A.OBJECT_TYPE_PLANE3D&&n.A.isTransformationOrArray(e[2])?(b=e[1],g=e[2],a=n.A.providePoints3D(m,[[0,0,0,0]],i,"plane3d",["point"])[0],c=[0,1e-4,0,0],d=[0,0,1e-4,0],u=e[3]||[-1/0,1/0],p=e[4]||[-1/0,1/0]):(a=n.A.providePoints3D(m,[e[1]],i,"plane3d",["point"])[0],c=e[2],d=e[3],u=e[4]||[-1/0,1/0],p=e[5]||[-1/0,1/0]),!1===a)throw Error("JSXGraph: Can't create plane3d with first parent of type '"+typeof e[1]+"'.\nPossible first parent types are: point3d, array of length 3, function returning an array of length 3.");if(null!==b&&e<3||null===b&&e.length<4)throw Error("JSXGraph: Can't create plane3d with parents of type '"+typeof e[1]+", "+typeof e[2]+", "+typeof e[3]+", "+typeof e[4]+", "+typeof e[5]+"'.")}return f=new r.A.Plane3D(m,a,c,u,d,p,s),a.addChild(f),s=f.setAttr2D(s),f.element2D=m.create("curve",[[],[]],s),f.element2D.view=m,null!==b&&null!==g&&(f.addTransform(b,g),f.addParents(b)),f.element2D.updateDataArray=function(){var t=f.updateDataArray();this.dataX=t.X,this.dataY=t.Y},f.addChild(f.element2D),f.inherits.push(f.element2D),f.element2D.setParents(f),Math.abs(f.range_u[0])!==1/0&&Math.abs(f.range_u[1])!==1/0&&Math.abs(f.range_v[0])!==1/0&&Math.abs(f.range_v[1])!==1/0&&(s=n.A.copyAttributes(s.mesh3d,t.options,"mesh3d"),A=m.create("mesh3d",[function(){return a.coords},function(){return f.vec1},function(){return f.vec2},f.range_u,f.range_v],s),f.mesh3d=A,f.addChild(A),f.inherits.push(A),f.element2D.inherits.push(A),A.setParents(f),f.mesh3d.view=m),f.element2D.prepareUpdate().update(),t.isSuspendedUpdate||f.element2D.updateVisibility().updateRenderer(),f},r.A.registerElement("plane3d",r.A.createPlane3D),r.A.createIntersectionLine3D=function(t,e,
1i){var r,s,a,h=e[0],l=e[1],d=e[2],u=n.A.copyAttributes(i,t.options,"intersectionline3d"),p=[];for(s=0,a=c.A.intersectionFunction3D(h,l,d);s<2;s++)p[s]=h.create("point3d",a[s],u["point"+(s+1)]);r=h.create("line3d",p,u);try{l.addChild(r),d.addChild(r)}catch(t){throw Error("JSXGraph: Can't create 'intersection' with parent types '"+typeof e[1]+"' and '"+typeof e[2]+"'.")}return r.type=o.A.OBJECT_TYPE_INTERSECTION_LINE3D,r.elType="intersectionline3d",r.setParents([l.id,d.id]),r},r.A.registerElement("intersectionline3d",r.A.createIntersectionLine3D),r.A.Text3D=function(t,e,i,r,s){this.constructor(t.board,s,o.A.OBJECT_TYPE_TEXT3D,o.A.OBJECT_CLASS_3D),this.constructor3D(t,"text3d"),this.board.finalizeAdding(this),this.coords=[0,0,0,0],this.F=e,this.slide=r,this.X=function(){return this.coords[1]},this.Y=function(){return this.coords[2]},this.Z=function(){return this.coords[3]},this.position=[],this._c2d=null,this.methodMap=n.A.deepCopy(this.methodMap,{})},r.A.Text3D.prototype=new r.A.GeometryElement,n.A.copyPrototypeMethods(r.A.Text3D,r.A.GeometryElement3D,"constructor3D"),r.A.extend(r.A.Text3D.prototype,{updateCoords:function(){var t;if(n.A.isFunction(this.F))this.coords=n.A.evaluate(this.F),this.coords.unshift(1);else for(t=0,this.coords[0]=1;t<3;t++)n.A.isFunction(this.F[t])&&(this.coords[t+1]=n.A.evaluate(this.F[t]));return this},initCoords:function(){var t;if(n.A.isFunction(this.F))this.coords=n.A.evaluate(this.F),this.coords.unshift(1);else for(t=0,this.coords[0]=1;t<3;t++)this.coords[t+1]=n.A.evaluate(this.F[t]);return this},normalizeCoords:function(){return Math.abs(this.coords[0])>a.A.eps&&(this.coords[1]/=this.coords[0],this.coords[2]/=this.coords[0],this.coords[3]/=this.coords[0],this.coords[0]=1),this},setPosition:function(t,e){var i=this.coords;return 3===t.length?(i[0]=1,i[1]=t[0],i[2]=t[1],i[3]=t[2]):(i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=t[2],this.normalizeCoords()),this},update:function(t){var e,i,r;return this.element2D.draggable()&&0!==c.A.distance(this._c2d,this.element2D.coords.usrCoords)?(this.view.isVerticalDrag()?e=this.view.project2DTo3DVertical(this.element2D,this.coords):(i=[1,0,0,this.coords[3]],e=this.view.project2DTo3DPlane(this.element2D,[1,0,0,1],i)),0!==e[0]&&(r=this.view.project3DToCube(e),this.coords=r[0],r[1]&&this.element2D.coords.setCoordinates(o.A.COORDS_BY_USER,this.view.project3DTo2D(this.coords)),this.slide&&(this.coords=this.slide.projectCoords([this.X(),this.Y(),this.Z()],this.position),this.element2D.coords.setCoordinates(o.A.COORDS_BY_USER,this.view.project3DTo2D(this.coords))))):(this.updateCoords(),this.slide&&(this.coords=this.slide.projectCoords([this.X(),this.Y(),this.Z()],this.position)),e=this.coords,this.element2D.coords.setCoordinates(o.A.COORDS_BY_USER,this.view.project3DTo2D(e)),this.zIndex=a.A.matVecMult(this.view.matrix3DRotShift,e)[3],this.element2D.prepareUpdate().update()),this._c2d=this.element2D.coords.usrCoords.slice(),this},updateRenderer:function(){return this.needsUpdate=!1,this},testIfFinite:function(){return Math.abs(this.coords[0])>a.A.eps},__evt__update3D:function(t){}}),r.A.createText3D=function(t,e,i){var s,o,a,h,l,c,d=e[0];if(a=e.length>2&&n.A.exists(e[e.length-1].is3D)?e.pop():null,3===e.length)o=e[1],h=e[2];else if(5===e.length)o=e.slice(1,4),h=e[4];else throw Error("JSXGraph: Can't create text3d with parent types '"+typeof e[1]+"' and '"+typeof e[2]+"'.\nPossible parent types: [[x,y,z], text], [x,y,z, text]");return s=n.A.copyAttributes(i,t.options,"text3d"),(c=new r.A.Text3D(d,o,h,a,s)).initCoords(),l=d.project3DTo2D(c.coords),s=c.setAttr2D(s),c.element2D=d.create("text",[l[1],l[2],h],s),c.element2D.view=d,c.addChild(c.element2D),c.inherits.push(c.element2D),c.element2D.setParents(c),c.slide&&(c.slide.addChild(c),c.setParents(c.slide)),c._c2d=c.element2D.coords.usrCoords.slice(),c},r.A.registerElement("text3d",r.A.createText3D),r.A.createTicks3D=function(t,e,i){var s,o,h=e[0],l=e[1],c=e[2],d=e[3],u=e[4];return o=n.A.copyAttributes(i,t.options,"ticks3d"),(s=h.create("curve",[[],[]],o)).point=l,s.direction1=c,s.len=d,s.direction2=u,s.drawLabels=function(e){var i,s,o,l,c,d,u,p=0,f=this.len,A=this.evalVisProp("ticksdistance"),m=this.evalVisProp("ticken
1dings"),b=this.evalVisProp("majorheight"),g=[0,0,0],v=[0,0,0],y=[0,0,0],C=[];if(b/=Math.sqrt(t.unitX*t.unitY),i=b*m[1]*2,this.dataX=[],this.dataY=[],n.A.isFunction(this.point))y=this.point().slice(1);else for(l=0;l<3;l++)y[l]=n.A.evaluate(this.point[l]);for(l=0;l<3;l++)g[l]=n.A.evaluate(this.direction1[l]),v[l]=n.A.evaluate(this.direction2[l]);for(l=0,s=r.A.Math.norm(g,3),o=r.A.Math.norm(v,3);l<3;l++)g[l]/=s,v[l]/=o;if(!(Math.abs(A)<a.A.eps)){for(c=p;c<=f;c+=A){for(l=0,u=[y[0]+c*g[0]+i*v[0],y[1]+c*g[1]+i*v[1],y[2]+c*g[2]+i*v[2]];l<3;l++)0!==g[l]&&(d=y[l]+c*g[l]);C.push(h.create("text3d",[u,d],e))}return C}},s.evalVisProp("drawlabels")&&(s.labels=s.drawLabels(o.label)),s.updateDataArray=function(){var e,i,s,o,l,c,d,u,p=0,f=this.len,A=this.evalVisProp("ticksdistance"),m=this.evalVisProp("tickendings"),b=this.evalVisProp("majorheight"),g=[0,0,0],v=[0,0,0],y=[0,0,0];if(b/=Math.sqrt(t.unitX*t.unitY),e=-(b*m[0]),i=b*m[1],this.dataX=[],this.dataY=[],n.A.isFunction(this.point))y=this.point().slice(1);else for(l=0;l<3;l++)y[l]=n.A.evaluate(this.point[l]);for(l=0;l<3;l++)g[l]=n.A.evaluate(this.direction1[l]),v[l]=n.A.evaluate(this.direction2[l]);for(l=0,s=r.A.Math.norm(g,3),o=r.A.Math.norm(v,3);l<3;l++)g[l]/=s,v[l]/=o;if(!(Math.abs(A)<a.A.eps))for(c=p;c<=f;c+=A)u=[y[0]+c*g[0]+e*v[0],y[1]+c*g[1]+e*v[1],y[2]+c*g[2]+e*v[2]],d=h.project3DTo2D(u),this.dataX.push(d[1]),this.dataY.push(d[2]),u=[y[0]+c*g[0]+i*v[0],y[1]+c*g[1]+i*v[1],y[2]+c*g[2]+i*v[2]],d=h.project3DTo2D(u),this.dataX.push(d[1]),this.dataY.push(d[2]),this.dataX.push(NaN),this.dataY.push(NaN)},s},r.A.registerElement("ticks3d",r.A.createTicks3D),r.A.Polygon3D=function(t,e,i){var r;for(this.constructor(t.board,i,o.A.OBJECT_TYPE_POLYGON3D,o.A.OBJECT_CLASS_3D),this.constructor3D(t,"polygon3d"),this.board.finalizeAdding(this),this.vertices=[],r=0;r<e.length;r++)this.vertices[r]=this.board.select(e[r]),this.vertices[r]._is_new&&(delete this.vertices[r]._is_new,this.vertices[r]._is_new_pol=!0)},r.A.Polygon3D.prototype=new r.A.GeometryElement,n.A.copyPrototypeMethods(r.A.Polygon3D,r.A.GeometryElement3D,"constructor3D"),r.A.extend(r.A.Polygon3D.prototype,{update:function(){return this},updateRenderer:function(){return this.needsUpdate=!1,this},updateZIndex:function(){var t,e=this.vertices.length,i=[1,0,0,0];if(e<=0)return[NaN,NaN,NaN,NaN];for(t=0;t<e;t++)i[1]+=this.vertices[t].coords[1],i[2]+=this.vertices[t].coords[2],i[3]+=this.vertices[t].coords[3];return i[1]/=e,i[2]/=e,i[3]/=e,this.zIndex=a.A.matVecMult(this.view.matrix3DRotShift,i)[3],this}}),r.A.createPolygon3D=function(t,e,i){var s,a,h,l,c,d,u=e[0],p=[],f=[],A=!1;if(c=n.A.copyAttributes(i,t.options,"polygon3d"),null===(l=t.select(e[1]))&&(l=e[1]),n.A.isObject(l)&&l.type===o.A.OBJECT_TYPE_POLYGON3D&&n.A.isTransformationOrArray(e[2]))for(a=0,A=!0,h=l.vertices.length-1,d=n.A.copyAttributes(i,t.options,"polygon3d","vertices");a<h;a++)d.withlabel&&(d.name=""===l.vertices[a].name?"":l.vertices[a].name+"'"),p.push(t.create("point3d",[l.vertices[a],e[2]],d));else if(n.A.isArray(e[1])&&e[1].every(t=>n.A.isPoint3D(t)))p=e[1];else if(!1===(p=n.A.providePoints3D(u,e.slice(1),i,"polygon3d",["vertices"])))throw Error("JSXGraph: Can't create polygon3d with parent types other than 'point' and 'coordinate arrays' or a function returning an array of coordinates. Alternatively, a polygon3d and a transformation can be supplied");for(a=0,(s=new r.A.Polygon3D(u,p,c)).isDraggable=!0,c=s.setAttr2D(c);a<p.length;a++)f.push(p[a].element2D);if(s.element2D=t.create("polygon",f,c),s.element2D.view=u,s.addChild(s.element2D),s.inherits.push(s.element2D),s.element2D.setParents(s),A)for(s.prepareUpdate().update().updateVisibility().updateRenderer(),h=l.vertices.length-1,a=0;a<h;a++)p[a].prepareUpdate().update().updateVisibility().updateRenderer();return s},r.A.registerElement("polygon3d",r.A.createPolygon3D),r.A.Face3D=function(t,e,i,r){this.constructor(t.board,r,o.A.OBJECT_TYPE_FACE3D,o.A.OBJECT_CLASS_3D),this.constructor3D(t,"face3d"),this.board.finalizeAdding(this),this.polyhedron=e,this.faceNumber=i,this.normal=[0,0,0,0],this.d=0,this.vec1=[0,0,0,0],this.vec2=[0,0,0,0],0===this.faceNumber&&this.updateCoords(),this.methodMap=n.A.deepCopy(this.methodMap,{})},r.A.Face3D.prototype=new r.A.GeometryElement,n.A.copyPrototypeMethods(r.A.Face3D,r.A.GeometryElement3D,"constructor3D"),r.A.extend(r.A.Face3D.prototype,{updateCoords:function(){var t,e,i,r,s=this.polyhedron;for(t in s.vertices){if(r=s.vertices[t],n.A.isFunction(r))s.coords[t]=n.A.evaluate(r);else if(n.A.isArray(r))for(e=0,s.coords[t]=[],i=r.length;e<i;e++)s.coords[t][e]=n.A.evaluate(r[e]);else if(r=s.view.select(r),n.A.isPoint3D(r))s.coords[t]=r.coords;else throw Error("Polyhedron3D.updateCoords: unknown vertices type!");
13===s.coords[t].length&&s.coords[t].unshift(1)}return this},updateDataArray2D:function(){var t,e,i,r,s=[],o=[],n=this.polyhedron,h=n.faces[this.faceNumber];if(0===this.faceNumber)for(t in n.vertices)n.coords2D[t]=[];for(t=0,e=h.length,this.zIndex=0;t<e;t++)0===(r=n.coords2D[h[t]]).length&&(i=n.coords[h[t]],r=this.view.project3DTo2D(i),n.coords2D[h[t]]=r,n.zIndex[h[t]]=a.A.matVecMult(this.view.matrix3DRotShift,i)[3]),s.push(r[1]),o.push(r[2]),this.zIndex+=n.zIndex[h[t]];return e>0&&(this.zIndex/=e),2!==e&&(s.push(s[0]),o.push(o[0])),{X:s,Y:o}},addTransform:function(t,e){return 0===this.faceNumber&&this.addTransformGeneric(t,e),this},updateTransform:function(){var t,e,i,r,s;if(0!==this.faceNumber||0===this.transformations.length||null===this.baseElement)return this;for(i=0,t=this.transformations;i<t.length;i++)t[i].update();for(i in(s=this===this.baseElement?this.polyhedron:this.baseElement.polyhedron).coords)if(s.coords.hasOwnProperty(i)){for(r=0,e=s.coords[i];r<t.length;r++)e=a.A.matVecMult(t[r].matrix,e);this.polyhedron.coords[i]=e}return this},update:function(){var t,e,i,r,s,o;if(this.needsUpdate&&!this.view.board._change3DView){if(e=this.polyhedron,0===this.faceNumber&&this.updateCoords().updateTransform(),(o=e.faces[this.faceNumber]).length<3)return this;if(r=e.coords[o[0]],s=e.coords[o[1]],this.vec1=[s[0]-r[0],s[1]-r[1],s[2]-r[2],s[3]-r[3]],s=e.coords[o[2]],this.vec2=[s[0]-r[0],s[1]-r[1],s[2]-r[2],s[3]-r[3]],this.normal=a.A.crossProduct(this.vec1.slice(1),this.vec2.slice(1)),i=a.A.norm(this.normal),this.normal.unshift(0),Math.abs(i)>1e-12)for(t=1;t<4;t++)this.normal[t]/=i;this.d=a.A.innerProduct(r,this.normal,4)}return this},updateRenderer:function(){return this.needsUpdate&&(this.needsUpdate=!1,this.shader()),this},shader:function(){var t,e,i,r,s,o,n,h,l;if(this.evalVisProp("shader.enabled"))return t=this.evalVisProp("shader.hue"),e=this.evalVisProp("shader.saturation"),h=this.evalVisProp("shader.minlightness"),l=this.evalVisProp("shader.maxlightness"),"angle"===this.evalVisProp("shader.type").toLowerCase()?i=h+(l-h)*(r=Math.abs(r=a.A.innerProduct(this.view.matrix3DRotShift[3],this.normal))):(n=this.view.zIndexMax,o=this.view.zIndexMin,i=h+(l-h)*((this.zIndex-o)/(n-o))),s="hsl("+t+","+e+"%,"+i+"%)",this.element2D.visProp.fillcolor=s,this.zIndex}}),r.A.createFace3D=function(t,e,i){var s,o,a=e[0],h=e[1],l=e[2];return s=n.A.copyAttributes(i,t.options,"face3d"),s=(o=new r.A.Face3D(a,h,l,s)).setAttr2D(s),o.element2D=a.create("curve",[[],[]],s),o.element2D.view=a,o.element2D.updateDataArray=function(){var t=o.updateDataArray2D();this.dataX=t.X,this.dataY=t.Y},o.addChild(o.element2D),o.inherits.push(o.element2D),o.element2D.setParents(o),o.element2D.prepareUpdate().update(),t.isSuspendedUpdate||o.element2D.updateVisibility().updateRenderer(),o},r.A.registerElement("face3d",r.A.createFace3D),r.A.Polyhedron3D=function(t,e,i,r){var s,a,h,l=this;for(this.constructor(t.board,r,o.A.OBJECT_TYPE_POLYHEDRON3D,o.A.OBJECT_CLASS_3D),this.constructor3D(t,"polyhedron3d"),this.board.finalizeAdding(this),this.elType="polyhedron3d",this.faces=i,this.numberFaces=i.length,this.def=e,a=["setAttribute","setParents","prepareUpdate","updateRenderer","update","fullUpdate","highlight","noHighlight"],h=function(t){return function(){var e;for(e in l.faces)l.faces.hasOwnProperty(e)&&n.A.exists(l.faces[e][t])&&l.faces[e][t].apply(l.faces[e],arguments);return l}},s=0;s<a.length;s++)this[a[s]]=h(a[s]);this.methodMap=n.A.deepCopy(this.methodMap,{setAttribute:"setAttribute",setParents:"setParents"})},r.A.Polyhedron3D.prototype=new r.A.GeometryElement,n.A.copyPrototypeMethods(r.A.Polyhedron3D,r.A.GeometryElement3D,"constructor3D"),r.A.extend(r.A.Polyhedron3D.prototype,{addTransform:function(t,e){if(this.faces.length>0&&t.faces.length>0)this.faces[0].addTransform(t.faces[0],e);else throw Error("Adding transformation failed. At least one of the two polyhedra has no faces.");return this}}),r.A.createPolyhedron3D=function(t,e,i){var s,a,h,l,c,d,u,p=e[0],f=[],A=null,m=null,b={view:p,vertices:{},coords:{},coords2D:{},zIndex:{},faces:[]};if(n.A.exists(e[1].type)&&e[1].type===o.A.OBJECT_TYPE_POLYHEDRON3D)A=e[1],m=e[2],b.vertices=A.def.vertices,b.faces=A.def.faces;else{if(n.A.isArray(e[1]))for(s=0,a=e[1].length;s<a;s++)b.vertices[s]=e[1][s];else if(n.A.isObject(e[1]))for(s in e[1])e[1].hasOwnProperty(s)&&(b.vertices[s]=e[1][s]);b.faces=e[2]}for(u=n.A.copyAttributes(i,t.options,"polyhedron3d"),console.time("polyhedron"),p.board.suspendUpdate(),a=b.faces.length,s=0;s<a;s++)d=n.A.copyAttributes(i,t.options,"face3d"),u.fillcolorarray.length>0&&(d.fillcolor=u.fillcolorarray[s%u.fillcolorarray.length]),l=b.faces[s],n.A.isArray(l)&&2===l.length&&n.A.isObject(l[1])&&n.A.isArray(l[0])&&(n.A.mergeAttr(d,l[1]),b.faces[s]=l[0]),h=p.create("face3d",[b,s],d),f.push(h);for((c=new r.A.Polyhedron3D(p,b,f,u)).setParents(c),s=0;s<a;s++)c.inherits.push(c.faces[s]),c.addChild(c.faces[s]);return null!==A&&(c.addTransform(A,m),c.addParents(A)),p.board.unsuspendUpdate(),console.timeEnd("polyhedron"),c},r.A.registerElement("polyhedron3d",r.A.createPolyhedron3D),r.A.Sphere3D=function(t,e,
1i,r,s){this.constructor(t.board,s,o.A.OBJECT_TYPE_SPHERE3D,o.A.OBJECT_CLASS_3D),this.constructor3D(t,"sphere3d"),this.board.finalizeAdding(this),this.method=e,this.center=this.board.select(i),this.point2=null,this.points=[],this.element2D=null,this.aux2D=[],this.projectionType=t.projectionType,"twoPoints"===e?(this.point2=this.board.select(r),this.radius=this.Radius()):"pointRadius"===e&&(this.updateRadius=n.A.createFunction(r,this.board),this.updateRadius(),this.addParentsFromJCFunctions([this.updateRadius])),n.A.exists(this.center._is_new)?(this.addChild(this.center),delete this.center._is_new):this.center.addChild(this),"twoPoints"===e&&(n.A.exists(this.point2._is_new)?(this.addChild(this.point2),delete this.point2._is_new):this.point2.addChild(this)),this.methodMap=n.A.deepCopy(this.methodMap,{center:"center",point2:"point2",Radius:"Radius"})},r.A.Sphere3D.prototype=new r.A.GeometryElement,n.A.copyPrototypeMethods(r.A.Sphere3D,r.A.GeometryElement3D,"constructor3D"),r.A.extend(r.A.Sphere3D.prototype,{X:function(t,e){return this.Radius()*Math.sin(t)*Math.cos(e)},Y:function(t,e){return this.Radius()*Math.sin(t)*Math.sin(e)},Z:function(t,e){return this.Radius()*Math.cos(t)},range_u:[0,2*Math.PI],range_v:[0,Math.PI],update:function(){return this.projectionType!==this.view.projectionType&&this.rebuildProjection(),this},updateRenderer:function(){return this.needsUpdate=!1,this},setRadius:function(t){return this.updateRadius=n.A.createFunction(t,this.board),this.addParentsFromJCFunctions([this.updateRadius]),this.board.update(),this},Radius:function(t){return n.A.exists(t)?(this.setRadius(t),this.Radius()):"twoPoints"===this.method?this.center.testIfFinite()&&this.point2.testIfFinite()?this.center.distance(this.point2):NaN:"pointRadius"===this.method?Math.abs(this.updateRadius()):NaN},focusFn:function(t){var e=this;return function(){var i=e.view.boxToCam[3],r=e.Radius();return e.view.project3DTo2D([e.center.X()+t*r*i[1],e.center.Y()+t*r*i[2],e.center.Z()+t*r*i[3]]).slice(1,3)}},innerVertexFn:function(){var t=this;return function(){var e,i=t.view,r=i.worldToFocal(t.center.coords,!1),s=a.A.hypot(r[0],r[1]),o=i.boxToCam,n=t.Radius(),h=Math.atan(-s/r[2])+Math.acos(n/a.A.norm(r)),l=Math.cos(h),c=Math.sin(h);return e=s>1e-8?[-(r[0]*o[1][1]+r[1]*o[2][1])/s,-(r[0]*o[1][2]+r[1]*o[2][2])/s,-(r[0]*o[1][3]+r[1]*o[2][3])/s]:[o[1][1],o[1][2],o[1][3]],i.project3DTo2D([t.center.X()+n*(c*e[0]+l*o[3][1]),t.center.Y()+n*(c*e[1]+l*o[3][2]),t.center.Z()+n*(c*e[2]+l*o[3][3])])}},buildCentralProjection:function(t){var e=this.view,i={visible:!1,withLabel:!1},r=e.create("point",this.focusFn(-1),i),s=e.create("point",this.focusFn(1),i),o=e.create("point",this.innerVertexFn(e),i);this.aux2D=[r,s,o],this.element2D=e.create("ellipse",this.aux2D,void 0===t?this.visProp:t)},buildParallelProjection:function(t){var e=this,i=function(){var t=e.view.bbox3D[0][1]-e.view.bbox3D[0][0];return e.Radius()*e.view.size[0]/t};this.aux2D=[],this.element2D=this.view.create("circle",[e.center.element2D,i],void 0===t?this.visProp:t)},rebuildProjection:function(t){var e;if(this.element2D)for(e in this.view.board.removeObject(this.element2D),this.aux2D)this.aux2D.hasOwnProperty(e)&&this.view.board.removeObject(this.aux2D[e]);this.projectionType=this.view.projectionType,"central"===this.projectionType?this.buildCentralProjection(t):this.buildParallelProjection(t),this.addChild(this.element2D),this.inherits.push(this.element2D),this.element2D.view=this.view},projectCoords:function(t,e){var i=this.Radius(),r=[1].concat(t),s=this.center.coords,o=c.A.distance(s,r,4),n=A.A.subtract(r,s);return 0===o?(e[0]=0,e[1]=0,[1,i,0,0]):0===i?(e[0]=0,e[1]=0,this.center.coords):(o=i/o,n[0]=1,n[1]*=o,n[2]*=o,n[3]*=o,e[1]=Math.atan2(n[2],n[1]),e[1]+=e[1]<0?Math.PI:0,0!==e[1]?e[0]=Math.atan2(n[2],n[3]*Math.sin(e[1])):e[0]=Math.atan2(n[1],n[3]*Math.cos(e[1])),e[0]+=e[0]<0?2*Math.PI:0,n)}}),r.A.createSphere3D=function(t,e,i){var s,o,a,h,l,c,d=e[0];for(c=1,s=n.A.copyAttributes(i,t.options,"sphere3d"),o=[];c<e.length;c++)if(n.A.isPointType3D(t,e[c])){if(a=0===o.length?"center":"point",!1===(h=n.A.providePoints3D(d,[e[c]],i,"sphere3d",[a])[0]))throw Error("JSXGraph: Can't create sphere3d from this type. Please provide a point type.");o.push(h)}else o.push(e[c]);if(n.A.isPoint3D(o[0])&&n.A.isPoint3D(o[1]))l=new r.A.Sphere3D(d,"twoPoints",o[0],o[1],s);else if(n.A.isPoint3D(o[0])&&(n.A.isNumber(o[1])||n.A.isFunction(o[1])||n.A.isString(o[1])))l=new r.A.Sphere3D(d,"pointRadius",o[0],o[1],s);else throw Error("JSXGraph: Can't create sphere3d with parent types '"+typeof e[1]+"' and '"+typeof e[2]+"'.\nPossible parent types: [point,point], [point,number], [point,function]");return s=l.setAttr2D(s),l.rebuildProjection(s),l.element2D.prepareUpdate().update(),t.isSuspendedUpdate||l.element2D.updateVisibility().updateRenderer(),l},r.A.registerElement("sphere3d",r.A.createSphere3D),r.A.Surface3D=function(t,e,
1i,r,s,a,h,l){this.constructor(t.board,l,o.A.OBJECT_TYPE_SURFACE3D,o.A.OBJECT_CLASS_3D),this.constructor3D(t,"surface3d"),this.board.finalizeAdding(this),this._F=e,this._X=i,this._Y=r,this._Z=s,null!==this._F?(this._X=function(t,e){return this._F(t,e)[0]},this._Y=function(t,e){return this._F(t,e)[1]},this._Z=function(t,e){return this._F(t,e)[2]}):null!==this._X&&(this._F=function(t,e){return[this._X(t,e),this._Y(t,e),this._Z(t,e)]}),this.range_u=a,this.range_v=h,this.dataX=null,this.dataY=null,this.dataZ=null,this.points=[],this.methodMap=n.A.deepCopy(this.methodMap,{})},r.A.Surface3D.prototype=new r.A.GeometryElement,n.A.copyPrototypeMethods(r.A.Surface3D,r.A.GeometryElement3D,"constructor3D"),r.A.extend(r.A.Surface3D.prototype,{updateWireframe:function(){var t,e,i,r,s,o,a,h,l,c,d,u,p,f,A=[1,0,0,0];for(i=0,this.points=[],t=this.evalVisProp("stepsu"),e=this.evalVisProp("stepsv"),s=n.A.evaluate(this.range_u),o=n.A.evaluate(this.range_v),a=n.A.evaluate(s[0]),h=n.A.evaluate(o[0]),l=n.A.evaluate(s[1]),c=n.A.evaluate(o[1]),d=(l-a)/t,u=(c-h)/e,p=a;i<=t;i++,p+=d)for(this.points.push([]),r=0,f=h;r<=e;r++,f+=u)(A=this.F(p,f)).unshift(1),this.points[i].push(A);return this},updateCoords:function(){return null!==this._F?this.updateWireframe():this.updateTransform(),this},evalF:function(t,e){var i,r,s=[0,0,0,0];if(0===this.transformations.length||!n.A.exists(this.baseElement))return this._F(t,e);for(r=0,i=this.transformations;r<i.length;r++)i[r].update();for((s=this===this.baseElement?this._F(t,e):this.baseElement.evalF(t,e)).unshift(1),s=a.A.matVecMult(i[0].matrix,s),r=1;r<i.length;r++)s=a.A.matVecMult(i[r].matrix,s);return s.slice(1)},F:function(t,e){return this.evalF(t,e)},X:function(t,e){return this.evalF(t,e)[0]},Y:function(t,e){return this.evalF(t,e)[1]},Z:function(t,e){return this.evalF(t,e)[2]},updateDataArray2D:function(){var t,e,i,r,s,o=[],n=[];if(0!==(i=this.points.length)){for(t=0,r=this.points[0].length;t<i;t++){for(e=0;e<r;e++)s=this.view.project3DTo2D(this.points[t][e]),o.push(s[1]),n.push(s[2]);o.push(NaN),n.push(NaN)}for(e=0;e<r;e++){for(t=0;t<i;t++)s=this.view.project3DTo2D(this.points[t][e]),o.push(s[1]),n.push(s[2]);o.push(NaN),n.push(NaN)}}return{X:o,Y:n}},addTransform:function(t,e){return this.addTransformGeneric(t,e),this},updateTransform:function(){var t,e,i,r,s,o,h;if(0===this.transformations.length||null===this.baseElement||n.A.exists(this._F))return this;for(i=0,t=this.transformations;i<t.length;i++)t[i].update();if(this!==this.baseElement&&(this.points=[]),(o=this.baseElement.points.length)>0)for(i=0,h=this.baseElement.points[0].length;i<o;i++)for(this!==this.baseElement&&this.points.push([]),r=0;r<h;r++){for(s=0,e=this===this.baseElement?this.points[i][r]:this.baseElement.points[i][r];s<t.length;s++)e=a.A.matVecMult(t[s].matrix,e);this===this.baseElement?this.points[i][r]=e:this.points[i].push(e)}return this},updateDataArray:function(){},update:function(){return this.needsUpdate&&(this.updateDataArray(),this.updateCoords()),this},updateRenderer:function(){return this.needsUpdate=!1,this},projectCoords:function(t,e){return c.A.projectCoordsToParametric(t,this,2,e)}}),r.A.createParametricSurface3D=function(t,e,i){var s,o,a,h,l,c,d,u,p=e[0],f=null,A=null;return 3===e.length?(f=e[1],A=e[2],s=null,o=null,a=null,h=null):4===e.length?(s=e[1],l=e[2],c=e[3],o=null,a=null,h=null):(o=e[1],a=e[2],h=e[3],l=e[4],c=e[5],s=null),d=n.A.copyAttributes(i,t.options,"surface3d"),d=(u=new r.A.Surface3D(p,s,o,a,h,l,c,d)).setAttr2D(d),u.element2D=p.create("curve",[[],[]],d),u.element2D.view=p,null!==f&&(u.addTransform(f,A),u.addParents(f)),u.element2D.updateDataArray=function(){var t=u.updateDataArray2D();this.dataX=t.X,this.dataY=t.Y},u.addChild(u.element2D),u.inherits.push(u.element2D),u.element2D.setParents(u),u.element2D.prepareUpdate().update(),t.isSuspendedUpdate||u.element2D.updateVisibility().updateRenderer(),u},r.A.registerElement("parametricsurface3d",r.A.createParametricSurface3D),r.A.createFunctiongraph3D=function(t,e,i){var r,s=e[0],o=function(t,e){return t},a=function(t,e){return e},h=n.A.createFunction(e[1],t,"x, y"),l=e[2],c=e[3];return(r=s.create("parametricsurface3d",[o,a,h,l,c],i)).elType="functiongraph3d",r},r.A.registerElement("functiongraph3d",r.A.createFunctiongraph3D);let tr=.75,ts="#000";r.A.themes.mono_thin={board:{showInfobox:!1,showCopyright:!0,defaultAxes:{x:{ticks:{minorTicks:0,majorHeight:10,majorTickEndings:[1,0]}},y:{ticks:{minorTicks:0,majorHeight:10,majorTickEndings:[0,1]}}}},navbar:{strokeColor:"#bbb",fillColor:"none"},elements:{strokeColor:ts,highlightStrokeColor:ts,fillColor:"none",highlightFillColor:"none",strokeOpacity:.6,highlightStrokeOpacity:1},angle:{strokeColor:ts,fillColor:"#aaaaaa55",fillOpacity:.3,highlightFillColor:"#aaaaaa33",highlightFillOpacity:.3,label:{strokeColor:ts}},arc:{strokeColor:ts,strokeWidth:tr,highlightStrokeColor:ts,highlightStrokeWidth:tr},axis:{},boxplot:{strokeWidth:tr,strokeColor:ts,fillColor:ts,fillOpacity:.2,highlightStrokeWidth:tr,highlightStrokeColor:ts,highlightFillColor:ts,highlightFillOpacity:.1},circle:{strokeWidth:tr,highlightStrokeWidth:1.5*tr,strokeColor:ts,highlightFillColor:"none",highlightStrokeColor:ts,center:{size:tr,fillColor:ts,strokeColor:ts,highlightStrokeWidth:4*tr,highlightFillColor:ts,highlightStrokeColor:ts},point2:{size:tr,fillColor:ts,strokeColor:ts,highlightStrokeWidth:4*tr,highlightFillColor:ts,highlightStrokeColor:ts}},circumcircle:{strokeWidth:tr,highlightStrokeWidth:1.5*tr,strokeColor:ts,highlightFillColor:"none",highlightStrokeColor:ts,center:{size:tr,fillColor:ts,strokeColor:ts,highlightStrokeWidth:4*tr,highlightFillColor:ts,highlightStrokeColor:ts}},circumcirclearc:{strokeColor:ts,strokeWidth:tr,highlightStrokeColor:ts,highlightStrokeWidth:tr},circumcirclesector:{strokeColor:ts,fillColor:"#aaaaaa55",fillOpacity:.3,highlightFillColor:"#aaaaaa33",highlightFillOpacity:.3},comb:{strokeColor:ts,strokeWidth:tr},conic:{strokeWidth:tr,highlightStrokeWidth:1.5*tr,strokeColor:ts,highlightStrokeColor:ts,fillColor:"none",highlightFillColor:"none"},curve:{strokeColor:ts,strokeWidth:tr,highlightStrokeColor:ts,highlightStrokeWidth:tr},grid:{strokeWidth:tr},hatch:{strokeColor:ts,strokeWidth:tr},incircle:{strokeWidth:tr,highlightStrokeWidth:1.5*tr,strokeColor:ts,highlightFillColor:"none",highlightStrokeColor:ts,center:{size:tr,fillColor:ts,strokeColor:ts,highlightStrokeWidth:4*tr,highlightFillColor:ts,highlightStrokeColor:ts}},inequality:{fillColor:"#aaaaaa55",fillOpacity:.2},integral:{fillColor:"#aaaaaa55",highlightFillColor:"#aaaaa33",fillOpacity:.3,highlightFillOpacity:.3,curveLeft:{color:ts},baseLeft:{color:ts},curveRight:{color:ts},baseRight:{color:ts}},label:{strokeColor:ts},line:{strokeColor:ts,strokeWidth:tr,highlightStrokeColor:ts,highlightStrokeWidth:tr,point1:{size:tr,fillColor:ts,strokeColor:ts,highlightStrokeWidth:4*tr,highlightFillColor:ts,highlightStrokeColor:ts},point2:{size:tr,fillColor:ts,strokeColor:ts,highlightStrokeWidth:4*tr,highlightFillColor:ts,highlightStrokeColor:ts}},normal:{strokeColor:ts},parallel:{strokeColor:ts},perpendicular:{strokeColor:ts},perpendicularsegment:{strokeColor:ts},point:{size:tr,fillColor:ts,strokeColor:ts,highlightStrokeWidth:4*tr,highlightFillColor:ts,highlightStrokeColor:ts}
1,polygon:{fillColor:"#aaaaaa55",highlightFillColor:"#aaaaaa33",fillOpacity:.3,highlightFillOpacity:.3,vertices:{size:tr,fillColor:ts,strokeColor:ts,highlightStrokeWidth:4*tr,highlightFillColor:ts,highlightStrokeColor:ts},borders:{strokeColor:ts,strokeWidth:tr,highlightStrokeColor:ts,highlightStrokeWidth:tr}},sector:{strokeColor:ts,fillColor:"#aaaaaa55",fillOpacity:.3,highlightFillColor:"#aaaaaa33",highlightFillOpacity:.3},semicircle:{center:{size:tr,fillColor:ts,strokeColor:ts,highlightStrokeWidth:4*tr,highlightFillColor:ts,highlightStrokeColor:ts}},slider:{size:tr,fillColor:ts,strokeColor:ts,highlightStrokeWidth:4*tr,highlightFillColor:ts,highlightStrokeColor:ts,baseline:{strokeWidth:tr,strokeColor:ts,highlightStrokeColor:ts},label:{strokeColor:ts},highline:{strokeWidth:3*tr,name:"",strokeColor:ts,highlightStrokeColor:ts},ticks:{strokeColor:ts}},slopefield:{strokeWidth:.75*tr,highlightStrokeWidth:tr,highlightStrokeColor:ts,highlightStrokeOpacity:.8},tapemeasure:{strokeColor:ts,strokeWidth:tr,highlightStrokeColor:ts,highlightStrokeWidth:tr,point1:{size:tr,fillColor:ts,strokeColor:ts,highlightStrokeWidth:4*tr,highlightFillColor:ts,highlightStrokeColor:ts},point2:{size:tr,fillColor:ts,strokeColor:ts,highlightStrokeWidth:4*tr,highlightFillColor:ts,highlightStrokeColor:ts},ticks:{strokeWidth:tr}},text:{strokeColor:ts},tracecurve:{strokeColor:ts},turtle:{strokeWidth:tr,strokeColor:ts,arrow:{strokeWidth:2*tr,strokeColor:"#aaaaaa55"}},vectorfield:{strokeWidth:.75*tr,highlightStrokeWidth:tr,highlightStrokeColor:ts,highlightStrokeOpacity:.8}};let to=r.A.COORDS_BY_SCREEN,tn=r.A.COORDS_BY_USER,ta=r.A.Dump,th=r.A.Expect,tl=r.A.JSXGraph,tc=r.A.Math,td=r.A.Options,tu=r.A.boards,tp=r.A.elements,tf=r.A.palette,tA=r.A.paletteWong,tm=r.A.Board,tb=r.A.Chart,tg=r.A.Circle,tv=r.A.Complex,ty=r.A.Composition,tC=r.A.Coords,t_=r.A.CoordsElement,tP=r.A.Curve,tx=r.A.GeometryElement,tE=r.A.Group,tS=r.A.Image,tN=r.A.JessieCode,tT=r.A.PrefixParser,tw=r.A.Line,tO=r.A.Point,tM=r.A.Polygon,tk=r.A.Text,tD=r.A.Ticks,tR=r.A.Transformation,tL=r.A.Turtle,tB=r.A.View3D,tI=r.A.LMS2rgb,tV=r.A.addEvent,tY=r.A.autoDigits,tj=r.A.autoHighlight,tX=r.A.bind,tF=r.A.capitalize,tJ=r.A.clearVisPropOld,tU=r.A.clone,tz=r.A.cloneAndCopy,tG=r.A.cmpArrays,tH=r.A.coordsArrayToMatrix,t$=r.A.copyAttributes,tW=r.A.createEvalFunction,tq=r.A.createFunction,tZ=r.A.createHTMLSlider,tQ=r.A.darkenColor,tK=r.A.debug,t0=r.A.debugInt,t1=r.A.debugLine,t2=r.A.debugWST,t3=r.A.deepCopy,t5=r.A.def,t4=r.A.deprecated,t6=r.A.eliminateDuplicates,t7=r.A.escapeHTML,t8=r.A.evalSlider,t9=r.A.evaluate,et=r.A.filterElements,ee=r.A.getBoardByContainerId,ei=r.A.getCSSTransformMatrix,er=r.A.getCSSTransform,es=r.A.getDimensions,eo=r.A.getOffset,en=r.A.getPosition,ea=r.A.getProp,eh=r.A.hex2rgb,el=r.A.hsv2rgb,ec=r.A.isAndroid,ed=r.A.isApple,eu=r.A.isArray,ep=r.A.isDesktop,ef=r.A.isInArray,eA=r.A.isInObject,em=r.A.isMetroApp,eb=r.A.isMobile,eg=r.A.isMozilla,ev=r.A.isBoard,ey=r.A.isName,eC=r.A.isNode,e_=r.A.isNumber,eP=r.A.isObject,ex=r.A.isPoint,eE=r.A.isPoint3D,eS=r.A.isPointType,eN=r.A.isPointType3D,eT=r.A.isString,ew=r.A.isTouchDevice,eO=r.A.isTransformationOrArray,eM=r.A.isWebWorker,ek=r.A.isWebkitAndroid,eD=r.A.isWebkitApple,eR=r.A.keys,eL=r.A.lightenColor,eB=r.A.merge,eI=r.A.normalizePointFace,eV=r.A.providePoints,eY=r.A.registerElement,ej=r.A.registerReader,eX=r.A.removeAllEvents,eF=r.A.removeElementFromArray,eJ=r.A.removeEvent,eU=r.A.rgb2LMS,ez=r.A.rgb2bw,eG=r.A.rgb2cb,eH=r.A.rgb2css,e$=r.A.rgb2hex,eW=r.A.rgb2hsv,eq=r.A.rgbParser,eZ=r.A.rgba2rgbo,eQ=r.A.rgbo2rgba,eK=r.A.sanitizeHTML,e0=r.A.shortcut,e1=r.A.str2Bool,e2=r.A.supportsCanvas,e3=r.A.supportsPointerEvents,e5=r.A.supportsSVG,e4=r.A.supportsVML,e6=r.A.swap,e7=r.A.timedChunk,e8=r.A.toFixed,e9=r.A.toFullscreen,it=r.A.toJSON,ie=r.A.trim,ii=r.A.trimNumber,ir=r.A.truncate,is=r.A.unescapeHTML,io=r.A.uniqueArray,ia=r.A.useBlackWhiteOptions,ih=r.A.useStandardOptions,il=r.A.warn;s.A.isBrowser?window.JXG=r.A:s.A.isWebWorker()&&(self.JXG=r.A);let ic=r.A},20708:(t,e,i)=>{i.d(e,{A:()=>h});var r=i(76422),s=i(64657),o=i(97272),n={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dodgerblue:"1e90ff",feldspar:"d19275",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgrey:"d3d3d3",lightgreen:"90ee9
10",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslateblue:"8470ff",lightslategray:"778899",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"00ff00",limegreen:"32cd32",linen:"faf0e6",magenta:"ff00ff",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370d8",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"d87093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",red:"ff0000",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",venetianred:"ae181e",violet:"ee82ee",violetred:"d02090",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"},a=[{re:/^\s*rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*([\d.]{1,3})\s*\)\s*$/,example:["rgba(123, 234, 45, 0.5)","rgba(255,234,245,1.0)"],process:function(t){return[parseInt(t[1],10),parseInt(t[2],10),parseInt(t[3],10)]}},{re:/^\s*rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)\s*$/,example:["rgb(123, 234, 45)","rgb(255,234,245)"],process:function(t){return[parseInt(t[1],10),parseInt(t[2],10),parseInt(t[3],10)]}},{re:/^(\w{2})(\w{2})(\w{2})$/,example:["#00ff00","336699"],process:function(t){return[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]}},{re:/^(\w{1})(\w{1})(\w{1})$/,example:["#fb0","f0f"],process:function(t){return[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16)]}}];r.A.rgbParser=function(t,e,i){var r,o,h,l,c,d,u,p,f,A,m=t;if(!s.A.exists(t))return[];if(s.A.exists(e)&&s.A.exists(i)&&(m=[t,e,i]),r=m,A=!1,s.A.isArray(r)){for(d=0;d<3;d++)A=A||/\./.test(m[d].toString());for(d=0;d<3;d++)A=A&&m[d]>=0&&m[d]<=1;return A?[Math.ceil(255*m[0]),Math.ceil(255*m[1]),Math.ceil(255*m[2])]:m}for("string"==typeof m&&(r=m),"#"===r.charAt(0)&&(r=r.slice(1,7)),r=n[r=r.replace(/ /g,"").toLowerCase()]||r,d=0;d<a.length;d++)h=a[d].re,l=a[d].process,(c=h.exec(r))&&(u=(o=l(c))[0],p=o[1],f=o[2]);return isNaN(u)||isNaN(p)||isNaN(f)?[]:(u=u<0||isNaN(u)?0:u>255?255:u,[u,p=p<0||isNaN(p)?0:p>255?255:p,f=f<0||isNaN(f)?0:f>255?255:f])},r.A.isColor=function(t){var e=new Option().style;return e.color=t,""!==e.color},r.A.rgb2css=function(t,e,i){var s;return"rgb("+(s=r.A.rgbParser(t,e,i))[0]+", "+s[1]+", "+s[2]+")"},r.A.rgb2hex=function(t,e,i){var s,o,n;return o=(s=r.A.rgbParser(t,e,i))[1],n=s[2],s=(s=s[0]).toString(16),o=o.toString(16),n=n.toString(16),1===s.length&&(s="0"+s),1===o.length&&(o="0"+o),1===n.length&&(n="0"+n),"#"+s+o+n},r.A.hex2rgb=function(t){return r.A.deprecated("JXG.hex2rgb()","JXG.rgb2css()"),r.A.rgb2css(t)},r.A.hsv2rgb=function(t,e,i){var r,s,n,a,h,l,c,d,u;if(t=(t%360+360)%360,0===e)if(!isNaN(t)&&!(t<o.A.eps))return"#ffffff";else r=i,s=i,n=i;else switch(h=Math.floor(l=(t>=360?0:t)/60),a=l-h,c=i*(1-e),d=i*(1-e*a),u=i*(1-e*(1-a)),h){case 0:r=i,s=u,n=c;break;case 1:r=d,s=i,n=c;break;case 2:r=c,s=i,n=u;break;case 3:r=c,s=d,n=i;break;case 4:r=u,s=c,n=i;break;case 5:r=i,s=c,n=d}return r=2===(r=Math.round(255*r).toString(16)).length?r:1===r.length?"0"+r:"00","#"+r+(s=2===(s=Math.round(255*s).toString(16)).length?s:1===s.length?"0"+s:"00")+(n=2===(n=Math.round(255*n).toString(16)).length?n:1===n.length?"0"+n:"00")},r.A.rgb2hsv=function(t,e,i){var s,o,n,a,h,l,c,d,u,p,f,A,m;return o=(s=r.A.rgbParser(t,e,i))[1],n=s[2],a=(s=s[0])/255,h=o/255,l=n/255,A=Math.max(s,o,n),m=Math.min(s,o,n),c=A/255,d=m/255,p=0,(f=c)>0&&(p=(f-d)/f),u=1/(c-d),p>
10&&(u=A===s?(h-l)*u:A===o?2+(l-a)*u:4+(a-h)*u),(u*=60)<0&&(u+=360),A===m&&(u=0),[u,p,f]},r.A.rgb2LMS=function(t,e,i){var s,o,n,a,h,l,c,d=[[.05059983,.08585369,.0095242],[.01893033,.08925308,.01370054],[.00292202,.00975732,.07145979]];return o=(s=r.A.rgbParser(t,e,i))[1],n=s[2],s=Math.pow(s=s[0],.476190476),o=Math.pow(o,.476190476),n=Math.pow(n,.476190476),a=s*d[0][0]+o*d[0][1]+n*d[0][2],(c=[a,h=s*d[1][0]+o*d[1][1]+n*d[1][2],l=s*d[2][0]+o*d[2][1]+n*d[2][2]]).l=a,c.m=h,c.s=l,c},r.A.LMS2rgb=function(t,e,i){var r,s,o,n,a=[[30.830854,-29.832659,1.610474],[-6.481468,17.715578,-2.532642],[-.37569,-1.199062,14.273846]],h=function(t){for(var e=127,i=64;i>0;){if(Math.pow(e,.476190476)>t)e-=i;else{if(Math.pow(e+1,.476190476)>t)return e;e+=i}i/=2}return 254===e&&13.994955247<t?255:e};return r=t*a[0][0]+e*a[0][1]+i*a[0][2],s=t*a[1][0]+e*a[1][1]+i*a[1][2],o=t*a[2][0]+e*a[2][1]+i*a[2][2],r=h(r),(n=[r,s=h(s),o=h(o)]).r=r,n.g=s,n.b=o,n},r.A.rgba2rgbo=function(t){var e;return 9===t.length&&"#"===t.charAt(0)?(e=parseInt(t.slice(7,9).toUpperCase(),16)/255,t=t.slice(0,7)):e=1,[t,e]},r.A.rgbo2rgba=function(t,e){var i;return"none"===t||"transparent"===t?t:(1===(i=Math.round(255*e).toString(16)).length&&(i="0"+i),r.A.rgb2hex(t)+i)},r.A.rgb2bw=function(t){var e,i,s,o="0123456789ABCDEF";return"none"===t?t:t="#"+(i=o.charAt((e=Math.floor(.3*(s=r.A.rgbParser(t))[0]+.59*s[1]+.11*s[2]))>>4&15)+o.charAt(15&e))+i+i},r.A.rgb2cb=function(t,e){var i,s,o,n,a,h,l,c,d,u,p,f,A,m="0123456789ABCDEF";if("none"===t)return t;switch(s=(a=r.A.rgb2LMS(t))[0],o=a[1],n=a[2],e=e.toLowerCase()){case"protanopia":l=-.06150039994295001,c=.08277001656812001,d=-.013200141220000003,u=.05858939668799999,p=-.07934519995360001,f=.013289415272000003,A=.6903216543277437,s=(h=n/o)<A?-(c*o+d*n)/l:-(p*o+f*n)/u;break;case"tritanopia":l=-58973116217e-14,c=.007690316482,d=-.01011703519052,u=.025495080838999994,p=-.0422740347,f=.017005316784,A=.8349489908460004,n=(h=o/s)<A?-(l*s+c*o)/d:-(u*s+p*o)/f;break;default:l=-.06150039994295001,c=.08277001656812001,d=-.013200141220000003,u=.05858939668799999,p=-.07934519995360001,f=.013289415272000003,A=.5763833686400911,o=(h=n/s)<A?-(l*s+d*n)/c:-(u*s+f*n)/p}return"#"+(h=m.charAt((i=r.A.LMS2rgb(s,o,n))[0]>>4&15)+m.charAt(15&i[0]))+(h=m.charAt(i[1]>>4&15)+m.charAt(15&i[1]))+(h=m.charAt(i[2]>>4&15)+m.charAt(15&i[2]))},r.A.shadeColor=function(t,e){var i=r.A.rgbParser(t),s=i[0],o=i[1],n=i[2];return s=parseInt(s+255*e),o=parseInt(o+255*e),n=parseInt(n+255*e),o=(o=o>0?o:0)<255?o:255,n=(n=n>0?n:0)<255?n:255,s=Math.round(s=(s=s>0?s:0)<255?s:255),o=Math.round(o),n=Math.round(n),r.A.rgb2hex([s,o,n])},r.A.lightenColor=function(t,e){return r.A.shadeColor(t,e)},r.A.darkenColor=function(t,e){return r.A.shadeColor(t,-1*e)},r.A.autoHighlight=function(t){var e=r.A.rgba2rgbo(t),i=e[0],s=e[1];return"#"===t.charAt(0)?(s<.3?s*=1.8:s*=.4,r.A.rgbo2rgba(i,s)):t},r.A.contrast=function(t,e,i,s){var o,n,a,h,l,c="#000000";return(e=e||"#000000",i=i||"#ffffff",s=s||7,o=r.A.rgbParser(t),n=r.A.rgbParser(c),(l=((a=.2126*Math.pow(o[0]/255,2.2)+.7152*Math.pow(o[1]/255,2.2)+.0722*Math.pow(o[2]/255,2.2))>(h=.2126*Math.pow(n[0]/255,2.2)+.7152*Math.pow(n[1]/255,2.2)+.0722*Math.pow(n[2]/255,2.2))?Math.floor((a+.05)/(h+.05)):Math.floor((h+.05)/(a+.05)))-1)>s)?e:i},r.A.setClassicColors=function(){r.A.Options.elements.strokeColor="blue",r.A.Options.elements.fillColor="red",r.A.Options.hatch.strokeColor="blue",r.A.Options.angle.fillColor="#ff7f00",r.A.Options.angle.highlightFillColor="#ff7f00",r.A.Options.angle.strokeColor="#ff7f00",r.A.Options.angle.label.strokeColor="blue",r.A.Options.arc.strokeColor="blue",r.A.Options.circle.center.fillColor="red",r.A.Options.circle.center.strokeColor="blue",r.A.Options.circumcircle.strokeColor="blue",r.A.Options.circumcircle.center.fillColor="red",r.A.Options.circumcircle.center.strokeColor="blue",r.A.Options.circumcirclearc.strokeColor="blue",r.A.Options.circumcirclesector.strokeColor="blue",r.A.Options.circumcirclesector.fillColor="green",r.A.Options.circumcirclesector.highlightFillColor="green",r.A.Options.conic.strokeColor="blue",r.A.Options.curve.strokeColor="blue",r.A.Options.incircle.strokeColor="blue",r.A.Options.incircle.center.fillColor="red",r.A.Options.incircle.center.strokeColor="blue",r.A.Options.inequality.fillColor="red",r.A.Options.integral.fillColor="red",r.A.Options.integral.curveLeft.color="red",r.A.Options.integral.curveRight.color="red",r.A.Options.line.strokeColor="blue",r.A.Options.point.fillColor="red",r.A.Options.point.strokeColor="red",r.A.Options.polygon.fillColor="green",r.A.Options.polygon.highlightFillColor="green",r.A.Options.polygon.vertices.strokeColor="red",r.A.Options.polygon.vertices.fillColor="red",r.A.Options.regularpolygon.fillColor="green",r.A.Options.regularpolygon.highlightFillColor="green",r.A.Options.regularpolygon.vertices.strokeColor="red",r.A.Options.regularpolygon.vertices.fillColor="red",r.A.Options.riemannsum.fillColor="yellow",r.A.Options.sector.fillColor="green",r.A.Options.sector.highlightFillColor="green",r.A.Options.semicircle.center.fillColor="red",r.A.Options.semicircle.center.strokeColor="blue",r.A.Options.slopetriangle.fillColor="red",r.A.Options.slopetriangle.highlightFillColor="red",r.A.Options.turtle.arrow.strokeColor="blue"}
1,r.A.extend(r.A,{paletteWong:{black:"#000000",orange:"#E69F00",skyblue:"#56B4E9",bluishgreen:"#009E73",yellow:"#F0E442",darkblue:"#0072B2",vermillion:"#D55E00",reddishpurple:"#CC79A7",blue:"#0072B2",red:"#D55E00",green:"#009E73",purple:"#CC79A7",white:"#ffffff"}}),r.A.palette=r.A.paletteWong;let h=r.A},35283:(t,e,i)=>{i.d(e,{A:()=>n});var r=i(76422),s=i(16100),o=i(64657);r.A.GeonextParser={replacePow:function(t){var e,i,r,s,o,n,a,h,l,c,d,u;for(c=(t=t.replace(/(\s*)\^(\s*)/g,"^")).indexOf("^"),s=-1;c>=0&&c<t.length-1;){if(s===c)throw Error("JSXGraph: Error while parsing expression '"+t+"'");if(s=c,l=t.slice(0,c),d=t.slice(c+1),")"===l.charAt(l.length-1)){for(e=1,i=l.length-2;i>=0&&e>0;)")"===(r=l.charAt(i))?e++:"("===r&&(e-=1),i-=1;if(0===e){for(o="",a=l.substring(0,i+1),h=i;h>=0&&a.slice(h,h+1).match(/([\w.]+)/);)o=RegExp.$1+o,h-=1;o+=l.substring(i+1,l.length),o=o.replace(/([()+*%^\-/\][])/g,"\\$1")}else throw Error("JSXGraph: Missing '(' in expression")}else o="[\\w\\.]+";if(d.match(/^([\w.]*\()/)){for(e=1,i=RegExp.$1.length;i<d.length&&e>0;)")"===(r=d.charAt(i))?e-=1:"("===r&&(e+=1),i+=1;if(0===e)n=(n=d.substring(0,i)).replace(/([()+*%^\-/[\]])/g,"\\$1");else throw Error("JSXGraph: Missing ')' in expression")}else n="[\\w\\.]+";u=RegExp("("+o+")\\^("+n+")"),c=(t=t.replace(u,"pow($1,$2)")).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))?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||a<0)return"";d=l.slice(0,n),u=l.slice(n+1,a),p=l.slice(a+1),d=this.replaceIf(d),c+=e+"(("+d+")?("+(u=this.replaceIf(u))+"):("+(p=this.replaceIf(p))+"))",d=null,u=null,r=(t=i).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=(s=t.slice(a+2,r)).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=(s=t.slice(a+5,r)).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))>=0&&(s=(s=t.slice(a+1,r)).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(n=0,h=["Deg","Rad"];n<h.length;n++)for(a=t.indexOf(h[n]+"(");a>=0;)a>=0&&(r=t.indexOf(",",a+4))>=0&&(s=(s=t.slice(a+4,r)).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))>=0&&(s=(s=t.slice(a+1,r)).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))>=0&&(s=(s=t.slice(a+1,r)).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(s=0,r=t=(t=(t=t.replace(/</g,"<")).replace(/>/g,">")).replace(/&/g,"&"),r=this.replaceNameById(r,e),r=this.replaceIf(r),r=this.replacePow(r),r=this.replaceIdByObj(r);s<o.length;s++)i=RegExp("(\\W|^)("+o[s]+")","ig"),r=r.replace(i,"$1"+n[s]);return(r=(r=(r=(r=r.replace(/True/g,"true")).replace(/False/g,"fal
1se")).replace(/fasle/g,"false")).replace(/Pi/g,"PI")).replace(/"/g,"'")},findDependencies:function(t,e,i){var r,n,a,h;for(n in o.A.exists(i)||(i=t.board),r=i.elementsByName)r.hasOwnProperty(n)&&n!==t.name&&(r[n].elementClass===s.A.OBJECT_CLASS_TEXT?!r[n].evalVisProp("islabel")&&(a=RegExp("\\(([\\w\\[\\]'_ ]+,)*("+(h=(h=n.replace(/\[/g,"\\[")).replace(/\]/g,"\\]"))+")(,[\\w\\[\\]'_ ]+)*\\)","g"),e.search(a)>=0&&r[n].addChild(t)):(a=RegExp("\\(([\\w\\[\\]'_ ]+,)*("+(h=(h=n.replace(/\[/g,"\\[")).replace(/\]/g,"\\]"))+")(,[\\w\\[\\]'_ ]+)*\\)","g"),e.search(a)>=0&&r[n].addChild(t)))},gxt2jc:function(t,e){var i;return i=t=(t=(t=t.replace(/</g,"<")).replace(/>/g,">")).replace(/&/g,"&"),i=(i=(i=(i=this.replaceNameById(i,e,!0)).replace(/True/g,"true")).replace(/False/g,"false")).replace(/fasle/g,"false")}};let n=r.A.GeonextParser},43209:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{A:()=>__WEBPACK_DEFAULT_EXPORT__});var _jxg_js__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(76422),_base_constants_js__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(16100),_base_text_js__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(43464),_math_math_js__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(97272),_math_ia_js__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(63640),_math_geometry_js__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(1006),_math_statistics_js__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(86385),_utils_type_js__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__(64657),_utils_env_js__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__(94768);Object.create||(Object.create=function(t,e){if("object"!=typeof t&&"function"!=typeof t)throw TypeError("Object prototype may only be an Object: "+t);if(null===t)throw Error("This browser's implementation of Object.create is a shim and doesn't support 'null' as the first argument.");if(void 0!==e)throw Error("This browser's implementation of Object.create is a shim and doesn't support a second argument.");function i(){}return i.prototype=t,new i});var priv={modules:{math:_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A,"math/geometry":_math_geometry_js__WEBPACK_IMPORTED_MODULE_5__.A,"math/statistics":_math_statistics_js__WEBPACK_IMPORTED_MODULE_6__.A,"math/numerics":_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A.Numerics}};_jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.JessieCode=function(t,e){this.scope={id:0,hasChild:!0,args:[],locals:{},context:null,previous:null},this.scopes=[],this.scopes.push(this.scope),this.dpstack=[[]],this.pscope=0,this.propstack=[{}],this.propscope=0,this.lhs=[],this.isLHS=!1,this.warnLog="jcwarn",this.$log=[],this.builtIn=this.defineBuiltIn(),this.operands=this.getPossibleOperands(),this.board=null,this.forceValueCall=!1,this.lineToElement={},this.parCurLine=1,this.parCurColumn=0,this.line=1,this.col=1,_jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.CA&&(this.CA=new _jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.CA(this.node,this.createNode,this)),this.code="","string"==typeof t&&this.parse(t,e)},_jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.extend(_jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.JessieCode.prototype,{node:function(t,e,i){return{type:t,value:e,children:i}},createNode:function(t,e,i){var r,s=this.node(t,e,[]);for(r=2;r<arguments.length;r++)s.children.push(arguments[r]);return"node_const"===s.type&&_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isNumber(s.value)&&(s.isMath=!0),s.line=this.parCurLine,s.col=this.parCurColumn,s},pushScope:function(t){var e={args:t,locals:{},context:null,previous:this.scope};return this.scope.hasChild=!0,this.scope=e,e.id=this.scopes.push(e)-1,e},popScope:function(){var t=this.scope.previous;return this.scope=null!==t?t:this.scope,this.scope},getElementById:function(t){return this.board.objects[t]},log:function(){this.$log.push(arguments),"object"==typeof console&&console.log&&console.log.apply(console,arguments)},creator:function(){var t,e={};return(t=function(t){var i;return"function"==typeof e[this.board.id+t]?i=e[this.board.id+t]:((i=function(e){return function(i,r){var s;return void 0===(s=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(r)?r:{}).name&&void 0===s.id&&(s.name=0!==e.lhs[e.scope.id]?e.lhs[e.scope.id]:""),e.board.create(t,i,s)}}(this)).creator=!0,e[this.board.id+t]=i),i}).clearCache=function(){e={}},t}(),letvar:function(t,e){this.builtIn[t]&&this._warn('"'+t+'" is a predefined value.'),this.scope.locals[t]=e},isLocalVariable:function(t){for(var e=this.scope;null!==e;){if(_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(e.locals[t]))return e;e=e.previous}return null},isParameter:function(t){for(var e=this.scope;null!==e;){if(_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.indexOf(e.args,t)>-1)return e;e=e.previous}return null},isCreator:function(t){return!!_jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.elements[t]},isMathMethod:function(t){return"E"!==t&&!!Math[t]},isBuiltIn:function(t){return!!this.builtIn[t]}
1,getvar:function(t,e,i){var r;if(e=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.def(e,!1),null!==(r=this.isLocalVariable(t)))return r.locals[t];if("$board"===t||"EULER"===t||"PI"===t)return this.builtIn[t];if(i){if(this.isBuiltIn(t))return this.builtIn[t];if(this.isMathMethod(t))return Math[t];if(this.isCreator(t))return this.creator(t)}if(!e&&(r=this.board.select(t))!==t)return r},resolve:function(t){for(var e=this.scope;null!==e;){if(_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(e.locals[t]))return e.locals[t];e=e.previous}},getvarJS:function(t,e,i){var r,s,o="";if(e=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.def(e,!1),i=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.def(i,!1),null!==(r=this.isParameter(t)))return t;if(null!==(r=this.isLocalVariable(t))&&!i)return"$jc$.resolve('"+t+"')";if(this.isCreator(t))return"(function () { var a = Array.prototype.slice.call(arguments, 0), props = "+(i?"a.pop()":"{}")+"; return $jc$.board.create.apply($jc$.board, ['"+t+"'].concat([a, props])); })";if(i&&this._error("Syntax error (attribute values are allowed with element creators only)"),this.isBuiltIn(t))return(o=this.builtIn[t].src||this.builtIn[t],_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isNumber(o)||o.match(/board\.select/))?o:(t=o.split(".").pop(),_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(this.board.mathLib)&&null!==(s=RegExp("^Math."+t)).exec(o))?o.replace(s,"$jc$.board.mathLib."+t):_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(this.board.mathLibJXG)&&null!==(s=RegExp("^JXG.Math.")).exec(o)?o.replace(s,"$jc$.board.mathLibJXG."):o;return this.isMathMethod(t)?"$jc$.board.mathLib."+t:e?"":(_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isId(this.board,t)?(o="$jc$.board.objects['"+t+"']","slider"===this.board.objects[t].elType&&(o+=".Value()")):_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isName(this.board,t)?(o="$jc$.board.elementsByName['"+t+"']","slider"===this.board.elementsByName[t].elType&&(o+=".Value()")):_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isGroup(this.board,t)&&(o="$jc$.board.groups['"+t+"']"),o)},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,that=this,list=node.children[0],scope=this.pushScope(list);if(this.board.options.jc.compile){for(i=0,this.isLHS=!1;i<list.length;i++)scope.locals[list[i]]=list[i];this.replaceNames(node.children[1]),fun=function(jc){var fun,str="var f = function($jc$) { return "+jc.functionCodeJS(node)+"}; f;";try{for(i=0,fun=eval(str)(jc),scope.argtypes=[];i<list.length;i++)scope.argtypes.push(that.resolveType(list[i],node));return fun}catch(e){return jc._warn("error compiling function\n\n"+str+"\n\n"+e.toString()),function(){}}}(this),this.popScope()}else fun=function(t,e,i){return function(){var r,s;for(r=0,s=e.scope,e.scope=e.scopes[i];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(_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.deepCopy(node)))}}(this),fun.deps={},this.collectDependencies(node.children[1],node.children[0],fun.deps),fun},mergeAttributes:function(t){var e,i={};for(e=0;e<arguments.length;e++)i=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.deepCopy(i,arguments[e],!0);return i},setProp:function(t,e,i){var r,s,o={};t.elementClass===_base_constants_js__WEBPACK_IMPORTED_MODULE_1__.A.OBJECT_CLASS_POINT&&("X"===e||"Y"===e)?(e=e.toLowerCase(),t.isDraggable&&"number"==typeof i?(r="x"===e?i:t.X(),s="y"===e?i:t.Y(),t.setPosition(_base_constants_js__WEBPACK_IMPORTED_MODULE_1__.A.COORDS_BY_USER,[r,s])):t.isDraggable&&("function"==typeof i||"string"==typeof i)?(r="x"===e?i:t.coords.usrCoords[1],s="y"===e?i:t.coords.usrCoords[2],t.addConstraint([r,s])):t.
1isDraggable||(r="x"===e?i:t.XEval.origin,s="y"===e?i:t.YEval.origin,t.addConstraint([r,s])),this.board.update()):t.elementClass===_base_constants_js__WEBPACK_IMPORTED_MODULE_1__.A.OBJECT_CLASS_TEXT&&("X"===e||"Y"===e)?("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]=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.createFunction(i,this.board),t[e+"jc"]=i),t[e].origin=i,this.board.update()):t.type&&t.elementClass&&t.visProp?_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.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},_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"),_base_text_js__WEBPACK_IMPORTED_MODULE_2__.A&&(o=_base_text_js__WEBPACK_IMPORTED_MODULE_2__.A.prototype.setText,_base_text_js__WEBPACK_IMPORTED_MODULE_2__.A.prototype.setText=_base_text_js__WEBPACK_IMPORTED_MODULE_2__.A.prototype.setTextJessieCode);try{for(_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(i)||(i=!1),s=0;s<h.length;s++)i&&(h[s]=_jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.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{_base_text_js__WEBPACK_IMPORTED_MODULE_2__.A&&(_base_text_js__WEBPACK_IMPORTED_MODULE_2__.A.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,s){var o;return e=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.def(e,!0),i=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.def(i,""),r=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.def(r,!1),this.forceValueCall=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.def(s,!0),o=(e?" function ("+i+") { return ":"")+t+(e?"; }":"")+";",this.parse(o,r,!0)},replaceIDs:function(t){var e,i;if(t.replaced&&(i=this.board.objects[t.children[1][0].value],_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(i)&&""!==i.name&&(t.type="node_var",t.value=i.name,t.children.length=0,delete t.replaced)),_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isArray(t))for(e=0;e<t.length;e++)t[e]=this.replaceIDs(t[e]);if(t.children)for(e=t.children.length;e>0;e--)_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(t.children[e-1])&&(t.children[e-1]=this.replaceIDs(t.children[e-1]));return t},replaceNames:function(t,e){var i,r,s=!1;if(void 0!==e&&(s=e),r=t.value,"node_op"===t.type&&"op_lhs"===r&&1===t.children.length?this.isLHS=!0:"node_var"===t.type&&(this.isLHS?this.letvar(r,!0):!_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(this.getvar(r,!0))&&_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(this.board.elementsByName[r])&&(s&&"slider"!==this.board.elementsByName[r].elType&&(s=!1),t=this.createReplacementNode(t,s))),_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isArray(t))for(i=0;i<t.length;i++)t[i]=this.replaceNames(t[i],s);if(t.children)for(this.forceValueCall&&("op_execfun"===t.value&&"V"!==t.children[0].value&&"$"!==t.children[0].value&&(_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(Math[t.children[0].value])||_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A[t.children[0].value]))&&"node_var"===t.children[1][0].type||"op_return"===t.value&&1===t.children.length&&"node_var"===t.children[0].type)&&(s=!0),i=t.children.length;i>0;i--)_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(t.children[i-1])&&(t.children[i-1]=this.replaceNames(t.children[i-1],s));return"node_op"===t.type&&"op_lhs"===t.value&&1===t.children.length&&(this.isLHS=!1),t},createReplacementNode:function(t,e){var i=t.value,r=this.board.elementsByName[i];return(t=this.createNode("node_op","op_execfun",this.createNode("node_var",!0===e?"$value":"$"),[this.createNode("node_str",r.id)])).replaced=!0,t}
1,collectDependencies:function(t,e,i){var r,s,o,n;if(_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isArray(t)){for(r=0,n=t.length;r<n;r++)this.collectDependencies(t[r],e,i);return}if(s=t.value,"node_var"===t.type&&0>e.indexOf(s)&&(o=this.getvar(s))&&o.visProp&&o.elType&&o.elementClass&&o.id&&(i[o.id]=o),"node_op"===t.type&&"op_execfun"===t.value&&t.children.length>1&&("$"===t.children[0].value||"$value"===t.children[0].value)&&t.children[1].length>0&&(i[o=t.children[1][0].value]=this.board.objects[o]),t.children)for(r=t.children.length;r>0;r--)_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(t.children[r-1])&&this.collectDependencies(t.children[r-1],e,i)},resolveProperty:function(t,e,i){return(i=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.def(i,!1),t&&t.methodMap&&(_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(t.subs)&&_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(t.subs[e])?t=t.subs:_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(t.methodMap[e])?e=t.methodMap[e]:(t=t.visProp,e=e.toLowerCase())),_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isFunction(t)&&this._error("Accessing function properties is not allowed."),_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(t)||this._error(t+" is not an object"),_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(t[e])||this._error("unknown property "+e),i&&"function"==typeof t[e])?function(){return t[e].apply(t,arguments)}:t[e]},resolveType:function(t,e){var i,r,s="any";if(_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isArray(e)){for(i=0;i<e.length;i++)if("any"!==(r=this.resolveType(t,e[i])))return r}if("node_op"===e.type&&"op_execfun"===e.value&&"node_var"===e.children[0].type&&e.children[0].value===t)return"function";if("node_op"===e.type){for(i=0;i<e.children.length;i++)if("node_var"===e.children[0].type&&e.children[0].value===t&&("op_add"===e.value||"op_sub"===e.value||"op_mul"===e.value||"op_div"===e.value||"op_mod"===e.value||"op_exp"===e.value||"op_neg"===e.value))return"any";for(i=0;i<e.children.length;i++)if("any"!==(r=this.resolveType(t,e.children[i])))return r}return"any"},getLHS:function(t){var e;if("node_var"===t.type)e={o:this.scope.locals,what:t.value};else if("node_op"===t.type&&"op_property"===t.value)e={o:this.execute(t.children[0]),what:t.children[1]};else if("node_op"===t.type&&"op_extvalue"===t.value)e={o:this.execute(t.children[0]),what:this.execute(t.children[1])};else throw Error("Syntax error: Invalid left-hand side of assignment.");return e},getLHSCompiler:function(t,e){var i;if("node_var"===t.type)i=t.value;else if("node_op"===t.type&&"op_property"===t.value)i=[this.compile(t.children[0],e),"'"+t.children[1]+"'"];else if("node_op"===t.type&&"op_extvalue"===t.value)i=[this.compile(t.children[0],e),"node_const"===t.children[1].type?t.children[1].value:this.compile(t.children[1],e)];else throw Error("Syntax error: Invalid left-hand side of assignment.");return i},execute:function(t){var e,i,r,s,o,n,a,h,l,c,d,u=[];if(e=0,!t)return e;switch(this.line=t.line,this.col=t.col,t.type){case"node_op":switch(t.value){case"op_none":t.children[0]&&this.execute(t.children[0]),t.children[1]&&(e=this.execute(t.children[1]));break;case"op_assign":i=this.getLHS(t.children[0]),this.lhs[this.scope.id]=i.what,i.o.type&&i.o.elementClass&&i.o.methodMap&&"label"===i.what&&this._error("Left-hand side of assignment is read-only."),e=this.execute(t.children[1]),i.o!==this.scope.locals||_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isArray(i.o)&&"number"==typeof i.what?this.setProp(i.o,i.what,e):this.letvar(i.what,e),this.lhs[this.scope.id]=0;break;case"op_if":this.execute(t.children[0])&&(e=this.execute(t.children[1]));break;case"op_conditional":case"op_if_else":e=this.execute(t.children[0])?this.execute(t.children[1]):this.execute(t.children[2]);break;case"op_while":for(;this.execute(t.children[0]);)this.execute(t.children[1]);break;case"op_do":do this.execute(t.children[0]);while(this.execute(t.children[1]));break;case"op_for":for(this.execute(t.children[0]);this.execute(t.children[1]);this.execute(t.children[2]))this.execute(t.children[3]);break;case"op_proplst":t.children[0]&&this.execute(t.children[0]),t.children[1]&&this.execute(t.children[1]);break;case"op_emptyobject":e={};break;case"op_proplst_val":this.propstack.push({}),this.propscope++,this.execute(t.children[0]),e=this.propstack[this.propscope],this.propstack.pop(),this.propscope--;break;case"op_prop":this.propstack[this.propscope][t.children[0]]=this.execute(t.children[1]);break;case"op_array":for(r=0,e=[],o=t.children[0].length;r<o;r++)e.push(this.execute(t.children[0][r]));break;case"op_extvalue":e=this.execute(t.children[0]),e="number"==typeof(r=this.execute(t.children[1]))&&Math.abs(Math.round(r)-r)<_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A.eps?e[r]:n;break;case"op_return":if(0!==this.scope)return this.execute(t.children[0]);this._error("Unexpected return.");break;case"op_map":t.children[1].isMath||"node_var"===t.children[1].type||this._error("execute: In a map only function calls and mathematical expressions are allowed."),(l=this.defineFunction(t)).isMap=!0,e=l;break;case"op_function":(l=this.defineFunction(t)).isMap=!1,e=l;break;case"op_execfun":if(this.dpstack.push([]),this.pscope++,a=t.children[1],_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(t.children[2]))if(t.children[3])for(r=0,h=t.children[2],c={};r<h.length;r++)c=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.deepCopy(c,this.execute(h[r]),!0);else c=this.execute(t.children[2]);for(t.children[0]._isFunctionName=!0,l=this.execute(t.children[0]),delete t.children[0]._isFunctionName,d=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(l)&&_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(l.sc)?l.sc:this,!l.creator&&_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(t.children[2])&&this._error("Unexpected value. Only element creators are allowed to have a value after the function call."),r=0;r<a.length;r++)_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(l.scope)&&_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(l.scope.argtypes)&&"function"===l.scope.argtypes[r]?(a[r]._isFunctionName=!0,u[r]=this.execute(a[r]),delete a[r]._isFunctionName):u[r]=this.execute(a[r]),this.dpstack[this.pscope].push({line:t.children[1][r].line,col:t.children[1][r].ec
1ol});if("function"!=typeof l||l.creator)if("function"==typeof l&&l.creator){s=this.line;try{for((e=l(u,c)).jcLineStart=s,e.jcLineEnd=t.eline,r=s;r<=t.line;r++)this.lineToElement[r]=e;e.debugParents=this.dpstack[this.pscope]}catch(t){this._error(t.toString())}}else this._error("Function '"+l+"' is undefined.");else e=l.apply(d,u);this.dpstack.pop(),this.pscope--;break;case"op_property":s=this.execute(t.children[0]),i=t.children[1],e=this.resolveProperty(s,i,!1),_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(e)&&0>["number","string","boolean"].indexOf(typeof e)&&(e.sc=s);break;case"op_use":this._warn("Use of the 'use' operator is deprecated."),this.use(t.children[0].toString());break;case"op_delete":this._warn("Use of the 'delete' operator is deprecated. Please use the remove() function."),i=this.getvar(t.children[0]),e=this.del(i);break;case"op_eq":e=this.execute(t.children[0])==this.execute(t.children[1]);break;case"op_neq":e=this.execute(t.children[0])!=this.execute(t.children[1]);break;case"op_approx":e=Math.abs(this.execute(t.children[0])-this.execute(t.children[1]))<_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A.eps;break;case"op_gt":e=this.execute(t.children[0])>this.execute(t.children[1]);break;case"op_lt":e=this.execute(t.children[0])<this.execute(t.children[1]);break;case"op_geq":e=this.execute(t.children[0])>=this.execute(t.children[1]);break;case"op_leq":e=this.execute(t.children[0])<=this.execute(t.children[1]);break;case"op_or":e=this.execute(t.children[0])||this.execute(t.children[1]);break;case"op_and":e=this.execute(t.children[0])&&this.execute(t.children[1]);break;case"op_not":e=!this.execute(t.children[0]);break;case"op_add":e=this.add(this.execute(t.children[0]),this.execute(t.children[1]));break;case"op_sub":e=this.sub(this.execute(t.children[0]),this.execute(t.children[1]));break;case"op_div":e=this.div(this.execute(t.children[0]),this.execute(t.children[1]));break;case"op_mod":e=this.mod(this.execute(t.children[0]),this.execute(t.children[1]),!0);break;case"op_mul":e=this.mul(this.execute(t.children[0]),this.execute(t.children[1]));break;case"op_exp":e=this.pow(this.execute(t.children[0]),this.execute(t.children[1]));break;case"op_neg":e=this.neg(this.execute(t.children[0]))}break;case"node_var":e=this.getvar(t.value,!1,t._isFunctionName);break;case"node_const":e=null===t.value?null:Number(t.value);break;case"node_const_bool":e=t.value;break;case"node_str":e=t.value.replace(/\\(.)/g,"$1")}return e},compile:function(t,e){var i,r,s,o,n="";if(_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(e)||(e=!1),!t)return n;switch(t.type){case"node_op":switch(t.value){case"op_none":t.children[0]&&(n=this.compile(t.children[0],e)),t.children[1]&&(n+=this.compile(t.children[1],e));break;case"op_assign":e?(i=this.getLHSCompiler(t.children[0],e),_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isArray(i)?n="$jc$.setProp("+i[0]+", "+i[1]+", "+this.compile(t.children[1],e)+");\n":(this.isLocalVariable(i)!==this.scope&&(this.scope.locals[i]=!0),n="$jc$.scopes["+this.scope.id+"].locals['"+i+"'] = "+this.compile(t.children[1],e)+";\n")):n=(i=this.compile(t.children[0]))+" = "+this.compile(t.children[1],e)+";\n";break;case"op_if":n=" if ("+this.compile(t.children[0],e)+") "+this.compile(t.children[1],e);break;case"op_if_else":n=" if ("+this.compile(t.children[0],e)+")"+this.compile(t.children[1],e)+" else "+this.compile(t.children[2],e);break;case"op_conditional":n="(("+this.compile(t.children[0],e)+")?("+this.compile(t.children[1],e)+("):("+this.compile(t.children[2],e))+"))";break;case"op_while":n=" while ("+this.compile(t.children[0],e)+") {\n"+this.compile(t.children[1],e)+"}\n";break;case"op_do":n=" do {\n"+this.compile(t.children[0],e)+"} while ("+this.compile(t.children[1],e)+");\n";break;case"op_for":n=" for ("+this.compile(t.children[0],e)+this.compile(t.children[1],e)+"; "+this.compile(t.children[2],e).slice(0,-2)+") {\n"+this.compile(t.children[3],e)+"\n}\n";break;case"op_proplst":t.children[0]&&(n=this.compile(t.children[0],e)+", "),n+=this.compile(t.children[1],e);break;case"op_prop":n=t.children[0]+": "+this.compile(t.children[1],e);break;case"op_emptyobject":n=e?"{}":"<< >>";break;case"op_proplst_val":n=this.compile(t.children[0],e);break;case"op_array":for(r=0,s=[];r<t.children[0].length;r++)s.push(this.compile(t.children[0][r],e));n="["+s.join(", ")+"]";break;case"op_extvalue":n=this.compile(t.children[0],e)+"["+this.compile(t.children[1],e)+"]";break;case"op_return":n=" return "+this.compile(t.children[0],e)+";\n";break;case"op_map":t.children[1].isMath||"node_var"===t.children[1].type||this._error("compile: In a map only function calls and mathematical expressions are allowed."),s=t.children[0],n=e?" $jc$.makeMap(function ("+s.join(", ")+") { return "+this.compile(t.children[1],e)+"; })":"map ("+s.join(", ")+") -> "+this.compile(t.children[1],e);break;case"op_function":s=t.children[0],o=this.pushScope(s),n=e?this.functionCodeJS(t):" function ("+s.join(", ")+") "+this.compile(t.children[1],e),this.popScope();break;case"op_execfunmath":console.log("op_execfunmath: TODO"),n="-1";break;case"op_execfun":if(t.children[2]){for(r=0,s=[];r<t.children[2].length;r++)s.push(this.compile(t.children[2][r],e));i=e?"$jc$.mergeAttributes("+s.join(", ")+")":s.join(", ")}for(r=0,t.children[0].withProps=!!t.children[2],s=[];r<t.children[1].length;r++)s.push(this.compile(t.children[1][r],e));n=this.compile(t.children[0],e)+"("+s.join(", ")+(t.children[2]&&e?", "+i:"")+")"+(t.children[2]&&!e?" "+i:""),e&&(n+="\n"),e&&"$"===t.children[0].value&&(n="$jc$.board.objects["+this.compile(t.children[1][0],e)+"]");break;case"op_property":n=e&&"X"!==t.children[1]&&"Y"!==t.children[1]?"$jc$.resolveProperty("+this.compile(t.children[0],e)+", '"+t.children[1]+"', true)":this.compile(t.children[0],e)+"."+t.children[1];break;case"op_use":this._warn("Use of the 'use' operator is deprecated."),n=(e?"$jc$.use('":"use('")+t.children[0].toString()+"');";break;case"op_delete":this._warn("Use of the 'delete' operator is deprecated. Please use the remove() function."),n=(e?"$jc$.del(":"remove(")+this.compile(t.children[0],e)+")";break;case"op_eq":n="("+this.compile(t.children[0],e)+" === "+this.compile(t.children[1],e)+")";break;case"op_neq":n="("+this.compile(t.children[0],e)+" !== "+this.compile(t.children[1],e)+")";break;case"op_approx":n="("+this.compile(t.children[0],e)+" ~= "+this.compile(t.children[1],e)+")";break;case"op_gt":n=e?"$jc$.gt("+this.compile(t.children[0],e)+", "+this.compile(t.children[1],e)+")":"("+this.compile(t.children[0],e)+" > "+this.compile(t.children[1],e)+")";break;case"op_lt":n=e?"$jc$.lt("+this.compile(t.children[0],e)+", "+this.compile(t.children[1],e)+")":"("+this.compile(t.children[0],e)+" < "+this.compile(t.children[1],e)+")";break;case"op_geq":n=e?"$jc$.geq("+this.compile(t.children[0],e)+", "+this.compile(t.children[1],e)+")":"("+this.compile(t.children[0],e)+" >= "+this.compile(t.children[1],e)+")";break;case"op_leq":n=e?"$jc$.leq("+this.compile(t.children[0],e)+", "+this.compile(t.children[1],e)+")":"("+this.compile(t.children[0],e)+" <= "+this.compile(t.children[1],e)+")";break;case"op_or":n="("+this.compile(t.children[0],e)+" || "+this.compile(t.children[1],e)+")";break;case"op_and":n="("+this.compile(t.children[0],e)+" && "+this.compile(t.children[1],e)+")";break;case"op_not":n="!("+this.compile(t.children[0],e)+")";break;case"op_add":n=e?"$jc$.add("+this.compile(t.children[0],e)+", "+this.compile(t.children[1],e)+")":"("+this.compile(t.children[0],e)+" + "+this.compile(t.children[1],e)+")";break;case"op_sub":n=e?"$jc$.sub("+this.compile(t.children[0],e)+", "+this.compile(t.children[1],e)+")":"("+this.compile(t.children[0],e)+" - "+this.compile(t.children[1],e)+")";break;case"op_div":n=e?"$jc$.div("+this.compile(t.children[0],e)+", "+this.compile(t.children[1],e)+")":"("+this.compile(t.children[0],e)+" / "+this.compile(t.children[1],e)+")";break;case"op_mod":n=e?"$jc$.mod("+this.compile(t.children[0],e)+", "+this.compile(t.children[1],e)+", true)":"("+this.compile(t.children[0],e)+" % "+this.compile(t.children[1],e)+")";break;case"op_mul":n=e?"$jc$.mul("+this.compile(t.children[0],e)+", "+this.compile(t.children[1],e)+")":"("+this.compile(t.children[0],e)+" * "+this.compile(t.children[1],e)+")";break;case"op_exp":n=e?"$jc$.pow("+this.compile(t.children[0],e)+", "+this.compile(t.children[1],e)+")":"("+this.compile(t.children[0],e)+"^"+this.compile(t.children[1],e)+")";break;case"op_neg":n=e?"$jc$.neg("+this.compile(t.children[0],e)+")":"(-"+this.compile(t.children[0],e)+")"}break;case"node_var":n=e?this.getvarJS(t.value,!1,t.withProps):t.value;break;case"node_const":case"node_const_bool":n=t.value;break;case"node_str":n="'"+t.value+"'"}return t.needsBrackets&&(n="{\n"+n+" }\n"),t.needsAngleBrackets&&(n=e?"{\n"+n+" }\n":"<< "+n+" >>\n"),n},getName:function(t,e){var i="";return _utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(t)&&_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(t.getName)?(i=t.getName(),(!_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(i)||""===i)&&e&&(i=t.id)):e&&(i=t.id),i},X:function(t){return t.X()},Y:function(t){return t.Y()},V:function(t){return t.Value()},L:function(t){return t.L()},area:function(t){return _utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(t)&&_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(t.Area)||this._error("Error: Can't
1calculate area."),t.Area()},perimeter:function(t){return _utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(t)&&_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(t.Perimeter)||this._error("Error: Can't calculate perimeter."),t.Perimeter()},dist:function(t,e){return _utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(t)&&_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(t.Dist)||this._error("Error: Can't calculate distance."),t.Dist(e)},radius:function(t){return _utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(t)&&_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(t.Radius)||this._error("Error: Can't calculate radius."),t.Radius()},slope:function(t){return _utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(t)&&_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(t.Slope)||this._error("Error: Can't calculate slope."),t.Slope()},add:function(t,e){var i,r,s;if(t=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.evalSlider(t),e=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.evalSlider(e),_math_ia_js__WEBPACK_IMPORTED_MODULE_4__.A.isInterval(t)||_math_ia_js__WEBPACK_IMPORTED_MODULE_4__.A.isInterval(e))s=_math_ia_js__WEBPACK_IMPORTED_MODULE_4__.A.add(t,e);else if(_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isArray(t)&&_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isArray(e))for(i=0,r=Math.min(t.length,e.length),s=[];i<r;i++)s[i]=t[i]+e[i];else _utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isNumber(t)&&_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isNumber(e)?s=t+e:_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isString(t)||_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isString(e)?s=t.toString()+e.toString():this._error("Operation + not defined on operands "+typeof t+" and "+typeof e);return s},sub:function(t,e){var i,r,s;if(t=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.evalSlider(t),e=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.evalSlider(e),_math_ia_js__WEBPACK_IMPORTED_MODULE_4__.A.isInterval(t)||_math_ia_js__WEBPACK_IMPORTED_MODULE_4__.A.isInterval(e))s=_math_ia_js__WEBPACK_IMPORTED_MODULE_4__.A.sub(t,e);else if(_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isArray(t)&&_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isArray(e))for(i=0,r=Math.min(t.length,e.length),s=[];i<r;i++)s[i]=t[i]-e[i];else _utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isNumber(t)&&_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isNumber(e)?s=t-e:this._error("Operation - not defined on operands "+typeof t+" and "+typeof e);return s},neg:function(t){var e,i,r;if(t=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.evalSlider(t),_math_ia_js__WEBPACK_IMPORTED_MODULE_4__.A.isInterval(t))r=_math_ia_js__WEBPACK_IMPORTED_MODULE_4__.A.negative(t);else if(_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isArray(t))for(e=0,i=t.length,r=[];e<i;e++)r[e]=-t[e];else _utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isNumber(t)?r=-t:this._error("Unary operation - not defined on operand "+typeof t);return r},mul:function(t,e){var i,r,s;if(t=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.evalSlider(t),e=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.evalSlider(e),_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isArray(t)&&_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isNumber(e)&&(i=t,e=t=e),_math_ia_js__WEBPACK_IMPORTED_MODULE_4__.A.isInterval(t)||_math_ia_js__WEBPACK_IMPORTED_MODULE_4__.A.isInterval(e))s=_math_ia_js__WEBPACK_IMPORTED_MODULE_4__.A.mul(t,e);else if(_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isArray(t)&&_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isArray(e))r=Math.min(t.length,e.length),s=_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A.innerProduct(t,e,r);else if(_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isNumber(t)&&_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isArray(e))for(i=0,r=e.length,s=[];i<r;i++)s[i]=t*e[i];else _utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isNumber(t)&&_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isNumber(e)?s=t*e:this._error("Operation * not defined on operands "+typeof t+" and "+typeof e);return s},div:function(t,e){var i,r,s;if(t=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.evalSlider(t),e=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.evalSlider(e),_math_ia_js__WEBPACK_IMPORTED_MODULE_4__.A.isInterval(t)||_math_ia_js__WEBPACK_IMPORTED_MODULE_4__.A.isInterval(e))s=_math_ia_js__WEBPACK_IMPORTED_MODULE_4__.A.div(t,e);else if(_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isArray(t)&&_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isNumber(e))for(i=0,r=t.length,s=[];i<r;i++)s[i]=t[i]/e;else _utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isNumber(t)&&_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isNumber(e)?s=t/e:this._error("Operation * not defined on operands "+typeof t+" and "+typeof e);return s},mod:function(t,e){var i,r,s;if(t=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.evalSlider(t),e=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.evalSlider(e),_math_ia_js__WEBPACK_IMPORTED_MODULE_4__.A.isInterval(t)||_math_ia_js__WEBPACK_IMPORTED_MODULE_4__.A.isInterval(e))return _math_ia_js__WEBPACK_IMPORTED_MODULE_4__.A.fmod(t,e);if(_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isArray(t)&&_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isNumber(e))for(i=0,r=t.length,s=[];i<r;i++)s[i]=_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A.mod(t[i],e,!0);else _utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isNumber(t)&&_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isNumber(e)?s=_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A.mod(t,e,!0):this._error("Operation * not defined on operands "+typeof t+" and "+typeof e);return s},pow:function(t,e){return(t=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.evalSlider(t),e=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.evalSlider(e),_math_ia_js__WEBPACK_IMPORTED_MODULE_4__.A.isInterval(t)||_math_ia_js__WEBPACK_IMPORTED_MODULE_4__.A.isInterval(e))?_math_ia_js__WEBPACK_IMPORTED_MODULE_4__.A.pow(t,e):_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A.pow(t,e)},lt:function(t,e){return _math_ia_js__WEBPACK_IMPORTED_MODULE_4__.A.isInterval(t)||_math_ia_js__WEBPACK_IMPORTED_MODULE_4__.A.isInterval(e)?_math_ia_js__WEBPACK_IMPORTED_MODULE_4__.A.lt(t,e):t<e},leq:function(t,e){return _math_ia_js__WEBPACK_IMPORTED_MODULE_4__.A.isInterval(t)||_math_ia_js__WEBPACK_IMPORTED_MODULE_4__.A.isInterval(e)?_math_ia_js__WEBPACK_IMPORTED_MODULE_4__.A.leq(t,e):t<=e},gt:function(t,e){return _math_ia_js__WEBPACK_IMPORTED_MODULE_4__.A.isInterval(t)||_math_ia_js__WEBPACK_IMPORTED_MODULE_4__.A.isInterval(e)?_math_ia_js__WEBPACK_IMPORTED_MODULE_4__.A.gt(t,e):t>e},geq:function(t,e){return _math_ia_js__WEBPACK_IMPORTED_MODULE_4__.A.isInterval(t)||_math_ia_js__WEBPACK_IMPORTED_MODULE_4__.A.isInterval(e)?_math_ia_js__WEBPACK_IMPORTED_MODULE_4__.A.geq(t,e):t>=e}
1,randint:function(t,e,i){return _utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(i)||(i=1),Math.round(Math.random()*(e-t)/i)*i+t},DDD:function(t){console.log("Dummy derivative function. This should never appear!")},ifthen:function(t,e,i){return t?e:i},del:function(t){"object"==typeof t&&_jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.exists(t.type)&&_jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.exists(t.elementClass)&&this.board.removeObject(t)},eval:function(t){return _jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.evaluate(t)},use:function(t){var e,i,r=!1;if("string"==typeof t){for(e in _jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.boards)if(_jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.boards.hasOwnProperty(e)&&_jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.boards[e].container===t){i=_jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.boards[e],r=!0;break}}else i=t,r=!0;r?(this.board=i,this.builtIn.$board=i,this.builtIn.$board.src="$jc$.board"):this._error("Board '"+t+"' not found!")},findSymbol:function(t,e){var i,r;for(r=-1===(e=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.def(e,-1))?this.scope:this.scopes[e];null!==r;){for(i in r.locals)if(r.locals.hasOwnProperty(i)&&r.locals[i]===t)return[i,r];r=r.previous}return[]},importModule:function(t){return priv.modules[t.toLowerCase()]},defineBuiltIn:function(){var t=this,e={PI:Math.PI,EULER:Math.E,D:t.DDD,X:t.X,Y:t.Y,V:t.V,Value:t.V,L:t.L,Length:t.L,acosh:_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A.acosh,acot:_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A.acot,asinh:_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A.asinh,binomial:_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A.binomial,cbrt:_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A.cbrt,cosh:_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A.cosh,cot:_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A.cot,deg:_math_geometry_js__WEBPACK_IMPORTED_MODULE_5__.A.trueAngle,A:t.area,area:t.area,Area:t.area,perimeter:t.perimeter,Perimeter:t.perimeter,dist:t.dist,Dist:t.dist,R:t.radius,radius:t.radius,Radius:t.radius,erf:_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A.erf,erfc:_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A.erfc,erfi:_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A.erfi,factorial:_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A.factorial,gcd:_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A.gcd,lb:_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A.log2,lcm:_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A.lcm,ld:_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A.log2,lg:_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A.log10,ln:Math.log,log:_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A.log,log10:_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A.log10,log2:_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A.log2,ndtr:_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A.ndtr,ndtri:_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A.ndtri,nthroot:_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A.nthroot,pow:_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A.pow,rad:_math_geometry_js__WEBPACK_IMPORTED_MODULE_5__.A.rad,ratpow:_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A.ratpow,trunc:_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.trunc,sinh:_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A.sinh,slope:t.slope,Slope:t.slope,randint:t.randint,IfThen:t.ifthen,import:t.importModule,eval:t.eval,use:t.use,remove:t.del,$:t.getElementById,$value:function(e){return t.getElementById(e).Value()},getName:t.getName,name:t.getName,$board:t.board,$log:t.log};return e.rad.sc=_math_geometry_js__WEBPACK_IMPORTED_MODULE_5__.A,e.deg.sc=_math_geometry_js__WEBPACK_IMPORTED_MODULE_5__.A,e.factorial.sc=_math_math_js__WEBPACK_IMPORTED_MODULE_3__.A,e.X.src="$jc$.X",e.Y.src="$jc$.Y",e.V.src="$jc$.V",e.Value.src="$jc$.V",e.L.src="$jc$.L",e.Length.src="$jc$.L",e.acosh.src="JXG.Math.acosh",e.acot.src="JXG.Math.acot",e.asin
1h.src="JXG.Math.asinh",e.binomial.src="JXG.Math.binomial",e.cbrt.src="JXG.Math.cbrt",e.cot.src="JXG.Math.cot",e.cosh.src="JXG.Math.cosh",e.deg.src="JXG.Math.Geometry.trueAngle",e.erf.src="JXG.Math.erf",e.erfc.src="JXG.Math.erfc",e.erfi.src="JXG.Math.erfi",e.A.src="$jc$.area",e.area.src="$jc$.area",e.Area.src="$jc$.area",e.perimeter.src="$jc$.perimeter",e.Perimeter.src="$jc$.perimeter",e.dist.src="$jc$.dist",e.Dist.src="$jc$.dist",e.R.src="$jc$.radius",e.radius.src="$jc$.radius",e.Radius.src="$jc$.radius",e.factorial.src="JXG.Math.factorial",e.gcd.src="JXG.Math.gcd",e.lb.src="JXG.Math.log2",e.lcm.src="JXG.Math.lcm",e.ld.src="JXG.Math.log2",e.lg.src="JXG.Math.log10",e.ln.src="Math.log",e.log.src="JXG.Math.log",e.log10.src="JXG.Math.log10",e.log2.src="JXG.Math.log2",e.ndtr.src="JXG.Math.ndtr",e.ndtri.src="JXG.Math.ndtri",e.nthroot.src="JXG.Math.nthroot",e.pow.src="JXG.Math.pow",e.rad.src="JXG.Math.Geometry.rad",e.ratpow.src="JXG.Math.ratpow",e.trunc.src="JXG.trunc",e.sinh.src="JXG.Math.sinh",e.slope.src="$jc$.slope",e.Slope.src="$jc$.slope",e.randint.src="$jc$.randint",e.import.src="$jc$.importModule",e.eval.src="$jc$.eval",e.use.src="$jc$.use",e.remove.src="$jc$.del",e.IfThen.src="$jc$.ifthen",e.$.src="(function (n) { return $jc$.board.select(n); })",e.$value.src="(function (n) { return $jc$.board.select(n).Value(); })",e.getName.src="$jc$.getName",e.name.src="$jc$.getName",e.$board&&(e.$board.src="$jc$.board"),e.$log.src="$jc$.log",e=_jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.merge(e,t._addedBuiltIn)},_addedBuiltIn:{},addBuiltIn:function(t,e){if(_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(this.builtIn)){if(_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(this.builtIn[t]))return;this.builtIn[t]=e,this.builtIn[t].src="$jc$."+t}_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(this._addedBuiltIn[t])||(this._addedBuiltIn[t]=e,this._addedBuiltIn[t].src="$jc$."+t,_jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.JessieCode.prototype[t]=e)},getPossibleOperands:function(){var t,e,i,r,s,o,n,a,h,l,c,d,u,p,f=["E"],A=this.builtIn||this.defineBuiltIn(),m=Math;for(u=function(t,e){return t.toLowerCase().localeCompare(e.toLowerCase())},p=function(t,e){var i=null;if("jc"===e)i=A[t];else{if("Math"!==e)return;i=m[t]}if(!(f.indexOf(t)>=0)){if(_jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.isFunction(i))return{name:t,type:"function",numParams:i.length,origin:e};if(_jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.isNumber(i))return{name:t,type:"constant",value:i,origin:e};t.startsWith("$")||void 0!==i&&console.error("undefined type",i)}},t=Object.getOwnPropertyNames(A).sort(u),e=Object.getOwnPropertyNames(m).sort(u),i=[],r=0,s=0;r<t.length||s<e.length;)t[r]===e[s]?(o=p(e[s],"Math"),_jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.exists(o)&&i.push(o),r++,s++):!_jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.exists(e[s])||0>t[r].toLowerCase().localeCompare(e[s].toLowerCase())?(o=p(t[r],"jc"),_jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.exists(o)&&i.push(o),r++):(o=p(e[s],"Math"),_jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.exists(o)&&i.push(o),s++);for(r=0,h=[],l=[],c=[],d={},n=i.length;r<n;r++){switch((a=i[r]).type){case"function":h.push(a.name),"jc"===a.origin&&l.push(a.name);break;case"constant":c.push(a.name)}d[a.name]=a}return{all:d,list:i,functions:h,functions_jessiecode:l,constants:c}},_debug:function(t){"object"==typeof console?console.log(t):_utils_env_js__WEBPACK_IMPORTED_MODULE_8__.A.isBrowser&&document&&null!==document.getElementById("debug")&&(document.getElementById("debug").innerHTML+=t+"<br />")},_error:function(t){var e=Error("Error("+this.line+"): "+t);throw e.line=this.line,e},_warn:function(t){"object"==typeof console?console.log("Warning("+this.line+"): "+t):_utils_env_js__WEBPACK_IMPORTED_MODULE_8__.A.isBrowser&&document&&null!==document.getElementById(this.warnLog)&&(document.getElementById(this.warnLog).innerHTML+="Warning("+this.line+"): "+t+"<br />")},_log:function(t){"object"!=typeof window&&"object"==typeof self&&self.postMessage?self.postMessage({type:"log",msg:"Log: "+t.toString()}):console.log("Log: ",arguments)}});var parser=function(){var t=function(t,e,i,r){for(i=i||{},r=t.length;r--;i[t[r]]=e);return i},e=[2,14],i=[1,13],r=[1,37],s=[1,14],o=[1,15],n=[1,21],a=[1,16],h=[1,17],l=[1,33],c=[1,18],d=[1,19],u=[1,12],p=[1,59],f=[1,60],A=[1,58],m=[1,46],b=[1,48],g=[1,49],v=[1,50],y=[1,51],C=[1,52],_=[1,53],P=[1,54],x=[1,45],E=[1,38],S=[1,39],N=[5,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],T=[5,7,8,12,14,15,16,17,19,20,21,23,26,27,50,51,58,65,74,75,76,77,78,79,80,82,91,93],w=[8,10,16,32,34,35,37,39,41,42,43,45,46,47,48,50,51,53,54,55,57,64,65,66,83,86],O=[2,48],M=[1,72],k=[10,16,32,34,35,37,39,41,42,43,45,46,47,48,50,51,53,54,55,57,66,83,86],D=[1,78],R=[8,10,16,32,34,35,37,41,42,43,45,46,47,48,50,51,53,54,55,57,64,65,66,83,86],L=[1,82],B=[8,10,16,32,34,35,37,39,45,46,47,48,50,51,53,54,55,57,64,65,66,83,86],I=[1,83],V=[1,84],Y=[1,85],j=[8,10,16,32,34,35,37,39,41,42,43,50,51,53,54,55,57,64,65,66,83,86],X=[1,89],F=[1,90],J=[1,91],U=[1,92],z=[
11,97],G=[8,10,16,32,34,35,37,39,41,42,43,45,46,47,48,53,54,55,57,64,65,66,83,86],H=[1,103],$=[1,104],W=[8,10,16,32,34,35,37,39,41,42,43,45,46,47,48,50,51,57,64,65,66,83,86],q=[1,105],Z=[1,106],Q=[1,107],K=[1,126],tt=[1,139],te=[83,86],ti=[1,150],tr=[10,66,86],ts=[8,10,16,20,32,34,35,37,39,41,42,43,45,46,47,48,50,51,53,54,55,57,64,65,66,82,83,86],to=[1,167],tn=[10,86],ta={trace:function(){},yy:{},symbols_:{error:2,Program:3,StatementList:4,EOF:5,IfStatement:6,IF:7,"(":8,Expression:9,")":10,Statement:11,ELSE:12,LoopStatement:13,WHILE:14,FOR:15,";":16,DO:17,UnaryStatement:18,USE:19,IDENTIFIER:20,DELETE:21,ReturnStatement:22,RETURN:23,EmptyStatement:24,StatementBlock:25,"{":26,"}":27,ExpressionStatement:28,AssignmentExpression:29,ConditionalExpression:30,LeftHandSideExpression:31,"=":32,LogicalORExpression:33,"?":34,":":35,LogicalANDExpression:36,"||":37,EqualityExpression:38,"&&":39,RelationalExpression:40,"==":41,"!=":42,"~=":43,AdditiveExpression:44,"<":45,">":46,"<=":47,">=":48,MultiplicativeExpression:49,"+":50,"-":51,UnaryExpression:52,"*":53,"/":54,"%":55,ExponentExpression:56,"^":57,"!":58,Member
1Expression:59,CallExpression:60,PrimaryExpression:61,FunctionExpression:62,MapExpression:63,".":64,"[":65,"]":66,BasicLiteral:67,ObjectLiteral:68,ArrayLiteral:69,NullLiteral:70,BooleanLiteral:71,StringLiteral:72,NumberLiteral:73,NULL:74,TRUE:75,FALSE:76,STRING:77,NUMBER:78,NAN:79,INFINITY:80,ElementList:81,"<<":82,">>":83,PropertyList:84,Property:85,",":86,PropertyName:87,Arguments:88,AttributeList:89,Attribute:90,FUNCTION:91,ParameterDefinitionList:92,MAP:93,"->":94,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",7:"IF",8:"(",10:")",12:"ELSE",14:"WHILE",15:"FOR",16:";",17:"DO",19:"USE",20:"IDENTIFIER",21:"DELETE",23:"RETURN",26:"{",27:"}",32:"=",34:"?",35:":",37:"||",39:"&&",41:"==",42:"!=",43:"~=",45:"<",46:">",47:"<=",48:">=",50:"+",51:"-",53:"*",54:"/",55:"%",57:"^",58:"!",64:".",65:"[",66:"]",74:"NULL",75:"TRUE",76:"FALSE",77:"STRING",78:"NUMBER",79:"NAN",80:"INFINITY",82:"<<",83:">>",86:",",91:"FUNCTION",93:"MAP",94:"->"},productions_:[0,[3,2],[6,5],[6,7],[13,5],[13,9],[13,7],[18,2],[18,2],[22,2],[22,3],[24,1],[25,3],[4,2],[4,0],[11,1],[11,1],[11,1],[11,1],[11,1],[11,1],[11,1],[28,2],[9,1],[29,1],[29,3],[30,1],[30,5],[33,1],[33,3],[36,1],[36,3],[38,1],[38,3],[38,3],[38,3],[40,1],[40,3],[40,3],[40,3],[40,3],[44,1],[44,3],[44,3],[49,1],[49,3],[49,3],[49,3],[56,1],[56,3],[52,1],[52,2],[52,2],[52,2],[31,1],[31,1],[59,1],[59,1],[59,1],[59,3],[59,4],[61,1],[61,1],[61,1],[61,1],[61,3],[67,1],[67,1],[67,1],[67,1],[70,1],[71,1],[71,1],[72,1],[73,1],[73,1],[73,1],[69,2],[69,3],[68,2],[68,3],[84,1],[84,3],[85,3],[87,1],[87,1],[87,1],[60,2],[60,3],[60,2],[60,4],[60,3],[88,2],[88,3],[89,1],[89,3],[90,1],[90,1],[81,1],[81,3],[62,4],[62,5],[63,5],[63,6],[92,1],[92,3]],performAction:function(t,e,i,r,s,o,n){var a=o.length-1;switch(s){case 1:return o[a-1];case 2:this.$=th.createNode(tl(n[a-4]),"node_op","op_if",o[a-2],o[a]);break;case 3:this.$=th.createNode(tl(n[a-6]),"node_op","op_if_else",o[a-4],o[a-2],o[a]);break;case 4:this.$=th.createNode(tl(n[a-4]),"node_op","op_while",o[a-2],o[a]);break;case 5:this.$=th.createNode(tl(n[a-8]),"node_op","op_for",o[a-6],o[a-4],o[a-2],o[a]);break;case 6:this.$=th.createNode(tl(n[a-6]),"node_op","op_do",o[a-5],o[a-2]);break;case 7:this.$=th.createNode(tl(n[a-1]),"node_op","op_use",o[a]);break;case 8:this.$=th.createNode(tl(n[a-1]),"node_op","op_delete",o[a]);break;case 9:this.$=th.createNode(tl(n[a-1]),"node_op","op_return",void 0);break;case 10:this.$=th.createNode(tl(n[a-2]),"node_op","op_return",o[a-1]);break;case 11:case 14:this.$=th.createNode(tl(n[a]),"node_op","op_none");break;case 12:this.$=o[a-1],this.$.needsBrackets=!0;break;case 13:this.$=th.createNode(tl(n[a-1]),"node_op","op_none",o[a-1],o[a]);break;case 15:case 16:case 17:case 18:case 19:case 20:case 21:case 23:case 24:case 26:case 28:case 30:case 32:case 36:case 41:case 44:case 48:case 50:case 52:case 54:case 55:case 56:case 58:case 62:case 81:case 84:case 85:case 86:this.$=o[a];break;case 22:case 65:case 93:this.$=o[a-1];break;case 25:this.$=th.createNode(tl(n[a-2]),"node_op","op_assign",o[a-2],o[a]),this.$.isMath=!1;break;case 27:this.$=th.createNode(tl(n[a-4]),"node_op","op_conditional",o[a-4],o[a-2],o[a]),this.$.isMath=!1;break;case 29:this.$=th.createNode(tl(n[a-2]),"node_op","op_or",o[a-2],o[a]),this.$.isMath=!1;break;case 31:this.$=th.createNode(tl(n[a-2]),"node_op","op_and",o[a-2],o[a]),this.$.isMath=!1;break;case 33:this.$=th.createNode(tl(n[a-2]),"node_op","op_eq",o[a-2],o[a]),this.$.isMath=!1;break;case 34:this.$=th.createNode(tl(n[a-2]),"node_op","op_neq",o[a-2],o[a]),this.$.isMath=!1;break;case 35:this.$=th.createNode(tl(n[a-2]),"node_op","op_approx",o[a-2],o[a]),this.$.isMath=!1;break;case 37:this.$=th.createNode(tl(n[a-2]),"node_op","op_lt",o[a-2],o[a]),this.$.isMath=!1;break;case 38:this.$=th.createNode(tl(n[a-2]),"node_op","op_gt",o[a-2],o[a]),this.$.isMath=!1;break;case 39:this.$=th.createNode(tl(n[a-2]),"node_op","op_leq",o[a-2],o[a]),this.$.isMath=!1;break;case 40:this.$=th.createNode(tl(n[a-2]),"node_op","op_geq",o[a-2],o[a]),this.$.isMath=!1;break;case 42:this.$=th.createNode(tl(n[a-2]),"node_op","op_add",o[a-2],o[a]),this.$.isMath=!0;break;case 43:this.$=th.createNode(tl(n[a-2]),"node_op","op_sub",o[a-2],o[a]),this.$.isMath=!0;break;case 45:this.$=th.createNode(tl(n[a-2]),"node_op","op_mul",o[a-2],o[a]),this.$.isMath=!0;break;case 46:this.$=th.createNode(tl(n[a-2]),"node_op","op_div",o[a-2],o[a]),this.$.isMath=!0;break;case 47:this.$=th.createNode(tl(n[a-2]),"node_op","op_mod",o[a-2],o[a]),this.$.isMath=!0;break;case 49:this.$=th.createNode(tl(n[a-2]),"node_op","op_exp",o[a-2],o[a]),this.$.isMath=!0;break;case 51:this.$=th.createNode(tl(n[a-1]),"node_op","op_not",o[a]),this.$.isMath=!1;break;case 53:this.$=th.createNode(tl(n[a-1]),"node_op","op_neg",o[a]),this.$.isMath=!0;break;
1case 57:case 63:case 64:case 66:case 67:case 68:case 97:this.$=o[a],this.$.isMath=!1;break;case 59:case 91:this.$=th.createNode(tl(n[a-2]),"node_op","op_property",o[a-2],o[a]),this.$.isMath=!0;break;case 60:case 90:this.$=th.createNode(tl(n[a-3]),"node_op","op_extvalue",o[a-3],o[a-1]),this.$.isMath=!0;break;case 61:this.$=th.createNode(tl(n[a]),"node_var",o[a]);break;case 69:this.$=o[a],this.$.isMath=!0;break;case 70:this.$=th.createNode(tl(n[a]),"node_const",null);break;case 71:this.$=th.createNode(tl(n[a]),"node_const_bool",!0);break;case 72:this.$=th.createNode(tl(n[a]),"node_const_bool",!1);break;case 73:this.$=th.createNode(tl(n[a]),"node_str",o[a].substring(1,o[a].length-1));break;case 74:this.$=th.createNode(tl(n[a]),"node_const",parseFloat(o[a]));break;case 75:this.$=th.createNode(tl(n[a]),"node_const",NaN);break;case 76:this.$=th.createNode(tl(n[a]),"node_const",1/0);break;case 77:this.$=th.createNode(tl(n[a-1]),"node_op","op_array",[]);break;case 78:this.$=th.createNode(tl(n[a-2]),"node_op","op_array",o[a-1]);break;case 79:this.$=th.createNode(tl(n[a-1]),"node_op","op_emptyobject",{}),this.$.needsAngleBrackets=!0;break;case 80:this.$=th.createNode(tl(n[a-2]),"node_op","op_proplst_val",o[a-1]),this.$.needsAngleBrackets=!0;break;case 82:this.$=th.createNode(tl(n[a-2]),"node_op","op_proplst",o[a-2],o[a]);break;case 83:this.$=th.createNode(tl(n[a-2]),"node_op","op_prop",o[a-2],o[a]);break;case 87:case 89:this.$=th.createNode(tl(n[a-1]),"node_op","op_execfun",o[a-1],o[a]),this.$.isMath=!0;break;case 88:this.$=th.createNode(tl(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 104:this.$=[o[a]];break;case 95:case 99:case 105:this.$=o[a-2].concat(o[a]);break;case 96:this.$=th.createNode(tl(n[a]),"node_var",o[a]),this.$.isMath=!0;break;case 100:this.$=th.createNode(tl(n[a-3]),"node_op","op_function",[],o[a]),this.$.isMath=!1;break;case 101:this.$=th.createNode(tl(n[a-4]),"node_op","op_function",o[a-2],o[a]),this.$.isMath=!1;break;case 102:this.$=th.createNode(tl(n[a-4]),"node_op","op_map",[],o[a]);break;case 103:this.$=th.createNode(tl(n[a-5]),"node_op","op_map",o[a-3],o[a])}},table:[t([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],e,{3:1,4:2}),{1:[3]},{5:[1,3],6:6,7:i,8:r,9:20,11:4,13:7,14:s,15:o,16:n,17:a,18:8,19:h,20:l,21:c,22:9,23:d,24:11,25:5,26:u,28:10,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:f,52:56,56:57,58:A,59:26,60:27,61:29,62:30,63:31,65:m,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:b,75:g,76:v,77:y,78:C,79:_,80:P,82:x,91:E,93:S},{1:[2,1]},t(N,[2,13]),t(T,[2,15]),t(T,[2,16]),t(T,[2,17]),t(T,[2,18]),t(T,[2,19]),t(T,[2,20]),t(T,[2,21]),t([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],e,{4:61}),{8:[1,62]},{8:[1,63]},{8:[1,64]},{6:6,7:i,8:r,9:20,11:65,13:7,14:s,15:o,16:n,17:a,18:8,19:h,20:l,21:c,22:9,23:d,24:11,25:5,26:u,28:10,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:f,52:56,56:57,58:A,59:26,60:27,61:29,62:30,63:31,65:m,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:b,75:g,76:v,77:y,78:C,79:_,80:P,82:x,91:E,93:S},{20:[1,66]},{20:[1,67]},{8:r,9:69,16:[1,68],20:l,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:f,52:56,56:57,58:A,59:26,60:27,61:29,62:30,63:31,65:m,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:b,75:g,76:v,77:y,78:C,79:_,80:P,82:x,91:E,93:S},{16:[1,70]},t(T,[2,11]),t(w,[2,23]),t(w,[2,24]),t([8,10,16,34,35,37,39,41,42,43,45,46,47,48,50,51,53,54,55,64,65,66,83,86],O,{32:[1,71],57:M}),t([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]}),t(k,[2,54],{88:77,8:D,64:[1,75],65:[1,76]}),t(k,[2,55],{88:79,8:D,64:[1,81],65:[1,80]}),t(R,[2,28],{39:L}),t(w,[2,56]),t(w,[2,57]),t(w,[2,58]),t(B,[2,30],{41:I,42:V,43:Y}),t(w,[2,61]),t(w,[2,62]),t(w,[2,63]),t(w,[2,64]),{8:r,9:86,20:l,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:f,52:56,56:57,58:A,59:26,60:27,61:29,62:30,63:31,65:m,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:b,75:g,76:v,77:y,78:C,79:_,80:P,82:x,91:E,93:S},{8:[1,87]},{8:[1,88]},t(j,[2,32],{45:X,46:F,47:J,48:U}),t(w,[2,66]),t(w,[2,67]),t(w,[2,68]),t(w,[2,69]),{20:z,72:98,73:99,77:y,78:C,79:_,80:P,83:[1,93],84:94,85:95,87:96},{8:r,20:l,29:102,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:f,52:56,56:57,58:A,59:26,60:27,61:29,62:30,63:31,65:m,66:[1,100],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:b,75:g,76:v,77:y,78:C,79:_,80:P,81:101,82:x,91:E,93:S},t(G,[2,36],{50:H,51:$}),t(w,[2,70]),t(w,[2,71]),t(w,[2,72]),t(w,[2,73]),t(w,[2,74]),t(w,[2,75]),t(w,[2,76]),t(W,[2,41],{53:q,54:Z,55:Q}),t(w,[2,44]),t(w,[2,50]),{8:r,20:l,31:109,50:p,51:f,52:108,56:57,58:A,59:26,60:27,61:29,62:30,63:31,65:m,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:b,75:g,76:v,77:y,78:C,79:_,80:P,82:x,91:E,93:S},{8:r,20:l,31:109,50:p,51:f,52:110,56:57,58:A,59:26,60:27,61:29,62:30,63:31,65:m,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:b,75:g,76:v,77:y,78:C,79:_,80:P,82:x,91:E,93:S},{8:r,20:l,31:109,50:p,51:f,52:111,56:57,58:A,59:26,60:27,61:29,62:30,63:31,65:m,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:b,75:g,76:v,77:y,78:C,79:_,80:P,82:x,91:E,93:S},{6:6,7:i,8:r,9:20,11:4,13:7,14:s,15:o,16:n,17:a,18:8,19:h,20:l,21:c,22:9,23:d,24:11,25:5,26:u,27:[1,112],28:10,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:f,52:56,56:57,58:A,59:26,60:27,61:29,62:30,63:31,65:m,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:b,75:g,76:v,77:y,78:C,79:_,80:P,82:x,91:E,93:S},{8:r,9:113,20:l,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:f,52:56,56:57,58:A,59:26,60:27,61:29,62:30,63:31,65:m,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:b,75:g,76:v,77:y,78:C,79:_,80:P,82:x,91:E,93:S},{8:r,9:114,20:l,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:f,52:56,56:57,58:A,59:26,60:27,61:29,62:30,63:31,65:m,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:b,75:g,76:v,77:y,78:C,79:_,80:P,82:x,91:E,93:S}
vendor: 4,808 bytes, line 1
1,{8:r,9:115,20:l,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:f,52:56,56:57,58:A,59:26,60:27,61:29,62:30,63:31,65:m,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:b,75:g,76:v,77:y,78:C,79:_,80:P,82:x,91:E,93:S},{14:[1,116]},t(T,[2,7]),t(T,[2,8]),t(T,[2,9]),{16:[1,117]},t(T,[2,22]),{8:r,20:l,29:118,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:f,52:56,56:57,58:A,59:26,60:27,61:29,62:30,63:31,65:m,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:b,75:g,76:v,77:y,78:C,79:_,80:P,82:x,91:E,93:S},{8:r,20:l,31:109,50:p,51:f,52:119,56:57,58:A,59:26,60:27,61:29,62:30,63:31,65:m,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:b,75:g,76:v,77:y,78:C,79:_,80:P,82:x,91:E,93:S},{8:r,20:l,29:120,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:f,52:56,56:57,58:A,59:26,60:27,61:29,62:30,63:31,65:m,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:b,75:g,76:v,77:y,78:C,79:_,80:P,82:x,91:E,93:S},{8:r,20:l,31:109,36:121,38:32,40:40,44:47,49:55,50:p,51:f,52:56,56:57,58:A,59:26,60:27,61:29,62:30,63:31,65:m,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:b,75:g,76:v,77:y,78:C,79:_,80:P,82:x,91:E,93:S},{20:[1,122]},{8:r,9:123,20:l,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:f,52:56,56:57,58:A,59:26,60:27,61:29,62:30,63:31,65:m,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:b,75:g,76:v,77:y,78:C,79:_,80:P,82:x,91:E,93:S},t(w,[2,87],{89:124,90:125,68:127,20:K,82:x}),{8:r,10:[1,128],20:l,29:102,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:f,52:56,56:57,58:A,59:26,60:27,61:29,62:30,63:31,65:m,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:b,75:g,76:v,77:y,78:C,79:_,80:P,81:129,82:x,91:E,93:S},t(w,[2,89]),{8:r,9:130,20:l,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:f,52:56,56:57,58:A,59:26,60:27,61:29,62:30,63:31,65:m,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:b,75:g,76:v,77:y,78:C,79:_,80:P,82:x,91:E,93:S},{20:[1,131]},{8:r,20:l,31:109,38:132,40:40,44:47,49:55,50:p,51:f,52:56,56:57,58:A,59:26,60:27,61:29,62:30,63:31,65:m,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:b,75:g,76:v,77:y,78:C,79:_,80:P,82:x,91:E,93:S},{8:r,20:l,31:109,40:133,44:47,49:55,50:p,51:f,52:56,56:57,58:A,59:26,60:27,61:29,62:30,63:31,65:m,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:b,75:g,76:v,77:y,78:C,79:_,80:P,82:x,91:E,93:S},{8:r,20:l,31:109,40:134,44:47,49:55,50:p,51:f,52:56,56:57,58:A,59:26,60:27,61:29,62:30,63:31,65:m,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:b,75:g,76:v,77:y,78:C,79:_,80:P,82:x,91:E,93:S},{8:r,20:l,31:109,40:135,44:47,49:55,50:p,51:f,52:56,56:57,58:A,59:26,60:27,61:29,62:30,63:31,65:m,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:b,75:g,76:v,77:y,78:C,79:_,80:P,82:x,91:E,93:S},{10:[1,136]},{10:[1,137],20:tt,92:138},{10:[1,140],20:tt,92:141},{8:r,20:l,31:109,44:142,49:55,50:p,51:f,52:56,56:57,58:A,59:26,60:27,61:29,62:30,63:31,65:m,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:b,75:g,76:v,77:y,78:C,79:_,80:P,82:x,91:E,93:S},{8:r,20:l,31:109,44:143,49:55,50:p,51:f,52:56,56:57,58:A,59:26,60:27,61:29,62:30,63:31,65:m,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:b,75:g,76:v,77:y,78:C,79:_,80:P,82:x,91:E,93:S},{8:r,20:l,31:109,44:144,49:55,50:p,51:f,52:56,56:57,58:A,59:26,60:27,61:29,62:30,63:31,65:m,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:b,75:g,76:v,77:y,78:C,79:_,80:P,82:x,91:E,93:S},{8:r,20:l,31:109,44:145,49:55,50:p,51:f,52:56,56:57,58:A,59:26,60:27,61:29,62:30,63:31,65:m,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:b,75:g,76:v,77:y,78:C,79:_,80:P,82:x,91:E,93:S},t(w,[2,79]),{83:[1,146],86:[1,147]},t(te,[2,81]),{35:[1,148]},{35:[2,84]},{35:[2,85]},{35:[2,86]},t(w,[2,77]),{66:[1,149],86:ti},t(tr,[2,98]),{8:r,20:l,31:109,49:151,50:p,51:f,52:56,56:57,58:A,59:26,60:27,61:29,62:30,63:31,65:m,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:b,75:g,76:v,77:y,78:C,79:_,80:P,82:x,91:E,93:S},{8:r,20:l,31:109,49:152,50:p,51:f,52:56,56:57,58:A,59:26,60:27,61:29,62:30,63:31,65:m,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:b,75:g,76:v,77:y,78:C,79:_,80:P,82:x,91:E,93:S},{8:r,20:l,31:109,50:p,51:f,52:153,56:57,58:A,59:26,60:27,61:29,62:30,63:31,65:m,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:b,75:g,76:v,77:y,78:C,79:_,80:P,82:x,91:E,93:S},{8:r,20:l,31:109,50:p,51:f,52:154,56:57,58:A,59:26,60:27,61:29,62:30,63:31,65:m,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:b,75:g,76:v,77:y,78:C,79:_,80:P,82:x,91:E,93:S},{8:r,20:l,31:109,50:p,51:f,52:155,56:57,58:A,59:26,60:27,61:29,62:30,63:31,65:m,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:b,75:g,76:v,77:y,78:C,79:_,80:P,82:x,91:E,93:S},t(w,[2,51]),t([8,10,16,32,34,35,37,39,41,42,43,45,46,47,48,50,51,53,54,55,64,65,66,83,86],O,{57:M}),t(w,[2,52]),t(w,[2,53]),t([5,7,8,10,12,14,15,16,17,19,20,21,23,26,27,32,34,35,37,39,41,42,43,45,46,47,48,50,51,53,54,55,57,58,64,65,66,74,75,76,77,78,79,80,82,83,86,91,93],[2,12]),{10:[1,156]},{10:[1,157]},{16:[1,158]},{8:[1,159]}
vendor: 4,419 bytes, line 1
1,t(T,[2,10]),t(w,[2,25]),t(w,[2,49]),{35:[1,160]},t(R,[2,29],{39:L}),t(w,[2,59]),{66:[1,161]},t([8,10,16,32,34,35,37,39,41,42,43,45,46,47,48,50,51,53,54,55,57,64,65,66,83],[2,88],{86:[1,162]}),t(w,[2,94]),t(w,[2,96]),t(w,[2,97]),t(ts,[2,92]),{10:[1,163],86:ti},{66:[1,164]},t(w,[2,91]),t(B,[2,31],{41:I,42:V,43:Y}),t(j,[2,33],{45:X,46:F,47:J,48:U}),t(j,[2,34],{45:X,46:F,47:J,48:U}),t(j,[2,35],{45:X,46:F,47:J,48:U}),t(w,[2,65]),{25:165,26:u},{10:[1,166],86:to},t(tn,[2,104]),{94:[1,168]},{10:[1,169],86:to},t(G,[2,37],{50:H,51:$}),t(G,[2,38],{50:H,51:$}),t(G,[2,39],{50:H,51:$}),t(G,[2,40],{50:H,51:$}),t(w,[2,80]),{20:z,72:98,73:99,77:y,78:C,79:_,80:P,85:170,87:96},{8:r,20:l,29:171,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:f,52:56,56:57,58:A,59:26,60:27,61:29,62:30,63:31,65:m,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:b,75:g,76:v,77:y,78:C,79:_,80:P,82:x,91:E,93:S},t(w,[2,78]),{8:r,20:l,29:172,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:f,52:56,56:57,58:A,59:26,60:27,61:29,62:30,63:31,65:m,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:b,75:g,76:v,77:y,78:C,79:_,80:P,82:x,91:E,93:S},t(W,[2,42],{53:q,54:Z,55:Q}),t(W,[2,43],{53:q,54:Z,55:Q}),t(w,[2,45]),t(w,[2,46]),t(w,[2,47]),{6:6,7:i,8:r,9:20,11:173,13:7,14:s,15:o,16:n,17:a,18:8,19:h,20:l,21:c,22:9,23:d,24:11,25:5,26:u,28:10,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:f,52:56,56:57,58:A,59:26,60:27,61:29,62:30,63:31,65:m,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:b,75:g,76:v,77:y,78:C,79:_,80:P,82:x,91:E,93:S},{6:6,7:i,8:r,9:20,11:174,13:7,14:s,15:o,16:n,17:a,18:8,19:h,20:l,21:c,22:9,23:d,24:11,25:5,26:u,28:10,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:f,52:56,56:57,58:A,59:26,60:27,61:29,62:30,63:31,65:m,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:b,75:g,76:v,77:y,78:C,79:_,80:P,82:x,91:E,93:S},{8:r,9:175,20:l,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:f,52:56,56:57,58:A,59:26,60:27,61:29,62:30,63:31,65:m,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:b,75:g,76:v,77:y,78:C,79:_,80:P,82:x,91:E,93:S},{8:r,9:176,20:l,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:f,52:56,56:57,58:A,59:26,60:27,61:29,62:30,63:31,65:m,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:b,75:g,76:v,77:y,78:C,79:_,80:P,82:x,91:E,93:S},{8:r,20:l,29:177,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:f,52:56,56:57,58:A,59:26,60:27,61:29,62:30,63:31,65:m,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:b,75:g,76:v,77:y,78:C,79:_,80:P,82:x,91:E,93:S},t(w,[2,60]),{20:K,68:127,82:x,90:178},t(ts,[2,93]),t(w,[2,90]),t(w,[2,100]),{25:179,26:u},{20:[1,180]},{8:r,9:181,20:l,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:f,52:56,56:57,58:A,59:26,60:27,61:29,62:30,63:31,65:m,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:b,75:g,76:v,77:y,78:C,79:_,80:P,82:x,91:E,93:S},{94:[1,182]},t(te,[2,82]),t(te,[2,83]),t(tr,[2,99]),t(N,[2,2],{12:[1,183]}),t(T,[2,4]),{16:[1,184]},{10:[1,185]},t(w,[2,27]),t(w,[2,95]),t(w,[2,101]),t(tn,[2,105]),t(w,[2,102]),{8:r,9:186,20:l,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:f,52:56,56:57,58:A,59:26,60:27,61:29,62:30,63:31,65:m,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:b,75:g,76:v,77:y,78:C,79:_,80:P,82:x,91:E,93:S},{6:6,7:i,8:r,9:20,11:187,13:7,14:s,15:o,16:n,17:a,18:8,19:h,20:l,21:c,22:9,23:d,24:11,25:5,26:u,28:10,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:f,52:56,56:57,58:A,59:26,60:27,61:29,62:30,63:31,65:m,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:b,75:g,76:v,77:y,78:C,79:_,80:P,82:x,91:E,93:S},{8:r,9:188,20:l,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:f,52:56,56:57,58:A,59:26,60:27,61:29,62:30,63:31,65:m,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:b,75:g,76:v,77:y,78:C,79:_,80:P,82:x,91:E,93:S},{16:[1,189]},t(w,[2,103]),t(T,[2,3]),{10:[1,190]},t(T,[2,6]),{6:6,7:i,8:r,9:20,11:191,13:7,14:s,15:o,16:n,17:a,18:8,19:h,20:l,21:c,22:9,23:d,24:11,25:5,26:u,28:10,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:p,51:f,52:56,56:57,58:A,59:26,60:27,61:29,62:30,63:31,65:m,67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:b,75:g,76:v,77:y,78:C,79:_,80:P,82:x,91:E,93:S},t(T,[2,5])],defaultActions:{3:[2,1],97:[2,84],98:[2,85],99:[2,86]},parseError:function(t,e){if(e.recoverable)this.trace(t);else{var i=Error(t);throw i.hash=e,i}},parse:function(t){var e=this,i=[0],r=[null],s=[],o=this.table,n="",a=0,h=0,l=0,c=2,d=1,u=s.slice.call(arguments,1
vendor: 7,102 bytes, line 1
1),p=Object.create(this.lexer),f={};for(var A in this.yy)Object.prototype.hasOwnProperty.call(this.yy,A)&&(f[A]=this.yy[A]);p.setInput(t,f),f.lexer=p,f.parser=this,void 0===p.yylloc&&(p.yylloc={});var m=p.yylloc;s.push(m);var b=p.options&&p.options.ranges;"function"==typeof f.parseError?this.parseError=f.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var g,v,y,C,_,P,x,E,S,N=function(){var t;return"number"!=typeof(t=p.lex()||d)&&(t=e.symbols_[t]||t),t},T={};;){if(y=i[i.length-1],this.defaultActions[y]?C=this.defaultActions[y]:(null==g&&(g=N()),C=o[y]&&o[y][g]),void 0===C||!C.length||!C[0]){var w="";for(P in S=[],o[y])this.terminals_[P]&&P>c&&S.push("'"+this.terminals_[P]+"'");w=p.showPosition?"Parse error on line "+(a+1)+":\n"+p.showPosition()+"\nExpecting "+S.join(", ")+", got '"+(this.terminals_[g]||g)+"'":"Parse error on line "+(a+1)+": Unexpected "+(g==d?"end of input":"'"+(this.terminals_[g]||g)+"'"),this.parseError(w,{text:p.match,token:this.terminals_[g]||g,line:p.yylineno,loc:m,expected:S})}if(C[0]instanceof Array&&C.length>1)throw Error("Parse Error: multiple actions possible at state: "+y+", token: "+g);switch(C[0]){case 1:i.push(g),r.push(p.yytext),s.push(p.yylloc),i.push(C[1]),g=null,v?(g=v,v=null):(h=p.yyleng,n=p.yytext,a=p.yylineno,m=p.yylloc,l>0&&l--);break;case 2:if(x=this.productions_[C[1]][1],T.$=r[r.length-x],T._$={first_line:s[s.length-(x||1)].first_line,last_line:s[s.length-1].last_line,first_column:s[s.length-(x||1)].first_column,last_column:s[s.length-1].last_column},b&&(T._$.range=[s[s.length-(x||1)].range[0],s[s.length-1].range[1]]),void 0!==(_=this.performAction.apply(T,[n,h,a,f,C[1],r,s].concat(u))))return _;x&&(i=i.slice(0,-1*x*2),r=r.slice(0,-1*x),s=s.slice(0,-1*x)),i.push(this.productions_[C[1]][0]),r.push(T.$),s.push(T._$),E=o[i[i.length-2]][i[i.length-1]],i.push(E);break;case 3:return!0}}return!0}},th={node:function(t,e,i){return{type:t,value:e,children:i}},createNode:function(t,e,i,r){var s,o=this.node(e,i,[]);for(s=3;s<arguments.length;s++)o.children.push(arguments[s]);return o.line=t[0],o.col=t[1],o.eline=t[2],o.ecol=t[3],o}},tl=function(t){return[t.first_line,t.first_column,t.last_line,t.last_column]};function tc(){this.yy={}}return ta.lexer=function(){return{EOF:1,parseError:function(t,e){if(this.yy.parser)this.yy.parser.parseError(t,e);else throw Error(t)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,i=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),i.length-1&&(this.yylineno-=i.length-1);var s=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:i?(i.length===r.length?this.yylloc.first_column:0)+r[r.length-i.length].length-i[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[s[0],s[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},test_match:function(t,e){var i,r,s;if(this.options.backtrack_lexer&&(s={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(s.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],i=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),i)return i;if(this._backtrack)for(var o in s)this[o]=s[o];return!1},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var t,e,i,r,s=this._currentRules(),o=0;o<s.length;o++)if((i=this._input.match(this.rules[s[o]]))&&(!e||i[0].length>e[0].length)){if(e=i,r=o,this.options.backtrack_lexer){if(!1!==(t=this.test_match(i,s[o])))return t;if(!this._backtrack)return!1;e=!1;continue}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,s[r]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return t||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{}
1,performAction:function(t,e,i,r){switch(i){case 0:case 6:case 7:break;case 1:case 2:case 3:return 78;case 4:case 5:return 77;case 8:return 7;case 9:return 12;case 10:return 14;case 11:return 17;case 12:return 15;case 13:return 91;case 14:return 93;case 15:return 19;case 16:return 23;case 17:return 21;case 18:return 75;case 19:return 76;case 20:return 74;case 21:return 80;case 22:case 23:return 94;case 24:return 82;case 25:return 83;case 26:return 26;case 27:return 27;case 28:return 16;case 29:return"#";case 30:return 34;case 31:return 35;case 32:return 79;case 33:return 64;case 34:return 65;case 35:return 66;case 36:return 8;case 37:return 10;case 38:return 58;case 39:case 40:return 57;case 41:return 53;case 42:return 54;case 43:return 55;case 44:return 50;case 45:return 51;case 46:return 47;case 47:return 45;case 48:return 48;case 49:return 46;case 50:return 41;case 51:return 43;case 52:return 42;case 53:return 39;case 54:return 37;case 55:return 32;case 56:return 86;case 57:return 5;case 58:return 20;case 59:return"INVALID"}},rules:[/^(?:\s+)/,/^(?:[0-9]*\.?[0-9]+([eE][-+]?[0-9]+))/,/^(?:[0-9]+\.[0-9]*|[0-9]*\.[0-9]+\b)/,/^(?:[0-9]+)/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:\/\/.*)/,/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:if\b)/,/^(?:else\b)/,/^(?:while\b)/,/^(?:do\b)/,/^(?:for\b)/,/^(?:function\b)/,/^(?:map\b)/,/^(?:use\b)/,/^(?:return\b)/,/^(?:delete\b)/,/^(?:true\b)/,/^(?:false\b)/,/^(?:null\b)/,/^(?:Infinity\b)/,/^(?:->)/,/^(?:=>)/,/^(?:<<)/,/^(?:>>)/,/^(?:\{)/,/^(?:\})/,/^(?:;)/,/^(?:#)/,/^(?:\?)/,/^(?::)/,/^(?:NaN\b)/,/^(?:\.)/,/^(?:\[)/,/^(?:\])/,/^(?:\()/,/^(?:\))/,/^(?:!)/,/^(?:\^)/,/^(?:\*\*)/,/^(?:\*)/,/^(?:\/)/,/^(?:%)/,/^(?:\+)/,/^(?:-)/,/^(?:<=)/,/^(?:<)/,/^(?:>=)/,/^(?:>)/,/^(?:==)/,/^(?:~=)/,/^(?:!=)/,/^(?:&&)/,/^(?:\|\|)/,/^(?:=)/,/^(?:,)/,/^(?:$)/,/^(?:[A-Za-z_\$][A-Za-z0-9_]*)/,/^(?:.)/],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59],inclusive:!0}}}}(),tc.prototype=ta,ta.Parser=tc,new tc}();parser.yy.parseError=parser.parseError;let __WEBPACK_DEFAULT_EXPORT__=_jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.JessieCode},43464:(t,e,i)=>{i.d(e,{A:()=>u});var r=i(76422),s=i(16100),o=i(11701),n=i(35283),a=i(94768),h=i(64657),l=i(97272),c=i(57571),d={HTMLSliderInputEventHandler:function(){this._val=parseFloat(this.rendNodeRange.value),this.rendNodeOut.value=this.rendNodeRange.value,this.board.update()}};r.A.Text=function(t,e,i,r){var o;this.constructor(t,i,s.A.OBJECT_TYPE_TEXT,s.A.OBJECT_CLASS_TEXT),this.element=this.board.select(i.anchor),this.coordsConstructor(e,this.evalVisProp("islabel")),this.content="",this.plaintext="",this.plaintextOld=null,this.orgText="",this.needsSizeUpdate=!1,this.hiddenByParent=!1,this.size=[1,1],this.id=this.board.setId(this,"T"),this.board.renderer.drawText(this),this.board.finalizeAdding(this),o=this.visProp.visible,this.visProp.visible=!0,this.setText(r),this.visProp.visible=o,h.A.isString(this.content)&&this.notifyParents(this.content),this.elType="text",this.methodMap=h.A.deepCopy(this.methodMap,{setText:"setTextJessieCode",move:"setCoords",Size:"getSize",setAutoPosition:"setAutoPosition"})},r.A.Text.prototype=new o.A,h.A.copyPrototypeMethods(r.A.Text,c.A,"coordsConstructor"),r.A.extend(r.A.Text.prototype,{hasPoint:function(t,e){var i,r,s,o,n,a,c,d;return(h.A.isObject(this.evalVisProp("precision"))?(c=this.board._inputDevice,d=this.evalVisProp("precision."+c)):d=this.board.options.precision.hasPoint,this.transformations.length>0&&(t=(i=l.A.matVecMult(l.A.inverse(this.board.renderer.joinTransforms(this,this.transformations)),[1,t,e]))[1],e=i[2]),r=(i="right"===(n=this.getAnchorX())?this.coords.scrCoords[1]-this.size[0]:"middle"===n?this.coords.scrCoords[1]-.5*this.size[0]:this.coords.scrCoords[1])+this.size[0],s=(o="top"===(a=this.getAnchorY())?this.coords.scrCoords[2]+this.size[1]:"middle"===a?this.coords.scrCoords[2]+.5*this.size[1]:this.coords.scrCoords[2])-this.size[1],"all"===this.evalVisProp("dragarea"))?t>=i-d&&t<r+d&&e>=s-d&&e<=o+d:e>=s-d&&e<=o+d&&(t>=i-d&&t<=i+2*d||t>=r-2*d&&t<=r+d)},_createFctUpdateText:function(t){var e,i,r,s,o,n,a=this.evalVisProp("parse"),l=this.evalVisProp("usemathjax"),c=this.evalVisProp("usekatex"),d=!1;if(this.orgText=t,h.A.isFunction(t))this.updateText=function(){s=t().toString(),!a||l||c?this.plaintext=s:this.plaintext=this.replaceSub(this.replaceSup(this.convertGeonextAndSketchometry2CSS(s,!1)))};else if(h.A.isNumber(t)&&this.evalVisProp("formatnumber")?this.evalVisProp("tofraction")?l?this.content="\\("+h.A.toFraction(t,!0)+"\\)":this.content=h.A.toFraction(t,c):(r=this.evalVisProp("digits"),this.useLocale()?this.content=this.formatNumberLocale(t,r):this.content=h.A.toFixed(t,r)):h.A.isString(t)&&a?(this.evalVisProp("useasciimathml")?this.content="'`"+t+"`'":l||c?(this.content=this.valueTagToJessieCode(t),h.A.isArray(this.content)||(this.content=this.content.replace(/\\/g,"\\\\"))):this.content=this.poorMansTeX(this.valueTagToJessieCode(t)),d=!0):this.content=t,d){if(h.A.isArray(this.content)){for(o=0,n=this;o<this.content.length;o++)if('"'!==this.content[o][0])for(i in this.content[o]=this.board.jc.snippet(this.content[o],!0,"",!1),this.content[o].deps)this.addParents(this.content[o].deps[i]),this.content[o].deps[i].addChild(this);e=function(){var t,e,i=n.evalVisProp("digits"),r="";for(t=0;t<n.content.length;t++)h.A.isFunction(n.content[t])?(e=n.content[t](),e=n.useLocale()?n.formatNumberLocale(e,i):h.A.toFixed(e,i)):'"'===(e=n.content[t])[0]&&'"'===e[e.length-1]&&(e=e.slice(1,-1)),r+=e;return r}}else for(i in(e=this.board.jc.snippet(this.content,!0,"",!1)).deps)this.addParents(e.deps[i]),e.deps[i].addChild(this);this.updateText=function(){this.plaintext=this.unescapeTicks(e())}}else this.updateText=function(){this.plaintext=this.content}},_setText:function(t){return this._createFctUpdateText(t),this.updateText(),this.fullUpdate(),this.board.infobox&&this.id===this.board.infobox.id||this.updateSize(),this},setTextJessieCode:function(t){var e;return this.visProp.castext=t,e=h.A.isFunction(t)?function(){return h.A.sanitizeHTML(t())}:h.A.isNumber(t)?t:h.A.sanitizeHTML(t),this._setText(e)},setText:function(t){return this._setText(t)},updateSize:function(){var t,e,i,r=this.evalVisProp("display");return a.A.isBrowser&&"no"!==this.board.renderer.type&&(i=this.rendNode,"html"===r||"vml"===this.board.renderer.type?h.A.exists(i.offsetWidth)?(e=this,window.setTimeout(function(){e.size=[i.offsetWidth,i.offsetHeight],e.needsUpdate=!0,e.updateRenderer()},0)):this.size=this.crudeSizeEstimate():"internal"===r&&("svg"===this.board.renderer.type?(e=this,window.setTimeout(function(){try{t=i.getBBox(),e.size=[t.width,t.height],e.needsUpdate=!0,e.updateRenderer()}catch(t){}},0)):"canvas"===this.board.renderer.type&&(this.size=this.crudeSizeEstimate()))),this},crudeSizeEstimate:function(){var t=parseFloat(this.evalVisProp("fontsize"));return[t*this.plaintext.length*.45,.9*t]},utf8_decode:function(t){return t.replace(/&#x(\w+);/g,function(t,e){return String.fromCharCode(parseInt(e,16))})},replaceSub:function(t){if(!t.indexOf)return t;for(var e,i=t.indexOf("_{");i>=0;)(e=(t=t.slice(0,i)+t.slice(i).replace(/_\{/,"<sub>")).indexOf("}",i+4))>
1=0&&(t=t.slice(0,e)+t.slice(e).replace(/\}/,"</sub>")),i=t.indexOf("_{");for(i=t.indexOf("_");i>=0;)i=(t=t.slice(0,i)+t.slice(i).replace(/_(.?)/,"<sub>$1</sub>")).indexOf("_");return t},replaceSup:function(t){if(!t.indexOf)return t;for(var e,i=t.indexOf("^{");i>=0;)(e=(t=t.slice(0,i)+t.slice(i).replace(/\^\{/,"<sup>")).indexOf("}",i+4))>=0&&(t=t.slice(0,e)+t.slice(e).replace(/\}/,"</sup>")),i=t.indexOf("^{");for(i=t.indexOf("^");i>=0;)i=(t=t.slice(0,i)+t.slice(i).replace(/\^(.?)/,"<sup>$1</sup>")).indexOf("^");return t},getSize:function(){return this.size},setCoords:function(t,e){var i,r,o;return h.A.isArray(t)&&t.length>1&&(e=t[1],t=t[0]),this.evalVisProp("islabel")&&h.A.exists(this.element)?(r=(t-(i=this.element.getLabelAnchor()).usrCoords[1])*this.board.unitX,o=-(e-i.usrCoords[2])*this.board.unitY,this.relativeCoords.setCoordinates(s.A.COORDS_BY_SCREEN,[r,o])):this.coords.setCoordinates(s.A.COORDS_BY_USER,[t,e]),this.fullUpdate(),this},update:function(t){return this.needsUpdate&&(this.updateCoords(t),this.updateText(),"internal"===this.evalVisProp("display")&&h.A.isString(this.plaintext)&&(this.plaintext=this.utf8_decode(this.plaintext)),this.checkForSizeUpdate(),this.needsSizeUpdate&&this.updateSize()),this},checkForSizeUpdate:function(){this.board.infobox&&this.id===this.board.infobox.id?this.needsSizeUpdate=!1:(this.needsSizeUpdate=this.plaintextOld!==this.plaintext,this.needsSizeUpdate&&(this.plaintextOld=this.plaintext))},updateRenderer:function(){return this.evalVisProp("autoposition")&&this.setAutoPosition().updateConstraint(),this.updateRendererGeneric("updateText")},expandShortMath:function(t){var e=/([)0-9.])\s*([(a-zA-Z_])/g;return t.replace(e,"$1*$2")},generateTerm:function(t,e,i){var r,s,o,a,l='""';if(o=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=t||"").replace(/\r/g,"")).replace(/\n/g,"")).replace(/"/g,"'")).replace(/'/g,"\\'")).replace(/&arc;/g,"∠")).replace(/<arc\s*\/>/g,"∠")).replace(/<arc\s*\/>/g,"∠")).replace(/<sqrt\s*\/>/g,"√")).replace(/<value>/g,"<value>")).replace(/<\/value>/g,"</value>")).indexOf("<value>"),a=t.indexOf("</value>"),o>=0)for(;o>=0;)l+=' + "'+this.replaceSub(this.replaceSup(t.slice(0,o)))+'"',s=(s=t.slice(o+7,a)).replace(/\s+/g,""),!0===e&&(s=this.expandShortMath(s)),0>(r=(r=(r=i?s:n.A.geonext2JS(s,this.board)).replace(/\\"/g,"'")).replace(/\\'/g,"'")).indexOf("toFixed")&&h.A.isNumber(h.A.bind(this.board.jc.snippet(r,!0,"",!1),this)())?l+="+("+r+").toFixed("+this.evalVisProp("digits")+")":l+="+("+r+")",o=(t=t.slice(a+8)).indexOf("<value>"),a=t.indexOf("</value>");return l+=' + "'+this.replaceSub(this.replaceSup(t))+'"',l=(l=(l=this.convertGeonextAndSketchometry2CSS(l)).replace(/&/g,"&")).replace(/"/g,"'")},valueTagToJessieCode:function(t){var e,i,r,s,o=!0,n=[],a='"';if(r=(t=(t=(t=(t=(t=t||"").replace(/\r/g,"")).replace(/\n/g,"")).replace(/<value>/g,"<value>")).replace(/<\/value>/g,"</value>")).indexOf("<value>"),s=t.indexOf("</value>"),r>=0)for(;r>=0;)n.push(a+this.escapeTicks(t.slice(0,r))+a),i=(i=t.slice(r+7,s)).replace(/\s+/g,""),!0===o&&(i=this.expandShortMath(i)),e=(e=i).replace(/\\"/g,"'").replace(/\\'/g,"'"),n.push("("+e+")"),r=(t=t.slice(s+8)).indexOf("<value>"),s=t.indexOf("</value>");for(n.push(a+this.escapeTicks(t)+a),r=0;r<n.length;r++)n[r]=n[r].replace(/&/g,"&");return n},poorMansTeX:function(t){var e,i;if(h.A.isArray(t)){for(e=0,i=[];e<t.length;e++)i.push(this.poorMansTeX(t[e]));return i}return t=t.replace(/<arc\s*\/*>/g,"∠").replace(/<arc\s*\/*>/g,"∠").replace(/<sqrt\s*\/*>/g,"√").replace(/<sqrt\s*\/*>/g,"√"),this.convertGeonextAndSketchometry2CSS(this.replaceSub(this.replaceSup(t)),!0)},escapeTicks:function(t){return t.replace(/"/g,"%22").replace(/'/g,"%27")},unescapeTicks:function(t){return t.replace(/%22/g,'"').replace(/%27/g,"'")},convertGeonext2CSS:function(t){return h.A.isString(t)&&(t=(t=(t=(t=t.replace(/(<|<)overline(>|>)/g,"<span style=text-decoration:overline;>")).replace(/(<|<)\/overline(>|>)/g,"</span>")).replace(/(<|<)arrow(>|>)/g,"<span style=text-decoration:overline;>")).replace(/(<|<)\/arrow(>|>)/g,"</span>")),t},convertSketchometry2CSS:function(t,e){var i='<span class="sketcho sketcho-inherit sketcho-',r='"></span>';return h.A.isString(t)&&(e&&(i=this.escapeTicks(i),r=this.escapeTicks(r)),t=(t=t.replace(/(<|<)sketchofont(>|>)/g,i)).replace(/(<|<)\/sketchofont(>|>)/g,r)),t},convertGeonextAndSketchometry2CSS:function(t,e){return t=this.convertGeonext2CSS(t),t=this.convertSketchometry2CSS(t,e)},notifyParents:function(t){var e,i=null;t=(t=t.replace(/<value>/g,"<value>")).replace(/<\/value>/g,"</value>");do null!==(i=(e=/<value>([\w\s*/^\-+()[\],<>=!]+)<\/value>/).exec(t))&&(n.A.findDependencies(this,i[1],this.board),t=(t=t.slice(i.index)).replace(e,""));while(null!==i);return this},getParents:function(){var t;return t=void 0!==this.relativeCoords?[this.relativeCoords.usrCoords[1],this.relativeCoords.usrCoords[2],this.orgText]:[this.Z(),this.X(),this.Y(),this.orgText],0!==this.parents.length&&(t=this.parents),t},bounds:function(){var t=this.coords.usrCoords;return this.evalVisProp("islabel")||0===this.board.unitY||0===this.board.unitX?[0,0,0,0]:[t[1],t[2]+this.size[1]/this.board.unitY,t[1]+this.size[0]/this.board.unitX,t[2]]},getAnchorX:function(){var t=this.evalVisProp("anchorx");if("auto"===t)switch(this.visProp.position){case"top":case"bot":return"middle";case"rt":case"lrt":case"urt":return"left";default:return"right"}return t},getAnchorY:function(){var t=this.evalVisProp("anchory");if("auto"===t)switch(this.visProp.position){case"top":case"ulft":case"urt":return"bottom";case"bot":case"lrt":case"llft":return"top";default:return"middle"}return t}
1,getNumberOfConflicts:function(t,e,i,r,s){s=s||[];var o,n,a,h,l,c=0;for(o=0,h=this.board.options.precision.hasPoint,this.board.options.precision.hasPoint=(i+r)*.25,a=this.board.objectsList.length;o<a;o++)l=(n=this.board.objectsList[o]).visProp.hasinnerpoints,n.visProp.hasinnerpoints=!1,n.visPropCalc.visible&&"axis"!==n.elType&&"ticks"!==n.elType&&n!==this.board.infobox&&n!==this&&n.hasPoint(t,e)&&-1===s.indexOf(n.id)&&c++,n.visProp.hasinnerpoints=l;return this.board.options.precision.hasPoint=h,c},setAutoPosition:function(){var t,e,i,r,s,o,n,a,h,l,c,d,u,p,f,A,m,b=this.size[0],g=this.size[1],v={conflicts:1/0,angle:0,r:0},y=12,C=2*Math.PI/12;if(this===this.board.infobox||!this.visPropCalc.visible||!this.evalVisProp("islabel")||!this.element||(c=this.evalVisProp("offset"),i=(s=this.element.getLabelAnchor()).scrCoords[1],r=s.scrCoords[2],p=c[0],f=c[1],0===(l=this.getNumberOfConflicts(i+p,r-f,b,g,this.evalVisProp("autopositionwhitelist")))))return this;for(d=this.evalVisProp("autopositionmindistance"),a=this.evalVisProp("autopositionmaxdistance"),h=.2*d,o=Math.atan2(f,p),v.conflicts=l,v.angle=o,v.r=d;v.conflicts>0&&d<=a;){for(u=1,n=o+C;u<y&&v.conflicts>0&&(A=Math.cos(n),m=Math.sin(n),t=i+d*A,e=r-d*m,(l=this.getNumberOfConflicts(t,e,b,g,this.evalVisProp("autopositionwhitelist")))<v.conflicts&&(v.conflicts=l,v.angle=n,v.r=d),0!==v.conflicts);u++)n+=C;d+=h}return d=v.r,A=Math.cos(v.angle),m=Math.sin(v.angle),this.visProp.offset=[d*A,d*m],A<-.2?this.visProp.anchorx="right":A>.2?this.visProp.anchorx="left":this.visProp.anchorx="middle",this}}),r.A.createText=function(t,e,i){var s,o=h.A.copyAttributes(i,t.options,"text"),n=e.slice(0,-1),a=e[e.length-1];if(o.anchor=o.parent||o.anchor,!(s=c.A.create(r.A.Text,t,n,o,a)))throw Error("JSXGraph: Can't create text with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [x,y], [z,x,y], [element,transformation]");return 0!==o.rotate&&s.addRotation(o.rotate),s},r.A.registerElement("text",r.A.createText),r.A.createHTMLSlider=function(t,e,i){var s,o,n=h.A.copyAttributes(i,t.options,"htmlslider");if(2!==e.length||2!==e[0].length||3!==e[1].length)throw Error("JSXGraph: Can't create htmlslider with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parents are: [[x,y], [min, start, max]]");n.anchor=n.parent||n.anchor,n.fixed=n.fixed||!0,o=[e[0][0],e[0][1],'<form style="display:inline"><input type="range" /><span></span><input type="text" /></form>'],(s=r.A.createText(t,o,n)).type=h.A.OBJECT_TYPE_HTMLSLIDER,s.rendNodeForm=s.rendNode.childNodes[0],s.rendNodeRange=s.rendNodeForm.childNodes[0],s.rendNodeRange.min=e[1][0],s.rendNodeRange.max=e[1][2],s.rendNodeRange.step=n.step,s.rendNodeRange.value=e[1][1],s.rendNodeLabel=s.rendNodeForm.childNodes[1],s.rendNodeLabel.id=s.rendNode.id+"_label",n.withlabel&&(s.rendNodeLabel.innerHTML=s.name+"="),s.rendNodeOut=s.rendNodeForm.childNodes[2],s.rendNodeOut.value=e[1][1];try{s.rendNodeForm.id=s.rendNode.id+"_form",s.rendNodeRange.id=s.rendNode.id+"_range",s.rendNodeOut.id=s.rendNode.id+"_out"}catch(t){r.A.debug(t)}return s.rendNodeRange.style.width=n.widthrange+"px",s.rendNodeRange.style.verticalAlign="middle",s.rendNodeOut.style.width=n.widthout+"px",s._val=e[1][1],r.A.supportsVML()?a.A.addEvent(s.rendNodeForm,"change",d.HTMLSliderInputEventHandler,s):a.A.addEvent(s.rendNodeForm,"input",d.HTMLSliderInputEventHandler,s),s.Value=function(){return this._val},s},r.A.registerElement("htmlslider",r.A.createHTMLSlider);let u=r.A.Text},46693:(t,e,i)=>{i.d(e,{A:()=>h});var r=i(76422),s=i(16100),o=i(13291),n=i(64657),a=i(97272);r.A.Coords=function(t,e,i,r){this.board=i,this.usrCoords=[],this.scrCoords=[],this.emitter=!n.A.exists(r)||r,this.emitter&&o.A.eventify(this),this.setCoordinates(t,e,!1,!0)},r.A.extend(r.A.Coords.prototype,{normalizeUsrCoords:function(){Math.abs(this.usrCoords[0])>a.A.eps&&(this.usrCoords[1]/=this.usrCoords[0],this.usrCoords[2]/=this.usrCoords[0],this.usrCoords[0]=1)},usr2screen:function(t){var e=Math.round,i=this.board,r=this.usrCoords,s=i.origin.scrCoords;!0===t?(this.scrCoords[0]=e(r[0]),this.scrCoords[1]=e(r[0]*s[1]+r[1]*i.unitX),this.scrCoords[2]=e(r[0]*s[2]-r[2]*i.unitY)):(this.scrCoords[0]=r[0],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,e){var i,r,o=0,n=this.usrCoords,h=this.scrCoords;return t!==s.A.COORDS_BY_USER?(i=e.scrCoords,a.A.hypot(h[1]-i[1],h[2]-i[2])):(i=e.usrCoords,(o=(r=n[0]-i[0])*r)>a.A.eps*a.A.eps)?1/0:a.A.hypot(n[1]-i[1],n[2]-i[2])}
1,setCoordinates:function(t,e,i,r){var o=this.usrCoords,n=this.scrCoords,a=[o[0],o[1],o[2]],h=[n[0],n[1],n[2]];return t===s.A.COORDS_BY_USER?(2===e.length?(o[0]=1,o[1]=e[0],o[2]=e[1]):(o[0]=e[0],o[1]=e[1],o[2]=e[2],this.normalizeUsrCoords()),this.usr2screen(i)):(2===e.length?(n[1]=e[0],n[2]=e[1]):(n[1]=e[1],n[2]=e[2]),this.screen2usr()),this.emitter&&!r&&(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])>a.A.eps},__evt__update:function(t,e){},__evt:function(){}});let h=r.A.Coords},50547:(t,e,i)=>{i.d(e,{A:()=>o});var r=i(76422),s=i(64657);r.A.Composition=function(t){var e,i=this,r=["setAttribute","setParents","prepareUpdate","updateRenderer","update","fullUpdate","highlight","noHighlight"],o=function(t){return function(){var e;for(e in i.elements)i.elements.hasOwnProperty(e)&&s.A.exists(i.elements[e][t])&&i.elements[e][t].apply(i.elements[e],arguments);return i}};for(e=0;e<r.length;e++)this[r[e]]=o(r[e]);for(e in this.elements={},this.objects=this.elements,this.elementsByName={},this.objectsList=[],this.groups={},this.methodMap={setAttribute:"setAttribute",setProperty:"setAttribute",setParents:"setParents",add:"add",remove:"remove",select:"select"},t)t.hasOwnProperty(e)&&this.add(e,t[e]);this.dump=!0,this.subs={}},r.A.extend(r.A.Composition.prototype,{add:function(t,e){return!!(!s.A.exists(this[t])&&s.A.exists(e))&&(s.A.exists(e.id)?this.elements[e.id]=e:this.elements[t]=e,s.A.exists(e.name)&&(this.elementsByName[e.name]=e),e.on("attribute:name",this.nameListener,this),this.objectsList.push(e),this[t]=e,this.methodMap[t]=e,!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(t){return s.A.exists(r.A.Board)?r.A.Board.prototype.select.call(this,t):new r.A.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}});let o=r.A.Composition},57571:(t,e,i)=>{i.d(e,{A:()=>d});var r=i(76422),s=i(97272),o=i(1006),n=i(97878),a=i(86385),h=i(46693),l=i(16100),c=i(64657);r.A.CoordsElement=function(t,e){var i;for(c.A.exists(t)||(t=[1,0,0]),i=0;i<t.length;++i)t[i]=parseFloat(t[i]);this.coords=new h.A(l.A.COORDS_BY_USER,t,this.board),this.initialCoords=new h.A(l.A.COORDS_BY_USER,t,this.board),this.actualCoords=new h.A(l.A.COORDS_BY_USER,t,this.board),this.position=null,this.isConstrained=!1,this.onPolygon=!1,this.slideObject=null,this.slideObjects=[],this.needsUpdateFromParent=!0,this.groups=[],this.Xjc=null,this.Yjc=null,this.methodMap=c.A.deepCopy(this.methodMap,{move:"moveTo",moveTo:"moveTo",moveAlong:"moveAlong",visit:"visit",glide:"makeGlider",makeGlider:"makeGlider",intersect:"makeIntersection",makeIntersection:"makeIntersection",X:"X",Y:"Y",Coords:"Coords",free:"free",setPosition:"setGliderPosition",setGliderPosition:"setGliderPosition",addConstraint:"addConstraint",dist:"Dist",Dist:"Dist",onPolygon:"onPolygon",startAnimation:"startAnimation",stopAnimation:"stopAnimation"}),c.A.exists(this.element)&&this.addAnchor(t,e),this.isDraggable=!0},r.A.extend(r.A.CoordsElement.prototype,{updateConstraint:function(){return this},updateCoords:function(t){return this.needsUpdate&&(c.A.exists(t)||(t=!1),this.evalVisProp("frozen")||this.updateConstraint(),this.type===l.A.OBJECT_TYPE_GLIDER&&(this.isConstrained&&(t=!1),t?this.updateGliderFromParent():this.updateGlider()),this.updateTransform(t)),this},updateGlider:function(){var t,e,i,r,n,a,d,u,p,f,A,m,b,g,v,y,C,_,P,x,E=2*Math.PI,S=!1,N=this.slideObject,T=[];if(this.needsUpdateFromParent=!1,N.elementClass===l.A.OBJECT_CLASS_CIRCLE)this.evalVisProp("isgeonext")&&(E=1),g=o.A.projectPointToCircle(this,N,this.board),v=o.A.rad([N.center.X()+1,N.center.Y()],N.center,this)/E;else if(N.elementClass===l.A.OBJECT_CLASS_LINE){if(this.onPolygon){if(r=N.point1.coords.usrCoords,Math.abs(e=(n=N.point2.coords.usrCoords)[t=1]-r[t])<s.A.eps&&(e=n[t=2]-r[t]),d=(o.A.projectPointToLine(this,N,this.board).usrCoords[t]-r[t])/e,a=N.parentPolygon,d<0){for(t=0;t<a.borders.length;t++)if(N===a.borders[t]){N=a.borders[(t-1+a.borders.length)%a.borders.length];break}}else if(d>1){for(t=0;t<a.borders.length;t++)if(N===a.borders[t]){N=a.borders[(t+1+a.borders.length)%a.borders.length];break}}N.id!==this.slideObject.id&&(this.slideObject=N)}r=N.point1.coords,n=N.point2.coords,(e=r.distance(l.A.COORDS_BY_USER,n))<s.A.eps?(g=r,S=!0,v=0):(g=o.A.projectPointToLine(this,N,this.board),r=r.usrCoords.slice(0),Math.abs((n=n.usrCoords.slice(0))[0])<s.A.eps?(Math.abs(e=n[t=1])<s.A.eps&&(e=n[t=2]),v=((e=(g.usrCoords[t]-r[t])/e)>=0?1:-1)*(e=Math.abs(e))/(e+1)):Math.abs(r[0])<s.A.eps?(Math.abs(e=r[t=1])<s.A.eps&&(e=r[t=2]),v=(e=(g.usrCoords[t]-n[t])/e)<0?(1-2*e)/(1-e):1/(e+1)):(Math.abs(e=n[t=1]-r[t])<s.A.eps&&(e=n[t=2]-r[t]),v=(g.usrCoords[t]-r[t])/e)),null!==(C=this.findClosestSnapValue(v))?(v=(this.evalVisProp("snapvalues")[C]-this._smin)/(this._smax-this._smin),this.update(!0)):(y=this.evalVisProp("snapwidth"))>0&&Math.abs(this._smax-this._smin)>=s.A.eps&&(v=((i=Math.round((i=(v=Math.max(Math.min(v,1),0))*(this._smax-this._smin))/y)*y+this._smin)-this._smin)/(this._smax-this._smin),this.update(!0)),r=N.point1.coords,!N.evalVisProp("straightfirst")&&Math.abs(r.usrCoords[0])>s.A.eps&&v<0&&(g=r,S=!0,v=0),n=N.point2.coords,!N.evalVisProp("straightlast")&&Math.abs(n.usrCoords[0])>s.A.eps&&v>1&&(g=n,S=!0,v=1)}else if(N.type===l.A.OBJECT_TYPE_TURTLE)this.updateConstraint(),g=(_=o.A.projectPointToTurtle(this,N,this.board))[0],v=_[1];else if(N.elementClass===l.A.OBJECT_CLASS_CURVE)if(N.type===l.A.OBJECT_TYPE_ARC||N.type===l.A.OBJECT_TYPE_SECTOR)g=o.A.projectPointToCircle(this,N,this.board),u=o.A.rad(N.radiuspoint,N.center,this),p=0,f=o.A.rad(N.radiuspoint,N.center,N.anglepoint),v=u,("minor"===(y=N.evalVisProp("selection"))&&f>Math.PI||"major"===y&&f<Math.PI)&&(p=f,f=2*Math.PI),(u<p||u>f)&&(v=f,(u<p&&u>.5*p||u>f&&u>.5*f+Math.PI)&&(v=p),this.needsUpdateFromParent=!0,this.updateGliderFromParent()),E=f-p,this.visProp.isgeonext&&(E=1),Math.abs(E)>s.A.eps&&(v/=E);else if(this.updateConstraint(),N.transformations.length>0){for(x=!1,(_=N.getTransformationSource())[0]&&(x=_[0],T.push(N),T.push(_[1]));_[0]&&c.A.exists(_[1]._transformationSource);)_=_[1].getTransformationSource(),T.push(_[1]);if(P=this.coords.usrCoords,x){for(t=0;t<T.length;t++)T[t].updateTransformMatrix(),b=s.A.inverse(T[t].transformMat),P=s.A.matVecMult(b,P);for(A=new h.A(l.A.COORDS_BY_USER,P,this.board).usrCoords,P=(m=o.A.projectCoordsToCurve(A[1],A[2],this.position||0,T[T.length-1],this.board))[0].usrCoords,t=T.length-2;t>=0;t--)P=s.A.matVecMult(T[t].transformMat,P);m[0]=new h.A(l.A.COORDS_BY_USER,P,this.board)}else N.updateTransformMatrix(),b=s.A.inverse(N.transformMat),P=s.A.matVecMult(b,P),A=new h.A(l.A.COORDS_BY_USER,P,this.board).usrCoords,m=o.A.projectCoordsToCurve(A[1],A[2],this.position||0,N,this.board);g=m[0],v=m[1]}else g=(_=o.A.projectPointToCurve(this,N,this.board))[0],v=_[1];else c.A.isPoint(N)&&(g=o.A.projectPointToPoint(this,N,this.board),v=this.position);this.coords.setCoordinates(l.A.COORDS_BY_USER,g.usrCoords,S),this.position=v},findClosestSnapValue:function(t){var e,i,r,o,n=null;if(r=this.evalVisProp("snapvalues"),o=this.evalVisProp("snapvaluedistance"),c.A.isArray(r)&&Math.abs(this._smax-this._smin)>=s.A.eps&&o>0)for(e=0;e<r.length;e++)(i=Math.abs(t*(this._smax-this._smin)+this._smin-r[e]))<o&&(o=i,n=e);return n},updateGliderFromParent:function(){var t,e,i,r,n,a,d,u,p,f,A,m,b=this.slideObject,g=[],v=2*Math.PI;if(!this.needsUpdateFromParent){this.needsUpdateFromParent=!0;return}if(b.elementClass===l.A.OBJECT_CLASS_CIRCLE)i=b.Radius(),this.evalVisProp("isgeonext")&&(v=1),n=[b.center.X()+i*Math.cos(this.position*v),b.center.Y()+i*Math.sin(this.position*v)];else if(b.elementClass===l.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]?n=[0,0,0]:Math.abs(e[0])<s.A.eps?(r=Math.min(Math.abs(this.position),1-s.A.eps),r/=1-r,this.position<0&&(r=-r),n=[t[0]+r*e[0],t[1]+r*e[1],t[2]+r*e[2]]):Math.abs(t[0])<s.A.eps?(r=(r=Math.min(r=Math.max(this.position,s.A.eps),2-s.A.eps))>1?(r-1)/(r-2):(1-r)/r,n=[e[0]+r*t[0],e[1]+r*t[1],e[2]+r*t[2]]):(r=this.position,n=[t[0]+r*(e[0]-t[0]),t[1]+r*(e[1]-t[1]),t[2]+r*(e[2]-t[2])]);else if(b.type===l.A.OBJECT_TYPE_TURTLE)this.coords.setCoordinates(l.A.COORDS_BY_USER,[b.Z(this.position),b.X(this.position),b.Y(this.position)]),this.updateConstraint(),n=o.A.projectPointToTurtle(this,b,this.board)[0].usrCoords;else if(b.elementClass===l.A.OBJECT_CLASS_CURVE){for(u=!1,(a=b.getTransformationSource())[0]&&(u=a[0],g.push(b),g.push(a[1]));a[0]&&c.A.exists(a[1]._transformationSource);
1)a=a[1].getTransformationSource(),g.push(a[1]);if(u?this.coords.setCoordinates(l.A.COORDS_BY_USER,[g[g.length-1].Z(this.position),g[g.length-1].X(this.position),g[g.length-1].Y(this.position)]):this.coords.setCoordinates(l.A.COORDS_BY_USER,[b.Z(this.position),b.X(this.position),b.Y(this.position)]),b.type===l.A.OBJECT_TYPE_ARC||b.type===l.A.OBJECT_TYPE_SECTOR)p=o.A.rad([b.center.X()+1,b.center.Y()],b.center,b.radiuspoint),f=0,m=o.A.rad(b.radiuspoint,b.center,b.anglepoint),("minor"===b.visProp.selection&&m>Math.PI||"major"===b.visProp.selection&&m<Math.PI)&&(f=m,m=2*Math.PI),v=m-f,this.evalVisProp("isgeonext")&&(v=1),((A=this.position*v)<f||A>m)&&(((A=m)<f&&A>.5*f||A>m&&A>.5*m+Math.PI)&&(A=f),this.position=A,Math.abs(v)>s.A.eps&&(this.position/=v)),i=b.Radius(),n=[b.center.X()+i*Math.cos(this.position*v+p),b.center.Y()+i*Math.sin(this.position*v+p)];else if(this.updateConstraint(),u)for(n=o.A.projectPointToCurve(this,g[g.length-1],this.board)[0].usrCoords,d=g.length-2;d>=0;d--)n=new h.A(l.A.COORDS_BY_USER,s.A.matVecMult(g[d].transformMat,n),this.board).usrCoords;else n=o.A.projectPointToCurve(this,b,this.board)[0].usrCoords}else c.A.isPoint(b)&&(n=o.A.projectPointToPoint(this,b,this.board).usrCoords);this.coords.setCoordinates(l.A.COORDS_BY_USER,n,!1)},updateRendererGeneric:function(t){return this.needsUpdate&&this.board.renderer&&(this.visPropCalc.visible&&(this.isReal=!isNaN(this.coords.usrCoords[1]+this.coords.usrCoords[2]),this.isReal=Math.abs(this.coords.usrCoords[0])>s.A.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},X:function(){return this.coords.usrCoords[1]},Y:function(){return this.coords.usrCoords[2]},Z:function(){return this.coords.usrCoords[0]},Coords:function(t){return t?this.coords.usrCoords.slice():this.coords.usrCoords.slice(1)},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(l.A.COORDS_BY_USER,t.coords):NaN},snapToGrid:function(t){return this.handleSnapToGrid(t)},handleSnapToPoints:function(t){var e,i,r,s,n,a,h,d,u=0,p=1/0,f=null,A=this.evalVisProp("ignoredsnaptopoints"),m=!1;if(s=this.board.objectsList.length,A&&(h=A.length),this.evalVisProp("snaptopoints")||t){for(e=0,n=this.evalVisProp("attractorunit"),a=this.evalVisProp("attractordistance");e<s;e++){if(i=this.board.objectsList[e],A){for(d=0,m=!1;d<h;d++)if(i===this.board.select(A[d])){m=!0;break}if(m)continue}c.A.isPoint(i)&&i!==this&&i.visPropCalc.visible&&(r=o.A.projectPointToPoint(this,i,this.board),(u="screen"===n?r.distance(l.A.COORDS_BY_SCREEN,this.coords):r.distance(l.A.COORDS_BY_USER,this.coords))<a&&u<p&&(p=u,f=r))}null!==f&&this.coords.setCoordinates(l.A.COORDS_BY_USER,f.usrCoords)}return this},snapToPoints:function(t){return this.handleSnapToPoints(t)},handleAttractors:function(){var t,e,i,r,s=0,n=this.evalVisProp("attractorunit"),a=this.evalVisProp("attractordistance"),d=this.evalVisProp("snatchdistance"),u=this.evalVisProp("attractors"),p=u.length;if(0!==a){for(t=0;t<p;t++)if(e=this.board.select(u[t]),c.A.exists(e)&&e!==this){if(c.A.isPoint(e)?i=o.A.projectPointToPoint(this,e,this.board):e.elementClass===l.A.OBJECT_CLASS_LINE?(r=o.A.projectCoordsToSegment(this.coords.usrCoords,e.point1.coords.usrCoords,e.point2.coords.usrCoords),i=!e.evalVisProp("straightfirst")&&r[1]<0?e.point1.coords:!e.evalVisProp("straightlast")&&r[1]>1?e.point2.coords:new h.A(l.A.COORDS_BY_USER,r[0],this.board)):e.elementClass===l.A.OBJECT_CLASS_CIRCLE?i=o.A.projectPointToCircle(this,e,this.board):e.elementClass===l.A.OBJECT_CLASS_CURVE?i=o.A.projectPointToCurve(this,e,this.board)[0]:e.type===l.A.OBJECT_TYPE_TURTLE?i=o.A.projectPointToTurtle(this,e,this.board)[0]:e.type===l.A.OBJECT_TYPE_POLYGON&&(i=new h.A(l.A.COORDS_BY_USER,o.A.projectCoordsToPolygon(this.coords.usrCoords,e),this.board)),(s="screen"===n?i.distance(l.A.COORDS_BY_SCREEN,this.coords):i.distance(l.A.COORDS_BY_USER,this.coords))<a){this.type===l.A.OBJECT_TYPE_GLIDER&&(e===this.slideObject||this.slideObject&&this.onPolygon&&this.slideObject.parentPolygon===e)||this.makeGlider(e);break}s>=d&&(e===this.slideObject||this.slideObject&&this.onPolygon&&this.slideObject.parentPolygon===e)&&this.popSlideObject()}return this}},setPositionDirectly:function(t,e){var i,r,o,n,c,d=this.coords;if(this.relativeCoords)return r=new h.A(t,e,this.board),this.evalVisProp("islabel")?(o=a.A.subtract(r.scrCoords,d.scrCoords),this.relativeCoords.scrCoords[1]+=o[1],this.relativeCoords.scrCoords[2]+=o[2]):(o=a.A.subtract(r.usrCoords,d.usrCoords),this.relativeCoords.usrCoords[1]+=o[1],this.relativeCoords.usrCoords[2]+=o[2]),this;
1if(this.coords.setCoordinates(t,e),this.handleSnapToGrid(),this.handleSnapToPoints(),this.handleAttractors(),this.actualCoords.setCoordinates(l.A.COORDS_BY_USER,this.coords.usrCoords),this.transformations.length>0){for(t===l.A.COORDS_BY_SCREEN?c=new h.A(t,e,this.board).usrCoords:(2===e.length&&(e=[1].concat(e)),c=e),n=[[1,0,0],[0,1,0],[0,0,1]],i=0;i<this.transformations.length;i++)n=s.A.matMatMult(this.transformations[i].matrix,n);c=s.A.matVecMult(s.A.inverse(n),c),this.initialCoords.setCoordinates(l.A.COORDS_BY_USER,c),this.elementClass!==l.A.OBJECT_CLASS_POINT&&this.coords.setCoordinates(l.A.COORDS_BY_USER,c)}return this.prepareUpdate().update(),this.board.isSuspendedUpdate&&this.type===l.A.OBJECT_TYPE_GLIDER&&this.updateGlider(),this},setPositionByTransform:function(t,e){var i;return e=new h.A(t,e,this.board),i=this.board.create("transform",e.usrCoords.slice(1),{type:"translate"}),this.transformations.length>0&&this.transformations[this.transformations.length-1].isNumericMatrix?this.transformations[this.transformations.length-1].melt(i):this.addTransform(this,i),this.prepareUpdate().update(),this},setPosition:function(t,e){return this.setPositionDirectly(t,e)},setGliderPosition:function(t){return this.type===l.A.OBJECT_TYPE_GLIDER&&(this.position=t,this.board.update()),this},makeGlider:function(t){var e,i,s,o=this.board.select(t),n=!1;if(o.type===l.A.OBJECT_TYPE_POLYGON){for(i=0,e=Number.MAX_VALUE;i<o.borders.length;i++)(s=r.A.Math.Geometry.distPointLine(this.coords.usrCoords,o.borders[i].stdform))<e&&(e=s,t=o.borders[i]);o=this.board.select(t),n=!0}if(c.A.exists(o)){if(o.type===l.A.OBJECT_TYPE_TICKS)throw Error("JSXGraph: gliders on ticks are not possible.")}else throw Error("JSXGraph: slide object undefined.");return this.slideObject=this.board.select(t),this.slideObjects.push(this.slideObject),this.addParents(t),this.type=l.A.OBJECT_TYPE_GLIDER,this.elType="glider",this.visProp.snapwidth=-1,this.slideObject.addChild(this),this.isDraggable=!0,this.onPolygon=n,this.generatePolynomial=function(){return this.slideObject.generatePolynomial(this)},this.updateGlider(),this.needsUpdateFromParent=!0,this.updateGliderFromParent(),this},popSlideObject:function(){this.slideObjects.length>0&&(this.slideObjects.pop(),this.slideObject.removeChild(this),0===this.slideObjects.length?(this.type=this._org_type,this.type===l.A.OBJECT_TYPE_POINT?this.elType="point":this.elementClass===l.A.OBJECT_CLASS_TEXT?this.elType="text":this.type===l.A.OBJECT_TYPE_IMAGE?this.elType="image":this.type===l.A.OBJECT_TYPE_FOREIGNOBJECT&&(this.elType="foreignobject"),this.slideObject=null):this.slideObject=this.slideObjects[this.slideObjects.length-1])},free:function(){var t,e;if(this.type!==l.A.OBJECT_TYPE_GLIDER){if(this.transformations.length=0,delete this.updateConstraint,this.isConstrained=!1,this.isDraggable)return;this.isDraggable=!0,this.elementClass===l.A.OBJECT_CLASS_POINT&&(this.type=l.A.OBJECT_TYPE_POINT,this.elType="point"),this.XEval=function(){return this.coords.usrCoords[1]},this.YEval=function(){return this.coords.usrCoords[2]},this.ZEval=function(){return this.coords.usrCoords[0]},this.Xjc=null,this.Yjc=null}for(t in this.board.objects)this.board.objects.hasOwnProperty(t)&&(e=this.board.objects[t]).descendants&&(delete e.descendants[this.id],delete e.childElements[this.id],this.hasLabel&&(delete e.descendants[this.label.id],delete e.childElements[this.label.id]));this.ancestors={},this.parents=[],this.slideObject=null,this.slideObjects=[],this.elementClass===l.A.OBJECT_CLASS_POINT?(this.type=l.A.OBJECT_TYPE_POINT,this.elType="point"):this.elementClass===l.A.OBJECT_CLASS_TEXT?(this.type=this._org_type,this.elType="text"):this.elementClass===l.A.OBJECT_CLASS_OTHER&&(this.type=this._org_type,this.elType="image")},addConstraint:function(t){var e,i,r=[],s=["X","Y"],o=function(t){return function(){return t}},n=function(t){return function(){return t.Value()}};for(this.elementClass===l.A.OBJECT_CLASS_POINT&&(this.type=l.A.OBJECT_TYPE_CAS),this.isDraggable=!1,e=0;e<t.length;e++)i=t[e],c.A.isString(i)?(r[e]=this.board.jc.snippet(i,!0,null,!0),this.addParentsFromJCFunctions([r[e]]),2===t.length&&(this[s[e]+"jc"]=t[e])):c.A.isFunction(i)?r[e]=i:c.A.
1isNumber(i)?r[e]=o(i):c.A.isObject(i)&&c.A.isFunction(i.Value)&&(r[e]=n(i)),r[e].origin=i;return 1===t.length?this.updateConstraint=function(){var t=r[0]();return c.A.isArray(t)?this.coords.setCoordinates(l.A.COORDS_BY_USER,t):this.coords=t,this}:2===t.length?(this.XEval=r[0],this.YEval=r[1],this.addParents([r[0].origin,r[1].origin]),this.updateConstraint=function(){return this.coords.setCoordinates(l.A.COORDS_BY_USER,[this.XEval(),this.YEval()]),this}):(this.ZEval=r[0],this.XEval=r[1],this.YEval=r[2],this.addParents([r[0].origin,r[1].origin,r[2].origin]),this.updateConstraint=function(){return this.coords.setCoordinates(l.A.COORDS_BY_USER,[this.ZEval(),this.XEval(),this.YEval()]),this}),this.isConstrained=!0,this.prepareUpdate().update(),!this.board.isSuspendedUpdate&&(this.updateVisibility().updateRenderer(),this.hasLabel&&this.label.fullUpdate()),this},addAnchor:function(t,e){e?this.relativeCoords=new h.A(l.A.COORDS_BY_SCREEN,t.slice(0,2),this.board):this.relativeCoords=new h.A(l.A.COORDS_BY_USER,t,this.board),this.element.addChild(this),e&&this.addParents(this.element),this.XEval=function(){var t,e;return this.evalVisProp("islabel")?(t=parseFloat(this.evalVisProp("offset")[0]),e=this.element.getLabelAnchor(),new h.A(l.A.COORDS_BY_SCREEN,[t+this.relativeCoords.scrCoords[1]+e.scrCoords[1],0],this.board).usrCoords[1]):(e=this.element.getTextAnchor(),this.relativeCoords.usrCoords[1]+e.usrCoords[1])},this.YEval=function(){var t,e;return this.evalVisProp("islabel")?(t=-parseFloat(this.evalVisProp("offset")[1]),e=this.element.getLabelAnchor(),new h.A(l.A.COORDS_BY_SCREEN,[0,t+this.relativeCoords.scrCoords[2]+e.scrCoords[2]],this.board).usrCoords[2]):(e=this.element.getTextAnchor(),this.relativeCoords.usrCoords[2]+e.usrCoords[2])},this.ZEval=c.A.createFunction(1,this.board,""),this.updateConstraint=function(){this.coords.setCoordinates(l.A.COORDS_BY_USER,[this.ZEval(),this.XEval(),this.YEval()])},this.isConstrained=!0,this.updateConstraint()},updateTransform:function(t){var e,i;if(0===this.transformations.length||null===this.baseElement)return this;for(this.transformations[0].update(),e=this===this.baseElement?this.transformations[0].apply(this,"self"):this.transformations[0].apply(this.baseElement),i=1;i<this.transformations.length;i++)this.transformations[i].update(),e=s.A.matVecMult(this.transformations[i].matrix,e);return this.actualCoords.setCoordinates(l.A.COORDS_BY_USER,e),this},addTransform:function(t,e){var i,r=c.A.isArray(e)?e:[e],s=r.length;for(0===this.transformations.length&&(this.baseElement=t),i=0;i<s;i++)this.transformations.push(r[i]);return this},startAnimation:function(t,e,i){var r=c.A.evaluate(t),s=c.A.evaluate(e),o=this;return i=c.A.evaluate(i)||250,this.type===l.A.OBJECT_TYPE_GLIDER&&!c.A.exists(this.intervalCode)&&(this.intervalCode=window.setInterval(function(){o._anim(r,s)},i),c.A.exists(this.intervalCount)||(this.intervalCount=0)),this},stopAnimation:function(){return c.A.exists(this.intervalCode)&&(window.clearInterval(this.intervalCode),delete this.intervalCode),this},moveAlong:function(t,e,i){i=i||{};var r,s,o,a,h,d=[],u=[],p=e/this.board.attr.animationdelay,f=function(e,i){return function(){return t[e][i]}};if(c.A.isArray(t)){for(r=0,o=t.length;r<o;r++)c.A.isPoint(t[r])?u[r]=t[r]:u[r]={elementClass:l.A.OBJECT_CLASS_POINT,X:f(r,0),Y:f(r,1)};if(0===(e=e||0))return this.setPosition(l.A.COORDS_BY_USER,[u[u.length-1].X(),u[u.length-1].Y()]),this.board.update(this);if(!c.A.exists(i.interpolate)||i.interpolate)for(r=0,s=n.A.Neville(u);r<p;r++)d[r]=[],d[r][0]=s[0]((p-r)/p*s[3]()),d[r][1]=s[1]((p-r)/p*s[3]());else{for(r=0,o=t.length-1;r<p;++r)a=Math.floor(r/p*o),h=r/p*o-a,d[r]=[],d[r][0]=(1-h)*u[a].X()+h*u[a+1].X(),d[r][1]=(1-h)*u[a].Y()+h*u[a+1].Y();d.push([u[o].X(),u[o].Y()]),d.reverse()}this.animationPath=d}else c.A.isFunction(t)&&(this.animationPath=t,this.animationStart=new Date().getTime());return this.animationCallback=i.callback,this.board.addAnimation(this),this},moveTo:function(t,e,i){i=i||{},t=new h.A(l.A.COORDS_BY_USER,t,this.board);var r,o=Math.ceil(e/this.board.attr.animationdelay),n=[],a=this.coords.usrCoords[1],d=this.coords.usrCoords[2],u=t.usrCoords[1]-a,p=t.usrCoords[2]-d,f=function(t){var e=t/o;if(i.effect){if("<>"===i.effect)return Math.pow(Math.sin(e*Math.PI/2),2);if("<"===i.effect)return e*e*e;if(">"===i.effect)return 1-Math.pow(1-e,3);if("=="===i.effect)return t/o;throw Error("valid effects are '==', '<>', '>', and '<'.")}return t/o};if(!c.A.exists(e)||0===e||Math.abs(t.usrCoords[0]-this.coords.usrCoords[0])>s.A.eps)return this.setPosition(l.A.COORDS_BY_USER,t.usrCoords),this.board.update(this);if(!c.A.exists(i.callback)&&Math.abs(u)<s.A.eps&&Math.abs(p)<s.A.eps)return this;for(r=o;r>=0;r--)n[o-r]=[t.usrCoords[0],a+u*f(r),d+p*f(r)];return this.animationPath=n,this.animationCallback=i.callback,this.board.addAnimation(this),this}
1,visit:function(t,e,i){t=new h.A(l.A.COORDS_BY_USER,t,this.board);var r,s,o,n=this.board.attr.animationdelay,a=[],d=this.coords.usrCoords[1],u=this.coords.usrCoords[2],p=t.usrCoords[1]-d,f=t.usrCoords[2]-u,A=function(t){var e=t<o/2?2*t/o:2*(o-t)/o;if(i.effect){if("<>"===i.effect)return Math.pow(Math.sin(e*Math.PI/2),2);if("<"===i.effect)return e*e*e;if(">"===i.effect)return 1-Math.pow(1-e,3);if("=="===i.effect)return e;throw Error("valid effects are '==', '<>', '>', and '<'.")}return e};for(c.A.isNumber(i)?i={repeat:i}:(i=i||{},c.A.exists(i.repeat)||(i.repeat=1)),o=Math.ceil(e/(n*i.repeat)),s=0;s<i.repeat;s++)for(r=o;r>=0;r--)a[s*(o+1)+o-r]=[t.usrCoords[0],d+p*A(r),u+f*A(r)];return this.animationPath=a,this.animationCallback=i.callback,this.board.addAnimation(this),this},moveAlongES6:function(t,e,i){return new Promise((r,s)=>{c.A.exists(i)&&c.A.exists(i.callback)?i.callback=r:i={callback:r},this.moveAlong(t,e,i)})},moveToES6:function(t,e,i){return new Promise((r,s)=>{c.A.exists(i)&&c.A.exists(i.callback)?i.callback=r:i={callback:r},this.moveTo(t,e,i)})},visitES6:function(t,e,i){return new Promise((r,s)=>{c.A.exists(i)&&c.A.exists(i.callback)?i.callback=r:i={callback:r},this.visit(t,e,i)})},_anim:function(t,e){var i,r,s,n,a,h,c,d,u;return this.intervalCount+=1,this.intervalCount>e&&(this.intervalCount=0),this.slideObject.elementClass===l.A.OBJECT_CLASS_LINE?(c=this.slideObject.point1.coords.scrCoords,i=Math.round(((d=this.slideObject.point2.coords.scrCoords)[1]-c[1])*this.intervalCount/e),r=Math.round((d[2]-c[2])*this.intervalCount/e),t>0?n=this.slideObject.point1:(n=this.slideObject.point2,i*=-1,r*=-1),this.coords.setCoordinates(l.A.COORDS_BY_SCREEN,[n.coords.scrCoords[1]+i,n.coords.scrCoords[2]+r])):this.slideObject.elementClass===l.A.OBJECT_CLASS_CURVE?(a=t>0?(this.slideObject.maxX()-this.slideObject.minX())*this.intervalCount/e+this.slideObject.minX():-(this.slideObject.maxX()-this.slideObject.minX())*this.intervalCount/e+this.slideObject.maxX(),this.coords.setCoordinates(l.A.COORDS_BY_USER,[this.slideObject.X(a),this.slideObject.Y(a)]),u=o.A.projectPointToCurve(this,this.slideObject,this.board),this.coords=u[0],this.position=u[1]):this.slideObject.elementClass===l.A.OBJECT_CLASS_CIRCLE&&(s=2*Math.PI,t<0?s*=this.intervalCount/e:s*=(e-this.intervalCount)/e,h=this.slideObject.Radius(),this.coords.setCoordinates(l.A.COORDS_BY_USER,[this.slideObject.center.coords.usrCoords[1]+h*Math.cos(s),this.slideObject.center.coords.usrCoords[2]+h*Math.sin(s)])),this.board.update(this),this},getTextAnchor:function(){return this.coords},getLabelAnchor:function(){return this.coords},getParents:function(){var t=[this.Z(),this.X(),this.Y()];return 0!==this.parents.length&&(t=this.parents),this.type===l.A.OBJECT_TYPE_GLIDER&&(t=[this.X(),this.Y(),this.slideObject.id]),t}}),r.A.CoordsElement.create=function(t,e,i,r,s,o){var n,a,h=!1;for(a=0;a<i.length;a++)(c.A.isFunction(i[a])||c.A.isString(i[a]))&&(h=!0);if(h)(n=new t(e,[0,0],r,s,o)).addConstraint(i);else if(c.A.isNumber(i[0])&&c.A.isNumber(i[1]))n=new t(e,i,r,s,o),c.A.exists(r.slideobject)?n.makeGlider(r.slideobject):n.baseElement=n,n.isDraggable=!0;else{if(!(c.A.isObject(i[0])&&c.A.isTransformationOrArray(i[1])))return!1;(n=new t(e,[0,0],r,s,o)).addTransform(i[0],i[1]),n.isDraggable=!1}return n.handleSnapToGrid(),n.handleSnapToPoints(),n.handleAttractors(),n.addParents(i),n};let d=r.A.CoordsElement},63640:(t,e,i)=>{i.d(e,{A:()=>h});var r=i(76422),s=i(97272),o=i(64657);r.A.Math.DoubleBits=function(){var t,e,i,r,s,o,n,a,h=new Float64Array(1),l=new Uint32Array(h.buffer);void 0!==Float64Array&&(h[0]=1,0x3ff00000===l[1]?(t=function(t){return h[0]=t,[l[0],l[1]]},e=function(t,e){return l[0]=t,l[1]=e,h[0]},i=function(t){return h[0]=t,l[0]},r=function(t){return h[0]=t,l[1]},this.doubleBits=t,this.pack=e,this.lo=i,this.hi=r):0x3ff00000===l[0]&&(s=function(t){return h[0]=t,[l[1],l[0]]},o=function(t,e){return l[1]=t,l[0]=e,h[0]},n=function(t){return h[0]=t,l[1]},a=function(t){return h[0]=t,l[0]},this.doubleBits=s,this.pack=o,this.lo=n,this.hi=a))},r.A.extend(r.A.Math.DoubleBits.prototype,{sign:function(t){return this.hi(t)>>>31},exponent:function(t){return(this.hi(t)<<1>>>21)-1023},fraction:function(t){var e=this.lo(t),i=this.hi(t),r=1048575&i;
1return 0x7ff00000&i&&(r+=1048576),[e,r]},denormalized:function(t){return!(0x7ff00000&this.hi(t))}});var n=new r.A.Math.DoubleBits,a=function(t,e){if(void 0!==t&&void 0!==e){if(s.A.IntervalArithmetic.isInterval(t)){if(!s.A.IntervalArithmetic.isSingleton(t))throw TypeError("JXG.Math.IntervalArithmetic: interval `lo` must be a singleton");this.lo=t.lo}else this.lo=t;if(s.A.IntervalArithmetic.isInterval(e)){if(!s.A.IntervalArithmetic.isSingleton(e))throw TypeError("JXG.Math.IntervalArithmetic: interval `hi` must be a singleton");this.hi=e.hi}else this.hi=e}else{if(void 0!==t)return Array.isArray(t)?new a(t[0],t[1]):new a(t,t);this.lo=this.hi=0}};r.A.extend(a.prototype,{print:function(){console.log("[",this.lo,this.hi,"]")},set:function(t,e){return this.lo=t,this.hi=e,this},bounded:function(t,e){return this.set(s.A.IntervalArithmetic.prev(t),s.A.IntervalArithmetic.next(e))},boundedSingleton:function(t){return this.bounded(t,t)},assign:function(t,e){if("number"!=typeof t||"number"!=typeof e)throw TypeError("JXG.Math.Interval#assign: arguments must be numbers");return isNaN(t)||isNaN(e)||t>e?this.setEmpty():this.set(t,e)},setEmpty:function(){return this.set(1/0,-1/0)},setWhole:function(){return this.set(-1/0,1/0)},open:function(t,e){return this.assign(s.A.IntervalArithmetic.next(t),s.A.IntervalArithmetic.prev(e))},halfOpenLeft:function(t,e){return this.assign(s.A.IntervalArithmetic.next(t),e)},halfOpenRight:function(t,e){return this.assign(t,s.A.IntervalArithmetic.prev(e))},toArray:function(){return[this.lo,this.hi]},clone:function(){return new a().set(this.lo,this.hi)}}),r.A.Math.IntervalArithmetic={Interval:function(t,e){return new a(t,e)},isInterval:function(t){return null!==t&&"object"==typeof t&&"number"==typeof t.lo&&"number"==typeof t.hi},isSingleton:function(t){return t.lo===t.hi},add:function(t,e){return o.A.isNumber(t)&&(t=this.Interval(t)),o.A.isNumber(e)&&(e=this.Interval(e)),new a(this.addLo(t.lo,e.lo),this.addHi(t.hi,e.hi))},sub:function(t,e){return o.A.isNumber(t)&&(t=this.Interval(t)),o.A.isNumber(e)&&(e=this.Interval(e)),new a(this.subLo(t.lo,e.hi),this.subHi(t.hi,e.lo))},mul:function(t,e){var i,r,s,n,h;return(o.A.isNumber(t)&&(t=this.Interval(t)),o.A.isNumber(e)&&(e=this.Interval(e)),this.isEmpty(t)||this.isEmpty(e))?this.EMPTY.clone():(i=t.lo,r=t.hi,s=e.lo,n=e.hi,h=new a,i<0?r>0?s<0?n>0?(h.lo=Math.min(this.mulLo(i,n),this.mulLo(r,s)),h.hi=Math.max(this.mulHi(i,s),this.mulHi(r,n))):(h.lo=this.mulLo(r,s),h.hi=this.mulHi(i,s)):n>0?(h.lo=this.mulLo(i,n),h.hi=this.mulHi(r,n)):(h.lo=0,h.hi=0):s<0?(n>0?h.lo=this.mulLo(i,n):h.lo=this.mulLo(r,n),h.hi=this.mulHi(i,s)):n>0?(h.lo=this.mulLo(i,n),h.hi=this.mulHi(r,s)):(h.lo=0,h.hi=0):r>0?s<0?n>0?(h.lo=this.mulLo(r,s),h.hi=this.mulHi(r,n)):(h.lo=this.mulLo(r,s),h.hi=this.mulHi(i,n)):n>0?(h.lo=this.mulLo(i,s),h.hi=this.mulHi(r,n)):(h.lo=0,h.hi=0):(h.lo=0,h.hi=0),h)},div:function(t,e){if(o.A.isNumber(t)&&(t=this.Interval(t)),o.A.isNumber(e)&&(e=this.Interval(e)),this.isEmpty(t)||this.isEmpty(e))return this.EMPTY.clone();if(this.zeroIn(e))return 0!==e.lo?0!==e.hi?this.divZero(t):this.divNegative(t,e.lo):0!==e.hi?this.divPositive(t,e.hi):this.EMPTY.clone();return this.divNonZero(t,e)},positive:function(t){return new a(t.lo,t.hi)},negative:function(t){return o.A.isNumber(t)?new a(-t):new a(-t.hi,-t.lo)},isEmpty:function(t){return t.lo>t.hi},isWhole:function(t){return t.lo===-1/0&&t.hi===1/0},zeroIn:function(t){return this.hasValue(t,0)},hasValue:function(t,e){return!this.isEmpty(t)&&t.lo<=e&&e<=t.hi},hasInterval:function(t,e){return!!this.isEmpty(t)||!this.isEmpty(e)&&e.lo<=t.lo&&t.hi<=e.hi},intervalsOverlap:function(t,e){return!(this.isEmpty(t)||this.isEmpty(e))&&(t.lo<=e.lo&&e.lo<=t.hi||e.lo<=t.lo&&t.lo<=e.hi)},divNonZero:function(t,e){var i=t.lo,r=t.hi,s=e.lo,o=e.hi,n=new a;return r<0?o<0?(n.lo=this.divLo(r,s),n.hi=this.divHi(i,o)):(n.lo=this.divLo(i,s),n.hi=this.divHi(r,o)):i<0?o<0?(n.lo=this.divLo(r,o),n.hi=this.divHi(i,o)):(n.lo=this.divLo(i,s),n.hi=this.divHi(r,s)):o<0?(n.lo=this.divLo(r,o),n.hi=this.divHi(i,s)):(n.lo=this.divLo(i,o),n.hi=this.divHi(r,s)),n},divPositive:function(t,e){return 0===t.lo&&0===t.hi?t:this.zeroIn(t)?this.WHOLE:t.hi<0?new a(-1/0,this.divHi(t.hi,e)):new a(this.divLo(t.lo,e),1/0)},divNegative:function(t,e){return 0===t.lo&&0===t.hi?t:this.zeroIn(t)?this.WHOLE:t.hi<0?new a(this.divLo(t.hi,e),1
1/0):new a(-1/0,this.divHi(t.lo,e))},divZero:function(t){return 0===t.lo&&0===t.hi?t:this.WHOLE},fmod:function(t,e){var i,r;return(o.A.isNumber(t)&&(t=this.Interval(t)),o.A.isNumber(e)&&(e=this.Interval(e)),this.isEmpty(t)||this.isEmpty(e))?this.EMPTY.clone():(i=t.lo<0?e.lo:e.hi,r=(r=t.lo/i)<0?Math.ceil(r):Math.floor(r),this.sub(t,this.mul(e,new a(r))))},multiplicativeInverse:function(t){if(o.A.isNumber(t)&&(t=this.Interval(t)),this.isEmpty(t))return this.EMPTY.clone();if(this.zeroIn(t))return 0!==t.lo?0!==t.hi?this.WHOLE:new a(-1/0,this.divHi(1,t.lo)):0!==t.hi?new a(this.divLo(1,t.hi),1/0):this.EMPTY.clone();return new a(this.divLo(1,t.hi),this.divHi(1,t.lo))},pow:function(t,e){var i,r;if(o.A.isNumber(t)&&(t=this.Interval(t)),this.isEmpty(t))return this.EMPTY.clone();if(this.isInterval(e)){if(!this.isSingleton(e))return this.EMPTY.clone();e=e.lo}if(0===e)return 0===t.lo&&0===t.hi?this.EMPTY.clone():this.ONE.clone();if(e<0)return this.pow(this.multiplicativeInverse(t),-e);if(e%1==0)return t.hi<0?(i=this.powLo(-t.hi,e),r=this.powHi(-t.lo,e),(1&e)==1)?new a(-r,-i):new a(i,r):t.lo<0?(1&e)==1?new a(-this.powLo(-t.lo,e),this.powHi(t.hi,e)):new a(0,this.powHi(Math.max(-t.lo,t.hi),e)):new a(this.powLo(t.lo,e),this.powHi(t.hi,e));return console.warn("power is not an integer, you should use nth-root instead, returning an empty interval"),this.EMPTY.clone()},sqrt:function(t){return o.A.isNumber(t)&&(t=this.Interval(t)),this.nthRoot(t,2)},nthRoot:function(t,e){var i,r;if(o.A.isNumber(t)&&(t=this.Interval(t)),this.isEmpty(t)||e<0)return this.EMPTY.clone();if(this.isInterval(e)){if(!this.isSingleton(e))return this.EMPTY.clone();e=e.lo}return(i=1/e,t.hi<0)?e%1==0&&(1&e)==1?new a(-this.powHi(-t.lo,i),-this.powLo(-t.hi,i)):this.EMPTY.clone():t.lo<0?(r=this.powHi(t.hi,i),e%1==0&&(1&e)==1)?new a(-this.powHi(-t.lo,i),r):new a(0,r):new a(this.powLo(t.lo,i),this.powHi(t.hi,i))},exp:function(t){return(o.A.isNumber(t)&&(t=this.Interval(t)),this.isEmpty(t))?this.EMPTY.clone():new a(this.expLo(t.lo),this.expHi(t.hi))},log:function(t){return(o.A.isNumber(t)&&(t=this.Interval(t)),this.isEmpty(t))?this.EMPTY.clone():new a(t.lo<=0?-1/0:this.logLo(t.lo),this.logHi(t.hi))},ln:function(t){return this.log(t)},log10:function(t){return this.isEmpty(t)?this.EMPTY.clone():this.div(this.log(t),this.log(new a(10,10)))},log2:function(t){return this.isEmpty(t)?this.EMPTY.clone():this.div(this.log(t),this.log(new a(2,2)))},hull:function(t,e){var i=this.isEmpty(t),r=this.isEmpty(e);return i&&r?this.EMPTY.clone():i?e.clone():r?t.clone():new a(Math.min(t.lo,e.lo),Math.max(t.hi,e.hi))},intersection:function(t,e){var i,r;return this.isEmpty(t)||this.isEmpty(e)?this.EMPTY.clone():(i=Math.max(t.lo,e.lo))<=(r=Math.min(t.hi,e.hi))?new a(i,r):this.EMPTY.clone()},union:function(t,e){if(!this.intervalsOverlap(t,e))throw Error("Interval#unions do not overlap");return new a(Math.min(t.lo,e.lo),Math.max(t.hi,e.hi))},difference:function(t,e){if(this.isEmpty(t)||this.isWhole(e))return this.EMPTY.clone();if(this.intervalsOverlap(t,e)){if(t.lo<e.lo&&e.hi<t.hi)throw Error("Interval.difference: difference creates multiple intervals");return e.lo<=t.lo&&e.hi===1/0||e.hi>=t.hi&&e.lo===-1/0?this.EMPTY.clone():e.lo<=t.lo?new a().halfOpenLeft(e.hi,t.hi):new a().halfOpenRight(t.lo,e.lo)}return t.clone()},width:function(t){return this.isEmpty(t)?0:this.subHi(t.hi,t.lo)},abs:function(t){return(o.A.isNumber(t)&&(t=this.Interval(t)),this.isEmpty(t))?this.EMPTY.clone():t.lo>=0?t.clone():t.hi<=0?this.negative(t):new a(0,Math.max(-t.lo,t.hi))},max:function(t,e){var i=this.isEmpty(t),r=this.isEmpty(e);return i&&r?this.EMPTY.clone():i?e.clone():r?t.clone():new a(Math.max(t.lo,e.lo),Math.max(t.hi,e.hi))},min:function(t,e){var i=this.isEmpty(t),r=this.isEmpty(e);return i&&r?this.EMPTY.clone():i?e.clone():r?t.clone():new a(Math.min(t.lo,e.lo),Math.min(t.hi,e.hi))},onlyInfinity:function(t){return!isFinite(t.lo)&&t.lo===t.hi},_handleNegative:function(t){var e;return t.lo<0&&(t.lo===-1/0?(t.lo=0,t.hi=1/0):(e=Math.ceil(-t.lo/this.piTwiceLow),t.lo+=this.piTwiceLow*e,t.hi+=this.piTwiceLow*e)),t},cos:function(t){var e,i,r,s,o,n,h,l;return this.isEmpty(t)||this.onlyInfinity(t)?this.EMPTY.clone():(e=new a().set(t.lo,t.hi),this._handleNegative(e),i=this.PI_TWICE,r=this.fmod(e,i),this.width(r)>=i.lo)?new a(-1,1):r.lo>=this.piHigh?(s=this.cos(this.sub(r,this.PI)),this.negative(s)):(o=r.lo,n=r.hi,h=this.cosLo(n),l=this.cosHi(o),n<=this.piLow)?new a(h,l):n<=i.lo?new a(-1,Math.max(h,l)):new a(-1,1)},sin:function(t){return this.isEmpty(t)||this.onlyInfinity(t)?this.EMPTY.clone():this.cos(this.sub(t,this.PI_HALF))},tan:function(t){var e,i,r;return this.isEmpty(t)||this.onlyInfinity(t)?this.EMPTY.clone():(e=new a().set(t.lo,t.hi),this._handleNegative(e),r=this.PI,(i=this.fmod(e,r)).lo>=this.piHalfLow&&(i=this.sub(i,r)),i.lo<=-this.piHalfLow||i.hi>=this.piHalfLow)?this.WHOLE.clone():new a(this.tanLo(i.lo),this.tanHi(i.hi))},asin:function(t){return this.isEmpty(t)||t.hi<-1||t.lo>1?this.EMPTY.clone():new a(t.lo<=-1?-this.piHalfHigh:this.asinLo(t.lo),t.hi>=1?this.piHalfHigh:this.asinHi(t.hi))},acos:function(t){return this.isEmpty(t)||t.hi<-1||t.lo>1?this.EMPTY.clone():new a(t.hi>=1?0:this.acosLo(t.hi),t.lo<=-1?this.piHigh:this.acosHi(t.lo))},acot:function(t){return this.isEmpty(t)?this.EMPTY.clone():new a(this.acotLo(t.lo),this.acotHi(t.hi))},atan:function(t){return this.isEmpty(t)?this.EMPTY.clone():new a(this.atanLo(t.lo),this.atanHi(t.hi))},sinh:function(t){return this.isEmpty(t)?this.EMPTY.clone():new a(this.sinhLo(t.lo),this.sinhHi(t.hi))},cosh:function(t){return this.isEmpty(t)?this.EMPTY.clone():t.hi<0?new a(this.coshLo(t.hi),this.coshHi(t.lo)):t.lo>=0?new a(this.coshLo(t.lo),this.coshHi(t.hi)):new a(1,this.coshHi(-t.lo>t.hi?t.lo:t.hi))},tanh:function(t){return this.isEmpty(t)?this.EMPTY.clone():new a(this.tanhLo(t.lo),this.tanhHi(t.hi))},equal:function(t,e){return this.isEmpty(t)?this.isEmpty(e):!this.isEmpty(e)&&t.lo===e.lo&&t.hi===e.hi},notEqual:function(t,e){return this.isEmpty(t)?!this.isEmpty(e):this.isEmpty(e)||t.hi<e.lo||t.lo>e.hi},lt:function(t,e){return o.A.isNumber(t)&&(t=this.Interval(t)),o.A.isNumber(e)&&(e=this.Interval(e)),!(this.isEmpty(t)||this.isEmpty(e))&&t.hi<e.lo},gt:function(t,e){return o.A.isNumber(t)&&(t=this.Interval(t)),o.A.isNumber(e)&&(e=this.Interval(e)),!(this.isEmpty(t)||this.isEmpty(e))&&t.lo>e.hi},leq:function(t,e){return o.A.isNumber(t)&&(t=this.Interval(t)),o.A.isNumber(e)&&(e=this.Interval(e)),!(this.isEmpty(t)||this.isEmpty(e))&&t.hi<=e.lo},geq:function(t,e){return o.A.isNumber(t)&&(t=this.Interval(t)),o.A.isNumber(e)&&(e=this.Interval(e)),!(this.isEmpty(t)||this.isEmpty(e))&&t.lo>=e.hi},piLow:(0xc90fdaa2+273688/2097152)/0x40000000,piHigh:(0xc90fdaa2+273689/2097152)/0x40000000,piHalfLow:(0xc90fdaa2+273688/2097152)/0x40000000*.5,piHalfHigh:(0xc90fdaa2+273689/2097152)/0x40000000*.5,piTwiceLow:(0xc90fdaa2+273688/2097152)/0x40000000*2,piTwiceHigh:(0xc90fdaa2+273689/2097152)/0x40000000*2,identity:function(t){return t},_prev:function(t){return t===1/0?t:this.nextafter(t,-1/0)},_next:function(t){return t===-1/0?t:this.nextafter(t,1/0)},prev:function(t){return this._prev(t)},next:function(t){return this._next(t)},toInteger:function(t){return t<0?Math.ceil(t):Math.floor(t)},addLo:function(t,e){return this.prev(t+e)},addHi:function(t,e){return this.next(t+e)},subLo:function(t,e){return this.prev(t-e)},subHi:function(t,e){return this.next(t-e)},mulLo:function(t,e){return this.prev(t*e)},mulHi:function(t,e){return this.next(t*e)},divLo:function(t,e){return this.prev(t/e)},divHi:function(t,e){return this.next(t/e)},intLo:function(t){return this.toInteger(this.prev(t))},intHi:function(t){return this.toInteger(this.next(t))},logLo:function(t){return this.prev(Math.log(t))},logHi:function(t){return this.next(Math.log(t))},expLo:function(t){return this.prev(Math.exp(t))},expHi:function(t){return this.next(Math.exp(t))},sinLo:function(t){return this.prev(Math.sin(t))},sinHi:function(t){return this.next(Math.sin(t))},cosLo:function(t){return this.prev(Math.cos(t))},cosHi:function(t){return this.next(Math.cos(t))},tanLo:function(t){return this.prev(Math.tan(t))},tanHi:function(t){return this.next(Math.tan(t))},asinLo:function(t){return this.prev(Math.asin(t))},asinHi:function(t){return this.next(Math.asin(t))},acosLo:function(t){return this.prev(Math.acos(t))},acosHi:function(t){return this.next(Math.acos(t))},acotLo:function(t){return this.prev(s.A.acot(t))},acotHi:function(t){return this.next(s.A.acot(t))},atanLo:function(t){return this.prev(Math.atan(t))},atanHi:function(t){return this.next(Math.atan(t))},sinhLo:function(t){return this.prev(s.A.sinh(t))},sinhHi:function(t){return this.next(s.A.sinh(t))},coshLo:function(t){return this.prev(s.A.cosh(t))},coshHi:function(t){return this.next(s.A.cosh(t))},tanhLo:function(t){return this.prev(s.A.tanh(t))},tanhHi:function(t){return this.next(s.A.tanh(t))},sqrtLo:function(t){return this.prev(Math.sqrt(t))},sqrtHi:function(t){return this.next(Math.sqrt(t))},powLo:function(t,e){var i;if(e%1!=0)return this.prev(Math.pow(t,e));for(i=(1&e)==1?t:1,e>>=1;e>0;)t=this.mulLo(t,t),(1&e)==1&&(i=this.mulLo(t,i)),e>>=1;return i},powHi:function(t,e){var i;if(e%1!=0)return this.next(Math.pow(t,e));for(i=(1&e)==1?t:1,e>>=1;e>0;)t=this.mulHi(t,t),(1&e)==1&&(i=this.mulHi(t,i)),e>>=1;return i},disable:function(){this.next=this.prev=this.identity},enable:function(){this.prev=function(t){return this._prev(t)},this.next=function(t){return this._next(t)}},SMALLEST_DENORM:5e-324,UINT_MAX:0xffffffff,nextafter:function(t,e){var i,r;return isNaN(t)||isNaN(e)?NaN:t===e?t:0===t?e<0?-this.SMALLEST_DENORM:this.SMALLEST_DENORM:(r=n.hi(t),i=n.lo(t),e>t==t>0?i===this.UINT_MAX?(r+=1,i=0):i+=1:0===i?(i=this.UINT_MAX,r-=1):i-=1,n.pack(i,r))}},r.A.Math.IntervalArithmetic.PI=new a(s.A.IntervalArithmetic.piLow,s.A.IntervalArithmetic.piHigh),r.A.Math.IntervalArithmetic.PI_HALF=new a(s.A.IntervalArithmetic.piHalfLow,s.A.IntervalArithmetic.piHalfHigh),r.A.Math.IntervalArithmetic.PI_TWICE=new a(s.A.IntervalArithmetic.piTwiceLow,s.A.IntervalArithmetic.piTwiceHigh),r.A.Math.IntervalArithmetic.ZERO=new a(0),r.A.Math.IntervalArithmetic.ONE=new a(1),r.A.Math.IntervalArithmetic.WHOLE=new a().setWhole(),r.A.Math.IntervalArithmetic.EMPTY=ne
1w a().setEmpty();let h=r.A.Math.IntervalArithmetic},64657:(t,e,i)=>{i.d(e,{A:()=>n});var r=i(76422),s=i(16100),o=i(97272);r.A.extend(r.A,{isBoard:function(t){return null!==t&&"object"==typeof t&&this.isNumber(t.BOARD_MODE_NONE)&&this.isObject(t.objects)&&this.isObject(t.jc)&&this.isFunction(t.update)&&!!t.containerObj&&this.isString(t.id)},isId:function(t,e){return"string"==typeof e&&!!t.objects[e]},isName:function(t,e){return"string"==typeof e&&!!t.elementsByName[e]},isGroup:function(t,e){return"string"==typeof e&&!!t.groups[e]},isString:function(t){return"string"==typeof t},isNumber:function(t,e,i){var r="number"==typeof t||"[Object Number]"===Object.prototype.toString.call(t);return i=void 0===i||i,(e=e||!1)&&(r=r||""+parseFloat(t)===t),i||(r=r&&!isNaN(t)),r},isFunction:function(t){return"function"==typeof t},isArray:function(t){return Array.isArray?Array.isArray(t):null!==t&&"object"==typeof t&&"function"==typeof t.splice&&"function"==typeof t.join},isObject:function(t){return"object"==typeof t&&!this.isArray(t)},isDocumentOrFragment:function(t){return this.isObject(t)&&(9===t.nodeType||11===t.nodeType)},isPoint:function(t){return!!(null!==t&&"object"==typeof t&&this.exists(t.elementClass))&&t.elementClass===s.A.OBJECT_CLASS_POINT},isPoint3D:function(t){return!!(null!==t&&"object"==typeof t&&this.exists(t.type))&&t.type===s.A.OBJECT_TYPE_POINT3D},isPointType:function(t,e){var i,r;return!!(this.isArray(e)||this.isFunction(e)&&(i=e(),this.isArray(i)&&i.length>1))||(r=t.select(e),this.isPoint(r))},isPointType3D:function(t,e){var i,r;return!!(this.isArray(e)&&e.length>=3||this.isFunction(e)&&(i=e(),this.isArray(i)&&i.length>=3))||(r=t.select(e),this.isPoint3D(r))},isTransformationOrArray:function(t){if(null!==t){if(this.isArray(t)&&t.length>0)return this.isTransformationOrArray(t[0]);if("object"==typeof t)return t.type===s.A.OBJECT_TYPE_TRANSFORMATION}return!1},isEmpty:function(t){return 0===Object.keys(t).length},exists:function(t,e){var i=void 0!=t&&null!==t;return(e=e||!1)?i&&""!==t:i},def:function(t,e){return this.exists(t)?t:e},str2Bool:function(t){return!this.exists(t)||("boolean"==typeof t?t:!!this.isString(t)&&"true"===t.toLowerCase())},cssParse:function(t){var e=t;return this.isString(e)?JSON.parse(e='{"'+(e=(e=(e=(e=e.replace(/\s*;\s*$/g,"")).replace(/\s*;\s*/g,'","')).replace(/\s*:\s*/g,'":"')).trim())+'"}'):{}},cssStringify:function(t){var e,i,r="";if(!this.isObject(t))return"";for(e in t)t.hasOwnProperty(e)&&(i=t[e],(this.isString(i)||this.isNumber(i))&&(r+=e+":"+i+"; "));return r.trim()},createEvalFunction:function(t,e,i){var r,s,o,n=[],a={};for(s=0;s<i;s++)for(o in n[s]=this.createFunction(e[s],t),n[s].deps)a[o]=n[s].deps;return(r=function(t){return n[t]()}).deps=a,r},createFunction:function(t,e,i,r){var s=null;return this.isString(t)?s=e.jc.snippet(t,!0,i,!1):this.isFunction(t)?(s=t).deps=this.isObject(t.deps)?t.deps:{}:(this.isNumber(t)||this.isArray(t))&&((s=function(){return t}).deps={}),null!==s&&(s.origin=t),s},providePoints:function(t,e,i,r,s){var o,n,a,h,l,c=0,d=[];for(this.isArray(e)||(e=[e]),a=e.length,this.exists(s)&&(c=s.length),0===c&&(h=this.copyAttributes(i,t.options,r)),o=0;o<a;++o)if(c>0&&(n=Math.min(o,c-1),h=this.copyAttributes(i,t.options,r,s[n].toLowerCase())),this.isArray(e[o])&&e[o].length>1?(d.push(t.create("point",e[o],h)),d[d.length-1]._is_new=!0):this.isFunction(e[o])?(l=e[o](),this.isArray(l)&&l.length>1&&(d.push(t.create("point",[e[o]],h)),d[d.length-1]._is_new=!0)):d.push(t.select(e[o])),!this.isPoint(d[o]))return!1;return d},providePoints3D:function(t,e,i,r,s){var o,n,a,h,l,c=0,d=[];for(this.isArray(e)||(e=[e]),a=e.length,this.exists(s)&&(c=s.length),0===c&&(h=this.copyAttributes(i,t.board.options,r)),o=0;o<a;++o){if(c>0&&(n=Math.min(o,c-1),h=this.copyAttributes(i,t.board.options,r,s[n])),this.isArray(e[o])&&e[o].length>0&&e[o].every(t=>this.isArray(t)&&this.isNumber(t[0])))for(n=0;n<e[o].length;n++)d.push(t.create("point3d",e[o][n],h)),d[d.length-1]._is_new=!0;else this.isArray(e[o])&&e[o].every(t=>this.isNumber(t)||this.isFunction(t))?(d.push(t.create("point3d",e[o],h)),d[d.length-1]._is_new=!0):this.isPoint3D(e[o])?d.push(e[o]):this.isFunction(e[o])?(l=e[o](),this.isArray(l)&&l.length>1&&(d.push(t.create("point3d",[e[o]],h)),d[d.length-1]._is_new=!0)):d.push(t.select(e[o]));if(!this.isPoint3D(d[o]))return!1}return d},bind:function(t,e){return function(){return t.apply(e,arguments)}},evaluate:function(t){return this.isFunction(t)?t():t}
1,indexOf:function(t,e,i){var r,s=this.exists(i);if(Array.indexOf&&!s)return t.indexOf(e);for(r=0;r<t.length;r++)if(s&&t[r][i]===e||!s&&t[r]===e)return r;return -1},eliminateDuplicates:function(t){var e,i=t.length,r=[],s={};for(e=0;e<i;e++)s[t[e]]=0;for(e in s)s.hasOwnProperty(e)&&r.push(e);return r},swap:function(t,e,i){var r;return r=t[e],t[e]=t[i],t[i]=r,t},uniqueArray:function(t){var e,i,s,o=[];if(0===t.length)return[];for(e=0;e<t.length;e++){if(s=this.isArray(t[e]),!this.exists(t[e])){t[e]="";continue}for(i=e+1;i<t.length;i++)s&&r.A.cmpArrays(t[e],t[i])?t[e]=[]:s||t[e]!==t[i]||(t[e]="")}for(e=0,i=0;e<t.length;e++)(s=this.isArray(t[e]))||""===t[e]?s&&0!==t[e].length&&(o[i]=t[e].slice(0),i++):(o[i]=t[e],i++);return t=o,o},isInArray:function(t,e){return r.A.indexOf(t,e)>-1},coordsArrayToMatrix:function(t,e){var i,r=[],s=[];for(i=0;i<t.length;i++)e?(r.push(t[i].usrCoords[1]),s.push(t[i].usrCoords[2])):s.push([t[i].usrCoords[1],t[i].usrCoords[2]]);return e&&(s=[r,s]),s},cmpArrays:function(t,e){var i;if(t===e)return!0;if(t.length!==e.length)return!1;for(i=0;i<t.length;i++)if(this.isArray(t[i])&&this.isArray(e[i])){if(!this.cmpArrays(t[i],e[i]))return!1}else if(t[i]!==e[i])return!1;return!0},removeElementFromArray:function(t,e){var i;for(i=0;i<t.length;i++)if(t[i]===e){t.splice(i,1);break}return t},trunc:function(t,e){return e=r.A.def(e,0),this.toFixed(t,e)},_decimalAdjust:function(t,e,i){return void 0===i||0==+i?Math[t](e):(i*=1,isNaN(e*=1)||"number"!=typeof i||i%1!=0)?NaN:+((e=(e=Math[t](+((e=e.toString().split("e"))[0]+"e"+(e[1]?e[1]-i:-i)))).toString().split("e"))[0]+"e"+(e[1]?+e[1]+i:i))},_round10:function(t,e){return this._decimalAdjust("round",t,e)},_floor10:function(t,e){return this._decimalAdjust("floor",t,e)},_ceil10:function(t,e){return this._decimalAdjust("ceil",t,e)},toFixed:function(t,e){return this._round10(t,-e).toFixed(e)},autoDigits:function(t){var e=Math.abs(t);return e>=.1?this.toFixed(t,2):e>=.01?this.toFixed(t,4):e>=1e-4?this.toFixed(t,6):t},parseNumber:function(t,e,i){var r;return this.isString(t)&&t.indexOf("%")>-1?parseFloat(r=t.replace(/\s+%\s+/,""))*e*.01:this.isString(t)&&t.indexOf("fr")>-1?parseFloat(r=t.replace(/\s+fr\s+/,""))*e:this.isString(t)&&t.indexOf("px")>-1?(r=parseFloat(r=t.replace(/\s+px\s+/,"")),this.isFunction(i))?i(r):this.isNumber(i)?r*i:r:parseFloat(t)},parsePosition:function(t){var e,i,r="",s="";if(""!==(t=t.trim()))for(i=0,e=t.split(/[ ,]+/);i<e.length;i++)"left"===e[i]||"right"===e[i]?r=e[i]:s=e[i];return{side:r,pos:s}},keys:function(t,e){var i,r=[];for(i in t)e?t.hasOwnProperty(i)&&r.push(i):r.push(i);return r},clone:function(t){var e={};return e.prototype=t,e},cloneAndCopy:function(t,e){var i,r=function(){};for(i in r.prototype=t,e)r[i]=e[i];return r},merge:function(t,e){var i,r,s,o;for(i in e)if(e.hasOwnProperty(i))if(s=e[i],this.isArray(s))for(t[i]||(t[i]=[]),r=0;r<s.length;r++)o=e[i][r],"object"==typeof e[i][r]?t[i][r]=this.merge(t[i][r],o):t[i][r]=e[i][r];else"object"==typeof s?(t[i]||(t[i]={}),t[i]=this.merge(t[i],s)):("boolean"==typeof t&&(t={}),t[i]=s);return t},deepCopy:function(t,e,i){var r,s,o,n;if(i=i||!1,"object"!=typeof t||null===t)return t;if(this.isArray(t))for(s=0,r=[];s<t.length;s++)null!==(o=t[s])&&"object"==typeof o?this.exists(o.board)?r[s]=o.id:r[s]=this.deepCopy(o,{},i):r[s]=o;else{for(s in r={},t)t.hasOwnProperty(s)&&(n=i?s.toLowerCase():s,null!==(o=t[s])&&"object"==typeof o?this.exists(o.board)?r[n]=o.id:r[n]=this.deepCopy(o,{},i):r[n]=o);for(s in e)e.hasOwnProperty(s)&&(n=i?s.toLowerCase():s,null!==(o=e[s])&&"object"==typeof o?this.isArray(o)||!this.exists(r[n])?r[n]=this.deepCopy(o,{},i):r[n]=this.deepCopy(r[n],o,i):r[n]=o)}return r},mergeAttr:function(t,e,i,r){var s,o,n;for(s in i=i||!0,r=r||!1,e)e.hasOwnProperty(s)&&((o=i?s.toLowerCase():s)!==s&&t.hasOwnProperty(s)&&(t.hasOwnProperty(o)?this.mergeAttr(t[o],t[s],i):t[o]=t[s],delete t[s]),n=e[s],!this.isObject(n)||null===n||this.isDocumentOrFragment(n)||this.exists(n.board)||"string"==typeof n.valueOf()?(!r||this.exists(n))&&(t[o]=n):(void 0!==t[o]&&null!==t[o]&&this.isObject(t[o])||(t[o]={}),this.mergeAttr(t[o],n,i)))},keysToLowerCase:function(t){var e,i,r=Object.keys(t),s=r.length,o={};if("object"!=typeof t)return t;for(;s--;)e=r[s],t.hasOwnProperty(e)&&("object"!=typeof(i=t[e])||null===i||this.isArray(i)||this.exists(i.nodeType)||this.exists(i.board)?o[e.toLowerCase()]=i:o[e.toLowerCase()]=this.keysToLowerCase(i));return o}
1,copyAttributes:function(t,e,i){var s,o,n,a,h,l,c={circle:1,curve:1,foreignobject:1,image:1,line:1,point:1,polygon:1,text:1,ticks:1,integral:1};for(a=arguments.length,s=a<3||c[i]?r.A.deepCopy(e.elements,null,!0):{},a<4&&this.exists(i)&&this.exists(e.layer[i])&&(s.layer=e.layer[i]),h=e,l=!0,n=2;n<a;n++)if(o=arguments[n],this.exists(h[o]))h=h[o];else{l=!1;break}for(l&&(s=r.A.deepCopy(s,h,!0)),h="object"==typeof t?this.keysToLowerCase(t):{},l=!0,n=3;n<a;n++)if(o=arguments[n].toLowerCase(),this.exists(h[o]))h=h[o];else{l=!1;break}if(l&&this.mergeAttr(s,h,!0),"board"===arguments[2])return s;for(n=2,h=e,l=!0;n<a;n++)if(o=arguments[n],this.exists(h[o]))h=h[o];else{l=!1;break}return l&&this.exists(h.label)&&(s.label=r.A.deepCopy(h.label,s.label,!0)),s.label=r.A.deepCopy(e.label,s.label,!0),s},copyPrototypeMethods:function(t,e,i){var r;for(r in t.prototype[i]=e.prototype.constructor,e.prototype)e.prototype.hasOwnProperty(r)&&(t.prototype[r]=e.prototype[r])},getCloneObject:function(t){var e,i,r={};for(i in r.id=t.id+"T"+t.numTraces,t.numTraces+=1,r.coords=t.coords,e=this.deepCopy(t.visProp,t.visProp.traceattributes,!0),r.visProp={},e)e.hasOwnProperty(i)&&0!==i.indexOf("aria")&&0!==i.indexOf("highlight")&&0!==i.indexOf("attractor")&&"label"!==i&&"needsregularupdate"!==i&&"infoboxdigits"!==i&&(r.visProp[i]=t.eval(e[i]));return r.evalVisProp=function(t){return r.visProp[t]},r.eval=function(t){return t},r.visProp.layer=t.board.options.layer.trace,r.visProp.tabindex=null,r.visProp.highlight=!1,r.board=t.board,r.elementClass=t.elementClass,this.clearVisPropOld(r),r.visPropCalc={visible:t.evalVisProp("visible")},r},toJSON:function(t,e){var i,s,o,n;if(e=r.A.def(e,!1),void 0!==JSON&&JSON.stringify&&!e)try{return JSON.stringify(t)}catch(t){}switch(typeof t){case"object":if(t){if(i=[],this.isArray(t)){for(o=0;o<t.length;o++)i.push(r.A.toJSON(t[o],e));return"["+i.join(",")+"]"}for(s in t)if(t.hasOwnProperty(s)){try{n=r.A.toJSON(t[s],e)}catch(t){n=""}e?i.push(s+":"+n):i.push('"'+s+'":'+n)}return"{"+i.join(",")+"} "}return"null";case"string":return"'"+t.replace(/(["'])/g,"\\$1")+"'";case"number":case"boolean":return t.toString()}return"0"},clearVisPropOld:function(t){return t.visPropOld={cssclass:"",cssdefaultstyle:"",cssstyle:"",fillcolor:"",fillopacity:"",firstarrow:!1,fontsize:-1,lastarrow:!1,left:-1e5,linecap:"",shadow:!1,strokecolor:"",strokeopacity:"",strokewidth:"",tabindex:-1e5,transitionduration:0,top:-1e5,visible:null},t},isInObject:function(t,e){var i;for(i in t)if(t.hasOwnProperty(i)&&t[i]===e)return!0;return!1},escapeHTML:function(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")},unescapeHTML:function(t){return t.replace(/<\/?[^>]+>/gi,"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")},capitalize:function(t){return t.charAt(0).toUpperCase()+t.substring(1).toLowerCase()},trimNumber:function(t){return("."===(t=(t=t.replace(/^0+/,"")).replace(/0+$/,""))[t.length-1]||","===t[t.length-1])&&(t=t.slice(0,-1)),("."===t[0]||","===t[0])&&(t="0"+t),t},filterElements:function(t,e){var i,r,s,o,n,a,h,l=t.length,c=[];if("function"!=typeof e&&"object"!=typeof e)return c;for(i=0;i<l;i++){if(h=!0,s=t[i],"object"==typeof e){for(r in e)if(e.hasOwnProperty(r)&&(o=r.toLowerCase(),n="function"==typeof s[r]?s[r]():s[r],a=s.visProp&&"function"==typeof s.visProp[o]?s.visProp[o]():s.visProp&&s.visProp[o],!(h="function"==typeof e[r]?e[r](n)||e[r](a):n===e[r]||a===e[r])))break}else"function"==typeof e&&(h=e(s));h&&c.push(s)}return c},trim:function(t){return t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")},toFraction:function(t,e,i){var r=o.A.decToFraction(t,i),s="";return 0===r[1]&&0===r[2]?s+="0":(r[0]<0&&(s+="-"),0===r[2]?s+=r[1]:(1!==r[2]||1!==r[3])&&(0!==r[1]&&(s+=r[1]+" "),!0===e?s+="\\frac{"+r[2]+"}{"+r[3]+"}":s+=r[2]+"/"+r[3])),s},concat:function(t,e){var i,r=e.length;for(i=0;i<r;i++)t.push(e[i]);return t},sanitizeHTML:function(t,e){return"function"==typeof html_sanitize&&e?html_sanitize(t,function(){},function(t){return t}):(t&&"string"==typeof t&&(t=t.replace(/</g,"<").replace(/>/g,">")),t)},evalSlider:function(t){return t&&t.type===s.A.OBJECT_TYPE_GLIDER&&"function"==typeof t.Value?t.Value():t},stack2jsxgraph:function(t){var e;return"["===(e=t.replace(/%pi/g,"PI").replace(/%e/g,"EULER").replace(/%phi/g,"1.618033988749895").replace(/%gamma/g,"0.5772156649015329").trim())[0]&&"]"===e[e.length-1]&&(e=e.slice(1,-1).split(/\s*,\s*/)),e}});let n=r.A},76422:(t,e,i)=>{i.d(e,{A:()=>s});var r={};try{"object"!=typeof JXG||JXG.extend||(r=JXG)}catch(t){}
1r.extend=function(t,e,i,r){var s,o;for(s in i=i||!1,r=r||!1,e)(!i||i&&e.hasOwnProperty(s))&&(t[o=r?s.toLowerCase():s]=e[s])},r.defineConstant=function(t,e,i,s){(s=s||!1)&&r.exists(t[e])||Object.defineProperty(t,e,{value:i,writable:!1,enumerable:!0,configurable:!1})},r.extendConstants=function(t,e,i,r){var s,o;for(s in i=i||!1,r=r||!1,e)(!i||i&&e.hasOwnProperty(s))&&(o=r?s.toUpperCase():s,this.defineConstant(t,o,e[s]))},r.extend(r,{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(t,e){return r.deprecated("JXG.getRef()","Board.select()"),t.select(e)},getReference:function(t,e){return r.deprecated("JXG.getReference()","Board.select()"),t.select(e)},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(t,e){var i=t+" is deprecated.";e&&(i+=" Please use "+e+" instead."),r.warn(i)},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(t){var e=Error();r.debugInt.apply(this,arguments),e&&e.stack&&(r.debugInt("stacktrace"),r.debugInt(e.stack.split("\n").slice(1).join("\n")))},debugLine:function(t){var e=Error();r.debugInt.apply(this,arguments),e&&e.stack&&r.debugInt("Called from",e.stack.split("\n").slice(2,3).join("\n"))},debug:function(t){r.debugInt.apply(this,arguments)},themes:{}});let s=r},86385:(t,e,i)=>{i.d(e,{A:()=>n});var r=i(76422),s=i(97272),o=i(64657);s.A.Statistics={sum:function(t){var e,i=t.length,r=0;for(e=0;e<i;e++)r+=t[e];return r},prod:function(t){var e,i=t.length,r=1;for(e=0;e<i;e++)r*=t[e];return r},mean:function(t){return t.length>0?this.sum(t)/t.length:0},median:function(t){var e,i;return t.length>0?(ArrayBuffer.isView(t)?(e=new Float64Array(t)).sort():(e=t.slice(0)).sort(function(t,e){return t-e}),1&(i=e.length))?e[parseInt(.5*i,10)]:(e[.5*i-1]+e[.5*i])*.5:0},percentile:function(t,e){var i,r,s,n,a,h=[];if(t.length>0){for(ArrayBuffer.isView(t)?(i=new Float64Array(t)).sort():(i=t.slice(0)).sort(function(t,e){return t-e}),r=i.length,n=o.A.isArray(e)?e:[e],s=0;s<n.length;s++)parseInt(a=r*n[s]*.01,10)===a?h.push((i[a-1]+i[a])*.5):h.push(i[parseInt(a,10)]);return o.A.isArray(e)?h:h[0]}return 0},variance:function(t){var e,i,r,s=t.length;if(s>1){for(r=0,e=this.mean(t),i=0;r<s;r++)i+=(t[r]-e)*(t[r]-e);return i/(t.length-1)}return 0},sd:function(t){return Math.sqrt(this.variance(t))},weightedMean:function(t,e){if(t.length!==e.length)throw Error("JSXGraph error (Math.Statistics.weightedMean): Array dimension mismatch.");return t.length>0?this.mean(this.multiply(t,e)):0},max:function(t){return Math.max.apply(this,t)},min:function(t){return Math.min.apply(this,t)},range:function(t){return[this.min(t),this.max(t)]},abs:function(t){var e,i,r;if(o.A.isArray(t))if(t.map)r=t.map(Math.abs);else for(e=0,i=t.length,r=[];e<i;e++)r[e]=Math.abs(t[e]);else r=ArrayBuffer.isView(t)?t.map(Math.abs):Math.abs(t);return r},add:function(t,e){var i,r,s=[];if(t=o.A.evalSlider(t),e=o.A.evalSlider(e),o.A.isArray(t)&&o.A.isNumber(e))for(i=0,r=t.length;i<r;i++)s[i]=t[i]+e;else if(o.A.isNumber(t)&&o.A.isArray(e))for(i=0,r=e.length;i<r;i++)s[i]=t+e[i];else if(o.A.isArray(t)&&o.A.isArray(e))for(i=0,r=Math.min(t.length,e.length);i<r;i++)s[i]=t[i]+e[i];else s=t+e;return s},div:function(t,e){var i,r,s=[];if(t=o.A.evalSlider(t),e=o.A.evalSlider(e),o.A.isArray(t)&&o.A.isNumber(e))for(i=0,r=t.length;i<r;i++)s[i]=t[i]/e;else if(o.A.isNumber(t)&&o.A.isArray(e))for(i=0,r=e.length;i<r;i++)s[i]=t/e[i];else if(o.A.isArray(t)&&o.A.isArray(e))for(i=0,r=Math.min(t.length,e.length);i<r;i++)s[i]=t[i]/e[i];else s=t/e;return s},divide:function(){r.A.deprecated("Statistics.divide()","Statistics.div()"),s.A.Statistics.div.apply(s.A.Statistics,arguments)}
1,mod:function(t,e,i){var r,n,a=[],h=function(t,e){return t%e};if((i=o.A.def(i,!1))&&(h=s.A.mod),t=o.A.evalSlider(t),e=o.A.evalSlider(e),o.A.isArray(t)&&o.A.isNumber(e))for(r=0,n=t.length;r<n;r++)a[r]=h(t[r],e);else if(o.A.isNumber(t)&&o.A.isArray(e))for(r=0,n=e.length;r<n;r++)a[r]=h(t,e[r]);else if(o.A.isArray(t)&&o.A.isArray(e))for(r=0,n=Math.min(t.length,e.length);r<n;r++)a[r]=h(t[r],e[r]);else a=h(t,e);return a},multiply:function(t,e){var i,r,s=[];if(t=o.A.evalSlider(t),e=o.A.evalSlider(e),o.A.isArray(t)&&o.A.isNumber(e))for(i=0,r=t.length;i<r;i++)s[i]=t[i]*e;else if(o.A.isNumber(t)&&o.A.isArray(e))for(i=0,r=e.length;i<r;i++)s[i]=t*e[i];else if(o.A.isArray(t)&&o.A.isArray(e))for(i=0,r=Math.min(t.length,e.length);i<r;i++)s[i]=t[i]*e[i];else s=t*e;return s},subtract:function(t,e){var i,r,s=[];if(t=o.A.evalSlider(t),e=o.A.evalSlider(e),o.A.isArray(t)&&o.A.isNumber(e))for(i=0,r=t.length;i<r;i++)s[i]=t[i]-e;else if(o.A.isNumber(t)&&o.A.isArray(e))for(i=0,r=e.length;i<r;i++)s[i]=t-e[i];else if(o.A.isArray(t)&&o.A.isArray(e))for(i=0,r=Math.min(t.length,e.length);i<r;i++)s[i]=t[i]-e[i];else s=t-e;return s},TheilSenRegression:function(t){var e,i,r=[],o=[],n=[];for(e=0;e<t.length;e++){for(i=0,o.length=0;i<t.length;i++)Math.abs(t[i].usrCoords[1]-t[e].usrCoords[1])>s.A.eps&&(o[i]=(t[i].usrCoords[2]-t[e].usrCoords[2])/(t[i].usrCoords[1]-t[e].usrCoords[1]));r[e]=this.median(o),n.push(t[e].usrCoords[2]-r[e]*t[e].usrCoords[1])}return[this.median(n),this.median(r),-1]},generateGaussian:function(t,e){var i,r,s;if(this.hasSpare)return this.hasSpare=!1,this.spare*e+t;do s=(i=2*Math.random()-1)*i+(r=2*Math.random()-1)*r;while(s>=1||0===s);
1return s=Math.sqrt(-2*Math.log(s)/s),this.spare=r*s,this.hasSpare=!0,t+e*i*s},randomNormal:function(t,e){return this.generateGaussian(t,e)},randomUniform:function(t,e){return Math.random()*(e-t)+t},randomExponential:function(t){var e;if(t<=0)return NaN;do e=Math.random();while(0===e);return-Math.log(e)/t},randomGamma:function(t,e,i){var r,s,o,n,a,h;if(t<=0)return NaN;if(e=e||1,i=i||0,1===t)return e*this.randomExponential(1)+i;if(t<1){a=Math.E/(t+Math.E);do{r=Math.random();do s=Math.random();while(0===s);h=r<a?Math.exp(-(o=Math.pow(s,1/t))):Math.pow(o=1-Math.log(s),t-1),r=Math.random()}while(r>=h);return e*o+i}do{if(!((o=Math.sqrt(2*t-1)*(n=Math.tan(Math.PI*Math.random()))+t-1)>0))continue;s=Math.random()}while(o<=0||s>(1+n*n)*Math.exp((t-1)*Math.log(o/(t-1))-Math.sqrt(2*t-1)*n));return e*o+i},randomBeta:function(t,e){var i;return t<=0||e<=0?NaN:(i=this.randomGamma(t))/(i+this.randomGamma(e))},randomChisquare:function(t){return t<=0?NaN:2*this.randomGamma(.5*t)},randomF:function(t,e){var i,r;return t<=0||e<=0?NaN:(i=this.randomChisquare(t),r=this.randomChisquare(e),i*e/(r*t))},randomT:function(t){return t<=0?NaN:this.randomNormal(0,1)/Math.sqrt(this.randomChisquare(t)/t)},randomBinomial:function(t,e){var i,r,s,o,n,a;if(e<0||e>1||t<0)return NaN;if(0===e)return 0;if(1===e)return t;if(0===t)return 0;if(1===t)return+(Math.random()<e);if(e>.5)return t-this.randomBinomial(t,1-e);if(t<100){if(i=-1,r=0,0===(s=Math.log(1-e)))return 0;do i+=1,r+=Math.floor(Math.log(Math.random())/s)+1;while(r<t)}else o=1+Math.floor(.5*t),n=t-o+1,i=(i=this.randomBeta(o,n))>=e?a=this.randomBinomial(o-1,e/i):o+(a=this.randomBinomial(n-1,(e-i)/(1-i)));return i},randomGeometric:function(t){return t<0||t>1?NaN:Math.ceil(Math.log(Math.random())/Math.log(1-t))},randomPoisson:function(t){var e,i,r=Math.exp(-t),s=0,o=1,n=7/8;if(t<=0)return NaN;if(t<10){do o*=Math.random(),s+=1;while(o>r);e=s-1}else s=Math.floor(n*t),e=(i=this.randomGamma(s))<t?s+this.randomPoisson(t-i):this.randomBinomial(s-1,t/i);return e},randomPareto:function(t,e){var i=Math.random();return t<=0||e<=0?NaN:e*Math.pow(1-i,-1/t)},randomHypergeometric:function(t,e,i){var r,s,o=0,n=t+e-i,a=Math.min(t,e),h=a;if(t<1||e<1||i>t+e)return NaN;for(r=i;h*r>0;)s=Math.random(),h-=Math.floor(s+h/(n+r)),r-=1;return(o=a-h,t<=e)?o:i-o},histogram:function(t,e){var i,s,o,n,a,h,l,c,d,u=[],p=[],f=0;for(h=e.bins||10,!1===(c=e.range||!1)?(n=Math.min.apply(null,t),a=Math.max.apply(null,t)):(n=c[0],a=c[1]),l=h>0?(a-n)/(h-1):0,i=0;i<h;i++)u.push(0),p.push(n+i*l);for(i=0,s=t.length;i<s;i++)(o=Math.floor((t[i]-n)/l))>=0&&o<h?u[o]+=1:f+=1;if(e.density)for(i=0,d=r.A.Math.Statistics.sum(u)+f;i<h;i++)u[i]/=d*l;if(e.cumulative){if(e.density)for(i=0;i<h;i++)u[i]*=l;for(i=1;i<h;i++)u[i]+=u[i-1]}return[u,p]}};let n=s.A.Statistics},87490:(t,e,i)=>{i.d(e,{A:()=>o});var r=i(76422),s=i(64657);r.A.Complex=function(t,e){this.isComplex=!0,t&&t.isComplex&&(e=t.imaginary,t=t.real),this.real=t||0,this.imaginary=e||0,this.absval=0,this.angle=0},r.A.extend(r.A.Complex.prototype,{toString:function(){return this.real+" + "+this.imaginary+"i"},add:function(t){return s.A.isNumber(t)?this.real+=t:(this.real+=t.real,this.imaginary+=t.imaginary),this},sub:function(t){return s.A.isNumber(t)?this.real-=t:(this.real-=t.real,this.imaginary-=t.imaginary),this},mult:function(t){var e,i;return s.A.isNumber(t)?(this.real*=t,this.imaginary*=t):(e=this.real,i=this.imaginary,this.real=e*t.real-i*t.imaginary,this.imaginary=e*t.imaginary+i*t.real),this},div:function(t){var e,i,r;if(s.A.isNumber(t)){if(Math.abs(t)<Math.eps)return this.real=1/0,this.imaginary=1/0,this;this.real/=t,this.imaginary/=t}else{if(Math.abs(t.real)<Math.eps&&Math.abs(t.imaginary)<Math.eps)return this.real=1/0,this.imaginary=1/0,this;e=t.real*t.real+t.imaginary*t.imaginary,r=this.real,i=this.imaginary,this.real=(r*t.real+i*t.imaginary)/e,this.imaginary=(i*t.real-r*t.imaginary)/e}return this},conj:function(){return this.imaginary*=-1,this}}),r.A.C={},r.A.C.add=function(t,e){var i=new r.A.Complex(t);return i.add(e),i},r.A.C.sub=function(t,e){var i=new r.A.Complex(t);return i.sub(e),i},r.A.C.mult=function(t,e){var i=new r.A.Complex(t);return i.mult(e),i},r.A.C.div=function(t,e){var i=new r.A.Complex(t);return i.div(e),i},r.A.C.conj=function(t){var e=new r.A.Complex(t);return e.conj(),e},r.A.C.abs=function(t){var e=new r.A.Complex(t);return e.conj(),e.mult(t),Math.sqrt(e.real)},r.A.C.copy=function(t){return new r.A.Complex(t)},r.A.Complex.C=r.A.C;let o=r.A.Complex}
1,94768:(t,e,i)=>{i.d(e,{A:()=>n});var r=i(76422),s=i(64657),o=i(95704);r.A.extendConstants(r.A,{}),r.A.extend(r.A,{isTouchEvent:function(t){return r.A.exists(t.touches)},isPointerEvent:function(t){return r.A.exists(t.pointerId)},isMouseEvent:function(t){return!r.A.isTouchEvent(t)&&!r.A.isPointerEvent(t)},getNumberOfTouchPoints:function(t){var e=-1;return r.A.isTouchEvent(t)&&(e=t.touches.length),e},isFirstTouch:function(t){var e=r.A.getNumberOfTouchPoints(t);return r.A.isPointerEvent(t)?t.isPrimary:1===e},isBrowser:"object"==typeof window&&"object"==typeof document,supportsES6:function(){try{return Function("(a = 0) => a"),!0}catch(t){return!1}},supportsVML:function(){return this.isBrowser&&!!document.namespaces},supportsSVG:function(){return!!this.isBrowser&&!!document.createElementNS&&!!document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect},supportsCanvas:function(){var t=!1;return this.isNode()&&(t=!0),t||this.isBrowser&&!!document.createElement("canvas").getContext},isNode:function(){return!this.isBrowser&&void 0!==o&&-1!==o.release.name.search(/node|io.js/)},isWebWorker:function(){return!this.isBrowser&&"object"==typeof self&&"function"==typeof self.postMessage},supportsPointerEvents:function(){return!!(this.isBrowser&&window.navigator&&(window.PointerEvent||window.navigator.pointerEnabled||window.navigator.msPointerEnabled))},isTouchDevice:function(){return this.isBrowser&&void 0!==window.ontouchstart},isAndroid:function(){return s.A.exists(navigator)&&navigator.userAgent.toLowerCase().indexOf("android")>-1},isWebkitAndroid:function(){return this.isAndroid()&&navigator.userAgent.indexOf(" AppleWebKit/")>-1},isApple:function(){return s.A.exists(navigator)&&(navigator.userAgent.indexOf("iPad")>-1||navigator.userAgent.indexOf("iPhone")>-1)},isWebkitApple:function(){return this.isApple()&&navigator.userAgent.
1search(/Mobile\/[0-9A-Za-z.]*Safari/)>-1},isMetroApp:function(){return"object"==typeof window&&window.clientInformation&&window.clientInformation.appVersion&&window.clientInformation.appVersion.indexOf("MSAppHost")>-1},isMozilla:function(){return s.A.exists(navigator)&&navigator.userAgent.toLowerCase().indexOf("mozilla")>-1&&-1===navigator.userAgent.toLowerCase().indexOf("apple")},isFirefoxOS:function(){return s.A.exists(navigator)&&-1===navigator.userAgent.toLowerCase().indexOf("android")&&-1===navigator.userAgent.toLowerCase().indexOf("apple")&&navigator.userAgent.toLowerCase().indexOf("mobile")>-1&&navigator.userAgent.toLowerCase().indexOf("mozilla")>-1},isDesktop:function(){return!0},isMobile:function(){return!0},ieVersion:function(){var t,e,i=3;if("object"!=typeof document)return 0;e=(t=document.createElement("div")).getElementsByTagName("i");do t.innerHTML="\x3c!--[if gt IE "+ ++i+"]><i></i><![endif]--\x3e";while(e[0]);return i>4?i:void 0}(),getDimensions:function(t,e){var i,r,o,n,a,h,l,c,d,u=/\d+(\.\d*)?px/;if(!this.isBrowser||null===t)return{width:500,height:500};if(e=e||document,i=s.A.isString(t)?e.getElementById(t):t,!s.A.exists(i))throw Error("\nJSXGraph: HTML container element '"+t+"' not found.");return"none"!==(r=i.style.display)&&null!==r?i.clientWidth>0&&i.clientHeight>0?{width:i.clientWidth,height:i.clientHeight}:{width:u.test((d=window.getComputedStyle?window.getComputedStyle(i):i.style).width)?parseFloat(d.width):0,height:u.test(d.height)?parseFloat(d.height):0}:(n=(o=i.style).visibility,a=o.position,h=o.display,o.visibility="hidden",o.position="absolute",o.display="block",l=i.clientWidth,c=i.clientHeight,o.display=h,o.position=a,o.visibility=n,{width:l,height:c})},addEvent:function(t,e,i,r,o){var n=function(){return i.apply(r,arguments)};n.origin=i,"object"==typeof r&&s.A.exists(r.BOARD_MODE_NONE)&&(r["x_internal"+e]=r["x_internal"+e]||[],r["x_internal"+e].push(n)),s.A.exists(t)&&s.A.exists(t.addEventListener)&&(o=o||!1,t.addEventListener(e,n,o)),s.A.exists(t)&&s.A.exists(t.attachEvent)&&t.attachEvent("on"+e,n)},removeEvent:function(t,e,i,o){var n;if(!s.A.exists(o))return void r.A.debug("no such owner");if(!s.A.exists(o["x_internal"+e]))return void r.A.debug("removeEvent: no such type: "+e);if(!s.A.isArray(o["x_internal"+e]))return void r.A.debug("owner[x_internal + "+e+"] is not an array");if(-1===(n=s.A.indexOf(o["x_internal"+e],i,"origin")))return void r.A.debug("removeEvent: no such event function in internal list: "+i);try{s.A.exists(t)&&s.A.exists(t.removeEventListener)&&t.removeEventListener(e,o["x_internal"+e][n],!1),s.A.exists(t)&&s.A.exists(t.detachEvent)&&t.detachEvent("on"+e,o["x_internal"+e][n])}catch(t){r.A.debug("removeEvent: event not registered in browser: ("+e+" -- "+i+")")}o["x_internal"+e].splice(n,1)},removeAllEvents:function(t,e,i){var s;if(i["x_internal"+e]){for(s=i["x_internal"+e].length-1;s>=0;s--)r.A.removeEvent(t,e,i["x_internal"+e][s].origin,i);i["x_internal"+e].length>0&&r.A.debug("removeAllEvents: Not all events could be removed.")}},getPosition:function(t,e,i){var r,o,n,a=0,h=0;if(t||(t=window.event),i=i||document,n=t.touches,s.A.exists(n)&&0===n.length&&(n=t.changedTouches),s.A.exists(e)&&s.A.exists(n))if(-1===e){for(r=0,o=n.length;r<o;r++)if(n[r]){t=n[r];break}}else t=n[e];return t.clientX&&(a=t.clientX,h=t.clientY),[a,h]},getOffset:function(t){var e,i=t,r=t,s=i.offsetLeft-i.scrollLeft,o=i.offsetTop-i.scrollTop;for(s=(e=this.getCSSTransform([s,o],i))[0],o=e[1],i=i.offsetParent;i;){for(s+=i.offsetLeft,o+=i.offsetTop,i.offsetParent&&(s+=i.clientLeft-i.scrollLeft,o+=i.clientTop-i.scrollTop),s=(e=this.getCSSTransform([s,o],i))[0],o=e[1],r=r.parentNode;r!==i;)s+=r.clientLeft-r.scrollLeft,o+=r.clientTop-r.scrollTop,s=(e=this.getCSSTransform([s,o],r))[0],o=e[1],r=r.parentNode;i=i.offsetParent}return[s,o]},getStyle:function(t,e){var i,s=t.ownerDocument;return s.defaultView&&s.defaultView.getComputedStyle?i=s.defaultView.getComputedStyle(t,null).getPropertyValue(e):t.currentStyle&&r.A.ieVersion>=9?i=t.currentStyle[e]:t.style&&(e=e.replace(/-([a-z]|[0-9])/gi,function(t,e){return e.toUpperCase()}),i=t.style[e]),i},getProp:function(t,e){var i=parseInt(this.getStyle(t,e),10);return isNaN(i)?0:i},getCSSTransform:function(t,e){var i,r,o,n,a,h,l,c=["transform","webkitTransform","MozTransform","msTransform","oTransform"];for(i=0,a=c.length,o="";i<a;i++)if(s.A.exists(e.style[c[i]])){o=e.style[c[i]];break}if(""!==o&&(n=o.indexOf("("))>0){for(r=0,a=o.length,h=(l=o.substring(n+1,a-1).split(",")).length;r<h;r++)l[r]=parseFloat(l[r]);0===o.indexOf("matrix")?(t[0]+=l[4],t[1]+=l[5]):0===o.indexOf("translateX")?t[0]+=l[0]:0===o.indexOf("translateY")?t[1]+=l[0]:0===o.indexOf("translate")&&(t[0]+=l[0],t[1]+=l[1])}return s.A.exists(e.style.zoom)&&""!==(o=e.style.zoom)&&(t[0]*=parseFloat(o),t[1]*=parseFloat(o)),t},getCSSTransformMatrix:function(t){var e,i,r,o,n,a,h,l,c=t.ownerDocument,d=["transform","webkitTransform","MozTransform","msTransform","oTransform"],u=[[1,0,0],[0,1,0],[0,0,1]];if(c.defaultView&&c.defaultView.getComputedStyle)r=(l=c.defaultView.getComputedStyle(t,null)).getPropertyValue("-webkit-transform")||l.getPropertyValue("-moz-transform")||l.getPropertyValue("-ms-transform")||l.getPropertyValue("-o-transform")||l.getPropertyValue("transform");else for(e=0,a=d.length,r="";e<a;e++)if(s.A.exists(t.style[d[e]])){r=t.style[d[e]];break}if(""!==r&&(n=r.indexOf("("))>0){for(i=0,a=r.length,h=(o=r.substring(n+1,a-1).split(",")).length;i<h;i++)o[i]=parseFloat(o[i]);0===r.indexOf("matrix")?u=[[1,0,0],[0,o[0],o[1]],[0,o[2],o[3]]]:0===r.indexOf("scaleX")?u[1][1]=o[0]:0===r.indexOf("scaleY")?u[2][2]=o[0]:0===r.indexOf("scale")&&(u[1][1]=o[0],u[2][2]=o[1])}return s.A.exists(t.style.zoom)&&""!==(r=t.style.zoom)&&(u[1][1]*=parseFloat(r),u[2][2]*=parseFloat(r)),u}
1,timedChunk:function(t,e,i,r){var s=t.slice(),o=function(){var n=+new Date;do e.call(i,s.shift());while(s.length>0&&new Date-n<300);s.length>0?window.setTimeout(o,1):r(t)};window.setTimeout(o,1)},scaleJSXGraphDiv:function(t,e,i,s){var o,n,a,h,l,c,d,u,p,f,A,m,b=s,g=4;for(n=(a=i.getElementById(t).getBoundingClientRect()).height,o=a.width,c=(u=i.getElementById(e))._cssFullscreenStore.w,A=(d=u._cssFullscreenStore.h)/c,c>o*b&&(d=(c=o*b)*A),d>n*b&&(c=(d=n*b)/A),h=c,l=d,p=A<n/o?o*b/c:n*b/d,f=(n-l)*.5,m=0;m<g;m++)try{u.style.width=h+"px !important",u.style.height=l+"px !important",u.style.margin="0 auto",u.style.transform=u._cssFullscreenStore.transform+" matrix("+p+",0,0,"+p+",0,"+f+")";break}catch(t){r.A.debug("JXG.scaleJSXGraphDiv:\n"+t)}m===g&&r.A.debug("JXG.scaleJSXGraphDiv: Could not set any CSS property.")}});let n=r.A},97272:(t,e,i)=>{i.d(e,{A:()=>a});var r,s=i(76422),o=i(64657),n=function(t){var e,i;return t.memo||(e={},i=Array.prototype.join,t.memo=function(){var s=i.call(arguments);return e[s]!==r?e[s]:e[s]=t.apply(this,arguments)}),t.memo};s.A.Math={eps:1e-6,relDif:function(t,e){var i=Math.abs(e);return 0===(i=Math.max(Math.abs(t),i))?0:Math.abs(t-e)/i},mod:function(t,e){return t-Math.floor(t/e)*e},wrap:function(t,e,i){return e+this.mod(t-e,i-e)},clamp:function(t,e,i){return Math.min(Math.max(t,e),i)},wrapAndClamp:function(t,e,i,r){var s=.5*(e+i),o=.5*r;return this.clamp(this.wrap(t,s-o,s+o),e,i)},vector:function(t,e){var i,r;for(r=0,e=e||0,i=[];r<t;r++)i[r]=e;return i},matrix:function(t,e,i){var r,s,o;for(s=0,i=i||0,e=e||t,r=[];s<t;s++)for(o=0,r[s]=[];o<e;o++)r[s][o]=i;return r},identity:function(t,e){var i,s;for(e===r&&"number"!=typeof e&&(e=t),i=this.matrix(t,e),s=0;s<Math.min(t,e);s++)i[s][s]=1;return i},frustum:function(t,e,i,r,s,o){var n=this.matrix(4,4);return n[0][0]=2*s/(e-t),n[0][1]=0,n[0][2]=(e+t)/(e-t),n[0][3]=0,n[1][0]=0,n[1][1]=2*s/(r-i),n[1][2]=(r+i)/(r-i),n[1][3]=0,n[2][0]=0,n[2][1]=0,n[2][2]=-(o+s)/(o-s),n[2][3]=-(o*s*2)/(o-s),n[3][0]=0,n[3][1]=0,n[3][2]=-1,n[3][3]=0,n},projection:function(t,e,i,r){var s=i*Math.tan(t/2),o=s*e;return this.frustum(-o,o,-s,s,i,r)},matVecMult:function(t,e){var i,r,s,o=t.length,n=e.length,a=[];if(3===n)for(i=0;i<o;i++)a[i]=t[i][0]*e[0]+t[i][1]*e[1]+t[i][2]*e[2];else for(i=0;i<o;i++){for(r=0,s=0;r<n;r++)s+=t[i][r]*e[r];a[i]=s}return a},vecMatMult:function(t,e){var i,r,s,o=e.length,n=t.length,a=[];if(3===n)for(i=0;i<o;i++)a[i]=t[0]*e[0][i]+t[1]*e[1][i]+t[2]*e[2][i];else for(i=0;i<n;i++){for(r=0,s=0;r<o;r++)s+=t[r]*e[r][i];a[i]=s}return a},matMatMult:function(t,e){var i,r,s,o,n=t.length,a=n>0?e[0].length:0,h=e.length,l=this.matrix(n,a);for(i=0;i<n;i++)for(r=0;r<a;r++){for(o=0,s=0;o<h;o++)s+=t[i][o]*e[o][r];l[i][r]=s}return l},matNumberMult:function(t,e){var i,r,s=t.length,o=s>0?t[0].length:0,n=this.matrix(s,o);for(i=0;i<s;i++)for(r=0;r<o;r++)n[i][r]=t[i][r]*e;return n},matMatAdd:function(t,e){var i,r,s=t.length,o=s>0?t[0].length:0,n=this.matrix(s,o);for(i=0;i<s;i++)for(r=0;r<o;r++)n[i][r]=t[i][r]+e[i][r];return n},transpose:function(t){var e,i,r,s,o;for(i=0,s=t.length,o=t.length>0?t[0].length:0,e=this.matrix(o,s);i<o;i++)for(r=0;r<s;r++)e[i][r]=t[r][i];return e},inverse:function(t){var e,i,r,o,n,a,h,l=this.eps*this.eps,c=t.length,d=[],u=[],p=[];for(e=0;e<c;e++){for(i=0,d[e]=[];i<c;i++)d[e][i]=t[e][i];u[e]=e}for(i=0;i<c;i++){for(a=Math.abs(d[i][i]),o=i,e=i+1;e<c;e++)Math.abs(d[e][i])>a&&(a=Math.abs(d[e][i]),o=e);if(a<=l)return s.A.warn("JXG.Math.inverse: singular matrix"),[];if(o>i){for(r=0;r<c;r++)h=d[i][r],d[i][r]=d[o][r],d[o][r]=h;h=u[i],u[i]=u[o],u[o]=h}for(e=0,n=1/d[i][i];e<c;e++)d[e][i]*=n;for(r=0,d[i][i]=n;r<c;r++)if(r!==i){for(e=0;e<c;e++)e!==i&&(d[e][r]-=d[e][i]*d[i][r]);d[i][r]=-n*d[i][r]}}for(e=0;e<c;e++){for(r=0;r<c;r++)p[u[r]]=d[e][r];for(r=0;r<c;r++)d[e][r]=p[r]}return d},trace:function(t){var e,i,r=0;if(t.length!==(i=t.length>0?t[0].length:0))return NaN;for(e=0;e<i;e++)r+=t[e][e];return r},innerProduct:function(t,e,i){var s,n=0;for(i!==r&&o.A.isNumber(i)||(i=t.length),s=0;s<i;s++)n+=t[s]*e[s];return n},crossProduct:function(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]},norm:function(t,e){var i,s=0;for(e!==r&&o.A.isNumber(e)||(e=t.length),i=0;i<e;i++)s+=t[i]*t[i];return Math.sqrt(s)}
1,axpy:function(t,e,i){var r,s=e.length,o=[];for(r=0;r<s;r++)o[r]=t*e[r]+i[r];return o},factorial:n(function(t){return t<0?NaN:0===(t=Math.floor(t))||1===t?1:t*this.factorial(t-1)}),binomial:n(function(t,e){var i,r;if(e>t||e<0)return NaN;if(e=Math.round(e),t=Math.round(t),0===e||e===t)return 1;for(r=0,i=1;r<e;r++)i*=t-r,i/=r+1;return i}),cosh:Math.cosh||function(t){return(Math.exp(t)+Math.exp(-t))*.5},sinh:Math.sinh||function(t){return(Math.exp(t)-Math.exp(-t))*.5},acosh:Math.acosh||function(t){return Math.log(t+Math.sqrt(t*t-1))},asinh:Math.asinh||function(t){return t===-1/0?t:Math.log(t+Math.sqrt(t*t+1))},cot:function(t){return 1/Math.tan(t)},acot:function(t){return(t>=0?.5:-.5)*Math.PI-Math.atan(t)},nthroot:function(t,e){var i=1/e;return e<=0||Math.floor(e)!==e?NaN:0===t?0:t>0?Math.exp(i*Math.log(t)):e%2==1?-Math.exp(i*Math.log(-t)):NaN},cbrt:Math.cbrt||function(t){return this.nthroot(t,3)},pow:function(t,e){return 0===t?+(0===e):Math.floor(e)===e?Math.pow(t,e):t>0?Math.exp(e*Math.log(t)):NaN},ratpow:function(t,e,i){var r;return 0===e?1:0===i?NaN:(r=this.gcd(e,i),this.nthroot(this.pow(t,e/r),i/r))},log10:function(t){return Math.log(t)/Math.log(10)},log2:function(t){return Math.log(t)/Math.log(2)},log:function(t,e){return void 0!==e&&o.A.isNumber(e)?Math.log(t)/Math.log(e):Math.log(t)},sign:Math.sign||function(t){return 0==(t*=1)||isNaN(t)?t:t>0?1:-1},squampow:function(t,e){var i;if(Math.floor(e)===e){for(i=1,e<0&&(t=1/t,e*=-1);0!==e;)1&e&&(i*=t),e>>=1,t*=t;return i}return this.pow(t,e)},gcd:function(t,e){var i,r=!0;if(t=Math.abs(t),e=Math.abs(e),!(o.A.isNumber(t)&&o.A.isNumber(e)))return NaN;for(e>t&&(i=t,t=e,e=i);r;){if(0==(t%=e))return e;if(0==(e%=t))return t}},lcm:function(t,e){var i;return o.A.isNumber(t)&&o.A.isNumber(e)?0!=(i=t*e)?i/this.gcd(t,e):0:NaN},roundToStep:function(t,e,i,r){var n,a,h=t;if(!o.A.exists(e)&&!o.A.exists(i)&&!o.A.exists(r))return h;if(s.A.exists(r)&&(h=Math.min(h,r)),s.A.exists(i)&&(h=Math.max(h,i)),a=i||0,s.A.exists(e)){if(Number.isInteger(n=(h-a)/e))return h;h=a+(n=Math.round(n))*e}return s.A.exists(r)&&(h=Math.min(h,r)),s.A.exists(i)&&(h=Math.max(h,i)),h},erf:function(t){return this.ProbFuncs.erf(t)},erfc:function(t){return this.ProbFuncs.erfc(t)},erfi:function(t){return this.ProbFuncs.erfi(t)},ndtr:function(t){return this.ProbFuncs.ndtr(t)},ndtri:function(t){return this.ProbFuncs.ndtri(t)},hypot:function(){var t,e,i,r;for(t=0,e=arguments.length,r=0;t<e;t++)i=arguments[t],r+=i*i;return Math.sqrt(r)},hstep:function(t){return t>0?1:t<0?0:.5},gamma:function(t){var e,i,r,s,o,n=7,a=[1,676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,15056327351493116e-23];if(t<.5)i=Math.PI/(Math.sin(Math.PI*t)*this.gamma(1-t));else{for(t-=1,e=a[0],o=a.length,s=1;s<o;s++)e+=a[s]/(t+s);i=Math.sqrt(2*Math.PI)*Math.pow(r=t+n+.5,t+.5)*Math.exp(-r)*e}return i},lt:function(t,e){return t<e},leq:function(t,e){return t<=e},gt:function(t,e){return t>e},geq:function(t,e){return t>=e},eq:function(t,e){return t===e},neq:function(t,e){return t!==e},and:function(t,e){return t&&e},not:function(t){return!t},or:function(t,e){return t||e},xor:function(t,e){return(t||e)&&!(t&&e)},decToFraction:function(t,e){var i,r,s,n,a,h,l,c,d,u=0,p=20;for(e=o.A.def(e,.001),r=(t=1e-12*Math.round(1e12*t))<0?-1:1,i=Math.floor(t=Math.abs(t)),t-=Math.floor(t),h=1,n=a=s=0,d=0,l=c=1;t-Math.floor(t)>e&&u<p;)n=h+(s=Math.floor(t=1/(t-s)))*a,l=d+s*c,h=a,d=c,a=n,c=l,u++;return[r,i,n,l]},normalize:function(t){var e,i,r=2*t[3],s=t[4]/r;return t[5]=s,t[6]=-t[1]/r,t[7]=-t[2]/r,isFinite(s)?Math.abs(s)>=1?(t[0]=(t[6]*t[6]+t[7]*t[7]-s*s)/(2*s),t[1]=-t[6]/s,t[2]=-t[7]/s,t[3]=1/(2*s),t[4]=1):(i=s<=0?-1:1,t[0]=i*(t[6]*t[6]+t[7]*t[7]-s*s)*.5,t[1]=-i*t[6],t[2]=-i*t[7],t[3]=i/2,t[4]=i*s):(e=this.hypot(t[1],t[2]),t[0]/=e,t[1]/=e,t[2]/=e,t[3]=0,t[4]=1),t},toGL:function(t){var e,i,r;if(e="function"==typeof Float32Array?new Float32Array(16):Array(16),4!==t.length&&4!==t[0].length)return e;for(i=0;i<4;i++)for(r=0;r<4;r++)e[i+4*r]=t[i][r];return e},Vieta:function(t){var e,i,r,s=t.length,o=[];for(e=1,o=t.slice();e<s;++e){for(r=o[e],o[e]*=o[e-1],i=e-1;i>=1;--i)o[i]+=o[i-1]*r;o[0]+=r}return o}};let a=s.A.Math}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.