1"use strict";function _classCallCheck(t,a){if(!(t instanceof a))throw new TypeError("Cannot call a class as a function")}function getRGBFoxColor(t){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,e=getFoxColors(),i=!0,s=!1,n=void 0;try{for(var r,l=e[Symbol.iterator]();!(i=(r=l.next()).done);i=!0){var h=r.value;if(t===h.name)return"transparent"===h.name&&(a=0),"rgba("+h.rgb[0]+", "+h.rgb[1]+", "+h.rgb[2]+", "+a+")"}}catch(t){s=!0,n=t}finally{try{!i&&l.return&&l.return()}finally{if(s)throw n}}return"rgba(0, 0, 0, "+a+")"}function getFoxColors(){return[{enabled:!1,name:"transparent",hex:"000000",rgb:[0,0,0]},{enabled:!0,name:"dark-blue",hex:"0086CC",rgb:[0,134,204]},{enabled:!0,name:"blue",hex:"00A7FF",rgb:[0,167,255]},{enabled:!0,name:"light-blue",hex:"66CAFF",rgb:[102,202,255]},{enabled:!0,name:"dark-green",hex:"00A388",rgb:[9,163,136]},{enabled:!0,name:"green",hex:"38BB8F",rgb:[56,187,143]},{enabled:!0,name:"light-green",hex:"60C9A5",rgb:[96,201,165]},{enabled:!0,name:"dark-orange",hex:"F2784B",rgb:[242,120,75]},{enabled:!0,name:"orange",hex:"FF9666",rgb:[255,150,102]},{enabled:!1,name:"light-orange",hex:"FCA882",rgb:[252,168,130]},{enabled:!0,name:"dark-red",hex:"B23E3E",rgb:[178,62,62]},{enabled:!0,name:"red",hex:"EE6666",rgb:[237,102,102]},{enabled:!0,name:"light-red",hex:"F18585",rgb:[241,133,133]},{enabled:!0,name:"dark-yellow",hex:"F9BF3B",rgb:[249,191,59]},{enabled:!0,name:"yellow",hex:"FFE27F",rgb:[255,226,127]},{enabled:!1,name:"light-yellow",hex:"FFF3CB",rgb:[255,243,203]},{enabled:!0,name:"dark-purple",hex:"604B77",rgb:[96,75,119]},{enabled:!0,name:"purple",hex:"755B91",rgb:[117,91,145]},{enabled:!0,name:"light-purple",hex:"C8A5E5",rgb:[200,165,229]},{enabled:!0,name:"dark-navy",hex:"063C53",rgb:[6,60,83]},{enabled:!0,name:"navy",hex:"286BA8",rgb:[40,107,168]},{enabled:!1,name:"light-navy",hex:"85A5CC",rgb:[133,165,204]},{enabled:!0,name:"dark-sky",hex:"4E7AC7",rgb:[78,122,199]},{enabled:!0,name:"sky",hex:"7FB2F0",rgb:[127,178,240]},{enabled:!1,name:"light-sky",hex:"ADD5F7",rgb:[173,213,247]}
1,{enabled:!0,name:"dark-pink",hex:"BF6472",rgb:[191,100,114]},{enabled:!0,name:"pink",hex:"FF8598",rgb:[255,133,152]},{enabled:!0,name:"light-pink",hex:"FFB6C1",rgb:[255,182,193]},{enabled:!0,name:"khaki",hex:"CFC291",rgb:[207,194,145]},{enabled:!0,name:"slate",hex:"535777",rgb:[83,87,119]},{enabled:!0,name:"camo-green",hex:"5B7876",rgb:[91,120,118]},{enabled:!0,name:"turquoise",hex:"00BDC2",rgb:[0,189,194]},{enabled:!0,name:"dark-gray",hex:"303033",rgb:[48,48,51]},{enabled:!0,name:"gray",hex:"A1A1AC",rgb:[161,161,172]},{enabled:!0,name:"medium-gray",hex:"E7E7EA",rgb:[231,231,234]},{enabled:!1,name:"light-gray",hex:"E9EBEE",rgb:[233,235,238]},{enabled:!1,name:"bright-gray",hex:"FAFAFA",rgb:[250,250,250]},{enabled:!1,name:"white",hex:"FFFFFF",rgb:[255,255,255]},{enabled:!0,name:"black",hex:"000000",rgb:[0,0,0]},{enabled:!1,name:"main",hex:"F5F7F9",rgb:[245,247,249]},{enabled:!1,name:"alternative",hex:"EFF2F5",rgb:[239,242,245]},{enabled:!1,name:"bright",hex:"FAFAFA",rgb:[250,250,250]}]}function fixNumberByLocale(t,a){if(t=""+t,a&&(t=t.replace(/-/g,"â")),"et-ee"===LANGUAGE_OPTION||"ru-ru"===LANGUAGE_OPTION){var e=t.split(".").join(",");return e=e.replace(",,,","...")}return t}function _classCallCheck(t,a){if(!(t instanceof a))throw new TypeError("Cannot call a class as a function")}function _classCallCheck(t,a){if(!(t instanceof a))throw new TypeError("Cannot call a class as a function")}function _classCallCheck(t,a){if(!(t instanceof a))throw new TypeError("Cannot call a class as a function")}function _classCallCheck(t,a){if(!(t instanceof a))throw new TypeError("Cannot call a class as a function")}function _classCallCheck(t,a){if(!(t instanceof a))throw new TypeError("Cannot call a class as a function")}function _classCallCheck(t,a){if(!(t instanceof a))throw new TypeError("Cannot call a class as a function")}function _classCallCheck(t,a){if(!(t instanceof a))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function t(t,a){for(var e=0;e<a.length;e++){var i=a[e];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(a,e,i){return e&&t(a.prototype,e),i&&t(a,i),a}}(),Graph=function(){function t(a){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};_classCallCheck(this,t),this.el=a,this.options={size:e.size||600,eval:e.eval||window.eval,button:e.button||"Load"},this.onload=null,this.onrender=null,this.api_url="https://foxcademy.com/foxapiV3/v2/public/widget/",this._models=new Models(this),this.sliders=[],this.instructions=[],this.size=this.options.size,this.eval=this.options.eval,this.create()}return _createClass(t,[{key:"create",value:function(){this.layers=document.createElement("div"),this.layers.setAttribute("name","MainLayer"),this.layers.style.boxSizing="border-box",this.layers.style.overflow="hidden",this.layers.style.position="relative",this.layers.style.display="flex",this.layers.style.alignItems="center",this.layers.style.justifyContent="center",this.layers.style.height=this.size+"px",this.el.appendChild(this.layers)}},{key:"load",value:function(){var t=this,a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(this.uuid=a,null!=this.uuid){var e=window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP");e.open("GET",this.api_url+this.uuid),e.onload=function(){t.handle(e)},e.send()}}},{key:"hasSliders",value:function(){return this.sliders.length>0}},{key:"getSliders",value:function(){return this.sliders}},{key:"hasInstructions",value:function(){return this.instructions.length>0}},{key:"getInstructions",value:function(){return this.instructions}},{key:"addInstructions",value:function(t){var a=!0,e=!1,i=void 0;try{for(var s,n=this.instructions[Symbol.iterator]();!(a=(s=n.next()).done);a=!0){var r=s.value;if(null==r._node){var l=document.createElement("div");r._node=document.createElement("div"),l.appendChild(r._node),t.appendChild(l),r._math=new Text(r._node,r.value,this)}}}catch(t){e=!0,i=t}finally{try{!a&&n.return&&n.return()}finally{if(e)throw i}}}},{key:"addSliders",value:function(t){var a=this,e=function(e){if(null==e._node){var i=document.createElement("div");e._node=document.createElement("input"),e._node.style.width="100%",e._node.type="range",e._node.min=e.min,e._node.max=e.max,e._node.value=e.value,e._node.step=e.interval,e._node.style.setProperty("--color",getRGBFoxColor
1(e.color)),e._node.oninput=function(){a._models.update(e.modal,e._node.value),null!=e.oninput&&"function"==typeof e.oninput&&e.oninput(e._node.value)},i.appendChild(e._node),t.appendChild(i),!0===e.hidden&&(e.style.display="none")}},i=!0,s=!1,n=void 0;try{for(var r,l=this.sliders[Symbol.iterator]();!(i=(r=l.next()).done);i=!0){e(r.value)}}catch(t){s=!0,n=t}finally{try{!i&&l.return&&l.return()}finally{if(s)throw n}}}},{key:"handle",value:function(t){if(t.readyState>3){var a=t.status;if(a>=200&&a<400){var e=JSON.parse(t.responseText);"graph"===e.type&&(this.data=e.content.data,this._checkInstructions(),null!=this.data.img_url?this.graph=new ImageGraph(this,this.data.img_url):(this._checkSliders(),this.graph=new InteractiveGraph(this,this.data)),null!=this.onload&&this.onload())}}}},{key:"resize",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;null!=t&&null!=this.graph&&null!=this.graph.resize&&(this.size=t,this.layers.style.height=this.size+"px",this.graph.resize())}},{key:"_checkSliders",value:function(){var t=!0,a=!1,e=void 0;try{for(var i,s=this.data.equations[Symbol.iterator]();!(t=(i=s.next()).done);t=!0){var n=i.value;"slider"===n.type&&(this.sliders.push(n),this._models.update(n.modal,n.value))}}catch(t){a=!0,e=t}finally{try{!t&&s.return&&s.return()}finally{if(a)throw e}}}},{key:"_checkInstructions",value:function(){Array.isArray(this.data.instructions)&&(this.instructions=this.data.instructions)}}]),t}(),LANGUAGE_OPTION="et-ee",_createClass=function(){function t(t,a){for(var e=0;e<a.length;e++){var i=a[e];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(a,e,i){return e&&t(a.prototype,e),i&&t(a,i),a}}(),ImageGraph=function(){function t(a,e){_classCallCheck(this,t),this.graph=a,this.main_layer=a.layers,this.url=e,this.init()}return _createClass(t,[{key:"init",value:function(){var t=this;this.img=new Image,this.img.src=this.url,this.main_layer.appendChild(this.img),this.img.onload=function(){t.graph.onrender()}}}]),t}(),_createClass=function(){function t(t,a){for(var e=0;e<a.length;e++){var i=a[e];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(a,e,i){return e&&t(a.prototype,e),i&&t(a,i),a}}(),InteractiveGraph=function(){function t(a,e){var i=this;_classCallCheck(this,t),this.graph=a,this.main_layer=a.layers,this.data=e,this.loaded=!1,this.container=null,this.load_container=null,this.equations_container=null,this.graph._models.subscribe(function(t,a){i.modelChanged(t,a)}),this.sumModels=[],this._saved_layers={},this._lines={},this.axis_values=null,this.xaxis=null,this.yaxis=null,this.width=null,this.height=null,this._upperLimit=1e5,this._lowerLimit=-1e5,this.init()}return _createClass(t,[{key:"init",value:function(){this.container=document.createElement("div"),this.container.setAttribute("name","LayersWrapper"),this.container.style.boxSizing="border-box",this.container.style.position="relative",this.appendLoadLayer(),this.main_layer.appendChild(this.container)}},{key:"resize",value:function(){!0===this.loaded&&(this.setSize(),this.resizeLayers(),this.configure(),this.replaceAllModelValues(),this.drawEquations(null))}},{key:"appendLoadLayer",value:function(){var t=this;this.load_container=document.createElement("div"),this.load_container.setAttribute("name","LoadLayer"),this.load_container.style.position="relative";var a=document.createElement("img");a.src="https://foxcademy.com/fox/assets/img/widgets/load-graph-placeholder.svg";var e=document.createElement("button");e.style.position="absolute",e.style.left="50%",e.style.top="50%",e.style.transform="translate(-50%, 0)",e.innerText=this.graph.options.button,e.onclick=function(){t.loadGraph()},this.load_container.appendChild(a),this.load_container.appendChild(e),this.main_layer.appendChild(this.load_container)}},{key:"removeLoadLayer",value:function(){null!=this.load_container&&null!=this.load_container.parentNode&&(this.load_container.parentNode.removeChild(this.load_container),this.loaded=!0)}},{key:"loadGraph",value:function(){var t=this;this.setSize(),this.fixInitialValues(),this.appendBasicLayers(),this.configure(),this.replaceAllModelValues(),this.drawEquations(null),this.mouseCoordinates=new Coordinates(this),this.removeLoadLayer(),setTimeout(function(){t.initAxisImages(),t.equations=new TextEquations(t),t.equations.draw(),null!=t.graph.onrender&&"function"==typeof t.graph.onrender&&t.graph.onrender()},200)}},{key:"replaceAllModelValues",value:function(){var t=!0,a=!1,e=void 0;try{for(var i,s=this.data.equations[Symbol.iterator]();!(t=(i=s.next()).done);t=!0){var n=i.value;n._replacedData={},"formula"===n.type?(null==n.area_start&&(n.area_start=""),null==n.area_end&&(n.area_end=""),null!=n.x_start&&""!==n.x_start||(n.x_start=""+this.data.minx),null!=n.x_end&&""!==n.x_end||(n.x_end=""+this.data.maxx),this.initFormula(n)):"array"===n.type?n._replacedData={points:this.graph._models.replaceModelValues(n.data_array)}:"polygon"===n.type?n._replacedData={x:this.graph._models.replaceModelValues(n.x),y:this.graph._models.replaceModelValues(n.y),rotation:this.graph._models.replaceModelValues(n.rotation)}:"arc"===n.type?n._replacedData={x:this.graph._models.replaceModelValues(n.x),y:this.graph._models.replaceModelValues(n.y),rotation:this.graph._models.replaceModelValues(n.rotation),start_angle:this.graph._models.replaceModelValues(n.start_angle),end_angle:this.graph._models.replaceModelValues(n.end_angle),radius:this.graph._models.replaceModelValues(n.radius)}:n.type,null!=n.equation&&null!=n.equation_x&&null!=n.equation_y&&(n.equation_x+="",n.equation_y+="",this.generateEquationVisibleText(n),n._replacedData.equationX=this.graph._models.replaceModelValues(n.equation_x),n._replacedData.equationY=this.graph._models.replaceModelValues(n.equation_y),n._styles=this.getEquationStyle(n))}}catch(t){a=!0,e=t}finally{try{!t&&s.return&&s.return()}finally{if(a)throw e}}}},{key:"modelChanged",value:function(t){if(!1!==this.loaded)for(var a=0;a<this.data.equations.length;a++){var e=this.data.equations[a];if(null==e._replacedData&&(e._replacedData={}),"formula"!==e.type||-1===e.formula.indexOf(t)&&-1===e.area_start.indexOf(t)&&-1===e.area_end.indexOf(t)&&-1===e.x_start.indexOf(t)&&-1===e.x_end.indexOf(t)){if("array"===e.type&&-1!==e.data_array.indexOf(t))e._replacedData.points=this.graph._models.replaceModelValues(e.data_array),this.drawEquations(a);else if("polygon"===e.type||"arc"===e.type){var i=!1;-1!==e.x.indexOf(t)&&(e._replacedData.x=this.graph._models.replaceModelValues(e.x),i=!0),-1!==e.y.indexOf(t)&&(e._replacedData.y=this.graph._models.replaceModelValues(e.y),i=!0),-1!==e.rotation.indexOf(t)&&(e._replacedData.rotation=this.graph._models.replaceModelValues(e.rotation),i=!0),"arc"===e.type&&(-1!==e.start_angle.indexOf(t)&&(e._replacedData.start_angle=this.graph._models.replaceModelValues(e.start_angle),i=!0),-1!==e.end_angle.indexOf(t)&&(e._replacedData.end_angle=this.graph._models.replaceModelValues(e.end_angle),i=!0),-1!==e.radius.indexOf(t)&&(e._replacedData.radius=this.graph._models.replaceModelValues(e.radius),i=!0)),i&&this.drawEquations(a)}}else this.initFormula(e),this.drawEquations(a);null==e.equation||null==e.equation_x||null==e.equation_y||-1===e.equation_x.indexOf(t)&&-1===e.equation_y.indexOf(t)&&-1===e.equation.indexOf(t)||(this.generateEquationVisibleText(e),e._replacedData.equationX=this.graph._models.replaceModelValues(e.equation_x),e._replacedData.equationY=this.graph._models.replaceModelValues(e.equation_y),e._styles=this.getEquationStyle(e),null!=e._draw&&e._draw())}}},{key:"initFormula",value:function(t){t._replacedData.formula=this.graph._models.replaceModelValues(t.formula),t._replacedData.areaStart=this.graph._models.replaceModelValues(t.area_start),t._replacedData.areaEnd=this.graph._models.replaceModelValues(t.area_end),t._replacedData.xStart=this.graph._models.replaceModelValues(t.x_start),t._replacedData.xEnd=this.graph._models.replaceModelValues(t.x_end)}},{key:"generateEquationVisibleText",value:function(t){for(var a=""+t.equation,e=""+t.equation,i=/{{.*?}}/g,s=i.exec(a),n=!1;null!==s;){for(var r=s[0],l=this.replaceWithValues(r),h=10,o=0;-1!==e.indexOf(r)&&o<h;)e=e.replace(r,l),o++;s=i.exec(a),n=!0}if(t._replacedData.equation=e,!1===n){var c=this.graph._models.replaceModelValues(t.equation,!0);isNaN(c)&&(t._replacedData.equation=c)}}},{key:"replaceWithValues",value:function(t){t=t.replace("{{","").replace("}}","");var a=this.graph._models.calculateFormula(t);return a=fixNumberByLocale(a)}},{key:"setSize",value:function(){this.size=this.graph.size||Math.min(this.main_layer.clientHeight,this.main_layer.clientWidth),this.width=this.size,this.height=this.size}},{key:"fixInitialValues",value:function(){null==this.data.drawGri
1d&&(this.data.drawGrid=!0),null==this.data.drawAxises&&(this.data.drawAxises=!0),null==this.data.x_text&&(this.data.x_text='<p><math xmlns="https://www.w3.org/1998/Math/MathML"><mi>x</mi></math></p>'),null==this.data.y_text&&(this.data.y_text='<p><math xmlns="https://www.w3.org/1998/Math/MathML"><mi>y</mi></math></p>');try{this.data.miny=parseFloat(this.data.miny)}catch(t){this.data.miny=-10}try{this.data.minx=parseFloat(this.data.minx)}catch(t){this.data.minx=-10}try{this.data.maxx=parseFloat(this.data.maxx)}catch(t){this.data.maxx=10}try{this.data.maxy=parseFloat(this.data.maxy)}catch(t){this.data.maxy=10}if(this.data.minx>this.data.maxx){var t=this.data.minx;this.data.minx=this.data.maxx,this.data.maxx=t}else this.data.minx===this.data.maxx&&this.data.maxx++;if(this.data.miny>this.data.maxy){var a=this.data.miny;this.data.miny=this.data.maxy,this.data.maxy=a}else this.data.miny===this.data.maxy&&this.data.maxy++}},{key:"resizeLayers",value:function(){var t=this;this._bottomLayer.canvas.width=this.width,this._bottomLayer.canvas.height=this.height,this._coordinateLayer.canvas.width=this.width,this._coordinateLayer.canvas.height=this.height,Object.keys(this._saved_layers).map(function(a){var e=t._saved_layers[a];e.canvas.width=t.width,e.canvas.height=t.height})}},{key:"createLayer",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],a=arguments.length>1&&void 0!==arguments[1]&&arguments[1],e=document.createElement("canvas");a||(e.style.pointerEvents="none"),t&&(e.style.position="absolute",e.style.left="0",e.style.top="0"),e.width=this.width,e.height=this.height;var i=e.getContext("2d");return this.container.appendChild(e),{canvas:e,ctx:i,clear:function(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height)}}}},{key:"appendBasicLayers",value:function(){this._bottomLayer=this.createLayer(),this._coordinateLayer=this.createLayer(!0,!0),this._coordinateLayer.canvas.style.zIndex=10}},{key:"configure",value:function(t){this.constants={},this.constants.tickSize=16,this.constants.totalTicks=this.width/60,this.constants.unitsPerTickX=this.fixTickUnits((this.data.maxx-this.data.minx)/this.constants.totalTicks),this.constants.unitsPerTickY=this.fixTickUnits((this.data.maxy-this.data.miny)/this.constants.totalTicks),this.constants.decimalsPlacesX=this.coordinateDecimals(this.constants.unitsPerTickX),this.constants.decimalsPlacesY=this.coordinateDecimals(this.constants.unitsPerTickY),this.constants.rangeX=this.data.maxx-this.data.minx,this.constants.rangeY=this.data.maxy-this.data.miny,this.constants.unitX=this.width/this.constants.rangeX,this.constants.unitY=this.height/this.constants.rangeY,this.data.minx>0?this.constants.centerX=Math.round((0-this.data.minx)/this.constants.rangeX*this.width):this.constants.centerX=Math.round(Math.abs(this.data.minx/this.constants.rangeX)*this.width),this.data.maxy<0?this.constants.centerY=Math.round(this.data.maxy/this.constants.rangeY*this.height):this.constants.centerY=Math.round(Math.abs(this.data.maxy/this.constants.rangeY)*this.height),null==this.data.calculated_points?this.data.calculated_points=400:this.data.calculated_points>5e3?this.data.calculated_points=5e3:this.data.calculated_points<1&&(this.data.calculated_points=1),this.constants.iteration=(this.data.maxx-this.data.minx)/this.data.calculated_points,this.constants.scaleX=this.width/this.constants.rangeX,this.constants.scaleY=this.height/this.constants.rangeY,"rad"===this.data.x_axis_type||"deg"===this.data.x_axis_type?(this.constants.xPosIncrement=Math.PI/2*this.constants.unitX,this.constants.unitsPerTickX=Math.PI/2):this.constants.xPosIncrement=this.constants.unitsPerTickX*this.constants.unitX,"rad"===this.data.y_axis_type||"deg"===this.data.y_axis_type?(this.constants.yPosIncrement=Math.PI/2*this.constants.unitY,this.constants.unitsPerTickY=Math.PI/2):this.constants.yPosIncrement=this.constants.unitsPerTickY*this.constants.unitY,this.constants.yPosIncrement=this.constants.unitsPerTickY*this.constants.unitY,this.constants.snap={x:.1*this.constants.unitsPerTickX,y:.1*this.constants.unitsPerTickY},this._bottomLayer.clear(),null==this.grid&&(this.grid=new Grid(this)),this.data.drawGri
1d&&this.grid.draw(),this.data.drawAxises&&(this.grid.drawXAxis(),this.grid.drawYAxis()),null!=t&&t()}},{key:"initAxisImages",value:function(){this.data.drawAxises&&(this.axis_values=document.createElement("div"),this.axis_values.setAttribute("name","AxisValues"),this.axis_values.style.zIndex=1,"hidden"!==this.data.x_axis_type&&(this.xaxis=document.createElement("div"),this.xaxis.setAttribute("name","Xaxis"),this.xaxis.innerHTML=this.data.x_text,this.xaxis.style.position="absolute",this.axis_values.appendChild(this.xaxis)),"hidden"!==this.data.y_axis_type&&(this.yaxis=document.createElement("div"),this.yaxis.setAttribute("name","Yaxis"),this.yaxis.innerHTML=this.data.y_text,this.yaxis.style.position="absolute",this.axis_values.appendChild(this.yaxis)),this.container.appendChild(this.axis_values),this.putMathOnGraph())}},{key:"putMathOnGraph",value:function(){var t={el:this.axis_values.children[0]},a={el:this.axis_values.children[1]};t._styles=this.getEquationStyle({_replacedData:{equationX:""+this.data.maxx,equationY:"0"},equation_on_coordinates:!0,equation_translate:!0}),a._styles=this.getEquationStyle({_replacedData:{equationX:"0",equationY:""+this.data.maxy},equation_on_coordinates:!0,equation_translate:!0}),t.el&&t.el.style&&(t.el.style.left=t._styles.left,t.el.style.top=t._styles.top,t.el.style.transform=t._styles.transform),a.el&&a.el.style&&(a.el.style.left=a._styles.left,a.el.style.top=a._styles.top,a.el.style.transform=a._styles.transform)}},{key:"drawEquations",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,a=0,e=this.data.equations.length;null!=t&&(a=t,e=t+1);for(var i=a;i<e;i++){var s=this.data.equations[i];if("slider"!==s.type){var n=void 0;if(null!=this._saved_layers[i]?(n=this._saved_layers[i],n.clear()):(n=this.createLayer(!0,!1),n._index=i,this._saved_layers[i]=n),"formula"===s.type){var r=this.equation(s,n);this._lines[i]={type:s.type,line:r}}else if("array"===s.type){var l=this.vectorPoints(s,n);this._lines[i]={type:s.type,line:l}}else"polygon"===s.type?this.polygon(s,n):"arc"===s.type&&this.arc(s,n)}}}},{key:"equation",value:function(t,a){var e=this,i=[];if(""===t._replacedData.formula)return i;var s=a.ctx;s.beginPath(),t.dashed?s.setLineDash([6,4]):s.setLineDash([]),s.save(),this.transformContext(a);var n=new RegExp("x","g"),r=function(a){try{var i=t._replacedData.formula.replace(n,"(x)").replace(n,a),s=e.correctRounding(e.graph.eval(i));return s===1/0||s===-1/0?s:s>e._upperLimit?e._upperLimit:s<e._lowerLimit?e._lowerLimit:s}catch(t){return 0}},l=this.correctRounding(this.graph.eval(t._replacedData.xStart)),h=this.correctRounding(this.graph.eval(t._replacedData.xEnd));s.moveTo(l,r(l));for(var o=null,c=null,d=null,u=this.correctRounding(l+this.constants.iteration);u<=h;u=this.correctRounding(u+this.constants.iteration)){if(0===this.correctRounding(u-this.constants.iteration)){var p=1e-6,y=p.toFixed(6);d=r(y),this.appendLine(a,y,d,c,o),c=y,o=d,i.push([c,o])}if(d=r(u),this.appendLine(a,u,d,c,o),c=u,o=d,i.push([c,o]),0===this.correctRounding(u+this.constants.iteration)){var g=-1e-6,x=g.toFixed(6);d=r(x),this.appendLine(a,x,d,c,o),c=x,o=d,i.push([c,o])}if(u<l&&this.correctRounding(u+this.constants.iteration)>l){var v=Math.ceil(l);d=r(v),this.appendLine(a,v,d,c,o),c=v,o=d,i.push([c,o])}else if(u<h&&this.correctRounding(u+this.constants.iteration)>h){var f=h;d=r(f),this.appendLine(a,f,d,c,o),c=f,o=d,i.push([c,o])}var m=r(this.correctRounding(u+33.5*this.constants.iteration));isNaN(d)&&isNaN(m)&&(u+=32*this.constants.iteration)}s.restore(),s.lineJoin="round",s.lineWidth=t.thickness||1;var _=t.color||"#3ABB54";if(s.strokeStyle=getRGBFoxColor(_,1),s.stroke(),s.closePath(),""!==t.area_start&&""!==t.area_end){var b=t._replacedData.areaStart,k=t._replacedData.areaEnd;b=this.correctRounding(this.graph.eval(b)),k=this.correctRounding(this.graph.eval(k)),l<=b&&h>=k&&this.drawArea(a,i,b,k,t.color,r)}return i}},{key:"drawArea",value:function(t,a,e,i,s,n){var r=t.ctx,l={a:0,b:0,h:0,sum:0,value:function(){this.sum+=Math.abs((this.a+this.b)/2*this.h)}},h=!1,o=!1,c=!1,d=0;r.beginPath(),r.save(),this.transformContext(t);for(var u=void 0,p=void 0,y=0;y<a.length;y++)!h&&!o&&a[y][0]+this.constants.iteration>e||a[y][0]===e?isNaN(a[y][1])?c=!0:(c?d=u:p=a[y][0]===e?a[y][1]:n(e),u=e,r.moveTo(u,0),r.lineTo(u,p),h=!0,l.a=p):h&&!o&&(u=a[y][0],p=a[y][1],r.lineTo(u,p),l.b=a[y][1],a[y-1][0]<e?l.h=Math.abs(e-a[y][0]):l.h=Math.abs(a[y-1][0]-a[y][0]),l.value(),l.a=a[y][1]),(!o&&a[y][0]+this.constants.iteration>i||a[y][0]===i)&&(a[y][0]!==i?(p=n(i),l.h=Math.abs(i-a[y][0]),l.b=p,l.value()):p=a[y][1],u=i,r.lineTo(u,0),c?r.lineTo(d,0):r.lineTo(e,0),h=!1,o=!0);var g=Math.round(100*l.sum)/100;null==t._sumIndex&&(t._sumIndex="S"+(this.sumModels.length+1),this.sumModels.push({model:t._sumIndex,value:g})),this.graph._models.update(t._sumIndex,g),r.fillStyle=getRGBFoxColor
1(s,.3),r.fill(),r.restore()}},{key:"vectorPoints",value:function(t,a){var e=a.ctx;e.beginPath(),t.dashed?e.setLineDash([6,4]):e.setLineDash([]),e.save(),this.transformContext(a);var i=void 0;try{i=this.graph.eval(t._replacedData.points)}catch(a){i=t._replacedData.points}var s=[];i.split?s=i.split(";"):s.push(i.join(","));for(var n=[],r=null,l=null,h=0;h<s.length;h++)if(r=s[h].split(","),null!=r[0]&&null!=r[1]){try{r[0]=Math.round(1e6*this.graph.eval(r[0]))/1e6,r[1]=Math.round(1e6*this.graph.eval(r[1]))/1e6}catch(t){break}0===h&&e.moveTo(r[0],r[1]),t.line?e.lineTo(r[0],r[1]):(e.moveTo(r[0],r[1]),this.drawEllipse(e,r[0],r[1],8/this.constants.scaleX,8/this.constants.scaleY)),n.push([r[0],r[1]]),h===s.length-2&&t.arrows&&t.line&&(l=r),h===s.length-1&&t.arrows&&t.line&&null!==l&&e.lineTo(r[0],r[1])}e.restore(),e.lineJoin="round",e.lineWidth=t.thickness||1;var o=t.color||"000000";return e.strokeStyle=getRGBFoxColor(o,1),t.line||(null==t.filled||!0===t.filled?(e.fillStyle=getRGBFoxColor(o,1),e.fill()):(e.strokeStyle=getRGBFoxColor(o,1),e.fillStyle="#FFF",e.fill(),e.stroke())),e.stroke(),e.closePath(),t.arrows&&t.line&&null!==l&&(r[0]!==l[0]||r[1]!==l[1])&&this.appendArrow(a,r[0],r[1],l[0],l[1]),n}},{key:"polygon",value:function(t,a){var e=a.ctx;e.beginPath(),e.save(),this.transformContext(a);var i=t.style,s=parseFloat(this.graph.eval(t._replacedData.x)),n=parseFloat(this.graph.eval(t._replacedData.y)),r=parseFloat(this.graph.eval(t._replacedData.rotation));e.moveTo(s,n);var l={x:s,y:n},h=90-r,o=t.angles,c={xmin:null,xmax:null,ymin:null,ymax:null},d={x:null,y:null},u=null,p=[];p.push({x:l.x,y:l.y});for(var y=0;y<o.length;y++){var g=o[y];if(y===o.length-1){var x=Math.round(100*Math.sqrt(Math.pow(Math.abs(s-l.x),2)+Math.pow(Math.abs(n-l.y),2)))/100;g.size=x,d={x:s,y:n}}else{isNaN(g.value)&&(g.value=0),u=180-this.correctRounding(this.graph.eval(g.value.toString()));var v=this.correctRounding(this.graph.eval(g.size.toString()));l.x+=v*Math.sin(Math.PI/180*h),l.y+=v*Math.cos(Math.PI/180*h),d.x=l.x,d.y=l.y,p.push({x:l.x,y:l.y})}e.lineTo(d.x,d.y),null===c.xmax?(c.xmax=d.x,c.xmin=d.x,c.ymax=d.y,c.ymin=d.y):(d.x>c.xmax?c.xmax=d.x:d.x<c.xmin&&(c.xmin=d.x),d.y>c.ymax?c.ymax=d.y:d.y<c.ymin&&(c.ymin=d.y)),h-=u}var f=p[p.length-2],m=p[p.length-1],_=p[0],b=(_.x-m.x)*(f.x-m.x)+(_.y-m.y)*(f.y-m.y),k=Math.sqrt(Math.pow(m.x-_.x,2)+Math.pow(m.y-_.y,2))*Math.sqrt(Math.pow(f.x-m.x,2)+Math.pow(f.y-m.y,2)),w=Math.round(180*Math.acos(b/k)/Math.PI*100)/100;o[o.length-2].value=w,e.restore(),e.strokeStyle=getRGBFoxColor(i.stroke,1),e.lineWidth=t.thickness||2,e.stroke(),"none"!==i.fill_type&&this.getFill(e,i,c),e.closePath()}},{key:"arc",value:function(t,a){var e=a.ctx;e.save(),this.transformContext(a);var i=parseFloat(this.graph.eval(t._replacedData.x)),s=parseFloat(this.graph.eval(t._replacedData.y)),n=parseFloat(this.graph.eval(t._replacedData.rotation)),r=parseFloat(this.graph.eval(t._replacedData.start_angle)),l=parseFloat(this.graph.eval(t._replacedData.end_angle)),h=parseFloat(this.graph.eval(t._replacedData.radius)),o=t.style;e.translate(i,s),e.rotate(Math.PI/180*n);var c=void 0;if("side"===t.anchor.type){var d=t.anchor.value;c={x:-h*Math.cos(Math.PI/180*d),y:-h*Math.sin(Math.PI/180*d)}}else c={x:0,y:0};e.beginPath();var u=r+(360-l)>0&&t.connect_to_segment;u&&e.moveTo(0+c.x,0+c.y),e.arc(0+c.x,0+c.y,h,Math.PI/180*r,Math.PI/180*l),u&&e.lineTo(0+c.x,0+c.y),e.restore(),e.strokeStyle=getRGBFoxColor(o.stroke,1),e.lineWidth=t.thickness||2,e.stroke();var p={xmin:i-h,xmax:i+h,ymin:s-h,ymax:s+h};"none"!==o.fill_type&&this.getFill(e,o,p),e.closePath()}},{key:"transformContext",value:function(t){t.ctx.translate(this.constants.centerX,this.constants.centerY),t.ctx.scale(this.constants.scaleX,-this.constants.scaleY)}},{key:"fixTickUnits",value:function(t){return t<=.005?.005:t<=.01?.01:t<=.04?.025:t<=.1?.05:t<=.2?.1:t<=.4?.25:t<=.8?.5:t<=1.8?1:t<=3.8?2:t<=9?5:t<=19?10:t<=25?20:t<=35?25:t<=50?50:t<=90?100:t<=170?200:t<=270?250:t<=900?500:t<=2500?1e3:t<=3500?2e3:t<=3500?2500:t<=5500?5e3:1e4}},{key:"coordinateDecimals",value:function(t){return t<=.01?5:t<=.1?4:t<=10?3:t<=100?2:t<=1e3?1:0}},{key:"drawEllipse",value:function(t,a,e,i,s){var n=2*i/3,r=.5*s;t.moveTo(a,e-r),t.bezierCurveTo(a+n,e-r,a+n,e+r,a,e+r),t.bezierCurveTo(a-n,e+r,a-n,e-r,a,e-r)}},{key:"appendArrow",value:function(t,a,e,i,s){var n=t.ctx;n.setLineDash([]),n.beginPath(),n.save(),this.transformContext(t);var r=this.constants.scaleX*(a-this.data.minx),l=-this.constants.scaleY*(e-this.data.maxy),h=this.constants.scaleX*(i-this.data.minx),o=-this.constants.scaleY*(s-this.data.maxy),c=0,d=r-h,u=o-l,p=Math.abs(d),y=Math.abs(u);d>0&&u>=0?c=Math.atan(y/p):d<0&&u>=0?c=Math.PI-Math.atan(y/p):d<0&&u<0?c=Math.PI+Math.atan(y/p):d>0&&u<0?c=2*Math.PI-Math.atan(y/p):0===d&&u>0?c=.5*Math.PI:0===d&&u<0&&(c=3*Math.PI*.5);var g=c+Math.PI+Math.PI/6,x=c+Math.PI-Math.PI/6,v=Math.max(this.constants.scaleX,this.constants.scaleY)/Math.min(this.constants.scaleX,this.constants.scaleY),f=16/Math.max(this.constants.scaleX,this.constants.scaleY),m=this.constants.scaleX/this.constants.scaleY,_=this.constants.scaleY/this.constants.scaleX,b=0,k=0,w=0,T=0;m>_?(b=f*Math.cos(g),w=f*Math.sin(g)*v,k=f*Math.cos(x),T=f*Math.sin(x)*v):_>m?(b=f*Math.cos(g)*v,w=f*Math.sin(g),k=f*Math.cos(x)*v,T=f*Math.sin(x)
1):(b=f*Math.cos(g),w=f*Math.sin(g),k=f*Math.cos(x),T=f*Math.sin(x));var M=parseFloat(a)+b,C=parseFloat(e)+w,P=parseFloat(a)+k,F=parseFloat(e)+T;n.moveTo(a,e),n.lineTo(M,C),n.moveTo(a,e),n.lineTo(P,F),n.restore(),n.lineJoin="miter",n.stroke(),n.closePath()}},{key:"appendLine",value:function(t,a,e,i,s){var n=t.ctx;!isNaN(e)&&isNaN(s)?e===-1/0?n.moveTo(a,this._lowerLimit):e===1/0?n.moveTo(a,this._upperLimit):n.moveTo(a,e||e===-1*s||0===a&&(e===this._upperLimit||e===this._lowerLimit)):e===-1/0&&0===a&&s!==this._upperLimit?n.lineTo(a,this._lowerLimit):e===1/0&&s>0?n.lineTo(a,this.data.maxy):e===1/0&&s<0?n.lineTo(a,this.data.miny):s===1/0?(e>0?n.moveTo(a,this.data.maxy):n.moveTo(a,this.data.miny),n.lineTo(a,e)):s>0&&Math.abs(s-e)>50&&e<0?(n.lineTo(i,this.data.maxy),n.moveTo(a,this.data.miny),n.lineTo(a,e)):s<0&&Math.abs(s-e)>50&&e>0?(n.lineTo(i,this.data.miny),n.moveTo(a,this.data.maxy),n.lineTo(a,e)):0===a&&isNaN(e)||n.lineTo(a,e)}},{key:"correctRounding",value:function(t){return Math.round(1e5*t)/1e5}},{key:"getPattern",value:function(t,a,e){var i=document.createElement("canvas");i.height=10,i.width=10;var s=i.getContext("2d");return"horizontal"===t?(s.fillStyle=a,s.fillRect(0,0,i.width,.5*i.height),s.fillStyle=e,s.fillRect(0,.5*i.height,i.width,.5*i.height)):"vertical"===t?(s.fillStyle=a,s.fillRect(0,0,.5*i.width,i.height),s.fillStyle=e,s.fillRect(.5*i.width,0,.5*i.width,i.height)):"diagonal"===t&&(s.translate(0,0),s.rotate(Math.PI/180*45),s.fillStyle=e,s.fillRect(0,.72*-i.height,2*i.width,.4*i.height),s.fillStyle=a,s.fillRect(0,.35*-i.height,2*i.width,.4*i.height),s.fillStyle=e,s.fillRect(0,0,2*i.width,.4*i.height),s.fillStyle=a,s.fillRect(0,.355*i.height,2*i.width,.4*i.height)),s.fill(),i}},{key:"getFill",value:function(t,a,e){var i=getRGBFoxColor(a.color1,1),s=getRGBFoxColor(a.color2,1);if("gradient"===a.fill_type)this.gradientFill(t,e,i,s,45);else if("gradient-horizontal"===a.fill_type)this.gradientFill(t,e,i,s,0);else if("gradient-vertical"===a.fill_type)this.gradientFill(t,e,i,s,90);else{var n=this.getPattern(a.fill_type,i,s),r=t.createPattern(n,"repeat");t.fillStyle=r}t.fill()}},{key:"gradientFill",value:function(t,a,e,i){var s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:45,n=this.constants.centerX+a.xmin*this.constants.scaleX,r=this.constants.centerX+a.xmax*this.constants.scaleX,l=this.constants.centerY+a.ymax*-this.constants.scaleY,h=this.constants.centerY-a.ymin*this.constants.scaleY,o=r-.5*n,c=l-.5*l,d=void 0;45===s?d=t.createLinearGradient(n,l,r,h):0===s?d=t.createLinearGradient(n,c,r,c):90===s&&(d=t.createLinearGradient(o,l,o,h)),d.addColorStop(0,e),d.addColorStop(1,i),t.fillStyle=d}},{key:"findHoverLayer",value:function(t,a){var e=!0,i=!1,s=void 0;try{for(var n,r=Object.keys(this._lines)[Symbol.iterator]();!(e=(n=r.next()).done);e=!0){var l=n.value,h=this._lines[l].line,o=this._lines[l].type;if("array"===o){var c=!0,d=!1,u=void 0;try{for(var p,y=h[Symbol.iterator]();!(c=(p=y.next()).done);c=!0){var g=p.value,x=g[0]>t-this.constants.snap.x&&g[0]<t+this.constants.snap.x,v=g[1]>a-this.constants.snap.y&&g[1]<a+this.constants.snap.y;if(x&&v)return{index:l,x:g[0],y:g[1]}}}catch(t){d=!0,u=t}finally{try{!c&&y.return&&y.return()}finally{if(d)throw u}}}}}catch(t){i=!0,s=t}finally{try{!e&&r.return&&r.return()}finally{if(i)throw s}}var f=!0,m=!1,_=void 0;try{for(var b,k=Object.keys(this._lines)[Symbol.iterator]();!(f=(b=k.next()).done);f=!0){var w=b.value,h=this._lines[w].line,o=this._lines[w].type;if("formula"===o){var T=!0,M=!1,C=void 0;try{for(var P,F=h[Symbol.iterator]();!(T=(P=F.next()).done);T=!0){var L=P.value,S=L[0]>t-this.constants.snap.x&&L[0]<t+this.constants.snap.x,X=L[1]>a-this.constants.snap.y&&L[1]<a+this.constants.snap.y;if(S&&X)return{index:w,x:L[0],y:L[1]}}}catch(t){M=!0,C=t}finally{try{!T&&F.return&&F.return()}finally{if(M)throw C}}}}}catch(t){m=!0,_=t}finally{try{!f&&k.return&&k.return()}finally{if(m)throw _}}return null}},{key:"getEquationStyle",value:function(t){var a=""+t._replacedData.equationX,e=""+t._replacedData.equationY;try{a=this.correctRounding(this.graph.eval(a)),e=this.correctRounding(this.graph.eval(e))}catch(t){a=0,e=0}var i={left:a,top:e};if(t.equation_on_coordinates){var s=100/Math.abs(this.data.minx-this.data.maxx),n=100/Math.abs(this.data.miny-this.data.maxy);i.left=(a-this.data.minx)*s,i.top=(this.data.maxy-e)*n}return i.left+="%",i.top+="%",t.equation_translate&&(i.transform="translate(-"+i.left+", -"+i.top+")"),i}}]),t}(),_createClass=function(){function t(t,a){for(var e=0;e<a.length;e++){var i=a[e];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(a,e,i){return e&&t(a.prototype,e),i&&t(a,i),a}}(),Models=function(){function t(a){_classCallCheck(this,t),this.graph=a,this.models=[],this.callbacks=[]}return _createClass(t,[{key:"subscribe",value:function(t){this.callbacks.push(t)}},{key:"replaceModelValues",value:function(t){var a=arguments.length>1&&void 0!==arguments[1]&&arguments[1];for(var e in this.models)if(-1!==t.indexOf(e)){var i=this.models[e];isNaN(this.models[e])||(i=Number(i)),t=!1===a&&i<0?t.replace(new RegExp(e,"g"),"("+i+")"):t.replace(new RegExp(e,"g"),""+i)}return t}},{key:"calculateFormula",value:function(t){var a=this.replaceModelValues(t);try{var e=this.graph.eval(a);return this.testEvaluatedFormula(e)}catch(t){}try{var i=this.graph.eval(t);return this.testEvaluatedFormula(i)}catch(t){return"-"}}},{key:"testEvaluatedFormula",value:function(t){if(isNaN(t)||""===t)return t;if("string"===t||t instanceof String)return t;if(t<1e-4&&t>0)return"<0.0001";if(t>-1e-4&&t<0)return">-0.0001";if(t===1/0)return"â";if(t===-1/0)return"-â";var a=5,e=t.toFixed(a),i="",s="";"0"!==e[e.length-1]&&t<1e6?i="...":t>1e6&&t%1!=0&&(s="~"),e=e.substring(0,e.length-1).replace(new RegExp("\\d(?=(\\d{3})+\\D)","g"),"$& ");for(var n=e.length,r=e.length-1;r>=0&&"0"===e[r];r--)n=r;return e=e.substring(0,n),"."===e[e.length-1]&&(e=e.substring(0,e.length-1)),e=s+e+i,isNaN(e)?e:Number(e)}},{key:"update",value:function(t,a){this.models[t]=a;var e=!0,i=!1,s=void 0;try{for(var n,r=this.callbacks[Symbol.iterator]();!(e=(n=r.next()).done);e=!0){(0,n.value)(t,a)}}catch(t){i=!0,s=t}finally{try{!e&&r.return&&r.return()}finally{if(i)throw s}}}}]),t}(),_createClass=function(){function t(t,a){for(var e=0;e<a.length;e++){var i=a[e];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(a,e,i){return e&&t(a.prototype,e),i&&t(a,i),a}}(),Text=function(){function t(a,e,i){var s=this;_classCallCheck(this,t),this.el=a,this.original_content=e,this.graph=i,this.graph._models.subscribe(function(t,a){s.modelChanged(t,a)}),this.modelChanged(null,!0)}return _createClass(t,[{key:"modelChanged",value:function(t){if(!0===(arguments.length>1&&void 0!==arguments[1]&&arguments[1])||-1!==this.original_content.indexOf(t)){for(var a=""+this.original_content,e=""+this.original_content,i=/{{.*?}}/g,s=i.exec(a);null!==s;){for(var n=s[0],r=this.replaceWithValues(n),l=10,h=0;-1!==e.indexOf(n)&&h<l;)e=e.replace(n,r),h++;s=i.exec(a)}
1this.el.innerHTML=e}}},{key:"replaceWithValues",value:function(t){t=t.replace("{{","").replace("}}","");var a=this.graph._models.calculateFormula(t);return a=fixNumberByLocale(a)}}]),t}(),_createClass=function(){function t(t,a){for(var e=0;e<a.length;e++){var i=a[e];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(a,e,i){return e&&t(a.prototype,e),i&&t(a,i),a}}(),Coordinates=function(){function t(a){_classCallCheck(this,t),this.graph=a,this.layer=a._coordinateLayer,this.font='12pt STIXGeneral, Lato, "Times New Roman"',this.init()}return _createClass(t,[{key:"init",value:function(){var t=this,a=this.layer.ctx,e=0,i=0,s=0,n=0;this.layer.canvas.addEventListener("mousemove",function(r){if(!1!==t.graph.data.enableHover){t.layer.clear(),e=r.offsetX||r.layerX,i=r.offsetY||r.layerY,s=t.graph.data.minx+e/t.graph.constants.scaleX,n=t.graph.data.maxy+i/-t.graph.constants.scaleY;var l=null;t.graph.loaded&&(l=t.graph.findHoverLayer(s,n)),a.textAlign="right";var h=t.graph.width-20,o=20;a.beginPath();var c="",d="";if(null!==l){var u=!0,p=!1,y=void 0;try{for(var g,x=Object.keys(t.graph._saved_layers)[Symbol.iterator]();!(u=(g=x.next()).done);u=!0){var v=g.value,f=t.graph._saved_layers[v];v===l.index||t.graph.data.equations[v].static?f.canvas.style.opacity="1":f.canvas.style.opacity=".3"}}catch(t){p=!0,y=t}finally{try{!u&&x.return&&x.return()}finally{if(p)throw y}}var m=t.graph.constants.scaleX*(l.x-t.graph.data.minx),_=-t.graph.constants.scaleY*(l.y-t.graph.data.maxy),b=6;a.moveTo(m+b,_),a.arc(m,_,b,0,2*Math.PI),a.lineWidth=1,a.strokeStyle="rgb(0, 167, 255)";try{c=fixNumberByLocale(parseFloat(l.x).toFixed(t.graph.constants.decimalsPlacesX))}catch(t){c="-"}try{d=fixNumberByLocale(parseFloat(l.y).toFixed(t.graph.constants.decimalsPlacesY))}catch(t){c="-"}}else{var k=!0,w=!1,T=void 0;try{for(var M,C=Object.keys(t.graph._saved_layers)[Symbol.iterator]();!(k=(M=C.next()).done);k=!0){var P=M.value;t.graph._saved_layers[P].canvas.style.opacity="1"}}catch(t){w=!0,T=t}finally{try{!k&&C.return&&C.return()}finally{if(w)throw T}}c=fixNumberByLocale(s.toFixed(t.graph.constants.decimalsPlacesX)),d=fixNumberByLocale(n.toFixed(t.graph.constants.decimalsPlacesY))}t.writeCoordinatesOnCanvas(a,c,d,h,o)}}),this.layer.canvas.addEventListener("mouseleave",function(a){t.layer.clear()})}},{key:"writeCoordinatesOnCanvas",value:function(t,a,e,i,s){var n=0;if("hidden"!==this.graph.data.y_axis_type){t.font=this.font;var r=" : "+e;t.fillText(r,i,s),n+=t.measureText(r).width,t.font="italic "+this.font,t.fillText(this.graph.data.coordinateLayerYText,i-n,s)}if("hidden"!==this.graph.data.x_axis_type){t.font=this.font;var l=" : "+a;"hidden"!==this.graph.data.y_axis_type&&(l+=" | "),n+=t.measureText(this.graph.data.coordinateLayerYText).width,t.fillText(l,i-n,s),t.font="italic "+this.font,n+=t.measureText(l).width,t.fillText(this.graph.data.coordinateLayerXText,i-n,s)}t.stroke(),t.closePath()}}]),t}(),_createClass=function(){function t(t,a){for(var e=0;e<a.length;e++){var i=a[e];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(a,e,i){return e&&t(a.prototype,e),i&&t(a,i),a}}(),TextEquations=function(){function t(a){_classCallCheck(this,t),this.graph=a,this.init()}return _createClass(t,[{key:"init",value:function(){this.appendEquationsLayer()}},{key:"appendEquationsLayer",value:function(){this.container=document.createElement("div"),this.container.setAttribute("name","TextEquations"),this.container.style.position="absolute",this.container.style.boxSizing="border-box",this.container.style.width="100%",this.container.style.height="100%",this.container.style.top=0,this.container.style.left=0,this.graph.container.appendChild(this.container)}},{key:"draw",value:function(){var t=this;this.container.innerHTML="";var a=function(a){if(null!=a._replacedData&&null!=a._replacedData.equation&&""!=a._replacedData.equation){var e=document.createElement("div");e.style.position="absolute",e.style.pointerEvents="none",e.style.whiteSpace="nowrap",e.style.position="absolute",e.style.position="absolute",e.style.position="absolute",e.style.color=getRGBFoxColor
1(a.color),a._draw=function(){e.innerHTML=a._replacedData.equation,Object.assign(e.style,a._styles)},t.container.appendChild(e),a._draw()}},e=!0,i=!1,s=void 0;try{for(var n,r=this.graph.data.equations[Symbol.iterator]();!(e=(n=r.next()).done);e=!0){a(n.value)}}catch(t){i=!0,s=t}finally{try{!e&&r.return&&r.return()}finally{if(i)throw s}}}}]),t}(),_createClass=function(){function t(t,a){for(var e=0;e<a.length;e++){var i=a[e];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(a,e,i){return e&&t(a.prototype,e),i&&t(a,i),a}}(),Grid=function(){function t(a){_classCallCheck(this,t),this.graph=a,this.layer=a._bottomLayer,this.font='10pt STIXGeneral, Lato, "Times New Roman"'}return _createClass(t,[{key:"draw",value:function(){this.layer.ctx.beginPath(),this.layer.ctx.save(),this.graph.transformContext(this.layer);for(var t=0;t>this.graph.data.minx;)this.layer.ctx.moveTo(t,this.graph.data.miny),this.layer.ctx.lineTo(t,this.graph.data.maxy),t-=this.graph.constants.unitsPerTickX;for(t=0;t<this.graph.data.maxx;)this.layer.ctx.moveTo(t,this.graph.data.miny),this.layer.ctx.lineTo(t,this.graph.data.maxy),t+=this.graph.constants.unitsPerTickX;for(var a=0;a<this.graph.data.maxy;)this.layer.ctx.moveTo(this.graph.data.minx,a),this.layer.ctx.lineTo(this.graph.data.maxx,a),a+=this.graph.constants.unitsPerTickY;for(a=0;a>this.graph.data.miny;)this.layer.ctx.moveTo(this.graph.data.minx,a),this.layer.ctx.lineTo(this.graph.data.maxx,a),a-=this.graph.constants.unitsPerTickY;this.layer.ctx.restore(),this.layer.ctx.lineWidth=2,this.layer.ctx.strokeStyle="rgba(170,170,170,.1)",this.layer.ctx.stroke(),this.layer.ctx.closePath()}},{key:"getPiValue",value:function(t){if(t%180==0){var a=t/180;return 1===a?"Ï":-1===a?"-Ï":a+"Ï"}return""}},{key:"drawXAxis",value:function(){if("hidden"!==this.graph.data.x_axis_type){var t=this.layer.ctx;if(t.font=this.font,t.strokeStyle="#aaaaaa",t.fillStyle="#aaaaaa",t.lineWidth=2,this.graph.data.maxy>=0){t.beginPath(),t.textAlign="center",t.textBaseline="top",t.moveTo(0,this.graph.constants.centerY),this.graph.constants.centerX===this.layer.canvas.width?t.lineTo(this.layer.canvas.width,this.graph.constants.centerY):(t.lineTo(this.layer.canvas.width-20,this.graph.constants.centerY),t.moveTo(this.layer.canvas.width-25,this.graph.constants.centerY-5),t.lineTo(this.layer.canvas.width-20,this.graph.constants.centerY),t.moveTo(this.layer.canvas.width-25,this.graph.constants.centerY+5),t.lineTo(this.layer.canvas.width-20,this.graph.constants.centerY));var a=void 0,e=void 0,i=this.graph.constants.centerY+.5*this.graph.constants.tickSize+4;for(i>this.graph.height-10&&(i=this.graph.constants.centerY-.5*this.graph.constants.tickSize-14),a=this.graph.constants.centerX-this.graph.constants.xPosIncrement,e="rad"===this.graph.data.x_axis_type||"deg"===this.graph.data.x_axis_type?-1*Math.round(180*this.graph.constants.unitsPerTickX/Math.PI):-1*Math.round(1e3*this.graph.constants.unitsPerTickX)/1e3;a>0;)a>30&&(t.moveTo(a,this.graph.constants.centerY-.5*this.graph.constants.tickSize),t.lineTo(a,this.graph.constants.centerY+.5*this.graph.constants.tickSize),this.graph.data.axis_values&&("rad"===this.graph.data.x_axis_type?t.fillText(this.getPiValue(e),a,i):"deg"===this.graph.data.x_axis_type?t.fillText(e+"°",a,i):t.fillText(e,a,i))),"rad"===this.graph.data.x_axis_type||"deg"===this.graph.data.x_axis_type?e-=Math.round(180*this.graph.constants.unitsPerTickX/Math.PI):e=Math.round(1e3*(e-this.graph.constants.unitsPerTickX))/1e3,a-=this.graph.constants.xPosIncrement;for(this.graph.data.drawAxises&&"hidden"===this.graph.data.y_axis_type&&(a=this.graph.constants.centerX,e=0,t.moveTo(a,this.graph.constants.centerY-.5*this.graph.constants.tickSize),t.lineTo(a,this.graph.constants.centerY+.5*this.graph.constants.tickSize),this.graph.data.axis_values&&("rad"===this.graph.data.x_axis_type?t.fillText(this.getPiValue(e),a,i):"deg"===this.graph.data.x_axis_type?t.fillText(e+"°",a,i):t.fillText(e,a,i))),a=this.graph.constants.centerX+this.graph.constants.xPosIncrement,e="rad"===this.graph.data.x_axis_type||"deg"===this.graph.data.x_axis_type?Math.round(180*this.graph.constants.unitsPerTickX/Math.PI):Math.round(1e3*this.graph.constants.unitsPerTickX)/1e3;a<this.graph.width;)a<this.graph.width-30&&(t.moveTo(a,this.graph.constants.centerY-.5*this.graph.constants.tickSize),t.lineTo(a,this.graph.constants.centerY+.5*this.graph.constants.tickSize),this.graph.data.axis_values&&("rad"===this.graph.data.x_axis_type?t.fillText(this.getPiValue(e),a,i):"deg"===this.graph.data.x_axis_type?t.fillText(e+"°",a,i):t.fillText(e,a,i))),"rad"===this.graph.data.x_axis_type||"deg"===this.graph.data.x_axis_type?e+=Math.round(180*this.graph.constants.unitsPerTickX/Math.PI):e=Math.round(1e3*(e+this.graph.constants.unitsPerTickX))/1e3,a+=this.graph.constants.xPosIncrement;t.stroke(),t.closePath()}}}},{key:"drawYAxis",value:function(){if("hidden"!==this.graph.data.y_axis_type){var t=this.layer.ctx;if(t.font=this.font,t.strokeStyle="#aaaaaa",t.fillStyle="#aaaaaa",t.lineWidth=2,this.graph.data.minx<=0){t.beginPath(),0===this.graph.constants.centerY?(t.moveTo(this.graph.constants.centerX,0),t.lineTo(this.graph.constants.centerX,this.layer.canvas.width)):(t.moveTo(this.graph.constants.centerX,25),t.lineTo(this.graph.constants.centerX,this.layer.canvas.width),t.moveTo(this.graph.constants.centerX-5,30),t.lineTo(this.graph.constants.centerX,25),t.moveTo(this.graph.constants.centerX+5,30),t.lineTo(this.graph.constants.centerX,25)),t.textBaseline="middle";var a=void 0,e=void 0,i=this.graph.constants.centerX-.5*this.graph.constants.tickSize-6;for(i<10?(i=this.graph.constants.centerX+.5*this.graph.constants.tickSize+6,t.textAlign="left"):t.textAlign="right",a=this.graph.constants.centerY-this.graph.constants.yPosIncrement,e="rad"===this.graph.data.y_axis_type||"deg"===this.graph.data.y_axis_type?Math.round(180*this.graph.constants.unitsPerTickY/Math.PI):Math.round(1e3*this.graph.constants.unitsPerTickY)/1e3;a>0;)a>30&&(t.moveTo(this.graph.constants.centerX-.5*this.graph.constants.tickSize,a),t.lineTo(this.graph.constants.centerX+.5*this.graph.constants.tickSize,a),this.graph.data.axis_values&&("rad"===this.graph.data.y_axis_type?t.fillText(this.getPiValue(e),i,a):"deg"===this.graph.data.y_axis_type?t.fillText(e+"°",i,a):t.fillText(e,i,a))),"rad"===this.graph.data.y_axis_type||"deg"===this.graph.data.y_axis_type?e+=Math.round(180*this.graph.constants.unitsPerTickY/Math.PI):e=Math.round(1e3*(e+this.graph.constants.unitsPerTickY))/1e3,a-=this.graph.constants.yPosIncrement;
1for(this.graph.data.drawAxises&&"hidden"===this.graph.data.x_axis_type&&(a=this.graph.constants.centerY,e=0,t.moveTo(this.graph.constants.centerX-.5*this.graph.constants.tickSize,a),t.lineTo(this.graph.constants.centerX+.5*this.graph.constants.tickSize,a),this.graph.data.axis_values&&("rad"===this.graph.data.y_axis_type?t.fillText(this.getPiValue(e),i,a):"deg"===this.graph.data.y_axis_type?t.fillText(e+"°",i,a):t.fillText(e,i,a))),a=this.graph.constants.centerY+this.graph.constants.yPosIncrement,e="rad"===this.graph.data.y_axis_type||"deg"===this.graph.data.y_axis_type?-1*Math.round(180*this.graph.constants.unitsPerTickY/Math.PI):-1*Math.round(1e3*this.graph.constants.unitsPerTickY)/1e3;a<this.layer.canvas.height;)a<this.graph.height-30&&(t.moveTo(this.graph.constants.centerX-.5*this.graph.constants.tickSize,a),t.lineTo(this.graph.constants.centerX+.5*this.graph.constants.tickSize,a),this.graph.data.axis_values&&("rad"===this.graph.data.y_axis_type?t.fillText(this.getPiValue(e),i,a):"deg"===this.graph.data.y_axis_type?t.fillText(e+"°",i,a):t.fillText(e,i,a))),"rad"===this.graph.data.y_axis_type||"deg"===this.graph.data.y_axis_type?e-=Math.round(180*this.graph.constants.unitsPerTickY/Math.PI):e=Math.round(1e3*(e-this.graph.constants.unitsPerTickY))/1e3,a+=this.graph.constants.yPosIncrement;t.stroke(),t.closePath()}}}}]),t}();
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.