From 1ea94c97ac3cffc9741eed32df794583a5abc8df Mon Sep 17 00:00:00 2001 From: merefield Date: Mon, 26 Oct 2026 17:52:37 +0000 Subject: [PATCH 1/8] FEATURE: bundle mathematical function graphs and plotting tool --- README.md | 41 ++++ .../components/function-plot-block.gjs | 128 ++++++++++++ .../discourse/initializers/function-plot.js | 23 +++ .../discourse/lib/function-plot-expression.js | 187 ++++++++++++++++++ assets/stylesheets/common/chatbot_common.scss | 41 ++++ config/locales/client.en.yml | 6 + config/locales/server.en.yml | 13 ++ config/settings.yml | 3 + lib/discourse_chatbot/bot.rb | 4 + lib/discourse_chatbot/function_plot.rb | 72 +++++++ lib/discourse_chatbot/tool.rb | 1 + lib/discourse_chatbot/tools/function_plot.rb | 48 +++++ plugin.rb | 2 +- public/function-plot/1.26.0/LICENSE | 21 ++ public/function-plot/1.26.0/function-plot.js | 2 + public/function-plot/README.md | 17 ++ spec/lib/bot_function_plot_spec.rb | 97 +++++++++ spec/lib/tools/function_plot_spec.rb | 95 +++++++++ .../page_objects/components/function_plots.rb | 28 +++ spec/system/read_function_plots_spec.rb | 69 +++++++ .../unit/function-plot-expression-test.js | 105 ++++++++++ 21 files changed, 1002 insertions(+), 1 deletion(-) create mode 100644 assets/javascripts/discourse/components/function-plot-block.gjs create mode 100644 assets/javascripts/discourse/initializers/function-plot.js create mode 100644 assets/javascripts/discourse/lib/function-plot-expression.js create mode 100644 lib/discourse_chatbot/function_plot.rb create mode 100644 lib/discourse_chatbot/tools/function_plot.rb create mode 100644 public/function-plot/1.26.0/LICENSE create mode 100644 public/function-plot/1.26.0/function-plot.js create mode 100644 public/function-plot/README.md create mode 100644 spec/lib/bot_function_plot_spec.rb create mode 100644 spec/lib/tools/function_plot_spec.rb create mode 100644 spec/system/page_objects/components/function_plots.rb create mode 100644 spec/system/read_function_plots_spec.rb create mode 100644 test/javascripts/unit/function-plot-expression-test.js diff --git a/README.md b/README.md index ed5e5cfc..1515e396 100644 --- a/README.md +++ b/README.md @@ -371,6 +371,47 @@ Filtering adds an evaluation call and can change prompt-cache reuse; reduced too guarantee lower total cost or better answers. Thresholds and guidance should be evaluated against your community's requests. +### Mathematical function graphs + +Chatbot bundles function-plot 1.26.0 for interactive graphs rendered locally in the +reader's browser. Enable `chatbot_function_plot_enabled` (default `true`) and add +`plot_function` to the appropriate `chatbot_tools_*_trust` settings to let the bot +prepare graphs. Existing trust-level tool lists are not changed automatically. +System One selection evaluates the new tool like the other eligible tools. + +The tool is intended to accompany mathematical explanations, including the site's +usual MathJax/LaTeX output when Discourse Math is installed. For example, an answer +about quadratic roots can explain the algebra and include a plot of `x^2-4`. +The graph tool uses no external API and adds no notional tool quota charge. + +Human-authored posts, PMs and Chat messages can use the same fenced format: + +````markdown +The curves intersect where $\sin(x)=\cos(x)$. + +```function-plot +{"functions":["sin(x)","cos(x)"],"title":"Sine and cosine","x_domain":[-7,7],"y_domain":[-2,2]} +``` +```` + +Supported expressions use `x`, numeric literals, `pi`, `e`, explicit multiplication, +`+ - * / ^`, parentheses, and the single-argument functions `sin`, `cos`, `tan`, +`asin`, `acos`, `atan`, `sqrt`, `abs`, `exp`, `log`, `log10`, `floor`, and `ceil`. +`log` is the natural logarithm and trigonometric angles are radians. Omit `y=` and +LaTeX commands from graph expressions. There may be up to four expressions, each +at most 256 characters. Titles are plain text, at most 120 characters. Both axes +default to `[-10,10]`; custom domains must be finite, increasing pairs within +`[-1000000,1000000]`, with a span of at least `0.000001`. + +The renderer uses a restricted interpreter with function-plot's numeric sampler +(1,000 samples per curve) rather than its string-to-JavaScript compiler, preserving +Discourse's CSP. It redraws when resized or zoomed and uses function-plot's +discontinuity handling. Undefined or non-finite function values are omitted; +graphs are numerical visualisations, not proofs or a symbolic solver. Graph +definitions remain available in a disclosure below each plot and as ordinary +code blocks in email, exports, disabled rendering, and clients without JavaScript. +Invalid definitions display an error and retain the original definition. + ### Tool extensions Other plugins can add tools by loading zero-argument subclasses of diff --git a/assets/javascripts/discourse/components/function-plot-block.gjs b/assets/javascripts/discourse/components/function-plot-block.gjs new file mode 100644 index 00000000..e44d1665 --- /dev/null +++ b/assets/javascripts/discourse/components/function-plot-block.gjs @@ -0,0 +1,128 @@ +import Component from "@glimmer/component"; +import { tracked } from "@glimmer/tracking"; +import { modifier } from "ember-modifier"; +import loadScript from "discourse/lib/load-script"; +import { i18n } from "discourse-i18n"; +import { + parseGraph, + splitUndefinedSegments, +} from "../lib/function-plot-expression"; + +const COLORS = ["#0088cc", "#e4572e", "#32a66a", "#b279a2"]; + +export default class FunctionPlotBlock extends Component { + @tracked failed = false; + @tracked loading = true; + + renderPlot = modifier((element, [raw]) => { + let disposed = false; + let chart; + let observer; + let options; + let previousWidth; + + const draw = () => { + const width = Math.max(240, Math.min(element.clientWidth || 640, 1000)); + if (width === previousWidth) { + return; + } + previousWidth = width; + options.width = width; + options.height = Math.max(240, Math.min(width * 0.65, 420)); + chart.build(); + }; + + const initialize = async () => { + try { + const graph = parseGraph(raw); + await loadScript( + "/plugins/discourse-chatbot/function-plot/1.26.0/function-plot.js" + ); + if (disposed) { + return; + } + options = { + target: element, + title: graph.title, + grid: true, + xAxis: { domain: graph.xDomain }, + yAxis: { domain: graph.yDomain }, + data: [], + }; + chart = window.functionPlot(options); + chart.on("eval", (segments, index, isHelper) => { + if (isHelper || !graph.functions[index]) { + return; + } + const [minimum, maximum] = chart.meta.xScale.domain(); + const separated = splitUndefinedSegments( + segments, + graph.functions[index].evaluate, + (maximum - minimum) / 999 + ); + segments.splice(0, segments.length, ...separated); + }); + options.data = graph.functions.map((curve, index) => ({ + fn: ({ x }) => curve.evaluate(x), + graphType: "polyline", + sampler: "builtIn", + nSamples: 1000, + color: COLORS[index], + })); + draw(); + observer = new ResizeObserver(() => { + if (!disposed) { + draw(); + } + }); + observer.observe(element); + } catch { + if (!disposed) { + this.failed = true; + } + } finally { + if (!disposed) { + this.loading = false; + } + } + }; + initialize(); + + return () => { + disposed = true; + observer?.disconnect(); + if (chart) { + chart.removeAllListeners(); + // Upstream retains every chart in a static cache, including detached post graphs. + delete chart.constructor.cache[chart.id]; + } + }; + }); + + +} diff --git a/assets/javascripts/discourse/initializers/function-plot.js b/assets/javascripts/discourse/initializers/function-plot.js new file mode 100644 index 00000000..ceb7416b --- /dev/null +++ b/assets/javascripts/discourse/initializers/function-plot.js @@ -0,0 +1,23 @@ +import { apiInitializer } from "discourse/lib/api"; +import FunctionPlotBlock from "../components/function-plot-block"; + +export function decorateFunctionPlots(element, helper) { + element.querySelectorAll("pre > code.lang-function-plot").forEach((code) => { + const raw = code.textContent; + const container = document.createElement("div"); + container.className = "chatbot-function-plot-container"; + code.parentElement.replaceWith(container); + helper.renderGlimmer(container, FunctionPlotBlock, { raw }); + }); +} + +export default apiInitializer((api) => { + const settings = api.container.lookup("service:site-settings"); + if (!settings.chatbot_enabled || !settings.chatbot_function_plot_enabled) { + return; + } + api.decorateCookedElement(decorateFunctionPlots, { + id: "chatbot-function-plot", + }); + api.decorateChatMessage?.(decorateFunctionPlots); +}); diff --git a/assets/javascripts/discourse/lib/function-plot-expression.js b/assets/javascripts/discourse/lib/function-plot-expression.js new file mode 100644 index 00000000..a72072c0 --- /dev/null +++ b/assets/javascripts/discourse/lib/function-plot-expression.js @@ -0,0 +1,187 @@ +const FUNCTIONS = Object.freeze({ + sin: Math.sin, + cos: Math.cos, + tan: Math.tan, + asin: Math.asin, + acos: Math.acos, + atan: Math.atan, + sqrt: Math.sqrt, + abs: Math.abs, + exp: Math.exp, + log: Math.log, + log10: Math.log10, + floor: Math.floor, + ceil: Math.ceil, +}); +const PRECEDENCE = { "+": 1, "-": 1, "*": 2, "/": 2, "^": 4 }; +const OPERATORS = { + "+": (left, right) => left + right, + "-": (left, right) => left - right, + "*": (left, right) => left * right, + "/": (left, right) => left / right, + "^": (left, right) => Math.pow(left, right), +}; + +// Interpret a small maths grammar; never pass post text to the library's code generator. +export function compileExpression(expression) { + if ( + typeof expression !== "string" || + !expression.trim() || + expression.length > 256 + ) { + throw new Error("Invalid expression"); + } + const source = expression.trim().toLowerCase(); + const pattern = + /(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|[a-z][a-z0-9]*|[()+\-*/^]/y; + const tokens = []; + let offset = 0; + while (offset < source.length) { + if (/\s/.test(source[offset])) { + offset++; + continue; + } + pattern.lastIndex = offset; + const match = pattern.exec(source); + if (!match || tokens.length >= 128) { + throw new Error("Invalid expression"); + } + tokens.push(match[0]); + offset = pattern.lastIndex; + } + + let index = 0; + function parse(minimum = 1, depth = 0) { + if (depth > 32) { + throw new Error("Expression too complex"); + } + const token = tokens[index++]; + let left; + if (token === "+" || token === "-") { + const operand = parse(3, depth + 1); + left = token === "-" ? (x) => -operand(x) : operand; + } else if (token === "(") { + left = parse(1, depth + 1); + if (tokens[index++] !== ")") { + throw new Error("Unclosed group"); + } + } else if (token === "x") { + left = (x) => x; + } else if (token === "pi" || token === "e") { + const constant = token === "pi" ? Math.PI : Math.E; + left = () => constant; + } else if (Object.hasOwn(FUNCTIONS, token)) { + if (tokens[index++] !== "(") { + throw new Error("Missing function argument"); + } + const argument = parse(1, depth + 1); + if (tokens[index++] !== ")") { + throw new Error("Invalid function argument"); + } + left = (x) => FUNCTIONS[token](argument(x)); + } else if (token && Number.isFinite(Number(token))) { + const number = Number(token); + left = () => number; + } else { + throw new Error("Unsupported expression"); + } + + while ( + Object.hasOwn(PRECEDENCE, tokens[index]) && + PRECEDENCE[tokens[index]] >= minimum + ) { + const operator = tokens[index++]; + const right = parse( + PRECEDENCE[operator] + (operator === "^" ? 0 : 1), + depth + 1 + ); + const previous = left; + left = (x) => OPERATORS[operator](previous(x), right(x)); + } + return left; + } + + const evaluate = parse(); + if (index !== tokens.length) { + throw new Error("Unexpected expression input"); + } + return (x) => { + const result = evaluate(x); + return Number.isFinite(result) ? result : NaN; + }; +} + +function domain(value) { + if ( + !Array.isArray(value) || + value.length !== 2 || + !value.every( + (bound) => + typeof bound === "number" && + Number.isFinite(bound) && + Math.abs(bound) <= 1000000 + ) || + value[1] - value[0] < 0.000001 + ) { + throw new Error("Invalid graph bounds"); + } + return [...value]; +} + +export function parseGraph(raw) { + if (typeof raw !== "string" || raw.length > 8192) { + throw new Error("Graph too large"); + } + const graph = JSON.parse(raw); + if ( + !graph || + !Array.isArray(graph.functions) || + graph.functions.length < 1 || + graph.functions.length > 4 || + Object.keys(graph).some( + (key) => !["functions", "title", "x_domain", "y_domain"].includes(key) + ) + ) { + throw new Error("Invalid graph"); + } + const title = graph.title ?? ""; + if (typeof title !== "string" || title.length > 120 || /[\r\n]/.test(title)) { + throw new Error("Invalid title"); + } + return { + title, + xDomain: domain(graph.x_domain ?? [-10, 10]), + yDomain: domain(graph.y_domain ?? [-10, 10]), + functions: graph.functions.map((expression) => ({ + expression, + evaluate: compileExpression(expression), + })), + }; +} + +// The upstream sampler drops undefined points, which can otherwise bridge domain gaps. +export function splitUndefinedSegments(segments, evaluate, step) { + const result = []; + for (const segment of segments) { + let current = []; + for (const point of segment) { + if (!point || !point.every(Number.isFinite)) { + continue; + } + const previous = current.at(-1); + if ( + previous && + (point[0] - previous[0] > step * 1.5 || + !Number.isFinite(evaluate((point[0] + previous[0]) / 2))) + ) { + result.push(current); + current = []; + } + current.push(point); + } + if (current.length) { + result.push(current); + } + } + return result; +} diff --git a/assets/stylesheets/common/chatbot_common.scss b/assets/stylesheets/common/chatbot_common.scss index 47bd3dd4..74322d78 100644 --- a/assets/stylesheets/common/chatbot_common.scss +++ b/assets/stylesheets/common/chatbot_common.scss @@ -104,3 +104,44 @@ opacity: 100%; } } + +.chatbot-function-plot { + margin: 1em 0; + padding: 0.5em; + border: 1px solid var(--primary-low); + border-radius: var(--d-border-radius); + background: var(--secondary); + + &__canvas { + width: 100%; + overflow: hidden; + + svg { + display: block; + max-width: 100%; + } + + svg text { + fill: var(--primary); + } + + .axis path, + .axis line { + stroke: var(--primary-medium); + } + } + + figcaption { + color: var(--primary-high); + font-size: var(--font-down-1); + } + + &__definition { + margin-top: 0.5em; + font-size: var(--font-down-1); + } + + &__error { + color: var(--danger); + } +} diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 5ef0c623..56731872 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -3,6 +3,12 @@ en: discourse_chatbot: title: "Chatbot" chatbot: + function_plot: + loading: "Loading graph…" + error: "This graph could not be rendered. Check its expressions and axis bounds." + fallback: "Graph definition" + label: "Interactive function graph" + help: "Drag to pan; scroll or pinch to zoom. Angles are in radians." tool_selection_mode: remove_definitions: "Remove unselected tool definitions" restrict_calls: "Restrict calls and retain tool definitions for caching" diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index 087e72cb..8f2eb36d 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -1,5 +1,6 @@ en: site_settings: + chatbot_function_plot_enabled: "Render function-plot graph blocks locally in posts, PMs and Chat. Add plot_function to the appropriate trust-level tool lists to let Chatbot prepare graphs. Graphs can accompany maths explanations and MathJax output." chatbot_enabled: "Enable the chatbot plugin" chatbot_llm_provider: "Provider used for chatbot completions. OpenAI, Anthropic, Google Gemini, and xAI are supported through their OpenAI-compatible APIs." chatbot_open_ai_token: "OpenAI API key shared by every chatbot capability configured to use OpenAI. Get a key at OpenAI." @@ -196,6 +197,18 @@ en: post_analysis_before_posts: "I am now talking to only %{username} who has asked me to consider the following posts in private. The other users are now not present, but I have access to their conversation which is as follows:" post_analysis: "I am still talking to only %{username} who has asked me to consider the above posts in private. I should summarize the discussion, provide my opinion about it to %{username} and ask them what they would like to discuss about it." function: + function_plot: + description: | + Prepare an interactive graph of up to four mathematical functions y=f(x). Use when a graph would help explain a maths question: roots, intersections, turning points, trigonometry, growth, or comparing functions, even if the user did not explicitly ask for a graph. Accompany the graph with the mathematical explanation and the site's usual LaTeX/MathJax notation; the graph does not replace the answer or numerical calculation tools. + Supply expressions in x, one per line, without 'y=' or LaTeX. Use explicit multiplication (*), powers (^), parentheses, constants pi and e, and these single-argument functions: sin, cos, tan, asin, acos, atan, sqrt, abs, exp, log (natural logarithm), log10, floor, ceil. Trigonometric angles are radians. For example: x^2-4 or sin(x). Expressions are limited to 256 characters each. + Choose axis bounds that show the relevant features. Bounds are numeric; supply both minimum and maximum for an axis, with -1000000 <= minimum < maximum <= 1000000. Each axis defaults to [-10,10] if omitted. The tool returns a function-plot fenced block; copy the complete block unchanged into your final answer outside any other code fence. The graph renders in the reader's browser; do not claim to have viewed its rendered appearance. + expressions: "One to four expressions in x, separated by newlines, for example sin(x) followed by cos(x)." + title: "Optional plain-text graph title, up to 120 characters." + x_min: "Left boundary of the graph. Supply with x_max." + x_max: "Right boundary of the graph. Supply with x_min." + y_min: "Bottom boundary of the graph. Supply with y_max." + y_max: "Top boundary of the graph. Supply with y_min." + error: "Unable to prepare the graph. Use up to four supported expressions in x, one per line, without y= or LaTeX. Supply finite, increasing axis bounds in pairs, within -1000000 to 1000000, and a title of at most 120 characters. Correct the arguments before retrying." remaining_bot_quota: description: | Get the current number of tokens or queries you have left for use of the bot this week diff --git a/config/settings.yml b/config/settings.yml index c18cffef..0ad25197 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -2,6 +2,9 @@ plugins: chatbot_enabled: default: true client: true + chatbot_function_plot_enabled: + default: true + client: true chatbot_llm_provider: client: false default: open_ai diff --git a/lib/discourse_chatbot/bot.rb b/lib/discourse_chatbot/bot.rb index b7cec26a..3c9e9a27 100644 --- a/lib/discourse_chatbot/bot.rb +++ b/lib/discourse_chatbot/bot.rb @@ -28,6 +28,7 @@ class ChainLimitError < NonRetryableError DiscourseChatbot::Tools::UserInformation DiscourseChatbot::Tools::EscalateToStaff DiscourseChatbot::Tools::Calculator + DiscourseChatbot::Tools::FunctionPlot DiscourseChatbot::Tools::RemainingQuota ] @@ -360,6 +361,9 @@ def get_system_message_suffix(opts) def merge_tools(opts) tools = [] tools << ::DiscourseChatbot::Tools::Calculator.new if tool_enabled?("calculate") + if tool_enabled?("plot_function") && SiteSetting.chatbot_function_plot_enabled + tools << ::DiscourseChatbot::Tools::FunctionPlot.new + end tools << ::DiscourseChatbot::Tools::Wikipedia.new if tool_enabled?("wikipedia") if opts[:private] && tool_enabled?("user_information") diff --git a/lib/discourse_chatbot/function_plot.rb b/lib/discourse_chatbot/function_plot.rb new file mode 100644 index 00000000..c4d67a70 --- /dev/null +++ b/lib/discourse_chatbot/function_plot.rb @@ -0,0 +1,72 @@ +# frozen_string_literal: true + +require "dentaku" + +module DiscourseChatbot + class FunctionPlot + FUNCTIONS = %w[sin cos tan asin acos atan sqrt abs exp log log10 floor ceil].freeze + VARIABLES = %w[x pi e].freeze + MAX_FUNCTIONS = 4 + MAX_EXPRESSION_LENGTH = 256 + MAX_TOKENS = 128 + MAX_DEPTH = 16 + MAX_BOUND = 1_000_000 + + def self.markdown(args) + expressions = args.fetch("expressions").split("\n").map(&:strip).reject(&:empty?) + raise ArgumentError if expressions.empty? || expressions.length > MAX_FUNCTIONS + + expressions.each { |expression| validate_expression!(expression) } + title = args.fetch("title", "") + raise ArgumentError if title.length > 120 || title.match?(/[\r\n]/) + + graph = { + functions: expressions, + title: title, + x_domain: domain(args, "x", [-10, 10]), + y_domain: domain(args, "y", [-10, 10]), + } + "```function-plot\n#{JSON.generate(graph)}\n```" + end + + def self.validate_expression!(expression) + if expression.length > MAX_EXPRESSION_LENGTH || + !expression.match?(%r{\A[0-9a-z+\-*/^().\s]+\z}i) + raise ArgumentError + end + normalized = expression.downcase + names = normalized.scan(/[a-z][a-z0-9]*/).reject { |name| name.match?(/\Ae\d+\z/) } + raise ArgumentError unless (names - FUNCTIONS - VARIABLES).empty? + + depth = 0 + normalized.each_char do |character| + depth += 1 if character == "(" + depth -= 1 if character == ")" + raise ArgumentError if depth.negative? || depth > MAX_DEPTH + end + raise ArgumentError if depth.nonzero? + + calculator = Dentaku::Calculator.new + calculator.add_function(:floor, :numeric, ->(value) { value.floor }) + calculator.add_function(:ceil, :numeric, ->(value) { value.ceil }) + raise ArgumentError if calculator.tokenizer.tokenize(normalized).length > MAX_TOKENS + node = calculator.ast(normalized) + raise ArgumentError unless (node.dependencies - VARIABLES).empty? + rescue Dentaku::Error + raise ArgumentError + end + + def self.domain(args, axis, default) + minimum, maximum = args.values_at("#{axis}_min", "#{axis}_max") + return default if minimum.nil? && maximum.nil? + + unless [minimum, maximum].all? { |value| + value.is_a?(Numeric) && value.finite? && value.abs <= MAX_BOUND + } && maximum - minimum >= 0.000001 + raise ArgumentError + end + [minimum, maximum] + end + private_class_method :domain, :validate_expression! + end +end diff --git a/lib/discourse_chatbot/tool.rb b/lib/discourse_chatbot/tool.rb index 043587e6..f9e828d8 100644 --- a/lib/discourse_chatbot/tool.rb +++ b/lib/discourse_chatbot/tool.rb @@ -9,6 +9,7 @@ class Tool news paint_edit_picture paint_picture + plot_function remaining_bot_quota stock_data user_information diff --git a/lib/discourse_chatbot/tools/function_plot.rb b/lib/discourse_chatbot/tools/function_plot.rb new file mode 100644 index 00000000..e013ba7a --- /dev/null +++ b/lib/discourse_chatbot/tools/function_plot.rb @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +module DiscourseChatbot + module Tools + class FunctionPlot < ::DiscourseChatbot::Tool + def name + "plot_function" + end + + def description + I18n.t("chatbot.prompt.function.function_plot.description") + end + + def parameters + [ + { + name: "expressions", + type: String, + description: I18n.t("chatbot.prompt.function.function_plot.expressions"), + }, + { + name: "title", + type: String, + description: I18n.t("chatbot.prompt.function.function_plot.title"), + }, + *%w[x_min x_max y_min y_max].map do |name| + { + name: name, + type: Numeric, + description: I18n.t("chatbot.prompt.function.function_plot.#{name}"), + } + end, + ] + end + + def required + ["expressions"] + end + + def process(args) + super(args) + { answer: ::DiscourseChatbot::FunctionPlot.markdown(args), token_usage: 0 } + rescue ArgumentError + { answer: I18n.t("chatbot.prompt.function.function_plot.error"), token_usage: 0 } + end + end + end +end diff --git a/plugin.rb b/plugin.rb index 68aa57b0..adc17560 100644 --- a/plugin.rb +++ b/plugin.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true # name: discourse-chatbot # about: a plugin that allows you to have a conversation with a configurable chatbot in Chat, Topics and Private Messages -# version: 3.1.8 +# version: 3.1.9 # authors: merefield # url: https://github.com/merefield/discourse-chatbot diff --git a/public/function-plot/1.26.0/LICENSE b/public/function-plot/1.26.0/LICENSE new file mode 100644 index 00000000..57bde726 --- /dev/null +++ b/public/function-plot/1.26.0/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2015 Mauricio Poppe + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/public/function-plot/1.26.0/function-plot.js b/public/function-plot/1.26.0/function-plot.js new file mode 100644 index 00000000..3c12e692 --- /dev/null +++ b/public/function-plot/1.26.0/function-plot.js @@ -0,0 +1,2 @@ +!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.functionPlot=n():t.functionPlot=n()}(self,(()=>(()=>{var t={5248:(t,n,e)=>{"use strict";t.exports=e(9976)},517:t=>{"use strict";t.exports=function(){const t=Object.create(Math);return t.factory=function(t){if("number"!=typeof t)throw new TypeError("built-in math factory only accepts numbers");return Number(t)},t.add=function(t,n){return t+n},t.sub=function(t,n){return t-n},t.mul=function(t,n){return t*n},t.div=function(t,n){return t/n},t.mod=function(t,n){return t%n},t.factorial=function(t){let n=1;for(let e=2;e<=t;e+=1)n*=e;return n},t.nthRoot=function(t,n){const e=n<0;if(e&&(n=-n),0===n)throw new Error("Root must be non-zero");if(t<0&&Math.abs(n)%2!=1)throw new Error("Root must be odd when a is negative.");if(0===t)return 0;if(!isFinite(t))return e?0:t;let r=Math.pow(Math.abs(t),1/n);return r=t<0?-r:r,e?1/r:r},t.logicalOR=function(t,n){return t||n},t.logicalXOR=function(t,n){return t!=n},t.logicalAND=function(t,n){return t&&n},t.bitwiseOR=function(t,n){return t|n},t.bitwiseXOR=function(t,n){return t^n},t.bitwiseAND=function(t,n){return t&n},t.lessThan=function(t,n){return tn},t.greaterEqualThan=function(t,n){return t>=n},t.equal=function(t,n){return t==n},t.strictlyEqual=function(t,n){return t===n},t.notEqual=function(t,n){return t!=n},t.strictlyNotEqual=function(t,n){return t!==n},t.shiftRight=function(t,n){return t>>n},t.shiftLeft=function(t,n){return t<>>n},t.negative=function(t){return-t},t.positive=function(t){return t},t}},9976:(t,n,e)=>{"use strict";const r=e(2223),i=e(517)();function o(t){Object.keys(t).forEach((function(n){const e=t[n];t[n]=i.factory(e)}))}t.exports=function(t){return(new r).setDefs({$$processScope:o}).parse(t).compile(i)},t.exports.math=i},4822:t=>{var n=!1;if("undefined"!=typeof Float64Array){var e=new Float64Array(1),r=new Uint32Array(e.buffer);e[0]=1,n=!0,1072693248===r[1]?(t.exports=function(t){return e[0]=t,[r[0],r[1]]},t.exports.pack=function(t,n){return r[0]=t,r[1]=n,e[0]},t.exports.lo=function(t){return e[0]=t,r[0]},t.exports.hi=function(t){return e[0]=t,r[1]}):1072693248===r[0]?(t.exports=function(t){return e[0]=t,[r[1],r[0]]},t.exports.pack=function(t,n){return r[1]=t,r[0]=n,e[0]},t.exports.lo=function(t){return e[0]=t,r[1]},t.exports.hi=function(t){return e[0]=t,r[0]}):n=!1}if(!n){var i=new Buffer(8);t.exports=function(t){return i.writeDoubleLE(t,0,!0),[i.readUInt32LE(0,!0),i.readUInt32LE(4,!0)]},t.exports.pack=function(t,n){return i.writeUInt32LE(t,0,!0),i.writeUInt32LE(n,4,!0),i.readDoubleLE(0,!0)},t.exports.lo=function(t){return i.writeDoubleLE(t,0,!0),i.readUInt32LE(0,!0)},t.exports.hi=function(t){return i.writeDoubleLE(t,0,!0),i.readUInt32LE(4,!0)}}t.exports.sign=function(n){return t.exports.hi(n)>>>31},t.exports.exponent=function(n){return(t.exports.hi(n)<<1>>>21)-1023},t.exports.fraction=function(n){var e=t.exports.lo(n),r=t.exports.hi(n),i=1048575&r;return 2146435072&r&&(i+=1<<20),[e,i]},t.exports.denormalized=function(n){return!(2146435072&t.exports.hi(n))}},7187:t=>{"use strict";var n,e="object"==typeof Reflect?Reflect:null,r=e&&"function"==typeof e.apply?e.apply:function(t,n,e){return Function.prototype.apply.call(t,n,e)};n=e&&"function"==typeof e.ownKeys?e.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var i=Number.isNaN||function(t){return t!=t};function o(){o.init.call(this)}t.exports=o,t.exports.once=function(t,n){return new Promise((function(e,r){function i(e){t.removeListener(n,o),r(e)}function o(){"function"==typeof t.removeListener&&t.removeListener("error",i),e([].slice.call(arguments))}y(t,n,o,{once:!0}),"error"!==n&&function(t,n,e){"function"==typeof t.on&&y(t,"error",n,{once:!0})}(t,i)}))},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var a=10;function s(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function u(t){return void 0===t._maxListeners?o.defaultMaxListeners:t._maxListeners}function l(t,n,e,r){var i,o,a,l;if(s(e),void 0===(o=t._events)?(o=t._events=Object.create(null),t._eventsCount=0):(void 0!==o.newListener&&(t.emit("newListener",n,e.listener?e.listener:e),o=t._events),a=o[n]),void 0===a)a=o[n]=e,++t._eventsCount;else if("function"==typeof a?a=o[n]=r?[e,a]:[a,e]:r?a.unshift(e):a.push(e),(i=u(t))>0&&a.length>i&&!a.warned){a.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(n)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=t,c.type=n,c.count=a.length,l=c,console&&console.warn&&console.warn(l)}return t}function c(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function h(t,n,e){var r={fired:!1,wrapFn:void 0,target:t,type:n,listener:e},i=c.bind(r);return i.listener=e,r.wrapFn=i,i}function f(t,n,e){var r=t._events;if(void 0===r)return[];var i=r[n];return void 0===i?[]:"function"==typeof i?e?[i.listener||i]:[i]:e?function(t){for(var n=new Array(t.length),e=0;e0&&(a=n[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var u=o[t];if(void 0===u)return!1;if("function"==typeof u)r(u,this,n);else{var l=u.length,c=d(u,l);for(e=0;e=0;o--)if(e[o]===n||e[o].listener===n){a=e[o].listener,i=o;break}if(i<0)return this;0===i?e.shift():function(t,n){for(;n+1=0;r--)this.removeListener(t,n[r]);return this},o.prototype.listeners=function(t){return f(this,t,!0)},o.prototype.rawListeners=function(t){return f(this,t,!1)},o.listenerCount=function(t,n){return"function"==typeof t.listenerCount?t.listenerCount(n):p.call(t,n)},o.prototype.listenerCount=p,o.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]}},4470:t=>{"use strict";var n=Object.prototype.hasOwnProperty,e=Object.prototype.toString,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,o=function(t){return"function"==typeof Array.isArray?Array.isArray(t):"[object Array]"===e.call(t)},a=function(t){if(!t||"[object Object]"!==e.call(t))return!1;var r,i=n.call(t,"constructor"),o=t.constructor&&t.constructor.prototype&&n.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!i&&!o)return!1;for(r in t);return void 0===r||n.call(t,r)},s=function(t,n){r&&"__proto__"===n.name?r(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},u=function(t,e){if("__proto__"===e){if(!n.call(t,e))return;if(i)return i(t,e).value}return t[e]};t.exports=function t(){var n,e,r,i,l,c,h=arguments[0],f=1,p=arguments.length,d=!1;for("boolean"==typeof h&&(d=h,h=arguments[1]||{},f=2),(null==h||"object"!=typeof h&&"function"!=typeof h)&&(h={});f{"use strict";t.exports=e(2320)},3380:t=>{"use strict";t.exports=function(t){t.mod=t.fmod,t.lessThan=t.lt,t.lessEqualThan=t.leq,t.greaterThan=t.gt,t.greaterEqualThan=t.geq,t.strictlyEqual=t.equal,t.strictlyNotEqual=t.notEqual,t.logicalAND=function(t,n){return t&&n},t.logicalXOR=function(t,n){return t^n},t.logicalOR=function(t,n){return t||n}}},2320:(t,n,e)=>{"use strict";const r=e(2223),i=e(9851).ZP;function o(t){Object.keys(t).forEach((function(n){const e=t[n];"number"==typeof e||Array.isArray(e)?t[n]=i.factory(e):"object"==typeof e&&"lo"in e&&"hi"in e&&(t[n]=i.factory(e.lo,e.hi))}))}e(3380)(i),t.exports=function(t){return(new r).setDefs({$$processScope:o}).parse(t).compile(i)},t.exports.policies=e(4186)(i),t.exports.Interval=i},4186:t=>{"use strict";t.exports=function(t){return{disableRounding:function(){t.round.disable()},enableRounding:function(){t.round.enable()}}}},9851:(t,n,e)=>{"use strict";e.d(n,{ZP:()=>Ct});var r={};e.r(r),e.d(r,{hasInterval:()=>y,hasValue:()=>d,intervalsOverlap:()=>m,isEmpty:()=>c,isInterval:()=>l,isSingleton:()=>f,isWhole:()=>h,zeroIn:()=>p});var i={};e.r(i),e.d(i,{almostEqual:()=>D,assertIncludes:()=>$,equal:()=>I,geq:()=>B,greaterEqualThan:()=>q,greaterThan:()=>F,gt:()=>Y,leq:()=>R,lessEqualThan:()=>U,lessThan:()=>j,lt:()=>z,notEqual:()=>H});var o={};e.r(o),e.d(o,{add:()=>X,div:()=>K,divide:()=>Q,mul:()=>J,multiply:()=>G,negative:()=>nt,positive:()=>tt,sub:()=>W,subtract:()=>V});var a={};e.r(a),e.d(a,{fmod:()=>et,multiplicativeInverse:()=>rt,nthRoot:()=>at,pow:()=>it,sqrt:()=>ot});var s={};e.r(s),e.d(s,{LOG_EXP_10:()=>ct,LOG_EXP_2:()=>ft,abs:()=>xt,clone:()=>Mt,difference:()=>_t,exp:()=>st,hull:()=>dt,intersection:()=>yt,ln:()=>lt,log:()=>ut,log10:()=>ht,log2:()=>pt,max:()=>wt,min:()=>bt,union:()=>mt,wid:()=>vt,width:()=>gt});var u={};function l(t){return"object"==typeof t&&"number"==typeof t.lo&&"number"==typeof t.hi}function c(t){return t.lo>t.hi}function h(t){return t.lo===-1/0&&t.hi===1/0}function f(t){return t.lo===t.hi}function p(t){return d(t,0)}function d(t,n){return!c(t)&&t.lo<=n&&n<=t.hi}function y(t,n){return!!c(t)||!c(n)&&n.lo<=t.lo&&t.hi<=n.hi}function m(t,n){return!c(t)&&!c(n)&&(t.lo<=n.lo&&n.lo<=t.hi||n.lo<=t.lo&&t.lo<=n.hi)}e.r(u),e.d(u,{acos:()=>Pt,asin:()=>Nt,atan:()=>Ot,cos:()=>Et,cosh:()=>Lt,sin:()=>kt,sinh:()=>It,tan:()=>St,tanh:()=>Zt});var _=e(3093),g=e.n(_);function v(t){return t}function x(t){return t===1/0?t:g()(t,-1/0)}function w(t){return t===-1/0?t:g()(t,1/0)}function b(t){return t<0?Math.ceil(t):Math.floor(t)}const M={prev:x,next:w},T={safePrev:x,safeNext:w,prev:t=>M.prev(t),next:t=>M.next(t),addLo:(t,n)=>T.prev(t+n),addHi:(t,n)=>T.next(t+n),subLo:(t,n)=>T.prev(t-n),subHi:(t,n)=>T.next(t-n),mulLo:(t,n)=>T.prev(t*n),mulHi:(t,n)=>T.next(t*n),divLo:(t,n)=>T.prev(t/n),divHi:(t,n)=>T.next(t/n),intLo:t=>b(T.prev(t)),intHi:t=>b(T.next(t)),logLo:t=>T.prev(Math.log(t)),logHi:t=>T.next(Math.log(t)),expLo:t=>T.prev(Math.exp(t)),expHi:t=>T.next(Math.exp(t)),sinLo:t=>T.prev(Math.sin(t)),sinHi:t=>T.next(Math.sin(t)),cosLo:t=>T.prev(Math.cos(t)),cosHi:t=>T.next(Math.cos(t)),tanLo:t=>T.prev(Math.tan(t)),tanHi:t=>T.next(Math.tan(t)),asinLo:t=>T.prev(Math.asin(t)),asinHi:t=>T.next(Math.asin(t)),acosLo:t=>T.prev(Math.acos(t)),acosHi:t=>T.next(Math.acos(t)),atanLo:t=>T.prev(Math.atan(t)),atanHi:t=>T.next(Math.atan(t)),sinhLo:t=>T.prev(Math.sinh(t)),sinhHi:t=>T.next(Math.sinh(t)),coshLo:t=>T.prev(Math.cosh(t)),coshHi:t=>T.next(Math.cosh(t)),tanhLo:t=>T.prev(Math.tanh(t)),tanhHi:t=>T.next(Math.tanh(t)),powLo(t,n){if(n%1!=0)return T.prev(Math.pow(t,n));let e=1==(1&n)?t:1;for(n>>=1;n>0;)t=T.mulLo(t,t),1==(1&n)&&(e=T.mulLo(t,e)),n>>=1;return e},powHi(t,n){if(n%1!=0)return T.next(Math.pow(t,n));let e=1==(1&n)?t:1;for(n>>=1;n>0;)t=T.mulHi(t,t),1==(1&n)&&(e=T.mulHi(t,e)),n>>=1;return e},sqrtLo:t=>T.prev(Math.sqrt(t)),sqrtHi:t=>T.next(Math.sqrt(t)),disable(){M.next=M.prev=v},enable(){M.next=w,M.prev=x}},A=T;class E{constructor(t,n){if(this.lo=0,this.hi=0,!(this instanceof E))return console.log("calling with new"),console.log(t,n),new E(t,n);if(void 0!==t&&void 0!==n){if(l(t)){if(!f(t))throw new TypeError("Interval: interval `lo` must be a singleton");t=t.lo}if(l(n)){if(!f(n))throw TypeError("Interval: interval `hi` must be a singleton");n=n.hi}}else{if(void 0!==t)return Array.isArray(t)?new k(t[0],t[1]):new k(t,t);t=n=0}this.assign(t,n)}singleton(t){return this.set(t,t)}bounded(t,n){return this.set(A.prev(t),A.next(n))}boundedSingleton(t){return this.bounded(t,t)}set(t,n){return this.lo=t,this.hi=n,this}assign(t,n){if("number"!=typeof t||"number"!=typeof n)throw TypeError("Interval#assign: arguments must be numbers");return isNaN(t)||isNaN(n)||t>n?this.setEmpty():this.set(t,n)}setEmpty(){return this.set(Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY)}setWhole(){return this.set(Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY)}open(t,n){return this.assign(A.safeNext(t),A.safePrev(n))}halfOpenLeft(t,n){return this.assign(A.safeNext(t),n)}halfOpenRight(t,n){return this.assign(t,A.safePrev(n))}toArray(){return[this.lo,this.hi]}clone(){return(new k).set(this.lo,this.hi)}}const k=function(t){function n(){for(var n=arguments.length,e=Array(n),r=0;rn.hi}function j(t,n){return!c(t)&&!c(n)&&t.hin.hi}const Y=F;function U(t,n){return!c(t)&&!c(n)&&t.hi<=n.lo}const R=U;function q(t,n){return!c(t)&&!c(n)&&t.lo>=n.hi}const B=q;function X(t,n){return new k(A.addLo(t.lo,n.lo),A.addHi(t.hi,n.hi))}function V(t,n){return new k(A.subLo(t.lo,n.hi),A.subHi(t.hi,n.lo))}const W=V;function G(t,n){if(c(t)||c(n))return O.EMPTY;const e=t.lo,r=t.hi,i=n.lo,o=n.hi,a=new k;return e<0?r>0?i<0?o>0?(a.lo=Math.min(A.mulLo(e,o),A.mulLo(r,i)),a.hi=Math.max(A.mulHi(e,i),A.mulHi(r,o))):(a.lo=A.mulLo(r,i),a.hi=A.mulHi(e,i)):o>0?(a.lo=A.mulLo(e,o),a.hi=A.mulHi(r,o)):(a.lo=0,a.hi=0):i<0?o>0?(a.lo=A.mulLo(e,o),a.hi=A.mulHi(e,i)):(a.lo=A.mulLo(r,o),a.hi=A.mulHi(e,i)):o>0?(a.lo=A.mulLo(e,o),a.hi=A.mulHi(r,i)):(a.lo=0,a.hi=0):r>0?i<0?o>0?(a.lo=A.mulLo(r,i),a.hi=A.mulHi(r,o)):(a.lo=A.mulLo(r,i),a.hi=A.mulHi(e,o)):o>0?(a.lo=A.mulLo(e,i),a.hi=A.mulHi(r,o)):(a.lo=0,a.hi=0):(a.lo=0,a.hi=0),a}const J=G;function Q(t,n){return c(t)||c(n)?O.EMPTY:p(n)?0!==n.lo?0!==n.hi?function(t){return 0===t.lo&&0===t.hi?t:O.WHOLE}(t):function(t,n){return 0===t.lo&&0===t.hi?t:p(t)?O.WHOLE:t.hi<0?new k(A.divLo(t.hi,n),Number.POSITIVE_INFINITY):new k(Number.NEGATIVE_INFINITY,A.divHi(t.lo,n))}(t,n.lo):0!==n.hi?function(t,n){return 0===t.lo&&0===t.hi?t:p(t)?O.WHOLE:t.hi<0?new k(Number.NEGATIVE_INFINITY,A.divHi(t.hi,n)):new k(A.divLo(t.lo,n),Number.POSITIVE_INFINITY)}(t,n.hi):O.EMPTY:function(t,n){const e=t.lo,r=t.hi,i=n.lo,o=n.hi,a=new k;return r<0?o<0?(a.lo=A.divLo(r,i),a.hi=A.divHi(e,o)):(a.lo=A.divLo(e,i),a.hi=A.divHi(r,o)):e<0?o<0?(a.lo=A.divLo(r,o),a.hi=A.divHi(e,o)):(a.lo=A.divLo(e,i),a.hi=A.divHi(r,i)):o<0?(a.lo=A.divLo(r,o),a.hi=A.divHi(e,i)):(a.lo=A.divLo(e,o),a.hi=A.divHi(r,i)),a}(t,n)}const K=Q;function tt(t){return new k(t.lo,t.hi)}function nt(t){return new k(-t.hi,-t.lo)}function et(t,n){if(c(t)||c(n))return O.EMPTY;const e=t.lo<0?n.lo:n.hi;let r=t.lo/e;return r=r<0?Math.ceil(r):Math.floor(r),W(t,J(n,new k(r)))}function rt(t){return c(t)?O.EMPTY:p(t)?0!==t.lo?0!==t.hi?O.WHOLE:new k(Number.NEGATIVE_INFINITY,A.divHi(1,t.lo)):0!==t.hi?new k(A.divLo(1,t.hi),Number.POSITIVE_INFINITY):O.EMPTY:new k(A.divLo(1,t.hi),A.divHi(1,t.lo))}function it(t,n){if(c(t))return O.EMPTY;if("object"==typeof n){if(!f(n))return O.EMPTY;n=n.lo}if(0===n)return 0===t.lo&&0===t.hi?O.EMPTY:O.ONE;if(n<0)return it(rt(t),-n);if(Number.isSafeInteger(n)){if(t.hi<0){const e=A.powLo(-t.hi,n),r=A.powHi(-t.lo,n);return 1==(1&n)?new k(-r,-e):new k(e,r)}return t.lo<0?1==(1&n)?new k(-A.powLo(-t.lo,n),A.powHi(t.hi,n)):new k(0,A.powHi(Math.max(-t.lo,t.hi),n)):new k(A.powLo(t.lo,n),A.powHi(t.hi,n))}return console.warn("power is not an integer, you should use nth-root instead, returning an empty interval"),O.EMPTY}function ot(t){return at(t,2)}function at(t,n){if(c(t)||n<0)return O.EMPTY;if("object"==typeof n){if(!f(n))return O.EMPTY;n=n.lo}const e=1/n;if(t.hi<0){if(Number.isSafeInteger(n)&&1==(1&n)){const n=A.powHi(-t.lo,e),r=A.powLo(-t.hi,e);return new k(-n,-r)}return O.EMPTY}if(t.lo<0){const r=A.powHi(t.hi,e);if(Number.isSafeInteger(n)&&1==(1&n)){const n=-A.powHi(-t.lo,e);return new k(n,r)}return new k(0,r)}return new k(A.powLo(t.lo,e),A.powHi(t.hi,e))}function st(t){return c(t)?O.EMPTY:new k(A.expLo(t.lo),A.expHi(t.hi))}function ut(t){if(c(t))return O.EMPTY;const n=t.lo<=0?Number.NEGATIVE_INFINITY:A.logLo(t.lo);return new k(n,A.logHi(t.hi))}const lt=ut,ct=ut(new k(10,10));function ht(t){return c(t)?O.EMPTY:K(ut(t),ct)}const ft=ut(new k(2,2));function pt(t){return c(t)?O.EMPTY:K(ut(t),ft)}function dt(t,n){const e=c(t),r=c(n);return e&&r?O.EMPTY:e?n.clone():r?t.clone():new k(Math.min(t.lo,n.lo),Math.max(t.hi,n.hi))}function yt(t,n){if(c(t)||c(n))return O.EMPTY;const e=Math.max(t.lo,n.lo),r=Math.min(t.hi,n.hi);return e<=r?new k(e,r):O.EMPTY}function mt(t,n){if(!m(t,n))throw Error("Interval#union: intervals do not overlap");return new k(Math.min(t.lo,n.lo),Math.max(t.hi,n.hi))}function _t(t,n){if(c(t)||h(n))return O.EMPTY;if(m(t,n)){if(t.lo=t.hi&&n.lo===-1/0?O.EMPTY:n.lo<=t.lo?(new k).halfOpenLeft(n.hi,t.hi):(new k).halfOpenRight(t.lo,n.lo)}return t.clone()}function gt(t){return c(t)?0:A.subHi(t.hi,t.lo)}const vt=gt;function xt(t){return c(t)||h(t)?O.EMPTY:t.lo>=0?t.clone():t.hi<=0?nt(t):new k(0,Math.max(-t.lo,t.hi))}function wt(t,n){const e=c(t),r=c(n);return e&&r?O.EMPTY:e?n.clone():r?t.clone():new k(Math.max(t.lo,n.lo),Math.max(t.hi,n.hi))}function bt(t,n){const e=c(t),r=c(n);return e&&r?O.EMPTY:e?n.clone():r?t.clone():new k(Math.min(t.lo,n.lo),Math.min(t.hi,n.hi))}function Mt(t){return(new k).set(t.lo,t.hi)}function Tt(t){return!isFinite(t.lo)&&t.lo===t.hi}function At(t){if(t.lo<0)if(t.lo===-1/0)t.lo=0,t.hi=1/0;else{const n=Math.ceil(-t.lo/O.PI_TWICE_LOW);t.lo+=O.PI_TWICE_LOW*n,t.hi+=O.PI_TWICE_LOW*n}return t}function Et(t){if(c(t)||Tt(t))return O.EMPTY;const n=(new k).set(t.lo,t.hi);At(n);const e=O.PI_TWICE,r=et(n,e);if(gt(r)>=e.lo)return new k(-1,1);if(r.lo>=O.PI_HIGH)return nt(Et(W(r,O.PI)));const i=r.lo,o=r.hi,a=A.cosLo(o),s=A.cosHi(i);return o<=O.PI_LOW?new k(a,s):o<=e.lo?new k(-1,Math.max(a,s)):new k(-1,1)}function kt(t){return c(t)||Tt(t)?O.EMPTY:Et(W(t,O.PI_HALF))}function St(t){if(c(t)||Tt(t))return O.EMPTY;const n=(new k).set(t.lo,t.hi);At(n);const e=O.PI;let r=et(n,e);return r.lo>=O.PI_HALF_LOW&&(r=W(r,e)),r.lo<=-O.PI_HALF_LOW||r.hi>=O.PI_HALF_LOW?O.WHOLE:new k(A.tanLo(r.lo),A.tanHi(r.hi))}function Nt(t){if(c(t)||t.hi<-1||t.lo>1)return O.EMPTY;const n=t.lo<=-1?-O.PI_HALF_HIGH:A.asinLo(t.lo),e=t.hi>=1?O.PI_HALF_HIGH:A.asinHi(t.hi);return new k(n,e)}function Pt(t){if(c(t)||t.hi<-1||t.lo>1)return O.EMPTY;const n=t.hi>=1?0:A.acosLo(t.hi),e=t.lo<=-1?O.PI_HIGH:A.acosHi(t.lo);return new k(n,e)}function Ot(t){return c(t)?O.EMPTY:new k(A.atanLo(t.lo),A.atanHi(t.hi))}function It(t){return c(t)?O.EMPTY:new k(A.sinhLo(t.lo),A.sinhHi(t.hi))}function Lt(t){return c(t)?O.EMPTY:t.hi<0?new k(A.coshLo(t.hi),A.coshHi(t.lo)):t.lo>=0?new k(A.coshLo(t.lo),A.coshHi(t.hi)):new k(1,A.coshHi(-t.lo>t.hi?t.lo:t.hi))}function Zt(t){return c(t)?O.EMPTY:new k(A.tanhLo(t.lo),A.tanhHi(t.hi))}const Ct=Object.assign(k,O,A,s,r,i,o,a,u,{round:A})},2223:(t,n,e)=>{"use strict";t.exports=e(3829)},3829:(t,n,e)=>{"use strict";const r=e(9213).Parser,i=e(6009),o=e(4470);function a(t,n){this.statements=[],this.defs=n||{},this.interpreter=new i(this,t)}a.prototype.setDefs=function(t){return this.defs=o(this.defs,t),this},a.prototype.compile=function(t){const n=this;if(!t||"object"!=typeof t&&"function"!=typeof t)throw TypeError("namespace must be an object");if("function"!=typeof t.factory)throw TypeError("namespace.factory must be a function");this.defs.ns=t,this.defs.$$mathCodegen={getProperty:function(t,e,r){function i(t){return n.interpreter.options.applyFactoryToScope&&"function"!=typeof t?r.factory(t):t}if(t in e)return i(e[t]);if(t in r)return i(r[t]);throw SyntaxError('symbol "'+t+'" is undefined')},functionProxy:function(t,n){if("function"!=typeof t)throw SyntaxError('symbol "'+n+'" must be a function');return t}},this.defs.$$processScope=this.defs.$$processScope||function(){};const e=Object.keys(this.defs).map((function(t){return"var "+t+' = defs["'+t+'"]'}));if(!this.statements.length)throw Error("there are no statements saved in this generator, make sure you parse an expression before compiling it");this.statements[this.statements.length-1]="return "+this.statements[this.statements.length-1];const r=this.statements.join(";"),i=e.join("\n")+"\n"+["return {"," eval: function (scope) {"," scope = scope || {}"," $$processScope(scope)"," "+r," },"," code: "+JSON.stringify(r),"}"].join("\n");return new Function("defs",i)(this.defs)},a.prototype.parse=function(t){const n=this,e=(new r).parse(t);return this.statements=e.blocks.map((function(t){return n.interpreter.next(t)})),this},t.exports=a},6009:(t,n,e)=>{"use strict";const r=e(4470),i={ArrayNode:e(5476),AssignmentNode:e(6408),ConditionalNode:e(9907),ConstantNode:e(2341),FunctionNode:e(7850),OperatorNode:e(305),SymbolNode:e(6656),UnaryNode:e(2386)},o=function(t,n){this.owner=t,this.options=r({factory:"ns.factory",raw:!1,rawArrayExpressionElements:!0,rawCallExpressionElements:!1,applyFactoryToScope:!1},n);const e=this.options.factory;if("string"!=typeof e||!/^[a-zA-Z_$][a-zA-Z0-9_$]*(\.[a-zA-Z_$][a-zA-Z0-9_$]*)*$/.test(e))throw new Error('factory must be a valid JS property access path (e.g. "ns.factory")')};r(o.prototype,i),o.prototype.next=function(t){if(!(t.type in this))throw new TypeError("the node type "+t.type+" is not implemented");return this[t.type](t)},o.prototype.rawify=function(t,n){const e=this.options.raw;t&&(this.options.raw=!0),n(),t&&(this.options.raw=e)},t.exports=o},2576:t=>{"use strict";t.exports={"+":"add","-":"sub","*":"mul","/":"div","^":"pow","%":"mod","!":"factorial","|":"bitwiseOR","^|":"bitwiseXOR","&":"bitwiseAND","||":"logicalOR",xor:"logicalXOR","&&":"logicalAND","<":"lessThan",">":"greaterThan","<=":"lessEqualThan",">=":"greaterEqualThan","===":"strictlyEqual","==":"equal","!==":"strictlyNotEqual","!=":"notEqual",">>":"shiftRight","<<":"shiftLeft",">>>":"unsignedRightShift"}},6104:t=>{"use strict";t.exports={"+":"positive","-":"negative","~":"oneComplement"}},5476:t=>{"use strict";t.exports=function(t){const n=this;let e=[];this.rawify(this.options.rawArrayExpressionElements,(function(){e=t.nodes.map((function(t){return n.next(t)}))}));const r="["+e.join(",")+"]";return this.options.raw?r:this.options.factory+"("+r+")"}},6408:t=>{"use strict";t.exports=function(t){return"scope["+JSON.stringify(t.name)+"] = "+this.next(t.expr)}},9907:t=>{"use strict";t.exports=function(t){return"(!!("+this.next(t.condition)+") ? ("+this.next(t.trueExpr)+") : ("+this.next(t.falseExpr)+") )"}},2341:t=>{"use strict";t.exports=function(t){if(this.options.raw)return t.value;const n="string"===t.valueType?JSON.stringify(t.value):t.value;return this.options.factory+"("+n+")"}},7850:(t,n,e)=>{"use strict";const r=e(9213).nodeTypes.SymbolNode,i=function(t){return"$$mathCodegen.functionProxy("+this.next(new r(t.name))+", "+JSON.stringify(t.name)+")"};t.exports=function(t){const n=this,e=i.call(this,t);let r=[];return this.rawify(this.options.rawCallExpressionElements,(function(){r=t.args.map((function(t){return n.next(t)}))})),e+"("+r.join(", ")+")"},t.exports.functionProxy=i},305:(t,n,e)=>{"use strict";const r=e(2576);t.exports=function(t){if(this.options.raw)return["("+this.next(t.args[0]),t.op,this.next(t.args[1])+")"].join(" ");const n=r[t.op];if(!n)throw TypeError("unidentified operator");return this.FunctionNode({name:n,args:t.args})}},6656:t=>{"use strict";t.exports=function(t){const n=t.name;return"$$mathCodegen.getProperty("+JSON.stringify(n)+", scope, ns)"}},2386:(t,n,e)=>{"use strict";const r=e(6104);t.exports=function(t){if(this.options.raw)return t.op+this.next(t.argument);if(!(t.op in r))throw new SyntaxError(t.op+" not implemented");const n=r[t.op];return this.FunctionNode({name:n,args:[t.argument]})}},9213:(t,n,e)=>{"use strict";e(1668),t.exports.Parser=e(5438),t.exports.nodeTypes=e(3450)},1668:(t,n,e)=>{var r=e(5054),i={n:"\n",f:"\f",r:"\r",t:"\t",v:"\v","'":"'",'"':'"'},o={",":!0,"(":!0,")":!0,"[":!0,"]":!0,";":!0,"~":!0,"!":!0,"+":!0,"-":!0,"*":!0,"/":!0,"%":!0,"^":!0,"**":!0,"|":!0,"&":!0,"^|":!0,"=":!0,":":!0,"?":!0,"||":!0,"&&":!0,xor:!0,"==":!0,"!=":!0,"===":!0,"!==":!0,"<":!0,">":!0,">=":!0,"<=":!0,">>>":!0,"<<":!0,">>":!0};function a(t){return t>="0"&&t<="9"}function s(t){return t>="a"&&t<="z"||t>="A"&&t<="Z"||"$"===t||"_"===t}function u(t){return" "===t||"\r"===t||"\t"===t||"\n"===t||"\v"===t||" "===t}function l(t){return o[t]}function c(t){return"'"===t||'"'===t}function h(){}h.prototype.throwError=function(t,n){n=void 0===n?this.index:n;var e=new Error(t+" at index "+n);throw e.index=n,e.description=t,e},h.prototype.lex=function(t){for(this.text=t,this.index=0,this.tokens=[];this.index=this.text.length))return this.text.charAt(this.index+t)},h.prototype.consume=function(){var t=this.peek();return this.index+=1,t},h.prototype.readNumber=function(){var t="";if("."===this.peek())t+=this.consume(),a(this.peek())||this.throwError("number expected");else{for(;a(this.peek());)t+=this.consume();"."===this.peek()&&(t+=this.consume())}for(;a(this.peek());)t+=this.consume();if("e"===this.peek()||"E"===this.peek())for(t+=this.consume(),a(this.peek())||"+"===this.peek()||"-"===this.peek()||this.throwError(),"+"!==this.peek()&&"-"!==this.peek()||(t+=this.consume()),a(this.peek())||this.throwError("number expected");a(this.peek());)t+=this.consume();return t},h.prototype.readIdentifier=function(){for(var t="";s(this.peek())||a(this.peek());)t+=this.consume();return t},h.prototype.readString=function(){for(var t,n=this.consume(),e="";;){var r=this.consume();if(r||this.throwError("string is not closed"),t){if("u"===r){var o=this.text.substring(this.index+1,this.index+5);o.match(/[\da-f]{4}/i)||this.throwError("invalid unicode escape"),this.index+=4,e+=String.fromCharCode(parseInt(o,16))}else{e+=i[r]||r}t=!1}else{if(r===n)break;"\\"===r?t=!0:e+=r}}return e},t.exports=h},5438:(t,n,e)=>{var r=e(5054),i=e(1668),o=e(6311),a=e(6565),s=e(5543),u=e(2514),l=e(8935),c=e(3862),h=e(9322),f=e(3262),p=e(2962);function d(){this.lexer=new i,this.tokens=null}d.prototype.current=function(){return this.tokens[0]},d.prototype.next=function(){return this.tokens[1]},d.prototype.peek=function(){if(this.tokens.length)for(var t=this.tokens[0],n=0;n=","<=",">","<")){var n=this.consume(),e=this.shift();return new a(n.value,[t,e])}return t},d.prototype.shift=function(){var t=this.additive();if(this.peek(">>","<<",">>>")){var n=this.consume(),e=this.shift();return new a(n.value,[t,e])}return t},d.prototype.additive=function(){for(var t=this.multiplicative();this.peek("+","-");){var n=this.consume();t=new a(n.value,[t,this.multiplicative()])}return t},d.prototype.multiplicative=function(){for(var t,n,e=this.unary();this.peek("*","/","%");)t=this.consume(),e=new a(t.value,[e,this.unary()]);return this.current().type===r.SYMBOL||this.peek("(")||!(e.type instanceof o)&&this.current().type===r.NUMBER?(n=this.multiplicative(),new a("*",[e,n])):e},d.prototype.unary=function(){if(this.peek("-","+","~")){var t=this.consume(),n=this.unary();return new s(t.value,n)}return this.pow()},d.prototype.pow=function(){var t=this.factorial();if(this.peek("^","**")){var n=this.consume(),e=this.unary();return new a(n.value,[t,e])}return t},d.prototype.factorial=function(){var t=this.symbol();if(this.peek("!")){var n=this.consume();return new a(n.value,[t])}return t},d.prototype.symbol=function(){if(this.current().type===r.SYMBOL){var t=this.consume();return this.functionCall(t)}return this.string()},d.prototype.functionCall=function(t){var n=t.value;if(this.peek("(")){this.consume();for(var e=[];!this.peek(")")&&!this.isEOF();)e.push(this.assignment()),this.peek(",")&&this.consume();return this.expect(")"),new l(n,e)}return new u(n)},d.prototype.string=function(){return this.current().type===r.STRING?new o(this.consume().value,"string"):this.array()},d.prototype.array=function(){if(this.peek("[")){this.consume();for(var t=[];!this.peek("]")&&!this.isEOF();)t.push(this.assignment()),this.peek(",")&&this.consume();return this.expect("]"),new c(t)}return this.number()},d.prototype.number=function(){return this.current().type===r.NUMBER?new o(this.consume().value,"number"):this.parentheses()},d.prototype.parentheses=function(){if("("===this.current().value){this.consume();var t=this.assignment();return this.expect(")"),t}return this.end()},d.prototype.end=function(){if(this.current().type!==r.EOF)throw Error("unexpected end of expression")},t.exports=d},3862:(t,n,e)=>{var r=e(7111);function i(t){this.nodes=t}i.prototype=Object.create(r.prototype),i.prototype.type="ArrayNode",t.exports=i},3262:(t,n,e)=>{var r=e(7111);function i(t,n){this.name=t,this.expr=n}i.prototype=Object.create(r.prototype),i.prototype.type="AssignmentNode",t.exports=i},2962:(t,n,e)=>{var r=e(7111);function i(t){this.blocks=t}i.prototype=Object.create(r.prototype),i.prototype.type="BlockNode",t.exports=i},9322:(t,n,e)=>{var r=e(7111);function i(t,n,e){this.condition=t,this.trueExpr=n,this.falseExpr=e}i.prototype=Object.create(r.prototype),i.prototype.type="ConditionalNode",t.exports=i},6311:(t,n,e)=>{var r=e(7111),i={number:!0,string:!0,boolean:!0,undefined:!0,null:!0};function o(t,n){if(!i[n])throw Error("unsupported type '"+n+"'");this.value=t,this.valueType=n}o.prototype=Object.create(r.prototype),o.prototype.type="ConstantNode",t.exports=o},8935:(t,n,e)=>{var r=e(7111);function i(t,n){this.name=t,this.args=n}i.prototype=Object.create(r.prototype),i.prototype.type="FunctionNode",t.exports=i},7111:t=>{function n(){}n.prototype.type="Node",t.exports=n},6565:(t,n,e)=>{var r=e(7111);function i(t,n){this.op=t,this.args=n||[]}i.prototype=Object.create(r.prototype),i.prototype.type="OperatorNode",t.exports=i},2514:(t,n,e)=>{var r=e(7111);function i(t){this.name=t}i.prototype=Object.create(r.prototype),i.prototype.type="SymbolNode",t.exports=i},5543:(t,n,e)=>{var r=e(7111);function i(t,n){this.op=t,this.argument=n}i.prototype=Object.create(r.prototype),i.prototype.type="UnaryNode",t.exports=i},3450:(t,n,e)=>{t.exports={ArrayNode:e(3862),AssignmentNode:e(3262),BlockNode:e(2962),ConditionalNode:e(9322),ConstantNode:e(6311),FunctionNode:e(8935),Node:e(7111),OperatorNode:e(6565),SymbolNode:e(2514),UnaryNode:e(5543)}},5054:t=>{t.exports={EOF:0,DELIMITER:1,NUMBER:2,STRING:3,SYMBOL:4}},3093:(t,n,e)=>{"use strict";var r=e(4822),i=Math.pow(2,-1074),o=-1>>>0;t.exports=function(t,n){if(isNaN(t)||isNaN(n))return NaN;if(t===n)return t;if(0===t)return n<0?-i:i;var e=r.hi(t),a=r.lo(t);return n>t==t>0?a===o?(e+=1,a=0):a+=1:0===a?(a=o,e-=1):a-=1,r.pack(a,e)}},405:function(t,n,e){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(n,"__esModule",{value:!0}),n.Chart=void 0;const i=e(6660),o=e(103),a=e(8066),s=e(8873),u=e(9065),l=e(3905),c=e(9928),h=r(e(7187)),f=r(e(3559)),p=r(e(953)),d=r(e(9489)),y=r(e(917)),m=r(e(5888)),_=e(7634);function g(t){return"linear"===t?a.scaleLinear:a.scaleLog}class v extends h.default.EventEmitter{constructor(t){super();const n=Math.random(),e=String.fromCharCode(Math.floor(26*n)+97);this.options=t,this.id=e+n.toString(16).substr(2),this.options.id=this.id,this.markerId=this.id+"-marker",v.cache[this.id]=this,this.linkedGraphs=[this],this.meta={},this.setUpEventListeners()}build(){return this.internalVars(),this.drawGraphWrapper(),this}getDraggableNode(){return(0,l.select)(this.options.target).select(".zoom-and-drag").node()}getEmitInstance(){let t=this;const n=this.getDraggableNode();return n&&(t=n.instance),t}internalVars(){const t=this.meta.margin=this.isPolarCoordinateSystem()?{left:0,right:0,top:0,bottom:0}:{left:40,right:20,top:20,bottom:20};this.options.title&&!this.isPolarCoordinateSystem()&&(this.meta.margin.top=40),this.meta.width=(this.options.width||m.default.DEFAULT_WIDTH)-t.left-t.right,this.meta.height=(this.options.height||m.default.DEFAULT_HEIGHT)-t.top-t.bottom,this.initializeAxes()}initializeAxes(){const t=this,n=(0,o.format)("~s");function e(t){return Math.abs(t)-Math.floor(Math.abs(t))>0?t.toString():n(t)}if(this.options.coordinateSystem=this.options.coordinateSystem||"cartesian",this.options.xAxis=this.options.xAxis||{},this.options.xAxis.type=this.options.xAxis.type||"linear",this.options.yAxis=this.options.yAxis||{},this.options.yAxis.type=this.options.yAxis.type||"linear","cartesian"!==this.options.coordinateSystem&&"polar"!==this.options.coordinateSystem)throw new Error(`unsupported coordinate system ${this.options.coordinateSystem}`);"polar"===this.options.coordinateSystem&&(0,_.validatePolarOptions)(this.options);const{xDomain:r,yDomain:a}=function(t,n,e){var r,i;const o="polar"===t.coordinateSystem?null===(i=null===(r=t.polar)||void 0===r?void 0:r.radiusDomain)||void 0===i?void 0:i[1]:void 0,a=void 0===o?void 0:1.2*o,s=(()=>{if(t.xAxis.domain)return t.xAxis.domain;if("log"===t.xAxis.type)return[1,10];if("linear"===t.xAxis.type)return void 0===a?[-6,6]:[-a,a];throw new Error(`axis type ${t.xAxis.type} unsupported`)})(),u=(()=>{if(t.yAxis.domain)return t.yAxis.domain;if("log"===t.yAxis.type)return[1,10];if("linear"===t.yAxis.type){if(void 0!==a)return[-a,a];const t=(t=>{const r=t[1]-t[0];return e*r/n})(s);return[-t/2,t/2]}throw new Error(`axis type ${t.yAxis.type} unsupported`)})();return"polar"===t.coordinateSystem?(0,_.getPolarDomains)(s,u,n,e):{xDomain:s,yDomain:u}}(this.options,this.meta.width,this.meta.height);this.meta.xDomain=r,this.meta.yDomain=a,this.meta.xScale||(this.meta.xScale=g(this.options.xAxis.type)()),this.meta.xScale.domain(r).range(this.options.xAxis.invert?[this.meta.width,0]:[0,this.meta.width]),this.meta.yScale||(this.meta.yScale=g(this.options.yAxis.type)()),this.meta.yScale.domain(a).range(this.options.yAxis.invert?[0,this.meta.height]:[this.meta.height,0]),this.meta.xAxis||(this.meta.xAxis=(0,s.axisBottom)(this.meta.xScale)),this.meta.xAxis.scale(this.meta.xScale).tickSize(this.options.grid?-this.meta.height:0).tickFormat(e),this.meta.yAxis||(this.meta.yAxis=(0,s.axisLeft)(this.meta.yScale)),this.meta.yAxis.scale(this.meta.yScale).tickSize(this.options.grid?-this.meta.width:0).tickFormat(e),this.line=(0,i.line)().x((function(n){return t.meta.xScale(n[0])})).y((function(n){return t.meta.yScale(n[1])}))}drawGraphWrapper(){const t=this.root=(0,l.select)(this.options.target).selectAll("svg").data([this.options]);this.root.enter=t.enter().append("svg").attr("class","function-plot").attr("font-size",this.getFontSize()),t.merge(this.root.enter).attr("width",this.meta.width+this.meta.margin.left+this.meta.margin.right).attr("height",this.meta.height+this.meta.margin.top+this.meta.margin.bottom),this.buildTitle(),this.buildLegend(),this.buildCanvas(),this.buildClip(),this.buildAxis(),this.buildAxisLabel();const n=this.tip=(0,p.default)(Object.assign(this.options.tip||{},{owner:this}));this.canvas.merge(this.canvas.enter).call(n),this.setUpPlugins(),this.draw(),this.buildZoomHelper()}buildTitle(){const t=this.root.merge(this.root.enter).selectAll("text.title").data((function(t){return[t.title].filter(Boolean)}));t.enter().append("text").merge(t).attr("class","title").attr("y",this.isPolarCoordinateSystem()?20:this.meta.margin.top/2).attr("x",this.meta.margin.left+this.meta.width/2).attr("font-size",25).attr("text-anchor","middle").attr("alignment-baseline","middle").text(this.options.title),t.exit().remove()}buildLegend(){this.root.enter.append("text").attr("class","top-right-legend").attr("text-anchor","end"),this.root.merge(this.root.enter).select(".top-right-legend").attr("y",this.isPolarCoordinateSystem()?8:this.meta.margin.top/2).attr("x",this.meta.width+this.meta.margin.left-(this.isPolarCoordinateSystem()?8:0)).attr("dominant-baseline",this.isPolarCoordinateSystem()?"hanging":null)}buildCanvas(){const t=this.canvas=this.root.merge(this.root.enter).selectAll(".canvas").data((function(t){return[t]}));this.canvas.enter=t.enter().append("g").attr("class","canvas")}buildClip(){const t=this.id,n=this.canvas.enter.append("defs");n.append("clipPath").attr("id","function-plot-clip-"+t).append("rect").attr("class","clip static-clip"),this.canvas.merge(this.canvas.enter).selectAll(".clip").attr("width",this.meta.width).attr("height",this.meta.height),n.append("clipPath").append("marker").attr("id",this.markerId).attr("viewBox","0 -5 10 10").attr("refX",10).attr("markerWidth",5).attr("markerHeight",5).attr("orient","auto").append("svg:path").attr("d","M0,-5L10,0L0,5L0,0").attr("stroke-width","0px").attr("fill-opacity",1).attr("fill","#777")}buildAxis(){const t=this.canvas.enter;t.append("g").attr("class","x axis"),t.append("g").attr("class","y axis"),this.canvas.merge(this.canvas.enter).select(".x.axis").attr("transform","translate(0,"+this.meta.height+")").style("display",this.isPolarCoordinateSystem()?"none":null).call(this.meta.xAxis),this.canvas.merge(this.canvas.enter).select(".y.axis").style("display",this.isPolarCoordinateSystem()?"none":null).call(this.meta.yAxis)}buildAxisLabel(){const t=this.canvas,n=this,e=t.merge(t.enter).selectAll("text.x.axis-label").data((function(t){return n.isPolarCoordinateSystem()?[]:[t.xAxis.label].filter(Boolean)})),r=e.enter().append("text").attr("class","x axis-label").attr("text-anchor","end");e.merge(r).attr("x",this.meta.width).attr("y",this.meta.height-6).text((function(t){return t})),e.exit().remove();const i=t.merge(t.enter).selectAll("text.y.axis-label").data((function(t){return n.isPolarCoordinateSystem()?[]:[t.yAxis.label].filter(Boolean)})),o=i.enter().append("text").attr("class","y axis-label").attr("y",6).attr("dy",".75em").attr("text-anchor","end").attr("transform","rotate(-90)");i.merge(o).text((function(t){return t})),i.exit().remove()}buildContent(){const t=this,n=this.canvas;n.merge(n.enter).attr("transform","translate("+this.meta.margin.left+","+this.meta.margin.top+")");const e=this.content=n.merge(n.enter).selectAll(":scope > g.content").data((function(t){return[t]})),r=e.enter().append("g").attr("clip-path","url(#function-plot-clip-"+this.id+")").attr("class","content");if("linear"===this.options.xAxis.type){const t=e.merge(r).selectAll(":scope > path.y.origin").data(this.isPolarCoordinateSystem()?[]:[[[0,this.meta.yScale.domain()[0]],[0,this.meta.yScale.domain()[1]]]]),n=t.enter().append("path").attr("class","y origin").attr("stroke","black").attr("opacity",.2);t.merge(n).attr("d",this.line),t.exit().remove()}if("linear"===this.options.yAxis.type){const t=e.merge(r).selectAll(":scope > path.x.origin").data(this.isPolarCoordinateSystem()?[]:[[[this.meta.xScale.domain()[0],0],[this.meta.xScale.domain()[1],0]]]),n=t.enter().append("path").attr("class","x origin").attr("stroke","black").attr("opacity",.2);t.merge(n).attr("d",this.line),t.exit().remove()}e.merge(r).call((0,f.default)({owner:t}));const i=e.merge(r).selectAll(":scope > g.graph").data((t=>t.data.map(y.default)),(t=>t.fn||t.r||t.x||t.text));i.exit().remove();const o=i.enter().append("g").attr("class","graph");i.merge(o).each((function(n,e){n.index=e;const r=(0,l.select)(this);r.call(m.default.graphTypes[n.graphType](t)),r.call((0,d.default)(t))}))}buildZoomHelper(){var t;const n=this;if(this.meta.zoomBehavior||(this.meta.zoomBehavior=(0,u.zoom)().on("zoom",(function(t){n.getEmitInstance().emit("all:zoom",t)}))),this.isPolarCoordinateSystem()||"polar"===this.getEmitInstance().options.lastCoordinateSystem){const e=(null===(t=this.getDraggableNode())||void 0===t?void 0:t.__zoom)||u.zoomIdentity,r=u.zoomIdentity.scale(1/e.k).translate(-e.x,-e.y);n.meta.zoomBehavior.xScale=r.rescaleX(n.meta.xScale),n.meta.zoomBehavior.yScale=r.rescaleY(n.meta.yScale)}else n.meta.zoomBehavior.xScale=n.meta.zoomBehavior.xScale||n.meta.xScale.copy(),n.meta.zoomBehavior.yScale=n.meta.zoomBehavior.yScale||n.meta.yScale.copy(),n.meta.zoomBehavior.xScale.range(n.meta.xScale.range()),n.meta.zoomBehavior.yScale.range(n.meta.yScale.range());this.canvas.enter.append("rect").call(this.meta.zoomBehavior).attr("class","zoom-and-drag").style("fill","none").style("pointer-events","all").on("mouseover",(function(t){n.getEmitInstance().emit("all:mouseover",t)})).on("mouseout",(function(t){n.getEmitInstance().emit("all:mouseout",t)})).on("mousemove",(function(t){n.getEmitInstance().emit("all:mousemove",t)})),this.draggable=this.canvas.merge(this.canvas.enter).select(".zoom-and-drag").call((t=>{t.node()&&(t.node().instance=n)})).attr("width",this.meta.width).attr("height",this.meta.height),this.options.lastCoordinateSystem=this.options.coordinateSystem}setUpPlugins(){const t=this.options.plugins||[],n=this;t.forEach((function(t){t(n)}))}addLink(){for(let t=0;tthis.meta.height?this.meta.height:i,n.select(".x.axis").attr("transform","translate(0,"+i+")"),n.selectAll(".x.axis path, .x.axis line").attr("transform","translate(0,"+(this.meta.height/2-i+this.meta.height/2)+")")}if(n.select(".y.axis").call(t.meta.yAxis),n.select(".y.axis").style("display",null),"sticky"===this.options.yAxis.position){const t=this.meta.xScale.domain()[0],e=this.meta.xScale.domain()[1],r=(e+t)/2;let i=this.meta.width/(t-e)*r+this.meta.width/2;i=i<0?0:i,i=i>this.meta.width?this.meta.width:i,n.select(".y.axis").attr("transform","translate("+i+",0)"),n.selectAll(".y.axis path, .y.axis line").attr("transform","translate("+-i+",0)")}n.selectAll(".axis path, .axis line").attr("fill","none").attr("stroke","black").attr("shape-rendering","crispedges").attr("opacity",.1)}syncOptions(){this.options.xAxis.domain=this.meta.xScale.domain(),this.options.yAxis.domain=this.meta.yScale.domain()}getFontSize(){return Math.max(Math.max(this.meta.width,this.meta.height)/50,8)}draw(){const t=this;t.emit("before:draw"),t.syncOptions(),t.updateAxes(),t.buildContent(),t.emit("after:draw")}isPolarCoordinateSystem(){return"polar"===this.options.coordinateSystem}setUpEventListeners(){const t=this,n=this.getEmitInstance();n&&n.removeAllListeners();const e={mousemove:function(n){t.tip.move(n)},mouseover:function(){t.tip.show()},mouseout:function(){t.tip.hide()},zoom:function({transform:n}){if(t.options.disableZoom)return;const e=n.rescaleX(t.meta.zoomBehavior.xScale).interpolate(c.interpolateRound),r=n.rescaleY(t.meta.zoomBehavior.yScale).interpolate(c.interpolateRound);t.meta.xScale.domain(e.domain()).range(e.range()),t.meta.yScale.domain(r.domain()).range(r.range())},"tip:update":function({x:n,y:e,index:r}){const i=t.root.merge(t.root.enter).datum().data[r],o=i.title||"",a=i.renderer||function(t,n){return t.toFixed(3)+", "+n.toFixed(3)},s=[];o&&s.push(o),s.push(a(n,e)),t.root.select(".top-right-legend").attr("fill",m.default.COLORS[r]).text(s.join(" "))}},r={mousemove:function(n){const e=(0,l.pointer)(n,t.draggable.node()),r={x:t.meta.xScale.invert(e[0]),y:t.meta.yScale.invert(e[1])};t.linkedGraphs.forEach((function(t){t.emit("before:mousemove",r),t.emit("mousemove",r)}))},zoom:function(n){t.linkedGraphs.forEach((function(e){e.draggable.node().__zoom=t.draggable.node().__zoom,e.emit("zoom",n),e.draw()})),t.emit("all:mousemove",n)}};Object.keys(e).forEach((function(n){!r[n]&&t.on("all:"+n,(function(){const e=Array.prototype.slice.call(arguments);t.linkedGraphs.forEach((function(t){const r=e.slice();r.unshift(n),t.emit.apply(t,r)}))})),t.on(n,e[n])})),Object.keys(r).forEach((function(n){t.on("all:"+n,r[n])}))}}n.Chart=v,v.cache={}},917:(t,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(t){return"graphType"in t||(t.graphType="interval"),"sampler"in t||(t.sampler="interval"!==t.graphType?"builtIn":"interval"),"fnType"in t||(t.fnType="linear"),t}},6025:function(t,n,e){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(n,"__esModule",{value:!0});const i=r(e(5888)),o=r(e(8458)),a=r(e(7777));n.default=function(t,n){const e=function(t,n){const e=n.range||[-1/0,1/0];return[Math.max(t.domain()[0],e[0]),Math.min(t.domain()[1],e[1])]}(t.meta.xScale,n);let r;if("builtIn"===n.sampler)r=a.default;else{if("interval"!==n.sampler)throw new Error(`Invalid sampler function ${n.sampler}`);r=o.default}const s=n.nSamples||Math.min(i.default.MAX_ITERATIONS,i.default.DEFAULT_ITERATIONS||2*t.meta.width),u=r({d:n,range:e,xScale:t.meta.xScale,yScale:t.meta.yScale,xAxis:t.options.xAxis,yAxis:t.options.yAxis,nSamples:s});return t.emit("eval",u,n.index,n.isHelper),u}},5888:(t,n,e)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.registerGraphType=void 0;const r=e(6618),i={COLORS:["steelblue","red","#05b378","orange","#4040e8","yellow","brown","magenta","cyan"].map((function(t){return(0,r.hsl)(t)})),DEFAULT_WIDTH:550,DEFAULT_HEIGHT:350,DEFAULT_ITERATIONS:null,TIP_X_EPS:1,MAX_ITERATIONS:0,graphTypes:{}};i.MAX_ITERATIONS=10*i.DEFAULT_WIDTH,n.registerGraphType=function(t,n){if(Object.hasOwn(i.graphTypes,t))throw new Error(`registerGraphType: graphType ${t} is already registered.`);i.graphTypes[t]=n},n.default=i},3321:function(t,n,e){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(n,"__esModule",{value:!0}),n.text=n.scatter=n.interval=n.polyline=void 0;const i=r(e(2210));n.polyline=i.default;const o=r(e(2266));n.interval=o.default;const a=r(e(648));n.scatter=a.default;const s=r(e(8607));n.text=s.default},2266:function(t,n,e){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(n,"__esModule",{value:!0});const i=e(3905),o=r(e(6025)),a=r(e(8593));n.default=function(t){let n;const e=t.meta.xScale,r=t.meta.yScale;function s(t,e,r,i){if(r>i){const t=r;r=i,i=t}const o=Math.min(e,i),a=Math.max(t,r);return a>o?[-n,0]:[a,o]}return function u(l){l.each((function(l){const c=u.el=(0,i.select)(this),h=l.index,f=l.closed,p=(0,o.default)(t,l),d=c.selectAll(":scope > path.line").data(p);n=Math.max(p[0].scaledDx,1);const y=`line line-${h}`,m=d.enter().append("path").attr("class",y).attr("fill","none"),_=d.merge(m).attr("stroke-width",n).attr("stroke",a.default.color(l,h)).attr("opacity",f?.5:1).attr("d",(function(t){return function(t,i){let o="";const a=r.range(),u=Math.min.apply(Math,a),l=Math.max.apply(Math,a);for(let a=0,c=t.length;a path.line").data(l),f=t.meta.yScale.range();let p=f[0],d=f[1];const y=p-d;function m(n){return a.default.clamp(t.meta.yScale(n[1]),d,p)}p+=1e6*y,d-=1e6*y,e.skipBoundsCheck&&(p=a.default.infinity(),d=-a.default.infinity());const _=(0,o.line)().curve(o.curveLinear).x((function(n){return t.meta.xScale(n[0])})).y(m),g=(0,o.area)().x((function(n){return t.meta.xScale(n[0])})).y0(t.meta.yScale(0)).y1(m),v=`line line-${u}`,x=h.enter().append("path").attr("class",v).attr("stroke-width",1).attr("stroke-linecap","round");h.merge(x).each((function(){const n=(0,i.select)(this);let r;if(e.closed?(n.attr("fill",c),n.attr("fill-opacity",.3),r=g):(n.attr("fill","none"),r=_),n.attr("stroke",c).attr("marker-end",(function(){return"vector"===e.fnType?"url(#"+t.markerId+")":null})).attr("d",r),e.attr)for(const t in e.attr){let r=e.attr[t];"class"===t&&(r=`${v} ${e.attr[t]}`),n.attr(t,r)}})),h.exit().remove()}))}}},648:function(t,n,e){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(n,"__esModule",{value:!0});const i=e(3905),o=e(6618),a=r(e(8593)),s=r(e(6025));n.default=function(t){const n=t.meta.xScale,e=t.meta.yScale;return function(r){r.each((function(r){let u,l;const c=r.index,h=a.default.color(r,c),f=(0,s.default)(t,r),p=[];for(u=0;u circle.scatter").data(p),y=`scatter scatter-${c}`,m=d.enter().append("circle").attr("class",y),_=d.merge(m).attr("fill",(0,o.hsl)(h.toString()).brighter(1.5).formatHex()).attr("stroke",h).attr("opacity",.7).attr("r",1).attr("cx",(function(t){return n(t[0])})).attr("cy",(function(t){return e(t[1])}));if(r.attr)for(const t in r.attr){let n=r.attr[t];"class"===t&&(n=`${y} ${r.attr[t]}`),_.attr(t,n)}d.exit().remove()}))}}},8607:function(t,n,e){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(n,"__esModule",{value:!0});const i=e(3905),o=e(6618),a=r(e(8593));n.default=function(t){const n=t.meta.xScale,e=t.meta.yScale;return function(t){t.each((function(t){t.sampler="builtIn",t.fnType="vector";const r=(0,i.select)(this).selectAll(":scope > text.fn-text").data([t.location]),s=r.enter().append("text").attr("class",`fn-text fn-text-${t.index}`),u=a.default.color(t,t.index),l=r.merge(s).attr("fill",(0,o.hsl)(u.toString()).brighter(1.5).formatHex()).attr("x",(t=>n(t[0]))).attr("y",(t=>e(t[1]))).text((()=>t.text));if(t.attr)for(const n in t.attr)l.attr(n,t.attr[n]);r.exit().remove()}))}}},3559:(t,n,e)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e(6660),i=e(3905);n.default=function(t){const n=t.owner.meta.xScale,e=t.owner.meta.yScale,o=(0,r.line)().x((function(t){return t[0]})).y((function(t){return t[1]}));return function(t){t.each((function(){const t=(0,i.select)(this).selectAll("g.annotations").data((function(t){return t.annotations||[]})),r=t.enter().append("g").attr("class","annotations"),a=e.range(),s=n.range(),u=t.merge(r).selectAll("path").data((function(t){return"x"in t?[[[0,a[0]],[0,a[1]]]]:[[[s[0],0],[s[1],0]]]})),l=u.enter().append("path");u.merge(l).attr("stroke","#eee").attr("d",o),u.exit().remove();const c=t.merge(r).selectAll("text").data((function(t){return[{text:t.text||"",hasX:"x"in t}]})),h=c.enter().append("text");c.merge(h).text((function(t){return t.text})).attr("y",(function(t){return t.hasX?3:0})).attr("x",(function(t){return t.hasX?0:3})).attr("dy",(function(t){return t.hasX?5:-5})).attr("text-anchor",(function(t){return t.hasX?"end":""})).attr("transform",(function(t){return t.hasX?"rotate(-90)":""})),c.exit().remove(),t.merge(r).attr("transform",(function(t){return"x"in t?"translate("+n(t.x)+", 0)":"translate(0, "+e(t.y)+")"})),t.exit().remove()}))}}},8016:function(t,n,e){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(n,"__esModule",{value:!0});const i=e(3905),o=e(3321),a=e(1669),s=r(e(917)),u=r(e(8593));n.default=function(t){const n=(0,s.default)({isHelper:!0,skipTip:!0,skipBoundsCheck:!0,nSamples:2,graphType:"polyline"});function e(t){if(!t.derivative)return[];const e="number"==typeof t.derivative.x0?t.derivative.x0:u.default.infinity();return n.index=t.index,n.scope={m:(0,a.builtIn)(t.derivative,"fn",{x:e}),x0:e,y0:(0,a.builtIn)(t,"fn",{x:e})},n.fn="m * (x - x0) + y0",[n]}function r(n){const e=this;n.derivative&&n.derivative.updateOnMouseMove&&!n.derivative.$$mouseListener&&(n.derivative.$$mouseListener=function({x:t}){n.derivative&&(n.derivative.x0=t),l(e)},t.on("tip:update",n.derivative.$$mouseListener))}const l=function(n){n.each((function(a){const s=(0,i.select)(this),u=e.call(n,a);r.call(n,a);const l=s.selectAll("g.derivative").data(u),c=l.enter().append("g").attr("class","derivative");l.merge(c).call((0,o.polyline)(t)),l.merge(c).selectAll("path").attr("opacity",.5),l.exit().remove()}))};return l}},1669:function(t,n,e){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(n,"__esModule",{value:!0}),n.interval=n.builtIn=void 0;const i=r(e(5248)),o={interval:r(e(8867)).default,builtIn:i.default},a="object"==typeof e.g&&"math"in e.g?e.g.math:"object"==typeof window&&"math"in window?window.math:null;function s(t){return function(n,e,r){return function(n,e){const r=n[e],i=t+"_Expression_"+e,s=t+"_Compiled_"+e;r!==n[i]&&(n[i]=r,n[s]=function(n){if("string"==typeof n){const e=o[t](n);return a&&"builtIn"===t?{eval:e.evaluate||e.eval}:e}if("function"==typeof n)return{eval:n};throw Error("expression must be a string or a function")}(r))}(n,e),function(n,e){return n[t+"_Compiled_"+e]}(n,e).eval(Object.assign({},n.scope||{},r))}}a&&(o.builtIn=a.compile);const u=s("builtIn");n.builtIn=u;const l=s("interval");n.interval=l},9489:function(t,n,e){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(n,"__esModule",{value:!0});const i=e(3905),o=r(e(8016)),a=r(e(9793));n.default=function(t){return function(n){n.each((function(){const n=(0,i.select)(this);n.call((0,o.default)(t)),n.call((0,a.default)(t))}))}}},9793:function(t,n,e){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(n,"__esModule",{value:!0});const i=e(3905),o=e(1669),a=r(e(917)),s=e(3321),u=r(e(8593));n.default=function(t){const n=(0,a.default)({isHelper:!0,skipTip:!0,skipBoundsCheck:!0,nSamples:2,graphType:"polyline"});function e(t,n){if(!("x0"in n))throw Error("secant must have the property `x0` defined");n.scope=n.scope||{};const e=n.x0,r="number"==typeof n.x1?n.x1:u.default.infinity();var i;Object.assign(n.scope,{x0:e,x1:r,y0:(0,o.builtIn)(t,"fn",{x:e}),y1:(0,o.builtIn)(t,"fn",{x:r})}),(i=n.scope).m=(i.y1-i.y0)/(i.x1-i.x0)}function r(t,n){e(t,n),n.fn="m * (x - x0) + y0"}function l(n,r){const i=this;r.updateOnMouseMove&&!r.$$mouseListener&&(r.$$mouseListener=function({x:t}){r.x1=t,e(n,r),h(i)},t.on("tip:update",r.$$mouseListener))}function c(t){const e=this,i=[];t.secants=t.secants||[];for(let o=0;o{"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.renderPolarGrid=n.getPolarLabelLayout=n.getPolarRayInterval=n.formatPolarAngle=n.getPolarAngles=n.getPolarRadii=n.getPolarRadiusDomain=n.getPolarDomains=n.validatePolarOptions=void 0;const r=e(103),i=e(8066),o=e(3905),a=2*Math.PI;function s(t,n){const e=Math.min(...t),r=Math.max(...t),i=Math.min(...n),o=Math.max(...n),a=Math.max(e,Math.min(0,r)),s=Math.max(i,Math.min(0,o));return[Math.hypot(a,s),Math.hypot(Math.max(Math.abs(e),Math.abs(r)),Math.max(Math.abs(i),Math.abs(o)))]}function u(t,n,e){const r=t.radiusDomain||n,o=Math.max(r[0],n[0]),a=Math.min(r[1],n[1]);if(o>a)return[];let s;if(Array.isArray(t.radialTicks))s=t.radialTicks;else{let n=t.radialTicks||5;if(void 0===t.radialTicks&&void 0!==e){const t=(a-o)*e;n=Math.max(1,Math.round(t/50))}s=(0,i.scaleLinear)().domain([o,a]).ticks(n)}return Array.from(new Set(s)).filter((t=>t>0&&t>=o&&t<=a)).sort(((t,n)=>t-n))}function l(t){if(Array.isArray(t.angularTicks)){const n=t.angularTicks.map((t=>(t%a+a)%a));return n.filter(((t,e)=>n.findIndex((n=>Math.abs(n-t)<1e-10))===e))}const n=t.angularTicks||12;return Array.from({length:n},((t,e)=>e*a/n))}function c(t,n){if("degrees"===n)return`${Number((180*t/Math.PI).toFixed(2))}°`;for(const n of[1,2,3,4,6,8,12,16]){const e=Math.round(t/Math.PI*n);if(Math.abs(t/Math.PI-e/n)<1e-10)return 0===e?"0":`${1===e?"":-1===e?"-":String(e)}π${1===n?"":`/${n}`}`}return Number(t.toFixed(3)).toString()}function h(t,n,e,r){let i=-1/0,o=1/0;for(const[a,s,u]of[[t[0],n[0],e],[t[1],n[1],r]]){if(Math.abs(s)<1e-10){if(a<0||a>u)return;continue}const t=(0-a)/s,n=(u-a)/s;i=Math.max(i,Math.min(t,n)),o=Math.min(o,Math.max(t,n))}const a=Math.max(0,i);return o>a?[a,o]:void 0}function f(t,n,e,r,i){const o=h(t,n,r,i);if(!o)return;const a=e.filter((t=>t>=o[0]&&t<=o[1])).pop();return void 0!==a?{position:[t[0]+n[0]*a,t[1]+n[1]*a],textAnchor:n[0]>1e-10?"start":n[0]<-1e-10?"end":"middle"}:void 0}n.validatePolarOptions=function(t){var n,e;if("linear"!==t.xAxis.type||"linear"!==t.yAxis.type)throw new Error("polar coordinate system only supports linear axes");for(const e of[t.xAxis.domain,t.yAxis.domain,null===(n=t.polar)||void 0===n?void 0:n.radiusDomain])if(e&&(2!==e.length||e.some((t=>!Number.isFinite(t)))||e[0]>=e[1]))throw new Error("polar domains must contain two finite ascending values");const r=t.polar;if((null===(e=null==r?void 0:r.radiusDomain)||void 0===e?void 0:e[0])<0)throw new Error("polar radiusDomain must be non-negative");for(const t of[null==r?void 0:r.radialTicks,null==r?void 0:r.angularTicks]){if(void 0!==t&&!Array.isArray(t)&&(!Number.isInteger(t)||t<1))throw new Error("polar tick counts must be positive integers");if(Array.isArray(t)&&t.some((t=>!Number.isFinite(t))))throw new Error("polar tick values must be finite numbers")}if(Array.isArray(null==r?void 0:r.radialTicks)&&r.radialTicks.some((t=>t<0)))throw new Error("polar radial ticks must be non-negative");if((null==r?void 0:r.angleUnit)&&"radians"!==r.angleUnit&&"degrees"!==r.angleUnit)throw new Error(`unsupported polar angle unit ${r.angleUnit}`)},n.getPolarDomains=function(t,n,e,r){const i=Math.max((t[1]-t[0])/e,(n[1]-n[0])/r),o=(t[0]+t[1])/2,a=(n[0]+n[1])/2;return{xDomain:[o-e*i/2,o+e*i/2],yDomain:[a-r*i/2,a+r*i/2]}},n.getPolarRadiusDomain=s,n.getPolarRadii=u,n.getPolarAngles=l,n.formatPolarAngle=c,n.getPolarRayInterval=h,n.getPolarLabelLayout=f,n.renderPolarGrid=function(t,n,e){var i;if("polar"!==e.coordinateSystem||!1===(null===(i=e.polar)||void 0===i?void 0:i.grid))return void t.selectAll("g.polar-grid").remove();const a=t.selectAll("g.polar-grid").data([e.polar||{}]),p=a.merge(a.enter().insert("g",".content, .zoom-and-drag").attr("class","polar-grid")).attr("clip-path",null).attr("pointer-events","none"),d=p.selectAll(":scope > g.polar-grid-lines").data([0]),y=d.enter().append("g").attr("class","polar-grid-lines"),m=t.select("clipPath[id]").attr("id"),_=d.merge(y).attr("clip-path","url(#"+m+")"),g=e.polar||{},v=n.xScale,x=n.yScale,w=s(v.domain(),x.domain()),b=[v(0),x(0)],M=v(1)-b[0],T=x(1)-b[1],A=Math.abs(M),E=u(g,w,A),k=l(g),S=t=>{var e;const r=void 0===(null===(e=g.radiusDomain)||void 0===e?void 0:e[1])?void 0:Math.min(g.radiusDomain[1],w[1]),i=[Math.cos(t)*Math.sign(M),Math.sin(t)*Math.sign(T)],o=h(b,i,n.width,n.height);if(!o)return;const a=void 0===r?o[1]:Math.min(r*A,o[1]);return a>o[0]?{direction:i,rayLength:a}:void 0},N=k.filter((t=>S(t))),P=_.selectAll("circle.polar-grid-circle").data(E,(t=>t));P.exit().remove(),P.merge(P.enter().append("circle").attr("class","polar-grid-circle")).attr("cx",b[0]).attr("cy",b[1]).attr("r",(t=>t*A)).attr("fill","none").attr("stroke","currentColor").attr("opacity",.2);const O=_.selectAll("line.polar-grid-ray").data(N,(t=>t));O.exit().remove(),O.merge(O.enter().append("line").attr("class","polar-grid-ray")).attr("x1",b[0]).attr("y1",b[1]).attr("x2",(t=>{const n=S(t);return b[0]+n.direction[0]*n.rayLength})).attr("y2",(t=>{const n=S(t);return b[1]+n.direction[1]*n.rayLength})).attr("stroke","currentColor").attr("opacity",.2);const I=p.selectAll("text.polar-radius-label").data(E,(t=>t));I.exit().remove(),I.merge(I.enter().append("text").attr("class","polar-radius-label")).attr("x",(t=>v(t))).attr("y",b[1]).attr("text-anchor","middle").attr("dy","-0.8em").attr("fill","currentColor").text(g.radiusTickFormat||(0,r.format)("~g"));const L=[];if(g.angularLabels&&E.length){const t=E.map((t=>t*A));for(const e of N){const r=[Math.cos(e)*Math.sign(M),Math.sin(e)*Math.sign(T)],i=f(b,r,t,n.width,n.height);i&&L.push(Object.assign({angle:e,direction:r},i))}}const Z=p.selectAll("text.polar-angle-label").data(L,(t=>t.angle));Z.exit().remove(),Z.merge(Z.enter().append("text").attr("class","polar-angle-label")).attr("x",(t=>t.position[0])).attr("y",(t=>t.position[1])).attr("dx",(t=>8*t.direction[0])).attr("dy",(t=>8*t.direction[1])).attr("text-anchor",(t=>t.textAnchor)).attr("dominant-baseline","middle").attr("fill","currentColor").text((t=>{const n=g.angleUnit||"radians",e="degrees"===n?180*t.angle/Math.PI:t.angle;return g.angleTickFormat?g.angleTickFormat(e):c(t.angle,n)})).each((function(t){const e=this.getBBox(),r=Math.max(0,-e.x)-Math.max(0,e.x+e.width-n.width),i=Math.max(0,-e.y)-Math.max(0,e.y+e.height-n.height);(0,o.select)(this).attr("dx",8*t.direction[0]+r).attr("dy",8*t.direction[1]+i)}))}},360:()=>{"undefined"!=typeof window&&function(t,n){try{t.querySelector(":scope body")}catch(e){["querySelector","querySelectorAll"].forEach((function(e){const r=n[e];n[e]=function(n){if(/(^|,)\s*:scope/.test(n)){const r=this.id;this.id="ID_"+Date.now(),n=n.replace(/((^|,)\s*):scope/g,"$1#"+this.id);const i=t[e](n);return this.id=r,i}return r.call(this,n)}}))}}(window.document,Element.prototype)},7777:function(t,n,e){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(n,"__esModule",{value:!0});const i=r(e(8593)),o=e(1669);function a(t,n,e,r,s){if(!s)return{asymptote:!0,d0:t,d1:n};const u=t[0],l=n[0],c=i.default.linspace(u,l,10);let h,f;for(let t=0;t<10;t+=1){const n=c[t],u=(0,o.builtIn)(e,"fn",{x:n});if(h){const t=u-h;if(i.default.sgn(t)===r)return a([f,h],[n,u],e,r,s-1)}h=u,f=n}return{asymptote:!1,d0:t,d1:n}}function s(t){const n=i.default.space(t.xAxis,t.range,t.nSamples),e=t.yScale.domain(),r=e[0]-i.default.infinity(),s=e[1]+i.default.infinity(),u=[];for(let e=0;e=2&&r!==p&&Math.abs(f/h)>1){const e=a(n[c-1],n[c],t,p,3);e.asymptote?(n[c-1][0]=e.d0[0],n[c-1][1]=i.default.clamp(e.d0[1],s,u),o.push(l),n[c][0]=e.d1[0],n[c][1]=i.default.clamp(e.d1[1],s,u),l=[n[c]]):l.push(n[c])}else l.push(n[c]);l.length>1&&(h=l[l.length-1][0]-l[l.length-2][0],r=p),++c}return l.length&&o.push(l),o}(t.d,u,t.yScale);return l}function u(t){const n=t.d.range||[0,2*Math.PI],e=i.default.space(t.xAxis,n,t.nSamples),r=[];for(let n=0;nn[1].hi&&(t[1].hi=Math.max(o,t[1].hi),n[1].lo=Math.min(i,n[1].lo)),t[1].hit[0]-s.default.TIP_X_EPS&&w{"use strict";Object.defineProperty(n,"__esModule",{value:!0})},8593:function(t,n,e){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(n,"__esModule",{value:!0});const i=r(e(5888)),o={linspace:function(t,n,e){const r=(n-t)/(e-1);return Array.from({length:e},((n,e)=>t+r*e))},logspace:function(t,n,e){return this.linspace(t,n,e).map((t=>Math.pow(10,t)))},isValidNumber:function(t){return"number"==typeof t&&!isNaN(t)},space:function(t,n,e){const r=n[0],i=n[1];return"log"===t.type?this.logspace(Math.log10(r),Math.log10(i),e):this.linspace(r,i,e)},getterSetter:function(t,n){const e=this;this[n]=function(r){return arguments.length?(t[n]=r,e):t[n]}},sgn:function(t){return t<0?-1:t>0?1:0},clamp:function(t,n,e){return te?e:t},color:function(t,n){const e=n%i.default.COLORS.length;return t.color||i.default.COLORS[e].hex()},infinity:function(){return 9007199254740991}};n.default=o},8873:(t,n,e)=>{"use strict";function r(t){return t}e.r(n),e.d(n,{axisBottom:()=>_,axisLeft:()=>g,axisRight:()=>m,axisTop:()=>y});var i=1,o=2,a=3,s=4,u=1e-6;function l(t){return"translate("+t+",0)"}function c(t){return"translate(0,"+t+")"}function h(t){return n=>+t(n)}function f(t,n){return n=Math.max(0,t.bandwidth()-2*n)/2,t.round()&&(n=Math.round(n)),e=>+t(e)+n}function p(){return!this.__axis}function d(t,n){var e=[],d=null,y=null,m=6,_=6,g=3,v="undefined"!=typeof window&&window.devicePixelRatio>1?0:.5,x=t===i||t===s?-1:1,w=t===s||t===o?"x":"y",b=t===i||t===a?l:c;function M(l){var c=null==d?n.ticks?n.ticks.apply(n,e):n.domain():d,M=null==y?n.tickFormat?n.tickFormat.apply(n,e):r:y,T=Math.max(m,0)+g,A=n.range(),E=+A[0]+v,k=+A[A.length-1]+v,S=(n.bandwidth?f:h)(n.copy(),v),N=l.selection?l.selection():l,P=N.selectAll(".domain").data([null]),O=N.selectAll(".tick").data(c,n).order(),I=O.exit(),L=O.enter().append("g").attr("class","tick"),Z=O.select("line"),C=O.select("text");P=P.merge(P.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),O=O.merge(L),Z=Z.merge(L.append("line").attr("stroke","currentColor").attr(w+"2",x*m)),C=C.merge(L.append("text").attr("fill","currentColor").attr(w,x*T).attr("dy",t===i?"0em":t===a?"0.71em":"0.32em")),l!==N&&(P=P.transition(l),O=O.transition(l),Z=Z.transition(l),C=C.transition(l),I=I.transition(l).attr("opacity",u).attr("transform",(function(t){return isFinite(t=S(t))?b(t+v):this.getAttribute("transform")})),L.attr("opacity",u).attr("transform",(function(t){var n=this.parentNode.__axis;return b((n&&isFinite(n=n(t))?n:S(t))+v)}))),I.remove(),P.attr("d",t===s||t===o?_?"M"+x*_+","+E+"H"+v+"V"+k+"H"+x*_:"M"+v+","+E+"V"+k:_?"M"+E+","+x*_+"V"+v+"H"+k+"V"+x*_:"M"+E+","+v+"H"+k),O.attr("opacity",1).attr("transform",(function(t){return b(S(t)+v)})),Z.attr(w+"2",x*m),C.attr(w,x*T).text(M),N.filter(p).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",t===o?"start":t===s?"end":"middle"),N.each((function(){this.__axis=S}))}return M.scale=function(t){return arguments.length?(n=t,M):n},M.ticks=function(){return e=Array.from(arguments),M},M.tickArguments=function(t){return arguments.length?(e=null==t?[]:Array.from(t),M):e.slice()},M.tickValues=function(t){return arguments.length?(d=null==t?null:Array.from(t),M):d&&d.slice()},M.tickFormat=function(t){return arguments.length?(y=t,M):y},M.tickSize=function(t){return arguments.length?(m=_=+t,M):m},M.tickSizeInner=function(t){return arguments.length?(m=+t,M):m},M.tickSizeOuter=function(t){return arguments.length?(_=+t,M):_},M.tickPadding=function(t){return arguments.length?(g=+t,M):g},M.offset=function(t){return arguments.length?(v=+t,M):v},M}function y(t){return d(i,t)}function m(t){return d(o,t)}function _(t){return d(a,t)}function g(t){return d(s,t)}},4447:(t,n,e)=>{"use strict";e.d(n,{B8:()=>T,Il:()=>i,J5:()=>a,SU:()=>M,Ss:()=>A,Ym:()=>L,ZP:()=>x,xV:()=>o});var r=e(9531);function i(){}var o=.7,a=1/o,s="\\s*([+-]?\\d+)\\s*",u="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",l="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",c=/^#([0-9a-f]{3,8})$/,h=new RegExp(`^rgb\\(${s},${s},${s}\\)$`),f=new RegExp(`^rgb\\(${l},${l},${l}\\)$`),p=new RegExp(`^rgba\\(${s},${s},${s},${u}\\)$`),d=new RegExp(`^rgba\\(${l},${l},${l},${u}\\)$`),y=new RegExp(`^hsl\\(${u},${l},${l}\\)$`),m=new RegExp(`^hsla\\(${u},${l},${l},${u}\\)$`),_={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function g(){return this.rgb().formatHex()}function v(){return this.rgb().formatRgb()}function x(t){var n,e;return t=(t+"").trim().toLowerCase(),(n=c.exec(t))?(e=n[1].length,n=parseInt(n[1],16),6===e?w(n):3===e?new A(n>>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1):8===e?b(n>>24&255,n>>16&255,n>>8&255,(255&n)/255):4===e?b(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|240&n,((15&n)<<4|15&n)/255):null):(n=h.exec(t))?new A(n[1],n[2],n[3],1):(n=f.exec(t))?new A(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=p.exec(t))?b(n[1],n[2],n[3],n[4]):(n=d.exec(t))?b(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=y.exec(t))?O(n[1],n[2]/100,n[3]/100,1):(n=m.exec(t))?O(n[1],n[2]/100,n[3]/100,n[4]):_.hasOwnProperty(t)?w(_[t]):"transparent"===t?new A(NaN,NaN,NaN,0):null}function w(t){return new A(t>>16&255,t>>8&255,255&t,1)}function b(t,n,e,r){return r<=0&&(t=n=e=NaN),new A(t,n,e,r)}function M(t){return t instanceof i||(t=x(t)),t?new A((t=t.rgb()).r,t.g,t.b,t.opacity):new A}function T(t,n,e,r){return 1===arguments.length?M(t):new A(t,n,e,null==r?1:r)}function A(t,n,e,r){this.r=+t,this.g=+n,this.b=+e,this.opacity=+r}function E(){return`#${P(this.r)}${P(this.g)}${P(this.b)}`}function k(){const t=S(this.opacity);return`${1===t?"rgb(":"rgba("}${N(this.r)}, ${N(this.g)}, ${N(this.b)}${1===t?")":`, ${t})`}`}function S(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function N(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function P(t){return((t=N(t))<16?"0":"")+t.toString(16)}function O(t,n,e,r){return r<=0?t=n=e=NaN:e<=0||e>=1?t=n=NaN:n<=0&&(t=NaN),new Z(t,n,e,r)}function I(t){if(t instanceof Z)return new Z(t.h,t.s,t.l,t.opacity);if(t instanceof i||(t=x(t)),!t)return new Z;if(t instanceof Z)return t;var n=(t=t.rgb()).r/255,e=t.g/255,r=t.b/255,o=Math.min(n,e,r),a=Math.max(n,e,r),s=NaN,u=a-o,l=(a+o)/2;return u?(s=n===a?(e-r)/u+6*(e0&&l<1?0:s,new Z(s,u,l,t.opacity)}function L(t,n,e,r){return 1===arguments.length?I(t):new Z(t,n,e,null==r?1:r)}function Z(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function C(t){return(t=(t||0)%360)<0?t+360:t}function D(t){return Math.max(0,Math.min(1,t||0))}function $(t,n,e){return 255*(t<60?n+(e-n)*t/60:t<180?e:t<240?n+(e-n)*(240-t)/60:n)}(0,r.Z)(i,x,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:g,formatHex:g,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return I(this).formatHsl()},formatRgb:v,toString:v}),(0,r.Z)(A,T,(0,r.l)(i,{brighter(t){return t=null==t?a:Math.pow(a,t),new A(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?o:Math.pow(o,t),new A(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new A(N(this.r),N(this.g),N(this.b),S(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:E,formatHex:E,formatHex8:function(){return`#${P(this.r)}${P(this.g)}${P(this.b)}${P(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:k,toString:k})),(0,r.Z)(Z,L,(0,r.l)(i,{brighter(t){return t=null==t?a:Math.pow(a,t),new Z(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?o:Math.pow(o,t),new Z(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),n=isNaN(t)||isNaN(this.s)?0:this.s,e=this.l,r=e+(e<.5?e:1-e)*n,i=2*e-r;return new A($(t>=240?t-240:t+120,i,r),$(t,i,r),$(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new Z(C(this.h),D(this.s),D(this.l),S(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=S(this.opacity);return`${1===t?"hsl(":"hsla("}${C(this.h)}, ${100*D(this.s)}%, ${100*D(this.l)}%${1===t?")":`, ${t})`}`}}))},5159:(t,n,e)=>{"use strict";e.d(n,{Z:()=>d});var r=e(9531),i=e(4447),o=e(5782),a=-.14861,s=1.78277,u=-.29227,l=-.90649,c=1.97294,h=c*l,f=c*s,p=s*u-l*a;function d(t,n,e,r){return 1===arguments.length?function(t){if(t instanceof y)return new y(t.h,t.s,t.l,t.opacity);t instanceof i.Ss||(t=(0,i.SU)(t));var n=t.r/255,e=t.g/255,r=t.b/255,a=(p*r+h*n-f*e)/(p+h-f),s=r-a,d=(c*(e-a)-u*s)/l,m=Math.sqrt(d*d+s*s)/(c*a*(1-a)),_=m?Math.atan2(d,s)*o.R-120:NaN;return new y(_<0?_+360:_,m,a,t.opacity)}(t):new y(t,n,e,null==r?1:r)}function y(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}(0,r.Z)(y,d,(0,r.l)(i.Il,{brighter(t){return t=null==t?i.J5:Math.pow(i.J5,t),new y(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?i.xV:Math.pow(i.xV,t),new y(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=isNaN(this.h)?0:(this.h+120)*o.u,n=+this.l,e=isNaN(this.s)?0:this.s*n*(1-n),r=Math.cos(t),h=Math.sin(t);return new i.Ss(255*(n+e*(a*r+s*h)),255*(n+e*(u*r+l*h)),255*(n+e*(c*r)),this.opacity)}}))},9531:(t,n,e)=>{"use strict";function r(t,n,e){t.prototype=n.prototype=e,e.constructor=t}function i(t,n){var e=Object.create(t.prototype);for(var r in n)e[r]=n[r];return e}e.d(n,{Z:()=>r,l:()=>i})},6618:(t,n,e)=>{"use strict";e.r(n),e.d(n,{color:()=>r.ZP,cubehelix:()=>o.Z,gray:()=>i.MA,hcl:()=>i.Uc,hsl:()=>r.Ym,lab:()=>i.ZP,lch:()=>i.tW,rgb:()=>r.B8});var r=e(4447),i=e(8990),o=e(5159)},8990:(t,n,e)=>{"use strict";e.d(n,{MA:()=>d,Uc:()=>M,ZP:()=>y,tW:()=>b});var r=e(9531),i=e(4447),o=e(5782);const a=.96422,s=1,u=.82521,l=4/29,c=6/29,h=3*c*c,f=c*c*c;function p(t){if(t instanceof m)return new m(t.l,t.a,t.b,t.opacity);if(t instanceof T)return A(t);t instanceof i.Ss||(t=(0,i.SU)(t));var n,e,r=x(t.r),o=x(t.g),l=x(t.b),c=_((.2225045*r+.7168786*o+.0606169*l)/s);return r===o&&o===l?n=e=c:(n=_((.4360747*r+.3850649*o+.1430804*l)/a),e=_((.0139322*r+.0971045*o+.7141733*l)/u)),new m(116*c-16,500*(n-c),200*(c-e),t.opacity)}function d(t,n){return new m(t,0,0,null==n?1:n)}function y(t,n,e,r){return 1===arguments.length?p(t):new m(t,n,e,null==r?1:r)}function m(t,n,e,r){this.l=+t,this.a=+n,this.b=+e,this.opacity=+r}function _(t){return t>f?Math.pow(t,1/3):t/h+l}function g(t){return t>c?t*t*t:h*(t-l)}function v(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function x(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function w(t){if(t instanceof T)return new T(t.h,t.c,t.l,t.opacity);if(t instanceof m||(t=p(t)),0===t.a&&0===t.b)return new T(NaN,0{"use strict";e.d(n,{R:()=>i,u:()=>r});const r=Math.PI/180,i=180/Math.PI},5386:(t,n,e)=>{"use strict";e.d(n,{WU:()=>i,ZP:()=>s,jH:()=>o});var r,i,o,a=e(28);function s(t){return r=(0,a.Z)(t),i=r.format,o=r.formatPrefix,r}s({thousands:",",grouping:[3],currency:["$",""]})},5368:(t,n,e)=>{"use strict";e.d(n,{Z:()=>i});var r=e(8613);function i(t){return(t=(0,r.V)(Math.abs(t)))?t[1]:NaN}},8613:(t,n,e)=>{"use strict";function r(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function i(t,n){if((e=(t=n?t.toExponential(n-1):t.toExponential()).indexOf("e"))<0)return null;var e,r=t.slice(0,e);return[r.length>1?r[0]+r.slice(2):r,+t.slice(e+1)]}e.d(n,{V:()=>i,Z:()=>r})},2035:(t,n,e)=>{"use strict";e.d(n,{Z:()=>i,v:()=>o});var r=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function i(t){if(!(n=r.exec(t)))throw new Error("invalid format: "+t);var n;return new o({fill:n[1],align:n[2],sign:n[3],symbol:n[4],zero:n[5],width:n[6],comma:n[7],precision:n[8]&&n[8].slice(1),trim:n[9],type:n[10]})}function o(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}i.prototype=o.prototype,o.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type}},103:(t,n,e)=>{"use strict";e.r(n),e.d(n,{FormatSpecifier:()=>o.v,format:()=>r.WU,formatDefaultLocale:()=>r.ZP,formatLocale:()=>i.Z,formatPrefix:()=>r.jH,formatSpecifier:()=>o.Z,precisionFixed:()=>a.Z,precisionPrefix:()=>s.Z,precisionRound:()=>u.Z});var r=e(5386),i=e(28),o=e(2035),a=e(6909),s=e(7017),u=e(3482)},28:(t,n,e)=>{"use strict";e.d(n,{Z:()=>f});var r,i=e(5368),o=e(2035),a=e(8613);function s(t,n){var e=(0,a.V)(t,n);if(!e)return t+"";var r=e[0],i=e[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}const u={"%":(t,n)=>(100*t).toFixed(n),b:t=>Math.round(t).toString(2),c:t=>t+"",d:a.Z,e:(t,n)=>t.toExponential(n),f:(t,n)=>t.toFixed(n),g:(t,n)=>t.toPrecision(n),o:t=>Math.round(t).toString(8),p:(t,n)=>s(100*t,n),r:s,s:function(t,n){var e=(0,a.V)(t,n);if(!e)return t+"";var i=e[0],o=e[1],s=o-(r=3*Math.max(-8,Math.min(8,Math.floor(o/3))))+1,u=i.length;return s===u?i:s>u?i+new Array(s-u+1).join("0"):s>0?i.slice(0,s)+"."+i.slice(s):"0."+new Array(1-s).join("0")+(0,a.V)(t,Math.max(0,n+s-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function l(t){return t}var c=Array.prototype.map,h=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function f(t){var n,e,a=void 0===t.grouping||void 0===t.thousands?l:(n=c.call(t.grouping,Number),e=t.thousands+"",function(t,r){for(var i=t.length,o=[],a=0,s=n[0],u=0;i>0&&s>0&&(u+s+1>r&&(s=Math.max(1,r-u)),o.push(t.substring(i-=s,i+s)),!((u+=s+1)>r));)s=n[a=(a+1)%n.length];return o.reverse().join(e)}),s=void 0===t.currency?"":t.currency[0]+"",f=void 0===t.currency?"":t.currency[1]+"",p=void 0===t.decimal?".":t.decimal+"",d=void 0===t.numerals?l:function(t){return function(n){return n.replace(/[0-9]/g,(function(n){return t[+n]}))}}(c.call(t.numerals,String)),y=void 0===t.percent?"%":t.percent+"",m=void 0===t.minus?"−":t.minus+"",_=void 0===t.nan?"NaN":t.nan+"";function g(t){var n=(t=(0,o.Z)(t)).fill,e=t.align,i=t.sign,l=t.symbol,c=t.zero,g=t.width,v=t.comma,x=t.precision,w=t.trim,b=t.type;"n"===b?(v=!0,b="g"):u[b]||(void 0===x&&(x=12),w=!0,b="g"),(c||"0"===n&&"="===e)&&(c=!0,n="0",e="=");var M="$"===l?s:"#"===l&&/[boxX]/.test(b)?"0"+b.toLowerCase():"",T="$"===l?f:/[%p]/.test(b)?y:"",A=u[b],E=/[defgprs%]/.test(b);function k(t){var o,s,u,l=M,f=T;if("c"===b)f=A(t)+f,t="";else{var y=(t=+t)<0||1/t<0;if(t=isNaN(t)?_:A(Math.abs(t),x),w&&(t=function(t){t:for(var n,e=t.length,r=1,i=-1;r0&&(i=0)}return i>0?t.slice(0,i)+t.slice(n+1):t}(t)),y&&0==+t&&"+"!==i&&(y=!1),l=(y?"("===i?i:m:"-"===i||"("===i?"":i)+l,f=("s"===b?h[8+r/3]:"")+f+(y&&"("===i?")":""),E)for(o=-1,s=t.length;++o(u=t.charCodeAt(o))||u>57){f=(46===u?p+t.slice(o+1):t.slice(o))+f,t=t.slice(0,o);break}}v&&!c&&(t=a(t,1/0));var k=l.length+t.length+f.length,S=k>1)+l+t+f+S.slice(k);break;default:t=S+l+t+f}return d(t)}return x=void 0===x?6:/[gprs]/.test(b)?Math.max(1,Math.min(21,x)):Math.max(0,Math.min(20,x)),k.toString=function(){return t+""},k}return{format:g,formatPrefix:function(t,n){var e=g(((t=(0,o.Z)(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor((0,i.Z)(n)/3))),a=Math.pow(10,-r),s=h[8+r/3];return function(t){return e(a*t)+s}}}}},6909:(t,n,e)=>{"use strict";e.d(n,{Z:()=>i});var r=e(5368);function i(t){return Math.max(0,-(0,r.Z)(Math.abs(t)))}},7017:(t,n,e)=>{"use strict";e.d(n,{Z:()=>i});var r=e(5368);function i(t,n){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor((0,r.Z)(n)/3)))-(0,r.Z)(Math.abs(t)))}},3482:(t,n,e)=>{"use strict";e.d(n,{Z:()=>i});var r=e(5368);function i(t,n){return t=Math.abs(t),n=Math.abs(n)-t,Math.max(0,(0,r.Z)(n)-(0,r.Z)(t))+1}},1606:(t,n,e)=>{"use strict";e.d(n,{M:()=>a,Z:()=>o});var r=e(5326),i=e(5401);function o(t,n){return((0,i.v)(n)?i.Z:a)(t,n)}function a(t,n){var e,i=n?n.length:0,o=t?Math.min(i,t.length):0,a=new Array(o),s=new Array(i);for(e=0;e{"use strict";function r(t,n,e,r,i){var o=t*t,a=o*t;return((1-3*t+3*o-a)*n+(4-6*o+3*a)*e+(1+3*t+3*o-3*a)*r+a*i)/6}function i(t){var n=t.length-1;return function(e){var i=e<=0?e=0:e>=1?(e=1,n-1):Math.floor(e*n),o=t[i],a=t[i+1],s=i>0?t[i-1]:2*o-a,u=ii,t:()=>r})},6068:(t,n,e)=>{"use strict";e.d(n,{Z:()=>i});var r=e(7265);function i(t){var n=t.length;return function(e){var i=Math.floor(((e%=1)<0?++e:e)*n),o=t[(i+n-1)%n],a=t[i%n],s=t[(i+1)%n],u=t[(i+2)%n];return(0,r.t)((e-i/n)*n,o,a,s,u)}}},8280:(t,n,e)=>{"use strict";e.d(n,{ZP:()=>s,wx:()=>o,yi:()=>a});var r=e(2954);function i(t,n){return function(e){return t+e*n}}function o(t,n){var e=n-t;return e?i(t,e>180||e<-180?e-360*Math.round(e/360):e):(0,r.Z)(isNaN(t)?n:t)}function a(t){return 1==(t=+t)?s:function(n,e){return e-n?function(t,n,e){return t=Math.pow(t,e),n=Math.pow(n,e)-t,e=1/e,function(r){return Math.pow(t+r*n,e)}}(n,e,t):(0,r.Z)(isNaN(n)?e:n)}}function s(t,n){var e=n-t;return e?i(t,e):(0,r.Z)(isNaN(t)?n:t)}},2954:(t,n,e)=>{"use strict";e.d(n,{Z:()=>r});const r=t=>()=>t},6246:(t,n,e)=>{"use strict";function r(t,n){var e=new Date;return t=+t,n=+n,function(r){return e.setTime(t*(1-r)+n*r),e}}e.d(n,{Z:()=>r})},9928:(t,n,e)=>{"use strict";e.r(n),e.d(n,{interpolate:()=>r.Z,interpolateArray:()=>i.Z,interpolateBasis:()=>o.Z,interpolateBasisClosed:()=>a.Z,interpolateCubehelix:()=>P,interpolateCubehelixLong:()=>O,interpolateDate:()=>s.Z,interpolateDiscrete:()=>u,interpolateHcl:()=>E,interpolateHclLong:()=>k,interpolateHsl:()=>w,interpolateHslLong:()=>b,interpolateHue:()=>c,interpolateLab:()=>T,interpolateNumber:()=>h.Z,interpolateNumberArray:()=>f.Z,interpolateObject:()=>p.Z,interpolateRgb:()=>g.ZP,interpolateRgbBasis:()=>g.hD,interpolateRgbBasisClosed:()=>g.YD,interpolateRound:()=>d.Z,interpolateString:()=>y.Z,interpolateTransformCss:()=>m.Y,interpolateTransformSvg:()=>m.w,interpolateZoom:()=>_.Z,piecewise:()=>I.Z,quantize:()=>L});var r=e(5326),i=e(1606),o=e(7265),a=e(6068),s=e(6246);function u(t){var n=t.length;return function(e){return t[Math.max(0,Math.min(n-1,Math.floor(e*n)))]}}var l=e(8280);function c(t,n){var e=(0,l.wx)(+t,+n);return function(t){var n=e(t);return n-360*Math.floor(n/360)}}var h=e(8063),f=e(5401),p=e(8296),d=e(4635),y=e(6773),m=e(6556),_=e(8167),g=e(6354),v=e(4447);function x(t){return function(n,e){var r=t((n=(0,v.Ym)(n)).h,(e=(0,v.Ym)(e)).h),i=(0,l.ZP)(n.s,e.s),o=(0,l.ZP)(n.l,e.l),a=(0,l.ZP)(n.opacity,e.opacity);return function(t){return n.h=r(t),n.s=i(t),n.l=o(t),n.opacity=a(t),n+""}}}const w=x(l.wx);var b=x(l.ZP),M=e(8990);function T(t,n){var e=(0,l.ZP)((t=(0,M.ZP)(t)).l,(n=(0,M.ZP)(n)).l),r=(0,l.ZP)(t.a,n.a),i=(0,l.ZP)(t.b,n.b),o=(0,l.ZP)(t.opacity,n.opacity);return function(n){return t.l=e(n),t.a=r(n),t.b=i(n),t.opacity=o(n),t+""}}function A(t){return function(n,e){var r=t((n=(0,M.Uc)(n)).h,(e=(0,M.Uc)(e)).h),i=(0,l.ZP)(n.c,e.c),o=(0,l.ZP)(n.l,e.l),a=(0,l.ZP)(n.opacity,e.opacity);return function(t){return n.h=r(t),n.c=i(t),n.l=o(t),n.opacity=a(t),n+""}}}const E=A(l.wx);var k=A(l.ZP),S=e(5159);function N(t){return function n(e){function r(n,r){var i=t((n=(0,S.Z)(n)).h,(r=(0,S.Z)(r)).h),o=(0,l.ZP)(n.s,r.s),a=(0,l.ZP)(n.l,r.l),s=(0,l.ZP)(n.opacity,r.opacity);return function(t){return n.h=i(t),n.s=o(t),n.l=a(Math.pow(t,e)),n.opacity=s(t),n+""}}return e=+e,r.gamma=n,r}(1)}const P=N(l.wx);var O=N(l.ZP),I=e(9640);function L(t,n){for(var e=new Array(n),r=0;r{"use strict";function r(t,n){return t=+t,n=+n,function(e){return t*(1-e)+n*e}}e.d(n,{Z:()=>r})},5401:(t,n,e)=>{"use strict";function r(t,n){n||(n=[]);var e,r=t?Math.min(n.length,t.length):0,i=n.slice();return function(o){for(e=0;er,v:()=>i})},8296:(t,n,e)=>{"use strict";e.d(n,{Z:()=>i});var r=e(5326);function i(t,n){var e,i={},o={};for(e in null!==t&&"object"==typeof t||(t={}),null!==n&&"object"==typeof n||(n={}),n)e in t?i[e]=(0,r.Z)(t[e],n[e]):o[e]=n[e];return function(t){for(e in i)o[e]=i[e](t);return o}}},9640:(t,n,e)=>{"use strict";e.d(n,{Z:()=>i});var r=e(5326);function i(t,n){void 0===n&&(n=t,t=r.Z);for(var e=0,i=n.length-1,o=n[0],a=new Array(i<0?0:i);e{"use strict";e.d(n,{YD:()=>c,ZP:()=>s,hD:()=>l});var r=e(4447),i=e(7265),o=e(6068),a=e(8280);const s=function t(n){var e=(0,a.yi)(n);function i(t,n){var i=e((t=(0,r.B8)(t)).r,(n=(0,r.B8)(n)).r),o=e(t.g,n.g),s=e(t.b,n.b),u=(0,a.ZP)(t.opacity,n.opacity);return function(n){return t.r=i(n),t.g=o(n),t.b=s(n),t.opacity=u(n),t+""}}return i.gamma=t,i}(1);function u(t){return function(n){var e,i,o=n.length,a=new Array(o),s=new Array(o),u=new Array(o);for(e=0;e{"use strict";function r(t,n){return t=+t,n=+n,function(e){return Math.round(t*(1-e)+n*e)}}e.d(n,{Z:()=>r})},6773:(t,n,e)=>{"use strict";e.d(n,{Z:()=>a});var r=e(8063),i=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,o=new RegExp(i.source,"g");function a(t,n){var e,a,s,u=i.lastIndex=o.lastIndex=0,l=-1,c=[],h=[];for(t+="",n+="";(e=i.exec(t))&&(a=o.exec(n));)(s=a.index)>u&&(s=n.slice(u,s),c[l]?c[l]+=s:c[++l]=s),(e=e[0])===(a=a[0])?c[l]?c[l]+=a:c[++l]=a:(c[++l]=null,h.push({i:l,x:(0,r.Z)(e,a)})),u=o.lastIndex;return u{"use strict";e.d(n,{Y:()=>l,w:()=>c});var r,i=e(8063),o=180/Math.PI,a={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function s(t,n,e,r,i,a){var s,u,l;return(s=Math.sqrt(t*t+n*n))&&(t/=s,n/=s),(l=t*e+n*r)&&(e-=t*l,r-=n*l),(u=Math.sqrt(e*e+r*r))&&(e/=u,r/=u,l/=u),t*r180?n+=360:n-t>180&&(t+=360),a.push({i:e.push(o(e)+"rotate(",null,r)-2,x:(0,i.Z)(t,n)})):n&&e.push(o(e)+"rotate("+n+r)}(a.rotate,s.rotate,u,l),function(t,n,e,a){t!==n?a.push({i:e.push(o(e)+"skewX(",null,r)-2,x:(0,i.Z)(t,n)}):n&&e.push(o(e)+"skewX("+n+r)}(a.skewX,s.skewX,u,l),function(t,n,e,r,a,s){if(t!==e||n!==r){var u=a.push(o(a)+"scale(",null,",",null,")");s.push({i:u-4,x:(0,i.Z)(t,e)},{i:u-2,x:(0,i.Z)(n,r)})}else 1===e&&1===r||a.push(o(a)+"scale("+e+","+r+")")}(a.scaleX,a.scaleY,s.scaleX,s.scaleY,u,l),a=s=null,function(t){for(var n,e=-1,r=l.length;++e{"use strict";e.d(n,{Z:()=>f});var r=e(4447),i=e(6354),o=e(1606),a=e(6246),s=e(8063),u=e(8296),l=e(6773),c=e(2954),h=e(5401);function f(t,n){var e,f=typeof n;return null==n||"boolean"===f?(0,c.Z)(n):("number"===f?s.Z:"string"===f?(e=(0,r.ZP)(n))?(n=e,i.ZP):l.Z:n instanceof r.ZP?i.ZP:n instanceof Date?a.Z:(0,h.v)(n)?h.Z:Array.isArray(n)?o.M:"function"!=typeof n.valueOf&&"function"!=typeof n.toString||isNaN(n)?u.Z:s.Z)(t,n)}},8167:(t,n,e)=>{"use strict";function r(t){return((t=Math.exp(t))+1/t)/2}e.d(n,{Z:()=>i});const i=function t(n,e,i){function o(t,o){var a,s,u=t[0],l=t[1],c=t[2],h=o[0],f=o[1],p=o[2],d=h-u,y=f-l,m=d*d+y*y;if(m<1e-12)s=Math.log(p/c)/n,a=function(t){return[u+t*d,l+t*y,c*Math.exp(n*t*s)]};else{var _=Math.sqrt(m),g=(p*p-c*c+i*m)/(2*c*e*_),v=(p*p-c*c-i*m)/(2*p*e*_),x=Math.log(Math.sqrt(g*g+1)-g),w=Math.log(Math.sqrt(v*v+1)-v);s=(w-x)/n,a=function(t){var i,o=t*s,a=r(x),h=c/(e*_)*(a*(i=n*o+x,((i=Math.exp(2*i))-1)/(i+1))-function(t){return((t=Math.exp(t))-1/t)/2}(x));return[u+h*d,l+h*y,c*a/r(n*o+x)]}}return a.duration=1e3*s*n/Math.SQRT2,a}return o.rho=function(n){var e=Math.max(.001,+n),r=e*e;return t(e,r,r*r)},o}(Math.SQRT2,2,4)},8066:(t,n,e)=>{"use strict";function r(t,n){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(n).domain(t)}return this}function i(t,n){switch(arguments.length){case 0:break;case 1:"function"==typeof t?this.interpolator(t):this.range(t);break;default:this.domain(t),"function"==typeof n?this.interpolator(n):this.range(n)}return this}e.r(n),e.d(n,{scaleBand:()=>c,scaleDiverging:()=>Ke,scaleDivergingLog:()=>tr,scaleDivergingPow:()=>er,scaleDivergingSqrt:()=>rr,scaleDivergingSymlog:()=>nr,scaleIdentity:()=>V,scaleImplicit:()=>u,scaleLinear:()=>X,scaleLog:()=>rt,scaleOrdinal:()=>l,scalePoint:()=>f,scalePow:()=>ft,scaleQuantile:()=>bt,scaleQuantize:()=>Mt,scaleRadial:()=>yt,scaleSequential:()=>qe,scaleSequentialLog:()=>Be,scaleSequentialPow:()=>Ve,scaleSequentialQuantile:()=>Ge,scaleSequentialSqrt:()=>We,scaleSequentialSymlog:()=>Xe,scaleSqrt:()=>pt,scaleSymlog:()=>st,scaleThreshold:()=>Tt,scaleTime:()=>Fe,scaleUtc:()=>Ye,tickFormat:()=>q});class o extends Map{constructor(t,n=s){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),null!=t)for(const[n,e]of t)this.set(n,e)}get(t){return super.get(a(this,t))}has(t){return super.has(a(this,t))}set(t,n){return super.set(function({_intern:t,_key:n},e){const r=n(e);return t.has(r)?t.get(r):(t.set(r,e),e)}(this,t),n)}delete(t){return super.delete(function({_intern:t,_key:n},e){const r=n(e);return t.has(r)&&(e=t.get(r),t.delete(r)),e}(this,t))}}function a({_intern:t,_key:n},e){const r=n(e);return t.has(r)?t.get(r):e}function s(t){return null!==t&&"object"==typeof t?t.valueOf():t}const u=Symbol("implicit");function l(){var t=new o,n=[],e=[],i=u;function a(r){let o=t.get(r);if(void 0===o){if(i!==u)return i;t.set(r,o=n.push(r)-1)}return e[o%e.length]}return a.domain=function(e){if(!arguments.length)return n.slice();n=[],t=new o;for(const r of e)t.has(r)||t.set(r,n.push(r)-1);return a},a.range=function(t){return arguments.length?(e=Array.from(t),a):e.slice()},a.unknown=function(t){return arguments.length?(i=t,a):i},a.copy=function(){return l(n,e).unknown(i)},r.apply(a,arguments),a}function c(){var t,n,e=l().unknown(void 0),i=e.domain,o=e.range,a=0,s=1,u=!1,h=0,f=0,p=.5;function d(){var e=i().length,r=s=p?10:o>=d?5:o>=y?2:1;let s,u,l;return i<0?(l=Math.pow(10,-i)/a,s=Math.round(t*l),u=Math.round(n*l),s/ln&&--u,l=-l):(l=Math.pow(10,i)*a,s=Math.round(t/l),u=Math.round(n/l),s*ln&&--u),u0))return[];if((t=+t)==(n=+n))return[t];const r=n=i))return[];const s=o-i+1,u=new Array(s);if(r)if(a<0)for(let t=0;tn?1:t>=n?0:NaN}function w(t,n){return null==t||null==n?NaN:nt?1:n>=t?0:NaN}function b(t){let n,e,r;function i(t,r,i=0,o=t.length){if(i>>1;e(t[n],r)<0?i=n+1:o=n}while(ix(t(n),e),r=(n,e)=>t(n)-e):(n=t===x||t===w?t:M,e=t,r=t),{left:i,center:function(t,n,e=0,o=t.length){const a=i(t,n,e,o-1);return a>e&&r(t[a-1],n)>-r(t[a],n)?a-1:a},right:function(t,r,i=0,o=t.length){if(i>>1;e(t[n],r)<=0?i=n+1:o=n}while(in&&(e=t,t=n,n=e),l=function(e){return Math.max(t,Math.min(n,e))}),r=u>2?D:C,i=o=null,h}function h(n){return null==n||isNaN(n=+n)?e:(i||(i=r(a.map(t),s,u)))(t(l(n)))}return h.invert=function(e){return l(n((o||(o=r(s,a.map(t),N.Z)))(e)))},h.domain=function(t){return arguments.length?(a=Array.from(t,O),c()):a.slice()},h.range=function(t){return arguments.length?(s=Array.from(t),c()):s.slice()},h.rangeRound=function(t){return s=Array.from(t),u=P.Z,c()},h.clamp=function(t){return arguments.length?(l=!!t||L,c()):l!==L},h.interpolate=function(t){return arguments.length?(u=t,c()):u},h.unknown=function(t){return arguments.length?(e=t,h):e},function(e,r){return t=e,n=r,c()}}function j(){return H()(L,L)}var z=e(2035),F=e(7017),Y=e(5386),U=e(3482),R=e(6909);function q(t,n,e,r){var i,o=v(t,n,e);switch((r=(0,z.Z)(null==r?",f":r)).type){case"s":var a=Math.max(Math.abs(t),Math.abs(n));return null!=r.precision||isNaN(i=(0,F.Z)(o,a))||(r.precision=i),(0,Y.jH)(r,a);case"":case"e":case"g":case"p":case"r":null!=r.precision||isNaN(i=(0,U.Z)(o,Math.max(Math.abs(t),Math.abs(n))))||(r.precision=i-("e"===r.type));break;case"f":case"%":null!=r.precision||isNaN(i=(0,R.Z)(o))||(r.precision=i-2*("%"===r.type))}return(0,Y.WU)(r)}function B(t){var n=t.domain;return t.ticks=function(t){var e=n();return _(e[0],e[e.length-1],null==t?10:t)},t.tickFormat=function(t,e){var r=n();return q(r[0],r[r.length-1],null==t?10:t,e)},t.nice=function(e){null==e&&(e=10);var r,i,o=n(),a=0,s=o.length-1,u=o[a],l=o[s],c=10;for(l0;){if((i=g(u,l,e))===r)return o[a]=u,o[s]=l,n(o);if(i>0)u=Math.floor(u/i)*i,l=Math.ceil(l/i)*i;else{if(!(i<0))break;u=Math.ceil(u*i)/i,l=Math.floor(l*i)/i}r=i}return t},t}function X(){var t=j();return t.copy=function(){return $(t,X())},r.apply(t,arguments),B(t)}function V(t){var n;function e(t){return null==t||isNaN(t=+t)?n:t}return e.invert=e,e.domain=e.range=function(n){return arguments.length?(t=Array.from(n,O),e):t.slice()},e.unknown=function(t){return arguments.length?(n=t,e):n},e.copy=function(){return V(t).unknown(n)},t=arguments.length?Array.from(t,O):[0,1],B(e)}function W(t,n){var e,r=0,i=(t=t.slice()).length-1,o=t[r],a=t[i];return a-t(-n,e)}function et(t){const n=t(G,J),e=n.domain;let r,i,o=10;function a(){return r=function(t){return t===Math.E?Math.log:10===t&&Math.log10||2===t&&Math.log2||(t=Math.log(t),n=>Math.log(n)/t)}(o),i=function(t){return 10===t?tt:t===Math.E?Math.exp:n=>Math.pow(t,n)}(o),e()[0]<0?(r=nt(r),i=nt(i),t(Q,K)):t(G,J),n}return n.base=function(t){return arguments.length?(o=+t,a()):o},n.domain=function(t){return arguments.length?(e(t),a()):e()},n.ticks=t=>{const n=e();let a=n[0],s=n[n.length-1];const u=s0){for(;h<=f;++h)for(l=1;ls)break;d.push(c)}}else for(;h<=f;++h)for(l=o-1;l>=1;--l)if(c=h>0?l/i(-h):l*i(h),!(cs)break;d.push(c)}2*d.length{if(null==t&&(t=10),null==e&&(e=10===o?"s":","),"function"!=typeof e&&(o%1||null!=(e=(0,z.Z)(e)).precision||(e.trim=!0),e=(0,Y.WU)(e)),t===1/0)return e;const a=Math.max(1,o*t/n.ticks().length);return t=>{let n=t/i(Math.round(r(t)));return n*oe(W(e(),{floor:t=>i(Math.floor(r(t))),ceil:t=>i(Math.ceil(r(t)))})),n}function rt(){const t=et(H()).domain([1,10]);return t.copy=()=>$(t,rt()).base(t.base()),r.apply(t,arguments),t}function it(t){return function(n){return Math.sign(n)*Math.log1p(Math.abs(n/t))}}function ot(t){return function(n){return Math.sign(n)*Math.expm1(Math.abs(n))*t}}function at(t){var n=1,e=t(it(n),ot(n));return e.constant=function(e){return arguments.length?t(it(n=+e),ot(n)):n},B(e)}function st(){var t=at(H());return t.copy=function(){return $(t,st()).constant(t.constant())},r.apply(t,arguments)}function ut(t){return function(n){return n<0?-Math.pow(-n,t):Math.pow(n,t)}}function lt(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function ct(t){return t<0?-t*t:t*t}function ht(t){var n=t(L,L),e=1;return n.exponent=function(n){return arguments.length?1==(e=+n)?t(L,L):.5===e?t(lt,ct):t(ut(e),ut(1/e)):e},B(n)}function ft(){var t=ht(H());return t.copy=function(){return $(t,ft()).exponent(t.exponent())},r.apply(t,arguments),t}function pt(){return ft.apply(null,arguments).exponent(.5)}function dt(t){return Math.sign(t)*t*t}function yt(){var t,n=j(),e=[0,1],i=!1;function o(e){var r=function(t){return Math.sign(t)*Math.sqrt(Math.abs(t))}(n(e));return isNaN(r)?t:i?Math.round(r):r}return o.invert=function(t){return n.invert(dt(t))},o.domain=function(t){return arguments.length?(n.domain(t),o):n.domain()},o.range=function(t){return arguments.length?(n.range((e=Array.from(t,O)).map(dt)),o):e.slice()},o.rangeRound=function(t){return o.range(t).round(!0)},o.round=function(t){return arguments.length?(i=!!t,o):i},o.clamp=function(t){return arguments.length?(n.clamp(t),o):n.clamp()},o.unknown=function(n){return arguments.length?(t=n,o):t},o.copy=function(){return yt(n.domain(),e).round(i).clamp(n.clamp()).unknown(t)},r.apply(o,arguments),B(o)}function mt(t,n){let e;if(void 0===n)for(const n of t)null!=n&&(e=n)&&(e=n);else{let r=-1;for(let i of t)null!=(i=n(i,++r,t))&&(e=i)&&(e=i)}return e}function _t(t,n){let e;if(void 0===n)for(const n of t)null!=n&&(e>n||void 0===e&&n>=n)&&(e=n);else{let r=-1;for(let i of t)null!=(i=n(i,++r,t))&&(e>i||void 0===e&&i>=i)&&(e=i)}return e}function gt(t,n){return(null==t||!(t>=t))-(null==n||!(n>=n))||(tn?1:0)}function vt(t,n,e=0,r=1/0,i){if(n=Math.floor(n),e=Math.floor(Math.max(0,e)),r=Math.floor(Math.min(t.length-1,r)),!(e<=n&&n<=r))return t;for(i=void 0===i?gt:function(t=x){if(t===x)return gt;if("function"!=typeof t)throw new TypeError("compare is not a function");return(n,e)=>{const r=t(n,e);return r||0===r?r:(0===t(e,e))-(0===t(n,n))}}(i);r>e;){if(r-e>600){const o=r-e+1,a=n-e+1,s=Math.log(o),u=.5*Math.exp(2*s/3),l=.5*Math.sqrt(s*u*(o-u)/o)*(a-o/2<0?-1:1);vt(t,n,Math.max(e,Math.floor(n-a*u/o+l)),Math.min(r,Math.floor(n+(o-a)*u/o+l)),i)}const o=t[n];let a=e,s=r;for(xt(t,e,n),i(t[r],o)>0&&xt(t,e,r);a0;)--s}0===i(t[e],o)?xt(t,e,s):(++s,xt(t,s,r)),s<=n&&(e=s+1),n<=s&&(r=s-1)}return t}function xt(t,n,e){const r=t[n];t[n]=t[e],t[e]=r}function wt(t,n,e=T){if((r=t.length)&&!isNaN(n=+n)){if(n<=0||r<2)return+e(t[0],0,t);if(n>=1)return+e(t[r-1],r-1,t);var r,i=(r-1)*n,o=Math.floor(i),a=+e(t[o],o,t);return a+(+e(t[o+1],o+1,t)-a)*(i-o)}}function bt(){var t,n=[],e=[],i=[];function o(){var t=0,r=Math.max(1,e.length);for(i=new Array(r-1);++t0?i[r-1]:n[0],r=i?[o[i-1],e]:[o[r-1],o[r]]},s.unknown=function(n){return arguments.length?(t=n,s):s},s.thresholds=function(){return o.slice()},s.copy=function(){return Mt().domain([n,e]).range(a).unknown(t)},r.apply(B(s),arguments)}function Tt(){var t,n=[.5],e=[0,1],i=1;function o(r){return null!=r&&r<=r?e[k(n,r,0,i)]:t}return o.domain=function(t){return arguments.length?(n=Array.from(t),i=Math.min(n.length,e.length-1),o):n.slice()},o.range=function(t){return arguments.length?(e=Array.from(t),i=Math.min(n.length,e.length-1),o):e.slice()},o.invertExtent=function(t){var r=e.indexOf(t);return[n[r-1],n[r]]},o.unknown=function(n){return arguments.length?(t=n,o):t},o.copy=function(){return Tt().domain(n).range(e).unknown(t)},r.apply(o,arguments)}const At=1e3,Et=6e4,kt=36e5,St=864e5,Nt=6048e5,Pt=31536e6,Ot=new Date,It=new Date;function Lt(t,n,e,r){function i(n){return t(n=0===arguments.length?new Date:new Date(+n)),n}return i.floor=n=>(t(n=new Date(+n)),n),i.ceil=e=>(t(e=new Date(e-1)),n(e,1),t(e),e),i.round=t=>{const n=i(t),e=i.ceil(t);return t-n(n(t=new Date(+t),null==e?1:Math.floor(e)),t),i.range=(e,r,o)=>{const a=[];if(e=i.ceil(e),o=null==o?1:Math.floor(o),!(e0))return a;let s;do{a.push(s=new Date(+e)),n(e,o),t(e)}while(sLt((n=>{if(n>=n)for(;t(n),!e(n);)n.setTime(n-1)}),((t,r)=>{if(t>=t)if(r<0)for(;++r<=0;)for(;n(t,-1),!e(t););else for(;--r>=0;)for(;n(t,1),!e(t););})),e&&(i.count=(n,r)=>(Ot.setTime(+n),It.setTime(+r),t(Ot),t(It),Math.floor(e(Ot,It))),i.every=t=>(t=Math.floor(t),isFinite(t)&&t>0?t>1?i.filter(r?n=>r(n)%t==0:n=>i.count(0,n)%t==0):i:null)),i}const Zt=Lt((()=>{}),((t,n)=>{t.setTime(+t+n)}),((t,n)=>n-t));Zt.every=t=>(t=Math.floor(t),isFinite(t)&&t>0?t>1?Lt((n=>{n.setTime(Math.floor(n/t)*t)}),((n,e)=>{n.setTime(+n+e*t)}),((n,e)=>(e-n)/t)):Zt:null),Zt.range;const Ct=Lt((t=>{t.setTime(t-t.getMilliseconds())}),((t,n)=>{t.setTime(+t+n*At)}),((t,n)=>(n-t)/At),(t=>t.getUTCSeconds())),Dt=(Ct.range,Lt((t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*At)}),((t,n)=>{t.setTime(+t+n*Et)}),((t,n)=>(n-t)/Et),(t=>t.getMinutes()))),$t=(Dt.range,Lt((t=>{t.setUTCSeconds(0,0)}),((t,n)=>{t.setTime(+t+n*Et)}),((t,n)=>(n-t)/Et),(t=>t.getUTCMinutes()))),Ht=($t.range,Lt((t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*At-t.getMinutes()*Et)}),((t,n)=>{t.setTime(+t+n*kt)}),((t,n)=>(n-t)/kt),(t=>t.getHours()))),jt=(Ht.range,Lt((t=>{t.setUTCMinutes(0,0,0)}),((t,n)=>{t.setTime(+t+n*kt)}),((t,n)=>(n-t)/kt),(t=>t.getUTCHours()))),zt=(jt.range,Lt((t=>t.setHours(0,0,0,0)),((t,n)=>t.setDate(t.getDate()+n)),((t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*Et)/St),(t=>t.getDate()-1))),Ft=(zt.range,Lt((t=>{t.setUTCHours(0,0,0,0)}),((t,n)=>{t.setUTCDate(t.getUTCDate()+n)}),((t,n)=>(n-t)/St),(t=>t.getUTCDate()-1))),Yt=(Ft.range,Lt((t=>{t.setUTCHours(0,0,0,0)}),((t,n)=>{t.setUTCDate(t.getUTCDate()+n)}),((t,n)=>(n-t)/St),(t=>Math.floor(t/St))));function Ut(t){return Lt((n=>{n.setDate(n.getDate()-(n.getDay()+7-t)%7),n.setHours(0,0,0,0)}),((t,n)=>{t.setDate(t.getDate()+7*n)}),((t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*Et)/Nt))}Yt.range;const Rt=Ut(0),qt=Ut(1),Bt=Ut(2),Xt=Ut(3),Vt=Ut(4),Wt=Ut(5),Gt=Ut(6);function Jt(t){return Lt((n=>{n.setUTCDate(n.getUTCDate()-(n.getUTCDay()+7-t)%7),n.setUTCHours(0,0,0,0)}),((t,n)=>{t.setUTCDate(t.getUTCDate()+7*n)}),((t,n)=>(n-t)/Nt))}Rt.range,qt.range,Bt.range,Xt.range,Vt.range,Wt.range,Gt.range;const Qt=Jt(0),Kt=Jt(1),tn=Jt(2),nn=Jt(3),en=Jt(4),rn=Jt(5),on=Jt(6),an=(Qt.range,Kt.range,tn.range,nn.range,en.range,rn.range,on.range,Lt((t=>{t.setDate(1),t.setHours(0,0,0,0)}),((t,n)=>{t.setMonth(t.getMonth()+n)}),((t,n)=>n.getMonth()-t.getMonth()+12*(n.getFullYear()-t.getFullYear())),(t=>t.getMonth()))),sn=(an.range,Lt((t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)}),((t,n)=>{t.setUTCMonth(t.getUTCMonth()+n)}),((t,n)=>n.getUTCMonth()-t.getUTCMonth()+12*(n.getUTCFullYear()-t.getUTCFullYear())),(t=>t.getUTCMonth()))),un=(sn.range,Lt((t=>{t.setMonth(0,1),t.setHours(0,0,0,0)}),((t,n)=>{t.setFullYear(t.getFullYear()+n)}),((t,n)=>n.getFullYear()-t.getFullYear()),(t=>t.getFullYear())));un.every=t=>isFinite(t=Math.floor(t))&&t>0?Lt((n=>{n.setFullYear(Math.floor(n.getFullYear()/t)*t),n.setMonth(0,1),n.setHours(0,0,0,0)}),((n,e)=>{n.setFullYear(n.getFullYear()+e*t)})):null,un.range;const ln=Lt((t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),((t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n)}),((t,n)=>n.getUTCFullYear()-t.getUTCFullYear()),(t=>t.getUTCFullYear()));function cn(t,n,e,r,i,o){const a=[[Ct,1,At],[Ct,5,5e3],[Ct,15,15e3],[Ct,30,3e4],[o,1,Et],[o,5,3e5],[o,15,9e5],[o,30,18e5],[i,1,kt],[i,3,108e5],[i,6,216e5],[i,12,432e5],[r,1,St],[r,2,1728e5],[e,1,Nt],[n,1,2592e6],[n,3,7776e6],[t,1,Pt]];function s(n,e,r){const i=Math.abs(e-n)/r,o=b((([,,t])=>t)).right(a,i);if(o===a.length)return t.every(v(n/Pt,e/Pt,r));if(0===o)return Zt.every(Math.max(v(n,e,r),1));const[s,u]=a[i/a[o-1][2]isFinite(t=Math.floor(t))&&t>0?Lt((n=>{n.setUTCFullYear(Math.floor(n.getUTCFullYear()/t)*t),n.setUTCMonth(0,1),n.setUTCHours(0,0,0,0)}),((n,e)=>{n.setUTCFullYear(n.getUTCFullYear()+e*t)})):null,ln.range;const[hn,fn]=cn(ln,sn,Qt,Yt,jt,$t),[pn,dn]=cn(un,an,Rt,zt,Ht,Dt);function yn(t){if(0<=t.y&&t.y<100){var n=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return n.setFullYear(t.y),n}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function mn(t){if(0<=t.y&&t.y<100){var n=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return n.setUTCFullYear(t.y),n}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function _n(t,n,e){return{y:t,m:n,d:e,H:0,M:0,S:0,L:0}}var gn,vn,xn,wn={"-":"",_:" ",0:"0"},bn=/^\s*\d+/,Mn=/^%/,Tn=/[\\^$*+?|[\]().{}]/g;function An(t,n,e){var r=t<0?"-":"",i=(r?-t:t)+"",o=i.length;return r+(o[t.toLowerCase(),n])))}function Nn(t,n,e){var r=bn.exec(n.slice(e,e+1));return r?(t.w=+r[0],e+r[0].length):-1}function Pn(t,n,e){var r=bn.exec(n.slice(e,e+1));return r?(t.u=+r[0],e+r[0].length):-1}function On(t,n,e){var r=bn.exec(n.slice(e,e+2));return r?(t.U=+r[0],e+r[0].length):-1}function In(t,n,e){var r=bn.exec(n.slice(e,e+2));return r?(t.V=+r[0],e+r[0].length):-1}function Ln(t,n,e){var r=bn.exec(n.slice(e,e+2));return r?(t.W=+r[0],e+r[0].length):-1}function Zn(t,n,e){var r=bn.exec(n.slice(e,e+4));return r?(t.y=+r[0],e+r[0].length):-1}function Cn(t,n,e){var r=bn.exec(n.slice(e,e+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),e+r[0].length):-1}function Dn(t,n,e){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(n.slice(e,e+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),e+r[0].length):-1}function $n(t,n,e){var r=bn.exec(n.slice(e,e+1));return r?(t.q=3*r[0]-3,e+r[0].length):-1}function Hn(t,n,e){var r=bn.exec(n.slice(e,e+2));return r?(t.m=r[0]-1,e+r[0].length):-1}function jn(t,n,e){var r=bn.exec(n.slice(e,e+2));return r?(t.d=+r[0],e+r[0].length):-1}function zn(t,n,e){var r=bn.exec(n.slice(e,e+3));return r?(t.m=0,t.d=+r[0],e+r[0].length):-1}function Fn(t,n,e){var r=bn.exec(n.slice(e,e+2));return r?(t.H=+r[0],e+r[0].length):-1}function Yn(t,n,e){var r=bn.exec(n.slice(e,e+2));return r?(t.M=+r[0],e+r[0].length):-1}function Un(t,n,e){var r=bn.exec(n.slice(e,e+2));return r?(t.S=+r[0],e+r[0].length):-1}function Rn(t,n,e){var r=bn.exec(n.slice(e,e+3));return r?(t.L=+r[0],e+r[0].length):-1}function qn(t,n,e){var r=bn.exec(n.slice(e,e+6));return r?(t.L=Math.floor(r[0]/1e3),e+r[0].length):-1}function Bn(t,n,e){var r=Mn.exec(n.slice(e,e+1));return r?e+r[0].length:-1}function Xn(t,n,e){var r=bn.exec(n.slice(e));return r?(t.Q=+r[0],e+r[0].length):-1}function Vn(t,n,e){var r=bn.exec(n.slice(e));return r?(t.s=+r[0],e+r[0].length):-1}function Wn(t,n){return An(t.getDate(),n,2)}function Gn(t,n){return An(t.getHours(),n,2)}function Jn(t,n){return An(t.getHours()%12||12,n,2)}function Qn(t,n){return An(1+zt.count(un(t),t),n,3)}function Kn(t,n){return An(t.getMilliseconds(),n,3)}function te(t,n){return Kn(t,n)+"000"}function ne(t,n){return An(t.getMonth()+1,n,2)}function ee(t,n){return An(t.getMinutes(),n,2)}function re(t,n){return An(t.getSeconds(),n,2)}function ie(t){var n=t.getDay();return 0===n?7:n}function oe(t,n){return An(Rt.count(un(t)-1,t),n,2)}function ae(t){var n=t.getDay();return n>=4||0===n?Vt(t):Vt.ceil(t)}function se(t,n){return t=ae(t),An(Vt.count(un(t),t)+(4===un(t).getDay()),n,2)}function ue(t){return t.getDay()}function le(t,n){return An(qt.count(un(t)-1,t),n,2)}function ce(t,n){return An(t.getFullYear()%100,n,2)}function he(t,n){return An((t=ae(t)).getFullYear()%100,n,2)}function fe(t,n){return An(t.getFullYear()%1e4,n,4)}function pe(t,n){var e=t.getDay();return An((t=e>=4||0===e?Vt(t):Vt.ceil(t)).getFullYear()%1e4,n,4)}function de(t){var n=t.getTimezoneOffset();return(n>0?"-":(n*=-1,"+"))+An(n/60|0,"0",2)+An(n%60,"0",2)}function ye(t,n){return An(t.getUTCDate(),n,2)}function me(t,n){return An(t.getUTCHours(),n,2)}function _e(t,n){return An(t.getUTCHours()%12||12,n,2)}function ge(t,n){return An(1+Ft.count(ln(t),t),n,3)}function ve(t,n){return An(t.getUTCMilliseconds(),n,3)}function xe(t,n){return ve(t,n)+"000"}function we(t,n){return An(t.getUTCMonth()+1,n,2)}function be(t,n){return An(t.getUTCMinutes(),n,2)}function Me(t,n){return An(t.getUTCSeconds(),n,2)}function Te(t){var n=t.getUTCDay();return 0===n?7:n}function Ae(t,n){return An(Qt.count(ln(t)-1,t),n,2)}function Ee(t){var n=t.getUTCDay();return n>=4||0===n?en(t):en.ceil(t)}function ke(t,n){return t=Ee(t),An(en.count(ln(t),t)+(4===ln(t).getUTCDay()),n,2)}function Se(t){return t.getUTCDay()}function Ne(t,n){return An(Kt.count(ln(t)-1,t),n,2)}function Pe(t,n){return An(t.getUTCFullYear()%100,n,2)}function Oe(t,n){return An((t=Ee(t)).getUTCFullYear()%100,n,2)}function Ie(t,n){return An(t.getUTCFullYear()%1e4,n,4)}function Le(t,n){var e=t.getUTCDay();return An((t=e>=4||0===e?en(t):en.ceil(t)).getUTCFullYear()%1e4,n,4)}function Ze(){return"+0000"}function Ce(){return"%"}function De(t){return+t}function $e(t){return Math.floor(+t/1e3)}function He(t){return new Date(t)}function je(t){return t instanceof Date?+t:+new Date(+t)}function ze(t,n,e,r,i,o,a,s,u,l){var c=j(),h=c.invert,f=c.domain,p=l(".%L"),d=l(":%S"),y=l("%I:%M"),m=l("%I %p"),_=l("%a %d"),g=l("%b %d"),v=l("%B"),x=l("%Y");function w(t){return(u(t)n(r/(t.length-1))))},e.quantiles=function(n){return Array.from({length:n+1},((e,r)=>function(t,n,e){if(t=Float64Array.from(function*(t,n){if(void 0===n)for(let n of t)null!=n&&(n=+n)>=n&&(yield n);else{let e=-1;for(let r of t)null!=(r=n(r,++e,t))&&(r=+r)>=r&&(yield r)}}(t,e)),(r=t.length)&&!isNaN(n=+n)){if(n<=0||r<2)return _t(t);if(n>=1)return mt(t);var r,i=(r-1)*n,o=Math.floor(i),a=mt(vt(t,o).subarray(0,o+1));return a+(_t(t.subarray(o+1))-a)*(i-o)}}(t,r/n)))},e.copy=function(){return Ge(n).domain(t)},i.apply(e,arguments)}gn=function(t){var n=t.dateTime,e=t.date,r=t.time,i=t.periods,o=t.days,a=t.shortDays,s=t.months,u=t.shortMonths,l=kn(i),c=Sn(i),h=kn(o),f=Sn(o),p=kn(a),d=Sn(a),y=kn(s),m=Sn(s),_=kn(u),g=Sn(u),v={a:function(t){return a[t.getDay()]},A:function(t){return o[t.getDay()]},b:function(t){return u[t.getMonth()]},B:function(t){return s[t.getMonth()]},c:null,d:Wn,e:Wn,f:te,g:he,G:pe,H:Gn,I:Jn,j:Qn,L:Kn,m:ne,M:ee,p:function(t){return i[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:De,s:$e,S:re,u:ie,U:oe,V:se,w:ue,W:le,x:null,X:null,y:ce,Y:fe,Z:de,"%":Ce},x={a:function(t){return a[t.getUTCDay()]},A:function(t){return o[t.getUTCDay()]},b:function(t){return u[t.getUTCMonth()]},B:function(t){return s[t.getUTCMonth()]},c:null,d:ye,e:ye,f:xe,g:Oe,G:Le,H:me,I:_e,j:ge,L:ve,m:we,M:be,p:function(t){return i[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:De,s:$e,S:Me,u:Te,U:Ae,V:ke,w:Se,W:Ne,x:null,X:null,y:Pe,Y:Ie,Z:Ze,"%":Ce},w={a:function(t,n,e){var r=p.exec(n.slice(e));return r?(t.w=d.get(r[0].toLowerCase()),e+r[0].length):-1},A:function(t,n,e){var r=h.exec(n.slice(e));return r?(t.w=f.get(r[0].toLowerCase()),e+r[0].length):-1},b:function(t,n,e){var r=_.exec(n.slice(e));return r?(t.m=g.get(r[0].toLowerCase()),e+r[0].length):-1},B:function(t,n,e){var r=y.exec(n.slice(e));return r?(t.m=m.get(r[0].toLowerCase()),e+r[0].length):-1},c:function(t,e,r){return T(t,n,e,r)},d:jn,e:jn,f:qn,g:Cn,G:Zn,H:Fn,I:Fn,j:zn,L:Rn,m:Hn,M:Yn,p:function(t,n,e){var r=l.exec(n.slice(e));return r?(t.p=c.get(r[0].toLowerCase()),e+r[0].length):-1},q:$n,Q:Xn,s:Vn,S:Un,u:Pn,U:On,V:In,w:Nn,W:Ln,x:function(t,n,r){return T(t,e,n,r)},X:function(t,n,e){return T(t,r,n,e)},y:Cn,Y:Zn,Z:Dn,"%":Bn};function b(t,n){return function(e){var r,i,o,a=[],s=-1,u=0,l=t.length;for(e instanceof Date||(e=new Date(+e));++s53)return null;"w"in o||(o.w=1),"Z"in o?(i=(r=mn(_n(o.y,0,1))).getUTCDay(),r=i>4||0===i?Kt.ceil(r):Kt(r),r=Ft.offset(r,7*(o.V-1)),o.y=r.getUTCFullYear(),o.m=r.getUTCMonth(),o.d=r.getUTCDate()+(o.w+6)%7):(i=(r=yn(_n(o.y,0,1))).getDay(),r=i>4||0===i?qt.ceil(r):qt(r),r=zt.offset(r,7*(o.V-1)),o.y=r.getFullYear(),o.m=r.getMonth(),o.d=r.getDate()+(o.w+6)%7)}else("W"in o||"U"in o)&&("w"in o||(o.w="u"in o?o.u%7:"W"in o?1:0),i="Z"in o?mn(_n(o.y,0,1)).getUTCDay():yn(_n(o.y,0,1)).getDay(),o.m=0,o.d="W"in o?(o.w+6)%7+7*o.W-(i+5)%7:o.w+7*o.U-(i+6)%7);return"Z"in o?(o.H+=o.Z/100|0,o.M+=o.Z%100,mn(o)):yn(o)}}function T(t,n,e,r){for(var i,o,a=0,s=n.length,u=e.length;a=u)return-1;if(37===(i=n.charCodeAt(a++))){if(i=n.charAt(a++),!(o=w[i in wn?n.charAt(a++):i])||(r=o(t,e,r))<0)return-1}else if(i!=e.charCodeAt(r++))return-1}return r}return v.x=b(e,v),v.X=b(r,v),v.c=b(n,v),x.x=b(e,x),x.X=b(r,x),x.c=b(n,x),{format:function(t){var n=b(t+="",v);return n.toString=function(){return t},n},parse:function(t){var n=M(t+="",!1);return n.toString=function(){return t},n},utcFormat:function(t){var n=b(t+="",x);return n.toString=function(){return t},n},utcParse:function(t){var n=M(t+="",!0);return n.toString=function(){return t},n}}}({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}),vn=gn.format,gn.parse,xn=gn.utcFormat,gn.utcParse;var Je=e(9640);function Qe(){var t,n,e,r,i,o,a,s=0,u=.5,l=1,c=1,h=L,f=!1;function p(t){return isNaN(t=+t)?a:(t=.5+((t=+o(t))-n)*(c*t{"use strict";function r(t){return null==t?[]:Array.isArray(t)?t:Array.from(t)}e.d(n,{Z:()=>r})},4708:(t,n,e)=>{"use strict";e.d(n,{Z:()=>s});var r=e(1663),i=e(1226);function o(t){return function(){var n=this.ownerDocument,e=this.namespaceURI;return e===i.P&&n.documentElement.namespaceURI===i.P?n.createElement(t):n.createElementNS(e,t)}}function a(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function s(t){var n=(0,r.Z)(t);return(n.local?a:o)(n)}},3905:(t,n,e)=>{"use strict";e.r(n),e.d(n,{create:()=>o,creator:()=>r.Z,local:()=>s,matcher:()=>l.Z,namespace:()=>c.Z,namespaces:()=>h.Z,pointer:()=>f.Z,pointers:()=>d,select:()=>i.Z,selectAll:()=>_,selection:()=>m.ZP,selector:()=>g.Z,selectorAll:()=>v.Z,style:()=>x.S,window:()=>w.Z});var r=e(4708),i=e(3838);function o(t){return(0,i.Z)((0,r.Z)(t).call(document.documentElement))}var a=0;function s(){return new u}function u(){this._="@"+(++a).toString(36)}u.prototype=s.prototype={constructor:u,get:function(t){for(var n=this._;!(n in t);)if(!(t=t.parentNode))return;return t[n]},set:function(t,n){return t[this._]=n},remove:function(t){return this._ in t&&delete t[this._]},toString:function(){return this._}};var l=e(4421),c=e(1663),h=e(1226),f=e(3109),p=e(9439);function d(t,n){return t.target&&(t=(0,p.Z)(t),void 0===n&&(n=t.currentTarget),t=t.touches||[t]),Array.from(t,(t=>(0,f.Z)(t,n)))}var y=e(9898),m=e(6740);function _(t){return"string"==typeof t?new m.Y1([document.querySelectorAll(t)],[document.documentElement]):new m.Y1([(0,y.Z)(t)],m.Jz)}var g=e(3010),v=e(9701),x=e(2627),w=e(9920)},4421:(t,n,e)=>{"use strict";function r(t){return function(){return this.matches(t)}}function i(t){return function(n){return n.matches(t)}}e.d(n,{P:()=>i,Z:()=>r})},1663:(t,n,e)=>{"use strict";e.d(n,{Z:()=>i});var r=e(1226);function i(t){var n=t+="",e=n.indexOf(":");return e>=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),r.Z.hasOwnProperty(n)?{space:r.Z[n],local:t}:t}},1226:(t,n,e)=>{"use strict";e.d(n,{P:()=>r,Z:()=>i});var r="http://www.w3.org/1999/xhtml";const i={svg:"http://www.w3.org/2000/svg",xhtml:r,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"}},3109:(t,n,e)=>{"use strict";e.d(n,{Z:()=>i});var r=e(9439);function i(t,n){if(t=(0,r.Z)(t),void 0===n&&(n=t.currentTarget),n){var e=n.ownerSVGElement||n;if(e.createSVGPoint){var i=e.createSVGPoint();return i.x=t.clientX,i.y=t.clientY,[(i=i.matrixTransform(n.getScreenCTM().inverse())).x,i.y]}if(n.getBoundingClientRect){var o=n.getBoundingClientRect();return[t.clientX-o.left-n.clientLeft,t.clientY-o.top-n.clientTop]}}return[t.pageX,t.pageY]}},3838:(t,n,e)=>{"use strict";e.d(n,{Z:()=>i});var r=e(6740);function i(t){return"string"==typeof t?new r.Y1([[document.querySelector(t)]],[document.documentElement]):new r.Y1([[t]],r.Jz)}},6740:(t,n,e)=>{"use strict";e.d(n,{Y1:()=>rt,ZP:()=>ot,Jz:()=>et});var r=e(3010),i=e(9898),o=e(9701),a=e(4421),s=Array.prototype.find;function u(){return this.firstElementChild}var l=Array.prototype.filter;function c(){return Array.from(this.children)}function h(t){return new Array(t.length)}function f(t,n){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=n}function p(t,n,e,r,i,o){for(var a,s=0,u=n.length,l=o.length;sn?1:t>=n?0:NaN}f.prototype={constructor:f,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,n){return this._parent.insertBefore(t,n)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};var g=e(1663);function v(t){return function(){this.removeAttribute(t)}}function x(t){return function(){this.removeAttributeNS(t.space,t.local)}}function w(t,n){return function(){this.setAttribute(t,n)}}function b(t,n){return function(){this.setAttributeNS(t.space,t.local,n)}}function M(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttribute(t):this.setAttribute(t,e)}}function T(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,e)}}var A=e(2627);function E(t){return function(){delete this[t]}}function k(t,n){return function(){this[t]=n}}function S(t,n){return function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}}function N(t){return t.trim().split(/^|\s+/)}function P(t){return t.classList||new O(t)}function O(t){this._node=t,this._names=N(t.getAttribute("class")||"")}function I(t,n){for(var e=P(t),r=-1,i=n.length;++r=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var q=e(4708);function B(){return null}function X(){var t=this.parentNode;t&&t.removeChild(this)}function V(){var t=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(t,this.nextSibling):t}function W(){var t=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(t,this.nextSibling):t}function G(t){return function(){var n=this.__on;if(n){for(var e,r=0,i=-1,o=n.length;r=A&&(A=T+1);!(M=w[A])&&++A=0;)(r=i[o])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(t){function n(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}t||(t=_);for(var e=this._groups,r=e.length,i=new Array(r),o=0;o1?this.each((null==n?E:"function"==typeof n?S:k)(t,n)):this.node()[t]},classed:function(t,n){var e=N(t+"");if(arguments.length<2){for(var r=P(this.node()),i=-1,o=e.length;++i=0&&(n=t.slice(e+1),t=t.slice(0,e)),{type:t,name:n}}))}(t+""),a=o.length;if(!(arguments.length<2)){for(s=n?J:G,r=0;r{"use strict";e.d(n,{S:()=>u,Z:()=>s});var r=e(9920);function i(t){return function(){this.style.removeProperty(t)}}function o(t,n,e){return function(){this.style.setProperty(t,n,e)}}function a(t,n,e){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}}function s(t,n,e){return arguments.length>1?this.each((null==n?i:"function"==typeof n?a:o)(t,n,null==e?"":e)):u(this.node(),t)}function u(t,n){return t.style.getPropertyValue(n)||(0,r.Z)(t).getComputedStyle(t,null).getPropertyValue(n)}},3010:(t,n,e)=>{"use strict";function r(){}function i(t){return null==t?r:function(){return this.querySelector(t)}}e.d(n,{Z:()=>i})},9701:(t,n,e)=>{"use strict";function r(){return[]}function i(t){return null==t?r:function(){return this.querySelectorAll(t)}}e.d(n,{Z:()=>i})},9439:(t,n,e)=>{"use strict";function r(t){let n;for(;n=t.sourceEvent;)t=n;return t}e.d(n,{Z:()=>r})},9920:(t,n,e)=>{"use strict";function r(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}e.d(n,{Z:()=>r})},6660:(t,n,e)=>{"use strict";function r(t){return function(){return t}}e.r(n),e.d(n,{arc:()=>N,area:()=>$,areaRadial:()=>B,curveBasis:()=>Dt,curveBasisClosed:()=>Ht,curveBasisOpen:()=>zt,curveBumpX:()=>G,curveBumpY:()=>J,curveBundle:()=>Yt,curveCardinal:()=>qt,curveCardinalClosed:()=>Xt,curveCardinalOpen:()=>Wt,curveCatmullRom:()=>Qt,curveCatmullRomClosed:()=>tn,curveCatmullRomOpen:()=>en,curveLinear:()=>L,curveLinearClosed:()=>on,curveMonotoneX:()=>pn,curveMonotoneY:()=>dn,curveNatural:()=>_n,curveStep:()=>vn,curveStepAfter:()=>wn,curveStepBefore:()=>xn,line:()=>D,lineRadial:()=>q,link:()=>nt,linkHorizontal:()=>et,linkRadial:()=>it,linkVertical:()=>rt,pie:()=>z,pointRadial:()=>X,radialArea:()=>B,radialLine:()=>q,stack:()=>En,stackOffsetDiverging:()=>Sn,stackOffsetExpand:()=>kn,stackOffsetNone:()=>bn,stackOffsetSilhouette:()=>Nn,stackOffsetWiggle:()=>Pn,stackOrderAppearance:()=>On,stackOrderAscending:()=>Ln,stackOrderDescending:()=>Cn,stackOrderInsideOut:()=>Dn,stackOrderNone:()=>Mn,stackOrderReverse:()=>$n,symbol:()=>It,symbolAsterisk:()=>at,symbolCircle:()=>st,symbolCross:()=>ut,symbolDiamond:()=>ht,symbolDiamond2:()=>ft,symbolPlus:()=>pt,symbolSquare:()=>dt,symbolSquare2:()=>yt,symbolStar:()=>vt,symbolTimes:()=>Nt,symbolTriangle:()=>wt,symbolTriangle2:()=>Mt,symbolWye:()=>St,symbolX:()=>Nt,symbols:()=>Pt,symbolsFill:()=>Pt,symbolsStroke:()=>Ot});const i=Math.abs,o=Math.atan2,a=Math.cos,s=Math.max,u=Math.min,l=Math.sin,c=Math.sqrt,h=1e-12,f=Math.PI,p=f/2,d=2*f;function y(t){return t>=1?p:t<=-1?-p:Math.asin(t)}const m=Math.PI,_=2*m,g=1e-6,v=_-g;function x(t){this._+=t[0];for(let n=1,e=t.length;n=0))throw new Error(`invalid digits: ${t}`);if(n>15)return x;const e=10**n;return function(t){this._+=t[0];for(let n=1,r=t.length;ng)if(Math.abs(c*s-u*l)>g&&i){let f=e-o,p=r-a,d=s*s+u*u,y=f*f+p*p,_=Math.sqrt(d),v=Math.sqrt(h),x=i*Math.tan((m-Math.acos((d+h-y)/(2*_*v)))/2),w=x/v,b=x/_;Math.abs(w-1)>g&&this._append`L${t+w*l},${n+w*c}`,this._append`A${i},${i},0,0,${+(c*f>l*p)},${this._x1=t+b*s},${this._y1=n+b*u}`}else this._append`L${this._x1=t},${this._y1=n}`}arc(t,n,e,r,i,o){if(t=+t,n=+n,o=!!o,(e=+e)<0)throw new Error(`negative radius: ${e}`);let a=e*Math.cos(r),s=e*Math.sin(r),u=t+a,l=n+s,c=1^o,h=o?r-i:i-r;null===this._x1?this._append`M${u},${l}`:(Math.abs(this._x1-u)>g||Math.abs(this._y1-l)>g)&&this._append`L${u},${l}`,e&&(h<0&&(h=h%_+_),h>v?this._append`A${e},${e},0,1,${c},${t-a},${n-s}A${e},${e},0,1,${c},${this._x1=u},${this._y1=l}`:h>g&&this._append`A${e},${e},0,${+(h>=m)},${c},${this._x1=t+e*Math.cos(i)},${this._y1=n+e*Math.sin(i)}`)}rect(t,n,e,r){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${e=+e}v${+r}h${-e}Z`}toString(){return this._}}function b(t){let n=3;return t.digits=function(e){if(!arguments.length)return n;if(null==e)n=null;else{const t=Math.floor(e);if(!(t>=0))throw new RangeError(`invalid digits: ${e}`);n=t}return t},()=>new w(n)}function M(t){return t.innerRadius}function T(t){return t.outerRadius}function A(t){return t.startAngle}function E(t){return t.endAngle}function k(t){return t&&t.padAngle}function S(t,n,e,r,i,o,a){var u=t-e,l=n-r,h=(a?o:-o)/c(u*u+l*l),f=h*l,p=-h*u,d=t+f,y=n+p,m=e+f,_=r+p,g=(d+m)/2,v=(y+_)/2,x=m-d,w=_-y,b=x*x+w*w,M=i-o,T=d*_-m*y,A=(w<0?-1:1)*c(s(0,M*M*b-T*T)),E=(T*w-x*A)/b,k=(-T*x-w*A)/b,S=(T*w+x*A)/b,N=(-T*x+w*A)/b,P=E-g,O=k-v,I=S-g,L=N-v;return P*P+O*O>I*I+L*L&&(E=S,k=N),{cx:E,cy:k,x01:-f,y01:-p,x11:E*(i/M-1),y11:k*(i/M-1)}}function N(){var t=M,n=T,e=r(0),s=null,m=A,_=E,g=k,v=null,x=b(w);function w(){var r,w,b,M=+t.apply(this,arguments),T=+n.apply(this,arguments),A=m.apply(this,arguments)-p,E=_.apply(this,arguments)-p,k=i(E-A),N=E>A;if(v||(v=r=x()),Th)if(k>d-h)v.moveTo(T*a(A),T*l(A)),v.arc(0,0,T,A,E,!N),M>h&&(v.moveTo(M*a(E),M*l(E)),v.arc(0,0,M,E,A,N));else{var P,O,I=A,L=E,Z=A,C=E,D=k,$=k,H=g.apply(this,arguments)/2,j=H>h&&(s?+s.apply(this,arguments):c(M*M+T*T)),z=u(i(T-M)/2,+e.apply(this,arguments)),F=z,Y=z;if(j>h){var U=y(j/M*l(H)),R=y(j/T*l(H));(D-=2*U)>h?(Z+=U*=N?1:-1,C-=U):(D=0,Z=C=(A+E)/2),($-=2*R)>h?(I+=R*=N?1:-1,L-=R):($=0,I=L=(A+E)/2)}var q=T*a(I),B=T*l(I),X=M*a(C),V=M*l(C);if(z>h){var W,G=T*a(L),J=T*l(L),Q=M*a(Z),K=M*l(Z);if(k1?0:b<-1?f:Math.acos(b))/2),ot=c(W[0]*W[0]+W[1]*W[1]);F=u(z,(M-ot)/(it-1)),Y=u(z,(T-ot)/(it+1))}else F=Y=0}$>h?Y>h?(P=S(Q,K,q,B,T,Y,N),O=S(G,J,X,V,T,Y,N),v.moveTo(P.cx+P.x01,P.cy+P.y01),Yh&&D>h?F>h?(P=S(X,V,G,J,M,-F,N),O=S(q,B,Q,K,M,-F,N),v.lineTo(P.cx+P.x01,P.cy+P.y01),F=h;--f)u.point(_[f],g[f]);u.lineEnd(),u.areaEnd()}m&&(_[c]=+t(p,c,r),g[c]=+n(p,c,r),u.point(i?+i(p,c,r):_[c],e?+e(p,c,r):g[c]))}if(d)return u=null,d+""||null}function h(){return D().defined(o).curve(s).context(a)}return t="function"==typeof t?t:void 0===t?Z:r(+t),n="function"==typeof n?n:r(void 0===n?0:+n),e="function"==typeof e?e:void 0===e?C:r(+e),c.x=function(n){return arguments.length?(t="function"==typeof n?n:r(+n),i=null,c):t},c.x0=function(n){return arguments.length?(t="function"==typeof n?n:r(+n),c):t},c.x1=function(t){return arguments.length?(i=null==t?null:"function"==typeof t?t:r(+t),c):i},c.y=function(t){return arguments.length?(n="function"==typeof t?t:r(+t),e=null,c):n},c.y0=function(t){return arguments.length?(n="function"==typeof t?t:r(+t),c):n},c.y1=function(t){return arguments.length?(e=null==t?null:"function"==typeof t?t:r(+t),c):e},c.lineX0=c.lineY0=function(){return h().x(t).y(n)},c.lineY1=function(){return h().x(t).y(e)},c.lineX1=function(){return h().x(i).y(n)},c.defined=function(t){return arguments.length?(o="function"==typeof t?t:r(!!t),c):o},c.curve=function(t){return arguments.length?(s=t,null!=a&&(u=s(a)),c):s},c.context=function(t){return arguments.length?(null==t?a=u=null:u=s(a=t),c):a},c}function H(t,n){return nt?1:n>=t?0:NaN}function j(t){return t}function z(){var t=j,n=H,e=null,i=r(0),o=r(d),a=r(0);function s(r){var s,u,l,c,h,f=(r=O(r)).length,p=0,y=new Array(f),m=new Array(f),_=+i.apply(this,arguments),g=Math.min(d,Math.max(-d,o.apply(this,arguments)-_)),v=Math.min(Math.abs(g)/f,a.apply(this,arguments)),x=v*(g<0?-1:1);for(s=0;s0&&(p+=h);for(null!=n?y.sort((function(t,e){return n(m[t],m[e])})):null!=e&&y.sort((function(t,n){return e(r[t],r[n])})),s=0,l=p?(g-f*x)/p:0;s0?h*l:0)+x,m[u]={data:r[u],index:s,value:h,startAngle:_,endAngle:c,padAngle:v};return m}return s.value=function(n){return arguments.length?(t="function"==typeof n?n:r(+n),s):t},s.sortValues=function(t){return arguments.length?(n=t,e=null,s):n},s.sort=function(t){return arguments.length?(e=t,n=null,s):e},s.startAngle=function(t){return arguments.length?(i="function"==typeof t?t:r(+t),s):i},s.endAngle=function(t){return arguments.length?(o="function"==typeof t?t:r(+t),s):o},s.padAngle=function(t){return arguments.length?(a="function"==typeof t?t:r(+t),s):a},s}I.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;default:this._context.lineTo(t,n)}}};var F=U(L);function Y(t){this._curve=t}function U(t){function n(n){return new Y(t(n))}return n._curve=t,n}function R(t){var n=t.curve;return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t.curve=function(t){return arguments.length?n(U(t)):n()._curve},t}function q(){return R(D().curve(F))}function B(){var t=$().curve(F),n=t.curve,e=t.lineX0,r=t.lineX1,i=t.lineY0,o=t.lineY1;return t.angle=t.x,delete t.x,t.startAngle=t.x0,delete t.x0,t.endAngle=t.x1,delete t.x1,t.radius=t.y,delete t.y,t.innerRadius=t.y0,delete t.y0,t.outerRadius=t.y1,delete t.y1,t.lineStartAngle=function(){return R(e())},delete t.lineX0,t.lineEndAngle=function(){return R(r())},delete t.lineX1,t.lineInnerRadius=function(){return R(i())},delete t.lineY0,t.lineOuterRadius=function(){return R(o())},delete t.lineY1,t.curve=function(t){return arguments.length?n(U(t)):n()._curve},t}function X(t,n){return[(n=+n)*Math.cos(t-=Math.PI/2),n*Math.sin(t)]}Y.prototype={areaStart:function(){this._curve.areaStart()},areaEnd:function(){this._curve.areaEnd()},lineStart:function(){this._curve.lineStart()},lineEnd:function(){this._curve.lineEnd()},point:function(t,n){this._curve.point(n*Math.sin(t),n*-Math.cos(t))}};class V{constructor(t,n){this._context=t,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line}point(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,n,t,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,t,this._y0,t,n)}this._x0=t,this._y0=n}}class W{constructor(t){this._context=t}lineStart(){this._point=0}lineEnd(){}point(t,n){if(t=+t,n=+n,0===this._point)this._point=1;else{const e=X(this._x0,this._y0),r=X(this._x0,this._y0=(this._y0+n)/2),i=X(t,this._y0),o=X(t,n);this._context.moveTo(...e),this._context.bezierCurveTo(...r,...i,...o)}this._x0=t,this._y0=n}}function G(t){return new V(t,!0)}function J(t){return new V(t,!1)}function Q(t){return new W(t)}function K(t){return t.source}function tt(t){return t.target}function nt(t){let n=K,e=tt,i=Z,o=C,a=null,s=null,u=b(l);function l(){let r;const l=P.call(arguments),c=n.apply(this,l),h=e.apply(this,l);if(null==a&&(s=t(r=u())),s.lineStart(),l[0]=c,s.point(+i.apply(this,l),+o.apply(this,l)),l[0]=h,s.point(+i.apply(this,l),+o.apply(this,l)),s.lineEnd(),r)return s=null,r+""||null}return l.source=function(t){return arguments.length?(n=t,l):n},l.target=function(t){return arguments.length?(e=t,l):e},l.x=function(t){return arguments.length?(i="function"==typeof t?t:r(+t),l):i},l.y=function(t){return arguments.length?(o="function"==typeof t?t:r(+t),l):o},l.context=function(n){return arguments.length?(null==n?a=s=null:s=t(a=n),l):a},l}function et(){return nt(G)}function rt(){return nt(J)}function it(){const t=nt(Q);return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t}const ot=c(3),at={draw(t,n){const e=.59436*c(n+u(n/28,.75)),r=e/2,i=r*ot;t.moveTo(0,e),t.lineTo(0,-e),t.moveTo(-i,-r),t.lineTo(i,r),t.moveTo(-i,r),t.lineTo(i,-r)}},st={draw(t,n){const e=c(n/f);t.moveTo(e,0),t.arc(0,0,e,0,d)}},ut={draw(t,n){const e=c(n/5)/2;t.moveTo(-3*e,-e),t.lineTo(-e,-e),t.lineTo(-e,-3*e),t.lineTo(e,-3*e),t.lineTo(e,-e),t.lineTo(3*e,-e),t.lineTo(3*e,e),t.lineTo(e,e),t.lineTo(e,3*e),t.lineTo(-e,3*e),t.lineTo(-e,e),t.lineTo(-3*e,e),t.closePath()}},lt=c(1/3),ct=2*lt,ht={draw(t,n){const e=c(n/ct),r=e*lt;t.moveTo(0,-e),t.lineTo(r,0),t.lineTo(0,e),t.lineTo(-r,0),t.closePath()}},ft={draw(t,n){const e=.62625*c(n);t.moveTo(0,-e),t.lineTo(e,0),t.lineTo(0,e),t.lineTo(-e,0),t.closePath()}},pt={draw(t,n){const e=.87559*c(n-u(n/7,2));t.moveTo(-e,0),t.lineTo(e,0),t.moveTo(0,e),t.lineTo(0,-e)}},dt={draw(t,n){const e=c(n),r=-e/2;t.rect(r,r,e,e)}},yt={draw(t,n){const e=.4431*c(n);t.moveTo(e,e),t.lineTo(e,-e),t.lineTo(-e,-e),t.lineTo(-e,e),t.closePath()}},mt=l(f/10)/l(7*f/10),_t=l(d/10)*mt,gt=-a(d/10)*mt,vt={draw(t,n){const e=c(.8908130915292852*n),r=_t*e,i=gt*e;t.moveTo(0,-e),t.lineTo(r,i);for(let n=1;n<5;++n){const o=d*n/5,s=a(o),u=l(o);t.lineTo(u*e,-s*e),t.lineTo(s*r-u*i,u*r+s*i)}t.closePath()}},xt=c(3),wt={draw(t,n){const e=-c(n/(3*xt));t.moveTo(0,2*e),t.lineTo(-xt*e,-e),t.lineTo(xt*e,-e),t.closePath()}},bt=c(3),Mt={draw(t,n){const e=.6824*c(n),r=e/2,i=e*bt/2;t.moveTo(0,-e),t.lineTo(i,r),t.lineTo(-i,r),t.closePath()}},Tt=-.5,At=c(3)/2,Et=1/c(12),kt=3*(Et/2+1),St={draw(t,n){const e=c(n/kt),r=e/2,i=e*Et,o=r,a=e*Et+e,s=-o,u=a;t.moveTo(r,i),t.lineTo(o,a),t.lineTo(s,u),t.lineTo(Tt*r-At*i,At*r+Tt*i),t.lineTo(Tt*o-At*a,At*o+Tt*a),t.lineTo(Tt*s-At*u,At*s+Tt*u),t.lineTo(Tt*r+At*i,Tt*i-At*r),t.lineTo(Tt*o+At*a,Tt*a-At*o),t.lineTo(Tt*s+At*u,Tt*u-At*s),t.closePath()}},Nt={draw(t,n){const e=.6189*c(n-u(n/6,1.7));t.moveTo(-e,-e),t.lineTo(e,e),t.moveTo(-e,e),t.lineTo(e,-e)}},Pt=[st,ut,ht,dt,vt,wt,St],Ot=[st,pt,Nt,Mt,at,yt,ft];function It(t,n){let e=null,i=b(o);function o(){let r;if(e||(e=r=i()),t.apply(this,arguments).draw(e,+n.apply(this,arguments)),r)return e=null,r+""||null}return t="function"==typeof t?t:r(t||st),n="function"==typeof n?n:r(void 0===n?64:+n),o.type=function(n){return arguments.length?(t="function"==typeof n?n:r(n),o):t},o.size=function(t){return arguments.length?(n="function"==typeof t?t:r(+t),o):n},o.context=function(t){return arguments.length?(e=null==t?null:t,o):e},o}function Lt(){}function Zt(t,n,e){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+n)/6,(t._y0+4*t._y1+e)/6)}function Ct(t){this._context=t}function Dt(t){return new Ct(t)}function $t(t){this._context=t}function Ht(t){return new $t(t)}function jt(t){this._context=t}function zt(t){return new jt(t)}function Ft(t,n){this._basis=new Ct(t),this._beta=n}Ct.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Zt(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Zt(this,t,n)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}},$t.prototype={areaStart:Lt,areaEnd:Lt,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._x2=t,this._y2=n;break;case 1:this._point=2,this._x3=t,this._y3=n;break;case 2:this._point=3,this._x4=t,this._y4=n,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+n)/6);break;default:Zt(this,t,n)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}},jt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var e=(this._x0+4*this._x1+t)/6,r=(this._y0+4*this._y1+n)/6;this._line?this._context.lineTo(e,r):this._context.moveTo(e,r);break;case 3:this._point=4;default:Zt(this,t,n)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}},Ft.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,n=this._y,e=t.length-1;if(e>0)for(var r,i=t[0],o=n[0],a=t[e]-i,s=n[e]-o,u=-1;++u<=e;)r=u/e,this._basis.point(this._beta*t[u]+(1-this._beta)*(i+r*a),this._beta*n[u]+(1-this._beta)*(o+r*s));this._x=this._y=null,this._basis.lineEnd()},point:function(t,n){this._x.push(+t),this._y.push(+n)}};const Yt=function t(n){function e(t){return 1===n?new Ct(t):new Ft(t,n)}return e.beta=function(n){return t(+n)},e}(.85);function Ut(t,n,e){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-n),t._y2+t._k*(t._y1-e),t._x2,t._y2)}function Rt(t,n){this._context=t,this._k=(1-n)/6}Rt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:Ut(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2,this._x1=t,this._y1=n;break;case 2:this._point=3;default:Ut(this,t,n)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};const qt=function t(n){function e(t){return new Rt(t,n)}return e.tension=function(n){return t(+n)},e}(0);function Bt(t,n){this._context=t,this._k=(1-n)/6}Bt.prototype={areaStart:Lt,areaEnd:Lt,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._x3=t,this._y3=n;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=n);break;case 2:this._point=3,this._x5=t,this._y5=n;break;default:Ut(this,t,n)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};const Xt=function t(n){function e(t){return new Bt(t,n)}return e.tension=function(n){return t(+n)},e}(0);function Vt(t,n){this._context=t,this._k=(1-n)/6}Vt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Ut(this,t,n)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};const Wt=function t(n){function e(t){return new Vt(t,n)}return e.tension=function(n){return t(+n)},e}(0);function Gt(t,n,e){var r=t._x1,i=t._y1,o=t._x2,a=t._y2;if(t._l01_a>h){var s=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,u=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*s-t._x0*t._l12_2a+t._x2*t._l01_2a)/u,i=(i*s-t._y0*t._l12_2a+t._y2*t._l01_2a)/u}if(t._l23_a>h){var l=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,c=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*l+t._x1*t._l23_2a-n*t._l12_2a)/c,a=(a*l+t._y1*t._l23_2a-e*t._l12_2a)/c}t._context.bezierCurveTo(r,i,o,a,t._x2,t._y2)}function Jt(t,n){this._context=t,this._alpha=n}Jt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){if(t=+t,n=+n,this._point){var e=this._x2-t,r=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(e*e+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3;default:Gt(this,t,n)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};const Qt=function t(n){function e(t){return n?new Jt(t,n):new Rt(t,0)}return e.alpha=function(n){return t(+n)},e}(.5);function Kt(t,n){this._context=t,this._alpha=n}Kt.prototype={areaStart:Lt,areaEnd:Lt,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,n){if(t=+t,n=+n,this._point){var e=this._x2-t,r=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(e*e+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=n;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=n);break;case 2:this._point=3,this._x5=t,this._y5=n;break;default:Gt(this,t,n)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};const tn=function t(n){function e(t){return n?new Kt(t,n):new Bt(t,0)}return e.alpha=function(n){return t(+n)},e}(.5);function nn(t,n){this._context=t,this._alpha=n}nn.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){if(t=+t,n=+n,this._point){var e=this._x2-t,r=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(e*e+r*r,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Gt(this,t,n)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};const en=function t(n){function e(t){return n?new nn(t,n):new Vt(t,0)}return e.alpha=function(n){return t(+n)},e}(.5);function rn(t){this._context=t}function on(t){return new rn(t)}function an(t){return t<0?-1:1}function sn(t,n,e){var r=t._x1-t._x0,i=n-t._x1,o=(t._y1-t._y0)/(r||i<0&&-0),a=(e-t._y1)/(i||r<0&&-0),s=(o*i+a*r)/(r+i);return(an(o)+an(a))*Math.min(Math.abs(o),Math.abs(a),.5*Math.abs(s))||0}function un(t,n){var e=t._x1-t._x0;return e?(3*(t._y1-t._y0)/e-n)/2:n}function ln(t,n,e){var r=t._x0,i=t._y0,o=t._x1,a=t._y1,s=(o-r)/3;t._context.bezierCurveTo(r+s,i+s*n,o-s,a-s*e,o,a)}function cn(t){this._context=t}function hn(t){this._context=new fn(t)}function fn(t){this._context=t}function pn(t){return new cn(t)}function dn(t){return new hn(t)}function yn(t){this._context=t}function mn(t){var n,e,r=t.length-1,i=new Array(r),o=new Array(r),a=new Array(r);for(i[0]=0,o[0]=2,a[0]=t[0]+2*t[1],n=1;n=0;--n)i[n]=(a[n]-i[n+1])/o[n];for(o[r-1]=(t[r]+i[r-1])/2,n=0;n1)for(var e,r,i,o=1,a=t[n[0]],s=a.length;o=0;)e[n]=n;return e}function Tn(t,n){return t[n]}function An(t){const n=[];return n.key=t,n}function En(){var t=r([]),n=Mn,e=bn,i=Tn;function o(r){var o,a,s=Array.from(t.apply(this,arguments),An),u=s.length,l=-1;for(const t of r)for(o=0,++l;o0){for(var e,r,i,o=0,a=t[0].length;o0)for(var e,r,i,o,a,s,u=0,l=t[n[0]].length;u0?(r[0]=o,r[1]=o+=i):i<0?(r[1]=a,r[0]=a+=i):(r[0]=0,r[1]=i)}function Nn(t,n){if((e=t.length)>0){for(var e,r=0,i=t[n[0]],o=i.length;r0&&(r=(e=t[n[0]]).length)>0){for(var e,r,i,o=0,a=1;ao&&(o=n,r=e);return r}function Ln(t){var n=t.map(Zn);return Mn(t).sort((function(t,e){return n[t]-n[e]}))}function Zn(t){for(var n,e=0,r=-1,i=t.length;++r=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,n),this._context.lineTo(t,n);else{var e=this._x*(1-this._t)+t*this._t;this._context.lineTo(e,this._y),this._context.lineTo(e,n)}}this._x=t,this._y=n}}},9065:(t,n,e)=>{"use strict";e.r(n),e.d(n,{ZoomTransform:()=>St,zoom:()=>jt,zoomIdentity:()=>Nt,zoomTransform:()=>Pt});var r={value:()=>{}};function i(){for(var t,n=0,e=arguments.length,r={};n=0&&(n=t.slice(e+1),t=t.slice(0,e)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}}))),u=-1,l=o.length;if(!(arguments.length<2)){if(null!=n&&"function"!=typeof n)throw new Error("invalid callback: "+n);for(;++u0)for(var e,r,i=new Array(e),o=0;o=0&&n._call.call(void 0,t),n=n._next;--_}()}finally{_=0,function(){for(var t,n,e=f,r=1/0;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:f=n);p=t,I(r)}(),b=0}}function O(){var t=T.now(),n=t-w;n>x&&(M-=n,w=t)}function I(t){_||(g&&(g=clearTimeout(g)),t-b>24?(t<1/0&&(g=setTimeout(P,t-T.now()-M)),v&&(v=clearInterval(v))):(v||(w=T.now(),v=setInterval(O,x)),_=1,A(P)))}function L(t,n,e){var r=new S;return n=null==n?0:+n,r.restart((e=>{r.stop(),t(e+n)}),n,e),r}S.prototype=N.prototype={constructor:S,restart:function(t,n,e){if("function"!=typeof t)throw new TypeError("callback is not a function");e=(null==e?E():+e)+(null==n?0:+n),this._next||p===this||(p?p._next=this:f=this,p=this),this._call=t,this._time=e,I()},stop:function(){this._call&&(this._call=null,this._time=1/0,I())}};var Z=u("start","end","cancel","interrupt"),C=[],D=0,$=2,H=3,j=5,z=6;function F(t,n,e,r,i,o){var a=t.__transition;if(a){if(e in a)return}else t.__transition={};!function(t,n,e){var r,i=t.__transition;function o(u){var l,c,h,f;if(1!==e.state)return s();for(l in i)if((f=i[l]).name===e.name){if(f.state===H)return L(o);4===f.state?(f.state=z,f.timer.stop(),f.on.call("interrupt",t,t.__data__,f.index,f.group),delete i[l]):+lD)throw new Error("too late; already scheduled");return e}function U(t,n){var e=R(t,n);if(e.state>H)throw new Error("too late; already running");return e}function R(t,n){var e=t.__transition;if(!e||!(e=e[n]))throw new Error("transition not found");return e}function q(t,n){var e,r,i,o=t.__transition,a=!0;if(o){for(i in n=null==n?null:n+"",o)(e=o[i]).name===n?(r=e.state>$&&e.state=0&&(t=t.slice(0,n)),!t||"start"===t}))}(n)?Y:U;return function(){var a=o(this,t),s=a.on;s!==r&&(i=(r=s).copy()).on(n,e),a.on=i}}(e,t,n))},attr:function(t,n){var e=(0,X.Z)(t),r="transform"===e?B.w:nt;return this.attrTween(t,"function"==typeof n?(e.local?st:at)(e,r,G(this,"attr."+t,n)):null==n?(e.local?rt:et)(e):(e.local?ot:it)(e,r,n))},attrTween:function(t,n){var e="attr."+t;if(arguments.length<2)return(e=this.tween(e))&&e._value;if(null==n)return this.tween(e,null);if("function"!=typeof n)throw new Error;var r=(0,X.Z)(t);return this.tween(e,(r.local?ut:lt)(r,n))},style:function(t,n,e){var r="transform"==(t+="")?B.Y:nt;return null==n?this.styleTween(t,function(t,n){var e,r,i;return function(){var o=(0,gt.S)(this,t),a=(this.style.removeProperty(t),(0,gt.S)(this,t));return o===a?null:o===e&&a===r?i:i=n(e=o,r=a)}}(t,r)).on("end.style."+t,vt(t)):"function"==typeof n?this.styleTween(t,function(t,n,e){var r,i,o;return function(){var a=(0,gt.S)(this,t),s=e(this),u=s+"";return null==s&&(this.style.removeProperty(t),u=s=(0,gt.S)(this,t)),a===u?null:a===r&&u===i?o:(i=u,o=n(r=a,s))}}(t,r,G(this,"style."+t,n))).each(function(t,n){var e,r,i,o,a="style."+n,s="end."+a;return function(){var u=U(this,t),l=u.on,c=null==u.value[a]?o||(o=vt(n)):void 0;l===e&&i===c||(r=(e=l).copy()).on(s,i=c),u.on=r}}(this._id,t)):this.styleTween(t,function(t,n,e){var r,i,o=e+"";return function(){var a=(0,gt.S)(this,t);return a===o?null:a===r?i:i=n(r=a,e)}}(t,r,n),e).on("end.style."+t,null)},styleTween:function(t,n,e){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==n)return this.tween(r,null);if("function"!=typeof n)throw new Error;return this.tween(r,function(t,n,e){var r,i;function o(){var o=n.apply(this,arguments);return o!==i&&(r=(i=o)&&function(t,n,e){return function(r){this.style.setProperty(t,n.call(this,r),e)}}(t,o,e)),r}return o._value=n,o}(t,n,null==e?"":e))},text:function(t){return this.tween("text","function"==typeof t?function(t){return function(){var n=t(this);this.textContent=null==n?"":n}}(G(this,"text",t)):function(t){return function(){this.textContent=t}}(null==t?"":t+""))},textTween:function(t){var n="text";if(arguments.length<1)return(n=this.tween(n))&&n._value;if(null==t)return this.tween(n,null);if("function"!=typeof t)throw new Error;return this.tween(n,function(t){var n,e;function r(){var r=t.apply(this,arguments);return r!==e&&(n=(e=r)&&function(t){return function(n){this.textContent=t.call(this,n)}}(r)),n}return r._value=t,r}(t))},remove:function(){return this.on("end.remove",function(t){return function(){var n=this.parentNode;for(var e in this.__transition)if(+e!==t)return;n&&n.removeChild(this)}}(this._id))},tween:function(t,n){var e=this._id;if(t+="",arguments.length<2){for(var r,i=R(this.node(),e).tween,o=0,a=i.length;o()=>t;function kt(t,{sourceEvent:n,target:e,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:e,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function St(t,n,e){this.k=t,this.x=n,this.y=e}St.prototype={constructor:St,scale:function(t){return 1===t?this:new St(this.k*t,this.x,this.y)},translate:function(t,n){return 0===t&0===n?this:new St(this.k,this.x+this.k*t,this.y+this.k*n)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Nt=new St(1,0,0);function Pt(t){for(;!t.__zoom;)if(!(t=t.parentNode))return Nt;return t.__zoom}function Ot(t){t.stopImmediatePropagation()}function It(t){t.preventDefault(),t.stopImmediatePropagation()}function Lt(t){return!(t.ctrlKey&&"wheel"!==t.type||t.button)}function Zt(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t).hasAttribute("viewBox")?[[(t=t.viewBox.baseVal).x,t.y],[t.x+t.width,t.y+t.height]]:[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]:[[0,0],[t.clientWidth,t.clientHeight]]}function Ct(){return this.__zoom||Nt}function Dt(t){return-t.deltaY*(1===t.deltaMode?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function $t(){return navigator.maxTouchPoints||"ontouchstart"in this}function Ht(t,n,e){var r=t.invertX(n[0][0])-e[0][0],i=t.invertX(n[1][0])-e[1][0],o=t.invertY(n[0][1])-e[0][1],a=t.invertY(n[1][1])-e[1][1];return t.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),a>o?(o+a)/2:Math.min(0,o)||Math.max(0,a))}function jt(){var t,n,e,r=Lt,i=Zt,o=Ht,a=Dt,s=$t,f=[0,1/0],p=[[-1/0,-1/0],[1/0,1/0]],m=250,_=d.Z,g=u("start","zoom","end"),v=500,x=150,w=0,b=10;function M(t){t.property("__zoom",Ct).on("wheel.zoom",P,{passive:!1}).on("mousedown.zoom",O).on("dblclick.zoom",I).filter(s).on("touchstart.zoom",L).on("touchmove.zoom",Z).on("touchend.zoom touchcancel.zoom",C).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function T(t,n){return(n=Math.max(f[0],Math.min(f[1],n)))===t.k?t:new St(n,t.x,t.y)}function A(t,n,e){var r=n[0]-e[0]*t.k,i=n[1]-e[1]*t.k;return r===t.x&&i===t.y?t:new St(t.k,r,i)}function E(t){return[(+t[0][0]+ +t[1][0])/2,(+t[0][1]+ +t[1][1])/2]}function k(t,n,e,r){t.on("start.zoom",(function(){S(this,arguments).event(r).start()})).on("interrupt.zoom end.zoom",(function(){S(this,arguments).event(r).end()})).tween("zoom",(function(){var t=this,o=arguments,a=S(t,o).event(r),s=i.apply(t,o),u=null==e?E(s):"function"==typeof e?e.apply(t,o):e,l=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),c=t.__zoom,h="function"==typeof n?n.apply(t,o):n,f=_(c.invert(u).concat(l/c.k),h.invert(u).concat(l/h.k));return function(t){if(1===t)t=h;else{var n=f(t),e=l/n[2];t=new St(e,u[0]-n[0]*e,u[1]-n[1]*e)}a.zoom(null,t)}}))}function S(t,n,e){return!e&&t.__zooming||new N(t,n)}function N(t,n){this.that=t,this.args=n,this.active=0,this.sourceEvent=null,this.extent=i.apply(t,n),this.taps=0}function P(t,...n){if(r.apply(this,arguments)){var e=S(this,n).event(t),i=this.__zoom,s=Math.max(f[0],Math.min(f[1],i.k*Math.pow(2,a.apply(this,arguments)))),u=(0,y.Z)(t);if(e.wheel)e.mouse[0][0]===u[0]&&e.mouse[0][1]===u[1]||(e.mouse[1]=i.invert(e.mouse[0]=u)),clearTimeout(e.wheel);else{if(i.k===s)return;e.mouse=[u,i.invert(u)],q(this),e.start()}It(t),e.wheel=setTimeout((function(){e.wheel=null,e.end()}),x),e.zoom("mouse",o(A(T(i,s),e.mouse[0],e.mouse[1]),e.extent,p))}}function O(t,...n){if(!e&&r.apply(this,arguments)){var i=t.currentTarget,a=S(this,n,!0).event(t),s=(0,l.Z)(t.view).on("mousemove.zoom",(function(t){if(It(t),!a.moved){var n=t.clientX-f,e=t.clientY-d;a.moved=n*n+e*e>w}a.event(t).zoom("mouse",o(A(a.that.__zoom,a.mouse[0]=(0,y.Z)(t,i),a.mouse[1]),a.extent,p))}),!0).on("mouseup.zoom",(function(t){s.on("mousemove.zoom mouseup.zoom",null),function(t,n){var e=t.document.documentElement,r=(0,l.Z)(t).on("dragstart.drag",null);n&&(r.on("click.drag",h,c),setTimeout((function(){r.on("click.drag",null)}),0)),"onselectstart"in e?r.on("selectstart.drag",null):(e.style.MozUserSelect=e.__noselect,delete e.__noselect)}(t.view,a.moved),It(t),a.event(t).end()}),!0),u=(0,y.Z)(t,i),f=t.clientX,d=t.clientY;!function(t){var n=t.document.documentElement,e=(0,l.Z)(t).on("dragstart.drag",h,c);"onselectstart"in n?e.on("selectstart.drag",h,c):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}(t.view),Ot(t),a.mouse=[u,this.__zoom.invert(u)],q(this),a.start()}}function I(t,...n){if(r.apply(this,arguments)){var e=this.__zoom,a=(0,y.Z)(t.changedTouches?t.changedTouches[0]:t,this),s=e.invert(a),u=e.k*(t.shiftKey?.5:2),c=o(A(T(e,u),a,s),i.apply(this,n),p);It(t),m>0?(0,l.Z)(this).transition().duration(m).call(k,c,a,t):(0,l.Z)(this).call(M.transform,c,a,t)}}function L(e,...i){if(r.apply(this,arguments)){var o,a,s,u,l=e.touches,c=l.length,h=S(this,i,e.changedTouches.length===c).event(e);for(Ot(e),a=0;a{var n=t&&t.__esModule?()=>t.default:()=>t;return e.d(n,{a:n}),n},e.d=(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},e.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),e.o=(t,n)=>Object.prototype.hasOwnProperty.call(t,n),e.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var r=e(3607);return r.default})())); +//# sourceMappingURL=function-plot.js.map \ No newline at end of file diff --git a/public/function-plot/README.md b/public/function-plot/README.md new file mode 100644 index 00000000..554a3fcc --- /dev/null +++ b/public/function-plot/README.md @@ -0,0 +1,17 @@ +# function-plot + +`1.26.0/function-plot.js` is the unmodified browser distribution from +`npm pack function-plot@1.26.0` (`dist/function-plot.js`). + +- Upstream: https://github.com/mauriciopoppe/function-plot +- License: MIT; see `1.26.0/LICENSE`. +- SHA-256: `2c4a888fc382fe9102141f3c3e15094c4d1595385e2eb074507c01cd91307c70`. + +The renderer supplies callbacks from the restricted maths interpreter, using the +built-in numeric sampler. It does not invoke upstream's string-to-JavaScript +compiler or require `unsafe-eval`. The library draws SVG curves, axes and zoom +behaviour locally; no graph contents are sent to an external rendering service. + +When updating the library, preserve its license, update the pinned asset path and +checksum, and verify actual rendering under Discourse's default CSP. Check cleanup +of the upstream chart cache when decorated content is replaced. diff --git a/spec/lib/bot_function_plot_spec.rb b/spec/lib/bot_function_plot_spec.rb new file mode 100644 index 00000000..a83f9734 --- /dev/null +++ b/spec/lib/bot_function_plot_spec.rb @@ -0,0 +1,97 @@ +# frozen_string_literal: true + +require_relative "../plugin_helper" +require "openai" + +describe DiscourseChatbot::Bot do + let(:client) { mock } + let(:requests) { [] } + + before do + SiteSetting.chatbot_tools_low_trust = "plot_function" + SiteSetting.chatbot_open_ai_model_low_trust = "gpt-4.1-mini" + OpenAI::Client.stubs(:new).returns(client) + end + + it "uses the graph tool and returns a maths explanation accompanied by the prepared block" do + graph = DiscourseChatbot::FunctionPlot.markdown("expressions" => "x^2-4") + answer = "The roots of $x^2-4=0$ are $x=\\pm2$.\n\n#{graph}" + client + .expects(:chat) + .twice + .with do |parameters:| + requests << parameters.deep_dup + true + end + .returns( + { + "choices" => [ + { + "finish_reason" => "tool_calls", + "message" => { + "content" => "", + "tool_calls" => [ + { + "id" => "call_graph", + "type" => "function", + "function" => { + "name" => "plot_function", + "arguments" => '{"expressions":"x^2-4"}', + }, + }, + ], + }, + }, + ], + "usage" => { + "total_tokens" => 10, + }, + }, + { + "choices" => [{ "finish_reason" => "stop", "message" => { "content" => answer } }], + "usage" => { + "total_tokens" => 10, + }, + }, + ) + + result = + described_class.new({}).get_response( + [{ role: "user", content: "Explain the roots of x squared minus four" }], + {}, + ) + + expect(requests.first[:tools].map { |tool| tool[:function]["name"] }).to eq(["plot_function"]) + expect(requests.last[:messages].find { |message| message[:role] == "tool" }[:content]).to eq( + graph, + ) + expect(result[:reply]).to eq(answer) + expect(result[:inner_thoughts].find { |entry| entry[:role] == "tool" }[:content]).to eq(graph) + end + + it "exposes the graph tool only when rendering is enabled and the trust level permits it" do + tool_sets = [] + client + .expects(:chat) + .times(3) + .with do |parameters:| + tool_sets << Array(parameters[:tools]).map { |tool| tool[:function]["name"] } + true + end + .returns( + "choices" => [{ "finish_reason" => "stop", "message" => { "content" => "Done." } }], + "usage" => { + "total_tokens" => 10, + }, + ) + + described_class.new({}).get_response([{ role: "user", content: "Plot x" }], {}) + SiteSetting.chatbot_function_plot_enabled = false + described_class.new({}).get_response([{ role: "user", content: "Plot x" }], {}) + SiteSetting.chatbot_function_plot_enabled = true + SiteSetting.chatbot_tools_low_trust = "calculate" + described_class.new({}).get_response([{ role: "user", content: "Plot x" }], {}) + + expect(tool_sets).to eq([["plot_function"], [], ["calculate"]]) + end +end diff --git a/spec/lib/tools/function_plot_spec.rb b/spec/lib/tools/function_plot_spec.rb new file mode 100644 index 00000000..2de62b88 --- /dev/null +++ b/spec/lib/tools/function_plot_spec.rb @@ -0,0 +1,95 @@ +# frozen_string_literal: true + +require_relative "../../plugin_helper" + +describe DiscourseChatbot::Tools::FunctionPlot do + let(:tool) { described_class.new } + + it "returns a renderable graph block for multiple curves at no external API quota cost" do + result = + tool.process( + "expressions" => "sin(x)\ncos(x)", + "title" => "Sine and cosine", + "x_min" => -7, + "x_max" => 7, + "y_min" => -1.5, + "y_max" => 1.5, + ) + + expect(result[:token_usage]).to eq(0) + expect(result[:answer]).to start_with("```function-plot\n") + expect(result[:answer]).to end_with("\n```") + expect(JSON.parse(result[:answer].lines[1])).to eq( + "functions" => %w[sin(x) cos(x)], + "title" => "Sine and cosine", + "x_domain" => [-7, 7], + "y_domain" => [-1.5, 1.5], + ) + end + + it "accepts supported mathematical functions, powers and constants without evaluating a domain" do + %w[ + x^2-4 + -x^2 + 2^-x + 1/x + sqrt(x) + log(x) + log10(x) + exp(x) + abs(x) + floor(x) + ceil(x) + asin(x) + acos(x) + atan(x) + tan(x) + pi*x + e^x + 1e3*x + ].each do |expression| + result = tool.process("expressions" => expression) + expect(result[:answer]).to start_with("```function-plot\n"), expression + end + end + + it "rejects unsafe, malformed and oversized graph requests with correction guidance" do + invalid = [ + {}, + { "expressions" => "" }, + { "expressions" => "x\nx\nx\nx\nx" }, + { "expressions" => "x" * 257 }, + { "expressions" => "(" * 17 + "x" + ")" * 17 }, + { "expressions" => "window.alert(1)" }, + { "expressions" => "x;alert(1)" }, + { "expressions" => "constructor(x)" }, + { "expressions" => "x=1" }, + { "expressions" => "y=x^2" }, + { "expressions" => "sin(" }, + { "expressions" => "x", "x_min" => 0 }, + { "expressions" => "x", "x_min" => 10, "x_max" => 0 }, + { "expressions" => "x", "y_min" => -Float::INFINITY, "y_max" => 10 }, + { "expressions" => "x", "x_min" => -10, "x_max" => 1_000_001 }, + { "expressions" => "x", "title" => "a" * 121 }, + { "expressions" => "x", "unexpected" => "value" }, + ] + invalid.each do |arguments| + expect(tool.process(arguments)).to eq( + answer: I18n.t("chatbot.prompt.function.function_plot.error"), + token_usage: 0, + ), + arguments.inspect + end + end + + it "escapes graph contents during cooking and preserves the fallback definition" do + result = tool.process("expressions" => "x^2", "title" => "") + cooked = Nokogiri::HTML5.fragment(PrettyText.cook(result[:answer])) + + expect(cooked.css("script")).to be_empty + expect(cooked.at_css("pre code.lang-function-plot").text).to include( + '"functions":["x^2"]', + "", + ) + end +end diff --git a/spec/system/page_objects/components/function_plots.rb b/spec/system/page_objects/components/function_plots.rb new file mode 100644 index 00000000..34b7dd42 --- /dev/null +++ b/spec/system/page_objects/components/function_plots.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +module PageObjects + module Components + class FunctionPlots < PageObjects::Components::Base + def has_rendered_graphs?(count:) + page.has_css?(".chatbot-function-plot__canvas svg.function-plot", count: count) && + page.has_css?(".chatbot-function-plot__canvas path.line", minimum: count) + end + + def has_error? + page.has_css?( + ".chatbot-function-plot__error", + text: I18n.t("js.chatbot.function_plot.error"), + ) + end + + def has_no_error? + page.has_no_css?(".chatbot-function-plot__error") + end + + def has_separate_domain_segments? + page.has_css?(".chatbot-function-plot__canvas path.line-0", count: 2) && + page.has_no_css?(".chatbot-function-plot__canvas path.line-1") + end + end + end +end diff --git a/spec/system/read_function_plots_spec.rb b/spec/system/read_function_plots_spec.rb new file mode 100644 index 00000000..4f09dc6c --- /dev/null +++ b/spec/system/read_function_plots_spec.rb @@ -0,0 +1,69 @@ +# frozen_string_literal: true + +require_relative "page_objects/components/function_plots" + +RSpec.describe "Read function plots" do + fab!(:user) + fab!(:topic) + + let(:topic_page) { PageObjects::Pages::Topic.new } + let(:graphs) { PageObjects::Components::FunctionPlots.new } + + before do + enable_current_plugin + SiteSetting.chatbot_enabled = true + SiteSetting.chatbot_function_plot_enabled = true + sign_in(user) + end + + it "lets readers see mathematical explanations with multiple locally rendered curves" do + polynomial = + DiscourseChatbot::FunctionPlot.markdown( + "expressions" => "x^2-4", + "title" => "Roots of a quadratic", + ) + trig = + DiscourseChatbot::FunctionPlot.markdown( + "expressions" => "sin(x)\ncos(x)", + "y_min" => -2, + "y_max" => 2, + ) + Fabricate( + :post, + topic: topic, + raw: "The roots of $x^2-4=0$ are $x=\\pm2$.\n\n#{polynomial}\n\n#{trig}", + ) + + topic_page.visit_topic(topic) + + expect(topic_page).to have_content("The roots of") + expect(graphs).to have_rendered_graphs(count: 2) + expect(topic_page).to have_content("Roots of a quadratic") + + page.refresh + expect(graphs).to have_rendered_graphs(count: 2) + end + + it "shows a useful fallback for an unsupported expression without executing it" do + Fabricate( + :post, + topic: topic, + raw: "```function-plot\n{\"functions\":[\"window.alert(1)\"]}\n```", + ) + + topic_page.visit_topic(topic) + + expect(graphs).to have_error + expect(topic_page).to have_content(I18n.t("js.chatbot.function_plot.fallback")) + end + + it "preserves gaps in the domain and handles an entirely undefined curve" do + graph = DiscourseChatbot::FunctionPlot.markdown("expressions" => "sqrt(x^2-1)\nsqrt(-1)") + Fabricate(:post, topic: topic, raw: graph) + + topic_page.visit_topic(topic) + + expect(graphs).to have_separate_domain_segments + expect(graphs).to have_no_error + end +end diff --git a/test/javascripts/unit/function-plot-expression-test.js b/test/javascripts/unit/function-plot-expression-test.js new file mode 100644 index 00000000..ea6e3a0c --- /dev/null +++ b/test/javascripts/unit/function-plot-expression-test.js @@ -0,0 +1,105 @@ +import { module, test } from "qunit"; +import { + compileExpression, + parseGraph, + splitUndefinedSegments, +} from "discourse/plugins/discourse-chatbot/discourse/lib/function-plot-expression"; + +module("Chatbot | function plot expressions", function () { + test("interprets curve expressions with mathematical operator precedence", function (assert) { + [ + ["x^2-4", 3, 5], + ["-x^2", 3, -9], + ["2^-x", 3, 0.125], + ["2^3^2", 0, 512], + ["sin(pi/2)+cos(0)", 0, 2], + ["exp(log(e))", 0, Math.E], + ["log10(1000)", 0, 3], + ["sqrt(abs(x))", -4, 2], + ["1e3*x", 2, 2000], + ].forEach(([expression, x, expected]) => { + assert.true( + Math.abs(compileExpression(expression)(x) - expected) < 1e-10, + expression + ); + }); + assert.true(Number.isNaN(compileExpression("1/x")(0)), "pole is a gap"); + assert.true( + Number.isNaN(compileExpression("sqrt(x)")(-1)), + "undefined domain is a gap" + ); + }); + + test("rejects code, property access, unknown symbols and excessive complexity", function (assert) { + [ + "window.alert(1)", + "constructor(x)", + "x=1", + "x;alert(1)", + "x[0]", + "sin(", + "sin(x,2)", + "x y", + "", + "x".repeat(257), + "(".repeat(40) + "x" + ")".repeat(40), + ].forEach((expression) => { + assert.throws(() => compileExpression(expression), undefined, expression); + }); + }); + + test("accepts bounded graph definitions and rejects arbitrary library options", function (assert) { + const graph = parseGraph( + JSON.stringify({ + functions: ["sin(x)", "cos(x)"], + x_domain: [-7, 7], + y_domain: [-2, 2], + title: "Two curves", + }) + ); + assert.strictEqual(graph.functions.length, 2); + assert.deepEqual(graph.xDomain, [-7, 7]); + assert.deepEqual(graph.yDomain, [-2, 2]); + assert.strictEqual(graph.functions[0].evaluate(0), 0); + [ + { functions: [] }, + { functions: ["x", "x", "x", "x", "x"] }, + { functions: ["x"], target: "body" }, + { functions: ["x"], title: "a".repeat(121) }, + { functions: ["x"], x_domain: [0, 0] }, + { functions: ["x"], x_domain: [-1e7, 1e7] }, + { functions: ["x"], y_domain: [10, -10] }, + ].forEach((value) => + assert.throws(() => parseGraph(JSON.stringify(value))) + ); + assert.throws(() => parseGraph("x".repeat(8193))); + }); + + test("keeps sampled curves separate across undefined domains", function (assert) { + const evaluate = compileExpression("sqrt(x^2-1)"); + const points = [-2, -1.5, -1, 1, 1.5, 2].map((x) => [x, evaluate(x)]); + assert.deepEqual(splitUndefinedSegments([points], evaluate, 0.5), [ + points.slice(0, 3), + points.slice(3), + ]); + assert.deepEqual(splitUndefinedSegments([[undefined]], evaluate, 0.5), []); + assert.deepEqual( + splitUndefinedSegments( + [ + [ + [0, 0], + [1, 1], + ], + ], + compileExpression("x"), + 1 + ), + [ + [ + [0, 0], + [1, 1], + ], + ] + ); + }); +}); From 4fd95b847a47eb3e4387f7a3a2f7ab796b915bbe Mon Sep 17 00:00:00 2001 From: merefield Date: Mon, 26 Oct 2026 18:10:21 +0000 Subject: [PATCH 2/8] FIX: include plotting in every trust-level tool default --- README.md | 9 +++++---- config/locales/server.en.yml | 2 +- config/settings.yml | 6 +++--- spec/lib/site_setting_dependencies_spec.rb | 2 +- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 1515e396..8558536a 100644 --- a/README.md +++ b/README.md @@ -271,7 +271,7 @@ provided by other plugins are controlled by those plugins instead. The defaults are: -* Low and medium trust: `calculate`, `remaining_bot_quota`, and `local_forum_search`. +* Low and medium trust: `calculate`, `plot_function`, `remaining_bot_quota`, and `local_forum_search`. * High trust: those tools plus `wikipedia`, `news`, `web_crawler`, `web_search`, and `stock_data`. Runtime requirements still take precedence over these defaults. For example, @@ -374,9 +374,10 @@ your community's requests. ### Mathematical function graphs Chatbot bundles function-plot 1.26.0 for interactive graphs rendered locally in the -reader's browser. Enable `chatbot_function_plot_enabled` (default `true`) and add -`plot_function` to the appropriate `chatbot_tools_*_trust` settings to let the bot -prepare graphs. Existing trust-level tool lists are not changed automatically. +reader's browser. `chatbot_function_plot_enabled` defaults to `true`, and +`plot_function` is included in the defaults for all `chatbot_tools_*_trust` settings. +Customised trust-level tool lists retain their existing selections; add +`plot_function` to those lists to let the bot prepare graphs. System One selection evaluates the new tool like the other eligible tools. The tool is intended to accompany mathematical explanations, including the site's diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index 8f2eb36d..1b433978 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -1,6 +1,6 @@ en: site_settings: - chatbot_function_plot_enabled: "Render function-plot graph blocks locally in posts, PMs and Chat. Add plot_function to the appropriate trust-level tool lists to let Chatbot prepare graphs. Graphs can accompany maths explanations and MathJax output." + chatbot_function_plot_enabled: "Render function-plot graph blocks locally in posts, PMs and Chat. The plot_function tool is included in the defaults for every trust level; add it to any customised tool lists to let Chatbot prepare graphs. Graphs can accompany maths explanations and MathJax output." chatbot_enabled: "Enable the chatbot plugin" chatbot_llm_provider: "Provider used for chatbot completions. OpenAI, Anthropic, Google Gemini, and xAI are supported through their OpenAI-compatible APIs." chatbot_open_ai_token: "OpenAI API key shared by every chatbot capability configured to use OpenAI. Get a key at OpenAI." diff --git a/config/settings.yml b/config/settings.yml index 0ad25197..52351dba 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -139,7 +139,7 @@ plugins: type: group_list list_type: compact chatbot_tools_high_trust: - default: "calculate|wikipedia|remaining_bot_quota|local_forum_search|news|web_crawler|web_search|stock_data" + default: "calculate|plot_function|wikipedia|remaining_bot_quota|local_forum_search|news|web_crawler|web_search|stock_data" client: false type: list list_type: compact @@ -251,7 +251,7 @@ plugins: client: false default: '' chatbot_tools_medium_trust: - default: "calculate|remaining_bot_quota|local_forum_search" + default: "calculate|plot_function|remaining_bot_quota|local_forum_search" client: false type: list list_type: compact @@ -315,7 +315,7 @@ plugins: client: false default: '' chatbot_tools_low_trust: - default: "calculate|remaining_bot_quota|local_forum_search" + default: "calculate|plot_function|remaining_bot_quota|local_forum_search" client: false type: list list_type: compact diff --git a/spec/lib/site_setting_dependencies_spec.rb b/spec/lib/site_setting_dependencies_spec.rb index fae5bc10..f375156b 100644 --- a/spec/lib/site_setting_dependencies_spec.rb +++ b/spec/lib/site_setting_dependencies_spec.rb @@ -178,7 +178,7 @@ end it "selects the core tools by default at every trust level" do - expected_tools = %w[calculate remaining_bot_quota local_forum_search] + expected_tools = %w[calculate plot_function remaining_bot_quota local_forum_search] configured_settings = YAML.safe_load_file( File.expand_path("../../config/settings.yml", __dir__), From b885e3a111f9b3daae51ffc3fe54e15036cb831d Mon Sep 17 00:00:00 2001 From: merefield Date: Mon, 26 Oct 2026 18:29:04 +0000 Subject: [PATCH 3/8] EXPERIMENT: render 2D curves and rotatable 3D surfaces with JSXGraph --- README.md | 25 ++- .../components/function-plot-block.gjs | 84 ++++----- .../discourse/lib/function-plot-expression.js | 60 +++---- .../discourse/lib/jsxgraph-renderer.js | 114 ++++++++++++ assets/stylesheets/common/chatbot_common.scss | 27 +++ config/locales/client.en.yml | 1 + config/locales/server.en.yml | 13 +- lib/discourse_chatbot/function_plot.rb | 20 ++- lib/discourse_chatbot/tools/function_plot.rb | 7 +- public/jsxgraph/1.14.1/LICENSE.LGPL | 165 ++++++++++++++++++ public/jsxgraph/1.14.1/LICENSE.MIT | 26 +++ public/jsxgraph/1.14.1/jsxgraphcore.js | 55 ++++++ .../1.14.1/jsxgraphcore.js.LICENSE.txt | 5 + public/jsxgraph/README.md | 18 ++ spec/lib/tools/function_plot_spec.rb | 23 +++ .../page_objects/components/function_plots.rb | 54 +++++- spec/system/read_function_plots_spec.rb | 26 +++ .../unit/function-plot-expression-test.js | 47 +++-- 18 files changed, 637 insertions(+), 133 deletions(-) create mode 100644 assets/javascripts/discourse/lib/jsxgraph-renderer.js create mode 100644 public/jsxgraph/1.14.1/LICENSE.LGPL create mode 100644 public/jsxgraph/1.14.1/LICENSE.MIT create mode 100644 public/jsxgraph/1.14.1/jsxgraphcore.js create mode 100644 public/jsxgraph/1.14.1/jsxgraphcore.js.LICENSE.txt create mode 100644 public/jsxgraph/README.md diff --git a/README.md b/README.md index 8558536a..15d94812 100644 --- a/README.md +++ b/README.md @@ -373,13 +373,28 @@ your community's requests. ### Mathematical function graphs -Chatbot bundles function-plot 1.26.0 for interactive graphs rendered locally in the +This local experimental branch bundles JSXGraph 1.14.1 for interactive 2D curves +and 3D surfaces rendered locally in the reader's browser. `chatbot_function_plot_enabled` defaults to `true`, and `plot_function` is included in the defaults for all `chatbot_tools_*_trust` settings. Customised trust-level tool lists retain their existing selections; add `plot_function` to those lists to let the bot prepare graphs. System One selection evaluates the new tool like the other eligible tools. +Existing `function-plot` fences remain compatible. To plot a surface `z=f(x,y)`, +add `"dimensions":3` and optionally `"z_domain"` to its JSON definition: + +````markdown +```function-plot +{"dimensions":3,"functions":["sin(x)*cos(y)"],"title":"A 3D wave","x_domain":[-3,3],"y_domain":[-3,3],"z_domain":[-1.5,1.5]} +``` +```` + +Readers drag a 3D surface to rotate it and scroll or pinch to zoom. The tool accepts the equivalent numeric +`dimensions` parameter (2 by default, or 3 for surfaces) and paired `z_min`/`z_max` +bounds. Use at most two surfaces in a graph. This first 3D experiment supports +explicit surfaces `z=f(x,y)`, not arbitrary implicit solids or parametric curves. + The tool is intended to accompany mathematical explanations, including the site's usual MathJax/LaTeX output when Discourse Math is installed. For example, an answer about quadratic roots can explain the algebra and include a plot of `x^2-4`. @@ -404,10 +419,10 @@ at most 256 characters. Titles are plain text, at most 120 characters. Both axes default to `[-10,10]`; custom domains must be finite, increasing pairs within `[-1000000,1000000]`, with a span of at least `0.000001`. -The renderer uses a restricted interpreter with function-plot's numeric sampler -(1,000 samples per curve) rather than its string-to-JavaScript compiler, preserving -Discourse's CSP. It redraws when resized or zoomed and uses function-plot's -discontinuity handling. Undefined or non-finite function values are omitted; +The renderer uses a restricted interpreter and trusted callbacks, with JSXGraph's +code compilation disabled, preserving Discourse's CSP. 2D curves use adaptive +sampling; 3D surfaces use a bounded mesh with 24 subdivisions in each direction. +It redraws when resized, zoomed or rotated. Undefined or non-finite values are gaps; graphs are numerical visualisations, not proofs or a symbolic solver. Graph definitions remain available in a disclosure below each plot and as ordinary code blocks in email, exports, disabled rendering, and clients without JavaScript. diff --git a/assets/javascripts/discourse/components/function-plot-block.gjs b/assets/javascripts/discourse/components/function-plot-block.gjs index e44d1665..8a2bb81a 100644 --- a/assets/javascripts/discourse/components/function-plot-block.gjs +++ b/assets/javascripts/discourse/components/function-plot-block.gjs @@ -2,77 +2,47 @@ import Component from "@glimmer/component"; import { tracked } from "@glimmer/tracking"; import { modifier } from "ember-modifier"; import loadScript from "discourse/lib/load-script"; +import { eq } from "discourse/truth-helpers"; import { i18n } from "discourse-i18n"; -import { - parseGraph, - splitUndefinedSegments, -} from "../lib/function-plot-expression"; - -const COLORS = ["#0088cc", "#e4572e", "#32a66a", "#b279a2"]; +import { parseGraph } from "../lib/function-plot-expression"; +import { createGraphBoard } from "../lib/jsxgraph-renderer"; export default class FunctionPlotBlock extends Component { @tracked failed = false; + @tracked graph = null; @tracked loading = true; renderPlot = modifier((element, [raw]) => { let disposed = false; - let chart; + let board; let observer; - let options; let previousWidth; - const draw = () => { + const resize = () => { const width = Math.max(240, Math.min(element.clientWidth || 640, 1000)); - if (width === previousWidth) { - return; + const height = Math.max(260, Math.min(width * 0.7, 480)); + if (width !== previousWidth) { + previousWidth = width; + element.style.height = `${height}px`; + board?.resizeContainer(width, height, true); } - previousWidth = width; - options.width = width; - options.height = Math.max(240, Math.min(width * 0.65, 420)); - chart.build(); }; const initialize = async () => { try { const graph = parseGraph(raw); await loadScript( - "/plugins/discourse-chatbot/function-plot/1.26.0/function-plot.js" + "/plugins/discourse-chatbot/jsxgraph/1.14.1/jsxgraphcore.js" ); if (disposed) { return; } - options = { - target: element, - title: graph.title, - grid: true, - xAxis: { domain: graph.xDomain }, - yAxis: { domain: graph.yDomain }, - data: [], - }; - chart = window.functionPlot(options); - chart.on("eval", (segments, index, isHelper) => { - if (isHelper || !graph.functions[index]) { - return; - } - const [minimum, maximum] = chart.meta.xScale.domain(); - const separated = splitUndefinedSegments( - segments, - graph.functions[index].evaluate, - (maximum - minimum) / 999 - ); - segments.splice(0, segments.length, ...separated); - }); - options.data = graph.functions.map((curve, index) => ({ - fn: ({ x }) => curve.evaluate(x), - graphType: "polyline", - sampler: "builtIn", - nSamples: 1000, - color: COLORS[index], - })); - draw(); + this.graph = graph; + resize(); + board = createGraphBoard(element, graph); observer = new ResizeObserver(() => { if (!disposed) { - draw(); + resize(); } }); observer.observe(element); @@ -91,10 +61,8 @@ export default class FunctionPlotBlock extends Component { return () => { disposed = true; observer?.disconnect(); - if (chart) { - chart.removeAllListeners(); - // Upstream retains every chart in a static cache, including detached post graphs. - delete chart.constructor.cache[chart.id]; + if (board) { + window.JXG.JSXGraph.freeBoard(board); } }; }); @@ -104,6 +72,9 @@ export default class FunctionPlotBlock extends Component { class="chatbot-function-plot" aria-label={{i18n "chatbot.function_plot.label"}} > + {{#if this.graph.title}} +

{{this.graph.title}}

+ {{/if}} {{#if this.loading}}

{{i18n "chatbot.function_plot.loading" @@ -118,7 +89,18 @@ export default class FunctionPlotBlock extends Component { class="chatbot-function-plot__canvas" {{this.renderPlot @data.raw}} > -

{{i18n "chatbot.function_plot.help"}}
+
    + {{#each this.graph.functions as |curve|}} +
  • {{curve.expression}}
  • + {{/each}} +
+
{{i18n + (if + (eq this.graph.dimensions 3) + "chatbot.function_plot.help_3d" + "chatbot.function_plot.help" + ) + }}
{{i18n "chatbot.function_plot.fallback"}}
{{@data.raw}}
diff --git a/assets/javascripts/discourse/lib/function-plot-expression.js b/assets/javascripts/discourse/lib/function-plot-expression.js index a72072c0..510bb531 100644 --- a/assets/javascripts/discourse/lib/function-plot-expression.js +++ b/assets/javascripts/discourse/lib/function-plot-expression.js @@ -23,7 +23,7 @@ const OPERATORS = { }; // Interpret a small maths grammar; never pass post text to the library's code generator. -export function compileExpression(expression) { +export function compileExpression(expression, { dimensions = 2 } = {}) { if ( typeof expression !== "string" || !expression.trim() || @@ -59,7 +59,7 @@ export function compileExpression(expression) { let left; if (token === "+" || token === "-") { const operand = parse(3, depth + 1); - left = token === "-" ? (x) => -operand(x) : operand; + left = token === "-" ? (x, y) => -operand(x, y) : operand; } else if (token === "(") { left = parse(1, depth + 1); if (tokens[index++] !== ")") { @@ -67,6 +67,8 @@ export function compileExpression(expression) { } } else if (token === "x") { left = (x) => x; + } else if (token === "y" && dimensions === 3) { + left = (_x, y) => y; } else if (token === "pi" || token === "e") { const constant = token === "pi" ? Math.PI : Math.E; left = () => constant; @@ -78,7 +80,7 @@ export function compileExpression(expression) { if (tokens[index++] !== ")") { throw new Error("Invalid function argument"); } - left = (x) => FUNCTIONS[token](argument(x)); + left = (x, y) => FUNCTIONS[token](argument(x, y)); } else if (token && Number.isFinite(Number(token))) { const number = Number(token); left = () => number; @@ -96,7 +98,7 @@ export function compileExpression(expression) { depth + 1 ); const previous = left; - left = (x) => OPERATORS[operator](previous(x), right(x)); + left = (x, y) => OPERATORS[operator](previous(x, y), right(x, y)); } return left; } @@ -105,8 +107,8 @@ export function compileExpression(expression) { if (index !== tokens.length) { throw new Error("Unexpected expression input"); } - return (x) => { - const result = evaluate(x); + return (x, y) => { + const result = evaluate(x, y); return Number.isFinite(result) ? result : NaN; }; } @@ -133,13 +135,24 @@ export function parseGraph(raw) { throw new Error("Graph too large"); } const graph = JSON.parse(raw); + const dimensions = graph?.dimensions ?? 2; if ( !graph || + ![2, 3].includes(dimensions) || !Array.isArray(graph.functions) || graph.functions.length < 1 || - graph.functions.length > 4 || + graph.functions.length > (dimensions === 3 ? 2 : 4) || + (dimensions === 2 && Object.hasOwn(graph, "z_domain")) || Object.keys(graph).some( - (key) => !["functions", "title", "x_domain", "y_domain"].includes(key) + (key) => + ![ + "functions", + "title", + "dimensions", + "x_domain", + "y_domain", + "z_domain", + ].includes(key) ) ) { throw new Error("Invalid graph"); @@ -149,39 +162,14 @@ export function parseGraph(raw) { throw new Error("Invalid title"); } return { + dimensions, title, xDomain: domain(graph.x_domain ?? [-10, 10]), yDomain: domain(graph.y_domain ?? [-10, 10]), + zDomain: dimensions === 3 ? domain(graph.z_domain ?? [-10, 10]) : null, functions: graph.functions.map((expression) => ({ expression, - evaluate: compileExpression(expression), + evaluate: compileExpression(expression, { dimensions }), })), }; } - -// The upstream sampler drops undefined points, which can otherwise bridge domain gaps. -export function splitUndefinedSegments(segments, evaluate, step) { - const result = []; - for (const segment of segments) { - let current = []; - for (const point of segment) { - if (!point || !point.every(Number.isFinite)) { - continue; - } - const previous = current.at(-1); - if ( - previous && - (point[0] - previous[0] > step * 1.5 || - !Number.isFinite(evaluate((point[0] + previous[0]) / 2))) - ) { - result.push(current); - current = []; - } - current.push(point); - } - if (current.length) { - result.push(current); - } - } - return result; -} diff --git a/assets/javascripts/discourse/lib/jsxgraph-renderer.js b/assets/javascripts/discourse/lib/jsxgraph-renderer.js new file mode 100644 index 00000000..92230cc0 --- /dev/null +++ b/assets/javascripts/discourse/lib/jsxgraph-renderer.js @@ -0,0 +1,114 @@ +const COLORS = ["#0088cc", "#e4572e", "#32a66a", "#b279a2"]; + +export function createGraphBoard(element, graph) { + const library = window.JXG; + // Internal labels must also use the interpreter under Discourse's CSP. + library.Options.jc.compile = false; + const is3D = graph.dimensions === 3; + const primary = getComputedStyle(element) + .getPropertyValue("--primary") + .trim(); + const axis = { + strokeColor: primary, + ticks: { + label: { strokeColor: primary, display: "internal", parse: false }, + }, + }; + element.id ||= `chatbot-plot-${crypto.randomUUID()}`; + element.dataset.dimensions = graph.dimensions; + const board = library.JSXGraph.initBoard(element, { + renderer: "svg", + boundingbox: is3D + ? [-8, 6, 8, -6] + : [ + graph.xDomain[0], + graph.yDomain[1], + graph.xDomain[1], + graph.yDomain[0], + ], + axis: !is3D, + defaultAxes: { x: axis, y: axis }, + grid: !is3D, + showCopyright: false, + showNavigation: false, + showInfobox: false, + keepaspectratio: is3D, + resize: { enabled: false }, + pan: { enabled: !is3D, needShift: false }, + zoom: { enabled: true, needShift: false }, + title: "", + description: "", + }); + board.options.text.display = "internal"; + board.options.text.parse = false; + board.options.text.useMathJax = false; + const curves = []; + board.suspendUpdate(); + try { + if (is3D) { + const view = board.create( + "view3d", + [ + [-6, -4], + [12, 8], + [graph.xDomain, graph.yDomain, graph.zDomain], + ], + { + projection: "parallel", + trackball: { enabled: true }, + axesPosition: "center", + depthOrder: { enabled: true }, + xPlaneRear: { visible: false }, + yPlaneRear: { visible: false }, + zPlaneRear: { visible: false }, + } + ); + graph.functions.forEach((curve, index) => { + view.create( + "functiongraph3d", + [curve.evaluate, graph.xDomain, graph.yDomain], + { + type: "shader", + tiling: "triangle", + stepsU: 24, + stepsV: 24, + polyhedron: { + visible: true, + strokeWidth: 0, + fillOpacity: 0.85, + shader: { + enabled: true, + hue: index === 0 ? 200 : 15, + saturation: 80, + minLightness: 35, + maxLightness: 75, + }, + }, + } + ); + }); + } else { + graph.functions.forEach((curve, index) => { + curves.push( + board.create("functiongraph", [curve.evaluate], { + strokeColor: COLORS[index], + strokeWidth: 2, + highlight: false, + doAdvancedPlot: true, + recursionDepthHigh: 12, + recursionDepthLow: 8, + }) + ); + }); + } + board.unsuspendUpdate(); + curves.forEach((curve, index) => { + curve.rendNode.classList.add("chatbot-function-plot__curve"); + curve.rendNode.dataset.curve = index; + }); + return board; + } catch (error) { + library.JSXGraph.freeBoard(board); + throw error; + } +} diff --git a/assets/stylesheets/common/chatbot_common.scss b/assets/stylesheets/common/chatbot_common.scss index 74322d78..fc6c9fdd 100644 --- a/assets/stylesheets/common/chatbot_common.scss +++ b/assets/stylesheets/common/chatbot_common.scss @@ -113,7 +113,9 @@ background: var(--secondary); &__canvas { + position: relative; width: 100%; + min-height: 260px; overflow: hidden; svg { @@ -136,6 +138,31 @@ font-size: var(--font-down-1); } + &__legend { + display: flex; + flex-wrap: wrap; + gap: 0.5em 1.5em; + margin: 0.5em 0; + padding-left: 1.5em; + font-family: monospace; + + li:nth-child(1) { + color: #08c; + } + + li:nth-child(2) { + color: #e4572e; + } + + li:nth-child(3) { + color: #32a66a; + } + + li:nth-child(4) { + color: #b279a2; + } + } + &__definition { margin-top: 0.5em; font-size: var(--font-down-1); diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 56731872..66f68fa7 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -9,6 +9,7 @@ en: fallback: "Graph definition" label: "Interactive function graph" help: "Drag to pan; scroll or pinch to zoom. Angles are in radians." + help_3d: "Drag to rotate; scroll or pinch to zoom. Angles are in radians." tool_selection_mode: remove_definitions: "Remove unselected tool definitions" restrict_calls: "Restrict calls and retain tool definitions for caching" diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index 1b433978..71f6caa6 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -199,16 +199,19 @@ en: function: function_plot: description: | - Prepare an interactive graph of up to four mathematical functions y=f(x). Use when a graph would help explain a maths question: roots, intersections, turning points, trigonometry, growth, or comparing functions, even if the user did not explicitly ask for a graph. Accompany the graph with the mathematical explanation and the site's usual LaTeX/MathJax notation; the graph does not replace the answer or numerical calculation tools. - Supply expressions in x, one per line, without 'y=' or LaTeX. Use explicit multiplication (*), powers (^), parentheses, constants pi and e, and these single-argument functions: sin, cos, tan, asin, acos, atan, sqrt, abs, exp, log (natural logarithm), log10, floor, ceil. Trigonometric angles are radians. For example: x^2-4 or sin(x). Expressions are limited to 256 characters each. - Choose axis bounds that show the relevant features. Bounds are numeric; supply both minimum and maximum for an axis, with -1000000 <= minimum < maximum <= 1000000. Each axis defaults to [-10,10] if omitted. The tool returns a function-plot fenced block; copy the complete block unchanged into your final answer outside any other code fence. The graph renders in the reader's browser; do not claim to have viewed its rendered appearance. - expressions: "One to four expressions in x, separated by newlines, for example sin(x) followed by cos(x)." + Prepare an interactive mathematical graph. For ordinary equations in x and y use dimensions=2 (the default): up to four curves y=f(x), with expressions in x. For a surface z=f(x,y), use dimensions=3: up to two expressions in x and y; readers can rotate the surface. Do not add a third dimension to an equation that only describes a 2D curve. Use when a graph would help explain roots, intersections, turning points, trigonometry, growth, or surfaces, even if the user did not explicitly ask for a graph. Accompany the graph with a mathematical explanation and the site's usual LaTeX/MathJax notation; the graph does not replace the answer or numerical calculation tools. + Supply expressions one per line, without 'y=', 'z=' or LaTeX. Use explicit multiplication (*), powers (^), parentheses, constants pi and e, and these single-argument functions: sin, cos, tan, asin, acos, atan, sqrt, abs, exp, log (natural logarithm), log10, floor, ceil. Trigonometric angles are radians. Examples: x^2-4 for 2D; sin(x)*cos(y) or x^2-y^2 for 3D. Expressions are limited to 256 characters each. + Choose axis bounds that show the relevant features. Bounds are numeric; supply both minimum and maximum for an axis, with -1000000 <= minimum < maximum <= 1000000. Each axis defaults to [-10,10] if omitted. Supply z_min/z_max only for 3D. The tool returns a function-plot fenced block; copy the complete block unchanged into your final answer outside any other code fence. The graph renders in the reader's browser; do not claim to have viewed its rendered appearance. + expressions: "Expressions separated by newlines: up to four in x for 2D curves, or up to two in x and y for 3D surfaces." title: "Optional plain-text graph title, up to 120 characters." + dimensions: "Optional number 2 (default) for y=f(x) curves, or 3 for z=f(x,y) surfaces." x_min: "Left boundary of the graph. Supply with x_max." x_max: "Right boundary of the graph. Supply with x_min." y_min: "Bottom boundary of the graph. Supply with y_max." y_max: "Top boundary of the graph. Supply with y_min." - error: "Unable to prepare the graph. Use up to four supported expressions in x, one per line, without y= or LaTeX. Supply finite, increasing axis bounds in pairs, within -1000000 to 1000000, and a title of at most 120 characters. Correct the arguments before retrying." + z_min: "Lower z-axis boundary for a 3D surface only. Supply with z_max." + z_max: "Upper z-axis boundary for a 3D surface only. Supply with z_min." + error: "Unable to prepare the graph. Use dimensions=2 with up to four expressions in x, or dimensions=3 with up to two expressions in x and y, one per line, without y=, z= or LaTeX. Supply finite, increasing axis bounds in pairs, within -1000000 to 1000000, z bounds only for 3D, and a title of at most 120 characters. Correct the arguments before retrying." remaining_bot_quota: description: | Get the current number of tokens or queries you have left for use of the bot this week diff --git a/lib/discourse_chatbot/function_plot.rb b/lib/discourse_chatbot/function_plot.rb index c4d67a70..be9c30dc 100644 --- a/lib/discourse_chatbot/function_plot.rb +++ b/lib/discourse_chatbot/function_plot.rb @@ -13,10 +13,16 @@ class FunctionPlot MAX_BOUND = 1_000_000 def self.markdown(args) + dimensions = args.fetch("dimensions", 2) + raise ArgumentError if [2, 3].exclude?(dimensions) + raise ArgumentError if dimensions == 2 && (args.key?("z_min") || args.key?("z_max")) + expressions = args.fetch("expressions").split("\n").map(&:strip).reject(&:empty?) - raise ArgumentError if expressions.empty? || expressions.length > MAX_FUNCTIONS + limit = dimensions == 3 ? 2 : MAX_FUNCTIONS + raise ArgumentError if expressions.empty? || expressions.length > limit - expressions.each { |expression| validate_expression!(expression) } + variables = dimensions == 3 ? VARIABLES + ["y"] : VARIABLES + expressions.each { |expression| validate_expression!(expression, variables) } title = args.fetch("title", "") raise ArgumentError if title.length > 120 || title.match?(/[\r\n]/) @@ -26,17 +32,21 @@ def self.markdown(args) x_domain: domain(args, "x", [-10, 10]), y_domain: domain(args, "y", [-10, 10]), } + if dimensions == 3 + graph[:dimensions] = 3 + graph[:z_domain] = domain(args, "z", [-10, 10]) + end "```function-plot\n#{JSON.generate(graph)}\n```" end - def self.validate_expression!(expression) + def self.validate_expression!(expression, variables) if expression.length > MAX_EXPRESSION_LENGTH || !expression.match?(%r{\A[0-9a-z+\-*/^().\s]+\z}i) raise ArgumentError end normalized = expression.downcase names = normalized.scan(/[a-z][a-z0-9]*/).reject { |name| name.match?(/\Ae\d+\z/) } - raise ArgumentError unless (names - FUNCTIONS - VARIABLES).empty? + raise ArgumentError unless (names - FUNCTIONS - variables).empty? depth = 0 normalized.each_char do |character| @@ -51,7 +61,7 @@ def self.validate_expression!(expression) calculator.add_function(:ceil, :numeric, ->(value) { value.ceil }) raise ArgumentError if calculator.tokenizer.tokenize(normalized).length > MAX_TOKENS node = calculator.ast(normalized) - raise ArgumentError unless (node.dependencies - VARIABLES).empty? + raise ArgumentError unless (node.dependencies - variables).empty? rescue Dentaku::Error raise ArgumentError end diff --git a/lib/discourse_chatbot/tools/function_plot.rb b/lib/discourse_chatbot/tools/function_plot.rb index e013ba7a..e1503e36 100644 --- a/lib/discourse_chatbot/tools/function_plot.rb +++ b/lib/discourse_chatbot/tools/function_plot.rb @@ -23,7 +23,12 @@ def parameters type: String, description: I18n.t("chatbot.prompt.function.function_plot.title"), }, - *%w[x_min x_max y_min y_max].map do |name| + { + name: "dimensions", + type: Numeric, + description: I18n.t("chatbot.prompt.function.function_plot.dimensions"), + }, + *%w[x_min x_max y_min y_max z_min z_max].map do |name| { name: name, type: Numeric, diff --git a/public/jsxgraph/1.14.1/LICENSE.LGPL b/public/jsxgraph/1.14.1/LICENSE.LGPL new file mode 100644 index 00000000..0a041280 --- /dev/null +++ b/public/jsxgraph/1.14.1/LICENSE.LGPL @@ -0,0 +1,165 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/public/jsxgraph/1.14.1/LICENSE.MIT b/public/jsxgraph/1.14.1/LICENSE.MIT new file mode 100644 index 00000000..56ba574a --- /dev/null +++ b/public/jsxgraph/1.14.1/LICENSE.MIT @@ -0,0 +1,26 @@ +Copyright (C) 2008-2012 + + Matthias Ehmann + Michael Gerhaeuser + Carsten Miller + Bianca Valentin + Alfred Wassermann + Peter Wilfahrt + + Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/public/jsxgraph/1.14.1/jsxgraphcore.js b/public/jsxgraph/1.14.1/jsxgraphcore.js new file mode 100644 index 00000000..f763c268 --- /dev/null +++ b/public/jsxgraph/1.14.1/jsxgraphcore.js @@ -0,0 +1,55 @@ +/* + JSXGraph 1.14.1 + + Copyright 2008-2026 + Matthias Ehmann, + Michael Gerhaeuser, + Carsten Miller, + Bianca Valentin, + Andreas Walter, + Alfred Wassermann, + Peter Wilfahrt + + This file is part of JSXGraph. + + JSXGraph is free software dual licensed under the GNU LGPL or MIT License. + + You can redistribute it and/or modify it under the terms of the + + * GNU Lesser General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version + OR + * MIT License: https://github.com/jsxgraph/jsxgraph/blob/master/LICENSE.MIT + + JSXGraph is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License and + the MIT License along with JSXGraph. If not, see + and . +*/ + +/** + * UTF-8 Decoder by Bjoern Hoehrmann + * + * Copyright (c) 2008-2009 Bjoern Hoehrmann + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the Software + * without restriction, including without limitation the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons + * to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or + * substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING + * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.JXG=e():t.JXG=e()}(Object("undefined"!=typeof self?self:this),function(){return function(){var __webpack_modules__={561:function(t,e,i){"use strict";var s,r=i(443),o="1.14.1";s={version:o,licenseText:"jsxgraph.org "+o,licenseLogo:"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48c3ZnIGlkPSJMb2dvIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxNzAuMDc4NzQwMiAxNzAuMDc4NzQwMiI+PHBhdGggZD0iTTY1LjE5NzM0NzMsMTEuMzM4NTgyN2MtOS42NjE5ODczLDAtMTguMzExMDM1Miw0LjQxNzcyNDYtMjQuMDM0NzksMTEuMzM4ODY3MmgxMDYuMjM5ODY4MnYxMDYuMjM5MDEzN2M2LjkyMDY1NDMtNS43MjM4NzcsMTEuMzM3ODkwNi0xNC4zNzI4MDI3LDExLjMzNzg5MDYtMjQuMDM0NDIzOFYxMS4zMzg1ODI3aC05My41NDI5Njg4WiIvPjxwYXRoIGQ9Ik0xMS4zMzg1ODI3LDY1LjE5Njc5OHY5My41NDM0NTdoOTMuNTQyOTY4OGMxNy4xOTMzNTk0LDAsMzEuMTgxNjQwNi0xMy45ODc3OTMsMzEuMTgxNjQwNi0zMS4xODExNTIzVjM0LjAxNTY0NTdINDIuNTIwMjIzM2MtMTcuMTkzMzU5NCwwLTMxLjE4MTY0MDYsMTMuOTg3NzkzLTMxLjE4MTY0MDYsMzEuMTgxMTUyM1pNODUuMDM5NzU0NiwxMzguODk3OTY5OUgzMS4xODEzNTYxdi01My44NTgzOTg0aDExLjMzNzg5MDZ2NDIuNTE5NTMxMmg0Mi41MjA1MDc4djExLjMzODg2NzJaTTkyLjEyNTY5MjEsNTEuMDIzNDU4MmMxNC44NDg2MzI4LDAsMjYuOTI4NzEwOSwxMi4wODA1NjY0LDI2LjkyODcxMDksMjYuOTI5MTk5MnMtMTIuMDgwMDc4MSwyNi45MjkxOTkyLTI2LjkyODcxMDksMjYuOTI5MTk5Mi0yNi45Mjg3MTA5LTEyLjA4MDU2NjQtMjYuOTI4NzEwOS0yNi45MjkxOTkyLDEyLjA4MDA3ODEtMjYuOTI5MTk5MiwyNi45Mjg3MTA5LTI2LjkyOTE5OTJaIi8+PHBhdGggZD0iTTkyLjEyNTY5MjEsOTMuNTQyOTg5NGM4LjU5NjY3OTcsMCwxNS41OTA4MjAzLTYuOTkzNjUyMywxNS41OTA4MjAzLTE1LjU5MDMzMnMtNi45OTQxNDA2LTE1LjU5MDMzMi0xNS41OTA4MjAzLTE1LjU5MDMzMi0xNS41OTA4MjAzLDYuOTkzNjUyMy0xNS41OTA4MjAzLDE1LjU5MDMzMiw2Ljk5NDE0MDYsMTUuNTkwMzMyLDE1LjU5MDgyMDMsMTUuNTkwMzMyWiIvPjwvc3ZnPg==",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},r.A.extendConstants(r.A,s),e.A=s},904:function(t,e,i){"use strict";var s=i(443),r=i(561),o=i(454),n=i(188),a=i(477);s.A.Coords=function(t,e,i,s){this.board=i,this.usrCoords=[],this.scrCoords=[],this.emitter=!n.A.exists(s)||s,this.emitter&&o.A.eventify(this),this.setCoordinates(t,e,!1,!0)},s.A.extend(s.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,s=this.usrCoords,r=i.origin.scrCoords;!0===t?(this.scrCoords[0]=e(s[0]),this.scrCoords[1]=e(s[0]*r[1]+s[1]*i.unitX),this.scrCoords[2]=e(s[0]*r[2]-s[2]*i.unitY)):(this.scrCoords[0]=s[0],this.scrCoords[1]=s[0]*r[1]+s[1]*i.unitX,this.scrCoords[2]=s[0]*r[2]-s[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,s,o=this.usrCoords,n=this.scrCoords;return t===r.A.COORDS_BY_USER?(i=e.usrCoords,(s=o[0]-i[0])*s>a.A.eps*a.A.eps?Number.POSITIVE_INFINITY:a.A.hypot(o[1]-i[1],o[2]-i[2])):(i=e.scrCoords,a.A.hypot(n[1]-i[1],n[2]-i[2]))},setCoordinates:function(t,e,i,s){var o=this.usrCoords,n=this.scrCoords,a=[o[0],o[1],o[2]],h=[n[0],n[1],n[2]];return t===r.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||s||h[1]===n[1]&&h[2]===n[2]||this.triggerEventHandlers(["update"],[a,h]),this},copy:function(t,e){return void 0===e&&(e=0),this[t].slice(e)},isReal:function(){return!isNaN(this.usrCoords[1]+this.usrCoords[2])&&Math.abs(this.usrCoords[0])>a.A.eps},__evt__update:function(t,e){},__evt:function(){}}),e.A=s.A.Coords},102:function(t,e,i){"use strict";var s=i(443),r=i(477),o=i(571),n=i(171),a=i(588),h=i(904),l=i(561),c=i(188);s.A.CoordsElement=function(t,e){var i;for(c.A.exists(t)||(t=[1,0,0]),i=0;i1)for(t=0;t=0?1:-1)*(e=Math.abs(e))/(e+1)):Math.abs(s[0])0&&Math.abs(this._smax-this._smin)>=r.A.eps&&(i=(b=Math.max(Math.min(b,1),0))*(this._smax-this._smin),b=((i=Math.round(i/v)*v+this._smin)-this._smin)/(this._smax-this._smin),this.update(!0)),s=M.point1.coords,!M.evalVisProp("straightfirst")&&Math.abs(s.usrCoords[0])>r.A.eps&&b<0&&(g=s,O=!0,b=0),n=M.point2.coords,!M.evalVisProp("straightlast")&&Math.abs(n.usrCoords[0])>r.A.eps&&b>1&&(g=n,O=!0,b=1)}else if(M.type===l.A.OBJECT_TYPE_TURTLE)this.updateConstraint(),g=(C=o.A.projectPointToTurtle(this,M,this.board))[0],b=C[1];else if(M.elementClass===l.A.OBJECT_CLASS_CURVE)if(M.type===l.A.OBJECT_TYPE_ARC||M.type===l.A.OBJECT_TYPE_SECTOR)g=o.A.projectPointToCircle(this,M,this.board),u=o.A.rad(M.radiuspoint,M.center,this),p=0,f=o.A.rad(M.radiuspoint,M.center,M.anglepoint),b=u,("minor"===(v=M.evalVisProp("selection"))&&f>Math.PI||"major"===v&&ff)&&(b=f,(u.5*p||u>f&&u>.5*f+Math.PI)&&(b=p),this.needsUpdateFromParent=!0,this.updateGliderFromParent()),x=f-p,this.visProp.isgeonext&&(x=1),Math.abs(x)>r.A.eps&&(b/=x);else if(this.updateConstraint(),M.transformations.length>0){for(E=!1,(C=M.getTransformationSource())[0]&&(E=C[0],w.push(M),w.push(C[1]));C[0]&&c.A.exists(C[1]._transformationSource);)C=C[1].getTransformationSource(),w.push(C[1]);if(P=this.coords.usrCoords,E){for(t=0;t=0;t--)P=r.A.matVecMult(w[t].transformMat,P);_[0]=new h.A(l.A.COORDS_BY_USER,P,this.board)}else M.updateTransformMatrix(),m=r.A.inverse(M.transformMat),P=r.A.matVecMult(m,P),A=new h.A(l.A.COORDS_BY_USER,P,this.board).usrCoords,_=o.A.projectCoordsToCurve(A[1],A[2],this.position||0,M,this.board);g=_[0],b=_[1]}else g=(C=o.A.projectPointToCurve(this,M,this.board))[0],b=C[1];else c.A.isPoint(M)&&(g=o.A.projectPointToPoint(this,M,this.board),b=this.position);this.coords.setCoordinates(l.A.COORDS_BY_USER,g.usrCoords,O),this.position=b},findClosestSnapValue:function(t){var e,i,s,o,n=null;if(s=this.evalVisProp("snapvalues"),o=this.evalVisProp("snapvaluedistance"),c.A.isArray(s)&&Math.abs(this._smax-this._smin)>=r.A.eps&&o>0)for(e=0;e1?(s-1)/(s-2):(1-s)/s,n=[e[0]+s*t[0],e[1]+s*t[1],e[2]+s*t[2]]):(s=this.position,n=[t[0]+s*(e[0]-t[0]),t[1]+s*(e[1]-t[1]),t[2]+s*(e[2]-t[2])]);else if(m.type===l.A.OBJECT_TYPE_TURTLE)this.coords.setCoordinates(l.A.COORDS_BY_USER,[m.Z(this.position),m.X(this.position),m.Y(this.position)]),this.updateConstraint(),n=o.A.projectPointToTurtle(this,m,this.board)[0].usrCoords;else if(m.elementClass===l.A.OBJECT_CLASS_CURVE){for(u=!1,(a=m.getTransformationSource())[0]&&(u=a[0],g.push(m),g.push(a[1]));a[0]&&c.A.exists(a[1]._transformationSource);)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,[m.Z(this.position),m.X(this.position),m.Y(this.position)]),m.type===l.A.OBJECT_TYPE_ARC||m.type===l.A.OBJECT_TYPE_SECTOR)p=o.A.rad([m.center.X()+1,m.center.Y()],m.center,m.radiuspoint),f=0,_=o.A.rad(m.radiuspoint,m.center,m.anglepoint),("minor"===m.visProp.selection&&_>Math.PI||"major"===m.visProp.selection&&__)&&(((A=_).5*f||A>_&&A>.5*_+Math.PI)&&(A=f),this.position=A,Math.abs(b)>r.A.eps&&(this.position/=b)),i=m.Radius(),n=[m.center.X()+i*Math.cos(this.position*b+p),m.center.Y()+i*Math.sin(this.position*b+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,r.A.matVecMult(g[d].transformMat,n),this.board).usrCoords;else n=o.A.projectPointToCurve(this,m,this.board)[0].usrCoords}else c.A.isPoint(m)&&(n=o.A.projectPointToPoint(this,m,this.board).usrCoords);this.coords.setCoordinates(l.A.COORDS_BY_USER,n,!1)}else this.needsUpdateFromParent=!0},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])>r.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):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,s,r,n,a,h,d,u=0,p=1/0,f=null,A=this.evalVisProp("ignoredsnaptopoints"),_=!1;if(r=this.board.objectsList.length,A&&(h=A.length),this.evalVisProp("snaptopoints")||t){for(n=this.evalVisProp("attractorunit"),a=this.evalVisProp("attractordistance"),e=0;e1?e.point2.coords:new h.A(l.A.COORDS_BY_USER,s[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)),(r="screen"===n?i.distance(l.A.COORDS_BY_SCREEN,this.coords):i.distance(l.A.COORDS_BY_USER,this.coords))=d&&(e===this.slideObject||this.slideObject&&this.onPolygon&&this.slideObject.parentPolygon===e)&&this.popSlideObject()}return this}},setPositionDirectly:function(t,e){var i,s,o,n,c,d=this.coords;if(this.relativeCoords)return s=new h.A(t,e,this.board),this.evalVisProp("islabel")?(o=a.A.subtract(s.scrCoords,d.scrCoords),this.relativeCoords.scrCoords[1]+=o[1],this.relativeCoords.scrCoords[2]+=o[2]):(o=a.A.subtract(s.usrCoords,d.usrCoords),this.relativeCoords.usrCoords[1]+=o[1],this.relativeCoords.usrCoords[2]+=o[2]),this;if(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;i0&&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,r,o=this.board.select(t),n=!1;if(o.type===l.A.OBJECT_TYPE_POLYGON){for(e=Number.MAX_VALUE,i=0;i0&&(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,s=[],r=["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"===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||"--"===i.effect)return t/a;s.A.warn("Callback moveTo(): valid effects are '==', '--', '<>', '>', and '<', given is '"+i.effect+"'. Set it to '--'"),i.effect="--"}return t/a};if(!c.A.exists(e)||0===e||Math.abs(t.usrCoords[0]-this.coords.usrCoords[0])>r.A.eps)return this.setPosition(l.A.COORDS_BY_USER,t.usrCoords),this.board.update(this);if(!c.A.exists(i.callback)&&Math.abs(f)=0;o--)d[a-o]=[t.usrCoords[0],u+f*_(o),p+A*_(o)];return this.animationPath=d,this.animationCallback=i.callback,this.board.addAnimation(this),this},visit:function(t,e,i){t=new h.A(l.A.COORDS_BY_USER,t,this.board);var r,o,n,a=this.board.attr.animationdelay,d=[],u=this.coords.usrCoords[1],p=this.coords.usrCoords[2],f=t.usrCoords[1]-u,A=t.usrCoords[2]-p,_=function(t){var e=t"===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||"--"===i.effect)return e;s.A.warn("Callback visit(): valid effects are '==', '--', '<>', '>', and '<', given is '"+i.effect+"'. Set it to '--'"),i.effect="--"}return e};for(c.A.isNumber(i)?i={repeat:i}:(i=i||{},c.A.exists(i.repeat)||(i.repeat=1)),n=Math.ceil(e/(a*i.repeat)),o=0;o=0;r--)d[o*(n+1)+n-r]=[t.usrCoords[0],u+f*_(r),p+A*_(r)];return this.animationPath=d,this.animationCallback=i.callback,this.board.addAnimation(this),this},moveAlongES6:function(t,e,i){return new Promise((s,r)=>{c.A.exists(i)&&c.A.exists(i.callback)?i.callback=s:i={callback:s},this.moveAlong(t,e,i)})},moveToES6:function(t,e,i){return new Promise((s,r)=>{c.A.exists(i)&&c.A.exists(i.callback)?i.callback=s:i={callback:s},this.moveTo(t,e,i)})},visitES6:function(t,e,i){return new Promise((s,r)=>{c.A.exists(i)&&c.A.exists(i.callback)?i.callback=s:i={callback:s},this.visit(t,e,i)})},_anim:function(t,e,i){var s,r,n,a,h,c,d,u,p;return this.intervalCount+=1,this.intervalCount>e&&(this.intervalCount=0,this.roundsCount+=1,i>0&&this.roundsCount>=i)?(this.roundsCount=0,this.stopAnimation()):(this.slideObject.elementClass===l.A.OBJECT_CLASS_LINE?(d=this.slideObject.point1.coords.scrCoords,u=this.slideObject.point2.coords.scrCoords,s=Math.round((u[1]-d[1])*this.intervalCount/e),r=Math.round((u[2]-d[2])*this.intervalCount/e),t>0?a=this.slideObject.point1:(a=this.slideObject.point2,s*=-1,r*=-1),this.coords.setCoordinates(l.A.COORDS_BY_SCREEN,[a.coords.scrCoords[1]+s,a.coords.scrCoords[2]+r])):this.slideObject.elementClass===l.A.OBJECT_CLASS_CURVE?(h=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(h),this.slideObject.Y(h)]),p=o.A.projectPointToCurve(this,this.slideObject,this.board),this.coords=p[0],this.position=p[1]):this.slideObject.elementClass===l.A.OBJECT_CLASS_CIRCLE&&(n=2*Math.PI,n*=t<0?this.intervalCount/e:(e-this.intervalCount)/e,c=this.slideObject.Radius(),this.coords.setCoordinates(l.A.COORDS_BY_USER,[this.slideObject.center.coords.usrCoords[1]+c*Math.cos(n),this.slideObject.center.coords.usrCoords[2]+c*Math.sin(n)])),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}}),s.A.CoordsElement.create=function(t,e,i,s,r,o){var n,a,h=!1;for(a=0;a0){for(n in this.board=t,this.type=i,this._org_type=i,this.elementClass=s||r.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}},s.A.extend(s.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,s;for(i=(s=d.A.isArray(t)?t:arguments).length,e=0;e0){if(n.applyOnce(a),d.A.exists(this.view)&&"view3d"===this.view.elType)for(s=0;s0&&this.transformations[this.transformations.length-1].isNumericMatrix?this.transformations[this.transformations.length-1].melt(n):this.addTransform(n);for(s=0;s=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))this.visProp[t]=e;else for(i in this.visProp[t]={},e)e.hasOwnProperty(i)&&(this.visProp[t][i.toLocaleLowerCase()]=e[i])},resolveShortcuts:function(t){var e,i,s,r=["traceattributes","traceAttributes"];for(e in h.A.shortcuts)if(h.A.shortcuts.hasOwnProperty(e)){if(d.A.exists(t[e]))for(i=0;i/g,">"),this.label.setText(t)),this},setName:function(t){t=t.replace(//g,">"),"slider"!==this.elType&&this.setLabelText(t),this.setAttribute({name:t})},setProperty:function(){s.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=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;i0&&A>0&&(u=this.board.getBoundingBox(),n=Math.round(i/f)*f,a=Math.round(o/A)*A,h=new s.A.Coords(r.A.COORDS_BY_USER,[n,a],this.board),(!_||h.distance("screen"===m?r.A.COORDS_BY_SCREEN:r.A.COORDS_BY_USER,this.coords)l-f?i+=f:i>c&&il-A?o+=A:o>c&&oa[2]?i:a[2],i=this.vertices[t].Y(),a[1]=ia[3]?i:a[3]}else if(this.elementClass===r.A.OBJECT_CLASS_CIRCLE)s=this.center.X(),o=this.center.Y(),a=[s-(n=this.Radius()),o+n,s+n,o-n];else if(this.elementClass===r.A.OBJECT_CLASS_CURVE){if(0===(e=this.points.length))return a;for(t=0;ta[2]?i:a[2],i=this.points[t].usrCoords[2],a[1]=ia[3]?i:a[3]}else this.elementClass===r.A.OBJECT_CLASS_POINT?(s=this.X(),o=this.Y(),a=[s-(n=this.evalVisProp("size"))/this.board.unitX,o-n/this.board.unitY,s+n/this.board.unitX,o+n/this.board.unitY]):this.elementClass===r.A.OBJECT_CLASS_LINE&&(i=this.point1.coords.usrCoords[1],a[0]=ia[2]?i:a[2],i=this.point1.coords.usrCoords[2],a[1]=ia[3]?i:a[3],i=this.point2.coords.usrCoords[1],a[0]=ia[2]?i:a[2],i=this.point2.coords.usrCoords[2],a[1]=ia[3]?i:a[3]);return a},addEvent:s.A.shortcut(s.A.GeometryElement.prototype,"on"),removeEvent:s.A.shortcut(s.A.GeometryElement.prototype,"off"),formatNumberLocale:function(t,e){var i,s,r,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(r in i=this.evalVisProp("intl.locale")||this.eval(this.board.attr.intl.locale),s=this.evalVisProp("intl.options")||{})s.hasOwnProperty(r)&&(n.hasOwnProperty(r)?o[n[r]]=this.eval(s[r]):o[r]=this.eval(s[r]));return r="maximumfractiondigits",d.A.exists(s[r])||(o[n[r]]=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))},methodMap:{},__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(){}}),d.A.copyMethodMap(s.A.GeometryElement,{setLabel:"setLabel",label:"label",setName:"setName",getName:"getName",Name:"getName",addTransform:"addTransform",removeTransform:"removeTransform",clearTransforms:"clearTransforms",setProperty:"setAttribute",setAttribute:"setAttribute",addChild:"addChild",animate:"animate",on:"on",off:"off",trigger:"trigger",addTicks:"addTicks",removeTicks:"removeTicks",removeAllTicks:"removeAllTicks",Bounds:"bounds"}),e.A=s.A.GeometryElement},925:function(t,e,i){"use strict";var s=i(443),r=i(561),o=i(144),n=i(86),a=i(133),h=i(188),l=i(477),c=i(102),d=function(){this._val=parseFloat(this.rendNodeRange.value),this.rendNodeOut.value=this.rendNodeRange.value,this.board.update()};s.A.Text=function(t,e,i,s){var o;this.constructor(t,i,r.A.OBJECT_TYPE_TEXT,r.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(s),this.visProp.visible=o,h.A.isString(this.content)&&this.notifyParents(this.content),this.elType="text"},s.A.Text.prototype=new o.A,h.A.copyPrototypeMethods(s.A.Text,c.A,"coordsConstructor"),h.A.copyMethodMap(s.A.Text,{setText:"setTextJessieCode",move:"setCoords",Size:"getSize",setAutoPosition:"setAutoPosition"}),s.A.extend(s.A.Text.prototype,{hasPoint:function(t,e){var i,s,r,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]),s=(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],r=(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<=o+d:e>=r-d&&e<=o+d&&(t>=i-d&&t<=i+2*d||t>=s-2*d&&t<=s+d)},_createFctUpdateText:function(t){var e,i,s,r,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(){r=t().toString(),this.plaintext=!a||l||c?r:this.replaceSub(this.replaceSup(this.convertGeonextAndSketchometry2CSS(r,!1)))};else if(h.A.isNumber(t)&&this.evalVisProp("formatnumber")?this.evalVisProp("tofraction")?this.content=l?"\\("+h.A.toFraction(t,!0)+"\\)":h.A.toFraction(t,c):(s=this.evalVisProp("digits"),this.useLocale()?this.content=this.formatNumberLocale(t,s):this.content=h.A.toFixed(t,s)):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(n=this,o=0;o=0;)(e=(t=t.slice(0,i)+t.slice(i).replace(/_\{/,"")).indexOf("}",i+4))>=0&&(t=t.slice(0,e)+t.slice(e).replace(/\}/,"")),i=t.indexOf("_{");for(i=t.indexOf("_");i>=0;)i=(t=t.slice(0,i)+t.slice(i).replace(/_(.?)/,"$1")).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(/\^\{/,"")).indexOf("}",i+4))>=0&&(t=t.slice(0,e)+t.slice(e).replace(/\}/,"")),i=t.indexOf("^{");for(i=t.indexOf("^");i>=0;)i=(t=t.slice(0,i)+t.slice(i).replace(/\^(.?)/,"$1")).indexOf("^");return t},getSize:function(){return this.size},setCoords:function(t,e){var i,s,o;return h.A.isArray(t)&&t.length>1&&(e=t[1],t=t[0]),this.evalVisProp("islabel")&&h.A.exists(this.element)?(s=(t-(i=this.element.getLabelAnchor()).usrCoords[1])*this.board.unitX,o=-(e-i.usrCoords[2])*this.board.unitY,this.relativeCoords.setCoordinates(r.A.COORDS_BY_SCREEN,[s,o])):this.coords.setCoordinates(r.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):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){return t.replace(/([)0-9.])\s*([(a-zA-Z_])/g,"$1*$2")},generateTerm:function(t,e,i){var s,r,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(//g,"∠")).replace(/<arc\s*\/>/g,"∠")).replace(/<sqrt\s*\/>/g,"√")).replace(/<value>/g,"")).replace(/<\/value>/g,"")).indexOf(""),a=t.indexOf(""),o>=0)for(;o>=0;)l+=' + "'+this.replaceSub(this.replaceSup(t.slice(0,o)))+'"',r=(r=t.slice(o+7,a)).replace(/\s+/g,""),!0===e&&(r=this.expandShortMath(r)),(s=(s=(s=i?r:n.A.geonext2JS(r,this.board)).replace(/\\"/g,"'")).replace(/\\'/g,"'")).indexOf("toFixed")<0&&h.A.isNumber(h.A.bind(this.board.jc.snippet(s,!0,"",!1),this)())?l+="+("+s+").toFixed("+this.evalVisProp("digits")+")":l+="+("+s+")",o=(t=t.slice(a+8)).indexOf(""),a=t.indexOf("");return l+=' + "'+this.replaceSub(this.replaceSup(t))+'"',l=(l=(l=this.convertGeonextAndSketchometry2CSS(l)).replace(/&/g,"&")).replace(/"/g,"'")},valueTagToJessieCode:function(t){var e,i,s,r,o=[],n='"';if(s=(t=(t=(t=(t=(t=t||"").replace(/\r/g,"")).replace(/\n/g,"")).replace(/<value>/g,"")).replace(/<\/value>/g,"")).indexOf(""),r=t.indexOf(""),s>=0)for(;s>=0;)o.push(n+this.escapeTicks(t.slice(0,s))+n),i=(i=t.slice(s+7,r)).replace(/\s+/g,""),e=(e=i=this.expandShortMath(i)).replace(/\\"/g,"'").replace(/\\'/g,"'"),o.push("("+e+")"),s=(t=t.slice(r+8)).indexOf(""),r=t.indexOf("");for(o.push(n+this.escapeTicks(t)+n),s=0;s/g,"∠").replace(/<arc\s*\/*>/g,"∠").replace(//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,"")).replace(/(<|<)\/overline(>|>)/g,"")).replace(/(<|<)arrow(>|>)/g,"")).replace(/(<|<)\/arrow(>|>)/g,"")),t},convertSketchometry2CSS:function(t,e){var i='';return h.A.isString(t)&&(e&&(i=this.escapeTicks(i),s=this.escapeTicks(s)),t=(t=(t=(t=t.replace(/(<|<)sketchoicon(>|>)/g,i)).replace(/(<|<)\/sketchoicon(>|>)/g,s)).replace(/(<|<)sketchofont(>|>)/g,i)).replace(/(<|<)\/sketchofont(>|>)/g,s)),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,"")).replace(/<\/value>/g,"");do{null!==(i=(e=/([\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},getNumberOfConflicts:function(t,e,i,s,o){o=o||[];var n,a,h,l,c,d,u,p,f=0,A=this.board.options.precision.hasPoint;for(this.board.options.precision.hasPoint=.3*(i+s),n=0;n(f[2]-f[0])*this.board.unitX||c[1]<0||c[1]>(f[1]-f[3])*this.board.unitY)&&(l-=1),l-=this.getNumberOfConflicts(i,s,d,u,h.A.evaluate(this.visProp.autopositionwhitelist)),l-=t/this.evalVisProp("autopositionmindistance")/10-.1,(n=Math.atan2(p[1],p[0]))<0&&(n+=2*Math.PI),l-=(r>0&&Math.cos(n)>0&&Math.abs(e-n)>Math.PI?Math.abs(e-n-2*Math.PI):Math.abs(e-n))/10):0},setAutoPosition:function(){var t,e,i,s,r,o,n,a,h,l,c,d=-1/0,u=this.evalVisProp("autopositionmindistance"),p=this.evalVisProp("autopositionmaxdistance"),f=this.evalVisProp("offset");if(this===this.board.infobox||!this.element||!this.visPropCalc.visible||!this.evalVisProp("islabel"))return this;if(l=Math.sqrt(f[0]*f[0]+f[1]*f[1]),c=Math.atan2(f[1],f[0]),0===this.calculateScore(l,c))return this;for(t=u,i=(p-u)/3;p-t>-.01;){for(s=0;s<60;s++)if(e=s/60*2*Math.PI,(n=this.calculateScore(t,e))>d&&(o=e,r=t,d=n),0===d){t=p;break}t+=i}return a=Math.cos(o),h=Math.sin(o),this.visProp.anchorx=a<0?"right":"left",this.visProp.anchory=h<0?"top":"bottom",this.visProp.offset=[r*a,r*h],this}}),s.A.createText=function(t,e,i){var r,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,!(r=c.A.create(s.A.Text,t,n,o,a)))throw new 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&&r.addRotation(o.rotate),r},s.A.registerElement("text",s.A.createText),s.A.createHTMLSlider=function(t,e,i){var r,o,n=h.A.copyAttributes(i,t.options,"htmlslider");if(2!==e.length||2!==e[0].length||3!==e[1].length)throw new 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=h.A.def(n.parent,n.anchor),n.fixed=h.A.def(n.fixed,!0),o=[e[0][0],e[0][1],'
'],(r=s.A.createText(t,o,n)).type=h.A.OBJECT_TYPE_HTMLSLIDER,r.rendNodeForm=r.rendNode.childNodes[0],r.rendNodeRange=r.rendNodeForm.childNodes[0],r.rendNodeRange.min=e[1][0],r.rendNodeRange.max=e[1][2],r.rendNodeRange.step=n.step,r.rendNodeRange.value=e[1][1],r.rendNodeLabel=r.rendNodeForm.childNodes[1],r.rendNodeLabel.id=r.rendNode.id+"_label",n.withlabel&&(r.rendNodeLabel.innerText=r.name+"="),r.rendNodeOut=r.rendNodeForm.childNodes[2],r.rendNodeOut.value=e[1][1];try{r.rendNodeForm.id=r.rendNode.id+"_form",r.rendNodeRange.id=r.rendNode.id+"_range",r.rendNodeOut.id=r.rendNode.id+"_out"}catch(t){s.A.debug(t)}return r.rendNodeRange.style.width=n.widthrange+"px",r.rendNodeRange.style.verticalAlign="middle",r.rendNodeOut.style.width=n.widthout+"px",r._val=e[1][1],s.A.supportsVML()?a.A.addEvent(r.rendNodeForm,"change",d,r):a.A.addEvent(r.rendNodeForm,"input",d,r),r.Value=function(){return this._val},r},s.A.registerElement("htmlslider",s.A.createHTMLSlider),e.A=s.A.Text},443:function(t,e){"use strict";var i={};try{"object"!=typeof JXG||JXG.extend||(i=JXG)}catch(t){}i.extend=function(t,e,i,s){var r;for(r in i=i||!1,s=s||!1,e)(!i||i&&e.hasOwnProperty(r))&&(t[s?r.toLowerCase():r]=e[r])},i.defineConstant=function(t,e,s,r){(r=r||!1)&&i.exists(t[e])||Object.defineProperty(t,e,{value:s,writable:!1,enumerable:!0,configurable:!1})},i.extendConstants=function(t,e,i,s){var r,o;for(r in i=i||!1,s=s||!1,e)(!i||i&&e.hasOwnProperty(r))&&(o=s?r.toUpperCase():r,this.defineConstant(t,o,e[r]))},i.extend(i,{boards:{},readers:{},elements:{},registerElement:function(t,e){t=t.toLowerCase(),this.elements[t]=e},registerReader:function(t,e){var i,s;for(i=0;ia&&(h+=Math.PI),c=Math.cos(h)+p[1],d=Math.sin(h)+p[2],new o.A(r.A.COORDS_BY_USER,[1,c,d],s))},reflection:function(t,e,i){var s,n,a,h,c,d,u=e.coords.usrCoords,p=t.point1.coords.usrCoords,f=t.point2.coords.usrCoords;return l.A.exists(i)||(i=e.board),h=f[1]-p[1],c=f[2]-p[2],s=u[1]-p[1],d=(h*(u[2]-p[2])-c*s)/(h*h+c*c),n=u[1]+2*d*c,a=u[2]-2*d*h,new o.A(r.A.COORDS_BY_USER,[n,a],i)},rotation:function(t,e,i,s){var n,a,h,c,d,u,p=e.coords.usrCoords,f=t.coords.usrCoords;return l.A.exists(s)||(s=e.board),n=p[1]-f[1],a=p[2]-f[2],d=n*(h=Math.cos(i))-a*(c=Math.sin(i))+f[1],u=n*c+a*h+f[2],new o.A(r.A.COORDS_BY_USER,[d,u],s)},perpendicular:function(t,e,i){var s,a,h,c,d,u=t.point1.coords.usrCoords,p=t.point2.coords.usrCoords,f=e.coords.usrCoords;return l.A.exists(i)||(i=e.board),e===t.point1?(s=u[1]+p[2]-u[2],a=u[2]-p[1]+u[1],d=u[0]*p[0],Math.abs(d)n.A.eps&&Math.abs(s-f[1])n.A.eps&&(Math.abs(t[0])n.A.eps?(i[1]-t[1])/s:(i[2]-t[2])/(e[2]-t[2])},sortVertices:function(t){for(var e,i=c.A.each(t,c.A.coordsArray),s=i.length,r=null;i[0][0]===i[s-1][0]&&i[0][1]===i[s-1][1]&&i[0][2]===i[s-1][2];)r=i.pop(),s--;return e=i[0],i.sort(function(t,i){return(t[2]===e[2]&&t[1]===e[1]?-1/0:Math.atan2(t[2]-e[2],t[1]-e[1]))-(i[2]===e[2]&&i[1]===e[1]?-1/0:Math.atan2(i[2]-e[2],i[1]-e[1]))}),null!==r&&i.push(r),i},signedTriangle:function(t,e,i){var s=c.A.coordsArray(t),r=c.A.coordsArray(e),o=c.A.coordsArray(i);return.5*((r[1]-s[1])*(o[2]-s[2])-(r[2]-s[2])*(o[1]-s[1]))},signedPolygon:function(t,e){var i,s,r=0,o=c.A.each(t,c.A.coordsArray);for(void 0===e&&(e=!0),e?o.unshift(o[o.length-1]):o=this.sortVertices(o),s=o.length,i=1;i1024)for(h=o=N[0][1],d=a=N[0][2],A=p=N[0][1]-N[0][2],f=u=N[0][1]+N[0][2],_=0,m=0,g=0,b=0,y=0,P=0,v=0,C=0,e=1;eh&&(h=E,m=e),(E=N[e][2])d&&(d=E,b=e),(E=N[e][1]-N[e][2])A&&(A=E,P=e),(E=N[e][1]+N[e][2])f&&(f=E,C=e);for(e=0;e=0||_!==y&&this.signedTriangle(N[_],N[y],x)>=-M||y!==b&&this.signedTriangle(N[y],N[b],x)>=-M||b!==C&&this.signedTriangle(N[b],N[C],x)>=-M||C!==m&&this.signedTriangle(N[C],N[m],x)>=-M||m!==P&&this.signedTriangle(N[m],N[P],x)>=-M||P!==g&&this.signedTriangle(N[P],N[g],x)>=-M||g!==v&&this.signedTriangle(N[g],N[v],x)>=-M||v!==_&&this.signedTriangle(N[v],N[_],x)>=-M)&&S.push({i:e,c:x});for(O=S.length,r=0,o=S[0].c[1],a=S[0].c[2],e=1;e1&&this.signedTriangle(T[i-2].c,T[i-1].c,S[e].c)<=0;)T.pop(),i--;T.push(S[e]),i++}return T},convexHull:function(t,e){var i,s,r=[];for(s=this.GrahamScan(t),i=0;iMath.PI&&(f-=2*Math.PI),null===A){if(0===f)continue;A=f>0?1:-1}else if(A*f<-_)return!1;m+=f}return Math.abs(m/(2*Math.PI))-1<_},calcStraight:function(t,e,i,s){var o,a,h,c,d,u,p,f,A,_;if(l.A.exists(s)||(s=10),u=t.evalVisProp("straightfirst"),p=t.evalVisProp("straightlast"),Math.abs(e.scrCoords[0])=n.A.eps&&e.scrCoords[1]>=0&&e.scrCoords[1]<=t.board.canvasWidth&&e.scrCoords[2]>=0&&e.scrCoords[2]<=t.board.canvasHeight,a=!p&&Math.abs(i.usrCoords[0])>=n.A.eps&&i.scrCoords[1]>=0&&i.scrCoords[1]<=t.board.canvasWidth&&i.scrCoords[2]>=0&&i.scrCoords[2]<=t.board.canvasHeight,c=(h=this.meetLineBoard(f,t.board,s))[0],d=h[1],!o&&!a){if(!u&&p&&!this.isSameDirection(e,i,c)&&!this.isSameDirection(e,i,d))return;if(u&&!p&&!this.isSameDirection(i,e,c)&&!this.isSameDirection(i,e,d))return}o?a||(_=this.isSameDir(e,i,c,d)?d:c):a?A=this.isSameDir(e,i,c,d)?c:d:this.isSameDir(e,i,c,d)?(A=c,_=d):(_=c,A=d),A&&e.setCoordinates(r.A.COORDS_BY_USER,A.usrCoords),_&&i.setCoordinates(r.A.COORDS_BY_USER,_.usrCoords)}},calcLineDelimitingPoints:function(t,e,i){var s,o,a,h,l,c,d,u,p,f,A;if(l=t.evalVisProp("straightfirst"),c=t.evalVisProp("straightlast"),Math.abs(e.scrCoords[0])=0?(a=this.projectPointToLine({coords:{usrCoords:[1,o[2],o[1]]}},t,t.board),h=this.projectPointToLine({coords:{usrCoords:[1,o[0],o[3]]}},t,t.board)):(a=this.projectPointToLine({coords:{usrCoords:[1,o[0],o[1]]}},t,t.board),h=this.projectPointToLine({coords:{usrCoords:[1,o[2],o[3]]}},t,t.board)),!f&&!A){if(!l&&!c){if(s=e.distance(r.A.COORDS_BY_USER,i),Math.abs(e.distance(r.A.COORDS_BY_USER,a)+a.distance(r.A.COORDS_BY_USER,i)-s)>n.A.eps)return;if(Math.abs(e.distance(r.A.COORDS_BY_USER,h)+h.distance(r.A.COORDS_BY_USER,i)-s)>n.A.eps)return}if(!l&&c&&!this.isSameDirection(e,i,a)&&!this.isSameDirection(e,i,h))return;if(l&&!c&&!this.isSameDirection(i,e,a)&&!this.isSameDirection(i,e,h))return}f?A||(p=this.isSameDir(e,i,a,h)?h:a):A?u=this.isSameDir(e,i,a,h)?a:h:this.isSameDir(e,i,a,h)?(u=a,p=h):(p=a,u=h),u&&e.setCoordinates(r.A.COORDS_BY_USER,u.usrCoords),p&&i.setCoordinates(r.A.COORDS_BY_USER,p.usrCoords)}},calcLabelQuadrant:function(t){return t<0&&(t+=2*Math.PI),["rt","urt","top","ulft","lft","llft","bot","lrt"][Math.floor((t+Math.PI/8)/(Math.PI/4))%8]},isSameDir:function(t,e,i,s){var r=e.usrCoords[1]-t.usrCoords[1],o=e.usrCoords[2]-t.usrCoords[2],a=s.usrCoords[1]-i.usrCoords[1],h=s.usrCoords[2]-i.usrCoords[2];return Math.abs(e.usrCoords[0])=0},isSameDirection:function(t,e,i){var s,r,o,a,h=!1;return s=e.usrCoords[1]-t.usrCoords[1],r=e.usrCoords[2]-t.usrCoords[2],o=i.usrCoords[1]-t.usrCoords[1],a=i.usrCoords[2]-t.usrCoords[2],Math.abs(s)=0&&o>=0||s<=0&&o<=0)&&(h=r>=0&&a>=0||r<=0&&a<=0),h},det3p:function(t,e,i){var s,r,o;return s=l.A.isPoint(t)?t.Coords(!0):t,r=l.A.isPoint(e)?e.Coords(!0):e,o=l.A.isPoint(i)?i.Coords(!0):i,(s[1]-o[1])*(r[2]-o[2])-(r[1]-o[1])*(s[2]-o[2])},windingNumber:function(t,e,i){var s,r,o,a,h,c,d=0,u=e.length,p=t[1],f=t[2],A=0;if(0===u)return 0;if((i=i||!1)&&(A=1),isNaN(p)||isNaN(f))return 1;if(l.A.exists(e[0].coords)?(s=e[0].coords,r=e[u-1].coords):(s=e[0],r=e[u-1]),s.usrCoords[1]===p&&s.usrCoords[2]===f)return 1;for(c=0;cp==r[1]r[2]?1:0)-1,r[1]>=p)if(o[1]>p)d+=h;else{if(0===(a=this.det3p(r,o,t)))return 0;a>0+n.A.eps==o[2]>r[2]&&(d+=h)}else o[1]>p&&(a=this.det3p(r,o,t))>0+n.A.eps==o[2]>r[2]&&(d+=h)}return d},pnpoly:function(t,e,i,s,n){var a,h,c,d,u,p,f,A,_=i,m=!1;for(s===r.A.COORDS_BY_USER?(p=(A=new o.A(r.A.COORDS_BY_USER,[t,e],n)).scrCoords[1],f=A.scrCoords[2]):(p=t,f=e),a=0,h=(u=i.length)-2;af!=d.scrCoords[2]>f&&p<(d.scrCoords[1]-c.scrCoords[1])*(f-c.scrCoords[2])/(d.scrCoords[2]-c.scrCoords[2])+c.scrCoords[1]&&(m=!m);return m},intersectionFunction:function(t,e,i,a,h,c){var d,u,p=this;return d=e.elementClass===r.A.OBJECT_CLASS_CURVE&&(e.type===r.A.OBJECT_TYPE_ARC||e.type===r.A.OBJECT_TYPE_SECTOR),u=i.elementClass===r.A.OBJECT_CLASS_CURVE&&(i.type===r.A.OBJECT_TYPE_ARC||i.type===r.A.OBJECT_TYPE_SECTOR),e.elementClass!==r.A.OBJECT_CLASS_CURVE&&i.elementClass!==r.A.OBJECT_CLASS_CURVE||e.elementClass!==r.A.OBJECT_CLASS_CURVE&&e.elementClass!==r.A.OBJECT_CLASS_CIRCLE||i.elementClass!==r.A.OBJECT_CLASS_CURVE&&i.elementClass!==r.A.OBJECT_CLASS_CIRCLE?e.elementClass===r.A.OBJECT_CLASS_CURVE&&!d&&i.elementClass===r.A.OBJECT_CLASS_LINE||i.elementClass===r.A.OBJECT_CLASS_CURVE&&!u&&e.elementClass===r.A.OBJECT_CLASS_LINE?function(){return p.meetCurveLine(e,i,a,e.board,l.A.evaluate(c))}:e.type===r.A.OBJECT_TYPE_POLYGON||i.type===r.A.OBJECT_TYPE_POLYGON?e.elementClass===r.A.OBJECT_CLASS_LINE?function(){var t,s=e.evalVisProp("straightfirst"),r=e.evalVisProp("straightlast"),o=i.evalVisProp("straightfirst"),n=i.evalVisProp("straightlast");return t=!(l.A.evaluate(c)||s&&r&&o&&n),p.meetPolygonLine(i,e,a,e.board,t)}:i.elementClass===r.A.OBJECT_CLASS_LINE?function(){var t,s=e.evalVisProp("straightfirst"),r=e.evalVisProp("straightlast"),o=i.evalVisProp("straightfirst"),n=i.evalVisProp("straightlast");return t=!(l.A.evaluate(c)||s&&r&&o&&n),p.meetPolygonLine(e,i,a,e.board,t)}:function(){return p.meetPathPath(e,i,a,e.board)}:e.elementClass===r.A.OBJECT_CLASS_LINE&&i.elementClass===r.A.OBJECT_CLASS_LINE?function(){var t,s,n=e.evalVisProp("straightfirst"),h=e.evalVisProp("straightlast"),d=i.evalVisProp("straightfirst"),u=i.evalVisProp("straightlast");return l.A.evaluate(c)||n&&h&&d&&u?p.meet(e.stdform,i.stdform,a,e.board):(t=p.meetSegmentSegment(e.point1.coords.usrCoords,e.point2.coords.usrCoords,i.point1.coords.usrCoords,i.point2.coords.usrCoords),s=!n&&t[1]<0||!h&&t[1]>1||!d&&t[2]<0||!u&&t[2]>1?[0,NaN,NaN]:t[0],new o.A(r.A.COORDS_BY_USER,s,e.board))}:function(){var t,h,f,A=p.meet(e.stdform,i.stdform,a,e.board),_=!0;return l.A.evaluate(c)?A:(e.elementClass!==r.A.OBJECT_CLASS_LINE||(t=e.evalVisProp("straightfirst"),h=e.evalVisProp("straightlast"),t&&h||(f=p.affineRatio(e.point1.coords,e.point2.coords,A),!(!h&&f>1+n.A.eps||!t&&f<0-n.A.eps))))&&(i.elementClass!==r.A.OBJECT_CLASS_LINE||(t=i.evalVisProp("straightfirst"),h=i.evalVisProp("straightlast"),t&&h||(f=p.affineRatio(i.point1.coords,i.point2.coords,A),!(!h&&f>1+n.A.eps||!t&&f<0-n.A.eps))))?d&&((_=p.coordsOnArc(e,A))&&u&&(_=p.coordsOnArc(i,A)),!_)?new o.A(s.A.COORDS_BY_USER,[0,NaN,NaN],e.board):A:new o.A(s.A.COORDS_BY_USER,[0,NaN,NaN],e.board)}:function(){return p.meetCurveCurve(e,i,a,h,e.board)}},otherIntersectionFunction:function(t,e,i,o){var n,a,h,c=this;return a=t[0],h=t[1],n=a.board,function(){var t,d,u,p,f=e.length,A=l.A.evaluate(o);for(t=f;t>=0;t--)if(a.elementClass===r.A.OBJECT_CLASS_CIRCLE&&[r.A.OBJECT_CLASS_CIRCLE,r.A.OBJECT_CLASS_LINE].indexOf(h.elementClass)>=0?u=c.meet(a.stdform,h.stdform,t,n):a.elementClass===r.A.OBJECT_CLASS_CURVE&&[r.A.OBJECT_CLASS_CURVE,r.A.OBJECT_CLASS_CIRCLE].indexOf(h.elementClass)>=0?u=c.meetCurveCurve(a,h,t,0,n):a.elementClass===r.A.OBJECT_CLASS_CURVE&&h.elementClass===r.A.OBJECT_CLASS_LINE&&(u=l.A.exists(a.dataX)?s.A.Math.Geometry.meetCurveLine(a,h,t,a.board,l.A.evaluate(i)):s.A.Math.Geometry.meetCurveLineContinuous(a,h,t,a.board)),void 0!==u){for(p=!1,d=0;!p&&dMath.PI||"major"===o&&rr)},meet:function(t,e,i,s){var r=n.A.eps;return Math.abs(t[3])=r&&Math.abs(e[3])=r?this.meetLineCircle(t,e,i,s):this.meetCircleCircle(t,e,i,s)},meetLineBoard:function(t,e,i){var s,a,h,c,d=[];for(l.A.exists(i)||(i=0),d[0]=n.A.crossProduct(t,[i,0,1]),d[1]=n.A.crossProduct(t,[i,1,0]),d[2]=n.A.crossProduct(t,[-i-e.canvasHeight,0,1]),d[3]=n.A.crossProduct(t,[-i-e.canvasWidth,1,0]),h=0;h<4;h++)if(Math.abs(d[h][0])>n.A.eps){for(c=2;c>0;c--)d[h][c]/=d[h][0];d[h][0]=1}return Math.abs(d[1][0])e.canvasHeight?d[2]:d[3]):d[1][2]>e.canvasHeight?(s=d[2],a=d[3][2]<0?d[0]:d[3]):(s=d[1],a=d[3][2]<0?d[0]:d[3][2]>e.canvasHeight?d[2]:d[3]),[new o.A(r.A.COORDS_BY_SCREEN,s.slice(1),e),new o.A(r.A.COORDS_BY_SCREEN,a.slice(1),e)]},meetLineLine:function(t,e,i,s){var a=isNaN(t[5]+e[5])?[0,0,0]:n.A.crossProduct(t,e);return Math.abs(a[0])<1e-14&&(a[0]=0),new o.A(r.A.COORDS_BY_USER,a,s)},meetLineCircle:function(t,e,i,s){var a,h,c,d,u,p,f,A,_;return e[4]-n.A.eps*n.A.eps?(_=[(-f+(A=Math.sqrt(Math.abs(A))))/(2*p),(-f-A)/(2*p)],0===l.A.evaluate(i)?new o.A(r.A.COORDS_BY_USER,[-_[0]*-u[1]-d*u[0],-_[0]*u[0]-d*u[1]],s):new o.A(r.A.COORDS_BY_USER,[-_[1]*-u[1]-d*u[0],-_[1]*u[0]-d*u[1]],s)):new o.A(r.A.COORDS_BY_USER,[0,0,0],s))},meetCircleCircle:function(t,e,i,s){var a;return t[4]i[1]+n.A.eps||as[1]+n.A.eps||r&&(of+p||a_+p)?[l,o,a,1e4]:[l,o,a,c[1]]},_meetCurveCurveIterative:function(t,e,i,s,r,o){var a,h,c,d,u,p,f,A,_,m,g=100*n.A.eps,b=[];if(c=i[0],u=i[1],d=s[0],p=s[1],ur))return b;return b},meetCurveCurve:function(t,e,i,s,n,a,c){var d,u,p,f,A,_,m=l.A.evaluate(i);return n=n||t.board,"segment"===a||l.A.exists(t.dataX)||l.A.exists(e.dataX)?this.meetCurveCurveDiscrete(t,e,m,n):l.A.exists(a)&&"newton"===a&&m<0||parseInt(m)!==m?(d=h.A.generalizedNewton(t,e,m,s),new o.A(r.A.COORDS_BY_USER,d,n)):(p=t.minX(),f=t.maxX(),A=e.minX(),_=e.maxX(),(u=this._meetCurveCurveIterative(t,e,[p,f],[A,_],m,c)).length>m?(d=t.Ft(u[m]),new o.A(r.A.COORDS_BY_USER,d,n)):[0,NaN,NaN])},meetCurveLine:function(t,e,i,s,o){var n,a;return l.A.exists(s)||(s=t.board),t.elementClass===r.A.OBJECT_CLASS_CURVE?(n=t,a=e):(n=e,a=t),l.A.exists(n.dataX)?this.meetCurveLineDiscrete(n,a,i,s,!o):this.meetCurveLineContinuous(n,a,i,s,!o)},meetCurveLineContinuous:function(t,e,i,s,a){var l,c,d,u,p,f,A,_,m,g,b,v,y,C=n.A.eps,P=n.A.eps;for(u=this.meetCurveLineDiscrete(t,e,i,s,a),p=u.usrCoords[1],f=u.usrCoords[2],l=function(e){var i,s;return e>t.maxX()||eP?0:1,new o.A(r.A.COORDS_BY_USER,[A,t.X(d),t.Y(d)],s)},meetCurveLineDiscrete:function(t,e,i,s,a){var h,c,d,u,p,f,A,_=l.A.evaluate(i),m=e.point1.coords.usrCoords,g=e.point2.coords.usrCoords,b=0,v=t.numberPoints,y=e.evalVisProp("straightfirst"),C=e.evalVisProp("straightlast");for(f=new o.A(r.A.COORDS_BY_USER,[0,NaN,NaN],s),0===m[0]?m=[1,g[1]+e.stdform[2],g[2]-e.stdform[1]]:0===g[0]&&(g=[1,m[1]+e.stdform[2],m[2]-e.stdform[1]]),u=t.points[0].usrCoords,h=1;hn.A.eps)for(A=3===t.bezierDegree?this.meetBeziersegmentBeziersegment([t.points[h-1].usrCoords.slice(1),t.points[h].usrCoords.slice(1),t.points[h+1].usrCoords.slice(1),t.points[h+2].usrCoords.slice(1)],[m.slice(1),g.slice(1)],a):[this.meetSegmentSegment(d,u,m,g)],c=0;c1)?f:f=new o.A(r.A.COORDS_BY_USER,p[0],s);b+=1}return f},meetCurveRedBlueSegments:function(t,e,i){var s,r,o,n,a,h,c,d,u,p=l.A.evaluate(i),f=0,A=e.numberPoints,_=t.numberPoints;if(A<=1||_<=1)return[0,NaN,NaN];for(s=1;s<_;s++)for(o=t.points[s-1].usrCoords,n=t.points[s].usrCoords,d=Math.min(o[1],n[1]),u=Math.max(o[1],n[1]),h=e.points[0].usrCoords,r=1;rd&&(c=this.meetSegmentSegment(o,n,a,h))[1]>=0&&c[2]>=0&&(c[1]<1&&c[2]<1||s===_-1&&1===c[1]||r===A-1&&1===c[2])){if(f===p)return c[0];f++}return[0,NaN,NaN]},meetSegmentSegment:function(t,e,i,s){var r,o,a,h=n.A.crossProduct(t,e),l=n.A.crossProduct(i,s),c=n.A.crossProduct(h,l);return Math.abs(c[0])0&&this.distance(h[0].coords.usrCoords,h[d-1].coords.usrCoords,3)0&&this.distance(c[0].coords.usrCoords,c[d-1].coords.usrCoords,3)=0&&h[2]<1)&&h[1]>=0&&h[1]<1&&f.push(h[0]);return d>=0&&d=e[0]&&t[0]<=e[2]&&t[1]>=e[3]&&t[3]<=e[1]},_bezierListConcat:function(t,e,i,s){var r,o=l.A.exists(s),n=0,a=e.length,h=t.length;for(h>0&&a>0&&(1===t[h-1][1]&&0===e[0][1]||o&&1===t[h-1][2]&&0===e[0][2])&&(n=1),r=n;r=0&&c[2]>=0&&c[1]<=1&&c[2]<=1?[c]:[]):[]},_bezierLineMeetSubdivision:function(t,e,i,s){var r,o,n,a,h,l,c,d,u,p,f=[];return r=this._bezierBbox(e),o=this._bezierBbox(t),s&&!this._bezierOverlap(o,r)?[]:i<5?(a=(n=this._bezierSplit(t))[0],h=n[1],this._bezierListConcat(f,this._bezierLineMeetSubdivision(a,e,i+1),0),this._bezierListConcat(f,this._bezierLineMeetSubdivision(h,e,i+1),.5),f):(u=[1].concat(t[0]),p=[1].concat(t[3]),c=[1].concat(e[0]),d=[1].concat(e[1]),(l=this.meetSegmentSegment(u,p,c,d))[1]>=0&&l[1]<=1&&(!s||l[2]>=0&&l[2]<=1)?[l]:[])},meetBeziersegmentBeziersegment:function(t,e,i){var s,r,o;for((s=4===t.length&&4===e.length?this._bezierMeetSubdivision(t,e,0):this._bezierLineMeetSubdivision(t,e,0,i)).sort(function(t,e){return 1e7*(t[1]-e[1])+(t[2]-e[2])}),r=[],o=0;o1+n.A.eps||c[2]<-n.A.eps||c[2]>1+n.A.eps||C.push(c);if(C.length>b)return C[b][0]}return C.length>b?C[b][0]:[0,NaN,NaN]},bezierSegmentEval:function(t,e){var i,s,r,o=1-t;return s=0,r=0,s+=(i=o*o*o)*e[0][0],r+=i*e[0][1],s+=(i=3*t*o*o)*e[1][0],r+=i*e[1][1],s+=(i=3*t*t*o)*e[2][0],r+=i*e[2][1],[1,s+=(i=t*t*t)*e[3][0],r+=i*e[3][1]]},bezierArc:function(t,e,i,s,r){var o,a,h,c,d,u,p,f,A,_,m,g,b,v,y,C,P,E,x=e[1],O=e[2],M=e[0],w=[],S=[];for(d=this.distance(e,t),x/=M,O/=M,u=this.rad(t.slice(1),e.slice(1),i.slice(1)),-1===r&&(u=2*Math.PI-u),f=u/4,(o=t)[1]/=o[0],o[2]/=o[0],o[0]/=o[0],c=o.slice(0),s?(w=[x,x+.333*(o[1]-x),x+.666*(o[1]-x),o[1]],S=[O,O+.333*(o[2]-O),O+.666*(o[2]-O),o[2]]):(w=[o[1]],S=[o[2]]);u>n.A.eps;)u>f?(p=f,u-=f):(p=u,u=0),E=[[1,0,0],[x*(1-(A=Math.cos(r*p)))+O*(_=Math.sin(r*p)),A,-_],[O*(1-A)-x*_,_,A]],c=[(C=n.A.matVecMult(E,o))[0]/C[0],C[1]/C[0],C[2]/C[0]],m=o[1]-x,g=o[2]-O,b=c[1]-x,v=c[2]-O,P=n.A.hypot(m+b,g+v),y=Math.abs(v-g)>n.A.eps?(m+b)*(d/P-.5)/(v-g)*8/3:(g+v)*(d/P-.5)/(m-b)*8/3,a=[1,o[1]-y*g,o[2]+y*m],h=[1,c[1]+y*v,c[2]-y*b],l.A.concat(w,[a[1],h[1],c[1]]),l.A.concat(S,[a[2],h[2],c[2]]),o=c.slice(0);return s&&(l.A.concat(w,[c[1]+.333*(x-c[1]),c[1]+.666*(x-c[1]),x]),l.A.concat(S,[c[2]+.333*(O-c[2]),c[2]+.666*(O-c[2]),O])),[w,S]},projectPointToCircle:function(t,e,i){var s,a,h,c,d,u=e.center.coords.usrCoords;return l.A.exists(i)||(i=t.board),l.A.isPoint(t)?(s=t.coords.distance(r.A.COORDS_BY_USER,e.center.coords),a=t.coords.usrCoords):(s=t.distance(r.A.COORDS_BY_USER,e.center.coords),a=t.usrCoords),Math.abs(s)1)for(_=[1,t,e],3===s.bezierDegree?u=0:b=[s.Z(0),s.X(0),s.Y(0)],d=0;d1&&d===s.numberPoints-2&&(m=v,f=this.distance(m,_),g=s.numberPoints-1),fk?1/0:(r=t-s.X(i))*r+(o=e-s.Y(i))*o},x=C(i),M=(N-T)/50,P=T,d=0;d<50;d++)((E=C(P))k?k:i,c=new o.A(r.A.COORDS_BY_USER,[s.X(i),s.Y(i)],n)}return[s.updateTransform(c),i]},projectCoordsToPolygon:function(t,e){var i,r,o,n,a,h=e.vertices.length,l=1/0;for(i=0;ic&&((l=(s*o+r*a)/h)<0?l=0:l>1&&(l=1),s-=l*o,r-=l*a),n.A.hypot(s,r)},intersectionFunction3D:function(t,e,i){var s,o=this;return e.type===r.A.OBJECT_TYPE_PLANE3D?i.type===r.A.OBJECT_TYPE_PLANE3D?s=t.intersectionPlanePlane(e,i):i.type===r.A.OBJECT_TYPE_SPHERE3D&&(s=o.meetPlaneSphere(e,i)):e.type===r.A.OBJECT_TYPE_SPHERE3D&&(i.type===r.A.OBJECT_TYPE_PLANE3D?s=o.meetPlaneSphere(i,e):i.type===r.A.OBJECT_TYPE_SPHERE3D&&(s=o.meetSphereSphere(e,i))),s},meet3Planes:function(t,e,i,s,r,o){var a,h,l,c,d,u=[1,0,0,0];for(a=n.A.crossProduct(r.slice(1),t.slice(1)),h=n.A.crossProduct(t.slice(1),i.slice(1)),l=n.A.crossProduct(i.slice(1),r.slice(1)),c=n.A.innerProduct(t.slice(1),l,3),d=0;d<3;d++)u[d+1]=(e*l[d]+s*a[d]+o*h[d])/c;return u},meetPlanePlane:function(t,e,i,s){var r,o,a,h;return a=t.slice(1),h=e.slice(1),r=n.A.crossProduct(a,h),a=i.slice(1),h=s.slice(1),o=n.A.crossProduct(a,h),(h=n.A.crossProduct(r,o)).unshift(0),h},meetPlaneSphere:function(t,e){var i=function(){return n.A.innerProduct(t.normal,e.center.coords,4)-t.d};return[function(){return n.A.axpy(-i(),t.normal,e.center.coords)},t.normal,function(){var t=e.Radius(),s=i();return Math.sqrt(t*t-s*s)}]},meetSphereSphere:function(t,e){var i=function(){var i=t.center.distance(e.center),s=t.Radius(),r=e.Radius();return(s-r)*(s+r)/(i*i)};return[function(){var s=i();return[1,.5*((1-s)*t.center.coords[1]+(1+s)*e.center.coords[1]),.5*((1-s)*t.center.coords[2]+(1+s)*e.center.coords[2]),.5*((1-s)*t.center.coords[3]+(1+s)*e.center.coords[3])]},function(){return a.A.subtract(e.center.coords,t.center.coords)},function(){var s=t.center.distance(e.center),r=t.Radius(),o=e.Radius(),n=i(),a=.5*(r*r+o*o-.5*s*s*(1+n*n));return Math.sqrt(a)}]},_paramsOutOfRange:function(t,e,i){return t[0]e[1]||t.length>1&&(t[1]i[1])},projectCoordsToParametric:function(t,e,i,s){var r,o,a,h,c,d=.01*Math.random()+.5,u=2*i;return 1===i?r=.1*((h=[l.A.evaluate(e.range[0]),l.A.evaluate(e.range[1])])[1]-h[0]):2===i&&(h=[l.A.evaluate(e.range_u[0]),l.A.evaluate(e.range_u[1])],c=[l.A.evaluate(e.range_v[0]),l.A.evaluate(e.range_v[1])],r=.1*Math.min(h[1]-h[0],c[1]-c[0])),o=r/5e6,a=function(i,s,r,o){var n=[1,e.X.apply(e,r),e.Y.apply(e,r),e.Z.apply(e,r)],a=t[1]-n[1],l=t[2]-n[2],d=t[3]-n[3];return s>=2&&(o[0]=r[0]-h[0],o[1]=-r[0]+h[1]),s>=4&&(o[2]=r[1]-c[0],o[3]=-r[1]+c[1]),a*a+l*l+d*d},0===s.length?(s[0]=d*(h[0]+h[1]),2===i&&(s[1]=d*(c[0]+c[1]))):(s[0]=s[0]<=h[0]?h[0]+n.A.eps:s[0],s[0]=s[0]>=h[1]?h[1]-n.A.eps:s[0],2===i&&(s[1]=s[1]<=c[0]?c[0]+n.A.eps:s[1],s[1]=s[1]>=c[1]?c[1]-n.A.eps:s[1])),n.A.Nlp.FindMinimum(a,i,u,s,r,o,0,200),t=[1,e.X.apply(e,s),e.Y.apply(e,s),e.Z.apply(e,s)],this._paramsOutOfRange(s,h,c)&&(s[0]=s[0]<=h[0]?h[0]+n.A.eps:s[0],s[0]=s[0]>=h[1]?h[1]-n.A.eps:s[0],2===i&&(s[1]=s[1]<=c[0]?c[0]+n.A.eps:s[1],s[1]=s[1]>=c[1]?c[1]-n.A.eps:s[1]),n.A.Nlp.FindMinimum(a,i,u,s,r,o,0,200)),[1,e.X.apply(e,s),e.Y.apply(e,s),e.Z.apply(e,s)]},projectScreenCoordsToParametric:function(t,e,i,s){var r,o,a,h,c,d=i.length;return 1===d?r=.1*((a=[l.A.evaluate(e.range[0]),l.A.evaluate(e.range[1])])[1]-a[0]):2===d&&(a=[l.A.evaluate(e.range_u[0]),l.A.evaluate(e.range_u[1])],h=[l.A.evaluate(e.range_v[0]),l.A.evaluate(e.range_v[1])],r=.1*Math.min(a[1]-a[0],h[1]-h[0])),o=r/5e6,c=function(i,s,r,o){var n=[1,e.X.apply(e,r),e.Y.apply(e,r),e.Z.apply(e,r)],l=e.view.project3DTo2D(n),c=t[0]-l[1],d=t[1]-l[2];return 1===i?(o[0]=r[0]-a[0],o[1]=-r[0]+a[1]):2===i&&(o[0]=r[0]-a[0],o[1]=-r[0]+a[1],o[2]=r[1]-h[0],o[3]=-r[1]+h[1]),c*c+d*d},s?(n.A.Nlp.FindMinimum(c,d,0,i,r,o,0,200),i[0]=(i[0]+20*a[1])%(a[1]-a[0]),2===d&&(i[1]=(i[1]+20*h[1])%(h[1]-h[0]))):n.A.Nlp.FindMinimum(c,d,2*d,i,r,o,0,200),[1,e.X.apply(e,i),e.Y.apply(e,i),e.Z.apply(e,i)]},project3DTo3DPlane:function(t,e,i){var s,r;return i=i||[0,0,0],s=n.A.norm(e),r=(n.A.innerProduct(t,e,3)-n.A.innerProduct(i,e,3))/s,n.A.axpy(-r,e,t)},getPlaneBounds:function(t,e,i,s,r){var o,n,a,l,c;return t[2]+e[0]!==0?(a=[[t[0],e[0]],[t[1],e[1]]],l=[s-i[0],s-i[1]],o=(c=h.A.Gauss(a,l))[0],n=c[1],l=[r-i[0],r-i[1]],[o,(c=h.A.Gauss(a,l))[0],n,c[1]]):null},reuleauxPolygon:function(t,e){var i,s=2*Math.PI,r=s/e,o=(e-1)/2,a=0,h=function(h,l){return function(c,d){var u=(c%s+s)%s,p=Math.floor(u/r)%e;return d||(a=t[0].Dist(t[o]),i=n.A.Geometry.rad([t[0].X()+1,t[0].Y()],t[0],t[o%e])),isNaN(p)?p:(u=.5*u+p*r*.5+i,t[p][h]()+a*Math[l](u))}};return[h("X","cos"),h("Y","sin"),0,s]}}),e.A=n.A.Geometry},733:function(t,e,i){"use strict";var s=i(443),r=i(477),o=i(188);s.A.Math.DoubleBits=function(){var t,e,i,s,r,o,n,a,h=new Float64Array(1),l=new Uint32Array(h.buffer);void 0!==Float64Array&&(h[0]=1,1072693248===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]},s=function(t){return h[0]=t,l[1]},this.doubleBits=t,this.pack=e,this.lo=i,this.hi=s):1072693248===l[0]&&(r=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=r,this.pack=o,this.lo=n,this.hi=a))},s.A.extend(s.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),s=1048575&i;return 2146435072&i&&(s+=1<<20),[e,s]},denormalized:function(t){return!(2146435072&this.hi(t))}});var n=new s.A.Math.DoubleBits,a=function(t,e){if(void 0!==t&&void 0!==e){if(r.A.IntervalArithmetic.isInterval(t)){if(!r.A.IntervalArithmetic.isSingleton(t))throw new TypeError("JXG.Math.IntervalArithmetic: interval `lo` must be a singleton");this.lo=t.lo}else this.lo=t;if(r.A.IntervalArithmetic.isInterval(e)){if(!r.A.IntervalArithmetic.isSingleton(e))throw new 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}};s.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(r.A.IntervalArithmetic.prev(t),r.A.IntervalArithmetic.next(e))},boundedSingleton:function(t){return this.bounded(t,t)},assign:function(t,e){if("number"!=typeof t||"number"!=typeof e)throw new 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(Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY)},setWhole:function(){return this.set(Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY)},open:function(t,e){return this.assign(r.A.IntervalArithmetic.next(t),r.A.IntervalArithmetic.prev(e))},halfOpenLeft:function(t,e){return this.assign(r.A.IntervalArithmetic.next(t),e)},halfOpenRight:function(t,e){return this.assign(t,r.A.IntervalArithmetic.prev(e))},toArray:function(){return[this.lo,this.hi]},clone:function(){return(new a).set(this.lo,this.hi)}}),s.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,s,r,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,s=t.hi,r=e.lo,n=e.hi,h=new a,i<0?s>0?r<0?n>0?(h.lo=Math.min(this.mulLo(i,n),this.mulLo(s,r)),h.hi=Math.max(this.mulHi(i,r),this.mulHi(s,n))):(h.lo=this.mulLo(s,r),h.hi=this.mulHi(i,r)):n>0?(h.lo=this.mulLo(i,n),h.hi=this.mulHi(s,n)):(h.lo=0,h.hi=0):r<0?n>0?(h.lo=this.mulLo(i,n),h.hi=this.mulHi(i,r)):(h.lo=this.mulLo(s,n),h.hi=this.mulHi(i,r)):n>0?(h.lo=this.mulLo(i,n),h.hi=this.mulHi(s,r)):(h.lo=0,h.hi=0):s>0?r<0?n>0?(h.lo=this.mulLo(s,r),h.hi=this.mulHi(s,n)):(h.lo=this.mulLo(s,r),h.hi=this.mulHi(i,n)):n>0?(h.lo=this.mulLo(i,r),h.hi=this.mulHi(s,n)):(h.lo=0,h.hi=0):(h.lo=0,h.hi=0),h)},div: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)?this.EMPTY.clone():this.zeroIn(e)?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():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,s=t.hi,r=e.lo,o=e.hi,n=new a;return s<0?o<0?(n.lo=this.divLo(s,r),n.hi=this.divHi(i,o)):(n.lo=this.divLo(i,r),n.hi=this.divHi(s,o)):i<0?o<0?(n.lo=this.divLo(s,o),n.hi=this.divHi(i,o)):(n.lo=this.divLo(i,r),n.hi=this.divHi(s,r)):o<0?(n.lo=this.divLo(s,o),n.hi=this.divHi(i,r)):(n.lo=this.divLo(i,o),n.hi=this.divHi(s,r)),n},divPositive:function(t,e){return 0===t.lo&&0===t.hi?t:this.zeroIn(t)?this.WHOLE:t.hi<0?new a(Number.NEGATIVE_INFINITY,this.divHi(t.hi,e)):new a(this.divLo(t.lo,e),Number.POSITIVE_INFINITY)},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),Number.POSITIVE_INFINITY):new a(Number.NEGATIVE_INFINITY,this.divHi(t.lo,e))},divZero:function(t){return 0===t.lo&&0===t.hi?t:this.WHOLE},fmod:function(t,e){var i,s;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,s=(s=t.lo/i)<0?Math.ceil(s):Math.floor(s),this.sub(t,this.mul(e,new a(s))))},multiplicativeInverse:function(t){return o.A.isNumber(t)&&(t=this.Interval(t)),this.isEmpty(t)?this.EMPTY.clone():this.zeroIn(t)?0!==t.lo?0!==t.hi?this.WHOLE:new a(Number.NEGATIVE_INFINITY,this.divHi(1,t.lo)):0!==t.hi?new a(this.divLo(1,t.hi),Number.POSITIVE_INFINITY):this.EMPTY.clone():new a(this.divLo(1,t.hi),this.divHi(1,t.lo))},pow:function(t,e){var i,s;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}return 0===e?0===t.lo&&0===t.hi?this.EMPTY.clone():this.ONE.clone():e<0?this.pow(this.multiplicativeInverse(t),-e):e%1==0?t.hi<0?(i=this.powLo(-t.hi,e),s=this.powHi(-t.lo,e),1&~e?new a(i,s):new a(-s,-i)):t.lo<0?1&~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)):new a(this.powLo(t.lo,e),this.powHi(t.hi,e)):(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,s,r,n,h;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?this.EMPTY.clone():(s=this.powHi(-t.lo,i),r=this.powLo(-t.hi,i),new a(-s,-r)):t.lo<0?(n=this.powHi(t.hi,i),e%1!=0||1&~e?new a(0,n):(h=-this.powHi(-t.lo,i),new a(h,n))):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){var e;return o.A.isNumber(t)&&(t=this.Interval(t)),this.isEmpty(t)?this.EMPTY.clone():(e=t.lo<=0?Number.NEGATIVE_INFINITY:this.logLo(t.lo),new a(e,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),s=this.isEmpty(e);return i&&s?this.EMPTY.clone():i?e.clone():s?t.clone():new a(Math.min(t.lo,e.lo),Math.max(t.hi,e.hi))},intersection:function(t,e){var i,s;return this.isEmpty(t)||this.isEmpty(e)?this.EMPTY.clone():(i=Math.max(t.lo,e.lo))<=(s=Math.min(t.hi,e.hi))?new a(i,s):this.EMPTY.clone()},union:function(t,e){if(!this.intervalsOverlap(t,e))throw new 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=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),s=this.isEmpty(e);return i&&s?this.EMPTY.clone():i?e.clone():s?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),s=this.isEmpty(e);return i&&s?this.EMPTY.clone():i?e.clone():s?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,s,r,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,s=this.fmod(e,i),this.width(s)>=i.lo?new a(-1,1):s.lo>=this.piHigh?(r=this.cos(this.sub(s,this.PI)),this.negative(r)):(o=s.lo,n=s.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,s;return this.isEmpty(t)||this.onlyInfinity(t)?this.EMPTY.clone():(e=(new a).set(t.lo,t.hi),this._handleNegative(e),s=this.PI,(i=this.fmod(e,s)).lo>=this.piHalfLow&&(i=this.sub(i,s)),i.lo<=-this.piHalfLow||i.hi>=this.piHalfLow?this.WHOLE.clone():new a(this.tanLo(i.lo),this.tanHi(i.hi)))},asin:function(t){var e,i;return this.isEmpty(t)||t.hi<-1||t.lo>1?this.EMPTY.clone():(e=t.lo<=-1?-this.piHalfHigh:this.asinLo(t.lo),i=t.hi>=1?this.piHalfHigh:this.asinHi(t.hi),new a(e,i))},acos:function(t){var e,i;return this.isEmpty(t)||t.hi<-1||t.lo>1?this.EMPTY.clone():(e=t.hi>=1?0:this.acosLo(t.hi),i=t.lo<=-1?this.piHigh:this.acosHi(t.lo),new a(e,i))},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.hie.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.hie.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:3.141592653589793,piHigh:3.1415926535897936,piHalfLow:1.5707963267948966,piHalfHigh:1.5707963267948968,piTwiceLow:6.283185307179586,piTwiceHigh:6.283185307179587,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(r.A.acot(t))},acotHi:function(t){return this.next(r.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(r.A.sinh(t))},sinhHi:function(t){return this.next(r.A.sinh(t))},coshLo:function(t){return this.prev(r.A.cosh(t))},coshHi:function(t){return this.next(r.A.cosh(t))},tanhLo:function(t){return this.prev(r.A.tanh(t))},tanhHi:function(t){return this.next(r.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,e>>=1;e>0;)t=this.mulLo(t,t),1&~e||(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,e>>=1;e>0;)t=this.mulHi(t,t),1&~e||(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:Math.pow(2,-1074),UINT_MAX:-1>>>0,nextafter:function(t,e){var i,s;return isNaN(t)||isNaN(e)?NaN:t===e?t:0===t?e<0?-this.SMALLEST_DENORM:this.SMALLEST_DENORM:(s=n.hi(t),i=n.lo(t),e>t==t>0?i===this.UINT_MAX?(s+=1,i=0):i+=1:0===i?(i=this.UINT_MAX,s-=1):i-=1,n.pack(i,s))}},s.A.Math.IntervalArithmetic.PI=new a(r.A.IntervalArithmetic.piLow,r.A.IntervalArithmetic.piHigh),s.A.Math.IntervalArithmetic.PI_HALF=new a(r.A.IntervalArithmetic.piHalfLow,r.A.IntervalArithmetic.piHalfHigh),s.A.Math.IntervalArithmetic.PI_TWICE=new a(r.A.IntervalArithmetic.piTwiceLow,r.A.IntervalArithmetic.piTwiceHigh),s.A.Math.IntervalArithmetic.ZERO=new a(0),s.A.Math.IntervalArithmetic.ONE=new a(1),s.A.Math.IntervalArithmetic.WHOLE=(new a).setWhole(),s.A.Math.IntervalArithmetic.EMPTY=(new a).setEmpty(),e.A=s.A.Math.IntervalArithmetic},477:function(t,e,i){"use strict";var s,r=i(443),o=i(188),n=function(t){var e,i;return t.memo||(e={},i=Array.prototype.join,t.memo=function(){var r=i.call(arguments);return e[r]!==s?e[r]:e[r]=t.apply(this,arguments)}),t.memo};r.A.Math={eps:1e-6,relDif:function(t,e){var i=Math.abs(t),s=Math.abs(e);return 0===(s=Math.max(i,s))?0:Math.abs(t-e)/s},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,s){var r=.5*(e+i),o=.5*s;return this.clamp(this.wrap(t,r-o,r+o),e,i)},vector:function(t,e){var i,s;for(e=e||0,i=[],s=0;s0?e[0].length:0,h=e.length,l=this.matrix(n,a);for(i=0;i0?t[0].length:0,n=this.matrix(r,o);for(i=0;i0?t[0].length:0,n=this.matrix(r,o);for(i=0;i0?t[0].length:0,e=this.matrix(o,r),i=0;ia&&(a=Math.abs(d[e][i]),o=e);if(a<=l)return r.A.warn("JXG.Math.inverse: singular matrix"),[];if(o>i){for(s=0;s0?t[0].length:0))return NaN;for(e=0;et||e<0)return NaN;if(e=Math.round(e),t=Math.round(t),0===e||e===t)return 1;for(i=1,s=0;s=0?.5:-.5)*Math.PI-Math.atan(t)},nthroot:function(t,e){var i;return e<=0||Math.floor(e)!==e?NaN:(i=1/e,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?1:0:Math.floor(e)===e?Math.pow(t,e):t>0?Math.exp(e*Math.log(t)):NaN},ratpow:function(t,e,i){var s;return 0===e?1:0===i?NaN:(s=this.gcd(e,i),this.nthroot(this.pow(t,e/s),i/s))},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)?e<=0||Math.abs(e-1)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,s=1e5;if(t=Math.abs(t),e=Math.abs(e),!o.A.isNumber(t)||!o.A.isNumber(e))return NaN;if(isNaN(t)||isNaN(e)||t===1/0||e===1/0)return NaN;if(0===t||0===e)return NaN;if(!Number.isInteger(t)||!Number.isInteger(e))return r.A.warn("JSXGraph: JXG.Math.gcd requires integer parameters"),NaN;for(e>t&&(i=t,t=e,e=i);s>0;){if(0===(t%=e))return e;if(0===(e%=t))return t;s--}},lcm:function(t,e){var i;return o.A.isNumber(t)&&o.A.isNumber(e)?isNaN(t)||isNaN(e)||Math.abs(t)===1/0||Math.abs(e)===1/0?NaN:0===t||0===e?0:Number.isInteger(t)&&Number.isInteger(e)?0!==(i=t*e)?i/this.gcd(t,e):0:(r.A.warn("JSXGraph: JXG.Math.gcd requires integer parameters"),NaN):NaN},roundToStep:function(t,e,i,s){var n,a,h=t;if(!o.A.exists(e)&&!o.A.exists(i)&&!o.A.exists(s))return h;if(r.A.exists(s)&&(h=Math.min(h,s)),r.A.exists(i)&&(h=Math.max(h,i)),a=i||0,r.A.exists(e)){if(n=(h-a)/e,Number.isInteger(n))return h;h=a+(n=Math.round(n))*e}return r.A.exists(s)&&(h=Math.min(h,s)),r.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,s;for(e=arguments.length,t=0,s=0;t0?1:t<0?0:.5},gamma:function(t){var e,i,s,r,o,n=[1,676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,1.5056327351493116e-7];if(t<.5)i=Math.PI/(Math.sin(Math.PI*t)*this.gamma(1-t));else{for(t-=1,e=n[0],o=n.length,r=1;re},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,s,r,n,a,h,l,c,d,u=0;for(e=o.A.def(e,.001),s=(t=1e-12*Math.round(1e12*t))<0?-1:1,t=Math.abs(t),i=Math.floor(t),t-=Math.floor(t),h=1,n=a=r=0,d=0,l=c=1;t-Math.floor(t)>e&&u<20;)t=1/(t-r),n=h+(r=Math.floor(t))*a,l=d+r*c,h=a,d=c,a=n,c=l,u++;return[s,i,n,l]},normalize:function(t){var e,i,s=2*t[3],r=t[4]/s;return t[5]=r,t[6]=-t[1]/s,t[7]=-t[2]/s,isFinite(r)?Math.abs(r)>=1?(t[0]=(t[6]*t[6]+t[7]*t[7]-r*r)/(2*r),t[1]=-t[6]/r,t[2]=-t[7]/r,t[3]=1/(2*r),t[4]=1):(i=r<=0?-1:1,t[0]=i*(t[6]*t[6]+t[7]*t[7]-r*r)*.5,t[1]=-i*t[6],t[2]=-i*t[7],t[3]=i/2,t[4]=i*r):(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,s;if(e="function"==typeof Float32Array?new Float32Array(16):new Array(16),4!==t.length&&4!==t[0].length)return e;for(i=0;i<4;i++)for(s=0;s<4;s++)e[i+4*s]=t[i][s];return e},Vieta:function(t){var e,i,s,r=t.length,o=[];for(o=t.slice(),e=1;e=1;--i)o[i]+=o[i-1]*s;o[0]+=s}return o}},e.A=r.A.Math},171:function(t,e,i){"use strict";var s=i(443),r=i(188),o=i(133),n=i(477),a={rk4:{s:4,A:[[0,0,0,0],[.5,0,0,0],[0,.5,0,0],[0,0,1,0]],b:[1/6,1/3,1/3,1/6],c:[0,.5,.5,1]},heun:{s:2,A:[[0,0],[1,0]],b:[.5,.5],c:[0,1]},euler:{s:1,A:[[0]],b:[1],c:[0]}};n.A.Numerics={Gauss:function(t,e){var i,s,o,a,h,l=n.A.eps,c=t.length>0?t[0].length:0;if(c!==e.length||c!==t.length)throw new Error("JXG.Math.Numerics.Gauss: Dimensions don't match. A must be a square matrix and b must be of the same length as A.");for(a=[],h=e.slice(0,c),i=0;is;i--)if(Math.abs(a[i][s])>l)if(Math.abs(a[s][s])0?t[0].length:0,n=r-1;n>=0;n--){for(a=o-1;a>n;a--)s[n]-=t[n][a]*s[a];s[n]/=t[n][n]}return s},gaussBareiss:function(t){var e,i,s,r,o,a,h,l,c,d=n.A.eps;if((h=t.length)<=0)return 0;for(t[0].length=d);r++);if(r===h)return 0;for(o=e;oc&&(c=r),l+=r,r>=d){for(r=.5*Math.atan2(2*A[e][i],A[e][e]-A[i][i]),o=Math.sin(r),a=Math.cos(r),s=0;sd&&_<2e3);return[A,f]},NewtonCotes:function(t,e,i){var s,o,n,a=0,h=i&&r.A.isNumber(i.number_of_nodes)?i.number_of_nodes:28,l={trapez:!0,simpson:!0,milne:!0},c=i&&i.integration_type&&l.hasOwnProperty(i.integration_type)&&l[i.integration_type]?i.integration_type:"milne",d=(t[1]-t[0])/h;switch(c){case"trapez":for(a=.5*(e(t[0])+e(t[1])),s=t[0],o=0;o0)throw new Error("JSXGraph: INT_SIMPSON requires config.number_of_nodes dividable by 2.");for(n=h/2,a=e(t[0])+e(t[1]),s=t[0],o=0;o0)throw new Error("JSXGraph: Error in INT_MILNE: config.number_of_nodes must be a multiple of 4");for(n=.25*h,a=7*(e(t[0])+e(t[1])),s=t[0],o=0;o=0;--c)d*=4,f[c]=f[c+1]+(f[c+1]-f[c])/(d-1),A=f[c];if(Math.abs(A-_)18&&(A=18),p[2]=[.5773502691896257],f[2]=[1],p[4]=[.33998104358485626,.8611363115940526],f[4]=[.6521451548625461,.34785484513745385],p[6]=[.2386191860831969,.6612093864662645,.932469514203152],f[6]=[.46791393457269104,.3607615730481386,.17132449237917036],p[8]=[.1834346424956498,.525532409916329,.7966664774136267,.9602898564975363],f[8]=[.362683783378362,.31370664587788727,.22238103445337448,.10122853629037626],p[10]=[.14887433898163122,.4333953941292472,.6794095682990244,.8650633666889845,.9739065285171717],f[10]=[.29552422471475287,.26926671930999635,.21908636251598204,.1494513491505806,.06667134430868814],p[12]=[.1252334085114689,.3678314989981802,.5873179542866175,.7699026741943047,.9041172563704749,.9815606342467192],f[12]=[.24914704581340277,.2334925365383548,.20316742672306592,.16007832854334622,.10693932599531843,.04717533638651183],p[14]=[.10805494870734367,.31911236892788974,.5152486363581541,.6872929048116855,.827201315069765,.9284348836635735,.9862838086968123],f[14]=[.2152638534631578,.2051984637212956,.18553839747793782,.15720316715819355,.12151857068790319,.08015808715976021,.03511946033175186],p[16]=[.09501250983763744,.2816035507792589,.45801677765722737,.6178762444026438,.755404408355003,.8656312023878318,.9445750230732326,.9894009349916499],f[16]=[.1894506104550685,.18260341504492358,.16915651939500254,.14959598881657674,.12462897125553388,.09515851168249279,.062253523938647894,.027152459411754096],p[18]=[.0847750130417353,.2518862256915055,.41175116146284263,.5597708310739475,.6916870430603532,.8037049589725231,.8926024664975557,.9558239495713977,.9915651684209309],f[18]=[.1691423829631436,.16427648374583273,.15468467512626524,.14064291467065065,.12255520671147846,.10094204410628717,.07642573025488905,.0497145488949698,.02161601352648331],p[3]=[0,.7745966692414834],f[3]=[.8888888888888888,.5555555555555556],p[5]=[0,.5384693101056831,.906179845938664],f[5]=[.5688888888888889,.47862867049936647,.23692688505618908],p[7]=[0,.4058451513773972,.7415311855993945,.9491079123427585],f[7]=[.4179591836734694,.3818300505051189,.27970539148927664,.1294849661688697],p[9]=[0,.3242534234038089,.6133714327005904,.8360311073266358,.9681602395076261],f[9]=[.3302393550012598,.31234707704000286,.26061069640293544,.1806481606948574,.08127438836157441],p[11]=[0,.26954315595234496,.5190961292068118,.7301520055740494,.8870625997680953,.978228658146057],f[11]=[.2729250867779006,.26280454451024665,.23319376459199048,.18629021092773426,.1255803694649046,.05566856711617366],p[13]=[0,.2304583159551348,.44849275103644687,.6423493394403402,.8015780907333099,.9175983992229779,.9841830547185881],f[13]=[.2325515532308739,.22628318026289723,.2078160475368885,.17814598076194574,.13887351021978725,.09212149983772845,.04048400476531588],p[15]=[0,.20119409399743451,.3941513470775634,.5709721726085388,.7244177313601701,.8482065834104272,.937273392400706,.9879925180204854],f[15]=[.2025782419255613,.19843148532711158,.1861610000155622,.16626920581699392,.13957067792615432,.10715922046717194,.07036604748810812,.03075324199611727],p[17]=[0,.17848418149584785,.3512317634538763,.5126905370864769,.6576711592166907,.7815140038968014,.8802391537269859,.9506755217687678,.9905754753144174],f[17]=[.17944647035620653,.17656270536699264,.16800410215645004,.15404576107681028,.13513636846852548,.11188384719340397,.08503614831717918,.0554595293739872,.02414830286854793],s=t[0],o=t[1],a=A+1>>1,c=p[A],d=f[A],l=.5*(o-s),h=.5*(o+s),1&~A)for(u=0,n=0;n20041683600089728e-310&&(r=50*o*e)>t&&(t=r),t},_gaussKronrod:function(t,e,i,s,r,o,n){var a,h,l,c,d,u,p,f,A,_,m,g=t[0],b=t[1],v=.5*(g+b),y=.5*(b-g),C=Math.abs(y),P=e(v),E=0,x=P*o[i-1],O=Math.abs(x),M=0,w=[],S=[];for(i%2==0&&(E=P*r[i/2-1]),a=Math.floor((i-1)/2),d=0;d0&&t>this.elist[this.order[a-1]];)this.order[a]=this.order[a-1],a--;for(r=oi-2&&e>=this.elist[this.order[s]];)this.order[s+1]=this.order[s],s--;this.order[s+1]=o,h=this.order[a],this.i=h,this.nrmax=a},set_initial_result:function(t,e){this.size=1,this.rlist[0]=t,this.elist[0]=e},update:function(t,e,i,s,r,o,n,a){var h=this.i,l=this.size,c=this.level[this.i]+1;a>s?(this.alist[h]=r,this.rlist[h]=n,this.elist[h]=a,this.level[h]=c,this.alist[l]=t,this.blist[l]=e,this.rlist[l]=i,this.elist[l]=s,this.level[l]=c):(this.blist[h]=e,this.rlist[h]=i,this.elist[h]=s,this.level[h]=c,this.alist[l]=r,this.blist[l]=o,this.rlist[l]=n,this.elist[l]=a,this.level[l]=c),this.size++,c>this.maximum_level&&(this.maximum_level=c),this.qpsrt()},retrieve:function(){var t=this.i;return{a:this.alist[t],b:this.blist[t],r:this.rlist[t],e:this.elist[t]}},sum_results:function(){var t,e=this.size,i=0;for(t=0;tE.limit&&s.A.warn("iteration limit exceeds available workspace"),M<=0&&(O<50*n.A.eps||O<5e-29)&&s.A.warn("tolerance cannot be acheived with given epsabs and epsrel"),h=w.apply(this,[t,e,S]),l=S.abserr,c=S.resabs,d=S.resasc,E.set_initial_result(h,l),u=Math.max(M,O*Math.abs(h)),l<=11102230246251565e-30*c&&l>u)return s.A.warn("cannot reach tolerance because of roundoff error on first attempt"),-1/0;if(l<=u&&l!==d||0===l)return h;if(1===x)return s.A.warn("a maximum of one iteration was insufficient"),-1/0;o=h,a=l,T=1;do{L=0,R=0,B=0,I=0,j=0,Y=0,m=(C=E.retrieve()).a,g=C.b,b=C.r,v=C.e,p=m,A=f=.5*(m+g),_=g,L=w.apply(this,[[p,f],e,S]),I=S.abserr,y=S.resasc,R=w.apply(this,[[A,_],e,S]),a+=(Y=I+(j=S.abserr))-v,o+=(B=L+R)-b,y!==I&&S.resasc!==j&&(P=b-B,Math.abs(P)<=1e-5*Math.abs(B)&&Y>=.99*v&&N++,T>=10&&Y>v&&D++),a>(u=Math.max(M,O*Math.abs(o)))&&((N>=6||D>=20)&&(k=2),E.subinterval_too_small(p,A,_)&&(k=3)),E.update(p,f,L,I,A,_,R,j),m=(C=E.retrieve()).a,g=C.b,b=C.r,v=C.e,T++}while(Tu);return E.sum_results()},I:function(t,e){return this.Qag(t,e,{q:this.GaussKronrod15,limit:15,epsrel:1e-7,epsabs:1e-7})},Newton:function(t,e,i){var s,o=0,a=n.A.eps,h=t.apply(i,[e]);for(r.A.isArray(e)&&(e=e[0]);o<50&&Math.abs(h)>a;)s=this.D(t,i)(e),Math.abs(s)>a?e-=h/s:e+=.2*Math.random()-1,h=t.apply(i,[e]),o+=1;return e},root:function(t,e,i){return this.chandrupatla(t,e,i)},generalizedNewton:function(t,e,i,s){var r,o,a,h,l,c,d,u,p,f,A,_,m,g,b=0;for(r=i,o=s,f=(d=t.X(r)-e.X(o))*d+(u=t.Y(r)-e.Y(o))*u,A=this.D(t.X,t),_=this.D(e.X,e),m=this.D(t.Y,t),g=this.D(e.Y,e);f>n.A.eps&&b<10;)a=A(r),h=-_(o),l=m(r),r-=((c=-g(o))*d-h*u)/(p=a*c-h*l),o-=(a*u-l*d)/p,f=(d=t.X(r)-e.X(o))*d+(u=t.Y(r)-e.Y(o))*u,b+=1;return Math.abs(r)o&&y<40;)l=(v=b(a,h))[0][0],c=v[0][1],d=v[1][0],a-=r*((u=v[1][1])*p-c*f)/(A=l*u-c*d),h-=r*(l*f-d*p)/A,m=t.Ft(a),g=e.Ft(h),_=(p=m[1]-g[1])*p+(f=m[2]-g[2])*f,y+=1;return[a,h,_]},generalizedDampedNewton:function(t,e,i,s,r,o,a){var h,l,c,d,u,p,f,A,_,m,g,b,v=[],y=0;if(a=a||40,_=t(v=s.slice(0,i),i),2===i){for(g=(p=(_=t(v,i))[0])*p+(f=_[1])*f;g>o&&yo&&y=0;s--)d[s]=(a[s]-l[s+1]*d[s+1])/n[s];for(s=o-3;s>=0;s--)d[s+1]=d[s];return d[0]=0,d[o-1]=0,d},splineEval:function(t,e,i,s){var o,n,a,h,l,c,d,u=Math.min(e.length,i.length),p=1,f=!1,A=[];for(r.A.isArray(t)?(p=t.length,f=!0):t=[t],o=0;oe[u-1])return NaN;for(n=1;n=0;o--)r.A.concat(n,["(",t[o].toPrecision(s),")"]),o>1?r.A.concat(n,["*",i,"",o,"<","/sup> + "]):1===o&&r.A.concat(n,["*",i," + "]);return n.join("")},lagrangePolynomial:function(t){var e=[],i=this,s=function(i,s){var r,o,n,a,h=t.length,l=0,c=0;if(!s)for(r=0;r0?u:"-"+-u,f=!1):c+=u>0?" + "+u:" - "+-u,l-d>1?c+=r+i+"^"+(l-d):l-d===1&&(c+=r+i));return c}},lagrangePolynomialCoefficients:function(t){return function(){var e,i,s,r,o=t.length,a=[],h=[],l=[];for(i=0;i=v?t[v-1][e]():(d=Math.floor(r))===r?t[d][e]():(r-=d,void 0===(u=l[e][d])?NaN:((u[3]*r+u[2])*r+u[1])*r+u[0]))}},[o("X"),o("Y"),0,function(){return t.length-1}]},CatmullRomSpline:function(t,e){return this.CardinalSpline(t,.5,e)},regressionPolynomial:function(t,e,i){var s,o,a,h,l,c,d="";if(r.A.isPoint(t)&&r.A.isFunction(t.Value))o=function(){return t.Value()};else if(r.A.isFunction(t))o=t;else{if(!r.A.isNumber(t))throw new Error("JSXGraph: Can't create regressionPolynomial from degree of type'"+typeof t+"'.");o=function(){return t}}if(3===arguments.length&&r.A.isArray(e)&&r.A.isArray(i))l=0;else if(2===arguments.length&&r.A.isArray(e)&&e.length>0&&r.A.isPoint(e[0]))l=1;else{if(!(2===arguments.length&&r.A.isArray(e)&&e.length>0&&e[0].usrCoords&&e[0].scrCoords))throw new Error("JSXGraph: Can't create regressionPolynomial. Wrong parameters.");l=2}return(c=function(t,c){var u,p,f,A,_,m,g,b,v,y=e.length;if(v=Math.floor(o()),!c){if(1===l)for(a=[],h=[],u=0;u=0;u--)b=b*t+s[u];return b}).getTerm=function(){return d},c},bezier:function(t){var e,i,s=function(s){return function(r,o){var n=3*Math.floor(r),a=r%1,h=1-a;return o||(i=3*Math.floor((t.length-1)/3),e=Math.floor(i/3)),r<0?t[0][s]():r>=e?t[i][s]():isNaN(r)?NaN:h*h*(h*t[n][s]()+3*a*t[n+1][s]())+(3*h*t[n+2][s]()+a*t[n+3][s]())*a*a}};return[s("X"),s("Y"),0,function(){return Math.floor(t.length/3)}]},bspline:function(t,e){var i,s=function(s){return function(r,o){var n,a,h,l,c=t.length,d=c-1,u=e;if(d<=0)return NaN;if(d+2<=u&&(u=d+1),r<=0)return t[0][s]();if(r>=d-u+2)return t[d][s]();for(h=Math.floor(r)+u-1,i=function(t,e){var i,s=[];for(i=0;i=s?0:l[o+1],h=e[o+r-1]-e[o],l[o]=0===h?0:(t-e[o])/h*n,0!==(h=e[o+r]-e[o+1])&&(l[o]+=(e[o+r]-t)/h*a);return l}(r,i,u,h),n=0,a=h-u+1;a<=h;a++)a=0&&(n+=t[a][s]()*l[a]);return n}};return[s("X"),s("Y"),0,function(){return t.length-1}]},D:function(t,e){return r.A.exists(e)?function(i,s){var r=1e-5;return(t.apply(e,[i+r,s])-t.apply(e,[i-r,s]))/2e-5}:function(e,i){var s=1e-5;return(t(e+s,i)-t(e-s,i))/2e-5}},_riemannValue:function(t,e,i,s){var r,o,n,a;if(s<0&&("trapezoidal"!==i&&(t+=s),s*=-1,"lower"===i?i="upper":"upper"===i&&(i="lower")),a=.01*s,"right"===i)r=e(t+s);else if("middle"===i)r=e(t+.5*s);else if("left"===i||"trapezoidal"===i)r=e(t);else if("lower"===i){for(r=e(t),n=t+a;n<=t+s;n+=a)(o=e(n))r&&(r=o);(o=e(t+s))>r&&(r=o)}else r="random"===i?e(t+s*Math.random()):"simpson"===i?(e(t)+4*e(t+.5*s)+e(t+s))/6:e(t);return r},riemann:function(t,e,i,s,o){var n,a,h,l,c,d,u,p,f,A,_,m,g,b,v=[],y=[],C=s,P=0;if(r.A.isArray(t)?(b=t[0],g=t[1]):g=t,(e=Math.floor(e))<=0)return[v,y,P];for(a=(o-s)/e,n=0;n0)return r.A.isArray(e)?this.fminbr(t,[s,o],i):this.Newton(t,s,i);for(a=s,c=h;P=m&&Math.abs(h)>Math.abs(l)&&(_=a-o,s===a?(g=_*(f=l/h),b=1-f):(g=(A=l/h)*(_*(b=h/c)*(b-(f=l/c))-(o-s)*(f-1)),b=(b-1)*(f-1)*(A-1)),g>0?b=-b:g=-g,g<.75*_*b-.5*Math.abs(m*b)&&g0?m:-m),s=o,h=l,o+=v,((l=t.call(i,o))>0&&c>0||l<0&&c<0)&&(a=s,c=h),P++}return o},chandrupatla:function(t,e,i){var s,o,a,h,l,c,d,u,p,f,A,_,m,g,b,v,y,C,P,E,x=0,O=this.maxIterationsRoot,M=1+.001*Math.random(),w=.5*M,S=n.A.eps;if(r.A.isArray(e)){if(e.length<2)throw new Error("JXG.Math.Numerics.fzero: length of array x0 has to be at least two.");s=e[0],a=t.call(i,s),o=e[1],h=t.call(i,o)}else s=(l=this.findBracket(t,e,i))[0],a=l[1],o=l[2],h=l[3];if(a*h>0)return r.A.isArray(e)?this.fminbr(t,[s,o],i):this.Newton(t,s,i);c=s,d=o,f=a,A=h;do{if(p=c+w*(d-c),m=t.call(i,p),Math.sign(m)===Math.sign(f)?(u=c,c=p,_=f,f=m):(u=d,d=c,_=A,A=f),g=c=p,b=f=m,Math.abs(A).5||0===b)break;y=(c-d)/(u-d),C=(f-A)/(_-A),P=1-Math.sqrt(1-y),E=Math.sqrt(y),(w=P1-v&&(w=1-v),x++}while(x<=O);return g},findDomain:function(t,e,i,s){var o,n,a,h,l,c,d=1-1/1.61803398875;if(void 0===s&&(s=!0),!r.A.isArray(e)||e.length<2)throw new Error("JXG.Math.Numerics.findDomain: length of array x0 has to be at least two.");if(o=(l=e.slice())[0],n=l[1],h=t.call(i,o),isNaN(h)){for(c=0;n-o>.001&&c<20;)a=(n-o)*d+o,h=t.call(i,a),isNaN(h)?o=a:n=a,c++;l[0]=s?o:n}if(o=l[0],n=l[1],h=t.call(i,n),isNaN(h)){for(c=0;n-o>.001&&c<20;)a=n-(n-o)*d,h=t.call(i,a),isNaN(h)?n=a:o=a,c++;l[1]=s?n:o}return l},fminbr:function(t,e,i){var s,o,a,h,l,c,d,u,p,f,A,_,m,g,b,v,y,C=.5*(3-Math.sqrt(5)),P=n.A.eps,E=n.A.eps,x=this.maxIterationsMinimize,O=0;if(!r.A.isArray(e)||e.length<2)throw new Error("JXG.Math.Numerics.fminbr: length of array x0 has to be at least two.");for(a=h=(s=(p=this.findDomain(t,e,i))[0])+C*((o=p[1])-s),l=h,c=d=t.call(i,h),u=d;O=_&&(g=(a-h)*(b=(a-h)*(c-u))-(a-l)*(v=(a-l)*(c-d)),(b=2*(b-v))>0?g=-g:b=-b,Math.abs(g)b*(s-a+2*_)&&g0?_:-_),v=a+m,(y=t.call(i,v))<=c?(v0;r--)o.mult(e),o.add(s.A.C.mult(t[r],r));else for(o=s.A.C.copy(t[n]),r=n-1;r>=0;r--)o.mult(e),o.add(t[r]);return o},p=function(t,e,i){var r,o,n=t.length-1;if(i=i||!1)for(o=s.A.C.mult(n,t[0]),r=n-1;r>0;r--)o.mult(e),o.add(s.A.C.mult(t[n-r],r));else for(o=s.A.C.copy(t[0]),r=n-1;r>=0;r--)o.mult(e),o.add(t[n-r]);return o},f=function(t,e){var i,s,r=t.length-1;for(s=t[r],i=r-1;i>=0;i--)s=s*e+t[i];return s};for(i=i||Number.EPSILON,r=r||30,a=t.length,s.A.isNumber(e)&&e>=0&&e=0&&(0===l[n].real&&0===l[n].imaginary);n--)l.pop();if(0===(a=l.length))return[];if(o)for(n=0;n1?(h=s.A.C.div(1,r[n]),(_=p(t,h,!0)).div(p(t,h)),_.mult(h),c=s.A.C.sub(v,_),c=s.A.C.div(r[n],c)):c.div(u(t,r[n],!0)),d=new s.A.Complex(0),a=0;ae.real?1:0}),d},_RDPfindSplit:function(t,e,i,s){var r,o,a,h,l,c,d,u,p,f,A,_=n.A.eps*n.A.eps,m=1e4,g=0,b=e;if(i-e<2)return[-1,0];if(s?(a=t[e].usrCoords,h=t[i].usrCoords):(a=t[e].scrCoords,h=t[i].scrCoords),isNaN(a[1])||isNaN(a[2]))return[NaN,e];if(isNaN(h[1])||isNaN(h[2]))return[NaN,i];for(f=(u=(u=(u=h[1]-a[1])===1/0?m:u)===-1/0?-m:u)*u+(p=(p=(p=h[2]-a[2])===1/0?m:p)===-1/0?-m:p)*p,o=e+1;o_&&((A=(c*u+d*p)/f)<0?A=0:A>1&&(A=1),c-=A*u,d-=A*p),(r=c*c+d*d)>g&&(g=r,b=o)}return[Math.sqrt(g),b]},_RDP:function(t,e,i,s,r,o){var n,a=this._RDPfindSplit(t,e,i,o),h=a[1];if(isNaN(a[0])){this._RDP(t,e,h-1,s,r,o),r.push(t[h]);do{n=++h>i||void 0===t[h]||void 0===t[h].usrCoords||(o?isNaN(t[h].usrCoords[1]+t[h].usrCoords[2]):isNaN(t[h].scrCoords[1]+t[h].scrCoords[2]))}while(h<=i&&n);h<=i&&r.push(t[h]),this._RDP(t,h+1,i,s,r,o)}else a[0]>s?(this._RDP(t,e,h,s,r,o),this._RDP(t,h,i,s,r,o)):r.push(t[i])},RamerDouglasPeucker:function(t,e,i){var s,r,o,n=[],a=[];for(o=t.length,s=0;;){for(;ss&&(a=[t[s]],this._RDP(t,s,r,e,a,i),n=n.concat(a)),s>=o)break;re;)p.sort(function(t,e){return e.v-t.v}),u[i=p.pop().idx].used=!1,n=u[i].node.v,a=u[i].lft,h=u[i].rt,u[a].rt=h,u[h].lft=a,null!==(l=u[a].lft)&&(o=Math.abs(s.A.Math.Numerics.det([t[l].usrCoords,t[a].usrCoords,t[h].usrCoords])),u[a].node.v=o>=n?o:n),null!==(c=u[h].rt)&&(o=Math.abs(s.A.Math.Numerics.det([t[a].usrCoords,t[h].usrCoords,t[c].usrCoords])),u[h].node.v=o>=n?o:n);f=[t[i=0]];do{i=u[i].rt,f.push(t[i])}while(null!==u[i].rt);return f}},e.A=n.A.Numerics},588:function(t,e,i){"use strict";var s=i(443),r=i(477),o=i(188);r.A.Statistics={sum:function(t){var e,i=t.length,s=0;for(e=0;e0?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)]:.5*(e[.5*i-1]+e[.5*i])):0},_getPercentiles:function(t,e){var i,s,r,o,n=[];for(o=t.length,i=0;i=d[0]-c&&h<=d[2]+c?r.push(h):n.push(h);return d.unshift(this.min(r)),d.push(this.max(r)),d.push(n),d},variance:function(t){var e,i,s,r=t.length;if(r>1){for(e=this.mean(t),i=0,s=0;s0?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,s;if(o.A.isArray(t))if(t.map)s=t.map(Math.abs);else for(i=t.length,s=[],e=0;er.A.eps&&(o[i]=(t[i].usrCoords[2]-t[e].usrCoords[2])/(t[i].usrCoords[1]-t[e].usrCoords[1]));s[e]=this.median(o),n.push(t[e].usrCoords[2]-s[e]*t[e].usrCoords[1])}return[this.median(n),this.median(s),-1]},generateGaussian:function(t,e){var i,s,r;if(this.hasSpare)return this.hasSpare=!1,this.spare*e+t;do{r=(i=2*Math.random()-1)*i+(s=2*Math.random()-1)*s}while(r>=1||0===r);return r=Math.sqrt(-2*Math.log(r)/r),this.spare=s*r,this.hasSpare=!0,t+e*i*r},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 s,r,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{s=Math.random();do{r=Math.random()}while(0===r);s=h);return e*o+i}do{n=Math.tan(Math.PI*Math.random()),(o=Math.sqrt(2*t-1)*n+t-1)>0&&(r=Math.random())}while(o<=0||r>(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){return t<=0||e<=0?NaN:this.randomChisquare(t)*e/(this.randomChisquare(e)*t)},randomT:function(t){var e,i;return t<=0?NaN:(e=this.randomNormal(0,1),i=this.randomChisquare(t),e/Math.sqrt(i/t))},randomBinomial:function(t,e){var i,s,r,o,n;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().5)return t-this.randomBinomial(t,1-e);if(t<100){if(i=-1,s=0,0===(r=Math.log(1-e)))return 0;do{i+=1,s+=Math.floor(Math.log(Math.random())/r)+1}while(s=e?this.randomBinomial(o-1,e/i):o+this.randomBinomial(n-1,(e-i)/(1-i));return i},randomGeometric:function(t){var e;return t<0||t>1?NaN:(e=Math.random(),Math.ceil(Math.log(e)/Math.log(1-t)))},randomPoisson:function(t){var e,i,s=Math.exp(-t),r=0,o=1;if(t<=0)return NaN;if(t<10){do{o*=Math.random(),r+=1}while(o>s);e=r-1}else r=Math.floor(7/8*t),e=(i=this.randomGamma(r))t+e)return NaN;for(s=i;h*s>0;)r=Math.random(),h-=Math.floor(r+h/(n+s)),s-=1;return o=a-h,t<=e?o:i-o},histogram:function(t,e){var i,r,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=0&&o',scale:.85,id:null},ignoreLabels:!0,intl:{enabled:!1},jxgbox:{id:"jxgbox",outerbox:null,cssStyle:"width: 500px; aspect-ratio: 1/1; overflow: visible",cssClass:"jxgbox"},keepAspectRatio:!1,keyboard:{enabled:!0,dx:10,dy:10,panShift:!0,panCtrl:!1},logging:{enabled:!1},minimizeReflow:"none",maxBoundingBox:[-1/0,1/0,1/0,-1/0],maxFrameRate:40,maxNameLength:1,moveTarget:null,offsetX:0,offsetY:0,pan:{enabled:!0,needShift:!0,needTwoFingers:!1},registerEvents:!0,renderer:"auto",resize:{enabled:!0,throttle:10},screenshot:{scale:1,type:"png",symbol:"⌘",css:"background-color:#eeeeee; opacity:1.0; border:2px solid black; border-radius:10px; text-align:center",cssButton:"padding: 4px 10px; border: solid #356AA0 1px; border-radius: 5px; position: absolute; right: 2ex; top: 2ex; background-color: rgba(255, 255, 255, 0.3);"},selection:{enabled:!1,name:"selectionPolygon",needShift:!1,needCtrl:!0,fillColor:"#ffff00",visible:!1,withLines:!1,vertices:{visible:!1}},sketches:{enabled:!1,0:{visible:!0},1:{visible:!0}},showClearTraces:!1,showCopyright:!0,showFullscreen:!1,showInfobox:!0,showLogo:!1,showNavigation:!0,showReload:!1,showScreenshot:!1,showZoom:!0,takeFirst:!1,takeSizeFromFile:!1,theme:"default",title:"",zoom:{enabled:!0,factorX:1.25,factorY:1.25,wheel:!0,needShift:!0,center:"auto",min:1e-4,max:1e4,pinch:!0,pinchHorizontal:!0,pinchVertical:!0,pinchSensitivity:7},zoomX:1,zoomY:1},navbar:{strokeColor:"#333333",fillColor:"transparent",highlightFillColor:"#aaaaaa",padding:"2px",position:"absolute",fontSize:"14px",cursor:"pointer",zIndex:"100",right:"5px",bottom:"5px"},elements:{aria:{enabled:!1,label:"",live:"assertive"},clip:!0,cssClass:"",highlightCssClass:"",dash:0,dashScale:!1,draft:{draft:!1,strokeColor:"#565656",fillColor:"#565656",strokeOpacity:.8,fillOpacity:.8,strokeWidth:1},dragToTopOfLayer:!1,element3D:null,fillColor:"black",fillOpacity:1,fixed:!1,frozen:!1,gradient:null,gradientAngle:0,gradientCX:.5,gradientCY:.5,gradientEndOffset:1,gradientFX:.5,gradientFY:.5,gradientFR:0,gradientR:.5,gradientSecondColor:"#ffffff",gradientSecondOpacity:1,gradientStartOffset:0,highlight:!0,highlightFillColor:"none",highlightFillOpacity:1,highlightStrokeColor:"#c3d9ff",highlightStrokeOpacity:1,highlightStrokeWidth:2,isLabel:!1,layer:0,lineCap:"butt",needsRegularUpdate:!0,nonnegativeOnly:!1,precision:"inherit",priv:!1,rotatable:!0,scalable:!0,shadow:{enabled:!1,color:[0,0,0],opacity:1,blur:3,blend:.1,offset:[5,5]},snapToGrid:!1,strokeColor:n.A.palette.blue,strokeOpacity:1,strokeWidth:2,tabindex:-1,trace:!1,traceAttributes:{},transitionDuration:100,transitionProperties:["fill","fill-opacity","stroke","stroke-opacity","stroke-width"],visible:!0,withLabel:!1,ignoreForLabelAutoposition:!1},ticks:{generateLabelText:null,generateLabelValue:null,drawLabels:!1,label:{tabindex:null,layer:7,highlight:!1,autoPosition:!1},beautifulScientificTickLabels:!1,useUnicodeMinus:!0,anchor:"left",drawZero:!1,insertTicks:!1,minTicksDistance:10,minorHeight:4,majorHeight:10,tickEndings:[1,1],majorTickEndings:[1,1],ignoreInfiniteTickEndings:!0,minorTicks:4,ticksPerLabel:!1,scale:1,scaleSymbol:"",labels:[],maxLabelLength:5,precision:3,digits:3,ticksDistance:1,face:"|",strokeOpacity:1,strokeWidth:1,strokeColor:"#000000",highlightStrokeColor:"#888888",fillColor:"none",highlightFillColor:"none",visible:"inherit",includeBoundaries:!1,type:"linear",intl:{enabled:"inherit",options:{}},minorTicksInArrow:!1,majorTicksInArrow:!0,labelInArrow:!0,minorTicksInMargin:!1,majorTicksInMargin:!0,labelInMargin:!0,ignoreForLabelAutoposition:!0},hatch:{drawLabels:!1,drawZero:!0,majorHeight:20,anchor:"middle",face:"|",strokeWidth:2,strokeColor:n.A.palette.blue,ticksDistance:.2},precision:{touch:30,touchMax:100,mouse:4,pen:4,epsilon:1e-4,hasPoint:4},layer:{numlayers:20,unused9:19,unused8:18,unused7:17,unused6:16,unused5:15,unused4:14,unused3:13,unused2:12,unused1:11,unused0:10,text:9,point:9,glider:9,arc:8,line:7,circle:6,curve:5,turtle:5,polygon:3,sector:3,angle:3,integral:3,axis:2,ticks:2,grid:1,image:0,trace:0},angle:{withLabel:!0,radius:"auto",orientation:"counterclockwise",type:"sector",orthoType:"square",orthoSensitivity:1,fillColor:n.A.palette.orange,highlightFillColor:n.A.palette.orange,strokeColor:n.A.palette.orange,fillOpacity:.3,highlightFillOpacity:.3,radiuspoint:{withLabel:!1,visible:!1,name:""},pointsquare:{withLabel:!1,visible:!1,name:""},dot:{visible:!1,strokeColor:"none",fillColor:"#000000",size:2,face:"o",withLabel:!1,name:""},label:{position:"top",offset:[0,0],strokeColor:n.A.palette.blue},arc:{visible:!1,orientation:"inherit",fillColor:"none"}},arc:{selection:"auto",orientation:"counterclockwise",hasInnerPoints:!1,label:{anchorX:"auto",anchorY:"auto"},firstArrow:!1,lastArrow:!1,fillColor:"none",highlightFillColor:"none",strokeColor:n.A.palette.blue,highlightStrokeColor:"#c3d9ff",useDirection:!1,center:{name:"",visible:!1,withLabel:!1},radiusPoint:{name:"",visible:!1,withLabel:!1},anglePoint:{name:"",visible:!1,withLabel:!1}},arrow:{firstArrow:!1,lastArrow:{type:1,highlightSize:6,size:6}},arrowparallel:{firstArrow:!1,lastArrow:{type:1,highlightSize:6,size:6}},axis:{name:"",needsRegularUpdate:!1,strokeWidth:1,lastArrow:{type:1,highlightSize:8,size:8},strokeColor:"#666666",highlightStrokeWidth:1,highlightStrokeColor:"#888888",position:"static",anchor:"",anchorDist:"10%",ticksAutoPos:!1,ticksAutoPosThreshold:"5%",withTicks:!0,straightFirst:!0,straightLast:!0,margin:-4,withLabel:!1,scalable:!1,ticks:{label:{offset:[4,-9],parse:!1,needsRegularUpdate:!1,display:"internal",visible:"inherit",layer:9},visible:"inherit",needsRegularUpdate:!1,strokeWidth:1,strokeColor:"#666666",highlightStrokeColor:"#888888",drawLabels:!0,drawZero:!1,insertTicks:!0,minTicksDistance:5,minorHeight:10,majorHeight:-1,tickEndings:[0,1],majorTickEndings:[1,1],minorTicks:4,ticksDistance:1,strokeOpacity:.25},point1:{needsRegularUpdate:!1,visible:!1},point2:{needsRegularUpdate:!1,visible:!1},tabindex:-1,label:{position:"lft",offset:[10,10]},ignoreForLabelAutoposition:!0},bisector:{strokeColor:"#000000",point:{visible:!1,fixed:!1,withLabel:!1,name:""}},bisectorlines:{line1:{strokeColor:"#000000"},line2:{strokeColor:"#000000"}},boxplot:{dir:"vertical",smallWidth:.5,outlier:{size:3,face:"o"},strokeWidth:2,strokeColor:n.A.palette.blue,fillColor:n.A.palette.blue,fillOpacity:.2,highlightStrokeWidth:2,highlightStrokeColor:n.A.palette.blue,highlightFillColor:n.A.palette.blue,highlightFillOpacity:.1},button:{disabled:!1,display:"html"},cardinalspline:{createPoints:!0,isArrayOfCoordinates:!0,points:{strokeOpacity:.05,fillOpacity:.05,highlightStrokeOpacity:1,highlightFillOpacity:1,withLabel:!1,name:"",fixed:!1}},chart:{chartStyle:"line",colors:["#B02B2C","#3F4C6B","#C79810","#D15600","#FFFF88","#c3d9ff","#4096EE","#008C00"],highlightcolors:null,fillcolor:null,highlightonsector:!1,highlightbysize:!1,fillOpacity:.6,withLines:!1,label:{}},checkbox:{disabled:!1,checked:!1,display:"html"},circle:{hasInnerPoints:!1,fillColor:"none",highlightFillColor:"none",strokeColor:n.A.palette.blue,highlightStrokeColor:"#c3d9ff",center:{visible:!1,withLabel:!1,fixed:!1,fillColor:n.A.palette.red,strokeColor:n.A.palette.red,highlightFillColor:"#c3d9ff",highlightStrokeColor:"#c3d9ff",layer:9,name:""},point2:{fillColor:n.A.palette.red,strokeColor:n.A.palette.red,highlightFillColor:"#c3d9ff",highlightStrokeColor:"#c3d9ff",layer:9,visible:!1,withLabel:!1,fixed:!1,name:""},label:{position:"urt"}},circumcircle:{fillColor:"none",highlightFillColor:"none",strokeColor:n.A.palette.blue,highlightStrokeColor:"#c3d9ff",center:{visible:!1,fixed:!1,withLabel:!1,fillColor:n.A.palette.red,strokeColor:n.A.palette.red,highlightFillColor:"#c3d9ff",highlightStrokeColor:"#c3d9ff",name:""}},circumcirclearc:{fillColor:"none",highlightFillColor:"none",strokeColor:n.A.palette.blue,highlightStrokeColor:"#c3d9ff",useDirection:!0,center:{visible:!1,withLabel:!1,fixed:!1,name:""}},circumcirclesector:{useDirection:!0,fillColor:n.A.palette.yellow,highlightFillColor:n.A.palette.yellow,fillOpacity:.3,highlightFillOpacity:.3,strokeColor:n.A.palette.blue,highlightStrokeColor:"#c3d9ff",point:{visible:!1,fixed:!1,withLabel:!1,name:""}},comb:{frequency:.2,width:.4,angle:Math.PI/3,reverse:!1,point1:{visible:!1,withLabel:!1,fixed:!1,name:""},point2:{visible:!1,withLabel:!1,fixed:!1,name:""},strokeWidth:1,strokeColor:"#0000ff",fillColor:"none"},conic:{fillColor:"none",highlightFillColor:"none",strokeColor:n.A.palette.blue,highlightStrokeColor:"#c3d9ff",foci:{fixed:!1,visible:!1,withLabel:!1,name:""},center:{visible:!1,withLabel:!1,name:""},point:{withLabel:!1,name:""},line:{visible:!1}},curve:{strokeWidth:1,strokeColor:n.A.palette.blue,fillColor:"none",fixed:!0,curveType:null,doAdvancedPlot:!0,doAdvancedPlotOld:!1,firstArrow:!1,handDrawing:!1,label:{position:"rt"},lastArrow:!1,lineCap:"round",numberPointsHigh:1600,numberPointsLow:400,plotVersion:2,RDPsmoothing:!1,RDPthreshold:.2,recursionDepthHigh:17,recursionDepthLow:15},foreignobject:{fixed:!0,visible:!0,needsRegularUpdate:!1,attractors:[],evaluateOnlyOnce:!1},functiongraph:{label:{position:"rt"},RDPsmoothing:!0},glider:{label:{}},grid:{needsRegularUpdate:!1,hasGrid:!1,highlight:!1,gridX:null,gridY:null,majorStep:"auto",minorElements:0,forceSquare:!1,includeBoundaries:!1,size:void 0,face:void 0,margin:void 0,drawZero:void 0,polygonVertices:void 0,major:{size:5,face:"line",margin:0,drawZero:!0,polygonVertices:6},minor:{visible:"inherit",size:3,face:"point",margin:0,drawZero:!0,polygonVertices:6},snapToGrid:!1,strokeColor:"#c0c0c0",strokeWidth:1,strokeOpacity:.5,dash:0,theme:0,themes:[{},{forceSquare:"min",major:{face:"line"}},{major:{face:"line"},minor:{size:3,face:"point"},minorElements:"auto"},{major:{face:"line"},minor:{face:"line",strokeOpacity:.25},minorElements:"auto"},{major:{face:"line"},minor:{face:"+",size:"95%"},minorElements:"auto"},{major:{face:"+",size:10,strokeOpacity:1},minor:{face:"point",size:3},minorElements:"auto"},{major:{face:"circle",size:8,fillColor:"#c0c0c0"},minor:{face:"point",size:3},minorElements:"auto"}]},group:{needsRegularUpdate:!0},htmlslider:{widthRange:100,widthOut:34,step:.01,frozen:!0,isLabel:!1,strokeColor:"#000000",display:"html",anchorX:"left",anchorY:"middle",withLabel:!1},image:{imageString:null,fillOpacity:1,highlightFillOpacity:.6,cssClass:"JXGimage",highlightCssClass:"JXGimageHighlight",rotate:0,snapSizeX:1,snapSizeY:1,attractors:[]},implicitcurve:{margin:1,resolution_outer:5,resolution_inner:5,max_steps:1024,alpha_0:.05,tol_u0:o.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:.5,loop_dist:.09,loop_dir:.99,loop_detection:!0},incircle:{fillColor:"none",highlightFillColor:"none",strokeColor:n.A.palette.blue,highlightStrokeColor:"#c3d9ff",center:{visible:!1,fixed:!1,withLabel:!1,fillColor:n.A.palette.red,strokeColor:n.A.palette.red,highlightFillColor:"#c3d9ff",highlightStrokeColor:"#c3d9ff",name:""}},inequality:{fillColor:n.A.palette.red,fillOpacity:.2,strokeColor:"none",inverse:!1},infobox:{distanceX:-20,distanceY:25,intl:{enabled:"inherit",options:{}},fontSize:12,isLabel:!1,strokeColor:"#bbbbbb",display:"html",anchorX:"left",anchorY:"middle",cssClass:"JXGinfobox",rotate:0,visible:!0,parse:!1,transitionDuration:0,needsRegularUpdate:!1,tabindex:null,viewport:[0,0,0,0],ignoreForLabelAutoposition:!0},integral:{axis:"x",withLabel:!0,fixed:!0,strokeWidth:0,strokeOpacity:0,fillColor:n.A.palette.red,fillOpacity:.3,highlightFillColor:n.A.palette.red,highlightFillOpacity:.2,curveLeft:{visible:!0,withLabel:!1,color:n.A.palette.red,fillOpacity:.8,layer:9},baseLeft:{visible:!1,fixed:!1,withLabel:!1,name:""},curveRight:{visible:!0,withLabel:!1,color:n.A.palette.red,fillOpacity:.8,layer:9},baseRight:{visible:!1,fixed:!1,withLabel:!1,name:""},label:{fontSize:20,digits:4,intl:{enabled:!1,options:{}}}},input:{disabled:!1,maxlength:524288,display:"html"},intersection:{alwaysIntersect:!0},label:{visible:"inherit",clip:"inherit",strokeColor:"#000000",strokeOpacity:1,highlightStrokeOpacity:.666666,highlightStrokeColor:"#000000",fixed:!0,tabindex:null,position:"urt",distance:1.5,offset:[10,10],autoPosition:!1,autoPositionMinDistance:12,autoPositionMaxDistance:28,autoPositionWhitelist:[]},legend:{style:"vertical",labels:["1","2","3","4","5","6","7","8"],colors:["#B02B2C","#3F4C6B","#C79810","#D15600","#FFFF88","#c3d9ff","#4096EE","#008C00"],lineLength:1,strokeOpacity:[1],rowHeight:20,strokeWidth:5,frozen:!1},line:{firstArrow:!1,lastArrow:!1,margin:0,straightFirst:!0,straightLast:!0,fillColor:"none",highlightFillColor:"none",strokeColor:n.A.palette.blue,highlightStrokeColor:"#c3d9ff",withTicks:!1,point1:{fillColor:n.A.palette.red,strokeColor:n.A.palette.red,highlightFillColor:"#c3d9ff",highlightStrokeColor:"#c3d9ff",layer:9,visible:!1,withLabel:!1,fixed:!1,name:""},point2:{fillColor:n.A.palette.red,strokeColor:n.A.palette.red,highlightFillColor:"#c3d9ff",highlightStrokeColor:"#c3d9ff",layer:9,visible:!1,withLabel:!1,fixed:!1,name:""},ticks:{drawLabels:!0,label:{offset:[4,-9]},drawZero:!1,insertTicks:!1,ticksDistance:1,minTicksDistance:50,minorHeight:4,majorHeight:-1,minorTicks:4,strokeOpacity:.3,visible:"inherit"},label:{position:"llft"},snapToGrid:!1,snapSizeX:1,snapSizeY:1,touchFirstPoint:!1,touchLastPoint:!1,transitionProperties:[]},locus:{translateToOrigin:!1,translateTo10:!1,stretch:!1,toOrigin:null,to10:null},measurement:{baseUnit:"",units:{},showPrefix:!0,showSuffix:!0,prefix:"",suffix:"",dim:null,formatCoords:function(t,e,i,s){return 1!==parseFloat(s)?"Infinit coords":"("+e+", "+i+")"},formatDirection:function(t,e,i){return"("+e+", "+i+")"}},metapostspline:{createPoints:!0,isArrayOfCoordinates:!0,points:{strokeOpacity:.5,fillOpacity:.5,highlightStrokeOpacity:1,highlightFillOpacity:1,withLabel:!1,name:"",fixed:!1}},mirrorelement:{fixed:!0,point:{},center:{},type:"Euclidean"},nonreflexangle:{},normal:{strokeColor:"#000000",point:{visible:!1,fixed:!1,withLabel:!1,name:""}},orthogonalprojection:{},otherintersection:{alwaysIntersect:!0,precision:.001},parallel:{strokeColor:"#000000",point:{visible:!1,fixed:!1,withLabel:!1,name:""},label:{position:"llft"}},parallelogram:{parallelpoint:{withLabel:!1,name:""}},parallelpoint:{},perpendicular:{strokeColor:"#000000",straightFirst:!0,straightLast:!0},perpendicularsegment:{strokeColor:"#000000",straightFirst:!1,straightLast:!1,point:{visible:!1,fixed:!0,withLabel:!1,name:""}},point:{withLabel:!0,label:{},style:5,face:"o",size:3,sizeUnit:"screen",strokeWidth:2,transitionProperties:["fill","fill-opacity","stroke","stroke-opacity","stroke-width","width","height","rx","ry"],fillColor:n.A.palette.red,strokeColor:n.A.palette.red,highlightFillColor:"#c3d9ff",highlightStrokeColor:"#c3d9ff",zoom:!1,showInfobox:"inherit",infoboxDigits:"auto",attractors:[],attractorUnit:"user",attractorDistance:0,snatchDistance:0,snapToGrid:!1,attractToGrid:!1,snapSizeX:1,snapSizeY:1,snapToPoints:!1,ignoredSnapToPoints:[]},polygon:{hasInnerPoints:!1,fillColor:n.A.palette.yellow,highlightFillColor:n.A.palette.yellow,fillOpacity:.3,highlightFillOpacity:.2,withLines:!0,borders:{withLabel:!1,strokeWidth:1,highlightStrokeWidth:1,layer:5,label:{position:"top"},visible:"inherit"},highlightByStrokeWidth:!1,vertices:{layer:9,withLabel:!1,name:"",strokeColor:n.A.palette.red,fillColor:n.A.palette.red,fixed:!1,visible:"inherit"},label:{offset:[0,0]}},polygonalchain:{fillColor:"none",highlightFillColor:"none"},prescribedangle:{anglePoint:{size:2,visible:!1,withLabel:!1}},reflection:{fixed:!0,center:{},type:"Euclidean"},reflexangle:{},regularpolygon:{hasInnerPoints:!1,fillColor:n.A.palette.yellow,highlightFillColor:n.A.palette.yellow,fillOpacity:.3,highlightFillOpacity:.2,withLines:!0,borders:{withLabel:!1,strokeWidth:1,highlightStrokeWidth:1,layer:5,label:{position:"top"}},vertices:{layer:9,withLabel:!0,strokeColor:n.A.palette.red,fillColor:n.A.palette.red,fixed:!1},label:{offset:[0,0]}},riemannsum:{withLabel:!1,fillOpacity:.3,fillColor:n.A.palette.yellow},sector:{fillColor:n.A.palette.yellow,highlightFillColor:n.A.palette.yellow,fillOpacity:.3,highlightFillOpacity:.3,highlightOnSector:!1,highlightStrokeWidth:0,useDirection:!1,selection:"auto",orientation:"counterclockwise",arc:{visible:!1,fillColor:"none",withLabel:!1,name:"",orientation:"inherit",center:{visible:!1,withLabel:!1,name:""},radiusPoint:{visible:!1,withLabel:!1,name:""},anglePoint:{visible:!1,withLabel:!1,name:""}},radiusPoint:{name:"",visible:!1,withLabel:!1},center:{name:"",visible:!1,withLabel:!1},anglePoint:{name:"",visible:!1,withLabel:!1},label:{offset:[0,0],anchorX:"auto",anchorY:"auto"}},segment:{label:{position:"top"}},semicircle:{center:{visible:!1,withLabel:!1,fixed:!1,fillColor:n.A.palette.red,strokeColor:n.A.palette.red,highlightFillColor:"#eeeeee",highlightStrokeColor:n.A.palette.red,name:""},anglePoint:{name:""},radiusPoint:{name:""}},sketchcurve:{visible:!0,strokeColor:s.A.palette.red,highlight:!1,strokeWidth:1,lineCap:"round",deleteOnUp:!1,maxLength:null},slider:{snapWidth:-1,snapValues:[],snapValueDistance:0,precision:2,digits:2,intl:{enabled:"inherit",options:{}},firstArrow:!1,lastArrow:!1,withTicks:!0,withLabel:!0,suffixLabel:null,unitLabel:null,postLabel:null,layer:9,showInfobox:!1,name:"",visible:!0,strokeColor:"#000000",highlightStrokeColor:"#888888",fillColor:"#ffffff",highlightFillColor:"none",size:6,point1:{needsRegularUpdate:!1,showInfobox:!1,withLabel:!1,visible:!1,fixed:!0,frozen:"inherit",name:""},point2:{needsRegularUpdate:!1,showInfobox:!1,withLabel:!1,visible:!1,fixed:!0,frozen:"inherit",name:""},baseline:{needsRegularUpdate:!1,visible:"inherit",clip:"inherit",fixed:!0,scalable:!1,tabindex:null,name:"",strokeWidth:1,strokeColor:"#000000",highlightStrokeColor:"#888888"},ticks:{needsRegularUpdate:!1,fixed:!0,clip:"inherit",drawLabels:!1,digits:2,includeBoundaries:!0,drawZero:!0,label:{offset:[-4,-14],display:"internal"},minTicksDistance:30,insertTicks:!0,ticksDistance:1,minorHeight:4,majorHeight:5,minorTicks:0,strokeOpacity:1,strokeWidth:1,tickEndings:[0,1],majortickEndings:[0,1],strokeColor:"#000000",visible:"inherit"},highline:{strokeWidth:3,visible:"inherit",clip:"inherit",fixed:!0,tabindex:null,name:"",strokeColor:"#000000",highlightStrokeColor:"#888888"},label:{visible:"inherit",clip:"inherit",strokeColor:"#000000"},moveOnUp:!0},slopefield:{strokeWidth:.5,highlightStrokeWidth:.5,highlightStrokeColor:n.A.palette.blue,highlightStrokeOpacity:.8,scale:1,arrowhead:{enabled:!1,size:5,angle:.125*Math.PI}},slopetriangle:{fillColor:n.A.palette.red,fillOpacity:.4,highlightFillColor:n.A.palette.red,highlightFillOpacity:.3,borders:{lastArrow:{type:1,size:6}},glider:{fixed:!0,visible:!1,withLabel:!1},baseline:{visible:!1,withLabel:!1,name:""},basepoint:{visible:!1,withLabel:!1,name:""},tangent:{visible:!1,withLabel:!1,name:""},toppoint:{visible:!1,withLabel:!1,name:""},label:{visible:!0,position:"first",digits:function(t){return t.slopetriangle.evalVisProp("digits")},showPrefix:function(t){return t.slopetriangle.evalVisProp("showPrefix")},showSuffix:function(t){return t.slopetriangle.evalVisProp("showSuffix")},prefix:function(t){return t.slopetriangle.evalVisProp("prefix")},suffix:function(t){return t.slopetriangle.evalVisProp("suffix")}},digits:2,showPrefix:!0,showSuffix:!0,prefix:"",suffix:"",formatValue:null},smartlabel:{cssClass:"smart-label-solid",highlightCssClass:"smart-label-solid",unit:"",baseUnit:"",units:{},showPrefix:!0,showSuffix:!0,prefix:"",suffix:"",formatValue:null,measure:"",useMathJax:!0},smartlabelangle:{cssClass:"smart-label-solid smart-label-angle",highlightCssClass:"smart-label-solid smart-label-angle",anchorX:"left",anchorY:"middle"},smartlabelcircle:{cssClass:"smart-label-solid smart-label-circle",highlightCssClass:"smart-label-solid smart-label-circle",anchorX:"middle",measure:"radius",visibleThreshold:.6},smartlabelline:{cssClass:"smart-label-solid smart-label-line",highlightCssClass:"smart-label-solid smart-label-line",anchorX:"middle",measure:"length",orientation:"parallel",visibleThreshold:.7},smartlabelpoint:{cssClass:"smart-label-solid smart-label-point",highlightCssClass:"smart-label-solid smart-label-point",anchorX:"middle",anchorY:"top",measure:"coords",dir:"row"},smartlabelpolygon:{cssClass:"smart-label-solid smart-label-polygon",highlightCssClass:"smart-label-solid smart-label-polygon",anchorX:"middle",measure:"area"},stepfunction:{},tangent:{},tangentto:{polar:{visible:!1,strokeWidth:1,dash:3},point:{visible:!1}},tapemeasure:{strokeColor:"#000000",strokeWidth:2,highlightStrokeColor:"#000000",withTicks:!0,withLabel:!0,rotate:0,precision:2,digits:2,point1:{visible:!0,strokeColor:"#000000",fillColor:"#ffffff",fillOpacity:0,highlightFillOpacity:.1,size:6,snapToPoints:!0,attractorUnit:"screen",attractorDistance:20,showInfobox:!1,withLabel:!1,name:""},point2:{visible:!0,strokeColor:"#000000",fillColor:"#ffffff",fillOpacity:0,highlightFillOpacity:.1,size:6,snapToPoints:!0,attractorUnit:"screen",attractorDistance:20,showInfobox:!1,withLabel:!1,name:""},ticks:{drawLabels:!1,drawZero:!0,insertTicks:!0,ticksDistance:.1,minorHeight:8,majorHeight:16,minorTicks:4,tickEndings:[0,1],majorTickEndings:[0,1],strokeOpacity:1,strokeWidth:1,strokeColor:"#000000",visible:"inherit",label:{anchorY:"top",anchorX:"middle",offset:[0,-10]}},label:{position:"top"}},text:{fontSize:12,fontUnit:"px",formatNumber:!1,digits:2,intl:{enabled:"inherit",options:{minimumFractionDigits:0,maximumFractionDigits:2}},parse:!0,useCaja:!1,isLabel:!1,strokeColor:"#000000",highlightStrokeColor:"#000000",highlightStrokeOpacity:.666666,cssDefaultStyle:"font-family: Arial, Helvetica, Geneva, sans-serif;",highlightCssDefaultStyle:"font-family: Arial, Helvetica, Geneva, sans-serif;",cssStyle:"",highlightCssStyle:"",transitionProperties:["color","opacity"],useASCIIMathML:!1,useMathJax:!1,useKatex:!1,katexMacros:{},toFraction:!1,display:"html",anchor:null,anchorX:"left",anchorY:"middle",cssClass:"JXGtext",highlightCssClass:"JXGtext",dragArea:"all",withLabel:!1,rotate:0,visible:!0,snapSizeX:1,snapSizeY:1,attractors:[]},tracecurve:{strokeColor:"#000000",fillColor:"none",numberPoints:100},turtle:{strokeWidth:1,fillColor:"none",strokeColor:"#000000",arrow:{strokeWidth:2,withLabel:!1,strokeColor:n.A.palette.red,lastArrow:!0}},vectorfield:{strokeWidth:.5,highlightStrokeWidth:.5,highlightStrokeColor:n.A.palette.blue,highlightStrokeOpacity:.8,scale:1,arrowhead:{enabled:!0,size:5,angle:.125*Math.PI}},shortcuts:{color:["strokeColor","fillColor"],opacity:["strokeOpacity","fillOpacity"],highlightColor:["highlightStrokeColor","highlightFillColor"],highlightOpacity:["highlightStrokeOpacity","highlightFillOpacity"],strokeWidth:["strokeWidth","highlightStrokeWidth"]}},s.A.Validator=function(){var t,e=function(t){return a.A.isString(t)},i=function(t){return a.A.isNumber(t,!0,!1)},r=function(t){return Math.abs(t-Math.round(t))0},h=function(t){return t>0},l=function(t){return t>=0},c={},d={attractorDistance:l,color:e,display:function(t){return"html"===t||"internal"===t},doAdvancedPlot:!1,draft:!1,drawLabels:!1,drawZero:!1,face:function(t){return a.A.exists(s.A.normalizePointFace(t))},factor:i,fillColor:e,fillOpacity:i,firstArrow:!1,fontSize:r,dash:r,gridX:i,gridY:i,hasGrid:!1,highlightFillColor:e,highlightFillOpacity:i,highlightStrokeColor:e,highlightStrokeOpacity:i,insertTicks:!1,lastArrow:!1,layer:function(t){return r(t)&&t>=0},majorHeight:r,minorHeight:r,minorTicks:l,minTicksDistance:n,numberPointsHigh:n,numberPointsLow:n,opacity:i,radius:i,RDPsmoothing:!1,renderer:function(t){return"vml"===t||"svg"===t||"canvas"===t||"no"===t},right:function(t){return/^[0-9]+px$/.test(t)},showCopyright:!1,showInfobox:!1,showNavigation:!1,size:l,snapSizeX:h,snapSizeY:h,snapWidth:i,snapToGrid:!1,snatchDistance:l,straightFirst:!1,straightLast:!1,stretch:!1,strokeColor:e,strokeOpacity:i,strokeWidth:l,takeFirst:!1,takeSizeFromFile:!1,to10:!1,toOrigin:!1,translateTo10:!1,translateToOrigin:!1,useASCIIMathML:!1,useDirection:!1,useMathJax:!1,withLabel:!1,withTicks:!1,zoom:!1};for(t in d)d.hasOwnProperty(t)&&(c[t.toLowerCase()]=d[t]);return c}(),s.A.normalizePointFace=function(t){return{cross:"x",x:"x",circle:"o",o:"o",square:"[]","[]":"[]",plus:"+","+":"+",divide:"|","|":"|",minus:"-","-":"-",diamond:"<>","<>":"<>",diamond2:"<<>>","<<>>":"<<>>",triangleup:"^",A:"^",a:"^","^":"^",triangledown:"v",v:"v",triangleleft:"<","<":"<",triangleright:">",">":">"}[t]},s.A.useStandardOptions=function(t){var e,i,o,n,a=s.A.Options,h=t.hasGrid;for(e in t.options.grid.hasGrid=a.grid.hasGrid,t.options.grid.gridX=a.grid.gridX,t.options.grid.gridY=a.grid.gridY,t.options.grid.gridColor=a.grid.gridColor,t.options.grid.gridOpacity=a.grid.gridOpacity,t.options.grid.gridDash=a.grid.gridDash,t.options.grid.snapToGrid=a.grid.snapToGrid,t.options.grid.snapSizeX=a.grid.SnapSizeX,t.options.grid.snapSizeY=a.grid.SnapSizeY,t.takeSizeFromFile=a.takeSizeFromFile,n=function(t,e){t.visProp.fillcolor=e.fillColor,t.visProp.highlightfillcolor=e.highlightFillColor,t.visProp.strokecolor=e.strokeColor,t.visProp.highlightstrokecolor=e.highlightStrokeColor},t.objects)if(t.objects.hasOwnProperty(e))if((o=t.objects[e]).elementClass===r.A.OBJECT_CLASS_POINT)n(o,a.point);else if(o.elementClass===r.A.OBJECT_CLASS_LINE)for(n(o,a.line),i=0;i=0&&c=0&&e>0;)")"===(s=l.charAt(i))?e++:"("===s&&(e-=1),i-=1;if(0!==e)throw new Error("JSXGraph: Missing '(' in expression");for(o="",a=l.substring(0,i+1),h=i;h>=0&&a.slice(h,h+1).match(/([\w.]+)/);)o=RegExp.$1+o,h-=1;o=(o+=l.substring(i+1,l.length)).replace(/([()+*%^\-/\][])/g,"\\$1")}else o="[\\w\\.]+";if(d.match(/^([\w.]*\()/)){for(e=1,i=RegExp.$1.length;i0;)")"===(s=d.charAt(i))?e-=1:"("===s&&(e+=1),i+=1;if(0!==e)throw new Error("JSXGraph: Missing ')' in expression");n=(n=d.substring(0,i)).replace(/([()+*%^\-/[\]])/g,"\\$1")}else n="[\\w\\.]+";u=new RegExp("("+o+")\\^("+n+")"),c=(t=t.replace(u,"pow($1,$2)")).indexOf("^")}return t},replaceIf:function(t){var e,i,s,r,o,n,a,h,l,c="",d=null,u=null,p=null;if((s=t.indexOf("If("))<0)return t;for(t=t.replace(/""/g,"0");s>=0;){for(e=t.slice(0,s),i=t.slice(s+3),o=1,r=0,n=-1,a=-1;r0;)")"===(h=i.charAt(r))?o-=1:"("===h?o+=1:","===h&&1===o&&(n<0?n=r:a=r),r+=1;if(l=i.slice(0,r-1),i=i.slice(r),n<0)return"";if(a<0)return"";d=l.slice(0,n),u=l.slice(n+1,a),p=l.slice(a+1),c+=e+"(("+(d=this.replaceIf(d))+")?("+(u=this.replaceIf(u))+"):("+(p=this.replaceIf(p))+"))",d=null,u=null,s=(t=i).indexOf("If(")}return c+=i},replaceNameById:function(t,e,i){var s,r,o,n,a=0,h=["X","Y","L","V"],l=function(t){return i?"$('"+t+"')":t};for(n=0;n=0;)a>=0&&(s=t.indexOf(")",a+2))>=0&&(r=(r=t.slice(a+2,s)).replace(/\\(['"])?/g,"$1"),(o=e.elementsByName[r])&&(t=t.slice(0,a+2)+(i?"$('":"")+l(o.id)+t.slice(s))),s=t.indexOf(")",a+2),a=t.indexOf(h[n]+"(",s);for(a=t.indexOf("Dist(");a>=0;)a>=0&&(s=t.indexOf(",",a+5))>=0&&(r=(r=t.slice(a+5,s)).replace(/\\(['"])?/g,"$1"),(o=e.elementsByName[r])&&(t=t.slice(0,a+5)+l(o.id)+t.slice(s))),s=t.indexOf(",",a+5),a=t.indexOf(",",s),(s=t.indexOf(")",a+1))>=0&&(r=(r=t.slice(a+1,s)).replace(/\\(['"])?/g,"$1"),(o=e.elementsByName[r])&&(t=t.slice(0,a+1)+l(o.id)+t.slice(s))),s=t.indexOf(")",a+1),a=t.indexOf("Dist(",s);for(h=["Deg","Rad"],n=0;n=0;)a>=0&&(s=t.indexOf(",",a+4))>=0&&(r=(r=t.slice(a+4,s)).replace(/\\(['"])?/g,"$1"),(o=e.elementsByName[r])&&(t=t.slice(0,a+4)+l(o.id)+t.slice(s))),s=t.indexOf(",",a+4),a=t.indexOf(",",s),(s=t.indexOf(",",a+1))>=0&&(r=(r=t.slice(a+1,s)).replace(/\\(['"])?/g,"$1"),(o=e.elementsByName[r])&&(t=t.slice(0,a+1)+l(o.id)+t.slice(s))),s=t.indexOf(",",a+1),a=t.indexOf(",",s),(s=t.indexOf(")",a+1))>=0&&(r=(r=t.slice(a+1,s)).replace(/\\(['"])?/g,"$1"),(o=e.elementsByName[r])&&(t=t.slice(0,a+1)+l(o.id)+t.slice(s))),s=t.indexOf(")",a+1),a=t.indexOf(h[n]+"(",s);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,s,r,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=t=(t=(t=t.replace(/</g,"<")).replace(/>/g,">")).replace(/&/g,"&"),s=this.replaceNameById(s,e),s=this.replaceIf(s),s=this.replacePow(s),s=this.replaceIdByObj(s),r=0;r=0&&s[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")}},e.A=s.A.GeonextParser},428:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){"use strict";var _jxg_js__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(443),_base_constants_js__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(561),_base_text_js__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(925),_math_math_js__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(477),_math_ia_js__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(733),_math_geometry_js__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(571),_math_statistics_js__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(588),_utils_type_js__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__(188),_utils_env_js__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__(133);Object.create||(Object.create=function(t,e){if("object"!=typeof t&&"function"!=typeof t)throw new TypeError("Object prototype may only be an Object: "+t);if(null===t)throw new 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 new 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}},r,_ccache;_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)),_jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.CAS&&(this.CAS=new _jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.CAS(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 s,r=this.node(t,e,[]);for(s=2;s-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]},getvar:function(t,e,i){var s;if(e=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.def(e,!1),null!==(s=this.isLocalVariable(t)))return s.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)}return e||(s=this.board.select(t))===t?void 0:s},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 s,r="";return 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!==this.isParameter(t)?t:null===this.isLocalVariable(t)||i?this.isCreator(t)?"(function () { var a = Array.prototype.slice.call(arguments, 0), props = "+(i?"a.pop()":"{}")+"; return $jc$.board.create.apply($jc$.board, ['"+t+"'].concat([a, props])); })":(i&&this._error("Syntax error (attribute values are allowed with element creators only)"),this.isBuiltIn(t)?(r=this.builtIn[t].src||this.builtIn[t],_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isNumber(r)||r.match(/board\.select/)?r:(t=r.split(".").pop(),_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(this.board.mathLib)&&null!==(s=new RegExp("^Math."+t)).exec(r)?r.replace(s,"$jc$.board.mathLib."+t):_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(this.board.mathLibJXG)&&null!==(s=new RegExp("^JXG.Math.")).exec(r)?r.replace(s,"$jc$.board.mathLibJXG."):r)):this.isMathMethod(t)?"$jc$.board.mathLib."+t:e?"":(_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isId(this.board,t)?(r="$jc$.board.objects['"+t+"']","slider"===this.board.objects[t].elType&&(r+=".Value()")):_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isName(this.board,t)?(r="$jc$.board.elementsByName['"+t+"']","slider"===this.board.elementsByName[t].elType&&(r+=".Value()")):_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isGroup(this.board,t)&&(r="$jc$.board.groups['"+t+"']"),r)):"$jc$.resolve('"+t+"')"},makeMap:function(t){return t.isMap=!0,t},functionCodeJS:function(t){var e=t.children[0].join(", "),i="",s="";return"op_map"===t.value&&(i="{ return ",s=" }"),"function ("+e+") {\nvar $oldscope$ = $jc$.scope;\n$jc$.scope = $jc$.scopes["+this.scope.id+"];\nvar r = (function () "+i+this.compile(t.children[1],!0)+s+")();\n$jc$.scope = $oldscope$;\nreturn r;\n}"},defineFunction:function(node){var fun,i,that=this,list=node.children[0],scope=this.pushScope(list),_that;if(this.board.options.jc.compile){for(this.isLHS=!1,i=0;i0;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,s,r=!1;if(void 0!==e&&(r=e),s=t.value,"node_op"===t.type&&"op_lhs"===s&&1===t.children.length?this.isLHS=!0:"node_var"===t.type&&(this.isLHS?this.letvar(s,!0):!_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(this.getvar(s,!0))&&_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(this.board.elementsByName[s])&&(r&&"slider"!==this.board.elementsByName[s].elType&&(r=!1),t=this.createReplacementNode(t,r))),_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isArray(t))for(i=0;i0;i--)_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(t.children[i-1])&&(t.children[i-1]=this.replaceNames(t.children[i-1],r));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,s=this.board.elementsByName[i];return(t=this.createNode("node_op","op_execfun",this.createNode("node_var",!0===e?"$value":"$"),[this.createNode("node_str",s.id)])).replaced=!0,t},collectDependencies:function(t,e,i){var s,r,o,n;if(_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isArray(t))for(n=t.length,s=0;s1&&("$"===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(s=t.children.length;s>0;s--)_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(t.children[s-1])&&this.collectDependencies(t.children[s-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,s;if(_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isArray(e))for(i=0;ithis.execute(t.children[1]);break;case"op_lt":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,i){var s=this;function r(t){switch(t.type){case"node_const":case"node_const_bool":case"node_str":case"node_var":return 10;case"node_op":switch(t.value){case"op_none":default:return 0;case"op_assign":return 1;case"op_map":case"op_function":case"op_return":return 2;case"op_add":case"op_sub":return 3;case"op_mul":case"op_div":case"op_mod":return 5;case"op_neg":return 4;case"op_exp":return 6;case"op_array":case"op_execfun":return 7}default:return 0}}return _utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(e)||(e=!1),_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(i)&&_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isObject(i)||(i={}),i=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.deepCopy({minParentheses:!1,constToFixed:!1,printable:!1},i),function t(o,n,a=-1){var h,l,c,d,u,p,f="";if(!o)return f;switch(o.type){case"node_op":switch(o.value){case"op_none":o.children[0]&&(f=t(o.children[0],"op_none")),o.children[1]&&(f+=t(o.children[1],"op_none"));break;case"op_block":f="{\n"+t(o.children[0],"op_block")+" }\n";break;case"op_assign":e?(h=s.getLHSCompiler(o.children[0],e),_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isArray(h)?f="$jc$.setProp("+h[0]+", "+h[1]+", "+t(o.children[1],"op_assign")+");\n":(s.isLocalVariable(h)!==s.scope&&(s.scope.locals[h]=!0),f="$jc$.scopes["+s.scope.id+"].locals['"+h+"'] = "+t(o.children[1],"op_assign")+";\n")):f=(h=t(o.children[0],"op_assign"))+" = "+t(o.children[1],"op_assign")+";\n";break;case"op_if":f=" if ("+t(o.children[0],"op_if")+") "+t(o.children[1],"op_if");break;case"op_if_else":f=" if ("+t(o.children[0],"op_if_else")+")"+t(o.children[1],"op_if_else"),f+=" else "+t(o.children[2],"op_if_else");break;case"op_conditional":f="(("+t(o.children[0],"op_conditional")+")?("+t(o.children[1],"op_conditional"),f+="):("+t(o.children[2],"op_conditional")+"))";break;case"op_while":f=" while ("+t(o.children[0],"op_while")+") {\n"+t(o.children[1],"op_while")+"}\n";break;case"op_do":f=" do {\n"+t(o.children[0],"op_do")+"} while ("+t(o.children[1],"op_do")+");\n";break;case"op_for":f=" for ("+t(o.children[0],"op_for")+t(o.children[1],"op_for")+"; "+t(o.children[2],"op_for").slice(0,-2)+") {\n"+t(o.children[3],"op_for")+"\n}\n";break;case"op_proplst":o.children[0]&&(f=t(o.children[0],"op_proplst")+", "),f+=t(o.children[1],"op_proplst");break;case"op_prop":f=o.children[0]+": "+t(o.children[1],"op_prop");break;case"op_emptyobject":f=e?"{}":"<< >>";break;case"op_proplst_val":f=t(o.children[0],"op_proplst_val");break;case"op_array":for(d=[],l=0;l "+t(o.children[1],"op_map");break;case"op_function":d=o.children[0],s.pushScope(d),f=e?s.functionCodeJS(o):" function ("+d.join(", ")+") "+t(o.children[1],"op_function"),s.popScope();break;case"op_execfunmath":console.log("op_execfunmath: TODO"),f="-1";break;case"op_execfun":if(o.children[2]){for(d=[],l=0;l "+t(o.children[1],"op_gt")+")";break;case"op_lt":f=e?"$jc$.lt("+t(o.children[0],"op_lt")+", "+t(o.children[1],"op_lt")+")":"("+t(o.children[0],"op_lt")+" < "+t(o.children[1],"op_lt")+")";break;case"op_geq":f=e?"$jc$.geq("+t(o.children[0],"op_geq")+", "+t(o.children[1],"op_geq")+")":"("+t(o.children[0],"op_geq")+" >= "+t(o.children[1],"op_geq")+")";break;case"op_leq":f=e?"$jc$.leq("+t(o.children[0],"op_leq")+", "+t(o.children[1],"op_leq")+")":"("+t(o.children[0],"op_leq")+" <= "+t(o.children[1],"op_leq")+")";break;case"op_or":f="("+t(o.children[0],"op_or")+" || "+t(o.children[1],"op_or")+")";break;case"op_and":f="("+t(o.children[0],"op_and")+" && "+t(o.children[1],"op_and")+")";break;case"op_not":f="!("+t(o.children[0],"op_not")+")";break;case"op_add":e?f="$jc$.add("+t(o.children[0],"op_add")+", "+t(o.children[1],"op_add")+")":i.minParentheses?(u=r(o),h=t(o.children[0],"op_add"),f=u>(p=r(o.children[0]))?"("+h+")":h,f+=" + ",h=t(o.children[1],"op_add"),f+=u>(p=r(o.children[1]))?"("+h+")":h):f="("+t(o.children[0],"op_add")+" + "+t(o.children[1],"op_add")+")";break;case"op_sub":e?f="$jc$.sub("+t(o.children[0],"op_sub")+", "+t(o.children[1],"op_sub")+")":i.minParentheses?(u=r(o),h=t(o.children[0],"op_sub"),f=u>(p=r(o.children[0]))?"("+h+")":h,f+=" - ",h=t(o.children[1],"op_sub"),f+=u>=(p=r(o.children[1]))?"("+h+")":h):f="("+t(o.children[0],"op_sub")+" - "+t(o.children[1],"op_sub")+")";break;case"op_div":e?f="$jc$.div("+t(o.children[0],"op_div")+", "+t(o.children[1],"op_div")+")":i.minParentheses?(u=r(o),h=t(o.children[0],"op_div"),f=u>(p=r(o.children[0]))?"("+h+")":h,f+=" / ",h=t(o.children[1],"op_div"),f+=u>=(p=r(o.children[1]))?"("+h+")":h):f="("+t(o.children[0],"op_div")+" / "+t(o.children[1],"op_div")+")";break;case"op_mod":e?f="$jc$.mod("+t(o.children[0],"op_mod")+", "+t(o.children[1],"op_mod")+", true)":i.minParentheses?(u=r(o),h=t(o.children[0],"op_mod"),f=u>(p=r(o.children[0]))?"("+h+")":h,f+=" % ",h=t(o.children[1],"op_mod"),f+=u>=(p=r(o.children[1]))?"("+h+")":h):f="("+t(o.children[0],"op_mod")+" % "+t(o.children[1],"op_mod")+")";break;case"op_mul":e?f="$jc$.mul("+t(o.children[0],"op_mul")+", "+t(o.children[1],"op_mul")+")":i.minParentheses?(u=r(o),h=t(o.children[0],"op_mul"),f=u>(p=r(o.children[0]))?"("+h+")":h,f+=" * ",h=t(o.children[1],"op_mul"),f+=u>(p=r(o.children[1]))?"("+h+")":h):f="("+t(o.children[0],"op_mul")+" * "+t(o.children[1],"op_mul")+")";break;case"op_exp":e?f="$jc$.pow("+t(o.children[0],"op_exp",0)+", "+t(o.children[1],"op_exp",1)+")":i.minParentheses?(u=r(o),h=t(o.children[0],"op_exp",0),f=u>=(p=r(o.children[0]))?"("+h+")":h,f+="^",h=t(o.children[1],"op_exp",1),f+=u>(p=r(o.children[1]))&&(!i.printable||"{"!==h[0]||"}"!==h[h.length-1])?"("+h+")":h):f="("+t(o.children[0],"op_exp",0)+"^"+t(o.children[1],"op_exp",1)+")";break;case"op_neg":e?f="$jc$.neg("+t(o.children[0],"op_neg")+")":i.minParentheses?(u=r(o),p=r(o.children[0]),h=t(o.children[0],"op_neg"),f=u>=p?"-("+h+")":"-"+h):f="(-"+t(o.children[0],"op_neg")+")"}break;case"node_var":f=e?s.getvarJS(o.value,!1,o.withProps):o.value;break;case"node_const":if(e){f=o.value;break}c=o.value,!1===i.constToFixed||!_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isNumber(c)||"op_exp"===n&&1===a||(c=parseFloat(c),c=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isNumber(i.constToFixed)?_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.toFixed(c,i.constToFixed):_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isFunction(i.constToFixed)?i.constToFixed(c):o.value),f=i.minParentheses&&parseFloat(c)<0&&"op_execfun"!==n&&0!==a?"("+c+")":c;break;case"node_const_bool":f=o.value;break;case"node_str":f="'"+o.value+"'"}return o.needsAngleBrackets&&(f=e?"{\n"+f+" }\n":"<< "+f+" >>\n"),i.printable&&"op_exp"===n&&1===a&&(f="{"+f+"}"),i.printable&&_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isString(f)&&(f=f.replaceAll("\n","")),f}(t,"")},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 calculate 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,s,r;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))r=_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(s=Math.min(t.length,e.length),r=[],i=0;ie},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},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,s=!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],s=!0;break}}else i=t,s=!0;s?(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,s;for(s=-1===(e=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.def(e,-1))?this.scope:this.scopes[e];null!==s;){for(i in s.locals)if(s.locals.hasOwnProperty(i)&&s.locals[i]===t)return[i,s];s=s.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.asinh.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,s,r,o,n,a,h,l,c,d,u,p,f=["E"],A=this.builtIn||this.defineBuiltIn(),_=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=_[t]}if(!(f.indexOf(t)>=0))return _jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.isFunction(i)?{name:t,type:"function",numParams:i.length,origin:e}:_jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.isNumber(i)?{name:t,type:"constant",value:i,origin:e}:void(t.startsWith("$")||void 0!==i&&console.error("undefined type",i))},t=Object.getOwnPropertyNames(A).sort(u),e=Object.getOwnPropertyNames(_).sort(u),i=[],s=0,r=0;s":46,"<=":47,">=":48,MultiplicativeExpression:49,"+":50,"-":51,UnaryExpression:52,"*":53,"/":54,"%":55,ExponentExpression:56,"^":57,"!":58,MemberExpression: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,s,r,o,n,a,h){var l=a.length-1;switch(n){case 1:return a[l-1];case 2:this.$=e.createNode(i(h[l-4]),"node_op","op_if",a[l-2],a[l]);break;case 3:this.$=e.createNode(i(h[l-6]),"node_op","op_if_else",a[l-4],a[l-2],a[l]);break;case 4:this.$=e.createNode(i(h[l-4]),"node_op","op_while",a[l-2],a[l]);break;case 5:this.$=e.createNode(i(h[l-8]),"node_op","op_for",a[l-6],a[l-4],a[l-2],a[l]);break;case 6:this.$=e.createNode(i(h[l-6]),"node_op","op_do",a[l-5],a[l-2]);break;case 7:this.$=e.createNode(i(h[l-1]),"node_op","op_use",a[l]);break;case 8:this.$=e.createNode(i(h[l-1]),"node_op","op_delete",a[l]);break;case 9:this.$=e.createNode(i(h[l-1]),"node_op","op_return",void 0);break;case 10:this.$=e.createNode(i(h[l-2]),"node_op","op_return",a[l-1]);break;case 11:case 14:this.$=e.createNode(i(h[l]),"node_op","op_none");break;case 12:this.$=e.createNode(i(h[l-2]),"node_op","op_block",a[l-1]);break;case 13:this.$=e.createNode(i(h[l-1]),"node_op","op_none",a[l-1],a[l]);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.$=a[l];break;case 22:case 65:case 93:this.$=a[l-1];break;case 25:this.$=e.createNode(i(h[l-2]),"node_op","op_assign",a[l-2],a[l]),this.$.isMath=!1;break;case 27:this.$=e.createNode(i(h[l-4]),"node_op","op_conditional",a[l-4],a[l-2],a[l]),this.$.isMath=!1;break;case 29:this.$=e.createNode(i(h[l-2]),"node_op","op_or",a[l-2],a[l]),this.$.isMath=!1;break;case 31:this.$=e.createNode(i(h[l-2]),"node_op","op_and",a[l-2],a[l]),this.$.isMath=!1;break;case 33:this.$=e.createNode(i(h[l-2]),"node_op","op_eq",a[l-2],a[l]),this.$.isMath=!1;break;case 34:this.$=e.createNode(i(h[l-2]),"node_op","op_neq",a[l-2],a[l]),this.$.isMath=!1;break;case 35:this.$=e.createNode(i(h[l-2]),"node_op","op_approx",a[l-2],a[l]),this.$.isMath=!1;break;case 37:this.$=e.createNode(i(h[l-2]),"node_op","op_lt",a[l-2],a[l]),this.$.isMath=!1;break;case 38:this.$=e.createNode(i(h[l-2]),"node_op","op_gt",a[l-2],a[l]),this.$.isMath=!1;break;case 39:this.$=e.createNode(i(h[l-2]),"node_op","op_leq",a[l-2],a[l]),this.$.isMath=!1;break;case 40:this.$=e.createNode(i(h[l-2]),"node_op","op_geq",a[l-2],a[l]),this.$.isMath=!1;break;case 42:this.$=e.createNode(i(h[l-2]),"node_op","op_add",a[l-2],a[l]),this.$.isMath=!0;break;case 43:this.$=e.createNode(i(h[l-2]),"node_op","op_sub",a[l-2],a[l]),this.$.isMath=!0;break;case 45:this.$=e.createNode(i(h[l-2]),"node_op","op_mul",a[l-2],a[l]),this.$.isMath=!0;break;case 46:this.$=e.createNode(i(h[l-2]),"node_op","op_div",a[l-2],a[l]),this.$.isMath=!0;break;case 47:this.$=e.createNode(i(h[l-2]),"node_op","op_mod",a[l-2],a[l]),this.$.isMath=!0;break;case 49:this.$=e.createNode(i(h[l-2]),"node_op","op_exp",a[l-2],a[l]),this.$.isMath=!0;break;case 51:this.$=e.createNode(i(h[l-1]),"node_op","op_not",a[l]),this.$.isMath=!1;break;case 53:this.$=e.createNode(i(h[l-1]),"node_op","op_neg",a[l]),this.$.isMath=!0;break;case 57:case 63:case 64:case 66:case 67:case 68:case 97:this.$=a[l],this.$.isMath=!1;break;case 59:case 91:this.$=e.createNode(i(h[l-2]),"node_op","op_property",a[l-2],a[l]),this.$.isMath=!0;break;case 60:case 90:this.$=e.createNode(i(h[l-3]),"node_op","op_extvalue",a[l-3],a[l-1]),this.$.isMath=!0;break;case 61:this.$=e.createNode(i(h[l]),"node_var",a[l]);break;case 69:this.$=a[l],this.$.isMath=!0;break;case 70:this.$=e.createNode(i(h[l]),"node_const",null);break;case 71:this.$=e.createNode(i(h[l]),"node_const_bool",!0);break;case 72:this.$=e.createNode(i(h[l]),"node_const_bool",!1);break;case 73:this.$=e.createNode(i(h[l]),"node_str",a[l].substring(1,a[l].length-1));break;case 74:this.$=e.createNode(i(h[l]),"node_const",parseFloat(a[l]));break;case 75:this.$=e.createNode(i(h[l]),"node_const",NaN);break;case 76:this.$=e.createNode(i(h[l]),"node_const",1/0);break;case 77:this.$=e.createNode(i(h[l-1]),"node_op","op_array",[]);break;case 78:this.$=e.createNode(i(h[l-2]),"node_op","op_array",a[l-1]);break;case 79:this.$=e.createNode(i(h[l-1]),"node_op","op_emptyobject",{}),this.$.needsAngleBrackets=!0;break;case 80:this.$=e.createNode(i(h[l-2]),"node_op","op_proplst_val",a[l-1]),this.$.needsAngleBrackets=!0;break;case 82:this.$=e.createNode(i(h[l-2]),"node_op","op_proplst",a[l-2],a[l]);break;case 83:this.$=e.createNode(i(h[l-2]),"node_op","op_prop",a[l-2],a[l]);break;case 87:case 89:this.$=e.createNode(i(h[l-1]),"node_op","op_execfun",a[l-1],a[l]),this.$.isMath=!0;break;case 88:this.$=e.createNode(i(h[l-2]),"node_op","op_execfun",a[l-2],a[l-1],a[l],!0),this.$.isMath=!1;break;case 92:this.$=[];break;case 94:case 98:case 104:this.$=[a[l]];break;case 95:case 99:case 105:this.$=a[l-2].concat(a[l]);break;case 96:this.$=e.createNode(i(h[l]),"node_var",a[l]),this.$.isMath=!0;break;case 100:this.$=e.createNode(i(h[l-3]),"node_op","op_function",[],a[l]),this.$.isMath=!1;break;case 101:this.$=e.createNode(i(h[l-4]),"node_op","op_function",a[l-2],a[l]),this.$.isMath=!1;break;case 102:this.$=e.createNode(i(h[l-4]),"node_op","op_map",[],a[l]);break;case 103:this.$=e.createNode(i(h[l-5]),"node_op","op_map",a[l-3],a[l])}},table:[{3:1,4:2,5:[2,14],7:[2,14],8:[2,14],14:[2,14],15:[2,14],16:[2,14],17:[2,14],19:[2,14],20:[2,14],21:[2,14],23:[2,14],26:[2,14],50:[2,14],51:[2,14],58:[2,14],65:[2,14],74:[2,14],75:[2,14],76:[2,14],77:[2,14],78:[2,14],79:[2,14],80:[2,14],82:[2,14],91:[2,14],93:[2,14]},{1:[3]},{5:[1,3],6:6,7:[1,13],8:[1,37],9:20,11:4,13:7,14:[1,14],15:[1,15],16:[1,21],17:[1,16],18:8,19:[1,17],20:[1,33],21:[1,18],22:9,23:[1,19],24:11,25:5,26:[1,12],28:10,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{1:[2,1]},{5:[2,13],7:[2,13],8:[2,13],14:[2,13],15:[2,13],16:[2,13],17:[2,13],19:[2,13],20:[2,13],21:[2,13],23:[2,13],26:[2,13],27:[2,13],50:[2,13],51:[2,13],58:[2,13],65:[2,13],74:[2,13],75:[2,13],76:[2,13],77:[2,13],78:[2,13],79:[2,13],80:[2,13],82:[2,13],91:[2,13],93:[2,13]},{5:[2,15],7:[2,15],8:[2,15],12:[2,15],14:[2,15],15:[2,15],16:[2,15],17:[2,15],19:[2,15],20:[2,15],21:[2,15],23:[2,15],26:[2,15],27:[2,15],50:[2,15],51:[2,15],58:[2,15],65:[2,15],74:[2,15],75:[2,15],76:[2,15],77:[2,15],78:[2,15],79:[2,15],80:[2,15],82:[2,15],91:[2,15],93:[2,15]},{5:[2,16],7:[2,16],8:[2,16],12:[2,16],14:[2,16],15:[2,16],16:[2,16],17:[2,16],19:[2,16],20:[2,16],21:[2,16],23:[2,16],26:[2,16],27:[2,16],50:[2,16],51:[2,16],58:[2,16],65:[2,16],74:[2,16],75:[2,16],76:[2,16],77:[2,16],78:[2,16],79:[2,16],80:[2,16],82:[2,16],91:[2,16],93:[2,16]},{5:[2,17],7:[2,17],8:[2,17],12:[2,17],14:[2,17],15:[2,17],16:[2,17],17:[2,17],19:[2,17],20:[2,17],21:[2,17],23:[2,17],26:[2,17],27:[2,17],50:[2,17],51:[2,17],58:[2,17],65:[2,17],74:[2,17],75:[2,17],76:[2,17],77:[2,17],78:[2,17],79:[2,17],80:[2,17],82:[2,17],91:[2,17],93:[2,17]},{5:[2,18],7:[2,18],8:[2,18],12:[2,18],14:[2,18],15:[2,18],16:[2,18],17:[2,18],19:[2,18],20:[2,18],21:[2,18],23:[2,18],26:[2,18],27:[2,18],50:[2,18],51:[2,18],58:[2,18],65:[2,18],74:[2,18],75:[2,18],76:[2,18],77:[2,18],78:[2,18],79:[2,18],80:[2,18],82:[2,18],91:[2,18],93:[2,18]},{5:[2,19],7:[2,19],8:[2,19],12:[2,19],14:[2,19],15:[2,19],16:[2,19],17:[2,19],19:[2,19],20:[2,19],21:[2,19],23:[2,19],26:[2,19],27:[2,19],50:[2,19],51:[2,19],58:[2,19],65:[2,19],74:[2,19],75:[2,19],76:[2,19],77:[2,19],78:[2,19],79:[2,19],80:[2,19],82:[2,19],91:[2,19],93:[2,19]},{5:[2,20],7:[2,20],8:[2,20],12:[2,20],14:[2,20],15:[2,20],16:[2,20],17:[2,20],19:[2,20],20:[2,20],21:[2,20],23:[2,20],26:[2,20],27:[2,20],50:[2,20],51:[2,20],58:[2,20],65:[2,20],74:[2,20],75:[2,20],76:[2,20],77:[2,20],78:[2,20],79:[2,20],80:[2,20],82:[2,20],91:[2,20],93:[2,20]},{5:[2,21],7:[2,21],8:[2,21],12:[2,21],14:[2,21],15:[2,21],16:[2,21],17:[2,21],19:[2,21],20:[2,21],21:[2,21],23:[2,21],26:[2,21],27:[2,21],50:[2,21],51:[2,21],58:[2,21],65:[2,21],74:[2,21],75:[2,21],76:[2,21],77:[2,21],78:[2,21],79:[2,21],80:[2,21],82:[2,21],91:[2,21],93:[2,21]},{4:61,7:[2,14],8:[2,14],14:[2,14],15:[2,14],16:[2,14],17:[2,14],19:[2,14],20:[2,14],21:[2,14],23:[2,14],26:[2,14],27:[2,14],50:[2,14],51:[2,14],58:[2,14],65:[2,14],74:[2,14],75:[2,14],76:[2,14],77:[2,14],78:[2,14],79:[2,14],80:[2,14],82:[2,14],91:[2,14],93:[2,14]},{8:[1,62]},{8:[1,63]},{8:[1,64]},{6:6,7:[1,13],8:[1,37],9:20,11:65,13:7,14:[1,14],15:[1,15],16:[1,21],17:[1,16],18:8,19:[1,17],20:[1,33],21:[1,18],22:9,23:[1,19],24:11,25:5,26:[1,12],28:10,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{20:[1,66]},{20:[1,67]},{8:[1,37],9:69,16:[1,68],20:[1,33],29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{16:[1,70]},{5:[2,11],7:[2,11],8:[2,11],12:[2,11],14:[2,11],15:[2,11],16:[2,11],17:[2,11],19:[2,11],20:[2,11],21:[2,11],23:[2,11],26:[2,11],27:[2,11],50:[2,11],51:[2,11],58:[2,11],65:[2,11],74:[2,11],75:[2,11],76:[2,11],77:[2,11],78:[2,11],79:[2,11],80:[2,11],82:[2,11],91:[2,11],93:[2,11]},{8:[2,23],10:[2,23],16:[2,23],32:[2,23],34:[2,23],35:[2,23],37:[2,23],39:[2,23],41:[2,23],42:[2,23],43:[2,23],45:[2,23],46:[2,23],47:[2,23],48:[2,23],50:[2,23],51:[2,23],53:[2,23],54:[2,23],55:[2,23],57:[2,23],64:[2,23],65:[2,23],66:[2,23],83:[2,23],86:[2,23]},{8:[2,24],10:[2,24],16:[2,24],32:[2,24],34:[2,24],35:[2,24],37:[2,24],39:[2,24],41:[2,24],42:[2,24],43:[2,24],45:[2,24],46:[2,24],47:[2,24],48:[2,24],50:[2,24],51:[2,24],53:[2,24],54:[2,24],55:[2,24],57:[2,24],64:[2,24],65:[2,24],66:[2,24],83:[2,24],86:[2,24]},{8:[2,48],10:[2,48],16:[2,48],32:[1,71],34:[2,48],35:[2,48],37:[2,48],39:[2,48],41:[2,48],42:[2,48],43:[2,48],45:[2,48],46:[2,48],47:[2,48],48:[2,48],50:[2,48],51:[2,48],53:[2,48],54:[2,48],55:[2,48],57:[1,72],64:[2,48],65:[2,48],66:[2,48],83:[2,48],86:[2,48]},{8:[2,26],10:[2,26],16:[2,26],32:[2,26],34:[1,73],35:[2,26],37:[1,74],39:[2,26],41:[2,26],42:[2,26],43:[2,26],45:[2,26],46:[2,26],47:[2,26],48:[2,26],50:[2,26],51:[2,26],53:[2,26],54:[2,26],55:[2,26],57:[2,26],64:[2,26],65:[2,26],66:[2,26],83:[2,26],86:[2,26]},{8:[1,78],10:[2,54],16:[2,54],32:[2,54],34:[2,54],35:[2,54],37:[2,54],39:[2,54],41:[2,54],42:[2,54],43:[2,54],45:[2,54],46:[2,54],47:[2,54],48:[2,54],50:[2,54],51:[2,54],53:[2,54],54:[2,54],55:[2,54],57:[2,54],64:[1,75],65:[1,76],66:[2,54],83:[2,54],86:[2,54],88:77},{8:[1,78],10:[2,55],16:[2,55],32:[2,55],34:[2,55],35:[2,55],37:[2,55],39:[2,55],41:[2,55],42:[2,55],43:[2,55],45:[2,55],46:[2,55],47:[2,55],48:[2,55],50:[2,55],51:[2,55],53:[2,55],54:[2,55],55:[2,55],57:[2,55],64:[1,81],65:[1,80],66:[2,55],83:[2,55],86:[2,55],88:79},{8:[2,28],10:[2,28],16:[2,28],32:[2,28],34:[2,28],35:[2,28],37:[2,28],39:[1,82],41:[2,28],42:[2,28],43:[2,28],45:[2,28],46:[2,28],47:[2,28],48:[2,28],50:[2,28],51:[2,28],53:[2,28],54:[2,28],55:[2,28],57:[2,28],64:[2,28],65:[2,28],66:[2,28],83:[2,28],86:[2,28]},{8:[2,56],10:[2,56],16:[2,56],32:[2,56],34:[2,56],35:[2,56],37:[2,56],39:[2,56],41:[2,56],42:[2,56],43:[2,56],45:[2,56],46:[2,56],47:[2,56],48:[2,56],50:[2,56],51:[2,56],53:[2,56],54:[2,56],55:[2,56],57:[2,56],64:[2,56],65:[2,56],66:[2,56],83:[2,56],86:[2,56]},{8:[2,57],10:[2,57],16:[2,57],32:[2,57],34:[2,57],35:[2,57],37:[2,57],39:[2,57],41:[2,57],42:[2,57],43:[2,57],45:[2,57],46:[2,57],47:[2,57],48:[2,57],50:[2,57],51:[2,57],53:[2,57],54:[2,57],55:[2,57],57:[2,57],64:[2,57],65:[2,57],66:[2,57],83:[2,57],86:[2,57]},{8:[2,58],10:[2,58],16:[2,58],32:[2,58],34:[2,58],35:[2,58],37:[2,58],39:[2,58],41:[2,58],42:[2,58],43:[2,58],45:[2,58],46:[2,58],47:[2,58],48:[2,58],50:[2,58],51:[2,58],53:[2,58],54:[2,58],55:[2,58],57:[2,58],64:[2,58],65:[2,58],66:[2,58],83:[2,58],86:[2,58]},{8:[2,30],10:[2,30],16:[2,30],32:[2,30],34:[2,30],35:[2,30],37:[2,30],39:[2,30],41:[1,83],42:[1,84],43:[1,85],45:[2,30],46:[2,30],47:[2,30],48:[2,30],50:[2,30],51:[2,30],53:[2,30],54:[2,30],55:[2,30],57:[2,30],64:[2,30],65:[2,30],66:[2,30],83:[2,30],86:[2,30]},{8:[2,61],10:[2,61],16:[2,61],32:[2,61],34:[2,61],35:[2,61],37:[2,61],39:[2,61],41:[2,61],42:[2,61],43:[2,61],45:[2,61],46:[2,61],47:[2,61],48:[2,61],50:[2,61],51:[2,61],53:[2,61],54:[2,61],55:[2,61],57:[2,61],64:[2,61],65:[2,61],66:[2,61],83:[2,61],86:[2,61]},{8:[2,62],10:[2,62],16:[2,62],32:[2,62],34:[2,62],35:[2,62],37:[2,62],39:[2,62],41:[2,62],42:[2,62],43:[2,62],45:[2,62],46:[2,62],47:[2,62],48:[2,62],50:[2,62],51:[2,62],53:[2,62],54:[2,62],55:[2,62],57:[2,62],64:[2,62],65:[2,62],66:[2,62],83:[2,62],86:[2,62]},{8:[2,63],10:[2,63],16:[2,63],32:[2,63],34:[2,63],35:[2,63],37:[2,63],39:[2,63],41:[2,63],42:[2,63],43:[2,63],45:[2,63],46:[2,63],47:[2,63],48:[2,63],50:[2,63],51:[2,63],53:[2,63],54:[2,63],55:[2,63],57:[2,63],64:[2,63],65:[2,63],66:[2,63],83:[2,63],86:[2,63]},{8:[2,64],10:[2,64],16:[2,64],32:[2,64],34:[2,64],35:[2,64],37:[2,64],39:[2,64],41:[2,64],42:[2,64],43:[2,64],45:[2,64],46:[2,64],47:[2,64],48:[2,64],50:[2,64],51:[2,64],53:[2,64],54:[2,64],55:[2,64],57:[2,64],64:[2,64],65:[2,64],66:[2,64],83:[2,64],86:[2,64]},{8:[1,37],9:86,20:[1,33],29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{8:[1,87]},{8:[1,88]},{8:[2,32],10:[2,32],16:[2,32],32:[2,32],34:[2,32],35:[2,32],37:[2,32],39:[2,32],41:[2,32],42:[2,32],43:[2,32],45:[1,89],46:[1,90],47:[1,91],48:[1,92],50:[2,32],51:[2,32],53:[2,32],54:[2,32],55:[2,32],57:[2,32],64:[2,32],65:[2,32],66:[2,32],83:[2,32],86:[2,32]},{8:[2,66],10:[2,66],16:[2,66],32:[2,66],34:[2,66],35:[2,66],37:[2,66],39:[2,66],41:[2,66],42:[2,66],43:[2,66],45:[2,66],46:[2,66],47:[2,66],48:[2,66],50:[2,66],51:[2,66],53:[2,66],54:[2,66],55:[2,66],57:[2,66],64:[2,66],65:[2,66],66:[2,66],83:[2,66],86:[2,66]},{8:[2,67],10:[2,67],16:[2,67],32:[2,67],34:[2,67],35:[2,67],37:[2,67],39:[2,67],41:[2,67],42:[2,67],43:[2,67],45:[2,67],46:[2,67],47:[2,67],48:[2,67],50:[2,67],51:[2,67],53:[2,67],54:[2,67],55:[2,67],57:[2,67],64:[2,67],65:[2,67],66:[2,67],83:[2,67],86:[2,67]},{8:[2,68],10:[2,68],16:[2,68],32:[2,68],34:[2,68],35:[2,68],37:[2,68],39:[2,68],41:[2,68],42:[2,68],43:[2,68],45:[2,68],46:[2,68],47:[2,68],48:[2,68],50:[2,68],51:[2,68],53:[2,68],54:[2,68],55:[2,68],57:[2,68],64:[2,68],65:[2,68],66:[2,68],83:[2,68],86:[2,68]},{8:[2,69],10:[2,69],16:[2,69],32:[2,69],34:[2,69],35:[2,69],37:[2,69],39:[2,69],41:[2,69],42:[2,69],43:[2,69],45:[2,69],46:[2,69],47:[2,69],48:[2,69],50:[2,69],51:[2,69],53:[2,69],54:[2,69],55:[2,69],57:[2,69],64:[2,69],65:[2,69],66:[2,69],83:[2,69],86:[2,69]},{20:[1,97],72:98,73:99,77:[1,51],78:[1,52],79:[1,53],80:[1,54],83:[1,93],84:94,85:95,87:96},{8:[1,37],20:[1,33],29:102,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],66:[1,100],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],81:101,82:[1,45],91:[1,38],93:[1,39]},{8:[2,36],10:[2,36],16:[2,36],32:[2,36],34:[2,36],35:[2,36],37:[2,36],39:[2,36],41:[2,36],42:[2,36],43:[2,36],45:[2,36],46:[2,36],47:[2,36],48:[2,36],50:[1,103],51:[1,104],53:[2,36],54:[2,36],55:[2,36],57:[2,36],64:[2,36],65:[2,36],66:[2,36],83:[2,36],86:[2,36]},{8:[2,70],10:[2,70],16:[2,70],32:[2,70],34:[2,70],35:[2,70],37:[2,70],39:[2,70],41:[2,70],42:[2,70],43:[2,70],45:[2,70],46:[2,70],47:[2,70],48:[2,70],50:[2,70],51:[2,70],53:[2,70],54:[2,70],55:[2,70],57:[2,70],64:[2,70],65:[2,70],66:[2,70],83:[2,70],86:[2,70]},{8:[2,71],10:[2,71],16:[2,71],32:[2,71],34:[2,71],35:[2,71],37:[2,71],39:[2,71],41:[2,71],42:[2,71],43:[2,71],45:[2,71],46:[2,71],47:[2,71],48:[2,71],50:[2,71],51:[2,71],53:[2,71],54:[2,71],55:[2,71],57:[2,71],64:[2,71],65:[2,71],66:[2,71],83:[2,71],86:[2,71]},{8:[2,72],10:[2,72],16:[2,72],32:[2,72],34:[2,72],35:[2,72],37:[2,72],39:[2,72],41:[2,72],42:[2,72],43:[2,72],45:[2,72],46:[2,72],47:[2,72],48:[2,72],50:[2,72],51:[2,72],53:[2,72],54:[2,72],55:[2,72],57:[2,72],64:[2,72],65:[2,72],66:[2,72],83:[2,72],86:[2,72]},{8:[2,73],10:[2,73],16:[2,73],32:[2,73],34:[2,73],35:[2,73],37:[2,73],39:[2,73],41:[2,73],42:[2,73],43:[2,73],45:[2,73],46:[2,73],47:[2,73],48:[2,73],50:[2,73],51:[2,73],53:[2,73],54:[2,73],55:[2,73],57:[2,73],64:[2,73],65:[2,73],66:[2,73],83:[2,73],86:[2,73]},{8:[2,74],10:[2,74],16:[2,74],32:[2,74],34:[2,74],35:[2,74],37:[2,74],39:[2,74],41:[2,74],42:[2,74],43:[2,74],45:[2,74],46:[2,74],47:[2,74],48:[2,74],50:[2,74],51:[2,74],53:[2,74],54:[2,74],55:[2,74],57:[2,74],64:[2,74],65:[2,74],66:[2,74],83:[2,74],86:[2,74]},{8:[2,75],10:[2,75],16:[2,75],32:[2,75],34:[2,75],35:[2,75],37:[2,75],39:[2,75],41:[2,75],42:[2,75],43:[2,75],45:[2,75],46:[2,75],47:[2,75],48:[2,75],50:[2,75],51:[2,75],53:[2,75],54:[2,75],55:[2,75],57:[2,75],64:[2,75],65:[2,75],66:[2,75],83:[2,75],86:[2,75]},{8:[2,76],10:[2,76],16:[2,76],32:[2,76],34:[2,76],35:[2,76],37:[2,76],39:[2,76],41:[2,76],42:[2,76],43:[2,76],45:[2,76],46:[2,76],47:[2,76],48:[2,76],50:[2,76],51:[2,76],53:[2,76],54:[2,76],55:[2,76],57:[2,76],64:[2,76],65:[2,76],66:[2,76],83:[2,76],86:[2,76]},{8:[2,41],10:[2,41],16:[2,41],32:[2,41],34:[2,41],35:[2,41],37:[2,41],39:[2,41],41:[2,41],42:[2,41],43:[2,41],45:[2,41],46:[2,41],47:[2,41],48:[2,41],50:[2,41],51:[2,41],53:[1,105],54:[1,106],55:[1,107],57:[2,41],64:[2,41],65:[2,41],66:[2,41],83:[2,41],86:[2,41]},{8:[2,44],10:[2,44],16:[2,44],32:[2,44],34:[2,44],35:[2,44],37:[2,44],39:[2,44],41:[2,44],42:[2,44],43:[2,44],45:[2,44],46:[2,44],47:[2,44],48:[2,44],50:[2,44],51:[2,44],53:[2,44],54:[2,44],55:[2,44],57:[2,44],64:[2,44],65:[2,44],66:[2,44],83:[2,44],86:[2,44]},{8:[2,50],10:[2,50],16:[2,50],32:[2,50],34:[2,50],35:[2,50],37:[2,50],39:[2,50],41:[2,50],42:[2,50],43:[2,50],45:[2,50],46:[2,50],47:[2,50],48:[2,50],50:[2,50],51:[2,50],53:[2,50],54:[2,50],55:[2,50],57:[2,50],64:[2,50],65:[2,50],66:[2,50],83:[2,50],86:[2,50]},{8:[1,37],20:[1,33],31:109,50:[1,59],51:[1,60],52:108,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{8:[1,37],20:[1,33],31:109,50:[1,59],51:[1,60],52:110,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{8:[1,37],20:[1,33],31:109,50:[1,59],51:[1,60],52:111,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{6:6,7:[1,13],8:[1,37],9:20,11:4,13:7,14:[1,14],15:[1,15],16:[1,21],17:[1,16],18:8,19:[1,17],20:[1,33],21:[1,18],22:9,23:[1,19],24:11,25:5,26:[1,12],27:[1,112],28:10,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{8:[1,37],9:113,20:[1,33],29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{8:[1,37],9:114,20:[1,33],29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{8:[1,37],9:115,20:[1,33],29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{14:[1,116]},{5:[2,7],7:[2,7],8:[2,7],12:[2,7],14:[2,7],15:[2,7],16:[2,7],17:[2,7],19:[2,7],20:[2,7],21:[2,7],23:[2,7],26:[2,7],27:[2,7],50:[2,7],51:[2,7],58:[2,7],65:[2,7],74:[2,7],75:[2,7],76:[2,7],77:[2,7],78:[2,7],79:[2,7],80:[2,7],82:[2,7],91:[2,7],93:[2,7]},{5:[2,8],7:[2,8],8:[2,8],12:[2,8],14:[2,8],15:[2,8],16:[2,8],17:[2,8],19:[2,8],20:[2,8],21:[2,8],23:[2,8],26:[2,8],27:[2,8],50:[2,8],51:[2,8],58:[2,8],65:[2,8],74:[2,8],75:[2,8],76:[2,8],77:[2,8],78:[2,8],79:[2,8],80:[2,8],82:[2,8],91:[2,8],93:[2,8]},{5:[2,9],7:[2,9],8:[2,9],12:[2,9],14:[2,9],15:[2,9],16:[2,9],17:[2,9],19:[2,9],20:[2,9],21:[2,9],23:[2,9],26:[2,9],27:[2,9],50:[2,9],51:[2,9],58:[2,9],65:[2,9],74:[2,9],75:[2,9],76:[2,9],77:[2,9],78:[2,9],79:[2,9],80:[2,9],82:[2,9],91:[2,9],93:[2,9]},{16:[1,117]},{5:[2,22],7:[2,22],8:[2,22],12:[2,22],14:[2,22],15:[2,22],16:[2,22],17:[2,22],19:[2,22],20:[2,22],21:[2,22],23:[2,22],26:[2,22],27:[2,22],50:[2,22],51:[2,22],58:[2,22],65:[2,22],74:[2,22],75:[2,22],76:[2,22],77:[2,22],78:[2,22],79:[2,22],80:[2,22],82:[2,22],91:[2,22],93:[2,22]},{8:[1,37],20:[1,33],29:118,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{8:[1,37],20:[1,33],31:109,50:[1,59],51:[1,60],52:119,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{8:[1,37],20:[1,33],29:120,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{8:[1,37],20:[1,33],31:109,36:121,38:32,40:40,44:47,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{20:[1,122]},{8:[1,37],9:123,20:[1,33],29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{8:[2,87],10:[2,87],16:[2,87],20:[1,126],32:[2,87],34:[2,87],35:[2,87],37:[2,87],39:[2,87],41:[2,87],42:[2,87],43:[2,87],45:[2,87],46:[2,87],47:[2,87],48:[2,87],50:[2,87],51:[2,87],53:[2,87],54:[2,87],55:[2,87],57:[2,87],64:[2,87],65:[2,87],66:[2,87],68:127,82:[1,45],83:[2,87],86:[2,87],89:124,90:125},{8:[1,37],10:[1,128],20:[1,33],29:102,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],81:129,82:[1,45],91:[1,38],93:[1,39]},{8:[2,89],10:[2,89],16:[2,89],32:[2,89],34:[2,89],35:[2,89],37:[2,89],39:[2,89],41:[2,89],42:[2,89],43:[2,89],45:[2,89],46:[2,89],47:[2,89],48:[2,89],50:[2,89],51:[2,89],53:[2,89],54:[2,89],55:[2,89],57:[2,89],64:[2,89],65:[2,89],66:[2,89],83:[2,89],86:[2,89]},{8:[1,37],9:130,20:[1,33],29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{20:[1,131]},{8:[1,37],20:[1,33],31:109,38:132,40:40,44:47,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{8:[1,37],20:[1,33],31:109,40:133,44:47,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{8:[1,37],20:[1,33],31:109,40:134,44:47,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{8:[1,37],20:[1,33],31:109,40:135,44:47,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{10:[1,136]},{10:[1,137],20:[1,139],92:138},{10:[1,140],20:[1,139],92:141},{8:[1,37],20:[1,33],31:109,44:142,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{8:[1,37],20:[1,33],31:109,44:143,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{8:[1,37],20:[1,33],31:109,44:144,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{8:[1,37],20:[1,33],31:109,44:145,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{8:[2,79],10:[2,79],16:[2,79],32:[2,79],34:[2,79],35:[2,79],37:[2,79],39:[2,79],41:[2,79],42:[2,79],43:[2,79],45:[2,79],46:[2,79],47:[2,79],48:[2,79],50:[2,79],51:[2,79],53:[2,79],54:[2,79],55:[2,79],57:[2,79],64:[2,79],65:[2,79],66:[2,79],83:[2,79],86:[2,79]},{83:[1,146],86:[1,147]},{83:[2,81],86:[2,81]},{35:[1,148]},{35:[2,84]},{35:[2,85]},{35:[2,86]},{8:[2,77],10:[2,77],16:[2,77],32:[2,77],34:[2,77],35:[2,77],37:[2,77],39:[2,77],41:[2,77],42:[2,77],43:[2,77],45:[2,77],46:[2,77],47:[2,77],48:[2,77],50:[2,77],51:[2,77],53:[2,77],54:[2,77],55:[2,77],57:[2,77],64:[2,77],65:[2,77],66:[2,77],83:[2,77],86:[2,77]},{66:[1,149],86:[1,150]},{10:[2,98],66:[2,98],86:[2,98]},{8:[1,37],20:[1,33],31:109,49:151,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{8:[1,37],20:[1,33],31:109,49:152,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{8:[1,37],20:[1,33],31:109,50:[1,59],51:[1,60],52:153,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{8:[1,37],20:[1,33],31:109,50:[1,59],51:[1,60],52:154,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{8:[1,37],20:[1,33],31:109,50:[1,59],51:[1,60],52:155,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{8:[2,51],10:[2,51],16:[2,51],32:[2,51],34:[2,51],35:[2,51],37:[2,51],39:[2,51],41:[2,51],42:[2,51],43:[2,51],45:[2,51],46:[2,51],47:[2,51],48:[2,51],50:[2,51],51:[2,51],53:[2,51],54:[2,51],55:[2,51],57:[2,51],64:[2,51],65:[2,51],66:[2,51],83:[2,51],86:[2,51]},{8:[2,48],10:[2,48],16:[2,48],32:[2,48],34:[2,48],35:[2,48],37:[2,48],39:[2,48],41:[2,48],42:[2,48],43:[2,48],45:[2,48],46:[2,48],47:[2,48],48:[2,48],50:[2,48],51:[2,48],53:[2,48],54:[2,48],55:[2,48],57:[1,72],64:[2,48],65:[2,48],66:[2,48],83:[2,48],86:[2,48]},{8:[2,52],10:[2,52],16:[2,52],32:[2,52],34:[2,52],35:[2,52],37:[2,52],39:[2,52],41:[2,52],42:[2,52],43:[2,52],45:[2,52],46:[2,52],47:[2,52],48:[2,52],50:[2,52],51:[2,52],53:[2,52],54:[2,52],55:[2,52],57:[2,52],64:[2,52],65:[2,52],66:[2,52],83:[2,52],86:[2,52]},{8:[2,53],10:[2,53],16:[2,53],32:[2,53],34:[2,53],35:[2,53],37:[2,53],39:[2,53],41:[2,53],42:[2,53],43:[2,53],45:[2,53],46:[2,53],47:[2,53],48:[2,53],50:[2,53],51:[2,53],53:[2,53],54:[2,53],55:[2,53],57:[2,53],64:[2,53],65:[2,53],66:[2,53],83:[2,53],86:[2,53]},{5:[2,12],7:[2,12],8:[2,12],10:[2,12],12:[2,12],14:[2,12],15:[2,12],16:[2,12],17:[2,12],19:[2,12],20:[2,12],21:[2,12],23:[2,12],26:[2,12],27:[2,12],32:[2,12],34:[2,12],35:[2,12],37:[2,12],39:[2,12],41:[2,12],42:[2,12],43:[2,12],45:[2,12],46:[2,12],47:[2,12],48:[2,12],50:[2,12],51:[2,12],53:[2,12],54:[2,12],55:[2,12],57:[2,12],58:[2,12],64:[2,12],65:[2,12],66:[2,12],74:[2,12],75:[2,12],76:[2,12],77:[2,12],78:[2,12],79:[2,12],80:[2,12],82:[2,12],83:[2,12],86:[2,12],91:[2,12],93:[2,12]},{10:[1,156]},{10:[1,157]},{16:[1,158]},{8:[1,159]},{5:[2,10],7:[2,10],8:[2,10],12:[2,10],14:[2,10],15:[2,10],16:[2,10],17:[2,10],19:[2,10],20:[2,10],21:[2,10],23:[2,10],26:[2,10],27:[2,10],50:[2,10],51:[2,10],58:[2,10],65:[2,10],74:[2,10],75:[2,10],76:[2,10],77:[2,10],78:[2,10],79:[2,10],80:[2,10],82:[2,10],91:[2,10],93:[2,10]},{8:[2,25],10:[2,25],16:[2,25],32:[2,25],34:[2,25],35:[2,25],37:[2,25],39:[2,25],41:[2,25],42:[2,25],43:[2,25],45:[2,25],46:[2,25],47:[2,25],48:[2,25],50:[2,25],51:[2,25],53:[2,25],54:[2,25],55:[2,25],57:[2,25],64:[2,25],65:[2,25],66:[2,25],83:[2,25],86:[2,25]},{8:[2,49],10:[2,49],16:[2,49],32:[2,49],34:[2,49],35:[2,49],37:[2,49],39:[2,49],41:[2,49],42:[2,49],43:[2,49],45:[2,49],46:[2,49],47:[2,49],48:[2,49],50:[2,49],51:[2,49],53:[2,49],54:[2,49],55:[2,49],57:[2,49],64:[2,49],65:[2,49],66:[2,49],83:[2,49],86:[2,49]},{35:[1,160]},{8:[2,29],10:[2,29],16:[2,29],32:[2,29],34:[2,29],35:[2,29],37:[2,29],39:[1,82],41:[2,29],42:[2,29],43:[2,29],45:[2,29],46:[2,29],47:[2,29],48:[2,29],50:[2,29],51:[2,29],53:[2,29],54:[2,29],55:[2,29],57:[2,29],64:[2,29],65:[2,29],66:[2,29],83:[2,29],86:[2,29]},{8:[2,59],10:[2,59],16:[2,59],32:[2,59],34:[2,59],35:[2,59],37:[2,59],39:[2,59],41:[2,59],42:[2,59],43:[2,59],45:[2,59],46:[2,59],47:[2,59],48:[2,59],50:[2,59],51:[2,59],53:[2,59],54:[2,59],55:[2,59],57:[2,59],64:[2,59],65:[2,59],66:[2,59],83:[2,59],86:[2,59]},{66:[1,161]},{8:[2,88],10:[2,88],16:[2,88],32:[2,88],34:[2,88],35:[2,88],37:[2,88],39:[2,88],41:[2,88],42:[2,88],43:[2,88],45:[2,88],46:[2,88],47:[2,88],48:[2,88],50:[2,88],51:[2,88],53:[2,88],54:[2,88],55:[2,88],57:[2,88],64:[2,88],65:[2,88],66:[2,88],83:[2,88],86:[1,162]},{8:[2,94],10:[2,94],16:[2,94],32:[2,94],34:[2,94],35:[2,94],37:[2,94],39:[2,94],41:[2,94],42:[2,94],43:[2,94],45:[2,94],46:[2,94],47:[2,94],48:[2,94],50:[2,94],51:[2,94],53:[2,94],54:[2,94],55:[2,94],57:[2,94],64:[2,94],65:[2,94],66:[2,94],83:[2,94],86:[2,94]},{8:[2,96],10:[2,96],16:[2,96],32:[2,96],34:[2,96],35:[2,96],37:[2,96],39:[2,96],41:[2,96],42:[2,96],43:[2,96],45:[2,96],46:[2,96],47:[2,96],48:[2,96],50:[2,96],51:[2,96],53:[2,96],54:[2,96],55:[2,96],57:[2,96],64:[2,96],65:[2,96],66:[2,96],83:[2,96],86:[2,96]},{8:[2,97],10:[2,97],16:[2,97],32:[2,97],34:[2,97],35:[2,97],37:[2,97],39:[2,97],41:[2,97],42:[2,97],43:[2,97],45:[2,97],46:[2,97],47:[2,97],48:[2,97],50:[2,97],51:[2,97],53:[2,97],54:[2,97],55:[2,97],57:[2,97],64:[2,97],65:[2,97],66:[2,97],83:[2,97],86:[2,97]},{8:[2,92],10:[2,92],16:[2,92],20:[2,92],32:[2,92],34:[2,92],35:[2,92],37:[2,92],39:[2,92],41:[2,92],42:[2,92],43:[2,92],45:[2,92],46:[2,92],47:[2,92],48:[2,92],50:[2,92],51:[2,92],53:[2,92],54:[2,92],55:[2,92],57:[2,92],64:[2,92],65:[2,92],66:[2,92],82:[2,92],83:[2,92],86:[2,92]},{10:[1,163],86:[1,150]},{66:[1,164]},{8:[2,91],10:[2,91],16:[2,91],32:[2,91],34:[2,91],35:[2,91],37:[2,91],39:[2,91],41:[2,91],42:[2,91],43:[2,91],45:[2,91],46:[2,91],47:[2,91],48:[2,91],50:[2,91],51:[2,91],53:[2,91],54:[2,91],55:[2,91],57:[2,91],64:[2,91],65:[2,91],66:[2,91],83:[2,91],86:[2,91]},{8:[2,31],10:[2,31],16:[2,31],32:[2,31],34:[2,31],35:[2,31],37:[2,31],39:[2,31],41:[1,83],42:[1,84],43:[1,85],45:[2,31],46:[2,31],47:[2,31],48:[2,31],50:[2,31],51:[2,31],53:[2,31],54:[2,31],55:[2,31],57:[2,31],64:[2,31],65:[2,31],66:[2,31],83:[2,31],86:[2,31]},{8:[2,33],10:[2,33],16:[2,33],32:[2,33],34:[2,33],35:[2,33],37:[2,33],39:[2,33],41:[2,33],42:[2,33],43:[2,33],45:[1,89],46:[1,90],47:[1,91],48:[1,92],50:[2,33],51:[2,33],53:[2,33],54:[2,33],55:[2,33],57:[2,33],64:[2,33],65:[2,33],66:[2,33],83:[2,33],86:[2,33]},{8:[2,34],10:[2,34],16:[2,34],32:[2,34],34:[2,34],35:[2,34],37:[2,34],39:[2,34],41:[2,34],42:[2,34],43:[2,34],45:[1,89],46:[1,90],47:[1,91],48:[1,92],50:[2,34],51:[2,34],53:[2,34],54:[2,34],55:[2,34],57:[2,34],64:[2,34],65:[2,34],66:[2,34],83:[2,34],86:[2,34]},{8:[2,35],10:[2,35],16:[2,35],32:[2,35],34:[2,35],35:[2,35],37:[2,35],39:[2,35],41:[2,35],42:[2,35],43:[2,35],45:[1,89],46:[1,90],47:[1,91],48:[1,92],50:[2,35],51:[2,35],53:[2,35],54:[2,35],55:[2,35],57:[2,35],64:[2,35],65:[2,35],66:[2,35],83:[2,35],86:[2,35]},{8:[2,65],10:[2,65],16:[2,65],32:[2,65],34:[2,65],35:[2,65],37:[2,65],39:[2,65],41:[2,65],42:[2,65],43:[2,65],45:[2,65],46:[2,65],47:[2,65],48:[2,65],50:[2,65],51:[2,65],53:[2,65],54:[2,65],55:[2,65],57:[2,65],64:[2,65],65:[2,65],66:[2,65],83:[2,65],86:[2,65]},{25:165,26:[1,12]},{10:[1,166],86:[1,167]},{10:[2,104],86:[2,104]},{94:[1,168]},{10:[1,169],86:[1,167]},{8:[2,37],10:[2,37],16:[2,37],32:[2,37],34:[2,37],35:[2,37],37:[2,37],39:[2,37],41:[2,37],42:[2,37],43:[2,37],45:[2,37],46:[2,37],47:[2,37],48:[2,37],50:[1,103],51:[1,104],53:[2,37],54:[2,37],55:[2,37],57:[2,37],64:[2,37],65:[2,37],66:[2,37],83:[2,37],86:[2,37]},{8:[2,38],10:[2,38],16:[2,38],32:[2,38],34:[2,38],35:[2,38],37:[2,38],39:[2,38],41:[2,38],42:[2,38],43:[2,38],45:[2,38],46:[2,38],47:[2,38],48:[2,38],50:[1,103],51:[1,104],53:[2,38],54:[2,38],55:[2,38],57:[2,38],64:[2,38],65:[2,38],66:[2,38],83:[2,38],86:[2,38]},{8:[2,39],10:[2,39],16:[2,39],32:[2,39],34:[2,39],35:[2,39],37:[2,39],39:[2,39],41:[2,39],42:[2,39],43:[2,39],45:[2,39],46:[2,39],47:[2,39],48:[2,39],50:[1,103],51:[1,104],53:[2,39],54:[2,39],55:[2,39],57:[2,39],64:[2,39],65:[2,39],66:[2,39],83:[2,39],86:[2,39]},{8:[2,40],10:[2,40],16:[2,40],32:[2,40],34:[2,40],35:[2,40],37:[2,40],39:[2,40],41:[2,40],42:[2,40],43:[2,40],45:[2,40],46:[2,40],47:[2,40],48:[2,40],50:[1,103],51:[1,104],53:[2,40],54:[2,40],55:[2,40],57:[2,40],64:[2,40],65:[2,40],66:[2,40],83:[2,40],86:[2,40]},{8:[2,80],10:[2,80],16:[2,80],32:[2,80],34:[2,80],35:[2,80],37:[2,80],39:[2,80],41:[2,80],42:[2,80],43:[2,80],45:[2,80],46:[2,80],47:[2,80],48:[2,80],50:[2,80],51:[2,80],53:[2,80],54:[2,80],55:[2,80],57:[2,80],64:[2,80],65:[2,80],66:[2,80],83:[2,80],86:[2,80]},{20:[1,97],72:98,73:99,77:[1,51],78:[1,52],79:[1,53],80:[1,54],85:170,87:96},{8:[1,37],20:[1,33],29:171,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{8:[2,78],10:[2,78],16:[2,78],32:[2,78],34:[2,78],35:[2,78],37:[2,78],39:[2,78],41:[2,78],42:[2,78],43:[2,78],45:[2,78],46:[2,78],47:[2,78],48:[2,78],50:[2,78],51:[2,78],53:[2,78],54:[2,78],55:[2,78],57:[2,78],64:[2,78],65:[2,78],66:[2,78],83:[2,78],86:[2,78]},{8:[1,37],20:[1,33],29:172,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{8:[2,42],10:[2,42],16:[2,42],32:[2,42],34:[2,42],35:[2,42],37:[2,42],39:[2,42],41:[2,42],42:[2,42],43:[2,42],45:[2,42],46:[2,42],47:[2,42],48:[2,42],50:[2,42],51:[2,42],53:[1,105],54:[1,106],55:[1,107],57:[2,42],64:[2,42],65:[2,42],66:[2,42],83:[2,42],86:[2,42]},{8:[2,43],10:[2,43],16:[2,43],32:[2,43],34:[2,43],35:[2,43],37:[2,43],39:[2,43],41:[2,43],42:[2,43],43:[2,43],45:[2,43],46:[2,43],47:[2,43],48:[2,43],50:[2,43],51:[2,43],53:[1,105],54:[1,106],55:[1,107],57:[2,43],64:[2,43],65:[2,43],66:[2,43],83:[2,43],86:[2,43]},{8:[2,45],10:[2,45],16:[2,45],32:[2,45],34:[2,45],35:[2,45],37:[2,45],39:[2,45],41:[2,45],42:[2,45],43:[2,45],45:[2,45],46:[2,45],47:[2,45],48:[2,45],50:[2,45],51:[2,45],53:[2,45],54:[2,45],55:[2,45],57:[2,45],64:[2,45],65:[2,45],66:[2,45],83:[2,45],86:[2,45]},{8:[2,46],10:[2,46],16:[2,46],32:[2,46],34:[2,46],35:[2,46],37:[2,46],39:[2,46],41:[2,46],42:[2,46],43:[2,46],45:[2,46],46:[2,46],47:[2,46],48:[2,46],50:[2,46],51:[2,46],53:[2,46],54:[2,46],55:[2,46],57:[2,46],64:[2,46],65:[2,46],66:[2,46],83:[2,46],86:[2,46]},{8:[2,47],10:[2,47],16:[2,47],32:[2,47],34:[2,47],35:[2,47],37:[2,47],39:[2,47],41:[2,47],42:[2,47],43:[2,47],45:[2,47],46:[2,47],47:[2,47],48:[2,47],50:[2,47],51:[2,47],53:[2,47],54:[2,47],55:[2,47],57:[2,47],64:[2,47],65:[2,47],66:[2,47],83:[2,47],86:[2,47]},{6:6,7:[1,13],8:[1,37],9:20,11:173,13:7,14:[1,14],15:[1,15],16:[1,21],17:[1,16],18:8,19:[1,17],20:[1,33],21:[1,18],22:9,23:[1,19],24:11,25:5,26:[1,12],28:10,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{6:6,7:[1,13],8:[1,37],9:20,11:174,13:7,14:[1,14],15:[1,15],16:[1,21],17:[1,16],18:8,19:[1,17],20:[1,33],21:[1,18],22:9,23:[1,19],24:11,25:5,26:[1,12],28:10,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{8:[1,37],9:175,20:[1,33],29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{8:[1,37],9:176,20:[1,33],29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{8:[1,37],20:[1,33],29:177,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{8:[2,60],10:[2,60],16:[2,60],32:[2,60],34:[2,60],35:[2,60],37:[2,60],39:[2,60],41:[2,60],42:[2,60],43:[2,60],45:[2,60],46:[2,60],47:[2,60],48:[2,60],50:[2,60],51:[2,60],53:[2,60],54:[2,60],55:[2,60],57:[2,60],64:[2,60],65:[2,60],66:[2,60],83:[2,60],86:[2,60]},{20:[1,126],68:127,82:[1,45],90:178},{8:[2,93],10:[2,93],16:[2,93],20:[2,93],32:[2,93],34:[2,93],35:[2,93],37:[2,93],39:[2,93],41:[2,93],42:[2,93],43:[2,93],45:[2,93],46:[2,93],47:[2,93],48:[2,93],50:[2,93],51:[2,93],53:[2,93],54:[2,93],55:[2,93],57:[2,93],64:[2,93],65:[2,93],66:[2,93],82:[2,93],83:[2,93],86:[2,93]},{8:[2,90],10:[2,90],16:[2,90],32:[2,90],34:[2,90],35:[2,90],37:[2,90],39:[2,90],41:[2,90],42:[2,90],43:[2,90],45:[2,90],46:[2,90],47:[2,90],48:[2,90],50:[2,90],51:[2,90],53:[2,90],54:[2,90],55:[2,90],57:[2,90],64:[2,90],65:[2,90],66:[2,90],83:[2,90],86:[2,90]},{8:[2,100],10:[2,100],16:[2,100],32:[2,100],34:[2,100],35:[2,100],37:[2,100],39:[2,100],41:[2,100],42:[2,100],43:[2,100],45:[2,100],46:[2,100],47:[2,100],48:[2,100],50:[2,100],51:[2,100],53:[2,100],54:[2,100],55:[2,100],57:[2,100],64:[2,100],65:[2,100],66:[2,100],83:[2,100],86:[2,100]},{25:179,26:[1,12]},{20:[1,180]},{8:[1,37],9:181,20:[1,33],29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{94:[1,182]},{83:[2,82],86:[2,82]},{83:[2,83],86:[2,83]},{10:[2,99],66:[2,99],86:[2,99]},{5:[2,2],7:[2,2],8:[2,2],12:[1,183],14:[2,2],15:[2,2],16:[2,2],17:[2,2],19:[2,2],20:[2,2],21:[2,2],23:[2,2],26:[2,2],27:[2,2],50:[2,2],51:[2,2],58:[2,2],65:[2,2],74:[2,2],75:[2,2],76:[2,2],77:[2,2],78:[2,2],79:[2,2],80:[2,2],82:[2,2],91:[2,2],93:[2,2]},{5:[2,4],7:[2,4],8:[2,4],12:[2,4],14:[2,4],15:[2,4],16:[2,4],17:[2,4],19:[2,4],20:[2,4],21:[2,4],23:[2,4],26:[2,4],27:[2,4],50:[2,4],51:[2,4],58:[2,4],65:[2,4],74:[2,4],75:[2,4],76:[2,4],77:[2,4],78:[2,4],79:[2,4],80:[2,4],82:[2,4],91:[2,4],93:[2,4]},{16:[1,184]},{10:[1,185]},{8:[2,27],10:[2,27],16:[2,27],32:[2,27],34:[2,27],35:[2,27],37:[2,27],39:[2,27],41:[2,27],42:[2,27],43:[2,27],45:[2,27],46:[2,27],47:[2,27],48:[2,27],50:[2,27],51:[2,27],53:[2,27],54:[2,27],55:[2,27],57:[2,27],64:[2,27],65:[2,27],66:[2,27],83:[2,27],86:[2,27]},{8:[2,95],10:[2,95],16:[2,95],32:[2,95],34:[2,95],35:[2,95],37:[2,95],39:[2,95],41:[2,95],42:[2,95],43:[2,95],45:[2,95],46:[2,95],47:[2,95],48:[2,95],50:[2,95],51:[2,95],53:[2,95],54:[2,95],55:[2,95],57:[2,95],64:[2,95],65:[2,95],66:[2,95],83:[2,95],86:[2,95]},{8:[2,101],10:[2,101],16:[2,101],32:[2,101],34:[2,101],35:[2,101],37:[2,101],39:[2,101],41:[2,101],42:[2,101],43:[2,101],45:[2,101],46:[2,101],47:[2,101],48:[2,101],50:[2,101],51:[2,101],53:[2,101],54:[2,101],55:[2,101],57:[2,101],64:[2,101],65:[2,101],66:[2,101],83:[2,101],86:[2,101]},{10:[2,105],86:[2,105]},{8:[2,102],10:[2,102],16:[2,102],32:[2,102],34:[2,102],35:[2,102],37:[2,102],39:[2,102],41:[2,102],42:[2,102],43:[2,102],45:[2,102],46:[2,102],47:[2,102],48:[2,102],50:[2,102],51:[2,102],53:[2,102],54:[2,102],55:[2,102],57:[2,102],64:[2,102],65:[2,102],66:[2,102],83:[2,102],86:[2,102]},{8:[1,37],9:186,20:[1,33],29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{6:6,7:[1,13],8:[1,37],9:20,11:187,13:7,14:[1,14],15:[1,15],16:[1,21],17:[1,16],18:8,19:[1,17],20:[1,33],21:[1,18],22:9,23:[1,19],24:11,25:5,26:[1,12],28:10,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{8:[1,37],9:188,20:[1,33],29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{16:[1,189]},{8:[2,103],10:[2,103],16:[2,103],32:[2,103],34:[2,103],35:[2,103],37:[2,103],39:[2,103],41:[2,103],42:[2,103],43:[2,103],45:[2,103],46:[2,103],47:[2,103],48:[2,103],50:[2,103],51:[2,103],53:[2,103],54:[2,103],55:[2,103],57:[2,103],64:[2,103],65:[2,103],66:[2,103],83:[2,103],86:[2,103]},{5:[2,3],7:[2,3],8:[2,3],12:[2,3],14:[2,3],15:[2,3],16:[2,3],17:[2,3],19:[2,3],20:[2,3],21:[2,3],23:[2,3],26:[2,3],27:[2,3],50:[2,3],51:[2,3],58:[2,3],65:[2,3],74:[2,3],75:[2,3],76:[2,3],77:[2,3],78:[2,3],79:[2,3],80:[2,3],82:[2,3],91:[2,3],93:[2,3]},{10:[1,190]},{5:[2,6],7:[2,6],8:[2,6],12:[2,6],14:[2,6],15:[2,6],16:[2,6],17:[2,6],19:[2,6],20:[2,6],21:[2,6],23:[2,6],26:[2,6],27:[2,6],50:[2,6],51:[2,6],58:[2,6],65:[2,6],74:[2,6],75:[2,6],76:[2,6],77:[2,6],78:[2,6],79:[2,6],80:[2,6],82:[2,6],91:[2,6],93:[2,6]},{6:6,7:[1,13],8:[1,37],9:20,11:191,13:7,14:[1,14],15:[1,15],16:[1,21],17:[1,16],18:8,19:[1,17],20:[1,33],21:[1,18],22:9,23:[1,19],24:11,25:5,26:[1,12],28:10,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{5:[2,5],7:[2,5],8:[2,5],12:[2,5],14:[2,5],15:[2,5],16:[2,5],17:[2,5],19:[2,5],20:[2,5],21:[2,5],23:[2,5],26:[2,5],27:[2,5],50:[2,5],51:[2,5],58:[2,5],65:[2,5],74:[2,5],75:[2,5],76:[2,5],77:[2,5],78:[2,5],79:[2,5],80:[2,5],82:[2,5],91:[2,5],93:[2,5]}],defaultActions:{3:[2,1],97:[2,84],98:[2,85],99:[2,86]},parseError:function(t,e){throw new Error(t)},parse:function(t){var e=this,i=[0],s=[null],r=[],o=this.table,n="",a=0,h=0,l=0;this.lexer.setInput(t),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,this.yy.parser=this,void 0===this.lexer.yylloc&&(this.lexer.yylloc={});var c=this.lexer.yylloc;r.push(c);var d=this.lexer.options&&this.lexer.options.ranges;function u(){var t;return"number"!=typeof(t=e.lexer.lex()||1)&&(t=e.symbols_[t]||t),t}"function"==typeof this.yy.parseError&&(this.parseError=this.yy.parseError);for(var p,f,A,_,m,g,b,v,y,C={};;){if(A=i[i.length-1],this.defaultActions[A]?_=this.defaultActions[A]:(null==p&&(p=u()),_=o[A]&&o[A][p]),void 0===_||!_.length||!_[0]){var P="";if(!l){for(g in y=[],o[A])this.terminals_[g]&&g>2&&y.push("'"+this.terminals_[g]+"'");P=this.lexer.showPosition?"Parse error on line "+(a+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+y.join(", ")+", got '"+(this.terminals_[p]||p)+"'":"Parse error on line "+(a+1)+": Unexpected "+(1==p?"end of input":"'"+(this.terminals_[p]||p)+"'"),this.parseError(P,{text:this.lexer.match,token:this.terminals_[p]||p,line:this.lexer.yylineno,loc:c,expected:y})}}if(_[0]instanceof Array&&_.length>1)throw new Error("Parse Error: multiple actions possible at state: "+A+", token: "+p);switch(_[0]){case 1:i.push(p),s.push(this.lexer.yytext),r.push(this.lexer.yylloc),i.push(_[1]),p=null,f?(p=f,f=null):(h=this.lexer.yyleng,n=this.lexer.yytext,a=this.lexer.yylineno,c=this.lexer.yylloc,l>0&&l--);break;case 2:if(b=this.productions_[_[1]][1],C.$=s[s.length-b],C._$={first_line:r[r.length-(b||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(b||1)].first_column,last_column:r[r.length-1].last_column},d&&(C._$.range=[r[r.length-(b||1)].range[0],r[r.length-1].range[1]]),void 0!==(m=this.performAction.call(C,n,h,a,this.yy,_[1],s,r)))return m;b&&(i=i.slice(0,-1*b*2),s=s.slice(0,-1*b),r=r.slice(0,-1*b)),i.push(this.productions_[_[1]][0]),s.push(C.$),r.push(C._$),v=o[i[i.length-2]][i[i.length-1]],i.push(v);break;case 3:return!0}}return!0}},e={node:function(t,e,i){return{type:t,value:e,children:i}},createNode:function(t,e,i,s){var r,o=this.node(e,i,[]);for(r=3;r20?"...":"")+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=new Array(t.length+1).join("-");return _jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.escapeHTML(t+this.upcomingInput()+"\n"+e+"^")},next:function(){if(this.done)return this.EOF;var t,e,i,s,r;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var o=this._currentRules(),n=0;ne[0].length)||(e=i,s=n,this.options.flex));n++);return e?((r=e[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+e[0].length},this.yytext+=e[0],this.match+=e[0],this.matches=e,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._input=this._input.slice(e[0].length),this.matched+=e[0],t=this.performAction.call(this,this.yy,this,o[s],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),t||void 0):""===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 void 0!==t?t:this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(t){this.begin(t)},options:{},performAction:function(t,e,i,s){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}}};return t}();function r(){this.yy={}}return t.lexer=s,r.prototype=t,t.Parser=r,new r}();parser.yy.parseError=parser.parseError,__webpack_exports__.A=_jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.JessieCode},873:function(t,e,i){"use strict";var s=i(443),r=i(188),o=i(477),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:"90ee90",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)]}}];s.A.rgbParser=function(t,e,i){var s,o,h,l,c,d,u,p,f,A,_=t;if(!r.A.exists(t))return[];if(r.A.exists(e)&&r.A.exists(i)&&(_=[t,e,i]),s=_,A=!1,r.A.isArray(s)){for(d=0;d<3;d++)A=A||/\./.test(_[d].toString());for(d=0;d<3;d++)A=A&&_[d]>=0&&_[d]<=1;return A?[Math.ceil(255*_[0]),Math.ceil(255*_[1]),Math.ceil(255*_[2])]:_}for("string"==typeof _&&(s=_),"#"===s.charAt(0)&&(s=s.slice(1,7)),s=s.replace(/ /g,"").toLowerCase(),s=n[s]||s,d=0;d255?255:u,p=p<0||isNaN(p)?0:p>255?255:p,f=f<0||isNaN(f)?0:f>255?255:f]},s.A.isColor=function(t){var e=(new Option).style;return e.color=t,""!==e.color},s.A.rgb2css=function(t,e,i){var r;return"rgb("+(r=s.A.rgbParser(t,e,i))[0]+", "+r[1]+", "+r[2]+")"},s.A.rgb2hex=function(t,e,i){var r,o,n;return o=(r=s.A.rgbParser(t,e,i))[1],n=r[2],r=(r=r[0]).toString(16),o=o.toString(16),n=n.toString(16),1===r.length&&(r="0"+r),1===o.length&&(o="0"+o),1===n.length&&(n="0"+n),"#"+r+o+n},s.A.hex2rgb=function(t){return s.A.deprecated("JXG.hex2rgb()","JXG.rgb2css()"),s.A.rgb2css(t)},s.A.hsv2hsl=function(t,e,i){var s=i*(1-.5*e);return[t,0===s||1===s?0:(i-s)/Math.min(s,1-s),s]},s.A.hsv2rgb=function(t,e,i){var s,r,n,a,h,l,c,d,u;if(t=(t%360+360)%360,0===e){if(!(isNaN(t)||t=360?0:t,c=i*(1-e),d=i*(1-e*(a=(l/=60)-(h=Math.floor(l)))),u=i*(1-e*(1-a)),h){case 0:s=i,r=u,n=c;break;case 1:s=d,r=i,n=c;break;case 2:s=c,r=i,n=u;break;case 3:s=c,r=d,n=i;break;case 4:s=u,r=c,n=i;break;case 5:s=i,r=c,n=d}return["#",s=2===(s=Math.round(255*s).toString(16)).length?s:1===s.length?"0"+s:"00",r=2===(r=Math.round(255*r).toString(16)).length?r:1===r.length?"0"+r:"00",n=2===(n=Math.round(255*n).toString(16)).length?n:1===n.length?"0"+n:"00"].join("")},s.A.rgb2hsv=function(t,e,i){var r,o,n,a,h,l,c,d,u,p,f,A,_;return o=(r=s.A.rgbParser(t,e,i))[1],n=r[2],a=(r=r[0])/255,h=o/255,l=n/255,A=Math.max(r,o,n),d=(_=Math.min(r,o,n))/255,p=0,(f=c=A/255)>0&&(p=(f-d)/f),u=1/(c-d),p>0&&(A===r?u*=h-l:u=A===o?2+(l-a)*u:4+(a-h)*u),(u*=60)<0&&(u+=360),A===_&&(u=0),[u,p,f]},s.A.rgb2LMS=function(t,e,i){var r,o,n,a,h,l,c,d=[[.05059983,.08585369,.0095242],[.01893033,.08925308,.01370054],[.00292202,.00975732,.07145979]];return o=(r=s.A.rgbParser(t,e,i))[1],n=r[2],r=r[0],r=Math.pow(r,.476190476),o=Math.pow(o,.476190476),n=Math.pow(n,.476190476),(c=[a=r*d[0][0]+o*d[0][1]+n*d[0][2],h=r*d[1][0]+o*d[1][1]+n*d[1][2],l=r*d[2][0]+o*d[2][1]+n*d[2][2]]).l=a,c.m=h,c.s=l,c},s.A.LMS2rgb=function(t,e,i){var s,r,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>4&15)+o.charAt(15&e))+i+i)},s.A.rgb2cb=function(t,e){var i,r,o,n,a,h,l,c,d,u,p,f="0123456789ABCDEF";if("none"===t)return t;switch(r=(a=s.A.rgb2LMS(t))[0],o=a[1],n=a[2],e=e.toLowerCase()){case"protanopia":h=-.06150039994295001,l=.08277001656812001,c=-.013200141220000003,d=.05858939668799999,u=-.07934519995360001,p=.013289415272000003,r=n/o<.6903216543277437?-(l*o+c*n)/h:-(u*o+p*n)/d;break;case"tritanopia":h=-.00058973116217,l=.007690316482,c=-.01011703519052,d=.025495080838999994,u=-.0422740347,p=.017005316784,n=o/r<.8349489908460004?-(h*r+l*o)/c:-(d*r+u*o)/p;break;default:h=-.06150039994295001,l=.08277001656812001,c=-.013200141220000003,d=.05858939668799999,u=-.07934519995360001,p=.013289415272000003,o=n/r<.5763833686400911?-(h*r+c*n)/l:-(d*r+p*n)/u}return i=s.A.LMS2rgb(r,o,n),t="#"+(f.charAt(i[0]>>4&15)+f.charAt(15&i[0])),t+=f.charAt(i[1]>>4&15)+f.charAt(15&i[1]),t+=f.charAt(i[2]>>4&15)+f.charAt(15&i[2])},s.A.shadeColor=function(t,e){var i=s.A.rgbParser(t),r=i[0],o=i[1],n=i[2];return r=(r=(r=parseInt(r+255*e))>0?r:0)<255?r:255,o=(o=(o=parseInt(o+255*e))>0?o:0)<255?o:255,n=(n=(n=parseInt(n+255*e))>0?n:0)<255?n:255,r=Math.round(r),o=Math.round(o),n=Math.round(n),s.A.rgb2hex([r,o,n])},s.A.lightenColor=function(t,e){return s.A.shadeColor(t,e)},s.A.darkenColor=function(t,e){return s.A.shadeColor(t,-1*e)},s.A.mixColor=function(t,e,i){var r,o=s.A.rgbParser(t),n=s.A.rgbParser(e),a=[];for(i=null!=i?i:.5,r=0;r<3;r++)a[r]=parseInt(o[r]*i+n[r]*(1-i));return s.A.rgb2hex(a)},s.A.autoHighlight=function(t){var e=s.A.rgba2rgbo(t),i=e[0],r=e[1];return"#"===t.charAt(0)?(r*=r<.3?1.8:.4,s.A.rgbo2rgba(i,r)):t},s.A.contrast=function(t,e,i,r){var o,n,a,h,l;return e=e||"#000000",i=i||"#ffffff",r=r||7,o=s.A.rgbParser(t),n=s.A.rgbParser("#000000"),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)),(l-=1)>r?e:i},s.A.setClassicColors=function(){s.A.Options.elements.strokeColor="blue",s.A.Options.elements.fillColor="red",s.A.Options.hatch.strokeColor="blue",s.A.Options.angle.fillColor="#ff7f00",s.A.Options.angle.highlightFillColor="#ff7f00",s.A.Options.angle.strokeColor="#ff7f00",s.A.Options.angle.label.strokeColor="blue",s.A.Options.arc.strokeColor="blue",s.A.Options.circle.center.fillColor="red",s.A.Options.circle.center.strokeColor="blue",s.A.Options.circumcircle.strokeColor="blue",s.A.Options.circumcircle.center.fillColor="red",s.A.Options.circumcircle.center.strokeColor="blue",s.A.Options.circumcirclearc.strokeColor="blue",s.A.Options.circumcirclesector.strokeColor="blue",s.A.Options.circumcirclesector.fillColor="green",s.A.Options.circumcirclesector.highlightFillColor="green",s.A.Options.conic.strokeColor="blue",s.A.Options.curve.strokeColor="blue",s.A.Options.incircle.strokeColor="blue",s.A.Options.incircle.center.fillColor="red",s.A.Options.incircle.center.strokeColor="blue",s.A.Options.inequality.fillColor="red",s.A.Options.integral.fillColor="red",s.A.Options.integral.curveLeft.color="red",s.A.Options.integral.curveRight.color="red",s.A.Options.line.strokeColor="blue",s.A.Options.point.fillColor="red",s.A.Options.point.strokeColor="red",s.A.Options.polygon.fillColor="green",s.A.Options.polygon.highlightFillColor="green",s.A.Options.polygon.vertices.strokeColor="red",s.A.Options.polygon.vertices.fillColor="red",s.A.Options.regularpolygon.fillColor="green",s.A.Options.regularpolygon.highlightFillColor="green",s.A.Options.regularpolygon.vertices.strokeColor="red",s.A.Options.regularpolygon.vertices.fillColor="red",s.A.Options.riemannsum.fillColor="yellow",s.A.Options.sector.fillColor="green",s.A.Options.sector.highlightFillColor="green",s.A.Options.semicircle.center.fillColor="red",s.A.Options.semicircle.center.strokeColor="blue",s.A.Options.slopetriangle.fillColor="red",s.A.Options.slopetriangle.highlightFillColor="red",s.A.Options.turtle.arrow.strokeColor="blue"},s.A.extend(s.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"}}),s.A.palette=s.A.paletteWong,e.A=s.A},133:function(t,e,i){"use strict";var s=i(443),r=i(188);s.A.extendConstants(s.A,{}),s.A.extend(s.A,{maxScreenCoord:16777215,isTouchEvent:function(t){return s.A.exists(t.touches)},isPointerEvent:function(t){return s.A.exists(t.pointerId)},isMouseEvent:function(t){return!s.A.isTouchEvent(t)&&!s.A.isPointerEvent(t)},getNumberOfTouchPoints:function(t){var e=-1;return s.A.isTouchEvent(t)&&(e=t.touches.length),e},isFirstTouch:function(t){var e=s.A.getNumberOfTouchPoints(t);return s.A.isPointerEvent(t)?t.isPrimary:1===e},isBrowser:"undefined"!=typeof window&&"undefined"!=typeof document&&"object"==typeof window&&"object"==typeof document,supportsES6:function(){try{return new 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&&"undefined"!=typeof process&&-1!==process.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 r.A.exists(navigator)&&navigator.userAgent.toLowerCase().indexOf("android")>-1},isWebkitAndroid:function(){return this.isAndroid()&&navigator.userAgent.indexOf(" AppleWebKit/")>-1},isApple:function(){return r.A.exists(navigator)&&(navigator.userAgent.indexOf("iPad")>-1||navigator.userAgent.indexOf("iPhone")>-1)},isWebkitApple:function(){return"GestureEvent"in window&&("ongesturechange"in window||void 0!==window&&"safari"in window&&"pushNotification"in window.safari)},isMetroApp:function(){return"object"==typeof window&&window.clientInformation&&window.clientInformation.appVersion&&window.clientInformation.appVersion.indexOf("MSAppHost")>-1},isMozilla:function(){return r.A.exists(navigator)&&navigator.userAgent.toLowerCase().indexOf("mozilla")>-1&&-1===navigator.userAgent.toLowerCase().indexOf("apple")},isFirefoxOS:function(){return r.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("undefined"==typeof document||null===document||"object"!=typeof document)return 0;e=(t=document.createElement("div")).getElementsByTagName("i");do{t.innerHTML="\x3c!--[if gt IE "+ ++i+"]>4?i:void 0}(),getDimensions:function(t,e){var i,s,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=r.A.isString(t)?e.getElementById(t):t,!r.A.exists(i))throw new Error("\nJSXGraph: HTML container element '"+t+"' not found.");return"none"!==(s=i.style.display)&&null!==s?i.clientWidth>0&&i.clientHeight>0?{width:i.clientWidth,height:i.clientHeight}:(d=window.getComputedStyle?window.getComputedStyle(i):i.style,{width:u.test(d.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,s,o){var n=function(){return i.apply(s,arguments)};n.origin=i,"object"==typeof s&&r.A.exists(s.BOARD_MODE_NONE)&&(s["x_internal"+e]=s["x_internal"+e]||[],s["x_internal"+e].push(n)),r.A.exists(t)&&r.A.exists(t.addEventListener)&&(o=o||!1,t.addEventListener(e,n,o)),r.A.exists(t)&&r.A.exists(t.attachEvent)&&t.attachEvent("on"+e,n)},removeEvent:function(t,e,i,o){var n;if(r.A.exists(o))if(r.A.exists(o["x_internal"+e]))if(r.A.isArray(o["x_internal"+e]))if(-1!==(n=r.A.indexOf(o["x_internal"+e],i,"origin"))){try{r.A.exists(t)&&r.A.exists(t.removeEventListener)&&t.removeEventListener(e,o["x_internal"+e][n],!1),r.A.exists(t)&&r.A.exists(t.detachEvent)&&t.detachEvent("on"+e,o["x_internal"+e][n])}catch(t){s.A.debug("removeEvent: event not registered in browser: ("+e+" -- "+i+")")}o["x_internal"+e].splice(n,1)}else s.A.debug("removeEvent: no such event function in internal list: "+i);else s.A.debug("owner[x_internal + "+e+"] is not an array");else s.A.debug("removeEvent: no such type: "+e);else s.A.debug("no such owner")},removeAllEvents:function(t,e,i){var r;if(i["x_internal"+e]){for(r=i["x_internal"+e].length-1;r>=0;r--)s.A.removeEvent(t,e,i["x_internal"+e][r].origin,i);i["x_internal"+e].length>0&&s.A.debug("removeAllEvents: Not all events could be removed.")}},getPosition:function(t,e,i){var s,o,n,a=0,h=0;if(t||(t=window.event),i=i||document,n=t.touches,r.A.exists(n)&&0===n.length&&(n=t.changedTouches),r.A.exists(e)&&r.A.exists(n))if(-1===e){for(o=n.length,s=0;s=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,s,o,n,a,h,l,c=["transform","webkitTransform","MozTransform","msTransform","oTransform"];for(a=c.length,i=0,o="";i0){for(a=o.length,s=0,h=(l=o.substring(n+1,a-1).split(",")).length;s0){for(a=s.length,i=0,h=(o=s.substring(n+1,a-1).split(",")).length;i0&&+new Date-n<300);r.length>0?window.setTimeout(o,1):s(t)};window.setTimeout(o,1)},scaleJSXGraphDiv:function(t,e,i,r){var o,n,a,h,l,c,d,u,p,f,A,_,m=r;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*m&&(d=(c=o*m)*A),d>n*m&&(c=(d=n*m)/A),h=c,p=A-1&&this.eventHandlers[t].splice(i,1),0===this.eventHandlers[t].length&&delete this.eventHandlers[t]):delete this.eventHandlers[t],this):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={}}},e.A=s.A.EventEmitter},713:function(t,e,i){"use strict";var s=i(443),r=i(188),o=i(561),n=i(904);s.A.Expect={each:function(t,e,i){var s,o,n=[];if(r.A.exists(t.length))for(o=t.length,s=0;s1))||(s=t.select(e),this.isPoint(s)))},isPointType3D:function(t,e){var i,s;return!!(this.isArray(e)&&e.length>=3)||(!!(this.isFunction(e)&&(i=e(),this.isArray(i)&&i.length>=3))||(s=t.select(e),this.isPoint3D(s)))},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===r.A.OBJECT_TYPE_TRANSFORMATION}return!1},isEmpty:function(t){return 0===Object.keys(t).length},exists:function(t,e){var i=!(null==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)?(e='{"'+(e=(e=(e=(e=e.replace(/\s*;\s*$/g,"")).replace(/\s*;\s*/g,'","')).replace(/\s*:\s*/g,'":"')).trim())+'"}',JSON.parse(e)):{}},css2js:function(t){var e,i,r,o,n,a=[],h=s.A.trim(t).replace(/;$/,"").split(";");for(i=h.length,e=0;e0&&(n=Math.min(o,c-1),h=this.copyAttributes(i,t.options,s,r[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,s,r){var o,n,a,h,l,c=0,d=[];for(this.isArray(e)||(e=[e]),a=e.length,this.exists(r)&&(c=r.length),0===c&&(h=this.copyAttributes(i,t.board.options,s)),o=0;o0&&(n=Math.min(o,c-1),h=this.copyAttributes(i,t.board.options,s,r[n])),this.isArray(e[o])&&e[o].length>0&&e[o].every(t=>this.isArray(t)&&this.isNumber(t[0])))for(n=0;nthis.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){var e,i,s;if(this.isFunction(t))return t();if(this.isArray(t)){for(i=t.length,s=[],e=0;e0;s--)Math.abs(i[s]-i[s-1])-1},coordsArrayToMatrix:function(t,e){var i,s=[],r=[];for(i=0;i=.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 s;return this.isString(t)&&t.indexOf("%")>-1?(s=t.replace(/\s+%\s+/,""),parseFloat(s)*e*.01):this.isString(t)&&t.indexOf("fr")>-1?(s=t.replace(/\s+fr\s+/,""),parseFloat(s)*e):this.isString(t)&&t.indexOf("px")>-1?(s=t.replace(/\s+px\s+/,""),s=parseFloat(s),this.isFunction(i)?i(s):this.isNumber(i)?s*i:s):parseFloat(t)},parsePosition:function(t){var e,i,s="",r="";if(""!==(t=t.trim()))for(e=t.split(/[ ,]+/),i=0;i/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"0"!==t&&(t=t.replace(/^0+/,"")),(t.indexOf(".")>=0||t.indexOf(",")>=0)&&(t=t.replace(/0+$/,"")),"."!==t[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,s,r,o,n,a,h,l=t.length,c=[];if(this.exists(e)&&"function"!=typeof e&&"object"!=typeof e)return c;for(i=0;i/g,">")),t)},evalSlider:function(t){return t&&t.type===r.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}}),e.A=s.A}},__webpack_module_cache__={};function __webpack_require__(t){var e=__webpack_module_cache__[t];if(void 0!==e)return e.exports;var i=__webpack_module_cache__[t]={exports:{}};return __webpack_modules__[t](i,i.exports,__webpack_require__),i.exports}__webpack_require__.d=function(t,e){for(var i in e)__webpack_require__.o(e,i)&&!__webpack_require__.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},__webpack_require__.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)};var __webpack_exports__={};return function(){"use strict";__webpack_require__.d(__webpack_exports__,{default:function(){return ct}});var t=__webpack_require__(443),e=__webpack_require__(133),i=__webpack_require__(561),s=__webpack_require__(188);t.A.XML={cleanWhitespace:function(t){for(var e=t.firstChild;s.A.exists(e);)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 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}},e=(new i).parseFromString(t,"text/xml"),this.cleanWhitespace(e),e}};t.A.XML;var r=__webpack_require__(454),o=(__webpack_require__(713),__webpack_require__(477));o.A.ProbFuncs={MAXNUM:17014118346046923e22,SQRTH:.7071067811865476,SQRT2:1.4142135623730951,MAXLOG:708.3964185322641,P:[2.461969814735305e-10,.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,s,r,o;return t=Math.abs(t),e<0&&(t=-t),i=(r=this.MINV*Math.floor(this.M*t+.5))*r,s=2*r*(o=t-r)+o*o,e<0&&(i=-i,s=-s),i+s>this.MAXLOG?1/0:i=Math.exp(i)*Math.exp(s)},polevl:function(t,e,i){var r,o;if(s.A.exists(e.reduce))return e.reduce(function(e,i){return e*t+i},0);for(o=0,r=0;o<=i;o++)r=r*t+e[o];return r},p1evl:function(t,e,i){var r,o;if(s.A.exists(e.reduce))return e.reduce(function(e,i){return e*t+i},1);for(o=0,r=1;o0&&(i=1-i)),i},_underflow:function(t){return t<0?2:0},erfc:function(t){var e,i,s,r,o;return(s=t<0?-t:t)<1?1-this.erf(t):(o=-t*t)<-this.MAXLOG?this._underflow(t):(o=this.expx2(t,-1),s<8?(e=this.polevl(s,this.P,8),i=this.p1evl(s,this.Q,8)):(e=this.polevl(s,this.R,5),i=this.p1evl(s,this.S,6)),r=o*e/i,t<0&&(r=2-r),0===r?this._underflow(t):r)},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.90562251262117,-1.1833162112133],P1:[4.0554489230596245,31.525109459989388,57.16281922464213,44.08050738932008,14.684956192885803,2.1866330685079025,-.1402560791713545,-.03504246268278482,-.0008574567851546854],Q1:[15.779988325646675,45.39076351288792,41.3172038254672,15.04253856929075,2.504649462083094,-.14218292285478779,-.03808064076915783,-.0009332594808954574],P2:[3.2377489177694603,6.915228890689842,3.9388102529247444,1.3330346081580755,.20148538954917908,.012371663481782003,.00030158155350823543,26580697468673755e-22,6.239745391849833e-9],Q2:[6.02427039364742,3.6798356385616087,1.3770209948908132,.21623699359449663,.013420400608854318,.00032801446468212774,28924786474538068e-22,6.790194080099813e-9],ndtri:function(t){var e,i,s,r,o;return t<=0?-1/0:t>=1?1/0:(o=1,(i=t)>.8646647167633873&&(i=1-i,o=0),i>.1353352832366127?(e=(i-=.5)+i*((r=i*i)*this.polevl(r,this.P0,4)/this.p1evl(r,this.Q0,8)),e*=this.s2pi):(s=1/(e=Math.sqrt(-2*Math.log(i))),e=e-Math.log(e)/e-(e<8?s*this.polevl(s,this.P1,8)/this.p1evl(s,this.Q1,8):s*this.polevl(s,this.P2,8)/this.p1evl(s,this.Q2,8)),0!==o&&(e=-e),e))},erfi:function(t){return this.ndtri(.5*(t+1))*this.SQRTH}};o.A.ProbFuncs;var n=__webpack_require__(733);o.A.Extrapolate={upper:15,infty:1e4,wynnEps:function(t,e,i){var s,r,o,n,a;if(i[e]=t,0===e)a=t;else{for(o=0,s=e;s>0;s--)r=o,o=i[s-1],n=i[s]-o,Math.abs(n)<=1e-15?i[s-1]=1e20:i[s-1]=1*r+1/n;a=i[e%2]}return a},aitken:function(t,e,i){var s,r,o,n,a,h;if(i[e]=t,e<2)s=t;else{for(n=e/2,a=1;a<=n;a++)r=i[(h=e-2*a)+2]-2*i[h+1]+i[h],Math.abs(r)<1e-15?i[h]=1e20:(o=i[h]-i[h+1],i[h]-=o*o/r);s=i[e%2]}return s},brezinski:function(t,e,i){var s,r,o,n,a,h,l,c;if(i[e]=t,e<3)s=t;else{for(h=e/3,c=e,l=1;l<=h;l++)o=i[(c-=3)+1]-i[c],n=i[c+2]-i[c+1],r=(a=i[c+3]-i[c+2])*(n-o)-o*(a-n),Math.abs(r)<1e-15?i[c]=1e20:i[c]=i[c+1]-o*n*(a-n)/r;s=i[e%3]}return s},iteration:function(t,e,i,s,r){var o,n,a,h,l=NaN,c=[],d="finite",u=e;for(r=r||0,o=1;o<=this.upper;o++){if(n=i(t+(u=0===r?e/(o+1):.5*u),!0),a=this[s](n,o-1,c),isNaN(a)){d="NaN";break}if(0!==n&&a/n>this.infty){l=a,d="infinite";break}if(h=a-l,Math.abs(h)<1e-7)break;l=a}return[l,d,1-(o-1)/this.upper]},levin:function(t,e,i,s,r,o){var n,a,h,l;if(l=1/(s+e),r[e]=t/i,o[e]=1/i,e>0&&(r[e-1]=r[e]-r[e-1],o[e-1]=o[e]-o[e-1],e>1))for(h=(s+e-1)*l,n=2;n<=e;n++)a=(s+e-n)*Math.pow(h,n-2)*l,r[e-n]=r[e-n+1]-a*r[e-n],o[e-n]=o[e-n+1]-a*o[e-n],l*=h;return Math.abs(o[0])<1e-15?1e20:r[0]/o[0]},iteration_levin:function(t,e,i,s){var r,o,n,a,h,l,c,d=NaN,u=[],p=[],f="finite",A=e;for(s=s||0,a=i(t+e,!0),r=1;r<=this.upper;r++){if(h=(o=i(t+(A=0===s?e/(r+1):.5*A),!0))-a,c="u"===(Math.abs(h)<1?"u":"t")?(1+r)*h:h,a=o,l=(n=this.levin(o,r-1,c,1,u,p))-d,isNaN(n)){f="NaN";break}if(0!==o&&n/o>this.infty){d=n,f="infinite";break}if(Math.abs(l)<1e-7)break;d=n}return[d,f,1-(r-1)/this.upper]},limit:function(t,e,i){return this.iteration_levin(t,e,i,0)}};var a=o.A.Extrapolate,h=__webpack_require__(571);o.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},s.A.extend(o.A.Quadtree.prototype,{contains:function(t,e){return this.xlbr?a.yub:r,o=a.xub>o?a.xub:o,n=a.ylbthis.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,s,r,o,n),this},insertItem:function(t){var e,i,s,r,o,n,a,h,l=[],c=[],d=[],u=[];return null===this.bbox?(e=r=1/0,s=i=-1/0,e=t.xlbi?t.yub:i,s=t.xub>s?t.xub:s,r=t.ylbthis.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,s,r),this)},subdivide:function(t,e,i,s,r,o,n,a){return t.length>0&&(null===this.northWest&&(this.northWest=new JXG.Math.BoxQuadtree(this.depth,this.capacity,[r,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,[r,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)),s.length>0&&(null===this.southEast&&(this.southEast=new JXG.Math.BoxQuadtree(this.depth,this.capacity,[this.cx,this.cy,n,a])),this.southEast.insert(s)),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},o=[];for(i=this.items.length,e=0;e=this.cy&&s.A.concat(o,this.northWest.find(t)),null!==this.southWest&&t[0]<=this.cx&t[3]<=this.cy&&s.A.concat(o,this.southWest.find(t)),null!==this.northEast&&t[2]>=this.cx&t[1]>=this.cy&&s.A.concat(o,this.northEast.find(t)),null!==this.southEast&&t[2]>=this.cx&t[3]<=this.cy&&s.A.concat(o,this.southEast.find(t)),o},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(),s.A.concat(e,t[0]),s.A.concat(i,t[1])),null!==this.northEast&&(t=this.northEast.plot(),s.A.concat(e,t[0]),s.A.concat(i,t[1])),null!==this.southEast&&(t=this.southEast.plot(),s.A.concat(e,t[0]),s.A.concat(i,t[1])),null!==this.southWest&&(t=this.southWest.plot(),s.A.concat(e,t[0]),s.A.concat(i,t[1])),[e,i]}});var c=o.A.BoxQuadtree,d=__webpack_require__(171);t.A.Math.Nlp={arr:function(t){return new Float64Array(t)},arr2:function(t,e){for(var i=0,s=new Array(t);i=2&&console.log("The initial value of RHO is "+z+" and PARMU is set to zero."),m=0,A=1/z,d=1;d<=e;++d)Z[d][U]=r[d],Z[d][d]=z,Q[d][d]=A;g=U,b=!1;t:for(;;){if(m>=h&&m>0){Y=this.MaxIterationsReached;break t}for(++m,V=t(e,i,r,q),X=0,p=1;p<=i;++p)X=Math.max(X,-q[p]);if(m!==a-1&&3!==a||this.PrintIterationResult(m,V,X,r,e,a),q[F]=V,q[s]=X,v=!0,!b){for(v=!1,d=1;d<=s;++d)tt[d][g]=q[d];if(m<=U){if(g<=e)if(tt[F][U]<=V)r[g]=Z[g][U];else{for(Z[g][U]=r[g],p=1;p<=s;++p)tt[p][g]=tt[p][U],tt[p][U]=q[p];for(p=1;p<=g;++p){for(Z[g][p]=-z,A=0,d=p;d<=g;++d)A-=Q[d][p];Q[g][p]=A}}if(m<=e){r[g=m]+=z;continue t}}b=!0}e:for(;;){i:do{if(!v){for(y=tt[F][U]+J*tt[s][U],C=U,u=1;u<=e;++u)(A=tt[F][u]+J*tt[s][u]).1){Y=this.DivergingRoundingErrors;break t}for(p=1;p<=F;++p){for(q[p]=-tt[p][U],u=1;u<=e;++u)nt[u]=tt[p][u]+q[p];for(d=1;d<=e;++d)et[d][p]=(p===F?-1:1)*this.DOT_PRODUCT_ROW_COL(nt,-1,Q,d,1,e)}for(G=!0,H=.25*z,E=2.1*z,u=1;u<=e;++u){for(x=0,O=0,p=1;p<=e;++p)x+=Q[u][p]*Q[u][p],O+=Z[p][u]*Z[p][u];it[u]=1/Math.sqrt(x),st[u]=Math.sqrt(O),(it[u]E)&&(G=!1)}if(!b&&!G){for(g=0,A=E,u=1;u<=e;++u)st[u]>A&&(g=u,A=st[u]);if(0===g)for(u=1;u<=e;++u)it[u]2*c?-1:1,A=0,d=1;d<=e;++d)ot[d]=S*ot[d],Z[d][g]=ot[d],A+=Q[g][d]*ot[d];for(p=1;p<=e;++p)Q[g][p]/=A;for(u=1;u<=e;++u){if(u!==g)for(A=this.DOT_PRODUCT_ROW_COL(Q,u,ot,-1,1,e),p=1;p<=e;++p)Q[u][p]-=A*Q[g][p];r[u]=Z[u][U]+ot[u]}continue t}if(!(W=this.trstlp(e,i,et,q,z,ot))){for(A=0,p=1;p<=e;++p)A+=ot[p]*ot[p];if(A<.25*z*z){b=!0;break i}}for(c=0,T=0,q[F]=0,p=1;p<=F;++p)c=q[p]-this.DOT_PRODUCT_ROW_COL(ot,-1,et,p,1,e),p0?c/$:0))for(J=2*N,a>=2&&console.log("Increase in PARMU to "+J),D=tt[F][U]+J*tt[s][U],u=1;u<=e;++u)if((A=tt[F][u]+J*tt[s][u])L&&(g=u,L=A),rt[u]=A*it[u];for(R=1.1*z,f=0,u=1;u<=e;++u)if(rt[u]>=H||rt[u]>=it[u]){if(A=st[u],k>0){for(A=0,p=1;p<=e;++p)A+=Math.pow(ot[p]-Z[p][u],2);A=Math.sqrt(A)}A>R&&(f=u,R=A)}if(f>0&&(g=f),0!==g){for(A=0,d=1;d<=e;++d)Z[d][g]=ot[d],A+=Q[g][d]*ot[d];for(p=1;p<=e;++p)Q[g][p]/=A;for(u=1;u<=e;++u)if(u!==g)for(A=this.DOT_PRODUCT_ROW_COL(Q,u,ot,-1,1,e),p=1;p<=e;++p)Q[u][p]-=A*Q[g][p];for(p=1;p<=s;++p)tt[p][g]=q[p];if(k>0&&k>=.1*K)continue e}}while(0);if(G){if(z<=n){Y=this.Normal;break t}if(B=0,I=0,(z*=.5)<=1.5*n&&(z=n),J>0){for(j=0,p=1;p<=F;++p){for(I=B=tt[p][U],d=1;d<=e;++d)B=Math.min(B,tt[p][d]),I=Math.max(I,tt[p][d]);p<=i&&B<.5*I&&(A=Math.max(I,0)-B,j=j<=0?A:Math.min(j,A))}0===j?J=0:I-B=2&&console.log("Reduction in RHO to "+z+" and PARMU = "+J),2===a&&this.PrintIterationResult(m,tt[F][U],tt[s][U],this.COL(Z,U),e,a)}else b=!1}}switch(Y){case this.Normal:if(a>=1&&console.log("%nNormal return from subroutine COBYLA%n"),W)return a>=1&&this.PrintIterationResult(m,V,X,r,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)r[p]=Z[p][U];return V=tt[F][U],X=tt[s][U],a>=1&&this.PrintIterationResult(m,V,X,r,e,a),Y},trstlp:function(t,e,i,s,r,n){var a,h,l,c,d,u,p,f,A,_,m,g,b,v,y,C,P,E,x,O,M,w,S,T,N,D,k,L,R,B,I,j,Y,V=0,X=0,U=0,F=this.arr2(1+t,1+t),z=this.arr(2+e),J=this.arr(2+e),G=this.arr(1+t),W=this.arr(1+t),H=this.arr(2+e),$=this.arr(2+e),K=e,q=0;for(l=1;l<=t;++l)F[l][l]=1,n[l]=0;if(a=0,h=0,e>=1){for(c=1;c<=e;++c)s[c]>h&&(h=s[c],a=c);for(c=1;c<=e;++c)$[c]=c,J[c]=h-s[c]}d=!0;do{t:for(;;){(!d||d&&0===h)&&(a=K=e+1,$[K]=K,J[K]=0),d=!1,u=0,p=0,f=0,A=0;e:do{if(_=K===e?h:-this.DOT_PRODUCT_ROW_COL(n,-1,i,K,1,t),0===p||_X?(X=q,p=3):--p,0===p)break t;if(m=0,a<=q){if(ae)for(V=1/z[q],c=1;c<=t;++c)G[c]=V*F[c][q];else for(V=this.DOT_PRODUCT_ROW_COL(G,-1,F,q+1,1,t),c=1;c<=t;++c)G[c]-=V*F[c][q+1]}else{for(C=$[a],c=1;c<=t;++c)W[c]=i[c][C];for(O=0,c=t;c>q;){for(P=0,M=0,l=1;l<=t;++l)P+=V=F[l][c]*W[l],M+=Math.abs(V);if(w=M+.1*Math.abs(P),S=M+.2*Math.abs(P),(M>=w||w>=S)&&(P=0),0===O)O=P;else for(y=c+1,E=P/(V=o.A.hypot(P,O)),x=O/V,O=V,l=1;l<=t;++l)V=E*F[l][c]+x*F[l][y],F[l][y]=E*F[l][y]-x*F[l][c],F[l][c]=V;--c}if(0===O){m=-1,c=q;do{for(T=0,N=0,l=1;l<=t;++l)T+=V=F[l][c]*W[l],N+=Math.abs(V);if(w=N+.1*Math.abs(T),S=N+.2*Math.abs(T),N0&&$[c]<=e&&(Y=J[c]/V,(m<0||Y=2)for(D=$[c],l=1;l<=t;++l)W[l]-=V*i[l][D];H[c]=V}else H[c]=0}while(--c>0);if(m<0)break t;for(c=1;c<=q;++c)J[c]=Math.max(0,J[c]-m*H[c]);if(ae&&C!==K){for(c=q-1,P=this.DOT_PRODUCT(this.PART(this.COL(F,c),1,t),this.PART(this.COL(i,C),1,t)),V=o.A.hypot(P,z[q]),E=z[q]/V,x=P/V,z[q]=E*z[c],z[c]=V,l=1;l<=t;++l)V=E*F[l][q]+x*F[l][c],F[l][q]=E*F[l][c]-x*F[l][q],F[l][c]=V;$[q]=$[c],$[c]=C,V=J[c],J[c]=J[q],J[q]=V}if(K>e)for(V=1/z[q],c=1;c<=t;++c)G[c]=V*F[c][q];else for(C=$[q],V=(this.DOT_PRODUCT_ROW_COL(G,-1,i,C,1,t)-1)/z[q],c=1;c<=t;++c)G[c]-=V*F[c][q]}for(k=r*r,R=0,L=0,l=1;l<=t;++l)Math.abs(n[l])>=1e-6*r&&(k-=n[l]*n[l]),R+=n[l]*G[l],L+=G[l]*G[l];if(k<=0)break t;if(V=Math.sqrt(L*k),Math.abs(R)>=1e-6*V&&(V=Math.sqrt(L*k+R*R)),f=A=k/(V+R),K===e){if(S=f+.2*h,f>=(w=f+.1*h)||w>=S)break e;f=Math.min(f,h)}for(c=1;c<=t;++c)W[c]=n[c]+f*G[c];if(K===e)for(U=h,h=0,c=1;c<=q;++c)V=s[C=$[c]]-this.DOT_PRODUCT_ROW_COL(W,-1,i,C,1,t),h=Math.max(h,V);c=q;do{for(B=0,I=0,l=1;l<=t;++l)B+=V=F[l][c]*W[l],I+=Math.abs(V);if(w=I+.1*Math.abs(B),S=I+.2*Math.abs(B),(I>=w||w>=S)&&(B=0),H[c]=B/z[c],c>=2)for(C=$[c],l=1;l<=t;++l)W[l]-=H[c]*i[l][C]}while(c-- >=2);for(K>e&&(H[q]=Math.max(0,H[q])),c=1;c<=t;++c)W[c]=n[c]+f*G[c];if(K>q)for(c=q+1;c<=K;++c){for(v=h-s[C=$[c]],j=h+Math.abs(s[C]),l=1;l<=t;++l)v+=V=i[l][C]*W[l],j+=Math.abs(V);w=j+.1*Math.abs(v),S=j+.2*Math.abs(v),(j>=w||w>=S)&&(v=0),H[c]=v}for(m=1,a=0,c=1;c<=K;++c)H[c]<0&&(V=J[c]/(J[c]-H[c]))0);if(f===A)return!0}}while(K===e);return!1},PrintIterationResult:function(t,e,i,s,r,o){o>1&&console.log("NFVALS = "+t+" F = "+e+" MAXCV = "+i),o>1&&console.log("X = "+this.PART(s,1,r))},ROW:function(t,e){return t[e].slice()},COL:function(t,e){var i,s=t.length,r=[];for(i=0;io.A.eps)){s=!0;break}return s},updateParametricCurveNaive:function(t,e,s,r){var o,n,a=!1,h=(s-e)/r;for(o=0;or.canvasHeight&&s>r.canvasHeight||t<0&&i<0||t>r.canvasWidth&&i>r.canvasWidth},isDistOK:function(t,e,i,s){return Math.abs(t)=o.A.eps&&(s=(r*a+n*h)/l)>0&&(s<=1?(r-=s*a,n-=s*h):(r-=a,n-=h)),o.A.hypot(r,n)};for(t.A.deprecated("Curve.updateParametricCurveOld()"),e.board.updateQuality===e.board.BOARD_QUALITY_LOW?(A=15,_=10,m=10):(A=21,_=.7,m=.7),P[0]=r-s,n=1;n1&&O(e.points[x-2].scrCoords,[h,l],e.points[x-1].scrCoords)<.015&&(x-=1),e.points[x]=new u.A(i.A.COORDS_BY_SCREEN,[h,l],e.board,!1),e.points[x]._t=a,x+=1,c=h,d=l,h=C[p-=1][0],l=C[p][1],f=y[p]+1,n=2*v[p]}while(p>0&&x<5e5);return e.numberPoints=e.points.length,e},_insertPoint_v2:function(t,e,i){var s=!isNaN(this._lastCrds[1]+this._lastCrds[2]),r=!isNaN(e.scrCoords[1]+e.scrCoords[2]),o=t.board.canvasWidth,n=t.board.canvasHeight,a=500;(!(r=r&&e.scrCoords[1]>-500&&e.scrCoords[2]>-500&&e.scrCoords[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 s,r,n=new u.A(i.A.COORDS_BY_USER,[0,0],t.board,!1);return s=e+o.A.eps,n.setCoordinates(i.A.COORDS_BY_USER,[t.X(s,!0),t.Y(s,!0)],!1),r=n.usrCoords,!!(isNaN(r[1]+r[2])||(s=e-o.A.eps,n.setCoordinates(i.A.COORDS_BY_USER,[t.X(s,!0),t.Y(s,!0)],!1),r=n.usrCoords,isNaN(r[1]+r[2])))},_borderCase:function(t,e,s,r,o,n,a,h){var l,c,d,p,f,A,_=null,m=!1;if(h<=1){if(c=new u.A(i.A.COORDS_BY_USER,[0,0],t.board,!1),isNaN(e[1]+e[2])&&!isNaN(r[1]+r[2])&&!this.neighborhood_isNaN_v2(t,o))return!1;if(isNaN(s[1]+s[2])&&!isNaN(r[1]+r[2])&&!this.neighborhood_isNaN_v2(t,n))return!1;if(isNaN(r[1]+r[2])&&(!isNaN(e[1]+e[2])||!isNaN(s[1]+s[2]))&&!this.neighborhood_isNaN_v2(t,a))return!1;p=0;do{if(isNaN(e[1]+e[2])&&!isNaN(r[1]+r[2]))f=o,A=a;else if(isNaN(s[1]+s[2])&&!isNaN(r[1]+r[2]))f=n,A=a;else if(isNaN(r[1]+r[2])&&!isNaN(s[1]+s[2]))f=a,A=n;else{if(!isNaN(r[1]+r[2])||isNaN(e[1]+e[2]))return!1;f=a,A=o}l=.5*(f+A),c.setCoordinates(i.A.COORDS_BY_USER,[t.X(l,!0),t.Y(l,!0)],!1),d=c.usrCoords,(m=isNaN(d[1]+d[2]))?f=l:A=l,++p}while(m&&p<30);if(p<30&&(_=d.slice(),r=d.slice(),A=l),null!==_)return this._insertPoint_v2(t,new u.A(i.A.COORDS_BY_USER,_,t.board,!1)),!0}return!1},_plotRecursive_v2:function(t,e,s,r,o,n,a){var h,l,c,d,p,f=0,A=new u.A(i.A.COORDS_BY_USER,[0,0],t.board,!1);if(!(t.numberPoints>65536))return n.99*c[0]||c[1]>.99*c[0]||c[0]===1/0||c[1]===1/0||c[2]===1/0),no.A.eps||Math.abs(n.left_y-n.right_y)>o.A.eps)||((h=new u.A(i.A.COORDS_BY_SCREEN,e,t.board))._t=s,t.points.push(h)),(l=new u.A(i.A.COORDS_BY_USER,[n.right_x,n.right_y],t.board))._t=s,t.points.push(l),this._lastScrCrds=l.copy("scrCoords"),this._lastUsrCrds=l.copy("usrCoords"))},_insertPoint:function(t,e,r,o,n){var a,h=!isNaN(this._lastScrCrds[1]+this._lastScrCrds[2]),l=!isNaN(e[1]+e[2]),c=t.board.canvasWidth,d=t.board.canvasHeight,p=500;s.A.exists(n)?this._insertLimesPoint(t,e,r,o,n):(l=l&&e[1]>-500&&e[2]>-500&&e[1]n+o&&i[1]>n+o||t[2]>a+o&&i[2]>a+o)},_isOutsidePoint:function(t,e){var i=500,s=e.canvasWidth,r=e.canvasHeight;return!!(t[1]<-500||t[2]<-500||t[1]>s+i||t[2]>r+i)},_findStartPoint:function(t,e,i,s,r){return[e,i]},_getBorderPos:function(t,e,s,r,n,a,h){var l,c,d,p,f,A;if(c=new u.A(i.A.COORDS_BY_USER,[0,0],t.board,!1),p=0,isNaN(s[1]+s[2])&&!isNaN(n[1]+n[2]))A=e,f=r;else if(isNaN(h[1]+h[2])&&!isNaN(n[1]+n[2]))A=a,f=r;else if(isNaN(n[1]+n[2])&&!isNaN(h[1]+h[2]))A=r,f=a;else{if(!isNaN(n[1]+n[2])||isNaN(s[1]+s[2]))return!1;A=r,f=e}do{l=.5*(f+A),c.setCoordinates(i.A.COORDS_BY_USER,[t.X(l,!0),t.Y(l,!0)],!1),d=c.usrCoords,isNaN(d[1]+d[2])?A=l:f=l,++p}while(p<30&&Math.abs(f-A)>o.A.eps);return l},_getCuspPos:function(t,e,i){var s=[t.X(e,!0),t.Y(e,!0)],r=[t.X(i,!0),t.Y(i,!0)];return d.A.fminbr(function(e){var i=[t.X(e,!0),t.Y(e,!0)];return-(o.A.hypot(s[0]-i[0],s[1]-i[1])+o.A.hypot(r[0]-i[0],r[1]-i[1]))},[e,i],t)},_getJumpPos:function(t,e,i){return d.A.fminbr(function(e){var i=o.A.eps*o.A.eps,s=[t.X(e,!0),t.Y(e,!0)],r=[t.X(e+i,!0),t.Y(e+i,!0)];return-Math.abs((r[1]-s[1])/(r[0]-s[0]))},[e,i],t)},_getLimits:function(t,e){var i,s,r,o,n,h=2/(t.maxX()-t.minX());return s=(i=a.limit(e,-h,t.X))[0],"infinite"===i[1]&&(s=Math.sign(s)*(1/0)),o=(i=a.limit(e,-h,t.Y))[0],"infinite"===i[1]&&(o=Math.sign(o)*(1/0)),r=(i=a.limit(e,h,t.X))[0],"infinite"===i[1]&&(r=Math.sign(r)*(1/0)),n=(i=a.limit(e,h,t.Y))[0],"infinite"===i[1]&&(n=Math.sign(n)*(1/0)),{left_x:s,left_y:o,right_x:r,right_y:n,t:e}},_getLimes:function(t,e,i,s,r,o,n,a,h){var l;return"border"===a?l=this._getBorderPos(t,e,i,s,r,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,s,r,o){var n,a,h,l,c,d,u,p,f,A,_,m=null,g=!1,b="",v=[],y=0;for(p=t.board.origin.scrCoords,v[y++]=[e,i,s,r,o,1/0];y>0;){if(e=(_=v[--y])[0],i=_[1],s=_[2],r=_[3],f=_[4],A=_[5],g=!1,b="",m=null,t.points.length>65536)return;if(f.66*A||h[0]5*h[2]||h[2]>5*h[1]?b="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)&&(b="jump"),g=""===b&&fn?(g.push({i:s,v:t[s],group:A}),d=s,c||(c=!0)):c&&s>d+4&&(g.length>0&&_.push(g.slice(0)),g=[],c=!1,A++);for(c&&g.length>1&&_.push(g.slice(0)),u&&0===_.length&&(f=!0),r=0;r<_.length;r++)if(m[r]="point",!((o=_[r].length)<64)){for(h=0,a=Math.sign(_[r][0].v),s=1;so&&(m[r]="interval")}return{smooth:f,groups:_,types:m}},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,s){var r,o,n,a,h,l,c=[],d=0,u=0,p=0,f=!1,A=!1;for(n=(i-e)/s,c[d]=new this.Component,l=c[d],r=0,o=e;r<=s;r++,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===r&&(A=!0);return f?l.len=u:c.pop(),c},getPointType:function(t,e,i,s,r,o,n){var a=r[0],h=o[0],l=s.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=s[0],c.x=a[0],c.y=h[0],c):e>n-6?(c.type="borderright",c.idx=l-1,c.t=s[l-1],c.x=a[l-1],c.y=h[l-1],c):c},newtonApprox:function(t,e,i,s,r){var o,n=0;for(o=s;o>0;o--)n=(n+r[o][t])*(e-(o-1)*i)/o;return n+r[0][t]},thiele:function(t,e,i,s,r){var o,n=0;for(o=r;o>1;o--)n=(t-i[s+o])/(e[o][s+1]-e[o-2][s+1]+n);return e[0][s+1]+(t-i[s+1])/(e[1][s+1]+n)},differenceMethodExperiments:function(t,e){var i,s,r,o,n,a,h,l,c,d,u,p=t.t_values,f=t.x_values,A=t.y_values,_=[],m=[],g=[],b=[],v=[],y=[],C=[],P=[],E=0,x=[];for(n=p[1]-p[0],v.push([]),y.push([]),C.push([]),P.push([]),r=A.length,i=0;i0&&++E>1&&s%2==0)break;r--}for(i=0;il&&(l=d,h=c);h=Math.floor(u[i][h].i+s/2),x.push(this.getPointType(e,h,p,f,A,g,b,r+1))}return[x,v,y,C,P]},getCenterOfCriticalInterval:function(t,e,i){var s,r,o,n,a,h=0,l=0,c=i[1]-i[0],d=[];for(s=-1/0,d=[],r=0;rs?(d=[r],s=n,o=r):s===n&&d.push(r);if(d.length>0&&(a=d.reduce(function(t,e){return t+e},0)/d.length,o=Math.floor(a),a+=t[0].i),s<1/0){for(r=0;r=0));s++){if(l.groups.length>0&&++m>2&&(s+1)%2==0){v=l.groups,d=l.types;break}r--}for(i=0;i0&&(h=t.points[t.points.length-1].scrCoords),o=new u.A(i.A.COORDS_BY_USER,e,t.board),null!==h&&(n=o.scrCoords[1]-h[1])*n+(a=o.scrCoords[2]-h[2])*a<.8*.8||(o._t=s,t.points.push(o))},getInterval:function(e,i,s){var r,o;return n.A.disable(),r=n.A.Interval(i,s),e.board.mathLib=n.A,e.board.mathLibJXG=n.A,o=e.Y(r,!0),e.board.mathLib=Math,e.board.mathLibJXG=t.A.Math,o},sign:function(t){return t<0?-1:t>0?1:0},handleBorder:function(t,e,i,r,o){var n,a,h,l,c,d,u,p,f,A,_,m,g=i.idx;if(m=e.t_values[1]-e.t_values[0],"borderleft"===i.type?h=(a=n=e.left_isNaN?e.left_t:i.t-m)+m:"borderright"===i.type?a=(h=n=e.right_isNaN?e.right_t:i.t+m)-m:console.log("No bordercase!!!"),0!==(A=this.findComponents(t,a,h,32)).length){for("borderleft"===i.type&&(a=A[0].left_t,h=A[0].t_values[0],m=A[0].t_values[1]-A[0].t_values[0],n=a=null===a?h-m:a,l=this.getInterval(t,a,h),s.A.isObject(l)&&(u=l.lo,p=l.hi,c=t.X(n,!0),d=o[1][g]<0?p:u,this._insertPoint_v4(t,[1,c,d],n))),_=A[0].t_values.length,f=0;f<_;f++)n=A[0].t_values[f],c=A[0].x_values[f],d=A[0].y_values[f],this._insertPoint_v4(t,[1,c,d],n);"borderright"===i.type&&(a=A[0].t_values[_-1],h=A[0].right_t,m=A[0].t_values[1]-A[0].t_values[0],n=h=null===h?a+m:h,l=this.getInterval(t,a,h),s.A.isObject(l)&&(u=l.lo,p=l.hi,c=t.X(n,!0),d=o[1][g]>0?p:u,this._insertPoint_v4(t,[1,c,d],n)))}},_seconditeration_v4:function(t,e,i,s,r){var o,n,a,h,l,c,d,u,p,f,A,_,m;for(n=e.t_values[i.idx-2],a=e.t_values[i.idx+2],l=this.findComponents(t,n,a,64),d=0;d2?this._recurse_v4(t,e,d,s,r,u,p,h-1):this._insertPoint_v4(t,[1,u,p],d),l=(u-n)*t.board.unitX,c=(p-a)*t.board.unitY,o.A.hypot(l,c)>2?this._recurse_v4(t,d,i,u,p,n,a,h-1):this._insertPoint_v4(t,[1,u,p],d)):this._insertPoint_v4(t,[1,NaN,NaN],d)},handleSingularity:function(t,e,i,r,o){var n,a,h,l,c,d,u,p,f,A,_,m=i.idx,g=100;n=i.t,console.log("HandleSingularity at t =",n),a=e.t_values[m-5],h=e.t_values[m+5],l=this.getInterval(t,a,h),s.A.isObject(l)?(p=l.lo,f=l.hi):o[0][m-1]g?(this._insertPoint_v4(t,[1,u,f],n),_>=-100&&this._insertPoint_v4(t,[1,NaN,NaN],n)):(p===-1/0&&(this._insertPoint_v4(t,[1,u,p],n,!0),this._insertPoint_v4(t,[1,NaN,NaN],n)),f===1/0&&(this._insertPoint_v4(t,[1,NaN,NaN],n),this._insertPoint_v4(t,[1,u,f],n,!0)),i.tg&&this._insertPoint_v4(t,[1,u,p],n)},steps:1021,criticalThreshold:1e3,plot_v4:function(t,e,i,r){var o,n,a,h,l,c,u,p,f,A,_,m,g,b,v,y=(i-e)/r,C=function(e){return t.Y(e,!0)},P=function(e){return-t.Y(e,!0)},E=.5*y;for(a=this.findComponents(t,e,i,r),h=0;h=p+3&&o3&&Math.abs(_[2][o])>.2*Math.abs(_[0][o])&&(m=l.t_values[o],E=.25*y,v=this.getInterval(t,m,m+y),s.A.isObject(v)?_[2][o]>0?this._insertPoint_v4(t,[1,m+E,v.lo],m+E):this._insertPoint_v4(t,[1,m+y-E,v.hi],m+y-E):(g=d.A.fminbr(C,[m,m+y]))<(b=d.A.fminbr(P,[m,m+y]))?(this._insertPoint_v4(t,[1,t.X(g,!0),t.Y(g,!0)],g),this._insertPoint_v4(t,[1,t.X(b,!0),t.Y(b,!0)],b)):(this._insertPoint_v4(t,[1,t.X(b,!0),t.Y(b,!0)],b),this._insertPoint_v4(t,[1,t.X(g,!0),t.Y(g,!0)],g)));u-O){if(g=u,u=Math.min(g,p),p=Math.max(g,p),A=t(f=d.A.fzero(t,[u,p])),Math.abs(A)>Math.max((m-_)*o.A.eps,.001))return!1;if("vertical"===n?(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+o.A.eps,this.curveContainsPoint(v,h,l,2*x,this.config.qdt_box))M;else if((P=this.traceComponent(v,1))[0].length>0){for(a>0&&(h.push(NaN),l.push(NaN)),E=h.length,C=P[0].length,y=1;yx&&c>0&&!1!==(P=this.searchLine(t,e,i,[w,b],n,a,h,l,c-1))&&(h=P[0],l=P[1],a=P[2]),S-(b=f+.01*x)>x&&c>0&&!1!==(P=this.searchLine(t,e,i,[b,S],n,a,h,l,c-1))&&(h=P[0],l=P[1],a=P[2]),[h,l,a]}return!1},curveContainsPoint:function(t,e,i,s,r){var o,n,a,l=t[1],c=t[2];for(n=(a=this.qdt.find([l-r,c+r,l+r,c-r])).length,o=0;o0&&e.length<6&&(e.push(e[e.length-1]),i.push(i[i.length-1])),[e,i]},tracing:function(t,e){var i,s,r,n,a,l,c,d,u,p,f,A,_,m,g,b,v,y,C,P,E=[],x=[],O=[],M=0,w=0,S=!1,T=!1,N=!1,D=this.config.kappa_0,k=this.config.delta_0,L=this.config.alpha_0,R=this.config.h_initial,B=this.config.max_steps,I=e,j=[],Y=[],V=[];if(E=t.slice(1),j.push(E[0]),Y.push(E[1]),!1===(r=this.tangent(E)))return[];this.dfx(E[0],E[1]),this.dfy(E[0],E[1]);do{if(!1===(r=this.tangent(E))){E=x.slice(),j.push(E[0]),Y.push(E[1]);break}if(1===j.length)a=r.slice();else if(2===j.length)V.push(j.length-1);else if(T&&j.length>2&&!N){if(h.A.distPointSegment([1,E[0],E[1]],[1,j[0],Y[0]],[1,j[1],Y[1]])this.config.loop_dir){E=t.slice(1),j.push(E[0]),Y.push(E[1]),S=!0;break}if(this.config.loop_detection){for(v=j.length-1,y=Math.floor(o.A.log2(v)),C=0;C<=y&&!(h.A.distPointSegment([1,E[0],E[1]],[1,j[V[C]-1],Y[V[C]-1]],[1,j[V[C]],Y[V[C]]])this.config.loop_dir));C++);if(C<=y){S=!0;break}for(y=1,P=0,C=0;C<100&&(v+1)%y===0;C++)y*=2,P++;V[P]=v}}x[0]=E[0]+R*I*r[0],x[1]=E[1]+R*I*r[1],w=0;do{A=(c=[this.dfx(x[0],x[1]),this.dfy(x[0],x[1])])[0]*c[0]+c[1]*c[1],d=this.f(x[0],x[1])/A,O[0]=x[0]-c[0]*d,O[1]=x[1]-c[1]*d,0===w?p=Math.abs(d)*Math.sqrt(A):1===w&&(f=Math.abs(d)*Math.sqrt(A)),x[0]=O[0],x[1]=O[1],w++}while(w<20&&Math.abs(this.f(x[0],x[1]))>this.config.tol_newton);if(m=p,_=w>1?f/p:0,n=this.tangent(x),u=o.A.innerProduct(r,n,2),u=Math.max(-1,Math.min(1,u)),g=Math.acos(u),N=!1,h.A.distance(E,x,2)this.config.h_critical);else{if(N=!0,!this.isBifurcation(E,this.config.tol_cusp)){E=x.slice(),j.push(E[0]),Y.push(E[1]);break}I*=-1,g=0}if(!N&&(b=Math.max(Math.sqrt(_/D),Math.sqrt(m/k),g/L),isNaN(b)&&(b=1),R/=b=Math.max(Math.min(b,2),.5),R=Math.min(this.config.h_max,R),b>=2)){if(++M>=3*B)break;T=!1}else E=x.slice(),j.push(E[0]),Y.push(E[1]),T=!0,M++}while(M=this.bbox[0]&&E[1]<=this.bbox[1]&&E[0]<=this.bbox[2]&&E[1]>=this.bbox[3]);return i=[j[(s=j.length)-2],Y[s-2]],E[0]this.bbox[2]&&(E[0]!==i[0]&&(l=(this.bbox[2]-i[0])/(E[0]-i[0]),E[1]!==i[1]&&(E[1]=i[1]+l*(E[1]-i[1]))),E[0]=this.bbox[2]),E[1]this.bbox[1]&&(E[1]!==i[1]&&(l=(this.bbox[1]-i[1])/(E[1]-i[1]),E[0]!==i[0]&&(E[0]=i[0]+l*(E[0]-i[0]))),E[1]=this.bbox[1]),j[s-1]=E[0],Y[s-1]=E[1],[j,Y,S]},isBifurcation:function(t,e){var i,s,r,n,a,h,l,c,d,u,p=o.A.eps*o.A.eps*100;return i=t[0],s=t[1],r=.5*(this.dfx(i+p,s)-this.dfx(i-p,s))/p,n=.5*(this.dfx(i,s+p)-this.dfx(i,s-p))/p,a=.5*(this.dfy(i+p,s)-this.dfy(i-p,s))/p,u=(l=r+(h=.5*(this.dfy(i,s+p)-this.dfy(i,s-p))/p))*l-4*(r*h-n*a),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,s){var r,o=Math.atan2(s*e[1],s*e[0]);return r=d.A.root(function(e){var s=t[0]+i*Math.cos(e),r=t[1]+i*Math.sin(e);return this.f(s,r)},o),[t[0]+i*Math.cos(r),t[1]+i*Math.sin(r)]},updateA:function(t,e,i){var s,r,o=[i[0]-e[0],i[1]-e[1]],n=this.f(i[0],i[1])-this.f(e[0],e[1]);return r=o[0]*o[0]+o[1]*o[1],s=n-(t[0]*o[0]+t[1]*o[1]),s/=r,t[0]+=s*o[0],t[1]+=s*o[1],t},tangent_A:function(t){var e=[-t[1],t[0]],i=o.A.norm(e,2);return o.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=o.A.norm(e,2);return!(ithis.MP_EXPLICIT&&(a.x-n.x)*(a.x-n.x)+(a.y-n.y)*(a.y-n.y)=this.MP_GIVEN){for(;n.ltype===this.MP_OPEN&&n.rtype===this.MP_OPEN;)n=n.next;for(s=0,h=a,o=t.length,u=[],p=[],f=[],A=[null];c=h.next,u.push(c.x-h.x),p.push(c.y-h.y),f.push(this.mp_pyth_add(u[s],p[s])),s>0&&(d=p[s-1]/f[s-1],l=u[s-1]/f[s-1],A.push(Math.atan2(p[s]*l-u[s]*d,u[s]*l+p[s]*d))),s++,(h=c)===n&&(o=s),!(s>=o&&h.ltype!==this.MP_END_CYCLE););s===o?A.push(0):A.push(A[1]),n.ltype===this.MP_OPEN&&((r=n.rx-n.x)*r+(e=n.ry-n.y)*eC&&(u*=Math.pow(C/m,2)),v=u/(u+P),_[p]=v*c,h=-n[p+1]*_[p],g.rtype===this.MP_CURL?(A[p]=0,l[p]=h-n[1]*(this.FRACTION_ONE-v)):(v=(this.FRACTION_ONE-v)/E,h-=n[p]*v,v*=a,l[p]=h-l[p-1]*v,A[p]=-A[p-1]*v),f.ltype===this.MP_END_CYCLE){for(a=0,c=this.FRACTION_ONE;0===(p-=1)&&(p=i),a=l[p]-a*_[p],c=A[p]-c*_[p],p!==i;);for(a/=this.FRACTION_ONE-c,y[i]=a,l[0]=a,D=1;D-1;p--)y[p]=l[p]-y[p+1]*_[p];for(f=t,p=0;b=f.next,O=(x=this.mp_n_sin_cos(y[p]))[0],M=x[1],S=(w=this.mp_n_sin_cos(-n[p+1]-y[p+1]))[0],T=w[1],this.mp_set_controls(f,b,s[p],r[p],M,O,T,S),f=b,++p!==i;);},mp_n_sin_cos:function(t){return[Math.cos(t),Math.sin(t)]},mp_set_controls:function(t,e,i,s,r,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(r,o,n,a,h),l=this.mp_velocity(n,a,r,o,c),(t.right_tension()<0||e.left_tension()<0)&&(r>=0&&n>=0||r<=0&&n<=0)&&(d=Math.abs(r)*a+Math.abs(n)*o)>0&&(d*=1.00024414062,t.right_tension()<0&&this.mp_ab_vs_cd(Math.abs(n),this.FRACTION_ONE,u,d)<0&&(u=Math.abs(n)/d),e.left_tension()<0&&this.mp_ab_vs_cd(Math.abs(r),this.FRACTION_ONE,l,d)<0&&(l=Math.abs(r)/d)),t.rx=t.x+(i*o-s*r)*u,t.ry=t.y+(s*o+i*r)*u,e.lx=e.x-(i*a+s*n)*l,e.ly=e.y-(s*a-i*n)*l,t.rtype=this.MP_EXPLICIT,e.ltype=this.MP_EXPLICIT},mp_pyth_add:function(t,e){return o.A.hypot(t,e)},mp_curl_ratio:function(t,e,i){var s=1/e,r=1/i;return Math.min(4,((3-s)*s*s*t+r*r*r)/(s*s*s*t+(3-r)*r*r))},mp_ab_vs_cd:function(t,e,i,s){return t*e===i*s?0:t*e>i*s?1:-1},mp_velocity:function(t,e,i,s,r){return Math.min(4,(2+Math.sqrt(2)*(t-i/16)*(i-t/16)*(e-s))/(1.5*r*(2+(Math.sqrt(5)-1)*e+(3-Math.sqrt(5))*s)))},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,s,r=[];for(s=t.length,i=0;i=r)continue;if(h=e[o],s.A.exists(h.type)&&"curl"===h.type)a=s.A.evaluate(h.curl),0===o?(i[o].rtype=this.MP_CURL,i[o].set_right_curl(a)):o===r-1?(i[o].ltype=this.MP_CURL,i[o].set_left_curl(a)):(i[o].ltype=this.MP_CURL,i[o].rtype=this.MP_CURL,i[o].lx=a,i[o].rx=a);s.A.exists(h.direction)&&(a=s.A.evaluate(h.direction),s.A.isArray(a)?(!1!==a[0]&&(i[o].lx=a[0]*Math.PI/180,i[o].ltype=this.MP_GIVEN),!1!==a[1]&&(i[o].rx=a[1]*Math.PI/180,i[o].rtype=this.MP_GIVEN)):(i[o].lx=a*Math.PI/180,i[o].rx=a*Math.PI/180,i[o].ltype=i[o].rtype=this.MP_GIVEN)),s.A.exists(h.tension)&&(a=s.A.evaluate(h.tension),s.A.isArray(a)?(!1!==a[0]&&(i[o].ly=s.A.evaluate(a[0])),!1!==a[1]&&(i[o].ry=s.A.evaluate(a[1]))):(i[o].ly=a,i[o].ry=a))}for(this.make_choices(i),o=0;o0)for(e=0;e0&&Math.abs(t[r-1].coords.usrCoords[0]-e.usrCoords[0])e.data.alpha?1:-1}),t[e].length>0){for(o=t[e].length-1,n=(r=(s=t[e][0]).data.path[s.pos])._next,e===h-1&&(r._end=!1),0===s.data.alpha&&"T"===s.data.type?(r.intersection=!0,r.data=s.data,r.neighbour=s.neighbour,r.neighbour.neighbour=r,r.entry_exit=!1,t[e][0]=r):(s._prev=r,s._prev._next=s),i=1;i<=o;i++)(s=t[e][i])._prev=t[e][i-1],s._prev._next=s;(s=t[e][o])._next=n,s._next._prev=s,e===h-1&&(s._end=!0),a=a.concat(t[e])}return a},_inbetween:function(t,e,i){var s,r=o.A.eps*o.A.eps,n=i[1]-e[1],a=i[2]-e[2],h=t[1]-e[1],l=t[2]-e[2];return 0===n&&0===a&&0===h&&0===l||(s=Math.abs(h)l+c){d=!0;break}return d},findIntersections:function(t,e,s){var r,n,a,l,c,d,p,f,A,_,m,g,b,v=[],y=100*o.A.eps,C=t.length,P=e.length,E=[],x=[],O=[],M=!1,w=!1,S=!1;for(n=0;n-y&&v[1]<1-y/f&&v[2]*A>-y&&v[2]<1-y/A||v[1]===1/0&&v[2]===1/0&&o.A.norm(v[0],3)=0&&_<1&&(m="T",a=new u.A(i.A.COORDS_BY_USER,l,s),v[1]=0,v[2]=_,g=new this.Vertex(a,r,v[1],t,"S",m),b=new this.Vertex(a,n,v[2],e,"C",m),g.neighbour=b,b.neighbour=g,x[r].push(g),O[n].push(b)),_=this._inbetween(d,l,c),h.A.distance(l,d,3)>y&&_>=0&&_<1&&(m="T",a=new u.A(i.A.COORDS_BY_USER,d,s),v[1]=_,v[2]=0,g=new this.Vertex(a,r,v[1],t,"S",m),b=new this.Vertex(a,n,v[2],e,"C",m),g.neighbour=b,b.neighbour=g,x[r].push(g),O[n].push(b));continue}S,g=new this.Vertex(a,r,v[1],t,"S",m),b=new this.Vertex(a,n,v[2],e,"C",m),g.neighbour=b,b.neighbour=g,x[r].push(g),O[n].push(b)}}}for(E=this.sortIntersections(x),r=0;r=0?r>=0&&o>=0?"left":"right":r>=0||o>=0?"left":"right"},_classifyDegenerateIntersections:function(t){var e,i,r,n,a,l,c,d,u,p,f,A,_,m,g=!1;for(g,u=h.A.det3p,c=0,t._tours=0;;){if(t.intersection&&"T"===t.data.type&&(e=t._next.coords.usrCoords,i=t._prev.coords.usrCoords,h.A.distance(t.coords.usrCoords,e,3)0&&(p=!0):0===m&&h.A.affineRatio(t.coords.usrCoords,e,n)>0&&(p=!0),p&&(d=n,n=r,r=d,d=f,f=_,_=d,d=A,A=m,m=d),s.A.exists(t.delayedStatus)||(t.delayedStatus=[]),0===f&&0===A?t.delayedStatus=["on","on"]:0===f?(l=this._getPosition(e,n,a.coords.usrCoords,r),t.delayedStatus=["on",l]):0===A?(l=this._getPosition(i,n,a.coords.usrCoords,r),t.delayedStatus=[l,"on"]):0===t.delayedStatus.length&&(this._getPosition(i,n,a.coords.usrCoords,r)!==this._getPosition(e,n,a.coords.usrCoords,r)?t.data.type="X":t.data.type="B")),s.A.exists(t._tours)&&t._tours++,t._tours>3||t._end||c>1e3){c>1e3&&console.log("Clipping: _classifyDegenerateIntersections exit"),s.A.exists(t._tours)&&delete t._tours;break}t.intersection&&c++,t=t._next}},_handleIntersectionChains:function(t){var e,i=0,s="Null",r=!1,o=!1,n=!1;for(n;!0===t.intersection&&("T"===t.data.type&&("on"!==t.delayedStatus[0]&&"on"===t.delayedStatus[1]?(r=!0,e=t,s=t.delayedStatus[0]):r&&"on"===t.delayedStatus[0]&&"on"===t.delayedStatus[1]?t.data.type="B":r&&"on"===t.delayedStatus[0]&&"on"!==t.delayedStatus[1]&&(r=!1,s===t.delayedStatus[1]?(e.data.type="DB",t.data.type="DB"):(e.data.type="DX",t.data.type="DX"))),i++),t._end&&(o=!0),!o||r;){if(i>1e3){console.log("Warning: _handleIntersectionChains: intersection chain reached maximum numbers of iterations");break}t=t._next}},_handleFullyDegenerateCase:function(t,e,s){var r,n,a,l,c,d,p,f,A,_,m,g,b,v,y=[t,e];for(a=0;a<2;a++){for(_=(r=y[a]).length,f=0,v=!0;f<_;f++)if(!r[f].intersection){v=!1;break}if(v)for(m=(n=y[(a+1)%2]).length,f=0;f<_;f++){for(c=r[f].coords.usrCoords,d=r[f]._next.coords.usrCoords,l=[.5*(c[0]+d[0]),.5*(c[1]+d[1]),.5*(c[2]+d[2])],A=0,g=!1;A1e4);)n++},_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){var s,r,o,n,a=0,h=1e4,l=0,c=[],d=!1,u=!1;for(u;l0&&c.push([NaN,NaN]),n=o.data.idx,s=t,d=this._addVertex(c,o,u),r=o.entry_exit;do{if(d)break;if("intersection"===i&&"entry"===o.entry_exit||"union"===i&&"exit"===o.entry_exit||"difference"===i&&s===t==("exit"===o.entry_exit)){u;do{if(o=o._next,d=this._addVertex(c,o,u))break}while(this._stayOnPath(o,r));a++}else{u;do{if(o=o._prev,d=this._addVertex(c,o,u))break}while(this._stayOnPath(o,r));a++}if(d)break;if(!o.neighbour)return console.log("Tracing: emergency break - no neighbour!!!!!!!!!!!!!!!!!",a),[[0],[0]];if((o=o.neighbour).data.done)break;o.data.done=!0,r=o.entry_exit,s=o.data.path}while(o.data.idx!==n&&a=h&&console.log("Tracing: stopping an infinite loop!",a),l++}return this._getCoordsArrays(c,!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,s=[],r=[],o=t.length;for(i=0;i0&&(t[0].coords?(s.push(t[0].coords.usrCoords[1]),r.push(t[0].coords.usrCoords[2])):(s.push(t[0][0]),r.push(t[0][1]))),[s,r]},handleEmptyIntersection:function(t,e,i){var r,o,n=!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(o=e[0];o.intersection&&!(o=o._next)._end;);return 0===h.A.windingNumber(r.coords.usrCoords,e)?0!==h.A.windingNumber(o.coords.usrCoords,t)?("union"===i?(s.A.concat(a,t),a.push(t[0])):"difference"===i&&(s.A.concat(a,t),a.push(t[0]),h.A.signedPolygon(t)*h.A.signedPolygon(e)>0&&a.reverse(),a.push([NaN,NaN])),"difference"!==i&&"intersection"!==i||(s.A.concat(a,e),a.push(e[0]),n=!1)):"difference"===i?(s.A.concat(a,t),n=!0):"union"===i&&(s.A.concat(a,t),a.push(t[0]),a.push([NaN,NaN]),s.A.concat(a,e),a.push(e[0])):"intersection"===i?(s.A.concat(a,t),n=!0):"union"===i&&(s.A.concat(a,e),a.push(e[0])),this._getCoordsArrays(a,n)},_countCrossingIntersections:function(t){var e,i=t.length,s=0;for(e=0;e0&&h.A.distance(c[0].coords.usrCoords,c[r-1].coords.usrCoords,3)0&&h.A.distance(d[0].coords.usrCoords,d[r-1].coords.usrCoords,3)-1?this.monomials[i].coefficient+=e*t.coefficient:(t.coefficient*=e,this.monomials.push(t))},add:function(t){var e;if(!s.A.exists(t)||t.ring!==this.ring)throw new Error("JSXGraph error: In JXG.Math.Poly.polynomial.add either summand is undefined or rings don't match.");if(s.A.isArray(t.exponents))this.addSubMonomial(t,1);else for(e=0;e0?o-.5:h),function(){var o=JXG.evaluate(e),a=JXG.evaluate(i),l=o[0]+h*(o[1]-o[0])/s,c=a[0]+n*(a[1]-a[0])/r,d=t.F(l,c);return 4===d.length?d.slice(1):d}}(o,n,h)),n>0&&(a=u.length-1,n%2==1?o>0&&(p.push([a-1,a,a-2-s]),o0&&p.push([a,a-2-s,a-1]),p.push([a,a-1-s,a-2-s])));return[u,p]},rectangulation:function(t,e,i,s,r){var o,n,a,h=[],l=[];for(n=0;n<=r;n++)for(o=0;o<=s;o++)h.push(function(o,n){return function(){var a=JXG.evaluate(e),h=JXG.evaluate(i),l=a[0]+o*(a[1]-a[0])/s,c=h[0]+n*(h[1]-h[0])/r,d=t.F(l,c);return 4===d.length?d.slice(1):d}}(o,n)),o>0&&n>0&&(a=h.length-1,l.push([a-1,a,a-1-s,a-1-s-1]));return[h,l]}};var b=o.A.Tiling,v=__webpack_require__(378);t.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]]},t.A.extend(t.A.AbstractRenderer.prototype,{_updateVisual:function(t,e,i){(i||this.enhancedRendering)&&(e=e||{},this.setObjectTransition(t),this.setClipPath(t,!!t.evalVisProp("clip")),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=!1;return s.A.exists(t.board)&&s.A.exists(t.board.highlightedObjects)||(e=!0),!e&&s.A.exists(t.board.highlightedObjects[t.id])?"highlight":""},drawPoint:function(t){var e,i=v.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"),s=v.A.normalizePointFace(t.evalVisProp("face")),r=t.evalVisProp("sizeunit"),o=t.evalVisProp("zoom");isNaN(t.coords.scrCoords[2]+t.coords.scrCoords[1])||("user"===r&&(i*=Math.sqrt(Math.abs(t.board.unitX*t.board.unitY))),e=0===(i*=t.board&&o?Math.sqrt(t.board.zoomX*t.board.zoomY):1)?0:i+1,"o"===s?this.updateEllipsePrim(t.rendNode,t.coords.scrCoords[1],t.coords.scrCoords[2],e,e):"[]"===s?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,s),t.board),this._updateVisual(t,{dash:!1,shadow:!1}),this.setShadow(t))},changePointStyle:function(t){var e=this.getElementById(t.id);s.A.exists(e)&&this.remove(e),this.drawPoint(t),s.A.clearVisPropOld(t),t.visPropCalc.visible||this.display(t,!1),t.evalVisProp("draft")&&this.setDraft(t)},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 s,r,o=e?"highlight":"";s=e&&t.evalVisProp("highlightstrokewidth")?Math.max(t.evalVisProp("highlightstrokewidth"),t.evalVisProp("strokewidth")):t.evalVisProp("strokewidth"),r=this.getArrowHeadData(t,s,o),this.makeArrows(t,r),t.elementClass===i.A.OBJECT_CLASS_LINE?this.updateLineWithEndings(t,r):t.elementClass===i.A.OBJECT_CLASS_CURVE&&this.updatePath(t),this.setArrowSize(t,r)},getArrowHeadData:function(t,e,r){var n,a,h,l,c=o.A.eps,d=0,u=0,p=0,f=0,A=t.evalVisProp("firstarrow"),_=t.evalVisProp("lastarrow");return(A||_)&&(n=s.A.exists(A.type)?t.eval(A.type):t.elementClass===i.A.OBJECT_CLASS_LINE?1:7,a=s.A.exists(_.type)?t.eval(_.type):t.elementClass===i.A.OBJECT_CLASS_LINE?1:7,A&&(l=6,s.A.exists(A.size)&&(l=t.eval(A.size)),""!==r&&s.A.exists(A[r+"size"])&&(l=t.eval(A[r+"size"])),h=e*l,2===n?(h*=.5,c+=e*l):3===n?(h=e*l/3,c+=e):4===n||5===n||6===n?(h=e*l/1.5,c+=e*l):7===n?(h=0,l=10,c+=e):c+=e*l,d+=h,p=l),_&&(l=6,s.A.exists(_.size)&&(l=t.eval(_.size)),""!==r&&s.A.exists(_[r+"size"])&&(l=t.eval(_[r+"size"])),h=e*l,2===a?(h*=.5,c+=e*l):3===a?(h=e*l/3,c+=e):4===a||5===a||6===a?(h=e*l/1.5,c+=e*l):7===a?(h=0,l=10,c+=e):c+=e*l,u+=h,f=l)),t.visPropCalc.typeFirst=n,t.visPropCalc.typeLast=a,{evFirst:A,evLast:_,typeFirst:n,typeLast:a,offFirst:d,offLast:u,sizeFirst:p,sizeLast:f,showFirst:1,showLast:1,minLen:c,strokeWidth:e}},updateLineWithEndings:function(t,e){var s,r,o=null;return s=new u.A(i.A.COORDS_BY_USER,t.point1.coords.usrCoords,t.board),r=new u.A(i.A.COORDS_BY_USER,t.point2.coords.usrCoords,t.board),o=t.evalVisProp("margin"),t.evalVisProp("clip")||(o+=4096),h.A.calcStraight(t,s,r,o),this.handleTouchpoints(t,s,r,e),this.getPositionArrowHead(t,s,r,e),this.updateLinePrim(t.rendNode,s.scrCoords[1],s.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,s,r){var o,n,a,h,l;return(r.evFirst||r.evLast)&&(n=a=h=l=0,o=e.distance(i.A.COORDS_BY_SCREEN,s),r.evFirst&&"vml"!==t.board.renderer.type&&(o>=r.minLen?(n=(s.scrCoords[1]-e.scrCoords[1])*r.offFirst/o,a=(s.scrCoords[2]-e.scrCoords[2])*r.offFirst/o):r.showFirst=0),r.evLast&&"vml"!==t.board.renderer.type&&(o>=r.minLen?(h=(s.scrCoords[1]-e.scrCoords[1])*r.offLast/o,l=(s.scrCoords[2]-e.scrCoords[2])*r.offLast/o):r.showLast=0),e.setCoordinates(i.A.COORDS_BY_SCREEN,[e.scrCoords[1]+n,e.scrCoords[2]+a],!1,!0),s.setCoordinates(i.A.COORDS_BY_SCREEN,[s.scrCoords[1]-h,s.scrCoords[2]-l],!1,!0)),this},handleTouchpoints:function(t,e,s,r){var o,n,a,h,l,c,d;return(r.evFirst||r.evLast)&&(a=h=l=c=d=0,o=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(i.A.COORDS_BY_SCREEN,s),h=(s.scrCoords[1]-e.scrCoords[1])*o/a,l=(s.scrCoords[2]-e.scrCoords[2])*o/a),r.evLast&&t.evalVisProp("touchlastpoint")&&t.point2.evalVisProp("visible")&&(a=e.distance(i.A.COORDS_BY_SCREEN,s),c=(s.scrCoords[1]-e.scrCoords[1])*n/a,d=(s.scrCoords[2]-e.scrCoords[2])*n/a),e.setCoordinates(i.A.COORDS_BY_SCREEN,[e.scrCoords[1]+h,e.scrCoords[2]+l],!1,!0),s.setCoordinates(i.A.COORDS_BY_SCREEN,[s.scrCoords[1]-c,s.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])>o.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){},displayLogo:function(t,e){},drawInternalText:function(t){},updateInternalText:function(t){},drawText:function(t){var i,r,o,n;"html"===t.evalVisProp("display")&&e.A.isBrowser&&"no"!==this.type?((i=this.container.ownerDocument.createElement("div")).style.position="absolute",i.className=t.evalVisProp("cssclass"),o=t.evalVisProp("layer"),s.A.exists(o)||(o=0),r=""===this.container.style.zIndex?0:parseInt(this.container.style.zIndex,10),i.style.zIndex=r+o,this.container.appendChild(i),i.setAttribute("id",this.container.id+"_"+t.id)):i=this.drawInternalText(t),t.rendNode=i,t.htmlStr="",t.visProp.islabel&&s.A.exists(t.visProp.anchor)?(n=t.visProp.anchor.evalVisProp("visible"),t.prepareUpdate().updateVisibility(n)):t.prepareUpdate().updateVisibility(),this.updateText(t)},updateClipPath:function(t,e){var i,s,r,o,n=t.rendNode.offsetWidth,a=t.rendNode.offsetHeight,h=t.rendNode.style.inset.split(" "),l=t.board.canvasWidth,c=t.board.canvasHeight;void 0===e&&(e=t.evalVisProp("clip")),e?("auto"!==h[3]?r=l-(i=parseFloat(h[3])):i=l-(r=parseFloat(h[1])+n),"auto"!==h[0]?o=c-(s=parseFloat(h[0])):s=c-(o=parseFloat(h[2])+a),t.rendNode.style.clipPath="rect("+-s+"px "+r+"px "+o+"px "+-i+"px)"):t.rendNode.style.removeProperty("clip-path")},updateText:function(e){var i,r,o,n,a,h,l,c,d,u,p,f=e.plaintext;if(e.visPropCalc.visible)if(this.updateTextStyle(e,!1),"html"===e.evalVisProp("display")&&"no"!==this.type){if(isNaN(e.coords.scrCoords[1]+e.coords.scrCoords[2])||(r=e.coords.scrCoords[1],r=Math.abs(r)<1e6?r:1e6,"right"===(a=e.getAnchorX())?(i=e.board.canvasWidth-r,u="right"):"middle"===a?(i=r-.5*e.size[0],u="center"):(i=r,u="left"),e.visPropOld.left!==a+i&&("right"===a?(e.rendNode.style.right=i+"px",e.rendNode.style.left="auto"):(e.rendNode.style.left=i+"px",e.rendNode.style.right="auto"),e.visPropOld.left=a+i),r=e.coords.scrCoords[2]+this.vOffsetText,r=Math.abs(r)<1e6?r:1e6,"bottom"===(h=e.getAnchorY())?(i=e.board.canvasHeight-r,p="bottom"):"middle"===h?(i=r-.5*e.size[1],p="center"):(i=r,p="top"),e.visPropOld.top!==h+i&&("bottom"===h?(e.rendNode.style.top="auto",e.rendNode.style.bottom=i+"px"):(e.rendNode.style.bottom="auto",e.rendNode.style.top=i+"px"),e.visPropOld.top=h+i)),e.htmlStr!==f){try{e.type===s.A.OBJECT_TYPE_BUTTON?e.rendNodeButton.innerHTML=f:e.type===s.A.OBJECT_TYPE_CHECKBOX||e.type===s.A.OBJECT_TYPE_INPUT?e.rendNodeLabel.innerHTML=f:e.rendNode.innerHTML=f}catch(t){o=e.rendNode.parentNode,e.rendNode.parentNode.removeChild(e.rendNode),e.rendNode.innerHTML=f,o.appendChild(e.rendNode)}if(e.htmlStr=f,e.evalVisProp("usemathjax"))try{MathJax.typeset?MathJax.typeset([e.rendNode]):MathJax.Hub.Queue(["Typeset",MathJax.Hub,e.rendNode])}catch(e){t.A.debug("MathJax (not yet) loaded")}else if(e.evalVisProp("usekatex"))try{(n=0===e.rendNode.innerHTML.indexOf("0&&(e.rendNode.innerHTML.indexOf("0||e.rendNode.innerHTML.indexOf("0)?e.rendNodeLabel:0===e.rendNode.innerHTML.indexOf("127&&i<2048?(s+=String.fromCharCode(i>>6|192),s+=String.fromCharCode(63&i|128)):(s+=String.fromCharCode(i>>12|224),s+=String.fromCharCode(i>>6&63|128),s+=String.fromCharCode(63&i|128));return s},decode:function(t){var e,i,s,r=0,o=0,n=0,a=[],h=t.length,l=[];for(e=0;e>s&i,0===(n=C[256+n+s])&&(o>65535?a.push(55232+(o>>10),56320+(1023&o)):a.push(o),++r%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;case 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}};var P=t.A.Util.UTF8,E="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",x="=";t.A.Util=t.A.Util||{},t.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,s,r,o,n=[];for(r=(s=(o=P.encode(t)).length)%3,e=0;e>18),E.charAt(i>>12&63),E.charAt(i>>6&63),E.charAt(63&i));switch(r){case 1:i=this._getByte(o,s-1),n.push(E.charAt(i>>2),E.charAt(i<<4&63),x,x);break;case 2:i=this._getByte(o,s-2)<<8|this._getByte(o,s-1),n.push(E.charAt(i>>10),E.charAt(i>>4&63),E.charAt(i<<2&63),x)}return n.join("")},decode:function(t,e){var i,s,r,o,n,a,h=[],l=[];if((r=(i=t.replace(/[^A-Za-z0-9+/=]/g,"")).length)%4!=0)throw new Error("JSXGraph/utils/base64: Can't decode string (invalid input length).");for(i.charAt(r-1)===x&&(o=1,i.charAt(r-2)===x&&(o=2),r-=4),s=0;s>16,n>>8&255,255&n),s%1e4==0&&(h.push(String.fromCharCode.apply(null,l)),l=[]);switch(o){case 1:n=this._getIndex(i,r)<<12|this._getIndex(i,r+1)<<6|this._getIndex(i,r+2),l.push(n>>10,n>>2&255);break;case 2:n=this._getIndex(i,s)<<6|this._getIndex(i,s+1),l.push(n>>4)}return h.push(String.fromCharCode.apply(null,l)),a=h.join(""),e&&(a=P.decode(a)),a},decodeAsArray:function(t){var e,i=this.decode(t),s=[],r=i.length;for(e=0;e\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');var M=t.A.FileReader,w=__webpack_require__(86),S=__webpack_require__(428),T=__webpack_require__(873);t.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;e0;r--)l+=e[h[r-1]];if(!s.A.exists(this.elementsByName[l+a]))return l+a}for(h[0]=e.length,r=1;r=1e3&&(e=!0),e&&(this.touchMoveLast=i),e},getCoordsTopLeftCorner:function(){var t,i,r,o,n,a=this.document.ownerDocument||this.document,h=a.documentElement||this.document.body.parentNode,l=a.body,c=this.containerObj;if(this.cPos.length>0&&(this.mode===this.BOARD_MODE_DRAG||this.mode===this.BOARD_MODE_MOVE_ORIGIN||(new Date).getTime()-this.positionAccessLast<1e3))return this.cPos;if(this.positionAccessLast=(new Date).getTime(),c.getBoundingClientRect){for(r=c.getBoundingClientRect(),o=1,n=c;n&&s.A.exists(n.parentNode);)s.A.exists(n.style)&&s.A.exists(n.style.zoom)&&""!==n.style.zoom&&(o*=parseFloat(n.style.zoom)),n=n.parentNode;return(t=[r.left*o,r.top*o])[0]+=e.A.getProp(c,"border-left-width"),t[1]+=e.A.getProp(c,"border-top-width"),"vml"!==this.renderer.type&&(t[0]+=e.A.getProp(c,"padding-left"),t[1]+=e.A.getProp(c,"padding-top")),this.cPos=t.slice(),this.cPos}return t=e.A.getOffset(c),i=this.document.documentElement.ownerDocument,!this.containerObj.currentStyle&&i.defaultView&&(t[0]+=e.A.getProp(h,"margin-left"),t[1]+=e.A.getProp(h,"margin-top"),t[0]+=e.A.getProp(h,"border-left-width"),t[1]+=e.A.getProp(h,"border-top-width"),t[0]+=e.A.getProp(h,"padding-left"),t[1]+=e.A.getProp(h,"padding-top")),l&&(t[0]+=e.A.getProp(l,"left"),t[1]+=e.A.getProp(l,"top")),"object"==typeof google&&google.translate&&(t[0]+=10,t[1]+=25),t[0]+=e.A.getProp(c,"border-left-width"),t[1]+=e.A.getProp(c,"border-top-width"),"vml"!==this.renderer.type&&(t[0]+=e.A.getProp(c,"padding-left"),t[1]+=e.A.getProp(c,"padding-top")),t[0]+=this.attr.offsetx,t[1]+=this.attr.offsety,this.cPos=t.slice(),this.cPos},getPointLoc:function(t,e){var i,r,o,n;return i=this.getBoundingBox(),2===(r=t).length&&r.unshift(void 0),o=[0,0],n=e||0,s.A.isNumber(n)&&(n=[n,n,n,n]),r[1]>i[2]-n[1]&&(o[0]=1),r[1]i[1]-n[0]&&(o[1]=1),r[2]u.visProp.layer||n.visProp.layer===u.visProp.layer&&n.lastDragTime.getTime()>=u.lastDragTime.getTime())&&(this.attr.ignorelabels&&s.A.exists(u.label)&&n===u.label||(u=n,l.push(u),s.A.exists(u.coords)?u.elementClass===i.A.OBJECT_CLASS_POINT||u.relativeCoords?c.push(p.A.subtract(u.coords.scrCoords.slice(1),[t,e])):c.push(p.A.subtract(u.actualCoords.scrCoords.slice(1),[t,e])):c.push([0,0])));return this.attr.drag.enabled&&l.length>0&&(this.mode=this.BOARD_MODE_DRAG),this.attr.takefirst?(l.length=1,this._drag_offset=c[0]):(l=l.slice(-1),this._drag_offset=c[c.length-1]),this._drag_offset||(this._drag_offset=[0,0]),"svg"===this.renderer.type&&s.A.exists(l[0])&&1===l.length&&s.A.exists(l[0].rendNode)&&(l[0].evalVisProp("dragtotopoflayer")&&l[0].rendNode.parentNode.appendChild(l[0].rendNode),l[0].hasLabel&&"html"===l[0].label.evalVisProp("display")&&l[0].label.evalVisProp("dragtotopoflayer")&&l[0].label.rendNode.parentNode.appendChild(l[0].label.rendNode)),l.length>=1&&(l[0].highlight(!0),this.triggerEventHandlers(["mousehit","hit"],[r,l[0]])),l},moveObject:function(t,e,r,o,n){var a,h,l,c=new u.A(i.A.COORDS_BY_SCREEN,this.getScrCoordsOfMouse(t,e),this);r&&r.obj&&((a=r.obj).coords&&(h=a.coords.scrCoords.slice()),this.addLogEntry("drag",a,c.usrCoords.slice(1)),this.drag_position=[c.scrCoords[1],c.scrCoords[2]],this.drag_position=p.A.add(this.drag_position,this._drag_offset),this._shiftKey=o.shiftKey,this._ctrlKey=o.ctrlKey,s.A.exists(a.coords)?a.setPositionDirectly(i.A.COORDS_BY_SCREEN,this.drag_position,[t,e]):(this.displayInfobox(!1),isNaN(r.targets[0].Xprev+r.targets[0].Yprev)||a.setPositionDirectly(i.A.COORDS_BY_SCREEN,[c.scrCoords[1],c.scrCoords[2]],[r.targets[0].Xprev,r.targets[0].Yprev]),r.targets[0].Xprev=c.scrCoords[1],r.targets[0].Yprev=c.scrCoords[2]),s.A.exists(a.coords)&&(a.prepareUpdate().update(!1).updateRenderer(),this.updateInfobox(a),a.prepareUpdate().update(!0).updateRenderer()),a.coords&&(l=a.coords.scrCoords),a.coords&&h[1]===l[1]&&h[2]===l[2]||(a.triggerEventHandlers([n+"drag","drag"],[o]),this.update(a)),a.highlight(!0),this.triggerEventHandlers(["mousehit","hit"],[o,a]),a.lastDragTime=new Date)},twoFingerMove:function(t,e,r){var o;s.A.exists(t)&&s.A.exists(t.obj)&&((o=t.obj).elementClass===i.A.OBJECT_CLASS_LINE||o.type===i.A.OBJECT_TYPE_POLYGON?this.twoFingerTouchObject(t.targets,o,e):o.elementClass===i.A.OBJECT_CLASS_CIRCLE&&this.twoFingerTouchCircle(t.targets,o,e),r&&o.triggerEventHandlers(["touchdrag","drag"],[r]))},getTwoFingerTransform(t,e,s,r){var n,a,h,l,c,d,p,f,A,_,m,g,b,v,y,C,P;return a=(n=new u.A(i.A.COORDS_BY_SCREEN,[t.Xprev,t.Yprev],this).usrCoords)[1],h=n[2],l=(n=new u.A(i.A.COORDS_BY_SCREEN,[e.Xprev,e.Yprev],this).usrCoords)[1],c=n[2],f=(n=new u.A(i.A.COORDS_BY_SCREEN,[t.X,t.Y],this).usrCoords)[1],A=n[2],v=((g=(_=(n=new u.A(i.A.COORDS_BY_SCREEN,[e.X,e.Y],this).usrCoords)[1])-f)*(d=l-a)+(b=(m=n[2])-A)*(p=c-h))/(C=d*d+p*p),y=(b*d-g*p)/C,s||(v/=P=o.A.hypot(v,y),y/=P),r||(y=0),[1,0,0,.5*(f+_-v*(a+l)+y*(h+c)),v,-y,.5*(A+m-y*(a+l)-v*(h+c)),y,v]},twoFingerTouchObject:function(t,e,r){var o,n,a,h,l,c=!1;if(s.A.exists(t[0])&&s.A.exists(t[1])&&!isNaN(t[0].Xprev+t[0].Yprev+t[1].Xprev+t[1].Yprev)){if(n=this.getTwoFingerTransform(t[0],t[1],e.evalVisProp("scalable"),e.evalVisProp("rotatable")),(o=this.create("transform",n,{type:"generic"})).update(),e.elementClass===i.A.OBJECT_CLASS_LINE)a=[],e.point1.draggable()&&a.push(e.point1),e.point2.draggable()&&a.push(e.point2),o.applyOnce(a);else if(e.type===i.A.OBJECT_TYPE_POLYGON){for(l=e.vertices.length-1,c=e.evalVisProp("snaptogrid")||e.evalVisProp("snaptopoints"),h=0;h0&&a.push(e.points[0].usrCoords);else try{a.push(e.coords.usrCoords)}catch(e){t.A.debug("JSXGraph+ saveStartPos: obj.coords.usrCoords not available: "+e)}for(n=a.length,o=0;o0&&e.A.isBrowser){for(t=0;t.2*Math.PI&&Math.abs(n)<1.8*Math.PI&&(g=!0),"pan"===this.isPreviousGesture||g||(Math.abs(t.scale)<.77||Math.abs(t.scale)>1.3)&&(g=!0),a=t.scale/this.prevScale,this.prevScale=t.scale,this.prevCoords=[[t.touches[0].clientX,t.touches[0].clientY],[t.touches[1].clientX,t.touches[1].clientY]],e=new u.A(i.A.COORDS_BY_SCREEN,this.getMousePosition(t,0),this),this.attr.pan.enabled&&this.attr.pan.needtwofingers&&!g?(this.isPreviousGesture="pan",this.moveOrigin(e.scrCoords[1],e.scrCoords[2],!0)):this.attr.zoom.enabled&&Math.abs(a-1)<.5&&(y=!1,p=this.attr.zoom.center,(this.attr.zoom.pinchhorizontal||this.attr.zoom.pinchvertical)&&(f=Math.abs(t.touches[0].clientX-t.touches[1].clientX),A=Math.abs(t.touches[0].clientY-t.touches[1].clientY),c=Math.abs(Math.atan2(A,f)),d=Math.PI*this.attr.zoom.pinchsensitivity/90),!this.keepaspectratio&&this.attr.zoom.pinchhorizontal&&c0&&this.dehighlightAll(),this.updateQuality=this.BOARD_QUALITY_HIGH,this.mode=this.BOARD_MODE_NONE,this._board_touches=[],this.touches=[]},_getPointerInputDevice:function(t){if(e.A.isBrowser){if("touch"===t.pointerType||window.navigator.msMaxTouchPoints&&window.navigator.msMaxTouchPoints>1)return"touch";if("mouse"===t.pointerType)return"mouse";if("pen"===t.pointerType)return"pen"}return"mouse"},pointerDownListener:function(t,i,r){var o,n,a,h,l,c,d,u,p,f,A;if(!i&&this._isPointerRegistered(t))return!1;if(null===s.A.evaluate(this.attr.movetarget)&&s.A.exists(t.target)&&s.A.exists(t.target.releasePointerCapture)&&t.target.releasePointerCapture(t.pointerId),!i&&t.isPrimary,this.hasPointerUp||(window.navigator.msPointerEnabled?e.A.addEvent(this.document,"MSPointerUp",this.pointerUpListener,this):(e.A.addEvent(this.document,"pointerup",this.pointerUpListener,this),e.A.addEvent(this.document,"pointercancel",this.pointerUpListener,this)),this.hasPointerUp=!0),this.hasMouseHandlers&&this.removeMouseEventHandlers(),this.hasTouchHandlers&&this.removeTouchEventHandlers(),this.document.selection&&s.A.isFunction(this.document.selection.empty))this.document.selection.empty();else if(window.getSelection&&(c=window.getSelection()).removeAllRanges)try{c.removeAllRanges()}catch(t){}if(this._inputDevice=this._getPointerInputDevice(t),u=this._inputDevice,this.options.precision.hasPoint=this.options.precision[u],h=this.getMousePosition(t),this._testForSelection(t),this.selectingMode)return this._startSelecting(h),void this.triggerEventHandlers(["touchstartselecting","pointerstartselecting","startselecting"],[t]);if(this.attr.drag.enabled&&i?(l=[i],this.mode=this.BOARD_MODE_DRAG):l=this.initMoveObject(h[0],h[1],t,u),d={num:t.pointerId,X:h[0],Y:h[1],Xprev:NaN,Yprev:NaN,Xstart:[],Ystart:[],Zstart:[]},l.length>0){for(f=l[l.length-1],p=!1,o=0;o0&&!r&&(t.preventDefault(),t.stopPropagation()),!!e.A.isBrowser&&("touch"!==this._getPointerInputDevice(t)?this.mode===this.BOARD_MODE_NONE&&this.mouseOriginMoveStart(t):(this._pointerStorePosition(t),t.touches=this._board_touches,1===t.touches.length&&this.mode===this.BOARD_MODE_NONE&&this.touchStartMoveOriginOneFinger(t)||2!==t.touches.length||this.mode!==this.BOARD_MODE_NONE&&this.mode!==this.BOARD_MODE_MOVE_ORIGIN||(this.mode===this.BOARD_MODE_MOVE_ORIGIN&&this.originMoveEnd(),this.gestureStartListener(t))),this.initSketchCurve(t),A="none",this.mode!==this.BOARD_MODE_NONE||!0!==s.A.evaluate(this.attr.browserpan)&&!0!==s.A.evaluate(this.attr.browserpan.enabled)||!1!==s.A.evaluate(this.attr.pan.enabled)&&!0!==s.A.evaluate(this.attr.pan.needtwofingers)||(A="auto"),this.containerObj.style.touchAction=A,this.triggerEventHandlers(["touchstart","down","pointerdown","MSPointerDown"],[t]),!0)},_handleClicks:function(t,e){var i,r,o=this;if(this.selectingMode)t.stopPropagation();else{if(r=s.A.evaluate(this.attr.clickdelay),s.A.evaluate(this.attr.dblclicksuppressclick))this._preventSingleClick=!1,this._singleClickTimer=setTimeout(function(){if(!o._preventSingleClick)for(i in o.triggerEventHandlers(e,[t]),o.clickObjects)o.clickObjects.hasOwnProperty(i)&&(o.clickObjects[i].triggerEventHandlers(e,[t]),delete o.clickObjects[i])},r);else{for(i in o.triggerEventHandlers(e,[t]),o.clickObjects)o.clickObjects.hasOwnProperty(i)&&o.clickObjects[i].triggerEventHandlers(e,[t]);setTimeout(function(){for(i in o.clickObjects)o.clickObjects.hasOwnProperty(i)&&delete o.clickObjects[i]},r)}t.stopPropagation()}},_handleDblClicks:function(t,e){var i;if(this.selectingMode)t.stopPropagation();else{for(i in this._preventSingleClick=!0,clearTimeout(this._singleClickTimer),this.triggerEventHandlers(e,[t]),this.clickObjects)this.clickObjects.hasOwnProperty(i)&&(this.clickObjects[i].triggerEventHandlers(e,[t]),delete this.clickObjects[i]);t.stopPropagation()}},pointerClickListener:function(t){this._handleClicks(t,["click","pointerclick"])},pointerDblClickListener:function(t){this._handleDblClicks(t,["dblclick","pointerdblclick"])},mouseClickListener:function(t){this._handleClicks(t,["click","mouseclick"])},mouseDblClickListener:function(t){this._handleDblClicks(t,["dblclick","mousedblclick"])},pointerMoveListener:function(t){var e,i,r,o,n,a;if("touch"===this._getPointerInputDevice(t)&&!this._isPointerRegistered(t))return this.BOARD_MODE_NONE;if(!this.checkFrameRate(t))return!1;if(this.mode!==this.BOARD_MODE_DRAG&&(this.dehighlightAll(),this.displayInfobox(!1)),this.mode!==this.BOARD_MODE_NONE&&(t.preventDefault(),t.stopPropagation()),this.updateQuality=this.BOARD_QUALITY_LOW,this._inputDevice=this._getPointerInputDevice(t),a=this._inputDevice,this.options.precision.hasPoint=this.options.precision[a],o=.3333*this.options.precision.hasPoint,r=this.getMousePosition(t),null===s.A.evaluate(this.attr.movetarget)&&(r[0]<=o||r[1]<=o||r[0]>=this.canvasWidth-o||r[1]>=this.canvasHeight-o))return this.mode===this.BOARD_MODE_NONE;if(this.selectingMode)this._moveSelecting(r),this.triggerEventHandlers(["touchmoveselecting","moveselecting","pointermoveselecting"],[t,this.mode]);else if(!this.mouseOriginMove(t))if(this.addToSketchCurve(t),this.mode===this.BOARD_MODE_DRAG){for(e=0;e-1;i--){for(o=!1,r=0;r0||s.A.exists(n.pointerclick)&&n.pointerclick.length>0||s.A.exists(n.dblclick)&&n.dblclick.length>0||s.A.exists(n.pointerdblclick)&&n.pointerdblclick.length>0)&&(this.clickObjects[this.downObjects[i].id]=this.downObjects[i]),this.downObjects.splice(i,1))}return this.hasPointerUp&&(window.navigator.msPointerEnabled?e.A.removeEvent(this.document,"MSPointerUp",this.pointerUpListener,this):(e.A.removeEvent(this.document,"pointerup",this.pointerUpListener,this),e.A.removeEvent(this.document,"pointercancel",this.pointerUpListener,this)),this.hasPointerUp=!1),this._pointerClearTouches(t.pointerId),"touch"!==this._getPointerInputDevice(t)&&this.dehighlightAll(),h&&this.update(),!0},pointerLeaveListener:function(t){return this.displayInfobox(!1),this.dehighlightAll(),!0},touchStartListener:function(r){var o,n,a,h,l,c,d,u,p,f,A=this.options.precision.touch,_=r.touches;for(this.hasTouchEnd||(e.A.addEvent(this.document,"touchend",this.touchEndListener,this),this.hasTouchEnd=!0),this.document.selection&&s.A.isFunction(this.document.selection.empty)?this.document.selection.empty():window.getSelection&&window.getSelection().removeAllRanges(),this._inputDevice="touch",this.options.precision.hasPoint=this.options.precision.touch,o=0;o<_.length;o++)_[o].jxg_isused=!1;for(o=0;o0;if(0!==(l=this.initMoveObject(h[0],h[1],r,"touch")).length)if(c=l[l.length-1],p={num:o,X:_[o].screenX,Y:_[o].screenY,Xprev:NaN,Yprev:NaN,Xstart:[],Ystart:[],Zstart:[]},s.A.isPoint(c)||c.elementClass===i.A.OBJECT_CLASS_TEXT||c.type===i.A.OBJECT_TYPE_TICKS||c.type===i.A.OBJECT_TYPE_IMAGE)u=[p],this.saveStartPos(c,u[0]),this.touches.push({obj:c,targets:u}),c.highlight(!0);else if(c.elementClass===i.A.OBJECT_CLASS_LINE||c.elementClass===i.A.OBJECT_CLASS_CIRCLE||c.elementClass===i.A.OBJECT_CLASS_CURVE||c.type===i.A.OBJECT_TYPE_POLYGON){for(d=!1,n=0;n0&&(r.preventDefault(),r.stopPropagation()),1===_.length&&this.mode===this.BOARD_MODE_NONE&&this.touchStartMoveOriginOneFinger(r)||2!==_.length||this.mode!==this.BOARD_MODE_NONE&&this.mode!==this.BOARD_MODE_MOVE_ORIGIN||(this.mode===this.BOARD_MODE_MOVE_ORIGIN&&this.originMoveEnd(),this.gestureStartListener(r)),this.initSketchCurve(r),this.options.precision.hasPoint=this.options.precision.mouse,this.triggerEventHandlers(["touchstart","down"],[r]),!1},touchMoveListener:function(t){var e,i,s,r,o=t.touches;if(!this.checkFrameRate(t))return!1;if(this.mode!==this.BOARD_MODE_NONE&&(t.preventDefault(),t.stopPropagation()),this.mode!==this.BOARD_MODE_DRAG&&(this.dehighlightAll(),this.displayInfobox(!1)),this._inputDevice="touch",this.options.precision.hasPoint=this.options.precision.touch,this.updateQuality=this.BOARD_QUALITY_LOW,this.selectingMode){for(e=0;ethis.canvasWidth||i[1]<0||i[1]>this.canvasHeight)return;r[0].X=i[0],r[0].Y=i[1],this.moveObject(i[0],i[1],this.touches[e],t,"touch")}}else if(2===r.length&&r[0].num>-1&&r[1].num>-1&&o[r[0].num]&&o[r[1].num]){if(i=this.getMousePosition(t,r[0].num),s=this.getMousePosition(t,r[1].num),i[0]<0||i[0]>this.canvasWidth||i[1]<0||i[1]>this.canvasHeight||s[0]<0||s[0]>this.canvasWidth||s[1]<0||s[1]>this.canvasHeight)return;r[0].X=i[0],r[0].Y=i[1],r[1].X=s[0],r[1].Y=s[1],this.twoFingerMove(this.touches[e],r[0].num,t),r[0].Xprev=i[0],r[0].Yprev=i[1],r[1].Xprev=s[0],r[1].Yprev=s[1]}}else 2===o.length&&this.gestureChangeListener(t),i=this.getMousePosition(t,0),this.highlightElements(i[0],i[1],t,-1);return this.mode!==this.BOARD_MODE_DRAG&&this.displayInfobox(!1),this.triggerEventHandlers(["touchmove","move"],[t,this.mode]),this.options.precision.hasPoint=this.options.precision.mouse,this.updateQuality=this.BOARD_QUALITY_HIGH,this.mode===this.BOARD_MODE_NONE},touchEndListener:function(t){var r,o,n,a,h,l,c=this.options.precision.touch,d=[],u=t&&t.touches,p=!1;if(this.triggerEventHandlers(["touchend","up"],[t]),this.displayInfobox(!1),this.finalizeSketchCurve(t),this.selectingMode)this._stopSelecting(t),this.triggerEventHandlers(["touchstopselecting","stopselecting"],[t]),this.stopSelectionMode();else if(u&&u.length>0){for(r=0;r-1;r--){for(a=!1,o=0;o0?this.zoomIn(s[1],s[2]):this.zoomOut(s[1],s[2]),this.triggerEventHandlers(["mousewheel"],[t]),t.preventDefault(),!1)},keyDownListener:function(e){var r,o,n,a,h,l,c=e.target.id,d=0,u=0,p=s.A.evaluate(this.attr.keyboard.dx)/this.unitX,f=s.A.evaluate(this.attr.keyboard.dy)/this.unitY,A=!1,_=!0;return!(!this.attr.keyboard.enabled||""===c)&&(9!==e.keyCode&&((!(a=this.containerObj.shadowRoot||document).activeElement||"INPUT"!==(o=a.activeElement).tagName&&"textarea"!==o.tagName)&&(r=c.replace(this.containerObj.id+"_",""),o=this.select(r),s.A.exists(o.coords)&&(l=o.coords.usrCoords.slice(1)),s.A.evaluate(this.attr.keyboard.panshift)&&e.shiftKey||s.A.evaluate(this.attr.keyboard.panctrl)&&e.ctrlKey?(!0===s.A.evaluate(this.attr.zoom.enabled)&&(A=!0),38===e.keyCode?this.clickUpArrow():40===e.keyCode?this.clickDownArrow():37===e.keyCode?this.clickLeftArrow():39===e.keyCode?this.clickRightArrow():A&&171===e.keyCode?this.zoomIn():A&&173===e.keyCode?this.zoomOut():A&&79===e.keyCode?this.zoom100():_=!1):e.shiftKey||e.ctrlKey||(s.A.exists(o.visProp)&&(s.A.exists(o.visProp.snaptogrid)&&o.visProp.snaptogrid&&o.evalVisProp("snapsizex")&&o.evalVisProp("snapsizey")?(p=d=(n=o.getSnapSizes())[0],f=u=n[1]):s.A.exists(o.visProp.attracttogrid)&&o.visProp.attracttogrid&&o.evalVisProp("attractordistance")&&o.evalVisProp("attractorunit")&&(u=d=1.1*o.evalVisProp("attractordistance"),"screen"===o.evalVisProp("attractorunit")&&(d/=this.unitX,u/=this.unitX),p=Math.max(d,p),f=Math.max(u,f))),38===e.keyCode?h=[0,f]:40===e.keyCode?h=[0,-f]:37===e.keyCode?h=[-p,0]:39===e.keyCode?h=[p,0]:_=!1,h&&o.isDraggable&&o.visPropCalc.visible&&(this.geonextCompatibilityMode&&(s.A.isPoint(o)||o.elementClass===i.A.OBJECT_CLASS_TEXT)||!this.geonextCompatibilityMode)&&!o.evalVisProp("fixed")&&(this.mode=this.BOARD_MODE_DRAG,s.A.exists(o.coords)&&(h[0]+=l[0],h[1]+=l[1]),s.A.exists(o.coords)?(o.setPosition(t.A.COORDS_BY_USER,h),this.updateInfobox(o)):(this.displayInfobox(!1),o.setPositionDirectly(i.A.COORDS_BY_USER,h,[0,0])),this.triggerEventHandlers(["keymove","move"],[e,this.mode]),o.triggerEventHandlers(["keydrag","drag"],[e]),this.mode=this.BOARD_MODE_NONE)),this.update(),_&&s.A.exists(e.preventDefault)&&e.preventDefault(),_)))},keyFocusInListener:function(t){var e,i,r=t.target.id;if(!this.attr.keyboard.enabled||""===r)return!1;e=r.replace(this.containerObj.id+"_",""),i=this.select(e),s.A.exists(i.highlight)&&(i.highlight(!0),this.focusObjects=[e],i.triggerEventHandlers(["hit"],[t])),s.A.exists(i.coords)&&this.updateInfobox(i)},keyFocusOutListener:function(t){if(!this.attr.keyboard.enabled)return!1;this.focusObjects=[],this.dehighlightAll(),this.displayInfobox(!1)},updateContainerDims:function(t,e){var i,r,o,n,a=t,h=e,l=0,c=0;return void 0===t&&(a=this.containerObj.offsetWidth,h=this.containerObj.offsetHeight),void 0===t&&window&&window.getComputedStyle&&(r=window.getComputedStyle(this.containerObj,null),o=parseFloat(r.getPropertyValue("border-left-width"))+parseFloat(r.getPropertyValue("border-right-width")),isNaN(o)||(a-=o),n=parseFloat(r.getPropertyValue("border-top-width"))+parseFloat(r.getPropertyValue("border-bottom-width")),isNaN(n)||(h-=n)),a<=0||h<=0||isNaN(a)||isNaN(h)?this:(isNaN(this.getBoundingBox()[0])&&(i=this.attr.boundingbox,s.A.exists(i)&&this.keepaspectratio?(this.unitX=a/(i[2]-i[0]),this.unitY=h/(i[1]-i[3]),Math.abs(this.unitX)0&&this.select(this.focusObjects[0]).elementClass===i.A.OBJECT_CLASS_POINT||this.infobox.hiddenByParent===t&&(this.infobox.hiddenByParent=!t,this.infobox.prepareUpdate().updateVisibility(t).updateRenderer()),this},showInfobox:function(t){return this.displayInfobox(t)},highlightInfobox:function(t,e,i){return this.highlightCustomInfobox("("+t+", "+e+")",i),this},highlightCustomInfobox:function(t,e){return this.infobox.setText(t),this},dehighlightAll:function(){var t,e,i={},s=!1;for(t in this.highlightedObjects)this.highlightedObjects.hasOwnProperty(t)&&(e=this.highlightedObjects[t],this.focusObjects.indexOf(t)<0?((this.hasMouseHandlers||this.hasPointerHandlers)&&e.noHighlight(),s=!0):i[t]=e);return this.highlightedObjects=i,"canvas"===this.renderer.type&&s&&(this.prepareUpdate(),this.renderer.suspendRedraw(this),this.updateRenderer(),this.renderer.unsuspendRedraw()),this},getScrCoordsOfMouse:function(t,e){return[t,e]},getUsrCoordsOfMouse:function(t){var s=this.getCoordsTopLeftCorner(),r=e.A.getPosition(t,null,this.document),o=r[0]-s[0],n=r[1]-s[1];return new u.A(i.A.COORDS_BY_SCREEN,[o,n],this).usrCoords.slice(1)},getAllUnderMouse:function(t){var e=this.getAllObjectsUnderMouse(t);return e.push(this.getUsrCoordsOfMouse(t)),e},getAllObjectsUnderMouse:function(t){var i,s,r=this.getCoordsTopLeftCorner(),o=e.A.getPosition(t,null,this.document),n=o[0]-r[0],a=o[1]-r[1],h=[],l=this.objectsList.length;for(i=0;ithis.maxboundingbox[1]+o.A.eps||l[1]>this.maxboundingbox[2]+o.A.eps||l[2]"),p=e.indexOf(""),f=function(t,e,s,r){return function(){var o,n;n=(o=t.select(e.id)).coords.usrCoords[r],2===r?o.setPositionDirectly(i.A.COORDS_BY_USER,[s(),n]):o.setPositionDirectly(i.A.COORDS_BY_USER,[n,s()]),o.prepareUpdate().update()}},A=function(t,e,i){return function(){var s,r;s=t.select(e.id),r=i(),s.setAttribute({visible:r})}},_=function(t,e,i,s){return function(){var r,o;r=t.select(e.id),o=i(),"strokewidth"===s?r.visProp.strokewidth=o:(o=T.A.rgba2rgbo(o),r.visProp[s+"color"]=o[0],r.visProp[s+"opacity"]=o[1])}},m=function(t,e,i){return function(){t.select(e.id).position=i()}},g=function(t,e,i){return function(){t.select(e.id).setStyle(i())}};if(!(u<0)){for(;u>=0;){if(o=(r=e.slice(u+6,p)).indexOf("="),n=r.slice(0,o),a=r.slice(o+1),o=n.indexOf("."),h=n.slice(0,o),l=this.elementsByName[s.A.unescapeHTML(h)],c=n.slice(o+1).replace(/\s+/g,"").toLowerCase(),a=s.A.createFunction(a,this,"",!0),s.A.exists(this.elementsByName[h]))switch(c){case"x":d.push(f(this,l,a,2));break;case"y":d.push(f(this,l,a,1));break;case"visible":d.push(A(this,l,a));break;case"position":d.push(m(this,l,a));break;case"stroke":d.push(_(this,l,a,"stroke"));break;case"style":d.push(g(this,l,a));break;case"strokewidth":d.push(_(this,l,a,"strokewidth"));break;case"fill":d.push(_(this,l,a,"fill"));break;case"label":break;default:t.A.debug('property "'+c+'" in conditions not yet implemented:'+a)}else t.A.debug("debug conditions: |"+h+"| undefined");u=(e=e.slice(p+7)).indexOf(""),p=e.indexOf("")}this.updateConditions=function(){var t;for(t=0;t25;)this.options.grid.snapSizeX*=2,r/=2;for(this.options.grid.snapSizeY=a[1];Math.abs(o)>25;)this.options.grid.snapSizeY*=2,o/=2;return this},applyZoom:function(){return this.updateCoords().calculateSnapSizes().clearTraces().fullUpdate(),this},zoomIn:function(t,e){var i=this.getBoundingBox(),r=s.A.evaluate(this.attr.zoom.factorx),o=s.A.evaluate(this.attr.zoom.factory),n=(i[2]-i[0])*(1-1/r),a=(i[1]-i[3])*(1-1/o),h=.5,l=.5,c=s.A.evaluate(this.attr.zoom.max),d=s.A.evaluate(this.attr.zoom.eps)||s.A.evaluate(this.attr.zoom.min)||.001;return this.zoomX>c&&r>1||this.zoomY>c&&o>1||this.zoomXn&&(n=r.coords.usrCoords[1]),r.coords.usrCoords[2]>h?h=r.coords.usrCoords[2]:r.coords.usrCoords[2]l[1]&&(l[1]=i[1]),i[2]>l[2]&&(l[2]=i[2]),i[3]-1){for(this.objectsList.splice(a,1),n=a;n=0&&(e+=""+this.objects[t].id+": "),this.objects[t].childElements)this.objects[t].childElements.hasOwnProperty(i)&&(e+=this.objects[t].childElements[i].id+"("+this.objects[t].childElements[i].name+"), ");e+="\n"}return e+="

\n",(s=window.open()).document.open(),s.document.write(e),s.document.close(),this},showXML:function(){var t=window.open("");return t.document.open(),t.document.write("
"+s.A.escapeHTML(this.xmlString)+"
"),t.document.close(),this},prepareUpdate:function(t){var e,r,o,n=this.objectsList.length;for(e=0;e=0;e--)this.dependentBoards[e]===t&&this.dependentBoards.splice(e,1);return this},update:function(t){var e,i,r,o,n;if(this.inUpdate||this.isSuspendedUpdate)return this;for(this.inUpdate=!0,"all"===this.attr.minimizereflow&&this.containerObj&&"vml"!==this.renderer.type&&(n=this.document.activeElement,o=this.renderer.removeToInsertLater(this.containerObj)),"svg"===this.attr.minimizereflow&&"svg"===this.renderer.type&&(n=this.document.activeElement,o=this.renderer.removeToInsertLater(this.renderer.svgRoot)),this.prepareUpdate(t).updateElements(t).updateConditions(),this.renderer.suspendRedraw(this),this.updateRenderer(),this.renderer.unsuspendRedraw(),this.triggerEventHandlers(["update"],[]),o&&(o(),n.focus()),i=this.dependentBoards.length,e=0;e0&&"view3d"===i[0].elType?i[n]=i[0].select(i[n]):i[n]=this.select(i[n]));if(!s.A.isFunction(t.A.elements[e]))throw new Error("JSXGraph: create: Unknown element type given: "+e);return o=t.A.elements[e](this,i,r),s.A.exists(o)?(o.prepareUpdate&&o.update&&o.updateRenderer&&o.fullUpdate(),o):(t.A.debug("JSXGraph: create: failure creating "+e),o)},createElement:function(){return t.A.deprecated("Board.createElement()","Board.create()"),this.create.apply(this,arguments)},clearTraces:function(){var t;for(t=0;tthis.maxboundingbox[1]+o.A.eps||t[2]>this.maxboundingbox[2]+o.A.eps||t[3]=n?p>=f?(this.unitY=n/u,this.unitX=this.unitY*c):(this.unitY=n/Math.abs(d)*o.A.sign(u)/m,this.unitX=this.unitY*c):f>p?(this.unitX=a/d,this.unitY=this.unitX/c):(this.unitX=a/Math.abs(u)*o.A.sign(d)*m,this.unitY=this.unitX/c),A=.5*(a/this.unitX-d),_=.5*(n/this.unitY-u),this.keepaspectratio=!0):(this.unitX=a/(t[2]-t[0]),this.unitY=n/(t[1]-t[3]),this.keepaspectratio=!1),this.moveOrigin(-this.unitX*(t[0]-A),this.unitY*(t[1]+_)),"update"===r?(this.zoomX*=this.unitX/h,this.zoomY*=this.unitY/l):"reset"===r&&(this.zoomX=s.A.exists(this.attr.zoomx)?this.attr.zoomx:1,this.zoomY=s.A.exists(this.attr.zoomy)?this.attr.zoomy:1)),this):this},getBoundingBox:function(){var t=new u.A(i.A.COORDS_BY_SCREEN,[0,0],this).usrCoords,e=new u.A(i.A.COORDS_BY_SCREEN,[this.canvasWidth,this.canvasHeight],this).usrCoords;return[t[1],t[2],e[1],e[2]]},_set:function(t,e){t=t.toLocaleLowerCase(),null===e||!s.A.isObject(e)||s.A.exists(e.id)||s.A.exists(e.name)?this.attr[t]=e:s.A.mergeAttr(this.attr[t],e)},setAttribute:function(e,r){var o,n,a,h,l,c,d,u,p,f={};for(o=0;or&&r>o[3])},updateCSSTransforms:function(){var t=this.containerObj,i=t,r=t;if(this.cssTransMat=e.A.getCSSTransformMatrix(i),s.A.exists(i.getRootNode)){for(i=i.parentNode===i.getRootNode()?i.parentNode.host:i.parentNode;i;)this.cssTransMat=o.A.matMatMult(e.A.getCSSTransformMatrix(i),this.cssTransMat),i=i.parentNode===i.getRootNode()?i.parentNode.host:i.parentNode;this.cssTransMat=o.A.inverse(this.cssTransMat)}else{for(i=i.offsetParent;i;){for(this.cssTransMat=o.A.matMatMult(e.A.getCSSTransformMatrix(i),this.cssTransMat),r=r.parentNode;r!==i;)this.cssTransMat=o.A.matMatMult(e.A.getCSSTransformMatrix(i),this.cssTransMat),r=r.parentNode;i=i.offsetParent}this.cssTransMat=o.A.inverse(this.cssTransMat)}return this},startSelectionMode:function(){this.selectingMode=!0,this.selectionPolygon.setAttribute({visible:!0}),this.selectingBox=[[0,0],[0,0]],this._setSelectionPolygonFromBox(),this.selectionPolygon.fullUpdate()},stopSelectionMode:function(){return this.selectingMode=!1,this.selectionPolygon.setAttribute({visible:!1}),[this.selectionPolygon.vertices[0].coords,this.selectionPolygon.vertices[2].coords]},_startSelecting:function(t){this.isSelecting=!0,this.selectingBox=[[t[0],t[1]],[t[0],t[1]]],this._setSelectionPolygonFromBox()},_moveSelecting:function(t){this.isSelecting&&(this.selectingBox[1]=[t[0],t[1]],this._setSelectionPolygonFromBox(),this.selectionPolygon.fullUpdate())},_stopSelecting:function(t){var e=this.getMousePosition(t);this.isSelecting=!1,this.selectingBox[1]=[e[0],e[1]],this._setSelectionPolygonFromBox()},_setSelectionPolygonFromBox:function(){var e=this.selectingBox[0],i=this.selectingBox[1];this.selectionPolygon.vertices[0].setPositionDirectly(t.A.COORDS_BY_SCREEN,[e[0],e[1]]),this.selectionPolygon.vertices[1].setPositionDirectly(t.A.COORDS_BY_SCREEN,[e[0],i[1]]),this.selectionPolygon.vertices[2].setPositionDirectly(t.A.COORDS_BY_SCREEN,[i[0],i[1]]),this.selectionPolygon.vertices[3].setPositionDirectly(t.A.COORDS_BY_SCREEN,[i[0],e[1]])},_testForSelection:function(t){this._isRequiredKeyPressed(t,"selection")&&(s.A.exists(this.selectionPolygon)||this._createSelectionPolygon(this.attr),this.startSelectionMode())},_createSelectionPolygon:function(t){var e;return s.A.exists(this.selectionPolygon)||!0===(e=s.A.copyAttributes(t,v.A,"board","selection")).enabled&&(this.selectionPolygon=this.create("polygon",[[0,0],[0,0],[0,0],[0,0]],e)),this},initSketchCurve:function(t){var e,i;this.mode!==this.BOARD_MODE_MOVE_ORIGIN&&(i=this.getUsrCoordsOfMouse(t),e=t.isPrimary?0:1,s.A.exists(this.sketches[e])&&(this.sketches[e].dataX=[i[0]],this.sketches[e].dataY=[i[1]],this.isSketching[e]=!0))},addToSketchCurve:function(t){var e,i,r;e=t.isPrimary?0:1,this.attr.sketches.enabled&&!0===this.isSketching[e]&&s.A.exists(this.sketches[e])&&(i=this.getUsrCoordsOfMouse(t),this.sketches[e].dataX.push(i[0]),this.sketches[e].dataY.push(i[1]),null!==(r=this.sketches[e].evalVisProp("maxlength"))&&this.sketches[e].dataX.length>r&&(this.sketches[e].dataX=this.sketches[e].dataX.slice(-r),this.sketches[e].dataY=this.sketches[e].dataY.slice(-r)),this.sketches[e].evalVisProp("visible")&&this.update())},finalizeSketchCurve:function(t){var e;e=t.isPrimary?0:1,this.attr.sketches.enabled&&s.A.exists(this.sketches[e])&&(this.isSketching[e]=!1,this.sketches[e].evalVisProp("deleteOnUp")&&(this.sketches[e].dataX=[],this.sketches[e].dataY=[]))},__evt__attribute:function(t){},__evt__down:function(t){},__evt__mousedown:function(t){},__evt__pendown:function(t){},__evt__pointerdown:function(t){},__evt__touchstart:function(t){},__evt__up:function(t){},__evt__mouseup:function(t){},__evt__pointerup:function(t){},__evt__touchend: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__move:function(t,e){},__evt__mousemove:function(t,e){},__evt__penmove:function(t,e){},__evt__pointermove:function(t,e){},__evt__touchmove:function(t,e){},__evt__keymove:function(t,e){},__evt__hit:function(t,e,i){},__evt__mousehit:function(t,e,i){},__evt__update:function(){},__evt__boundingbox:function(){},__evt__startselecting:function(){},__evt__mousestartselecting:function(){},__evt__pointerstartselecting:function(){},__evt__touchstartselecting:function(){},__evt__stopselecting:function(){},__evt__mousestopselecting:function(){},__evt__pointerstopselecting:function(){},__evt__touchstopselecting:function(){},__evt__moveselecting:function(){},__evt__mousemoveselecting:function(){},__evt__pointermoveselecting:function(){},__evt__touchmoveselecting:function(){},__evt:function(){},toFullscreen:function(t){var e,i,r,o,n=this.document;return t=t||this.container,this._fullscreen_inner_id=t,r=n.getElementById(t),e="fullscreenwrap_"+t,s.A.exists(r._cssFullscreenStore)||(o=this.containerObj.getBoundingClientRect(),r._cssFullscreenStore={w:o.width,h:o.height}),n.getElementById(e)?i=n.getElementById(e):((i=document.createElement("div")).classList.add("JXG_wrap_private"),i.setAttribute("id",e),r.parentNode.insertBefore(i,r),i.appendChild(r)),i.requestFullscreen=i.requestFullscreen||i.webkitRequestFullscreen||i.mozRequestFullScreen||i.msRequestFullscreen,null===(void 0!==n.fullscreenElement?n.fullscreenElement:void 0!==n.webkitFullscreenElement?n.webkitFullscreenElement:n.msFullscreenElement)?i.requestFullscreen&&(i.requestFullscreen(),this.startFullscreenResizeObserver(i)):(this.stopFullscreenResizeObserver(i),s.A.exists(document.exitFullscreen)?document.exitFullscreen():s.A.exists(document.webkitExitFullscreen)&&document.webkitExitFullscreen()),this},fullscreenListener:function(t){var i,r,o,n=this.document;i=this._fullscreen_inner_id,s.A.exists(i)&&(o=void 0!==n.fullscreenElement?n.fullscreenElement:void 0!==n.webkitFullscreenElement?n.webkitFullscreenElement:n.msFullscreenElement,r=n.getElementById(i),o?(r._cssFullscreenStore.id=o.id,r._cssFullscreenStore.isFullscreen=!0,r._cssFullscreenStore.margin=r.style.margin,r._cssFullscreenStore.width=r.style.width,r._cssFullscreenStore.height=r.style.height,r._cssFullscreenStore.transform=r.style.transform,r.style.width=r._cssFullscreenStore.w+"px",r.style.height=r._cssFullscreenStore.h+"px",r.style.margin="",e.A.scaleJSXGraphDiv(o.id,i,n,s.A.evaluate(this.attr.fullscreen.scale)),o=null):s.A.exists(r._cssFullscreenStore)&&(r._cssFullscreenStore.isFullscreen=!1,r.style.margin=r._cssFullscreenStore.margin,r.style.width=r._cssFullscreenStore.width,r.style.height=r._cssFullscreenStore.height,r.style.transform=r._cssFullscreenStore.transform,r._cssFullscreenStore=null,r.parentElement.replaceWith(r)),this.updateCSSTransforms())},startFullscreenResizeObserver:function(t){var i=this;return e.A.isBrowser&&this.attr.resize&&this.attr.resize.enabled?(this.resizeObserver=new ResizeObserver(function(r){var o,n,a=i.document;i._isResizing||(i._isResizing=!0,window.setTimeout(function(){try{o=i._fullscreen_inner_id,null!==(n=void 0!==a.fullscreenElement?a.fullscreenElement:void 0!==a.webkitFullscreenElement?a.webkitFullscreenElement:a.msFullscreenElement)&&e.A.scaleJSXGraphDiv(n.id,o,a,s.A.evaluate(i.attr.fullscreen.scale))}catch(e){i.stopFullscreenResizeObserver(t)}finally{i._isResizing=!1}},i.attr.resize.throttle))}),this.resizeObserver.observe(t),this):this},stopFullscreenResizeObserver:function(t){return e.A.isBrowser&&this.attr.resize&&this.attr.resize.enabled?(s.A.exists(this.resizeObserver)&&this.resizeObserver.unobserve(t),this):this},addLogEntry:function(t,e,i){var r,o,n=this.userLog.length-1;return s.A.exists(e.elementClass)&&(o=e.id),s.A.evaluate(this.attr.logging.enabled)&&(r=(new Date).getTime(),n>=0&&this.userLog[n].type===t&&this.userLog[n].id===o&&r-this.userLog[n].end<500?(this.userLog[n].end=r,this.userLog[n].endpos=i):this.userLog.push({type:t,id:o,start:r,startpos:i,end:r,endpos:i,bbox:this.getBoundingBox(),canvas:[this.canvasWidth,this.canvasHeight],zoom:[this.zoomX,this.zoomY]})),this},createRoulette:function(t,e,i,s,r,n,a){var h=this;return new function(){var l,c=0,u=0,p=0,f=i,A=d.A.root(function(i){var s=t.X(f),r=t.Y(f),o=e.X(i),n=e.Y(i);return(s-o)*(s-o)+(r-n)*(r-n)},[0,2*Math.PI]),_=0,m=0,b=h.create("transform",[function(){return c}],{type:"rotate"}),v=h.create("transform",[function(){return c},function(){return t.X(f)},function(){return t.Y(f)}],{type:"rotate"}),y=h.create("transform",[function(){return u},function(){return p}],{type:"translate"}),C=function(t,e,i){var s=d.A.D(t.X)(e),r=d.A.D(t.Y)(e),n=d.A.D(t.X)(i),a=d.A.D(t.Y)(i),h=d.A.D(t.X)(.5*(e+i)),l=d.A.D(t.Y)(.5*(e+i)),c=o.A.hypot(s,r),u=o.A.hypot(n,a);return(c+4*o.A.hypot(h,l)+u)*(i-e)/6},P=function(t){return l-C(e,A,t)},E=Math.PI/18,x=9*E,O=null;return this.rolling=function(){var i,o,n,O,M;l=C(t,f,_=f+r*s),m=d.A.root(P,A),i=new g(t.X(_),t.Y(_)),o=new g(e.X(m),e.Y(m)),n=new g(d.A.D(t.X)(_),d.A.D(t.Y)(_)),O=new g(d.A.D(e.X)(m),d.A.D(e.Y)(m)),M=g.C.div(n,O),c=Math.atan2(M.imaginary,M.real),M.div(g.C.abs(M)),M.mult(o),u=i.real-M.real,p=i.imaginary-M.imaginary,c<-E&&c>-x?(c=-E,v.applyOnce(a)):c>E&&c0&&(O=window.setInterval(this.rolling,n)),this},this.stop=function(){return window.clearInterval(O),this},this}}});var D=t.A.Board;t.A.SVGRenderer=function(t,e){var i;for(this.type="svg",this.isIE="undefined"!=typeof navigator&&(-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,o,n){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",n[0]),a.setAttributeNS(null,"dy",n[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||!s.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",o),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 s.A.exists(encodeURIComponent)&&(t=encodeURIComponent(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.createClip=function(){var t,i,r=this.uniqName("ClipFull"),o=this.container.ownerDocument.createElementNS(this.svgNamespace,"clipPath"),n=this.container.ownerDocument.createElementNS(this.svgNamespace,"rect");return o.setAttributeNS(null,"id",r),n.setAttributeNS(null,"x",0),n.setAttributeNS(null,"y",0),n.setAttributeNS(null,"width",e.width),n.setAttributeNS(null,"height",e.height),t=getComputedStyle(this.container),i=s.A.exists(t["border-radius"])&&""!==t["border-radius"]?parseFloat(t["border-radius"]):0,n.setAttributeNS(null,"rx",i),n.setAttributeNS(null,"ry",i),o.appendChild(n),o},this.defs.appendChild(this.createClip()),this.setClipPath=function(t,e){return e?t.rendNode.style.clipPath=this.toURL(this.uniqName("ClipFull")):t.rendNode.style.removeProperty("clip-path"),this},this.updateClipPathRect=function(t,e){var i,r,o=this.uniqName("ClipFull");i=this.container.ownerDocument.getElementById(o),s.A.exists(i)&&s.A.exists(i.firstChild)&&(r=i.firstChild,s.A.exists(r)&&(r.setAttributeNS(null,"width",t),r.setAttributeNS(null,"height",e)))},this.layer=[],i=0;i0&&(o=t.rendNode,-1===(s=[(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("+s+") ",t.elementClass===i.A.OBJECT_CLASS_TEXT&&"html"===t.visProp.display){switch(o.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]}o.style["transform-origin"]=n+"px "+a+"px"}else o.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.rendNode.setAttributeNS(null,"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 s.A.exists(e)?e>=v.A.layer.numlayers&&(e=v.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){s.A.exists(t)&&s.A.exists(t.parentNode)&&t.parentNode.removeChild(t)},setLayer:function(t,e){var i,r;s.A.exists(e)?e>=v.A.layer.numlayers&&(e=v.A.layer.numlayers-1):e=0,i=this.layer[e],s.A.exists(i.moveBefore)?(r=t.rendNode).isConnected&&i.isConnected&&r.ownerDocument===i.ownerDocument?i.moveBefore(r,null):i.insertBefore(r,null):i.appendChild(t.rendNode)},makeArrows:function(t,e){var i,r,o=e.evFirst,n=e.evLast;this.isIE&&t.visPropCalc.visible&&(o||n)?t.rendNode.parentNode.insertBefore(t.rendNode,t.rendNode):(i=t.rendNodeTriangleStart,o?(r=this.toStr(this.container.id,"_",t.id,"TriangleStart",e.typeFirst),s.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)))):(s.A.exists(i)&&(this.remove(i),t.rendNodeTriangleStart=null),t.rendNode.removeAttributeNS(null,"marker-start")),i=t.rendNodeTriangleEnd,n?(r=this.toStr(this.container.id,"_",t.id,"TriangleEnd",e.typeLast),s.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)))):(s.A.exists(i)&&(this.remove(i),t.rendNodeTriangleEnd=null),t.rendNode.removeAttributeNS(null,"marker-end")))},updateEllipsePrim:function(t,e,i,s,r){var o;o=2e5,e=Math.abs(e)"===i||"<<>>"===i?("<<>>"===i&&(e*=1.41),s=" M "+(r[1]-e)+" "+r[2]+" L "+r[1]+" "+(r[2]+e)+" L "+(r[1]+e)+" "+r[2]+" L "+r[1]+" "+(r[2]-e)+" Z "):"^"===i?s=" M "+r[1]+" "+(r[2]-e)+" L "+(r[1]-o)+" "+(r[2]+n)+" L "+(r[1]+o)+" "+(r[2]+n)+" Z ":"v"===i?s=" M "+r[1]+" "+(r[2]+e)+" L "+(r[1]-o)+" "+(r[2]-n)+" L "+(r[1]+o)+" "+(r[2]-n)+" Z ":">"===i?s=" M "+(r[1]+e)+" "+r[2]+" L "+(r[1]-n)+" "+(r[2]-o)+" L "+(r[1]-n)+" "+(r[2]+o)+" Z ":"<"===i&&(s=" M "+(r[1]-e)+" "+r[2]+" L "+(r[1]+n)+" "+(r[2]-o)+" L "+(r[1]+n)+" "+(r[2]+o)+" Z "),s},updatePathStringPrim:function(t){var i,s,r,o,n,a,h,l=" M ",c=l,d=e.A.maxScreenCoord,u="";if(t.numberPoints<=0)return"";if(n=Math.min(t.points.length,t.numberPoints),1===t.bezierDegree){for(i=0;id||Math.abs(o)>d){if(i>0)a=t.points[i-1].scrCoords;else{if(!(id&&(h=o-a[2],o=Math.max(Math.min(o,d),-d),r=a[1]+(r-a[1])*(o-a[2])/h),Math.abs(r)>d&&(h=r-a[1],r=Math.max(Math.min(r,d),-d),o=a[2]+(o-a[2])*(r-a[1])/h)}u+=c+r+" "+o,c=" L "}}else if(3===t.bezierDegree)for(i=0;i0?s.setAttributeNS(null,"stroke-dasharray",this.dashArray[e-1].map(function(t){return t*i}).join(",")):s.hasAttributeNS(null,"stroke-dasharray")&&s.removeAttributeNS(null,"stroke-dasharray")},setGradient:function(t){var e,i,s,r=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"),s=this.createPrim("stop",t.id+"_gradient2"),e.appendChild(i),e.appendChild(s),this.defs.appendChild(e),r.setAttributeNS(null,"style","fill:"+this.toURL(this.container.id+"_"+t.id+"_gradient")),t.gradNode1=i,t.gradNode2=s,t.gradNode=e):r.removeAttributeNS(null,"style")},setLineCap:function(t){var e=t.evalVisProp("linecap");void 0!==e&&""!==e&&t.visPropOld.linecap!==e&&s.A.exists(t.rendNode)&&(this.setPropertyPrim(t.rendNode,"stroke-linecap",e),t.visPropOld.linecap=e)},setObjectFillColor:function(e,i,r,o){var n,a,h,l,c=i,d=r,u=e.evalVisProp("gradient");d=d>0?d:0,e.visPropOld.fillcolor===c&&e.visPropOld.fillopacity===d&&null===u||(s.A.exists(c)&&!1!==c&&(9!==c.length?(a=c,l=d):(h=T.A.rgba2rgbo(c),a=h[0],l=d*h[1]),n=void 0===o?e.rendNode:o,"none"!==a&&""!==a&&!1!==a&&this._setAttribute(function(){n.setAttributeNS(null,"fill",a)},e.visPropOld.fillcolor),e.type===t.A.OBJECT_TYPE_IMAGE?this._setAttribute(function(){n.setAttributeNS(null,"opacity",l)},e.visPropOld.fillopacity):("none"===a?(l=0,n.setAttributeNS(null,"pointer-events","visibleStroke")):n.setAttributeNS(null,"pointer-events","visiblePainted"),this._setAttribute(function(){n.setAttributeNS(null,"fill-opacity",l)},e.visPropOld.fillopacity)),"linear"!==u&&"radial"!==u||this.updateGradient(e)),e.visPropOld.fillcolor=c,e.visPropOld.fillopacity=d)},setObjectStrokeColor:function(t,e,r){var o,n,a,h,l=e,c=r;c=c>0?c:0,t.visPropOld.strokecolor===l&&t.visPropOld.strokeopacity===c||(s.A.exists(l)&&!1!==l&&(9!==l.length?(o=l,a=c):(n=T.A.rgba2rgbo(l),o=n[0],a=c*n[1]),h=t.rendNode,t.elementClass===i.A.OBJECT_CLASS_TEXT?"html"===t.evalVisProp("display")?this._setAttribute(function(){h.style.color=o,h.style.opacity=a},t.visPropOld.strokecolor):this._setAttribute(function(){h.setAttributeNS(null,"fill",o),h.setAttributeNS(null,"fill-opacity",a)},t.visPropOld.strokecolor):this._setAttribute(function(){h.setAttributeNS(null,"stroke",o),h.setAttributeNS(null,"stroke-opacity",a)},t.visPropOld.strokecolor),t.elementClass!==i.A.OBJECT_CLASS_CURVE&&t.elementClass!==i.A.OBJECT_CLASS_LINE||(t.evalVisProp("firstarrow")&&this._setArrowColor(t.rendNodeTriangleStart,o,a,t,t.visPropCalc.typeFirst),t.evalVisProp("lastarrow")&&this._setArrowColor(t.rendNodeTriangleEnd,o,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"),s.A.exists(r)&&this.setPropertyPrim(i,"stroke-width",r+"px"),t.visPropOld.strokewidth=r)},setObjectTransition:function(t,e){var i,r,o,n=[],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(s.A.exists(i)&&(a=i.length),o=0;o0?i:0,e=t.evalVisProp("fillcolor"),r.setAttributeNS(null,"style","stop-color:"+e+";stop-opacity:"+i),o.setAttributeNS(null,"style","stop-color:"+t.evalVisProp("gradientsecondcolor")+";stop-opacity:"+t.evalVisProp("gradientsecondopacity")),r.setAttributeNS(null,"offset",100*t.evalVisProp("gradientstartoffset")+"%"),o.setAttributeNS(null,"offset",100*t.evalVisProp("gradientendoffset")+"%"),"linear"===n?this.updateGradientAngle(t.gradNode,t.evalVisProp("gradientangle")):"radial"===n&&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,s=Math.cos(e),r=Math.sin(e);Math.abs(s)>Math.abs(r)?i/=Math.abs(s):i/=Math.abs(r),s>=0?(t.setAttributeNS(null,"x1",0),t.setAttributeNS(null,"x2",s*i)):(t.setAttributeNS(null,"x1",-s*i),t.setAttributeNS(null,"x2",0)),r>=0?(t.setAttributeNS(null,"y1",0),t.setAttributeNS(null,"y2",r*i)):(t.setAttributeNS(null,"y1",-r*i),t.setAttributeNS(null,"y2",0))},updateGradientCircle:function(t,e,i,s,r,o,n){t.setAttributeNS(null,"cx",100*e+"%"),t.setAttributeNS(null,"cy",100*i+"%"),t.setAttributeNS(null,"r",100*s+"%"),t.setAttributeNS(null,"fx",100*r+"%"),t.setAttributeNS(null,"fy",100*o+"%"),t.setAttributeNS(null,"fr",100*n+"%")},suspendRedraw:function(){this.suspendHandle=this.svgRoot.suspendRedraw(1e4)},unsuspendRedraw:function(){this.svgRoot.unsuspendRedraw(this.suspendHandle)},resize:function(t,e){this.svgRoot.setAttribute("width",parseFloat(t)),this.svgRoot.setAttribute("height",parseFloat(e)),s.A.exists(this.updateClipPathRect)&&this.updateClipPathRect(t,e)},createTouchpoints:function(t){var e,i,s,r;for(this.touchpoints=[],e=0;e=0&&2*t=0&&2*t=0&&2*t0)for(s=document.createElement("canvas"),n=0;n1&&(e=e.replace(/xmlns="http:\/\/www.w3.org\/2000\/svg"\s+xmlns="http:\/\/www.w3.org\/2000\/svg"/g,"")),e=e.replace(/ /g," "),s.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,"+n(unescape(encodeURIComponent(e)))},dumpToCanvas:function(t,e,i,s){var r,o,n,a;return(n=this.container.ownerDocument.getElementById(t)).width=n.width,a=n.getContext("2d"),void 0!==e&&void 0!==i&&(n.style.width=parseFloat(e)+"px",n.style.height=parseFloat(i)+"px",n.setAttribute("width",parseFloat(e)),n.setAttribute("height",parseFloat(i))),o=new Image,r=this.dumpToDataURI(s),o.src=r,"Promise"in window?new Promise(function(t,s){try{o.onload=function(){a.drawImage(o,0,0,e,i),t()}}catch(t){s(t)}}):(o.onload=function(){window.setTimeout(function(){try{a.drawImage(o,0,0,e,i)}catch(t){console.log("screenshots not longer supported on IE")}},200)},this)},screenshot:function(t,e,i){var r,o,n,a,h,l,c,d,u,p,f,A,_=this.container.ownerDocument,m=this.container.parentNode,g=t.attr.screenshot,b=!1;return"no"===this.type||(c=g.scale*this.container.getBoundingClientRect().width,d=g.scale*this.container.getBoundingClientRect().height,void 0===e||""===e?(b=!0,(a=new Image).style.width=c+"px",a.style.height=d+"px"):(b=!1,a=_.getElementById(e)),b&&((r=_.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"),o=_.createElement("canvas"),n=Math.random().toString(36).slice(2,7),o.setAttribute("id",n),o.setAttribute("width",c),o.setAttribute("height",d),o.style.width=c+"px",o.style.height=c+"px",o.style.display="none",m.appendChild(o),b&&(h=_.createElement("span"),l=_.createTextNode("✖"),h.style.cssText=g.cssButton,h.appendChild(l),h.onclick=function(){r.parentNode.removeChild(r)},r.appendChild(a),r.appendChild(h),m.insertBefore(r,this.container.nextSibling)),u=_.getElementById(this.uniqName("navigationbar")),s.A.exists(u)&&(p=u.style.display,u.style.display="none",f=this.removeToInsertLater(u)),A=function(){a.src=o.toDataURL("image/png"),m.removeChild(o)},"Promise"in window?this.dumpToCanvas(n,c,d,i).then(A):(this.dumpToCanvas(n,c,d,i),window.setTimeout(A,200)),s.A.exists(u)&&(u.style.display=p,f())),this}});var k=t.A.SVGRenderer;t.A.VMLRenderer=function(e){this.type="vml",this.container=e,this.container.style.overflow="hidden",""===this.container.style.position&&(this.container.style.position="relative"),this.container.onselectstart=function(){return!1},this.resolution=10,s.A.exists(t.A.vmlStylesheet)||(e.ownerDocument.namespaces.add("jxgvml","urn:schemas-microsoft-com:vml"),t.A.vmlStylesheet=this.container.ownerDocument.createStyleSheet(),t.A.vmlStylesheet.addRule(".jxgvml","behavior:url(#default#VML)"));try{e.ownerDocument.namespaces.jxgvml||e.ownerDocument.namespaces.add("jxgvml","urn:schemas-microsoft-com:vml"),this.createNode=function(t){return e.ownerDocument.createElement("')}}catch(t){this.createNode=function(t){return e.ownerDocument.createElement("<"+t+' xmlns="urn:schemas-microsoft.com:vml" class="jxgvml">')}}this.dashArray=["Solid","1 1","ShortDash","Dash","LongDash","ShortDashDot","LongDashDot"]},t.A.VMLRenderer.prototype=new y,t.A.extend(t.A.VMLRenderer.prototype,{_setAttr:function(e,i,s,r){try{8===this.container.ownerDocument.documentMode?e[i]=s:e.setAttribute(i,s,r)}catch(e){t.A.debug("_setAttr: "+i+" "+s+"
\n")}},updateTicks:function(t){var e,i,r,o,n,a=this.resolution,h=[];for(i=t.ticks.length,e=0;e0){for(i=this.joinTransforms(t,e),c[0]=o.A.matVecMult(i,t.coords.scrCoords),c[0][1]/=c[0][0],c[0][2]/=c[0][0],c[1]=o.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]=o.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]=o.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],s=c[0][1],n=c[0][1],r=c[0][2],a=c[0][2],h=1;h<4;h++)s=Math.max(s,c[h][1]),n=Math.min(n,c[h][1]),r=Math.max(r,c[h][2]),a=Math.min(a,c[h][2]);l.style.left=Math.floor(n)+"px",l.style.top=Math.floor(a)+"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 s.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,s,r=this.createNode("fill"),o=this.createNode("stroke"),n=this.createNode("shadow");return this._setAttr(r,"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(r),i.appendChild(o),i.appendChild(n)):"polygon"===t||"path"===t||"shape"===t||"line"===t?((i=this.createNode("shape")).appendChild(r),i.appendChild(o),i.appendChild(n),s=this.createNode("path"),this._setAttr(s,"id",this.container.id+"_"+e+"_path"),i.appendChild(s)):((i=this.createNode(t)).appendChild(r),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){s.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,s.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,s.A.exists(e)&&this._setAttr(e,"endarrow","none")),t.visPropOld.firstarrow=i,t.visPropOld.lastarrow=r)},updateEllipsePrim:function(t,e,i,s,r){t.style.left=Math.floor(e-s)+"px",t.style.top=Math.floor(i-r)+"px",t.style.width=Math.floor(2*Math.abs(s))+"px",t.style.height=Math.floor(2*Math.abs(r))+"px"},updateLinePrim:function(t,e,i,s,r,o){var n,a=this.resolution;isNaN(e+i+s+r)||(n=["m ",Math.floor(a*e),", ",Math.floor(a*i)," l ",Math.floor(a*s),", ",Math.floor(a*r)],this.updatePathPrim(t,n,o))},updatePathPrim:function(t,e,i){var s=i.canvasWidth,r=i.canvasHeight;e.length<=0&&(e=["m 0,0"]),t.style.width=s,t.style.height=r,this._setAttr(t,"coordsize",[Math.floor(this.resolution*s),Math.floor(this.resolution*r)].join(",")),this._setAttr(t,"path",e.join(""))},updatePathStringPoint:function(t,e,i){var s=[],r=Math.round,o=t.coords.scrCoords,n=e*Math.sqrt(3)*.5,a=.5*e,h=this.resolution;return"x"===i?s.push([" m ",r(h*(o[1]-e)),", ",r(h*(o[2]-e))," l ",r(h*(o[1]+e)),", ",r(h*(o[2]+e))," m ",r(h*(o[1]+e)),", ",r(h*(o[2]-e))," l ",r(h*(o[1]-e)),", ",r(h*(o[2]+e))].join("")):"+"===i?s.push([" m ",r(h*(o[1]-e)),", ",r(h*o[2])," l ",r(h*(o[1]+e)),", ",r(h*o[2])," m ",r(h*o[1]),", ",r(h*(o[2]-e))," l ",r(h*o[1]),", ",r(h*(o[2]+e))].join("")):"<>"===i||"<<>>"===i?("<<>>"===i&&(e*=1.41),s.push([" m ",r(h*(o[1]-e)),", ",r(h*o[2])," l ",r(h*o[1]),", ",r(h*(o[2]+e))," l ",r(h*(o[1]+e)),", ",r(h*o[2])," l ",r(h*o[1]),", ",r(h*(o[2]-e))," x e "].join(""))):"^"===i?s.push([" m ",r(h*o[1]),", ",r(h*(o[2]-e))," l ",r(h*(o[1]-n)),", ",r(h*(o[2]+a))," l ",r(h*(o[1]+n)),", ",r(h*(o[2]+a))," x e "].join("")):"v"===i?s.push([" m ",r(h*o[1]),", ",r(h*(o[2]+e))," l ",r(h*(o[1]-n)),", ",r(h*(o[2]-a))," l ",r(h*(o[1]+n)),", ",r(h*(o[2]-a))," x e "].join("")):">"===i?s.push([" m ",r(h*(o[1]+e)),", ",r(h*o[2])," l ",r(h*(o[1]-a)),", ",r(h*(o[2]-n))," l ",r(h*(o[1]-a)),", ",r(h*(o[2]+n))," l ",r(h*(o[1]+e)),", ",r(h*o[2])].join("")):"<"===i&&s.push([" m ",r(h*(o[1]-e)),", ",r(h*o[2])," l ",r(h*(o[1]+a)),", ",r(h*(o[2]-n))," l ",r(h*(o[1]+a)),", ",r(h*(o[2]+n))," x e "].join("")),s},updatePathStringPrim:function(t){var e,i,s=[],r=this.resolution,o=Math.round,n=" m ",a=n,h=Math.min(t.numberPoints,8192);if(t.numberPoints<=0)return"";if(h=Math.min(h,t.points.length),1===t.bezierDegree)for(e=0;e2e4?i[1]=2e4:i[1]<-2e4&&(i[1]=-2e4),i[2]>2e4?i[2]=2e4:i[2]<-2e4&&(i[2]=-2e4),s.push([a,o(r*i[1]),", ",o(r*i[2])].join("")),a=" l ");else if(3===t.bezierDegree)for(e=0;e2e4?r[1]=2e4:r[1]<-2e4&&(r[1]=-2e4),r[2]>2e4?r[2]=2e4:r[2]<-2e4&&(r[2]=-2e4),p===u?a.push([p,c(l*r[1])," ",c(l*r[2])].join("")):(s=2*i,a.push([p,c(l*(o+.333*(r[1]-o)+h*(s*Math.random()-i)))," ",c(l*(n+.333*(r[2]-n)+h*(s*Math.random()-i)))," ",c(l*(o+.666*(r[1]-o)+h*(s*Math.random()-i)))," ",c(l*(n+.666*(r[2]-n)+h*(s*Math.random()-i)))," ",c(l*r[1])," ",c(l*r[2])].join(""))),p=" c ",o=r[1],n=r[2]);return a.push(" e"),a},updatePolygonPrim:function(t,e){var i,s,r=e.vertices.length,o=this.resolution,n=[];if(this._setAttr(t,"stroked","false"),s=e.vertices[0].coords.scrCoords,!isNaN(s[1]+s[2])){for(n.push(["m ",Math.floor(o*s[1]),",",Math.floor(o*s[2])," l "].join("")),i=1;i=0&&(t.style.width=s+"px"),r>=0&&(t.style.height=r+"px")},setPropertyPrim:function(t,e,i){var s,r="";switch(e){case"stroke":r="strokecolor";break;case"stroke-width":r="strokeweight";break;case"stroke-dasharray":r="dashstyle"}""!==r&&(s=i,this._setAttr(t,r,s))},display:function(t,e){t&&t.rendNode&&(t.visPropOld.visible=e,t.rendNode.style.visibility=e?"inherit":"hidden")},show:function(e){t.A.deprecated("Board.renderer.show()","Board.renderer.display()"),e&&e.rendNode&&(e.rendNode.style.visibility="inherit")},hide:function(e){t.A.deprecated("Board.renderer.hide()","Board.renderer.display()"),e&&e.rendNode&&(e.rendNode.style.visibility="hidden")},setDashStyle:function(t,e){var i;e.dash>=0&&(i=t.rendNodeStroke,this._setAttr(i,"dashstyle",this.dashArray[e.dash]))},setGradient:function(t){var e=t.rendNodeFill,i=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,r){var o,n,a,h=e,l=r,c=t.rendNode;l=l>0?l:0,t.visPropOld.fillcolor===h&&t.visPropOld.fillopacity===l||(s.A.exists(h)&&!1!==h&&(9!==h.length?(o=h,a=l):(o=(n=T.A.rgba2rgbo(h))[0],a=l*n[1]),"none"===o||!1===o?this._setAttr(t.rendNode,"filled","false"):(this._setAttr(t.rendNode,"filled","true"),this._setAttr(t.rendNode,"fillcolor",o),s.A.exists(a)&&t.rendNodeFill&&this._setAttr(t.rendNodeFill,"opacity",100*a+"%")),t.type===i.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,r){var o,n,a,h,l=e,c=r,d=t.rendNode;c=c>0?c:0,t.visPropOld.strokecolor===l&&t.visPropOld.strokeopacity===c||(s.A.exists(l)&&!1!==l&&(9!==l.length?(o=l,a=c):(o=(n=e.rgba2rgbo(l))[0],a=c*n[1]),t.elementClass===i.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=o):(!1!==o&&(this._setAttr(d,"stroked","true"),this._setAttr(d,"strokecolor",o)),h=t.rendNodeStroke,s.A.exists(a)&&t.type!==i.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=s.A.evaluate(e);isNaN(r)||t.visPropOld.strokewidth===r||(i=t.rendNode,this.setPropertyPrim(i,"stroked","true"),s.A.exists(r)&&(this.setPropertyPrim(i,"stroke-width",r),0===r&&s.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=""}});var L=t.A.VMLRenderer,R="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split("");t.A.Util=t.A.Util||{},t.A.Util.genUUID=function(t){var e,i,s=[],r=0;for(""!==(t=t||"")&&"-"!==t.slice(t.length-1)&&(t+="-"),i=0;i<36;i++)8===i||13===i||18===i||23===i?s[i]="-":14===i?s[i]="4":(r<=2&&(r=33554432+16777216*Math.random()|0),e=15&r,r>>=4,s[i]=R[19===i?3&e|8:e]);return t+s.join("")};var B=t.A.Util;t.A.CanvasRenderer=function(i,s){if(this.type="canvas",this.canvasRoot=null,this.suspendHandle=null,this.canvasId=B.genUUID(),this.canvasNamespace=null,e.A.isBrowser)this.container=i,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=[''].join(""),this.canvasRoot=this.container.ownerDocument.getElementById(this.canvasId),this.canvasRoot.style.display="block",this.context=this.canvasRoot.getContext("2d");else if(e.A.isNode())try{this.canvasRoot=t.A.createCanvas(500,500),this.context=this.canvasRoot.getContext("2d")}catch(t){throw new Error('JXG.createCanvas not available.\nInstall the npm package `canvas`\nand call:\n import { createCanvas } from "canvas.js"\n JXG.createCanvas = createCanvas;\n')}},t.A.CanvasRenderer.prototype=new y,t.A.extend(t.A.CanvasRenderer.prototype,{_drawPolygon:function(t,e,i){var s,r=t.length,o=this.context;if(r>0){if(i&&(o.lineWidth=0),o.beginPath(),o.moveTo(t[0][0],t[0][1]),1===e)for(s=1;sMath.abs(g)?_/=Math.abs(m):_/=Math.abs(g),m>=0?(o=0,n=m*_):(o=-m*_,n=0),g>=0?(a=0,h=g*_):(a=-g*_,h=0),s=new u.A(i.A.COORDS_BY_USER,[b[0],b[1]],t.board),f=(r=new u.A(i.A.COORDS_BY_USER,[b[2],b[3]],t.board)).scrCoords[1]-s.scrCoords[1],A=r.scrCoords[2]-s.scrCoords[2],l=s.scrCoords[1]+f*o,d=s.scrCoords[2]+A*a,c=s.scrCoords[1]+f*n,p=s.scrCoords[2]+A*h,this.context.createLinearGradient(l,d,c,p)},updateGradientCircle:function(t,e,s,r,o,n,a){var h,l,c,d,p,f,A,_,m,g,b,v=t.getBoundingBox();return h=new u.A(i.A.COORDS_BY_USER,[v[0],v[1]],t.board),m=(l=new u.A(i.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]+m*e,d=l.scrCoords[2]+g*s,f=h.scrCoords[1]+m*o,A=l.scrCoords[2]+g*n,b=Math.abs(m)+Math.abs(g),p=Math.max(r*b*.5,0),_=Math.max(a*b*.5,0),this.context.createRadialGradient(f,A,_,c,d,p)},updateGradient:function(t){var e,i,s=t.evalVisProp("gradient");return e=t.evalVisProp("fillcolor"),"linear"===s?i=this.updateGradientAngle(t,t.evalVisProp("gradientangle")):"radial"===s&&(i=this.updateGradientCircle(t,t.evalVisProp("gradientcx"),t.evalVisProp("gradientcy"),t.evalVisProp("gradientr"),t.evalVisProp("gradientfx"),t.evalVisProp("gradientfy"),t.evalVisProp("gradientfr"))),"none"!==e&&""!==e&&!1!==e&&(i.addColorStop(t.evalVisProp("gradientstartoffset"),e),i.addColorStop(t.evalVisProp("gradientendoffset"),t.evalVisProp("gradientsecondcolor"))),i},_setColor:function(t,e,i){var s,r,o,n,a,h,l,c,d,u=!0;return e=e||"stroke",i=i||e,r=this._getHighlighted(t),"none"!==(n=t.evalVisProp(r+e+"color"))&&""!==n&&!1!==n?(l=(l=t.evalVisProp(r+e+"opacity"))>0?l:0,9!==n.length?(h=n,c=l):(h=(a=T.A.rgba2rgbo(n))[0],c=l*a[1]),this.context.globalAlpha=c,this.context[i+"Style"]=h):u=!1,"stroke"===e||"linear"!==(d=t.evalVisProp("gradient"))&&"radial"!==d?(o=parseFloat(t.evalVisProp(r+"strokewidth")),"stroke"!==e||isNaN(o)||(0===o?this.context.globalAlpha=0:this.context.lineWidth=o),s=t.evalVisProp("linecap"),"stroke"===e&&void 0!==s&&""!==s&&(this.context.lineCap=s),u):(this.context.globalAlpha=c,this.context[i+"Style"]=this.updateGradient(t),u)},_stroke:function(t){var e=this.context,i=t.evalVisProp("dash"),s=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*s})):this.context.lineDashArray=[],this._setColor(t,"stroke")&&e.stroke(),e.restore()},_translateShape:function(t,e,i){var s,r=[],o=t.length;if(o<=0)return t;for(s=0;s>":i*=1.41;case"diamond":case"<>":a.beginPath(),a.moveTo(s[1]-i,s[2]),a.lineTo(s[1],s[2]+i),a.lineTo(s[1]+i,s[2]),a.lineTo(s[1],s[2]-i),a.closePath(),this._fill(t),this._stroke(t);break;case"triangleup":case"A":case"a":case"^":a.beginPath(),a.moveTo(s[1],s[2]-i),a.lineTo(s[1]-r,s[2]+o),a.lineTo(s[1]+r,s[2]+o),a.closePath(),this._fill(t),this._stroke(t);break;case"triangledown":case"v":a.beginPath(),a.moveTo(s[1],s[2]+i),a.lineTo(s[1]-r,s[2]-o),a.lineTo(s[1]+r,s[2]-o),a.closePath(),this._fill(t),this._stroke(t);break;case"triangleleft":case"<":a.beginPath(),a.moveTo(s[1]-i,s[2]),a.lineTo(s[1]+o,s[2]-r),a.lineTo(s[1]+o,s[2]+r),a.closePath(),this._fill(t),this._stroke(t);break;case"triangleright":case">":a.beginPath(),a.moveTo(s[1]+i,s[2]),a.lineTo(s[1]-o,s[2]-r),a.lineTo(s[1]-o,s[2]+r),a.closePath(),this._fill(t),this._stroke(t)}},updatePoint:function(t){this.drawPoint(t)},drawArrows:function(t,e,s,r,o){var n,a,h,l,c,d,u,p,f,A,_,m,g,b,v,y,C,P,E,x,O=this.context,M=1,w=1,S=1,T=o.evFirst,N=o.evLast;if("none"!==t.evalVisProp("strokecolor")&&(T||N)){if(t.elementClass===i.A.OBJECT_CLASS_LINE)n=e.scrCoords[1],a=e.scrCoords[2],h=s.scrCoords[1],l=s.scrCoords[2],E=x=Math.atan2(l-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],b=t.points[1].scrCoords[1]-t.points[0].scrCoords[1],v=t.points[1].scrCoords[2]-t.points[0].scrCoords[2],y=t.points[P].scrCoords[1]-t.points[P-1].scrCoords[1],C=t.points[P].scrCoords[2]-t.points[P-1].scrCoords[2],T&&(E=Math.atan2(v,b)),N&&(x=Math.atan2(C,y))}if(d=t.evalVisProp(r+"strokewidth"),T)if(c=d*o.sizeFirst,f=M=o.typeFirst,2===M)p=[[c,.5*-c],[0,0],[c,.5*c],[.5*c,0]];else if(3===M)p=[[c/3,.5*-c],[0,.5*-c],[0,.5*c],[c/3,.5*c]];else if(4===M)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,m=0;m1&&(e=this._getHighlighted(t),i=t.evalVisProp(e+"strokewidth"),((s=this.getArrowHeadData(t,i,e)).evFirst||s.evLast)&&this.drawArrows(t,null,null,e,s))},updateCurve:function(t){this.drawCurve(t)},drawEllipse:function(t){var e=t.center.coords.scrCoords[1],i=t.center.coords.scrCoords[2],s=t.board.unitX,r=t.board.unitY,o=2*t.Radius(),n=2*t.Radius(),a=o*s,h=n*r,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,_=c+h/2,m=this.context;o>0&&n>0&&!isNaN(e+i)&&(m.beginPath(),m.moveTo(l,_),m.bezierCurveTo(l,_-u,A-d,c,A,c),m.bezierCurveTo(A+d,c,p,_-u,p,_),m.bezierCurveTo(p,_+u,A+d,f,A,f),m.bezierCurveTo(A-d,f,l,_+u,l,_),m.closePath(),this._fill(t),this._stroke(t))},updateEllipse:function(t){return this.drawEllipse(t)},displayCopyright:function(t,e){var i=this.context,s=4+1.8*e,r=6+e;i.save(),i.font=e+"px Arial",i.globalAlpha=.2,i.lineWidth=.5,i.fillText(t+".",s,r),i.restore()},displayLogo:function(t,e,i){var r=this.context,o=1.5*e;s.A.isBrowser&&(s.A.exists(i._logo_image)||(i._logo_image=new Image,i._logo_image.src=t),i._logo_image.onload=function(){r.save(),r.globalAlpha=.2,r.drawImage(i._logo_image,5,5,o,o),r.restore()},r.save(),r.globalAlpha=.2,r.drawImage(i._logo_image,5,5,o,o),r.restore())},drawInternalText:function(t){var e=t.evalVisProp("fontsize"),i=t.evalVisProp("fontunit"),s=t.getAnchorX(),r=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"===s?o.textAlign="left":"right"===s?o.textAlign="right":"middle"===s&&(o.textAlign="center"),"bottom"===r?o.textBaseline="bottom":"top"===r?o.textBaseline="top":"middle"===r&&(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,r){var o,n,a,h,l=e,c=r;c=c>0?c:0,t.visPropOld.strokecolor===l&&t.visPropOld.strokeopacity===c||(s.A.exists(l)&&!1!==l&&(9!==l.length?(o=l,a=c):(o=(n=T.A.rgba2rgbo(l))[0],a=c*n[1]),h=t.rendNode,t.elementClass===i.A.OBJECT_CLASS_TEXT&&"html"===t.evalVisProp("display")&&(h.style.color=o,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=s.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 s,r,n,a,h,l=e.length,c=this.context;if(l>0)if(s=this.joinTransforms(t,e),t.elementClass===i.A.OBJECT_CLASS_TEXT&&"html"===t.visProp.display){if(-1===(r=" matrix("+[s[1][1],s[2][1],s[1][2],s[2][2],s[1][0],s[2][0]].join(",")+") ").indexOf("NaN")){switch((h=t.rendNode).style.transform=r,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]}h.style["transform-origin"]=n+"px "+a+"px"}}else Math.abs(d.A.det(s))>=o.A.eps&&c.transform(s[1][1],s[2][1],s[1][2],s[2][2],s[1][0],s[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){s.A.exists(t)&&s.A.exists(t.parentNode)&&t.parentNode.removeChild(t)},updatePathStringPrim:function(t){var e,i,s,r,o,n="M",a=n,h=this.context;if(!(t.numberPoints<=0)){if(o=Math.min(t.points.length,t.numberPoints),h.beginPath(),1===t.bezierDegree)for(e=0;ef.maxboundingbox[1]&&(p[1]=f.maxboundingbox[1]),p[2]>f.maxboundingbox[2]&&(p[2]=f.maxboundingbox[2]),p[3]-1)r.construct(e);else try{r.jc.parse(e)}catch(e){t.A.debug(e)}return r},P=function(e,i,s,r){return function(){var o;t.A.JSXGraph.freeBoard(e),(o=C(i,s,r)).reload=P(o,i,s,r)}};for(i=0;i/g,""),y[i].innerHTML=m,v||((a=C(m,e,f)).reload=P(a,m,e,f))):t.A.debug("JSXGraph: Apparently the div injection failed. Can't create a board, sorry.")}},window);t.A.JSXGraph;var Y=__webpack_require__(144),V=__webpack_require__(102);t.A.Point=function(t,e,s){this.constructor(t,s,i.A.OBJECT_TYPE_POINT,i.A.OBJECT_CLASS_POINT),this.element=this.board.select(s.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()},t.A.Point.prototype=new Y.A,s.A.copyPrototypeMethods(t.A.Point,V.A,"coordsConstructor"),t.A.extend(t.A.Point.prototype,{hasPoint:function(t,e){var i,r,o,n=this.coords.scrCoords,a=this.evalVisProp("sizeunit");return s.A.isObject(this.evalVisProp("precision"))?(o=this.board._inputDevice,r=this.evalVisProp("precision."+o)):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")))=0&&n[1]<=1)&&h.A.distPointLine(this.coords.usrCoords,e.stdform)1&&(h=s[0].type===i.A.OBJECT_TYPE_CONIC||s[0].elementClass===i.A.OBJECT_CLASS_CIRCLE,l=s[1].type===i.A.OBJECT_TYPE_CONIC||s[1].elementClass===i.A.OBJECT_CLASS_CIRCLE,c=s[0].elementClass===i.A.OBJECT_CLASS_LINE,d=s[1].elementClass===i.A.OBJECT_CLASS_LINE),2!==s.length||!(h&&d||c&&l))throw new Error("JSXGraph: Can't create 'pole point' with parent types '"+typeof s[0]+"' and '"+typeof s[1]+"'.\nPossible parent type: [conic|circle,line], [line,conic|circle]");return d?(n=e.select(s[0]),a=e.select(s[1])):(n=e.select(s[1]),a=e.select(s[0])),(o=e.create("point",[function(){var e=n.quadraticform,i=a.stdform.slice(0,3);return[t.A.Math.Numerics.det([i,e[1],e[2]]),t.A.Math.Numerics.det([e[0],i,e[2]]),t.A.Math.Numerics.det([e[0],e[1],i])]}],r)).elType="polepoint",o.setParents([n.id,a.id]),n.addChild(o),a.addChild(o),o},t.A.registerElement("point",t.A.createPoint),t.A.registerElement("glider",t.A.createGlider),t.A.registerElement("intersection",t.A.createIntersectionPoint),t.A.registerElement("otherintersection",t.A.createOtherIntersectionPoint),t.A.registerElement("polepoint",t.A.createPolePoint);var X=t.A.Point;t.A.Line=function(t,e,s,r){this.constructor(t,r,i.A.OBJECT_TYPE_LINE,i.A.OBJECT_CLASS_LINE),this.point1=this.board.select(e),this.point2=this.board.select(s),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()},t.A.Line.prototype=new Y.A,s.A.copyMethodMap(t.A.Line,{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",setFixedLength:"setFixedLength",setStraight:"setStraight"}),t.A.extend(t.A.Line.prototype,{hasPoint:function(t,e){var r,n,a,l,c,d,p,f,A,_=[],m=[1,t,e],g=this.evalVisProp("strokewidth");return s.A.isObject(this.evalVisProp("precision"))?(A=this.board._inputDevice,f=this.evalVisProp("precision."+A)):f=this.board.options.precision.hasPoint,f+=.5*g,_[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,_[1]=this.stdform[1]/this.board.unitX,_[2]=this.stdform[2]/-this.board.unitY,r=h.A.distPointLine(m,_),!(isNaN(r)||r>f)&&(!(!this.evalVisProp("straightfirst")||!this.evalVisProp("straightlast"))||(a=this.point1.coords,l=this.point2.coords,n=[0,_[1],_[2]],n=o.A.crossProduct(n,m),(n=o.A.crossProduct(n,_))[1]/=n[0],n[2]/=n[0],n[0]=1,n=new u.A(i.A.COORDS_BY_SCREEN,n.slice(1),this.board).usrCoords,c=a.distance(i.A.COORDS_BY_USER,l),a=a.usrCoords.slice(0),l=l.usrCoords.slice(0),c1)))},update:function(){var t;return this.needsUpdate?(this.constrained&&(s.A.isFunction(this.funps)?(t=this.funps())&&t.length&&2===t.length&&(this.point1=t[0],this.point2=t[1]):(s.A.isFunction(this.funp1)&&(t=this.funp1(),s.A.isPoint(t)?this.point1=t:t&&t.length&&2===t.length&&this.point1.setPositionDirectly(i.A.COORDS_BY_USER,t)),s.A.isFunction(this.funp2)&&(t=this.funp2(),s.A.isPoint(t)?this.point2=t:t&&t.length&&2===t.length&&this.point2.setPositionDirectly(i.A.COORDS_BY_USER,t)))),this.updateSegmentFixedLength(),this.updateStdform(),this.evalVisProp("trace")&&this.cloneToBackground(!0),this):this},updateSegmentFixedLength:function(){var t,e,s,r,n,a,h,l;return this.hasFixedLength?(t=this.point1.Dist(this.point2),e=this.evalVisProp("nonnegativeonly")?Math.max(0,this.fixedLength()):Math.abs(this.fixedLength()),s=this.fixedLengthOldCoords[0].distance(i.A.COORDS_BY_USER,this.point1.coords),r=this.fixedLengthOldCoords[1].distance(i.A.COORDS_BY_USER,this.point2.coords),(s>o.A.eps||r>o.A.eps||t!==e)&&(n=this.point1.isDraggable&&this.point1.type!==i.A.OBJECT_TYPE_GLIDER&&!this.point1.evalVisProp("fixed"),a=this.point2.isDraggable&&this.point2.type!==i.A.OBJECT_TYPE_GLIDER&&!this.point2.evalVisProp("fixed"),t>o.A.eps?s>r&&a||s<=r&&a&&!n?(this.point2.setPositionDirectly(i.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()):(s<=r&&n||s>r&&n&&!a)&&(this.point1.setPositionDirectly(i.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=o.A.hypot(h,l),a?(this.point2.setPositionDirectly(i.A.COORDS_BY_USER,[this.point1.X()+h*e/t,this.point1.Y()+l*e/t]),this.point2.fullUpdate()):n&&(this.point1.setPositionDirectly(i.A.COORDS_BY_USER,[this.point2.X()+h*e/t,this.point2.Y()+l*e/t]),this.point1.fullUpdate())),this.fixedLengthOldCoords[0].setCoordinates(i.A.COORDS_BY_USER,this.point1.coords.usrCoords),this.fixedLengthOldCoords[1].setCoordinates(i.A.COORDS_BY_USER,this.point2.coords.usrCoords)),this):this},updateStdform:function(){var t=o.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])&&o.A.innerProduct(this.stdform,this.stdform,3)>=o.A.eps*o.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(),this.board.renderer.updateText(this.label)),this.setDisplayRendNode(),this.needsUpdate=!1,this):this},generatePolynomial:function(t){var e=this.point1.symbolic.x,i=this.point1.symbolic.y,s=this.point2.symbolic.x,r=this.point2.symbolic.y,o=t.symbolic.x,n=t.symbolic.y;return[["(",i,")*(",o,")-(",i,")*(",s,")+(",n,")*(",s,")-(",e,")*(",n,")+(",e,")*(",r,")-(",o,")*(",r,")"].join("")]},getRise:function(){return Math.abs(this.stdform[2])>=o.A.eps?-this.stdform[0]/this.stdform[2]:1/0},Slope:function(){return Math.abs(this.stdform[2])>=o.A.eps?-this.stdform[1]/this.stdform[2]:1/0},getSlope:function(){return this.Slope()},getAngle:function(t){var e,i=Math.atan2(-this.stdform[1],this.stdform[2]);return s.A.isString(t)&&""!==t?(""===(t=t.toLocaleLowerCase())||0===t.indexOf("rad")?e=i:0===t.indexOf("deg")?e=180*i/Math.PI:0===t.indexOf("sem")?e=i/Math.PI:0===t.indexOf("cir")&&(e=.5*i/Math.PI),e):i},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 u.A(i.A.COORDS_BY_USER,[.5*(this.point2.X()+this.point1.X()),.5*(this.point2.Y()+this.point1.Y())],this.board)},setLabelRelativeCoords:function(t){s.A.exists(this.label)&&(this.label.relativeCoords=new u.A(i.A.COORDS_BY_SCREEN,[t[0],-t[1]],this.board))},getLabelAnchor:function(){var t,e,r,n,a,l,c,d,p=1.5,f=0,A=new u.A(i.A.COORDS_BY_USER,this.point1.coords.usrCoords,this.board),_=new u.A(i.A.COORDS_BY_USER,this.point2.coords.usrCoords,this.board),m=this.evalVisProp("straightfirst"),g=this.evalVisProp("straightlast");if((m||g)&&h.A.calcStraight(this,A,_,0),A=A.scrCoords,_=_.scrCoords,!s.A.exists(this.label))return new u.A(i.A.COORDS_BY_SCREEN,[NaN,NaN],this.board);if(r=this.label.evalVisProp("position"),!s.A.isString(r))return new u.A(i.A.COORDS_BY_SCREEN,[NaN,NaN],this.board);if(r.indexOf("right")<0&&r.indexOf("left")<0)switch(r){case"last":t=_[1],e=_[2];break;case"first":t=A[1],e=A[2];break;case"lft":case"llft":case"ulft":A[1]<_[1]+o.A.eps?(t=A[1],e=A[2]):(t=_[1],e=_[2]);break;case"rt":case"lrt":case"urt":A[1]>_[1]+o.A.eps?(t=A[1],e=A[2]):(t=_[1],e=_[2]);break;default:t=.5*(A[1]+_[1]),e=.5*(A[2]+_[2])}else n=s.A.parsePosition(r),a=s.A.parseNumber(n.pos,1,1),l=_[1]-A[1],c=_[2]-A[2],d=o.A.hypot(l,c),n.pos.indexOf("px")>=0||n.pos.indexOf("fr")>=0||n.pos.indexOf("%")>=0?(n.pos.indexOf("px")>=0&&(a/=d),t=A[1]+a*l,e=A[2]+a*c):(t=A[1]+a*this.board.unitX*l/d,e=A[2]+a*this.board.unitY*c/d),"left"===n.side?l*=-1:c*=-1,s.A.exists(this.label)&&(p=.5*this.label.evalVisProp("distance")/d),t+=c*this.label.size[0]*p,e+=l*this.label.size[1]*p;return(m||g)&&(s.A.exists(this.label)&&(f=this.label.evalVisProp("fontsize")),Math.abs(t)t&&t>this.board.canvasWidth-f-o.A.eps&&(t=this.board.canvasWidth-f),o.A.eps+f>e&&e>-o.A.eps?e=f:this.board.canvasHeight+o.A.eps>e&&e>this.board.canvasHeight-f-o.A.eps&&(e=this.board.canvasHeight-f)),new u.A(i.A.COORDS_BY_SCREEN,[t,e],this.board)},cloneToBackground:function(){var t,e,i,r=s.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=s.A.isArray(t)?t:[t],r=i.length;for(e=0;e0&&d>0&&(r=h.A.projectPointToLine({coords:e},this,this.board),o=p.A.subtract([1,Math.round(a/c)*c,Math.round(l/d)*d],r.usrCoords),this.board.create("transform",o.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.point1.coords.usrCoords,i=this.point2.coords.usrCoords,s=this.stdform[2];return 0!==e[0]?0!==i[0]?e[1]+(i[1]-e[1])*t:e[1]+1e5*s*t:0!==e[0]?i[1]-(e[1]-i[1])*t:i[1]+1e5*s*t},Y:function(t){var e=this.point1.coords.usrCoords,i=this.point2.coords.usrCoords,s=this.stdform[1];return 0!==e[0]?0!==i[0]?e[2]+(i[2]-e[2])*t:e[2]-1e5*s*t:0!==e[0]?i[2]-(e[2]-i[2])*t:i[2]-1e5*s*t},Z:function(t){var e=this.point1.coords.usrCoords,i=this.point2.coords.usrCoords;return 1===t&&e[0]*i[0]===0?0:1},Ft:function(t){var e=[this.Z(t),this.X(t),this.Y(t)];return e[1]/=e[0],e[2]/=e[0],e[0]/=e[0],e},L:function(){return this.point1.Dist(this.point2)},setFixedLength:function(t){return this.hasFixedLength?(this.fixedLength=s.A.createFunction(t,this.board),this.hasFixedLength=!0,this.addParentsFromJCFunctions([this.fixedLength]),this.board.update(),this):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(),Y.A.prototype.remove.call(this)}}),t.A.createLine=function(e,i,r){var o,n,a,h,l,c,d,u=[],p=!1,f=!1;if(2===i.length){if(c=s.A.copyAttributes(r,e.options,"line","point1"),s.A.isArray(i[0])&&i[0].length>1)a=e.create("point",i[0],c);else if(s.A.isString(i[0])||s.A.isPoint(i[0]))a=e.select(i[0]);else if(s.A.isFunction(i[0])&&s.A.isPoint(i[0]()))a=i[0](),f=!0;else if(s.A.isFunction(i[0])&&i[0]().length&&i[0]().length>=2)a=t.A.createPoint(e,i[0](),c),f=!0;else{if(!s.A.isObject(i[0])||!s.A.isTransformationOrArray(i[1]))throw new Error("JSXGraph: Can't create line with parent types '"+typeof i[0]+"' and '"+typeof i[1]+"'.\nPossible parent types: [point,point], [[x1,y1],[x2,y2]], [a,b,c]");p=!0,a=e.create("point",[i[0].point1,i[1]],c)}if(c=s.A.copyAttributes(r,e.options,"line","point2"),p)h=e.create("point",[i[0].point2,i[1]],c);else if(s.A.isArray(i[1])&&i[1].length>1)h=e.create("point",i[1],c);else if(s.A.isString(i[1])||s.A.isPoint(i[1]))h=e.select(i[1]);else if(s.A.isFunction(i[1])&&s.A.isPoint(i[1]()))h=i[1](),f=!0;else{if(!(s.A.isFunction(i[1])&&i[1]().length&&i[1]().length>=2))throw new Error("JSXGraph: Can't create line with parent types '"+typeof i[0]+"' and '"+typeof i[1]+"'.\nPossible parent types: [point,point], [[x1,y1],[x2,y2]], [a,b,c]");h=t.A.createPoint(e,i[1](),c),f=!0}c=s.A.copyAttributes(r,e.options,"line"),n=new t.A.Line(e,a,h,c),f?(n.constrained=!0,n.funp1=i[0],n.funp2=i[1]):p||(n.isDraggable=!0),n.setParents([a.id,h.id])}else if(3===i.length){for(d=!0,l=0;l<3;l++)if(s.A.isNumber(i[l]))u[l]=s.A.createFunction(i[l]);else{if(!s.A.isFunction(i[l]))throw new Error("JSXGraph: Can't create line with parent types '"+typeof i[0]+"' and '"+typeof i[1]+"' and '"+typeof i[2]+"'.\nPossible parent types: [point,point], [[x1,y1],[x2,y2]], [a,b,c]");u[l]=i[l],d=!1}c=s.A.copyAttributes(r,e.options,"line","point1"),a=d?e.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):e.create("point",[function(){return.5*(u[2]()*u[2]()+u[1]()*u[1]())},function(){return.5*(u[2]()-u[1]()*u[0]()+u[2]())},function(){return.5*(-u[1]()-u[2]()*u[0]()-u[1]())}],c),c=s.A.copyAttributes(r,e.options,"line","point2"),h=d?e.create("point",[u[2]()*u[2]()+u[1]()*u[1](),-u[1]()*u[0]()+u[2](),-u[2]()*u[0]()-u[1]()],c):e.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=s.A.copyAttributes(r,e.options,"line"),(n=new t.A.Line(e,a,h,c)).isDraggable=d,n.setParents([a,h])}else if(1===i.length&&s.A.isFunction(i[0])&&2===i[0]().length&&s.A.isPoint(i[0]()[0])&&s.A.isPoint(i[0]()[1]))o=i[0](),c=s.A.copyAttributes(r,e.options,"line"),(n=new t.A.Line(e,o[0],o[1],c)).constrained=!0,n.funps=i[0],n.setParents(o);else{if(!(1===i.length&&s.A.isFunction(i[0])&&3===i[0]().length&&s.A.isNumber(i[0]()[0])&&s.A.isNumber(i[0]()[1])&&s.A.isNumber(i[0]()[2])))throw new Error("JSXGraph: Can't create line with parent types '"+typeof i[0]+"' and '"+typeof i[1]+"'.\nPossible parent types: [point,point], [[x1,y1],[x2,y2]], [a,b,c]");o=i[0],c=s.A.copyAttributes(r,e.options,"line","point1"),a=e.create("point",[function(){var t=o();return[.5*(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])]}],c),c=s.A.copyAttributes(r,e.options,"line","point2"),h=e.create("point",[function(){var t=o();return[t[2]*t[2]+t[1]*t[1],-t[1]*t[0]+t[2],-t[2]*t[0]-t[1]]}],c),c=s.A.copyAttributes(r,e.options,"line"),(n=new t.A.Line(e,a,h,c)).constrained=!0,n.funps=i[0],n.setParents([a,h])}return n},t.A.registerElement("line",t.A.createLine),t.A.createSegment=function(t,e,r){var o,n;if(r.straightFirst=!1,r.straightLast=!1,n=s.A.copyAttributes(r,t.options,"segment"),o=t.create("line",e.slice(0,2),n),3===e.length){try{o.hasFixedLength=!0,o.fixedLengthOldCoords=[],o.fixedLengthOldCoords[0]=new u.A(i.A.COORDS_BY_USER,o.point1.coords.usrCoords.slice(1,3),t),o.fixedLengthOldCoords[1]=new u.A(i.A.COORDS_BY_USER,o.point2.coords.usrCoords.slice(1,3),t),o.setFixedLength(e[2])}catch(t){throw new Error("JSXGraph: Can't create segment with third parent type '"+typeof e[2]+"'.\nPossible third parent types: number or function")}o.getParents=function(){return this.parents.concat(this.fixedLength())}}return o.elType="segment",o},t.A.registerElement("segment",t.A.createSegment),t.A.createArrow=function(t,e,r){var o,n;return r.straightFirst=!1,r.straightLast=!1,n=s.A.copyAttributes(r,t.options,"arrow"),(o=t.create("line",e,n)).type=i.A.OBJECT_TYPE_VECTOR,o.elType="arrow",o},t.A.registerElement("arrow",t.A.createArrow),t.A.createAxis=function(e,r,o){var n,a,h,l;a=s.A.copyAttributes(o,e.options,"axis");try{n=e.create("line",r,a)}catch(t){throw new Error("JSXGraph: Can't create axis with parent types '"+typeof r[0]+"' and '"+typeof r[1]+"'.\nPossible parent types: [point,point], [[x1,y1],[x2,y2]]")}for(h in n.type=i.A.OBJECT_TYPE_AXIS,n.isDraggable=!1,n.point1.isDraggable=!1,n.point2.isDraggable=!1,n._point1UsrCoordsOrg=n.point1.coords.usrCoords.slice(),n._point2UsrCoordsOrg=n.point2.coords.usrCoords.slice(),n.ancestors)n.ancestors.hasOwnProperty(h)&&(n.ancestors[h].type=i.A.OBJECT_TYPE_AXISPOINT);return l=s.A.exists(a.ticks.ticksdistance)?a.ticks.ticksdistance:s.A.isArray(a.ticks.ticks)?a.ticks.ticks:1,n.defaultTicks=e.create("ticks",[n,l],a.ticks),n.defaultTicks.dump=!1,n.elType="axis",n.subs={ticks:n.defaultTicks},n.inherits.push(n.defaultTicks),n.update=function(){var e,i,r,o,a,h,l,c,d,u,p,f,A,_,m,g,b,v,y;if(!this.needsUpdate)return this;if(e=this.board.getBoundingBox(),i=this.evalVisProp("position"),o=this.Direction(),a=this.isHorizontal(),h=this.isVertical(),l=this.evalVisProp("ticksautopos"),c=this.evalVisProp("ticksautoposthreshold"),c=a?s.A.parseNumber(c,Math.abs(e[1]-e[3]),1/this.board.unitX)*this.board.unitX:h?s.A.parseNumber(c,Math.abs(e[1]-e[3]),1/this.board.unitY)*this.board.unitY:s.A.parseNumber(c,1,1),p=(u=this.evalVisProp("anchor")).indexOf("left")>-1,f=u.indexOf("right")>-1,A=this.evalVisProp("anchordist"),A=a?s.A.parseNumber(A,Math.abs(e[1]-e[3]),1/this.board.unitX):h?s.A.parseNumber(A,Math.abs(e[0]-e[2]),1/this.board.unitY):0,g=this.board.getPointLoc(this._point1UsrCoordsOrg,A),_=this.point1.coords.usrCoords.slice(),m=this.point2.coords.usrCoords.slice(),"static"===i||!h&&!a||("fixed"===i?(a&&(o[0]>0&&f||o[0]<0&&p?(_[2]=e[3]+A,m[2]=e[3]+A):o[0]>0&&p||o[0]<0&&f?(_[2]=e[1]-A,m[2]=e[1]-A):(_=this._point1UsrCoordsOrg.slice(),m=this._point2UsrCoordsOrg.slice())),h&&(o[1]>0&&p||o[1]<0&&f?(_[1]=e[0]+A,m[1]=e[0]+A):o[1]>0&&f||o[1]<0&&p?(_[1]=e[2]-A,m[1]=e[2]-A):(_=this._point1UsrCoordsOrg.slice(),m=this._point2UsrCoordsOrg.slice()))):"sticky"===i&&(a&&(g[1]<0&&(o[0]>0&&f||o[0]<0&&p)?(_[2]=e[3]+A,m[2]=e[3]+A):g[1]>0&&(o[0]>0&&p||o[0]<0&&f)?(_[2]=e[1]-A,m[2]=e[1]-A):(_=this._point1UsrCoordsOrg.slice(),m=this._point2UsrCoordsOrg.slice())),h&&(g[0]<0&&(o[1]>0&&p||o[1]<0&&f)?(_[1]=e[0]+A,m[1]=e[0]+A):g[0]>0&&(o[1]>0&&f||o[1]<0&&p)?(_[1]=e[2]-A,m[1]=e[2]-A):(_=this._point1UsrCoordsOrg.slice(),m=this._point2UsrCoordsOrg.slice())))),this.point1.setPositionDirectly(t.A.COORDS_BY_USER,_),this.point2.setPositionDirectly(t.A.COORDS_BY_USER,m),s.A.exists(this.defaultTicks)){if(b=this.defaultTicks.visProp.label,l&&(a||h)){if(s.A.exists(b._anchorx_org)||(b._anchorx_org=s.A.def(b.anchorx,this.board.options.text.anchorX)),s.A.exists(b._anchory_org)||(b._anchory_org=s.A.def(b.anchory,this.board.options.text.anchorY)),s.A.exists(b._offset_org)||(b._offset_org=b.offset.slice()),y=b.offset,a){for(d=n.point1.coords.scrCoords[2]-.5*this.board.canvasHeight,v=b.anchory,d<0&&Math.abs(d)>c?"bottom"===b._side&&("top"===b.anchory&&(v="bottom"),y[1]*=-1,b._side="top"):d>0&&Math.abs(d)>c?"top"===b._side&&("bottom"===b.anchory&&(v="top"),y[1]*=-1,b._side="bottom"):(v=b._anchory_org,y=b._offset_org.slice(),"top"===v?b._side="bottom":"bottom"===v?b._side="top":y[1]<0?b._side="bottom":b._side="top"),r=0;rc?"right"===b._side&&("left"===b.anchorx&&(v="right"),y[0]*=-1,b._side="left"):d>0&&Math.abs(d)>c?"left"===b._side&&("right"===b.anchorx&&(v="left"),y[0]*=-1,b._side="right"):(v=b._anchorx_org,y=b._offset_org.slice(),"left"===v?b._side="right":"right"===v||y[0]<0?b._side="left":b._side="right"),r=0;r=0;l--)u=o.A.transpose(o.A.inverse(m[l].transformMat)),r=o.A.matVecMult(u,r);return r}],p),n.addChild(u),u.glider=n):(f=function(t,e,i){var s,r,a,h,l,c,d,u,p,f,A,_,m=Math.floor(t);if(1===e.bezierDegree)m===e.numberPoints-1&&m--;else{if(3!==e.bezierDegree)return 0;a=(t*((_="sector"===e.elType?(A=e.points.slice(3,e.numberPoints-3)).length:(A=e.points).length)-1)-(m=3*Math.floor(t*(_-1)/3)))/3,m>=_-1&&(m=_-4,a=1)}if(m<0)return 1;switch(1===e.bezierDegree?(s=e.points[m].usrCoords,r=e.points[m+1].usrCoords):(h=A[m].usrCoords,l=A[m+1].usrCoords,c=A[m+2].usrCoords,d=A[m+3].usrCoords,u=(1-a)*(1-a)*(l[1]-h[1])+2*(1-a)*a*(c[1]-l[1])+a*a*(d[1]-c[1]),p=(1-a)*(1-a)*(l[2]-h[2])+2*(1-a)*a*(c[2]-l[2])+a*a*(d[2]-c[2]),u/=f=o.A.hypot(u,p),p/=f,r=[1,(s=n.coords.usrCoords)[1]+u,s[2]+p]),i){case 0:return s[2]*r[1]-s[1]*r[2];case 1:return r[2]-s[2];case 2:return s[1]-r[1];default:return[s[2]*r[1]-s[1]*r[2],r[2]-s[2],s[1]-r[1]]}},u=t.create("line",[function(){var e;return e=n.type===i.A.OBJECT_TYPE_GLIDER?n.position:h.A.projectPointToCurve(n,a,t)[1],f(e,a)}],p),n.addChild(u),u.glider=n)}else a.type===i.A.OBJECT_TYPE_TURTLE?(u=t.create("line",[function(){var e,s;for(s=n.type===i.A.OBJECT_TYPE_GLIDER?n.position:h.A.projectPointToTurtle(n,a,t)[1],e=Math.floor(s),l=0;l=0;l--)u=o.A.transpose(o.A.inverse(g[l].transformMat)),r=o.A.matVecMult(u,r);return r}],u):(A=function(t,e,i){var s,r,a,h,l,c,d,u,p,f,A,_,m,g,b,v,y=Math.floor(t);if(1===e.bezierDegree)y===e.numberPoints-1&&y--,h=t;else{if(3!==e.bezierDegree)return 0;h=(t*((v="sector"===e.elType?(b=e.points.slice(3,e.numberPoints-3)).length:(b=e.points).length)-1)-(y=3*Math.floor(t*(v-1)/3)))/3,y>=v-1&&(y=v-4,h=1)}if(y<0)return 1;switch(s=h-y,1===e.bezierDegree?(r=e.points[y].usrCoords,a=e.points[y+1].usrCoords,m=[r[0]+s*(a[0]-r[0]),r[1]+s*(a[1]-r[1]),r[2]+s*(a[2]-r[2])],_=o.A.crossProduct(r,a),g=[(g=o.A.crossProduct([1,0,0],_))[0],-g[2],g[1]],_=o.A.crossProduct(m,g)):(l=b[y].usrCoords,c=b[y+1].usrCoords,d=b[y+2].usrCoords,u=b[y+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]),p/=A=o.A.hypot(p,f),f/=A,a=[1,(r=n.coords.usrCoords)[1]-f,r[2]+p],_=[r[2]*a[1]-r[1]*a[2],a[2]-r[2],r[1]-a[1]]),i){case 0:return _[0];case 1:return _[1];case 2:return _[2];default:return _}},l=t.create("line",[function(){var e;return e=n.type===i.A.OBJECT_TYPE_GLIDER?n.position:h.A.projectPointToCurve(n,a,t)[1],A(e,a)}],u),n.addChild(l),l.glider=n)}else{if(a.type!==i.A.OBJECT_TYPE_TURTLE)throw new Error("JSXGraph: Can't create normal with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [point,line], [point,circle], [glider]");l=t.create("line",[function(){var t,e,s=Math.floor(n.position),r=n.position-s;for(e=0;e1&&(h=e[0].type===i.A.OBJECT_TYPE_CONIC||e[0].elementClass===i.A.OBJECT_CLASS_CIRCLE,l=e[1].type===i.A.OBJECT_TYPE_CONIC||e[1].elementClass===i.A.OBJECT_CLASS_CIRCLE,c=s.A.isPoint(e[0]),d=s.A.isPoint(e[1])),2!==e.length||!(h&&d||c&&l))throw new 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?(n=t.select(e[0]),a=t.select(e[1])):(n=t.select(e[1]),a=t.select(e[0])),(o=t.create("tangent",[n,a],r)).elType="polarline",o},t.A.createTangentTo=function(t,e,r){var o,n,a,h,l,c,d;if(a=t.select(e[0]),h=s.A.providePoints(t,e[1],r,"point")[0],l=s.A.def(e[2],0),a.type!==i.A.OBJECT_TYPE_CIRCLE&&a.type!==i.A.OBJECT_TYPE_CONIC||h.elementClass!==i.A.OBJECT_CLASS_POINT)throw new 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 n=s.A.copyAttributes(r,t.options,"tangentto"),d=t.create("polar",[a,h],n.polar),c=t.create("intersection",[d,a,l],n.point),(o=t.create("tangent",[a,c],n)).point=c,o.polar=d,o.elType="tangentto",o},t.A.registerElement("tangent",t.A.createTangent),t.A.registerElement("normal",t.A.createNormal),t.A.registerElement("tangentto",t.A.createTangentTo),t.A.registerElement("polar",t.A.createTangent),t.A.registerElement("radicalaxis",t.A.createRadicalAxis),t.A.registerElement("polarline",t.A.createPolarLine);t.A.Line;t.A.Group=function(t,e,r,o,n){var a,h,l,c;for(this.board=t,this.objects={},a=this.board.numObjects,this.board.numObjects+=1,""!==e&&s.A.exists(e)?this.id=e:this.id=this.board.id+"Group"+a,this.board.groups[this.id]=this,this.type=i.A.OBJECT_TYPE_POINT,this.elementClass=i.A.OBJECT_CLASS_POINT,""!==r&&s.A.exists(r)?this.name=r:this.name="group_"+this.board.generateName(this),delete this.type,this.coords={},this.needsRegularUpdate=n.needsregularupdate,this.rotationCenter="centroid",this.scaleCenter=null,this.rotationPoints=[],this.translationPoints=[],this.scalePoints=[],this.scaleDirections={},this.parents=[],h=s.A.isArray(o)?o:Array.prototype.slice.call(arguments,3),l=0;l=0&&delete e.groups[i]);return this.objects={},this},addParents:function(t){var e,i,r;for(i=(r=s.A.isArray(t)?t:arguments).length,e=0;e=0?c:1,u=this.scaleDirections[r.id].indexOf("y")>=0?c:1,(f=this.board.create("transform",[1,0,0,_[0]*(1-d),d,0,_[1]*(1-u),0,u],{type:"generic"})).update()}}for(n in this.objects)(m=this.objects[n].point).elementClass!==i.A.OBJECT_CLASS_POINT&&(s.A.exists(f.board)?f.meltTo(m):r.id!==m.id&&A.meltTo(m));for(n in this._update_apply_transformation(r,f),this.needsUpdate=!1,this.objects)if(this.objects.hasOwnProperty(n))for(l in this.objects[n].descendants)this.objects[n].descendants.hasOwnProperty(l)&&(this.objects[n].descendants.needsUpdate=this.objects[n].descendants.needsRegularUpdate||this.board.needsFullUpdate);for(n in this.board.updateElements(r),this.objects)this.objects.hasOwnProperty(n)&&this._updateCoordsCache(n);return this},_update_find_drag_type:function(){var t,e,r,n="nothing",a=[];for(t in this.objects)this.objects.hasOwnProperty(t)&&(e=this.objects[t].point).coords.distance(i.A.COORDS_BY_USER,this.coords[t])>o.A.eps&&a.push(e.id);return 0===a.length?{action:n,id:"",changed:a}:(r=a[0],e=this.objects[r].point,a.length>1?n="translation":s.A.isInArray(this.rotationPoints,e)&&s.A.exists(this.rotationCenter)?n="rotation":s.A.isInArray(this.scalePoints,e)&&s.A.exists(this.scaleCenter)?n="scaling":s.A.isInArray(this.translationPoints,e)&&(n="translation"),{action:n,id:r,changed:a})},_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 r,n;for(r in this.objects)this.objects.hasOwnProperty(r)&&(s.A.exists(this.board.objects[r])?(n=this.objects[r].point).id!==t.id?"translation"===t.action?s.A.isInArray(t.changed,n.id)||n.elementClass===i.A.OBJECT_CLASS_POINT&&n.coords.setCoordinates(i.A.COORDS_BY_USER,[this.coords[r].usrCoords[1]+e[0],this.coords[r].usrCoords[2]+e[1]]):"rotation"!==t.action&&"scaling"!==t.action||n.elementClass===i.A.OBJECT_CLASS_POINT&&e.applyOnce([n]):"rotation"!==t.action&&"scaling"!==t.action||n.coords.setCoordinates(i.A.COORDS_BY_USER,o.A.matVecMult(e.matrix,this.coords[n.id].usrCoords)):delete this.objects[r])},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=s.A.uniqueArray(t.groups),this},addPoints:function(t){var e;for(e=0;e-1&&this[t+"Points"].splice(i,1),this},setProperty:function(){t.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}}),t.A.createGroup=function(e,i,r){var o=s.A.copyAttributes(r,e.options,"group"),n=new t.A.Group(e,o.id,o.name,i,o);return n.elType="group",n.setParents(i),n},t.A.registerElement("group",t.A.createGroup);t.A.Group;t.A.Circle=function(t,e,r,o,n){this.constructor(t,n,i.A.OBJECT_TYPE_CIRCLE,i.A.OBJECT_CLASS_CIRCLE),this.method=e,this.midpoint=this.board.select(r),this.center=this.board.select(r),this.point2=null,this.radius=0,this.line=null,this.circle=null,this.points=[],"twoPoints"===e?(this.point2=t.select(o),this.radius=this.Radius()):"pointRadius"===e?(this.gxtterm=o,this.updateRadius=s.A.createFunction(o,this.board),this.updateRadius(),this.addParentsFromJCFunctions([this.updateRadius])):"pointLine"===e?(this.line=t.select(o),this.radius=this.line.point1.coords.distance(i.A.COORDS_BY_USER,this.line.point2.coords)):"pointCircle"===e&&(this.circle=t.select(o),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(),s.A.exists(this.center._is_new)?(this.addChild(this.center),delete this.center._is_new):this.center.addChild(this),"pointRadius"===e?this.notifyParents(o):"pointLine"===e?this.line.addChild(this):"pointCircle"===e?this.circle.addChild(this):"twoPoints"===e&&(s.A.exists(this.point2._is_new)?(this.addChild(this.point2),delete this.point2._is_new):this.point2.addChild(this))},t.A.Circle.prototype=new Y.A,s.A.copyMethodMap(t.A.Circle,{setRadius:"setRadius",getRadius:"getRadius",Area:"Area",area:"Area",Perimeter:"Perimeter",Circumference:"Perimeter",radius:"Radius",Radius:"Radius",Diameter:"Diameter",center:"center",line:"line",point2:"point2"}),t.A.extend(t.A.Circle.prototype,{hasPoint:function(t,e){var r,n,a,h,l,c=this.center.coords.usrCoords,d=new u.A(i.A.COORDS_BY_SCREEN,[t,e],this.board),p=this.Radius();return s.A.isObject(this.evalVisProp("precision"))?(n=this.board._inputDevice,r=this.evalVisProp("precision."+n)):r=this.board.options.precision.hasPoint,a=c[1]-d.usrCoords[1],h=c[2]-d.usrCoords[2],l=o.A.hypot(a,h),r+=.5*this.evalVisProp("strokewidth"),r/=Math.sqrt(Math.abs(this.board.unitX*this.board.unitY)),this.evalVisProp("hasinnerpoints")?l=0?n=0:n*=Math.PI/180),a=1,"left"===o.side&&(a=-1),s.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(n),e=c[2]-(l*this.board.unitY+this.label.size[1]*h)*Math.sin(n),new u.A(i.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 u.A(i.A.COORDS_BY_USER,[t,e],this.board)},cloneToBackground:function(){var t,e=this.Radius(),i=s.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=s.A.isArray(t)?t:[t],r=i.length;for(e=0;e1)p[c]=t.create("point",e[c],f);else if(s.A.isPoint(e[c]))p[c]=t.select(e[c]);else if(s.A.isFunction(e[c])&&s.A.isPoint(e[c]()))p[c]=e[c]();else{if(!s.A.isString(e[c]))throw new 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]");p[c]=t.select(e[c])}if(s.A.isNumber(e[2]))l=s.A.createFunction(e[2],t);else if(s.A.isFunction(e[2])&&s.A.isNumber(e[2]()))l=e[2];else{if(s.A.isPoint(e[2]))h=t.select(e[2]);else if(e[2].length>1)h=t.create("point",e[2],f);else if(s.A.isFunction(e[2])&&s.A.isPoint(e[2]()))h=e[2]();else{if(!s.A.isString(e[2]))throw new 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]");h=t.select(e[2])}l=function(){return h.Dist(p[0])+h.Dist(p[1])}}for(s.A.exists(e[4])||(e[4]=2*Math.PI),s.A.exists(e[3])||(e[3]=0),a=t.create("point",[function(){return.5*(p[0].X()+p[1].X())},function(){return.5*(p[0].Y()+p[1].Y())}],A),(n=t.create("curve",[function(t){return 0},function(t){return 0},e[3],e[4]],_)).majorAxis=l,d=n.hasPoint,o=function(t,e){var i,s,r,o,a,h,c,d,u;e||(s=(i=l())*i,r=p[0].X(),o=p[0].Y(),c=r-(a=p[1].X()),d=o-(h=p[1].Y()),u=(s-r*r-o*o+a*a+h*h)/(2*i),n.quadraticform=[[u*u-a*a-h*h,u*c/i+a,u*d/i+h],[u*c/i+a,c*c/s-1,c*d/s],[u*d/i+h,c*d/s,d*d/s-1]])},n.X=function(t,e){var i=l(),s=p[1].Dist(p[0]),r=.5*(s*s-i*i)/(s*Math.cos(t)-i),n=Math.atan2(p[1].Y()-p[0].Y(),p[1].X()-p[0].X());return e||o(0,e),p[0].X()+Math.cos(n+t)*r},n.Y=function(t,e){var i=l(),s=p[1].Dist(p[0]),r=.5*(s*s-i*i)/(s*Math.cos(t)-i),o=Math.atan2(p[1].Y()-p[0].Y(),p[1].X()-p[0].X());return p[0].Y()+Math.sin(o+t)*r},n.midpoint=n.center=a,n.type=i.A.OBJECT_TYPE_CONIC,n.subs={center:n.center},n.inherits.push(n.center,p[0],p[1]),s.A.isPoint(h)&&n.inherits.push(h),n.hasPoint=function(t,e){var s,r,o,n;return this.evalVisProp("hasinnerpoints")?(s=p[0].coords,r=p[1].coords,o=this.majorAxis(),(n=new u.A(i.A.COORDS_BY_SCREEN,[t,e],this.board)).distance(i.A.COORDS_BY_USER,s)+n.distance(i.A.COORDS_BY_USER,r)<=o):d.apply(this,arguments)},a.addChild(n),c=0;c<2;c++)s.A.isPoint(p[c])&&p[c].addChild(n);return s.A.isPoint(h)&&h.addChild(n),n.setParents(e),n},t.A.createHyperbola=function(t,e,r){var o,n,a,h,l,c,d=[],u=s.A.copyAttributes(r,t.options,"conic","foci"),p=s.A.copyAttributes(r,t.options,"conic","center"),f=s.A.copyAttributes(r,t.options,"conic");for(c=0;c<2;c++)if(e[c].length>1)d[c]=t.create("point",e[c],u);else if(s.A.isPoint(e[c]))d[c]=t.select(e[c]);else if(s.A.isFunction(e[c])&&s.A.isPoint(e[c]()))d[c]=e[c]();else{if(!s.A.isString(e[c]))throw new 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]");d[c]=t.select(e[c])}if(s.A.isNumber(e[2]))l=s.A.createFunction(e[2],t);else if(s.A.isFunction(e[2])&&s.A.isNumber(e[2]()))l=e[2];else{if(s.A.isPoint(e[2]))h=t.select(e[2]);else if(e[2].length>1)h=t.create("point",e[2],u);else if(s.A.isFunction(e[2])&&s.A.isPoint(e[2]()))h=e[2]();else{if(!s.A.isString(e[2]))throw new 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]");h=t.select(e[2])}l=function(){return h.Dist(d[0])-h.Dist(d[1])}}for(s.A.exists(e[4])||(e[4]=1.0001*Math.PI),s.A.exists(e[3])||(e[3]=-1.0001*Math.PI),a=t.create("point",[function(){return.5*(d[0].X()+d[1].X())},function(){return.5*(d[0].Y()+d[1].Y())}],p),(n=t.create("curve",[function(t){return 0},function(t){return 0},e[3],e[4]],f)).majorAxis=l,o=function(t,e){var i,s,r,o,a,h,c,u,p;e||(s=(i=l())*i,r=d[0].X(),o=d[0].Y(),c=r-(a=d[1].X()),u=o-(h=d[1].Y()),p=(s-r*r-o*o+a*a+h*h)/(2*i),n.quadraticform=[[p*p-a*a-h*h,p*c/i+a,p*u/i+h],[p*c/i+a,c*c/s-1,c*u/s],[p*u/i+h,c*u/s,u*u/s-1]])},n.X=function(t,e){var i=l(),s=d[1].Dist(d[0]),r=.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||o(0,e),d[0].X()+Math.cos(n+t)*r},n.Y=function(t,e){var i=l(),s=d[1].Dist(d[0]),r=.5*(s*s-i*i)/(s*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)*r},n.midpoint=n.center=a,n.subs={center:n.center},n.inherits.push(n.center,d[0],d[1]),s.A.isPoint(h)&&n.inherits.push(h),n.type=i.A.OBJECT_TYPE_CONIC,a.addChild(n),c=0;c<2;c++)s.A.isPoint(d[c])&&d[c].addChild(n);return s.A.isPoint(h)&&h.addChild(n),n.setParents(e),n},t.A.createParabola=function(t,e,r){var o,n,a,l,c=e[0],d=e[1],u=s.A.copyAttributes(r,t.options,"conic","foci"),p=s.A.copyAttributes(r,t.options,"conic","center"),f=s.A.copyAttributes(r,t.options,"conic");if(e[0].length>1)c=t.create("point",e[0],u);else if(s.A.isPoint(e[0]))c=t.select(e[0]);else if(s.A.isFunction(e[0])&&s.A.isPoint(e[0]()))c=e[0]();else{if(!s.A.isString(e[0]))throw new Error("JSXGraph: Can't create Parabola with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [point,line]");c=t.select(e[0])}return s.A.isArray(d)&&2===d.length&&(l=s.A.copyAttributes(r,t.options,"conic","line"),d=t.create("line",d,l)),s.A.exists(e[3])||(e[3]=2*Math.PI),s.A.exists(e[2])||(e[2]=0),a=t.create("point",[function(){return h.A.projectPointToLine(c,d,t).usrCoords}],p),(n=t.create("curve",[function(t){return 0},function(t){return 0},e[2],e[3]],f)).midpoint=n.center=a,n.subs={center:n.center},n.inherits.push(n.center),o=function(t,e){var i,s,r,o,a,h;e||(i=d.stdform[1],s=d.stdform[2],r=d.stdform[0],o=i*i+s*s,a=c.X(),h=c.Y(),n.quadraticform=[[r*r-o*(a*a+h*h),r*i+o*a,r*s+o*h],[r*i+o*a,-s*s,i*s],[r*s+o*h,i*s,-i*i]])},n.X=function(t,e){var i,s=d.getAngle(),r=h.A.distPointLine(c.coords.usrCoords,d.stdform),n=d.point1.coords.usrCoords,a=d.point2.coords.usrCoords,l=c.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])*(l[2]-n[2])-(a[2]-n[2])*(l[1]-n[1])>=0?1:-1)*r/(1-Math.sin(t)),e||o(0,e),c.X()+Math.cos(t+s)*i},n.Y=function(t,e){var i,s=d.getAngle(),r=h.A.distPointLine(c.coords.usrCoords,d.stdform),o=d.point1.coords.usrCoords,n=d.point2.coords.usrCoords,a=c.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)*r/(1-Math.sin(t)),c.Y()+Math.sin(t+s)*i},n.type=i.A.OBJECT_TYPE_CONIC,a.addChild(n),s.A.isPoint(c)&&(c.addChild(n),n.inherits.push(c)),d.addChild(n),n.setParents(e),n},t.A.createConic=function(t,e,r){var n,a,h,l,c,u,p,f,A,_,m,g,b,v,y=[[1,0,0],[0,1,0],[0,0,1]],C=[[1,0,0],[0,1,0],[0,0,1]],P=[],E=[],x=s.A.copyAttributes(r,t.options,"conic","point"),O=s.A.copyAttributes(r,t.options,"conic","center"),M=s.A.copyAttributes(r,t.options,"conic");if(5===e.length)v=!0;else{if(6!==e.length)throw new Error("JSXGraph: Can't create generic Conic with "+e.length+" parameters.");v=!1}if(v)for(g=0;g<5;g++)if(e[g].length>1)P[g]=t.create("point",e[g],x);else if(s.A.isPoint(e[g]))P[g]=t.select(e[g]);else if(s.A.isFunction(e[g])&&s.A.isPoint(e[g]()))P[g]=e[g]();else{if(!s.A.isString(e[g]))throw new Error("JSXGraph: Can't create Conic section with parent types '"+typeof e[g]+"'.\nPossible parent types: [point,point,point,point,point], [a00,a11,a22,a01,a02,a12]");P[g]=t.select(e[g])}else(b=[[0,0,0],[0,0,0],[0,0,0]])[0][0]=s.A.isFunction(e[2])?function(){return e[2]()}:function(){return e[2]},b[0][1]=s.A.isFunction(e[4])?function(){return e[4]()}:function(){return e[4]},b[0][2]=s.A.isFunction(e[5])?function(){return e[5]()}:function(){return e[5]},b[1][1]=s.A.isFunction(e[0])?function(){return e[0]()}:function(){return e[0]},b[1][2]=s.A.isFunction(e[3])?function(){return e[3]()}:function(){return e[3]},b[2][2]=s.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;ii&&(C[r][i]=C[i][r]);a.quadraticform=C,(u=d.A.Jacobi(C))[0][0][0]<0&&(u[0][0][0]*=-1,u[0][1][1]*=-1,u[0][2][2]*=-1),y=u[1],A=Math.sqrt(Math.abs(u[0][0][0])),p=Math.sqrt(Math.abs(u[0][1][1])),f=Math.sqrt(Math.abs(u[0][2][2]))}return u[0][1][1]<=0&&u[0][2][2]<=0?n=o.A.matVecMult(y,[1/A,Math.cos(t)/p,Math.sin(t)/f]):u[0][1][1]<=0&&u[0][2][2]>0?n=o.A.matVecMult(y,[Math.cos(t)/A,1/p,Math.sin(t)/f]):u[0][2][2]<0&&(n=o.A.matVecMult(y,[Math.sin(t)/A,Math.cos(t)/p,1/f])),s.A.exists(n)?(n[1]/=n[0],n[2]/=n[0],n[0]=1):n=[1,NaN,NaN],n},a.X=function(t,e){return n(t,e)[1]},a.Y=function(t,e){return n(t,e)[2]},a.midpoint=t.create("point",[function(){var t=a.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]]}],O),a.type=i.A.OBJECT_TYPE_CONIC,a.center=a.midpoint,a.subs={center:a.center},a.inherits.push(a.center),a.inherits=a.inherits.concat(P),v){for(g=0;g<5;g++)s.A.isPoint(P[g])&&P[g].addChild(a);a.setParents(e)}return a.addChild(a.center),a},t.A.registerElement("ellipse",t.A.createEllipse),t.A.registerElement("hyperbola",t.A.createHyperbola),t.A.registerElement("parabola",t.A.createParabola),t.A.registerElement("conic",t.A.createConic),t.A.Polygon=function(t,e,r){this.constructor(t,r,i.A.OBJECT_TYPE_POLYGON,i.A.OBJECT_CLASS_AREA);var o,n,a,h,l,c=s.A.copyAttributes(r,t.options,"polygon","borders");for(this.withLines=r.withlines,this.attr_line=c,this.vertices=[],o=0;o0&&this.vertices[this.vertices.length-1].id!==this.vertices[0].id&&this.vertices.push(this.vertices[0]),this.borders=[],this.withLines)for(a=this.vertices.length-1,h=0;h0&&(c.strokecolor=c.colors[o%c.colors.length]),c.visible=s.A.exists(r.borders.visible)?r.borders.visible:r.visible,!1===c.strokecolor&&(c.strokecolor="none"),(n=t.create("segment",[this.vertices[o],this.vertices[o+1]],c)).dump=!1,this.borders[o]=n,n.parentPolygon=this,this.addChild(n);for(this.inherits.push(this.vertices,this.borders),this.id=this.board.setId(this,"Py"),o=0;os&&(s=this.vertices[o].X()),this.vertices[o].Y()>e&&(e=this.vertices[o].Y()),this.vertices[o].Y()i[2]&&(i[2]=e),(e=this.vertices[t].Y())>i[1]?i[1]=e:eo)return this;for(r=arguments.length-1,i=1;i=0&&(t-1&&r-1;e--)n[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;e1&&this.vertices[this.vertices.length-1].id!==this.vertices[0].id&&this.vertices.push(this.vertices[0]),this.withLines){for(e=0;e2&&(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=Y.A.prototype.getAttributes.call(this);if(this.withLines)for(e.lines=e.lines||{},e.lines.ids=[],e.lines.colors=[],t=0;t=0};for(r=0;r 2 as input.");if(s.A.isNumber(t.select(a))?(l--,c=!1):(a=l,c=!0),!1===(u=s.A.providePoints(t,e.slice(0,l),r,"regularpolygon",["vertices"])))throw new 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(d=s.A.copyAttributes(r,t.options,"regularpolygon","vertices"),n=2;n=a-2&&(d.id=d.ids[n-2]),u[n]=t.create("point",[u[n-2],h],d),u[n].type=i.A.OBJECT_TYPE_CAS,u[n].isDraggable=!0,u[n].visProp.fixed=!1);return d=s.A.copyAttributes(r,t.options,"regularpolygon"),(o=t.create("polygon",u,d)).elType="regularpolygon",o},t.A.createPolygonalChain=function(t,e,i){var r,o;return r=s.A.copyAttributes(i,t.options,"polygonalchain"),(o=t.create("polygon",e,r)).elType="polygonalchain",o.vertices.pop(),t.removeObject(o.borders[o.borders.length-1]),o.borders.pop(),o},t.A.createParallelogram=function(t,e,i){var r,o,n,a,h;if(!1===(n=s.A.providePoints(t,e,i,"polygon",["vertices"]))||n.length<3)throw new Error("JSXGraph: Can't create parallelogram with parent types other than 'point' and 'coordinate arrays' or a function returning an array of coordinates.");return h=s.A.copyAttributes(i,t.options,"parallelogram","parallelpoint"),o=t.create("parallelpoint",n,h),a=s.A.copyAttributes(i,t.options,"parallelogram"),(r=t.create("polygon",[n[0],n[1],o,n[2]],a)).elType="parallelogram",r.parallelPoint=o,r.isDraggable=!0,o.isDraggable=!0,o.visProp.fixed=!1,r},t.A.registerElement("polygon",t.A.createPolygon),t.A.registerElement("regularpolygon",t.A.createRegularPolygon),t.A.registerElement("polygonalchain",t.A.createPolygonalChain),t.A.registerElement("parallelogram",t.A.createParallelogram);var F=t.A.Polygon;t.A.Curve=function(t,e,r){this.constructor(t,r,i.A.OBJECT_TYPE_CURVE,i.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,s.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(),s.A.isString(this.xterm)&&this.notifyParents(this.xterm),s.A.isString(this.yterm)&&this.notifyParents(this.yterm)},t.A.Curve.prototype=new Y.A,s.A.copyMethodMap(t.A.Curve,{generateTerm:"generateTerm",setTerm:"generateTerm",move:"moveTo",moveTo:"moveTo",MinX:"minX",MaxX:"maxX"}),t.A.extend(t.A.Curve.prototype,{minX:function(){return"polar"===this.evalVisProp("curvetype")?0:new u.A(i.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 u.A(i.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},Ft:function(t){var e=[this.Z(t),this.X(t),this.Y(t)];return this.transformations.length>0&&(e=o.A.matVecMult(this.transformMat,e)),e[1]/=e[0],e[2]/=e[0],e[0]/=e[0],e},hasPoint:function(t,e,r){var n,a,l,c,d,p,f,A,_,m,g,b,v,y,C,P,E=[],x=this.evalVisProp("numberpointslow"),O=(this.maxX()-this.minX())/x,M=1/0,w=!0;if(s.A.isObject(this.evalVisProp("precision"))?(b=this.board._inputDevice,g=this.evalVisProp("precision."+b)):g=this.board.options.precision.hasPoint,t=(p=new u.A(i.A.COORDS_BY_SCREEN,[t,e],this.board,!1)).usrCoords[1],e=p.usrCoords[2],1===this.bezierDegree&&this.evalVisProp("hasinnerpoints")&&0!==h.A.windingNumber([1,t,e],this.points,!0))return!0;if(g+=.5*this.evalVisProp("strokewidth"),g*=g,v=this.board.unitX*this.board.unitX,y=this.board.unitY*this.board.unitY,P=this.minX(),this.maxX(),s.A.exists(this._visibleArea)&&(P=this._visibleArea[0],O=(this._visibleArea[1]-P)/x),"parameter"===(C=this.evalVisProp("curvetype"))||"polar"===C)for(this.transformations.length>0&&(this.updateTransformMatrix(),A=o.A.inverse(this.transformMat),t=(a=o.A.matVecMult(A,[1,t,e]))[1],e=a[2]),l=0,n=P;l=0&&E[1]<=1&&(t-E[0][1])*(t-E[0][1])*v+(e-E[0][2])*(e-E[0][2])*y<=g)return!0;return!1}return M0&&(this.points[t].prev=this.points[t-1]),t0&&(e=o.A.matVecMult(this.transformMat,t.usrCoords),t.setCoordinates(i.A.COORDS_BY_USER,e,!1,!0)),t},addTransform:function(t){var e,i=s.A.isArray(t)?t:[t],r=i.length;for(e=0;e=(c-1)/3)return s.A.isFunction(l[l.length-1])?l[l.length-1]():l[l.length-1];for(o=3*Math.floor(t),h=1-(a=t%1),n=0;n<4;n++)s.A.isFunction(l[o+n])?d[n]=l[o+n]():d[n]=l[o+n];return h*h*(h*d[0]+3*a*d[1])+(3*h*d[2]+a*d[3])*a*a}if((o=t>c-2?c-2:parseInt(Math.floor(t),10))===t)return s.A.isFunction(l[o])?l[o]():l[o];for(n=0;n<2;n++)s.A.isFunction(l[o+n])?d[n]=l[o+n]():d[n]=l[o+n];return d[0]+(d[1]-d[0])*(t-o)}},generateTerm:function(t,e,i,r,n){var a,h,l,c;s.A.isArray(e)?(this.dataX=e,this.numberPoints=this.dataX.length,this.X=this.interpolationFunctionFromArray.apply(this,["X"]),this.visProp.curvetype="plot",this.isDraggable=!0):(this.X=s.A.createFunction(e,this.board,t),s.A.isString(e)?this.visProp.curvetype="functiongraph":(s.A.isFunction(e)||s.A.isNumber(e))&&(this.visProp.curvetype="parameter"),this.isDraggable=!0),s.A.isArray(i)?(this.dataY=i,this.Y=this.interpolationFunctionFromArray.apply(this,["Y"])):s.A.exists(i)?this.Y=s.A.createFunction(i,this.board,t):(c=(l=o.A.transpose(e)).length>2?1:0,this.dataX=l[c],this.dataY=l[c+1],this.numberPoints=this.dataX.length,this.Y=this.interpolationFunctionFromArray.apply(this,["Y"])),s.A.isFunction(e)&&s.A.isArray(i)&&(a=s.A.createFunction(i[0],this.board,""),h=s.A.createFunction(i[1],this.board,""),this.X=function(t){return e(t)*Math.cos(t)+a()},this.X.deps=a.deps,this.Y=function(t){return e(t)*Math.sin(t)+h()},this.Y.deps=h.deps,this.visProp.curvetype="polar"),s.A.exists(r)?this.minX=s.A.createFunction(r,this.board,""):delete this.minX,s.A.exists(n)?this.maxX=s.A.createFunction(n,this.board,""):delete this.maxX,this.addParentsFromJCFunctions([this.X,this.Y,this.minX,this.maxX])},notifyParents:function(t){var e,i,s,r=!1;for(e in s={xterm:1,yterm:1})if(s.hasOwnProperty(e)&&this.hasOwnProperty(e)&&this[e].origin)for(i in r=!0,this[e].origin.deps)this[e].origin.deps.hasOwnProperty(i)&&this[e].origin.deps[i].addChild(this);r||w.A.findDependencies(this,t,this.board)},getLabelPosition:function(t,e){var r,n,a,h,l,c,p,f,A,_,m,g,b,v,y,C,P,E=1.5;return g=this.minX(),b=this.maxX(),v=d.A.findDomain(this.X,[g,b],null,!1),v=d.A.findDomain(this.Y,v,null,!1),g=Math.max(v[0],v[0]),b=Math.min(v[1],v[1]),a=s.A.parsePosition(t),m=s.A.parseNumber(a.pos,b-g,1),a.pos.indexOf("fr")<0&&a.pos.indexOf("%")<0&&(m=0),y=g+m,r=(p=this.Ft(y))[1],n=p[2],isNaN(r+n)&&(y=g+(m/=b-g),_=this.Ft(g),A=this.Ft(b),r=_[1]+m*(A[1]-_[1]),n=_[2]+m*(A[2]-_[2])),h=new u.A(i.A.COORDS_BY_USER,[r,n],this.board).scrCoords,yb-c?(f=this.Ft(y-c),C=(p[1]-f[1])/c,P=(p[2]-f[2])/c):(f=this.Ft(y+c),p=this.Ft(y-c),C=.5*(f[1]-p[1])/c,P=.5*(f[2]-p[2])/c),C=isNaN(C)?1:C,P=isNaN(P)?1:P,l=o.A.hypot(C,P),"left"===a.side?P*=-1:C*=-1,s.A.exists(this.label)&&(E=.5*e/l),r=h[1]+P*this.label.size[0]*E,n=h[2]-C*this.label.size[1]*E,new u.A(i.A.COORDS_BY_SCREEN,[r,n],this.board)},getLabelAnchor:function(){var t,e,r,o,n=.1*this.board.canvasWidth,a=.1*this.board.canvasHeight,l=.9*this.board.canvasWidth,c=.9*this.board.canvasHeight;if(!s.A.exists(this.label))return new u.A(i.A.COORDS_BY_SCREEN,[NaN,NaN],this.board);if(r=this.label.evalVisProp("position"),!s.A.isString(r))return new u.A(i.A.COORDS_BY_SCREEN,[NaN,NaN],this.board);if(!(r.indexOf("right")<0&&r.indexOf("left")<0))return this.getLabelPosition(r,this.label.evalVisProp("distance"));switch(this.evalVisProp("label.position")){case"ulft":t=n,e=a;break;case"llft":t=n,e=c;break;case"rt":t=l,e=.5*c;break;case"lrt":t=l,e=c;break;case"urt":t=l,e=a;break;case"top":t=.5*l,e=a;break;case"bot":t=.5*l,e=c;break;default:t=n,e=.5*c}return o=new u.A(i.A.COORDS_BY_SCREEN,[t,e],this.board,!1),h.A.projectCoordsToCurve(o.usrCoords[1],o.usrCoords[2],0,this,this.board)[0]},cloneToBackground:function(){var t,e=s.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,o=-1/0,n=1/0,a=-1/0,h=this.points.length;if(3===this.bezierDegree){for(t=0;tthis.points[t].usrCoords[1]&&(r=this.points[t].usrCoords[1]),othis.points[t].usrCoords[2]&&(n=this.points[t].usrCoords[2]),a0&&!this.evalVisProp("fixed")?(e=this.points[0],s=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(i.A.COORDS_BY_USER,s),this.board.update(this)):this},getTransformationSource:function(){var t,e;return s.A.exists(this._transformationSource)&&(e=this._transformationSource).elementClass===i.A.OBJECT_CLASS_CURVE&&(t=!0),[t,e]},getCoords:function(){var t,e,i=[];for(t=this.numberPoints,e=0;e5&&s.A.isArray(this.Q[5]()))for(t.push(NaN),e.push(NaN),b=this.evalVisProp("outlier.face"),"vertical"===h?(f=this.evalVisProp("outlier.size")/this.board.unitX,A=this.evalVisProp("outlier.size")/this.board.unitY):(A=this.evalVisProp("outlier.size")/this.board.unitX,f=this.evalVisProp("outlier.size")/this.board.unitY),_=f*Math.sqrt(2),m=A*Math.sqrt(2),d=(u=this.Q[5]()).length,c=0;c":case"diamond":t.push(l,l+f,l,l-f,l,NaN),e.push(p+A,p,p-A,p,p+A,NaN);break;case"<<>>":case"diamond2":t.push(l,l+_,l,l-_,l,NaN),e.push(p+m,p,p-m,p,p+m,NaN);break;case"+":case"plus":t.push(l-f,l+f,NaN,l,l,NaN),e.push(p,p,NaN,p-A,p+A,NaN);break;case"-":case"minus":t.push(l-f,l+f,NaN),e.push(p,p,NaN);break;case"|":case"divide":t.push(l,l,NaN),e.push(p-A,p+A,NaN);break;default:for(g=0;g<=2*Math.PI;g+=2*Math.PI/17)t.push(l-f*Math.sin(g)),e.push(p-A*Math.cos(g));t.push(NaN),e.push(NaN)}"vertical"===h?(this.dataX=t,this.dataY=e):(this.dataX=e,this.dataY=t)},r.addParentsFromJCFunctions([r.Q,r.x,r.w]),r},t.A.registerElement("boxplot",t.A.createBoxPlot),t.A.createImplicitCurve=function(t,e,i){var r,o;if([1,3,5].indexOf(e.length)<0)throw new 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 o=s.A.copyAttributes(i,t.options,"implicitcurve"),(r=t.create("curve",[[],[]],o)).f=s.A.createFunction(e[0],t,"x, y"),5===e.length||s.A.isString(e[1])||s.A.isFunction(e[1])?r.dfx=s.A.createFunction(e[1],t,"x, y"):r.dfx=null,5===e.length||s.A.isString(e[2])||s.A.isFunction(e[2])?r.dfy=s.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,o,n,a;null===this.domain?(a=this.evalVisProp("margin"),(t=this.board.getBoundingBox())[0]-=a,t[1]+=a,t[2]+=a,t[3]-=a):(e=s.A.evaluate(this.domain[0]),i=s.A.evaluate(this.domain[1]),t=[Math.min(e[0],e[1]),Math.max(i[0],i[1]),Math.max(e[0],e[1]),Math.min(i[0],i[1])]),o={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 A(t,o,this.f,this.dfx,this.dfy),this.qdt=r.qdt,n=r.plot(),this.dataX=n[0],this.dataY=n[1]},r.elType="implicitcurve",r},t.A.registerElement("implicitcurve",t.A.createImplicitCurve),t.A.createSketchCurve=function(t,e,i){var r,o;return o=s.A.copyAttributes(i,t.options,"sketchcurve"),(r=t.create("curve",[[],[]],o)).elType="sketchcurve",r},t.A.registerElement("sketchcurve",t.A.createSketchCurve);t.A.Curve;t.A.createArc=function(e,r,n){var a,l,c;if(l=s.A.copyAttributes(n,e.options,"arc"),!1===(c=s.A.providePoints(e,r,l,"arc",["center","radiuspoint","anglepoint"]))||c.length<3)throw new Error("JSXGraph: Can't create Arc with parent types '"+typeof r[0]+"' and '"+typeof r[1]+"' and '"+typeof r[2]+"'.\nPossible parent types: [point,point,point], [arc, transformation]");return(a=e.create("curve",[[0],[0],0,4],l)).elType="arc",a.setParents(c),a.type=i.A.OBJECT_TYPE_ARC,a.center=c[0],a.radiuspoint=c[1],a.point2=a.radiuspoint,a.anglepoint=c[2],a.point3=a.anglepoint,s.A.exists(a.center._is_new)?(a.addChild(a.center),delete a.center._is_new):a.center.addChild(a),s.A.exists(a.radiuspoint._is_new)?(a.addChild(a.radiuspoint),delete a.radiuspoint._is_new):a.radiuspoint.addChild(a),s.A.exists(a.anglepoint._is_new)?(a.addChild(a.anglepoint),delete a.anglepoint._is_new):a.anglepoint.addChild(a),a.useDirection=l.usedirection,a.updateDataArray=function(){var t,e,i,s,r,o,n,a,l=1,d=this.radiuspoint,u=this.center,p=this.anglepoint,f=this.evalVisProp("selection"),A=this.evalVisProp("orientation");e=h.A.rad(d,u,p),("minor"===f&&e>Math.PI||"major"===f&&e0&&(this.updateTransformMatrix(),l=o.A.inverse(this.transformMat),c=o.A.matVecMult(l,n.usrCoords),n=new u.A(i.A.COORDS_BY_USER,c,this.board)),r=this.center.coords.distance(i.A.COORDS_BY_USER,n),(a=Math.abs(r-f)Math.PI||"major"===g&&c=0?1:-1):a.direction1=r[2]>=0?1:-1,s.A.isArray(r[3])?(2===r[3].length&&(r[3]=[1].concat(r[3])),f=h.A.projectPointToLine({coords:{usrCoords:r[3]}},a.line2,e),f=p.A.subtract(f.usrCoords,d.usrCoords),a.direction2=o.A.innerProduct(f,[0,a.line2.stdform[2],-a.line2.stdform[1]],3)>=0?1:-1):a.direction2=r[3]>=0?1:-1,a.updateDataArray=function(){var e,s,r,n,l,c,d=1e-14,f=[0,0,0];if(s=this.line1,r=this.line2,f=o.A.crossProduct(s.stdform,r.stdform),h.A.distance(f,[0,0,0],3)d&&(f[1]/=f[0],f[2]/=f[0],f[0]/=f[0]),e=this.direction1*this.Radius(),n=p.A.add(f,[0,e*s.stdform[2],-e*s.stdform[1]]),e=this.direction2*this.Radius(),l=p.A.add(f,[0,e*r.stdform[2],-e*r.stdform[1]]),this.point2.coords=new u.A(i.A.COORDS_BY_USER,n,a.board),this.point1.coords=new u.A(i.A.COORDS_BY_USER,f,a.board),this.point3.coords=new u.A(i.A.COORDS_BY_USER,l,a.board),Math.abs(n[0])Math.PI||"major"===f&&lMath.PI||"major"===f&&l=0&&(u=this.point2,c=this.point3)),o=c.coords.usrCoords,n=d.coords.usrCoords,a=u.coords.usrCoords,t=h.A.bezierArc(o,n,a,!0,p),this.dataX=t[0],this.dataY=t[1],this.bezierDegree=3},a.Radius=function(){return this.point2.Dist(this.point1)},s.A.extendInstanceMethodMap(a,{arc:"arc",center:"center",radiuspoint:"radiuspoint",anglepoint:"anglepoint"})}return a.center=a.point1,a.radiuspoint=a.point2,a.anglepoint=a.point3,l=s.A.copyAttributes(n,e.options,"arc"),(l=s.A.copyAttributes(l,e.options,"sector","arc")).withlabel=!1,l.selection=a.visProp.selection,l.name+="_arc","2lines"===m?(a.updateDataArray(),a.arc=e.create("arc",[function(){return a.point1.coords.usrCoords},function(){var t=a.point2.coords.distance(i.A.COORDS_BY_USER,a.point1.coords);return 0===t?[a.point1.coords.usrCoords[1],a.point1.coords.usrCoords[2]]:[a.point1.coords.usrCoords[1]+a.Radius()*(a.point2.coords.usrCoords[1]-a.point1.coords.usrCoords[1])/t,a.point1.coords.usrCoords[2]+a.Radius()*(a.point2.coords.usrCoords[2]-a.point1.coords.usrCoords[2])/t]},function(){return a.point3.coords.usrCoords}],l)):a.arc=e.create("arc",[a.point1,function(){var t,e,i=a.point2.Dist(a.point1);return t=a.point1,e=a.point2,0===i?[t.X(),t.Y()]:[t.X()+a.Radius()*(e.X()-t.X())/i,t.Y()+a.Radius()*(e.Y()-t.Y())/i]},a.point3],l),a.addChild(a.arc),a.inherits.push(a.arc),a.hasPointCurve=function(t,e){var r,o,n,a,l,c,d=new u.A(i.A.COORDS_BY_SCREEN,[t,e],this.board),p=this.Radius(),f=this.center.coords.distance(i.A.COORDS_BY_USER,d),A=this.evalVisProp("selection"),_=this.evalVisProp("orientation");return s.A.isObject(this.evalVisProp("precision"))?(l=this.board._inputDevice,a=this.evalVisProp("precision."+l)):a=this.board.options.precision.hasPoint,a/=Math.min(Math.abs(this.board.unitX),Math.abs(this.board.unitY)),(c=Math.abs(f-p)Math.PI||"major"===A&&nn)&&(c=!1)),c},a.hasPointSector=function(t,e){var s,r,o,n=new u.A(i.A.COORDS_BY_SCREEN,[t,e],this.board),a=this.Radius(),l=this.point1.coords.distance(i.A.COORDS_BY_USER,n)Math.PI||"major"===c&&oo)&&(l=!1)),l},a.hasPoint=function(t,e){return this.evalVisProp("highlightonsector")||this.evalVisProp("hasinnerpoints")?this.hasPointSector(t,e):this.hasPointCurve(t,e)},a.getTextAnchor=function(){return this.point1.coords},a.getLabelAnchor=function(){var t,e,r,n,a,l=this.label.evalVisProp("position"),c=h.A.rad(this.point2,this.point1,this.point3),d=13/this.board.unitX,p=13/this.board.unitY,f=this.point2.coords.usrCoords,A=this.point1.coords.usrCoords,_=f[1]-A[1],m=f[2]-A[2],g=this.evalVisProp("selection"),b=this.evalVisProp("orientation"),v=this.label?this.label.visProp:this.visProp.label;return!s.A.isString(l)||l.indexOf("right")<0&&l.indexOf("left")<0?(("minor"===g&&c>Math.PI||"major"===g&&cMath.PI||"major"===u&&r0&&(t.transformations.pop(),t.isDraggable=!0,t.parents=[],t.coords.off("update")),this.hasFixedAngle=!1,this},n.setParents(p)),s.A.exists(n.visProp.text)&&n.label.setText(n.evalVisProp("text")),n.elType="angle",n.type=i.A.OBJECT_TYPE_ANGLE,n.subs={},n.updateDataArraySquare=function(){var t,e,i,s,r,n,a,l,c=this.Radius();"2lines"===f&&this.updateDataArraySector(),t=this.point2,e=this.point1,i=this.point3,t=t.coords.usrCoords,e=e.coords.usrCoords,i=i.coords.usrCoords,s=h.A.distance(t,e,3),r=h.A.distance(i,e,3),t=[1,e[1]+(t[1]-e[1])*c/s,e[2]+(t[2]-e[2])*c/s],i=[1,e[1]+(i[1]-e[1])*c/r,e[2]+(i[2]-e[2])*c/r],n=o.A.crossProduct(i,e),a=[-t[1]*n[1]-t[2]*n[2],t[0]*n[1],t[0]*n[2]],n=o.A.crossProduct(t,e),l=[-i[1]*n[1]-i[2]*n[2],i[0]*n[1],i[0]*n[2]],(n=o.A.crossProduct(a,l))[1]/=n[0],n[2]/=n[0],this.dataX=[e[1],t[1],n[1],i[1],e[1]],this.dataY=[e[2],t[2],n[2],i[2],e[2]],this.bezierDegree=1},n.updateDataArrayNone=function(){this.dataX=[NaN],this.dataY=[NaN],this.bezierDegree=1},n.updateDataArray=function(){var t=this.evalVisProp("type"),e=h.A.trueAngle(this.point2,this.point1,this.point3),i=this.evalVisProp("selection"),s=this.evalVisProp("orientation");("minor"===i&&e>180||"major"===i&&e<180||"auto"===i&&"clockwise"===s)&&(e=360-e),Math.abs(e-90)Math.PI||"major"===u&&aMath.PI||"major"===_&&c=Math.PI?e:2*Math.PI-e,this.arc.Value(t,e)},o},t.A.registerElement("reflexangle",t.A.createReflexAngle),t.A.createOrthogonalProjection=function(t,e,r){var o,n,a,l,c={name:""};if(e[0]=t.select(e[0]),e[1]=t.select(e[1]),s.A.isPointType(t,e[0])&&e[1].elementClass===i.A.OBJECT_CLASS_LINE)n=s.A.providePoints(t,[e[0]],c,"point")[0],o=e[1];else{if(!s.A.isPointType(t,e[1])||e[0].elementClass!==i.A.OBJECT_CLASS_LINE)throw new Error("JSXGraph: Can't create perpendicular point with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [point,line]");n=s.A.providePoints(t,[e[1]],c,"point")[0],o=e[0]}return l=s.A.copyAttributes(r,t.options,"orthogonalprojection"),a=t.create("point",[function(){return h.A.projectPointToLine(n,o,t)}],l),s.A.exists(n._is_new)?(a.addChild(n),delete n._is_new):n.addChild(a),o.addChild(a),a.elType="orthogonalprojection",a.setParents([n.id,a.id]),a.update(),a.generatePolynomial=function(){var t=o.point1.symbolic.x,e=o.point1.symbolic.y,i=o.point2.symbolic.x,s=o.point2.symbolic.y,r=n.symbolic.x,h=n.symbolic.y,l=a.symbolic.x,c=a.symbolic.y;return["("+e+")*("+l+")-("+e+")*("+i+")+("+c+")*("+i+")-("+t+")*("+c+")+("+t+")*("+s+")-("+l+")*("+s+")","("+h+")*("+e+")-("+h+")*("+s+")-("+c+")*("+e+")+("+c+")*("+s+")+("+r+")*("+t+")-("+r+")*("+i+")-("+l+")*("+t+")+("+l+")*("+i+")"]},a},t.A.createPerpendicular=function(e,r,o){var n,a,h,l,c={name:""};if(r[0]=e.select(r[0]),r[1]=e.select(r[1]),s.A.isPointType(e,r[0])&&r[1].elementClass===i.A.OBJECT_CLASS_LINE)a=r[1],n=s.A.providePoints(e,[r[0]],c,"point")[0];else{if(!s.A.isPointType(e,r[1])||r[0].elementClass!==i.A.OBJECT_CLASS_LINE)throw new Error("JSXGraph: Can't create perpendicular with parent types '"+typeof r[0]+"' and '"+typeof r[1]+"'.\nPossible parent types: [line,point]");a=r[0],n=s.A.providePoints(e,[r[1]],c,"point")[0]}return l=s.A.copyAttributes(o,e.options,"perpendicular"),(h=t.A.createLine(e,[function(){return a.stdform[2]*n.X()-a.stdform[1]*n.Y()},function(){return-a.stdform[2]*n.Z()},function(){return a.stdform[1]*n.Z()}],l)).elType="perpendicular",h.setParents([a.id,n.id]),s.A.exists(n._is_new)?(h.addChild(n),delete n._is_new):n.addChild(h),a.addChild(h),h},t.A.createPerpendicularPoint=function(t,e,r){var o,n,a,l={name:""};if(e[0]=t.select(e[0]),e[1]=t.select(e[1]),s.A.isPointType(t,e[0])&&e[1].elementClass===i.A.OBJECT_CLASS_LINE)n=s.A.providePoints(t,[e[0]],l,"point")[0],o=e[1];else{if(!s.A.isPointType(t,e[1])||e[0].elementClass!==i.A.OBJECT_CLASS_LINE)throw new Error("JSXGraph: Can't create perpendicular point with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [point,line]");n=s.A.providePoints(t,[e[1]],l,"point")[0],o=e[0]}return a=t.create("point",[function(){return h.A.perpendicular(o,n,t)[0]}],r),s.A.exists(n._is_new)?(a.addChild(n),delete n._is_new):n.addChild(a),o.addChild(a),a.elType="perpendicularpoint",a.setParents([n.id,o.id]),a.update(),a.generatePolynomial=function(){var t=o.point1.symbolic.x,e=o.point1.symbolic.y,i=o.point2.symbolic.x,s=o.point2.symbolic.y,r=n.symbolic.x,h=n.symbolic.y,l=a.symbolic.x,c=a.symbolic.y;return["("+e+")*("+l+")-("+e+")*("+i+")+("+c+")*("+i+")-("+t+")*("+c+")+("+t+")*("+s+")-("+l+")*("+s+")","("+h+")*("+e+")-("+h+")*("+s+")-("+c+")*("+e+")+("+c+")*("+s+")+("+r+")*("+t+")-("+r+")*("+i+")-("+l+")*("+t+")+("+l+")*("+i+")"]},a},t.A.createPerpendicularSegment=function(e,r,o){var n,a,l,c,d,u={name:""};if(r[0]=e.select(r[0]),r[1]=e.select(r[1]),s.A.isPointType(e,r[0])&&r[1].elementClass===i.A.OBJECT_CLASS_LINE)a=r[1],n=s.A.providePoints(e,[r[0]],u,"point")[0];else{if(!s.A.isPointType(e,r[1])||r[0].elementClass!==i.A.OBJECT_CLASS_LINE)throw new Error("JSXGraph: Can't create perpendicular with parent types '"+typeof r[0]+"' and '"+typeof r[1]+"'.\nPossible parent types: [line,point]");a=r[0],n=s.A.providePoints(e,[r[1]],u,"point")[0]}return d=s.A.copyAttributes(o,e.options,"perpendicularsegment","point"),(c=t.A.createPerpendicularPoint(e,[a,n],d)).dump=!1,s.A.exists(o.layer)||(o.layer=e.options.layer.line),d=s.A.copyAttributes(o,e.options,"perpendicularsegment"),(l=t.A.createLine(e,[function(){return h.A.perpendicular(a,n,e)[1]?[c,n]:[n,c]}],d)).point=c,s.A.exists(n._is_new)?(l.addChild(n),delete n._is_new):n.addChild(l),a.addChild(l),l.elType="perpendicularsegment",l.setParents([n.id,a.id]),l.subs={point:c},l.inherits.push(c),l},t.A.createMidpoint=function(t,e,r){var n,a,h,l,c;for(l=0;l=3&&s.A.isPoint(e[0])&&s.A.isPoint(e[1])&&s.A.isPoint(e[2])))throw new 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]");for(a=e[0],h=e[1],l=e[2],n=t.create("point",[function(){var e,s,r;return e=o.A.hypot(h.X()-l.X(),h.Y()-l.Y()),s=o.A.hypot(a.X()-l.X(),a.Y()-l.Y()),r=o.A.hypot(h.X()-a.X(),h.Y()-a.Y()),new u.A(i.A.COORDS_BY_USER,[(e*a.X()+s*h.X()+r*l.X())/(e+s+r),(e*a.Y()+s*h.Y()+r*l.Y())/(e+s+r)],t)}],r),c=0;c<3;c++)s.A.exists(e[c]._is_new)?(n.addChild(e[c]),delete e[c]._is_new):e[c].addChild(n);return n.elType="incenter",n.setParents(e),n},t.A.createCircumcircle=function(e,i,r){var o,n,a,h;if(!1===(i=s.A.providePoints(e,i,{name:""},"point")))throw new Error("JSXGraph: Can't create circumcircle with parent types '"+typeof i[0]+"', '"+typeof i[1]+"' and '"+typeof i[2]+"'.\nPossible parent types: [point,point,point]");try{for(a=s.A.copyAttributes(r,e.options,"circumcircle","center"),(o=t.A.createCircumcenter(e,i,a)).dump=!1,s.A.exists(r.layer)||(r.layer=e.options.layer.circle),a=s.A.copyAttributes(r,e.options,"circumcircle"),(n=t.A.createCircle(e,[o,i[0]],a)).elType="circumcircle",n.setParents(i),n.subs={center:o},n.inherits.push(n),h=0;h<3;h++)s.A.exists(i[h]._is_new)?(n.addChild(i[h]),delete i[h]._is_new):i[h].addChild(n)}catch(t){throw new Error("JSXGraph: Can't create circumcircle with parent types '"+typeof i[0]+"', '"+typeof i[1]+"' and '"+typeof i[2]+"'.\nPossible parent types: [point,point,point]")}return n},t.A.createIncircle=function(e,i,r){var n,a,h,l;if(!1===(i=s.A.providePoints(e,i,{name:""},"point")))throw new Error("JSXGraph: Can't create circumcircle with parent types '"+typeof i[0]+"', '"+typeof i[1]+"' and '"+typeof i[2]+"'.\nPossible parent types: [point,point,point]");try{for(l=s.A.copyAttributes(r,e.options,"incircle","center"),(a=t.A.createIncenter(e,i,l)).dump=!1,s.A.exists(r.layer)||(r.layer=e.options.layer.circle),l=s.A.copyAttributes(r,e.options,"incircle"),(h=t.A.createCircle(e,[a,function(){var t=o.A.hypot(i[1].X()-i[2].X(),i[1].Y()-i[2].Y()),e=o.A.hypot(i[0].X()-i[2].X(),i[0].Y()-i[2].Y()),s=o.A.hypot(i[1].X()-i[0].X(),i[1].Y()-i[0].Y()),r=(t+e+s)/2;return Math.sqrt((r-t)*(r-e)*(r-s)/r)}],l)).elType="incircle",h.setParents(i),n=0;n<3;n++)s.A.exists(i[n]._is_new)?(h.addChild(i[n]),delete i[n]._is_new):i[n].addChild(h);h.center=a,h.subs={center:h.center},h.inherits.push(a)}catch(t){throw new Error("JSXGraph: Can't create circumcircle with parent types '"+typeof i[0]+"', '"+typeof i[1]+"' and '"+typeof i[2]+"'.\nPossible parent types: [point,point,point]")}return h},t.A.createReflection=function(e,r,o){var n,a,h,l,c,d,u,p,f="\nPossible parent types: [point|line|curve|polygon|circle|arc|sector, line]";for(d=0;de[2]&&(r=e[2]-s),r+t.usrCoords[1]},function(){var t=new u.A(i.A.COORDS_BY_SCREEN,[0,this.evalVisProp("offset.1")+this.board.origin.scrCoords[2]],this.board,!1),e=this.board.getBoundingBox(),s=.1*(e[1]-e[3]),r=g.Y();return r>e[1]?r=e[1]-s:r=o.A.eps?h.A.perpendicular(e[0],u,t)[0].usrCoords:u.coords.usrCoords)[1]+p[1]*d,u[2]-p[0]*d],r=[1,u[1]-f[1]*d,u[2]+f[0]*d],this.dataX=[s[1],s[1]+p[0]*n,r[1]+f[0]*n,r[1],s[1]],this.dataY=[s[2],s[2]+p[1]*n,r[2]+f[1]*n,r[2],s[2]]};else if(e[0].elementClass===i.A.OBJECT_CLASS_CURVE&&"functiongraph"===e[0].visProp.curvetype)(a=t.create("curve",[[],[]],l)).updateDataArray=function(){var t,i,s,r,o,n,a,h,l,c,d=this.board.getBoundingBox(),u=[],p=1/0,f=-1/0,A=e[0].minX(),_=e[0].maxX(),m=1*(d[1]-d[3]);if(t=this.evalVisProp("inverse")?1:3,this.dataX=[],this.dataY=[],0!==(r=e[0].points.length))for(d[1]+=m,d[3]-=m,s=-1;s=r)break;for(o=i,s=r-1;o_?_:d[2],a=0===i?a:Math.max(a,l),h=s===r-1?h:Math.min(h,c),h=s===r-1?_:c,(u=[]).push([1,a=0===i?A:l,d[t]]),u.push([1,a,e[0].points[i].usrCoords[2]]),o=i;o<=s;o++)n=e[0].points[o].usrCoords,u.push(e[0].points[o].usrCoords),p=n[2]f?n[2]:f;for(u[0][2]=1===t?f+m:p-m,u.push([1,h,e[0].points[s].usrCoords[2]]),u.push([1,h,d[t]]),u.push(u[0]),o=0;o2||l.length>=1&&"axis"!==l[0].elType||l.length>=2&&"axis"!==l[1].elType)throw new Error("JSXGraph: Can't create 'grid' with parent type '"+r[0].elType+"'. Possible parent types: [axis,axis]");return!s.A.exists(l[0])&&s.A.exists(e.defaultAxes)&&(l[0]=e.defaultAxes.x),!s.A.exists(l[1])&&s.A.exists(e.defaultAxes)&&(l[1]=e.defaultAxes.y),f=function(t,e,i,s,r,o,n){var a,h,l,c,d,u,p;switch(t.toLowerCase()){case".":case"point":return e.visProp.linecap="round",e.visProp.strokewidth=r*e.board.unitX+o*e.board.unitY,[[i,i,NaN],[s,s,NaN]];case"o":case"circle":return e.visProp.linecap="square",e.bezierDegree=3,[[i+r,i+r,i+(h=4*Math.tan(Math.PI/8)/3)*r,i,i-h*r,i-r,i-r,i-r,i-h*r,i,i+h*r,i+r,i+r,NaN],[s,s+h*o,s+o,s+o,s+o,s+h*o,s,s-h*o,s-o,s-o,s-o,s-h*o,s,NaN]];case"regpol":case"regularpolygon":for(e.visProp.linecap="round",c=e.evalVisProp("polygonvertices"),d=[[],[]],a=0;a<=2*Math.PI;a+=2*Math.PI/c)d[0].push(i-r*Math.sin(a)),d[1].push(s-o*Math.cos(a));return d[0].push(NaN),d[1].push(NaN),d;case"[]":case"square":return e.visProp.linecap="square",[[i-r,i+r,i+r,i-r,i-r,NaN],[s+o,s+o,s-o,s-o,s+o,NaN]];case"<>":case"diamond":return e.visProp.linecap="square",[[i,i+r,i,i-r,i,NaN],[s+o,s,s-o,s,s+o,NaN]];case"<<>>":case"diamond2":return e.visProp.linecap="square",[[i,i+(u=r*Math.sqrt(2)),i,i-u,i,NaN],[s+(p=o*Math.sqrt(2)),s,s-p,s,s+p,NaN]];case"x":case"cross":return[[i-r,i+r,NaN,i-r,i+r,NaN],[s+o,s-o,NaN,s-o,s+o,NaN]];case"+":case"plus":return[[i-r,i+r,NaN,i,i,NaN],[s,s,NaN,s-o,s+o,NaN]];case"-":case"minus":return[[i-r,i+r,NaN],[s,s,NaN]];case"|":case"divide":return[[i,i,NaN],[s-o,s+o,NaN]];case"^":case"a":case"A":case"triangleup":return[[i-r,i,i+r,NaN],[s-o,s,s-o,NaN]];case"v":case"triangledown":return[[i-r,i,i+r,NaN],[s+o,s,s+o,NaN]];case"<":case"triangleleft":return[[i+r,i,i+r,NaN],[s+o,s,s-o,NaN]];case">":case"triangleright":return[[i-r,i,i-r,NaN],[s+o,s,s-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,s,s,NaN]];default:return[[],[]]}},c=s.A.copyAttributes(n,e.options,"grid"),s.A.mergeAttr(c,c.themes[c.theme],!1),d={},s.A.mergeAttr(d,c,!0,!0),s.A.mergeAttr(d,c.major,!0,!0),(a=e.create("curve",[[null],[null]],d)).elType="grid",a.type=i.A.OBJECT_TYPE_GRID,u={},s.A.mergeAttr(u,c,!0,!0),s.A.mergeAttr(u,c.minor,!0,!0),u.id===d.id&&(u.id=a.id+"_minor"),u.name===d.name&&(u.name=a.name+"_minor"),(h=e.create("curve",[[null],[null]],u)).elType="grid",h.type=i.A.OBJECT_TYPE_GRID,a.minorGrid=h,h.majorGrid=a,a.hasPoint=function(){return!1},h.hasPoint=function(){return!1},a.inherits.push(h),a.updateDataArray=function(){var e,i,r,n,h,c,d,u,b=this.board.getBoundingBox(),v=this.evalVisProp("gridx"),y=this.evalVisProp("gridy"),C=this.evalVisProp("face"),P=this.evalVisProp("drawzero"),E=!0===P||s.A.isObject(P)&&!0===this.eval(P.origin),x=!0===P||s.A.isObject(P)&&!0===this.eval(P.x),O=!0===P||s.A.isObject(P)&&!0===this.eval(P.y),M=this.evalVisProp("includeboundaries"),w=this.evalVisProp("forcesquare");if(this.dataX=[],this.dataY=[],p=this.evalVisProp("majorstep"),s.A.isArray(p)||(p=[p,p]),p.length<2&&(p=[p[0],p[0]]),s.A.exists(v)&&(t.A.deprecated("gridX","majorStep"),p[0]=v),s.A.exists(y)&&(t.A.deprecated("gridY","majorStep"),p[1]=y),"auto"===p[0]?(u=Math.pow(10,Math.floor(Math.log(50/this.board.unitX)/Math.LN10)),p[0]=u,s.A.exists(l[0])&&(p[0]=l[0].ticks[0].getDistanceMajorTicks())):p[0]=s.A.parseNumber(p[0],Math.abs(b[1]-b[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,s.A.exists(l[1])&&(p[1]=l[1].ticks[0].getDistanceMajorTicks())):p[1]=s.A.parseNumber(p[1],Math.abs(b[0]-b[2]),1/this.board.unitY),"min"===w||!0===w?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"===w&&(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),m=this.evalVisProp("size"),s.A.isArray(m)||(m=[m,m]),m.length<2&&(m=[m[0],m[0]]),s.A.isNumber(m[0],!0)&&(m[0]=m[0]+"px"),s.A.isNumber(m[1],!0)&&(m[1]=m[1]+"px"),m[0]=s.A.parseNumber(m[0],p[0],1/this.board.unitX),m[1]=s.A.parseNumber(m[1],p[1],1/this.board.unitY),g[0]=m[0]/2,g[1]=m[1]/2,e=o.A.roundToStep(b[0],p[0]),i=o.A.roundToStep(b[1],p[1]),d=isFinite(e)&&isFinite(i)&&isFinite(b[2])&&isFinite(b[3])&&Math.abs(b[2])=b[3];n-=p[1])!E&&Math.abs(n)=b[1]-g[1])||(c=[[b[0]-h/a.board.unitX,b[2]+h/a.board.unitX,NaN],[n,n,NaN]],s.A.concat(this.dataX,c[0]),s.A.concat(this.dataY,c[1]));for(r=e;d&&r<=b[2];r+=p[0])!E&&Math.abs(r)=b[2]-g[0])||(c=[[r,r,NaN],[b[1]+h/a.board.unitY,b[3]-h/a.board.unitY,NaN]],s.A.concat(this.dataX,c[0]),s.A.concat(this.dataY,c[1]))}else for(n=i;d&&n>=b[3];n-=p[1])for(r=e;d&&r<=b[2];r+=p[0])!E&&Math.abs(n)=A||!O&&Math.abs(r)=A||!M&&(r<=b[0]+g[0]||r>=b[2]-g[0]||n<=b[3]+g[1]||n>=b[1]-g[1])||(c=f(C,a,r,n,g[0],g[1],b),s.A.concat(this.dataX,c[0]),s.A.concat(this.dataY,c[1]))},h.updateDataArray=function(){var t,e,i,r,n,a,c,d,u,m,b,v,y,C,P,E,x,O,M,w=this.board.getBoundingBox(),S=[],T=[],N=this.evalVisProp("minorelements"),D=this.evalVisProp("size"),k=this.evalVisProp("face"),L=this.evalVisProp("drawzero"),R=!0===L||s.A.isObject(L)&&!0===this.eval(L.x),B=!0===L||s.A.isObject(L)&&!0===this.eval(L.y),I=this.majorGrid.evalVisProp("face"),j=this.majorGrid.evalVisProp("drawzero"),Y=!0===j||s.A.isObject(j)&&!0===this.eval(j.origin),V=!0===j||s.A.isObject(j)&&!0===this.eval(j.x),X=!0===j||s.A.isObject(j)&&!0===this.eval(j.y),U=this.evalVisProp("includeboundaries");if(this.dataX=[],this.dataY=[],s.A.isArray(N)||(N=[N,N]),N.length<2&&(N=[N[0],N[0]]),s.A.isNumber(N[0],!0)?N[0]=parseFloat(N[0]):(N[0]=3,s.A.exists(l[0])&&(N[0]=l[0].eval(l[0].getAttribute("ticks").minorticks))),S[0]=p[0]/(N[0]+1),s.A.isNumber(N[1],!0)?N[1]=parseFloat(N[1]):(N[1]=3,s.A.exists(l[1])&&(N[1]=l[1].eval(l[1].getAttribute("ticks").minorticks))),S[1]=p[1]/(N[1]+1),s.A.isArray(D)||(D=[D,D]),D.length<2&&(D=[D[0],D[0]]),s.A.isNumber(D[0],!0)&&(D[0]=D[0]+"px"),s.A.isNumber(D[1],!0)&&(D[1]=D[1]+"px"),D[0]=s.A.parseNumber(D[0],S[0],1/this.board.unitX),D[1]=s.A.parseNumber(D[1],S[1],1/this.board.unitY),T[0]=.5*D[0],T[1]=.5*D[1],t=o.A.roundToStep(w[0],S[0]),e=o.A.roundToStep(w[1],S[1]),c=isFinite(t)&&isFinite(e)&&isFinite(w[2])&&isFinite(w[3])&&Math.abs(w[2])<=Math.abs(S[0]*_)&&Math.abs(w[3])=w[3];r-=S[1])for(i=t;c&&i<=w[2];i+=S[0]){if(d=o.A.roundToStep(Math.abs(i),p[0]),d=Math.abs(d-Math.abs(i)),u=p[0]-d,m=o.A.roundToStep(Math.abs(r),p[1]),m=Math.abs(m-Math.abs(r)),b=p[1]-m,"line"===I){if(d-T[0]-g[0]=w[3];r-=S[1]){if(m=o.A.roundToStep(Math.abs(r),p[1]),m=Math.abs(m-Math.abs(r)),b=p[1]-m,"line"===I){if(m-T[1]-g[1]=-(a=l)&&r-this.size[0]<=a&&n>=-a&&n-this.size[1]<=a):(d=[(c=(c=new u.A(i.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<=(p=(f=o.A.innerProduct)(d,this.span[1]))&&p<=f(this.span[1],this.span[1])&&0<=(p=f(d,this.span[2]))&&p<=f(this.span[2],this.span[2]))},update:function(t){return this.needsUpdate?(this.updateCoords(t),this.updateSize(),this.updateSpan(),this):this},updateRenderer:function(){return this.updateRendererGeneric("updateImage")},updateSize:function(){return this.usrSize=[this.W(),this.H()],this.size=[Math.abs(this.usrSize[0]*this.board.unitX),Math.abs(this.usrSize[1]*this.board.unitY)],this},updateSpan:function(){var t,e,i=this.transformations.length,s=[];if(0===i)this.span=[[this.Z(),this.X(),this.Y()],[this.Z(),this.W(),0],[this.Z(),0,this.H()]];else{for(s[0]=[this.Z(),this.X(),this.Y()],s[1]=[this.Z(),this.X()+this.W(),this.Y()],s[2]=[this.Z(),this.X(),this.Y()+this.H()],t=0;to.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},C&&(b=t.create("text",[function(){return.05*(f.X()-p.X())+f.X()},function(){return.05*(f.Y()-p.Y())+f.Y()},function(){var t,e=A.evalVisProp("digits"),i=A.evalVisProp("suffixlabel"),r=A.evalVisProp("unitlabel"),o=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+=s.A.toFixed(A.Value(),e),null!==r&&(t+=r),null!==o&&(t+=o),t}],S.label),A.label=b,A.visProp.withlabel=!0,A.hasLabel=!0,A.inherits.push(b),b.addParents(A),A.addChild(b)),A.point1=p,A.point2=f,A.baseline=_,A.highline=m,P&&(s.A.exists(S.generatelabeltext)||(S.ticks.generateLabelText=function(t,e,i){var s=A.point1.Dist(A.point2),r=A._smin,n=A._smax,a=this.getDistanceFromZero(e,t)*(n-r)/s+r;return s=0&&(c="",3===t.length&&s.A.isString(t[2])&&(c=t[2].toLowerCase()),n=""===c?t[1].type===i.A.OBJECT_TYPE_ANGLE?0:1:0===c.indexOf("len")?1:0))}return n},toPrefix:function(t){var e,i,r,o;if(s.A.isNumber(t))return t;if(!s.A.isArray(t)||t.length<2)throw new Error("PrefixParser.toPrefix: term is not an array");for(e=t[0],r=t.length,o=[e],i=1;i1&&s.A.concat(o,this.getParents(t[i])):o.push(t[i]);return o}};var J=t.A.PrefixParser;t.A.createTapemeasure=function(t,e,i){var r,o,n,a,h,l,c,d,u,p;return r=e[0],o=e[1],n=s.A.copyAttributes(i,t.options,"tapemeasure","point1"),c=t.create("point",r,n),n=s.A.copyAttributes(i,t.options,"tapemeasure","point2"),d=t.create("point",o,n),c.setAttribute({ignoredSnapToPoints:[d.id]}),d.setAttribute({ignoredSnapToPoints:[c.id]}),n=s.A.copyAttributes(i,t.options,"tapemeasure"),a=n.withticks,h=n.withlabel,2===n.digits&&2!==n.precision&&n.precision,h&&(n.withlabel=!0),l=t.create("segment",[c,d],n),h&&(u=i.name&&""!==i.name?i.name+" = ":"",l.label.setText(function(){var t=l.label.evalVisProp("digits");return l.label.useLocale()?u+l.label.formatNumberLocale(c.Dist(d),t):u+s.A.toFixed(c.Dist(d),t)})),a&&(n=s.A.copyAttributes(i,t.options,"tapemeasure","ticks"),p=t.create("ticks",[l,.1],n),l.inherits.push(p)),l.remove=function(){a&&l.removeTicks(p),t.removeObject(d),t.removeObject(c),Y.A.prototype.remove.call(this)},l.Value=function(){return c.Dist(d)},c.dump=!1,d.dump=!1,l.elType="tapemeasure",l.getParents=function(){return[[c.X(),c.Y()],[d.X(),d.Y()]]},l.subs={point1:c,point2:d},a&&(p.dump=!1),l.prepareUpdate().update(),t.isSuspendedUpdate||(l.updateVisibility().updateRenderer(),l.point1.updateVisibility().updateRenderer(),l.point2.updateVisibility().updateRenderer()),s.A.extendInstanceMethodMap(l,{Value:"Value"}),l},t.A.registerElement("tapemeasure",t.A.createTapemeasure),t.A.createMeasurement=function(t,e,i){var r,o,n,a,h,l;for(o=s.A.copyAttributes(i,t.options,"measurement"),n=e[0],a=e[1],h=e[2],(r=t.create("text",[n,a,""],o)).type=s.A.OBJECT_TYPE_MEASUREMENT,r.elType="measurement",r.Value=function(){return J.parse(h,"execute")},r.Dimension=function(){var t=r.evalVisProp("dim");return null!==t?t:J.dimension(h)},r.Unit=function(t){var e,i="",o=r.evalVisProp("units"),n=t,a={};if(s.A.exists(n)||(n=r.Dimension()),s.A.isArray(t)){for(e=0;e1&&""!==i&&(i=i+"^{"+n+"}")),i},r.getTerm=function(){return h},r.getMethod=function(){var t=h[0];return"V"===t&&(t="Value"),t},r.toPrefix=function(){return J.toPrefix(h)},r.getParents=function(){return J.getParents(h)},r.addParents(r.getParents()),l=0;lt&&(i[e]=parseFloat(this.data[e][t]));return i},getRow:function(t){var e,i;if(s.A.isString(t))for(i=0;i=0?"left":"right"},f.anchorY="middle",n=t.create("text",[d,l,p.labels[o]],f))):(_[0]=t.create("point",[h,0],g),_[1]=t.create("point",[h,d],g),_[2]=t.create("point",[c,d],g),_[3]=t.create("point",[c,0],g),s.A.exists(p.labels)&&s.A.exists(p.labels[o])&&(f.anchorX="middle",f.anchorY=function(t){return t.Y()>=0?"bottom":"top"},n=t.create("text",[l,d,p.labels[o]],f))),s.A.isArray(p.colors)&&(u=p.colors,p.fillcolor=u[o%u.length]),A[o]=t.create("polygon",_,p),s.A.exists(p.labels)&&s.A.exists(p.labels[o])&&(A[o].text=n,A[o].addChild(n));return A},drawPoints:function(t,e,i,s){var r,o=[],n=s.infoboxarray;for(s.fixed=!0,s.name="",r=0;rc[a]&&(c[a]=r[n][a]),r[n][a]0&&i.length<=2&&(this.evalParam=s.A.createEvalFunction(t,i,1),2!==i.length||s.A.isArray(i[1])||(i[1]=t.select(i[1]))),this.update=function(){var t,e,r=this.evalParam(0),o=Math.cos(r),n=Math.sin(r);this.matrix[1][1]=o,this.matrix[1][2]=-n,this.matrix[2][1]=n,this.matrix[2][2]=o,i.length>1&&(3===i.length?(t=this.evalParam(1),e=this.evalParam(2)):s.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-o)+e*n,this.matrix[2][0]=e*(1-o)-t*n)};else if("shear"===e){if(2!==i.length)throw new Error("JSXGraph: shear transformation needs 2 parameters.");this.evalParam=s.A.createEvalFunction(t,i,2),this.update=function(){this.matrix[1][2]=this.evalParam(0),this.matrix[2][1]=this.evalParam(1)}}else if("affine"===e){if(4!==i.length)throw new Error("JSXGraph: affine transformation needs 4 parameters.");this.evalParam=s.A.createEvalFunction(t,i,9),this.update=function(){this.matrix[1][1]=this.evalParam(0),this.matrix[1][2]=this.evalParam(1),this.matrix[2][1]=this.evalParam(2),this.matrix[2][2]=this.evalParam(3)}}else if("affinematrix"===e){if(1!==i.length)throw new Error("JSXGraph: transformation of type 'matrix' needs 1 parameter.");this.evalParam=i[0].slice(),this.update=function(){var t,e;for(t=0;t<2;t++)for(e=0;e<2;e++)this.matrix[t+1][e+1]=s.A.evaluate(this.evalParam[t][e])}}else if("generic"===e){if(9!==i.length)throw new Error("JSXGraph: generic transformation needs 9 parameters.");this.evalParam=s.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)return;if(1!==i.length)throw new 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]=s.A.evaluate(this.evalParam[t][e])}}this.transformationType=e},setMatrix3D:function(t,e,i){var r,n=t.board;for(this.isNumericMatrix=!0,r=0;r0&&i[i.length-1].isNumericMatrix&&this.isNumericMatrix?i[i.length-1].melt(this):(r=this.clone(),i.push(r))},clone:function(){var e=null;return this.update(),this.isNumericMatrix&&((e=new t.A.Transformation(this.board,"none",[])).matrix=this.matrix.slice(),e.transformationType=this.transformationType),e},setProperty:function(e){t.A.deprecated("Transformation.setProperty()","Transformation.setAttribute()")},setAttribute:function(t){},melt:function(t){var e;return this.update(),t.update(),e=o.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}}),t.A.createTransform=function(e,i,s){return new t.A.Transformation(e,s.type,i)},t.A.registerElement("transform",t.A.createTransform),t.A.createTransform3D=function(e,i,s){return new t.A.Transformation(e,s.type,i,!0)},t.A.registerElement("transform3d",t.A.createTransform3D);t.A.Transformation;t.A.Turtle=function(t,e,r){var o,n,a;return this.constructor(t,r,i.A.OBJECT_TYPE_TURTLE,i.A.OBJECT_CLASS_OTHER),this.turtleIsHidden=!1,this.board=t,this.visProp.curveType="plot",this._attributes=s.A.copyAttributes(this.visProp,t.options,"turtle"),delete this._attributes.id,o=0,n=0,a=90,0!==e.length&&(3===e.length?(o=s.A.evaluate(e[0]),n=s.A.evaluate(e[1]),a=s.A.evaluate(e[2])):2===e.length?s.A.isArray(e[0])?(o=e[0][0],n=e[0][1],a=e[1]):(o=s.A.evaluate(e[0]),n=s.A.evaluate(e[1])):(o=e[0][0],n=e[0][1])),this.init(o,n,a),this},t.A.Turtle.prototype=new Y.A,s.A.copyMethodMap(t.A.Turtle,{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"}),t.A.extend(t.A.Turtle.prototype,{init:function(t,e,i){var s={fixed:!0,name:"",visible:!1,withLabel:!1};this.arrowLen=20/o.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,s),this.objects.push(this.turtle),this.turtle2=this.board.create("point",[this.pos[0],this.pos[1]+this.arrowLen],s),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),s=t*Math.sin(this.dir*Math.PI/180);return this.turtleIsHidden||((e=this.board.create("transform",[i,s],{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]+=s,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){(this.dir-=t,this.dir%=360,this.turtleIsHidden)||this.board.create("transform",[-t*Math.PI/180,this.turtle],{type:"rotate"}).applyOnce(this.turtle2);return 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=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 s,r,o,n,a=this.objects.length;for(s=0,r=0;s=1||Math.abs(n[1][0]-n[1][1])>=1))if(0===this.line.stdform[1]){if(Math.abs(e-this.line.point1.coords.scrCoords[2])<2*a&&n[0][0]-ao.A.eps?(r=h.usrCoords[1]/a.usrCoords[1],l[0]*=r,l[2]*=r,this.board.setBoundingBox(l,this.board.keepaspectratio,"update")):Math.abs(this.line.stdform[2])o.A.eps&&(n=h.usrCoords[2]/a.usrCoords[2],l[3]*=n,l[1]*=n,this.board.setBoundingBox(l,this.board.keepaspectratio,"update")),this):this},calculateTicksCoordinates:function(){var t,e,s,r;if(!(this.line.elementClass===i.A.OBJECT_CLASS_LINE&&(this.setTicksSizeVariables(),Math.abs(this.dx)=o.A.eps&&c.scrCoords[1]>=0&&c.scrCoords[1]<=this.board.canvasWidth&&c.scrCoords[2]>=0&&c.scrCoords[2]<=this.board.canvasHeight,f=Math.abs(d.usrCoords[0])>=o.A.eps&&d.scrCoords[1]>=0&&d.scrCoords[1]<=this.board.canvasWidth&&d.scrCoords[2]>=0&&d.scrCoords[2]<=this.board.canvasHeight,s.A.exists(e)&&"ticksdistance"===e?(h.A.calcStraight(this.line,c,d,0),v=this.getDistanceFromZero(t,c),y=this.getDistanceFromZero(t,d),h.A.calcStraight(this.line,c,d,this.line.evalVisProp("margin")),v=this.getDistanceFromZero(t,c)-v,y=this.getDistanceFromZero(t,d).m2):h.A.calcLineDelimitingPoints(this.line,c,d),a=this.line.evalVisProp("firstarrow"),l=this.line.evalVisProp("lastarrow"),g=this.getDistanceFromZero(t,c),b=this.getDistanceFromZero(t,d),(a||l)&&(m=this.board.renderer.getArrowHeadData(this.line,this.line.evalVisProp("strokewidth"),""),this.board.renderer.getPositionArrowHead(this.line,c,d,m)),(A=this.getDistanceFromZero(t,c))<(_=this.getDistanceFromZero(t,d))?(r=A,n=_,P||!p||x||(r+=C),E||!f||x||(n-=C)):_2048*a)t.A.warn("JSXGraph ticks: too many ticks (>2048). Please increase ticksDistance.");else{for(r=0,this.evalVisProp("drawzero")||(r=a),r=s.lower-h&&this.processTickPosition(e,r,a,n),r+=a,!(s.upper-r>1e4*a)););for((r=-a)>s.upper&&(r=Math.ceil((s.upper+h)/-a)*-a);r>=s.lower-h&&(r<=s.upper+h&&this.processTickPosition(e,r,a,n),!((r-=a)-s.lower>1e4*a)););}},getDistanceMajorTicks:function(){var t,e,i,s,r,n,a,h;return this.evalVisProp("insertticks")?(n=((i=this.getLowerAndUpperBounds(this.getZeroCoordinates(),"")).upper-i.lower)/6/(r=this.evalVisProp("scale")),a=this.evalVisProp("minticksdistance")/r,h=this.evalVisProp("minorticks"),(s=this.getXandYdeltas()).x*=this.board.unitX,s.y*=this.board.unitY,a/=o.A.hypot(s.x,s.y),a*=h+1,2*(t=Math.pow(10,Math.floor(Math.log(a)/Math.LN10)))>=a?t*=2:5*t>=a&&(t*=5),5*(e=Math.pow(10,Math.floor(Math.log(n)/Math.LN10)))=e.lower-f&&d<=e.upper+f&&(this.ticks.push(h),_&&(A||s.A.exists(this.visProp.labels[a]))?(n=A?this.evalVisProp("labels."+a):d,this.labelsData.push(this.generateLabelData(this.generateLabelText(r,t,n),r,a))):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 s=this.board.canvasWidth,r=this.board.canvasHeight;return void 0===i&&(i=0),t[0]>=i&&t[0]<=s-i&&e[0]>=i&&e[0]<=r-i||t[1]>=i&&t[1]<=s-i&&e[1]>=i&&e[1]<=r-i},createTickPath:function(t,e){var i,s,r,n,a,l,c,d,u,p,f,A,_,m,g,b,v,y=[-2e6,-2e6],C=[-2e6,-2e6];if(i=t.scrCoords,e?(n=this.dxMaj,a=this.dyMaj,u=this.majStyle,g=this.evalVisProp("majortickendings.0")>0,b=this.evalVisProp("majortickendings.1")>0):(n=this.dxMin,a=this.dyMin,u=this.minStyle,g=this.evalVisProp("tickendings.0")>0,b=this.evalVisProp("tickendings.1")>0),s=[-a*i[1]-n*i[2],a,n],e&&"polar"===this.evalVisProp("type")){if(A=this.board.getBoundingBox(),m=(_=2*Math.PI)/180,i=t.usrCoords,(f=o.A.hypot(i[1],i[2]))0)return[];v[0]>0?(y[0]=i[1],C[0]=i[2],y[1]=r[1].scrCoords[1],C[1]=r[1].scrCoords[2]):(y[0]=r[0].scrCoords[1],C[0]=r[0].scrCoords[2],y[1]=r[1].scrCoords[1],C[1]=r[1].scrCoords[2])}}else d=">"===this.evalVisProp("face")?Math.PI/4:"<"===this.evalVisProp("face")?-Math.PI/4:0,l=Math.cos(d)*n-Math.sin(d)*a,c=Math.sin(d)*n+Math.cos(d)*a,y[0]=i[1]+l*g,C[0]=i[2]-c*g,y[1]=i[1],C[1]=i[2],d=-d,l=Math.cos(d)*n-Math.sin(d)*a,c=Math.sin(d)*n+Math.cos(d)*a,y[2]=i[1]-l*b,C[2]=i[2]+c*b;if(!this.evalVisProp("clip")||this._isInsideCanvas(y,C))return[y,C,e]}return[]},formatLabelText:function(t){var e,i,r=this.evalVisProp("label.usemathjax"),o=this.evalVisProp("label.usekatex"),n=this.evalVisProp("scalesymbol");return s.A.isNumber(t)?(this.evalVisProp("label.tofraction")?e=r?"\\("+s.A.toFraction(t,!0)+"\\)":s.A.toFraction(t,o):(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(),n.length>0&&("1"===e?e=n:"-1"===e?e="-"+n:"0"!==e&&(e+=n)),this.evalVisProp("useunicodeminus")&&(e=e.replace(/-/g,"−")),e},beautifyScientificNotationLabel:function(t){return-1===t.indexOf("e")?t:(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,"¹").replace(/2/g,"²").replace(/3/g,"³").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(!s.A.exists(i)){if(r=this.getDistanceFromZero(e,t),Math.abs(r)>=1)&&(t=1&(f=C()),f=f>>1|128)}catch(t){throw console.log("Probably problems on iOS7 with >>"),t}return t}function x(t){var e=0,i=t;try{for(;i--;)e=e<<1|E();t&&(e=W[e]>>8-t)}catch(t){throw console.log("Probably problems on iOS7 with >>"),t}return e}function O(){c=0}function M(t){l[c++]=t,n.push(String.fromCharCode(t)),32768===c&&(c=0)}function w(){this.b0=0,this.b1=0,this.jump=null,this.jumppos=-1}function S(){for(;;){if(v[b]>=o)return-1;if(r[v[b]]===b)return v[b]++;v[b]++}}function T(){var t,e=g[m];if(17===b)return-1;if(m++,b++,(t=S())>=0)e.b0=t;else if(e.b0=32768,T())return-1;if((t=S())>=0)e.b1=t,e.jump=null;else if(e.b1=32768,e.jump=g[m],e.jumppos=m,T())return-1;return b--,0}function N(t,e,i,s){var n;for(g=t,m=0,r=i,o=e,n=0;n<17;n++)v[n]=0;return b=0,T()?-1:0}function D(t){for(var e,i,s=0,r=t[s];;)if(E()){if(!(32768&r.b1))return r.b1;for(r=r.jump,e=t.length,i=0;i>1)>23?(r=r<<1|E())>199?r=(r-=128)<<1|E():(r-=48)>143&&(r+=136):r+=256,r<256)M(r);else{if(256===r)break;for(h=x($[r-=257])+H[r],r=W[x(5)]>>3,q[r]>8?(u=x(8),u|=x(q[r]-8)<<8):u=x(q[r]),u+=K[r],r=0;rf)return O(),1;for(o=s?n[s-1]:0;r--;)n[s++]=o}else{if(s+(r=17===r?3+x(3):11+x(7))>f)return O(),1;for(;r--;)n[s++]=0}for(h=A.length,s=0;s=256){if(0===(r-=256))break;for(h=x($[r-=1])+H[r],r=D(_),q[r]>8?(u=x(8),u|=x(q[r]-8)<<8):u=x(q[r]),u+=K[r];h--;)M(l[c-u&32767])}else M(r)}}while(!e);return O(),P(),0}function L(){var t,e,r,o,l,c=[];try{if(n=[],d=!1,c[0]=C(),c[1]=C(),120===c[0]&&218===c[1]&&(k(),h[a]=[n.join(""),"geonext.gxt"],a++),31===c[0]&&139===c[1]&&(R(),h[a]=[n.join(""),"file"],a++),80===c[0]&&75===c[1]){if(d=!0,c[2]=C(),c[3]=C(),3===c[2]&&4===c[3]){for(c[0]=C(),c[1]=C(),i=C(),i|=C()<<8,l=C(),l|=C()<<8,C(),C(),C(),C(),C(),C()<<8,C()<<16,C()<<24,C(),C()<<8,C()<<16,C()<<24,C(),C()<<8,C()<<16,C()<<24,o=C(),o|=C()<<8,r=C(),r|=C()<<8,t=0,y=[];o--;)"/"===(e=C())|":"===e?t=0:t<255&&(y[t++]=String.fromCharCode(e));for(s||(s=y),t=0;t>"),t}return!1}function R(){var t,e,s=[];if(8&i&&(s[0]=C(),s[1]=C(),s[2]=C(),s[3]=C(),80===s[0]&&75===s[1]&&7===s[2]&&8===s[3]?(C(),C()<<8,C()<<16,C()<<24):s[0]|s[1]<<8|s[2]<<16|s[3]<<24,C(),C()<<8,C()<<16,C()<<24,C(),C()<<8,C()<<16,C()<<24),d&&L())return!1;if(s[0]=C(),8!==s[0])return!0;if(i=C(),C(),C(),C(),C(),C(),C(),4&i)for(s[0]=C(),s[2]=C(),b=s[0]+256*s[1],t=0;t=2?t.children[1][1].value:a.children[0][0],h=a.children[1]):(h=t.children[1][0],p=["x"],u=t.children[1].length>=2?t.children[1][1].value:"x"),c=h,(f=t.children[1].length>=3?t.children[1][2].value:1)>=1)for(;f>=1;)c=this.derivative(c,u),c=this.removeTrivialNodes(c),f--;l="node_op"==e.type&&"op_assign"==e.value?this.createNode("node_op","op_map",p,c):c,this.setMath(l),t.type=l.type,t.value=l.value,l.children.length>0&&(t.children[0]=l.children[0]),l.children.length>1&&(t.children[1]=l.children[1])}return t},removeTrivialNodes:function(t){var e,i,r,o,n;if(s.A.isArray(t))for(i=t.length,e=0;e0?r.value=1/0:r.value=-1/0,r;if("node_op"==r.type&&"op_neg"==r.value&&"node_op"==o.type&&"op_neg"==o.value)return t.children=[r.children[0],o.children[0]],this.mayNotBeSimplified=!0,t;if("op_neg"==r.value&&"op_neg"!=o.value)return t.type="node_op",t.value="op_neg",t.children=[this.createNode("node_op","op_div",r.children[0],o)],this.mayNotBeSimplified=!0,t;if("op_neg"!=r.value&&"op_neg"==o.value)return t.type="node_op",t.value="op_neg",t.children=[this.createNode("node_op","op_div",r,o.children[0])],this.mayNotBeSimplified=!0,t;if("node_op"==r.type&&"op_exp"==r.value&&(o.hash||(o.hash=this.parser.compile(o)),r.children[0].hash||(r.children[0].hash=this.parser.compile(r.children[0])),o.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"!=o.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],o)],this.mayNotBeSimplified=!0,t;if("node_op"==r.type&&"op_exp"==r.value&&"node_op"==o.type&&"op_exp"==o.value&&(r.children[0].hash=this.parser.compile(r.children[0]),o.children[0].hash=this.parser.compile(o.children[0]),r.children[0].hash===o.children[0].hash))return r.children[1]=this.createNode("node_op","op_sub",r.children[1],o.children[1]),this.mayNotBeSimplified=!0,r;break;case"op_exp":if(r=t.children[0],"node_const"==(o=t.children[1]).type&&0===o.value)return o.value=1,o;if("node_const"==o.type&&1==o.value)return r;if("node_const"==r.type&&1==r.value)return r;if("node_const"==r.type&&0===r.value&&"node_const"==o.type&&0!==o.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],o)],t}switch(t.value){case"op_add":if(r=t.children[0],o=t.children[1],"node_const"==r.type&&"node_const"==o.type&&r.value==o.value)return r.value+=o.value,r;if("node_var"==r.type&&"node_var"==o.type&&r.value==o.value)return t.children[0]=this.createNode("node_const",2),t.value="op_mul",t;if("node_op"==r.type&&"op_neg"==r.value)return t.value="op_sub",t.children[0]=o,t.children[1]=r.children[0],this.mayNotBeSimplified=!0,t;if("node_op"==o.type&&"op_neg"==o.value)return t.value="op_sub",t.children[1]=o.children[0],this.mayNotBeSimplified=!0,t;if("node_op"==r.type&&"op_mul"==r.value&&"node_op"==o.type&&"op_mul"==o.value&&(r.children[1].hash=this.parser.compile(r.children[1]),o.children[1].hash=this.parser.compile(o.children[1]),r.children[1].hash===o.children[1].hash))return t.value="op_mul",t.children=[this.createNode("node_op","op_add",r.children[0],o.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]),o.hash=this.parser.compile(o),r.children[1].hash===o.hash))return t.value="op_mul",t.children=[this.createNode("node_op","op_add",r.children[0],this.createNode("node_const",1)),o],this.mayNotBeSimplified=!0,t;if("node_op"==o.type&&"op_mul"==o.value&&(o.children[1].hash=this.parser.compile(o.children[1]),r.hash=this.parser.compile(r),o.children[1].hash===r.hash))return t.value="op_mul",t.children=[this.createNode("node_op","op_add",this.createNode("node_const",1),o.children[0]),r],this.mayNotBeSimplified=!0,t;break;case"op_sub":if(r=t.children[0],"node_op"==(o=t.children[1]).type&&"op_neg"==o.value)return t.value="op_add",t.children[1]=o.children[0],this.mayNotBeSimplified=!0,t;break;case"op_execfun":return this.simplifyElementary(t)}return t},simplifyElementary:function(t){var e=t.children[0].value,i=t.children[1];if(0==i.length)return t;switch(e){case"sin":case"tan":if("node_const"==i[0].type&&0===i[0].value)return t.type="node_const",t.value=0,t;if("node_var"==i[0].type&&"PI"==i[0].value)return t.type="node_const",t.value=0,t;if("node_op"==i[0].type&&"op_mul"==i[0].value&&"node_const"==i[0].children[0].type&&i[0].children[0].value%1==0&&"node_var"==i[0].children[1].type&&"PI"==i[0].children[1].value)return t.type="node_const",t.value=0,t;break;case"cos":if("node_const"==i[0].type&&0===i[0].value)return t.type="node_const",t.value=1,t;if("node_var"==i[0].type&&"PI"==i[0].value)return t.type="node_op",t.value="op_neg",t.children=[this.createNode("node_const",1)],t;break;case"exp":if("node_const"==i[0].type&&0===i[0].value)return t.type="node_const",t.value=1,t;break;case"pow":if("node_const"==i[1].type&&0===i[1].value)return t.type="node_const",t.value=1,t}return t}});t.A.CA;t.A.Dump={addMarkers:function(t,e,i){var r,o,n;for(r in s.A.isArray(e)||(e=[e]),s.A.isArray(i)||(i=[i]),o=Math.min(e.length,i.length),e.length=o,i.length=o,t.objects)if(t.objects.hasOwnProperty(r))for(n=0;n=0;r--)o=s.A.deepCopy(o,a[r],!0);return!0===this._minimizeSubObject(n,o," ")&&(n={}),n},prepareAttributes:function(e,i){var r,o,n;for(o in n=t.A.Options[i.elType]||{},r=this.minimizeObject(i.getAttributes(),n),i.subs)i.subs.hasOwnProperty(o)&&(r[o]=this.minimizeObject(i.subs[o].getAttributes(),n[o],t.A.Options[i.subs[o].elType]||{}),r[o].id=i.subs[o].id,r[o].name=i.subs[o].name);return s.A.exists(r.label)&&(n=t.A.Options.label||{},r.label=this.minimizeObject(r.label,n),s.A.isEmpty(r.label)&&delete r.label),s.A.exists(r.layer)&&(n=t.A.Options.layer||{},r.layer===n[i.elType]&&delete r.layer),s.A.exists(r.draft)&&!1===r.draft&&delete r.draft,r.id=i.id,r.name=i.name,r},setBoundingBox:function(t,e,i){return t.push({obj:i,method:"setBoundingBox",params:[e.getBoundingBox(),e.keepaspectratio]}),t},dump:function(t,e){var i,r,o,n,a=[],h=[],l=t.objectsList.length;for(this.addMarkers(t,"dumped",!1),i=0;i> "}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,e){var i,s,r,o,n=this.dump(t),a=[];if(n.methods=this.setBoundingBox(n.methods,t,"$board"),r=n.elements,!0===e)for(i=0;i0&&a.push("// "+r[i].attributes.name),a.push("s"+i+" = "+r[i].type+"("+r[i].parents.join(", ")+") "+this.toJCAN(r[i].attributes).replace(/\n/,"\\n")+";"),"axis"===r[i].type&&(o=r[i].attributes.id,null===t.objects[o].defaultTicks&&a.push("s"+i+".removeAllTicks();")),a.push("");for(i=0;i1)h=s.A.copyAttributes(r,e.options,"comb","point1"),o=e.create("point",i[0],h);else if(s.A.isString(i[0])||s.A.isPoint(i[0]))o=e.select(i[0]);else if(s.A.isFunction(i[0])&&s.A.isPoint(i[0]()))o=i[0]();else{if(!(s.A.isFunction(i[0])&&i[0]().length&&i[0]().length>=2))throw new Error("JSXGraph: Can't create comb with parent types '"+typeof i[0]+"' and '"+typeof i[1]+"'.\nPossible parent types: [point,point], [[x1,y1],[x2,y2]]");h=s.A.copyAttributes(r,e.options,"comb","point1"),o=t.A.createPoint(e,i[0](),h)}if(s.A.isArray(i[1])&&i[1].length>1)h=s.A.copyAttributes(r,e.options,"comb","point2"),n=e.create("point",i[1],h);else if(s.A.isString(i[1])||s.A.isPoint(i[1]))n=e.select(i[1]);else if(s.A.isFunction(i[1])&&s.A.isPoint(i[1]()))n=i[1]();else{if(!(s.A.isFunction(i[1])&&i[1]().length&&i[1]().length>=2))throw new Error("JSXGraph: Can't create comb with parent types '"+typeof i[0]+"' and '"+typeof i[1]+"'.\nPossible parent types: [point,point], [[x1,y1],[x2,y2]]");h=s.A.copyAttributes(r,e.options,"comb","point2"),n=t.A.createPoint(e,i[1](),h)}return h=s.A.copyAttributes(r,e.options,"comb"),(a=e.create("curve",[[0],[0]],h)).updateDataArray=function(){var t,e,i,s,r,h,l,c,d,u,p=0,f=o.Dist(n),A=o,_=n;for(c=a.evalVisProp("frequency"),d=-a.evalVisProp("angle"),u=a.evalVisProp("width"),a.evalVisProp("reverse")&&(A=n,_=o,d=-d),t=Math.cos(d),e=Math.sin(d),i=(_.X()-A.X())/f,s=(_.Y()-A.Y())/f,t*=u/Math.abs(e),e*=u/Math.abs(e),this.dataX=[],this.dataY=[];p'],h=z.A.prototype.setText,z.A.prototype.setText=z.A.prototype._setText,(n=i.create("text",a,l)).type=s.A.OBJECT_TYPE_CHECKBOX,z.A.prototype.setText=h,n.rendNodeCheckbox=n.rendNode.childNodes[0].childNodes[0],n.rendNodeLabel=n.rendNode.childNodes[0].childNodes[1],n.rendNodeTag=n.rendNodeCheckbox,n.rendNodeTag.disabled=!!l.disabled,n.rendNodeCheckbox.id=n.rendNode.id+"_checkbox",n.rendNodeLabel.id=n.rendNode.id+"_label",n.rendNodeLabel.setAttribute("for",n.rendNodeCheckbox.id),n.setText(r[2]),n.visPropOld.fontsize="0px",i.renderer.updateTextStyle(n,!1),n.rendNodeCheckbox.checked=l.checked,n._value=l.checked,n.Value=function(){return this._value},n.update=function(){return this.needsUpdate&&(t.A.Text.prototype.update.call(this),this._value=this.rendNodeCheckbox.checked),this},e.A.addEvent(n.rendNodeCheckbox,"change",ot,n),n},t.A.registerElement("checkbox",t.A.createCheckbox);var nt=function(t){this._value=this.rendNodeInput.value,this.board.update()};t.A.createInput=function(i,r,o){var n,a,h,l=s.A.copyAttributes(o,i.options,"input");return a=[r[0],r[1],''],h=z.A.prototype.setText,z.A.prototype.setText=z.A.prototype._setText,(n=i.create("text",a,l)).type=s.A.OBJECT_TYPE_INPUT,z.A.prototype.setText=h,n.rendNodeLabel=n.rendNode.childNodes[0].childNodes[0],n.rendNodeInput=n.rendNode.childNodes[0].childNodes[1],n.rendNodeInput.value=r[2],n.rendNodeTag=n.rendNodeInput,n.rendNodeTag.disabled=!!l.disabled,n.rendNodeLabel.id=n.rendNode.id+"_label",n.rendNodeInput.id=n.rendNode.id+"_input",n.rendNodeInput.setAttribute("aria-labelledby",n.rendNodeLabel.id),n.setText(r[3]),n._value=r[2],n.rendNodeInput.addEventListener("keydown",t=>{"ArrowLeft"!==t.key&&"ArrowRight"!==t.key||t.stopPropagation()}),n.update=function(){return this.needsUpdate&&(t.A.Text.prototype.update.call(this),this._value=this.rendNodeInput.value),this},n.Value=function(){return this._value},n.set=function(t){return this._value=t,this.rendNodeInput.value=t,this},e.A.addEvent(n.rendNodeInput,"input",nt,n),e.A.addEvent(n.rendNodeInput,"mousedown",function(t){s.A.exists(t.stopPropagation)&&t.stopPropagation()},n),e.A.addEvent(n.rendNodeInput,"touchstart",function(t){s.A.exists(t.stopPropagation)&&t.stopPropagation()},n),e.A.addEvent(n.rendNodeInput,"pointerdown",function(t){s.A.exists(t.stopPropagation)&&t.stopPropagation()},n),n.visPropOld.fontsize="0px",i.renderer.updateTextStyle(n,!1),n},t.A.registerElement("input",t.A.createInput);var at=function(){this._handler&&this._handler(),this.board.update()};t.A.createButton=function(i,r,o){var n,a,h,l=s.A.copyAttributes(o,i.options,"button");return h=z.A.prototype.setText,z.A.prototype.setText=z.A.prototype._setText,a=[r[0],r[1],''],(n=i.create("text",a,l)).type=s.A.OBJECT_TYPE_BUTTON,z.A.prototype.setText=h,n.rendNodeButton=n.rendNode.childNodes[0],n.rendNodeButton.id=n.rendNode.id+"_button",n.rendNodeTag=n.rendNodeButton,n.rendNodeTag.disabled=!!l.disabled,n.setText(r[2]),n.visPropOld.fontsize="0px",i.renderer.updateTextStyle(n,!1),r[3]&&(s.A.isString(r[3])?(n._jc=new t.A.JessieCode,n._jc.use(i),n._handler=function(){n._jc.parse(r[3])}):n._handler=r[3]),e.A.addEvent(n.rendNodeButton,"click",at,n),e.A.addEvent(n.rendNodeButton,"mousedown",function(t){s.A.exists(t.stopPropagation)&&t.stopPropagation()},n),e.A.addEvent(n.rendNodeButton,"touchstart",function(t){s.A.exists(t.stopPropagation)&&t.stopPropagation()},n),e.A.addEvent(n.rendNodeButton,"pointerdown",function(t){s.A.exists(t.stopPropagation)&&t.stopPropagation()},n),n},t.A.registerElement("button",t.A.createButton),t.A.createVectorField=function(t,e,i){var r,o;if(!(e.length>=3&&(s.A.isArray(e[0])||s.A.isFunction(e[0])||s.A.isString(e[0]))&&s.A.isArray(e[1])&&3===e[1].length&&s.A.isArray(e[2])&&3===e[2].length))throw new Error("JSXGraph: Can't create vector field with parent types '"+typeof e[0]+"', '"+typeof e[1]+"', '"+typeof e[2]+"'.");return o=s.A.copyAttributes(i,t.options,"vectorfield"),(r=t.create("curve",[[],[]],o)).elType="vectorfield",r.setF=function(t,e){var i,o;return s.A.isArray(t)?(i=s.A.createFunction(t[0],this.board,e),o=s.A.createFunction(t[1],this.board,e),this.F=function(t,e){return[i(t,e),o(t,e)]}):this.F=s.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,o,n,a,h,l,c,d,u,p,f=this.evalVisProp("scale"),A=s.A.evaluate(this.xData[0]),_=s.A.evaluate(this.xData[1]),m=(s.A.evaluate(this.xData[2])-A)/_,g=s.A.evaluate(this.yData[0]),b=s.A.evaluate(this.yData[1]),v=(s.A.evaluate(this.yData[2])-g)/b,y=this.evalVisProp("arrowhead.enabled");for(y&&(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<=_;e+=m,r++)for(o=0,i=g;o<=b;i+=v,o++)(n=this.F(e,i))[0]*=f,n[1]*=f,s.A.concat(this.dataX,[e,e+n[0],NaN]),s.A.concat(this.dataY,[i,i+n[1],NaN]),y&&Math.abs(n[0])+Math.abs(n[1])>0&&(h=(a=Math.atan2(n[1],n[0]))+p,l=a-p,s.A.concat(this.dataX,[e+n[0]-Math.cos(h)*d,e+n[0],e+n[0]-Math.cos(l)*d,NaN]),s.A.concat(this.dataY,[i+n[1]-Math.sin(h)*u,i+n[1],i+n[1]-Math.sin(l)*u,NaN]))},s.A.extendInstanceMethodMap(r,{setF:"setF"}),r},t.A.registerElement("vectorfield",t.A.createVectorField),t.A.createSlopeField=function(t,e,i){var r,o,n;if(!(e.length>=3&&(s.A.isFunction(e[0])||s.A.isString(e[0]))&&s.A.isArray(e[1])&&3===e[1].length&&s.A.isArray(e[2])&&3===e[2].length))throw new Error("JSXGraph: Can't create slope field with parent types '"+typeof e[0]+"', '"+typeof e[1]+"', '"+typeof e[2]+"'.");return o=s.A.createFunction(e[0],t,"x, y"),e[0]=function(t,e){var i=o(t,e),s=Math.sqrt(1+i*i);return[1/s,i/s]},n=s.A.copyAttributes(i,t.options,"slopefield"),(r=t.create("vectorfield",e,n)).elType="slopefield",r.setF=function(t,e){var i=s.A.createFunction(t,r.board,e);this.F=function(t,e){var s=i(t,e),r=Math.sqrt(1+s*s);return[1/r,s/r]}},s.A.extendInstanceMethodMap(r,{setF:"setF"}),r},t.A.registerElement("slopefield",t.A.createSlopeField),t.A.createSmartLabel=function(e,r,o){var n,a,h,l;if(0===r.length||[i.A.OBJECT_CLASS_POINT,i.A.OBJECT_CLASS_LINE,i.A.OBJECT_CLASS_CIRCLE].indexOf(r[0].elementClass)<0&&[i.A.OBJECT_TYPE_POLYGON,i.A.OBJECT_TYPE_ANGLE].indexOf(r[0].type)<0)throw new Error("JSXGraph: Can't create smartlabel with parent types '"+typeof r[0]+"', '"+typeof r[1]+"'.");return h=r[0],l=r[1]||"",a=s.A.copyAttributes(o,e.options,"smartlabel"),h.elementClass===i.A.OBJECT_CLASS_POINT?a=s.A.merge(a,s.A.copyAttributes(o,e.options,"smartlabelpoint")):h.elementClass===i.A.OBJECT_CLASS_LINE?((a=s.A.merge(a,s.A.copyAttributes(o,e.options,"smartlabelline"))).rotate=function(t){var e;switch(t.evalVisProp("orientation")){case"none":return 0;case"orthogonal":e=270;break;case"orthogonal-inverted":e=90;break;case"parallel-inverted":case"inverted":e=0;break;default:e=360}return(180*Math.atan(h.getSlope())/Math.PI+e)%360},a.visible=function(t){var e,i,s,r,o,n=t.evalVisProp("orientation"),a=t.evalVisProp("visibleThreshold"),l=t.getSize();switch(i=h.point1.coords.scrCoords,r=(s=h.point2.coords.scrCoords)[1]-i[1],o=s[2]-i[2],e=Math.floor(Math.sqrt(r*r+o*o)),n){case"parallel":case"parallel-inverted":case"inverted":return l[0]=1.5}}):h.elementClass===i.A.OBJECT_CLASS_CIRCLE?(a=s.A.merge(a,s.A.copyAttributes(o,e.options,"smartlabelcircle"))).visible=function(e){var i,s,r,o,n,a=e.getSize(),l=e.evalVisProp("visibleThreshold");return s=h.center.coords.scrCoords,o=(r=h.point2?h.point2.coords.scrCoords:new t.A.Coords(t.A.COORDS_BY_USER,[h.center.coords.usrCoords[0],h.center.coords.usrCoords[1]+h.Radius()],h.board).scrCoords)[1]-s[1],n=r[2]-s[2],i=2*Math.floor(Math.sqrt(o*o+n*n)),a[0]90&&i<270?i+180:i},a.anchorX=function(){var t=h.center.coords.usrCoords,e=h.getLabelAnchor().usrCoords,i=(180*Math.atan2(e[2]-t[2],e[1]-t[1])/Math.PI+360)%360;return i>90&&i<270?"right":"left"}),h.elementClass===i.A.OBJECT_CLASS_POINT?n=e.create("text",[function(){return h.X()},function(){return h.Y()},""],a):h.elementClass===i.A.OBJECT_CLASS_LINE?"length"===a.measure?n=e.create("text",[function(){return.5*(h.point1.X()+h.point2.X())},function(){return.5*(h.point1.Y()+h.point2.Y())},""],a):"slope"===a.measure&&(n=e.create("text",[function(){return.25*h.point1.X()+.75*h.point2.X()},function(){return.25*h.point1.Y()+.75*h.point2.Y()},""],a)):h.elementClass===i.A.OBJECT_CLASS_CIRCLE?"radius"===a.measure?n=e.create("text",[function(){return h.center.X()+.5*h.Radius()},function(){return h.center.Y()},""],a):"area"===a.measure?n=e.create("text",[function(){return h.center.X()},function(){return h.center.Y()+.5*h.Radius()},""],a):"circumference"!==a.measure&&"perimeter"!==a.measure||(n=e.create("text",[function(){return h.getLabelAnchor()},""],a)):h.type===i.A.OBJECT_TYPE_POLYGON?"area"===a.measure?n=e.create("text",[function(){return h.getTextAnchor()},""],a):"perimeter"===a.measure&&(n=e.create("text",[function(){var t=h.borders.length-1;return t>=0?[.5*(h.borders[t].point1.X()+h.borders[t].point2.X()),.5*(h.borders[t].point1.Y()+h.borders[t].point2.Y())]:h.getTextAnchor()},""],a)):h.type===i.A.OBJECT_TYPE_ANGLE&&(n=e.create("text",[function(){return h.getLabelAnchor()},""],a)),s.A.exists(n)?(n.elType="smartlabel",n.parentObject=h,n.Value=function(){switch(this.evalVisProp("measure")){case"length":return h.L();case"slope":return h.Slope();case"area":return h.Area();case"radius":return h.Radius();case"perimeter":case"circumference":return h.Perimeter();case"rad":return h.Value();case"deg":return 180*h.Value()/Math.PI;case"coords":return[h.X(),h.Y()];default:return 0}},n.Dimension=function(){switch(this.evalVisProp("measure")){case"area":return 2;case"length":case"radius":case"perimeter":case"circumference":case"coords":return 1;default:return 0}},n.Unit=function(t){var e,i="",r=n.evalVisProp("units"),o=t,a={};if(s.A.exists(o)||(o=n.Dimension()),s.A.isArray(t)){for(e=0;e1&&""!==i&&(i=i+"^{"+o+"}")),i},n.setText(function(){var t,e,i,r,o,a,h=s.A.evaluate(l),c="",d="",u="";if(""!==h)return h;if(e=n.Value(),t=n.evalVisProp("digits"),i=n.Unit(),d="",u="",r=n.evalVisProp("dir"),o=n.evalVisProp("usemathjax")||n.evalVisProp("usekatex"),n.evalVisProp("showPrefix")&&(d=n.evalVisProp("prefix")),n.evalVisProp("showSuffix")&&(u=n.evalVisProp("suffix")),n.useLocale())if(s.A.isArray(e))for(a=0;a");c.push(u)}c=c.join("")}}else c=o?["\\(",d,e,"\\,",i,u,"\\)"].join(""):[d,e,i,u].join("");return c}),h.addChild(n),n.setParents([h]),s.A.extendInstanceMethodMap(n,{Value:"Value",V:"Value",Dimension:"Dimension",Unit:"Unit",parent:"parentObject",parentObject:"parentObject"}),n):null},t.A.registerElement("smartlabel",t.A.createSmartLabel),t.A.ForeignObject=function(t,e,r,o,n){this.constructor(t,r,i.A.OBJECT_TYPE_FOREIGNOBJECT,i.A.OBJECT_CLASS_OTHER),this.element=this.board.select(r.anchor),this.coordsConstructor(e),this._useUserSize=!1,this.size=[1,1],s.A.exists(n)&&n.length>0&&(this._useUserSize=!0,this.W=s.A.createFunction(n[0],this.board,""),this.H=s.A.createFunction(n[1],this.board,""),this.addParentsFromJCFunctions([this.W,this.H]),this.usrSize=[this.W(),this.H()]),this.content=o,this.elType="foreignobject",this.id=this.board.setId(this,"Im"),this.board.renderer.drawForeignObject(this),this.board.finalizeAdding(this)},t.A.ForeignObject.prototype=new Y.A,s.A.copyPrototypeMethods(t.A.ForeignObject,V.A,"coordsConstructor"),s.A.copyMethodMap(t.A.ForeignObject,{addTransformation:"addTransform",trans:"addTransform",W:"W",Width:"W",H:"H",Height:"H"}),t.A.extend(t.A.ForeignObject.prototype,{hasPoint:function(t,e){var r,n,a,h,l,c,d,p,f,A=this.transformations.length;return s.A.isObject(this.evalVisProp("precision"))?(h=this.board._inputDevice,l=this.evalVisProp("precision."+h)):l=this.board.options.precision.hasPoint,0===A?(r=t-this.coords.scrCoords[1],n=this.coords.scrCoords[2]-e,r>=-(a=l)&&r-this.size[0]<=a&&n>=-a&&n-this.size[1]<=a):(d=[(c=(c=new u.A(i.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<=(p=(f=o.A.innerProduct)(d,this.span[1]))&&p<=f(this.span[1],this.span[1])&&0<=(p=f(d,this.span[2]))&&p<=f(this.span[2],this.span[2]))},update:function(t){return this.needsUpdate?(this.updateCoords(t),this.updateSize(),this):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,s=[];if(0===i)this.span=[[this.Z(),this.X(),this.Y()],[this.Z(),this.W(),0],[this.Z(),0,this.H()]];else{for(s[0]=[this.Z(),this.X(),this.Y()],s[1]=[this.Z(),this.X()+this.W(),this.Y()],s[2]=[this.Z(),this.X(),this.Y()+this.H()],t=0;t=2&&(l=i[2]),o=s.A.copyAttributes(r,e.options,"foreignobject"),!(n=V.A.create(t.A.ForeignObject,e,h,o,a,l)))throw new Error("JSXGraph: Can't create foreignObject with parent types '"+typeof i[0]+"' and '"+typeof i[1]+"'.\nPossible parent types: [string, [x, y], [w, h]], [string, [x, y]], [element,transformation]");return n},t.A.registerElement("foreignobject",t.A.createForeignObject),t.A.registerElement("fo",t.A.createForeignObject);t.A.ForeignObject;t.A.extend(v.A,{axes3d:{axesPosition:"center",xAxis:{name:"X",withlabel:!0,visible:!0,layer:12,point2:{name:"x"},strokeColor:t.A.palette.red},yAxis:{name:"Y",withlabel:!0,visible:!0,layer:12,point2:{name:"y"},strokeColor:t.A.palette.green},zAxis:{name:"Z",visible:!0,withlabel:!0,layer:12,point2:{name:""},strokeColor:t.A.palette.blue},xAxisBorder:{name:"x",visible:"ìnherit",withLabel:!1,label:{position:"50% left",offset:[30,0],fontsize:15},strokeWidth:1,lastArrow:!1,ticks3d:{visible:"ìnherit",label:{anchorX:"middle",anchorY:"middle"}}},yAxisBorder:{name:"y",visible:"ìnherit",withLabel:!1,label:{position:"50% right",offset:[0,-30],fontsize:15},strokeWidth:1,lastArrow:!1,ticks3d:{visible:"ìnherit",label:{anchorX:"middle"}}},zAxisBorder:{name:"z",visible:"ìnherit",withLabel:!1,label:{position:"50% right",offset:[30,0],fontsize:15},strokeWidth:1,lastArrow:!1,ticks3d:{visible:"ìnherit",label:{anchorX:"middle",anchorY:"middle"}}},xPlaneRear:{visible:!0,layer:0,strokeWidth:1,strokeColor:"#dddddd",fillColor:"#dddddd",mesh3d:{layer:1},stepsU:10,stepsV:10,tiling:"rectangle",polyhedron:{visible:"inherit",strokeWidth:.5,strokeOpacity:.7,strokeColor:"#cccccc",fillOpacity:.3,fillColorArray:["#e7e7e7"],shader:{enabled:!0,fixed:!0,type:"zIndex",hue:0,saturation:0,minlightness:65,maxLightness:98}}},yPlaneRear:{visible:!0,strokeWidth:1,strokeColor:"#dddddd",fillColor:"#dddddd",layer:0,mesh3d:{layer:1},stepsU:10,stepsV:10,tiling:"rectangle",polyhedron:{visible:"inherit",strokeWidth:.5,strokeOpacity:.7,strokeColor:"#cccccc",fillOpacity:.3,fillColorArray:["#e7e7e7"],shader:{enabled:!0,fixed:!0,type:"zIndex",hue:0,saturation:0,minlightness:65,maxLightness:98}}},zPlaneRear:{visible:!0,strokeWidth:1,strokeColor:"#dddddd",fillColor:"#dddddd",layer:0,mesh3d:{layer:1},stepsU:10,stepsV:10,tiling:"rectangle",polyhedron:{visible:"inherit",strokeWidth:.5,strokeOpacity:.7,strokeColor:"#cccccc",fillOpacity:.3,fillColorArray:["#e7e7e7"],shader:{enabled:!0,fixed:!0,type:"zIndex",hue:0,saturation:0,minlightness:65,maxLightness:98}}},xPlaneFront:{visible:!1,type:"wireframe",strokeWidth:1,strokeColor:"#dddddd",fillColor:"none",layer:0,mesh3d:{layer:1,visible:!1},stepsU:10,stepsV:10,tiling:"rectangle",polyhedron:{visible:"inherit",strokeWidth:.5,strokeOpacity:.7,strokeColor:"#cccccc",fillOpacity:.3,fillColorArray:["#e7e7e7"],shader:{enabled:!0,fixed:!0,type:"zIndex",hue:0,saturation:0,minlightness:65,maxLightness:98}}},yPlaneFront:{visible:!1,type:"wireframe",strokeWidth:1,strokeColor:"#dddddd",fillColor:"none",layer:0,mesh3d:{layer:1,visible:!1},stepsU:10,stepsV:10,tiling:"rectangle",polyhedron:{visible:"inherit",strokeWidth:.5,strokeOpacity:.7,strokeColor:"#cccccc",fillOpacity:.3,fillColorArray:["#e7e7e7"],shader:{enabled:!0,fixed:!0,type:"zIndex",hue:0,saturation:0,minlightness:65,maxLightness:98}}},zPlaneFront:{visible:!1,type:"wireframe",strokeWidth:1,strokeColor:"#dddddd",fillColor:"none",layer:0,mesh3d:{layer:1,visible:!1},stepsU:10,stepsV:10,tiling:"rectangle",polyhedron:{visible:"inherit",strokeWidth:.5,strokeOpacity:.7,strokeColor:"#cccccc",fillOpacity:.3,fillColorArray:["#e7e7e7"],shader:{enabled:!0,fixed:!0,type:"zIndex",hue:0,saturation:0,minlightness:65,maxLightness:98}}},xPlaneRearYAxis:{visible:"inherit",strokeColor:"#aaaaaa",strokeWidth:1.2,layer:12},xPlaneRearZAxis:{visible:"inherit",strokeColor:"#888888",strokeWidth:1.2,layer:12},xPlaneFrontYAxis:{visible:!1,strokeColor:"#888888",strokeWidth:1.2,layer:12},xPlaneFrontZAxis:{visible:!1,strokeColor:"#888888",strokeWidth:1.2,layer:12},yPlaneRearXAxis:{visible:"inherit",strokeColor:"#888888",strokeWidth:1.2,layer:12},yPlaneRearZAxis:{visible:"inherit",strokeColor:"#888888",strokeWidth:1.2,layer:12},yPlaneFrontXAxis:{visible:!1,strokeColor:"#888888",strokeWidth:1.2,layer:12},yPlaneFrontZAxis:{visible:!1,strokeColor:"#888888",strokeWidth:1.2,layer:12},zPlaneRearXAxis:{visible:"inherit",strokeColor:"#888888",strokeWidth:1.2,layer:12},zPlaneRearYAxis:{visible:"inherit",strokeColor:"#888888",strokeWidth:1.2,layer:12},zPlaneFrontXAxis:{visible:!1,strokeColor:"#888888",strokeWidth:1.2,layer:12},zPlaneFrontYAxis:{visible:!1,strokeColor:"#888888",strokeWidth:1.2,layer:12}},axis3d:{highlight:!1,fixed:!0,strokeColor:"black",strokeWidth:1,lastArrow:!0,tabindex:null,label:{position:"103% left",offset:[0,0]},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:t.A.palette.yellow,fillOpacity:.4,needsRegularUpdate:!0,visible:!0,shader:{enabled:!1,fixed:!0,type:"angle",hue:60,saturation:90,minLightness:30,maxLightness:90,light:{type:1,az:-45,el:20,bank:0,dir:-1}}},intersectionline3d:{point1:{visible:!1,name:""},point2:{visible:!1,name:""}},line3d:{layer:12,strokeWidth:1,strokeColor:"black",fixed:!0,tabindex:null,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:1,strokeColor:"black",strokeOpacity:1,highlight:!1,tabindex:null,needsRegularUpdate:!0,visible:!0,gradient:"linear",gradientSecondColor:"#ffffff",gradientAngle:Math.PI,fillColor:"#bbbbbb",fillOpacity:.3,type:"shader",tiling:"rectangle",mesh3d:{visible:"inherit"},stepsU:6,stepsV:6,colormap:{min:[-5,190],max:[5,0],s:.9,v:.9},polyhedron:{layer:12,visible:"inherit",strokeWidth:.1,fillOpacity:.8,fillColorArray:["white",t.A.palette.blue],shader:{enabled:!1,fixed:!0,hue:60,saturation:90,minLightness:55,maxLightness:90,light:{dir:-1}}},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,cyclic:!1},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:{visible:!0,layer:12,highlight:!1,tabindex:-1,type:"wireframe",tiling:"rectangle",strokeWidth:.75,colormap:{min:[-5,190],max:[5,0],s:.9,v:.9},polyhedron:{visible:"inherit",strokeWidth:.1,fillOpacity:.8,fillColorArray:["white",t.A.palette.blue],shader:{enabled:!1,fixed:!0,hue:60,saturation:90,minLightness:55,maxLightness:90,light:{dir:-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:!0,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}},r:"auto",trackball:{enabled:!1,outside:!0,button:-1,key:"none"},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}});t.A.Options;t.A.View3D=function(t,e,s){this.constructor(t,s,i.A.OBJECT_TYPE_VIEW3D,i.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=null,this.focalDist=-1,this.projectionType="parallel",this.trackballEnabled=!1,this._lastPos={x:0,y:0},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"},t.A.View3D.prototype=new Y.A,s.A.copyMethodMap(t.A.View3D,{}),t.A.extend(t.A.View3D.prototype,{create:function(t,e,i){var s=[];return t.indexOf("3d")>0&&s.push(this),this.board.create(t,s.concat(e),i)},select:function(t,e){var i,r,o,n,a=t;if(null===a)return a;if(s.A.isString(a)&&""!==a)s.A.exists(this.objects[a])?a=this.objects[a]:s.A.exists(this.elementsByName[a])&&(a=this.elementsByName[a]);else if(!e&&(s.A.isFunction(a)||s.A.isObject(a)&&!s.A.isFunction(a.setAttribute))){for(r={},n=(i=s.A.filterElements(this.objectsList,a)).length,o=0;oo.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=o.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),s=h[2][3],r=h[3][3],h=o.A.matMatMult([[1,0,0,0],[0,1,0,0],[0,0,s,r],[0,0,-r,s]],h),this.angles.el=Math.atan2(r,s),n=-h[1][1],a=h[3][1],this.angles.az=Math.atan2(a,n),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())>o.A.eps||Math.abs(this.angles.el-this.el_slide.Value())>o.A.eps||Math.abs(this.angles.bank-this.bank_slide.Value())>o.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,s,r,n,a=[[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,s=-Math.sin(e),a[1][1]=-Math.cos(t),a[1][2]=Math.sin(t),a[1][3]=0,a[2][1]=s*Math.sin(t),a[2][2]=s*Math.cos(t),a[2][3]=Math.cos(e),a[3][1]=Math.cos(e)*Math.sin(t),a[3][2]=Math.cos(e)*Math.cos(t),a[3][3]=Math.sin(e),r=Math.cos(i),n=Math.sin(i),a=o.A.matMatMult([[1,0,0,0],[0,r,n,0],[0,-n,r,0],[0,0,0,1]],a)},_projectToSphere:function(t,e,i){var s,r=o.A.hypot(e,i);return r<.7071067811865475*t?Math.sqrt(t*t-r*r):(s=t/1.414213562373095)*s/r},updateProjectionTrackball:function(t){var e,i,r,n,a,l,c,d,u,p,f,A,_=100,m=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]];return s.A.exists(this._trackball)?((e=this._trackball.dx)*e+(i=this._trackball.dy)*i>o.A.eps&&(_=.25*(this.size[0]*this.board.unitX+this.size[1]*this.board.unitY),n=[a=this._trackball.x,l=this._trackball.y,this._projectToSphere(_,a,l)],r=[a-=e,l-=i,this._projectToSphere(_,a,l)],A=o.A.crossProduct(r,n),u=o.A.hypot(A[0],A[1],A[2]),A[0]/=u,A[1]/=u,A[2]/=u,d=(d=(d=h.A.distance(n,r,3)/(2*_))>1?1:d)<-1?-1:d,c=2*Math.asin(d),d=1-(p=Math.cos(c)),f=Math.sin(c),m[1][1]=p+A[0]*A[0]*d,m[2][1]=A[1]*A[0]*d+A[2]*f,m[3][1]=A[2]*A[0]*d-A[1]*f,m[1][2]=A[0]*A[1]*d-A[2]*f,m[2][2]=p+A[1]*A[1]*d,m[3][2]=A[2]*A[1]*d+A[0]*f,m[1][3]=A[0]*A[2]*d+A[1]*f,m[2][3]=A[1]*A[2]*d-A[0]*f,m[3][3]=p+A[2]*A[2]*d),m=o.A.matMatMult(m,this.matrix3DRot)):this.matrix3DRot},updateAngleSliderBounds:function(){var t,e,i,s,r,n,a,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,s=this.el_slide._smin,c=this.bank_slide._smax,d=this.bank_slide._smin,this.trackballEnabled?(r=o.A.mod(this.angles.el,2*Math.PI),.5*Math.PIthis.zIndexMax&&(this.zIndexMax=i))},updateDepthOrdering:function(){var t,e,r,o,n,a,h;for(a=this.evalVisProp("depthorder.layers"),r=0;r=0&&this.depthOrdered[h].push(e));if(this.board.renderer&&"svg"===this.board.renderer.type)for(r=0;re[0][1]&&(t[1]=e[0][1],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 s,r,o,n,a;for(a=3===e.length?e:e.slice(1),s=i,r=0;r<3;r++)0!==a[r]&&(o=(this.bbox3D[r][0]-t[r+1])/a[r],n=(this.bbox3D[r][1]-t[r+1])/a[r],s=i<0?Math.max(s,Math.min(o,n)):Math.min(s,Math.max(o,n)));return s},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]-o.A.eps&&i[0]this.bbox3D[1][0]-o.A.eps&&i[1]this.bbox3D[2][0]-o.A.eps&&i[2]-o.A.eps&&s<1+o.A.eps&&(c=[1,a[1]+s*b[1],a[2]+s*b[2],a[3]+s*b[3]],y.push(c));return y},intersectionPlanePolyhedron:function(t,e){var i,s,r,o,n,a,l=1e-12,c=[],d=[],u=[],p=[];for(i=0;i1&&(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"]},freeR:function(){this.r=null},setView:function(t,e,i){return void 0!==i&&(this.r=i),i=this.getCameraDistance(),this.az_slide.setValue(t),this.el_slide.setValue(e),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},_az_elEventHandler:function(t){var e,i,s=this.az_slide._smax,r=this.az_slide._smin,n=(s-r)/this.board.canvasWidth*this.evalVisProp("az.pointer.speed"),a=this.az_slide.Value(),h=this.el_slide.Value();return e=t.screenX-this._lastPos.x,this._lastPos.x=t.screenX,i=t.screenY-this._lastPos.y,this._lastPos.y=t.screenY,this.board.mode!==this.board.BOARD_MODE_DRAG&&this.board._change3DView?(this.evalVisProp("az.pointer.enabled")&&0!==e&&null==t.key&&(a+=e*n),this.evalVisProp("el.pointer.enabled")&&0!==i&&null==t.key&&(h+=i*n),this.evalVisProp("az.continuous")?a=o.A.wrap(a,r,s):a>0?a=Math.min(s,a):a<0&&(a=Math.max(r,a)),s=this.el_slide._smax,r=this.el_slide._smin,this.evalVisProp("el.continuous")&&!this.trackballEnabled?h=o.A.wrap(h,r,s):h>0?h=Math.min(s,h):h<0&&(h=Math.max(r,h)),this.setView(a,h),this):this},_azEventHandler:function(t){var e,i=this.az_slide._smax,s=this.az_slide._smin,r=(i-s)/this.board.canvasWidth*this.evalVisProp("az.pointer.speed"),n=this.az_slide.Value(),a=this.el_slide.Value();return e=t.screenX-this._lastPos.x,this._lastPos.x=t.screenX,this.board.mode!==this.board.BOARD_MODE_DRAG&&this.board._change3DView?(this.evalVisProp("az.keyboard.enabled")&&("ArrowRight"===t.key?n+=this.evalVisProp("az.keyboard.step")*Math.PI/180:"ArrowLeft"===t.key&&(n-=this.evalVisProp("az.keyboard.step")*Math.PI/180)),this.evalVisProp("az.pointer.enabled")&&0!==e&&null==t.key&&(n+=e*r),this.evalVisProp("az.continuous")?n=o.A.wrap(n,s,i):n>0?n=Math.min(i,n):n<0&&(n=Math.max(s,n)),this.setView(n,a),this):this},_elEventHandler:function(t){var e,i=this.el_slide._smax,s=this.el_slide._smin,r=(i-s)/this.board.canvasHeight*this.evalVisProp("el.pointer.speed"),n=this.az_slide.Value(),a=this.el_slide.Value();return e=t.screenY-this._lastPos.y,this._lastPos.y=t.screenY,this.board.mode!==this.board.BOARD_MODE_DRAG&&this.board._change3DView?(this.evalVisProp("el.keyboard.enabled")&&("ArrowUp"===t.key?a-=this.evalVisProp("el.keyboard.step")*Math.PI/180:"ArrowDown"===t.key&&(a+=this.evalVisProp("el.keyboard.step")*Math.PI/180)),this.evalVisProp("el.pointer.enabled")&&0!==e&&null==t.key&&(a+=e*r),this.evalVisProp("el.continuous")&&!this.trackballEnabled?a=o.A.wrap(a,s,i):a>0?a=Math.min(i,a):a<0&&(a=Math.max(s,a)),this.setView(n,a),this):this},_bankEventHandler:function(t){var e,i=this.bank_slide._smax,s=this.bank_slide._smin,r=t.deltaY,n=this.bank_slide.Value();return this.board.mode!==this.board.BOARD_MODE_DRAG&&this.board._change3DView?(this.evalVisProp("bank.keyboard.enabled")&&(e=this.evalVisProp("bank.keyboard.step")*Math.PI/180,"."===t.key||"<"===t.key?n-=e:","!==t.key&&">"!==t.key||(n+=e)),this.evalVisProp("bank.pointer.enabled")&&0!==r&&null==t.key&&(n+=r*((i-s)/this.board.canvasHeight*this.evalVisProp("bank.pointer.speed")),t.preventDefault()),n=this.evalVisProp("bank.continuous")?o.A.wrap(n,s,i):o.A.clamp(n,s,i),this.bank_slide.setValue(n),this.board.update(),this):this},_trackballHandler:function(t){var e,s,r,o,n,a=this.board.getMousePosition(t);return n=new u.A(i.A.COORDS_BY_USER,[this.llftCorner[0]+.5*this.size[0],this.llftCorner[1]+.5*this.size[1]],this.board),e=a[0]-n.scrCoords[1],s=a[1]-n.scrCoords[2],r=t.screenX-this._lastPos.x,o=t.screenY-this._lastPos.y,this._lastPos.x=t.screenX,this._lastPos.y=t.screenY,this._trackball={dx:r,dy:-o,x:e,y:-s},this.board.update(),this},pointerDownHandler:function(t){var i,s,r;this._hasMoveAzEl=!1,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._lastPos.x=t.screenX,this._lastPos.y=t.screenY,this.evalVisProp("trackball.enabled")?(i=this.evalVisProp("trackball.button"),s=this.evalVisProp("trackball.key"),-1!==i&&i!==t.button||!("none"===s||s.indexOf("shift")>-1&&t.shiftKey||s.indexOf("ctrl")>-1&&t.ctrlKey)||(r=this.evalVisProp("trackball.outside")?document:this.board.containerObj,e.A.addEvent(r,"pointermove",this._trackballHandler,this),this._hasMoveTrackball=!0)):(this.evalVisProp("az.pointer.enabled")&&this.evalVisProp("el.pointer.enabled")&&(i=this.evalVisProp("az.pointer.button"),s=this.evalVisProp("az.pointer.key"),i===this.evalVisProp("el.pointer.button")&&s===this.evalVisProp("el.pointer.key")&&(-1!==i&&i!==t.button||!("none"===s||s.indexOf("shift")>-1&&t.shiftKey||s.indexOf("ctrl")>-1&&t.ctrlKey)||(r=this.evalVisProp("az.pointer.outside")?document:this.board.containerObj)===(this.evalVisProp("el.pointer.outside")?document:this.board.containerObj)&&(e.A.addEvent(r,"pointermove",this._az_elEventHandler,this),this._hasMoveAzEl=!0))),this._hasMoveAzEl||(this.evalVisProp("az.pointer.enabled")&&(i=this.evalVisProp("az.pointer.button"),s=this.evalVisProp("az.pointer.key"),-1!==i&&i!==t.button||!("none"===s||s.indexOf("shift")>-1&&t.shiftKey||s.indexOf("ctrl")>-1&&t.ctrlKey)||(r=this.evalVisProp("az.pointer.outside")?document:this.board.containerObj,e.A.addEvent(r,"pointermove",this._azEventHandler,this),this._hasMoveAz=!0)),this.evalVisProp("el.pointer.enabled")&&(i=this.evalVisProp("el.pointer.button"),s=this.evalVisProp("el.pointer.key"),-1!==i&&i!==t.button||!("none"===s||s.indexOf("shift")>-1&&t.shiftKey||s.indexOf("ctrl")>-1&&t.ctrlKey)||(r=this.evalVisProp("el.pointer.outside")?document:this.board.containerObj,e.A.addEvent(r,"pointermove",this._elEventHandler,this),this._hasMoveEl=!0))),this.evalVisProp("bank.pointer.enabled")&&(i=this.evalVisProp("bank.pointer.button"),s=this.evalVisProp("bank.pointer.key"),-1!==i&&i!==t.button||!("none"===s||s.indexOf("shift")>-1&&t.shiftKey||s.indexOf("ctrl")>-1&&t.ctrlKey)||(r=this.evalVisProp("bank.pointer.outside")?document:this.board.containerObj,e.A.addEvent(r,"wheel",this._bankEventHandler,this,{passive:!1}),this._hasMoveBank=!0))),e.A.addEvent(document,"pointerup",this.pointerUpHandler,this))},pointerUpHandler:function(t){var i;this._hasMoveAzEl&&(i=this.evalVisProp("az.pointer.outside")?document:this.board.containerObj,e.A.removeEvent(i,"pointermove",this._az_elEventHandler,this),this._hasMoveAzEl=!1),this._hasMoveAz&&(i=this.evalVisProp("az.pointer.outside")?document:this.board.containerObj,e.A.removeEvent(i,"pointermove",this._azEventHandler,this),this._hasMoveAz=!1),this._hasMoveEl&&(i=this.evalVisProp("el.pointer.outside")?document:this.board.containerObj,e.A.removeEvent(i,"pointermove",this._elEventHandler,this),this._hasMoveEl=!1),this._hasMoveBank&&(i=this.evalVisProp("bank.pointer.outside")?document:this.board.containerObj,e.A.removeEvent(i,"wheel",this._bankEventHandler,this),this._hasMoveBank=!1),this._hasMoveTrackball&&(i=this.evalVisProp("trackball.outside")?document:this.board.containerObj,e.A.removeEvent(i,"pointermove",this._trackballHandler,this),this._hasMoveTrackball=!1),e.A.removeEvent(document,"pointerup",this.pointerUpHandler,this),this.board._change3DView=!1,this.board.mode=this.board.BOARD_MODE_NONE}}),t.A.createView3D=function(i,r,n){var a,h,l,c,d,u,p,f,A,_,m,g,b=r[0],v=r[1];return h=s.A.copyAttributes(n,i.options,"view3d"),(a=new t.A.View3D(i,r,h)).defaultAxes=a.create("axes3d",[],h),u=b[0],p=b[1],f=v[0],A=v[1],(l=s.A.copyAttributes(h,i.options,"view3d","az","slider")).name="az",(c=s.A.copyAttributes(h,i.options,"view3d","el","slider")).name="el",(d=s.A.copyAttributes(h,i.options,"view3d","bank","slider")).name="bank",g=s.A.evaluate(l.point1.pos),_=s.A.isArray(g)?g:[u-1,p-2],g=s.A.evaluate(l.point2.pos),m=s.A.isArray(g)?g:[u+f+1,p-2],a.az_slide=i.create("slider",[_,m,[s.A.evaluate(l.min),s.A.evaluate(l.start),s.A.evaluate(l.max)]],l),a.inherits.push(a.az_slide),a.az_slide.elType="view3d_slider",g=s.A.evaluate(c.point1.pos),_=s.A.isArray(g)?g:[u-1,p],g=s.A.evaluate(c.point2.pos),m=s.A.isArray(g)?g:[u-1,p+A],a.el_slide=i.create("slider",[_,m,[s.A.evaluate(c.min),s.A.evaluate(c.start),s.A.evaluate(c.max)]],c),a.inherits.push(a.el_slide),a.el_slide.elType="view3d_slider",g=s.A.evaluate(d.point1.pos),_=s.A.isArray(g)?g:[u-1,p+A+2],g=s.A.evaluate(d.point2.pos),m=s.A.isArray(g)?g:[u+f+1,p+A+2],a.bank_slide=i.create("slider",[_,m,[s.A.evaluate(d.min),s.A.evaluate(d.start),s.A.evaluate(d.max)]],d),a.inherits.push(a.bank_slide),a.bank_slide.elType="view3d_slider",a.board.infobox.visProp=s.A.merge(a.board.infobox.visProp,h.infobox),a.board.highlightInfobox=function(t,e,i){var r,n,h,l,c,d,u="",p=i.board,f=null;for(this.mode===this.BOARD_MODE_DRAG&&(u=a.isVerticalDrag()?'⇅  ':'⇄  '),n=0;n-1&&t.shiftKey||e.indexOf("ctrl")>-1&&t.ctrlKey)&&(a._elEventHandler(t),i=!0),!a.evalVisProp("az.keyboard.enabled")||"ArrowLeft"!==t.key&&"ArrowRight"!==t.key||("none"===(e=a.evalVisProp("az.keyboard.key"))||e.indexOf("shift")>-1&&t.shiftKey||e.indexOf("ctrl")>-1&&t.ctrlKey)&&(a._azEventHandler(t),i=!0),!a.evalVisProp("bank.keyboard.enabled")||","!==t.key&&"<"!==t.key&&"."!==t.key&&">"!==t.key||("none"===(e=a.evalVisProp("bank.keyboard.key"))||e.indexOf("shift")>-1&&t.shiftKey||e.indexOf("ctrl")>-1&&t.ctrlKey)&&(a._bankEventHandler(t),i=!0),"PageUp"===t.key?(a.nextView(),i=!0):"PageDown"===t.key&&(a.previousView(),i=!0),i&&t.preventDefault(),this.board._change3DView=!1},a),e.A.addEvent(i.containerObj,"pointerdown",a.pointerDownHandler,a),a.getAnglesFromSliders(),a.matrix3DRot=a.getRotationFromAngles(),a.updateAngleSliderBounds(),a.board.update(),a},t.A.registerElement("view3d",t.A.createView3D);t.A.View3D;t.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)},t.A.extend(t.A.GeometryElement3D.prototype,{setAttr2D:function(t){var e=t;return e.name=this.name,e.element3d=this,e.id=null,e},setAttribute:function(e){var i,r,o,n,a,h={};for(i=0;io.A.norm(this.frame1)&&(this.frame1=h),this.frame2=o.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),s=Math.cos(t);return[l.center.coords[1]+e*(s*l.frame1[1]+i*l.frame2[1]),l.center.coords[2]+e*(s*l.frame1[2]+i*l.frame2[2]),l.center.coords[3]+e*(s*l.frame1[3]+i*l.frame2[3])]},[0,2*Math.PI]],a)},t.A.Circle3D.prototype=new t.A.GeometryElement,s.A.copyPrototypeMethods(t.A.Circle3D,t.A.GeometryElement3D,"constructor3D"),t.A.extend(t.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=s.A.createFunction(t,this.board),this.addParentsFromJCFunctions([this.updateRadius]),this.board.update(),this},Radius:function(t){return s.A.exists(t)?(this.setRadius(t),this.Radius()):Math.abs(this.updateRadius())},normalizeFrame:function(){var t,e=o.A.norm(this.frame1),i=o.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=o.A.eps*o.A.eps;if(this.normal=s.A.evaluate(this.normalFunc),e=o.A.norm(this.normal),Math.abs(e)>i)for(t=0;t<4;t++)this.normal[t]/=e;return this},updateFrame:function(){return this.frame1=o.A.crossProduct(this.frame2.slice(1),this.normal.slice(1)),this.frame1.unshift(0),this.frame2=o.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)},projectScreenCoords:function(t,e,i){return this.curve.projectScreenCoords(t,e,i)}}),t.A.createCircle3D=function(e,i,r){var o,n=i[0],a=s.A.copyAttributes(r,e.options,"circle3d"),h=s.A.providePoints3D(n,[i[1]],r,"circle3d",["point"])[0],l=i[2],c=i[3];return s.A.isArray(l)&&3===l.length&&l.unshift(0),(o=new t.A.Circle3D(n,h,l,c,a)).curve.addParents([o]),o.addChild(o.curve),o.update(),o},t.A.registerElement("circle3d",t.A.createCircle3D),t.A.createIntersectionCircle3D=function(t,e,r){var o,n,a,l=e[0],c=e[1],d=e[2],u=s.A.copyAttributes(r,t.options,"intersectioncircle3d");try{a=h.A.intersectionFunction3D(l,c,d),n=l.create("point3d",a[0],{visible:!1}),o=l.create("circle3d",[n,a[1],a[2]],u),c.addChild(o),d.addChild(o)}catch(t){throw new Error("JSXGraph: Can't create 'intersection' with parent types '"+typeof e[1]+"' and '"+typeof e[2]+"'.")}return o.type=i.A.OBJECT_TYPE_INTERSECTION_CIRCLE3D,o.elType="intersectioncircle3d",o.setParents([c.id,d.id]),o},t.A.registerElement("intersectioncircle3d",t.A.createIntersectionCircle3D),t.A.Point3D=function(t,e,s,r){this.constructor(t.board,r,i.A.OBJECT_TYPE_POINT3D,i.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=s,this.position=[],this.movePath=[],this.moveCallback=null,this.moveInterval=null,this._c2d=null},t.A.Point3D.prototype=new t.A.GeometryElement,s.A.copyPrototypeMethods(t.A.Point3D,t.A.GeometryElement3D,"constructor3D"),s.A.copyMethodMap(t.A.Point3D,{}),t.A.extend(t.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(s.A.isFunction(this.F))this.coords=s.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;t1e-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[3],this.normalizeCoords()),this},addTransform:function(t,e){return this.addTransformGeneric(t,e),this},removeTransform:function(t){return this.removeTransformGeneric(t),this},clearTransforms:function(){return this.clearTransformsGeneric(),this},updateTransform:function(){var t,e;if(0===this.transformations.length||null===this.baseElement)return this;for(t=this===this.baseElement?this.initialCoords:this.baseElement.coords,e=0;e1e-12},distance:function(t){var e=this.coords,i=t.coords;return e[0]*e[0]>1e-12&&i[0]*i[0]>1e-12?o.A.hypot(i[1]-e[1],i[2]-e[2],i[3]-e[3]):Number.POSITIVE_INFINITY},moveTo:function(t,e,i){i=i||{};var r,n,a=Math.ceil(e/this.board.attr.animationdelay),h=t[0],l=t[1],c=t[2],d=this.coords[1]-h,u=this.coords[2]-l,p=this.coords[3]-c,f=()=>{};if(i.callback&&(f=i.callback),n=function(t){var e=t/a;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/a;throw new Error("valid effects are '==', '<>', '>', and '<'.")}return t/a},!s.A.exists(e)||0===e)return this.setPosition([h,l,c],!0),this.board.update(this);if(!s.A.exists(i.callback)&&Math.abs(d)=0;r--)this.animationPath[a-r]=[h+d*n(r),l+u*n(r),c+p*n(r)];return this.moveAlong(this.animationPath,e,{callback:f})},moveAlong:function(t,e,i){let r=e/t.length;if(s.A.isObject(i)&&"callback"in i&&(this.moveCallback=i.callback),!(this.movePath.length>0))return this.movePath=t,new Promise((t,e)=>{this.moveInterval=setInterval(()=>{if(this.movePath.length>0){let t=this.movePath.shift();this.setPosition(t,!0),this.board.update(this)}0===this.movePath.length&&(clearInterval(this.moveInterval),t(),s.A.isFunction(this.moveCallback)&&this.moveCallback())},r)});this.movePath=t},__evt__update3D:function(t){}}),t.A.createPoint3D=function(e,i,r){var o,n,a,h,l,c=i[0],d=null,u=null;if(a=i.length>2&&s.A.exists(i[i.length-1].is3D)&&!s.A.isTransformationOrArray(i[i.length-1])?i.pop():null,2===i.length)n=i[1];else if(3===i.length&&s.A.isPoint3D(i[1])&&s.A.isTransformationOrArray(i[2]))n=[0,0,0],d=i[1],u=i[2];else if(4===i.length)n=i.slice(1);else{if(5!==i.length)throw new Error("JSXGraph: Can't create point3d with parent types '"+typeof i[1]+"' and '"+typeof i[2]+"'.\nPossible parent types: [[x,y,z]], [x,y,z], or [[x,y,z], slide], () => [x, y, z], or [point, transformation(s)]");n=i.slice(1)}return o=s.A.copyAttributes(r,e.options,"point3d"),(l=new t.A.Point3D(c,n,a,o)).initCoords(),null!==d&&null!==u&&l.addTransform(d,u),h=c.project3DTo2D(l.coords),o=l.setAttr2D(o),l.element2D=c.create("point",h,o),l.element2D.view=c,l.element2D.dump=!1,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},t.A.registerElement("point3d",t.A.createPoint3D),t.A.Curve3D=function(t,e,r,o,n,a,h){this.constructor(t.board,h,i.A.OBJECT_TYPE_CURVE3D,i.A.OBJECT_CLASS_3D),this.constructor3D(t,"curve3d"),this.board.finalizeAdding(this),this._F=e,this._X=r,this._Y=o,this._Z=n,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]}):s.A.isFunction(this._X)?this._F=function(t){return[this._X(t),this._Y(t),this._Z(t)]}:this._F=null,this.range=a},t.A.Curve3D.prototype=new t.A.GeometryElement,s.A.copyPrototypeMethods(t.A.Curve3D,t.A.GeometryElement3D,"constructor3D"),s.A.copyMethodMap(t.A.Curve3D,{}),t.A.extend(t.A.Curve3D.prototype,{updateCoords:function(){var t,e,i,r,o,n,a=this.evalVisProp("numberpointshigh"),h=[1,0,0,0];if(this.points=[],s.A.exists(this.dataX))for(a=this.dataX.length,o=0;o=5&&(s.A.isArray(e[1])||s.A.isFunction(e[1])||s.A.isString(e[1]))&&s.A.isArray(e[2])&&3===e[1].length&&s.A.isArray(e[3])&&3===e[2].length&&s.A.isArray(e[4])&&3===e[3].length))throw new Error("JSXGraph: Can't create vector field 3D with parent types '"+typeof e[1]+"', '"+typeof e[2]+"', '"+typeof e[3]+"'.'"+typeof e[4]+"', ");return n=s.A.copyAttributes(i,t.options,"vectorfield3d"),(r=a.create("curve3d",[[],[],[]],n)).setF=function(t,e){var i,o,n;return s.A.isArray(t)?(i=s.A.createFunction(t[0],this.board,e),o=s.A.createFunction(t[1],this.board,e),n=s.A.createFunction(t[2],this.board,e),this.F=function(t,e,s){return[i(t,e,s),o(t,e,s),n(t,e,s)]}):this.F=s.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,n,a,h,l,c,d,u,p,f,A,_,m,g,b,v=this.evalVisProp("scale"),y=[s.A.evaluate(this.xData[0]),s.A.evaluate(this.yData[0]),s.A.evaluate(this.zData[0])],C=[s.A.evaluate(this.xData[1]),s.A.evaluate(this.yData[1]),s.A.evaluate(this.zData[1])],P=[s.A.evaluate(this.xData[2]),s.A.evaluate(this.yData[2]),s.A.evaluate(this.zData[2])],E=[(P[0]-y[0])/C[0],(P[1]-y[1])/C[1],(P[2]-y[2])/C[2]],x=this.evalVisProp("arrowhead.enabled");for(x&&(A=this.evalVisProp("arrowhead.size"),b=this.evalVisProp("arrowhead.angle"),_=A/t.unitX,m=A/t.unitY,g=A/Math.sqrt(t.unitX*t.unitY)),this.dataX=[],this.dataY=[],this.dataZ=[],i=0,h=y[0];i<=C[0];h+=E[0],i++)for(r=0,l=y[1];r<=C[1];l+=E[1],r++)for(e=0,c=y[2];e<=C[2];c+=E[2],e++)n=this.F(h,l,c),(a=o.A.norm(n))o.A.eps*o.A.eps)for(t=0;t<3;t++)this.normal[t]/=e;return this.normal.unshift(0),this.d=o.A.innerProduct(this.point.coords,this.normal,4),this},updateDataArray:function(){var t,e,i,r,n,a,l,c,d,u,p,f,A,_,m=["xPlaneRear","yPlaneRear","zPlaneRear"],g=[],b=[0,0,0],v=[0,0,0],y=[0,0,0],C=[0,0,0],P=1e-12,E=this.view;if(this.dataX=[],this.dataY=[],this.updateNormal(),"axisplane3d"!==this.elType&&E.defaultAxes&&s.A.evaluate(this.range_u[0])===-1/0&&s.A.evaluate(this.range_u[1])===1/0&&s.A.evaluate(this.range_v[0])===-1/0&&s.A.evaluate(this.range_v[1])===1/0){for(u=0;u{var i,s,r=0,o=e.polyhedron,n=o.faces[e.faceNumber],a=n.length;if(N||(C=f.evalVisProp("colormap.max"),P=C[0],x=C[1],C=f.evalVisProp("colormap.min"),E=C[0],O=C[1]),0!==a){for(i=0;io.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[3],this.normalizeCoords()),this},update:function(t){var e,s,r;return this.element2D.draggable()&&0!==h.A.distance(this._c2d,this.element2D.coords.usrCoords)?(this.view.isVerticalDrag()?e=this.view.project2DTo3DVertical(this.element2D,this.coords):(s=[1,0,0,this.coords[3]],e=this.view.project2DTo3DPlane(this.element2D,[1,0,0,1],s)),0!==e[0]&&(r=this.view.project3DToCube(e),this.coords=r[0],r[1]&&this.element2D.coords.setCoordinates(i.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(i.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(i.A.COORDS_BY_USER,this.view.project3DTo2D(e)),this.zIndex=o.A.innerProduct(this.view.matrix3DRotShift[3],e),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])>o.A.eps},__evt__update3D:function(t){}}),t.A.createText3D=function(e,i,r){var o,n,a,h,l,c,d=i[0];if(a=i.length>2&&s.A.exists(i[i.length-1].is3D)?i.pop():null,3===i.length)n=i[1],h=i[2];else{if(5!==i.length)throw new Error("JSXGraph: Can't create text3d with parent types '"+typeof i[1]+"' and '"+typeof i[2]+"'.\nPossible parent types: [[x,y,z], text], [x,y,z, text]");n=i.slice(1,4),h=i[4]}return o=s.A.copyAttributes(r,e.options,"text3d"),(c=new t.A.Text3D(d,n,h,a,o)).initCoords(),l=d.project3DTo2D(c.coords),o=c.setAttr2D(o),c.element2D=d.create("text",[l[1],l[2],h],o),c.element2D.view=d,c.element2D.dump=!1,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},t.A.registerElement("text3d",t.A.createText3D),t.A.createTicks3D=function(e,i,r){var n,a,h=i[0],l=i[1],c=i[2],d=i[3],u=i[4];return a=s.A.copyAttributes(r,e.options,"ticks3d"),(n=h.create("curve",[[],[]],a)).point=l,n.direction1=c,n.len=d,n.direction2=u,n.drawLabels=function(i){var r,n,a,l,c,d,u,p=this.len,f=this.evalVisProp("ticksdistance"),A=this.evalVisProp("tickendings"),_=this.evalVisProp("majorheight"),m=[0,0,0],g=[0,0,0],b=[0,0,0],v=[];if(r=(_/=Math.sqrt(e.unitX*e.unitY))*A[1]*2,this.dataX=[],this.dataY=[],s.A.isFunction(this.point))b=this.point().slice(1);else for(l=0;l<3;l++)b[l]=s.A.evaluate(this.point[l]);for(l=0;l<3;l++)m[l]=s.A.evaluate(this.direction1[l]),g[l]=s.A.evaluate(this.direction2[l]);for(n=t.A.Math.norm(m,3),a=t.A.Math.norm(g,3),l=0;l<3;l++)m[l]/=n,g[l]/=a;if(!(Math.abs(f)s.A.isPoint3D(t)))p=r[1];else if(!1===(p=s.A.providePoints3D(u,r.slice(1),o,"polygon3d",["vertices"])))throw new 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((n=new t.A.Polygon3D(u,p,c)).isDraggable=!0,c=n.setAttr2D(c),a=0;a0&&(this.zIndex/=e),2!==e&&(r.push(r[0]),n.push(n[0])),{X:r,Y:n}},addTransform:function(t,e){return 0===this.faceNumber&&this.addTransformGeneric(t,e),this},removeTransform:function(t){return 0===this.faceNumber&&this.removeTransformGeneric(t),this},clearTransforms:function(){return 0===this.faceNumber&&this.clearTransformsGeneric(),this},updateTransform:function(){var t,e,i,s,r;if(0!==this.faceNumber)return this;if(0===this.transformations.length||null===this.baseElement)return this;for(t=this.transformations,i=0;i1e-12)for(t=1;t<4;t++)this.normal[t]/=i;this.d=o.A.innerProduct(s,this.normal,4)}return this},updateRenderer:function(){return this.needsUpdate&&(this.needsUpdate=!1),this},getRotationFromAngles:function(t){var e,i,s,r,n,a,h=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]];return e=t.az,i=t.el,s=t.bank,r=-Math.sin(i),h[1][1]=-Math.cos(e),h[1][2]=Math.sin(e),h[1][3]=0,h[2][1]=r*Math.sin(e),h[2][2]=r*Math.cos(e),h[2][3]=Math.cos(i),h[3][1]=Math.cos(i)*Math.sin(e),h[3][2]=Math.cos(i)*Math.cos(e),h[3][3]=Math.sin(i),n=Math.cos(s),a=Math.sin(s),h=o.A.matMatMult([[1,0,0,0],[0,n,a,0],[0,-a,n,0],[0,0,0,1]],h)},shader:function(){var t,e,i,s,r,n,a,h,l,c,d,u,p;if(this.evalVisProp("shader.enabled")){if(t=this.evalVisProp("shader.hue"),e=this.evalVisProp("shader.saturation"),u=this.evalVisProp("shader.minlightness"),p=this.evalVisProp("shader.maxlightness"),"angle"===this.evalVisProp("shader.type").toLowerCase()){switch((l=this.evalVisProp("shader.light")).type){case 2:a={az:l.az*Math.PI/180,el:l.el*Math.PI/180,bank:l.bank*Math.PI/180},n=this.getRotationFromAngles(a)[3],h=l.dir;break;case 3:a={az:this.view.angles.az+l.az*Math.PI/180,el:this.view.angles.el+l.el*Math.PI/180,bank:this.view.angles.bank},n=this.getRotationFromAngles(a)[3],h=l.dir;break;default:n=this.view.matrix3DRotShift[3],h=l.dir}s=o.A.innerProduct(n,this.normal),i=u+(p-u)*(s=0===h?Math.abs(s):h<0?-s:s)}else d=this.view.zIndexMax,c=this.view.zIndexMin,i=u+(p-u)*((this.zIndex-c)/(d-c));return r="hsl("+t+","+e+"%,"+i+"%)",this.element2D.visProp.fillcolor=r,this._shadingDone=!0,this.zIndex}}}),t.A.createFace3D=function(e,i,r){var o,n,a=i[0],h=i[1],l=i[2];return o=s.A.copyAttributes(r,e.options,"face3d"),o=(n=new t.A.Face3D(a,h,l,o)).setAttr2D(o),n.element2D=a.create("curve",[[],[]],o),n.element2D.view=a,n.element2D.dump=!1,n.element2D.updateDataArray=function(){var t=n.updateDataArray2D();this.dataX=t.X,this.dataY=t.Y},n.element2D.hasPoint=function(){},n.addChild(n.element2D),n.inherits.push(n.element2D),n.element2D.setParents(n),n.element2D.prepareUpdate().update(),e.isSuspendedUpdate||n.element2D.updateVisibility().updateRenderer(),n},t.A.registerElement("face3d",t.A.createFace3D),t.A.Polyhedron3D=function(t,e,r,o){var n,a,h,l=this;for(this.constructor(t.board,o,i.A.OBJECT_TYPE_POLYHEDRON3D,i.A.OBJECT_CLASS_3D),this.constructor3D(t,"polyhedron3d"),this.board.finalizeAdding(this),this.elType="polyhedron3d",this.faces=r,this.numberFaces=r.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)&&s.A.exists(l.faces[e][t])&&l.faces[e][t].apply(l.faces[e],arguments);return l}},n=0;n0&&t.faces.length>0))throw new Error("Adding transformation failed. At least one of the two polyhedra has no faces.");return this.faces[0].addTransform(t.faces[0],e),this},removeTransform:function(t){if(!(this.faces.length>0))throw new Error("Removing transformation failed. The polyhedron has no faces.");return this.faces[0].removeTransform(t),this},clearTransforms:function(){if(!(this.faces.length>0))throw new Error("Removing transformation failed. The polyhedron has no faces.");return this.faces[0].clearTransforms(),this},toSTL:function(t){var e,i,s,r,o,n,a="solid ";for(void 0===t&&(t=this.name),a+=t+"\n",e=0;e0&&(d.fillcolor=u.fillcolorarray[n%u.fillcolorarray.length]),l=m.faces[n],s.A.isArray(l)&&2===l.length&&s.A.isObject(l[1])&&s.A.isArray(l[0])&&(s.A.mergeAttr(d,l[1]),m.faces[n]=l[0]),h=p.create("face3d",[m,n],d),f.push(h);for((c=new t.A.Polyhedron3D(p,m,f,u)).setParents(c),n=0;n1e-8?[-(n[0]*h[1][1]+n[1]*h[2][1])/a,-(n[0]*h[1][2]+n[1]*h[2][2])/a,-(n[0]*h[1][3]+n[1]*h[2][3])/a]:[h[1][1],h[1][2],h[1][3]],r.project3DTo2D([t.center.X()+l*(u*s[0]+d*h[3][1]),t.center.Y()+l*(u*s[1]+d*h[3][2]),t.center.Z()+l*(u*s[2]+d*h[3][3])]))}},buildProjection:function(t){var e=this.view,i={visible:!1,withLabel:!1},s=e.create("point",this.focusFn(-1),i),r=e.create("point",this.focusFn(1),i),o=e.create("point",this.innerVertexFn(e),i);this.aux2D=[s,r,o],this.element2D=e.create("ellipse",this.aux2D,void 0===t?this.visProp:t),this.addChild(this.element2D),this.inherits.push(this.element2D),this.element2D.view=this.view,this.element2D.dump=!1},projectCoords:function(t,e){var i=this.Radius(),s=[1].concat(t),r=this.center.coords,o=h.A.distance(r,s,4),n=p.A.subtract(s,r);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)}}),t.A.createSphere3D=function(e,i,r){var o,n,a,h,l,c,d=i[0];for(o=s.A.copyAttributes(r,e.options,"sphere3d"),n=[],c=1;c0)for(e=0;e0)for(t=0;t0)for(h=this.baseElement.points[0].length,i=0;i{var i,s,r=0,o=e.polyhedron,n=o.faces[e.faceNumber],a=n.length;if(E||(_=O.evalVisProp("colormap.max"),m=_[0],v=_[1],_=O.evalVisProp("colormap.min"),g=_[0],y=_[1]),0!==a){for(i=0;iparseFloat(t)),c=!1,s=0;s 3, + "expressions" => "sin(x)*cos(y)\nx^2-y^2", + "z_min" => -2, + "z_max" => 2, + ) + graph = JSON.parse(result[:answer].lines[1]) + + expect(graph).to include( + "dimensions" => 3, + "functions" => %w[sin(x)*cos(y) x^2-y^2], + "z_domain" => [-2, 2], + ) + expect(result[:token_usage]).to eq(0) + end + it "rejects unsafe, malformed and oversized graph requests with correction guidance" do invalid = [ {}, @@ -72,6 +90,11 @@ { "expressions" => "x", "x_min" => -10, "x_max" => 1_000_001 }, { "expressions" => "x", "title" => "a" * 121 }, { "expressions" => "x", "unexpected" => "value" }, + { "expressions" => "y" }, + { "expressions" => "x", "dimensions" => 4 }, + { "expressions" => "x", "z_min" => -1, "z_max" => 1 }, + { "expressions" => "x", "dimensions" => 3, "z_min" => 1 }, + { "expressions" => "x\ny\nx+y", "dimensions" => 3 }, ] invalid.each do |arguments| expect(tool.process(arguments)).to eq( diff --git a/spec/system/page_objects/components/function_plots.rb b/spec/system/page_objects/components/function_plots.rb index 34b7dd42..ac58ac08 100644 --- a/spec/system/page_objects/components/function_plots.rb +++ b/spec/system/page_objects/components/function_plots.rb @@ -4,8 +4,8 @@ module PageObjects module Components class FunctionPlots < PageObjects::Components::Base def has_rendered_graphs?(count:) - page.has_css?(".chatbot-function-plot__canvas svg.function-plot", count: count) && - page.has_css?(".chatbot-function-plot__canvas path.line", minimum: count) + page.has_css?(".chatbot-function-plot__canvas svg", count: count) && + page.has_css?(".chatbot-function-plot__curve", minimum: count) end def has_error? @@ -20,8 +20,54 @@ def has_no_error? end def has_separate_domain_segments? - page.has_css?(".chatbot-function-plot__canvas path.line-0", count: 2) && - page.has_no_css?(".chatbot-function-plot__canvas path.line-1") + path = find(".chatbot-function-plot__curve[data-curve='0']") + path["d"].scan(/M/i).length >= 2 + end + + def has_surface? + page.has_css?( + ".chatbot-function-plot__canvas[data-dimensions='3'] svg path[fill^='hsl']", + minimum: 100, + ) + end + + def rotate_surface + page.driver.with_playwright_page do |browser_page| + canvas = browser_page.locator(".chatbot-function-plot__canvas[data-dimensions='3']") + canvas.scroll_into_view_if_needed + box = canvas.bounding_box + browser_page.mouse.move(box["x"] + 200, box["y"] + 150) + browser_page.mouse.down + browser_page.mouse.move(box["x"] + 280, box["y"] + 190, steps: 10) + browser_page.mouse.up + end + end + + def surface_path + find( + ".chatbot-function-plot__canvas[data-dimensions='3'] svg path[fill^='hsl']", + match: :first, + )[ + "d" + ] + end + + def zoom_surface + page.driver.with_playwright_page do |browser_page| + canvas = browser_page.locator(".chatbot-function-plot__canvas[data-dimensions='3']") + box = canvas.bounding_box + browser_page.mouse.move(box["x"] + box["width"] / 2, box["y"] + box["height"] / 2) + browser_page.mouse.wheel(0, -300) + end + end + + def has_changed_surface?(original_path) + path = + find( + ".chatbot-function-plot__canvas[data-dimensions='3'] svg path[fill^='hsl']", + match: :first, + ) + page.has_css?("path[id='#{path[:id]}']:not([d='#{original_path}'])") end end end diff --git a/spec/system/read_function_plots_spec.rb b/spec/system/read_function_plots_spec.rb index 4f09dc6c..240a4300 100644 --- a/spec/system/read_function_plots_spec.rb +++ b/spec/system/read_function_plots_spec.rb @@ -66,4 +66,30 @@ expect(graphs).to have_separate_domain_segments expect(graphs).to have_no_error end + + it "lets readers rotate and zoom a 3D surface" do + graph = + DiscourseChatbot::FunctionPlot.markdown( + "dimensions" => 3, + "expressions" => "sin(x)*cos(y)", + "title" => "A 3D wave", + "x_min" => -3, + "x_max" => 3, + "y_min" => -3, + "y_max" => 3, + "z_min" => -1.5, + "z_max" => 1.5, + ) + Fabricate(:post, topic: topic, raw: graph) + topic_page.visit_topic(topic) + + expect(graphs).to have_surface + original_path = graphs.surface_path + graphs.rotate_surface + expect(graphs).to have_changed_surface(original_path) + rotated_path = graphs.surface_path + graphs.zoom_surface + expect(graphs).to have_changed_surface(rotated_path) + expect(graphs).to have_no_error + end end diff --git a/test/javascripts/unit/function-plot-expression-test.js b/test/javascripts/unit/function-plot-expression-test.js index ea6e3a0c..e31b84ce 100644 --- a/test/javascripts/unit/function-plot-expression-test.js +++ b/test/javascripts/unit/function-plot-expression-test.js @@ -2,7 +2,6 @@ import { module, test } from "qunit"; import { compileExpression, parseGraph, - splitUndefinedSegments, } from "discourse/plugins/discourse-chatbot/discourse/lib/function-plot-expression"; module("Chatbot | function plot expressions", function () { @@ -75,31 +74,27 @@ module("Chatbot | function plot expressions", function () { assert.throws(() => parseGraph("x".repeat(8193))); }); - test("keeps sampled curves separate across undefined domains", function (assert) { - const evaluate = compileExpression("sqrt(x^2-1)"); - const points = [-2, -1.5, -1, 1, 1.5, 2].map((x) => [x, evaluate(x)]); - assert.deepEqual(splitUndefinedSegments([points], evaluate, 0.5), [ - points.slice(0, 3), - points.slice(3), - ]); - assert.deepEqual(splitUndefinedSegments([[undefined]], evaluate, 0.5), []); - assert.deepEqual( - splitUndefinedSegments( - [ - [ - [0, 0], - [1, 1], - ], - ], - compileExpression("x"), - 1 - ), - [ - [ - [0, 0], - [1, 1], - ], - ] + test("supports two independent variables only for 3D surfaces", function (assert) { + const graph = parseGraph( + JSON.stringify({ + dimensions: 3, + functions: ["sin(x)*cos(y)", "x^2-y^2"], + z_domain: [-2, 2], + }) + ); + assert.strictEqual(graph.dimensions, 3); + assert.deepEqual(graph.zDomain, [-2, 2]); + assert.strictEqual(graph.functions[0].evaluate(Math.PI / 2, 0), 1); + assert.strictEqual(graph.functions[1].evaluate(3, 2), 5); + assert.throws(() => compileExpression("y")); + [ + { functions: ["y"] }, + { functions: ["x"], dimensions: 4 }, + { functions: ["x"], z_domain: [-1, 1] }, + { functions: ["x"], dimensions: 3, z_domain: [2, 1] }, + { functions: ["x", "y", "x+y"], dimensions: 3 }, + ].forEach((value) => + assert.throws(() => parseGraph(JSON.stringify(value))) ); }); }); From 74242aae82c53957b545b0c5b4b38d9229ed9f93 Mon Sep 17 00:00:00 2001 From: merefield Date: Mon, 26 Oct 2026 18:38:13 +0000 Subject: [PATCH 4/8] FIX: contain plot wheel zoom and accept 2D tool placeholders --- README.md | 5 +++-- .../components/function-plot-block.gjs | 20 ++++++++++++++++++ .../discourse/lib/function-plot-expression.js | 1 + .../discourse/lib/jsxgraph-renderer.js | 2 ++ config/locales/server.en.yml | 10 ++++----- lib/discourse_chatbot/function_plot.rb | 4 ++-- spec/lib/tools/function_plot_spec.rb | 21 ++++++++++++++++++- .../page_objects/components/function_plots.rb | 19 +++++++++++++++-- spec/system/read_function_plots_spec.rb | 11 ++++++++-- .../unit/function-plot-expression-test.js | 2 ++ 10 files changed, 81 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 15d94812..cbccc629 100644 --- a/README.md +++ b/README.md @@ -392,7 +392,7 @@ add `"dimensions":3` and optionally `"z_domain"` to its JSON definition: Readers drag a 3D surface to rotate it and scroll or pinch to zoom. The tool accepts the equivalent numeric `dimensions` parameter (2 by default, or 3 for surfaces) and paired `z_min`/`z_max` -bounds. Use at most two surfaces in a graph. This first 3D experiment supports +bounds. Z bounds are ignored for 2D plots, including placeholder values supplied by strict tool schemas. Use at most two surfaces in a graph. This first 3D experiment supports explicit surfaces `z=f(x,y)`, not arbitrary implicit solids or parametric curves. The tool is intended to accompany mathematical explanations, including the site's @@ -412,7 +412,8 @@ The curves intersect where $\sin(x)=\cos(x)$. Supported expressions use `x`, numeric literals, `pi`, `e`, explicit multiplication, `+ - * / ^`, parentheses, and the single-argument functions `sin`, `cos`, `tan`, -`asin`, `acos`, `atan`, `sqrt`, `abs`, `exp`, `log`, `log10`, `floor`, and `ceil`. +`asin`, `acos`, `atan`, `sqrt`, `cbrt`, `abs`, `exp`, `log`, `log10`, `floor`, and `ceil`. +Use `cbrt(...)` for real cube roots of negative as well as positive values. `log` is the natural logarithm and trigonometric angles are radians. Omit `y=` and LaTeX commands from graph expressions. There may be up to four expressions, each at most 256 characters. Titles are plain text, at most 120 characters. Both axes diff --git a/assets/javascripts/discourse/components/function-plot-block.gjs b/assets/javascripts/discourse/components/function-plot-block.gjs index 8a2bb81a..7affe3c4 100644 --- a/assets/javascripts/discourse/components/function-plot-block.gjs +++ b/assets/javascripts/discourse/components/function-plot-block.gjs @@ -18,6 +18,24 @@ export default class FunctionPlotBlock extends Component { let observer; let previousWidth; + const onWheel = (event) => { + event.preventDefault(); + event.stopPropagation(); + if (event.deltaY === 0) { + return; + } + const position = new window.JXG.Coords( + window.JXG.COORDS_BY_SCREEN, + board.getMousePosition(event), + board + ).usrCoords; + if (event.deltaY < 0) { + board.zoomIn(position[1], position[2]); + } else { + board.zoomOut(position[1], position[2]); + } + }; + const resize = () => { const width = Math.max(240, Math.min(element.clientWidth || 640, 1000)); const height = Math.max(260, Math.min(width * 0.7, 480)); @@ -40,6 +58,7 @@ export default class FunctionPlotBlock extends Component { this.graph = graph; resize(); board = createGraphBoard(element, graph); + element.addEventListener("wheel", onWheel, { passive: false }); observer = new ResizeObserver(() => { if (!disposed) { resize(); @@ -60,6 +79,7 @@ export default class FunctionPlotBlock extends Component { return () => { disposed = true; + element.removeEventListener("wheel", onWheel); observer?.disconnect(); if (board) { window.JXG.JSXGraph.freeBoard(board); diff --git a/assets/javascripts/discourse/lib/function-plot-expression.js b/assets/javascripts/discourse/lib/function-plot-expression.js index 510bb531..9ac6f89c 100644 --- a/assets/javascripts/discourse/lib/function-plot-expression.js +++ b/assets/javascripts/discourse/lib/function-plot-expression.js @@ -6,6 +6,7 @@ const FUNCTIONS = Object.freeze({ acos: Math.acos, atan: Math.atan, sqrt: Math.sqrt, + cbrt: Math.cbrt, abs: Math.abs, exp: Math.exp, log: Math.log, diff --git a/assets/javascripts/discourse/lib/jsxgraph-renderer.js b/assets/javascripts/discourse/lib/jsxgraph-renderer.js index 92230cc0..26ac87f6 100644 --- a/assets/javascripts/discourse/lib/jsxgraph-renderer.js +++ b/assets/javascripts/discourse/lib/jsxgraph-renderer.js @@ -34,6 +34,8 @@ export function createGraphBoard(element, graph) { showInfobox: false, keepaspectratio: is3D, resize: { enabled: false }, + // The component handles wheel events to prevent zoom from also scrolling the page. + registerEvents: { wheel: false }, pan: { enabled: !is3D, needShift: false }, zoom: { enabled: true, needShift: false }, title: "", diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index 71f6caa6..14951b2c 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -200,8 +200,8 @@ en: function_plot: description: | Prepare an interactive mathematical graph. For ordinary equations in x and y use dimensions=2 (the default): up to four curves y=f(x), with expressions in x. For a surface z=f(x,y), use dimensions=3: up to two expressions in x and y; readers can rotate the surface. Do not add a third dimension to an equation that only describes a 2D curve. Use when a graph would help explain roots, intersections, turning points, trigonometry, growth, or surfaces, even if the user did not explicitly ask for a graph. Accompany the graph with a mathematical explanation and the site's usual LaTeX/MathJax notation; the graph does not replace the answer or numerical calculation tools. - Supply expressions one per line, without 'y=', 'z=' or LaTeX. Use explicit multiplication (*), powers (^), parentheses, constants pi and e, and these single-argument functions: sin, cos, tan, asin, acos, atan, sqrt, abs, exp, log (natural logarithm), log10, floor, ceil. Trigonometric angles are radians. Examples: x^2-4 for 2D; sin(x)*cos(y) or x^2-y^2 for 3D. Expressions are limited to 256 characters each. - Choose axis bounds that show the relevant features. Bounds are numeric; supply both minimum and maximum for an axis, with -1000000 <= minimum < maximum <= 1000000. Each axis defaults to [-10,10] if omitted. Supply z_min/z_max only for 3D. The tool returns a function-plot fenced block; copy the complete block unchanged into your final answer outside any other code fence. The graph renders in the reader's browser; do not claim to have viewed its rendered appearance. + Supply expressions one per line, without 'y=', 'z=' or LaTeX. Use explicit multiplication (*), powers (^), parentheses, constants pi and e, and these single-argument functions: sin, cos, tan, asin, acos, atan, sqrt, cbrt, abs, exp, log (natural logarithm), log10, floor, ceil. Use cbrt(expression) for real cube roots, especially when the argument may be negative; do not use ^(1/3) for those roots. Trigonometric angles are radians. Examples: x^2-4 for 2D; sin(x)*cos(y) or x^2-y^2 for 3D. Expressions are limited to 256 characters each. + Choose axis bounds that show the relevant features. Bounds are numeric; supply both minimum and maximum for an axis, with -1000000 <= minimum < maximum <= 1000000. Each axis defaults to [-10,10] if omitted. The z_min/z_max bounds are used only for 3D and ignored for 2D. The tool returns a function-plot fenced block; copy the complete block unchanged into your final answer outside any other code fence. The graph renders in the reader's browser; do not claim to have viewed its rendered appearance. expressions: "Expressions separated by newlines: up to four in x for 2D curves, or up to two in x and y for 3D surfaces." title: "Optional plain-text graph title, up to 120 characters." dimensions: "Optional number 2 (default) for y=f(x) curves, or 3 for z=f(x,y) surfaces." @@ -209,9 +209,9 @@ en: x_max: "Right boundary of the graph. Supply with x_min." y_min: "Bottom boundary of the graph. Supply with y_max." y_max: "Top boundary of the graph. Supply with y_min." - z_min: "Lower z-axis boundary for a 3D surface only. Supply with z_max." - z_max: "Upper z-axis boundary for a 3D surface only. Supply with z_min." - error: "Unable to prepare the graph. Use dimensions=2 with up to four expressions in x, or dimensions=3 with up to two expressions in x and y, one per line, without y=, z= or LaTeX. Supply finite, increasing axis bounds in pairs, within -1000000 to 1000000, z bounds only for 3D, and a title of at most 120 characters. Correct the arguments before retrying." + z_min: "Lower z-axis boundary for a 3D surface. Ignored for 2D. Supply with z_max." + z_max: "Upper z-axis boundary for a 3D surface. Ignored for 2D. Supply with z_min." + error: "Unable to prepare the graph. Use dimensions=2 with up to four expressions in x, or dimensions=3 with up to two expressions in x and y, one per line, without y=, z= or LaTeX. Supply finite, increasing axis bounds in pairs, within -1000000 to 1000000, paired z bounds for 3D (ignored for 2D), and a title of at most 120 characters. Correct the arguments before retrying." remaining_bot_quota: description: | Get the current number of tokens or queries you have left for use of the bot this week diff --git a/lib/discourse_chatbot/function_plot.rb b/lib/discourse_chatbot/function_plot.rb index be9c30dc..9d75920f 100644 --- a/lib/discourse_chatbot/function_plot.rb +++ b/lib/discourse_chatbot/function_plot.rb @@ -4,7 +4,7 @@ module DiscourseChatbot class FunctionPlot - FUNCTIONS = %w[sin cos tan asin acos atan sqrt abs exp log log10 floor ceil].freeze + FUNCTIONS = %w[sin cos tan asin acos atan sqrt cbrt abs exp log log10 floor ceil].freeze VARIABLES = %w[x pi e].freeze MAX_FUNCTIONS = 4 MAX_EXPRESSION_LENGTH = 256 @@ -15,7 +15,6 @@ class FunctionPlot def self.markdown(args) dimensions = args.fetch("dimensions", 2) raise ArgumentError if [2, 3].exclude?(dimensions) - raise ArgumentError if dimensions == 2 && (args.key?("z_min") || args.key?("z_max")) expressions = args.fetch("expressions").split("\n").map(&:strip).reject(&:empty?) limit = dimensions == 3 ? 2 : MAX_FUNCTIONS @@ -59,6 +58,7 @@ def self.validate_expression!(expression, variables) calculator = Dentaku::Calculator.new calculator.add_function(:floor, :numeric, ->(value) { value.floor }) calculator.add_function(:ceil, :numeric, ->(value) { value.ceil }) + calculator.add_function(:cbrt, :numeric, ->(value) { Math.cbrt(value) }) raise ArgumentError if calculator.tokenizer.tokenize(normalized).length > MAX_TOKENS node = calculator.ast(normalized) raise ArgumentError unless (node.dependencies - variables).empty? diff --git a/spec/lib/tools/function_plot_spec.rb b/spec/lib/tools/function_plot_spec.rb index d7a780f4..e7d7a269 100644 --- a/spec/lib/tools/function_plot_spec.rb +++ b/spec/lib/tools/function_plot_spec.rb @@ -34,6 +34,7 @@ 2^-x 1/x sqrt(x) + cbrt(x) log(x) log10(x) exp(x) @@ -71,6 +72,25 @@ expect(result[:token_usage]).to eq(0) end + it "ignores z arguments supplied for 2D plots by providers requiring all fields" do + result = + tool.process( + "expressions" => "exp(-0.15*x)*sin(3*x)\nexp(-0.15*x)\n-exp(-0.15*x)", + "title" => "Damped oscillation with exponential envelopes", + "dimensions" => 2, + "x_min" => 0, + "x_max" => 20, + "y_min" => -1.1, + "y_max" => 1.1, + "z_min" => 0, + "z_max" => 0, + ) + graph = JSON.parse(result[:answer].lines[1]) + expect(graph["functions"].length).to eq(3) + expect(graph["x_domain"]).to eq([0, 20]) + expect(graph).not_to have_key("z_domain") + end + it "rejects unsafe, malformed and oversized graph requests with correction guidance" do invalid = [ {}, @@ -92,7 +112,6 @@ { "expressions" => "x", "unexpected" => "value" }, { "expressions" => "y" }, { "expressions" => "x", "dimensions" => 4 }, - { "expressions" => "x", "z_min" => -1, "z_max" => 1 }, { "expressions" => "x", "dimensions" => 3, "z_min" => 1 }, { "expressions" => "x\ny\nx+y", "dimensions" => 3 }, ] diff --git a/spec/system/page_objects/components/function_plots.rb b/spec/system/page_objects/components/function_plots.rb index ac58ac08..994c118a 100644 --- a/spec/system/page_objects/components/function_plots.rb +++ b/spec/system/page_objects/components/function_plots.rb @@ -52,12 +52,27 @@ def surface_path ] end - def zoom_surface + def zoom_surface(delta_y: -300) page.driver.with_playwright_page do |browser_page| canvas = browser_page.locator(".chatbot-function-plot__canvas[data-dimensions='3']") box = canvas.bounding_box browser_page.mouse.move(box["x"] + box["width"] / 2, box["y"] + box["height"] / 2) - browser_page.mouse.wheel(0, -300) + browser_page.mouse.wheel(0, delta_y) + end + end + + def page_scroll_position + page.evaluate_async_script(<<~JS) + const done = arguments[0]; + requestAnimationFrame(() => requestAnimationFrame(() => done(window.scrollY))); + JS + end + + def scroll_outside_plot + page.driver.with_playwright_page do |browser_page| + viewport_width = browser_page.evaluate("window.innerWidth") + browser_page.mouse.move(viewport_width - 40, 500) + browser_page.mouse.wheel(0, 300) end end diff --git a/spec/system/read_function_plots_spec.rb b/spec/system/read_function_plots_spec.rb index 240a4300..719488bb 100644 --- a/spec/system/read_function_plots_spec.rb +++ b/spec/system/read_function_plots_spec.rb @@ -67,7 +67,7 @@ expect(graphs).to have_no_error end - it "lets readers rotate and zoom a 3D surface" do + it "lets readers rotate and zoom a 3D surface without scrolling the page" do graph = DiscourseChatbot::FunctionPlot.markdown( "dimensions" => 3, @@ -80,7 +80,7 @@ "z_min" => -1.5, "z_max" => 1.5, ) - Fabricate(:post, topic: topic, raw: graph) + Fabricate(:post, topic: topic, raw: graph + "\n\n" + ("More about the graph.\n\n" * 30)) topic_page.visit_topic(topic) expect(graphs).to have_surface @@ -90,6 +90,13 @@ rotated_path = graphs.surface_path graphs.zoom_surface expect(graphs).to have_changed_surface(rotated_path) + zoomed_path = graphs.surface_path + scroll_position = graphs.page_scroll_position + graphs.zoom_surface(delta_y: 300) + expect(graphs).to have_changed_surface(zoomed_path) + expect(graphs.page_scroll_position).to eq(scroll_position) expect(graphs).to have_no_error + graphs.scroll_outside_plot + try_until_success { expect(graphs.page_scroll_position).to be > scroll_position } end end diff --git a/test/javascripts/unit/function-plot-expression-test.js b/test/javascripts/unit/function-plot-expression-test.js index e31b84ce..4c45261d 100644 --- a/test/javascripts/unit/function-plot-expression-test.js +++ b/test/javascripts/unit/function-plot-expression-test.js @@ -15,6 +15,8 @@ module("Chatbot | function plot expressions", function () { ["exp(log(e))", 0, Math.E], ["log10(1000)", 0, 3], ["sqrt(abs(x))", -4, 2], + ["cbrt(x)", -8, -2], + ["cbrt((3-4*x^3)/2)", 1, Math.cbrt(-0.5)], ["1e3*x", 2, 2000], ].forEach(([expression, x, expected]) => { assert.true( From 714a4987d1ae5da23f67e17d2322ba273cb72f7c Mon Sep 17 00:00:00 2001 From: merefield Date: Mon, 26 Oct 2026 20:54:32 +0000 Subject: [PATCH 5/8] FEATURE: restore curve tracing with axis and series intersection snapping --- README.md | 20 ++- .../components/function-plot-block.gjs | 56 +++++++- .../discourse/lib/function-plot-trace.js | 122 ++++++++++++++++++ .../discourse/lib/jsxgraph-renderer.js | 79 ++++++++++++ assets/stylesheets/common/chatbot_common.scss | 11 ++ config/locales/client.en.yml | 3 +- config/locales/server.en.yml | 2 +- public/function-plot/1.26.0/LICENSE | 21 --- public/function-plot/1.26.0/function-plot.js | 2 - public/function-plot/README.md | 17 --- public/jsxgraph/README.md | 5 +- .../page_objects/components/function_plots.rb | 40 ++++++ spec/system/read_function_plots_spec.rb | 41 ++++++ .../unit/function-plot-trace-test.js | 105 +++++++++++++++ 14 files changed, 470 insertions(+), 54 deletions(-) create mode 100644 assets/javascripts/discourse/lib/function-plot-trace.js delete mode 100644 public/function-plot/1.26.0/LICENSE delete mode 100644 public/function-plot/1.26.0/function-plot.js delete mode 100644 public/function-plot/README.md create mode 100644 test/javascripts/unit/function-plot-trace-test.js diff --git a/README.md b/README.md index cbccc629..d6e8fb4e 100644 --- a/README.md +++ b/README.md @@ -373,7 +373,7 @@ your community's requests. ### Mathematical function graphs -This local experimental branch bundles JSXGraph 1.14.1 for interactive 2D curves +Chatbot bundles JSXGraph 1.14.1 for interactive 2D curves and 3D surfaces rendered locally in the reader's browser. `chatbot_function_plot_enabled` defaults to `true`, and `plot_function` is included in the defaults for all `chatbot_tools_*_trust` settings. @@ -392,11 +392,21 @@ add `"dimensions":3` and optionally `"z_domain"` to its JSON definition: Readers drag a 3D surface to rotate it and scroll or pinch to zoom. The tool accepts the equivalent numeric `dimensions` parameter (2 by default, or 3 for surfaces) and paired `z_min`/`z_max` -bounds. Z bounds are ignored for 2D plots, including placeholder values supplied by strict tool schemas. Use at most two surfaces in a graph. This first 3D experiment supports +bounds. Z bounds are ignored for 2D plots, including placeholder values supplied by strict tool schemas. Use at most two surfaces in a graph. The 3D mode supports explicit surfaces `z=f(x,y)`, not arbitrary implicit solids or parametric curves. +In 2D, moving the pointer shows a coloured marker and live x/y coordinates for +each curve visible at that x value. Undefined and off-screen values are hidden; +the markers and coordinate readouts clear when the pointer leaves the plot. +Within six screen pixels of a nearby axis intercept or series intersection, +tracing snaps to that crossing. Intersecting series share a marker location and +coordinate reading, and axis intercepts show a zero coordinate. All series follow +the selected x position. Crossings are found numerically; coincident series, poles, +jumps and undefined regions do not introduce false intersection targets. +Tangential contacts can be missed unless a sampled point lands exactly on the contact. + The tool is intended to accompany mathematical explanations, including the site's -usual MathJax/LaTeX output when Discourse Math is installed. For example, an answer +usual MathJax/LaTeX output when Discourse Math is enabled (`discourse_math_enabled`). For example, an answer about quadratic roots can explain the algebra and include a plot of `x^2-4`. The graph tool uses no external API and adds no notional tool quota charge. @@ -410,12 +420,12 @@ The curves intersect where $\sin(x)=\cos(x)$. ``` ```` -Supported expressions use `x`, numeric literals, `pi`, `e`, explicit multiplication, +Supported expressions use `x` (and `y` for 3D surfaces), numeric literals, `pi`, `e`, explicit multiplication, `+ - * / ^`, parentheses, and the single-argument functions `sin`, `cos`, `tan`, `asin`, `acos`, `atan`, `sqrt`, `cbrt`, `abs`, `exp`, `log`, `log10`, `floor`, and `ceil`. Use `cbrt(...)` for real cube roots of negative as well as positive values. `log` is the natural logarithm and trigonometric angles are radians. Omit `y=` and -LaTeX commands from graph expressions. There may be up to four expressions, each +LaTeX commands from graph expressions. There may be up to four 2D expressions or two 3D expressions, each at most 256 characters. Titles are plain text, at most 120 characters. Both axes default to `[-10,10]`; custom domains must be finite, increasing pairs within `[-1000000,1000000]`, with a span of at least `0.000001`. diff --git a/assets/javascripts/discourse/components/function-plot-block.gjs b/assets/javascripts/discourse/components/function-plot-block.gjs index 7affe3c4..f2231970 100644 --- a/assets/javascripts/discourse/components/function-plot-block.gjs +++ b/assets/javascripts/discourse/components/function-plot-block.gjs @@ -1,22 +1,41 @@ import Component from "@glimmer/component"; import { tracked } from "@glimmer/tracking"; +import { get } from "@ember/helper"; import { modifier } from "ember-modifier"; import loadScript from "discourse/lib/load-script"; import { eq } from "discourse/truth-helpers"; import { i18n } from "discourse-i18n"; import { parseGraph } from "../lib/function-plot-expression"; -import { createGraphBoard } from "../lib/jsxgraph-renderer"; +import { createCurveTrace, createGraphBoard } from "../lib/jsxgraph-renderer"; export default class FunctionPlotBlock extends Component { @tracked failed = false; @tracked graph = null; @tracked loading = true; + @tracked traceValues = []; renderPlot = modifier((element, [raw]) => { let disposed = false; let board; let observer; let previousWidth; + let trace; + const locale = document.documentElement.lang || undefined; + const formatter = new Intl.NumberFormat(locale, { + maximumSignificantDigits: 6, + }); + const scientificFormatter = new Intl.NumberFormat(locale, { + maximumSignificantDigits: 6, + notation: "scientific", + }); + const formatNumber = (value) => { + const magnitude = Math.abs(value); + return ( + magnitude !== 0 && (magnitude < 0.0001 || magnitude >= 1000000) + ? scientificFormatter + : formatter + ).format(value === 0 ? 0 : value); + }; const onWheel = (event) => { event.preventDefault(); @@ -34,6 +53,7 @@ export default class FunctionPlotBlock extends Component { } else { board.zoomOut(position[1], position[2]); } + trace?.move(event); }; const resize = () => { @@ -41,6 +61,7 @@ export default class FunctionPlotBlock extends Component { const height = Math.max(260, Math.min(width * 0.7, 480)); if (width !== previousWidth) { previousWidth = width; + trace?.clear(); element.style.height = `${height}px`; board?.resizeContainer(width, height, true); } @@ -58,6 +79,22 @@ export default class FunctionPlotBlock extends Component { this.graph = graph; resize(); board = createGraphBoard(element, graph); + if (graph.dimensions === 2) { + trace = createCurveTrace(board, graph, (values) => { + if (!disposed) { + this.traceValues = values.map((value) => + value + ? i18n("chatbot.function_plot.trace_values", { + x: formatNumber(value.x), + y: formatNumber(value.y), + }) + : null + ); + } + }); + element.addEventListener("pointermove", trace.move); + element.addEventListener("pointerleave", trace.clear); + } element.addEventListener("wheel", onWheel, { passive: false }); observer = new ResizeObserver(() => { if (!disposed) { @@ -80,6 +117,11 @@ export default class FunctionPlotBlock extends Component { return () => { disposed = true; element.removeEventListener("wheel", onWheel); + if (trace) { + element.removeEventListener("pointermove", trace.move); + element.removeEventListener("pointerleave", trace.clear); + trace.destroy(); + } observer?.disconnect(); if (board) { window.JXG.JSXGraph.freeBoard(board); @@ -110,8 +152,16 @@ export default class FunctionPlotBlock extends Component { {{this.renderPlot @data.raw}} >
    - {{#each this.graph.functions as |curve|}} -
  • {{curve.expression}}
  • + {{#each this.graph.functions as |curve index|}} +
  • + {{curve.expression}} + {{#if (eq this.graph.dimensions 2)}} + {{get + this.traceValues + index + }} + {{/if}} +
  • {{/each}}
{{i18n diff --git a/assets/javascripts/discourse/lib/function-plot-trace.js b/assets/javascripts/discourse/lib/function-plot-trace.js new file mode 100644 index 00000000..58994713 --- /dev/null +++ b/assets/javascripts/discourse/lib/function-plot-trace.js @@ -0,0 +1,122 @@ +function crossing(evaluate, left, right) { + let leftValue = evaluate(left); + let rightValue = evaluate(right); + if (!Number.isFinite(leftValue) || !Number.isFinite(rightValue)) { + return null; + } + if (leftValue === 0 && rightValue === 0) { + return null; + } + if (leftValue === 0) { + return left; + } + if (rightValue === 0) { + return right; + } + if (Math.sign(leftValue) === Math.sign(rightValue)) { + return null; + } + const initialLeft = Math.abs(leftValue); + const initialRight = Math.abs(rightValue); + for (let iteration = 0; iteration < 48; iteration++) { + const middle = left + (right - left) / 2; + if (middle === left || middle === right) { + break; + } + const value = evaluate(middle); + if (!Number.isFinite(value)) { + return null; + } + if (value === 0) { + return middle; + } + if (Math.sign(value) === Math.sign(leftValue)) { + left = middle; + leftValue = value; + } else { + right = middle; + rightValue = value; + } + } + // Both sides must approach zero: sign changes alone also occur at poles and jumps. + if ( + Math.abs(leftValue) < initialLeft * 0.001 && + Math.abs(rightValue) < initialRight * 0.001 + ) { + return left + (right - left) / 2; + } + return null; +} + +export function traceSeriesCoordinates(evaluators, x, bounds, width) { + const [minimumX, maximumY, maximumX, minimumY] = bounds; + const tolerance = ((maximumX - minimumX) * 6) / width; + const candidates = []; + const samples = [ + Math.max(minimumX, x - tolerance), + x, + Math.min(maximumX, x + tolerance), + ]; + const roots = (evaluate) => { + const result = []; + for (let index = 1; index < samples.length; index++) { + const root = crossing(evaluate, samples[index - 1], samples[index]); + if (root !== null) { + result.push(root); + } + } + return result; + }; + const visible = (value) => + Number.isFinite(value.x) && + Number.isFinite(value.y) && + value.y >= minimumY && + value.y <= maximumY; + evaluators.forEach((evaluate, index) => { + if (minimumX <= 0 && maximumX >= 0 && Math.abs(x) <= tolerance) { + candidates.push({ x: 0, y: evaluate(0), indices: [index] }); + } + if (minimumY <= 0 && maximumY >= 0) { + roots(evaluate).forEach((root) => + candidates.push({ x: root, y: 0, indices: [index] }) + ); + } + for (let other = index + 1; other < evaluators.length; other++) { + roots((value) => evaluate(value) - evaluators[other](value)).forEach( + (root) => { + const firstY = evaluate(root); + const secondY = evaluators[other](root); + if ( + visible({ x: root, y: firstY }) && + visible({ x: root, y: secondY }) + ) { + candidates.push({ + x: root, + y: firstY + (secondY - firstY) / 2, + indices: [index, other], + }); + } + } + ); + } + }); + const snapped = candidates + .filter(visible) + .sort( + (first, second) => + Math.abs(first.x - x) - Math.abs(second.x - x) || + second.indices.length - first.indices.length + )[0]; + const traceX = snapped?.x ?? x; + return evaluators.map((evaluate, index) => { + const value = { + x: traceX, + y: snapped?.indices.includes(index) ? snapped.y : evaluate(traceX), + }; + return visible(value) ? value : null; + }); +} + +export function traceCoordinates(evaluate, x, bounds, width) { + return traceSeriesCoordinates([evaluate], x, bounds, width)[0]; +} diff --git a/assets/javascripts/discourse/lib/jsxgraph-renderer.js b/assets/javascripts/discourse/lib/jsxgraph-renderer.js index 26ac87f6..55ab10d0 100644 --- a/assets/javascripts/discourse/lib/jsxgraph-renderer.js +++ b/assets/javascripts/discourse/lib/jsxgraph-renderer.js @@ -1,5 +1,84 @@ +import { traceSeriesCoordinates } from "./function-plot-trace"; + const COLORS = ["#0088cc", "#e4572e", "#32a66a", "#b279a2"]; +export function createCurveTrace(board, graph, onValues) { + let values = []; + let frame = null; + let pointer; + const points = graph.functions.map((_curve, index) => { + const point = board.create( + "point", + [() => values[index]?.x ?? NaN, () => values[index]?.y ?? NaN], + { + name: "", + withLabel: false, + fixed: true, + highlight: false, + showInfobox: false, + size: 3, + strokeWidth: 2, + strokeColor: COLORS[index], + fillColor: COLORS[index], + visible: () => Boolean(values[index]), + } + ); + point.hasPoint = () => false; + point.rendNode.classList.add("chatbot-function-plot__trace-point"); + return point; + }); + const renderPoints = () => { + points.forEach((point) => + point.prepareUpdate().update().updateVisibility().updateRenderer() + ); + onValues(values); + }; + const clear = () => { + if (frame !== null) { + cancelAnimationFrame(frame); + frame = null; + } + pointer = null; + values = []; + renderPoints(); + }; + const update = () => { + frame = null; + const position = board.getMousePosition(pointer); + if ( + position[0] < 0 || + position[0] > board.canvasWidth || + position[1] < 0 || + position[1] > board.canvasHeight + ) { + clear(); + return; + } + const x = new window.JXG.Coords( + window.JXG.COORDS_BY_SCREEN, + position, + board + ).usrCoords[1]; + values = traceSeriesCoordinates( + graph.functions.map((curve) => curve.evaluate), + x, + board.getBoundingBox(), + board.canvasWidth + ); + renderPoints(); + }; + return { + clear, + move(event) { + pointer = event; + if (frame === null) { + frame = requestAnimationFrame(update); + } + }, + destroy: clear, + }; +} + export function createGraphBoard(element, graph) { const library = window.JXG; // Internal labels must also use the interpreter under Discourse's CSP. diff --git a/assets/stylesheets/common/chatbot_common.scss b/assets/stylesheets/common/chatbot_common.scss index fc6c9fdd..e0d46d8f 100644 --- a/assets/stylesheets/common/chatbot_common.scss +++ b/assets/stylesheets/common/chatbot_common.scss @@ -146,6 +146,11 @@ padding-left: 1.5em; font-family: monospace; + li { + display: flex; + flex-direction: column; + } + li:nth-child(1) { color: #08c; } @@ -163,6 +168,12 @@ } } + &__coordinates { + min-height: 1.4em; + font-size: var(--font-down-1); + white-space: nowrap; + } + &__definition { margin-top: 0.5em; font-size: var(--font-down-1); diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 66f68fa7..eb538403 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -8,7 +8,8 @@ en: error: "This graph could not be rendered. Check its expressions and axis bounds." fallback: "Graph definition" label: "Interactive function graph" - help: "Drag to pan; scroll or pinch to zoom. Angles are in radians." + help: "Move the pointer to trace values, snapping near axes and series intersections; drag to pan; scroll or pinch to zoom. Angles are in radians." + trace_values: "x = %{x}, y = %{y}" help_3d: "Drag to rotate; scroll or pinch to zoom. Angles are in radians." tool_selection_mode: remove_definitions: "Remove unselected tool definitions" diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index 14951b2c..1999e3b8 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -1,6 +1,6 @@ en: site_settings: - chatbot_function_plot_enabled: "Render function-plot graph blocks locally in posts, PMs and Chat. The plot_function tool is included in the defaults for every trust level; add it to any customised tool lists to let Chatbot prepare graphs. Graphs can accompany maths explanations and MathJax output." + chatbot_function_plot_enabled: "Render interactive 2D curves and 3D surfaces from function-plot blocks using JSXGraph in posts, PMs and Chat. The plot_function tool is included in the defaults for every trust level; add it to any customised tool lists to let Chatbot prepare graphs. Graphs can accompany maths explanations and MathJax output." chatbot_enabled: "Enable the chatbot plugin" chatbot_llm_provider: "Provider used for chatbot completions. OpenAI, Anthropic, Google Gemini, and xAI are supported through their OpenAI-compatible APIs." chatbot_open_ai_token: "OpenAI API key shared by every chatbot capability configured to use OpenAI. Get a key at OpenAI." diff --git a/public/function-plot/1.26.0/LICENSE b/public/function-plot/1.26.0/LICENSE deleted file mode 100644 index 57bde726..00000000 --- a/public/function-plot/1.26.0/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2015 Mauricio Poppe - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/public/function-plot/1.26.0/function-plot.js b/public/function-plot/1.26.0/function-plot.js deleted file mode 100644 index 3c12e692..00000000 --- a/public/function-plot/1.26.0/function-plot.js +++ /dev/null @@ -1,2 +0,0 @@ -!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.functionPlot=n():t.functionPlot=n()}(self,(()=>(()=>{var t={5248:(t,n,e)=>{"use strict";t.exports=e(9976)},517:t=>{"use strict";t.exports=function(){const t=Object.create(Math);return t.factory=function(t){if("number"!=typeof t)throw new TypeError("built-in math factory only accepts numbers");return Number(t)},t.add=function(t,n){return t+n},t.sub=function(t,n){return t-n},t.mul=function(t,n){return t*n},t.div=function(t,n){return t/n},t.mod=function(t,n){return t%n},t.factorial=function(t){let n=1;for(let e=2;e<=t;e+=1)n*=e;return n},t.nthRoot=function(t,n){const e=n<0;if(e&&(n=-n),0===n)throw new Error("Root must be non-zero");if(t<0&&Math.abs(n)%2!=1)throw new Error("Root must be odd when a is negative.");if(0===t)return 0;if(!isFinite(t))return e?0:t;let r=Math.pow(Math.abs(t),1/n);return r=t<0?-r:r,e?1/r:r},t.logicalOR=function(t,n){return t||n},t.logicalXOR=function(t,n){return t!=n},t.logicalAND=function(t,n){return t&&n},t.bitwiseOR=function(t,n){return t|n},t.bitwiseXOR=function(t,n){return t^n},t.bitwiseAND=function(t,n){return t&n},t.lessThan=function(t,n){return tn},t.greaterEqualThan=function(t,n){return t>=n},t.equal=function(t,n){return t==n},t.strictlyEqual=function(t,n){return t===n},t.notEqual=function(t,n){return t!=n},t.strictlyNotEqual=function(t,n){return t!==n},t.shiftRight=function(t,n){return t>>n},t.shiftLeft=function(t,n){return t<>>n},t.negative=function(t){return-t},t.positive=function(t){return t},t}},9976:(t,n,e)=>{"use strict";const r=e(2223),i=e(517)();function o(t){Object.keys(t).forEach((function(n){const e=t[n];t[n]=i.factory(e)}))}t.exports=function(t){return(new r).setDefs({$$processScope:o}).parse(t).compile(i)},t.exports.math=i},4822:t=>{var n=!1;if("undefined"!=typeof Float64Array){var e=new Float64Array(1),r=new Uint32Array(e.buffer);e[0]=1,n=!0,1072693248===r[1]?(t.exports=function(t){return e[0]=t,[r[0],r[1]]},t.exports.pack=function(t,n){return r[0]=t,r[1]=n,e[0]},t.exports.lo=function(t){return e[0]=t,r[0]},t.exports.hi=function(t){return e[0]=t,r[1]}):1072693248===r[0]?(t.exports=function(t){return e[0]=t,[r[1],r[0]]},t.exports.pack=function(t,n){return r[1]=t,r[0]=n,e[0]},t.exports.lo=function(t){return e[0]=t,r[1]},t.exports.hi=function(t){return e[0]=t,r[0]}):n=!1}if(!n){var i=new Buffer(8);t.exports=function(t){return i.writeDoubleLE(t,0,!0),[i.readUInt32LE(0,!0),i.readUInt32LE(4,!0)]},t.exports.pack=function(t,n){return i.writeUInt32LE(t,0,!0),i.writeUInt32LE(n,4,!0),i.readDoubleLE(0,!0)},t.exports.lo=function(t){return i.writeDoubleLE(t,0,!0),i.readUInt32LE(0,!0)},t.exports.hi=function(t){return i.writeDoubleLE(t,0,!0),i.readUInt32LE(4,!0)}}t.exports.sign=function(n){return t.exports.hi(n)>>>31},t.exports.exponent=function(n){return(t.exports.hi(n)<<1>>>21)-1023},t.exports.fraction=function(n){var e=t.exports.lo(n),r=t.exports.hi(n),i=1048575&r;return 2146435072&r&&(i+=1<<20),[e,i]},t.exports.denormalized=function(n){return!(2146435072&t.exports.hi(n))}},7187:t=>{"use strict";var n,e="object"==typeof Reflect?Reflect:null,r=e&&"function"==typeof e.apply?e.apply:function(t,n,e){return Function.prototype.apply.call(t,n,e)};n=e&&"function"==typeof e.ownKeys?e.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var i=Number.isNaN||function(t){return t!=t};function o(){o.init.call(this)}t.exports=o,t.exports.once=function(t,n){return new Promise((function(e,r){function i(e){t.removeListener(n,o),r(e)}function o(){"function"==typeof t.removeListener&&t.removeListener("error",i),e([].slice.call(arguments))}y(t,n,o,{once:!0}),"error"!==n&&function(t,n,e){"function"==typeof t.on&&y(t,"error",n,{once:!0})}(t,i)}))},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var a=10;function s(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function u(t){return void 0===t._maxListeners?o.defaultMaxListeners:t._maxListeners}function l(t,n,e,r){var i,o,a,l;if(s(e),void 0===(o=t._events)?(o=t._events=Object.create(null),t._eventsCount=0):(void 0!==o.newListener&&(t.emit("newListener",n,e.listener?e.listener:e),o=t._events),a=o[n]),void 0===a)a=o[n]=e,++t._eventsCount;else if("function"==typeof a?a=o[n]=r?[e,a]:[a,e]:r?a.unshift(e):a.push(e),(i=u(t))>0&&a.length>i&&!a.warned){a.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(n)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=t,c.type=n,c.count=a.length,l=c,console&&console.warn&&console.warn(l)}return t}function c(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function h(t,n,e){var r={fired:!1,wrapFn:void 0,target:t,type:n,listener:e},i=c.bind(r);return i.listener=e,r.wrapFn=i,i}function f(t,n,e){var r=t._events;if(void 0===r)return[];var i=r[n];return void 0===i?[]:"function"==typeof i?e?[i.listener||i]:[i]:e?function(t){for(var n=new Array(t.length),e=0;e0&&(a=n[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var u=o[t];if(void 0===u)return!1;if("function"==typeof u)r(u,this,n);else{var l=u.length,c=d(u,l);for(e=0;e=0;o--)if(e[o]===n||e[o].listener===n){a=e[o].listener,i=o;break}if(i<0)return this;0===i?e.shift():function(t,n){for(;n+1=0;r--)this.removeListener(t,n[r]);return this},o.prototype.listeners=function(t){return f(this,t,!0)},o.prototype.rawListeners=function(t){return f(this,t,!1)},o.listenerCount=function(t,n){return"function"==typeof t.listenerCount?t.listenerCount(n):p.call(t,n)},o.prototype.listenerCount=p,o.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]}},4470:t=>{"use strict";var n=Object.prototype.hasOwnProperty,e=Object.prototype.toString,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,o=function(t){return"function"==typeof Array.isArray?Array.isArray(t):"[object Array]"===e.call(t)},a=function(t){if(!t||"[object Object]"!==e.call(t))return!1;var r,i=n.call(t,"constructor"),o=t.constructor&&t.constructor.prototype&&n.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!i&&!o)return!1;for(r in t);return void 0===r||n.call(t,r)},s=function(t,n){r&&"__proto__"===n.name?r(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},u=function(t,e){if("__proto__"===e){if(!n.call(t,e))return;if(i)return i(t,e).value}return t[e]};t.exports=function t(){var n,e,r,i,l,c,h=arguments[0],f=1,p=arguments.length,d=!1;for("boolean"==typeof h&&(d=h,h=arguments[1]||{},f=2),(null==h||"object"!=typeof h&&"function"!=typeof h)&&(h={});f{"use strict";t.exports=e(2320)},3380:t=>{"use strict";t.exports=function(t){t.mod=t.fmod,t.lessThan=t.lt,t.lessEqualThan=t.leq,t.greaterThan=t.gt,t.greaterEqualThan=t.geq,t.strictlyEqual=t.equal,t.strictlyNotEqual=t.notEqual,t.logicalAND=function(t,n){return t&&n},t.logicalXOR=function(t,n){return t^n},t.logicalOR=function(t,n){return t||n}}},2320:(t,n,e)=>{"use strict";const r=e(2223),i=e(9851).ZP;function o(t){Object.keys(t).forEach((function(n){const e=t[n];"number"==typeof e||Array.isArray(e)?t[n]=i.factory(e):"object"==typeof e&&"lo"in e&&"hi"in e&&(t[n]=i.factory(e.lo,e.hi))}))}e(3380)(i),t.exports=function(t){return(new r).setDefs({$$processScope:o}).parse(t).compile(i)},t.exports.policies=e(4186)(i),t.exports.Interval=i},4186:t=>{"use strict";t.exports=function(t){return{disableRounding:function(){t.round.disable()},enableRounding:function(){t.round.enable()}}}},9851:(t,n,e)=>{"use strict";e.d(n,{ZP:()=>Ct});var r={};e.r(r),e.d(r,{hasInterval:()=>y,hasValue:()=>d,intervalsOverlap:()=>m,isEmpty:()=>c,isInterval:()=>l,isSingleton:()=>f,isWhole:()=>h,zeroIn:()=>p});var i={};e.r(i),e.d(i,{almostEqual:()=>D,assertIncludes:()=>$,equal:()=>I,geq:()=>B,greaterEqualThan:()=>q,greaterThan:()=>F,gt:()=>Y,leq:()=>R,lessEqualThan:()=>U,lessThan:()=>j,lt:()=>z,notEqual:()=>H});var o={};e.r(o),e.d(o,{add:()=>X,div:()=>K,divide:()=>Q,mul:()=>J,multiply:()=>G,negative:()=>nt,positive:()=>tt,sub:()=>W,subtract:()=>V});var a={};e.r(a),e.d(a,{fmod:()=>et,multiplicativeInverse:()=>rt,nthRoot:()=>at,pow:()=>it,sqrt:()=>ot});var s={};e.r(s),e.d(s,{LOG_EXP_10:()=>ct,LOG_EXP_2:()=>ft,abs:()=>xt,clone:()=>Mt,difference:()=>_t,exp:()=>st,hull:()=>dt,intersection:()=>yt,ln:()=>lt,log:()=>ut,log10:()=>ht,log2:()=>pt,max:()=>wt,min:()=>bt,union:()=>mt,wid:()=>vt,width:()=>gt});var u={};function l(t){return"object"==typeof t&&"number"==typeof t.lo&&"number"==typeof t.hi}function c(t){return t.lo>t.hi}function h(t){return t.lo===-1/0&&t.hi===1/0}function f(t){return t.lo===t.hi}function p(t){return d(t,0)}function d(t,n){return!c(t)&&t.lo<=n&&n<=t.hi}function y(t,n){return!!c(t)||!c(n)&&n.lo<=t.lo&&t.hi<=n.hi}function m(t,n){return!c(t)&&!c(n)&&(t.lo<=n.lo&&n.lo<=t.hi||n.lo<=t.lo&&t.lo<=n.hi)}e.r(u),e.d(u,{acos:()=>Pt,asin:()=>Nt,atan:()=>Ot,cos:()=>Et,cosh:()=>Lt,sin:()=>kt,sinh:()=>It,tan:()=>St,tanh:()=>Zt});var _=e(3093),g=e.n(_);function v(t){return t}function x(t){return t===1/0?t:g()(t,-1/0)}function w(t){return t===-1/0?t:g()(t,1/0)}function b(t){return t<0?Math.ceil(t):Math.floor(t)}const M={prev:x,next:w},T={safePrev:x,safeNext:w,prev:t=>M.prev(t),next:t=>M.next(t),addLo:(t,n)=>T.prev(t+n),addHi:(t,n)=>T.next(t+n),subLo:(t,n)=>T.prev(t-n),subHi:(t,n)=>T.next(t-n),mulLo:(t,n)=>T.prev(t*n),mulHi:(t,n)=>T.next(t*n),divLo:(t,n)=>T.prev(t/n),divHi:(t,n)=>T.next(t/n),intLo:t=>b(T.prev(t)),intHi:t=>b(T.next(t)),logLo:t=>T.prev(Math.log(t)),logHi:t=>T.next(Math.log(t)),expLo:t=>T.prev(Math.exp(t)),expHi:t=>T.next(Math.exp(t)),sinLo:t=>T.prev(Math.sin(t)),sinHi:t=>T.next(Math.sin(t)),cosLo:t=>T.prev(Math.cos(t)),cosHi:t=>T.next(Math.cos(t)),tanLo:t=>T.prev(Math.tan(t)),tanHi:t=>T.next(Math.tan(t)),asinLo:t=>T.prev(Math.asin(t)),asinHi:t=>T.next(Math.asin(t)),acosLo:t=>T.prev(Math.acos(t)),acosHi:t=>T.next(Math.acos(t)),atanLo:t=>T.prev(Math.atan(t)),atanHi:t=>T.next(Math.atan(t)),sinhLo:t=>T.prev(Math.sinh(t)),sinhHi:t=>T.next(Math.sinh(t)),coshLo:t=>T.prev(Math.cosh(t)),coshHi:t=>T.next(Math.cosh(t)),tanhLo:t=>T.prev(Math.tanh(t)),tanhHi:t=>T.next(Math.tanh(t)),powLo(t,n){if(n%1!=0)return T.prev(Math.pow(t,n));let e=1==(1&n)?t:1;for(n>>=1;n>0;)t=T.mulLo(t,t),1==(1&n)&&(e=T.mulLo(t,e)),n>>=1;return e},powHi(t,n){if(n%1!=0)return T.next(Math.pow(t,n));let e=1==(1&n)?t:1;for(n>>=1;n>0;)t=T.mulHi(t,t),1==(1&n)&&(e=T.mulHi(t,e)),n>>=1;return e},sqrtLo:t=>T.prev(Math.sqrt(t)),sqrtHi:t=>T.next(Math.sqrt(t)),disable(){M.next=M.prev=v},enable(){M.next=w,M.prev=x}},A=T;class E{constructor(t,n){if(this.lo=0,this.hi=0,!(this instanceof E))return console.log("calling with new"),console.log(t,n),new E(t,n);if(void 0!==t&&void 0!==n){if(l(t)){if(!f(t))throw new TypeError("Interval: interval `lo` must be a singleton");t=t.lo}if(l(n)){if(!f(n))throw TypeError("Interval: interval `hi` must be a singleton");n=n.hi}}else{if(void 0!==t)return Array.isArray(t)?new k(t[0],t[1]):new k(t,t);t=n=0}this.assign(t,n)}singleton(t){return this.set(t,t)}bounded(t,n){return this.set(A.prev(t),A.next(n))}boundedSingleton(t){return this.bounded(t,t)}set(t,n){return this.lo=t,this.hi=n,this}assign(t,n){if("number"!=typeof t||"number"!=typeof n)throw TypeError("Interval#assign: arguments must be numbers");return isNaN(t)||isNaN(n)||t>n?this.setEmpty():this.set(t,n)}setEmpty(){return this.set(Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY)}setWhole(){return this.set(Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY)}open(t,n){return this.assign(A.safeNext(t),A.safePrev(n))}halfOpenLeft(t,n){return this.assign(A.safeNext(t),n)}halfOpenRight(t,n){return this.assign(t,A.safePrev(n))}toArray(){return[this.lo,this.hi]}clone(){return(new k).set(this.lo,this.hi)}}const k=function(t){function n(){for(var n=arguments.length,e=Array(n),r=0;rn.hi}function j(t,n){return!c(t)&&!c(n)&&t.hin.hi}const Y=F;function U(t,n){return!c(t)&&!c(n)&&t.hi<=n.lo}const R=U;function q(t,n){return!c(t)&&!c(n)&&t.lo>=n.hi}const B=q;function X(t,n){return new k(A.addLo(t.lo,n.lo),A.addHi(t.hi,n.hi))}function V(t,n){return new k(A.subLo(t.lo,n.hi),A.subHi(t.hi,n.lo))}const W=V;function G(t,n){if(c(t)||c(n))return O.EMPTY;const e=t.lo,r=t.hi,i=n.lo,o=n.hi,a=new k;return e<0?r>0?i<0?o>0?(a.lo=Math.min(A.mulLo(e,o),A.mulLo(r,i)),a.hi=Math.max(A.mulHi(e,i),A.mulHi(r,o))):(a.lo=A.mulLo(r,i),a.hi=A.mulHi(e,i)):o>0?(a.lo=A.mulLo(e,o),a.hi=A.mulHi(r,o)):(a.lo=0,a.hi=0):i<0?o>0?(a.lo=A.mulLo(e,o),a.hi=A.mulHi(e,i)):(a.lo=A.mulLo(r,o),a.hi=A.mulHi(e,i)):o>0?(a.lo=A.mulLo(e,o),a.hi=A.mulHi(r,i)):(a.lo=0,a.hi=0):r>0?i<0?o>0?(a.lo=A.mulLo(r,i),a.hi=A.mulHi(r,o)):(a.lo=A.mulLo(r,i),a.hi=A.mulHi(e,o)):o>0?(a.lo=A.mulLo(e,i),a.hi=A.mulHi(r,o)):(a.lo=0,a.hi=0):(a.lo=0,a.hi=0),a}const J=G;function Q(t,n){return c(t)||c(n)?O.EMPTY:p(n)?0!==n.lo?0!==n.hi?function(t){return 0===t.lo&&0===t.hi?t:O.WHOLE}(t):function(t,n){return 0===t.lo&&0===t.hi?t:p(t)?O.WHOLE:t.hi<0?new k(A.divLo(t.hi,n),Number.POSITIVE_INFINITY):new k(Number.NEGATIVE_INFINITY,A.divHi(t.lo,n))}(t,n.lo):0!==n.hi?function(t,n){return 0===t.lo&&0===t.hi?t:p(t)?O.WHOLE:t.hi<0?new k(Number.NEGATIVE_INFINITY,A.divHi(t.hi,n)):new k(A.divLo(t.lo,n),Number.POSITIVE_INFINITY)}(t,n.hi):O.EMPTY:function(t,n){const e=t.lo,r=t.hi,i=n.lo,o=n.hi,a=new k;return r<0?o<0?(a.lo=A.divLo(r,i),a.hi=A.divHi(e,o)):(a.lo=A.divLo(e,i),a.hi=A.divHi(r,o)):e<0?o<0?(a.lo=A.divLo(r,o),a.hi=A.divHi(e,o)):(a.lo=A.divLo(e,i),a.hi=A.divHi(r,i)):o<0?(a.lo=A.divLo(r,o),a.hi=A.divHi(e,i)):(a.lo=A.divLo(e,o),a.hi=A.divHi(r,i)),a}(t,n)}const K=Q;function tt(t){return new k(t.lo,t.hi)}function nt(t){return new k(-t.hi,-t.lo)}function et(t,n){if(c(t)||c(n))return O.EMPTY;const e=t.lo<0?n.lo:n.hi;let r=t.lo/e;return r=r<0?Math.ceil(r):Math.floor(r),W(t,J(n,new k(r)))}function rt(t){return c(t)?O.EMPTY:p(t)?0!==t.lo?0!==t.hi?O.WHOLE:new k(Number.NEGATIVE_INFINITY,A.divHi(1,t.lo)):0!==t.hi?new k(A.divLo(1,t.hi),Number.POSITIVE_INFINITY):O.EMPTY:new k(A.divLo(1,t.hi),A.divHi(1,t.lo))}function it(t,n){if(c(t))return O.EMPTY;if("object"==typeof n){if(!f(n))return O.EMPTY;n=n.lo}if(0===n)return 0===t.lo&&0===t.hi?O.EMPTY:O.ONE;if(n<0)return it(rt(t),-n);if(Number.isSafeInteger(n)){if(t.hi<0){const e=A.powLo(-t.hi,n),r=A.powHi(-t.lo,n);return 1==(1&n)?new k(-r,-e):new k(e,r)}return t.lo<0?1==(1&n)?new k(-A.powLo(-t.lo,n),A.powHi(t.hi,n)):new k(0,A.powHi(Math.max(-t.lo,t.hi),n)):new k(A.powLo(t.lo,n),A.powHi(t.hi,n))}return console.warn("power is not an integer, you should use nth-root instead, returning an empty interval"),O.EMPTY}function ot(t){return at(t,2)}function at(t,n){if(c(t)||n<0)return O.EMPTY;if("object"==typeof n){if(!f(n))return O.EMPTY;n=n.lo}const e=1/n;if(t.hi<0){if(Number.isSafeInteger(n)&&1==(1&n)){const n=A.powHi(-t.lo,e),r=A.powLo(-t.hi,e);return new k(-n,-r)}return O.EMPTY}if(t.lo<0){const r=A.powHi(t.hi,e);if(Number.isSafeInteger(n)&&1==(1&n)){const n=-A.powHi(-t.lo,e);return new k(n,r)}return new k(0,r)}return new k(A.powLo(t.lo,e),A.powHi(t.hi,e))}function st(t){return c(t)?O.EMPTY:new k(A.expLo(t.lo),A.expHi(t.hi))}function ut(t){if(c(t))return O.EMPTY;const n=t.lo<=0?Number.NEGATIVE_INFINITY:A.logLo(t.lo);return new k(n,A.logHi(t.hi))}const lt=ut,ct=ut(new k(10,10));function ht(t){return c(t)?O.EMPTY:K(ut(t),ct)}const ft=ut(new k(2,2));function pt(t){return c(t)?O.EMPTY:K(ut(t),ft)}function dt(t,n){const e=c(t),r=c(n);return e&&r?O.EMPTY:e?n.clone():r?t.clone():new k(Math.min(t.lo,n.lo),Math.max(t.hi,n.hi))}function yt(t,n){if(c(t)||c(n))return O.EMPTY;const e=Math.max(t.lo,n.lo),r=Math.min(t.hi,n.hi);return e<=r?new k(e,r):O.EMPTY}function mt(t,n){if(!m(t,n))throw Error("Interval#union: intervals do not overlap");return new k(Math.min(t.lo,n.lo),Math.max(t.hi,n.hi))}function _t(t,n){if(c(t)||h(n))return O.EMPTY;if(m(t,n)){if(t.lo=t.hi&&n.lo===-1/0?O.EMPTY:n.lo<=t.lo?(new k).halfOpenLeft(n.hi,t.hi):(new k).halfOpenRight(t.lo,n.lo)}return t.clone()}function gt(t){return c(t)?0:A.subHi(t.hi,t.lo)}const vt=gt;function xt(t){return c(t)||h(t)?O.EMPTY:t.lo>=0?t.clone():t.hi<=0?nt(t):new k(0,Math.max(-t.lo,t.hi))}function wt(t,n){const e=c(t),r=c(n);return e&&r?O.EMPTY:e?n.clone():r?t.clone():new k(Math.max(t.lo,n.lo),Math.max(t.hi,n.hi))}function bt(t,n){const e=c(t),r=c(n);return e&&r?O.EMPTY:e?n.clone():r?t.clone():new k(Math.min(t.lo,n.lo),Math.min(t.hi,n.hi))}function Mt(t){return(new k).set(t.lo,t.hi)}function Tt(t){return!isFinite(t.lo)&&t.lo===t.hi}function At(t){if(t.lo<0)if(t.lo===-1/0)t.lo=0,t.hi=1/0;else{const n=Math.ceil(-t.lo/O.PI_TWICE_LOW);t.lo+=O.PI_TWICE_LOW*n,t.hi+=O.PI_TWICE_LOW*n}return t}function Et(t){if(c(t)||Tt(t))return O.EMPTY;const n=(new k).set(t.lo,t.hi);At(n);const e=O.PI_TWICE,r=et(n,e);if(gt(r)>=e.lo)return new k(-1,1);if(r.lo>=O.PI_HIGH)return nt(Et(W(r,O.PI)));const i=r.lo,o=r.hi,a=A.cosLo(o),s=A.cosHi(i);return o<=O.PI_LOW?new k(a,s):o<=e.lo?new k(-1,Math.max(a,s)):new k(-1,1)}function kt(t){return c(t)||Tt(t)?O.EMPTY:Et(W(t,O.PI_HALF))}function St(t){if(c(t)||Tt(t))return O.EMPTY;const n=(new k).set(t.lo,t.hi);At(n);const e=O.PI;let r=et(n,e);return r.lo>=O.PI_HALF_LOW&&(r=W(r,e)),r.lo<=-O.PI_HALF_LOW||r.hi>=O.PI_HALF_LOW?O.WHOLE:new k(A.tanLo(r.lo),A.tanHi(r.hi))}function Nt(t){if(c(t)||t.hi<-1||t.lo>1)return O.EMPTY;const n=t.lo<=-1?-O.PI_HALF_HIGH:A.asinLo(t.lo),e=t.hi>=1?O.PI_HALF_HIGH:A.asinHi(t.hi);return new k(n,e)}function Pt(t){if(c(t)||t.hi<-1||t.lo>1)return O.EMPTY;const n=t.hi>=1?0:A.acosLo(t.hi),e=t.lo<=-1?O.PI_HIGH:A.acosHi(t.lo);return new k(n,e)}function Ot(t){return c(t)?O.EMPTY:new k(A.atanLo(t.lo),A.atanHi(t.hi))}function It(t){return c(t)?O.EMPTY:new k(A.sinhLo(t.lo),A.sinhHi(t.hi))}function Lt(t){return c(t)?O.EMPTY:t.hi<0?new k(A.coshLo(t.hi),A.coshHi(t.lo)):t.lo>=0?new k(A.coshLo(t.lo),A.coshHi(t.hi)):new k(1,A.coshHi(-t.lo>t.hi?t.lo:t.hi))}function Zt(t){return c(t)?O.EMPTY:new k(A.tanhLo(t.lo),A.tanhHi(t.hi))}const Ct=Object.assign(k,O,A,s,r,i,o,a,u,{round:A})},2223:(t,n,e)=>{"use strict";t.exports=e(3829)},3829:(t,n,e)=>{"use strict";const r=e(9213).Parser,i=e(6009),o=e(4470);function a(t,n){this.statements=[],this.defs=n||{},this.interpreter=new i(this,t)}a.prototype.setDefs=function(t){return this.defs=o(this.defs,t),this},a.prototype.compile=function(t){const n=this;if(!t||"object"!=typeof t&&"function"!=typeof t)throw TypeError("namespace must be an object");if("function"!=typeof t.factory)throw TypeError("namespace.factory must be a function");this.defs.ns=t,this.defs.$$mathCodegen={getProperty:function(t,e,r){function i(t){return n.interpreter.options.applyFactoryToScope&&"function"!=typeof t?r.factory(t):t}if(t in e)return i(e[t]);if(t in r)return i(r[t]);throw SyntaxError('symbol "'+t+'" is undefined')},functionProxy:function(t,n){if("function"!=typeof t)throw SyntaxError('symbol "'+n+'" must be a function');return t}},this.defs.$$processScope=this.defs.$$processScope||function(){};const e=Object.keys(this.defs).map((function(t){return"var "+t+' = defs["'+t+'"]'}));if(!this.statements.length)throw Error("there are no statements saved in this generator, make sure you parse an expression before compiling it");this.statements[this.statements.length-1]="return "+this.statements[this.statements.length-1];const r=this.statements.join(";"),i=e.join("\n")+"\n"+["return {"," eval: function (scope) {"," scope = scope || {}"," $$processScope(scope)"," "+r," },"," code: "+JSON.stringify(r),"}"].join("\n");return new Function("defs",i)(this.defs)},a.prototype.parse=function(t){const n=this,e=(new r).parse(t);return this.statements=e.blocks.map((function(t){return n.interpreter.next(t)})),this},t.exports=a},6009:(t,n,e)=>{"use strict";const r=e(4470),i={ArrayNode:e(5476),AssignmentNode:e(6408),ConditionalNode:e(9907),ConstantNode:e(2341),FunctionNode:e(7850),OperatorNode:e(305),SymbolNode:e(6656),UnaryNode:e(2386)},o=function(t,n){this.owner=t,this.options=r({factory:"ns.factory",raw:!1,rawArrayExpressionElements:!0,rawCallExpressionElements:!1,applyFactoryToScope:!1},n);const e=this.options.factory;if("string"!=typeof e||!/^[a-zA-Z_$][a-zA-Z0-9_$]*(\.[a-zA-Z_$][a-zA-Z0-9_$]*)*$/.test(e))throw new Error('factory must be a valid JS property access path (e.g. "ns.factory")')};r(o.prototype,i),o.prototype.next=function(t){if(!(t.type in this))throw new TypeError("the node type "+t.type+" is not implemented");return this[t.type](t)},o.prototype.rawify=function(t,n){const e=this.options.raw;t&&(this.options.raw=!0),n(),t&&(this.options.raw=e)},t.exports=o},2576:t=>{"use strict";t.exports={"+":"add","-":"sub","*":"mul","/":"div","^":"pow","%":"mod","!":"factorial","|":"bitwiseOR","^|":"bitwiseXOR","&":"bitwiseAND","||":"logicalOR",xor:"logicalXOR","&&":"logicalAND","<":"lessThan",">":"greaterThan","<=":"lessEqualThan",">=":"greaterEqualThan","===":"strictlyEqual","==":"equal","!==":"strictlyNotEqual","!=":"notEqual",">>":"shiftRight","<<":"shiftLeft",">>>":"unsignedRightShift"}},6104:t=>{"use strict";t.exports={"+":"positive","-":"negative","~":"oneComplement"}},5476:t=>{"use strict";t.exports=function(t){const n=this;let e=[];this.rawify(this.options.rawArrayExpressionElements,(function(){e=t.nodes.map((function(t){return n.next(t)}))}));const r="["+e.join(",")+"]";return this.options.raw?r:this.options.factory+"("+r+")"}},6408:t=>{"use strict";t.exports=function(t){return"scope["+JSON.stringify(t.name)+"] = "+this.next(t.expr)}},9907:t=>{"use strict";t.exports=function(t){return"(!!("+this.next(t.condition)+") ? ("+this.next(t.trueExpr)+") : ("+this.next(t.falseExpr)+") )"}},2341:t=>{"use strict";t.exports=function(t){if(this.options.raw)return t.value;const n="string"===t.valueType?JSON.stringify(t.value):t.value;return this.options.factory+"("+n+")"}},7850:(t,n,e)=>{"use strict";const r=e(9213).nodeTypes.SymbolNode,i=function(t){return"$$mathCodegen.functionProxy("+this.next(new r(t.name))+", "+JSON.stringify(t.name)+")"};t.exports=function(t){const n=this,e=i.call(this,t);let r=[];return this.rawify(this.options.rawCallExpressionElements,(function(){r=t.args.map((function(t){return n.next(t)}))})),e+"("+r.join(", ")+")"},t.exports.functionProxy=i},305:(t,n,e)=>{"use strict";const r=e(2576);t.exports=function(t){if(this.options.raw)return["("+this.next(t.args[0]),t.op,this.next(t.args[1])+")"].join(" ");const n=r[t.op];if(!n)throw TypeError("unidentified operator");return this.FunctionNode({name:n,args:t.args})}},6656:t=>{"use strict";t.exports=function(t){const n=t.name;return"$$mathCodegen.getProperty("+JSON.stringify(n)+", scope, ns)"}},2386:(t,n,e)=>{"use strict";const r=e(6104);t.exports=function(t){if(this.options.raw)return t.op+this.next(t.argument);if(!(t.op in r))throw new SyntaxError(t.op+" not implemented");const n=r[t.op];return this.FunctionNode({name:n,args:[t.argument]})}},9213:(t,n,e)=>{"use strict";e(1668),t.exports.Parser=e(5438),t.exports.nodeTypes=e(3450)},1668:(t,n,e)=>{var r=e(5054),i={n:"\n",f:"\f",r:"\r",t:"\t",v:"\v","'":"'",'"':'"'},o={",":!0,"(":!0,")":!0,"[":!0,"]":!0,";":!0,"~":!0,"!":!0,"+":!0,"-":!0,"*":!0,"/":!0,"%":!0,"^":!0,"**":!0,"|":!0,"&":!0,"^|":!0,"=":!0,":":!0,"?":!0,"||":!0,"&&":!0,xor:!0,"==":!0,"!=":!0,"===":!0,"!==":!0,"<":!0,">":!0,">=":!0,"<=":!0,">>>":!0,"<<":!0,">>":!0};function a(t){return t>="0"&&t<="9"}function s(t){return t>="a"&&t<="z"||t>="A"&&t<="Z"||"$"===t||"_"===t}function u(t){return" "===t||"\r"===t||"\t"===t||"\n"===t||"\v"===t||" "===t}function l(t){return o[t]}function c(t){return"'"===t||'"'===t}function h(){}h.prototype.throwError=function(t,n){n=void 0===n?this.index:n;var e=new Error(t+" at index "+n);throw e.index=n,e.description=t,e},h.prototype.lex=function(t){for(this.text=t,this.index=0,this.tokens=[];this.index=this.text.length))return this.text.charAt(this.index+t)},h.prototype.consume=function(){var t=this.peek();return this.index+=1,t},h.prototype.readNumber=function(){var t="";if("."===this.peek())t+=this.consume(),a(this.peek())||this.throwError("number expected");else{for(;a(this.peek());)t+=this.consume();"."===this.peek()&&(t+=this.consume())}for(;a(this.peek());)t+=this.consume();if("e"===this.peek()||"E"===this.peek())for(t+=this.consume(),a(this.peek())||"+"===this.peek()||"-"===this.peek()||this.throwError(),"+"!==this.peek()&&"-"!==this.peek()||(t+=this.consume()),a(this.peek())||this.throwError("number expected");a(this.peek());)t+=this.consume();return t},h.prototype.readIdentifier=function(){for(var t="";s(this.peek())||a(this.peek());)t+=this.consume();return t},h.prototype.readString=function(){for(var t,n=this.consume(),e="";;){var r=this.consume();if(r||this.throwError("string is not closed"),t){if("u"===r){var o=this.text.substring(this.index+1,this.index+5);o.match(/[\da-f]{4}/i)||this.throwError("invalid unicode escape"),this.index+=4,e+=String.fromCharCode(parseInt(o,16))}else{e+=i[r]||r}t=!1}else{if(r===n)break;"\\"===r?t=!0:e+=r}}return e},t.exports=h},5438:(t,n,e)=>{var r=e(5054),i=e(1668),o=e(6311),a=e(6565),s=e(5543),u=e(2514),l=e(8935),c=e(3862),h=e(9322),f=e(3262),p=e(2962);function d(){this.lexer=new i,this.tokens=null}d.prototype.current=function(){return this.tokens[0]},d.prototype.next=function(){return this.tokens[1]},d.prototype.peek=function(){if(this.tokens.length)for(var t=this.tokens[0],n=0;n=","<=",">","<")){var n=this.consume(),e=this.shift();return new a(n.value,[t,e])}return t},d.prototype.shift=function(){var t=this.additive();if(this.peek(">>","<<",">>>")){var n=this.consume(),e=this.shift();return new a(n.value,[t,e])}return t},d.prototype.additive=function(){for(var t=this.multiplicative();this.peek("+","-");){var n=this.consume();t=new a(n.value,[t,this.multiplicative()])}return t},d.prototype.multiplicative=function(){for(var t,n,e=this.unary();this.peek("*","/","%");)t=this.consume(),e=new a(t.value,[e,this.unary()]);return this.current().type===r.SYMBOL||this.peek("(")||!(e.type instanceof o)&&this.current().type===r.NUMBER?(n=this.multiplicative(),new a("*",[e,n])):e},d.prototype.unary=function(){if(this.peek("-","+","~")){var t=this.consume(),n=this.unary();return new s(t.value,n)}return this.pow()},d.prototype.pow=function(){var t=this.factorial();if(this.peek("^","**")){var n=this.consume(),e=this.unary();return new a(n.value,[t,e])}return t},d.prototype.factorial=function(){var t=this.symbol();if(this.peek("!")){var n=this.consume();return new a(n.value,[t])}return t},d.prototype.symbol=function(){if(this.current().type===r.SYMBOL){var t=this.consume();return this.functionCall(t)}return this.string()},d.prototype.functionCall=function(t){var n=t.value;if(this.peek("(")){this.consume();for(var e=[];!this.peek(")")&&!this.isEOF();)e.push(this.assignment()),this.peek(",")&&this.consume();return this.expect(")"),new l(n,e)}return new u(n)},d.prototype.string=function(){return this.current().type===r.STRING?new o(this.consume().value,"string"):this.array()},d.prototype.array=function(){if(this.peek("[")){this.consume();for(var t=[];!this.peek("]")&&!this.isEOF();)t.push(this.assignment()),this.peek(",")&&this.consume();return this.expect("]"),new c(t)}return this.number()},d.prototype.number=function(){return this.current().type===r.NUMBER?new o(this.consume().value,"number"):this.parentheses()},d.prototype.parentheses=function(){if("("===this.current().value){this.consume();var t=this.assignment();return this.expect(")"),t}return this.end()},d.prototype.end=function(){if(this.current().type!==r.EOF)throw Error("unexpected end of expression")},t.exports=d},3862:(t,n,e)=>{var r=e(7111);function i(t){this.nodes=t}i.prototype=Object.create(r.prototype),i.prototype.type="ArrayNode",t.exports=i},3262:(t,n,e)=>{var r=e(7111);function i(t,n){this.name=t,this.expr=n}i.prototype=Object.create(r.prototype),i.prototype.type="AssignmentNode",t.exports=i},2962:(t,n,e)=>{var r=e(7111);function i(t){this.blocks=t}i.prototype=Object.create(r.prototype),i.prototype.type="BlockNode",t.exports=i},9322:(t,n,e)=>{var r=e(7111);function i(t,n,e){this.condition=t,this.trueExpr=n,this.falseExpr=e}i.prototype=Object.create(r.prototype),i.prototype.type="ConditionalNode",t.exports=i},6311:(t,n,e)=>{var r=e(7111),i={number:!0,string:!0,boolean:!0,undefined:!0,null:!0};function o(t,n){if(!i[n])throw Error("unsupported type '"+n+"'");this.value=t,this.valueType=n}o.prototype=Object.create(r.prototype),o.prototype.type="ConstantNode",t.exports=o},8935:(t,n,e)=>{var r=e(7111);function i(t,n){this.name=t,this.args=n}i.prototype=Object.create(r.prototype),i.prototype.type="FunctionNode",t.exports=i},7111:t=>{function n(){}n.prototype.type="Node",t.exports=n},6565:(t,n,e)=>{var r=e(7111);function i(t,n){this.op=t,this.args=n||[]}i.prototype=Object.create(r.prototype),i.prototype.type="OperatorNode",t.exports=i},2514:(t,n,e)=>{var r=e(7111);function i(t){this.name=t}i.prototype=Object.create(r.prototype),i.prototype.type="SymbolNode",t.exports=i},5543:(t,n,e)=>{var r=e(7111);function i(t,n){this.op=t,this.argument=n}i.prototype=Object.create(r.prototype),i.prototype.type="UnaryNode",t.exports=i},3450:(t,n,e)=>{t.exports={ArrayNode:e(3862),AssignmentNode:e(3262),BlockNode:e(2962),ConditionalNode:e(9322),ConstantNode:e(6311),FunctionNode:e(8935),Node:e(7111),OperatorNode:e(6565),SymbolNode:e(2514),UnaryNode:e(5543)}},5054:t=>{t.exports={EOF:0,DELIMITER:1,NUMBER:2,STRING:3,SYMBOL:4}},3093:(t,n,e)=>{"use strict";var r=e(4822),i=Math.pow(2,-1074),o=-1>>>0;t.exports=function(t,n){if(isNaN(t)||isNaN(n))return NaN;if(t===n)return t;if(0===t)return n<0?-i:i;var e=r.hi(t),a=r.lo(t);return n>t==t>0?a===o?(e+=1,a=0):a+=1:0===a?(a=o,e-=1):a-=1,r.pack(a,e)}},405:function(t,n,e){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(n,"__esModule",{value:!0}),n.Chart=void 0;const i=e(6660),o=e(103),a=e(8066),s=e(8873),u=e(9065),l=e(3905),c=e(9928),h=r(e(7187)),f=r(e(3559)),p=r(e(953)),d=r(e(9489)),y=r(e(917)),m=r(e(5888)),_=e(7634);function g(t){return"linear"===t?a.scaleLinear:a.scaleLog}class v extends h.default.EventEmitter{constructor(t){super();const n=Math.random(),e=String.fromCharCode(Math.floor(26*n)+97);this.options=t,this.id=e+n.toString(16).substr(2),this.options.id=this.id,this.markerId=this.id+"-marker",v.cache[this.id]=this,this.linkedGraphs=[this],this.meta={},this.setUpEventListeners()}build(){return this.internalVars(),this.drawGraphWrapper(),this}getDraggableNode(){return(0,l.select)(this.options.target).select(".zoom-and-drag").node()}getEmitInstance(){let t=this;const n=this.getDraggableNode();return n&&(t=n.instance),t}internalVars(){const t=this.meta.margin=this.isPolarCoordinateSystem()?{left:0,right:0,top:0,bottom:0}:{left:40,right:20,top:20,bottom:20};this.options.title&&!this.isPolarCoordinateSystem()&&(this.meta.margin.top=40),this.meta.width=(this.options.width||m.default.DEFAULT_WIDTH)-t.left-t.right,this.meta.height=(this.options.height||m.default.DEFAULT_HEIGHT)-t.top-t.bottom,this.initializeAxes()}initializeAxes(){const t=this,n=(0,o.format)("~s");function e(t){return Math.abs(t)-Math.floor(Math.abs(t))>0?t.toString():n(t)}if(this.options.coordinateSystem=this.options.coordinateSystem||"cartesian",this.options.xAxis=this.options.xAxis||{},this.options.xAxis.type=this.options.xAxis.type||"linear",this.options.yAxis=this.options.yAxis||{},this.options.yAxis.type=this.options.yAxis.type||"linear","cartesian"!==this.options.coordinateSystem&&"polar"!==this.options.coordinateSystem)throw new Error(`unsupported coordinate system ${this.options.coordinateSystem}`);"polar"===this.options.coordinateSystem&&(0,_.validatePolarOptions)(this.options);const{xDomain:r,yDomain:a}=function(t,n,e){var r,i;const o="polar"===t.coordinateSystem?null===(i=null===(r=t.polar)||void 0===r?void 0:r.radiusDomain)||void 0===i?void 0:i[1]:void 0,a=void 0===o?void 0:1.2*o,s=(()=>{if(t.xAxis.domain)return t.xAxis.domain;if("log"===t.xAxis.type)return[1,10];if("linear"===t.xAxis.type)return void 0===a?[-6,6]:[-a,a];throw new Error(`axis type ${t.xAxis.type} unsupported`)})(),u=(()=>{if(t.yAxis.domain)return t.yAxis.domain;if("log"===t.yAxis.type)return[1,10];if("linear"===t.yAxis.type){if(void 0!==a)return[-a,a];const t=(t=>{const r=t[1]-t[0];return e*r/n})(s);return[-t/2,t/2]}throw new Error(`axis type ${t.yAxis.type} unsupported`)})();return"polar"===t.coordinateSystem?(0,_.getPolarDomains)(s,u,n,e):{xDomain:s,yDomain:u}}(this.options,this.meta.width,this.meta.height);this.meta.xDomain=r,this.meta.yDomain=a,this.meta.xScale||(this.meta.xScale=g(this.options.xAxis.type)()),this.meta.xScale.domain(r).range(this.options.xAxis.invert?[this.meta.width,0]:[0,this.meta.width]),this.meta.yScale||(this.meta.yScale=g(this.options.yAxis.type)()),this.meta.yScale.domain(a).range(this.options.yAxis.invert?[0,this.meta.height]:[this.meta.height,0]),this.meta.xAxis||(this.meta.xAxis=(0,s.axisBottom)(this.meta.xScale)),this.meta.xAxis.scale(this.meta.xScale).tickSize(this.options.grid?-this.meta.height:0).tickFormat(e),this.meta.yAxis||(this.meta.yAxis=(0,s.axisLeft)(this.meta.yScale)),this.meta.yAxis.scale(this.meta.yScale).tickSize(this.options.grid?-this.meta.width:0).tickFormat(e),this.line=(0,i.line)().x((function(n){return t.meta.xScale(n[0])})).y((function(n){return t.meta.yScale(n[1])}))}drawGraphWrapper(){const t=this.root=(0,l.select)(this.options.target).selectAll("svg").data([this.options]);this.root.enter=t.enter().append("svg").attr("class","function-plot").attr("font-size",this.getFontSize()),t.merge(this.root.enter).attr("width",this.meta.width+this.meta.margin.left+this.meta.margin.right).attr("height",this.meta.height+this.meta.margin.top+this.meta.margin.bottom),this.buildTitle(),this.buildLegend(),this.buildCanvas(),this.buildClip(),this.buildAxis(),this.buildAxisLabel();const n=this.tip=(0,p.default)(Object.assign(this.options.tip||{},{owner:this}));this.canvas.merge(this.canvas.enter).call(n),this.setUpPlugins(),this.draw(),this.buildZoomHelper()}buildTitle(){const t=this.root.merge(this.root.enter).selectAll("text.title").data((function(t){return[t.title].filter(Boolean)}));t.enter().append("text").merge(t).attr("class","title").attr("y",this.isPolarCoordinateSystem()?20:this.meta.margin.top/2).attr("x",this.meta.margin.left+this.meta.width/2).attr("font-size",25).attr("text-anchor","middle").attr("alignment-baseline","middle").text(this.options.title),t.exit().remove()}buildLegend(){this.root.enter.append("text").attr("class","top-right-legend").attr("text-anchor","end"),this.root.merge(this.root.enter).select(".top-right-legend").attr("y",this.isPolarCoordinateSystem()?8:this.meta.margin.top/2).attr("x",this.meta.width+this.meta.margin.left-(this.isPolarCoordinateSystem()?8:0)).attr("dominant-baseline",this.isPolarCoordinateSystem()?"hanging":null)}buildCanvas(){const t=this.canvas=this.root.merge(this.root.enter).selectAll(".canvas").data((function(t){return[t]}));this.canvas.enter=t.enter().append("g").attr("class","canvas")}buildClip(){const t=this.id,n=this.canvas.enter.append("defs");n.append("clipPath").attr("id","function-plot-clip-"+t).append("rect").attr("class","clip static-clip"),this.canvas.merge(this.canvas.enter).selectAll(".clip").attr("width",this.meta.width).attr("height",this.meta.height),n.append("clipPath").append("marker").attr("id",this.markerId).attr("viewBox","0 -5 10 10").attr("refX",10).attr("markerWidth",5).attr("markerHeight",5).attr("orient","auto").append("svg:path").attr("d","M0,-5L10,0L0,5L0,0").attr("stroke-width","0px").attr("fill-opacity",1).attr("fill","#777")}buildAxis(){const t=this.canvas.enter;t.append("g").attr("class","x axis"),t.append("g").attr("class","y axis"),this.canvas.merge(this.canvas.enter).select(".x.axis").attr("transform","translate(0,"+this.meta.height+")").style("display",this.isPolarCoordinateSystem()?"none":null).call(this.meta.xAxis),this.canvas.merge(this.canvas.enter).select(".y.axis").style("display",this.isPolarCoordinateSystem()?"none":null).call(this.meta.yAxis)}buildAxisLabel(){const t=this.canvas,n=this,e=t.merge(t.enter).selectAll("text.x.axis-label").data((function(t){return n.isPolarCoordinateSystem()?[]:[t.xAxis.label].filter(Boolean)})),r=e.enter().append("text").attr("class","x axis-label").attr("text-anchor","end");e.merge(r).attr("x",this.meta.width).attr("y",this.meta.height-6).text((function(t){return t})),e.exit().remove();const i=t.merge(t.enter).selectAll("text.y.axis-label").data((function(t){return n.isPolarCoordinateSystem()?[]:[t.yAxis.label].filter(Boolean)})),o=i.enter().append("text").attr("class","y axis-label").attr("y",6).attr("dy",".75em").attr("text-anchor","end").attr("transform","rotate(-90)");i.merge(o).text((function(t){return t})),i.exit().remove()}buildContent(){const t=this,n=this.canvas;n.merge(n.enter).attr("transform","translate("+this.meta.margin.left+","+this.meta.margin.top+")");const e=this.content=n.merge(n.enter).selectAll(":scope > g.content").data((function(t){return[t]})),r=e.enter().append("g").attr("clip-path","url(#function-plot-clip-"+this.id+")").attr("class","content");if("linear"===this.options.xAxis.type){const t=e.merge(r).selectAll(":scope > path.y.origin").data(this.isPolarCoordinateSystem()?[]:[[[0,this.meta.yScale.domain()[0]],[0,this.meta.yScale.domain()[1]]]]),n=t.enter().append("path").attr("class","y origin").attr("stroke","black").attr("opacity",.2);t.merge(n).attr("d",this.line),t.exit().remove()}if("linear"===this.options.yAxis.type){const t=e.merge(r).selectAll(":scope > path.x.origin").data(this.isPolarCoordinateSystem()?[]:[[[this.meta.xScale.domain()[0],0],[this.meta.xScale.domain()[1],0]]]),n=t.enter().append("path").attr("class","x origin").attr("stroke","black").attr("opacity",.2);t.merge(n).attr("d",this.line),t.exit().remove()}e.merge(r).call((0,f.default)({owner:t}));const i=e.merge(r).selectAll(":scope > g.graph").data((t=>t.data.map(y.default)),(t=>t.fn||t.r||t.x||t.text));i.exit().remove();const o=i.enter().append("g").attr("class","graph");i.merge(o).each((function(n,e){n.index=e;const r=(0,l.select)(this);r.call(m.default.graphTypes[n.graphType](t)),r.call((0,d.default)(t))}))}buildZoomHelper(){var t;const n=this;if(this.meta.zoomBehavior||(this.meta.zoomBehavior=(0,u.zoom)().on("zoom",(function(t){n.getEmitInstance().emit("all:zoom",t)}))),this.isPolarCoordinateSystem()||"polar"===this.getEmitInstance().options.lastCoordinateSystem){const e=(null===(t=this.getDraggableNode())||void 0===t?void 0:t.__zoom)||u.zoomIdentity,r=u.zoomIdentity.scale(1/e.k).translate(-e.x,-e.y);n.meta.zoomBehavior.xScale=r.rescaleX(n.meta.xScale),n.meta.zoomBehavior.yScale=r.rescaleY(n.meta.yScale)}else n.meta.zoomBehavior.xScale=n.meta.zoomBehavior.xScale||n.meta.xScale.copy(),n.meta.zoomBehavior.yScale=n.meta.zoomBehavior.yScale||n.meta.yScale.copy(),n.meta.zoomBehavior.xScale.range(n.meta.xScale.range()),n.meta.zoomBehavior.yScale.range(n.meta.yScale.range());this.canvas.enter.append("rect").call(this.meta.zoomBehavior).attr("class","zoom-and-drag").style("fill","none").style("pointer-events","all").on("mouseover",(function(t){n.getEmitInstance().emit("all:mouseover",t)})).on("mouseout",(function(t){n.getEmitInstance().emit("all:mouseout",t)})).on("mousemove",(function(t){n.getEmitInstance().emit("all:mousemove",t)})),this.draggable=this.canvas.merge(this.canvas.enter).select(".zoom-and-drag").call((t=>{t.node()&&(t.node().instance=n)})).attr("width",this.meta.width).attr("height",this.meta.height),this.options.lastCoordinateSystem=this.options.coordinateSystem}setUpPlugins(){const t=this.options.plugins||[],n=this;t.forEach((function(t){t(n)}))}addLink(){for(let t=0;tthis.meta.height?this.meta.height:i,n.select(".x.axis").attr("transform","translate(0,"+i+")"),n.selectAll(".x.axis path, .x.axis line").attr("transform","translate(0,"+(this.meta.height/2-i+this.meta.height/2)+")")}if(n.select(".y.axis").call(t.meta.yAxis),n.select(".y.axis").style("display",null),"sticky"===this.options.yAxis.position){const t=this.meta.xScale.domain()[0],e=this.meta.xScale.domain()[1],r=(e+t)/2;let i=this.meta.width/(t-e)*r+this.meta.width/2;i=i<0?0:i,i=i>this.meta.width?this.meta.width:i,n.select(".y.axis").attr("transform","translate("+i+",0)"),n.selectAll(".y.axis path, .y.axis line").attr("transform","translate("+-i+",0)")}n.selectAll(".axis path, .axis line").attr("fill","none").attr("stroke","black").attr("shape-rendering","crispedges").attr("opacity",.1)}syncOptions(){this.options.xAxis.domain=this.meta.xScale.domain(),this.options.yAxis.domain=this.meta.yScale.domain()}getFontSize(){return Math.max(Math.max(this.meta.width,this.meta.height)/50,8)}draw(){const t=this;t.emit("before:draw"),t.syncOptions(),t.updateAxes(),t.buildContent(),t.emit("after:draw")}isPolarCoordinateSystem(){return"polar"===this.options.coordinateSystem}setUpEventListeners(){const t=this,n=this.getEmitInstance();n&&n.removeAllListeners();const e={mousemove:function(n){t.tip.move(n)},mouseover:function(){t.tip.show()},mouseout:function(){t.tip.hide()},zoom:function({transform:n}){if(t.options.disableZoom)return;const e=n.rescaleX(t.meta.zoomBehavior.xScale).interpolate(c.interpolateRound),r=n.rescaleY(t.meta.zoomBehavior.yScale).interpolate(c.interpolateRound);t.meta.xScale.domain(e.domain()).range(e.range()),t.meta.yScale.domain(r.domain()).range(r.range())},"tip:update":function({x:n,y:e,index:r}){const i=t.root.merge(t.root.enter).datum().data[r],o=i.title||"",a=i.renderer||function(t,n){return t.toFixed(3)+", "+n.toFixed(3)},s=[];o&&s.push(o),s.push(a(n,e)),t.root.select(".top-right-legend").attr("fill",m.default.COLORS[r]).text(s.join(" "))}},r={mousemove:function(n){const e=(0,l.pointer)(n,t.draggable.node()),r={x:t.meta.xScale.invert(e[0]),y:t.meta.yScale.invert(e[1])};t.linkedGraphs.forEach((function(t){t.emit("before:mousemove",r),t.emit("mousemove",r)}))},zoom:function(n){t.linkedGraphs.forEach((function(e){e.draggable.node().__zoom=t.draggable.node().__zoom,e.emit("zoom",n),e.draw()})),t.emit("all:mousemove",n)}};Object.keys(e).forEach((function(n){!r[n]&&t.on("all:"+n,(function(){const e=Array.prototype.slice.call(arguments);t.linkedGraphs.forEach((function(t){const r=e.slice();r.unshift(n),t.emit.apply(t,r)}))})),t.on(n,e[n])})),Object.keys(r).forEach((function(n){t.on("all:"+n,r[n])}))}}n.Chart=v,v.cache={}},917:(t,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(t){return"graphType"in t||(t.graphType="interval"),"sampler"in t||(t.sampler="interval"!==t.graphType?"builtIn":"interval"),"fnType"in t||(t.fnType="linear"),t}},6025:function(t,n,e){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(n,"__esModule",{value:!0});const i=r(e(5888)),o=r(e(8458)),a=r(e(7777));n.default=function(t,n){const e=function(t,n){const e=n.range||[-1/0,1/0];return[Math.max(t.domain()[0],e[0]),Math.min(t.domain()[1],e[1])]}(t.meta.xScale,n);let r;if("builtIn"===n.sampler)r=a.default;else{if("interval"!==n.sampler)throw new Error(`Invalid sampler function ${n.sampler}`);r=o.default}const s=n.nSamples||Math.min(i.default.MAX_ITERATIONS,i.default.DEFAULT_ITERATIONS||2*t.meta.width),u=r({d:n,range:e,xScale:t.meta.xScale,yScale:t.meta.yScale,xAxis:t.options.xAxis,yAxis:t.options.yAxis,nSamples:s});return t.emit("eval",u,n.index,n.isHelper),u}},5888:(t,n,e)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.registerGraphType=void 0;const r=e(6618),i={COLORS:["steelblue","red","#05b378","orange","#4040e8","yellow","brown","magenta","cyan"].map((function(t){return(0,r.hsl)(t)})),DEFAULT_WIDTH:550,DEFAULT_HEIGHT:350,DEFAULT_ITERATIONS:null,TIP_X_EPS:1,MAX_ITERATIONS:0,graphTypes:{}};i.MAX_ITERATIONS=10*i.DEFAULT_WIDTH,n.registerGraphType=function(t,n){if(Object.hasOwn(i.graphTypes,t))throw new Error(`registerGraphType: graphType ${t} is already registered.`);i.graphTypes[t]=n},n.default=i},3321:function(t,n,e){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(n,"__esModule",{value:!0}),n.text=n.scatter=n.interval=n.polyline=void 0;const i=r(e(2210));n.polyline=i.default;const o=r(e(2266));n.interval=o.default;const a=r(e(648));n.scatter=a.default;const s=r(e(8607));n.text=s.default},2266:function(t,n,e){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(n,"__esModule",{value:!0});const i=e(3905),o=r(e(6025)),a=r(e(8593));n.default=function(t){let n;const e=t.meta.xScale,r=t.meta.yScale;function s(t,e,r,i){if(r>i){const t=r;r=i,i=t}const o=Math.min(e,i),a=Math.max(t,r);return a>o?[-n,0]:[a,o]}return function u(l){l.each((function(l){const c=u.el=(0,i.select)(this),h=l.index,f=l.closed,p=(0,o.default)(t,l),d=c.selectAll(":scope > path.line").data(p);n=Math.max(p[0].scaledDx,1);const y=`line line-${h}`,m=d.enter().append("path").attr("class",y).attr("fill","none"),_=d.merge(m).attr("stroke-width",n).attr("stroke",a.default.color(l,h)).attr("opacity",f?.5:1).attr("d",(function(t){return function(t,i){let o="";const a=r.range(),u=Math.min.apply(Math,a),l=Math.max.apply(Math,a);for(let a=0,c=t.length;a path.line").data(l),f=t.meta.yScale.range();let p=f[0],d=f[1];const y=p-d;function m(n){return a.default.clamp(t.meta.yScale(n[1]),d,p)}p+=1e6*y,d-=1e6*y,e.skipBoundsCheck&&(p=a.default.infinity(),d=-a.default.infinity());const _=(0,o.line)().curve(o.curveLinear).x((function(n){return t.meta.xScale(n[0])})).y(m),g=(0,o.area)().x((function(n){return t.meta.xScale(n[0])})).y0(t.meta.yScale(0)).y1(m),v=`line line-${u}`,x=h.enter().append("path").attr("class",v).attr("stroke-width",1).attr("stroke-linecap","round");h.merge(x).each((function(){const n=(0,i.select)(this);let r;if(e.closed?(n.attr("fill",c),n.attr("fill-opacity",.3),r=g):(n.attr("fill","none"),r=_),n.attr("stroke",c).attr("marker-end",(function(){return"vector"===e.fnType?"url(#"+t.markerId+")":null})).attr("d",r),e.attr)for(const t in e.attr){let r=e.attr[t];"class"===t&&(r=`${v} ${e.attr[t]}`),n.attr(t,r)}})),h.exit().remove()}))}}},648:function(t,n,e){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(n,"__esModule",{value:!0});const i=e(3905),o=e(6618),a=r(e(8593)),s=r(e(6025));n.default=function(t){const n=t.meta.xScale,e=t.meta.yScale;return function(r){r.each((function(r){let u,l;const c=r.index,h=a.default.color(r,c),f=(0,s.default)(t,r),p=[];for(u=0;u circle.scatter").data(p),y=`scatter scatter-${c}`,m=d.enter().append("circle").attr("class",y),_=d.merge(m).attr("fill",(0,o.hsl)(h.toString()).brighter(1.5).formatHex()).attr("stroke",h).attr("opacity",.7).attr("r",1).attr("cx",(function(t){return n(t[0])})).attr("cy",(function(t){return e(t[1])}));if(r.attr)for(const t in r.attr){let n=r.attr[t];"class"===t&&(n=`${y} ${r.attr[t]}`),_.attr(t,n)}d.exit().remove()}))}}},8607:function(t,n,e){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(n,"__esModule",{value:!0});const i=e(3905),o=e(6618),a=r(e(8593));n.default=function(t){const n=t.meta.xScale,e=t.meta.yScale;return function(t){t.each((function(t){t.sampler="builtIn",t.fnType="vector";const r=(0,i.select)(this).selectAll(":scope > text.fn-text").data([t.location]),s=r.enter().append("text").attr("class",`fn-text fn-text-${t.index}`),u=a.default.color(t,t.index),l=r.merge(s).attr("fill",(0,o.hsl)(u.toString()).brighter(1.5).formatHex()).attr("x",(t=>n(t[0]))).attr("y",(t=>e(t[1]))).text((()=>t.text));if(t.attr)for(const n in t.attr)l.attr(n,t.attr[n]);r.exit().remove()}))}}},3559:(t,n,e)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0});const r=e(6660),i=e(3905);n.default=function(t){const n=t.owner.meta.xScale,e=t.owner.meta.yScale,o=(0,r.line)().x((function(t){return t[0]})).y((function(t){return t[1]}));return function(t){t.each((function(){const t=(0,i.select)(this).selectAll("g.annotations").data((function(t){return t.annotations||[]})),r=t.enter().append("g").attr("class","annotations"),a=e.range(),s=n.range(),u=t.merge(r).selectAll("path").data((function(t){return"x"in t?[[[0,a[0]],[0,a[1]]]]:[[[s[0],0],[s[1],0]]]})),l=u.enter().append("path");u.merge(l).attr("stroke","#eee").attr("d",o),u.exit().remove();const c=t.merge(r).selectAll("text").data((function(t){return[{text:t.text||"",hasX:"x"in t}]})),h=c.enter().append("text");c.merge(h).text((function(t){return t.text})).attr("y",(function(t){return t.hasX?3:0})).attr("x",(function(t){return t.hasX?0:3})).attr("dy",(function(t){return t.hasX?5:-5})).attr("text-anchor",(function(t){return t.hasX?"end":""})).attr("transform",(function(t){return t.hasX?"rotate(-90)":""})),c.exit().remove(),t.merge(r).attr("transform",(function(t){return"x"in t?"translate("+n(t.x)+", 0)":"translate(0, "+e(t.y)+")"})),t.exit().remove()}))}}},8016:function(t,n,e){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(n,"__esModule",{value:!0});const i=e(3905),o=e(3321),a=e(1669),s=r(e(917)),u=r(e(8593));n.default=function(t){const n=(0,s.default)({isHelper:!0,skipTip:!0,skipBoundsCheck:!0,nSamples:2,graphType:"polyline"});function e(t){if(!t.derivative)return[];const e="number"==typeof t.derivative.x0?t.derivative.x0:u.default.infinity();return n.index=t.index,n.scope={m:(0,a.builtIn)(t.derivative,"fn",{x:e}),x0:e,y0:(0,a.builtIn)(t,"fn",{x:e})},n.fn="m * (x - x0) + y0",[n]}function r(n){const e=this;n.derivative&&n.derivative.updateOnMouseMove&&!n.derivative.$$mouseListener&&(n.derivative.$$mouseListener=function({x:t}){n.derivative&&(n.derivative.x0=t),l(e)},t.on("tip:update",n.derivative.$$mouseListener))}const l=function(n){n.each((function(a){const s=(0,i.select)(this),u=e.call(n,a);r.call(n,a);const l=s.selectAll("g.derivative").data(u),c=l.enter().append("g").attr("class","derivative");l.merge(c).call((0,o.polyline)(t)),l.merge(c).selectAll("path").attr("opacity",.5),l.exit().remove()}))};return l}},1669:function(t,n,e){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(n,"__esModule",{value:!0}),n.interval=n.builtIn=void 0;const i=r(e(5248)),o={interval:r(e(8867)).default,builtIn:i.default},a="object"==typeof e.g&&"math"in e.g?e.g.math:"object"==typeof window&&"math"in window?window.math:null;function s(t){return function(n,e,r){return function(n,e){const r=n[e],i=t+"_Expression_"+e,s=t+"_Compiled_"+e;r!==n[i]&&(n[i]=r,n[s]=function(n){if("string"==typeof n){const e=o[t](n);return a&&"builtIn"===t?{eval:e.evaluate||e.eval}:e}if("function"==typeof n)return{eval:n};throw Error("expression must be a string or a function")}(r))}(n,e),function(n,e){return n[t+"_Compiled_"+e]}(n,e).eval(Object.assign({},n.scope||{},r))}}a&&(o.builtIn=a.compile);const u=s("builtIn");n.builtIn=u;const l=s("interval");n.interval=l},9489:function(t,n,e){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(n,"__esModule",{value:!0});const i=e(3905),o=r(e(8016)),a=r(e(9793));n.default=function(t){return function(n){n.each((function(){const n=(0,i.select)(this);n.call((0,o.default)(t)),n.call((0,a.default)(t))}))}}},9793:function(t,n,e){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(n,"__esModule",{value:!0});const i=e(3905),o=e(1669),a=r(e(917)),s=e(3321),u=r(e(8593));n.default=function(t){const n=(0,a.default)({isHelper:!0,skipTip:!0,skipBoundsCheck:!0,nSamples:2,graphType:"polyline"});function e(t,n){if(!("x0"in n))throw Error("secant must have the property `x0` defined");n.scope=n.scope||{};const e=n.x0,r="number"==typeof n.x1?n.x1:u.default.infinity();var i;Object.assign(n.scope,{x0:e,x1:r,y0:(0,o.builtIn)(t,"fn",{x:e}),y1:(0,o.builtIn)(t,"fn",{x:r})}),(i=n.scope).m=(i.y1-i.y0)/(i.x1-i.x0)}function r(t,n){e(t,n),n.fn="m * (x - x0) + y0"}function l(n,r){const i=this;r.updateOnMouseMove&&!r.$$mouseListener&&(r.$$mouseListener=function({x:t}){r.x1=t,e(n,r),h(i)},t.on("tip:update",r.$$mouseListener))}function c(t){const e=this,i=[];t.secants=t.secants||[];for(let o=0;o{"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.renderPolarGrid=n.getPolarLabelLayout=n.getPolarRayInterval=n.formatPolarAngle=n.getPolarAngles=n.getPolarRadii=n.getPolarRadiusDomain=n.getPolarDomains=n.validatePolarOptions=void 0;const r=e(103),i=e(8066),o=e(3905),a=2*Math.PI;function s(t,n){const e=Math.min(...t),r=Math.max(...t),i=Math.min(...n),o=Math.max(...n),a=Math.max(e,Math.min(0,r)),s=Math.max(i,Math.min(0,o));return[Math.hypot(a,s),Math.hypot(Math.max(Math.abs(e),Math.abs(r)),Math.max(Math.abs(i),Math.abs(o)))]}function u(t,n,e){const r=t.radiusDomain||n,o=Math.max(r[0],n[0]),a=Math.min(r[1],n[1]);if(o>a)return[];let s;if(Array.isArray(t.radialTicks))s=t.radialTicks;else{let n=t.radialTicks||5;if(void 0===t.radialTicks&&void 0!==e){const t=(a-o)*e;n=Math.max(1,Math.round(t/50))}s=(0,i.scaleLinear)().domain([o,a]).ticks(n)}return Array.from(new Set(s)).filter((t=>t>0&&t>=o&&t<=a)).sort(((t,n)=>t-n))}function l(t){if(Array.isArray(t.angularTicks)){const n=t.angularTicks.map((t=>(t%a+a)%a));return n.filter(((t,e)=>n.findIndex((n=>Math.abs(n-t)<1e-10))===e))}const n=t.angularTicks||12;return Array.from({length:n},((t,e)=>e*a/n))}function c(t,n){if("degrees"===n)return`${Number((180*t/Math.PI).toFixed(2))}°`;for(const n of[1,2,3,4,6,8,12,16]){const e=Math.round(t/Math.PI*n);if(Math.abs(t/Math.PI-e/n)<1e-10)return 0===e?"0":`${1===e?"":-1===e?"-":String(e)}π${1===n?"":`/${n}`}`}return Number(t.toFixed(3)).toString()}function h(t,n,e,r){let i=-1/0,o=1/0;for(const[a,s,u]of[[t[0],n[0],e],[t[1],n[1],r]]){if(Math.abs(s)<1e-10){if(a<0||a>u)return;continue}const t=(0-a)/s,n=(u-a)/s;i=Math.max(i,Math.min(t,n)),o=Math.min(o,Math.max(t,n))}const a=Math.max(0,i);return o>a?[a,o]:void 0}function f(t,n,e,r,i){const o=h(t,n,r,i);if(!o)return;const a=e.filter((t=>t>=o[0]&&t<=o[1])).pop();return void 0!==a?{position:[t[0]+n[0]*a,t[1]+n[1]*a],textAnchor:n[0]>1e-10?"start":n[0]<-1e-10?"end":"middle"}:void 0}n.validatePolarOptions=function(t){var n,e;if("linear"!==t.xAxis.type||"linear"!==t.yAxis.type)throw new Error("polar coordinate system only supports linear axes");for(const e of[t.xAxis.domain,t.yAxis.domain,null===(n=t.polar)||void 0===n?void 0:n.radiusDomain])if(e&&(2!==e.length||e.some((t=>!Number.isFinite(t)))||e[0]>=e[1]))throw new Error("polar domains must contain two finite ascending values");const r=t.polar;if((null===(e=null==r?void 0:r.radiusDomain)||void 0===e?void 0:e[0])<0)throw new Error("polar radiusDomain must be non-negative");for(const t of[null==r?void 0:r.radialTicks,null==r?void 0:r.angularTicks]){if(void 0!==t&&!Array.isArray(t)&&(!Number.isInteger(t)||t<1))throw new Error("polar tick counts must be positive integers");if(Array.isArray(t)&&t.some((t=>!Number.isFinite(t))))throw new Error("polar tick values must be finite numbers")}if(Array.isArray(null==r?void 0:r.radialTicks)&&r.radialTicks.some((t=>t<0)))throw new Error("polar radial ticks must be non-negative");if((null==r?void 0:r.angleUnit)&&"radians"!==r.angleUnit&&"degrees"!==r.angleUnit)throw new Error(`unsupported polar angle unit ${r.angleUnit}`)},n.getPolarDomains=function(t,n,e,r){const i=Math.max((t[1]-t[0])/e,(n[1]-n[0])/r),o=(t[0]+t[1])/2,a=(n[0]+n[1])/2;return{xDomain:[o-e*i/2,o+e*i/2],yDomain:[a-r*i/2,a+r*i/2]}},n.getPolarRadiusDomain=s,n.getPolarRadii=u,n.getPolarAngles=l,n.formatPolarAngle=c,n.getPolarRayInterval=h,n.getPolarLabelLayout=f,n.renderPolarGrid=function(t,n,e){var i;if("polar"!==e.coordinateSystem||!1===(null===(i=e.polar)||void 0===i?void 0:i.grid))return void t.selectAll("g.polar-grid").remove();const a=t.selectAll("g.polar-grid").data([e.polar||{}]),p=a.merge(a.enter().insert("g",".content, .zoom-and-drag").attr("class","polar-grid")).attr("clip-path",null).attr("pointer-events","none"),d=p.selectAll(":scope > g.polar-grid-lines").data([0]),y=d.enter().append("g").attr("class","polar-grid-lines"),m=t.select("clipPath[id]").attr("id"),_=d.merge(y).attr("clip-path","url(#"+m+")"),g=e.polar||{},v=n.xScale,x=n.yScale,w=s(v.domain(),x.domain()),b=[v(0),x(0)],M=v(1)-b[0],T=x(1)-b[1],A=Math.abs(M),E=u(g,w,A),k=l(g),S=t=>{var e;const r=void 0===(null===(e=g.radiusDomain)||void 0===e?void 0:e[1])?void 0:Math.min(g.radiusDomain[1],w[1]),i=[Math.cos(t)*Math.sign(M),Math.sin(t)*Math.sign(T)],o=h(b,i,n.width,n.height);if(!o)return;const a=void 0===r?o[1]:Math.min(r*A,o[1]);return a>o[0]?{direction:i,rayLength:a}:void 0},N=k.filter((t=>S(t))),P=_.selectAll("circle.polar-grid-circle").data(E,(t=>t));P.exit().remove(),P.merge(P.enter().append("circle").attr("class","polar-grid-circle")).attr("cx",b[0]).attr("cy",b[1]).attr("r",(t=>t*A)).attr("fill","none").attr("stroke","currentColor").attr("opacity",.2);const O=_.selectAll("line.polar-grid-ray").data(N,(t=>t));O.exit().remove(),O.merge(O.enter().append("line").attr("class","polar-grid-ray")).attr("x1",b[0]).attr("y1",b[1]).attr("x2",(t=>{const n=S(t);return b[0]+n.direction[0]*n.rayLength})).attr("y2",(t=>{const n=S(t);return b[1]+n.direction[1]*n.rayLength})).attr("stroke","currentColor").attr("opacity",.2);const I=p.selectAll("text.polar-radius-label").data(E,(t=>t));I.exit().remove(),I.merge(I.enter().append("text").attr("class","polar-radius-label")).attr("x",(t=>v(t))).attr("y",b[1]).attr("text-anchor","middle").attr("dy","-0.8em").attr("fill","currentColor").text(g.radiusTickFormat||(0,r.format)("~g"));const L=[];if(g.angularLabels&&E.length){const t=E.map((t=>t*A));for(const e of N){const r=[Math.cos(e)*Math.sign(M),Math.sin(e)*Math.sign(T)],i=f(b,r,t,n.width,n.height);i&&L.push(Object.assign({angle:e,direction:r},i))}}const Z=p.selectAll("text.polar-angle-label").data(L,(t=>t.angle));Z.exit().remove(),Z.merge(Z.enter().append("text").attr("class","polar-angle-label")).attr("x",(t=>t.position[0])).attr("y",(t=>t.position[1])).attr("dx",(t=>8*t.direction[0])).attr("dy",(t=>8*t.direction[1])).attr("text-anchor",(t=>t.textAnchor)).attr("dominant-baseline","middle").attr("fill","currentColor").text((t=>{const n=g.angleUnit||"radians",e="degrees"===n?180*t.angle/Math.PI:t.angle;return g.angleTickFormat?g.angleTickFormat(e):c(t.angle,n)})).each((function(t){const e=this.getBBox(),r=Math.max(0,-e.x)-Math.max(0,e.x+e.width-n.width),i=Math.max(0,-e.y)-Math.max(0,e.y+e.height-n.height);(0,o.select)(this).attr("dx",8*t.direction[0]+r).attr("dy",8*t.direction[1]+i)}))}},360:()=>{"undefined"!=typeof window&&function(t,n){try{t.querySelector(":scope body")}catch(e){["querySelector","querySelectorAll"].forEach((function(e){const r=n[e];n[e]=function(n){if(/(^|,)\s*:scope/.test(n)){const r=this.id;this.id="ID_"+Date.now(),n=n.replace(/((^|,)\s*):scope/g,"$1#"+this.id);const i=t[e](n);return this.id=r,i}return r.call(this,n)}}))}}(window.document,Element.prototype)},7777:function(t,n,e){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(n,"__esModule",{value:!0});const i=r(e(8593)),o=e(1669);function a(t,n,e,r,s){if(!s)return{asymptote:!0,d0:t,d1:n};const u=t[0],l=n[0],c=i.default.linspace(u,l,10);let h,f;for(let t=0;t<10;t+=1){const n=c[t],u=(0,o.builtIn)(e,"fn",{x:n});if(h){const t=u-h;if(i.default.sgn(t)===r)return a([f,h],[n,u],e,r,s-1)}h=u,f=n}return{asymptote:!1,d0:t,d1:n}}function s(t){const n=i.default.space(t.xAxis,t.range,t.nSamples),e=t.yScale.domain(),r=e[0]-i.default.infinity(),s=e[1]+i.default.infinity(),u=[];for(let e=0;e=2&&r!==p&&Math.abs(f/h)>1){const e=a(n[c-1],n[c],t,p,3);e.asymptote?(n[c-1][0]=e.d0[0],n[c-1][1]=i.default.clamp(e.d0[1],s,u),o.push(l),n[c][0]=e.d1[0],n[c][1]=i.default.clamp(e.d1[1],s,u),l=[n[c]]):l.push(n[c])}else l.push(n[c]);l.length>1&&(h=l[l.length-1][0]-l[l.length-2][0],r=p),++c}return l.length&&o.push(l),o}(t.d,u,t.yScale);return l}function u(t){const n=t.d.range||[0,2*Math.PI],e=i.default.space(t.xAxis,n,t.nSamples),r=[];for(let n=0;nn[1].hi&&(t[1].hi=Math.max(o,t[1].hi),n[1].lo=Math.min(i,n[1].lo)),t[1].hit[0]-s.default.TIP_X_EPS&&w{"use strict";Object.defineProperty(n,"__esModule",{value:!0})},8593:function(t,n,e){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(n,"__esModule",{value:!0});const i=r(e(5888)),o={linspace:function(t,n,e){const r=(n-t)/(e-1);return Array.from({length:e},((n,e)=>t+r*e))},logspace:function(t,n,e){return this.linspace(t,n,e).map((t=>Math.pow(10,t)))},isValidNumber:function(t){return"number"==typeof t&&!isNaN(t)},space:function(t,n,e){const r=n[0],i=n[1];return"log"===t.type?this.logspace(Math.log10(r),Math.log10(i),e):this.linspace(r,i,e)},getterSetter:function(t,n){const e=this;this[n]=function(r){return arguments.length?(t[n]=r,e):t[n]}},sgn:function(t){return t<0?-1:t>0?1:0},clamp:function(t,n,e){return te?e:t},color:function(t,n){const e=n%i.default.COLORS.length;return t.color||i.default.COLORS[e].hex()},infinity:function(){return 9007199254740991}};n.default=o},8873:(t,n,e)=>{"use strict";function r(t){return t}e.r(n),e.d(n,{axisBottom:()=>_,axisLeft:()=>g,axisRight:()=>m,axisTop:()=>y});var i=1,o=2,a=3,s=4,u=1e-6;function l(t){return"translate("+t+",0)"}function c(t){return"translate(0,"+t+")"}function h(t){return n=>+t(n)}function f(t,n){return n=Math.max(0,t.bandwidth()-2*n)/2,t.round()&&(n=Math.round(n)),e=>+t(e)+n}function p(){return!this.__axis}function d(t,n){var e=[],d=null,y=null,m=6,_=6,g=3,v="undefined"!=typeof window&&window.devicePixelRatio>1?0:.5,x=t===i||t===s?-1:1,w=t===s||t===o?"x":"y",b=t===i||t===a?l:c;function M(l){var c=null==d?n.ticks?n.ticks.apply(n,e):n.domain():d,M=null==y?n.tickFormat?n.tickFormat.apply(n,e):r:y,T=Math.max(m,0)+g,A=n.range(),E=+A[0]+v,k=+A[A.length-1]+v,S=(n.bandwidth?f:h)(n.copy(),v),N=l.selection?l.selection():l,P=N.selectAll(".domain").data([null]),O=N.selectAll(".tick").data(c,n).order(),I=O.exit(),L=O.enter().append("g").attr("class","tick"),Z=O.select("line"),C=O.select("text");P=P.merge(P.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),O=O.merge(L),Z=Z.merge(L.append("line").attr("stroke","currentColor").attr(w+"2",x*m)),C=C.merge(L.append("text").attr("fill","currentColor").attr(w,x*T).attr("dy",t===i?"0em":t===a?"0.71em":"0.32em")),l!==N&&(P=P.transition(l),O=O.transition(l),Z=Z.transition(l),C=C.transition(l),I=I.transition(l).attr("opacity",u).attr("transform",(function(t){return isFinite(t=S(t))?b(t+v):this.getAttribute("transform")})),L.attr("opacity",u).attr("transform",(function(t){var n=this.parentNode.__axis;return b((n&&isFinite(n=n(t))?n:S(t))+v)}))),I.remove(),P.attr("d",t===s||t===o?_?"M"+x*_+","+E+"H"+v+"V"+k+"H"+x*_:"M"+v+","+E+"V"+k:_?"M"+E+","+x*_+"V"+v+"H"+k+"V"+x*_:"M"+E+","+v+"H"+k),O.attr("opacity",1).attr("transform",(function(t){return b(S(t)+v)})),Z.attr(w+"2",x*m),C.attr(w,x*T).text(M),N.filter(p).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",t===o?"start":t===s?"end":"middle"),N.each((function(){this.__axis=S}))}return M.scale=function(t){return arguments.length?(n=t,M):n},M.ticks=function(){return e=Array.from(arguments),M},M.tickArguments=function(t){return arguments.length?(e=null==t?[]:Array.from(t),M):e.slice()},M.tickValues=function(t){return arguments.length?(d=null==t?null:Array.from(t),M):d&&d.slice()},M.tickFormat=function(t){return arguments.length?(y=t,M):y},M.tickSize=function(t){return arguments.length?(m=_=+t,M):m},M.tickSizeInner=function(t){return arguments.length?(m=+t,M):m},M.tickSizeOuter=function(t){return arguments.length?(_=+t,M):_},M.tickPadding=function(t){return arguments.length?(g=+t,M):g},M.offset=function(t){return arguments.length?(v=+t,M):v},M}function y(t){return d(i,t)}function m(t){return d(o,t)}function _(t){return d(a,t)}function g(t){return d(s,t)}},4447:(t,n,e)=>{"use strict";e.d(n,{B8:()=>T,Il:()=>i,J5:()=>a,SU:()=>M,Ss:()=>A,Ym:()=>L,ZP:()=>x,xV:()=>o});var r=e(9531);function i(){}var o=.7,a=1/o,s="\\s*([+-]?\\d+)\\s*",u="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",l="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",c=/^#([0-9a-f]{3,8})$/,h=new RegExp(`^rgb\\(${s},${s},${s}\\)$`),f=new RegExp(`^rgb\\(${l},${l},${l}\\)$`),p=new RegExp(`^rgba\\(${s},${s},${s},${u}\\)$`),d=new RegExp(`^rgba\\(${l},${l},${l},${u}\\)$`),y=new RegExp(`^hsl\\(${u},${l},${l}\\)$`),m=new RegExp(`^hsla\\(${u},${l},${l},${u}\\)$`),_={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function g(){return this.rgb().formatHex()}function v(){return this.rgb().formatRgb()}function x(t){var n,e;return t=(t+"").trim().toLowerCase(),(n=c.exec(t))?(e=n[1].length,n=parseInt(n[1],16),6===e?w(n):3===e?new A(n>>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1):8===e?b(n>>24&255,n>>16&255,n>>8&255,(255&n)/255):4===e?b(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|240&n,((15&n)<<4|15&n)/255):null):(n=h.exec(t))?new A(n[1],n[2],n[3],1):(n=f.exec(t))?new A(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=p.exec(t))?b(n[1],n[2],n[3],n[4]):(n=d.exec(t))?b(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=y.exec(t))?O(n[1],n[2]/100,n[3]/100,1):(n=m.exec(t))?O(n[1],n[2]/100,n[3]/100,n[4]):_.hasOwnProperty(t)?w(_[t]):"transparent"===t?new A(NaN,NaN,NaN,0):null}function w(t){return new A(t>>16&255,t>>8&255,255&t,1)}function b(t,n,e,r){return r<=0&&(t=n=e=NaN),new A(t,n,e,r)}function M(t){return t instanceof i||(t=x(t)),t?new A((t=t.rgb()).r,t.g,t.b,t.opacity):new A}function T(t,n,e,r){return 1===arguments.length?M(t):new A(t,n,e,null==r?1:r)}function A(t,n,e,r){this.r=+t,this.g=+n,this.b=+e,this.opacity=+r}function E(){return`#${P(this.r)}${P(this.g)}${P(this.b)}`}function k(){const t=S(this.opacity);return`${1===t?"rgb(":"rgba("}${N(this.r)}, ${N(this.g)}, ${N(this.b)}${1===t?")":`, ${t})`}`}function S(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function N(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function P(t){return((t=N(t))<16?"0":"")+t.toString(16)}function O(t,n,e,r){return r<=0?t=n=e=NaN:e<=0||e>=1?t=n=NaN:n<=0&&(t=NaN),new Z(t,n,e,r)}function I(t){if(t instanceof Z)return new Z(t.h,t.s,t.l,t.opacity);if(t instanceof i||(t=x(t)),!t)return new Z;if(t instanceof Z)return t;var n=(t=t.rgb()).r/255,e=t.g/255,r=t.b/255,o=Math.min(n,e,r),a=Math.max(n,e,r),s=NaN,u=a-o,l=(a+o)/2;return u?(s=n===a?(e-r)/u+6*(e0&&l<1?0:s,new Z(s,u,l,t.opacity)}function L(t,n,e,r){return 1===arguments.length?I(t):new Z(t,n,e,null==r?1:r)}function Z(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function C(t){return(t=(t||0)%360)<0?t+360:t}function D(t){return Math.max(0,Math.min(1,t||0))}function $(t,n,e){return 255*(t<60?n+(e-n)*t/60:t<180?e:t<240?n+(e-n)*(240-t)/60:n)}(0,r.Z)(i,x,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:g,formatHex:g,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return I(this).formatHsl()},formatRgb:v,toString:v}),(0,r.Z)(A,T,(0,r.l)(i,{brighter(t){return t=null==t?a:Math.pow(a,t),new A(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?o:Math.pow(o,t),new A(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new A(N(this.r),N(this.g),N(this.b),S(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:E,formatHex:E,formatHex8:function(){return`#${P(this.r)}${P(this.g)}${P(this.b)}${P(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:k,toString:k})),(0,r.Z)(Z,L,(0,r.l)(i,{brighter(t){return t=null==t?a:Math.pow(a,t),new Z(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?o:Math.pow(o,t),new Z(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),n=isNaN(t)||isNaN(this.s)?0:this.s,e=this.l,r=e+(e<.5?e:1-e)*n,i=2*e-r;return new A($(t>=240?t-240:t+120,i,r),$(t,i,r),$(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new Z(C(this.h),D(this.s),D(this.l),S(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=S(this.opacity);return`${1===t?"hsl(":"hsla("}${C(this.h)}, ${100*D(this.s)}%, ${100*D(this.l)}%${1===t?")":`, ${t})`}`}}))},5159:(t,n,e)=>{"use strict";e.d(n,{Z:()=>d});var r=e(9531),i=e(4447),o=e(5782),a=-.14861,s=1.78277,u=-.29227,l=-.90649,c=1.97294,h=c*l,f=c*s,p=s*u-l*a;function d(t,n,e,r){return 1===arguments.length?function(t){if(t instanceof y)return new y(t.h,t.s,t.l,t.opacity);t instanceof i.Ss||(t=(0,i.SU)(t));var n=t.r/255,e=t.g/255,r=t.b/255,a=(p*r+h*n-f*e)/(p+h-f),s=r-a,d=(c*(e-a)-u*s)/l,m=Math.sqrt(d*d+s*s)/(c*a*(1-a)),_=m?Math.atan2(d,s)*o.R-120:NaN;return new y(_<0?_+360:_,m,a,t.opacity)}(t):new y(t,n,e,null==r?1:r)}function y(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}(0,r.Z)(y,d,(0,r.l)(i.Il,{brighter(t){return t=null==t?i.J5:Math.pow(i.J5,t),new y(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?i.xV:Math.pow(i.xV,t),new y(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=isNaN(this.h)?0:(this.h+120)*o.u,n=+this.l,e=isNaN(this.s)?0:this.s*n*(1-n),r=Math.cos(t),h=Math.sin(t);return new i.Ss(255*(n+e*(a*r+s*h)),255*(n+e*(u*r+l*h)),255*(n+e*(c*r)),this.opacity)}}))},9531:(t,n,e)=>{"use strict";function r(t,n,e){t.prototype=n.prototype=e,e.constructor=t}function i(t,n){var e=Object.create(t.prototype);for(var r in n)e[r]=n[r];return e}e.d(n,{Z:()=>r,l:()=>i})},6618:(t,n,e)=>{"use strict";e.r(n),e.d(n,{color:()=>r.ZP,cubehelix:()=>o.Z,gray:()=>i.MA,hcl:()=>i.Uc,hsl:()=>r.Ym,lab:()=>i.ZP,lch:()=>i.tW,rgb:()=>r.B8});var r=e(4447),i=e(8990),o=e(5159)},8990:(t,n,e)=>{"use strict";e.d(n,{MA:()=>d,Uc:()=>M,ZP:()=>y,tW:()=>b});var r=e(9531),i=e(4447),o=e(5782);const a=.96422,s=1,u=.82521,l=4/29,c=6/29,h=3*c*c,f=c*c*c;function p(t){if(t instanceof m)return new m(t.l,t.a,t.b,t.opacity);if(t instanceof T)return A(t);t instanceof i.Ss||(t=(0,i.SU)(t));var n,e,r=x(t.r),o=x(t.g),l=x(t.b),c=_((.2225045*r+.7168786*o+.0606169*l)/s);return r===o&&o===l?n=e=c:(n=_((.4360747*r+.3850649*o+.1430804*l)/a),e=_((.0139322*r+.0971045*o+.7141733*l)/u)),new m(116*c-16,500*(n-c),200*(c-e),t.opacity)}function d(t,n){return new m(t,0,0,null==n?1:n)}function y(t,n,e,r){return 1===arguments.length?p(t):new m(t,n,e,null==r?1:r)}function m(t,n,e,r){this.l=+t,this.a=+n,this.b=+e,this.opacity=+r}function _(t){return t>f?Math.pow(t,1/3):t/h+l}function g(t){return t>c?t*t*t:h*(t-l)}function v(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function x(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function w(t){if(t instanceof T)return new T(t.h,t.c,t.l,t.opacity);if(t instanceof m||(t=p(t)),0===t.a&&0===t.b)return new T(NaN,0{"use strict";e.d(n,{R:()=>i,u:()=>r});const r=Math.PI/180,i=180/Math.PI},5386:(t,n,e)=>{"use strict";e.d(n,{WU:()=>i,ZP:()=>s,jH:()=>o});var r,i,o,a=e(28);function s(t){return r=(0,a.Z)(t),i=r.format,o=r.formatPrefix,r}s({thousands:",",grouping:[3],currency:["$",""]})},5368:(t,n,e)=>{"use strict";e.d(n,{Z:()=>i});var r=e(8613);function i(t){return(t=(0,r.V)(Math.abs(t)))?t[1]:NaN}},8613:(t,n,e)=>{"use strict";function r(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function i(t,n){if((e=(t=n?t.toExponential(n-1):t.toExponential()).indexOf("e"))<0)return null;var e,r=t.slice(0,e);return[r.length>1?r[0]+r.slice(2):r,+t.slice(e+1)]}e.d(n,{V:()=>i,Z:()=>r})},2035:(t,n,e)=>{"use strict";e.d(n,{Z:()=>i,v:()=>o});var r=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function i(t){if(!(n=r.exec(t)))throw new Error("invalid format: "+t);var n;return new o({fill:n[1],align:n[2],sign:n[3],symbol:n[4],zero:n[5],width:n[6],comma:n[7],precision:n[8]&&n[8].slice(1),trim:n[9],type:n[10]})}function o(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}i.prototype=o.prototype,o.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type}},103:(t,n,e)=>{"use strict";e.r(n),e.d(n,{FormatSpecifier:()=>o.v,format:()=>r.WU,formatDefaultLocale:()=>r.ZP,formatLocale:()=>i.Z,formatPrefix:()=>r.jH,formatSpecifier:()=>o.Z,precisionFixed:()=>a.Z,precisionPrefix:()=>s.Z,precisionRound:()=>u.Z});var r=e(5386),i=e(28),o=e(2035),a=e(6909),s=e(7017),u=e(3482)},28:(t,n,e)=>{"use strict";e.d(n,{Z:()=>f});var r,i=e(5368),o=e(2035),a=e(8613);function s(t,n){var e=(0,a.V)(t,n);if(!e)return t+"";var r=e[0],i=e[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}const u={"%":(t,n)=>(100*t).toFixed(n),b:t=>Math.round(t).toString(2),c:t=>t+"",d:a.Z,e:(t,n)=>t.toExponential(n),f:(t,n)=>t.toFixed(n),g:(t,n)=>t.toPrecision(n),o:t=>Math.round(t).toString(8),p:(t,n)=>s(100*t,n),r:s,s:function(t,n){var e=(0,a.V)(t,n);if(!e)return t+"";var i=e[0],o=e[1],s=o-(r=3*Math.max(-8,Math.min(8,Math.floor(o/3))))+1,u=i.length;return s===u?i:s>u?i+new Array(s-u+1).join("0"):s>0?i.slice(0,s)+"."+i.slice(s):"0."+new Array(1-s).join("0")+(0,a.V)(t,Math.max(0,n+s-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function l(t){return t}var c=Array.prototype.map,h=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function f(t){var n,e,a=void 0===t.grouping||void 0===t.thousands?l:(n=c.call(t.grouping,Number),e=t.thousands+"",function(t,r){for(var i=t.length,o=[],a=0,s=n[0],u=0;i>0&&s>0&&(u+s+1>r&&(s=Math.max(1,r-u)),o.push(t.substring(i-=s,i+s)),!((u+=s+1)>r));)s=n[a=(a+1)%n.length];return o.reverse().join(e)}),s=void 0===t.currency?"":t.currency[0]+"",f=void 0===t.currency?"":t.currency[1]+"",p=void 0===t.decimal?".":t.decimal+"",d=void 0===t.numerals?l:function(t){return function(n){return n.replace(/[0-9]/g,(function(n){return t[+n]}))}}(c.call(t.numerals,String)),y=void 0===t.percent?"%":t.percent+"",m=void 0===t.minus?"−":t.minus+"",_=void 0===t.nan?"NaN":t.nan+"";function g(t){var n=(t=(0,o.Z)(t)).fill,e=t.align,i=t.sign,l=t.symbol,c=t.zero,g=t.width,v=t.comma,x=t.precision,w=t.trim,b=t.type;"n"===b?(v=!0,b="g"):u[b]||(void 0===x&&(x=12),w=!0,b="g"),(c||"0"===n&&"="===e)&&(c=!0,n="0",e="=");var M="$"===l?s:"#"===l&&/[boxX]/.test(b)?"0"+b.toLowerCase():"",T="$"===l?f:/[%p]/.test(b)?y:"",A=u[b],E=/[defgprs%]/.test(b);function k(t){var o,s,u,l=M,f=T;if("c"===b)f=A(t)+f,t="";else{var y=(t=+t)<0||1/t<0;if(t=isNaN(t)?_:A(Math.abs(t),x),w&&(t=function(t){t:for(var n,e=t.length,r=1,i=-1;r0&&(i=0)}return i>0?t.slice(0,i)+t.slice(n+1):t}(t)),y&&0==+t&&"+"!==i&&(y=!1),l=(y?"("===i?i:m:"-"===i||"("===i?"":i)+l,f=("s"===b?h[8+r/3]:"")+f+(y&&"("===i?")":""),E)for(o=-1,s=t.length;++o(u=t.charCodeAt(o))||u>57){f=(46===u?p+t.slice(o+1):t.slice(o))+f,t=t.slice(0,o);break}}v&&!c&&(t=a(t,1/0));var k=l.length+t.length+f.length,S=k>1)+l+t+f+S.slice(k);break;default:t=S+l+t+f}return d(t)}return x=void 0===x?6:/[gprs]/.test(b)?Math.max(1,Math.min(21,x)):Math.max(0,Math.min(20,x)),k.toString=function(){return t+""},k}return{format:g,formatPrefix:function(t,n){var e=g(((t=(0,o.Z)(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor((0,i.Z)(n)/3))),a=Math.pow(10,-r),s=h[8+r/3];return function(t){return e(a*t)+s}}}}},6909:(t,n,e)=>{"use strict";e.d(n,{Z:()=>i});var r=e(5368);function i(t){return Math.max(0,-(0,r.Z)(Math.abs(t)))}},7017:(t,n,e)=>{"use strict";e.d(n,{Z:()=>i});var r=e(5368);function i(t,n){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor((0,r.Z)(n)/3)))-(0,r.Z)(Math.abs(t)))}},3482:(t,n,e)=>{"use strict";e.d(n,{Z:()=>i});var r=e(5368);function i(t,n){return t=Math.abs(t),n=Math.abs(n)-t,Math.max(0,(0,r.Z)(n)-(0,r.Z)(t))+1}},1606:(t,n,e)=>{"use strict";e.d(n,{M:()=>a,Z:()=>o});var r=e(5326),i=e(5401);function o(t,n){return((0,i.v)(n)?i.Z:a)(t,n)}function a(t,n){var e,i=n?n.length:0,o=t?Math.min(i,t.length):0,a=new Array(o),s=new Array(i);for(e=0;e{"use strict";function r(t,n,e,r,i){var o=t*t,a=o*t;return((1-3*t+3*o-a)*n+(4-6*o+3*a)*e+(1+3*t+3*o-3*a)*r+a*i)/6}function i(t){var n=t.length-1;return function(e){var i=e<=0?e=0:e>=1?(e=1,n-1):Math.floor(e*n),o=t[i],a=t[i+1],s=i>0?t[i-1]:2*o-a,u=ii,t:()=>r})},6068:(t,n,e)=>{"use strict";e.d(n,{Z:()=>i});var r=e(7265);function i(t){var n=t.length;return function(e){var i=Math.floor(((e%=1)<0?++e:e)*n),o=t[(i+n-1)%n],a=t[i%n],s=t[(i+1)%n],u=t[(i+2)%n];return(0,r.t)((e-i/n)*n,o,a,s,u)}}},8280:(t,n,e)=>{"use strict";e.d(n,{ZP:()=>s,wx:()=>o,yi:()=>a});var r=e(2954);function i(t,n){return function(e){return t+e*n}}function o(t,n){var e=n-t;return e?i(t,e>180||e<-180?e-360*Math.round(e/360):e):(0,r.Z)(isNaN(t)?n:t)}function a(t){return 1==(t=+t)?s:function(n,e){return e-n?function(t,n,e){return t=Math.pow(t,e),n=Math.pow(n,e)-t,e=1/e,function(r){return Math.pow(t+r*n,e)}}(n,e,t):(0,r.Z)(isNaN(n)?e:n)}}function s(t,n){var e=n-t;return e?i(t,e):(0,r.Z)(isNaN(t)?n:t)}},2954:(t,n,e)=>{"use strict";e.d(n,{Z:()=>r});const r=t=>()=>t},6246:(t,n,e)=>{"use strict";function r(t,n){var e=new Date;return t=+t,n=+n,function(r){return e.setTime(t*(1-r)+n*r),e}}e.d(n,{Z:()=>r})},9928:(t,n,e)=>{"use strict";e.r(n),e.d(n,{interpolate:()=>r.Z,interpolateArray:()=>i.Z,interpolateBasis:()=>o.Z,interpolateBasisClosed:()=>a.Z,interpolateCubehelix:()=>P,interpolateCubehelixLong:()=>O,interpolateDate:()=>s.Z,interpolateDiscrete:()=>u,interpolateHcl:()=>E,interpolateHclLong:()=>k,interpolateHsl:()=>w,interpolateHslLong:()=>b,interpolateHue:()=>c,interpolateLab:()=>T,interpolateNumber:()=>h.Z,interpolateNumberArray:()=>f.Z,interpolateObject:()=>p.Z,interpolateRgb:()=>g.ZP,interpolateRgbBasis:()=>g.hD,interpolateRgbBasisClosed:()=>g.YD,interpolateRound:()=>d.Z,interpolateString:()=>y.Z,interpolateTransformCss:()=>m.Y,interpolateTransformSvg:()=>m.w,interpolateZoom:()=>_.Z,piecewise:()=>I.Z,quantize:()=>L});var r=e(5326),i=e(1606),o=e(7265),a=e(6068),s=e(6246);function u(t){var n=t.length;return function(e){return t[Math.max(0,Math.min(n-1,Math.floor(e*n)))]}}var l=e(8280);function c(t,n){var e=(0,l.wx)(+t,+n);return function(t){var n=e(t);return n-360*Math.floor(n/360)}}var h=e(8063),f=e(5401),p=e(8296),d=e(4635),y=e(6773),m=e(6556),_=e(8167),g=e(6354),v=e(4447);function x(t){return function(n,e){var r=t((n=(0,v.Ym)(n)).h,(e=(0,v.Ym)(e)).h),i=(0,l.ZP)(n.s,e.s),o=(0,l.ZP)(n.l,e.l),a=(0,l.ZP)(n.opacity,e.opacity);return function(t){return n.h=r(t),n.s=i(t),n.l=o(t),n.opacity=a(t),n+""}}}const w=x(l.wx);var b=x(l.ZP),M=e(8990);function T(t,n){var e=(0,l.ZP)((t=(0,M.ZP)(t)).l,(n=(0,M.ZP)(n)).l),r=(0,l.ZP)(t.a,n.a),i=(0,l.ZP)(t.b,n.b),o=(0,l.ZP)(t.opacity,n.opacity);return function(n){return t.l=e(n),t.a=r(n),t.b=i(n),t.opacity=o(n),t+""}}function A(t){return function(n,e){var r=t((n=(0,M.Uc)(n)).h,(e=(0,M.Uc)(e)).h),i=(0,l.ZP)(n.c,e.c),o=(0,l.ZP)(n.l,e.l),a=(0,l.ZP)(n.opacity,e.opacity);return function(t){return n.h=r(t),n.c=i(t),n.l=o(t),n.opacity=a(t),n+""}}}const E=A(l.wx);var k=A(l.ZP),S=e(5159);function N(t){return function n(e){function r(n,r){var i=t((n=(0,S.Z)(n)).h,(r=(0,S.Z)(r)).h),o=(0,l.ZP)(n.s,r.s),a=(0,l.ZP)(n.l,r.l),s=(0,l.ZP)(n.opacity,r.opacity);return function(t){return n.h=i(t),n.s=o(t),n.l=a(Math.pow(t,e)),n.opacity=s(t),n+""}}return e=+e,r.gamma=n,r}(1)}const P=N(l.wx);var O=N(l.ZP),I=e(9640);function L(t,n){for(var e=new Array(n),r=0;r{"use strict";function r(t,n){return t=+t,n=+n,function(e){return t*(1-e)+n*e}}e.d(n,{Z:()=>r})},5401:(t,n,e)=>{"use strict";function r(t,n){n||(n=[]);var e,r=t?Math.min(n.length,t.length):0,i=n.slice();return function(o){for(e=0;er,v:()=>i})},8296:(t,n,e)=>{"use strict";e.d(n,{Z:()=>i});var r=e(5326);function i(t,n){var e,i={},o={};for(e in null!==t&&"object"==typeof t||(t={}),null!==n&&"object"==typeof n||(n={}),n)e in t?i[e]=(0,r.Z)(t[e],n[e]):o[e]=n[e];return function(t){for(e in i)o[e]=i[e](t);return o}}},9640:(t,n,e)=>{"use strict";e.d(n,{Z:()=>i});var r=e(5326);function i(t,n){void 0===n&&(n=t,t=r.Z);for(var e=0,i=n.length-1,o=n[0],a=new Array(i<0?0:i);e{"use strict";e.d(n,{YD:()=>c,ZP:()=>s,hD:()=>l});var r=e(4447),i=e(7265),o=e(6068),a=e(8280);const s=function t(n){var e=(0,a.yi)(n);function i(t,n){var i=e((t=(0,r.B8)(t)).r,(n=(0,r.B8)(n)).r),o=e(t.g,n.g),s=e(t.b,n.b),u=(0,a.ZP)(t.opacity,n.opacity);return function(n){return t.r=i(n),t.g=o(n),t.b=s(n),t.opacity=u(n),t+""}}return i.gamma=t,i}(1);function u(t){return function(n){var e,i,o=n.length,a=new Array(o),s=new Array(o),u=new Array(o);for(e=0;e{"use strict";function r(t,n){return t=+t,n=+n,function(e){return Math.round(t*(1-e)+n*e)}}e.d(n,{Z:()=>r})},6773:(t,n,e)=>{"use strict";e.d(n,{Z:()=>a});var r=e(8063),i=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,o=new RegExp(i.source,"g");function a(t,n){var e,a,s,u=i.lastIndex=o.lastIndex=0,l=-1,c=[],h=[];for(t+="",n+="";(e=i.exec(t))&&(a=o.exec(n));)(s=a.index)>u&&(s=n.slice(u,s),c[l]?c[l]+=s:c[++l]=s),(e=e[0])===(a=a[0])?c[l]?c[l]+=a:c[++l]=a:(c[++l]=null,h.push({i:l,x:(0,r.Z)(e,a)})),u=o.lastIndex;return u{"use strict";e.d(n,{Y:()=>l,w:()=>c});var r,i=e(8063),o=180/Math.PI,a={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function s(t,n,e,r,i,a){var s,u,l;return(s=Math.sqrt(t*t+n*n))&&(t/=s,n/=s),(l=t*e+n*r)&&(e-=t*l,r-=n*l),(u=Math.sqrt(e*e+r*r))&&(e/=u,r/=u,l/=u),t*r180?n+=360:n-t>180&&(t+=360),a.push({i:e.push(o(e)+"rotate(",null,r)-2,x:(0,i.Z)(t,n)})):n&&e.push(o(e)+"rotate("+n+r)}(a.rotate,s.rotate,u,l),function(t,n,e,a){t!==n?a.push({i:e.push(o(e)+"skewX(",null,r)-2,x:(0,i.Z)(t,n)}):n&&e.push(o(e)+"skewX("+n+r)}(a.skewX,s.skewX,u,l),function(t,n,e,r,a,s){if(t!==e||n!==r){var u=a.push(o(a)+"scale(",null,",",null,")");s.push({i:u-4,x:(0,i.Z)(t,e)},{i:u-2,x:(0,i.Z)(n,r)})}else 1===e&&1===r||a.push(o(a)+"scale("+e+","+r+")")}(a.scaleX,a.scaleY,s.scaleX,s.scaleY,u,l),a=s=null,function(t){for(var n,e=-1,r=l.length;++e{"use strict";e.d(n,{Z:()=>f});var r=e(4447),i=e(6354),o=e(1606),a=e(6246),s=e(8063),u=e(8296),l=e(6773),c=e(2954),h=e(5401);function f(t,n){var e,f=typeof n;return null==n||"boolean"===f?(0,c.Z)(n):("number"===f?s.Z:"string"===f?(e=(0,r.ZP)(n))?(n=e,i.ZP):l.Z:n instanceof r.ZP?i.ZP:n instanceof Date?a.Z:(0,h.v)(n)?h.Z:Array.isArray(n)?o.M:"function"!=typeof n.valueOf&&"function"!=typeof n.toString||isNaN(n)?u.Z:s.Z)(t,n)}},8167:(t,n,e)=>{"use strict";function r(t){return((t=Math.exp(t))+1/t)/2}e.d(n,{Z:()=>i});const i=function t(n,e,i){function o(t,o){var a,s,u=t[0],l=t[1],c=t[2],h=o[0],f=o[1],p=o[2],d=h-u,y=f-l,m=d*d+y*y;if(m<1e-12)s=Math.log(p/c)/n,a=function(t){return[u+t*d,l+t*y,c*Math.exp(n*t*s)]};else{var _=Math.sqrt(m),g=(p*p-c*c+i*m)/(2*c*e*_),v=(p*p-c*c-i*m)/(2*p*e*_),x=Math.log(Math.sqrt(g*g+1)-g),w=Math.log(Math.sqrt(v*v+1)-v);s=(w-x)/n,a=function(t){var i,o=t*s,a=r(x),h=c/(e*_)*(a*(i=n*o+x,((i=Math.exp(2*i))-1)/(i+1))-function(t){return((t=Math.exp(t))-1/t)/2}(x));return[u+h*d,l+h*y,c*a/r(n*o+x)]}}return a.duration=1e3*s*n/Math.SQRT2,a}return o.rho=function(n){var e=Math.max(.001,+n),r=e*e;return t(e,r,r*r)},o}(Math.SQRT2,2,4)},8066:(t,n,e)=>{"use strict";function r(t,n){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(n).domain(t)}return this}function i(t,n){switch(arguments.length){case 0:break;case 1:"function"==typeof t?this.interpolator(t):this.range(t);break;default:this.domain(t),"function"==typeof n?this.interpolator(n):this.range(n)}return this}e.r(n),e.d(n,{scaleBand:()=>c,scaleDiverging:()=>Ke,scaleDivergingLog:()=>tr,scaleDivergingPow:()=>er,scaleDivergingSqrt:()=>rr,scaleDivergingSymlog:()=>nr,scaleIdentity:()=>V,scaleImplicit:()=>u,scaleLinear:()=>X,scaleLog:()=>rt,scaleOrdinal:()=>l,scalePoint:()=>f,scalePow:()=>ft,scaleQuantile:()=>bt,scaleQuantize:()=>Mt,scaleRadial:()=>yt,scaleSequential:()=>qe,scaleSequentialLog:()=>Be,scaleSequentialPow:()=>Ve,scaleSequentialQuantile:()=>Ge,scaleSequentialSqrt:()=>We,scaleSequentialSymlog:()=>Xe,scaleSqrt:()=>pt,scaleSymlog:()=>st,scaleThreshold:()=>Tt,scaleTime:()=>Fe,scaleUtc:()=>Ye,tickFormat:()=>q});class o extends Map{constructor(t,n=s){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),null!=t)for(const[n,e]of t)this.set(n,e)}get(t){return super.get(a(this,t))}has(t){return super.has(a(this,t))}set(t,n){return super.set(function({_intern:t,_key:n},e){const r=n(e);return t.has(r)?t.get(r):(t.set(r,e),e)}(this,t),n)}delete(t){return super.delete(function({_intern:t,_key:n},e){const r=n(e);return t.has(r)&&(e=t.get(r),t.delete(r)),e}(this,t))}}function a({_intern:t,_key:n},e){const r=n(e);return t.has(r)?t.get(r):e}function s(t){return null!==t&&"object"==typeof t?t.valueOf():t}const u=Symbol("implicit");function l(){var t=new o,n=[],e=[],i=u;function a(r){let o=t.get(r);if(void 0===o){if(i!==u)return i;t.set(r,o=n.push(r)-1)}return e[o%e.length]}return a.domain=function(e){if(!arguments.length)return n.slice();n=[],t=new o;for(const r of e)t.has(r)||t.set(r,n.push(r)-1);return a},a.range=function(t){return arguments.length?(e=Array.from(t),a):e.slice()},a.unknown=function(t){return arguments.length?(i=t,a):i},a.copy=function(){return l(n,e).unknown(i)},r.apply(a,arguments),a}function c(){var t,n,e=l().unknown(void 0),i=e.domain,o=e.range,a=0,s=1,u=!1,h=0,f=0,p=.5;function d(){var e=i().length,r=s=p?10:o>=d?5:o>=y?2:1;let s,u,l;return i<0?(l=Math.pow(10,-i)/a,s=Math.round(t*l),u=Math.round(n*l),s/ln&&--u,l=-l):(l=Math.pow(10,i)*a,s=Math.round(t/l),u=Math.round(n/l),s*ln&&--u),u0))return[];if((t=+t)==(n=+n))return[t];const r=n=i))return[];const s=o-i+1,u=new Array(s);if(r)if(a<0)for(let t=0;tn?1:t>=n?0:NaN}function w(t,n){return null==t||null==n?NaN:nt?1:n>=t?0:NaN}function b(t){let n,e,r;function i(t,r,i=0,o=t.length){if(i>>1;e(t[n],r)<0?i=n+1:o=n}while(ix(t(n),e),r=(n,e)=>t(n)-e):(n=t===x||t===w?t:M,e=t,r=t),{left:i,center:function(t,n,e=0,o=t.length){const a=i(t,n,e,o-1);return a>e&&r(t[a-1],n)>-r(t[a],n)?a-1:a},right:function(t,r,i=0,o=t.length){if(i>>1;e(t[n],r)<=0?i=n+1:o=n}while(in&&(e=t,t=n,n=e),l=function(e){return Math.max(t,Math.min(n,e))}),r=u>2?D:C,i=o=null,h}function h(n){return null==n||isNaN(n=+n)?e:(i||(i=r(a.map(t),s,u)))(t(l(n)))}return h.invert=function(e){return l(n((o||(o=r(s,a.map(t),N.Z)))(e)))},h.domain=function(t){return arguments.length?(a=Array.from(t,O),c()):a.slice()},h.range=function(t){return arguments.length?(s=Array.from(t),c()):s.slice()},h.rangeRound=function(t){return s=Array.from(t),u=P.Z,c()},h.clamp=function(t){return arguments.length?(l=!!t||L,c()):l!==L},h.interpolate=function(t){return arguments.length?(u=t,c()):u},h.unknown=function(t){return arguments.length?(e=t,h):e},function(e,r){return t=e,n=r,c()}}function j(){return H()(L,L)}var z=e(2035),F=e(7017),Y=e(5386),U=e(3482),R=e(6909);function q(t,n,e,r){var i,o=v(t,n,e);switch((r=(0,z.Z)(null==r?",f":r)).type){case"s":var a=Math.max(Math.abs(t),Math.abs(n));return null!=r.precision||isNaN(i=(0,F.Z)(o,a))||(r.precision=i),(0,Y.jH)(r,a);case"":case"e":case"g":case"p":case"r":null!=r.precision||isNaN(i=(0,U.Z)(o,Math.max(Math.abs(t),Math.abs(n))))||(r.precision=i-("e"===r.type));break;case"f":case"%":null!=r.precision||isNaN(i=(0,R.Z)(o))||(r.precision=i-2*("%"===r.type))}return(0,Y.WU)(r)}function B(t){var n=t.domain;return t.ticks=function(t){var e=n();return _(e[0],e[e.length-1],null==t?10:t)},t.tickFormat=function(t,e){var r=n();return q(r[0],r[r.length-1],null==t?10:t,e)},t.nice=function(e){null==e&&(e=10);var r,i,o=n(),a=0,s=o.length-1,u=o[a],l=o[s],c=10;for(l0;){if((i=g(u,l,e))===r)return o[a]=u,o[s]=l,n(o);if(i>0)u=Math.floor(u/i)*i,l=Math.ceil(l/i)*i;else{if(!(i<0))break;u=Math.ceil(u*i)/i,l=Math.floor(l*i)/i}r=i}return t},t}function X(){var t=j();return t.copy=function(){return $(t,X())},r.apply(t,arguments),B(t)}function V(t){var n;function e(t){return null==t||isNaN(t=+t)?n:t}return e.invert=e,e.domain=e.range=function(n){return arguments.length?(t=Array.from(n,O),e):t.slice()},e.unknown=function(t){return arguments.length?(n=t,e):n},e.copy=function(){return V(t).unknown(n)},t=arguments.length?Array.from(t,O):[0,1],B(e)}function W(t,n){var e,r=0,i=(t=t.slice()).length-1,o=t[r],a=t[i];return a-t(-n,e)}function et(t){const n=t(G,J),e=n.domain;let r,i,o=10;function a(){return r=function(t){return t===Math.E?Math.log:10===t&&Math.log10||2===t&&Math.log2||(t=Math.log(t),n=>Math.log(n)/t)}(o),i=function(t){return 10===t?tt:t===Math.E?Math.exp:n=>Math.pow(t,n)}(o),e()[0]<0?(r=nt(r),i=nt(i),t(Q,K)):t(G,J),n}return n.base=function(t){return arguments.length?(o=+t,a()):o},n.domain=function(t){return arguments.length?(e(t),a()):e()},n.ticks=t=>{const n=e();let a=n[0],s=n[n.length-1];const u=s0){for(;h<=f;++h)for(l=1;ls)break;d.push(c)}}else for(;h<=f;++h)for(l=o-1;l>=1;--l)if(c=h>0?l/i(-h):l*i(h),!(cs)break;d.push(c)}2*d.length{if(null==t&&(t=10),null==e&&(e=10===o?"s":","),"function"!=typeof e&&(o%1||null!=(e=(0,z.Z)(e)).precision||(e.trim=!0),e=(0,Y.WU)(e)),t===1/0)return e;const a=Math.max(1,o*t/n.ticks().length);return t=>{let n=t/i(Math.round(r(t)));return n*oe(W(e(),{floor:t=>i(Math.floor(r(t))),ceil:t=>i(Math.ceil(r(t)))})),n}function rt(){const t=et(H()).domain([1,10]);return t.copy=()=>$(t,rt()).base(t.base()),r.apply(t,arguments),t}function it(t){return function(n){return Math.sign(n)*Math.log1p(Math.abs(n/t))}}function ot(t){return function(n){return Math.sign(n)*Math.expm1(Math.abs(n))*t}}function at(t){var n=1,e=t(it(n),ot(n));return e.constant=function(e){return arguments.length?t(it(n=+e),ot(n)):n},B(e)}function st(){var t=at(H());return t.copy=function(){return $(t,st()).constant(t.constant())},r.apply(t,arguments)}function ut(t){return function(n){return n<0?-Math.pow(-n,t):Math.pow(n,t)}}function lt(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function ct(t){return t<0?-t*t:t*t}function ht(t){var n=t(L,L),e=1;return n.exponent=function(n){return arguments.length?1==(e=+n)?t(L,L):.5===e?t(lt,ct):t(ut(e),ut(1/e)):e},B(n)}function ft(){var t=ht(H());return t.copy=function(){return $(t,ft()).exponent(t.exponent())},r.apply(t,arguments),t}function pt(){return ft.apply(null,arguments).exponent(.5)}function dt(t){return Math.sign(t)*t*t}function yt(){var t,n=j(),e=[0,1],i=!1;function o(e){var r=function(t){return Math.sign(t)*Math.sqrt(Math.abs(t))}(n(e));return isNaN(r)?t:i?Math.round(r):r}return o.invert=function(t){return n.invert(dt(t))},o.domain=function(t){return arguments.length?(n.domain(t),o):n.domain()},o.range=function(t){return arguments.length?(n.range((e=Array.from(t,O)).map(dt)),o):e.slice()},o.rangeRound=function(t){return o.range(t).round(!0)},o.round=function(t){return arguments.length?(i=!!t,o):i},o.clamp=function(t){return arguments.length?(n.clamp(t),o):n.clamp()},o.unknown=function(n){return arguments.length?(t=n,o):t},o.copy=function(){return yt(n.domain(),e).round(i).clamp(n.clamp()).unknown(t)},r.apply(o,arguments),B(o)}function mt(t,n){let e;if(void 0===n)for(const n of t)null!=n&&(e=n)&&(e=n);else{let r=-1;for(let i of t)null!=(i=n(i,++r,t))&&(e=i)&&(e=i)}return e}function _t(t,n){let e;if(void 0===n)for(const n of t)null!=n&&(e>n||void 0===e&&n>=n)&&(e=n);else{let r=-1;for(let i of t)null!=(i=n(i,++r,t))&&(e>i||void 0===e&&i>=i)&&(e=i)}return e}function gt(t,n){return(null==t||!(t>=t))-(null==n||!(n>=n))||(tn?1:0)}function vt(t,n,e=0,r=1/0,i){if(n=Math.floor(n),e=Math.floor(Math.max(0,e)),r=Math.floor(Math.min(t.length-1,r)),!(e<=n&&n<=r))return t;for(i=void 0===i?gt:function(t=x){if(t===x)return gt;if("function"!=typeof t)throw new TypeError("compare is not a function");return(n,e)=>{const r=t(n,e);return r||0===r?r:(0===t(e,e))-(0===t(n,n))}}(i);r>e;){if(r-e>600){const o=r-e+1,a=n-e+1,s=Math.log(o),u=.5*Math.exp(2*s/3),l=.5*Math.sqrt(s*u*(o-u)/o)*(a-o/2<0?-1:1);vt(t,n,Math.max(e,Math.floor(n-a*u/o+l)),Math.min(r,Math.floor(n+(o-a)*u/o+l)),i)}const o=t[n];let a=e,s=r;for(xt(t,e,n),i(t[r],o)>0&&xt(t,e,r);a0;)--s}0===i(t[e],o)?xt(t,e,s):(++s,xt(t,s,r)),s<=n&&(e=s+1),n<=s&&(r=s-1)}return t}function xt(t,n,e){const r=t[n];t[n]=t[e],t[e]=r}function wt(t,n,e=T){if((r=t.length)&&!isNaN(n=+n)){if(n<=0||r<2)return+e(t[0],0,t);if(n>=1)return+e(t[r-1],r-1,t);var r,i=(r-1)*n,o=Math.floor(i),a=+e(t[o],o,t);return a+(+e(t[o+1],o+1,t)-a)*(i-o)}}function bt(){var t,n=[],e=[],i=[];function o(){var t=0,r=Math.max(1,e.length);for(i=new Array(r-1);++t0?i[r-1]:n[0],r=i?[o[i-1],e]:[o[r-1],o[r]]},s.unknown=function(n){return arguments.length?(t=n,s):s},s.thresholds=function(){return o.slice()},s.copy=function(){return Mt().domain([n,e]).range(a).unknown(t)},r.apply(B(s),arguments)}function Tt(){var t,n=[.5],e=[0,1],i=1;function o(r){return null!=r&&r<=r?e[k(n,r,0,i)]:t}return o.domain=function(t){return arguments.length?(n=Array.from(t),i=Math.min(n.length,e.length-1),o):n.slice()},o.range=function(t){return arguments.length?(e=Array.from(t),i=Math.min(n.length,e.length-1),o):e.slice()},o.invertExtent=function(t){var r=e.indexOf(t);return[n[r-1],n[r]]},o.unknown=function(n){return arguments.length?(t=n,o):t},o.copy=function(){return Tt().domain(n).range(e).unknown(t)},r.apply(o,arguments)}const At=1e3,Et=6e4,kt=36e5,St=864e5,Nt=6048e5,Pt=31536e6,Ot=new Date,It=new Date;function Lt(t,n,e,r){function i(n){return t(n=0===arguments.length?new Date:new Date(+n)),n}return i.floor=n=>(t(n=new Date(+n)),n),i.ceil=e=>(t(e=new Date(e-1)),n(e,1),t(e),e),i.round=t=>{const n=i(t),e=i.ceil(t);return t-n(n(t=new Date(+t),null==e?1:Math.floor(e)),t),i.range=(e,r,o)=>{const a=[];if(e=i.ceil(e),o=null==o?1:Math.floor(o),!(e0))return a;let s;do{a.push(s=new Date(+e)),n(e,o),t(e)}while(sLt((n=>{if(n>=n)for(;t(n),!e(n);)n.setTime(n-1)}),((t,r)=>{if(t>=t)if(r<0)for(;++r<=0;)for(;n(t,-1),!e(t););else for(;--r>=0;)for(;n(t,1),!e(t););})),e&&(i.count=(n,r)=>(Ot.setTime(+n),It.setTime(+r),t(Ot),t(It),Math.floor(e(Ot,It))),i.every=t=>(t=Math.floor(t),isFinite(t)&&t>0?t>1?i.filter(r?n=>r(n)%t==0:n=>i.count(0,n)%t==0):i:null)),i}const Zt=Lt((()=>{}),((t,n)=>{t.setTime(+t+n)}),((t,n)=>n-t));Zt.every=t=>(t=Math.floor(t),isFinite(t)&&t>0?t>1?Lt((n=>{n.setTime(Math.floor(n/t)*t)}),((n,e)=>{n.setTime(+n+e*t)}),((n,e)=>(e-n)/t)):Zt:null),Zt.range;const Ct=Lt((t=>{t.setTime(t-t.getMilliseconds())}),((t,n)=>{t.setTime(+t+n*At)}),((t,n)=>(n-t)/At),(t=>t.getUTCSeconds())),Dt=(Ct.range,Lt((t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*At)}),((t,n)=>{t.setTime(+t+n*Et)}),((t,n)=>(n-t)/Et),(t=>t.getMinutes()))),$t=(Dt.range,Lt((t=>{t.setUTCSeconds(0,0)}),((t,n)=>{t.setTime(+t+n*Et)}),((t,n)=>(n-t)/Et),(t=>t.getUTCMinutes()))),Ht=($t.range,Lt((t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*At-t.getMinutes()*Et)}),((t,n)=>{t.setTime(+t+n*kt)}),((t,n)=>(n-t)/kt),(t=>t.getHours()))),jt=(Ht.range,Lt((t=>{t.setUTCMinutes(0,0,0)}),((t,n)=>{t.setTime(+t+n*kt)}),((t,n)=>(n-t)/kt),(t=>t.getUTCHours()))),zt=(jt.range,Lt((t=>t.setHours(0,0,0,0)),((t,n)=>t.setDate(t.getDate()+n)),((t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*Et)/St),(t=>t.getDate()-1))),Ft=(zt.range,Lt((t=>{t.setUTCHours(0,0,0,0)}),((t,n)=>{t.setUTCDate(t.getUTCDate()+n)}),((t,n)=>(n-t)/St),(t=>t.getUTCDate()-1))),Yt=(Ft.range,Lt((t=>{t.setUTCHours(0,0,0,0)}),((t,n)=>{t.setUTCDate(t.getUTCDate()+n)}),((t,n)=>(n-t)/St),(t=>Math.floor(t/St))));function Ut(t){return Lt((n=>{n.setDate(n.getDate()-(n.getDay()+7-t)%7),n.setHours(0,0,0,0)}),((t,n)=>{t.setDate(t.getDate()+7*n)}),((t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*Et)/Nt))}Yt.range;const Rt=Ut(0),qt=Ut(1),Bt=Ut(2),Xt=Ut(3),Vt=Ut(4),Wt=Ut(5),Gt=Ut(6);function Jt(t){return Lt((n=>{n.setUTCDate(n.getUTCDate()-(n.getUTCDay()+7-t)%7),n.setUTCHours(0,0,0,0)}),((t,n)=>{t.setUTCDate(t.getUTCDate()+7*n)}),((t,n)=>(n-t)/Nt))}Rt.range,qt.range,Bt.range,Xt.range,Vt.range,Wt.range,Gt.range;const Qt=Jt(0),Kt=Jt(1),tn=Jt(2),nn=Jt(3),en=Jt(4),rn=Jt(5),on=Jt(6),an=(Qt.range,Kt.range,tn.range,nn.range,en.range,rn.range,on.range,Lt((t=>{t.setDate(1),t.setHours(0,0,0,0)}),((t,n)=>{t.setMonth(t.getMonth()+n)}),((t,n)=>n.getMonth()-t.getMonth()+12*(n.getFullYear()-t.getFullYear())),(t=>t.getMonth()))),sn=(an.range,Lt((t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)}),((t,n)=>{t.setUTCMonth(t.getUTCMonth()+n)}),((t,n)=>n.getUTCMonth()-t.getUTCMonth()+12*(n.getUTCFullYear()-t.getUTCFullYear())),(t=>t.getUTCMonth()))),un=(sn.range,Lt((t=>{t.setMonth(0,1),t.setHours(0,0,0,0)}),((t,n)=>{t.setFullYear(t.getFullYear()+n)}),((t,n)=>n.getFullYear()-t.getFullYear()),(t=>t.getFullYear())));un.every=t=>isFinite(t=Math.floor(t))&&t>0?Lt((n=>{n.setFullYear(Math.floor(n.getFullYear()/t)*t),n.setMonth(0,1),n.setHours(0,0,0,0)}),((n,e)=>{n.setFullYear(n.getFullYear()+e*t)})):null,un.range;const ln=Lt((t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),((t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n)}),((t,n)=>n.getUTCFullYear()-t.getUTCFullYear()),(t=>t.getUTCFullYear()));function cn(t,n,e,r,i,o){const a=[[Ct,1,At],[Ct,5,5e3],[Ct,15,15e3],[Ct,30,3e4],[o,1,Et],[o,5,3e5],[o,15,9e5],[o,30,18e5],[i,1,kt],[i,3,108e5],[i,6,216e5],[i,12,432e5],[r,1,St],[r,2,1728e5],[e,1,Nt],[n,1,2592e6],[n,3,7776e6],[t,1,Pt]];function s(n,e,r){const i=Math.abs(e-n)/r,o=b((([,,t])=>t)).right(a,i);if(o===a.length)return t.every(v(n/Pt,e/Pt,r));if(0===o)return Zt.every(Math.max(v(n,e,r),1));const[s,u]=a[i/a[o-1][2]isFinite(t=Math.floor(t))&&t>0?Lt((n=>{n.setUTCFullYear(Math.floor(n.getUTCFullYear()/t)*t),n.setUTCMonth(0,1),n.setUTCHours(0,0,0,0)}),((n,e)=>{n.setUTCFullYear(n.getUTCFullYear()+e*t)})):null,ln.range;const[hn,fn]=cn(ln,sn,Qt,Yt,jt,$t),[pn,dn]=cn(un,an,Rt,zt,Ht,Dt);function yn(t){if(0<=t.y&&t.y<100){var n=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return n.setFullYear(t.y),n}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function mn(t){if(0<=t.y&&t.y<100){var n=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return n.setUTCFullYear(t.y),n}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function _n(t,n,e){return{y:t,m:n,d:e,H:0,M:0,S:0,L:0}}var gn,vn,xn,wn={"-":"",_:" ",0:"0"},bn=/^\s*\d+/,Mn=/^%/,Tn=/[\\^$*+?|[\]().{}]/g;function An(t,n,e){var r=t<0?"-":"",i=(r?-t:t)+"",o=i.length;return r+(o[t.toLowerCase(),n])))}function Nn(t,n,e){var r=bn.exec(n.slice(e,e+1));return r?(t.w=+r[0],e+r[0].length):-1}function Pn(t,n,e){var r=bn.exec(n.slice(e,e+1));return r?(t.u=+r[0],e+r[0].length):-1}function On(t,n,e){var r=bn.exec(n.slice(e,e+2));return r?(t.U=+r[0],e+r[0].length):-1}function In(t,n,e){var r=bn.exec(n.slice(e,e+2));return r?(t.V=+r[0],e+r[0].length):-1}function Ln(t,n,e){var r=bn.exec(n.slice(e,e+2));return r?(t.W=+r[0],e+r[0].length):-1}function Zn(t,n,e){var r=bn.exec(n.slice(e,e+4));return r?(t.y=+r[0],e+r[0].length):-1}function Cn(t,n,e){var r=bn.exec(n.slice(e,e+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),e+r[0].length):-1}function Dn(t,n,e){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(n.slice(e,e+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),e+r[0].length):-1}function $n(t,n,e){var r=bn.exec(n.slice(e,e+1));return r?(t.q=3*r[0]-3,e+r[0].length):-1}function Hn(t,n,e){var r=bn.exec(n.slice(e,e+2));return r?(t.m=r[0]-1,e+r[0].length):-1}function jn(t,n,e){var r=bn.exec(n.slice(e,e+2));return r?(t.d=+r[0],e+r[0].length):-1}function zn(t,n,e){var r=bn.exec(n.slice(e,e+3));return r?(t.m=0,t.d=+r[0],e+r[0].length):-1}function Fn(t,n,e){var r=bn.exec(n.slice(e,e+2));return r?(t.H=+r[0],e+r[0].length):-1}function Yn(t,n,e){var r=bn.exec(n.slice(e,e+2));return r?(t.M=+r[0],e+r[0].length):-1}function Un(t,n,e){var r=bn.exec(n.slice(e,e+2));return r?(t.S=+r[0],e+r[0].length):-1}function Rn(t,n,e){var r=bn.exec(n.slice(e,e+3));return r?(t.L=+r[0],e+r[0].length):-1}function qn(t,n,e){var r=bn.exec(n.slice(e,e+6));return r?(t.L=Math.floor(r[0]/1e3),e+r[0].length):-1}function Bn(t,n,e){var r=Mn.exec(n.slice(e,e+1));return r?e+r[0].length:-1}function Xn(t,n,e){var r=bn.exec(n.slice(e));return r?(t.Q=+r[0],e+r[0].length):-1}function Vn(t,n,e){var r=bn.exec(n.slice(e));return r?(t.s=+r[0],e+r[0].length):-1}function Wn(t,n){return An(t.getDate(),n,2)}function Gn(t,n){return An(t.getHours(),n,2)}function Jn(t,n){return An(t.getHours()%12||12,n,2)}function Qn(t,n){return An(1+zt.count(un(t),t),n,3)}function Kn(t,n){return An(t.getMilliseconds(),n,3)}function te(t,n){return Kn(t,n)+"000"}function ne(t,n){return An(t.getMonth()+1,n,2)}function ee(t,n){return An(t.getMinutes(),n,2)}function re(t,n){return An(t.getSeconds(),n,2)}function ie(t){var n=t.getDay();return 0===n?7:n}function oe(t,n){return An(Rt.count(un(t)-1,t),n,2)}function ae(t){var n=t.getDay();return n>=4||0===n?Vt(t):Vt.ceil(t)}function se(t,n){return t=ae(t),An(Vt.count(un(t),t)+(4===un(t).getDay()),n,2)}function ue(t){return t.getDay()}function le(t,n){return An(qt.count(un(t)-1,t),n,2)}function ce(t,n){return An(t.getFullYear()%100,n,2)}function he(t,n){return An((t=ae(t)).getFullYear()%100,n,2)}function fe(t,n){return An(t.getFullYear()%1e4,n,4)}function pe(t,n){var e=t.getDay();return An((t=e>=4||0===e?Vt(t):Vt.ceil(t)).getFullYear()%1e4,n,4)}function de(t){var n=t.getTimezoneOffset();return(n>0?"-":(n*=-1,"+"))+An(n/60|0,"0",2)+An(n%60,"0",2)}function ye(t,n){return An(t.getUTCDate(),n,2)}function me(t,n){return An(t.getUTCHours(),n,2)}function _e(t,n){return An(t.getUTCHours()%12||12,n,2)}function ge(t,n){return An(1+Ft.count(ln(t),t),n,3)}function ve(t,n){return An(t.getUTCMilliseconds(),n,3)}function xe(t,n){return ve(t,n)+"000"}function we(t,n){return An(t.getUTCMonth()+1,n,2)}function be(t,n){return An(t.getUTCMinutes(),n,2)}function Me(t,n){return An(t.getUTCSeconds(),n,2)}function Te(t){var n=t.getUTCDay();return 0===n?7:n}function Ae(t,n){return An(Qt.count(ln(t)-1,t),n,2)}function Ee(t){var n=t.getUTCDay();return n>=4||0===n?en(t):en.ceil(t)}function ke(t,n){return t=Ee(t),An(en.count(ln(t),t)+(4===ln(t).getUTCDay()),n,2)}function Se(t){return t.getUTCDay()}function Ne(t,n){return An(Kt.count(ln(t)-1,t),n,2)}function Pe(t,n){return An(t.getUTCFullYear()%100,n,2)}function Oe(t,n){return An((t=Ee(t)).getUTCFullYear()%100,n,2)}function Ie(t,n){return An(t.getUTCFullYear()%1e4,n,4)}function Le(t,n){var e=t.getUTCDay();return An((t=e>=4||0===e?en(t):en.ceil(t)).getUTCFullYear()%1e4,n,4)}function Ze(){return"+0000"}function Ce(){return"%"}function De(t){return+t}function $e(t){return Math.floor(+t/1e3)}function He(t){return new Date(t)}function je(t){return t instanceof Date?+t:+new Date(+t)}function ze(t,n,e,r,i,o,a,s,u,l){var c=j(),h=c.invert,f=c.domain,p=l(".%L"),d=l(":%S"),y=l("%I:%M"),m=l("%I %p"),_=l("%a %d"),g=l("%b %d"),v=l("%B"),x=l("%Y");function w(t){return(u(t)n(r/(t.length-1))))},e.quantiles=function(n){return Array.from({length:n+1},((e,r)=>function(t,n,e){if(t=Float64Array.from(function*(t,n){if(void 0===n)for(let n of t)null!=n&&(n=+n)>=n&&(yield n);else{let e=-1;for(let r of t)null!=(r=n(r,++e,t))&&(r=+r)>=r&&(yield r)}}(t,e)),(r=t.length)&&!isNaN(n=+n)){if(n<=0||r<2)return _t(t);if(n>=1)return mt(t);var r,i=(r-1)*n,o=Math.floor(i),a=mt(vt(t,o).subarray(0,o+1));return a+(_t(t.subarray(o+1))-a)*(i-o)}}(t,r/n)))},e.copy=function(){return Ge(n).domain(t)},i.apply(e,arguments)}gn=function(t){var n=t.dateTime,e=t.date,r=t.time,i=t.periods,o=t.days,a=t.shortDays,s=t.months,u=t.shortMonths,l=kn(i),c=Sn(i),h=kn(o),f=Sn(o),p=kn(a),d=Sn(a),y=kn(s),m=Sn(s),_=kn(u),g=Sn(u),v={a:function(t){return a[t.getDay()]},A:function(t){return o[t.getDay()]},b:function(t){return u[t.getMonth()]},B:function(t){return s[t.getMonth()]},c:null,d:Wn,e:Wn,f:te,g:he,G:pe,H:Gn,I:Jn,j:Qn,L:Kn,m:ne,M:ee,p:function(t){return i[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:De,s:$e,S:re,u:ie,U:oe,V:se,w:ue,W:le,x:null,X:null,y:ce,Y:fe,Z:de,"%":Ce},x={a:function(t){return a[t.getUTCDay()]},A:function(t){return o[t.getUTCDay()]},b:function(t){return u[t.getUTCMonth()]},B:function(t){return s[t.getUTCMonth()]},c:null,d:ye,e:ye,f:xe,g:Oe,G:Le,H:me,I:_e,j:ge,L:ve,m:we,M:be,p:function(t){return i[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:De,s:$e,S:Me,u:Te,U:Ae,V:ke,w:Se,W:Ne,x:null,X:null,y:Pe,Y:Ie,Z:Ze,"%":Ce},w={a:function(t,n,e){var r=p.exec(n.slice(e));return r?(t.w=d.get(r[0].toLowerCase()),e+r[0].length):-1},A:function(t,n,e){var r=h.exec(n.slice(e));return r?(t.w=f.get(r[0].toLowerCase()),e+r[0].length):-1},b:function(t,n,e){var r=_.exec(n.slice(e));return r?(t.m=g.get(r[0].toLowerCase()),e+r[0].length):-1},B:function(t,n,e){var r=y.exec(n.slice(e));return r?(t.m=m.get(r[0].toLowerCase()),e+r[0].length):-1},c:function(t,e,r){return T(t,n,e,r)},d:jn,e:jn,f:qn,g:Cn,G:Zn,H:Fn,I:Fn,j:zn,L:Rn,m:Hn,M:Yn,p:function(t,n,e){var r=l.exec(n.slice(e));return r?(t.p=c.get(r[0].toLowerCase()),e+r[0].length):-1},q:$n,Q:Xn,s:Vn,S:Un,u:Pn,U:On,V:In,w:Nn,W:Ln,x:function(t,n,r){return T(t,e,n,r)},X:function(t,n,e){return T(t,r,n,e)},y:Cn,Y:Zn,Z:Dn,"%":Bn};function b(t,n){return function(e){var r,i,o,a=[],s=-1,u=0,l=t.length;for(e instanceof Date||(e=new Date(+e));++s53)return null;"w"in o||(o.w=1),"Z"in o?(i=(r=mn(_n(o.y,0,1))).getUTCDay(),r=i>4||0===i?Kt.ceil(r):Kt(r),r=Ft.offset(r,7*(o.V-1)),o.y=r.getUTCFullYear(),o.m=r.getUTCMonth(),o.d=r.getUTCDate()+(o.w+6)%7):(i=(r=yn(_n(o.y,0,1))).getDay(),r=i>4||0===i?qt.ceil(r):qt(r),r=zt.offset(r,7*(o.V-1)),o.y=r.getFullYear(),o.m=r.getMonth(),o.d=r.getDate()+(o.w+6)%7)}else("W"in o||"U"in o)&&("w"in o||(o.w="u"in o?o.u%7:"W"in o?1:0),i="Z"in o?mn(_n(o.y,0,1)).getUTCDay():yn(_n(o.y,0,1)).getDay(),o.m=0,o.d="W"in o?(o.w+6)%7+7*o.W-(i+5)%7:o.w+7*o.U-(i+6)%7);return"Z"in o?(o.H+=o.Z/100|0,o.M+=o.Z%100,mn(o)):yn(o)}}function T(t,n,e,r){for(var i,o,a=0,s=n.length,u=e.length;a=u)return-1;if(37===(i=n.charCodeAt(a++))){if(i=n.charAt(a++),!(o=w[i in wn?n.charAt(a++):i])||(r=o(t,e,r))<0)return-1}else if(i!=e.charCodeAt(r++))return-1}return r}return v.x=b(e,v),v.X=b(r,v),v.c=b(n,v),x.x=b(e,x),x.X=b(r,x),x.c=b(n,x),{format:function(t){var n=b(t+="",v);return n.toString=function(){return t},n},parse:function(t){var n=M(t+="",!1);return n.toString=function(){return t},n},utcFormat:function(t){var n=b(t+="",x);return n.toString=function(){return t},n},utcParse:function(t){var n=M(t+="",!0);return n.toString=function(){return t},n}}}({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}),vn=gn.format,gn.parse,xn=gn.utcFormat,gn.utcParse;var Je=e(9640);function Qe(){var t,n,e,r,i,o,a,s=0,u=.5,l=1,c=1,h=L,f=!1;function p(t){return isNaN(t=+t)?a:(t=.5+((t=+o(t))-n)*(c*t{"use strict";function r(t){return null==t?[]:Array.isArray(t)?t:Array.from(t)}e.d(n,{Z:()=>r})},4708:(t,n,e)=>{"use strict";e.d(n,{Z:()=>s});var r=e(1663),i=e(1226);function o(t){return function(){var n=this.ownerDocument,e=this.namespaceURI;return e===i.P&&n.documentElement.namespaceURI===i.P?n.createElement(t):n.createElementNS(e,t)}}function a(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function s(t){var n=(0,r.Z)(t);return(n.local?a:o)(n)}},3905:(t,n,e)=>{"use strict";e.r(n),e.d(n,{create:()=>o,creator:()=>r.Z,local:()=>s,matcher:()=>l.Z,namespace:()=>c.Z,namespaces:()=>h.Z,pointer:()=>f.Z,pointers:()=>d,select:()=>i.Z,selectAll:()=>_,selection:()=>m.ZP,selector:()=>g.Z,selectorAll:()=>v.Z,style:()=>x.S,window:()=>w.Z});var r=e(4708),i=e(3838);function o(t){return(0,i.Z)((0,r.Z)(t).call(document.documentElement))}var a=0;function s(){return new u}function u(){this._="@"+(++a).toString(36)}u.prototype=s.prototype={constructor:u,get:function(t){for(var n=this._;!(n in t);)if(!(t=t.parentNode))return;return t[n]},set:function(t,n){return t[this._]=n},remove:function(t){return this._ in t&&delete t[this._]},toString:function(){return this._}};var l=e(4421),c=e(1663),h=e(1226),f=e(3109),p=e(9439);function d(t,n){return t.target&&(t=(0,p.Z)(t),void 0===n&&(n=t.currentTarget),t=t.touches||[t]),Array.from(t,(t=>(0,f.Z)(t,n)))}var y=e(9898),m=e(6740);function _(t){return"string"==typeof t?new m.Y1([document.querySelectorAll(t)],[document.documentElement]):new m.Y1([(0,y.Z)(t)],m.Jz)}var g=e(3010),v=e(9701),x=e(2627),w=e(9920)},4421:(t,n,e)=>{"use strict";function r(t){return function(){return this.matches(t)}}function i(t){return function(n){return n.matches(t)}}e.d(n,{P:()=>i,Z:()=>r})},1663:(t,n,e)=>{"use strict";e.d(n,{Z:()=>i});var r=e(1226);function i(t){var n=t+="",e=n.indexOf(":");return e>=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),r.Z.hasOwnProperty(n)?{space:r.Z[n],local:t}:t}},1226:(t,n,e)=>{"use strict";e.d(n,{P:()=>r,Z:()=>i});var r="http://www.w3.org/1999/xhtml";const i={svg:"http://www.w3.org/2000/svg",xhtml:r,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"}},3109:(t,n,e)=>{"use strict";e.d(n,{Z:()=>i});var r=e(9439);function i(t,n){if(t=(0,r.Z)(t),void 0===n&&(n=t.currentTarget),n){var e=n.ownerSVGElement||n;if(e.createSVGPoint){var i=e.createSVGPoint();return i.x=t.clientX,i.y=t.clientY,[(i=i.matrixTransform(n.getScreenCTM().inverse())).x,i.y]}if(n.getBoundingClientRect){var o=n.getBoundingClientRect();return[t.clientX-o.left-n.clientLeft,t.clientY-o.top-n.clientTop]}}return[t.pageX,t.pageY]}},3838:(t,n,e)=>{"use strict";e.d(n,{Z:()=>i});var r=e(6740);function i(t){return"string"==typeof t?new r.Y1([[document.querySelector(t)]],[document.documentElement]):new r.Y1([[t]],r.Jz)}},6740:(t,n,e)=>{"use strict";e.d(n,{Y1:()=>rt,ZP:()=>ot,Jz:()=>et});var r=e(3010),i=e(9898),o=e(9701),a=e(4421),s=Array.prototype.find;function u(){return this.firstElementChild}var l=Array.prototype.filter;function c(){return Array.from(this.children)}function h(t){return new Array(t.length)}function f(t,n){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=n}function p(t,n,e,r,i,o){for(var a,s=0,u=n.length,l=o.length;sn?1:t>=n?0:NaN}f.prototype={constructor:f,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,n){return this._parent.insertBefore(t,n)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};var g=e(1663);function v(t){return function(){this.removeAttribute(t)}}function x(t){return function(){this.removeAttributeNS(t.space,t.local)}}function w(t,n){return function(){this.setAttribute(t,n)}}function b(t,n){return function(){this.setAttributeNS(t.space,t.local,n)}}function M(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttribute(t):this.setAttribute(t,e)}}function T(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,e)}}var A=e(2627);function E(t){return function(){delete this[t]}}function k(t,n){return function(){this[t]=n}}function S(t,n){return function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}}function N(t){return t.trim().split(/^|\s+/)}function P(t){return t.classList||new O(t)}function O(t){this._node=t,this._names=N(t.getAttribute("class")||"")}function I(t,n){for(var e=P(t),r=-1,i=n.length;++r=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var q=e(4708);function B(){return null}function X(){var t=this.parentNode;t&&t.removeChild(this)}function V(){var t=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(t,this.nextSibling):t}function W(){var t=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(t,this.nextSibling):t}function G(t){return function(){var n=this.__on;if(n){for(var e,r=0,i=-1,o=n.length;r=A&&(A=T+1);!(M=w[A])&&++A=0;)(r=i[o])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(t){function n(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}t||(t=_);for(var e=this._groups,r=e.length,i=new Array(r),o=0;o1?this.each((null==n?E:"function"==typeof n?S:k)(t,n)):this.node()[t]},classed:function(t,n){var e=N(t+"");if(arguments.length<2){for(var r=P(this.node()),i=-1,o=e.length;++i=0&&(n=t.slice(e+1),t=t.slice(0,e)),{type:t,name:n}}))}(t+""),a=o.length;if(!(arguments.length<2)){for(s=n?J:G,r=0;r{"use strict";e.d(n,{S:()=>u,Z:()=>s});var r=e(9920);function i(t){return function(){this.style.removeProperty(t)}}function o(t,n,e){return function(){this.style.setProperty(t,n,e)}}function a(t,n,e){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}}function s(t,n,e){return arguments.length>1?this.each((null==n?i:"function"==typeof n?a:o)(t,n,null==e?"":e)):u(this.node(),t)}function u(t,n){return t.style.getPropertyValue(n)||(0,r.Z)(t).getComputedStyle(t,null).getPropertyValue(n)}},3010:(t,n,e)=>{"use strict";function r(){}function i(t){return null==t?r:function(){return this.querySelector(t)}}e.d(n,{Z:()=>i})},9701:(t,n,e)=>{"use strict";function r(){return[]}function i(t){return null==t?r:function(){return this.querySelectorAll(t)}}e.d(n,{Z:()=>i})},9439:(t,n,e)=>{"use strict";function r(t){let n;for(;n=t.sourceEvent;)t=n;return t}e.d(n,{Z:()=>r})},9920:(t,n,e)=>{"use strict";function r(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}e.d(n,{Z:()=>r})},6660:(t,n,e)=>{"use strict";function r(t){return function(){return t}}e.r(n),e.d(n,{arc:()=>N,area:()=>$,areaRadial:()=>B,curveBasis:()=>Dt,curveBasisClosed:()=>Ht,curveBasisOpen:()=>zt,curveBumpX:()=>G,curveBumpY:()=>J,curveBundle:()=>Yt,curveCardinal:()=>qt,curveCardinalClosed:()=>Xt,curveCardinalOpen:()=>Wt,curveCatmullRom:()=>Qt,curveCatmullRomClosed:()=>tn,curveCatmullRomOpen:()=>en,curveLinear:()=>L,curveLinearClosed:()=>on,curveMonotoneX:()=>pn,curveMonotoneY:()=>dn,curveNatural:()=>_n,curveStep:()=>vn,curveStepAfter:()=>wn,curveStepBefore:()=>xn,line:()=>D,lineRadial:()=>q,link:()=>nt,linkHorizontal:()=>et,linkRadial:()=>it,linkVertical:()=>rt,pie:()=>z,pointRadial:()=>X,radialArea:()=>B,radialLine:()=>q,stack:()=>En,stackOffsetDiverging:()=>Sn,stackOffsetExpand:()=>kn,stackOffsetNone:()=>bn,stackOffsetSilhouette:()=>Nn,stackOffsetWiggle:()=>Pn,stackOrderAppearance:()=>On,stackOrderAscending:()=>Ln,stackOrderDescending:()=>Cn,stackOrderInsideOut:()=>Dn,stackOrderNone:()=>Mn,stackOrderReverse:()=>$n,symbol:()=>It,symbolAsterisk:()=>at,symbolCircle:()=>st,symbolCross:()=>ut,symbolDiamond:()=>ht,symbolDiamond2:()=>ft,symbolPlus:()=>pt,symbolSquare:()=>dt,symbolSquare2:()=>yt,symbolStar:()=>vt,symbolTimes:()=>Nt,symbolTriangle:()=>wt,symbolTriangle2:()=>Mt,symbolWye:()=>St,symbolX:()=>Nt,symbols:()=>Pt,symbolsFill:()=>Pt,symbolsStroke:()=>Ot});const i=Math.abs,o=Math.atan2,a=Math.cos,s=Math.max,u=Math.min,l=Math.sin,c=Math.sqrt,h=1e-12,f=Math.PI,p=f/2,d=2*f;function y(t){return t>=1?p:t<=-1?-p:Math.asin(t)}const m=Math.PI,_=2*m,g=1e-6,v=_-g;function x(t){this._+=t[0];for(let n=1,e=t.length;n=0))throw new Error(`invalid digits: ${t}`);if(n>15)return x;const e=10**n;return function(t){this._+=t[0];for(let n=1,r=t.length;ng)if(Math.abs(c*s-u*l)>g&&i){let f=e-o,p=r-a,d=s*s+u*u,y=f*f+p*p,_=Math.sqrt(d),v=Math.sqrt(h),x=i*Math.tan((m-Math.acos((d+h-y)/(2*_*v)))/2),w=x/v,b=x/_;Math.abs(w-1)>g&&this._append`L${t+w*l},${n+w*c}`,this._append`A${i},${i},0,0,${+(c*f>l*p)},${this._x1=t+b*s},${this._y1=n+b*u}`}else this._append`L${this._x1=t},${this._y1=n}`}arc(t,n,e,r,i,o){if(t=+t,n=+n,o=!!o,(e=+e)<0)throw new Error(`negative radius: ${e}`);let a=e*Math.cos(r),s=e*Math.sin(r),u=t+a,l=n+s,c=1^o,h=o?r-i:i-r;null===this._x1?this._append`M${u},${l}`:(Math.abs(this._x1-u)>g||Math.abs(this._y1-l)>g)&&this._append`L${u},${l}`,e&&(h<0&&(h=h%_+_),h>v?this._append`A${e},${e},0,1,${c},${t-a},${n-s}A${e},${e},0,1,${c},${this._x1=u},${this._y1=l}`:h>g&&this._append`A${e},${e},0,${+(h>=m)},${c},${this._x1=t+e*Math.cos(i)},${this._y1=n+e*Math.sin(i)}`)}rect(t,n,e,r){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${e=+e}v${+r}h${-e}Z`}toString(){return this._}}function b(t){let n=3;return t.digits=function(e){if(!arguments.length)return n;if(null==e)n=null;else{const t=Math.floor(e);if(!(t>=0))throw new RangeError(`invalid digits: ${e}`);n=t}return t},()=>new w(n)}function M(t){return t.innerRadius}function T(t){return t.outerRadius}function A(t){return t.startAngle}function E(t){return t.endAngle}function k(t){return t&&t.padAngle}function S(t,n,e,r,i,o,a){var u=t-e,l=n-r,h=(a?o:-o)/c(u*u+l*l),f=h*l,p=-h*u,d=t+f,y=n+p,m=e+f,_=r+p,g=(d+m)/2,v=(y+_)/2,x=m-d,w=_-y,b=x*x+w*w,M=i-o,T=d*_-m*y,A=(w<0?-1:1)*c(s(0,M*M*b-T*T)),E=(T*w-x*A)/b,k=(-T*x-w*A)/b,S=(T*w+x*A)/b,N=(-T*x+w*A)/b,P=E-g,O=k-v,I=S-g,L=N-v;return P*P+O*O>I*I+L*L&&(E=S,k=N),{cx:E,cy:k,x01:-f,y01:-p,x11:E*(i/M-1),y11:k*(i/M-1)}}function N(){var t=M,n=T,e=r(0),s=null,m=A,_=E,g=k,v=null,x=b(w);function w(){var r,w,b,M=+t.apply(this,arguments),T=+n.apply(this,arguments),A=m.apply(this,arguments)-p,E=_.apply(this,arguments)-p,k=i(E-A),N=E>A;if(v||(v=r=x()),Th)if(k>d-h)v.moveTo(T*a(A),T*l(A)),v.arc(0,0,T,A,E,!N),M>h&&(v.moveTo(M*a(E),M*l(E)),v.arc(0,0,M,E,A,N));else{var P,O,I=A,L=E,Z=A,C=E,D=k,$=k,H=g.apply(this,arguments)/2,j=H>h&&(s?+s.apply(this,arguments):c(M*M+T*T)),z=u(i(T-M)/2,+e.apply(this,arguments)),F=z,Y=z;if(j>h){var U=y(j/M*l(H)),R=y(j/T*l(H));(D-=2*U)>h?(Z+=U*=N?1:-1,C-=U):(D=0,Z=C=(A+E)/2),($-=2*R)>h?(I+=R*=N?1:-1,L-=R):($=0,I=L=(A+E)/2)}var q=T*a(I),B=T*l(I),X=M*a(C),V=M*l(C);if(z>h){var W,G=T*a(L),J=T*l(L),Q=M*a(Z),K=M*l(Z);if(k1?0:b<-1?f:Math.acos(b))/2),ot=c(W[0]*W[0]+W[1]*W[1]);F=u(z,(M-ot)/(it-1)),Y=u(z,(T-ot)/(it+1))}else F=Y=0}$>h?Y>h?(P=S(Q,K,q,B,T,Y,N),O=S(G,J,X,V,T,Y,N),v.moveTo(P.cx+P.x01,P.cy+P.y01),Yh&&D>h?F>h?(P=S(X,V,G,J,M,-F,N),O=S(q,B,Q,K,M,-F,N),v.lineTo(P.cx+P.x01,P.cy+P.y01),F=h;--f)u.point(_[f],g[f]);u.lineEnd(),u.areaEnd()}m&&(_[c]=+t(p,c,r),g[c]=+n(p,c,r),u.point(i?+i(p,c,r):_[c],e?+e(p,c,r):g[c]))}if(d)return u=null,d+""||null}function h(){return D().defined(o).curve(s).context(a)}return t="function"==typeof t?t:void 0===t?Z:r(+t),n="function"==typeof n?n:r(void 0===n?0:+n),e="function"==typeof e?e:void 0===e?C:r(+e),c.x=function(n){return arguments.length?(t="function"==typeof n?n:r(+n),i=null,c):t},c.x0=function(n){return arguments.length?(t="function"==typeof n?n:r(+n),c):t},c.x1=function(t){return arguments.length?(i=null==t?null:"function"==typeof t?t:r(+t),c):i},c.y=function(t){return arguments.length?(n="function"==typeof t?t:r(+t),e=null,c):n},c.y0=function(t){return arguments.length?(n="function"==typeof t?t:r(+t),c):n},c.y1=function(t){return arguments.length?(e=null==t?null:"function"==typeof t?t:r(+t),c):e},c.lineX0=c.lineY0=function(){return h().x(t).y(n)},c.lineY1=function(){return h().x(t).y(e)},c.lineX1=function(){return h().x(i).y(n)},c.defined=function(t){return arguments.length?(o="function"==typeof t?t:r(!!t),c):o},c.curve=function(t){return arguments.length?(s=t,null!=a&&(u=s(a)),c):s},c.context=function(t){return arguments.length?(null==t?a=u=null:u=s(a=t),c):a},c}function H(t,n){return nt?1:n>=t?0:NaN}function j(t){return t}function z(){var t=j,n=H,e=null,i=r(0),o=r(d),a=r(0);function s(r){var s,u,l,c,h,f=(r=O(r)).length,p=0,y=new Array(f),m=new Array(f),_=+i.apply(this,arguments),g=Math.min(d,Math.max(-d,o.apply(this,arguments)-_)),v=Math.min(Math.abs(g)/f,a.apply(this,arguments)),x=v*(g<0?-1:1);for(s=0;s0&&(p+=h);for(null!=n?y.sort((function(t,e){return n(m[t],m[e])})):null!=e&&y.sort((function(t,n){return e(r[t],r[n])})),s=0,l=p?(g-f*x)/p:0;s0?h*l:0)+x,m[u]={data:r[u],index:s,value:h,startAngle:_,endAngle:c,padAngle:v};return m}return s.value=function(n){return arguments.length?(t="function"==typeof n?n:r(+n),s):t},s.sortValues=function(t){return arguments.length?(n=t,e=null,s):n},s.sort=function(t){return arguments.length?(e=t,n=null,s):e},s.startAngle=function(t){return arguments.length?(i="function"==typeof t?t:r(+t),s):i},s.endAngle=function(t){return arguments.length?(o="function"==typeof t?t:r(+t),s):o},s.padAngle=function(t){return arguments.length?(a="function"==typeof t?t:r(+t),s):a},s}I.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;default:this._context.lineTo(t,n)}}};var F=U(L);function Y(t){this._curve=t}function U(t){function n(n){return new Y(t(n))}return n._curve=t,n}function R(t){var n=t.curve;return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t.curve=function(t){return arguments.length?n(U(t)):n()._curve},t}function q(){return R(D().curve(F))}function B(){var t=$().curve(F),n=t.curve,e=t.lineX0,r=t.lineX1,i=t.lineY0,o=t.lineY1;return t.angle=t.x,delete t.x,t.startAngle=t.x0,delete t.x0,t.endAngle=t.x1,delete t.x1,t.radius=t.y,delete t.y,t.innerRadius=t.y0,delete t.y0,t.outerRadius=t.y1,delete t.y1,t.lineStartAngle=function(){return R(e())},delete t.lineX0,t.lineEndAngle=function(){return R(r())},delete t.lineX1,t.lineInnerRadius=function(){return R(i())},delete t.lineY0,t.lineOuterRadius=function(){return R(o())},delete t.lineY1,t.curve=function(t){return arguments.length?n(U(t)):n()._curve},t}function X(t,n){return[(n=+n)*Math.cos(t-=Math.PI/2),n*Math.sin(t)]}Y.prototype={areaStart:function(){this._curve.areaStart()},areaEnd:function(){this._curve.areaEnd()},lineStart:function(){this._curve.lineStart()},lineEnd:function(){this._curve.lineEnd()},point:function(t,n){this._curve.point(n*Math.sin(t),n*-Math.cos(t))}};class V{constructor(t,n){this._context=t,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line}point(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,n,t,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,t,this._y0,t,n)}this._x0=t,this._y0=n}}class W{constructor(t){this._context=t}lineStart(){this._point=0}lineEnd(){}point(t,n){if(t=+t,n=+n,0===this._point)this._point=1;else{const e=X(this._x0,this._y0),r=X(this._x0,this._y0=(this._y0+n)/2),i=X(t,this._y0),o=X(t,n);this._context.moveTo(...e),this._context.bezierCurveTo(...r,...i,...o)}this._x0=t,this._y0=n}}function G(t){return new V(t,!0)}function J(t){return new V(t,!1)}function Q(t){return new W(t)}function K(t){return t.source}function tt(t){return t.target}function nt(t){let n=K,e=tt,i=Z,o=C,a=null,s=null,u=b(l);function l(){let r;const l=P.call(arguments),c=n.apply(this,l),h=e.apply(this,l);if(null==a&&(s=t(r=u())),s.lineStart(),l[0]=c,s.point(+i.apply(this,l),+o.apply(this,l)),l[0]=h,s.point(+i.apply(this,l),+o.apply(this,l)),s.lineEnd(),r)return s=null,r+""||null}return l.source=function(t){return arguments.length?(n=t,l):n},l.target=function(t){return arguments.length?(e=t,l):e},l.x=function(t){return arguments.length?(i="function"==typeof t?t:r(+t),l):i},l.y=function(t){return arguments.length?(o="function"==typeof t?t:r(+t),l):o},l.context=function(n){return arguments.length?(null==n?a=s=null:s=t(a=n),l):a},l}function et(){return nt(G)}function rt(){return nt(J)}function it(){const t=nt(Q);return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t}const ot=c(3),at={draw(t,n){const e=.59436*c(n+u(n/28,.75)),r=e/2,i=r*ot;t.moveTo(0,e),t.lineTo(0,-e),t.moveTo(-i,-r),t.lineTo(i,r),t.moveTo(-i,r),t.lineTo(i,-r)}},st={draw(t,n){const e=c(n/f);t.moveTo(e,0),t.arc(0,0,e,0,d)}},ut={draw(t,n){const e=c(n/5)/2;t.moveTo(-3*e,-e),t.lineTo(-e,-e),t.lineTo(-e,-3*e),t.lineTo(e,-3*e),t.lineTo(e,-e),t.lineTo(3*e,-e),t.lineTo(3*e,e),t.lineTo(e,e),t.lineTo(e,3*e),t.lineTo(-e,3*e),t.lineTo(-e,e),t.lineTo(-3*e,e),t.closePath()}},lt=c(1/3),ct=2*lt,ht={draw(t,n){const e=c(n/ct),r=e*lt;t.moveTo(0,-e),t.lineTo(r,0),t.lineTo(0,e),t.lineTo(-r,0),t.closePath()}},ft={draw(t,n){const e=.62625*c(n);t.moveTo(0,-e),t.lineTo(e,0),t.lineTo(0,e),t.lineTo(-e,0),t.closePath()}},pt={draw(t,n){const e=.87559*c(n-u(n/7,2));t.moveTo(-e,0),t.lineTo(e,0),t.moveTo(0,e),t.lineTo(0,-e)}},dt={draw(t,n){const e=c(n),r=-e/2;t.rect(r,r,e,e)}},yt={draw(t,n){const e=.4431*c(n);t.moveTo(e,e),t.lineTo(e,-e),t.lineTo(-e,-e),t.lineTo(-e,e),t.closePath()}},mt=l(f/10)/l(7*f/10),_t=l(d/10)*mt,gt=-a(d/10)*mt,vt={draw(t,n){const e=c(.8908130915292852*n),r=_t*e,i=gt*e;t.moveTo(0,-e),t.lineTo(r,i);for(let n=1;n<5;++n){const o=d*n/5,s=a(o),u=l(o);t.lineTo(u*e,-s*e),t.lineTo(s*r-u*i,u*r+s*i)}t.closePath()}},xt=c(3),wt={draw(t,n){const e=-c(n/(3*xt));t.moveTo(0,2*e),t.lineTo(-xt*e,-e),t.lineTo(xt*e,-e),t.closePath()}},bt=c(3),Mt={draw(t,n){const e=.6824*c(n),r=e/2,i=e*bt/2;t.moveTo(0,-e),t.lineTo(i,r),t.lineTo(-i,r),t.closePath()}},Tt=-.5,At=c(3)/2,Et=1/c(12),kt=3*(Et/2+1),St={draw(t,n){const e=c(n/kt),r=e/2,i=e*Et,o=r,a=e*Et+e,s=-o,u=a;t.moveTo(r,i),t.lineTo(o,a),t.lineTo(s,u),t.lineTo(Tt*r-At*i,At*r+Tt*i),t.lineTo(Tt*o-At*a,At*o+Tt*a),t.lineTo(Tt*s-At*u,At*s+Tt*u),t.lineTo(Tt*r+At*i,Tt*i-At*r),t.lineTo(Tt*o+At*a,Tt*a-At*o),t.lineTo(Tt*s+At*u,Tt*u-At*s),t.closePath()}},Nt={draw(t,n){const e=.6189*c(n-u(n/6,1.7));t.moveTo(-e,-e),t.lineTo(e,e),t.moveTo(-e,e),t.lineTo(e,-e)}},Pt=[st,ut,ht,dt,vt,wt,St],Ot=[st,pt,Nt,Mt,at,yt,ft];function It(t,n){let e=null,i=b(o);function o(){let r;if(e||(e=r=i()),t.apply(this,arguments).draw(e,+n.apply(this,arguments)),r)return e=null,r+""||null}return t="function"==typeof t?t:r(t||st),n="function"==typeof n?n:r(void 0===n?64:+n),o.type=function(n){return arguments.length?(t="function"==typeof n?n:r(n),o):t},o.size=function(t){return arguments.length?(n="function"==typeof t?t:r(+t),o):n},o.context=function(t){return arguments.length?(e=null==t?null:t,o):e},o}function Lt(){}function Zt(t,n,e){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+n)/6,(t._y0+4*t._y1+e)/6)}function Ct(t){this._context=t}function Dt(t){return new Ct(t)}function $t(t){this._context=t}function Ht(t){return new $t(t)}function jt(t){this._context=t}function zt(t){return new jt(t)}function Ft(t,n){this._basis=new Ct(t),this._beta=n}Ct.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Zt(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Zt(this,t,n)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}},$t.prototype={areaStart:Lt,areaEnd:Lt,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._x2=t,this._y2=n;break;case 1:this._point=2,this._x3=t,this._y3=n;break;case 2:this._point=3,this._x4=t,this._y4=n,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+n)/6);break;default:Zt(this,t,n)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}},jt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var e=(this._x0+4*this._x1+t)/6,r=(this._y0+4*this._y1+n)/6;this._line?this._context.lineTo(e,r):this._context.moveTo(e,r);break;case 3:this._point=4;default:Zt(this,t,n)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}},Ft.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,n=this._y,e=t.length-1;if(e>0)for(var r,i=t[0],o=n[0],a=t[e]-i,s=n[e]-o,u=-1;++u<=e;)r=u/e,this._basis.point(this._beta*t[u]+(1-this._beta)*(i+r*a),this._beta*n[u]+(1-this._beta)*(o+r*s));this._x=this._y=null,this._basis.lineEnd()},point:function(t,n){this._x.push(+t),this._y.push(+n)}};const Yt=function t(n){function e(t){return 1===n?new Ct(t):new Ft(t,n)}return e.beta=function(n){return t(+n)},e}(.85);function Ut(t,n,e){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-n),t._y2+t._k*(t._y1-e),t._x2,t._y2)}function Rt(t,n){this._context=t,this._k=(1-n)/6}Rt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:Ut(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2,this._x1=t,this._y1=n;break;case 2:this._point=3;default:Ut(this,t,n)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};const qt=function t(n){function e(t){return new Rt(t,n)}return e.tension=function(n){return t(+n)},e}(0);function Bt(t,n){this._context=t,this._k=(1-n)/6}Bt.prototype={areaStart:Lt,areaEnd:Lt,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._x3=t,this._y3=n;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=n);break;case 2:this._point=3,this._x5=t,this._y5=n;break;default:Ut(this,t,n)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};const Xt=function t(n){function e(t){return new Bt(t,n)}return e.tension=function(n){return t(+n)},e}(0);function Vt(t,n){this._context=t,this._k=(1-n)/6}Vt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Ut(this,t,n)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};const Wt=function t(n){function e(t){return new Vt(t,n)}return e.tension=function(n){return t(+n)},e}(0);function Gt(t,n,e){var r=t._x1,i=t._y1,o=t._x2,a=t._y2;if(t._l01_a>h){var s=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,u=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*s-t._x0*t._l12_2a+t._x2*t._l01_2a)/u,i=(i*s-t._y0*t._l12_2a+t._y2*t._l01_2a)/u}if(t._l23_a>h){var l=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,c=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*l+t._x1*t._l23_2a-n*t._l12_2a)/c,a=(a*l+t._y1*t._l23_2a-e*t._l12_2a)/c}t._context.bezierCurveTo(r,i,o,a,t._x2,t._y2)}function Jt(t,n){this._context=t,this._alpha=n}Jt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){if(t=+t,n=+n,this._point){var e=this._x2-t,r=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(e*e+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3;default:Gt(this,t,n)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};const Qt=function t(n){function e(t){return n?new Jt(t,n):new Rt(t,0)}return e.alpha=function(n){return t(+n)},e}(.5);function Kt(t,n){this._context=t,this._alpha=n}Kt.prototype={areaStart:Lt,areaEnd:Lt,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,n){if(t=+t,n=+n,this._point){var e=this._x2-t,r=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(e*e+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=n;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=n);break;case 2:this._point=3,this._x5=t,this._y5=n;break;default:Gt(this,t,n)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};const tn=function t(n){function e(t){return n?new Kt(t,n):new Bt(t,0)}return e.alpha=function(n){return t(+n)},e}(.5);function nn(t,n){this._context=t,this._alpha=n}nn.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){if(t=+t,n=+n,this._point){var e=this._x2-t,r=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(e*e+r*r,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Gt(this,t,n)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};const en=function t(n){function e(t){return n?new nn(t,n):new Vt(t,0)}return e.alpha=function(n){return t(+n)},e}(.5);function rn(t){this._context=t}function on(t){return new rn(t)}function an(t){return t<0?-1:1}function sn(t,n,e){var r=t._x1-t._x0,i=n-t._x1,o=(t._y1-t._y0)/(r||i<0&&-0),a=(e-t._y1)/(i||r<0&&-0),s=(o*i+a*r)/(r+i);return(an(o)+an(a))*Math.min(Math.abs(o),Math.abs(a),.5*Math.abs(s))||0}function un(t,n){var e=t._x1-t._x0;return e?(3*(t._y1-t._y0)/e-n)/2:n}function ln(t,n,e){var r=t._x0,i=t._y0,o=t._x1,a=t._y1,s=(o-r)/3;t._context.bezierCurveTo(r+s,i+s*n,o-s,a-s*e,o,a)}function cn(t){this._context=t}function hn(t){this._context=new fn(t)}function fn(t){this._context=t}function pn(t){return new cn(t)}function dn(t){return new hn(t)}function yn(t){this._context=t}function mn(t){var n,e,r=t.length-1,i=new Array(r),o=new Array(r),a=new Array(r);for(i[0]=0,o[0]=2,a[0]=t[0]+2*t[1],n=1;n=0;--n)i[n]=(a[n]-i[n+1])/o[n];for(o[r-1]=(t[r]+i[r-1])/2,n=0;n1)for(var e,r,i,o=1,a=t[n[0]],s=a.length;o=0;)e[n]=n;return e}function Tn(t,n){return t[n]}function An(t){const n=[];return n.key=t,n}function En(){var t=r([]),n=Mn,e=bn,i=Tn;function o(r){var o,a,s=Array.from(t.apply(this,arguments),An),u=s.length,l=-1;for(const t of r)for(o=0,++l;o0){for(var e,r,i,o=0,a=t[0].length;o0)for(var e,r,i,o,a,s,u=0,l=t[n[0]].length;u0?(r[0]=o,r[1]=o+=i):i<0?(r[1]=a,r[0]=a+=i):(r[0]=0,r[1]=i)}function Nn(t,n){if((e=t.length)>0){for(var e,r=0,i=t[n[0]],o=i.length;r0&&(r=(e=t[n[0]]).length)>0){for(var e,r,i,o=0,a=1;ao&&(o=n,r=e);return r}function Ln(t){var n=t.map(Zn);return Mn(t).sort((function(t,e){return n[t]-n[e]}))}function Zn(t){for(var n,e=0,r=-1,i=t.length;++r=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,n),this._context.lineTo(t,n);else{var e=this._x*(1-this._t)+t*this._t;this._context.lineTo(e,this._y),this._context.lineTo(e,n)}}this._x=t,this._y=n}}},9065:(t,n,e)=>{"use strict";e.r(n),e.d(n,{ZoomTransform:()=>St,zoom:()=>jt,zoomIdentity:()=>Nt,zoomTransform:()=>Pt});var r={value:()=>{}};function i(){for(var t,n=0,e=arguments.length,r={};n=0&&(n=t.slice(e+1),t=t.slice(0,e)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}}))),u=-1,l=o.length;if(!(arguments.length<2)){if(null!=n&&"function"!=typeof n)throw new Error("invalid callback: "+n);for(;++u0)for(var e,r,i=new Array(e),o=0;o=0&&n._call.call(void 0,t),n=n._next;--_}()}finally{_=0,function(){for(var t,n,e=f,r=1/0;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:f=n);p=t,I(r)}(),b=0}}function O(){var t=T.now(),n=t-w;n>x&&(M-=n,w=t)}function I(t){_||(g&&(g=clearTimeout(g)),t-b>24?(t<1/0&&(g=setTimeout(P,t-T.now()-M)),v&&(v=clearInterval(v))):(v||(w=T.now(),v=setInterval(O,x)),_=1,A(P)))}function L(t,n,e){var r=new S;return n=null==n?0:+n,r.restart((e=>{r.stop(),t(e+n)}),n,e),r}S.prototype=N.prototype={constructor:S,restart:function(t,n,e){if("function"!=typeof t)throw new TypeError("callback is not a function");e=(null==e?E():+e)+(null==n?0:+n),this._next||p===this||(p?p._next=this:f=this,p=this),this._call=t,this._time=e,I()},stop:function(){this._call&&(this._call=null,this._time=1/0,I())}};var Z=u("start","end","cancel","interrupt"),C=[],D=0,$=2,H=3,j=5,z=6;function F(t,n,e,r,i,o){var a=t.__transition;if(a){if(e in a)return}else t.__transition={};!function(t,n,e){var r,i=t.__transition;function o(u){var l,c,h,f;if(1!==e.state)return s();for(l in i)if((f=i[l]).name===e.name){if(f.state===H)return L(o);4===f.state?(f.state=z,f.timer.stop(),f.on.call("interrupt",t,t.__data__,f.index,f.group),delete i[l]):+lD)throw new Error("too late; already scheduled");return e}function U(t,n){var e=R(t,n);if(e.state>H)throw new Error("too late; already running");return e}function R(t,n){var e=t.__transition;if(!e||!(e=e[n]))throw new Error("transition not found");return e}function q(t,n){var e,r,i,o=t.__transition,a=!0;if(o){for(i in n=null==n?null:n+"",o)(e=o[i]).name===n?(r=e.state>$&&e.state=0&&(t=t.slice(0,n)),!t||"start"===t}))}(n)?Y:U;return function(){var a=o(this,t),s=a.on;s!==r&&(i=(r=s).copy()).on(n,e),a.on=i}}(e,t,n))},attr:function(t,n){var e=(0,X.Z)(t),r="transform"===e?B.w:nt;return this.attrTween(t,"function"==typeof n?(e.local?st:at)(e,r,G(this,"attr."+t,n)):null==n?(e.local?rt:et)(e):(e.local?ot:it)(e,r,n))},attrTween:function(t,n){var e="attr."+t;if(arguments.length<2)return(e=this.tween(e))&&e._value;if(null==n)return this.tween(e,null);if("function"!=typeof n)throw new Error;var r=(0,X.Z)(t);return this.tween(e,(r.local?ut:lt)(r,n))},style:function(t,n,e){var r="transform"==(t+="")?B.Y:nt;return null==n?this.styleTween(t,function(t,n){var e,r,i;return function(){var o=(0,gt.S)(this,t),a=(this.style.removeProperty(t),(0,gt.S)(this,t));return o===a?null:o===e&&a===r?i:i=n(e=o,r=a)}}(t,r)).on("end.style."+t,vt(t)):"function"==typeof n?this.styleTween(t,function(t,n,e){var r,i,o;return function(){var a=(0,gt.S)(this,t),s=e(this),u=s+"";return null==s&&(this.style.removeProperty(t),u=s=(0,gt.S)(this,t)),a===u?null:a===r&&u===i?o:(i=u,o=n(r=a,s))}}(t,r,G(this,"style."+t,n))).each(function(t,n){var e,r,i,o,a="style."+n,s="end."+a;return function(){var u=U(this,t),l=u.on,c=null==u.value[a]?o||(o=vt(n)):void 0;l===e&&i===c||(r=(e=l).copy()).on(s,i=c),u.on=r}}(this._id,t)):this.styleTween(t,function(t,n,e){var r,i,o=e+"";return function(){var a=(0,gt.S)(this,t);return a===o?null:a===r?i:i=n(r=a,e)}}(t,r,n),e).on("end.style."+t,null)},styleTween:function(t,n,e){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==n)return this.tween(r,null);if("function"!=typeof n)throw new Error;return this.tween(r,function(t,n,e){var r,i;function o(){var o=n.apply(this,arguments);return o!==i&&(r=(i=o)&&function(t,n,e){return function(r){this.style.setProperty(t,n.call(this,r),e)}}(t,o,e)),r}return o._value=n,o}(t,n,null==e?"":e))},text:function(t){return this.tween("text","function"==typeof t?function(t){return function(){var n=t(this);this.textContent=null==n?"":n}}(G(this,"text",t)):function(t){return function(){this.textContent=t}}(null==t?"":t+""))},textTween:function(t){var n="text";if(arguments.length<1)return(n=this.tween(n))&&n._value;if(null==t)return this.tween(n,null);if("function"!=typeof t)throw new Error;return this.tween(n,function(t){var n,e;function r(){var r=t.apply(this,arguments);return r!==e&&(n=(e=r)&&function(t){return function(n){this.textContent=t.call(this,n)}}(r)),n}return r._value=t,r}(t))},remove:function(){return this.on("end.remove",function(t){return function(){var n=this.parentNode;for(var e in this.__transition)if(+e!==t)return;n&&n.removeChild(this)}}(this._id))},tween:function(t,n){var e=this._id;if(t+="",arguments.length<2){for(var r,i=R(this.node(),e).tween,o=0,a=i.length;o()=>t;function kt(t,{sourceEvent:n,target:e,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:e,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function St(t,n,e){this.k=t,this.x=n,this.y=e}St.prototype={constructor:St,scale:function(t){return 1===t?this:new St(this.k*t,this.x,this.y)},translate:function(t,n){return 0===t&0===n?this:new St(this.k,this.x+this.k*t,this.y+this.k*n)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Nt=new St(1,0,0);function Pt(t){for(;!t.__zoom;)if(!(t=t.parentNode))return Nt;return t.__zoom}function Ot(t){t.stopImmediatePropagation()}function It(t){t.preventDefault(),t.stopImmediatePropagation()}function Lt(t){return!(t.ctrlKey&&"wheel"!==t.type||t.button)}function Zt(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t).hasAttribute("viewBox")?[[(t=t.viewBox.baseVal).x,t.y],[t.x+t.width,t.y+t.height]]:[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]:[[0,0],[t.clientWidth,t.clientHeight]]}function Ct(){return this.__zoom||Nt}function Dt(t){return-t.deltaY*(1===t.deltaMode?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function $t(){return navigator.maxTouchPoints||"ontouchstart"in this}function Ht(t,n,e){var r=t.invertX(n[0][0])-e[0][0],i=t.invertX(n[1][0])-e[1][0],o=t.invertY(n[0][1])-e[0][1],a=t.invertY(n[1][1])-e[1][1];return t.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),a>o?(o+a)/2:Math.min(0,o)||Math.max(0,a))}function jt(){var t,n,e,r=Lt,i=Zt,o=Ht,a=Dt,s=$t,f=[0,1/0],p=[[-1/0,-1/0],[1/0,1/0]],m=250,_=d.Z,g=u("start","zoom","end"),v=500,x=150,w=0,b=10;function M(t){t.property("__zoom",Ct).on("wheel.zoom",P,{passive:!1}).on("mousedown.zoom",O).on("dblclick.zoom",I).filter(s).on("touchstart.zoom",L).on("touchmove.zoom",Z).on("touchend.zoom touchcancel.zoom",C).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function T(t,n){return(n=Math.max(f[0],Math.min(f[1],n)))===t.k?t:new St(n,t.x,t.y)}function A(t,n,e){var r=n[0]-e[0]*t.k,i=n[1]-e[1]*t.k;return r===t.x&&i===t.y?t:new St(t.k,r,i)}function E(t){return[(+t[0][0]+ +t[1][0])/2,(+t[0][1]+ +t[1][1])/2]}function k(t,n,e,r){t.on("start.zoom",(function(){S(this,arguments).event(r).start()})).on("interrupt.zoom end.zoom",(function(){S(this,arguments).event(r).end()})).tween("zoom",(function(){var t=this,o=arguments,a=S(t,o).event(r),s=i.apply(t,o),u=null==e?E(s):"function"==typeof e?e.apply(t,o):e,l=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),c=t.__zoom,h="function"==typeof n?n.apply(t,o):n,f=_(c.invert(u).concat(l/c.k),h.invert(u).concat(l/h.k));return function(t){if(1===t)t=h;else{var n=f(t),e=l/n[2];t=new St(e,u[0]-n[0]*e,u[1]-n[1]*e)}a.zoom(null,t)}}))}function S(t,n,e){return!e&&t.__zooming||new N(t,n)}function N(t,n){this.that=t,this.args=n,this.active=0,this.sourceEvent=null,this.extent=i.apply(t,n),this.taps=0}function P(t,...n){if(r.apply(this,arguments)){var e=S(this,n).event(t),i=this.__zoom,s=Math.max(f[0],Math.min(f[1],i.k*Math.pow(2,a.apply(this,arguments)))),u=(0,y.Z)(t);if(e.wheel)e.mouse[0][0]===u[0]&&e.mouse[0][1]===u[1]||(e.mouse[1]=i.invert(e.mouse[0]=u)),clearTimeout(e.wheel);else{if(i.k===s)return;e.mouse=[u,i.invert(u)],q(this),e.start()}It(t),e.wheel=setTimeout((function(){e.wheel=null,e.end()}),x),e.zoom("mouse",o(A(T(i,s),e.mouse[0],e.mouse[1]),e.extent,p))}}function O(t,...n){if(!e&&r.apply(this,arguments)){var i=t.currentTarget,a=S(this,n,!0).event(t),s=(0,l.Z)(t.view).on("mousemove.zoom",(function(t){if(It(t),!a.moved){var n=t.clientX-f,e=t.clientY-d;a.moved=n*n+e*e>w}a.event(t).zoom("mouse",o(A(a.that.__zoom,a.mouse[0]=(0,y.Z)(t,i),a.mouse[1]),a.extent,p))}),!0).on("mouseup.zoom",(function(t){s.on("mousemove.zoom mouseup.zoom",null),function(t,n){var e=t.document.documentElement,r=(0,l.Z)(t).on("dragstart.drag",null);n&&(r.on("click.drag",h,c),setTimeout((function(){r.on("click.drag",null)}),0)),"onselectstart"in e?r.on("selectstart.drag",null):(e.style.MozUserSelect=e.__noselect,delete e.__noselect)}(t.view,a.moved),It(t),a.event(t).end()}),!0),u=(0,y.Z)(t,i),f=t.clientX,d=t.clientY;!function(t){var n=t.document.documentElement,e=(0,l.Z)(t).on("dragstart.drag",h,c);"onselectstart"in n?e.on("selectstart.drag",h,c):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}(t.view),Ot(t),a.mouse=[u,this.__zoom.invert(u)],q(this),a.start()}}function I(t,...n){if(r.apply(this,arguments)){var e=this.__zoom,a=(0,y.Z)(t.changedTouches?t.changedTouches[0]:t,this),s=e.invert(a),u=e.k*(t.shiftKey?.5:2),c=o(A(T(e,u),a,s),i.apply(this,n),p);It(t),m>0?(0,l.Z)(this).transition().duration(m).call(k,c,a,t):(0,l.Z)(this).call(M.transform,c,a,t)}}function L(e,...i){if(r.apply(this,arguments)){var o,a,s,u,l=e.touches,c=l.length,h=S(this,i,e.changedTouches.length===c).event(e);for(Ot(e),a=0;a{var n=t&&t.__esModule?()=>t.default:()=>t;return e.d(n,{a:n}),n},e.d=(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},e.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),e.o=(t,n)=>Object.prototype.hasOwnProperty.call(t,n),e.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var r=e(3607);return r.default})())); -//# sourceMappingURL=function-plot.js.map \ No newline at end of file diff --git a/public/function-plot/README.md b/public/function-plot/README.md deleted file mode 100644 index 554a3fcc..00000000 --- a/public/function-plot/README.md +++ /dev/null @@ -1,17 +0,0 @@ -# function-plot - -`1.26.0/function-plot.js` is the unmodified browser distribution from -`npm pack function-plot@1.26.0` (`dist/function-plot.js`). - -- Upstream: https://github.com/mauriciopoppe/function-plot -- License: MIT; see `1.26.0/LICENSE`. -- SHA-256: `2c4a888fc382fe9102141f3c3e15094c4d1595385e2eb074507c01cd91307c70`. - -The renderer supplies callbacks from the restricted maths interpreter, using the -built-in numeric sampler. It does not invoke upstream's string-to-JavaScript -compiler or require `unsafe-eval`. The library draws SVG curves, axes and zoom -behaviour locally; no graph contents are sent to an external rendering service. - -When updating the library, preserve its license, update the pinned asset path and -checksum, and verify actual rendering under Discourse's default CSP. Check cleanup -of the upstream chart cache when decorated content is replaced. diff --git a/public/jsxgraph/README.md b/public/jsxgraph/README.md index de21086c..a35955d4 100644 --- a/public/jsxgraph/README.md +++ b/public/jsxgraph/README.md @@ -1,4 +1,4 @@ -# JSXGraph local experiment +# JSXGraph `1.14.1/jsxgraphcore.js` is the unmodified browser distribution from `npm pack jsxgraph@1.14.1` (`distrib/jsxgraphcore.js`). Its generated licence @@ -13,6 +13,3 @@ The renderer passes callbacks from Chatbot's restricted maths interpreter, never post text as JessieCode. JessieCode compilation is disabled because internal library expressions must also work under Discourse's default CSP. Board cleanup uses `JXG.JSXGraph.freeBoard` to release handlers and the board registry entry. - -This is the local `experiment/jsxgraph-plots` branch. The function-plot assets remain -available on the original `feature/function-plot-graphs` branch and in PR #191. diff --git a/spec/system/page_objects/components/function_plots.rb b/spec/system/page_objects/components/function_plots.rb index 994c118a..918e2bb9 100644 --- a/spec/system/page_objects/components/function_plots.rb +++ b/spec/system/page_objects/components/function_plots.rb @@ -24,6 +24,46 @@ def has_separate_domain_segments? path["d"].scan(/M/i).length >= 2 end + def move_over_2d_plot(relative_x:) + page.driver.with_playwright_page do |browser_page| + canvas = browser_page.locator(".chatbot-function-plot__canvas[data-dimensions='2']").first + canvas.scroll_into_view_if_needed + box = canvas.bounding_box + browser_page.mouse.move( + box["x"] + box["width"] * relative_x, + box["y"] + box["height"] / 2, + ) + end + end + + def leave_plot + page.driver.with_playwright_page do |browser_page| + browser_page.mouse.move(browser_page.evaluate("window.innerWidth") - 40, 500) + end + end + + def has_trace_points?(count:) + page.has_css?(".chatbot-function-plot__trace-point", count: count) + end + + def has_trace_values?(count:) + page.has_css?(".chatbot-function-plot__coordinates:not(:empty)", count: count) + end + + def trace_coordinates + all(".chatbot-function-plot__coordinates", visible: :all).map do |readout| + readout + .text + .match(/x = ([+-]?\d+(?:\.\d+)?), y = ([+-]?\d+(?:\.\d+)?)/) + &.captures + &.map(&:to_f) + end + end + + def trace_point_positions + all(".chatbot-function-plot__trace-point").map { |point| [point[:cx], point[:cy]] } + end + def has_surface? page.has_css?( ".chatbot-function-plot__canvas[data-dimensions='3'] svg path[fill^='hsl']", diff --git a/spec/system/read_function_plots_spec.rb b/spec/system/read_function_plots_spec.rb index 719488bb..76d187f0 100644 --- a/spec/system/read_function_plots_spec.rb +++ b/spec/system/read_function_plots_spec.rb @@ -57,6 +57,47 @@ expect(topic_page).to have_content(I18n.t("js.chatbot.function_plot.fallback")) end + it "traces visible curves and snaps to axes and series intersections" do + graph = + DiscourseChatbot::FunctionPlot.markdown( + "expressions" => "x^2\nsqrt(x)", + "x_min" => -2, + "x_max" => 2, + "y_min" => -1, + "y_max" => 5, + ) + Fabricate(:post, topic: topic, raw: graph) + topic_page.visit_topic(topic) + + expect(graphs).to have_rendered_graphs(count: 1) + graphs.move_over_2d_plot(relative_x: 0.755) + expect(graphs).to have_trace_points(count: 2) + expect(graphs).to have_trace_values(count: 2) + expect(graphs.trace_coordinates).to eq([[1, 1], [1, 1]]) + expect(graphs.trace_point_positions.uniq.length).to eq(1) + initial_positions = graphs.trace_point_positions + + graphs.move_over_2d_plot(relative_x: 0.875) + try_until_success { expect(graphs.trace_coordinates.first[0]).to be_within(0.03).of(1.5) } + expect(graphs.trace_coordinates.first[1]).to be_within(0.04).of(2.25) + expect(graphs.trace_point_positions).not_to eq(initial_positions) + + graphs.move_over_2d_plot(relative_x: 0.25) + expect(graphs).to have_trace_points(count: 1) + expect(graphs).to have_trace_values(count: 1) + expect(graphs.trace_coordinates.last).to be_nil + + graphs.move_over_2d_plot(relative_x: 0.502) + expect(graphs).to have_trace_points(count: 2) + expect(graphs).to have_trace_values(count: 2) + expect(graphs.trace_coordinates.first).to eq([0, 0]) + expect(graphs.trace_coordinates[1]).to eq([0, 0]) + + graphs.leave_plot + expect(graphs).to have_trace_points(count: 0) + expect(graphs).to have_trace_values(count: 0) + end + it "preserves gaps in the domain and handles an entirely undefined curve" do graph = DiscourseChatbot::FunctionPlot.markdown("expressions" => "sqrt(x^2-1)\nsqrt(-1)") Fabricate(:post, topic: topic, raw: graph) diff --git a/test/javascripts/unit/function-plot-trace-test.js b/test/javascripts/unit/function-plot-trace-test.js new file mode 100644 index 00000000..c992aa83 --- /dev/null +++ b/test/javascripts/unit/function-plot-trace-test.js @@ -0,0 +1,105 @@ +import { module, test } from "qunit"; +import { + traceCoordinates, + traceSeriesCoordinates, +} from "discourse/plugins/discourse-chatbot/discourse/lib/function-plot-trace"; + +module("Chatbot | curve tracing", function () { + test("snaps intersecting series to a shared point", function (assert) { + const values = traceSeriesCoordinates( + [(x) => x + 1, (x) => 3 - x], + 1.03, + [-5, 5, 5, -5], + 500 + ); + assert.true(Math.abs(values[0].x - 1) < 1e-10); + assert.strictEqual(values[0].y, 2); + assert.deepEqual(values[0], values[1]); + }); + test("chooses the closest of nearby series crossings", function (assert) { + const values = traceSeriesCoordinates( + [(x) => x + 1, (x) => 3 - x, (x) => 4.2 - 2 * x], + 1.04, + [-5, 5, 5, -5], + 500 + ); + assert.true(Math.abs(values[0].x - 3.2 / 3) < 1e-10); + assert.deepEqual(values[0], values[2]); + }); + test("ignores coincident series, poles and offscreen intersections", function (assert) { + const overlap = traceSeriesCoordinates( + [() => 2, () => 2], + 1.03, + [-5, 5, 5, -5], + 500 + ); + assert.deepEqual(overlap, [ + { x: 1.03, y: 2 }, + { x: 1.03, y: 2 }, + ]); + const pole = traceSeriesCoordinates( + [(x) => 1 / (x - 1), () => 0], + 1.02, + [-5, 100, 5, -100], + 500 + ); + assert.strictEqual(pole[0].x, 1.02); + assert.true(Math.abs(pole[0].y - 50) < 1e-8); + assert.deepEqual( + traceSeriesCoordinates( + [(x) => x + 100, (x) => 102 - x], + 1.03, + [-5, 5, 5, -5], + 500 + ), + [null, null] + ); + }); + test("snaps to a visible y-axis intercept within six pixels", function (assert) { + assert.deepEqual( + traceCoordinates((x) => x * x + 2, 0.02, [-5, 5, 5, -5], 500), + { x: 0, y: 2 } + ); + assert.deepEqual( + traceCoordinates((x) => x * x + 2, 0.2, [-5, 5, 5, -5], 500), + { x: 0.2, y: 2.04 } + ); + }); + test("snaps to nearby zeros including cubic roots with steep slopes", function (assert) { + const quadratic = traceCoordinates( + (x) => x * x - 4, + 2.03, + [-5, 5, 5, -5], + 500 + ); + assert.true(Math.abs(quadratic.x - 2) < 1e-10); + assert.strictEqual(quadratic.y, 0); + const cubic = traceCoordinates( + (x) => Math.cbrt((3 - 4 * x * x * x) / 2), + 0.92, + [-2, 5, 2, -5], + 500 + ); + assert.true(Math.abs(cubic.x - Math.cbrt(0.75)) < 1e-10); + assert.strictEqual(cubic.y, 0); + }); + test("keeps poles, jumps and undefined values from becoming false intercepts", function (assert) { + const pole = traceCoordinates((x) => 1 / x, 0.02, [-1, 100, 1, -100], 500); + assert.deepEqual(pole, { x: 0.02, y: 50 }); + const jump = traceCoordinates( + (x) => Math.floor(x) * 2 + 1, + 0.02, + [-1, 5, 1, -5], + 500 + ); + assert.deepEqual(jump, { x: 0, y: 1 }); + assert.strictEqual( + traceCoordinates((x) => Math.sqrt(x), -1, [-2, 5, 2, -5], 500), + null + ); + assert.strictEqual( + traceCoordinates((x) => x * x + 10, 1, [-2, 5, 2, -5], 500), + null + ); + }); +}); From ae1d5a92f66603bccc61c6d7fdbd87a78474c096 Mon Sep 17 00:00:00 2001 From: merefield Date: Mon, 26 Oct 2026 21:35:48 +0000 Subject: [PATCH 6/8] Return to function-plot and support additional 2D plot families --- README.md | 130 +++-- .../components/function-plot-block.gjs | 73 +-- .../discourse/lib/function-plot-expression.js | 191 +++++-- .../discourse/lib/function-plot-renderer.js | 214 ++++++++ .../discourse/lib/jsxgraph-renderer.js | 195 ------- assets/stylesheets/common/chatbot_common.scss | 8 +- config/locales/client.en.yml | 4 +- config/locales/server.en.yml | 26 +- lib/discourse_chatbot/function_plot.rb | 58 +- lib/discourse_chatbot/tools/function_plot.rb | 9 +- .../1.26.0/LICENSE} | 19 +- .../1.26.0/THIRD-PARTY-LICENSES.txt | 518 ++++++++++++++++++ public/function-plot/1.26.0/function-plot.js | 6 + public/function-plot/README.md | 34 ++ public/function-plot/build/build.mjs | 53 ++ public/function-plot/build/entry.js | 6 + public/function-plot/build/package.json | 12 + public/function-plot/build/pnpm-lock.yaml | 505 +++++++++++++++++ public/jsxgraph/1.14.1/LICENSE.LGPL | 165 ------ public/jsxgraph/1.14.1/jsxgraphcore.js | 55 -- .../1.14.1/jsxgraphcore.js.LICENSE.txt | 5 - public/jsxgraph/README.md | 15 - spec/lib/tools/function_plot_spec.rb | 99 ++-- .../page_objects/components/function_plots.rb | 58 +- spec/system/read_function_plots_spec.rb | 75 ++- .../unit/function-plot-expression-test.js | 73 ++- .../unit/function-plot-renderer-test.js | 73 +++ 27 files changed, 1970 insertions(+), 709 deletions(-) create mode 100644 assets/javascripts/discourse/lib/function-plot-renderer.js delete mode 100644 assets/javascripts/discourse/lib/jsxgraph-renderer.js rename public/{jsxgraph/1.14.1/LICENSE.MIT => function-plot/1.26.0/LICENSE} (61%) create mode 100644 public/function-plot/1.26.0/THIRD-PARTY-LICENSES.txt create mode 100644 public/function-plot/1.26.0/function-plot.js create mode 100644 public/function-plot/README.md create mode 100644 public/function-plot/build/build.mjs create mode 100644 public/function-plot/build/entry.js create mode 100644 public/function-plot/build/package.json create mode 100644 public/function-plot/build/pnpm-lock.yaml delete mode 100644 public/jsxgraph/1.14.1/LICENSE.LGPL delete mode 100644 public/jsxgraph/1.14.1/jsxgraphcore.js delete mode 100644 public/jsxgraph/1.14.1/jsxgraphcore.js.LICENSE.txt delete mode 100644 public/jsxgraph/README.md create mode 100644 test/javascripts/unit/function-plot-renderer-test.js diff --git a/README.md b/README.md index d6e8fb4e..d4b0c309 100644 --- a/README.md +++ b/README.md @@ -371,73 +371,97 @@ Filtering adds an evaluation call and can change prompt-cache reuse; reduced too guarantee lower total cost or better answers. Thresholds and guidance should be evaluated against your community's requests. -### Mathematical function graphs - -Chatbot bundles JSXGraph 1.14.1 for interactive 2D curves -and 3D surfaces rendered locally in the -reader's browser. `chatbot_function_plot_enabled` defaults to `true`, and -`plot_function` is included in the defaults for all `chatbot_tools_*_trust` settings. -Customised trust-level tool lists retain their existing selections; add -`plot_function` to those lists to let the bot prepare graphs. -System One selection evaluates the new tool like the other eligible tools. - -Existing `function-plot` fences remain compatible. To plot a surface `z=f(x,y)`, -add `"dimensions":3` and optionally `"z_domain"` to its JSON definition: +### Mathematical graphs + +Chatbot bundles function-plot 1.26.0 for interactive 2D graphs rendered in the +reader's browser. The library loads only when a graph is present, with no external +rendering API or notional tool quota charge. `chatbot_function_plot_enabled` +defaults to `true`; `plot_function` is included in all `chatbot_tools_*_trust` +defaults. Add it to any customised tool lists to make it available. System One +selection evaluates it like the other eligible tools. + +A single `plot_function` tool accepts an optional `plot_type` (default `function`), +`expressions`, `title`, paired `x_min`/`x_max` and `y_min`/`y_max` bounds, and paired +`parameter_min`/`parameter_max` for parametric/polar curves. Unused parameter bounds +are ignored, including placeholders supplied by strict tool schemas. Each graph +uses one family; an answer can include multiple graphs alongside explanations and +the usual MathJax/LaTeX output when Discourse Math is enabled. + +| Plot type | Tool `expressions` format (one entry per line) | Limit | +| --- | --- | --- | +| `function` | `sin(x)` or `cbrt((3-4*x^3)/2)` | 4 curves | +| `implicit` | `x^2+y^2-4` for the equation F(x,y)=0 | 2 curves | +| `parametric` | `cos(t); sin(t)` for x(t); y(t) | 4 curves | +| `polar` | `2*cos(3*theta)` for r(theta) | 4 curves | +| `points` | `1,2` for x,y scatter points | 150 points | +| `polyline` | `1,2` for connected x,y points in supplied order | 150 points | +| `vector` | `3,2` for dx,dy from the origin, or `1,1,3,2` for x0,y0,dx,dy | 16 vectors | + +Axes default to `[-10,10]`; t/theta defaults to `[0,2*pi]`. Custom bounds must be +finite, increasing pairs within `[-1000000,1000000]`, spanning at least `0.000001`. +Coordinates and vector components share that numeric limit. Titles are plain text +up to 120 characters. Inputs are limited to 6000 characters; rendered JSON to 8192. + +Human-authored posts, PMs and Chat can use the same `function-plot` fenced JSON. +Existing 2D `functions` blocks retain their format. These examples show the fields +for each additional family; `title`, `x_domain` and `y_domain` are optional: ````markdown +The curves intersect where $\sin(x)=\cos(x)$. + ```function-plot -{"dimensions":3,"functions":["sin(x)*cos(y)"],"title":"A 3D wave","x_domain":[-3,3],"y_domain":[-3,3],"z_domain":[-1.5,1.5]} +{"functions":["sin(x)","cos(x)"],"title":"Sine and cosine","x_domain":[-7,7],"y_domain":[-2,2]} ``` -```` -Readers drag a 3D surface to rotate it and scroll or pinch to zoom. The tool accepts the equivalent numeric -`dimensions` parameter (2 by default, or 3 for surfaces) and paired `z_min`/`z_max` -bounds. Z bounds are ignored for 2D plots, including placeholder values supplied by strict tool schemas. Use at most two surfaces in a graph. The 3D mode supports -explicit surfaces `z=f(x,y)`, not arbitrary implicit solids or parametric curves. +```function-plot +{"plot_type":"implicit","functions":["x^2+y^2-4"],"x_domain":[-3,3],"y_domain":[-3,3]} +``` -In 2D, moving the pointer shows a coloured marker and live x/y coordinates for -each curve visible at that x value. Undefined and off-screen values are hidden; -the markers and coordinate readouts clear when the pointer leaves the plot. -Within six screen pixels of a nearby axis intercept or series intersection, -tracing snaps to that crossing. Intersecting series share a marker location and -coordinate reading, and axis intercepts show a zero coordinate. All series follow -the selected x position. Crossings are found numerically; coincident series, poles, -jumps and undefined regions do not introduce false intersection targets. -Tangential contacts can be missed unless a sampled point lands exactly on the contact. +```function-plot +{"plot_type":"parametric","functions":[["cos(t)","sin(t)"]],"parameter_range":[0,6.283185307179586]} +``` -The tool is intended to accompany mathematical explanations, including the site's -usual MathJax/LaTeX output when Discourse Math is enabled (`discourse_math_enabled`). For example, an answer -about quadratic roots can explain the algebra and include a plot of `x^2-4`. -The graph tool uses no external API and adds no notional tool quota charge. +```function-plot +{"plot_type":"polar","functions":["2*cos(3*theta)"]} +``` -Human-authored posts, PMs and Chat messages can use the same fenced format: +```function-plot +{"plot_type":"points","points":[[0,0],[1,2],[2,1]]} +``` -````markdown -The curves intersect where $\sin(x)=\cos(x)$. +```function-plot +{"plot_type":"polyline","points":[[0,0],[1,2],[2,1]]} +``` ```function-plot -{"functions":["sin(x)","cos(x)"],"title":"Sine and cosine","x_domain":[-7,7],"y_domain":[-2,2]} +{"plot_type":"vector","vectors":[[0,0,3,2],[1,1,-2,1]]} ``` ```` -Supported expressions use `x` (and `y` for 3D surfaces), numeric literals, `pi`, `e`, explicit multiplication, -`+ - * / ^`, parentheses, and the single-argument functions `sin`, `cos`, `tan`, -`asin`, `acos`, `atan`, `sqrt`, `cbrt`, `abs`, `exp`, `log`, `log10`, `floor`, and `ceil`. -Use `cbrt(...)` for real cube roots of negative as well as positive values. -`log` is the natural logarithm and trigonometric angles are radians. Omit `y=` and -LaTeX commands from graph expressions. There may be up to four 2D expressions or two 3D expressions, each -at most 256 characters. Titles are plain text, at most 120 characters. Both axes -default to `[-10,10]`; custom domains must be finite, increasing pairs within -`[-1000000,1000000]`, with a span of at least `0.000001`. - -The renderer uses a restricted interpreter and trusted callbacks, with JSXGraph's -code compilation disabled, preserving Discourse's CSP. 2D curves use adaptive -sampling; 3D surfaces use a bounded mesh with 24 subdivisions in each direction. -It redraws when resized, zoomed or rotated. Undefined or non-finite values are gaps; -graphs are numerical visualisations, not proofs or a symbolic solver. Graph -definitions remain available in a disclosure below each plot and as ordinary -code blocks in email, exports, disabled rendering, and clients without JavaScript. -Invalid definitions display an error and retain the original definition. +Readers drag to pan and scroll or pinch to zoom. Wheel zoom inside a graph does +not scroll the page. For ordinary `function` curves, moving the pointer shows a +coloured marker and live x/y coordinates on each visible curve. Tracing snaps +within six screen pixels of axis intercepts and series intersections. Intersecting +series share coordinates; undefined/off-screen values and pointer exit hide the +markers. Crossings are numerical; poles, jumps and coincident series do not create +false snapping targets. Tangencies can be missed. Other plot types support pan and +zoom without the function-specific trace overlay. + +The restricted interpreter accepts numeric literals, `pi`, `e`, `+ - * / ^`, +parentheses and `sin`, `cos`, `tan`, `asin`, `acos`, `atan`, `sqrt`, `cbrt`, `abs`, +`exp`, `log`, `log10`, `floor`, `ceil`. Variables depend on the selected family. +Expressions are limited to 256 characters each, 128 tokens and bounded nesting; +assignments, JavaScript and arbitrary library options are rejected on both sides. +Use `cbrt(...)` for real cube roots; `log` is natural and angles are radians. + +Trusted callbacks preserve Discourse's CSP without evaluating post text as code. +Ordinary curves use 1000 samples and preserve undefined domain gaps. Implicit +curves use the library's interval sampler and a shared limit of 40000 evaluations +per redraw; over-budget graphs show an error with the original definition. +Graphs are numerical visualisations, not symbolic solutions or proofs. 3D surfaces +are unsupported. Definitions remain available below each plot and as ordinary +code in email, exports, disabled rendering, and clients without JavaScript. +Vendor build instructions and checksums are in `public/function-plot/README.md`. ### Tool extensions diff --git a/assets/javascripts/discourse/components/function-plot-block.gjs b/assets/javascripts/discourse/components/function-plot-block.gjs index f2231970..907e77fd 100644 --- a/assets/javascripts/discourse/components/function-plot-block.gjs +++ b/assets/javascripts/discourse/components/function-plot-block.gjs @@ -6,7 +6,10 @@ import loadScript from "discourse/lib/load-script"; import { eq } from "discourse/truth-helpers"; import { i18n } from "discourse-i18n"; import { parseGraph } from "../lib/function-plot-expression"; -import { createCurveTrace, createGraphBoard } from "../lib/jsxgraph-renderer"; +import { + createCurveTrace, + createGraphChart, +} from "../lib/function-plot-renderer"; export default class FunctionPlotBlock extends Component { @tracked failed = false; @@ -16,7 +19,7 @@ export default class FunctionPlotBlock extends Component { renderPlot = modifier((element, [raw]) => { let disposed = false; - let board; + let chart; let observer; let previousWidth; let trace; @@ -40,20 +43,6 @@ export default class FunctionPlotBlock extends Component { const onWheel = (event) => { event.preventDefault(); event.stopPropagation(); - if (event.deltaY === 0) { - return; - } - const position = new window.JXG.Coords( - window.JXG.COORDS_BY_SCREEN, - board.getMousePosition(event), - board - ).usrCoords; - if (event.deltaY < 0) { - board.zoomIn(position[1], position[2]); - } else { - board.zoomOut(position[1], position[2]); - } - trace?.move(event); }; const resize = () => { @@ -63,7 +52,11 @@ export default class FunctionPlotBlock extends Component { previousWidth = width; trace?.clear(); element.style.height = `${height}px`; - board?.resizeContainer(width, height, true); + if (chart) { + chart.options.width = width; + chart.options.height = height; + chart.build(); + } } }; @@ -71,16 +64,20 @@ export default class FunctionPlotBlock extends Component { try { const graph = parseGraph(raw); await loadScript( - "/plugins/discourse-chatbot/jsxgraph/1.14.1/jsxgraphcore.js" + "/plugins/discourse-chatbot/function-plot/1.26.0/function-plot.js" ); if (disposed) { return; } this.graph = graph; + chart = createGraphChart(element, graph, () => { + if (!disposed) { + this.failed = true; + } + }); resize(); - board = createGraphBoard(element, graph); - if (graph.dimensions === 2) { - trace = createCurveTrace(board, graph, (values) => { + if (graph.plotType === "function") { + trace = createCurveTrace(chart, graph, (values) => { if (!disposed) { this.traceValues = values.map((value) => value @@ -123,8 +120,10 @@ export default class FunctionPlotBlock extends Component { trace.destroy(); } observer?.disconnect(); - if (board) { - window.JXG.JSXGraph.freeBoard(board); + if (chart) { + chart.removeAllListeners(); + // Upstream retains detached charts in a static cache. + delete chart.constructor.cache[chart.id]; } }; }); @@ -149,26 +148,30 @@ export default class FunctionPlotBlock extends Component { {{/if}}
    - {{#each this.graph.functions as |curve index|}} -
  • - {{curve.expression}} - {{#if (eq this.graph.dimensions 2)}} - {{get - this.traceValues - index - }} - {{/if}} -
  • + {{#each this.graph.series as |curve index|}} + {{#if curve.expression}} +
  • + {{curve.expression}} + {{#if (eq this.graph.plotType "function")}} + {{get + this.traceValues + index + }} + {{/if}} +
  • + {{/if}} {{/each}}
{{i18n (if - (eq this.graph.dimensions 3) - "chatbot.function_plot.help_3d" + (eq this.graph.plotType "function") "chatbot.function_plot.help" + "chatbot.function_plot.help_other" ) }}
diff --git a/assets/javascripts/discourse/lib/function-plot-expression.js b/assets/javascripts/discourse/lib/function-plot-expression.js index 9ac6f89c..7feddc23 100644 --- a/assets/javascripts/discourse/lib/function-plot-expression.js +++ b/assets/javascripts/discourse/lib/function-plot-expression.js @@ -24,7 +24,13 @@ const OPERATORS = { }; // Interpret a small maths grammar; never pass post text to the library's code generator. -export function compileExpression(expression, { dimensions = 2 } = {}) { +export function compileExpression( + expression, + { variables = ["x"], arithmetic } = {} +) { + const functions = arithmetic?.functions ?? FUNCTIONS; + const operators = arithmetic?.operators ?? OPERATORS; + const literal = arithmetic?.literal ?? ((value) => value); if ( typeof expression !== "string" || !expression.trim() || @@ -60,18 +66,20 @@ export function compileExpression(expression, { dimensions = 2 } = {}) { let left; if (token === "+" || token === "-") { const operand = parse(3, depth + 1); - left = token === "-" ? (x, y) => -operand(x, y) : operand; + left = + token === "-" + ? (x, y) => + arithmetic ? arithmetic.negative(operand(x, y)) : -operand(x, y) + : operand; } else if (token === "(") { left = parse(1, depth + 1); if (tokens[index++] !== ")") { throw new Error("Unclosed group"); } - } else if (token === "x") { - left = (x) => x; - } else if (token === "y" && dimensions === 3) { - left = (_x, y) => y; + } else if (variables.includes(token)) { + left = variables.indexOf(token) === 0 ? (x) => x : (_x, y) => y; } else if (token === "pi" || token === "e") { - const constant = token === "pi" ? Math.PI : Math.E; + const constant = literal(token === "pi" ? Math.PI : Math.E); left = () => constant; } else if (Object.hasOwn(FUNCTIONS, token)) { if (tokens[index++] !== "(") { @@ -81,9 +89,9 @@ export function compileExpression(expression, { dimensions = 2 } = {}) { if (tokens[index++] !== ")") { throw new Error("Invalid function argument"); } - left = (x, y) => FUNCTIONS[token](argument(x, y)); + left = (x, y) => functions[token](argument(x, y)); } else if (token && Number.isFinite(Number(token))) { - const number = Number(token); + const number = literal(Number(token)); left = () => number; } else { throw new Error("Unsupported expression"); @@ -99,7 +107,7 @@ export function compileExpression(expression, { dimensions = 2 } = {}) { depth + 1 ); const previous = left; - left = (x, y) => OPERATORS[operator](previous(x, y), right(x, y)); + left = (x, y) => operators[operator](previous(x, y), right(x, y)); } return left; } @@ -110,7 +118,7 @@ export function compileExpression(expression, { dimensions = 2 } = {}) { } return (x, y) => { const result = evaluate(x, y); - return Number.isFinite(result) ? result : NaN; + return arithmetic ? result : Number.isFinite(result) ? result : NaN; }; } @@ -131,30 +139,67 @@ function domain(value) { return [...value]; } +const PLOT_TYPES = [ + "function", + "implicit", + "parametric", + "polar", + "points", + "polyline", + "vector", +]; + +function tuples(value, size, limit) { + if ( + !Array.isArray(value) || + !value.length || + value.length > limit || + value.some( + (tuple) => + !Array.isArray(tuple) || + tuple.length !== size || + tuple.some( + (number) => + typeof number !== "number" || + !Number.isFinite(number) || + Math.abs(number) > 1000000 + ) + ) + ) { + throw new Error("Invalid graph data"); + } + return value; +} + export function parseGraph(raw) { if (typeof raw !== "string" || raw.length > 8192) { throw new Error("Graph too large"); } const graph = JSON.parse(raw); - const dimensions = graph?.dimensions ?? 2; + const plotType = graph?.plot_type ?? "function"; + const dataKey = + plotType === "vector" + ? "vectors" + : ["points", "polyline"].includes(plotType) + ? "points" + : "functions"; + const parameterized = ["parametric", "polar"].includes(plotType); + const allowedKeys = [ + dataKey, + "plot_type", + "title", + "x_domain", + "y_domain", + "dimensions", + ]; + if (parameterized) { + allowedKeys.push("parameter_range"); + } if ( !graph || - ![2, 3].includes(dimensions) || - !Array.isArray(graph.functions) || - graph.functions.length < 1 || - graph.functions.length > (dimensions === 3 ? 2 : 4) || - (dimensions === 2 && Object.hasOwn(graph, "z_domain")) || - Object.keys(graph).some( - (key) => - ![ - "functions", - "title", - "dimensions", - "x_domain", - "y_domain", - "z_domain", - ].includes(key) - ) + !PLOT_TYPES.includes(plotType) || + (graph.dimensions !== undefined && graph.dimensions !== 2) || + Object.keys(graph).some((key) => !allowedKeys.includes(key)) ) { throw new Error("Invalid graph"); } @@ -162,15 +207,91 @@ export function parseGraph(raw) { if (typeof title !== "string" || title.length > 120 || /[\r\n]/.test(title)) { throw new Error("Invalid title"); } - return { - dimensions, + const result = { + plotType, title, xDomain: domain(graph.x_domain ?? [-10, 10]), yDomain: domain(graph.y_domain ?? [-10, 10]), - zDomain: dimensions === 3 ? domain(graph.z_domain ?? [-10, 10]) : null, - functions: graph.functions.map((expression) => ({ - expression, - evaluate: compileExpression(expression, { dimensions }), - })), + parameterRange: parameterized + ? domain(graph.parameter_range ?? [0, 2 * Math.PI]) + : null, + series: [], }; + if (dataKey !== "functions") { + const data = tuples( + graph[dataKey], + plotType === "vector" ? 4 : 2, + plotType === "vector" ? 16 : 150 + ); + result.series = + plotType === "vector" + ? data.map((vector) => ({ expression: vector.join(", "), vector })) + : [{ expression: "", points: data }]; + return result; + } + if ( + !Array.isArray(graph.functions) || + !graph.functions.length || + graph.functions.length > (plotType === "implicit" ? 2 : 4) + ) { + throw new Error("Invalid graph functions"); + } + result.series = graph.functions.map((expression) => { + if (plotType === "parametric") { + if (!Array.isArray(expression) || expression.length !== 2) { + throw new Error("Invalid parametric pair"); + } + return { + expression: expression.join("; "), + evaluateX: compileExpression(expression[0], { variables: ["t"] }), + evaluateY: compileExpression(expression[1], { variables: ["t"] }), + }; + } + const variables = + plotType === "implicit" + ? ["x", "y"] + : plotType === "polar" + ? ["theta"] + : ["x"]; + return { + expression, + evaluate: compileExpression(expression, { variables }), + }; + }); + return result; +} + +// The upstream sampler drops undefined points, which can otherwise bridge domain gaps. +export function splitUndefinedSegments( + segments, + evaluate = () => 0, + step = Infinity +) { + const result = []; + for (const segment of segments) { + let current = []; + for (const point of segment) { + if (!point || !point.every(Number.isFinite)) { + if (current.length) { + result.push(current); + current = []; + } + continue; + } + const previous = current.at(-1); + if ( + previous && + (point[0] - previous[0] > step * 1.5 || + !Number.isFinite(evaluate((point[0] + previous[0]) / 2))) + ) { + result.push(current); + current = []; + } + current.push(point); + } + if (current.length) { + result.push(current); + } + } + return result; } diff --git a/assets/javascripts/discourse/lib/function-plot-renderer.js b/assets/javascripts/discourse/lib/function-plot-renderer.js new file mode 100644 index 00000000..e25c7f63 --- /dev/null +++ b/assets/javascripts/discourse/lib/function-plot-renderer.js @@ -0,0 +1,214 @@ +import { + compileExpression, + splitUndefinedSegments, +} from "./function-plot-expression"; +import { traceSeriesCoordinates } from "./function-plot-trace"; + +const COLORS = ["#0088cc", "#e4572e", "#32a66a", "#b279a2"]; + +export function compileIntervalExpression(expression, interval) { + const monotonic = (fn) => (value) => + interval.isEmpty(value) + ? interval.EMPTY + : interval.factory(fn(value.lo), fn(value.hi)); + return compileExpression(expression, { + variables: ["x", "y"], + arithmetic: { + literal: (value) => interval.factory(value), + negative: interval.negative, + functions: { + ...interval, + cbrt: monotonic(Math.cbrt), + floor: monotonic(Math.floor), + ceil: monotonic(Math.ceil), + }, + operators: { + "+": interval.add, + "-": interval.sub, + "*": interval.mul, + "/": interval.div, + "^": (base, exponent) => { + if (interval.isSingleton(exponent) && Number.isInteger(exponent.lo)) { + return interval.pow(base, exponent); + } + if (base.lo < 0) { + return interval.WHOLE; + } + return interval.exp(interval.mul(interval.log(base), exponent)); + }, + }, + }, + }); +} + +export function createGraphChart(element, graph, onError) { + const library = window.functionPlot; + const options = { + target: element, + width: 640, + height: 420, + grid: true, + xAxis: { domain: graph.xDomain }, + yAxis: { domain: graph.yDomain }, + tip: { renderer: () => "" }, + data: [], + }; + const chart = library(options); + let evaluations = 0; + chart.on("before:draw", () => (evaluations = 0)); + chart.on("eval", (segments, index, isHelper) => { + if (isHelper || graph.plotType === "implicit") { + return; + } + const [minimum, maximum] = chart.meta.xScale.domain(); + const separated = + graph.plotType === "function" + ? splitUndefinedSegments( + segments, + graph.series[index].evaluate, + (maximum - minimum) / 999 + ) + : splitUndefinedSegments(segments); + segments.splice(0, segments.length, ...separated); + }); + options.data = graph.series.map((series, index) => { + const datum = { + color: COLORS[index % COLORS.length], + sampler: "builtIn", + graphType: "polyline", + nSamples: 1000, + skipTip: true, + }; + switch (graph.plotType) { + case "implicit": { + const evaluate = compileIntervalExpression( + series.expression, + library.intervalMath + ); + return { + ...datum, + fnType: "implicit", + sampler: "interval", + graphType: "interval", + fn: ({ x, y }) => { + if (++evaluations > 40000) { + throw new Error("Implicit plot exceeded the evaluation budget"); + } + return evaluate(x, y); + }, + }; + } + case "parametric": + return { + ...datum, + fnType: "parametric", + x: ({ t }) => series.evaluateX(t), + y: ({ t }) => series.evaluateY(t), + range: graph.parameterRange, + }; + case "polar": + return { + ...datum, + fnType: "polar", + r: ({ theta }) => series.evaluate(theta), + range: graph.parameterRange, + }; + case "points": + case "polyline": + return { + ...datum, + fnType: "points", + points: series.points, + graphType: graph.plotType === "points" ? "scatter" : "polyline", + }; + case "vector": + return { + ...datum, + fnType: "vector", + offset: series.vector.slice(0, 2), + vector: series.vector.slice(2), + }; + default: + return { + ...datum, + fnType: "linear", + fn: ({ x }) => series.evaluate(x), + }; + } + }); + + // Zoom redraws happen inside the library's event handlers, outside the component's initializer. + const draw = chart.draw.bind(chart); + chart.draw = () => { + try { + draw(); + } catch { + options.data = []; + onError(); + } + }; + chart.build(); + return chart; +} + +export function createCurveTrace(chart, graph, onValues) { + const canvas = chart.canvas.merge(chart.canvas.enter); + const overlay = canvas.append("g").attr("pointer-events", "none"); + const points = graph.series.map((_series, index) => + overlay + .append("circle") + .attr("class", "chatbot-function-plot__trace-point") + .attr("r", 4) + .attr("fill", COLORS[index]) + .attr("display", "none") + ); + let frame; + let pointer; + const clear = () => { + cancelAnimationFrame(frame); + frame = null; + points.forEach((point) => point.attr("display", "none")); + onValues([]); + }; + const update = () => { + frame = null; + const box = chart.draggable.node().getBoundingClientRect(); + const pixelX = pointer.clientX - box.left; + const pixelY = pointer.clientY - box.top; + if (pixelX < 0 || pixelX > box.width || pixelY < 0 || pixelY > box.height) { + clear(); + return; + } + const [minX, maxX] = chart.meta.xScale.domain(); + const [minY, maxY] = chart.meta.yScale.domain(); + const values = traceSeriesCoordinates( + graph.series.map((series) => series.evaluate), + chart.meta.xScale.invert(pixelX), + [minX, maxY, maxX, minY], + box.width + ); + points.forEach((point, index) => { + const value = values[index]; + point.attr("display", value ? null : "none"); + if (value) { + point + .attr("cx", chart.meta.xScale(value.x)) + .attr("cy", chart.meta.yScale(value.y)); + } + }); + onValues(values); + }; + chart.on("before:draw", clear); + return { + move(event) { + pointer = { clientX: event.clientX, clientY: event.clientY }; + frame ??= requestAnimationFrame(update); + }, + clear, + destroy() { + clear(); + chart.removeListener("before:draw", clear); + overlay.remove(); + }, + }; +} diff --git a/assets/javascripts/discourse/lib/jsxgraph-renderer.js b/assets/javascripts/discourse/lib/jsxgraph-renderer.js deleted file mode 100644 index 55ab10d0..00000000 --- a/assets/javascripts/discourse/lib/jsxgraph-renderer.js +++ /dev/null @@ -1,195 +0,0 @@ -import { traceSeriesCoordinates } from "./function-plot-trace"; - -const COLORS = ["#0088cc", "#e4572e", "#32a66a", "#b279a2"]; - -export function createCurveTrace(board, graph, onValues) { - let values = []; - let frame = null; - let pointer; - const points = graph.functions.map((_curve, index) => { - const point = board.create( - "point", - [() => values[index]?.x ?? NaN, () => values[index]?.y ?? NaN], - { - name: "", - withLabel: false, - fixed: true, - highlight: false, - showInfobox: false, - size: 3, - strokeWidth: 2, - strokeColor: COLORS[index], - fillColor: COLORS[index], - visible: () => Boolean(values[index]), - } - ); - point.hasPoint = () => false; - point.rendNode.classList.add("chatbot-function-plot__trace-point"); - return point; - }); - const renderPoints = () => { - points.forEach((point) => - point.prepareUpdate().update().updateVisibility().updateRenderer() - ); - onValues(values); - }; - const clear = () => { - if (frame !== null) { - cancelAnimationFrame(frame); - frame = null; - } - pointer = null; - values = []; - renderPoints(); - }; - const update = () => { - frame = null; - const position = board.getMousePosition(pointer); - if ( - position[0] < 0 || - position[0] > board.canvasWidth || - position[1] < 0 || - position[1] > board.canvasHeight - ) { - clear(); - return; - } - const x = new window.JXG.Coords( - window.JXG.COORDS_BY_SCREEN, - position, - board - ).usrCoords[1]; - values = traceSeriesCoordinates( - graph.functions.map((curve) => curve.evaluate), - x, - board.getBoundingBox(), - board.canvasWidth - ); - renderPoints(); - }; - return { - clear, - move(event) { - pointer = event; - if (frame === null) { - frame = requestAnimationFrame(update); - } - }, - destroy: clear, - }; -} - -export function createGraphBoard(element, graph) { - const library = window.JXG; - // Internal labels must also use the interpreter under Discourse's CSP. - library.Options.jc.compile = false; - const is3D = graph.dimensions === 3; - const primary = getComputedStyle(element) - .getPropertyValue("--primary") - .trim(); - const axis = { - strokeColor: primary, - ticks: { - label: { strokeColor: primary, display: "internal", parse: false }, - }, - }; - element.id ||= `chatbot-plot-${crypto.randomUUID()}`; - element.dataset.dimensions = graph.dimensions; - const board = library.JSXGraph.initBoard(element, { - renderer: "svg", - boundingbox: is3D - ? [-8, 6, 8, -6] - : [ - graph.xDomain[0], - graph.yDomain[1], - graph.xDomain[1], - graph.yDomain[0], - ], - axis: !is3D, - defaultAxes: { x: axis, y: axis }, - grid: !is3D, - showCopyright: false, - showNavigation: false, - showInfobox: false, - keepaspectratio: is3D, - resize: { enabled: false }, - // The component handles wheel events to prevent zoom from also scrolling the page. - registerEvents: { wheel: false }, - pan: { enabled: !is3D, needShift: false }, - zoom: { enabled: true, needShift: false }, - title: "", - description: "", - }); - board.options.text.display = "internal"; - board.options.text.parse = false; - board.options.text.useMathJax = false; - const curves = []; - board.suspendUpdate(); - try { - if (is3D) { - const view = board.create( - "view3d", - [ - [-6, -4], - [12, 8], - [graph.xDomain, graph.yDomain, graph.zDomain], - ], - { - projection: "parallel", - trackball: { enabled: true }, - axesPosition: "center", - depthOrder: { enabled: true }, - xPlaneRear: { visible: false }, - yPlaneRear: { visible: false }, - zPlaneRear: { visible: false }, - } - ); - graph.functions.forEach((curve, index) => { - view.create( - "functiongraph3d", - [curve.evaluate, graph.xDomain, graph.yDomain], - { - type: "shader", - tiling: "triangle", - stepsU: 24, - stepsV: 24, - polyhedron: { - visible: true, - strokeWidth: 0, - fillOpacity: 0.85, - shader: { - enabled: true, - hue: index === 0 ? 200 : 15, - saturation: 80, - minLightness: 35, - maxLightness: 75, - }, - }, - } - ); - }); - } else { - graph.functions.forEach((curve, index) => { - curves.push( - board.create("functiongraph", [curve.evaluate], { - strokeColor: COLORS[index], - strokeWidth: 2, - highlight: false, - doAdvancedPlot: true, - recursionDepthHigh: 12, - recursionDepthLow: 8, - }) - ); - }); - } - board.unsuspendUpdate(); - curves.forEach((curve, index) => { - curve.rendNode.classList.add("chatbot-function-plot__curve"); - curve.rendNode.dataset.curve = index; - }); - return board; - } catch (error) { - library.JSXGraph.freeBoard(board); - throw error; - } -} diff --git a/assets/stylesheets/common/chatbot_common.scss b/assets/stylesheets/common/chatbot_common.scss index e0d46d8f..3c524624 100644 --- a/assets/stylesheets/common/chatbot_common.scss +++ b/assets/stylesheets/common/chatbot_common.scss @@ -151,19 +151,19 @@ flex-direction: column; } - li:nth-child(1) { + li:nth-child(4n + 1) { color: #08c; } - li:nth-child(2) { + li:nth-child(4n + 2) { color: #e4572e; } - li:nth-child(3) { + li:nth-child(4n + 3) { color: #32a66a; } - li:nth-child(4) { + li:nth-child(4n + 4) { color: #b279a2; } } diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index eb538403..a0ddecc8 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -5,12 +5,12 @@ en: chatbot: function_plot: loading: "Loading graph…" - error: "This graph could not be rendered. Check its expressions and axis bounds." + error: "This graph could not be rendered. Check its expressions and bounds, or simplify an expensive implicit equation." fallback: "Graph definition" label: "Interactive function graph" help: "Move the pointer to trace values, snapping near axes and series intersections; drag to pan; scroll or pinch to zoom. Angles are in radians." trace_values: "x = %{x}, y = %{y}" - help_3d: "Drag to rotate; scroll or pinch to zoom. Angles are in radians." + help_other: "Drag to pan; scroll or pinch to zoom. Angles are in radians." tool_selection_mode: remove_definitions: "Remove unselected tool definitions" restrict_calls: "Restrict calls and retain tool definitions for caching" diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index 1999e3b8..c8dc720f 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -1,6 +1,6 @@ en: site_settings: - chatbot_function_plot_enabled: "Render interactive 2D curves and 3D surfaces from function-plot blocks using JSXGraph in posts, PMs and Chat. The plot_function tool is included in the defaults for every trust level; add it to any customised tool lists to let Chatbot prepare graphs. Graphs can accompany maths explanations and MathJax output." + chatbot_function_plot_enabled: "Render interactive 2D function, implicit, parametric, polar, point and vector plots locally with function-plot in posts, PMs and Chat. The plot_function tool is included in the defaults for every trust level; add it to customised tool lists to let Chatbot prepare graphs alongside maths explanations and MathJax output." chatbot_enabled: "Enable the chatbot plugin" chatbot_llm_provider: "Provider used for chatbot completions. OpenAI, Anthropic, Google Gemini, and xAI are supported through their OpenAI-compatible APIs." chatbot_open_ai_token: "OpenAI API key shared by every chatbot capability configured to use OpenAI. Get a key at OpenAI." @@ -199,19 +199,19 @@ en: function: function_plot: description: | - Prepare an interactive mathematical graph. For ordinary equations in x and y use dimensions=2 (the default): up to four curves y=f(x), with expressions in x. For a surface z=f(x,y), use dimensions=3: up to two expressions in x and y; readers can rotate the surface. Do not add a third dimension to an equation that only describes a 2D curve. Use when a graph would help explain roots, intersections, turning points, trigonometry, growth, or surfaces, even if the user did not explicitly ask for a graph. Accompany the graph with a mathematical explanation and the site's usual LaTeX/MathJax notation; the graph does not replace the answer or numerical calculation tools. - Supply expressions one per line, without 'y=', 'z=' or LaTeX. Use explicit multiplication (*), powers (^), parentheses, constants pi and e, and these single-argument functions: sin, cos, tan, asin, acos, atan, sqrt, cbrt, abs, exp, log (natural logarithm), log10, floor, ceil. Use cbrt(expression) for real cube roots, especially when the argument may be negative; do not use ^(1/3) for those roots. Trigonometric angles are radians. Examples: x^2-4 for 2D; sin(x)*cos(y) or x^2-y^2 for 3D. Expressions are limited to 256 characters each. - Choose axis bounds that show the relevant features. Bounds are numeric; supply both minimum and maximum for an axis, with -1000000 <= minimum < maximum <= 1000000. Each axis defaults to [-10,10] if omitted. The z_min/z_max bounds are used only for 3D and ignored for 2D. The tool returns a function-plot fenced block; copy the complete block unchanged into your final answer outside any other code fence. The graph renders in the reader's browser; do not claim to have viewed its rendered appearance. - expressions: "Expressions separated by newlines: up to four in x for 2D curves, or up to two in x and y for 3D surfaces." + Prepare an interactive 2D mathematical graph when it helps explain the answer, including roots, intersections, conics, trajectories or data. Choose plot_type and use the matching expressions format. Accompany the graph with the mathematical explanation and usual LaTeX/MathJax notation. 3D is unsupported. + Expressions use explicit multiplication (*), powers (^), parentheses, pi, e, and single-argument sin, cos, tan, asin, acos, atan, sqrt, cbrt, abs, exp, log (natural), log10, floor, ceil. Angles are radians. Use cbrt(...) for real cube roots of negative arguments. Omit assignments and LaTeX. Limit each expression to 256 characters. + Choose numeric axis bounds that show the relevant features; supply min/max pairs within [-1000000,1000000], increasing by at least 0.000001. Axes default to [-10,10]. For parametric/polar curves, parameter_min/parameter_max select t/theta (default 0 to 2*pi); ignored for other types. Copy the returned function-plot fence unchanged into the final answer outside other fences. Rendering is local; do not claim to have viewed the result. + expressions: "Newline-separated entries: function (default): y=f(x) as x^2-4; implicit: F(x,y)=0 as x^2+y^2-4 (max 2); parametric: x(t); y(t) as cos(t); sin(t); polar: r(theta) as 2*cos(3*theta). Max 4 curves except implicit. points/polyline: numeric x,y per line (max 150), scatter/connected respectively. vector: numeric dx,dy from origin or x0,y0,dx,dy per line (max 16)." title: "Optional plain-text graph title, up to 120 characters." - dimensions: "Optional number 2 (default) for y=f(x) curves, or 3 for z=f(x,y) surfaces." - x_min: "Left boundary of the graph. Supply with x_max." - x_max: "Right boundary of the graph. Supply with x_min." - y_min: "Bottom boundary of the graph. Supply with y_max." - y_max: "Top boundary of the graph. Supply with y_min." - z_min: "Lower z-axis boundary for a 3D surface. Ignored for 2D. Supply with z_max." - z_max: "Upper z-axis boundary for a 3D surface. Ignored for 2D. Supply with z_min." - error: "Unable to prepare the graph. Use dimensions=2 with up to four expressions in x, or dimensions=3 with up to two expressions in x and y, one per line, without y=, z= or LaTeX. Supply finite, increasing axis bounds in pairs, within -1000000 to 1000000, paired z bounds for 3D (ignored for 2D), and a title of at most 120 characters. Correct the arguments before retrying." + plot_type: "Plot family; function is the default. One family per graph." + x_min: "Left boundary. Supply with x_max." + x_max: "Right boundary. Supply with x_min." + y_min: "Bottom boundary. Supply with y_max." + y_max: "Top boundary. Supply with y_min." + parameter_min: "Start of t/theta for parametric/polar curves. Supply with parameter_max. Ignored otherwise." + parameter_max: "End of t/theta for parametric/polar curves. Supply with parameter_min. Ignored otherwise." + error: "Unable to prepare the graph. Check plot_type and its expressions format: function in x; implicit in x,y equal to zero; parametric x(t);y(t); polar in theta; points/polyline numeric x,y; vector numeric dx,dy or x0,y0,dx,dy. Max 4 curves (2 implicit), 150 points or 16 vectors. Use supported maths only, increasing finite bounds in pairs within +/-1000000, and a title up to 120 characters. Parameter bounds apply only to parametric/polar curves. Correct the arguments before retrying." remaining_bot_quota: description: | Get the current number of tokens or queries you have left for use of the bot this week diff --git a/lib/discourse_chatbot/function_plot.rb b/lib/discourse_chatbot/function_plot.rb index 9d75920f..2ad099e6 100644 --- a/lib/discourse_chatbot/function_plot.rb +++ b/lib/discourse_chatbot/function_plot.rb @@ -5,7 +5,7 @@ module DiscourseChatbot class FunctionPlot FUNCTIONS = %w[sin cos tan asin acos atan sqrt cbrt abs exp log log10 floor ceil].freeze - VARIABLES = %w[x pi e].freeze + PLOT_TYPES = %w[function implicit parametric polar points polyline vector].freeze MAX_FUNCTIONS = 4 MAX_EXPRESSION_LENGTH = 256 MAX_TOKENS = 128 @@ -13,27 +13,59 @@ class FunctionPlot MAX_BOUND = 1_000_000 def self.markdown(args) - dimensions = args.fetch("dimensions", 2) - raise ArgumentError if [2, 3].exclude?(dimensions) + plot_type = args.fetch("plot_type", "function") + raise ArgumentError if PLOT_TYPES.exclude?(plot_type) - expressions = args.fetch("expressions").split("\n").map(&:strip).reject(&:empty?) - limit = dimensions == 3 ? 2 : MAX_FUNCTIONS - raise ArgumentError if expressions.empty? || expressions.length > limit - - variables = dimensions == 3 ? VARIABLES + ["y"] : VARIABLES - expressions.each { |expression| validate_expression!(expression, variables) } + source = args.fetch("expressions") + raise ArgumentError if source.length > 6000 + expressions = source.split("\n").map(&:strip).reject(&:empty?) title = args.fetch("title", "") raise ArgumentError if title.length > 120 || title.match?(/[\r\n]/) graph = { - functions: expressions, title: title, x_domain: domain(args, "x", [-10, 10]), y_domain: domain(args, "y", [-10, 10]), } - if dimensions == 3 - graph[:dimensions] = 3 - graph[:z_domain] = domain(args, "z", [-10, 10]) + graph[:plot_type] = plot_type unless plot_type == "function" + if %w[points polyline vector].include?(plot_type) + key = plot_type == "vector" ? :vectors : :points + limit = plot_type == "vector" ? 16 : 150 + raise ArgumentError if expressions.empty? || expressions.length > limit + graph[key] = expressions.map do |line| + values = line.split(",", -1).map(&:strip) + sizes = plot_type == "vector" ? [2, 4] : [2] + unless sizes.include?(values.length) && + values.all? { |value| + value.match?(/\A[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?\z/i) + } + raise ArgumentError + end + numbers = values.map(&:to_f) + unless numbers.all? { |value| value.finite? && value.abs <= MAX_BOUND } + raise ArgumentError + end + numbers.unshift(0, 0) if plot_type == "vector" && numbers.length == 2 + numbers + end + else + limit = plot_type == "implicit" ? 2 : MAX_FUNCTIONS + raise ArgumentError if expressions.empty? || expressions.length > limit + variables = { + "function" => %w[x], + "implicit" => %w[x y], + "parametric" => %w[t], + "polar" => %w[theta], + }.fetch(plot_type) + graph[:functions] = expressions.map do |expression| + parts = plot_type == "parametric" ? expression.split(";", -1).map(&:strip) : [expression] + raise ArgumentError if parts.length != (plot_type == "parametric" ? 2 : 1) + parts.each { |part| validate_expression!(part, variables + %w[pi e]) } + plot_type == "parametric" ? parts : expression + end + if %w[parametric polar].include?(plot_type) + graph[:parameter_range] = domain(args, "parameter", [0, 2 * Math::PI]) + end end "```function-plot\n#{JSON.generate(graph)}\n```" end diff --git a/lib/discourse_chatbot/tools/function_plot.rb b/lib/discourse_chatbot/tools/function_plot.rb index e1503e36..e9312199 100644 --- a/lib/discourse_chatbot/tools/function_plot.rb +++ b/lib/discourse_chatbot/tools/function_plot.rb @@ -24,11 +24,12 @@ def parameters description: I18n.t("chatbot.prompt.function.function_plot.title"), }, { - name: "dimensions", - type: Numeric, - description: I18n.t("chatbot.prompt.function.function_plot.dimensions"), + name: "plot_type", + type: String, + enum: ::DiscourseChatbot::FunctionPlot::PLOT_TYPES, + description: I18n.t("chatbot.prompt.function.function_plot.plot_type"), }, - *%w[x_min x_max y_min y_max z_min z_max].map do |name| + *%w[x_min x_max y_min y_max parameter_min parameter_max].map do |name| { name: name, type: Numeric, diff --git a/public/jsxgraph/1.14.1/LICENSE.MIT b/public/function-plot/1.26.0/LICENSE similarity index 61% rename from public/jsxgraph/1.14.1/LICENSE.MIT rename to public/function-plot/1.26.0/LICENSE index 56ba574a..57bde726 100644 --- a/public/jsxgraph/1.14.1/LICENSE.MIT +++ b/public/function-plot/1.26.0/LICENSE @@ -1,26 +1,21 @@ -Copyright (C) 2008-2012 +MIT License - Matthias Ehmann - Michael Gerhaeuser - Carsten Miller - Bianca Valentin - Alfred Wassermann - Peter Wilfahrt +Copyright (c) 2015 Mauricio Poppe - Permission is hereby granted, free of charge, to any person obtaining a copy +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file +SOFTWARE. diff --git a/public/function-plot/1.26.0/THIRD-PARTY-LICENSES.txt b/public/function-plot/1.26.0/THIRD-PARTY-LICENSES.txt new file mode 100644 index 00000000..4655caa6 --- /dev/null +++ b/public/function-plot/1.26.0/THIRD-PARTY-LICENSES.txt @@ -0,0 +1,518 @@ +built-in-math-eval@0.3.2 +MIT License + +Copyright (c) 2015 Mauricio Poppe + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +d3-array@3.2.4 +Copyright 2010-2023 Mike Bostock + +Permission to use, copy, modify, and/or distribute this software for any purpose +with or without fee is hereby granted, provided that the above copyright notice +and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. + +d3-axis@3.0.0 +Copyright 2010-2021 Mike Bostock + +Permission to use, copy, modify, and/or distribute this software for any purpose +with or without fee is hereby granted, provided that the above copyright notice +and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. + +d3-color@3.1.0 +Copyright 2010-2022 Mike Bostock + +Permission to use, copy, modify, and/or distribute this software for any purpose +with or without fee is hereby granted, provided that the above copyright notice +and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. + +d3-dispatch@3.0.1 +Copyright 2010-2021 Mike Bostock + +Permission to use, copy, modify, and/or distribute this software for any purpose +with or without fee is hereby granted, provided that the above copyright notice +and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. + +d3-drag@3.0.0 +Copyright 2010-2021 Mike Bostock + +Permission to use, copy, modify, and/or distribute this software for any purpose +with or without fee is hereby granted, provided that the above copyright notice +and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. + +d3-ease@3.0.1 +Copyright 2010-2021 Mike Bostock +Copyright 2001 Robert Penner +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of the author nor the names of contributors may be used to + endorse or promote products derived from this software without specific prior + written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +d3-format@3.1.2 +Copyright 2010-2026 Mike Bostock + +Permission to use, copy, modify, and/or distribute this software for any purpose +with or without fee is hereby granted, provided that the above copyright notice +and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. + +d3-interpolate@3.0.1 +Copyright 2010-2021 Mike Bostock + +Permission to use, copy, modify, and/or distribute this software for any purpose +with or without fee is hereby granted, provided that the above copyright notice +and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. + +d3-path@3.1.0 +Copyright 2015-2022 Mike Bostock + +Permission to use, copy, modify, and/or distribute this software for any purpose +with or without fee is hereby granted, provided that the above copyright notice +and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. + +d3-scale@4.0.2 +Copyright 2010-2021 Mike Bostock + +Permission to use, copy, modify, and/or distribute this software for any purpose +with or without fee is hereby granted, provided that the above copyright notice +and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. + +d3-selection@3.0.0 +Copyright 2010-2021 Mike Bostock + +Permission to use, copy, modify, and/or distribute this software for any purpose +with or without fee is hereby granted, provided that the above copyright notice +and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. + +d3-shape@3.2.0 +Copyright 2010-2022 Mike Bostock + +Permission to use, copy, modify, and/or distribute this software for any purpose +with or without fee is hereby granted, provided that the above copyright notice +and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. + +d3-time-format@4.1.0 +Copyright 2010-2021 Mike Bostock + +Permission to use, copy, modify, and/or distribute this software for any purpose +with or without fee is hereby granted, provided that the above copyright notice +and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. + +d3-time@3.1.0 +Copyright 2010-2022 Mike Bostock + +Permission to use, copy, modify, and/or distribute this software for any purpose +with or without fee is hereby granted, provided that the above copyright notice +and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. + +d3-timer@3.0.1 +Copyright 2010-2021 Mike Bostock + +Permission to use, copy, modify, and/or distribute this software for any purpose +with or without fee is hereby granted, provided that the above copyright notice +and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. + +d3-transition@3.0.1 +Copyright 2010-2021 Mike Bostock + +Permission to use, copy, modify, and/or distribute this software for any purpose +with or without fee is hereby granted, provided that the above copyright notice +and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. + +d3-zoom@3.0.0 +Copyright 2010-2021 Mike Bostock + +Permission to use, copy, modify, and/or distribute this software for any purpose +with or without fee is hereby granted, provided that the above copyright notice +and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. + +double-bits@1.1.1 +The MIT License (MIT) + +Copyright (c) 2013 Mikola Lysenko + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +events@3.3.0 +MIT + +Copyright Joyent, Inc. and other Node contributors. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to permit +persons to whom the Software is furnished to do so, subject to the +following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +USE OR OTHER DEALINGS IN THE SOFTWARE. + +extend@3.0.2 +The MIT License (MIT) + +Copyright (c) 2014 Stefan Thomas + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +function-plot@1.26.0 +MIT License + +Copyright (c) 2015 Mauricio Poppe + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +internmap@2.0.3 +Copyright 2021 Mike Bostock + +Permission to use, copy, modify, and/or distribute this software for any purpose +with or without fee is hereby granted, provided that the above copyright notice +and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. + +interval-arithmetic-eval@0.5.3 +MIT License + +Copyright (c) 2015 Mauricio Poppe + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +interval-arithmetic@1.1.3 +Boost Software License - Version 1.0 - August 17th, 2003 + +Permission is hereby granted, free of charge, to any person or organization +obtaining a copy of the software and accompanying documentation covered by +this license (the "Software") to use, reproduce, display, distribute, +execute, and transmit the Software, and to prepare derivative works of the +Software, and to permit third-parties to whom the Software is furnished to +do so, all subject to the following: + +The copyright notices in the Software and this entire statement, including +the above license grant, this restriction and the following disclaimer, +must be included in all copies of the Software, in whole or in part, and +all derivative works of the Software, unless such copies or derivative +works are solely in the form of machine-executable object code generated by +a source language processor. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +math-codegen@0.4.3 +The MIT License (MIT) + +Copyright (c) 2015 Mauricio Poppe + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +mr-parser@0.2.2 +MIT License + +Copyright (c) 2015 Mauricio Poppe + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +nextafter@1.0.0 +The MIT License (MIT) + +Copyright (c) 2013 Mikola Lysenko + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/public/function-plot/1.26.0/function-plot.js b/public/function-plot/1.26.0/function-plot.js new file mode 100644 index 00000000..e1d3ceff --- /dev/null +++ b/public/function-plot/1.26.0/function-plot.js @@ -0,0 +1,6 @@ +(()=>{var Gv=Object.create;var Ao=Object.defineProperty;var Wv=Object.getOwnPropertyDescriptor;var Vv=Object.getOwnPropertyNames;var Zv=Object.getPrototypeOf,Qv=Object.prototype.hasOwnProperty;var p=(t,e)=>()=>(t&&(e=t(t=0)),e);var O=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),rn=(t,e)=>{for(var n in e)Ao(t,n,{get:e[n],enumerable:!0})},Mc=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Vv(e))!Qv.call(t,i)&&i!==n&&Ao(t,i,{get:()=>e[i],enumerable:!(r=Wv(e,i))||r.enumerable});return t};var Tc=(t,e,n)=>(n=t!=null?Gv(Zv(t)):{},Mc(e||!t||!t.__esModule?Ao(n,"default",{value:t,enumerable:!0}):n,t)),it=t=>Mc(Ao({},"__esModule",{value:!0}),t);var Sc=O(()=>{typeof window<"u"&&(function(t,e){try{t.querySelector(":scope body")}catch{["querySelector","querySelectorAll"].forEach(function(r){let i=e[r];e[r]=function(o){if(/(^|,)\s*:scope/.test(o)){let a=this.id;this.id="ID_"+Date.now(),o=o.replace(/((^|,)\s*):scope/g,"$1#"+this.id);let s=t[r](o);return this.id=a,s}else return i.call(this,o)}})}})(window.document,Element.prototype)});function D(t){return function(){return t}}var on=p(()=>{});function Ic(t){return t>1?0:t<-1?xe:Math.acos(t)}function fu(t){return t>=1?ei:t<=-1?-ei:Math.asin(t)}var lu,At,_e,Ec,ke,qt,$,bt,xe,ei,re,Ot=p(()=>{lu=Math.abs,At=Math.atan2,_e=Math.cos,Ec=Math.max,ke=Math.min,qt=Math.sin,$=Math.sqrt,bt=1e-12,xe=Math.PI,ei=xe/2,re=2*xe});function Ac(t){this._+=t[0];for(let e=1,n=t.length;e=0))throw new Error(`invalid digits: ${t}`);if(e>15)return Ac;let n=10**e;return function(r){this._+=r[0];for(let i=1,o=r.length;i{cu=Math.PI,hu=2*cu,En=1e-6,Jv=hu-En;In=class{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=e==null?Ac:Kv(e)}moveTo(e,n){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,n){this._append`L${this._x1=+e},${this._y1=+n}`}quadraticCurveTo(e,n,r,i){this._append`Q${+e},${+n},${this._x1=+r},${this._y1=+i}`}bezierCurveTo(e,n,r,i,o,a){this._append`C${+e},${+n},${+r},${+i},${this._x1=+o},${this._y1=+a}`}arcTo(e,n,r,i,o){if(e=+e,n=+n,r=+r,i=+i,o=+o,o<0)throw new Error(`negative radius: ${o}`);let a=this._x1,s=this._y1,u=r-e,l=i-n,f=a-e,c=s-n,h=f*f+c*c;if(this._x1===null)this._append`M${this._x1=e},${this._y1=n}`;else if(h>En)if(!(Math.abs(c*u-l*f)>En)||!o)this._append`L${this._x1=e},${this._y1=n}`;else{let m=r-a,g=i-s,y=u*u+l*l,M=m*m+g*g,_=Math.sqrt(y),E=Math.sqrt(h),A=o*Math.tan((cu-Math.acos((y+h-M)/(2*_*E)))/2),I=A/E,P=A/_;Math.abs(I-1)>En&&this._append`L${e+I*f},${n+I*c}`,this._append`A${o},${o},0,0,${+(c*m>f*g)},${this._x1=e+P*u},${this._y1=n+P*l}`}}arc(e,n,r,i,o,a){if(e=+e,n=+n,r=+r,a=!!a,r<0)throw new Error(`negative radius: ${r}`);let s=r*Math.cos(i),u=r*Math.sin(i),l=e+s,f=n+u,c=1^a,h=a?i-o:o-i;this._x1===null?this._append`M${l},${f}`:(Math.abs(this._x1-l)>En||Math.abs(this._y1-f)>En)&&this._append`L${l},${f}`,r&&(h<0&&(h=h%hu+hu),h>Jv?this._append`A${r},${r},0,1,${c},${e-s},${n-u}A${r},${r},0,1,${c},${this._x1=l},${this._y1=f}`:h>En&&this._append`A${r},${r},0,${+(h>=cu)},${c},${this._x1=e+r*Math.cos(o)},${this._y1=n+r*Math.sin(o)}`)}rect(e,n,r,i){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+n}h${r=+r}v${+i}h${-r}Z`}toString(){return this._}};Oc.prototype=In.prototype});var kc=p(()=>{Nc()});function Pe(t){let e=3;return t.digits=function(n){if(!arguments.length)return e;if(n==null)e=null;else{let r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);e=r}return t},()=>new In(e)}var rr=p(()=>{kc()});function t1(t){return t.innerRadius}function e1(t){return t.outerRadius}function n1(t){return t.startAngle}function r1(t){return t.endAngle}function i1(t){return t&&t.padAngle}function o1(t,e,n,r,i,o,a,s){var u=n-t,l=r-e,f=a-i,c=s-o,h=c*u-f*l;if(!(h*hd*d+S*S&&(z=V,tt=W),{cx:z,cy:tt,x01:-f,y01:-c,x11:z*(i/P-1),y11:tt*(i/P-1)}}function Pc(){var t=t1,e=e1,n=D(0),r=null,i=n1,o=r1,a=i1,s=null,u=Pe(l);function l(){var f,c,h=+t.apply(this,arguments),m=+e.apply(this,arguments),g=i.apply(this,arguments)-ei,y=o.apply(this,arguments)-ei,M=lu(y-g),_=y>g;if(s||(s=f=u()),mbt))s.moveTo(0,0);else if(M>re-bt)s.moveTo(m*_e(g),m*qt(g)),s.arc(0,0,m,g,y,!_),h>bt&&(s.moveTo(h*_e(y),h*qt(y)),s.arc(0,0,h,y,g,_));else{var E=g,A=y,I=g,P=y,w=M,q=M,z=a.apply(this,arguments)/2,tt=z>bt&&(r?+r.apply(this,arguments):$(h*h+m*m)),V=ke(lu(m-h)/2,+n.apply(this,arguments)),W=V,v=V,T,d;if(tt>bt){var S=fu(tt/h*qt(z)),x=fu(tt/m*qt(z));(w-=S*2)>bt?(S*=_?1:-1,I+=S,P-=S):(w=0,I=P=(g+y)/2),(q-=x*2)>bt?(x*=_?1:-1,E+=x,A-=x):(q=0,E=A=(g+y)/2)}var N=m*_e(E),C=m*qt(E),R=h*_e(P),L=h*qt(P);if(V>bt){var j=m*_e(A),Z=m*qt(A),Pt=h*_e(I),ct=h*qt(I),ht;if(Mbt?v>bt?(T=Oo(Pt,ct,N,C,m,v,_),d=Oo(j,Z,R,L,m,v,_),s.moveTo(T.cx+T.x01,T.cy+T.y01),vbt)||!(w>bt)?s.lineTo(R,L):W>bt?(T=Oo(R,L,j,Z,h,-W,_),d=Oo(N,C,Pt,ct,h,-W,_),s.lineTo(T.cx+T.x01,T.cy+T.y01),W{on();Ot();rr()});function an(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}var Cc,ir=p(()=>{Cc=Array.prototype.slice});function Lc(t){this._context=t}function sn(t){return new Lc(t)}var ni=p(()=>{Lc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e);break}}}});function or(t){return t[0]}function ar(t){return t[1]}var No=p(()=>{});function sr(t,e){var n=D(!0),r=null,i=sn,o=null,a=Pe(s);t=typeof t=="function"?t:t===void 0?or:D(t),e=typeof e=="function"?e:e===void 0?ar:D(e);function s(u){var l,f=(u=an(u)).length,c,h=!1,m;for(r==null&&(o=i(m=a())),l=0;l<=f;++l)!(l{ir();on();ni();rr();No()});function Po(t,e,n){var r=null,i=D(!0),o=null,a=sn,s=null,u=Pe(l);t=typeof t=="function"?t:t===void 0?or:D(+t),e=typeof e=="function"?e:e===void 0?D(0):D(+e),n=typeof n=="function"?n:n===void 0?ar:D(+n);function l(c){var h,m,g,y=(c=an(c)).length,M,_=!1,E,A=new Array(y),I=new Array(y);for(o==null&&(s=a(E=u())),h=0;h<=y;++h){if(!(h=m;--g)s.point(A[g],I[g]);s.lineEnd(),s.areaEnd()}_&&(A[h]=+t(M,h,c),I[h]=+e(M,h,c),s.point(r?+r(M,h,c):A[h],n?+n(M,h,c):I[h]))}if(E)return s=null,E+""||null}function f(){return sr().defined(i).curve(a).context(o)}return l.x=function(c){return arguments.length?(t=typeof c=="function"?c:D(+c),r=null,l):t},l.x0=function(c){return arguments.length?(t=typeof c=="function"?c:D(+c),l):t},l.x1=function(c){return arguments.length?(r=c==null?null:typeof c=="function"?c:D(+c),l):r},l.y=function(c){return arguments.length?(e=typeof c=="function"?c:D(+c),n=null,l):e},l.y0=function(c){return arguments.length?(e=typeof c=="function"?c:D(+c),l):e},l.y1=function(c){return arguments.length?(n=c==null?null:typeof c=="function"?c:D(+c),l):n},l.lineX0=l.lineY0=function(){return f().x(t).y(e)},l.lineY1=function(){return f().x(t).y(n)},l.lineX1=function(){return f().x(r).y(e)},l.defined=function(c){return arguments.length?(i=typeof c=="function"?c:D(!!c),l):i},l.curve=function(c){return arguments.length?(a=c,o!=null&&(s=a(o)),l):a},l.context=function(c){return arguments.length?(c==null?o=s=null:s=a(o=c),l):o},l}var pu=p(()=>{ir();on();ni();ko();rr();No()});function Dc(t,e){return et?1:e>=t?0:NaN}var Rc=p(()=>{});function Hc(t){return t}var Fc=p(()=>{});function Yc(){var t=Hc,e=Dc,n=null,r=D(0),i=D(re),o=D(0);function a(s){var u,l=(s=an(s)).length,f,c,h=0,m=new Array(l),g=new Array(l),y=+r.apply(this,arguments),M=Math.min(re,Math.max(-re,i.apply(this,arguments)-y)),_,E=Math.min(Math.abs(M)/l,o.apply(this,arguments)),A=E*(M<0?-1:1),I;for(u=0;u0&&(h+=I);for(e!=null?m.sort(function(P,w){return e(g[P],g[w])}):n!=null&&m.sort(function(P,w){return n(s[P],s[w])}),u=0,c=h?(M-l*A)/h:0;u0?I*c:0)+A,g[f]={data:s[f],index:u,value:I,startAngle:y,endAngle:_,padAngle:E};return g}return a.value=function(s){return arguments.length?(t=typeof s=="function"?s:D(+s),a):t},a.sortValues=function(s){return arguments.length?(e=s,n=null,a):e},a.sort=function(s){return arguments.length?(n=s,e=null,a):n},a.startAngle=function(s){return arguments.length?(r=typeof s=="function"?s:D(+s),a):r},a.endAngle=function(s){return arguments.length?(i=typeof s=="function"?s:D(+s),a):i},a.padAngle=function(s){return arguments.length?(o=typeof s=="function"?s:D(+s),a):o},a}var $c=p(()=>{ir();on();Rc();Fc();Ot()});function zc(t){this._curve=t}function ur(t){function e(n){return new zc(t(n))}return e._curve=t,e}var qo,mu=p(()=>{ni();qo=ur(sn);zc.prototype={areaStart:function(){this._curve.areaStart()},areaEnd:function(){this._curve.areaEnd()},lineStart:function(){this._curve.lineStart()},lineEnd:function(){this._curve.lineEnd()},point:function(t,e){this._curve.point(e*Math.sin(t),e*-Math.cos(t))}}});function lr(t){var e=t.curve;return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t.curve=function(n){return arguments.length?e(ur(n)):e()._curve},t}function du(){return lr(sr().curve(qo))}var gu=p(()=>{mu();ko()});function yu(){var t=Po().curve(qo),e=t.curve,n=t.lineX0,r=t.lineX1,i=t.lineY0,o=t.lineY1;return t.angle=t.x,delete t.x,t.startAngle=t.x0,delete t.x0,t.endAngle=t.x1,delete t.x1,t.radius=t.y,delete t.y,t.innerRadius=t.y0,delete t.y0,t.outerRadius=t.y1,delete t.y1,t.lineStartAngle=function(){return lr(n())},delete t.lineX0,t.lineEndAngle=function(){return lr(r())},delete t.lineX1,t.lineInnerRadius=function(){return lr(i())},delete t.lineY0,t.lineOuterRadius=function(){return lr(o())},delete t.lineY1,t.curve=function(a){return arguments.length?e(ur(a)):e()._curve},t}var Uc=p(()=>{mu();pu();gu()});function An(t,e){return[(e=+e)*Math.cos(t-=Math.PI/2),e*Math.sin(t)]}var _u=p(()=>{});function Lo(t){return new Co(t,!0)}function Do(t){return new Co(t,!1)}function jc(t){return new xu(t)}var Co,xu,vu=p(()=>{_u();Co=class{constructor(e,n){this._context=e,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,n){switch(e=+e,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(e,n):this._context.moveTo(e,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,n,e,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,e,this._y0,e,n);break}}this._x0=e,this._y0=n}},xu=class{constructor(e){this._context=e}lineStart(){this._point=0}lineEnd(){}point(e,n){if(e=+e,n=+n,this._point===0)this._point=1;else{let r=An(this._x0,this._y0),i=An(this._x0,this._y0=(this._y0+n)/2),o=An(e,this._y0),a=An(e,n);this._context.moveTo(...r),this._context.bezierCurveTo(...i,...o,...a)}this._x0=e,this._y0=n}}});function a1(t){return t.source}function s1(t){return t.target}function ri(t){let e=a1,n=s1,r=or,i=ar,o=null,a=null,s=Pe(u);function u(){let l,f=Cc.call(arguments),c=e.apply(this,f),h=n.apply(this,f);if(o==null&&(a=t(l=s())),a.lineStart(),f[0]=c,a.point(+r.apply(this,f),+i.apply(this,f)),f[0]=h,a.point(+r.apply(this,f),+i.apply(this,f)),a.lineEnd(),l)return a=null,l+""||null}return u.source=function(l){return arguments.length?(e=l,u):e},u.target=function(l){return arguments.length?(n=l,u):n},u.x=function(l){return arguments.length?(r=typeof l=="function"?l:D(+l),u):r},u.y=function(l){return arguments.length?(i=typeof l=="function"?l:D(+l),u):i},u.context=function(l){return arguments.length?(l==null?o=a=null:a=t(o=l),u):o},u}function Bc(){return ri(Lo)}function Xc(){return ri(Do)}function Gc(){let t=ri(jc);return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t}var Wc=p(()=>{ir();on();vu();rr();No()});var u1,Ro,wu=p(()=>{Ot();u1=$(3),Ro={draw(t,e){let n=$(e+ke(e/28,.75))*.59436,r=n/2,i=r*u1;t.moveTo(0,n),t.lineTo(0,-n),t.moveTo(-i,-r),t.lineTo(i,r),t.moveTo(-i,r),t.lineTo(i,-r)}}});var fr,bu=p(()=>{Ot();fr={draw(t,e){let n=$(e/xe);t.moveTo(n,0),t.arc(0,0,n,0,re)}}});var Ho,Mu=p(()=>{Ot();Ho={draw(t,e){let n=$(e/5)/2;t.moveTo(-3*n,-n),t.lineTo(-n,-n),t.lineTo(-n,-3*n),t.lineTo(n,-3*n),t.lineTo(n,-n),t.lineTo(3*n,-n),t.lineTo(3*n,n),t.lineTo(n,n),t.lineTo(n,3*n),t.lineTo(-n,3*n),t.lineTo(-n,n),t.lineTo(-3*n,n),t.closePath()}}});var Vc,l1,Fo,Tu=p(()=>{Ot();Vc=$(1/3),l1=Vc*2,Fo={draw(t,e){let n=$(e/l1),r=n*Vc;t.moveTo(0,-n),t.lineTo(r,0),t.lineTo(0,n),t.lineTo(-r,0),t.closePath()}}});var Yo,Su=p(()=>{Ot();Yo={draw(t,e){let n=$(e)*.62625;t.moveTo(0,-n),t.lineTo(n,0),t.lineTo(0,n),t.lineTo(-n,0),t.closePath()}}});var $o,Eu=p(()=>{Ot();$o={draw(t,e){let n=$(e-ke(e/7,2))*.87559;t.moveTo(-n,0),t.lineTo(n,0),t.moveTo(0,n),t.lineTo(0,-n)}}});var zo,Iu=p(()=>{Ot();zo={draw(t,e){let n=$(e),r=-n/2;t.rect(r,r,n,n)}}});var Uo,Au=p(()=>{Ot();Uo={draw(t,e){let n=$(e)*.4431;t.moveTo(n,n),t.lineTo(n,-n),t.lineTo(-n,-n),t.lineTo(-n,n),t.closePath()}}});var f1,Zc,c1,h1,jo,Ou=p(()=>{Ot();f1=.8908130915292852,Zc=qt(xe/10)/qt(7*xe/10),c1=qt(re/10)*Zc,h1=-_e(re/10)*Zc,jo={draw(t,e){let n=$(e*f1),r=c1*n,i=h1*n;t.moveTo(0,-n),t.lineTo(r,i);for(let o=1;o<5;++o){let a=re*o/5,s=_e(a),u=qt(a);t.lineTo(u*n,-s*n),t.lineTo(s*r-u*i,u*r+s*i)}t.closePath()}}});var Nu,Bo,ku=p(()=>{Ot();Nu=$(3),Bo={draw(t,e){let n=-$(e/(Nu*3));t.moveTo(0,n*2),t.lineTo(-Nu*n,-n),t.lineTo(Nu*n,-n),t.closePath()}}});var p1,Xo,Pu=p(()=>{Ot();p1=$(3),Xo={draw(t,e){let n=$(e)*.6824,r=n/2,i=n*p1/2;t.moveTo(0,-n),t.lineTo(i,r),t.lineTo(-i,r),t.closePath()}}});var ie,oe,qu,m1,Go,Cu=p(()=>{Ot();ie=-.5,oe=$(3)/2,qu=1/$(12),m1=(qu/2+1)*3,Go={draw(t,e){let n=$(e/m1),r=n/2,i=n*qu,o=r,a=n*qu+n,s=-o,u=a;t.moveTo(r,i),t.lineTo(o,a),t.lineTo(s,u),t.lineTo(ie*r-oe*i,oe*r+ie*i),t.lineTo(ie*o-oe*a,oe*o+ie*a),t.lineTo(ie*s-oe*u,oe*s+ie*u),t.lineTo(ie*r+oe*i,ie*i-oe*r),t.lineTo(ie*o+oe*a,ie*a-oe*o),t.lineTo(ie*s+oe*u,ie*u-oe*s),t.closePath()}}});var ii,Lu=p(()=>{Ot();ii={draw(t,e){let n=$(e-ke(e/6,1.7))*.6189;t.moveTo(-n,-n),t.lineTo(n,n),t.moveTo(-n,n),t.lineTo(n,-n)}}});function Ru(t,e){let n=null,r=Pe(i);t=typeof t=="function"?t:D(t||fr),e=typeof e=="function"?e:D(e===void 0?64:+e);function i(){let o;if(n||(n=o=r()),t.apply(this,arguments).draw(n,+e.apply(this,arguments)),o)return n=null,o+""||null}return i.type=function(o){return arguments.length?(t=typeof o=="function"?o:D(o),i):t},i.size=function(o){return arguments.length?(e=typeof o=="function"?o:D(+o),i):e},i.context=function(o){return arguments.length?(n=o??null,i):n},i}var Du,Qc,Jc=p(()=>{on();rr();wu();bu();Mu();Tu();Su();Eu();Iu();Au();Ou();ku();Pu();Cu();Lu();Du=[fr,Ho,Fo,zo,jo,Bo,Go],Qc=[fr,$o,ii,Xo,Ro,Uo,Yo]});function ae(){}var oi=p(()=>{});function cr(t,e,n){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+n)/6)}function ai(t){this._context=t}function Kc(t){return new ai(t)}var si=p(()=>{ai.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:cr(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:cr(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}}});function th(t){this._context=t}function eh(t){return new th(t)}var nh=p(()=>{oi();si();th.prototype={areaStart:ae,areaEnd:ae,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:cr(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}}});function rh(t){this._context=t}function ih(t){return new rh(t)}var oh=p(()=>{si();rh.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+t)/6,r=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:cr(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}}});function ah(t,e){this._basis=new ai(t),this._beta=e}var sh,uh=p(()=>{si();ah.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,e=this._y,n=t.length-1;if(n>0)for(var r=t[0],i=e[0],o=t[n]-r,a=e[n]-i,s=-1,u;++s<=n;)u=s/n,this._basis.point(this._beta*t[s]+(1-this._beta)*(r+u*o),this._beta*e[s]+(1-this._beta)*(i+u*a));this._x=this._y=null,this._basis.lineEnd()},point:function(t,e){this._x.push(+t),this._y.push(+e)}};sh=(function t(e){function n(r){return e===1?new ai(r):new ah(r,e)}return n.beta=function(r){return t(+r)},n})(.85)});function hr(t,e,n){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-e),t._y2+t._k*(t._y1-n),t._x2,t._y2)}function Wo(t,e){this._context=t,this._k=(1-e)/6}var lh,ui=p(()=>{Wo.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:hr(this,this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2,this._x1=t,this._y1=e;break;case 2:this._point=3;default:hr(this,t,e);break}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};lh=(function t(e){function n(r){return new Wo(r,e)}return n.tension=function(r){return t(+r)},n})(0)});function Vo(t,e){this._context=t,this._k=(1-e)/6}var fh,Hu=p(()=>{oi();ui();Vo.prototype={areaStart:ae,areaEnd:ae,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:hr(this,t,e);break}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};fh=(function t(e){function n(r){return new Vo(r,e)}return n.tension=function(r){return t(+r)},n})(0)});function Zo(t,e){this._context=t,this._k=(1-e)/6}var ch,Fu=p(()=>{ui();Zo.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:hr(this,t,e);break}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};ch=(function t(e){function n(r){return new Zo(r,e)}return n.tension=function(r){return t(+r)},n})(0)});function li(t,e,n){var r=t._x1,i=t._y1,o=t._x2,a=t._y2;if(t._l01_a>bt){var s=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,u=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*s-t._x0*t._l12_2a+t._x2*t._l01_2a)/u,i=(i*s-t._y0*t._l12_2a+t._y2*t._l01_2a)/u}if(t._l23_a>bt){var l=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,f=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*l+t._x1*t._l23_2a-e*t._l12_2a)/f,a=(a*l+t._y1*t._l23_2a-n*t._l12_2a)/f}t._context.bezierCurveTo(r,i,o,a,t._x2,t._y2)}function hh(t,e){this._context=t,this._alpha=e}var ph,Qo=p(()=>{Ot();ui();hh.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3;default:li(this,t,e);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};ph=(function t(e){function n(r){return e?new hh(r,e):new Wo(r,0)}return n.alpha=function(r){return t(+r)},n})(.5)});function mh(t,e){this._context=t,this._alpha=e}var dh,gh=p(()=>{Hu();oi();Qo();mh.prototype={areaStart:ae,areaEnd:ae,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:li(this,t,e);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};dh=(function t(e){function n(r){return e?new mh(r,e):new Vo(r,0)}return n.alpha=function(r){return t(+r)},n})(.5)});function yh(t,e){this._context=t,this._alpha=e}var _h,xh=p(()=>{Fu();Qo();yh.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:li(this,t,e);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};_h=(function t(e){function n(r){return e?new yh(r,e):new Zo(r,0)}return n.alpha=function(r){return t(+r)},n})(.5)});function vh(t){this._context=t}function wh(t){return new vh(t)}var bh=p(()=>{oi();vh.prototype={areaStart:ae,areaEnd:ae,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,e){t=+t,e=+e,this._point?this._context.lineTo(t,e):(this._point=1,this._context.moveTo(t,e))}}});function Mh(t){return t<0?-1:1}function Th(t,e,n){var r=t._x1-t._x0,i=e-t._x1,o=(t._y1-t._y0)/(r||i<0&&-0),a=(n-t._y1)/(i||r<0&&-0),s=(o*i+a*r)/(r+i);return(Mh(o)+Mh(a))*Math.min(Math.abs(o),Math.abs(a),.5*Math.abs(s))||0}function Sh(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function Yu(t,e,n){var r=t._x0,i=t._y0,o=t._x1,a=t._y1,s=(o-r)/3;t._context.bezierCurveTo(r+s,i+s*e,o-s,a-s*n,o,a)}function Jo(t){this._context=t}function Eh(t){this._context=new Ih(t)}function Ih(t){this._context=t}function Ah(t){return new Jo(t)}function Oh(t){return new Eh(t)}var Nh=p(()=>{Jo.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Yu(this,this._t0,Sh(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var n=NaN;if(t=+t,e=+e,!(t===this._x1&&e===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,Yu(this,Sh(this,n=Th(this,t,e)),n);break;default:Yu(this,this._t0,n=Th(this,t,e));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}};(Eh.prototype=Object.create(Jo.prototype)).point=function(t,e){Jo.prototype.point.call(this,e,t)};Ih.prototype={moveTo:function(t,e){this._context.moveTo(e,t)},closePath:function(){this._context.closePath()},lineTo:function(t,e){this._context.lineTo(e,t)},bezierCurveTo:function(t,e,n,r,i,o){this._context.bezierCurveTo(e,t,r,n,o,i)}}});function Ph(t){this._context=t}function kh(t){var e,n=t.length-1,r,i=new Array(n),o=new Array(n),a=new Array(n);for(i[0]=0,o[0]=2,a[0]=t[0]+2*t[1],e=1;e=0;--e)i[e]=(a[e]-i[e+1])/o[e];for(o[n-1]=(t[n]+i[n-1])/2,e=0;e{Ph.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,e=this._y,n=t.length;if(n)if(this._line?this._context.lineTo(t[0],e[0]):this._context.moveTo(t[0],e[0]),n===2)this._context.lineTo(t[1],e[1]);else for(var r=kh(t),i=kh(e),o=0,a=1;a{Ko.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var n=this._x*(1-this._t)+t*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,e)}break}}this._x=t,this._y=e}}});function ve(t,e){if((a=t.length)>1)for(var n=1,r,i,o=t[e[0]],a,s=o.length;n{});function we(t){for(var e=t.length,n=new Array(e);--e>=0;)n[e]=e;return n}var mr=p(()=>{});function d1(t,e){return t[e]}function g1(t){let e=[];return e.key=t,e}function Fh(){var t=D([]),e=we,n=ve,r=d1;function i(o){var a=Array.from(t.apply(this,arguments),g1),s,u=a.length,l=-1,f;for(let c of o)for(s=0,++l;s{ir();on();pr();mr()});function $h(t,e){if((r=t.length)>0){for(var n,r,i=0,o=t[0].length,a;i{pr()});function Uh(t,e){if((u=t.length)>0)for(var n,r=0,i,o,a,s,u,l=t[e[0]].length;r0?(i[0]=a,i[1]=a+=o):o<0?(i[1]=s,i[0]=s+=o):(i[0]=0,i[1]=o)}var jh=p(()=>{});function Bh(t,e){if((i=t.length)>0){for(var n=0,r=t[e[0]],i,o=r.length;n{pr()});function Gh(t,e){if(!(!((a=t.length)>0)||!((o=(i=t[e[0]]).length)>0))){for(var n=0,r=1,i,o,a;r{pr()});function ta(t){var e=t.map(y1);return we(t).sort(function(n,r){return e[n]-e[r]})}function y1(t){for(var e=-1,n=0,r=t.length,i,o=-1/0;++eo&&(o=i,n=e);return n}var $u=p(()=>{mr()});function ea(t){var e=t.map(zu);return we(t).sort(function(n,r){return e[n]-e[r]})}function zu(t){for(var e=0,n=-1,r=t.length,i;++n{mr()});function Vh(t){return ea(t).reverse()}var Zh=p(()=>{na()});function Qh(t){var e=t.length,n,r,i=t.map(zu),o=ta(t),a=0,s=0,u=[],l=[];for(n=0;n{$u();na()});function Kh(t){return we(t).reverse()}var tp=p(()=>{mr()});var fi={};rn(fi,{arc:()=>Pc,area:()=>Po,areaRadial:()=>yu,curveBasis:()=>Kc,curveBasisClosed:()=>eh,curveBasisOpen:()=>ih,curveBumpX:()=>Lo,curveBumpY:()=>Do,curveBundle:()=>sh,curveCardinal:()=>lh,curveCardinalClosed:()=>fh,curveCardinalOpen:()=>ch,curveCatmullRom:()=>ph,curveCatmullRomClosed:()=>dh,curveCatmullRomOpen:()=>_h,curveLinear:()=>sn,curveLinearClosed:()=>wh,curveMonotoneX:()=>Ah,curveMonotoneY:()=>Oh,curveNatural:()=>qh,curveStep:()=>Lh,curveStepAfter:()=>Rh,curveStepBefore:()=>Dh,line:()=>sr,lineRadial:()=>du,link:()=>ri,linkHorizontal:()=>Bc,linkRadial:()=>Gc,linkVertical:()=>Xc,pie:()=>Yc,pointRadial:()=>An,radialArea:()=>yu,radialLine:()=>du,stack:()=>Fh,stackOffsetDiverging:()=>Uh,stackOffsetExpand:()=>$h,stackOffsetNone:()=>ve,stackOffsetSilhouette:()=>Bh,stackOffsetWiggle:()=>Gh,stackOrderAppearance:()=>ta,stackOrderAscending:()=>ea,stackOrderDescending:()=>Vh,stackOrderInsideOut:()=>Qh,stackOrderNone:()=>we,stackOrderReverse:()=>Kh,symbol:()=>Ru,symbolAsterisk:()=>Ro,symbolCircle:()=>fr,symbolCross:()=>Ho,symbolDiamond:()=>Fo,symbolDiamond2:()=>Yo,symbolPlus:()=>$o,symbolSquare:()=>zo,symbolSquare2:()=>Uo,symbolStar:()=>jo,symbolTimes:()=>ii,symbolTriangle:()=>Bo,symbolTriangle2:()=>Xo,symbolWye:()=>Go,symbolX:()=>ii,symbols:()=>Du,symbolsFill:()=>Du,symbolsStroke:()=>Qc});var ci=p(()=>{qc();pu();ko();$c();Uc();gu();_u();Wc();Jc();wu();bu();Mu();Tu();Su();Eu();Iu();Au();Ou();ku();Pu();Cu();Lu();nh();oh();si();vu();uh();Hu();Fu();ui();gh();xh();Qo();bh();ni();Nh();Ch();Hh();Yh();zh();jh();pr();Xh();Wh();$u();na();Zh();Jh();mr();tp()});function ep(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function On(t,e){if(!isFinite(t)||t===0)return null;var n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"),r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}var hi=p(()=>{});function qe(t){return t=On(Math.abs(t)),t?t[1]:NaN}var pi=p(()=>{hi()});function np(t,e){return function(n,r){for(var i=n.length,o=[],a=0,s=t[0],u=0;i>0&&s>0&&(u+s+1>r&&(s=Math.max(1,r-u)),o.push(n.substring(i-=s,i+s)),!((u+=s+1)>r));)s=t[a=(a+1)%t.length];return o.reverse().join(e)}}var rp=p(()=>{});function ip(t){return function(e){return e.replace(/[0-9]/g,function(n){return t[+n]})}}var op=p(()=>{});function be(t){if(!(e=_1.exec(t)))throw new Error("invalid format: "+t);var e;return new mi({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}function mi(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}var _1,Uu=p(()=>{_1=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;be.prototype=mi.prototype;mi.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type}});function ap(t){t:for(var e=t.length,n=1,r=-1,i;n0&&(r=0);break}return r>0?t.slice(0,r)+t.slice(i+1):t}var sp=p(()=>{});function up(t,e){var n=On(t,e);if(!n)return di=void 0,t.toPrecision(e);var r=n[0],i=n[1],o=i-(di=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,a=r.length;return o===a?r:o>a?r+new Array(o-a+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+On(t,Math.max(0,e+o-1))[0]}var di,ju=p(()=>{hi()});function Bu(t,e){var n=On(t,e);if(!n)return t+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}var lp=p(()=>{hi()});var Xu,fp=p(()=>{hi();ju();lp();Xu={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:ep,e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>Bu(t*100,e),r:Bu,s:up,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)}});function Gu(t){return t}var cp=p(()=>{});function ra(t){var e=t.grouping===void 0||t.thousands===void 0?Gu:np(hp.call(t.grouping,Number),t.thousands+""),n=t.currency===void 0?"":t.currency[0]+"",r=t.currency===void 0?"":t.currency[1]+"",i=t.decimal===void 0?".":t.decimal+"",o=t.numerals===void 0?Gu:ip(hp.call(t.numerals,String)),a=t.percent===void 0?"%":t.percent+"",s=t.minus===void 0?"\u2212":t.minus+"",u=t.nan===void 0?"NaN":t.nan+"";function l(c,h){c=be(c);var m=c.fill,g=c.align,y=c.sign,M=c.symbol,_=c.zero,E=c.width,A=c.comma,I=c.precision,P=c.trim,w=c.type;w==="n"?(A=!0,w="g"):Xu[w]||(I===void 0&&(I=12),P=!0,w="g"),(_||m==="0"&&g==="=")&&(_=!0,m="0",g="=");var q=(h&&h.prefix!==void 0?h.prefix:"")+(M==="$"?n:M==="#"&&/[boxX]/.test(w)?"0"+w.toLowerCase():""),z=(M==="$"?r:/[%p]/.test(w)?a:"")+(h&&h.suffix!==void 0?h.suffix:""),tt=Xu[w],V=/[defgprs%]/.test(w);I=I===void 0?6:/[gprs]/.test(w)?Math.max(1,Math.min(21,I)):Math.max(0,Math.min(20,I));function W(v){var T=q,d=z,S,x,N;if(w==="c")d=tt(v)+d,v="";else{v=+v;var C=v<0||1/v<0;if(v=isNaN(v)?u:tt(Math.abs(v),I),P&&(v=ap(v)),C&&+v==0&&y!=="+"&&(C=!1),T=(C?y==="("?y:s:y==="-"||y==="("?"":y)+T,d=(w==="s"&&!isNaN(v)&&di!==void 0?pp[8+di/3]:"")+d+(C&&y==="("?")":""),V){for(S=-1,x=v.length;++SN||N>57){d=(N===46?i+v.slice(S+1):v.slice(S))+d,v=v.slice(0,S);break}}}A&&!_&&(v=e(v,1/0));var R=T.length+v.length+d.length,L=R>1)+T+v+d+L.slice(R);break;default:v=L+T+v+d;break}return o(v)}return W.toString=function(){return c+""},W}function f(c,h){var m=Math.max(-8,Math.min(8,Math.floor(qe(h)/3)))*3,g=Math.pow(10,-m),y=l((c=be(c),c.type="f",c),{suffix:pp[8+m/3]});return function(M){return y(g*M)}}return{format:l,formatPrefix:f}}var hp,pp,Wu=p(()=>{pi();rp();op();Uu();sp();fp();ju();cp();hp=Array.prototype.map,pp=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"]});function oa(t){return ia=ra(t),Nn=ia.format,gi=ia.formatPrefix,ia}var ia,Nn,gi,mp=p(()=>{Wu();oa({thousands:",",grouping:[3],currency:["$",""]})});function aa(t){return Math.max(0,-qe(Math.abs(t)))}var dp=p(()=>{pi()});function sa(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(qe(e)/3)))*3-qe(Math.abs(t)))}var gp=p(()=>{pi()});function ua(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,qe(e)-qe(t))+1}var yp=p(()=>{pi()});var Vu={};rn(Vu,{FormatSpecifier:()=>mi,format:()=>Nn,formatDefaultLocale:()=>oa,formatLocale:()=>ra,formatPrefix:()=>gi,formatSpecifier:()=>be,precisionFixed:()=>aa,precisionPrefix:()=>sa,precisionRound:()=>ua});var yi=p(()=>{mp();Wu();Uu();dp();gp();yp()});function Ft(t,e){return t==null||e==null?NaN:te?1:t>=e?0:NaN}var _i=p(()=>{});function Zu(t,e){return t==null||e==null?NaN:et?1:e>=t?0:NaN}var _p=p(()=>{});function kn(t){let e,n,r;t.length!==2?(e=Ft,n=(s,u)=>Ft(t(s),u),r=(s,u)=>t(s)-u):(e=t===Ft||t===Zu?t:x1,n=t,r=t);function i(s,u,l=0,f=s.length){if(l>>1;n(s[c],u)<0?l=c+1:f=c}while(l>>1;n(s[c],u)<=0?l=c+1:f=c}while(ll&&r(s[c-1],u)>-r(s[c],u)?c-1:c}return{left:i,center:a,right:o}}function x1(){return 0}var Qu=p(()=>{_i();_p()});function xi(t){return t===null?NaN:+t}function*xp(t,e){if(e===void 0)for(let n of t)n!=null&&(n=+n)>=n&&(yield n);else{let n=-1;for(let r of t)(r=e(r,++n,t))!=null&&(r=+r)>=r&&(yield r)}}var Ju=p(()=>{});var vp,wp,v1,w1,Me,bp=p(()=>{_i();Qu();Ju();vp=kn(Ft),wp=vp.right,v1=vp.left,w1=kn(xi).center,Me=wp});function Mp({_intern:t,_key:e},n){let r=e(n);return t.has(r)?t.get(r):n}function b1({_intern:t,_key:e},n){let r=e(n);return t.has(r)?t.get(r):(t.set(r,n),n)}function M1({_intern:t,_key:e},n){let r=e(n);return t.has(r)&&(n=t.get(r),t.delete(r)),n}function T1(t){return t!==null&&typeof t=="object"?t.valueOf():t}var dr,Tp=p(()=>{dr=class extends Map{constructor(e,n=T1){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),e!=null)for(let[r,i]of e)this.set(r,i)}get(e){return super.get(Mp(this,e))}has(e){return super.has(Mp(this,e))}set(e,n){return super.set(b1(this,e),n)}delete(e){return super.delete(M1(this,e))}}});function Sp(t=Ft){if(t===Ft)return Ku;if(typeof t!="function")throw new TypeError("compare is not a function");return(e,n)=>{let r=t(e,n);return r||r===0?r:(t(n,n)===0)-(t(e,e)===0)}}function Ku(t,e){return(t==null||!(t>=t))-(e==null||!(e>=e))||(te?1:0)}var Ep=p(()=>{_i()});function la(t,e,n){let r=(e-t)/Math.max(0,n),i=Math.floor(Math.log10(r)),o=r/Math.pow(10,i),a=o>=S1?10:o>=E1?5:o>=I1?2:1,s,u,l;return i<0?(l=Math.pow(10,-i)/a,s=Math.round(t*l),u=Math.round(e*l),s/le&&--u,l=-l):(l=Math.pow(10,i)*a,s=Math.round(t/l),u=Math.round(e/l),s*le&&--u),u0))return[];if(t===e)return[t];let r=e=i))return[];let s=o-i+1,u=new Array(s);if(r)if(a<0)for(let l=0;l{S1=Math.sqrt(50),E1=Math.sqrt(10),I1=Math.sqrt(2)});function fa(t,e){let n;if(e===void 0)for(let r of t)r!=null&&(n=r)&&(n=r);else{let r=-1;for(let i of t)(i=e(i,++r,t))!=null&&(n=i)&&(n=i)}return n}var Ap=p(()=>{});function ca(t,e){let n;if(e===void 0)for(let r of t)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let i of t)(i=e(i,++r,t))!=null&&(n>i||n===void 0&&i>=i)&&(n=i)}return n}var Op=p(()=>{});function ha(t,e,n=0,r=1/0,i){if(e=Math.floor(e),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(t.length-1,r)),!(n<=e&&e<=r))return t;for(i=i===void 0?Ku:Sp(i);r>n;){if(r-n>600){let u=r-n+1,l=e-n+1,f=Math.log(u),c=.5*Math.exp(2*f/3),h=.5*Math.sqrt(f*c*(u-c)/u)*(l-u/2<0?-1:1),m=Math.max(n,Math.floor(e-l*c/u+h)),g=Math.min(r,Math.floor(e+(u-l)*c/u+h));ha(t,e,m,g,i)}let o=t[e],a=n,s=r;for(wi(t,n,e),i(t[r],o)>0&&wi(t,n,r);a0;)--s}i(t[n],o)===0?wi(t,n,s):(++s,wi(t,s,r)),s<=e&&(n=s+1),e<=s&&(r=s-1)}return t}function wi(t,e,n){let r=t[e];t[e]=t[n],t[n]=r}var Np=p(()=>{Ep()});function pa(t,e,n){if(t=Float64Array.from(xp(t,n)),!(!(r=t.length)||isNaN(e=+e))){if(e<=0||r<2)return ca(t);if(e>=1)return fa(t);var r,i=(r-1)*e,o=Math.floor(i),a=fa(ha(t,o).subarray(0,o+1)),s=ca(t.subarray(o+1));return a+(s-a)*(i-o)}}function tl(t,e,n=xi){if(!(!(r=t.length)||isNaN(e=+e))){if(e<=0||r<2)return+n(t[0],0,t);if(e>=1)return+n(t[r-1],r-1,t);var r,i=(r-1)*e,o=Math.floor(i),a=+n(t[o],o,t),s=+n(t[o+1],o+1,t);return a+(s-a)*(i-o)}}var kp=p(()=>{Ap();Op();Np();Ju()});function ma(t,e,n){t=+t,e=+e,n=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((e-t)/n))|0,o=new Array(i);++r{});var se=p(()=>{bp();_i();Qu();kp();Pp();Ip();Tp()});function ut(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t);break}return this}function ue(t,e){switch(arguments.length){case 0:break;case 1:{typeof t=="function"?this.interpolator(t):this.range(t);break}default:{this.domain(t),typeof e=="function"?this.interpolator(e):this.range(e);break}}return this}var Ct=p(()=>{});function yr(){var t=new dr,e=[],n=[],r=da;function i(o){let a=t.get(o);if(a===void 0){if(r!==da)return r;t.set(o,a=e.push(o)-1)}return n[a%n.length]}return i.domain=function(o){if(!arguments.length)return e.slice();e=[],t=new dr;for(let a of o)t.has(a)||t.set(a,e.push(a)-1);return i},i.range=function(o){return arguments.length?(n=Array.from(o),i):n.slice()},i.unknown=function(o){return arguments.length?(r=o,i):r},i.copy=function(){return yr(e,n).unknown(r)},ut.apply(i,arguments),i}var da,el=p(()=>{se();Ct();da=Symbol("implicit")});function bi(){var t=yr().unknown(void 0),e=t.domain,n=t.range,r=0,i=1,o,a,s=!1,u=0,l=0,f=.5;delete t.unknown;function c(){var h=e().length,m=i{se();Ct();el()});function je(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function un(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}var ga=p(()=>{});function Le(){}function Rp(){return this.rgb().formatHex()}function L1(){return this.rgb().formatHex8()}function D1(){return jp(this).formatHsl()}function Hp(){return this.rgb().formatRgb()}function le(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=A1.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?Fp(e):n===3?new dt(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?ya(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?ya(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=O1.exec(t))?new dt(e[1],e[2],e[3],1):(e=N1.exec(t))?new dt(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=k1.exec(t))?ya(e[1],e[2],e[3],e[4]):(e=P1.exec(t))?ya(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=q1.exec(t))?zp(e[1],e[2]/100,e[3]/100,1):(e=C1.exec(t))?zp(e[1],e[2]/100,e[3]/100,e[4]):Dp.hasOwnProperty(t)?Fp(Dp[t]):t==="transparent"?new dt(NaN,NaN,NaN,0):null}function Fp(t){return new dt(t>>16&255,t>>8&255,t&255,1)}function ya(t,e,n,r){return r<=0&&(t=e=n=NaN),new dt(t,e,n,r)}function Ti(t){return t instanceof Le||(t=le(t)),t?(t=t.rgb(),new dt(t.r,t.g,t.b,t.opacity)):new dt}function Dn(t,e,n,r){return arguments.length===1?Ti(t):new dt(t,e,n,r??1)}function dt(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function Yp(){return`#${qn(this.r)}${qn(this.g)}${qn(this.b)}`}function R1(){return`#${qn(this.r)}${qn(this.g)}${qn(this.b)}${qn((isNaN(this.opacity)?1:this.opacity)*255)}`}function $p(){let t=xa(this.opacity);return`${t===1?"rgb(":"rgba("}${Cn(this.r)}, ${Cn(this.g)}, ${Cn(this.b)}${t===1?")":`, ${t})`}`}function xa(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Cn(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function qn(t){return t=Cn(t),(t<16?"0":"")+t.toString(16)}function zp(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Te(t,e,n,r)}function jp(t){if(t instanceof Te)return new Te(t.h,t.s,t.l,t.opacity);if(t instanceof Le||(t=le(t)),!t)return new Te;if(t instanceof Te)return t;t=t.rgb();var e=t.r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),o=Math.max(e,n,r),a=NaN,s=o-i,u=(o+i)/2;return s?(e===o?a=(n-r)/s+(n0&&u<1?0:a,new Te(a,s,u,t.opacity)}function xr(t,e,n,r){return arguments.length===1?jp(t):new Te(t,e,n,r??1)}function Te(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function Up(t){return t=(t||0)%360,t<0?t+360:t}function _a(t){return Math.max(0,Math.min(1,t||0))}function nl(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}var ln,Ln,_r,Mi,Ce,A1,O1,N1,k1,P1,q1,C1,Dp,va=p(()=>{ga();ln=.7,Ln=1/ln,_r="\\s*([+-]?\\d+)\\s*",Mi="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ce="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",A1=/^#([0-9a-f]{3,8})$/,O1=new RegExp(`^rgb\\(${_r},${_r},${_r}\\)$`),N1=new RegExp(`^rgb\\(${Ce},${Ce},${Ce}\\)$`),k1=new RegExp(`^rgba\\(${_r},${_r},${_r},${Mi}\\)$`),P1=new RegExp(`^rgba\\(${Ce},${Ce},${Ce},${Mi}\\)$`),q1=new RegExp(`^hsl\\(${Mi},${Ce},${Ce}\\)$`),C1=new RegExp(`^hsla\\(${Mi},${Ce},${Ce},${Mi}\\)$`),Dp={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};je(Le,le,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Rp,formatHex:Rp,formatHex8:L1,formatHsl:D1,formatRgb:Hp,toString:Hp});je(dt,Dn,un(Le,{brighter(t){return t=t==null?Ln:Math.pow(Ln,t),new dt(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?ln:Math.pow(ln,t),new dt(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new dt(Cn(this.r),Cn(this.g),Cn(this.b),xa(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Yp,formatHex:Yp,formatHex8:R1,formatRgb:$p,toString:$p}));je(Te,xr,un(Le,{brighter(t){return t=t==null?Ln:Math.pow(Ln,t),new Te(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?ln:Math.pow(ln,t),new Te(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new dt(nl(t>=240?t-240:t+120,i,r),nl(t,i,r),nl(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new Te(Up(this.h),_a(this.s),_a(this.l),xa(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let t=xa(this.opacity);return`${t===1?"hsl(":"hsla("}${Up(this.h)}, ${_a(this.s)*100}%, ${_a(this.l)*100}%${t===1?")":`, ${t})`}`}}))});var wa,ba,rl=p(()=>{wa=Math.PI/180,ba=180/Math.PI});function Zp(t){if(t instanceof Se)return new Se(t.l,t.a,t.b,t.opacity);if(t instanceof De)return tm(t);t instanceof dt||(t=Ti(t));var e=sl(t.r),n=sl(t.g),r=sl(t.b),i=il((.2225045*e+.7168786*n+.0606169*r)/Xp),o,a;return e===n&&n===r?o=a=i:(o=il((.4360747*e+.3850649*n+.1430804*r)/Bp),a=il((.0139322*e+.0971045*n+.7141733*r)/Gp)),new Se(116*i-16,500*(o-i),200*(i-a),t.opacity)}function Qp(t,e){return new Se(t,0,0,e??1)}function Rn(t,e,n,r){return arguments.length===1?Zp(t):new Se(t,e,n,r??1)}function Se(t,e,n,r){this.l=+t,this.a=+e,this.b=+n,this.opacity=+r}function il(t){return t>H1?Math.pow(t,1/3):t/Vp+Wp}function ol(t){return t>vr?t*t*t:Vp*(t-Wp)}function al(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function sl(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Jp(t){if(t instanceof De)return new De(t.h,t.c,t.l,t.opacity);if(t instanceof Se||(t=Zp(t)),t.a===0&&t.b===0)return new De(NaN,0{ga();va();rl();Ma=18,Bp=.96422,Xp=1,Gp=.82521,Wp=4/29,vr=6/29,Vp=3*vr*vr,H1=vr*vr*vr;je(Se,Rn,un(Le,{brighter(t){return new Se(this.l+Ma*(t??1),this.a,this.b,this.opacity)},darker(t){return new Se(this.l-Ma*(t??1),this.a,this.b,this.opacity)},rgb(){var t=(this.l+16)/116,e=isNaN(this.a)?t:t+this.a/500,n=isNaN(this.b)?t:t-this.b/200;return e=Bp*ol(e),t=Xp*ol(t),n=Gp*ol(n),new dt(al(3.1338561*e-1.6168667*t-.4906146*n),al(-.9787684*e+1.9161415*t+.033454*n),al(.0719453*e-.2289914*t+1.4052427*n),this.opacity)}}));je(De,wr,un(Le,{brighter(t){return new De(this.h,this.c,this.l+Ma*(t??1),this.opacity)},darker(t){return new De(this.h,this.c,this.l-Ma*(t??1),this.opacity)},rgb(){return tm(this).rgb()}}))});function F1(t){if(t instanceof Hn)return new Hn(t.h,t.s,t.l,t.opacity);t instanceof dt||(t=Ti(t));var e=t.r/255,n=t.g/255,r=t.b/255,i=(im*r+nm*e-rm*n)/(im+nm-rm),o=r-i,a=(Si*(n-i)-ll*o)/Ta,s=Math.sqrt(a*a+o*o)/(Si*i*(1-i)),u=s?Math.atan2(a,o)*ba-120:NaN;return new Hn(u<0?u+360:u,s,i,t.opacity)}function Fn(t,e,n,r){return arguments.length===1?F1(t):new Hn(t,e,n,r??1)}function Hn(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}var om,ul,ll,Ta,Si,nm,rm,im,am=p(()=>{ga();va();rl();om=-.14861,ul=1.78277,ll=-.29227,Ta=-.90649,Si=1.97294,nm=Si*Ta,rm=Si*ul,im=ul*ll-Ta*om;je(Hn,Fn,un(Le,{brighter(t){return t=t==null?Ln:Math.pow(Ln,t),new Hn(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?ln:Math.pow(ln,t),new Hn(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=isNaN(this.h)?0:(this.h+120)*wa,e=+this.l,n=isNaN(this.s)?0:this.s*e*(1-e),r=Math.cos(t),i=Math.sin(t);return new dt(255*(e+n*(om*r+ul*i)),255*(e+n*(ll*r+Ta*i)),255*(e+n*(Si*r)),this.opacity)}}))});var Sa={};rn(Sa,{color:()=>le,cubehelix:()=>Fn,gray:()=>Qp,hcl:()=>wr,hsl:()=>xr,lab:()=>Rn,lch:()=>Kp,rgb:()=>Dn});var Ee=p(()=>{va();em();am()});function fl(t,e,n,r,i){var o=t*t,a=o*t;return((1-3*t+3*o-a)*e+(4-6*o+3*a)*n+(1+3*t+3*o-3*a)*r+a*i)/6}function Ea(t){var e=t.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,e-1):Math.floor(n*e),i=t[r],o=t[r+1],a=r>0?t[r-1]:2*i-o,s=r{});function Aa(t){var e=t.length;return function(n){var r=Math.floor(((n%=1)<0?++n:n)*e),i=t[(r+e-1)%e],o=t[r%e],a=t[(r+1)%e],s=t[(r+2)%e];return fl((n-r/e)*e,i,o,a,s)}}var cl=p(()=>{Ia()});var br,hl=p(()=>{br=t=>()=>t});function sm(t,e){return function(n){return t+n*e}}function Y1(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}function fn(t,e){var n=e-t;return n?sm(t,n>180||n<-180?n-360*Math.round(n/360):n):br(isNaN(t)?e:t)}function um(t){return(t=+t)==1?lt:function(e,n){return n-e?Y1(e,n,t):br(isNaN(e)?n:e)}}function lt(t,e){var n=e-t;return n?sm(t,n):br(isNaN(t)?e:t)}var Yn=p(()=>{hl()});function lm(t){return function(e){var n=e.length,r=new Array(n),i=new Array(n),o=new Array(n),a,s;for(a=0;a{Ee();Ia();cl();Yn();cn=(function t(e){var n=um(e);function r(i,o){var a=n((i=Dn(i)).r,(o=Dn(o)).r),s=n(i.g,o.g),u=n(i.b,o.b),l=lt(i.opacity,o.opacity);return function(f){return i.r=a(f),i.g=s(f),i.b=u(f),i.opacity=l(f),i+""}}return r.gamma=t,r})(1);fm=lm(Ea),cm=lm(Aa)});function Mr(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,r=e.slice(),i;return function(o){for(i=0;i{});function hm(t,e){return(Oa(e)?Mr:ml)(t,e)}function ml(t,e){var n=e?e.length:0,r=t?Math.min(n,t.length):0,i=new Array(r),o=new Array(n),a;for(a=0;a{Ei();Na()});function ka(t,e){var n=new Date;return t=+t,e=+e,function(r){return n.setTime(t*(1-r)+e*r),n}}var gl=p(()=>{});function Mt(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}var Ii=p(()=>{});function Pa(t,e){var n={},r={},i;(t===null||typeof t!="object")&&(t={}),(e===null||typeof e!="object")&&(e={});for(i in e)i in t?n[i]=Bt(t[i],e[i]):r[i]=e[i];return function(o){for(i in n)r[i]=n[i](o);return r}}var yl=p(()=>{Ei()});function $1(t){return function(){return t}}function z1(t){return function(e){return t(e)+""}}function Tr(t,e){var n=xl.lastIndex=_l.lastIndex=0,r,i,o,a=-1,s=[],u=[];for(t=t+"",e=e+"";(r=xl.exec(t))&&(i=_l.exec(e));)(o=i.index)>n&&(o=e.slice(n,o),s[a]?s[a]+=o:s[++a]=o),(r=r[0])===(i=i[0])?s[a]?s[a]+=i:s[++a]=i:(s[++a]=null,u.push({i:a,x:Mt(r,i)})),n=_l.lastIndex;return n{Ii();xl=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,_l=new RegExp(xl.source,"g")});function Bt(t,e){var n=typeof e,r;return e==null||n==="boolean"?br(e):(n==="number"?Mt:n==="string"?(r=le(e))?(e=r,cn):Tr:e instanceof le?cn:e instanceof Date?ka:Oa(e)?Mr:Array.isArray(e)?ml:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?Pa:Mt)(t,e)}var Ei=p(()=>{Ee();pl();dl();gl();Ii();yl();vl();hl();Na()});function pm(t){var e=t.length;return function(n){return t[Math.max(0,Math.min(e-1,Math.floor(n*e)))]}}var mm=p(()=>{});function dm(t,e){var n=fn(+t,+e);return function(r){var i=n(r);return i-360*Math.floor(i/360)}}var gm=p(()=>{Yn()});function hn(t,e){return t=+t,e=+e,function(n){return Math.round(t*(1-n)+e*n)}}var ym=p(()=>{});function wl(t,e,n,r,i,o){var a,s,u;return(a=Math.sqrt(t*t+e*e))&&(t/=a,e/=a),(u=t*n+e*r)&&(n-=t*u,r-=e*u),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,u/=s),t*r{_m=180/Math.PI,qa={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1}});function vm(t){let e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?qa:wl(e.a,e.b,e.c,e.d,e.e,e.f)}function wm(t){return t==null?qa:(Ca||(Ca=document.createElementNS("http://www.w3.org/2000/svg","g")),Ca.setAttribute("transform",t),(t=Ca.transform.baseVal.consolidate())?(t=t.matrix,wl(t.a,t.b,t.c,t.d,t.e,t.f)):qa)}var Ca,bm=p(()=>{xm()});function Mm(t,e,n,r){function i(l){return l.length?l.pop()+" ":""}function o(l,f,c,h,m,g){if(l!==c||f!==h){var y=m.push("translate(",null,e,null,n);g.push({i:y-4,x:Mt(l,c)},{i:y-2,x:Mt(f,h)})}else(c||h)&&m.push("translate("+c+e+h+n)}function a(l,f,c,h){l!==f?(l-f>180?f+=360:f-l>180&&(l+=360),h.push({i:c.push(i(c)+"rotate(",null,r)-2,x:Mt(l,f)})):f&&c.push(i(c)+"rotate("+f+r)}function s(l,f,c,h){l!==f?h.push({i:c.push(i(c)+"skewX(",null,r)-2,x:Mt(l,f)}):f&&c.push(i(c)+"skewX("+f+r)}function u(l,f,c,h,m,g){if(l!==c||f!==h){var y=m.push(i(m)+"scale(",null,",",null,")");g.push({i:y-4,x:Mt(l,c)},{i:y-2,x:Mt(f,h)})}else(c!==1||h!==1)&&m.push(i(m)+"scale("+c+","+h+")")}return function(l,f){var c=[],h=[];return l=t(l),f=t(f),o(l.translateX,l.translateY,f.translateX,f.translateY,c,h),a(l.rotate,f.rotate,c,h),s(l.skewX,f.skewX,c,h),u(l.scaleX,l.scaleY,f.scaleX,f.scaleY,c,h),l=f=null,function(m){for(var g=-1,y=h.length,M;++g{Ii();bm();La=Mm(vm,"px, ","px)","deg)"),Da=Mm(wm,", ",")",")")});function Sm(t){return((t=Math.exp(t))+1/t)/2}function j1(t){return((t=Math.exp(t))-1/t)/2}function B1(t){return((t=Math.exp(2*t))-1)/(t+1)}var U1,Ra,Em=p(()=>{U1=1e-12;Ra=(function t(e,n,r){function i(o,a){var s=o[0],u=o[1],l=o[2],f=a[0],c=a[1],h=a[2],m=f-s,g=c-u,y=m*m+g*g,M,_;if(y{Ee();Yn();Am=Im(fn),Om=Im(lt)});function bl(t,e){var n=lt((t=Rn(t)).l,(e=Rn(e)).l),r=lt(t.a,e.a),i=lt(t.b,e.b),o=lt(t.opacity,e.opacity);return function(a){return t.l=n(a),t.a=r(a),t.b=i(a),t.opacity=o(a),t+""}}var km=p(()=>{Ee();Yn()});function Pm(t){return function(e,n){var r=t((e=wr(e)).h,(n=wr(n)).h),i=lt(e.c,n.c),o=lt(e.l,n.l),a=lt(e.opacity,n.opacity);return function(s){return e.h=r(s),e.c=i(s),e.l=o(s),e.opacity=a(s),e+""}}}var qm,Cm,Lm=p(()=>{Ee();Yn();qm=Pm(fn),Cm=Pm(lt)});function Dm(t){return(function e(n){n=+n;function r(i,o){var a=t((i=Fn(i)).h,(o=Fn(o)).h),s=lt(i.s,o.s),u=lt(i.l,o.l),l=lt(i.opacity,o.opacity);return function(f){return i.h=a(f),i.s=s(f),i.l=u(Math.pow(f,n)),i.opacity=l(f),i+""}}return r.gamma=e,r})(1)}var Rm,Hm,Fm=p(()=>{Ee();Yn();Rm=Dm(fn),Hm=Dm(lt)});function Ai(t,e){e===void 0&&(e=t,t=Bt);for(var n=0,r=e.length-1,i=e[0],o=new Array(r<0?0:r);n{Ei()});function $m(t,e){for(var n=new Array(e),r=0;r{});var Um={};rn(Um,{interpolate:()=>Bt,interpolateArray:()=>hm,interpolateBasis:()=>Ea,interpolateBasisClosed:()=>Aa,interpolateCubehelix:()=>Rm,interpolateCubehelixLong:()=>Hm,interpolateDate:()=>ka,interpolateDiscrete:()=>pm,interpolateHcl:()=>qm,interpolateHclLong:()=>Cm,interpolateHsl:()=>Am,interpolateHslLong:()=>Om,interpolateHue:()=>dm,interpolateLab:()=>bl,interpolateNumber:()=>Mt,interpolateNumberArray:()=>Mr,interpolateObject:()=>Pa,interpolateRgb:()=>cn,interpolateRgbBasis:()=>fm,interpolateRgbBasisClosed:()=>cm,interpolateRound:()=>hn,interpolateString:()=>Tr,interpolateTransformCss:()=>La,interpolateTransformSvg:()=>Da,interpolateZoom:()=>Ra,piecewise:()=>Ai,quantize:()=>$m});var Be=p(()=>{Ei();dl();Ia();cl();gl();mm();gm();Ii();Na();yl();ym();vl();Tm();Em();pl();Nm();km();Lm();Fm();Ym();zm()});function Ml(t){return function(){return t}}var jm=p(()=>{});function pn(t){return+t}var Ha=p(()=>{});function _t(t){return t}function Tl(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:Ml(isNaN(e)?NaN:.5)}function X1(t,e){var n;return t>e&&(n=t,t=e,e=n),function(r){return Math.max(t,Math.min(e,r))}}function G1(t,e,n){var r=t[0],i=t[1],o=e[0],a=e[1];return i2?W1:G1,u=l=null,c}function c(h){return h==null||isNaN(h=+h)?o:(u||(u=s(t.map(r),e,n)))(r(a(h)))}return c.invert=function(h){return a(i((l||(l=s(e,t.map(r),Mt)))(h)))},c.domain=function(h){return arguments.length?(t=Array.from(h,pn),f()):t.slice()},c.range=function(h){return arguments.length?(e=Array.from(h),f()):e.slice()},c.rangeRound=function(h){return e=Array.from(h),n=hn,f()},c.clamp=function(h){return arguments.length?(a=h?!0:_t,f()):a!==_t},c.interpolate=function(h){return arguments.length?(n=h,f()):n},c.unknown=function(h){return arguments.length?(o=h,c):o},function(h,m){return r=h,i=m,f()}}function zn(){return $n()(_t,_t)}var Bm,He=p(()=>{se();Be();jm();Ha();Bm=[0,1]});function Oi(t,e,n,r){var i=gr(t,e,n),o;switch(r=be(r??",f"),r.type){case"s":{var a=Math.max(Math.abs(t),Math.abs(e));return r.precision==null&&!isNaN(o=sa(i,a))&&(r.precision=o),gi(r,a)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(o=ua(i,Math.max(Math.abs(t),Math.abs(e))))&&(r.precision=o-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(o=aa(i))&&(r.precision=o-(r.type==="%")*2);break}}return Nn(r)}var Sl=p(()=>{se();yi()});function Yt(t){var e=t.domain;return t.ticks=function(n){var r=e();return Pn(r[0],r[r.length-1],n??10)},t.tickFormat=function(n,r){var i=e();return Oi(i[0],i[i.length-1],n??10,r)},t.nice=function(n){n==null&&(n=10);var r=e(),i=0,o=r.length-1,a=r[i],s=r[o],u,l,f=10;for(s0;){if(l=vi(a,s,n),l===u)return r[i]=a,r[o]=s,e(r);if(l>0)a=Math.floor(a/l)*l,s=Math.ceil(s/l)*l;else if(l<0)a=Math.ceil(a*l)/l,s=Math.floor(s*l)/l;else break;u=l}return t},t}function Fa(){var t=zn();return t.copy=function(){return Re(t,Fa())},ut.apply(t,arguments),Yt(t)}var Xe=p(()=>{se();He();Ct();Sl()});function Ya(t){var e;function n(r){return r==null||isNaN(r=+r)?e:r}return n.invert=n,n.domain=n.range=function(r){return arguments.length?(t=Array.from(r,pn),n):t.slice()},n.unknown=function(r){return arguments.length?(e=r,n):e},n.copy=function(){return Ya(t).unknown(e)},t=arguments.length?Array.from(t,pn):[0,1],Yt(n)}var Xm=p(()=>{Xe();Ha()});function Ni(t,e){t=t.slice();var n=0,r=t.length-1,i=t[n],o=t[r],a;return o{});function Gm(t){return Math.log(t)}function Wm(t){return Math.exp(t)}function V1(t){return-Math.log(-t)}function Z1(t){return-Math.exp(-t)}function Q1(t){return isFinite(t)?+("1e"+t):t<0?0:t}function J1(t){return t===10?Q1:t===Math.E?Math.exp:e=>Math.pow(t,e)}function K1(t){return t===Math.E?Math.log:t===10&&Math.log10||t===2&&Math.log2||(t=Math.log(t),e=>Math.log(e)/t)}function Vm(t){return(e,n)=>-t(-e,n)}function ki(t){let e=t(Gm,Wm),n=e.domain,r=10,i,o;function a(){return i=K1(r),o=J1(r),n()[0]<0?(i=Vm(i),o=Vm(o),t(V1,Z1)):t(Gm,Wm),e}return e.base=function(s){return arguments.length?(r=+s,a()):r},e.domain=function(s){return arguments.length?(n(s),a()):n()},e.ticks=s=>{let u=n(),l=u[0],f=u[u.length-1],c=f0){for(;h<=m;++h)for(g=1;gf)break;_.push(y)}}else for(;h<=m;++h)for(g=r-1;g>=1;--g)if(y=h>0?g/o(-h):g*o(h),!(yf)break;_.push(y)}_.length*2{if(s==null&&(s=10),u==null&&(u=r===10?"s":","),typeof u!="function"&&(!(r%1)&&(u=be(u)).precision==null&&(u.trim=!0),u=Nn(u)),s===1/0)return u;let l=Math.max(1,r*s/e.ticks().length);return f=>{let c=f/o(Math.round(i(f)));return c*rn(Ni(n(),{floor:s=>o(Math.floor(i(s))),ceil:s=>o(Math.ceil(i(s)))})),e}function $a(){let t=ki($n()).domain([1,10]);return t.copy=()=>Re(t,$a()).base(t.base()),ut.apply(t,arguments),t}var za=p(()=>{se();yi();El();He();Ct()});function Zm(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function Qm(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function Pi(t){var e=1,n=t(Zm(e),Qm(e));return n.constant=function(r){return arguments.length?t(Zm(e=+r),Qm(e)):e},Yt(n)}function Ua(){var t=Pi($n());return t.copy=function(){return Re(t,Ua()).constant(t.constant())},ut.apply(t,arguments)}var ja=p(()=>{Xe();He();Ct()});function Jm(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function tw(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function ew(t){return t<0?-t*t:t*t}function qi(t){var e=t(_t,_t),n=1;function r(){return n===1?t(_t,_t):n===.5?t(tw,ew):t(Jm(n),Jm(1/n))}return e.exponent=function(i){return arguments.length?(n=+i,r()):n},Yt(e)}function Ci(){var t=qi($n());return t.copy=function(){return Re(t,Ci()).exponent(t.exponent())},ut.apply(t,arguments),t}function Km(){return Ci.apply(null,arguments).exponent(.5)}var Ba=p(()=>{Xe();He();Ct()});function td(t){return Math.sign(t)*t*t}function nw(t){return Math.sign(t)*Math.sqrt(Math.abs(t))}function Xa(){var t=zn(),e=[0,1],n=!1,r;function i(o){var a=nw(t(o));return isNaN(a)?r:n?Math.round(a):a}return i.invert=function(o){return t.invert(td(o))},i.domain=function(o){return arguments.length?(t.domain(o),i):t.domain()},i.range=function(o){return arguments.length?(t.range((e=Array.from(o,pn)).map(td)),i):e.slice()},i.rangeRound=function(o){return i.range(o).round(!0)},i.round=function(o){return arguments.length?(n=!!o,i):n},i.clamp=function(o){return arguments.length?(t.clamp(o),i):t.clamp()},i.unknown=function(o){return arguments.length?(r=o,i):r},i.copy=function(){return Xa(t.domain(),e).round(n).clamp(t.clamp()).unknown(r)},ut.apply(i,arguments),Yt(i)}var ed=p(()=>{He();Ct();Xe();Ha()});function Ga(){var t=[],e=[],n=[],r;function i(){var a=0,s=Math.max(1,e.length);for(n=new Array(s-1);++a0?n[s-1]:t[0],s{se();Ct()});function Wa(){var t=0,e=1,n=1,r=[.5],i=[0,1],o;function a(u){return u!=null&&u<=u?i[Me(r,u,0,n)]:o}function s(){var u=-1;for(r=new Array(n);++u=n?[r[n-1],e]:[r[l-1],r[l]]},a.unknown=function(u){return arguments.length&&(o=u),a},a.thresholds=function(){return r.slice()},a.copy=function(){return Wa().domain([t,e]).range(i).unknown(o)},ut.apply(Yt(a),arguments)}var rd=p(()=>{se();Xe();Ct()});function Va(){var t=[.5],e=[0,1],n,r=1;function i(o){return o!=null&&o<=o?e[Me(t,o,0,r)]:n}return i.domain=function(o){return arguments.length?(t=Array.from(o),r=Math.min(t.length,e.length-1),i):t.slice()},i.range=function(o){return arguments.length?(e=Array.from(o),r=Math.min(t.length,e.length-1),i):e.slice()},i.invertExtent=function(o){var a=e.indexOf(o);return[t[a-1],t[a]]},i.unknown=function(o){return arguments.length?(n=o,i):n},i.copy=function(){return Va().domain(t).range(e).unknown(n)},ut.apply(i,arguments)}var id=p(()=>{se();Ct()});function et(t,e,n,r){function i(o){return t(o=arguments.length===0?new Date:new Date(+o)),o}return i.floor=o=>(t(o=new Date(+o)),o),i.ceil=o=>(t(o=new Date(o-1)),e(o,1),t(o),o),i.round=o=>{let a=i(o),s=i.ceil(o);return o-a(e(o=new Date(+o),a==null?1:Math.floor(a)),o),i.range=(o,a,s)=>{let u=[];if(o=i.ceil(o),s=s==null?1:Math.floor(s),!(o0))return u;let l;do u.push(l=new Date(+o)),e(o,s),t(o);while(let(a=>{if(a>=a)for(;t(a),!o(a);)a.setTime(a-1)},(a,s)=>{if(a>=a)if(s<0)for(;++s<=0;)for(;e(a,-1),!o(a););else for(;--s>=0;)for(;e(a,1),!o(a););}),n&&(i.count=(o,a)=>(Il.setTime(+o),Al.setTime(+a),t(Il),t(Al),Math.floor(n(Il,Al))),i.every=o=>(o=Math.floor(o),!isFinite(o)||!(o>0)?null:o>1?i.filter(r?a=>r(a)%o===0:a=>i.count(0,a)%o===0):i)),i}var Il,Al,Ge=p(()=>{Il=new Date,Al=new Date});var Li,lL,od=p(()=>{Ge();Li=et(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);Li.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?et(e=>{e.setTime(Math.floor(e/t)*t)},(e,n)=>{e.setTime(+e+n*t)},(e,n)=>(n-e)/t):Li);lL=Li.range});var fe,ad,Ol=p(()=>{Ge();fe=et(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*1e3)},(t,e)=>(e-t)/1e3,t=>t.getUTCSeconds()),ad=fe.range});var Sr,rw,Er,iw,Nl=p(()=>{Ge();Sr=et(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*1e3)},(t,e)=>{t.setTime(+t+e*6e4)},(t,e)=>(e-t)/6e4,t=>t.getMinutes()),rw=Sr.range,Er=et(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*6e4)},(t,e)=>(e-t)/6e4,t=>t.getUTCMinutes()),iw=Er.range});var Ir,ow,Ar,aw,kl=p(()=>{Ge();Ir=et(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*1e3-t.getMinutes()*6e4)},(t,e)=>{t.setTime(+t+e*36e5)},(t,e)=>(e-t)/36e5,t=>t.getHours()),ow=Ir.range,Ar=et(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*36e5)},(t,e)=>(e-t)/36e5,t=>t.getUTCHours()),aw=Ar.range});var We,sw,Bn,uw,Za,lw,Pl=p(()=>{Ge();We=et(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*6e4)/864e5,t=>t.getDate()-1),sw=We.range,Bn=et(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/864e5,t=>t.getUTCDate()-1),uw=Bn.range,Za=et(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/864e5,t=>Math.floor(t/864e5)),lw=Za.range});function Xn(t){return et(e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},(e,n)=>{e.setDate(e.getDate()+n*7)},(e,n)=>(n-e-(n.getTimezoneOffset()-e.getTimezoneOffset())*6e4)/6048e5)}function Gn(t){return et(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCDate(e.getUTCDate()+n*7)},(e,n)=>(n-e)/6048e5)}var Ve,Or,ud,ld,mn,fd,cd,hd,fw,cw,hw,pw,mw,dw,Ze,Nr,pd,md,dn,dd,gd,yd,gw,yw,_w,xw,vw,ww,ql=p(()=>{Ge();Ve=Xn(0),Or=Xn(1),ud=Xn(2),ld=Xn(3),mn=Xn(4),fd=Xn(5),cd=Xn(6),hd=Ve.range,fw=Or.range,cw=ud.range,hw=ld.range,pw=mn.range,mw=fd.range,dw=cd.range;Ze=Gn(0),Nr=Gn(1),pd=Gn(2),md=Gn(3),dn=Gn(4),dd=Gn(5),gd=Gn(6),yd=Ze.range,gw=Nr.range,yw=pd.range,_w=md.range,xw=dn.range,vw=dd.range,ww=gd.range});var kr,bw,Pr,Mw,Cl=p(()=>{Ge();kr=et(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+(e.getFullYear()-t.getFullYear())*12,t=>t.getMonth()),bw=kr.range,Pr=et(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)},(t,e)=>e.getUTCMonth()-t.getUTCMonth()+(e.getUTCFullYear()-t.getUTCFullYear())*12,t=>t.getUTCMonth()),Mw=Pr.range});var Qt,Tw,Jt,Sw,Ll=p(()=>{Ge();Qt=et(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());Qt.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:et(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,n)=>{e.setFullYear(e.getFullYear()+n*t)});Tw=Qt.range,Jt=et(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());Jt.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:et(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n*t)});Sw=Jt.range});function xd(t,e,n,r,i,o){let a=[[fe,1,1e3],[fe,5,5*1e3],[fe,15,15*1e3],[fe,30,30*1e3],[o,1,6e4],[o,5,5*6e4],[o,15,15*6e4],[o,30,30*6e4],[i,1,36e5],[i,3,3*36e5],[i,6,6*36e5],[i,12,12*36e5],[r,1,864e5],[r,2,2*864e5],[n,1,6048e5],[e,1,2592e6],[e,3,3*2592e6],[t,1,31536e6]];function s(l,f,c){let h=fM).right(a,h);if(m===a.length)return t.every(gr(l/31536e6,f/31536e6,c));if(m===0)return Li.every(Math.max(gr(l,f,c),1));let[g,y]=a[h/a[m-1][2]{se();od();Ol();Nl();kl();Pl();ql();Cl();Ll();[Dl,Rl]=xd(Jt,Pr,Ze,Za,Ar,Er),[Hl,Fl]=xd(Qt,kr,Ve,We,Ir,Sr)});var Qa=p(()=>{Ol();Nl();kl();Pl();ql();Cl();Ll();vd()});function Yl(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function $l(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function Ri(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}function zl(t){var e=t.dateTime,n=t.date,r=t.time,i=t.periods,o=t.days,a=t.shortDays,s=t.months,u=t.shortMonths,l=Hi(i),f=Fi(i),c=Hi(o),h=Fi(o),m=Hi(a),g=Fi(a),y=Hi(s),M=Fi(s),_=Hi(u),E=Fi(u),A={a:N,A:C,b:R,B:L,c:null,d:Ed,e:Ed,f:Vw,g:ob,G:sb,H:Xw,I:Gw,j:Ww,L:kd,m:Zw,M:Qw,p:j,q:Z,Q:Od,s:Nd,S:Jw,u:Kw,U:tb,V:eb,w:nb,W:rb,x:null,X:null,y:ib,Y:ab,Z:ub,"%":Ad},I={a:Pt,A:ct,b:ht,B:Rt,c:null,d:Id,e:Id,f:hb,g:bb,G:Tb,H:lb,I:fb,j:cb,L:qd,m:pb,M:mb,p:It,q:Ht,Q:Od,s:Nd,S:db,u:gb,U:yb,V:_b,w:xb,W:vb,x:null,X:null,y:wb,Y:Mb,Z:Sb,"%":Ad},P={a:V,A:W,b:v,B:T,c:d,d:Td,e:Td,f:zw,g:Md,G:bd,H:Sd,I:Sd,j:Hw,L:$w,m:Rw,M:Fw,p:tt,q:Dw,Q:jw,s:Bw,S:Yw,u:kw,U:Pw,V:qw,w:Nw,W:Cw,x:S,X:x,y:Md,Y:bd,Z:Lw,"%":Uw};A.x=w(n,A),A.X=w(r,A),A.c=w(e,A),I.x=w(n,I),I.X=w(r,I),I.c=w(e,I);function w(k,Y){return function(U){var b=[],jt=-1,rt=0,Vt=k.length,Zt,Sn,bc;for(U instanceof Date||(U=new Date(+U));++jt53)return null;"w"in b||(b.w=1),"Z"in b?(rt=$l(Ri(b.y,0,1)),Vt=rt.getUTCDay(),rt=Vt>4||Vt===0?Nr.ceil(rt):Nr(rt),rt=Bn.offset(rt,(b.V-1)*7),b.y=rt.getUTCFullYear(),b.m=rt.getUTCMonth(),b.d=rt.getUTCDate()+(b.w+6)%7):(rt=Yl(Ri(b.y,0,1)),Vt=rt.getDay(),rt=Vt>4||Vt===0?Or.ceil(rt):Or(rt),rt=We.offset(rt,(b.V-1)*7),b.y=rt.getFullYear(),b.m=rt.getMonth(),b.d=rt.getDate()+(b.w+6)%7)}else("W"in b||"U"in b)&&("w"in b||(b.w="u"in b?b.u%7:"W"in b?1:0),Vt="Z"in b?$l(Ri(b.y,0,1)).getUTCDay():Yl(Ri(b.y,0,1)).getDay(),b.m=0,b.d="W"in b?(b.w+6)%7+b.W*7-(Vt+5)%7:b.w+b.U*7-(Vt+6)%7);return"Z"in b?(b.H+=b.Z/100|0,b.M+=b.Z%100,$l(b)):Yl(b)}}function z(k,Y,U,b){for(var jt=0,rt=Y.length,Vt=U.length,Zt,Sn;jt=Vt)return-1;if(Zt=Y.charCodeAt(jt++),Zt===37){if(Zt=Y.charAt(jt++),Sn=P[Zt in wd?Y.charAt(jt++):Zt],!Sn||(b=Sn(k,U,b))<0)return-1}else if(Zt!=U.charCodeAt(b++))return-1}return b}function tt(k,Y,U){var b=l.exec(Y.slice(U));return b?(k.p=f.get(b[0].toLowerCase()),U+b[0].length):-1}function V(k,Y,U){var b=m.exec(Y.slice(U));return b?(k.w=g.get(b[0].toLowerCase()),U+b[0].length):-1}function W(k,Y,U){var b=c.exec(Y.slice(U));return b?(k.w=h.get(b[0].toLowerCase()),U+b[0].length):-1}function v(k,Y,U){var b=_.exec(Y.slice(U));return b?(k.m=E.get(b[0].toLowerCase()),U+b[0].length):-1}function T(k,Y,U){var b=y.exec(Y.slice(U));return b?(k.m=M.get(b[0].toLowerCase()),U+b[0].length):-1}function d(k,Y,U){return z(k,e,Y,U)}function S(k,Y,U){return z(k,n,Y,U)}function x(k,Y,U){return z(k,r,Y,U)}function N(k){return a[k.getDay()]}function C(k){return o[k.getDay()]}function R(k){return u[k.getMonth()]}function L(k){return s[k.getMonth()]}function j(k){return i[+(k.getHours()>=12)]}function Z(k){return 1+~~(k.getMonth()/3)}function Pt(k){return a[k.getUTCDay()]}function ct(k){return o[k.getUTCDay()]}function ht(k){return u[k.getUTCMonth()]}function Rt(k){return s[k.getUTCMonth()]}function It(k){return i[+(k.getUTCHours()>=12)]}function Ht(k){return 1+~~(k.getUTCMonth()/3)}return{format:function(k){var Y=w(k+="",A);return Y.toString=function(){return k},Y},parse:function(k){var Y=q(k+="",!1);return Y.toString=function(){return k},Y},utcFormat:function(k){var Y=w(k+="",I);return Y.toString=function(){return k},Y},utcParse:function(k){var Y=q(k+="",!0);return Y.toString=function(){return k},Y}}}function B(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",o=i.length;return r+(o[e.toLowerCase(),n]))}function Nw(t,e,n){var r=Tt.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function kw(t,e,n){var r=Tt.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function Pw(t,e,n){var r=Tt.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function qw(t,e,n){var r=Tt.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function Cw(t,e,n){var r=Tt.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function bd(t,e,n){var r=Tt.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function Md(t,e,n){var r=Tt.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function Lw(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function Dw(t,e,n){var r=Tt.exec(e.slice(n,n+1));return r?(t.q=r[0]*3-3,n+r[0].length):-1}function Rw(t,e,n){var r=Tt.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function Td(t,e,n){var r=Tt.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function Hw(t,e,n){var r=Tt.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function Sd(t,e,n){var r=Tt.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function Fw(t,e,n){var r=Tt.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function Yw(t,e,n){var r=Tt.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function $w(t,e,n){var r=Tt.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function zw(t,e,n){var r=Tt.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Uw(t,e,n){var r=Iw.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function jw(t,e,n){var r=Tt.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function Bw(t,e,n){var r=Tt.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function Ed(t,e){return B(t.getDate(),e,2)}function Xw(t,e){return B(t.getHours(),e,2)}function Gw(t,e){return B(t.getHours()%12||12,e,2)}function Ww(t,e){return B(1+We.count(Qt(t),t),e,3)}function kd(t,e){return B(t.getMilliseconds(),e,3)}function Vw(t,e){return kd(t,e)+"000"}function Zw(t,e){return B(t.getMonth()+1,e,2)}function Qw(t,e){return B(t.getMinutes(),e,2)}function Jw(t,e){return B(t.getSeconds(),e,2)}function Kw(t){var e=t.getDay();return e===0?7:e}function tb(t,e){return B(Ve.count(Qt(t)-1,t),e,2)}function Pd(t){var e=t.getDay();return e>=4||e===0?mn(t):mn.ceil(t)}function eb(t,e){return t=Pd(t),B(mn.count(Qt(t),t)+(Qt(t).getDay()===4),e,2)}function nb(t){return t.getDay()}function rb(t,e){return B(Or.count(Qt(t)-1,t),e,2)}function ib(t,e){return B(t.getFullYear()%100,e,2)}function ob(t,e){return t=Pd(t),B(t.getFullYear()%100,e,2)}function ab(t,e){return B(t.getFullYear()%1e4,e,4)}function sb(t,e){var n=t.getDay();return t=n>=4||n===0?mn(t):mn.ceil(t),B(t.getFullYear()%1e4,e,4)}function ub(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+B(e/60|0,"0",2)+B(e%60,"0",2)}function Id(t,e){return B(t.getUTCDate(),e,2)}function lb(t,e){return B(t.getUTCHours(),e,2)}function fb(t,e){return B(t.getUTCHours()%12||12,e,2)}function cb(t,e){return B(1+Bn.count(Jt(t),t),e,3)}function qd(t,e){return B(t.getUTCMilliseconds(),e,3)}function hb(t,e){return qd(t,e)+"000"}function pb(t,e){return B(t.getUTCMonth()+1,e,2)}function mb(t,e){return B(t.getUTCMinutes(),e,2)}function db(t,e){return B(t.getUTCSeconds(),e,2)}function gb(t){var e=t.getUTCDay();return e===0?7:e}function yb(t,e){return B(Ze.count(Jt(t)-1,t),e,2)}function Cd(t){var e=t.getUTCDay();return e>=4||e===0?dn(t):dn.ceil(t)}function _b(t,e){return t=Cd(t),B(dn.count(Jt(t),t)+(Jt(t).getUTCDay()===4),e,2)}function xb(t){return t.getUTCDay()}function vb(t,e){return B(Nr.count(Jt(t)-1,t),e,2)}function wb(t,e){return B(t.getUTCFullYear()%100,e,2)}function bb(t,e){return t=Cd(t),B(t.getUTCFullYear()%100,e,2)}function Mb(t,e){return B(t.getUTCFullYear()%1e4,e,4)}function Tb(t,e){var n=t.getUTCDay();return t=n>=4||n===0?dn(t):dn.ceil(t),B(t.getUTCFullYear()%1e4,e,4)}function Sb(){return"+0000"}function Ad(){return"%"}function Od(t){return+t}function Nd(t){return Math.floor(+t/1e3)}var wd,Tt,Iw,Aw,Ld=p(()=>{Qa();wd={"-":"",_:" ",0:"0"},Tt=/^\s*\d+/,Iw=/^%/,Aw=/[\\^$*+?|[\]().{}]/g});function Ul(t){return qr=zl(t),Ja=qr.format,Dd=qr.parse,Ka=qr.utcFormat,Rd=qr.utcParse,qr}var qr,Ja,Dd,Ka,Rd,Hd=p(()=>{Ld();Ul({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]})});var jl=p(()=>{Hd()});function Eb(t){return new Date(t)}function Ib(t){return t instanceof Date?+t:+new Date(+t)}function ts(t,e,n,r,i,o,a,s,u,l){var f=zn(),c=f.invert,h=f.domain,m=l(".%L"),g=l(":%S"),y=l("%I:%M"),M=l("%I %p"),_=l("%a %d"),E=l("%b %d"),A=l("%B"),I=l("%Y");function P(w){return(u(w){Qa();jl();He();Ct();El()});function Gl(){return ut.apply(ts(Dl,Rl,Jt,Pr,Ze,Bn,Ar,Er,fe,Ka).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}var Fd=p(()=>{Qa();jl();Xl();Ct()});function es(){var t=0,e=1,n,r,i,o,a=_t,s=!1,u;function l(c){return c==null||isNaN(c=+c)?u:a(i===0?.5:(c=(o(c)-n)*i,s?Math.max(0,Math.min(1,c)):c))}l.domain=function(c){return arguments.length?([t,e]=c,n=o(t=+t),r=o(e=+e),i=n===r?0:1/(r-n),l):[t,e]},l.clamp=function(c){return arguments.length?(s=!!c,l):s},l.interpolator=function(c){return arguments.length?(a=c,l):a};function f(c){return function(h){var m,g;return arguments.length?([m,g]=h,a=c(m,g),l):[a(0),a(1)]}}return l.range=f(Bt),l.rangeRound=f(hn),l.unknown=function(c){return arguments.length?(u=c,l):u},function(c){return o=c,n=c(t),r=c(e),i=n===r?0:1/(r-n),l}}function Qe(t,e){return e.domain(t.domain()).interpolator(t.interpolator()).clamp(t.clamp()).unknown(t.unknown())}function ns(){var t=Yt(es()(_t));return t.copy=function(){return Qe(t,ns())},ue.apply(t,arguments)}function Wl(){var t=ki(es()).domain([1,10]);return t.copy=function(){return Qe(t,Wl()).base(t.base())},ue.apply(t,arguments)}function Vl(){var t=Pi(es());return t.copy=function(){return Qe(t,Vl()).constant(t.constant())},ue.apply(t,arguments)}function rs(){var t=qi(es());return t.copy=function(){return Qe(t,rs()).exponent(t.exponent())},ue.apply(t,arguments)}function Yd(){return rs.apply(null,arguments).exponent(.5)}var Zl=p(()=>{Be();He();Ct();Xe();za();ja();Ba()});function is(){var t=[],e=_t;function n(r){if(r!=null&&!isNaN(r=+r))return e((Me(t,r,1)-1)/(t.length-1))}return n.domain=function(r){if(!arguments.length)return t.slice();t=[];for(let i of r)i!=null&&!isNaN(i=+i)&&t.push(i);return t.sort(Ft),n},n.interpolator=function(r){return arguments.length?(e=r,n):e},n.range=function(){return t.map((r,i)=>e(i/(t.length-1)))},n.quantiles=function(r){return Array.from({length:r+1},(i,o)=>pa(t,o/r))},n.copy=function(){return is(e).domain(t)},ue.apply(n,arguments)}var $d=p(()=>{se();He();Ct()});function os(){var t=0,e=.5,n=1,r=1,i,o,a,s,u,l=_t,f,c=!1,h;function m(y){return isNaN(y=+y)?h:(y=.5+((y=+f(y))-o)*(r*y{Be();He();Ct();Xe();za();Zl();ja();Ba()});var Kl={};rn(Kl,{scaleBand:()=>bi,scaleDiverging:()=>as,scaleDivergingLog:()=>Ql,scaleDivergingPow:()=>ss,scaleDivergingSqrt:()=>zd,scaleDivergingSymlog:()=>Jl,scaleIdentity:()=>Ya,scaleImplicit:()=>da,scaleLinear:()=>Fa,scaleLog:()=>$a,scaleOrdinal:()=>yr,scalePoint:()=>Cp,scalePow:()=>Ci,scaleQuantile:()=>Ga,scaleQuantize:()=>Wa,scaleRadial:()=>Xa,scaleSequential:()=>ns,scaleSequentialLog:()=>Wl,scaleSequentialPow:()=>rs,scaleSequentialQuantile:()=>is,scaleSequentialSqrt:()=>Yd,scaleSequentialSymlog:()=>Vl,scaleSqrt:()=>Km,scaleSymlog:()=>Ua,scaleThreshold:()=>Va,scaleTime:()=>Bl,scaleUtc:()=>Gl,tickFormat:()=>Oi});var tf=p(()=>{Lp();Xm();Xe();za();ja();el();Ba();ed();nd();rd();id();Xl();Fd();Zl();$d();Ud();Sl()});function jd(t){return t}var Bd=p(()=>{});function Ab(t){return"translate("+t+",0)"}function Ob(t){return"translate(0,"+t+")"}function Nb(t){return e=>+t(e)}function kb(t,e){return e=Math.max(0,t.bandwidth()-e*2)/2,t.round()&&(e=Math.round(e)),n=>+t(n)+e}function Pb(){return!this.__axis}function fs(t,e){var n=[],r=null,i=null,o=6,a=6,s=3,u=typeof window<"u"&&window.devicePixelRatio>1?0:.5,l=t===us||t===Yi?-1:1,f=t===Yi||t===ls?"x":"y",c=t===us||t===ef?Ab:Ob;function h(m){var g=r??(e.ticks?e.ticks.apply(e,n):e.domain()),y=i??(e.tickFormat?e.tickFormat.apply(e,n):jd),M=Math.max(o,0)+s,_=e.range(),E=+_[0]+u,A=+_[_.length-1]+u,I=(e.bandwidth?kb:Nb)(e.copy(),u),P=m.selection?m.selection():m,w=P.selectAll(".domain").data([null]),q=P.selectAll(".tick").data(g,e).order(),z=q.exit(),tt=q.enter().append("g").attr("class","tick"),V=q.select("line"),W=q.select("text");w=w.merge(w.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),q=q.merge(tt),V=V.merge(tt.append("line").attr("stroke","currentColor").attr(f+"2",l*o)),W=W.merge(tt.append("text").attr("fill","currentColor").attr(f,l*M).attr("dy",t===us?"0em":t===ef?"0.71em":"0.32em")),m!==P&&(w=w.transition(m),q=q.transition(m),V=V.transition(m),W=W.transition(m),z=z.transition(m).attr("opacity",Xd).attr("transform",function(v){return isFinite(v=I(v))?c(v+u):this.getAttribute("transform")}),tt.attr("opacity",Xd).attr("transform",function(v){var T=this.parentNode.__axis;return c((T&&isFinite(T=T(v))?T:I(v))+u)})),z.remove(),w.attr("d",t===Yi||t===ls?a?"M"+l*a+","+E+"H"+u+"V"+A+"H"+l*a:"M"+u+","+E+"V"+A:a?"M"+E+","+l*a+"V"+u+"H"+A+"V"+l*a:"M"+E+","+u+"H"+A),q.attr("opacity",1).attr("transform",function(v){return c(I(v)+u)}),V.attr(f+"2",l*o),W.attr(f,l*M).text(y),P.filter(Pb).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",t===ls?"start":t===Yi?"end":"middle"),P.each(function(){this.__axis=I})}return h.scale=function(m){return arguments.length?(e=m,h):e},h.ticks=function(){return n=Array.from(arguments),h},h.tickArguments=function(m){return arguments.length?(n=m==null?[]:Array.from(m),h):n.slice()},h.tickValues=function(m){return arguments.length?(r=m==null?null:Array.from(m),h):r&&r.slice()},h.tickFormat=function(m){return arguments.length?(i=m,h):i},h.tickSize=function(m){return arguments.length?(o=a=+m,h):o},h.tickSizeInner=function(m){return arguments.length?(o=+m,h):o},h.tickSizeOuter=function(m){return arguments.length?(a=+m,h):a},h.tickPadding=function(m){return arguments.length?(s=+m,h):s},h.offset=function(m){return arguments.length?(u=+m,h):u},h}function Gd(t){return fs(us,t)}function Wd(t){return fs(ls,t)}function Vd(t){return fs(ef,t)}function Zd(t){return fs(Yi,t)}var us,ls,ef,Yi,Xd,Qd=p(()=>{Bd();us=1,ls=2,ef=3,Yi=4,Xd=1e-6});var Jd={};rn(Jd,{axisBottom:()=>Vd,axisLeft:()=>Zd,axisRight:()=>Wd,axisTop:()=>Gd});var Kd=p(()=>{Qd()});function e0(){for(var t=0,e=arguments.length,n={},r;t=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}function Lb(t,e){for(var n=0,r=t.length,i;n{qb={value:()=>{}};cs.prototype=e0.prototype={constructor:cs,on:function(t,e){var n=this._,r=Cb(t+"",n),i,o=-1,a=r.length;if(arguments.length<2){for(;++o0)for(var n=new Array(i),r=0,i,o;r{n0()});var hs,zi,ps=p(()=>{hs="http://www.w3.org/1999/xhtml",zi={svg:"http://www.w3.org/2000/svg",xhtml:hs,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"}});function Ye(t){var e=t+="",n=e.indexOf(":");return n>=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),zi.hasOwnProperty(e)?{space:zi[e],local:t}:t}var ms=p(()=>{ps()});function Db(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===hs&&e.documentElement.namespaceURI===hs?e.createElement(t):e.createElementNS(n,t)}}function Rb(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function gn(t){var e=Ye(t);return(e.local?Rb:Db)(e)}var Ui=p(()=>{ms();ps()});function Hb(){}function yn(t){return t==null?Hb:function(){return this.querySelector(t)}}var ds=p(()=>{});function r0(t){typeof t!="function"&&(t=yn(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i{ce();ds()});function ji(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}var rf=p(()=>{});function Fb(){return[]}function Cr(t){return t==null?Fb:function(){return this.querySelectorAll(t)}}var of=p(()=>{});function Yb(t){return function(){return ji(t.apply(this,arguments))}}function o0(t){typeof t=="function"?t=Yb(t):t=Cr(t);for(var e=this._groups,n=e.length,r=[],i=[],o=0;o{ce();rf();of()});function Lr(t){return function(){return this.matches(t)}}function gs(t){return function(e){return e.matches(t)}}var Bi=p(()=>{});function zb(t){return function(){return $b.call(this.children,t)}}function Ub(){return this.firstElementChild}function s0(t){return this.select(t==null?Ub:zb(typeof t=="function"?t:gs(t)))}var $b,u0=p(()=>{Bi();$b=Array.prototype.find});function Bb(){return Array.from(this.children)}function Xb(t){return function(){return jb.call(this.children,t)}}function l0(t){return this.selectAll(t==null?Bb:Xb(typeof t=="function"?t:gs(t)))}var jb,f0=p(()=>{Bi();jb=Array.prototype.filter});function c0(t){typeof t!="function"&&(t=Lr(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i{ce();Bi()});function ys(t){return new Array(t.length)}var af=p(()=>{});function p0(){return new ot(this._enter||this._groups.map(ys),this._parents)}function Xi(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}var sf=p(()=>{af();ce();Xi.prototype={constructor:Xi,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}}});function m0(t){return function(){return t}}var d0=p(()=>{});function Gb(t,e,n,r,i,o){for(var a=0,s,u=e.length,l=o.length;a=A&&(A=E+1);!(P=M[A])&&++A{ce();sf();d0()});function _0(){return new ot(this._exit||this._groups.map(ys),this._parents)}var x0=p(()=>{af();ce()});function v0(t,e,n){var r=this.enter(),i=this,o=this.exit();return typeof t=="function"?(r=t(r),r&&(r=r.selection())):r=r.append(t+""),e!=null&&(i=e(i),i&&(i=i.selection())),n==null?o.remove():n(o),r&&i?r.merge(i).order():i}var w0=p(()=>{});function b0(t){for(var e=t.selection?t.selection():t,n=this._groups,r=e._groups,i=n.length,o=r.length,a=Math.min(i,o),s=new Array(i),u=0;u{ce()});function T0(){for(var t=this._groups,e=-1,n=t.length;++e=0;)(a=r[i])&&(o&&a.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(a,o),o=a);return this}var S0=p(()=>{});function E0(t){t||(t=Qb);function e(c,h){return c&&h?t(c.__data__,h.__data__):!c-!h}for(var n=this._groups,r=n.length,i=new Array(r),o=0;oe?1:t>=e?0:NaN}var I0=p(()=>{ce()});function A0(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}var O0=p(()=>{});function N0(){return Array.from(this)}var k0=p(()=>{});function P0(){for(var t=this._groups,e=0,n=t.length;e{});function C0(){let t=0;for(let e of this)++t;return t}var L0=p(()=>{});function D0(){return!this.node()}var R0=p(()=>{});function H0(t){for(var e=this._groups,n=0,r=e.length;n{});function Jb(t){return function(){this.removeAttribute(t)}}function Kb(t){return function(){this.removeAttributeNS(t.space,t.local)}}function tM(t,e){return function(){this.setAttribute(t,e)}}function eM(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function nM(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttribute(t):this.setAttribute(t,n)}}function rM(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function Y0(t,e){var n=Ye(t);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((e==null?n.local?Kb:Jb:typeof e=="function"?n.local?rM:nM:n.local?eM:tM)(n,e))}var $0=p(()=>{ms()});function Dr(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}var _s=p(()=>{});function iM(t){return function(){this.style.removeProperty(t)}}function oM(t,e,n){return function(){this.style.setProperty(t,e,n)}}function aM(t,e,n){return function(){var r=e.apply(this,arguments);r==null?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function z0(t,e,n){return arguments.length>1?this.each((e==null?iM:typeof e=="function"?aM:oM)(t,e,n??"")):Je(this.node(),t)}function Je(t,e){return t.style.getPropertyValue(e)||Dr(t).getComputedStyle(t,null).getPropertyValue(e)}var uf=p(()=>{_s()});function sM(t){return function(){delete this[t]}}function uM(t,e){return function(){this[t]=e}}function lM(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function U0(t,e){return arguments.length>1?this.each((e==null?sM:typeof e=="function"?lM:uM)(t,e)):this.node()[t]}var j0=p(()=>{});function B0(t){return t.trim().split(/^|\s+/)}function lf(t){return t.classList||new X0(t)}function X0(t){this._node=t,this._names=B0(t.getAttribute("class")||"")}function G0(t,e){for(var n=lf(t),r=-1,i=e.length;++r{X0.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}}});function pM(){this.textContent=""}function mM(t){return function(){this.textContent=t}}function dM(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function Q0(t){return arguments.length?this.each(t==null?pM:(typeof t=="function"?dM:mM)(t)):this.node().textContent}var J0=p(()=>{});function gM(){this.innerHTML=""}function yM(t){return function(){this.innerHTML=t}}function _M(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function K0(t){return arguments.length?this.each(t==null?gM:(typeof t=="function"?_M:yM)(t)):this.node().innerHTML}var tg=p(()=>{});function xM(){this.nextSibling&&this.parentNode.appendChild(this)}function eg(){return this.each(xM)}var ng=p(()=>{});function vM(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function rg(){return this.each(vM)}var ig=p(()=>{});function og(t){var e=typeof t=="function"?t:gn(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}var ag=p(()=>{Ui()});function wM(){return null}function sg(t,e){var n=typeof t=="function"?t:gn(t),r=e==null?wM:typeof e=="function"?e:yn(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}var ug=p(()=>{Ui();ds()});function bM(){var t=this.parentNode;t&&t.removeChild(this)}function lg(){return this.each(bM)}var fg=p(()=>{});function MM(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function TM(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function cg(t){return this.select(t?TM:MM)}var hg=p(()=>{});function pg(t){return arguments.length?this.property("__data__",t):this.node().__data__}var mg=p(()=>{});function SM(t){return function(e){t.call(this,e,this.__data__)}}function EM(t){return t.trim().split(/^|\s+/).map(function(e){var n="",r=e.indexOf(".");return r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),{type:e,name:n}})}function IM(t){return function(){var e=this.__on;if(e){for(var n=0,r=-1,i=e.length,o;n{});function yg(t,e,n){var r=Dr(t),i=r.CustomEvent;typeof i=="function"?i=new i(e,n):(i=r.document.createEvent("Event"),n?(i.initEvent(e,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(e,!1,!1)),t.dispatchEvent(i)}function OM(t,e){return function(){return yg(this,t,e)}}function NM(t,e){return function(){return yg(this,t,e.apply(this,arguments))}}function _g(t,e){return this.each((typeof e=="function"?NM:OM)(t,e))}var xg=p(()=>{_s()});function*vg(){for(var t=this._groups,e=0,n=t.length;e{});function ot(t,e){this._groups=t,this._parents=e}function bg(){return new ot([[document.documentElement]],Gi)}function kM(){return this}var Gi,$e,ce=p(()=>{i0();a0();u0();f0();h0();y0();sf();x0();w0();M0();S0();I0();O0();k0();q0();L0();R0();F0();$0();uf();j0();Z0();J0();tg();ng();ig();ag();ug();fg();hg();mg();gg();xg();wg();Gi=[null];ot.prototype=bg.prototype={constructor:ot,select:r0,selectAll:o0,selectChild:s0,selectChildren:l0,filter:c0,data:g0,enter:p0,exit:_0,join:v0,merge:b0,selection:kM,order:T0,sort:E0,call:A0,nodes:N0,node:P0,size:C0,empty:D0,each:H0,attr:Y0,style:z0,property:U0,classed:V0,text:Q0,html:K0,raise:eg,lower:rg,append:og,insert:sg,remove:lg,clone:cg,datum:pg,on:dg,dispatch:_g,[Symbol.iterator]:vg};$e=bg});function Kt(t){return typeof t=="string"?new ot([[document.querySelector(t)]],[document.documentElement]):new ot([[t]],Gi)}var ff=p(()=>{ce()});function Mg(t){return Kt(gn(t).call(document.documentElement))}var Tg=p(()=>{Ui();ff()});function xs(){return new cf}function cf(){this._="@"+(++PM).toString(36)}var PM,Sg=p(()=>{PM=0;cf.prototype=xs.prototype={constructor:cf,get:function(t){for(var e=this._;!(e in t);)if(!(t=t.parentNode))return;return t[e]},set:function(t,e){return t[this._]=e},remove:function(t){return this._ in t&&delete t[this._]},toString:function(){return this._}}});function vs(t){let e;for(;e=t.sourceEvent;)t=e;return t}var hf=p(()=>{});function he(t,e){if(t=vs(t),e===void 0&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=t.clientX,r.y=t.clientY,r=r.matrixTransform(e.getScreenCTM().inverse()),[r.x,r.y]}if(e.getBoundingClientRect){var i=e.getBoundingClientRect();return[t.clientX-i.left-e.clientLeft,t.clientY-i.top-e.clientTop]}}return[t.pageX,t.pageY]}var pf=p(()=>{hf()});function Eg(t,e){return t.target&&(t=vs(t),e===void 0&&(e=t.currentTarget),t=t.touches||[t]),Array.from(t,n=>he(n,e))}var Ig=p(()=>{pf();hf()});function Ag(t){return typeof t=="string"?new ot([document.querySelectorAll(t)],[document.documentElement]):new ot([ji(t)],Gi)}var Og=p(()=>{rf();ce()});var pe={};rn(pe,{create:()=>Mg,creator:()=>gn,local:()=>xs,matcher:()=>Lr,namespace:()=>Ye,namespaces:()=>zi,pointer:()=>he,pointers:()=>Eg,select:()=>Kt,selectAll:()=>Ag,selection:()=>$e,selector:()=>yn,selectorAll:()=>Cr,style:()=>Je,window:()=>Dr});var pt=p(()=>{Tg();Ui();Sg();Bi();ms();ps();pf();Ig();ff();Og();ce();ds();of();uf();_s()});function bs(t){t.preventDefault(),t.stopImmediatePropagation()}var ws,Ng=p(()=>{ws={capture:!0,passive:!1}});function mf(t){var e=t.document.documentElement,n=Kt(t).on("dragstart.drag",bs,ws);"onselectstart"in e?n.on("selectstart.drag",bs,ws):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function df(t,e){var n=t.document.documentElement,r=Kt(t).on("dragstart.drag",null);e&&(r.on("click.drag",bs,ws),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var kg=p(()=>{pt();Ng()});var Pg=p(()=>{kg()});function Ki(){return Wn||(Lg(qM),Wn=Qi.now()+Ss)}function qM(){Wn=0}function Ji(){this._call=this._time=this._next=null}function Es(t,e,n){var r=new Ji;return r.restart(t,e,n),r}function Dg(){Ki(),++Rr;for(var t=Ms,e;t;)(e=Wn-t._time)>=0&&t._call.call(void 0,e),t=t._next;--Rr}function qg(){Wn=(Ts=Qi.now())+Ss,Rr=Vi=0;try{Dg()}finally{Rr=0,LM(),Wn=0}}function CM(){var t=Qi.now(),e=t-Ts;e>Cg&&(Ss-=e,Ts=t)}function LM(){for(var t,e=Ms,n,r=1/0;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:Ms=n);Zi=t,gf(r)}function gf(t){if(!Rr){Vi&&(Vi=clearTimeout(Vi));var e=t-Wn;e>24?(t<1/0&&(Vi=setTimeout(qg,t-Qi.now()-Ss)),Wi&&(Wi=clearInterval(Wi))):(Wi||(Ts=Qi.now(),Wi=setInterval(CM,Cg)),Rr=1,Lg(qg))}}var Rr,Vi,Wi,Cg,Ms,Zi,Ts,Wn,Ss,Qi,Lg,yf=p(()=>{Rr=0,Vi=0,Wi=0,Cg=1e3,Ts=0,Wn=0,Ss=0,Qi=typeof performance=="object"&&performance.now?performance:Date,Lg=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};Ji.prototype=Es.prototype={constructor:Ji,restart:function(t,e,n){if(typeof t!="function")throw new TypeError("callback is not a function");n=(n==null?Ki():+n)+(e==null?0:+e),!this._next&&Zi!==this&&(Zi?Zi._next=this:Ms=this,Zi=this),this._call=t,this._time=n,gf()},stop:function(){this._call&&(this._call=null,this._time=1/0,gf())}}});function Is(t,e,n){var r=new Ji;return e=e==null?0:+e,r.restart(i=>{r.stop(),t(i+e)},e,n),r}var Rg=p(()=>{yf()});var _f=p(()=>{yf();Rg()});function _n(t,e,n,r,i,o){var a=t.__transition;if(!a)t.__transition={};else if(n in a)return;HM(t,n,{name:e,index:r,group:i,on:DM,tween:RM,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:Yg})}function eo(t,e){var n=xt(t,e);if(n.state>Yg)throw new Error("too late; already scheduled");return n}function Nt(t,e){var n=xt(t,e);if(n.state>As)throw new Error("too late; already running");return n}function xt(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function HM(t,e,n){var r=t.__transition,i;r[e]=n,n.timer=Es(o,0,n.time);function o(l){n.state=Hg,n.timer.restart(a,n.delay,n.time),n.delay<=l&&a(l-n.delay)}function a(l){var f,c,h,m;if(n.state!==Hg)return u();for(f in r)if(m=r[f],m.name===n.name){if(m.state===As)return Is(a);m.state===Fg?(m.state=to,m.timer.stop(),m.on.call("interrupt",t,t.__data__,m.index,m.group),delete r[f]):+f{nf();_f();DM=$i("start","end","cancel","interrupt"),RM=[],Yg=0,Hg=1,Os=2,As=3,Fg=4,Ns=5,to=6});function Vn(t,e){var n=t.__transition,r,i,o=!0,a;if(n){e=e==null?null:e+"";for(a in n){if((r=n[a]).name!==e){o=!1;continue}i=r.state>Os&&r.state{Xt()});function $g(t){return this.each(function(){Vn(this,t)})}var zg=p(()=>{xf()});function FM(t,e){var n,r;return function(){var i=Nt(this,t),o=i.tween;if(o!==n){r=n=o;for(var a=0,s=r.length;a{Xt()});function ks(t,e){var n;return(typeof e=="number"?Mt:e instanceof le?cn:(n=le(e))?(e=n,cn):Tr)(t,e)}var vf=p(()=>{Ee();Be()});function $M(t){return function(){this.removeAttribute(t)}}function zM(t){return function(){this.removeAttributeNS(t.space,t.local)}}function UM(t,e,n){var r,i=n+"",o;return function(){var a=this.getAttribute(t);return a===i?null:a===r?o:o=e(r=a,n)}}function jM(t,e,n){var r,i=n+"",o;return function(){var a=this.getAttributeNS(t.space,t.local);return a===i?null:a===r?o:o=e(r=a,n)}}function BM(t,e,n){var r,i,o;return function(){var a,s=n(this),u;return s==null?void this.removeAttribute(t):(a=this.getAttribute(t),u=s+"",a===u?null:a===r&&u===i?o:(i=u,o=e(r=a,s)))}}function XM(t,e,n){var r,i,o;return function(){var a,s=n(this),u;return s==null?void this.removeAttributeNS(t.space,t.local):(a=this.getAttributeNS(t.space,t.local),u=s+"",a===u?null:a===r&&u===i?o:(i=u,o=e(r=a,s)))}}function jg(t,e){var n=Ye(t),r=n==="transform"?Da:ks;return this.attrTween(t,typeof e=="function"?(n.local?XM:BM)(n,r,Hr(this,"attr."+t,e)):e==null?(n.local?zM:$M)(n):(n.local?jM:UM)(n,r,e))}var Bg=p(()=>{Be();pt();no();vf()});function GM(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function WM(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function VM(t,e){var n,r;function i(){var o=e.apply(this,arguments);return o!==r&&(n=(r=o)&&WM(t,o)),n}return i._value=e,i}function ZM(t,e){var n,r;function i(){var o=e.apply(this,arguments);return o!==r&&(n=(r=o)&&GM(t,o)),n}return i._value=e,i}function Xg(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;var r=Ye(t);return this.tween(n,(r.local?VM:ZM)(r,e))}var Gg=p(()=>{pt()});function QM(t,e){return function(){eo(this,t).delay=+e.apply(this,arguments)}}function JM(t,e){return e=+e,function(){eo(this,t).delay=e}}function Wg(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?QM:JM)(e,t)):xt(this.node(),e).delay}var Vg=p(()=>{Xt()});function KM(t,e){return function(){Nt(this,t).duration=+e.apply(this,arguments)}}function t2(t,e){return e=+e,function(){Nt(this,t).duration=e}}function Zg(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?KM:t2)(e,t)):xt(this.node(),e).duration}var Qg=p(()=>{Xt()});function e2(t,e){if(typeof e!="function")throw new Error;return function(){Nt(this,t).ease=e}}function Jg(t){var e=this._id;return arguments.length?this.each(e2(e,t)):xt(this.node(),e).ease}var Kg=p(()=>{Xt()});function n2(t,e){return function(){var n=e.apply(this,arguments);if(typeof n!="function")throw new Error;Nt(this,t).ease=n}}function ty(t){if(typeof t!="function")throw new Error;return this.each(n2(this._id,t))}var ey=p(()=>{Xt()});function ny(t){typeof t!="function"&&(t=Lr(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i{pt();Zn()});function iy(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,r=e.length,i=n.length,o=Math.min(r,i),a=new Array(r),s=0;s{Zn()});function r2(t){return(t+"").trim().split(/^|\s+/).every(function(e){var n=e.indexOf(".");return n>=0&&(e=e.slice(0,n)),!e||e==="start"})}function i2(t,e,n){var r,i,o=r2(e)?eo:Nt;return function(){var a=o(this,t),s=a.on;s!==r&&(i=(r=s).copy()).on(e,n),a.on=i}}function ay(t,e){var n=this._id;return arguments.length<2?xt(this.node(),n).on.on(t):this.each(i2(n,t,e))}var sy=p(()=>{Xt()});function o2(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function uy(){return this.on("end.remove",o2(this._id))}var ly=p(()=>{});function fy(t){var e=this._name,n=this._id;typeof t!="function"&&(t=yn(t));for(var r=this._groups,i=r.length,o=new Array(i),a=0;a{pt();Zn();Xt()});function hy(t){var e=this._name,n=this._id;typeof t!="function"&&(t=Cr(t));for(var r=this._groups,i=r.length,o=[],a=[],s=0;s{pt();Zn();Xt()});function my(){return new a2(this._groups,this._parents)}var a2,dy=p(()=>{pt();a2=$e.prototype.constructor});function s2(t,e){var n,r,i;return function(){var o=Je(this,t),a=(this.style.removeProperty(t),Je(this,t));return o===a?null:o===n&&a===r?i:i=e(n=o,r=a)}}function gy(t){return function(){this.style.removeProperty(t)}}function u2(t,e,n){var r,i=n+"",o;return function(){var a=Je(this,t);return a===i?null:a===r?o:o=e(r=a,n)}}function l2(t,e,n){var r,i,o;return function(){var a=Je(this,t),s=n(this),u=s+"";return s==null&&(u=s=(this.style.removeProperty(t),Je(this,t))),a===u?null:a===r&&u===i?o:(i=u,o=e(r=a,s))}}function f2(t,e){var n,r,i,o="style."+e,a="end."+o,s;return function(){var u=Nt(this,t),l=u.on,f=u.value[o]==null?s||(s=gy(e)):void 0;(l!==n||i!==f)&&(r=(n=l).copy()).on(a,i=f),u.on=r}}function yy(t,e,n){var r=(t+="")=="transform"?La:ks;return e==null?this.styleTween(t,s2(t,r)).on("end.style."+t,gy(t)):typeof e=="function"?this.styleTween(t,l2(t,r,Hr(this,"style."+t,e))).each(f2(this._id,t)):this.styleTween(t,u2(t,r,e),n).on("end.style."+t,null)}var _y=p(()=>{Be();pt();Xt();no();vf()});function c2(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}function h2(t,e,n){var r,i;function o(){var a=e.apply(this,arguments);return a!==i&&(r=(i=a)&&c2(t,a,n)),r}return o._value=e,o}function xy(t,e,n){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(e==null)return this.tween(r,null);if(typeof e!="function")throw new Error;return this.tween(r,h2(t,e,n??""))}var vy=p(()=>{});function p2(t){return function(){this.textContent=t}}function m2(t){return function(){var e=t(this);this.textContent=e??""}}function wy(t){return this.tween("text",typeof t=="function"?m2(Hr(this,"text",t)):p2(t==null?"":t+""))}var by=p(()=>{no()});function d2(t){return function(e){this.textContent=t.call(this,e)}}function g2(t){var e,n;function r(){var i=t.apply(this,arguments);return i!==n&&(e=(n=i)&&d2(i)),e}return r._value=t,r}function My(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(t==null)return this.tween(e,null);if(typeof t!="function")throw new Error;return this.tween(e,g2(t))}var Ty=p(()=>{});function Sy(){for(var t=this._name,e=this._id,n=Ps(),r=this._groups,i=r.length,o=0;o{Zn();Xt()});function Iy(){var t,e,n=this,r=n._id,i=n.size();return new Promise(function(o,a){var s={value:a},u={value:function(){--i===0&&o()}};n.each(function(){var l=Nt(this,r),f=l.on;f!==t&&(e=(t=f).copy(),e._.cancel.push(s),e._.interrupt.push(s),e._.end.push(u)),l.on=e}),i===0&&o()})}var Ay=p(()=>{Xt()});function $t(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function Oy(t){return $e().transition(t)}function Ps(){return++y2}var y2,Ke,Zn=p(()=>{pt();Bg();Gg();Vg();Qg();Kg();ey();ry();oy();sy();ly();cy();py();dy();_y();vy();by();Ty();Ey();no();Ay();y2=0;Ke=$e.prototype;$t.prototype=Oy.prototype={constructor:$t,select:fy,selectAll:hy,selectChild:Ke.selectChild,selectChildren:Ke.selectChildren,filter:ny,merge:iy,selection:my,transition:Sy,call:Ke.call,nodes:Ke.nodes,node:Ke.node,size:Ke.size,empty:Ke.empty,each:Ke.each,on:ay,attr:jg,attrTween:Xg,style:yy,styleTween:xy,text:wy,textTween:My,remove:uy,tween:Ug,delay:Wg,duration:Zg,ease:Jg,easeVarying:ty,end:Iy,[Symbol.iterator]:Ke[Symbol.iterator]}});function qs(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var Ny=p(()=>{});var ky=p(()=>{Ny()});function x2(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}function Py(t){var e,n;t instanceof $t?(e=t._id,t=t._name):(e=Ps(),(n=_2).time=Ki(),t=t==null?null:t+"");for(var r=this._groups,i=r.length,o=0;o{Zn();Xt();ky();_f();_2={time:null,delay:0,duration:250,ease:qs}});var Cy=p(()=>{pt();zg();qy();$e.prototype.interrupt=$g;$e.prototype.transition=Py});var Ly=p(()=>{Cy();xf()});var ro,Dy=p(()=>{ro=t=>()=>t});function wf(t,{sourceEvent:e,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}var Ry=p(()=>{});function me(t,e,n){this.k=t,this.x=e,this.y=n}function Cs(t){for(;!t.__zoom;)if(!(t=t.parentNode))return Fr;return t.__zoom}var Fr,bf=p(()=>{me.prototype={constructor:me,scale:function(t){return t===1?this:new me(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new me(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};Fr=new me(1,0,0);Cs.prototype=me.prototype});function Ls(t){t.stopImmediatePropagation()}function Yr(t){t.preventDefault(),t.stopImmediatePropagation()}var Hy=p(()=>{});function v2(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function w2(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]):[[0,0],[t.clientWidth,t.clientHeight]]}function Fy(){return this.__zoom||Fr}function b2(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function M2(){return navigator.maxTouchPoints||"ontouchstart"in this}function T2(t,e,n){var r=t.invertX(e[0][0])-n[0][0],i=t.invertX(e[1][0])-n[1][0],o=t.invertY(e[0][1])-n[0][1],a=t.invertY(e[1][1])-n[1][1];return t.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),a>o?(o+a)/2:Math.min(0,o)||Math.max(0,a))}function Yy(){var t=v2,e=w2,n=T2,r=b2,i=M2,o=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],s=250,u=Ra,l=$i("start","zoom","end"),f,c,h,m=500,g=150,y=0,M=10;function _(d){d.property("__zoom",Fy).on("wheel.zoom",z,{passive:!1}).on("mousedown.zoom",tt).on("dblclick.zoom",V).filter(i).on("touchstart.zoom",W).on("touchmove.zoom",v).on("touchend.zoom touchcancel.zoom",T).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}_.transform=function(d,S,x,N){var C=d.selection?d.selection():d;C.property("__zoom",Fy),d!==C?P(d,S,x,N):C.interrupt().each(function(){w(this,arguments).event(N).start().zoom(null,typeof S=="function"?S.apply(this,arguments):S).end()})},_.scaleBy=function(d,S,x,N){_.scaleTo(d,function(){var C=this.__zoom.k,R=typeof S=="function"?S.apply(this,arguments):S;return C*R},x,N)},_.scaleTo=function(d,S,x,N){_.transform(d,function(){var C=e.apply(this,arguments),R=this.__zoom,L=x==null?I(C):typeof x=="function"?x.apply(this,arguments):x,j=R.invert(L),Z=typeof S=="function"?S.apply(this,arguments):S;return n(A(E(R,Z),L,j),C,a)},x,N)},_.translateBy=function(d,S,x,N){_.transform(d,function(){return n(this.__zoom.translate(typeof S=="function"?S.apply(this,arguments):S,typeof x=="function"?x.apply(this,arguments):x),e.apply(this,arguments),a)},null,N)},_.translateTo=function(d,S,x,N,C){_.transform(d,function(){var R=e.apply(this,arguments),L=this.__zoom,j=N==null?I(R):typeof N=="function"?N.apply(this,arguments):N;return n(Fr.translate(j[0],j[1]).scale(L.k).translate(typeof S=="function"?-S.apply(this,arguments):-S,typeof x=="function"?-x.apply(this,arguments):-x),R,a)},N,C)};function E(d,S){return S=Math.max(o[0],Math.min(o[1],S)),S===d.k?d:new me(S,d.x,d.y)}function A(d,S,x){var N=S[0]-x[0]*d.k,C=S[1]-x[1]*d.k;return N===d.x&&C===d.y?d:new me(d.k,N,C)}function I(d){return[(+d[0][0]+ +d[1][0])/2,(+d[0][1]+ +d[1][1])/2]}function P(d,S,x,N){d.on("start.zoom",function(){w(this,arguments).event(N).start()}).on("interrupt.zoom end.zoom",function(){w(this,arguments).event(N).end()}).tween("zoom",function(){var C=this,R=arguments,L=w(C,R).event(N),j=e.apply(C,R),Z=x==null?I(j):typeof x=="function"?x.apply(C,R):x,Pt=Math.max(j[1][0]-j[0][0],j[1][1]-j[0][1]),ct=C.__zoom,ht=typeof S=="function"?S.apply(C,R):S,Rt=u(ct.invert(Z).concat(Pt/ct.k),ht.invert(Z).concat(Pt/ht.k));return function(It){if(It===1)It=ht;else{var Ht=Rt(It),k=Pt/Ht[2];It=new me(k,Z[0]-Ht[0]*k,Z[1]-Ht[1]*k)}L.zoom(null,It)}})}function w(d,S,x){return!x&&d.__zooming||new q(d,S)}function q(d,S){this.that=d,this.args=S,this.active=0,this.sourceEvent=null,this.extent=e.apply(d,S),this.taps=0}q.prototype={event:function(d){return d&&(this.sourceEvent=d),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(d,S){return this.mouse&&d!=="mouse"&&(this.mouse[1]=S.invert(this.mouse[0])),this.touch0&&d!=="touch"&&(this.touch0[1]=S.invert(this.touch0[0])),this.touch1&&d!=="touch"&&(this.touch1[1]=S.invert(this.touch1[0])),this.that.__zoom=S,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(d){var S=Kt(this.that).datum();l.call(d,this.that,new wf(d,{sourceEvent:this.sourceEvent,target:_,type:d,transform:this.that.__zoom,dispatch:l}),S)}};function z(d,...S){if(!t.apply(this,arguments))return;var x=w(this,S).event(d),N=this.__zoom,C=Math.max(o[0],Math.min(o[1],N.k*Math.pow(2,r.apply(this,arguments)))),R=he(d);if(x.wheel)(x.mouse[0][0]!==R[0]||x.mouse[0][1]!==R[1])&&(x.mouse[1]=N.invert(x.mouse[0]=R)),clearTimeout(x.wheel);else{if(N.k===C)return;x.mouse=[R,N.invert(R)],Vn(this),x.start()}Yr(d),x.wheel=setTimeout(L,g),x.zoom("mouse",n(A(E(N,C),x.mouse[0],x.mouse[1]),x.extent,a));function L(){x.wheel=null,x.end()}}function tt(d,...S){if(h||!t.apply(this,arguments))return;var x=d.currentTarget,N=w(this,S,!0).event(d),C=Kt(d.view).on("mousemove.zoom",Z,!0).on("mouseup.zoom",Pt,!0),R=he(d,x),L=d.clientX,j=d.clientY;mf(d.view),Ls(d),N.mouse=[R,this.__zoom.invert(R)],Vn(this),N.start();function Z(ct){if(Yr(ct),!N.moved){var ht=ct.clientX-L,Rt=ct.clientY-j;N.moved=ht*ht+Rt*Rt>y}N.event(ct).zoom("mouse",n(A(N.that.__zoom,N.mouse[0]=he(ct,x),N.mouse[1]),N.extent,a))}function Pt(ct){C.on("mousemove.zoom mouseup.zoom",null),df(ct.view,N.moved),Yr(ct),N.event(ct).end()}}function V(d,...S){if(t.apply(this,arguments)){var x=this.__zoom,N=he(d.changedTouches?d.changedTouches[0]:d,this),C=x.invert(N),R=x.k*(d.shiftKey?.5:2),L=n(A(E(x,R),N,C),e.apply(this,S),a);Yr(d),s>0?Kt(this).transition().duration(s).call(P,L,N,d):Kt(this).call(_.transform,L,N,d)}}function W(d,...S){if(t.apply(this,arguments)){var x=d.touches,N=x.length,C=w(this,S,d.changedTouches.length===N).event(d),R,L,j,Z;for(Ls(d),L=0;L{nf();Pg();Be();pt();Ly();Dy();Ry();bf();Hy()});var zy={};rn(zy,{ZoomTransform:()=>me,zoom:()=>Yy,zoomIdentity:()=>Fr,zoomTransform:()=>Cs});var Uy=p(()=>{$y();bf()});var t_=O((jF,Mf)=>{"use strict";var $r=typeof Reflect=="object"?Reflect:null,jy=$r&&typeof $r.apply=="function"?$r.apply:function(e,n,r){return Function.prototype.apply.call(e,n,r)},Ds;$r&&typeof $r.ownKeys=="function"?Ds=$r.ownKeys:Object.getOwnPropertySymbols?Ds=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Ds=function(e){return Object.getOwnPropertyNames(e)};function S2(t){console&&console.warn&&console.warn(t)}var Xy=Number.isNaN||function(e){return e!==e};function Q(){Q.init.call(this)}Mf.exports=Q;Mf.exports.once=O2;Q.EventEmitter=Q;Q.prototype._events=void 0;Q.prototype._eventsCount=0;Q.prototype._maxListeners=void 0;var By=10;function Rs(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(Q,"defaultMaxListeners",{enumerable:!0,get:function(){return By},set:function(t){if(typeof t!="number"||t<0||Xy(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");By=t}});Q.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};Q.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||Xy(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function Gy(t){return t._maxListeners===void 0?Q.defaultMaxListeners:t._maxListeners}Q.prototype.getMaxListeners=function(){return Gy(this)};Q.prototype.emit=function(e){for(var n=[],r=1;r0&&(a=n[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var u=o[e];if(u===void 0)return!1;if(typeof u=="function")jy(u,this,n);else for(var l=u.length,f=Jy(u,l),r=0;r0&&a.length>i&&!a.warned){a.warned=!0;var s=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");s.name="MaxListenersExceededWarning",s.emitter=t,s.type=e,s.count=a.length,S2(s)}return t}Q.prototype.addListener=function(e,n){return Wy(this,e,n,!1)};Q.prototype.on=Q.prototype.addListener;Q.prototype.prependListener=function(e,n){return Wy(this,e,n,!0)};function E2(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Vy(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},i=E2.bind(r);return i.listener=n,r.wrapFn=i,i}Q.prototype.once=function(e,n){return Rs(n),this.on(e,Vy(this,e,n)),this};Q.prototype.prependOnceListener=function(e,n){return Rs(n),this.prependListener(e,Vy(this,e,n)),this};Q.prototype.removeListener=function(e,n){var r,i,o,a,s;if(Rs(n),i=this._events,i===void 0)return this;if(r=i[e],r===void 0)return this;if(r===n||r.listener===n)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,r.listener||n));else if(typeof r!="function"){for(o=-1,a=r.length-1;a>=0;a--)if(r[a]===n||r[a].listener===n){s=r[a].listener,o=a;break}if(o<0)return this;o===0?r.shift():I2(r,o),r.length===1&&(i[e]=r[0]),i.removeListener!==void 0&&this.emit("removeListener",e,s||n)}return this};Q.prototype.off=Q.prototype.removeListener;Q.prototype.removeAllListeners=function(e){var n,r,i;if(r=this._events,r===void 0)return this;if(r.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):r[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete r[e]),this;if(arguments.length===0){var o=Object.keys(r),a;for(i=0;i=0;i--)this.removeListener(e,n[i]);return this};function Zy(t,e,n){var r=t._events;if(r===void 0)return[];var i=r[e];return i===void 0?[]:typeof i=="function"?n?[i.listener||i]:[i]:n?A2(i):Jy(i,i.length)}Q.prototype.listeners=function(e){return Zy(this,e,!0)};Q.prototype.rawListeners=function(e){return Zy(this,e,!1)};Q.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):Qy.call(t,e)};Q.prototype.listenerCount=Qy;function Qy(t){var e=this._events;if(e!==void 0){var n=e[t];if(typeof n=="function")return 1;if(n!==void 0)return n.length}return 0}Q.prototype.eventNames=function(){return this._eventsCount>0?Ds(this._events):[]};function Jy(t,e){for(var n=new Array(e),r=0;r{"use strict";Object.defineProperty(Tf,"__esModule",{value:!0});var k2=(ci(),it(fi)),P2=(pt(),it(pe));function q2(t){let e=t.owner.meta.xScale,n=t.owner.meta.yScale,r=(0,k2.line)().x(function(i){return i[0]}).y(function(i){return i[1]});return function(i){i.each(function(){let a=(0,P2.select)(this).selectAll("g.annotations").data(function(g){return g.annotations||[]}),s=a.enter().append("g").attr("class","annotations"),u=n.range(),l=e.range(),f=a.merge(s).selectAll("path").data(function(g){return"x"in g?[[[0,u[0]],[0,u[1]]]]:[[[l[0],0],[l[1],0]]]}),c=f.enter().append("path");f.merge(c).attr("stroke","#eee").attr("d",r),f.exit().remove();let h=a.merge(s).selectAll("text").data(function(g){return[{text:g.text||"",hasX:"x"in g}]}),m=h.enter().append("text");h.merge(m).text(function(g){return g.text}).attr("y",function(g){return g.hasX?3:0}).attr("x",function(g){return g.hasX?0:3}).attr("dy",function(g){return g.hasX?5:-5}).attr("text-anchor",function(g){return g.hasX?"end":""}).attr("transform",function(g){return g.hasX?"rotate(-90)":""}),h.exit().remove(),a.merge(s).attr("transform",function(g){return"x"in g?"translate("+e(g.x)+", 0)":"translate(0, "+n(g.y)+")"}),a.exit().remove()})}}Tf.default=q2});var zr=O(oo=>{"use strict";Object.defineProperty(oo,"__esModule",{value:!0});oo.registerGraphType=void 0;var C2=(Ee(),it(Sa)),io={COLORS:["steelblue","red","#05b378","orange","#4040e8","yellow","brown","magenta","cyan"].map(function(t){return(0,C2.hsl)(t)}),DEFAULT_WIDTH:550,DEFAULT_HEIGHT:350,DEFAULT_ITERATIONS:null,TIP_X_EPS:1,MAX_ITERATIONS:0,graphTypes:{}};io.MAX_ITERATIONS=io.DEFAULT_WIDTH*10;function L2(t,e){if(Object.hasOwn(io.graphTypes,t))throw new Error(`registerGraphType: graphType ${t} is already registered.`);io.graphTypes[t]=e}oo.registerGraphType=L2;oo.default=io});var ze=O(ao=>{"use strict";var D2=ao&&ao.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ao,"__esModule",{value:!0});var n_=D2(zr()),R2={linspace:function(t,e,n){let r=(e-t)/(n-1);return Array.from({length:n},(i,o)=>t+r*o)},logspace:function(t,e,n){return this.linspace(t,e,n).map(r=>Math.pow(10,r))},isValidNumber:function(t){return typeof t=="number"&&!isNaN(t)},space:function(t,e,n){let r=e[0],i=e[1];return t.type==="log"?this.logspace(Math.log10(r),Math.log10(i),n):this.linspace(r,i,n)},getterSetter:function(t,e){let n=this;this[e]=function(r){return arguments.length?(t[e]=r,n):t[e]}},sgn:function(t){return t<0?-1:t>0?1:0},clamp:function(t,e,n){return tn?n:t},color:function(t,e){let n=e%n_.default.COLORS.length;return t.color||n_.default.COLORS[n].hex()},infinity:function(){return 9007199254740991}};ao.default=R2});var Sf=O((WF,r_)=>{r_.exports={EOF:0,DELIMITER:1,NUMBER:2,STRING:3,SYMBOL:4}});var If=O((VF,o_)=>{var Qn=Sf(),H2={n:` +`,f:"\f",r:"\r",t:" ",v:"\v","'":"'",'"':'"'},F2={",":!0,"(":!0,")":!0,"[":!0,"]":!0,";":!0,"~":!0,"!":!0,"+":!0,"-":!0,"*":!0,"/":!0,"%":!0,"^":!0,"**":!0,"|":!0,"&":!0,"^|":!0,"=":!0,":":!0,"?":!0,"||":!0,"&&":!0,xor:!0,"==":!0,"!=":!0,"===":!0,"!==":!0,"<":!0,">":!0,">=":!0,"<=":!0,">>>":!0,"<<":!0,">>":!0};function tn(t){return t>="0"&&t<="9"}function i_(t){return t>="a"&&t<="z"||t>="A"&&t<="Z"||t==="$"||t==="_"}function Y2(t){return t===" "||t==="\r"||t===" "||t===` +`||t==="\v"||t==="\xA0"}function Ef(t){return F2[t]}function $2(t){return t==="'"||t==='"'}function xn(){}xn.prototype.throwError=function(t,e){e=typeof e>"u"?this.index:e;var n=new Error(t+" at index "+e);throw n.index=e,n.description=t,n};xn.prototype.lex=function(t){for(this.text=t,this.index=0,this.tokens=[];this.index=this.text.length))return this.text.charAt(this.index+t)};xn.prototype.consume=function(){var t=this.peek();return this.index+=1,t};xn.prototype.readNumber=function(){var t="";if(this.peek()===".")t+=this.consume(),tn(this.peek())||this.throwError("number expected");else{for(;tn(this.peek());)t+=this.consume();this.peek()==="."&&(t+=this.consume())}for(;tn(this.peek());)t+=this.consume();if(this.peek()==="e"||this.peek()==="E")for(t+=this.consume(),tn(this.peek())||this.peek()==="+"||this.peek()==="-"||this.throwError(),(this.peek()==="+"||this.peek()==="-")&&(t+=this.consume()),tn(this.peek())||this.throwError("number expected");tn(this.peek());)t+=this.consume();return t};xn.prototype.readIdentifier=function(){for(var t="";i_(this.peek())||tn(this.peek());)t+=this.consume();return t};xn.prototype.readString=function(){for(var t=this.consume(),e="",n;;){var r=this.consume();if(r||this.throwError("string is not closed"),n){if(r==="u"){var i=this.text.substring(this.index+1,this.index+5);i.match(/[\da-f]{4}/i)||this.throwError("invalid unicode escape"),this.index+=4,e+=String.fromCharCode(parseInt(i,16))}else{var o=H2[r];o?e+=o:e+=r}n=!1}else{if(r===t)break;r==="\\"?n=!0:e+=r}}return e};o_.exports=xn});var Ie=O((ZF,s_)=>{function a_(){}a_.prototype.type="Node";s_.exports=a_});var Of=O((QF,u_)=>{var z2=Ie(),U2={number:!0,string:!0,boolean:!0,undefined:!0,null:!0};function Af(t,e){if(!U2[e])throw Error("unsupported type '"+e+"'");this.value=t,this.valueType=e}Af.prototype=Object.create(z2.prototype);Af.prototype.type="ConstantNode";u_.exports=Af});var kf=O((JF,l_)=>{var j2=Ie();function Nf(t,e){this.op=t,this.args=e||[]}Nf.prototype=Object.create(j2.prototype);Nf.prototype.type="OperatorNode";l_.exports=Nf});var qf=O((KF,f_)=>{var B2=Ie();function Pf(t,e){this.op=t,this.argument=e}Pf.prototype=Object.create(B2.prototype);Pf.prototype.type="UnaryNode";f_.exports=Pf});var Lf=O((tY,c_)=>{var X2=Ie();function Cf(t){this.name=t}Cf.prototype=Object.create(X2.prototype);Cf.prototype.type="SymbolNode";c_.exports=Cf});var Rf=O((eY,h_)=>{var G2=Ie();function Df(t,e){this.name=t,this.args=e}Df.prototype=Object.create(G2.prototype);Df.prototype.type="FunctionNode";h_.exports=Df});var Ff=O((nY,p_)=>{var W2=Ie();function Hf(t){this.nodes=t}Hf.prototype=Object.create(W2.prototype);Hf.prototype.type="ArrayNode";p_.exports=Hf});var $f=O((rY,m_)=>{var V2=Ie();function Yf(t,e,n){this.condition=t,this.trueExpr=e,this.falseExpr=n}Yf.prototype=Object.create(V2.prototype);Yf.prototype.type="ConditionalNode";m_.exports=Yf});var Uf=O((iY,d_)=>{var Z2=Ie();function zf(t,e){this.name=t,this.expr=e}zf.prototype=Object.create(Z2.prototype);zf.prototype.type="AssignmentNode";d_.exports=zf});var Bf=O((oY,g_)=>{var Q2=Ie();function jf(t){this.blocks=t}jf.prototype=Object.create(Q2.prototype);jf.prototype.type="BlockNode";g_.exports=jf});var x_=O((aY,__)=>{var Jn=Sf(),J2=If(),Xf=Of(),te=kf(),K2=qf(),y_=Lf(),tT=Rf(),eT=Ff(),nT=$f(),rT=Uf(),iT=Bf();function G(){this.lexer=new J2,this.tokens=null}G.prototype.current=function(){return this.tokens[0]};G.prototype.next=function(){return this.tokens[1]};G.prototype.peek=function(){if(this.tokens.length){for(var t=this.tokens[0],e=0;e=","<=",">","<")){var e=this.consume(),n=this.shift();return new te(e.value,[t,n])}return t};G.prototype.shift=function(){var t=this.additive();if(this.peek(">>","<<",">>>")){var e=this.consume(),n=this.shift();return new te(e.value,[t,n])}return t};G.prototype.additive=function(){for(var t=this.multiplicative();this.peek("+","-");){var e=this.consume();t=new te(e.value,[t,this.multiplicative()])}return t};G.prototype.multiplicative=function(){for(var t,e,n=this.unary();this.peek("*","/","%");)t=this.consume(),n=new te(t.value,[n,this.unary()]);return this.current().type===Jn.SYMBOL||this.peek("(")||!(n.type instanceof Xf)&&this.current().type===Jn.NUMBER?(e=this.multiplicative(),new te("*",[n,e])):n};G.prototype.unary=function(){if(this.peek("-","+","~")){var t=this.consume(),e=this.unary();return new K2(t.value,e)}return this.pow()};G.prototype.pow=function(){var t=this.factorial();if(this.peek("^","**")){var e=this.consume(),n=this.unary();return new te(e.value,[t,n])}return t};G.prototype.factorial=function(){var t=this.symbol();if(this.peek("!")){var e=this.consume();return new te(e.value,[t])}return t};G.prototype.symbol=function(){var t=this.current();if(t.type===Jn.SYMBOL){var e=this.consume(),n=this.functionCall(e);return n}return this.string()};G.prototype.functionCall=function(t){var e=t.value;if(this.peek("(")){this.consume();for(var n=[];!this.peek(")")&&!this.isEOF();)n.push(this.assignment()),this.peek(",")&&this.consume();return this.expect(")"),new tT(e,n)}return new y_(e)};G.prototype.string=function(){return this.current().type===Jn.STRING?new Xf(this.consume().value,"string"):this.array()};G.prototype.array=function(){if(this.peek("[")){this.consume();for(var t=[];!this.peek("]")&&!this.isEOF();)t.push(this.assignment()),this.peek(",")&&this.consume();return this.expect("]"),new eT(t)}return this.number()};G.prototype.number=function(){var t=this.current();return t.type===Jn.NUMBER?new Xf(this.consume().value,"number"):this.parentheses()};G.prototype.parentheses=function(){var t=this.current();if(t.value==="("){this.consume();var e=this.assignment();return this.expect(")"),e}return this.end()};G.prototype.end=function(){var t=this.current();if(t.type!==Jn.EOF)throw Error("unexpected end of expression")};__.exports=G});var w_=O((sY,v_)=>{v_.exports={ArrayNode:Ff(),AssignmentNode:Uf(),BlockNode:Bf(),ConditionalNode:$f(),ConstantNode:Of(),FunctionNode:Rf(),Node:Ie(),OperatorNode:kf(),SymbolNode:Lf(),UnaryNode:qf()}});var Gf=O((uY,Hs)=>{"use strict";Hs.exports.Lexer=If();Hs.exports.Parser=x_();Hs.exports.nodeTypes=w_()});var Wf=O((lY,O_)=>{"use strict";var Fs=Object.prototype.hasOwnProperty,A_=Object.prototype.toString,b_=Object.defineProperty,M_=Object.getOwnPropertyDescriptor,T_=function(e){return typeof Array.isArray=="function"?Array.isArray(e):A_.call(e)==="[object Array]"},S_=function(e){if(!e||A_.call(e)!=="[object Object]")return!1;var n=Fs.call(e,"constructor"),r=e.constructor&&e.constructor.prototype&&Fs.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!n&&!r)return!1;var i;for(i in e);return typeof i>"u"||Fs.call(e,i)},E_=function(e,n){b_&&n.name==="__proto__"?b_(e,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):e[n.name]=n.newValue},I_=function(e,n){if(n==="__proto__")if(Fs.call(e,n)){if(M_)return M_(e,n).value}else return;return e[n]};O_.exports=function t(){var e,n,r,i,o,a,s=arguments[0],u=1,l=arguments.length,f=!1;for(typeof s=="boolean"&&(f=s,s=arguments[1]||{},u=2),(s==null||typeof s!="object"&&typeof s!="function")&&(s={});u{"use strict";N_.exports=function(t){let e=this,n=[];this.rawify(this.options.rawArrayExpressionElements,function(){n=t.nodes.map(function(i){return e.next(i)})});let r="["+n.join(",")+"]";return this.options.raw?r:this.options.factory+"("+r+")"}});var q_=O((cY,P_)=>{"use strict";P_.exports=function(t){return"scope["+JSON.stringify(t.name)+"] = "+this.next(t.expr)}});var L_=O((hY,C_)=>{"use strict";C_.exports=function(t){let e="!!("+this.next(t.condition)+")",n=this.next(t.trueExpr),r=this.next(t.falseExpr);return"("+e+" ? ("+n+") : ("+r+") )"}});var R_=O((pY,D_)=>{"use strict";D_.exports=function(t){if(this.options.raw)return t.value;let e=t.valueType==="string"?JSON.stringify(t.value):t.value;return this.options.factory+"("+e+")"}});var F_=O((mY,Vf)=>{"use strict";var oT=Gf().nodeTypes.SymbolNode,H_=function(t){return"$$mathCodegen.functionProxy("+this.next(new oT(t.name))+", "+JSON.stringify(t.name)+")"};Vf.exports=function(t){let e=this,n=H_.call(this,t),r=[];return this.rawify(this.options.rawCallExpressionElements,function(){r=t.args.map(function(i){return e.next(i)})}),n+"("+r.join(", ")+")"};Vf.exports.functionProxy=H_});var $_=O((dY,Y_)=>{"use strict";Y_.exports={"+":"add","-":"sub","*":"mul","/":"div","^":"pow","%":"mod","!":"factorial","|":"bitwiseOR","^|":"bitwiseXOR","&":"bitwiseAND","||":"logicalOR",xor:"logicalXOR","&&":"logicalAND","<":"lessThan",">":"greaterThan","<=":"lessEqualThan",">=":"greaterEqualThan","===":"strictlyEqual","==":"equal","!==":"strictlyNotEqual","!=":"notEqual",">>":"shiftRight","<<":"shiftLeft",">>>":"unsignedRightShift"}});var U_=O((gY,z_)=>{"use strict";var aT=$_();z_.exports=function(t){if(this.options.raw)return["("+this.next(t.args[0]),t.op,this.next(t.args[1])+")"].join(" ");let e=aT[t.op];if(!e)throw TypeError("unidentified operator");return this.FunctionNode({name:e,args:t.args})}});var B_=O((yY,j_)=>{"use strict";j_.exports=function(t){let e=t.name;return"$$mathCodegen.getProperty("+JSON.stringify(e)+", scope, ns)"}});var G_=O((_Y,X_)=>{"use strict";X_.exports={"+":"positive","-":"negative","~":"oneComplement"}});var Z_=O((xY,V_)=>{"use strict";var W_=G_();V_.exports=function(t){if(this.options.raw)return t.op+this.next(t.argument);if(!(t.op in W_))throw new SyntaxError(t.op+" not implemented");let e=W_[t.op];return this.FunctionNode({name:e,args:[t.argument]})}});var K_=O((vY,J_)=>{"use strict";var Q_=Wf(),sT={ArrayNode:k_(),AssignmentNode:q_(),ConditionalNode:L_(),ConstantNode:R_(),FunctionNode:F_(),OperatorNode:U_(),SymbolNode:B_(),UnaryNode:Z_()},Ys=function(t,e){this.owner=t,this.options=Q_({factory:"ns.factory",raw:!1,rawArrayExpressionElements:!0,rawCallExpressionElements:!1,applyFactoryToScope:!1},e);let n=this.options.factory;if(typeof n!="string"||!/^[a-zA-Z_$][a-zA-Z0-9_$]*(\.[a-zA-Z_$][a-zA-Z0-9_$]*)*$/.test(n))throw new Error('factory must be a valid JS property access path (e.g. "ns.factory")')};Q_(Ys.prototype,sT);Ys.prototype.next=function(t){if(!(t.type in this))throw new TypeError("the node type "+t.type+" is not implemented");return this[t.type](t)};Ys.prototype.rawify=function(t,e){let n=this.options.raw;t&&(this.options.raw=!0),e(),t&&(this.options.raw=n)};J_.exports=Ys});var ex=O((wY,tx)=>{"use strict";var uT=Gf().Parser,lT=K_(),fT=Wf();function $s(t,e){this.statements=[],this.defs=e||{},this.interpreter=new lT(this,t)}$s.prototype.setDefs=function(t){return this.defs=fT(this.defs,t),this};$s.prototype.compile=function(t){let e=this;if(!t||!(typeof t=="object"||typeof t=="function"))throw TypeError("namespace must be an object");if(typeof t.factory!="function")throw TypeError("namespace.factory must be a function");this.defs.ns=t,this.defs.$$mathCodegen={getProperty:function(a,s,u){function l(f){return e.interpreter.options.applyFactoryToScope&&typeof f!="function"?u.factory(f):f}if(a in s)return l(s[a]);if(a in u)return l(u[a]);throw SyntaxError('symbol "'+a+'" is undefined')},functionProxy:function(a,s){if(typeof a!="function")throw SyntaxError('symbol "'+s+'" must be a function');return a}},this.defs.$$processScope=this.defs.$$processScope||function(){};let n=Object.keys(this.defs).map(function(a){return"var "+a+' = defs["'+a+'"]'});if(!this.statements.length)throw Error("there are no statements saved in this generator, make sure you parse an expression before compiling it");this.statements[this.statements.length-1]="return "+this.statements[this.statements.length-1];let r=this.statements.join(";"),i=n.join(` +`)+` +`+["return {"," eval: function (scope) {"," scope = scope || {}"," $$processScope(scope)"," "+r," },"," code: "+JSON.stringify(r),"}"].join(` +`);var o=new Function("defs",i);return o(this.defs)};$s.prototype.parse=function(t){let e=this,n=new uT().parse(t);return this.statements=n.blocks.map(function(r){return e.interpreter.next(r)}),this};tx.exports=$s});var Zf=O((bY,nx)=>{"use strict";nx.exports=ex()});var ix=O((MY,rx)=>{"use strict";rx.exports=function(){let t=Object.create(Math);return t.factory=function(e){if(typeof e!="number")throw new TypeError("built-in math factory only accepts numbers");return Number(e)},t.add=function(e,n){return e+n},t.sub=function(e,n){return e-n},t.mul=function(e,n){return e*n},t.div=function(e,n){return e/n},t.mod=function(e,n){return e%n},t.factorial=function(e){let n=1;for(let r=2;r<=e;r+=1)n*=r;return n},t.nthRoot=function(e,n){let r=n<0;if(r&&(n=-n),n===0)throw new Error("Root must be non-zero");if(e<0&&Math.abs(n)%2!==1)throw new Error("Root must be odd when a is negative.");if(e===0)return 0;if(!isFinite(e))return r?0:e;let i=Math.pow(Math.abs(e),1/n);return i=e<0?-i:i,r?1/i:i},t.logicalOR=function(e,n){return e||n},t.logicalXOR=function(e,n){return e!=n},t.logicalAND=function(e,n){return e&&n},t.bitwiseOR=function(e,n){return e|n},t.bitwiseXOR=function(e,n){return e^n},t.bitwiseAND=function(e,n){return e&n},t.lessThan=function(e,n){return en},t.greaterEqualThan=function(e,n){return e>=n},t.equal=function(e,n){return e==n},t.strictlyEqual=function(e,n){return e===n},t.notEqual=function(e,n){return e!=n},t.strictlyNotEqual=function(e,n){return e!==n},t.shiftRight=function(e,n){return e>>n},t.shiftLeft=function(e,n){return e<>>n},t.negative=function(e){return-e},t.positive=function(e){return e},t}});var ox=O((TY,Jf)=>{"use strict";var cT=Zf(),Qf=ix()();function hT(t){Object.keys(t).forEach(function(e){let n=t[e];t[e]=Qf.factory(n)})}Jf.exports=function(t){return new cT().setDefs({$$processScope:hT}).parse(t).compile(Qf)};Jf.exports.math=Qf});var sx=O((SY,ax)=>{"use strict";ax.exports=ox()});var Ue=O(St=>{"use strict";Object.defineProperty(St,"__esModule",{value:!0});St.intervalsOverlap=St.hasInterval=St.hasValue=St.zeroIn=St.isSingleton=St.isWhole=St.isEmpty=St.isInterval=void 0;function pT(t){return typeof t=="object"&&typeof t.lo=="number"&&typeof t.hi=="number"}St.isInterval=pT;function Ur(t){return t.lo>t.hi}St.isEmpty=Ur;function mT(t){return t.lo===-1/0&&t.hi===1/0}St.isWhole=mT;function dT(t){return t.lo===t.hi}St.isSingleton=dT;function gT(t){return ux(t,0)}St.zeroIn=gT;function ux(t,e){return Ur(t)?!1:t.lo<=e&&e<=t.hi}St.hasValue=ux;function yT(t,e){return Ur(t)?!0:!Ur(e)&&e.lo<=t.lo&&t.hi<=e.hi}St.hasInterval=yT;function _T(t,e){return Ur(t)||Ur(e)?!1:t.lo<=e.lo&&e.lo<=t.hi||e.lo<=t.lo&&t.lo<=e.hi}St.intervalsOverlap=_T});var lx=O((IY,mt)=>{var Kf=!1;if(typeof Float64Array<"u")if(Ae=new Float64Array(1),zt=new Uint32Array(Ae.buffer),Ae[0]=1,Kf=!0,zt[1]===1072693248){let t=function(r,i){return zt[0]=r,zt[1]=i,Ae[0]},e=function(r){return Ae[0]=r,zt[0]},n=function(r){return Ae[0]=r,zt[1]};xT=t,vT=e,wT=n,mt.exports=function(i){return Ae[0]=i,[zt[0],zt[1]]},mt.exports.pack=t,mt.exports.lo=e,mt.exports.hi=n}else if(zt[0]===1072693248){let t=function(r,i){return zt[1]=r,zt[0]=i,Ae[0]},e=function(r){return Ae[0]=r,zt[1]},n=function(r){return Ae[0]=r,zt[0]};bT=t,MT=e,TT=n,mt.exports=function(i){return Ae[0]=i,[zt[1],zt[0]]},mt.exports.pack=t,mt.exports.lo=e,mt.exports.hi=n}else Kf=!1;var Ae,zt,xT,vT,wT,bT,MT,TT;if(!Kf){let t=function(r,i){return Oe.writeUInt32LE(r,0,!0),Oe.writeUInt32LE(i,4,!0),Oe.readDoubleLE(0,!0)},e=function(r){return Oe.writeDoubleLE(r,0,!0),Oe.readUInt32LE(0,!0)},n=function(r){return Oe.writeDoubleLE(r,0,!0),Oe.readUInt32LE(4,!0)};ST=t,ET=e,IT=n,Oe=new Buffer(8),mt.exports=function(i){return Oe.writeDoubleLE(i,0,!0),[Oe.readUInt32LE(0,!0),Oe.readUInt32LE(4,!0)]},mt.exports.pack=t,mt.exports.lo=e,mt.exports.hi=n}var Oe,ST,ET,IT;mt.exports.sign=function(t){return mt.exports.hi(t)>>>31};mt.exports.exponent=function(t){var e=mt.exports.hi(t);return(e<<1>>>21)-1023};mt.exports.fraction=function(t){var e=mt.exports.lo(t),n=mt.exports.hi(t),r=n&(1<<20)-1;return n&2146435072&&(r+=1<<20),[e,r]};mt.exports.denormalized=function(t){var e=mt.exports.hi(t);return!(e&2146435072)}});var px=O((AY,hx)=>{"use strict";var tc=lx(),fx=Math.pow(2,-1074),cx=-1>>>0;hx.exports=AT;function AT(t,e){if(isNaN(t)||isNaN(e))return NaN;if(t===e)return t;if(t===0)return e<0?-fx:fx;var n=tc.hi(t),r=tc.lo(t);return e>t==t>0?r===cx?(n+=1,r=0):r+=1:r===0?(r=cx,n-=1):r-=1,tc.pack(r,n)}});var en=O(so=>{"use strict";var OT=so&&so.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(so,"__esModule",{value:!0});var dx=OT(px());function NT(t){return t}function ec(t){return t===1/0?t:(0,dx.default)(t,-1/0)}function nc(t){return t===-1/0?t:(0,dx.default)(t,1/0)}function mx(t){return t<0?Math.ceil(t):Math.floor(t)}var jr={prev:ec,next:nc},F={safePrev:ec,safeNext:nc,prev(t){return jr.prev(t)},next(t){return jr.next(t)},addLo(t,e){return F.prev(t+e)},addHi(t,e){return F.next(t+e)},subLo(t,e){return F.prev(t-e)},subHi(t,e){return F.next(t-e)},mulLo(t,e){return F.prev(t*e)},mulHi(t,e){return F.next(t*e)},divLo(t,e){return F.prev(t/e)},divHi(t,e){return F.next(t/e)},intLo(t){return mx(F.prev(t))},intHi(t){return mx(F.next(t))},logLo(t){return F.prev(Math.log(t))},logHi(t){return F.next(Math.log(t))},expLo(t){return F.prev(Math.exp(t))},expHi(t){return F.next(Math.exp(t))},sinLo(t){return F.prev(Math.sin(t))},sinHi(t){return F.next(Math.sin(t))},cosLo(t){return F.prev(Math.cos(t))},cosHi(t){return F.next(Math.cos(t))},tanLo(t){return F.prev(Math.tan(t))},tanHi(t){return F.next(Math.tan(t))},asinLo(t){return F.prev(Math.asin(t))},asinHi(t){return F.next(Math.asin(t))},acosLo(t){return F.prev(Math.acos(t))},acosHi(t){return F.next(Math.acos(t))},atanLo(t){return F.prev(Math.atan(t))},atanHi(t){return F.next(Math.atan(t))},sinhLo(t){return F.prev(Math.sinh(t))},sinhHi(t){return F.next(Math.sinh(t))},coshLo(t){return F.prev(Math.cosh(t))},coshHi(t){return F.next(Math.cosh(t))},tanhLo(t){return F.prev(Math.tanh(t))},tanhHi(t){return F.next(Math.tanh(t))},powLo(t,e){if(e%1!==0)return F.prev(Math.pow(t,e));let n=(e&1)===1?t:1;for(e>>=1;e>0;)t=F.mulLo(t,t),(e&1)===1&&(n=F.mulLo(t,n)),e>>=1;return n},powHi(t,e){if(e%1!==0)return F.next(Math.pow(t,e));let n=(e&1)===1?t:1;for(e>>=1;e>0;)t=F.mulHi(t,t),(e&1)===1&&(n=F.mulHi(t,n)),e>>=1;return n},sqrtLo(t){return F.prev(Math.sqrt(t))},sqrtHi(t){return F.next(Math.sqrt(t))},disable(){jr.next=jr.prev=NT},enable(){jr.next=nc,jr.prev=ec}};so.default=F});var vn=O(Gt=>{"use strict";var kT=Gt&&Gt.__createBinding||(Object.create?(function(t,e,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}):(function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]})),PT=Gt&&Gt.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),qT=Gt&&Gt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var n in t)n!=="default"&&Object.prototype.hasOwnProperty.call(t,n)&&kT(e,t,n);return PT(e,t),e},CT=Gt&&Gt.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Gt,"__esModule",{value:!0});Gt.Interval=Gt._Interval=void 0;var zs=qT(Ue()),Br=CT(en()),Us=class t{constructor(e,n){if(this.lo=0,this.hi=0,!(this instanceof t))return console.log("calling with new"),console.log(e,n),new t(e,n);if(typeof e<"u"&&typeof n<"u"){if(zs.isInterval(e)){if(!zs.isSingleton(e))throw new TypeError("Interval: interval `lo` must be a singleton");e=e.lo}if(zs.isInterval(n)){if(!zs.isSingleton(n))throw TypeError("Interval: interval `hi` must be a singleton");n=n.hi}}else{if(typeof e<"u")return Array.isArray(e)?new Xr(e[0],e[1]):new Xr(e,e);e=n=0}this.assign(e,n)}singleton(e){return this.set(e,e)}bounded(e,n){return this.set(Br.default.prev(e),Br.default.next(n))}boundedSingleton(e){return this.bounded(e,e)}set(e,n){return this.lo=e,this.hi=n,this}assign(e,n){if(typeof e!="number"||typeof n!="number")throw TypeError("Interval#assign: arguments must be numbers");return isNaN(e)||isNaN(n)||e>n?this.setEmpty():this.set(e,n)}setEmpty(){return this.set(Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY)}setWhole(){return this.set(Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY)}open(e,n){return this.assign(Br.default.safeNext(e),Br.default.safePrev(n))}halfOpenLeft(e,n){return this.assign(Br.default.safeNext(e),n)}halfOpenRight(e,n){return this.assign(e,Br.default.safePrev(n))}toArray(){return[this.lo,this.hi]}clone(){return new Xr().set(this.lo,this.hi)}};Gt._Interval=Us;function LT(t){function e(){for(var n=arguments.length,r=Array(n),i=0;i{"use strict";var DT=lo&&lo.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(lo,"__esModule",{value:!0});var wn=vn(),gx=DT(en()),js=(3373259426+273688/(1<<21))/(1<<30),Bs=(3373259426+273689/(1<<21))/(1<<30),uo={PI_LOW:js,PI_HIGH:Bs,PI_HALF_LOW:js/2,PI_HALF_HIGH:Bs/2,PI_TWICE_LOW:js*2,PI_TWICE_HIGH:Bs*2,get E(){return new wn.Interval(gx.default.prev(Math.E),gx.default.next(Math.E))},get PI(){return new wn.Interval(js,Bs)},get PI_HALF(){return new wn.Interval(uo.PI_HALF_LOW,uo.PI_HALF_HIGH)},get PI_TWICE(){return new wn.Interval(uo.PI_TWICE_LOW,uo.PI_TWICE_HIGH)},get ZERO(){return new wn.Interval(0)},get ONE(){return new wn.Interval(1)},get WHOLE(){return new wn.Interval().setWhole()},get EMPTY(){return new wn.Interval().setEmpty()}};lo.default=uo});var rc=O(X=>{"use strict";var RT=X&&X.__createBinding||(Object.create?(function(t,e,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}):(function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]})),HT=X&&X.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),FT=X&&X.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var n in t)n!=="default"&&Object.prototype.hasOwnProperty.call(t,n)&&RT(e,t,n);return HT(e,t),e};Object.defineProperty(X,"__esModule",{value:!0});X.geq=X.greaterEqualThan=X.leq=X.lessEqualThan=X.gt=X.greaterThan=X.lt=X.lessThan=X.notEqual=X.assertIncludes=X.almostEqual=X.equal=void 0;var Wt=FT(Ue());function YT(t,e){return Wt.isEmpty(t)?Wt.isEmpty(e):!Wt.isEmpty(e)&&t.lo===e.lo&&t.hi===e.hi}X.equal=YT;var $T=1e-7;function Xs(t,e){if(!t)throw new Error(e||"assertion failed")}function yx(t,e){if(!isFinite(t))return Xs(t===e,`[Infinity] expected ${t} to be ${e}`);Xs(Math.abs(t-e)<$T,`expected ${t} to be close to ${e}`)}function _x(t,e){t=Array.isArray(t)?t:t.toArray(),e=Array.isArray(e)?e:e.toArray(),yx(t[0],e[0]),yx(t[1],e[1])}X.almostEqual=_x;function zT(t,e){_x(t,e),t=Array.isArray(t)?t:t.toArray(),e=Array.isArray(e)?e:e.toArray(),Xs(t[0]<=e[0],`${t[0]} should be less/equal than ${e[0]}`),Xs(e[1]<=t[1],`${e[1]} should be less/equal than ${t[1]}`)}X.assertIncludes=zT;function UT(t,e){return Wt.isEmpty(t)?!Wt.isEmpty(e):Wt.isEmpty(e)||t.hie.hi}X.notEqual=UT;function xx(t,e){return Wt.isEmpty(t)||Wt.isEmpty(e)?!1:t.hie.hi}X.greaterThan=vx;X.gt=vx;function wx(t,e){return Wt.isEmpty(t)||Wt.isEmpty(e)?!1:t.hi<=e.lo}X.lessEqualThan=wx;X.leq=wx;function bx(t,e){return Wt.isEmpty(t)||Wt.isEmpty(e)?!1:t.lo>=e.hi}X.greaterEqualThan=bx;X.geq=bx});var Sx=O(Et=>{"use strict";var jT=Et&&Et.__createBinding||(Object.create?(function(t,e,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}):(function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]})),BT=Et&&Et.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),XT=Et&&Et.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var n in t)n!=="default"&&Object.prototype.hasOwnProperty.call(t,n)&&jT(e,t,n);return BT(e,t),e},Mx=Et&&Et.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Et,"__esModule",{value:!0});Et.zero=Et.negative=Et.positive=Et.nonZero=void 0;var fo=vn(),Lt=Mx(en()),Tx=XT(Ue()),ic=Mx(Kn());function GT(t,e){let n=t.lo,r=t.hi,i=e.lo,o=e.hi,a=new fo.Interval;return r<0?o<0?(a.lo=Lt.default.divLo(r,i),a.hi=Lt.default.divHi(n,o)):(a.lo=Lt.default.divLo(n,i),a.hi=Lt.default.divHi(r,o)):n<0?o<0?(a.lo=Lt.default.divLo(r,o),a.hi=Lt.default.divHi(n,o)):(a.lo=Lt.default.divLo(n,i),a.hi=Lt.default.divHi(r,i)):o<0?(a.lo=Lt.default.divLo(r,o),a.hi=Lt.default.divHi(n,i)):(a.lo=Lt.default.divLo(n,o),a.hi=Lt.default.divHi(r,i)),a}Et.nonZero=GT;function WT(t,e){return t.lo===0&&t.hi===0?t:Tx.zeroIn(t)?ic.default.WHOLE:t.hi<0?new fo.Interval(Number.NEGATIVE_INFINITY,Lt.default.divHi(t.hi,e)):new fo.Interval(Lt.default.divLo(t.lo,e),Number.POSITIVE_INFINITY)}Et.positive=WT;function VT(t,e){return t.lo===0&&t.hi===0?t:Tx.zeroIn(t)?ic.default.WHOLE:t.hi<0?new fo.Interval(Lt.default.divLo(t.hi,e),Number.POSITIVE_INFINITY):new fo.Interval(Number.NEGATIVE_INFINITY,Lt.default.divHi(t.lo,e))}Et.negative=VT;function ZT(t){return t.lo===0&&t.hi===0?t:ic.default.WHOLE}Et.zero=ZT});var Gr=O(J=>{"use strict";var QT=J&&J.__createBinding||(Object.create?(function(t,e,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}):(function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]})),JT=J&&J.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),Ex=J&&J.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var n in t)n!=="default"&&Object.prototype.hasOwnProperty.call(t,n)&&QT(e,t,n);return JT(e,t),e},Ix=J&&J.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(J,"__esModule",{value:!0});J.negative=J.positive=J.div=J.divide=J.mul=J.multiply=J.sub=J.subtract=J.add=void 0;var ho=vn(),ft=Ix(en()),oc=Ix(Kn()),co=Ex(Ue()),Gs=Ex(Sx());function KT(t,e){return new ho.Interval(ft.default.addLo(t.lo,e.lo),ft.default.addHi(t.hi,e.hi))}J.add=KT;function Ax(t,e){return new ho.Interval(ft.default.subLo(t.lo,e.hi),ft.default.subHi(t.hi,e.lo))}J.subtract=Ax;J.sub=Ax;function Ox(t,e){if(co.isEmpty(t)||co.isEmpty(e))return oc.default.EMPTY;let n=t.lo,r=t.hi,i=e.lo,o=e.hi,a=new ho.Interval;return n<0?r>0?i<0?o>0?(a.lo=Math.min(ft.default.mulLo(n,o),ft.default.mulLo(r,i)),a.hi=Math.max(ft.default.mulHi(n,i),ft.default.mulHi(r,o))):(a.lo=ft.default.mulLo(r,i),a.hi=ft.default.mulHi(n,i)):o>0?(a.lo=ft.default.mulLo(n,o),a.hi=ft.default.mulHi(r,o)):(a.lo=0,a.hi=0):i<0?o>0?(a.lo=ft.default.mulLo(n,o),a.hi=ft.default.mulHi(n,i)):(a.lo=ft.default.mulLo(r,o),a.hi=ft.default.mulHi(n,i)):o>0?(a.lo=ft.default.mulLo(n,o),a.hi=ft.default.mulHi(r,i)):(a.lo=0,a.hi=0):r>0?i<0?o>0?(a.lo=ft.default.mulLo(r,i),a.hi=ft.default.mulHi(r,o)):(a.lo=ft.default.mulLo(r,i),a.hi=ft.default.mulHi(n,o)):o>0?(a.lo=ft.default.mulLo(n,i),a.hi=ft.default.mulHi(r,o)):(a.lo=0,a.hi=0):(a.lo=0,a.hi=0),a}J.multiply=Ox;J.mul=Ox;function Nx(t,e){return co.isEmpty(t)||co.isEmpty(e)?oc.default.EMPTY:co.zeroIn(e)?e.lo!==0?e.hi!==0?Gs.zero(t):Gs.negative(t,e.lo):e.hi!==0?Gs.positive(t,e.hi):oc.default.EMPTY:Gs.nonZero(t,e)}J.divide=Nx;J.div=Nx;function tS(t){return new ho.Interval(t.lo,t.hi)}J.positive=tS;function eS(t){return new ho.Interval(-t.hi,-t.lo)}J.negative=eS});var Ws=O(gt=>{"use strict";var nS=gt&>.__createBinding||(Object.create?(function(t,e,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}):(function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]})),rS=gt&>.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),Px=gt&>.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var n in t)n!=="default"&&Object.prototype.hasOwnProperty.call(t,n)&&nS(e,t,n);return rS(e,t),e},qx=gt&>.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(gt,"__esModule",{value:!0});gt.nthRoot=gt.sqrt=gt.pow=gt.multiplicativeInverse=gt.fmod=void 0;var ee=vn(),kt=qx(en()),de=qx(Kn()),bn=Px(Ue()),kx=Px(Gr());function iS(t,e){if(bn.isEmpty(t)||bn.isEmpty(e))return de.default.EMPTY;let n=t.lo<0?e.lo:e.hi,r=t.lo/n;return r<0?r=Math.ceil(r):r=Math.floor(r),kx.sub(t,kx.mul(e,new ee.Interval(r)))}gt.fmod=iS;function Cx(t){return bn.isEmpty(t)?de.default.EMPTY:bn.zeroIn(t)?t.lo!==0?t.hi!==0?de.default.WHOLE:new ee.Interval(Number.NEGATIVE_INFINITY,kt.default.divHi(1,t.lo)):t.hi!==0?new ee.Interval(kt.default.divLo(1,t.hi),Number.POSITIVE_INFINITY):de.default.EMPTY:new ee.Interval(kt.default.divLo(1,t.hi),kt.default.divHi(1,t.lo))}gt.multiplicativeInverse=Cx;function Lx(t,e){if(bn.isEmpty(t))return de.default.EMPTY;if(typeof e=="object"){if(!bn.isSingleton(e))return de.default.EMPTY;e=e.lo}if(e===0)return t.lo===0&&t.hi===0?de.default.EMPTY:de.default.ONE;if(e<0)return Lx(Cx(t),-e);if(Number.isSafeInteger(e))if(t.hi<0){let n=kt.default.powLo(-t.hi,e),r=kt.default.powHi(-t.lo,e);return(e&1)===1?new ee.Interval(-r,-n):new ee.Interval(n,r)}else return t.lo<0?(e&1)===1?new ee.Interval(-kt.default.powLo(-t.lo,e),kt.default.powHi(t.hi,e)):new ee.Interval(0,kt.default.powHi(Math.max(-t.lo,t.hi),e)):new ee.Interval(kt.default.powLo(t.lo,e),kt.default.powHi(t.hi,e));else return console.warn("power is not an integer, you should use nth-root instead, returning an empty interval"),de.default.EMPTY}gt.pow=Lx;function oS(t){return Dx(t,2)}gt.sqrt=oS;function Dx(t,e){if(bn.isEmpty(t)||e<0)return de.default.EMPTY;if(typeof e=="object"){if(!bn.isSingleton(e))return de.default.EMPTY;e=e.lo}let n=1/e;if(t.hi<0){if(Number.isSafeInteger(e)&&(e&1)===1){let r=kt.default.powHi(-t.lo,n),i=kt.default.powLo(-t.hi,n);return new ee.Interval(-r,-i)}return de.default.EMPTY}else if(t.lo<0){let r=kt.default.powHi(t.hi,n);if(Number.isSafeInteger(e)&&(e&1)===1){let i=-kt.default.powHi(-t.lo,n);return new ee.Interval(i,r)}return new ee.Interval(0,r)}else return new ee.Interval(kt.default.powLo(t.lo,n),kt.default.powHi(t.hi,n))}gt.nthRoot=Dx});var Vs=O(H=>{"use strict";var aS=H&&H.__createBinding||(Object.create?(function(t,e,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}):(function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]})),sS=H&&H.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),Rx=H&&H.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var n in t)n!=="default"&&Object.prototype.hasOwnProperty.call(t,n)&&aS(e,t,n);return sS(e,t),e},Hx=H&&H.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(H,"__esModule",{value:!0});H.clone=H.min=H.max=H.abs=H.wid=H.width=H.difference=H.union=H.intersection=H.hull=H.log2=H.LOG_EXP_2=H.log10=H.LOG_EXP_10=H.ln=H.log=H.exp=void 0;var ne=vn(),po=Hx(en()),ge=Hx(Kn()),vt=Rx(Ue()),ac=Rx(Gr());function uS(t){return vt.isEmpty(t)?ge.default.EMPTY:new ne.Interval(po.default.expLo(t.lo),po.default.expHi(t.hi))}H.exp=uS;function Wr(t){if(vt.isEmpty(t))return ge.default.EMPTY;let e=t.lo<=0?Number.NEGATIVE_INFINITY:po.default.logLo(t.lo);return new ne.Interval(e,po.default.logHi(t.hi))}H.log=Wr;H.ln=Wr;H.LOG_EXP_10=Wr(new ne.Interval(10,10));function lS(t){return vt.isEmpty(t)?ge.default.EMPTY:ac.div(Wr(t),H.LOG_EXP_10)}H.log10=lS;H.LOG_EXP_2=Wr(new ne.Interval(2,2));function fS(t){return vt.isEmpty(t)?ge.default.EMPTY:ac.div(Wr(t),H.LOG_EXP_2)}H.log2=fS;function cS(t,e){let n=vt.isEmpty(t),r=vt.isEmpty(e);return n&&r?ge.default.EMPTY:n?e.clone():r?t.clone():new ne.Interval(Math.min(t.lo,e.lo),Math.max(t.hi,e.hi))}H.hull=cS;function hS(t,e){if(vt.isEmpty(t)||vt.isEmpty(e))return ge.default.EMPTY;let n=Math.max(t.lo,e.lo),r=Math.min(t.hi,e.hi);return n<=r?new ne.Interval(n,r):ge.default.EMPTY}H.intersection=hS;function pS(t,e){if(!vt.intervalsOverlap(t,e))throw Error("Interval#union: intervals do not overlap");return new ne.Interval(Math.min(t.lo,e.lo),Math.max(t.hi,e.hi))}H.union=pS;function mS(t,e){if(vt.isEmpty(t)||vt.isWhole(e))return ge.default.EMPTY;if(vt.intervalsOverlap(t,e)){if(t.lo=t.hi&&e.lo===-1/0?ge.default.EMPTY:e.lo<=t.lo?new ne.Interval().halfOpenLeft(e.hi,t.hi):new ne.Interval().halfOpenRight(t.lo,e.lo)}return t.clone()}H.difference=mS;function Fx(t){return vt.isEmpty(t)?0:po.default.subHi(t.hi,t.lo)}H.width=Fx;H.wid=Fx;function dS(t){return vt.isEmpty(t)||vt.isWhole(t)?ge.default.EMPTY:t.lo>=0?t.clone():t.hi<=0?ac.negative(t):new ne.Interval(0,Math.max(-t.lo,t.hi))}H.abs=dS;function gS(t,e){let n=vt.isEmpty(t),r=vt.isEmpty(e);return n&&r?ge.default.EMPTY:n?e.clone():r?t.clone():new ne.Interval(Math.max(t.lo,e.lo),Math.max(t.hi,e.hi))}H.max=gS;function yS(t,e){let n=vt.isEmpty(t),r=vt.isEmpty(e);return n&&r?ge.default.EMPTY:n?e.clone():r?t.clone():new ne.Interval(Math.min(t.lo,e.lo),Math.min(t.hi,e.hi))}H.min=yS;function _S(t){return new ne.Interval().set(t.lo,t.hi)}H.clone=_S});var lc=O(K=>{"use strict";var xS=K&&K.__createBinding||(Object.create?(function(t,e,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}):(function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]})),vS=K&&K.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),Qs=K&&K.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var n in t)n!=="default"&&Object.prototype.hasOwnProperty.call(t,n)&&xS(e,t,n);return vS(e,t),e},Yx=K&&K.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(K,"__esModule",{value:!0});K.tanh=K.cosh=K.sinh=K.atan=K.acos=K.asin=K.tan=K.sin=K.cos=void 0;var Ut=vn(),wt=Yx(en()),at=Yx(Kn()),nn=Qs(Ue()),Zs=Qs(Gr()),$x=Qs(Ws()),wS=Qs(Vs());function sc(t){return!isFinite(t.lo)&&t.lo===t.hi}function zx(t){if(t.lo<0)if(t.lo===-1/0)t.lo=0,t.hi=1/0;else{let e=Math.ceil(-t.lo/at.default.PI_TWICE_LOW);t.lo+=at.default.PI_TWICE_LOW*e,t.hi+=at.default.PI_TWICE_LOW*e}return t}function uc(t){if(nn.isEmpty(t)||sc(t))return at.default.EMPTY;let e=new Ut.Interval().set(t.lo,t.hi);zx(e);let n=at.default.PI_TWICE,r=$x.fmod(e,n);if(wS.width(r)>=n.lo)return new Ut.Interval(-1,1);if(r.lo>=at.default.PI_HIGH){let u=uc(Zs.sub(r,at.default.PI));return Zs.negative(u)}let i=r.lo,o=r.hi,a=wt.default.cosLo(o),s=wt.default.cosHi(i);return o<=at.default.PI_LOW?new Ut.Interval(a,s):o<=n.lo?new Ut.Interval(-1,Math.max(a,s)):new Ut.Interval(-1,1)}K.cos=uc;function bS(t){return nn.isEmpty(t)||sc(t)?at.default.EMPTY:uc(Zs.sub(t,at.default.PI_HALF))}K.sin=bS;function MS(t){if(nn.isEmpty(t)||sc(t))return at.default.EMPTY;let e=new Ut.Interval().set(t.lo,t.hi);zx(e);let n=at.default.PI,r=$x.fmod(e,n);return r.lo>=at.default.PI_HALF_LOW&&(r=Zs.sub(r,n)),r.lo<=-at.default.PI_HALF_LOW||r.hi>=at.default.PI_HALF_LOW?at.default.WHOLE:new Ut.Interval(wt.default.tanLo(r.lo),wt.default.tanHi(r.hi))}K.tan=MS;function TS(t){if(nn.isEmpty(t)||t.hi<-1||t.lo>1)return at.default.EMPTY;let e=t.lo<=-1?-at.default.PI_HALF_HIGH:wt.default.asinLo(t.lo),n=t.hi>=1?at.default.PI_HALF_HIGH:wt.default.asinHi(t.hi);return new Ut.Interval(e,n)}K.asin=TS;function SS(t){if(nn.isEmpty(t)||t.hi<-1||t.lo>1)return at.default.EMPTY;let e=t.hi>=1?0:wt.default.acosLo(t.hi),n=t.lo<=-1?at.default.PI_HIGH:wt.default.acosHi(t.lo);return new Ut.Interval(e,n)}K.acos=SS;function ES(t){return nn.isEmpty(t)?at.default.EMPTY:new Ut.Interval(wt.default.atanLo(t.lo),wt.default.atanHi(t.hi))}K.atan=ES;function IS(t){return nn.isEmpty(t)?at.default.EMPTY:new Ut.Interval(wt.default.sinhLo(t.lo),wt.default.sinhHi(t.hi))}K.sinh=IS;function AS(t){return nn.isEmpty(t)?at.default.EMPTY:t.hi<0?new Ut.Interval(wt.default.coshLo(t.hi),wt.default.coshHi(t.lo)):t.lo>=0?new Ut.Interval(wt.default.coshLo(t.lo),wt.default.coshHi(t.hi)):new Ut.Interval(1,wt.default.coshHi(-t.lo>t.hi?t.lo:t.hi))}K.cosh=AS;function OS(t){return nn.isEmpty(t)?at.default.EMPTY:new Ut.Interval(wt.default.tanhLo(t.lo),wt.default.tanhHi(t.hi))}K.tanh=OS});var Gx=O(st=>{"use strict";var Ux=st&&st.__createBinding||(Object.create?(function(t,e,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}):(function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]})),NS=st&&st.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),Vr=st&&st.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var n in t)n!=="default"&&Object.prototype.hasOwnProperty.call(t,n)&&Ux(e,t,n);return NS(e,t),e},Zr=st&&st.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&Ux(e,t,n)},jx=st&&st.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(st,"__esModule",{value:!0});st.constants=st.round=st.Interval=void 0;var Bx=vn();Object.defineProperty(st,"Interval",{enumerable:!0,get:function(){return Bx._Interval}});var fc=jx(en());st.round=fc.default;var Xx=jx(Kn());st.constants=Xx.default;var kS=Vr(rc()),PS=Vr(Gr()),qS=Vr(Ws()),CS=Vr(lc()),LS=Vr(Vs()),DS=Vr(Ue()),RS=Object.assign(Bx.Interval,Xx.default,fc.default,LS,DS,kS,PS,qS,CS,{round:fc.default});st.default=RS;Zr(rc(),st);Zr(Gr(),st);Zr(Ws(),st);Zr(lc(),st);Zr(Vs(),st);Zr(Ue(),st)});var Vx=O((FY,Wx)=>{"use strict";Wx.exports=function(t){t.mod=t.fmod,t.lessThan=t.lt,t.lessEqualThan=t.leq,t.greaterThan=t.gt,t.greaterEqualThan=t.geq,t.strictlyEqual=t.equal,t.strictlyNotEqual=t.notEqual,t.logicalAND=function(e,n){return e&&n},t.logicalXOR=function(e,n){return e^n},t.logicalOR=function(e,n){return e||n}}});var Qx=O((YY,Zx)=>{"use strict";Zx.exports=function(t){return{disableRounding:function(){t.round.disable()},enableRounding:function(){t.round.enable()}}}});var Jx=O(($Y,Js)=>{"use strict";var HS=Zf(),Qr=Gx().default;Vx()(Qr);function FS(t){Object.keys(t).forEach(function(e){let n=t[e];typeof n=="number"||Array.isArray(n)?t[e]=Qr.factory(n):typeof n=="object"&&"lo"in n&&"hi"in n&&(t[e]=Qr.factory(n.lo,n.hi))})}Js.exports=function(t){return new HS().setDefs({$$processScope:FS}).parse(t).compile(Qr)};Js.exports.policies=Qx()(Qr);Js.exports.Interval=Qr});var Ks=O((zY,Kx)=>{"use strict";Kx.exports=Jx()});var Tn=O(Mn=>{"use strict";var tv=Mn&&Mn.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Mn,"__esModule",{value:!0});Mn.interval=Mn.builtIn=void 0;var YS=tv(sx()),$S=tv(Ks()),ev={interval:$S.default,builtIn:YS.default};function zS(){return typeof global=="object"&&"math"in global?global.math:typeof window=="object"&&"math"in window?window.math:null}var cc=zS();cc&&(ev.builtIn=cc.compile);function nv(t){function e(o){if(typeof o=="string"){let a=ev[t](o);return cc&&t==="builtIn"?{eval:a.evaluate||a.eval}:a}else{if(typeof o=="function")return{eval:o};throw Error("expression must be a string or a function")}}function n(o,a){let s=o[a],u=t+"_Expression_"+a,l=t+"_Compiled_"+a;s!==o[u]&&(o[u]=s,o[l]=e(s))}function r(o,a){return o[t+"_Compiled_"+a]}function i(o,a,s){return n(o,a),r(o,a).eval(Object.assign({},o.scope||{},s))}return i}var US=nv("builtIn");Mn.builtIn=US;var jS=nv("interval");Mn.interval=jS});var av=O(mo=>{"use strict";var ov=mo&&mo.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(mo,"__esModule",{value:!0});var BS=(ci(),it(fi)),XS=(pt(),it(pe)),tr=ov(ze()),rv=ov(zr()),iv=Tn();function GS(t){t=Object.assign({xLine:!1,yLine:!1,renderer:function(s,u){return"("+s.toFixed(3)+", "+u.toFixed(3)+")"},owner:null},t);let e=20,n=(0,BS.line)().x(function(s){return s[0]}).y(function(s){return s[1]});function r(s,u){return s.append("path").datum(u).attr("stroke","grey").attr("stroke-dasharray","5,5").attr("opacity",.5).attr("d",n)}let i,o;function a(s){let u=s.selectAll("g.tip").data(function(f){return[f]}),l=u.enter().append("g").attr("class","tip").attr("clip-path","url(#function-plot-clip-"+t.owner.id+")");i=u.merge(l).selectAll("g.inner-tip").data(function(f){return[f]}),o=i.enter().append("g").attr("class","inner-tip").style("display","none").each(function(){let f=(0,XS.select)(this);r(f,[[0,-t.owner.meta.height-e],[0,t.owner.meta.height+e]]).attr("class","tip-x-line").style("display","none"),r(f,[[-t.owner.meta.width-e,0],[t.owner.meta.width+e,0]]).attr("class","tip-y-line").style("display","none"),f.append("circle").attr("r",3),f.append("text").attr("transform","translate(5,-5)")}),i.merge(o).selectAll(".tip-x-line").style("display",t.xLine?null:"none"),i.merge(o).selectAll(".tip-y-line").style("display",t.yLine?null:"none")}return a.move=function(s){let u,l=1/0,f=-1,c,h,m=i.merge(o),g=t.owner.meta,y=m.datum().data,M=g.xScale,_=g.yScale,E=g.width,A=g.height,I=s.x,P=s.y;for(u=0;uw[0]-rv.default.TIP_X_EPS&&I{"use strict";var WS=Ne&&Ne.__createBinding||(Object.create?(function(t,e,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}):(function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]})),VS=Ne&&Ne.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),ZS=Ne&&Ne.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var n in t)n!=="default"&&Object.prototype.hasOwnProperty.call(t,n)&&WS(e,t,n);return VS(e,t),e},QS=Ne&&Ne.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ne,"__esModule",{value:!0});var er=ZS(Ks()),sv=Tn(),JS=QS(ze());er.default.policies.disableRounding();function KS(t){let e=JS.default.space(t.xAxis,t.range,t.nSamples),n=t.xScale,r=t.yScale,i=r.domain()[0],o=r.domain()[1],a=[],s;for(s=0;sl[1].hi&&(u[1].hi=Math.max(o,u[1].hi),l[1].lo=Math.min(i,l[1].lo)),u[1].hi{"use strict";var rE=_o&&_o.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(_o,"__esModule",{value:!0});var Dt=rE(ze()),yo=Tn();function fv(t,e,n,r,i){if(!i)return{asymptote:!0,d0:t,d1:e};let o=10,a=t[0],s=e[0],u=Dt.default.linspace(a,s,o),l,f;for(let c=0;c=2&&r!==m&&Math.abs(h/l)>1){let g=fv(e[u-1],e[u],t,m,3);g.asymptote?(e[u-1][0]=g.d0[0],e[u-1][1]=Dt.default.clamp(g.d0[1],o,a),i.push(s),e[u][0]=g.d1[0],e[u][1]=Dt.default.clamp(g.d1[1],o,a),s=[e[u]]):s.push(e[u])}else s.push(e[u]);s.length>1&&(l=s[s.length-1][0]-s[s.length-2][0],r=m),++u}return s.length&&i.push(s),i}function oE(t){let e=Dt.default.space(t.xAxis,t.range,t.nSamples),n=t.yScale.domain(),r=n[0]-Dt.default.infinity(),i=n[1]+Dt.default.infinity(),o=[];for(let s=0;s{"use strict";var hc=xo&&xo.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(xo,"__esModule",{value:!0});var hv=hc(zr()),cE=hc(lv()),hE=hc(cv());function pE(t,e){let n=e.range||[-1/0,1/0],r=Math.max(t.domain()[0],n[0]),i=Math.min(t.domain()[1],n[1]);return[r,i]}function mE(t,e){let n=pE(t.meta.xScale,e),r;if(e.sampler==="builtIn")r=hE.default;else if(e.sampler==="interval")r=cE.default;else throw new Error(`Invalid sampler function ${e.sampler}`);let i=e.nSamples||Math.min(hv.default.MAX_ITERATIONS,hv.default.DEFAULT_ITERATIONS||t.meta.width*2),o=r({d:e,range:n,xScale:t.meta.xScale,yScale:t.meta.yScale,xAxis:t.options.xAxis,yAxis:t.options.yAxis,nSamples:i});return t.emit("eval",o,e.index,e.isHelper),o}xo.default=mE});var dv=O(vo=>{"use strict";var mv=vo&&vo.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(vo,"__esModule",{value:!0});var pv=(pt(),it(pe)),pc=(ci(),it(fi)),eu=mv(ze()),dE=mv(tu());function gE(t){function e(n){n.each(function(r){let i=e.el=(0,pv.select)(this),o=r.index,a=(0,dE.default)(t,r),s=eu.default.color(r,o),u=i.selectAll(":scope > path.line").data(a),l=t.meta.yScale.range(),f=l[0],c=l[1],h=f-c;f+=h*1e6,c-=h*1e6,r.skipBoundsCheck&&(f=eu.default.infinity(),c=-eu.default.infinity());function m(E){return eu.default.clamp(t.meta.yScale(E[1]),c,f)}let g=(0,pc.line)().curve(pc.curveLinear).x(function(E){return t.meta.xScale(E[0])}).y(m),y=(0,pc.area)().x(function(E){return t.meta.xScale(E[0])}).y0(t.meta.yScale(0)).y1(m),M=`line line-${o}`,_=u.enter().append("path").attr("class",M).attr("stroke-width",1).attr("stroke-linecap","round");u.merge(_).each(function(){let E=(0,pv.select)(this),A;if(r.closed?(E.attr("fill",s),E.attr("fill-opacity",.3),A=y):(E.attr("fill","none"),A=g),E.attr("stroke",s).attr("marker-end",function(){return r.fnType==="vector"?"url(#"+t.markerId+")":null}).attr("d",A),r.attr)for(let I in r.attr){let P=r.attr[I];I==="class"&&(P=`${M} ${r.attr[I]}`),E.attr(I,P)}}),u.exit().remove()})}return e}vo.default=gE});var yv=O(wo=>{"use strict";var gv=wo&&wo.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(wo,"__esModule",{value:!0});var yE=(pt(),it(pe)),_E=gv(tu()),xE=gv(ze());function vE(t){let e,n=t.meta.xScale,r=t.meta.yScale;function i(s,u,l,f){if(l>f){let m=l;l=f,f=m}let c=Math.min(u,f),h=Math.max(s,l);return h>c?[-e,0]:[h,c]}let o=function(s,u){let l="",f=r.range(),c=Math.min.apply(Math,f),h=Math.max.apply(Math,f);for(let m=0,g=s.length;m path.line").data(h);e=Math.max(h[0].scaledDx,1);let g=`line line-${f}`,y=m.enter().append("path").attr("class",g).attr("fill","none"),M=m.merge(y).attr("stroke-width",e).attr("stroke",xE.default.color(u,f)).attr("opacity",c?.5:1).attr("d",function(_){return o(_,c)});if(u.attr)for(let _ in u.attr){let E=u.attr[_];_==="class"&&(E=`${g} ${u.attr[_]}`),M.attr(_,E)}m.exit().remove()})}return a}wo.default=vE});var xv=O(bo=>{"use strict";var _v=bo&&bo.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(bo,"__esModule",{value:!0});var wE=(pt(),it(pe)),bE=(Ee(),it(Sa)),ME=_v(ze()),TE=_v(tu());function SE(t){let e=t.meta.xScale,n=t.meta.yScale;function r(i){i.each(function(o){let a,s,u=o.index,l=ME.default.color(o,u),f=(0,TE.default)(t,o),c=[];for(a=0;a circle.scatter").data(c),m=`scatter scatter-${u}`,g=h.enter().append("circle").attr("class",m),y=h.merge(g).attr("fill",(0,bE.hsl)(l.toString()).brighter(1.5).formatHex()).attr("stroke",l).attr("opacity",.7).attr("r",1).attr("cx",function(M){return e(M[0])}).attr("cy",function(M){return n(M[1])});if(o.attr)for(let M in o.attr){let _=o.attr[M];M==="class"&&(_=`${m} ${o.attr[M]}`),y.attr(M,_)}h.exit().remove()})}return r}bo.default=SE});var vv=O(Mo=>{"use strict";var EE=Mo&&Mo.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Mo,"__esModule",{value:!0});var IE=(pt(),it(pe)),AE=(Ee(),it(Sa)),OE=EE(ze());function NE(t){let e=t.meta.xScale,n=t.meta.yScale;function r(i){i.each(function(o){o.sampler="builtIn",o.fnType="vector";let a=(0,IE.select)(this).selectAll(":scope > text.fn-text").data([o.location]),s=a.enter().append("text").attr("class",`fn-text fn-text-${o.index}`),u=OE.default.color(o,o.index),l=a.merge(s).attr("fill",(0,AE.hsl)(u.toString()).brighter(1.5).formatHex()).attr("x",f=>e(f[0])).attr("y",f=>n(f[1])).text(()=>o.text);if(o.attr)for(let f in o.attr)l.attr(f,o.attr[f]);a.exit().remove()})}return r}Mo.default=NE});var To=O(ye=>{"use strict";var nu=ye&&ye.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ye,"__esModule",{value:!0});ye.text=ye.scatter=ye.interval=ye.polyline=void 0;var kE=nu(dv());ye.polyline=kE.default;var PE=nu(yv());ye.interval=PE.default;var qE=nu(xv());ye.scatter=qE.default;var CE=nu(vv());ye.text=CE.default});var ru=O(mc=>{"use strict";Object.defineProperty(mc,"__esModule",{value:!0});function LE(t){return"graphType"in t||(t.graphType="interval"),"sampler"in t||(t.sampler=t.graphType!=="interval"?"builtIn":"interval"),"fnType"in t||(t.fnType="linear"),t}mc.default=LE});var Mv=O(So=>{"use strict";var bv=So&&So.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(So,"__esModule",{value:!0});var DE=(pt(),it(pe)),RE=To(),wv=Tn(),HE=bv(ru()),FE=bv(ze());function YE(t){let e=(0,HE.default)({isHelper:!0,skipTip:!0,skipBoundsCheck:!0,nSamples:2,graphType:"polyline"});function n(o){if(!o.derivative)return[];let a=typeof o.derivative.x0=="number"?o.derivative.x0:FE.default.infinity();return e.index=o.index,e.scope={m:(0,wv.builtIn)(o.derivative,"fn",{x:a}),x0:a,y0:(0,wv.builtIn)(o,"fn",{x:a})},e.fn="m * (x - x0) + y0",[e]}function r(o){let a=this;o.derivative&&o.derivative.updateOnMouseMove&&!o.derivative.$$mouseListener&&(o.derivative.$$mouseListener=function({x:s}){o.derivative&&(o.derivative.x0=s),i(a)},t.on("tip:update",o.derivative.$$mouseListener))}let i=function(o){o.each(function(a){let s=(0,DE.select)(this),u=n.call(o,a);r.call(o,a);let l=s.selectAll("g.derivative").data(u),f=l.enter().append("g").attr("class","derivative");l.merge(f).call((0,RE.polyline)(t)),l.merge(f).selectAll("path").attr("opacity",.5),l.exit().remove()})};return i}So.default=YE});var Ev=O(Eo=>{"use strict";var Sv=Eo&&Eo.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Eo,"__esModule",{value:!0});var $E=(pt(),it(pe)),Tv=Tn(),zE=Sv(ru()),UE=To(),jE=Sv(ze());function BE(t){let e=(0,zE.default)({isHelper:!0,skipTip:!0,skipBoundsCheck:!0,nSamples:2,graphType:"polyline"});function n(u){u.m=(u.y1-u.y0)/(u.x1-u.x0)}function r(u,l){if(!("x0"in l))throw Error("secant must have the property `x0` defined");l.scope=l.scope||{};let f=l.x0,c=typeof l.x1=="number"?l.x1:jE.default.infinity();Object.assign(l.scope,{x0:f,x1:c,y0:(0,Tv.builtIn)(u,"fn",{x:f}),y1:(0,Tv.builtIn)(u,"fn",{x:c})}),n(l.scope)}function i(u,l){r(u,l),l.fn="m * (x - x0) + y0"}function o(u,l){let f=this;l.updateOnMouseMove&&!l.$$mouseListener&&(l.$$mouseListener=function({x:c}){l.x1=c,r(u,l),s(f)},t.on("tip:update",l.$$mouseListener))}function a(u){let l=this,f=[];u.secants=u.secants||[];for(let c=0;c{"use strict";var Iv=Io&&Io.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Io,"__esModule",{value:!0});var XE=(pt(),it(pe)),GE=Iv(Mv()),WE=Iv(Ev());function VE(t){function e(n){n.each(function(){let r=(0,XE.select)(this);r.call((0,GE.default)(t)),r.call((0,WE.default)(t))})}return e}Io.default=VE});var qv=O(yt=>{"use strict";Object.defineProperty(yt,"__esModule",{value:!0});yt.renderPolarGrid=yt.getPolarLabelLayout=yt.getPolarRayInterval=yt.formatPolarAngle=yt.getPolarAngles=yt.getPolarRadii=yt.getPolarRadiusDomain=yt.getPolarDomains=yt.validatePolarOptions=void 0;var ZE=(yi(),it(Vu)),QE=(tf(),it(Kl)),JE=(pt(),it(pe)),iu=2*Math.PI,KE="radians";function tI(t){var e,n;if(t.xAxis.type!=="linear"||t.yAxis.type!=="linear")throw new Error("polar coordinate system only supports linear axes");for(let i of[t.xAxis.domain,t.yAxis.domain,(e=t.polar)===null||e===void 0?void 0:e.radiusDomain])if(i&&(i.length!==2||i.some(o=>!Number.isFinite(o))||i[0]>=i[1]))throw new Error("polar domains must contain two finite ascending values");let r=t.polar;if(((n=r?.radiusDomain)===null||n===void 0?void 0:n[0])<0)throw new Error("polar radiusDomain must be non-negative");for(let i of[r?.radialTicks,r?.angularTicks]){if(i!==void 0&&!Array.isArray(i)&&(!Number.isInteger(i)||i<1))throw new Error("polar tick counts must be positive integers");if(Array.isArray(i)&&i.some(o=>!Number.isFinite(o)))throw new Error("polar tick values must be finite numbers")}if(Array.isArray(r?.radialTicks)&&r.radialTicks.some(i=>i<0))throw new Error("polar radial ticks must be non-negative");if(r?.angleUnit&&r.angleUnit!=="radians"&&r.angleUnit!=="degrees")throw new Error(`unsupported polar angle unit ${r.angleUnit}`)}yt.validatePolarOptions=tI;function eI(t,e,n,r){let i=Math.max((t[1]-t[0])/n,(e[1]-e[0])/r),o=(t[0]+t[1])/2,a=(e[0]+e[1])/2;return{xDomain:[o-n*i/2,o+n*i/2],yDomain:[a-r*i/2,a+r*i/2]}}yt.getPolarDomains=eI;function Av(t,e){let n=Math.min(...t),r=Math.max(...t),i=Math.min(...e),o=Math.max(...e),a=Math.max(n,Math.min(0,r)),s=Math.max(i,Math.min(0,o));return[Math.hypot(a,s),Math.hypot(Math.max(Math.abs(n),Math.abs(r)),Math.max(Math.abs(i),Math.abs(o)))]}yt.getPolarRadiusDomain=Av;function Ov(t,e,n){let r=t.radiusDomain||e,i=Math.max(r[0],e[0]),o=Math.min(r[1],e[1]);if(i>o)return[];let a;if(Array.isArray(t.radialTicks))a=t.radialTicks;else{let s=t.radialTicks||5;if(t.radialTicks===void 0&&n!==void 0){let u=(o-i)*n;s=Math.max(1,Math.round(u/50))}a=(0,QE.scaleLinear)().domain([i,o]).ticks(s)}return Array.from(new Set(a)).filter(s=>s>0&&s>=i&&s<=o).sort((s,u)=>s-u)}yt.getPolarRadii=Ov;function Nv(t){if(Array.isArray(t.angularTicks)){let n=t.angularTicks.map(r=>(r%iu+iu)%iu);return n.filter((r,i)=>n.findIndex(o=>Math.abs(o-r)<1e-10)===i)}let e=t.angularTicks||12;return Array.from({length:e},(n,r)=>r*iu/e)}yt.getPolarAngles=Nv;function kv(t,e){if(e==="degrees")return`${Number((t*180/Math.PI).toFixed(2))}\xB0`;for(let n of[1,2,3,4,6,8,12,16]){let r=Math.round(t/Math.PI*n);if(Math.abs(t/Math.PI-r/n)<1e-10)return r===0?"0":`${r===1?"":r===-1?"-":String(r)}\u03C0${n===1?"":`/${n}`}`}return Number(t.toFixed(3)).toString()}yt.formatPolarAngle=kv;function gc(t,e,n,r){let i=-1/0,o=1/0;for(let[s,u,l]of[[t[0],e[0],n],[t[1],e[1],r]]){if(Math.abs(u)<1e-10){if(s<0||s>l)return;continue}let f=(0-s)/u,c=(l-s)/u;i=Math.max(i,Math.min(f,c)),o=Math.min(o,Math.max(f,c))}let a=Math.max(0,i);return o>a?[a,o]:void 0}yt.getPolarRayInterval=gc;function Pv(t,e,n,r,i){let o=gc(t,e,r,i);if(!o)return;let a=n.filter(l=>l>=o[0]&&l<=o[1]).pop();if(a===void 0)return;let s=[t[0]+e[0]*a,t[1]+e[1]*a],u=e[0]>1e-10?"start":e[0]<-1e-10?"end":"middle";return{position:s,textAnchor:u}}yt.getPolarLabelLayout=Pv;function nI(t,e,n){var r;if(!(n.coordinateSystem==="polar"&&((r=n.polar)===null||r===void 0?void 0:r.grid)!==!1)){t.selectAll("g.polar-grid").remove();return}let o=t.selectAll("g.polar-grid").data([n.polar||{}]),a=o.merge(o.enter().insert("g",".content, .zoom-and-drag").attr("class","polar-grid")).attr("clip-path",null).attr("pointer-events","none"),s=a.selectAll(":scope > g.polar-grid-lines").data([0]),u=s.enter().append("g").attr("class","polar-grid-lines"),l=t.select("clipPath[id]").attr("id"),f=s.merge(u).attr("clip-path","url(#"+l+")"),c=n.polar||{},h=e.xScale,m=e.yScale,g=Av(h.domain(),m.domain()),y=[h(0),m(0)],M=h(1)-y[0],_=m(1)-y[1],E=Math.abs(M),A=Ov(c,g,E),I=Nv(c),P=v=>{var T;let d=((T=c.radiusDomain)===null||T===void 0?void 0:T[1])===void 0?void 0:Math.min(c.radiusDomain[1],g[1]),S=[Math.cos(v)*Math.sign(M),Math.sin(v)*Math.sign(_)],x=gc(y,S,e.width,e.height);if(!x)return;let N=d===void 0?x[1]:Math.min(d*E,x[1]);return N>x[0]?{direction:S,rayLength:N}:void 0},w=I.filter(v=>P(v)),q=f.selectAll("circle.polar-grid-circle").data(A,v=>v);q.exit().remove(),q.merge(q.enter().append("circle").attr("class","polar-grid-circle")).attr("cx",y[0]).attr("cy",y[1]).attr("r",v=>v*E).attr("fill","none").attr("stroke","currentColor").attr("opacity",.2);let z=f.selectAll("line.polar-grid-ray").data(w,v=>v);z.exit().remove(),z.merge(z.enter().append("line").attr("class","polar-grid-ray")).attr("x1",y[0]).attr("y1",y[1]).attr("x2",v=>{let T=P(v);return y[0]+T.direction[0]*T.rayLength}).attr("y2",v=>{let T=P(v);return y[1]+T.direction[1]*T.rayLength}).attr("stroke","currentColor").attr("opacity",.2);let tt=a.selectAll("text.polar-radius-label").data(A,v=>v);tt.exit().remove(),tt.merge(tt.enter().append("text").attr("class","polar-radius-label")).attr("x",v=>h(v)).attr("y",y[1]).attr("text-anchor","middle").attr("dy","-0.8em").attr("fill","currentColor").text(c.radiusTickFormat||(0,ZE.format)("~g"));let V=[];if(c.angularLabels&&A.length){let v=A.map(T=>T*E);for(let T of w){let d=[Math.cos(T)*Math.sign(M),Math.sin(T)*Math.sign(_)],S=Pv(y,d,v,e.width,e.height);S&&V.push(Object.assign({angle:T,direction:d},S))}}let W=a.selectAll("text.polar-angle-label").data(V,v=>v.angle);W.exit().remove(),W.merge(W.enter().append("text").attr("class","polar-angle-label")).attr("x",v=>v.position[0]).attr("y",v=>v.position[1]).attr("dx",v=>v.direction[0]*8).attr("dy",v=>v.direction[1]*8).attr("text-anchor",v=>v.textAnchor).attr("dominant-baseline","middle").attr("fill","currentColor").text(v=>{let T=c.angleUnit||KE,d=T==="degrees"?v.angle*180/Math.PI:v.angle;return c.angleTickFormat?c.angleTickFormat(d):kv(v.angle,T)}).each(function(v){let T=this.getBBox(),d=Math.max(0,-T.x)-Math.max(0,T.x+T.width-e.width),S=Math.max(0,-T.y)-Math.max(0,T.y+T.height-e.height);(0,JE.select)(this).attr("dx",v.direction[0]*8+d).attr("dy",v.direction[1]*8+S)})}yt.renderPolarGrid=nI});var Hv=O(Jr=>{"use strict";var Kr=Jr&&Jr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Jr,"__esModule",{value:!0});Jr.Chart=void 0;var rI=(ci(),it(fi)),iI=(yi(),it(Vu)),Cv=(tf(),it(Kl)),Lv=(Kd(),it(Jd)),yc=(Uy(),it(zy)),ou=(pt(),it(pe)),Dv=(Be(),it(Um)),oI=Kr(t_()),aI=Kr(e_()),sI=Kr(av()),uI=Kr(dc()),lI=Kr(ru()),au=Kr(zr()),_c=qv();function Rv(t){return t==="linear"?Cv.scaleLinear:Cv.scaleLog}function fI(t,e,n){var r,i;let o=f=>{let c=f[1]-f[0];return n*c/e},a=t.coordinateSystem==="polar"?(i=(r=t.polar)===null||r===void 0?void 0:r.radiusDomain)===null||i===void 0?void 0:i[1]:void 0,s=a===void 0?void 0:a*1.2,u=(()=>{if(t.xAxis.domain)return t.xAxis.domain;if(t.xAxis.type==="log")return[1,10];if(t.xAxis.type==="linear")return s===void 0?[-6,6]:[-s,s];throw new Error(`axis type ${t.xAxis.type} unsupported`)})(),l=(()=>{if(t.yAxis.domain)return t.yAxis.domain;if(t.yAxis.type==="log")return[1,10];if(t.yAxis.type==="linear"){if(s!==void 0)return[-s,s];let f=o(u);return[-f/2,f/2]}throw new Error(`axis type ${t.yAxis.type} unsupported`)})();return t.coordinateSystem==="polar"?(0,_c.getPolarDomains)(u,l,e,n):{xDomain:u,yDomain:l}}var su=class t extends oI.default.EventEmitter{constructor(e){super();let n=Math.random(),r=String.fromCharCode(Math.floor(n*26)+97);this.options=e,this.id=r+n.toString(16).substr(2),this.options.id=this.id,this.markerId=this.id+"-marker",t.cache[this.id]=this,this.linkedGraphs=[this],this.meta={},this.setUpEventListeners()}build(){return this.internalVars(),this.drawGraphWrapper(),this}getDraggableNode(){return(0,ou.select)(this.options.target).select(".zoom-and-drag").node()}getEmitInstance(){let e=this,n=this.getDraggableNode();return n&&(e=n.instance),e}internalVars(){let e=this.meta.margin=this.isPolarCoordinateSystem()?{left:0,right:0,top:0,bottom:0}:{left:40,right:20,top:20,bottom:20};this.options.title&&!this.isPolarCoordinateSystem()&&(this.meta.margin.top=40),this.meta.width=(this.options.width||au.default.DEFAULT_WIDTH)-e.left-e.right,this.meta.height=(this.options.height||au.default.DEFAULT_HEIGHT)-e.top-e.bottom,this.initializeAxes()}initializeAxes(){let e=this,n=(0,iI.format)("~s");function r(a){return Math.abs(a)-Math.floor(Math.abs(a))>0?a.toString():n(a)}if(this.options.coordinateSystem=this.options.coordinateSystem||"cartesian",this.options.xAxis=this.options.xAxis||{},this.options.xAxis.type=this.options.xAxis.type||"linear",this.options.yAxis=this.options.yAxis||{},this.options.yAxis.type=this.options.yAxis.type||"linear",this.options.coordinateSystem!=="cartesian"&&this.options.coordinateSystem!=="polar")throw new Error(`unsupported coordinate system ${this.options.coordinateSystem}`);this.options.coordinateSystem==="polar"&&(0,_c.validatePolarOptions)(this.options);let{xDomain:i,yDomain:o}=fI(this.options,this.meta.width,this.meta.height);this.meta.xDomain=i,this.meta.yDomain=o,this.meta.xScale||(this.meta.xScale=Rv(this.options.xAxis.type)()),this.meta.xScale.domain(i).range(this.options.xAxis.invert?[this.meta.width,0]:[0,this.meta.width]),this.meta.yScale||(this.meta.yScale=Rv(this.options.yAxis.type)()),this.meta.yScale.domain(o).range(this.options.yAxis.invert?[0,this.meta.height]:[this.meta.height,0]),this.meta.xAxis||(this.meta.xAxis=(0,Lv.axisBottom)(this.meta.xScale)),this.meta.xAxis.scale(this.meta.xScale).tickSize(this.options.grid?-this.meta.height:0).tickFormat(r),this.meta.yAxis||(this.meta.yAxis=(0,Lv.axisLeft)(this.meta.yScale)),this.meta.yAxis.scale(this.meta.yScale).tickSize(this.options.grid?-this.meta.width:0).tickFormat(r),this.line=(0,rI.line)().x(function(a){return e.meta.xScale(a[0])}).y(function(a){return e.meta.yScale(a[1])})}drawGraphWrapper(){let e=this.root=(0,ou.select)(this.options.target).selectAll("svg").data([this.options]);this.root.enter=e.enter().append("svg").attr("class","function-plot").attr("font-size",this.getFontSize()),e.merge(this.root.enter).attr("width",this.meta.width+this.meta.margin.left+this.meta.margin.right).attr("height",this.meta.height+this.meta.margin.top+this.meta.margin.bottom),this.buildTitle(),this.buildLegend(),this.buildCanvas(),this.buildClip(),this.buildAxis(),this.buildAxisLabel();let n=this.tip=(0,sI.default)(Object.assign(this.options.tip||{},{owner:this}));this.canvas.merge(this.canvas.enter).call(n),this.setUpPlugins(),this.draw(),this.buildZoomHelper()}buildTitle(){let e=this.root.merge(this.root.enter).selectAll("text.title").data(function(r){return[r.title].filter(Boolean)});e.enter().append("text").merge(e).attr("class","title").attr("y",this.isPolarCoordinateSystem()?20:this.meta.margin.top/2).attr("x",this.meta.margin.left+this.meta.width/2).attr("font-size",25).attr("text-anchor","middle").attr("alignment-baseline","middle").text(this.options.title),e.exit().remove()}buildLegend(){this.root.enter.append("text").attr("class","top-right-legend").attr("text-anchor","end"),this.root.merge(this.root.enter).select(".top-right-legend").attr("y",this.isPolarCoordinateSystem()?8:this.meta.margin.top/2).attr("x",this.meta.width+this.meta.margin.left-(this.isPolarCoordinateSystem()?8:0)).attr("dominant-baseline",this.isPolarCoordinateSystem()?"hanging":null)}buildCanvas(){let e=this.canvas=this.root.merge(this.root.enter).selectAll(".canvas").data(function(n){return[n]});this.canvas.enter=e.enter().append("g").attr("class","canvas")}buildClip(){let e=this.id,n=this.canvas.enter.append("defs");n.append("clipPath").attr("id","function-plot-clip-"+e).append("rect").attr("class","clip static-clip"),this.canvas.merge(this.canvas.enter).selectAll(".clip").attr("width",this.meta.width).attr("height",this.meta.height),n.append("clipPath").append("marker").attr("id",this.markerId).attr("viewBox","0 -5 10 10").attr("refX",10).attr("markerWidth",5).attr("markerHeight",5).attr("orient","auto").append("svg:path").attr("d","M0,-5L10,0L0,5L0,0").attr("stroke-width","0px").attr("fill-opacity",1).attr("fill","#777")}buildAxis(){let e=this.canvas.enter;e.append("g").attr("class","x axis"),e.append("g").attr("class","y axis"),this.canvas.merge(this.canvas.enter).select(".x.axis").attr("transform","translate(0,"+this.meta.height+")").style("display",this.isPolarCoordinateSystem()?"none":null).call(this.meta.xAxis),this.canvas.merge(this.canvas.enter).select(".y.axis").style("display",this.isPolarCoordinateSystem()?"none":null).call(this.meta.yAxis)}buildAxisLabel(){let e=this.canvas,n=this,r=e.merge(e.enter).selectAll("text.x.axis-label").data(function(s){return n.isPolarCoordinateSystem()?[]:[s.xAxis.label].filter(Boolean)}),i=r.enter().append("text").attr("class","x axis-label").attr("text-anchor","end");r.merge(i).attr("x",this.meta.width).attr("y",this.meta.height-6).text(function(s){return s}),r.exit().remove();let o=e.merge(e.enter).selectAll("text.y.axis-label").data(function(s){return n.isPolarCoordinateSystem()?[]:[s.yAxis.label].filter(Boolean)}),a=o.enter().append("text").attr("class","y axis-label").attr("y",6).attr("dy",".75em").attr("text-anchor","end").attr("transform","rotate(-90)");o.merge(a).text(function(s){return s}),o.exit().remove()}buildContent(){let e=this,n=this.canvas;n.merge(n.enter).attr("transform","translate("+this.meta.margin.left+","+this.meta.margin.top+")");let r=this.content=n.merge(n.enter).selectAll(":scope > g.content").data(function(s){return[s]}),i=r.enter().append("g").attr("clip-path","url(#function-plot-clip-"+this.id+")").attr("class","content");if(this.options.xAxis.type==="linear"){let s=r.merge(i).selectAll(":scope > path.y.origin").data(this.isPolarCoordinateSystem()?[]:[[[0,this.meta.yScale.domain()[0]],[0,this.meta.yScale.domain()[1]]]]),u=s.enter().append("path").attr("class","y origin").attr("stroke","black").attr("opacity",.2);s.merge(u).attr("d",this.line),s.exit().remove()}if(this.options.yAxis.type==="linear"){let s=r.merge(i).selectAll(":scope > path.x.origin").data(this.isPolarCoordinateSystem()?[]:[[[this.meta.xScale.domain()[0],0],[this.meta.xScale.domain()[1],0]]]),u=s.enter().append("path").attr("class","x origin").attr("stroke","black").attr("opacity",.2);s.merge(u).attr("d",this.line),s.exit().remove()}r.merge(i).call((0,aI.default)({owner:e}));let o=r.merge(i).selectAll(":scope > g.graph").data(s=>s.data.map(lI.default),s=>s.fn||s.r||s.x||s.text);o.exit().remove();let a=o.enter().append("g").attr("class","graph");o.merge(a).each(function(s,u){s.index=u;let l=(0,ou.select)(this);l.call(au.default.graphTypes[s.graphType](e)),l.call((0,uI.default)(e))})}buildZoomHelper(){var e;let n=this;if(this.meta.zoomBehavior||(this.meta.zoomBehavior=(0,yc.zoom)().on("zoom",function(i){n.getEmitInstance().emit("all:zoom",i)})),this.isPolarCoordinateSystem()||this.getEmitInstance().options.lastCoordinateSystem==="polar"){let r=((e=this.getDraggableNode())===null||e===void 0?void 0:e.__zoom)||yc.zoomIdentity,i=yc.zoomIdentity.scale(1/r.k).translate(-r.x,-r.y);n.meta.zoomBehavior.xScale=i.rescaleX(n.meta.xScale),n.meta.zoomBehavior.yScale=i.rescaleY(n.meta.yScale)}else n.meta.zoomBehavior.xScale=n.meta.zoomBehavior.xScale||n.meta.xScale.copy(),n.meta.zoomBehavior.yScale=n.meta.zoomBehavior.yScale||n.meta.yScale.copy(),n.meta.zoomBehavior.xScale.range(n.meta.xScale.range()),n.meta.zoomBehavior.yScale.range(n.meta.yScale.range());this.canvas.enter.append("rect").call(this.meta.zoomBehavior).attr("class","zoom-and-drag").style("fill","none").style("pointer-events","all").on("mouseover",function(r){n.getEmitInstance().emit("all:mouseover",r)}).on("mouseout",function(r){n.getEmitInstance().emit("all:mouseout",r)}).on("mousemove",function(r){n.getEmitInstance().emit("all:mousemove",r)}),this.draggable=this.canvas.merge(this.canvas.enter).select(".zoom-and-drag").call(r=>{r.node()&&(r.node().instance=n)}).attr("width",this.meta.width).attr("height",this.meta.height),this.options.lastCoordinateSystem=this.options.coordinateSystem}setUpPlugins(){let e=this.options.plugins||[],n=this;e.forEach(function(r){r(n)})}addLink(){for(let e=0;ethis.meta.height?this.meta.height:s,n.select(".x.axis").attr("transform","translate(0,"+s+")"),n.selectAll(".x.axis path, .x.axis line").attr("transform","translate(0,"+(this.meta.height/2-s+this.meta.height/2)+")")}if(n.select(".y.axis").call(e.meta.yAxis),n.select(".y.axis").style("display",null),this.options.yAxis.position==="sticky"){let r=this.meta.xScale.domain()[0],i=this.meta.xScale.domain()[1],o=(i+r)/2,s=this.meta.width/(r-i)*o+this.meta.width/2;s=s<0?0:s,s=s>this.meta.width?this.meta.width:s,n.select(".y.axis").attr("transform","translate("+s+",0)"),n.selectAll(".y.axis path, .y.axis line").attr("transform","translate("+-s+",0)")}n.selectAll(".axis path, .axis line").attr("fill","none").attr("stroke","black").attr("shape-rendering","crispedges").attr("opacity",.1)}syncOptions(){this.options.xAxis.domain=this.meta.xScale.domain(),this.options.yAxis.domain=this.meta.yScale.domain()}getFontSize(){return Math.max(Math.max(this.meta.width,this.meta.height)/50,8)}draw(){let e=this;e.emit("before:draw"),e.syncOptions(),e.updateAxes(),e.buildContent(),e.emit("after:draw")}isPolarCoordinateSystem(){return this.options.coordinateSystem==="polar"}setUpEventListeners(){let e=this,n=this.getEmitInstance();n&&n.removeAllListeners();let r={mousemove:function(o){e.tip.move(o)},mouseover:function(){e.tip.show()},mouseout:function(){e.tip.hide()},zoom:function({transform:a}){if(e.options.disableZoom)return;let s=a.rescaleX(e.meta.zoomBehavior.xScale).interpolate(Dv.interpolateRound),u=a.rescaleY(e.meta.zoomBehavior.yScale).interpolate(Dv.interpolateRound);e.meta.xScale.domain(s.domain()).range(s.range()),e.meta.yScale.domain(u.domain()).range(u.range())},"tip:update":function({x:o,y:a,index:s}){let u=e.root.merge(e.root.enter).datum().data[s],l=u.title||"",f=u.renderer||function(h,m){return h.toFixed(3)+", "+m.toFixed(3)},c=[];l&&c.push(l),c.push(f(o,a)),e.root.select(".top-right-legend").attr("fill",au.default.COLORS[s]).text(c.join(" "))}},i={mousemove:function(o){let a=(0,ou.pointer)(o,e.draggable.node()),s={x:e.meta.xScale.invert(a[0]),y:e.meta.yScale.invert(a[1])};e.linkedGraphs.forEach(function(u){u.emit("before:mousemove",s),u.emit("mousemove",s)})},zoom:function(o){e.linkedGraphs.forEach(function(a){a.draggable.node().__zoom=e.draggable.node().__zoom,a.emit("zoom",o),a.draw()}),e.emit("all:mousemove",o)}};Object.keys(r).forEach(function(o){!i[o]&&e.on("all:"+o,function(){let a=Array.prototype.slice.call(arguments);e.linkedGraphs.forEach(function(s){let u=a.slice();u.unshift(o),s.emit.apply(s,u)})}),e.on(o,r[o])}),Object.keys(i).forEach(function(o){e.on("all:"+o,i[o])})}};Jr.Chart=su;su.cache={}});var Yv=O(Fv=>{"use strict";Object.defineProperty(Fv,"__esModule",{value:!0})});var Bv=O(nt=>{"use strict";var $v=nt&&nt.__createBinding||(Object.create?(function(t,e,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}):(function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]})),cI=nt&&nt.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),zv=nt&&nt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var n in t)n!=="default"&&Object.prototype.hasOwnProperty.call(t,n)&&$v(e,t,n);return cI(e,t),e},Uv=nt&&nt.__exportStar||function(t,e){for(var n in t)n!=="default"&&!Object.prototype.hasOwnProperty.call(e,n)&&$v(e,t,n)};Object.defineProperty(nt,"__esModule",{value:!0});nt.GraphTypeScatter=nt.GraphTypePolyline=nt.GraphTypeInterval=nt.EvalInterval=nt.EvalBuiltIn=nt.registerGraphType=nt.Chart=void 0;Sc();var xc=Hv();Object.defineProperty(nt,"Chart",{enumerable:!0,get:function(){return xc.Chart}});var ti=zv(zr());Object.defineProperty(nt,"registerGraphType",{enumerable:!0,get:function(){return ti.registerGraphType}});var nr=To(),hI=zv(Tn());(0,ti.registerGraphType)("polyline",nr.polyline);(0,ti.registerGraphType)("interval",nr.interval);(0,ti.registerGraphType)("scatter",nr.scatter);(0,ti.registerGraphType)("text",nr.text);function uu(t){t.data=t.data||[];let e=xc.Chart.cache[t.id];return e||(e=new xc.Chart(t)),e.build()}nt.default=uu;uu.globals=ti.default;uu.$eval=hI;uu.graphTypes={interval:nr.interval,polyline:nr.polyline,scatter:nr.scatter};Uv(Yv(),nt);var jv=Tn();Object.defineProperty(nt,"EvalBuiltIn",{enumerable:!0,get:function(){return jv.builtIn}});Object.defineProperty(nt,"EvalInterval",{enumerable:!0,get:function(){return jv.interval}});var vc=To();Object.defineProperty(nt,"GraphTypeInterval",{enumerable:!0,get:function(){return vc.interval}});Object.defineProperty(nt,"GraphTypePolyline",{enumerable:!0,get:function(){return vc.polyline}});Object.defineProperty(nt,"GraphTypeScatter",{enumerable:!0,get:function(){return vc.scatter}});Uv(dc(),nt)});var wc=Tc(Bv()),Xv=Tc(Ks());wc.default.intervalMath=Xv.Interval;window.functionPlot=wc.default;})(); diff --git a/public/function-plot/README.md b/public/function-plot/README.md new file mode 100644 index 00000000..40ede3ea --- /dev/null +++ b/public/function-plot/README.md @@ -0,0 +1,34 @@ +# function-plot vendor bundle + +Pinned upstream: [function-plot 1.26.0](https://github.com/mauriciopoppe/function-plot/tree/v1.26.0) +(MIT). The bundle and bundled dependencies' licence notices live in `1.26.0/`. + +This browser build exposes `window.functionPlot` and the interval arithmetic +already used by function-plot as `functionPlot.intervalMath`. The application +passes trusted numeric/interval callbacks; it never calls the library's expression +code generators with post content. No second plotting library is bundled. + +Rebuild from this directory: + +```sh +cd build +pnpm install --frozen-lockfile +pnpm build +``` + +`build/entry.js`, the pinned manifest and pnpm lockfile document the inputs. +`build/build.mjs` bundles the library and writes `THIRD-PARTY-LICENSES.txt` from +the packages actually included. Some upstream MIT packages omit their LICENSE +file from npm; the build preserves their published copyright notices with the MIT +licence text. esbuild's optional native binary is installed by pnpm; no postinstall +approval is required to run this build. + +The current artifact is 228,019 bytes (68,442 bytes with gzip). +SHA-256 of `1.26.0/function-plot.js`: + +```text +85a5b7eeb2827bfd3194c7f7684465b5dff5b48a8b432682b820dd4e5794009e +``` + +After dependency/build changes, regenerate the notices, update this checksum and +rerun the expression/interval tests and browser graph tests under Discourse's CSP. diff --git a/public/function-plot/build/build.mjs b/public/function-plot/build/build.mjs new file mode 100644 index 00000000..1d31cb76 --- /dev/null +++ b/public/function-plot/build/build.mjs @@ -0,0 +1,53 @@ +import fs from "node:fs"; +import path from "node:path"; +import { build } from "esbuild"; + +const output = "../1.26.0"; +const result = await build({ + entryPoints: ["entry.js"], + outfile: `${output}/function-plot.js`, + bundle: true, + minify: true, + format: "iife", + target: "es2022", + legalComments: "inline", + metafile: true, +}); + +const packages = new Map(); +for (const input of Object.keys(result.metafile.inputs)) { + let directory = path.dirname(fs.realpathSync(input)); + while (!fs.existsSync(path.join(directory, "package.json"))) { + directory = path.dirname(directory); + } + const metadata = JSON.parse( + fs.readFileSync(path.join(directory, "package.json")) + ); + if (metadata.name === "chatbot-function-plot-vendor") { + continue; + } + const license = fs + .readdirSync(directory) + .find((name) => /^license(?:\..*)?$/i.test(name)); + let text; + if (license) { + text = fs.readFileSync(path.join(directory, license), "utf8"); + } else if ( + ["built-in-math-eval", "interval-arithmetic-eval", "mr-parser"].includes( + metadata.name + ) + ) { + // These published packages omit LICENSE but retain this notice in index.js. + text = fs + .readFileSync(path.join(output, "LICENSE"), "utf8") + .replace(/Copyright[^\n]*/, "Copyright (c) 2015 Mauricio Poppe"); + } else { + throw new Error(`Missing license for ${metadata.name}`); + } + packages.set(`${metadata.name}@${metadata.version}`, text.trim()); +} +const notices = [...packages] + .sort(([left], [right]) => left.localeCompare(right)) + .map(([name, text]) => `${name}\n${text}`) + .join("\n\n"); +fs.writeFileSync(`${output}/THIRD-PARTY-LICENSES.txt`, `${notices}\n`); diff --git a/public/function-plot/build/entry.js b/public/function-plot/build/entry.js new file mode 100644 index 00000000..41f73386 --- /dev/null +++ b/public/function-plot/build/entry.js @@ -0,0 +1,6 @@ +import functionPlot from "function-plot"; +import { Interval } from "interval-arithmetic-eval"; + +// Expose the interval arithmetic already used by the sampler for trusted callbacks. +functionPlot.intervalMath = Interval; +window.functionPlot = functionPlot; diff --git a/public/function-plot/build/package.json b/public/function-plot/build/package.json new file mode 100644 index 00000000..ed3bc1bf --- /dev/null +++ b/public/function-plot/build/package.json @@ -0,0 +1,12 @@ +{ + "dependencies": { + "esbuild": "0.25.10", + "function-plot": "1.26.0", + "interval-arithmetic-eval": "0.5.3" + }, + "name": "chatbot-function-plot-vendor", + "private": true, + "scripts": { + "build": "node build.mjs" + } +} diff --git a/public/function-plot/build/pnpm-lock.yaml b/public/function-plot/build/pnpm-lock.yaml new file mode 100644 index 00000000..67cb2f26 --- /dev/null +++ b/public/function-plot/build/pnpm-lock.yaml @@ -0,0 +1,505 @@ +lockfileVersion: '9.0' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + +importers: + + .: + dependencies: + esbuild: + specifier: 0.25.10 + version: 0.25.10 + function-plot: + specifier: 1.26.0 + version: 1.26.0 + +packages: + + '@esbuild/aix-ppc64@0.25.10': + resolution: {integrity: sha512-0NFWnA+7l41irNuaSVlLfgNT12caWJVLzp5eAVhZ0z1qpxbockccEt3s+149rE64VUI3Ml2zt8Nv5JVc4QXTsw==} + engines: {node: '>=18'} + cpu: [ppc64] + os: [aix] + + '@esbuild/android-arm64@0.25.10': + resolution: {integrity: sha512-LSQa7eDahypv/VO6WKohZGPSJDq5OVOo3UoFR1E4t4Gj1W7zEQMUhI+lo81H+DtB+kP+tDgBp+M4oNCwp6kffg==} + engines: {node: '>=18'} + cpu: [arm64] + os: [android] + + '@esbuild/android-arm@0.25.10': + resolution: {integrity: sha512-dQAxF1dW1C3zpeCDc5KqIYuZ1tgAdRXNoZP7vkBIRtKZPYe2xVr/d3SkirklCHudW1B45tGiUlz2pUWDfbDD4w==} + engines: {node: '>=18'} + cpu: [arm] + os: [android] + + '@esbuild/android-x64@0.25.10': + resolution: {integrity: sha512-MiC9CWdPrfhibcXwr39p9ha1x0lZJ9KaVfvzA0Wxwz9ETX4v5CHfF09bx935nHlhi+MxhA63dKRRQLiVgSUtEg==} + engines: {node: '>=18'} + cpu: [x64] + os: [android] + + '@esbuild/darwin-arm64@0.25.10': + resolution: {integrity: sha512-JC74bdXcQEpW9KkV326WpZZjLguSZ3DfS8wrrvPMHgQOIEIG/sPXEN/V8IssoJhbefLRcRqw6RQH2NnpdprtMA==} + engines: {node: '>=18'} + cpu: [arm64] + os: [darwin] + + '@esbuild/darwin-x64@0.25.10': + resolution: {integrity: sha512-tguWg1olF6DGqzws97pKZ8G2L7Ig1vjDmGTwcTuYHbuU6TTjJe5FXbgs5C1BBzHbJ2bo1m3WkQDbWO2PvamRcg==} + engines: {node: '>=18'} + cpu: [x64] + os: [darwin] + + '@esbuild/freebsd-arm64@0.25.10': + resolution: {integrity: sha512-3ZioSQSg1HT2N05YxeJWYR+Libe3bREVSdWhEEgExWaDtyFbbXWb49QgPvFH8u03vUPX10JhJPcz7s9t9+boWg==} + engines: {node: '>=18'} + cpu: [arm64] + os: [freebsd] + + '@esbuild/freebsd-x64@0.25.10': + resolution: {integrity: sha512-LLgJfHJk014Aa4anGDbh8bmI5Lk+QidDmGzuC2D+vP7mv/GeSN+H39zOf7pN5N8p059FcOfs2bVlrRr4SK9WxA==} + engines: {node: '>=18'} + cpu: [x64] + os: [freebsd] + + '@esbuild/linux-arm64@0.25.10': + resolution: {integrity: sha512-5luJWN6YKBsawd5f9i4+c+geYiVEw20FVW5x0v1kEMWNq8UctFjDiMATBxLvmmHA4bf7F6hTRaJgtghFr9iziQ==} + engines: {node: '>=18'} + cpu: [arm64] + os: [linux] + + '@esbuild/linux-arm@0.25.10': + resolution: {integrity: sha512-oR31GtBTFYCqEBALI9r6WxoU/ZofZl962pouZRTEYECvNF/dtXKku8YXcJkhgK/beU+zedXfIzHijSRapJY3vg==} + engines: {node: '>=18'} + cpu: [arm] + os: [linux] + + '@esbuild/linux-ia32@0.25.10': + resolution: {integrity: sha512-NrSCx2Kim3EnnWgS4Txn0QGt0Xipoumb6z6sUtl5bOEZIVKhzfyp/Lyw4C1DIYvzeW/5mWYPBFJU3a/8Yr75DQ==} + engines: {node: '>=18'} + cpu: [ia32] + os: [linux] + + '@esbuild/linux-loong64@0.25.10': + resolution: {integrity: sha512-xoSphrd4AZda8+rUDDfD9J6FUMjrkTz8itpTITM4/xgerAZZcFW7Dv+sun7333IfKxGG8gAq+3NbfEMJfiY+Eg==} + engines: {node: '>=18'} + cpu: [loong64] + os: [linux] + + '@esbuild/linux-mips64el@0.25.10': + resolution: {integrity: sha512-ab6eiuCwoMmYDyTnyptoKkVS3k8fy/1Uvq7Dj5czXI6DF2GqD2ToInBI0SHOp5/X1BdZ26RKc5+qjQNGRBelRA==} + engines: {node: '>=18'} + cpu: [mips64el] + os: [linux] + + '@esbuild/linux-ppc64@0.25.10': + resolution: {integrity: sha512-NLinzzOgZQsGpsTkEbdJTCanwA5/wozN9dSgEl12haXJBzMTpssebuXR42bthOF3z7zXFWH1AmvWunUCkBE4EA==} + engines: {node: '>=18'} + cpu: [ppc64] + os: [linux] + + '@esbuild/linux-riscv64@0.25.10': + resolution: {integrity: sha512-FE557XdZDrtX8NMIeA8LBJX3dC2M8VGXwfrQWU7LB5SLOajfJIxmSdyL/gU1m64Zs9CBKvm4UAuBp5aJ8OgnrA==} + engines: {node: '>=18'} + cpu: [riscv64] + os: [linux] + + '@esbuild/linux-s390x@0.25.10': + resolution: {integrity: sha512-3BBSbgzuB9ajLoVZk0mGu+EHlBwkusRmeNYdqmznmMc9zGASFjSsxgkNsqmXugpPk00gJ0JNKh/97nxmjctdew==} + engines: {node: '>=18'} + cpu: [s390x] + os: [linux] + + '@esbuild/linux-x64@0.25.10': + resolution: {integrity: sha512-QSX81KhFoZGwenVyPoberggdW1nrQZSvfVDAIUXr3WqLRZGZqWk/P4T8p2SP+de2Sr5HPcvjhcJzEiulKgnxtA==} + engines: {node: '>=18'} + cpu: [x64] + os: [linux] + + '@esbuild/netbsd-arm64@0.25.10': + resolution: {integrity: sha512-AKQM3gfYfSW8XRk8DdMCzaLUFB15dTrZfnX8WXQoOUpUBQ+NaAFCP1kPS/ykbbGYz7rxn0WS48/81l9hFl3u4A==} + engines: {node: '>=18'} + cpu: [arm64] + os: [netbsd] + + '@esbuild/netbsd-x64@0.25.10': + resolution: {integrity: sha512-7RTytDPGU6fek/hWuN9qQpeGPBZFfB4zZgcz2VK2Z5VpdUxEI8JKYsg3JfO0n/Z1E/6l05n0unDCNc4HnhQGig==} + engines: {node: '>=18'} + cpu: [x64] + os: [netbsd] + + '@esbuild/openbsd-arm64@0.25.10': + resolution: {integrity: sha512-5Se0VM9Wtq797YFn+dLimf2Zx6McttsH2olUBsDml+lm0GOCRVebRWUvDtkY4BWYv/3NgzS8b/UM3jQNh5hYyw==} + engines: {node: '>=18'} + cpu: [arm64] + os: [openbsd] + + '@esbuild/openbsd-x64@0.25.10': + resolution: {integrity: sha512-XkA4frq1TLj4bEMB+2HnI0+4RnjbuGZfet2gs/LNs5Hc7D89ZQBHQ0gL2ND6Lzu1+QVkjp3x1gIcPKzRNP8bXw==} + engines: {node: '>=18'} + cpu: [x64] + os: [openbsd] + + '@esbuild/openharmony-arm64@0.25.10': + resolution: {integrity: sha512-AVTSBhTX8Y/Fz6OmIVBip9tJzZEUcY8WLh7I59+upa5/GPhh2/aM6bvOMQySspnCCHvFi79kMtdJS1w0DXAeag==} + engines: {node: '>=18'} + cpu: [arm64] + os: [openharmony] + + '@esbuild/sunos-x64@0.25.10': + resolution: {integrity: sha512-fswk3XT0Uf2pGJmOpDB7yknqhVkJQkAQOcW/ccVOtfx05LkbWOaRAtn5SaqXypeKQra1QaEa841PgrSL9ubSPQ==} + engines: {node: '>=18'} + cpu: [x64] + os: [sunos] + + '@esbuild/win32-arm64@0.25.10': + resolution: {integrity: sha512-ah+9b59KDTSfpaCg6VdJoOQvKjI33nTaQr4UluQwW7aEwZQsbMCfTmfEO4VyewOxx4RaDT/xCy9ra2GPWmO7Kw==} + engines: {node: '>=18'} + cpu: [arm64] + os: [win32] + + '@esbuild/win32-ia32@0.25.10': + resolution: {integrity: sha512-QHPDbKkrGO8/cz9LKVnJU22HOi4pxZnZhhA2HYHez5Pz4JeffhDjf85E57Oyco163GnzNCVkZK0b/n4Y0UHcSw==} + engines: {node: '>=18'} + cpu: [ia32] + os: [win32] + + '@esbuild/win32-x64@0.25.10': + resolution: {integrity: sha512-9KpxSVFCu0iK1owoez6aC/s/EdUQLDN3adTxGCqxMVhrPDj6bt5dbrHDXUuq+Bs2vATFBBrQS5vdQ/Ed2P+nbw==} + engines: {node: '>=18'} + cpu: [x64] + os: [win32] + + built-in-math-eval@0.3.2: + resolution: {integrity: sha512-YUEswPdQJYtAP0E9pMq7va05M6iA/8U3Pthnlx+fwbej1G16hy/ZBxyLw+gZpxdijjGGqiwxm7vs3tW7IQuUnw==} + + d3-array@3.2.4: + resolution: {integrity: sha512-tdQAmyA18i4J7wprpYq8ClcxZy3SC31QMeByyCFyRt7BVHdREQZ5lpzoe5mFEYZUWe+oq8HBvk9JjpibyEV4Jg==} + engines: {node: '>=12'} + + d3-axis@3.0.0: + resolution: {integrity: sha512-IH5tgjV4jE/GhHkRV0HiVYPDtvfjHQlQfJHs0usq7M30XcSBvOotpmH1IgkcXsO/5gEQZD43B//fc7SRT5S+xw==} + engines: {node: '>=12'} + + d3-color@3.1.0: + resolution: {integrity: sha512-zg/chbXyeBtMQ1LbD/WSoW2DpC3I0mpmPdW+ynRTj/x2DAWYrIY7qeZIHidozwV24m4iavr15lNwIwLxRmOxhA==} + engines: {node: '>=12'} + + d3-dispatch@3.0.1: + resolution: {integrity: sha512-rzUyPU/S7rwUflMyLc1ETDeBj0NRuHKKAcvukozwhshr6g6c5d8zh4c2gQjY2bZ0dXeGLWc1PF174P2tVvKhfg==} + engines: {node: '>=12'} + + d3-drag@3.0.0: + resolution: {integrity: sha512-pWbUJLdETVA8lQNJecMxoXfH6x+mO2UQo8rSmZ+QqxcbyA3hfeprFgIT//HW2nlHChWeIIMwS2Fq+gEARkhTkg==} + engines: {node: '>=12'} + + d3-ease@3.0.1: + resolution: {integrity: sha512-wR/XK3D3XcLIZwpbvQwQ5fK+8Ykds1ip7A2Txe0yxncXSdq1L9skcG7blcedkOX+ZcgxGAmLX1FrRGbADwzi0w==} + engines: {node: '>=12'} + + d3-format@3.1.2: + resolution: {integrity: sha512-AJDdYOdnyRDV5b6ArilzCPPwc1ejkHcoyFarqlPqT7zRYjhavcT3uSrqcMvsgh2CgoPbK3RCwyHaVyxYcP2Arg==} + engines: {node: '>=12'} + + d3-interpolate@3.0.1: + resolution: {integrity: sha512-3bYs1rOD33uo8aqJfKP3JWPAibgw8Zm2+L9vBKEHJ2Rg+viTR7o5Mmv5mZcieN+FRYaAOWX5SJATX6k1PWz72g==} + engines: {node: '>=12'} + + d3-path@3.1.0: + resolution: {integrity: sha512-p3KP5HCf/bvjBSSKuXid6Zqijx7wIfNW+J/maPs+iwR35at5JCbLUT0LzF1cnjbCHWhqzQTIN2Jpe8pRebIEFQ==} + engines: {node: '>=12'} + + d3-scale@4.0.2: + resolution: {integrity: sha512-GZW464g1SH7ag3Y7hXjf8RoUuAFIqklOAq3MRl4OaWabTFJY9PN/E1YklhXLh+OQ3fM9yS2nOkCoS+WLZ6kvxQ==} + engines: {node: '>=12'} + + d3-selection@3.0.0: + resolution: {integrity: sha512-fmTRWbNMmsmWq6xJV8D19U/gw/bwrHfNXxrIN+HfZgnzqTHp9jOmKMhsTUjXOJnZOdZY9Q28y4yebKzqDKlxlQ==} + engines: {node: '>=12'} + + d3-shape@3.2.0: + resolution: {integrity: sha512-SaLBuwGm3MOViRq2ABk3eLoxwZELpH6zhl3FbAoJ7Vm1gofKx6El1Ib5z23NUEhF9AsGl7y+dzLe5Cw2AArGTA==} + engines: {node: '>=12'} + + d3-time-format@4.1.0: + resolution: {integrity: sha512-dJxPBlzC7NugB2PDLwo9Q8JiTR3M3e4/XANkreKSUxF8vvXKqm1Yfq4Q5dl8budlunRVlUUaDUgFt7eA8D6NLg==} + engines: {node: '>=12'} + + d3-time@3.1.0: + resolution: {integrity: sha512-VqKjzBLejbSMT4IgbmVgDjpkYrNWUYJnbCGo874u7MMKIWsILRX+OpX/gTk8MqjpT1A/c6HY2dCA77ZN0lkQ2Q==} + engines: {node: '>=12'} + + d3-timer@3.0.1: + resolution: {integrity: sha512-ndfJ/JxxMd3nw31uyKoY2naivF+r29V+Lc0svZxe1JvvIRmi8hUsrMvdOwgS1o6uBHmiz91geQ0ylPP0aj1VUA==} + engines: {node: '>=12'} + + d3-transition@3.0.1: + resolution: {integrity: sha512-ApKvfjsSR6tg06xrL434C0WydLr7JewBB3V+/39RMHsaXTOG0zmt/OAXeng5M5LBm0ojmxJrpomQVZ1aPvBL4w==} + engines: {node: '>=12'} + peerDependencies: + d3-selection: 2 - 3 + + d3-zoom@3.0.0: + resolution: {integrity: sha512-b8AmV3kfQaqWAuacbPuNbL6vahnOJflOhexLzMMNLga62+/nh0JzvJ0aO/5a5MVgUFGS7Hu1P9P03o3fJkDCyw==} + engines: {node: '>=12'} + + double-bits@1.1.1: + resolution: {integrity: sha512-BCLEIBq0O/DWoA7BsCu/R+RP0ZXiowP8BhtJT3qeuuQEBpnS8LK/Wo6UTJQv6v8mK1fj8n90YziHLwGdM5whSg==} + + esbuild@0.25.10: + resolution: {integrity: sha512-9RiGKvCwaqxO2owP61uQ4BgNborAQskMR6QusfWzQqv7AZOg5oGehdY2pRJMTKuwxd1IDBP4rSbI5lHzU7SMsQ==} + engines: {node: '>=18'} + hasBin: true + + events@3.3.0: + resolution: {integrity: sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==} + engines: {node: '>=0.8.x'} + + extend@3.0.2: + resolution: {integrity: sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==} + + function-plot@1.26.0: + resolution: {integrity: sha512-cCtvNF7n3UOw883Z0tYGG5zElLDLPFI2mlq7Gg3YDToPvSBFEvU4IIPZTuYIU+1BcbeBSpmlCdrYbmkWf12pGg==} + + internmap@2.0.3: + resolution: {integrity: sha512-5Hh7Y1wQbvY5ooGgPbDaL5iYLAPzMTUrjMulskHLH6wnv/A+1q5rgEaiuqEjB+oxGXIVZs1FF+R/KPN3ZSQYYg==} + engines: {node: '>=12'} + + interval-arithmetic-eval@0.5.3: + resolution: {integrity: sha512-8cR5Uerz+h1yDpb8Y2z3XfnI0XOnmWapI1CP/j84EKVocr6m6/rziLU558Vi7VGh4Bgfv9VeoOQAjDV4And+tg==} + + interval-arithmetic@1.1.3: + resolution: {integrity: sha512-RdEKOQPUky8ShFdKnsOzXXO7LMaCfZtW9Z6t6LugIWgxU1pty4KEo7hpcIDcg3CYZ2iso9fPUiQPPdhsAhaLSQ==} + + math-codegen@0.4.3: + resolution: {integrity: sha512-wDPK9BputFrirD7dXgpeIa1nkTy08Gh+nCALwEmmHSmKoCJtTYu1PjGC6Z08FmCjkHzVkhvep2mzyJWRgtOe5A==} + + mr-parser@0.2.2: + resolution: {integrity: sha512-9pMgttJp8pZtiYfoHkhBc9ncOHKmEwLMNBQpS/ZXgj4ORnPMKznYR0lZ1We3ZrD71RevQ34hKyKzDV1p/agXuw==} + + nextafter@1.0.0: + resolution: {integrity: sha512-7PO+A89Tll2rSEfyrjtqO0MaI37+nnxBdnQcPypfbEYYuGaJxWGCqaOwQX4a3GHNTS08l1kazuiLEWZniZjMUQ==} + +snapshots: + + '@esbuild/aix-ppc64@0.25.10': + optional: true + + '@esbuild/android-arm64@0.25.10': + optional: true + + '@esbuild/android-arm@0.25.10': + optional: true + + '@esbuild/android-x64@0.25.10': + optional: true + + '@esbuild/darwin-arm64@0.25.10': + optional: true + + '@esbuild/darwin-x64@0.25.10': + optional: true + + '@esbuild/freebsd-arm64@0.25.10': + optional: true + + '@esbuild/freebsd-x64@0.25.10': + optional: true + + '@esbuild/linux-arm64@0.25.10': + optional: true + + '@esbuild/linux-arm@0.25.10': + optional: true + + '@esbuild/linux-ia32@0.25.10': + optional: true + + '@esbuild/linux-loong64@0.25.10': + optional: true + + '@esbuild/linux-mips64el@0.25.10': + optional: true + + '@esbuild/linux-ppc64@0.25.10': + optional: true + + '@esbuild/linux-riscv64@0.25.10': + optional: true + + '@esbuild/linux-s390x@0.25.10': + optional: true + + '@esbuild/linux-x64@0.25.10': + optional: true + + '@esbuild/netbsd-arm64@0.25.10': + optional: true + + '@esbuild/netbsd-x64@0.25.10': + optional: true + + '@esbuild/openbsd-arm64@0.25.10': + optional: true + + '@esbuild/openbsd-x64@0.25.10': + optional: true + + '@esbuild/openharmony-arm64@0.25.10': + optional: true + + '@esbuild/sunos-x64@0.25.10': + optional: true + + '@esbuild/win32-arm64@0.25.10': + optional: true + + '@esbuild/win32-ia32@0.25.10': + optional: true + + '@esbuild/win32-x64@0.25.10': + optional: true + + built-in-math-eval@0.3.2: + dependencies: + math-codegen: 0.4.3 + + d3-array@3.2.4: + dependencies: + internmap: 2.0.3 + + d3-axis@3.0.0: {} + + d3-color@3.1.0: {} + + d3-dispatch@3.0.1: {} + + d3-drag@3.0.0: + dependencies: + d3-dispatch: 3.0.1 + d3-selection: 3.0.0 + + d3-ease@3.0.1: {} + + d3-format@3.1.2: {} + + d3-interpolate@3.0.1: + dependencies: + d3-color: 3.1.0 + + d3-path@3.1.0: {} + + d3-scale@4.0.2: + dependencies: + d3-array: 3.2.4 + d3-format: 3.1.2 + d3-interpolate: 3.0.1 + d3-time: 3.1.0 + d3-time-format: 4.1.0 + + d3-selection@3.0.0: {} + + d3-shape@3.2.0: + dependencies: + d3-path: 3.1.0 + + d3-time-format@4.1.0: + dependencies: + d3-time: 3.1.0 + + d3-time@3.1.0: + dependencies: + d3-array: 3.2.4 + + d3-timer@3.0.1: {} + + d3-transition@3.0.1(d3-selection@3.0.0): + dependencies: + d3-color: 3.1.0 + d3-dispatch: 3.0.1 + d3-ease: 3.0.1 + d3-interpolate: 3.0.1 + d3-selection: 3.0.0 + d3-timer: 3.0.1 + + d3-zoom@3.0.0: + dependencies: + d3-dispatch: 3.0.1 + d3-drag: 3.0.0 + d3-interpolate: 3.0.1 + d3-selection: 3.0.0 + d3-transition: 3.0.1(d3-selection@3.0.0) + + double-bits@1.1.1: {} + + esbuild@0.25.10: + optionalDependencies: + '@esbuild/aix-ppc64': 0.25.10 + '@esbuild/android-arm': 0.25.10 + '@esbuild/android-arm64': 0.25.10 + '@esbuild/android-x64': 0.25.10 + '@esbuild/darwin-arm64': 0.25.10 + '@esbuild/darwin-x64': 0.25.10 + '@esbuild/freebsd-arm64': 0.25.10 + '@esbuild/freebsd-x64': 0.25.10 + '@esbuild/linux-arm': 0.25.10 + '@esbuild/linux-arm64': 0.25.10 + '@esbuild/linux-ia32': 0.25.10 + '@esbuild/linux-loong64': 0.25.10 + '@esbuild/linux-mips64el': 0.25.10 + '@esbuild/linux-ppc64': 0.25.10 + '@esbuild/linux-riscv64': 0.25.10 + '@esbuild/linux-s390x': 0.25.10 + '@esbuild/linux-x64': 0.25.10 + '@esbuild/netbsd-arm64': 0.25.10 + '@esbuild/netbsd-x64': 0.25.10 + '@esbuild/openbsd-arm64': 0.25.10 + '@esbuild/openbsd-x64': 0.25.10 + '@esbuild/openharmony-arm64': 0.25.10 + '@esbuild/sunos-x64': 0.25.10 + '@esbuild/win32-arm64': 0.25.10 + '@esbuild/win32-ia32': 0.25.10 + '@esbuild/win32-x64': 0.25.10 + + events@3.3.0: {} + + extend@3.0.2: {} + + function-plot@1.26.0: + dependencies: + built-in-math-eval: 0.3.2 + d3-axis: 3.0.0 + d3-color: 3.1.0 + d3-format: 3.1.2 + d3-interpolate: 3.0.1 + d3-scale: 4.0.2 + d3-selection: 3.0.0 + d3-shape: 3.2.0 + d3-zoom: 3.0.0 + events: 3.3.0 + interval-arithmetic-eval: 0.5.3 + + internmap@2.0.3: {} + + interval-arithmetic-eval@0.5.3: + dependencies: + interval-arithmetic: 1.1.3 + math-codegen: 0.4.3 + + interval-arithmetic@1.1.3: + dependencies: + nextafter: 1.0.0 + + math-codegen@0.4.3: + dependencies: + extend: 3.0.2 + mr-parser: 0.2.2 + + mr-parser@0.2.2: {} + + nextafter@1.0.0: + dependencies: + double-bits: 1.1.1 diff --git a/public/jsxgraph/1.14.1/LICENSE.LGPL b/public/jsxgraph/1.14.1/LICENSE.LGPL deleted file mode 100644 index 0a041280..00000000 --- a/public/jsxgraph/1.14.1/LICENSE.LGPL +++ /dev/null @@ -1,165 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - - This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. - - 0. Additional Definitions. - - As used herein, "this License" refers to version 3 of the GNU Lesser -General Public License, and the "GNU GPL" refers to version 3 of the GNU -General Public License. - - "The Library" refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. - - An "Application" is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - - A "Combined Work" is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the "Linked -Version". - - The "Minimal Corresponding Source" for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - - The "Corresponding Application Code" for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - - 1. Exception to Section 3 of the GNU GPL. - - You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - - 2. Conveying Modified Versions. - - If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - - a) under this License, provided that you make a good faith effort to - ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or - - b) under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. - - 3. Object Code Incorporating Material from Library Header Files. - - The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - - a) Give prominent notice with each copy of the object code that the - Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the object code with a copy of the GNU GPL and this license - document. - - 4. Combined Works. - - You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following: - - a) Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the Combined Work with a copy of the GNU GPL and this license - document. - - c) For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. - - d) Do one of the following: - - 0) Convey the Minimal Corresponding Source under the terms of this - License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - 1) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (a) uses at run time - a copy of the Library already present on the user's computer - system, and (b) will operate properly with a modified version - of the Library that is interface-compatible with the Linked - Version. - - e) Provide Installation Information, but only if you would otherwise - be required to provide such information under section 6 of the - GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the - Application with a modified version of the Linked Version. (If - you use option 4d0, the Installation Information must accompany - the Minimal Corresponding Source and Corresponding Application - Code. If you use option 4d1, you must provide the Installation - Information in the manner specified by section 6 of the GNU GPL - for conveying Corresponding Source.) - - 5. Combined Libraries. - - You may place library facilities that are a work based on the -Library side by side in a single library together with other library -facilities that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - - a) Accompany the combined library with a copy of the same work based - on the Library, uncombined with any other library facilities, - conveyed under the terms of this License. - - b) Give prominent notice with the combined library that part of it - is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. - - 6. Revised Versions of the GNU Lesser General Public License. - - The Free Software Foundation may publish revised and/or new versions -of the GNU Lesser General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - - Each version is given a distinguishing version number. If the -Library as you received it specifies that a certain numbered version -of the GNU Lesser General Public License "or any later version" -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation. - - If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library. diff --git a/public/jsxgraph/1.14.1/jsxgraphcore.js b/public/jsxgraph/1.14.1/jsxgraphcore.js deleted file mode 100644 index f763c268..00000000 --- a/public/jsxgraph/1.14.1/jsxgraphcore.js +++ /dev/null @@ -1,55 +0,0 @@ -/* - JSXGraph 1.14.1 - - Copyright 2008-2026 - Matthias Ehmann, - Michael Gerhaeuser, - Carsten Miller, - Bianca Valentin, - Andreas Walter, - Alfred Wassermann, - Peter Wilfahrt - - This file is part of JSXGraph. - - JSXGraph is free software dual licensed under the GNU LGPL or MIT License. - - You can redistribute it and/or modify it under the terms of the - - * GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version - OR - * MIT License: https://github.com/jsxgraph/jsxgraph/blob/master/LICENSE.MIT - - JSXGraph is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License and - the MIT License along with JSXGraph. If not, see - and . -*/ - -/** - * UTF-8 Decoder by Bjoern Hoehrmann - * - * Copyright (c) 2008-2009 Bjoern Hoehrmann - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of this - * software and associated documentation files (the "Software"), to deal in the Software - * without restriction, including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons - * to whom the Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all copies or - * substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING - * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.JXG=e():t.JXG=e()}(Object("undefined"!=typeof self?self:this),function(){return function(){var __webpack_modules__={561:function(t,e,i){"use strict";var s,r=i(443),o="1.14.1";s={version:o,licenseText:"jsxgraph.org "+o,licenseLogo:"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48c3ZnIGlkPSJMb2dvIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxNzAuMDc4NzQwMiAxNzAuMDc4NzQwMiI+PHBhdGggZD0iTTY1LjE5NzM0NzMsMTEuMzM4NTgyN2MtOS42NjE5ODczLDAtMTguMzExMDM1Miw0LjQxNzcyNDYtMjQuMDM0NzksMTEuMzM4ODY3MmgxMDYuMjM5ODY4MnYxMDYuMjM5MDEzN2M2LjkyMDY1NDMtNS43MjM4NzcsMTEuMzM3ODkwNi0xNC4zNzI4MDI3LDExLjMzNzg5MDYtMjQuMDM0NDIzOFYxMS4zMzg1ODI3aC05My41NDI5Njg4WiIvPjxwYXRoIGQ9Ik0xMS4zMzg1ODI3LDY1LjE5Njc5OHY5My41NDM0NTdoOTMuNTQyOTY4OGMxNy4xOTMzNTk0LDAsMzEuMTgxNjQwNi0xMy45ODc3OTMsMzEuMTgxNjQwNi0zMS4xODExNTIzVjM0LjAxNTY0NTdINDIuNTIwMjIzM2MtMTcuMTkzMzU5NCwwLTMxLjE4MTY0MDYsMTMuOTg3NzkzLTMxLjE4MTY0MDYsMzEuMTgxMTUyM1pNODUuMDM5NzU0NiwxMzguODk3OTY5OUgzMS4xODEzNTYxdi01My44NTgzOTg0aDExLjMzNzg5MDZ2NDIuNTE5NTMxMmg0Mi41MjA1MDc4djExLjMzODg2NzJaTTkyLjEyNTY5MjEsNTEuMDIzNDU4MmMxNC44NDg2MzI4LDAsMjYuOTI4NzEwOSwxMi4wODA1NjY0LDI2LjkyODcxMDksMjYuOTI5MTk5MnMtMTIuMDgwMDc4MSwyNi45MjkxOTkyLTI2LjkyODcxMDksMjYuOTI5MTk5Mi0yNi45Mjg3MTA5LTEyLjA4MDU2NjQtMjYuOTI4NzEwOS0yNi45MjkxOTkyLDEyLjA4MDA3ODEtMjYuOTI5MTk5MiwyNi45Mjg3MTA5LTI2LjkyOTE5OTJaIi8+PHBhdGggZD0iTTkyLjEyNTY5MjEsOTMuNTQyOTg5NGM4LjU5NjY3OTcsMCwxNS41OTA4MjAzLTYuOTkzNjUyMywxNS41OTA4MjAzLTE1LjU5MDMzMnMtNi45OTQxNDA2LTE1LjU5MDMzMi0xNS41OTA4MjAzLTE1LjU5MDMzMi0xNS41OTA4MjAzLDYuOTkzNjUyMy0xNS41OTA4MjAzLDE1LjU5MDMzMiw2Ljk5NDE0MDYsMTUuNTkwMzMyLDE1LjU5MDgyMDMsMTUuNTkwMzMyWiIvPjwvc3ZnPg==",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},r.A.extendConstants(r.A,s),e.A=s},904:function(t,e,i){"use strict";var s=i(443),r=i(561),o=i(454),n=i(188),a=i(477);s.A.Coords=function(t,e,i,s){this.board=i,this.usrCoords=[],this.scrCoords=[],this.emitter=!n.A.exists(s)||s,this.emitter&&o.A.eventify(this),this.setCoordinates(t,e,!1,!0)},s.A.extend(s.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,s=this.usrCoords,r=i.origin.scrCoords;!0===t?(this.scrCoords[0]=e(s[0]),this.scrCoords[1]=e(s[0]*r[1]+s[1]*i.unitX),this.scrCoords[2]=e(s[0]*r[2]-s[2]*i.unitY)):(this.scrCoords[0]=s[0],this.scrCoords[1]=s[0]*r[1]+s[1]*i.unitX,this.scrCoords[2]=s[0]*r[2]-s[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,s,o=this.usrCoords,n=this.scrCoords;return t===r.A.COORDS_BY_USER?(i=e.usrCoords,(s=o[0]-i[0])*s>a.A.eps*a.A.eps?Number.POSITIVE_INFINITY:a.A.hypot(o[1]-i[1],o[2]-i[2])):(i=e.scrCoords,a.A.hypot(n[1]-i[1],n[2]-i[2]))},setCoordinates:function(t,e,i,s){var o=this.usrCoords,n=this.scrCoords,a=[o[0],o[1],o[2]],h=[n[0],n[1],n[2]];return t===r.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||s||h[1]===n[1]&&h[2]===n[2]||this.triggerEventHandlers(["update"],[a,h]),this},copy:function(t,e){return void 0===e&&(e=0),this[t].slice(e)},isReal:function(){return!isNaN(this.usrCoords[1]+this.usrCoords[2])&&Math.abs(this.usrCoords[0])>a.A.eps},__evt__update:function(t,e){},__evt:function(){}}),e.A=s.A.Coords},102:function(t,e,i){"use strict";var s=i(443),r=i(477),o=i(571),n=i(171),a=i(588),h=i(904),l=i(561),c=i(188);s.A.CoordsElement=function(t,e){var i;for(c.A.exists(t)||(t=[1,0,0]),i=0;i1)for(t=0;t=0?1:-1)*(e=Math.abs(e))/(e+1)):Math.abs(s[0])0&&Math.abs(this._smax-this._smin)>=r.A.eps&&(i=(b=Math.max(Math.min(b,1),0))*(this._smax-this._smin),b=((i=Math.round(i/v)*v+this._smin)-this._smin)/(this._smax-this._smin),this.update(!0)),s=M.point1.coords,!M.evalVisProp("straightfirst")&&Math.abs(s.usrCoords[0])>r.A.eps&&b<0&&(g=s,O=!0,b=0),n=M.point2.coords,!M.evalVisProp("straightlast")&&Math.abs(n.usrCoords[0])>r.A.eps&&b>1&&(g=n,O=!0,b=1)}else if(M.type===l.A.OBJECT_TYPE_TURTLE)this.updateConstraint(),g=(C=o.A.projectPointToTurtle(this,M,this.board))[0],b=C[1];else if(M.elementClass===l.A.OBJECT_CLASS_CURVE)if(M.type===l.A.OBJECT_TYPE_ARC||M.type===l.A.OBJECT_TYPE_SECTOR)g=o.A.projectPointToCircle(this,M,this.board),u=o.A.rad(M.radiuspoint,M.center,this),p=0,f=o.A.rad(M.radiuspoint,M.center,M.anglepoint),b=u,("minor"===(v=M.evalVisProp("selection"))&&f>Math.PI||"major"===v&&ff)&&(b=f,(u.5*p||u>f&&u>.5*f+Math.PI)&&(b=p),this.needsUpdateFromParent=!0,this.updateGliderFromParent()),x=f-p,this.visProp.isgeonext&&(x=1),Math.abs(x)>r.A.eps&&(b/=x);else if(this.updateConstraint(),M.transformations.length>0){for(E=!1,(C=M.getTransformationSource())[0]&&(E=C[0],w.push(M),w.push(C[1]));C[0]&&c.A.exists(C[1]._transformationSource);)C=C[1].getTransformationSource(),w.push(C[1]);if(P=this.coords.usrCoords,E){for(t=0;t=0;t--)P=r.A.matVecMult(w[t].transformMat,P);_[0]=new h.A(l.A.COORDS_BY_USER,P,this.board)}else M.updateTransformMatrix(),m=r.A.inverse(M.transformMat),P=r.A.matVecMult(m,P),A=new h.A(l.A.COORDS_BY_USER,P,this.board).usrCoords,_=o.A.projectCoordsToCurve(A[1],A[2],this.position||0,M,this.board);g=_[0],b=_[1]}else g=(C=o.A.projectPointToCurve(this,M,this.board))[0],b=C[1];else c.A.isPoint(M)&&(g=o.A.projectPointToPoint(this,M,this.board),b=this.position);this.coords.setCoordinates(l.A.COORDS_BY_USER,g.usrCoords,O),this.position=b},findClosestSnapValue:function(t){var e,i,s,o,n=null;if(s=this.evalVisProp("snapvalues"),o=this.evalVisProp("snapvaluedistance"),c.A.isArray(s)&&Math.abs(this._smax-this._smin)>=r.A.eps&&o>0)for(e=0;e1?(s-1)/(s-2):(1-s)/s,n=[e[0]+s*t[0],e[1]+s*t[1],e[2]+s*t[2]]):(s=this.position,n=[t[0]+s*(e[0]-t[0]),t[1]+s*(e[1]-t[1]),t[2]+s*(e[2]-t[2])]);else if(m.type===l.A.OBJECT_TYPE_TURTLE)this.coords.setCoordinates(l.A.COORDS_BY_USER,[m.Z(this.position),m.X(this.position),m.Y(this.position)]),this.updateConstraint(),n=o.A.projectPointToTurtle(this,m,this.board)[0].usrCoords;else if(m.elementClass===l.A.OBJECT_CLASS_CURVE){for(u=!1,(a=m.getTransformationSource())[0]&&(u=a[0],g.push(m),g.push(a[1]));a[0]&&c.A.exists(a[1]._transformationSource);)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,[m.Z(this.position),m.X(this.position),m.Y(this.position)]),m.type===l.A.OBJECT_TYPE_ARC||m.type===l.A.OBJECT_TYPE_SECTOR)p=o.A.rad([m.center.X()+1,m.center.Y()],m.center,m.radiuspoint),f=0,_=o.A.rad(m.radiuspoint,m.center,m.anglepoint),("minor"===m.visProp.selection&&_>Math.PI||"major"===m.visProp.selection&&__)&&(((A=_).5*f||A>_&&A>.5*_+Math.PI)&&(A=f),this.position=A,Math.abs(b)>r.A.eps&&(this.position/=b)),i=m.Radius(),n=[m.center.X()+i*Math.cos(this.position*b+p),m.center.Y()+i*Math.sin(this.position*b+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,r.A.matVecMult(g[d].transformMat,n),this.board).usrCoords;else n=o.A.projectPointToCurve(this,m,this.board)[0].usrCoords}else c.A.isPoint(m)&&(n=o.A.projectPointToPoint(this,m,this.board).usrCoords);this.coords.setCoordinates(l.A.COORDS_BY_USER,n,!1)}else this.needsUpdateFromParent=!0},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])>r.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):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,s,r,n,a,h,d,u=0,p=1/0,f=null,A=this.evalVisProp("ignoredsnaptopoints"),_=!1;if(r=this.board.objectsList.length,A&&(h=A.length),this.evalVisProp("snaptopoints")||t){for(n=this.evalVisProp("attractorunit"),a=this.evalVisProp("attractordistance"),e=0;e1?e.point2.coords:new h.A(l.A.COORDS_BY_USER,s[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)),(r="screen"===n?i.distance(l.A.COORDS_BY_SCREEN,this.coords):i.distance(l.A.COORDS_BY_USER,this.coords))=d&&(e===this.slideObject||this.slideObject&&this.onPolygon&&this.slideObject.parentPolygon===e)&&this.popSlideObject()}return this}},setPositionDirectly:function(t,e){var i,s,o,n,c,d=this.coords;if(this.relativeCoords)return s=new h.A(t,e,this.board),this.evalVisProp("islabel")?(o=a.A.subtract(s.scrCoords,d.scrCoords),this.relativeCoords.scrCoords[1]+=o[1],this.relativeCoords.scrCoords[2]+=o[2]):(o=a.A.subtract(s.usrCoords,d.usrCoords),this.relativeCoords.usrCoords[1]+=o[1],this.relativeCoords.usrCoords[2]+=o[2]),this;if(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;i0&&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,r,o=this.board.select(t),n=!1;if(o.type===l.A.OBJECT_TYPE_POLYGON){for(e=Number.MAX_VALUE,i=0;i0&&(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,s=[],r=["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"===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||"--"===i.effect)return t/a;s.A.warn("Callback moveTo(): valid effects are '==', '--', '<>', '>', and '<', given is '"+i.effect+"'. Set it to '--'"),i.effect="--"}return t/a};if(!c.A.exists(e)||0===e||Math.abs(t.usrCoords[0]-this.coords.usrCoords[0])>r.A.eps)return this.setPosition(l.A.COORDS_BY_USER,t.usrCoords),this.board.update(this);if(!c.A.exists(i.callback)&&Math.abs(f)=0;o--)d[a-o]=[t.usrCoords[0],u+f*_(o),p+A*_(o)];return this.animationPath=d,this.animationCallback=i.callback,this.board.addAnimation(this),this},visit:function(t,e,i){t=new h.A(l.A.COORDS_BY_USER,t,this.board);var r,o,n,a=this.board.attr.animationdelay,d=[],u=this.coords.usrCoords[1],p=this.coords.usrCoords[2],f=t.usrCoords[1]-u,A=t.usrCoords[2]-p,_=function(t){var e=t"===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||"--"===i.effect)return e;s.A.warn("Callback visit(): valid effects are '==', '--', '<>', '>', and '<', given is '"+i.effect+"'. Set it to '--'"),i.effect="--"}return e};for(c.A.isNumber(i)?i={repeat:i}:(i=i||{},c.A.exists(i.repeat)||(i.repeat=1)),n=Math.ceil(e/(a*i.repeat)),o=0;o=0;r--)d[o*(n+1)+n-r]=[t.usrCoords[0],u+f*_(r),p+A*_(r)];return this.animationPath=d,this.animationCallback=i.callback,this.board.addAnimation(this),this},moveAlongES6:function(t,e,i){return new Promise((s,r)=>{c.A.exists(i)&&c.A.exists(i.callback)?i.callback=s:i={callback:s},this.moveAlong(t,e,i)})},moveToES6:function(t,e,i){return new Promise((s,r)=>{c.A.exists(i)&&c.A.exists(i.callback)?i.callback=s:i={callback:s},this.moveTo(t,e,i)})},visitES6:function(t,e,i){return new Promise((s,r)=>{c.A.exists(i)&&c.A.exists(i.callback)?i.callback=s:i={callback:s},this.visit(t,e,i)})},_anim:function(t,e,i){var s,r,n,a,h,c,d,u,p;return this.intervalCount+=1,this.intervalCount>e&&(this.intervalCount=0,this.roundsCount+=1,i>0&&this.roundsCount>=i)?(this.roundsCount=0,this.stopAnimation()):(this.slideObject.elementClass===l.A.OBJECT_CLASS_LINE?(d=this.slideObject.point1.coords.scrCoords,u=this.slideObject.point2.coords.scrCoords,s=Math.round((u[1]-d[1])*this.intervalCount/e),r=Math.round((u[2]-d[2])*this.intervalCount/e),t>0?a=this.slideObject.point1:(a=this.slideObject.point2,s*=-1,r*=-1),this.coords.setCoordinates(l.A.COORDS_BY_SCREEN,[a.coords.scrCoords[1]+s,a.coords.scrCoords[2]+r])):this.slideObject.elementClass===l.A.OBJECT_CLASS_CURVE?(h=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(h),this.slideObject.Y(h)]),p=o.A.projectPointToCurve(this,this.slideObject,this.board),this.coords=p[0],this.position=p[1]):this.slideObject.elementClass===l.A.OBJECT_CLASS_CIRCLE&&(n=2*Math.PI,n*=t<0?this.intervalCount/e:(e-this.intervalCount)/e,c=this.slideObject.Radius(),this.coords.setCoordinates(l.A.COORDS_BY_USER,[this.slideObject.center.coords.usrCoords[1]+c*Math.cos(n),this.slideObject.center.coords.usrCoords[2]+c*Math.sin(n)])),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}}),s.A.CoordsElement.create=function(t,e,i,s,r,o){var n,a,h=!1;for(a=0;a0){for(n in this.board=t,this.type=i,this._org_type=i,this.elementClass=s||r.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}},s.A.extend(s.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,s;for(i=(s=d.A.isArray(t)?t:arguments).length,e=0;e0){if(n.applyOnce(a),d.A.exists(this.view)&&"view3d"===this.view.elType)for(s=0;s0&&this.transformations[this.transformations.length-1].isNumericMatrix?this.transformations[this.transformations.length-1].melt(n):this.addTransform(n);for(s=0;s=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))this.visProp[t]=e;else for(i in this.visProp[t]={},e)e.hasOwnProperty(i)&&(this.visProp[t][i.toLocaleLowerCase()]=e[i])},resolveShortcuts:function(t){var e,i,s,r=["traceattributes","traceAttributes"];for(e in h.A.shortcuts)if(h.A.shortcuts.hasOwnProperty(e)){if(d.A.exists(t[e]))for(i=0;i/g,">"),this.label.setText(t)),this},setName:function(t){t=t.replace(//g,">"),"slider"!==this.elType&&this.setLabelText(t),this.setAttribute({name:t})},setProperty:function(){s.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=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;i0&&A>0&&(u=this.board.getBoundingBox(),n=Math.round(i/f)*f,a=Math.round(o/A)*A,h=new s.A.Coords(r.A.COORDS_BY_USER,[n,a],this.board),(!_||h.distance("screen"===m?r.A.COORDS_BY_SCREEN:r.A.COORDS_BY_USER,this.coords)l-f?i+=f:i>c&&il-A?o+=A:o>c&&oa[2]?i:a[2],i=this.vertices[t].Y(),a[1]=ia[3]?i:a[3]}else if(this.elementClass===r.A.OBJECT_CLASS_CIRCLE)s=this.center.X(),o=this.center.Y(),a=[s-(n=this.Radius()),o+n,s+n,o-n];else if(this.elementClass===r.A.OBJECT_CLASS_CURVE){if(0===(e=this.points.length))return a;for(t=0;ta[2]?i:a[2],i=this.points[t].usrCoords[2],a[1]=ia[3]?i:a[3]}else this.elementClass===r.A.OBJECT_CLASS_POINT?(s=this.X(),o=this.Y(),a=[s-(n=this.evalVisProp("size"))/this.board.unitX,o-n/this.board.unitY,s+n/this.board.unitX,o+n/this.board.unitY]):this.elementClass===r.A.OBJECT_CLASS_LINE&&(i=this.point1.coords.usrCoords[1],a[0]=ia[2]?i:a[2],i=this.point1.coords.usrCoords[2],a[1]=ia[3]?i:a[3],i=this.point2.coords.usrCoords[1],a[0]=ia[2]?i:a[2],i=this.point2.coords.usrCoords[2],a[1]=ia[3]?i:a[3]);return a},addEvent:s.A.shortcut(s.A.GeometryElement.prototype,"on"),removeEvent:s.A.shortcut(s.A.GeometryElement.prototype,"off"),formatNumberLocale:function(t,e){var i,s,r,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(r in i=this.evalVisProp("intl.locale")||this.eval(this.board.attr.intl.locale),s=this.evalVisProp("intl.options")||{})s.hasOwnProperty(r)&&(n.hasOwnProperty(r)?o[n[r]]=this.eval(s[r]):o[r]=this.eval(s[r]));return r="maximumfractiondigits",d.A.exists(s[r])||(o[n[r]]=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))},methodMap:{},__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(){}}),d.A.copyMethodMap(s.A.GeometryElement,{setLabel:"setLabel",label:"label",setName:"setName",getName:"getName",Name:"getName",addTransform:"addTransform",removeTransform:"removeTransform",clearTransforms:"clearTransforms",setProperty:"setAttribute",setAttribute:"setAttribute",addChild:"addChild",animate:"animate",on:"on",off:"off",trigger:"trigger",addTicks:"addTicks",removeTicks:"removeTicks",removeAllTicks:"removeAllTicks",Bounds:"bounds"}),e.A=s.A.GeometryElement},925:function(t,e,i){"use strict";var s=i(443),r=i(561),o=i(144),n=i(86),a=i(133),h=i(188),l=i(477),c=i(102),d=function(){this._val=parseFloat(this.rendNodeRange.value),this.rendNodeOut.value=this.rendNodeRange.value,this.board.update()};s.A.Text=function(t,e,i,s){var o;this.constructor(t,i,r.A.OBJECT_TYPE_TEXT,r.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(s),this.visProp.visible=o,h.A.isString(this.content)&&this.notifyParents(this.content),this.elType="text"},s.A.Text.prototype=new o.A,h.A.copyPrototypeMethods(s.A.Text,c.A,"coordsConstructor"),h.A.copyMethodMap(s.A.Text,{setText:"setTextJessieCode",move:"setCoords",Size:"getSize",setAutoPosition:"setAutoPosition"}),s.A.extend(s.A.Text.prototype,{hasPoint:function(t,e){var i,s,r,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]),s=(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],r=(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<=o+d:e>=r-d&&e<=o+d&&(t>=i-d&&t<=i+2*d||t>=s-2*d&&t<=s+d)},_createFctUpdateText:function(t){var e,i,s,r,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(){r=t().toString(),this.plaintext=!a||l||c?r:this.replaceSub(this.replaceSup(this.convertGeonextAndSketchometry2CSS(r,!1)))};else if(h.A.isNumber(t)&&this.evalVisProp("formatnumber")?this.evalVisProp("tofraction")?this.content=l?"\\("+h.A.toFraction(t,!0)+"\\)":h.A.toFraction(t,c):(s=this.evalVisProp("digits"),this.useLocale()?this.content=this.formatNumberLocale(t,s):this.content=h.A.toFixed(t,s)):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(n=this,o=0;o=0;)(e=(t=t.slice(0,i)+t.slice(i).replace(/_\{/,"")).indexOf("}",i+4))>=0&&(t=t.slice(0,e)+t.slice(e).replace(/\}/,"")),i=t.indexOf("_{");for(i=t.indexOf("_");i>=0;)i=(t=t.slice(0,i)+t.slice(i).replace(/_(.?)/,"$1")).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(/\^\{/,"")).indexOf("}",i+4))>=0&&(t=t.slice(0,e)+t.slice(e).replace(/\}/,"")),i=t.indexOf("^{");for(i=t.indexOf("^");i>=0;)i=(t=t.slice(0,i)+t.slice(i).replace(/\^(.?)/,"$1")).indexOf("^");return t},getSize:function(){return this.size},setCoords:function(t,e){var i,s,o;return h.A.isArray(t)&&t.length>1&&(e=t[1],t=t[0]),this.evalVisProp("islabel")&&h.A.exists(this.element)?(s=(t-(i=this.element.getLabelAnchor()).usrCoords[1])*this.board.unitX,o=-(e-i.usrCoords[2])*this.board.unitY,this.relativeCoords.setCoordinates(r.A.COORDS_BY_SCREEN,[s,o])):this.coords.setCoordinates(r.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):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){return t.replace(/([)0-9.])\s*([(a-zA-Z_])/g,"$1*$2")},generateTerm:function(t,e,i){var s,r,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(//g,"∠")).replace(/<arc\s*\/>/g,"∠")).replace(/<sqrt\s*\/>/g,"√")).replace(/<value>/g,"")).replace(/<\/value>/g,"")).indexOf(""),a=t.indexOf(""),o>=0)for(;o>=0;)l+=' + "'+this.replaceSub(this.replaceSup(t.slice(0,o)))+'"',r=(r=t.slice(o+7,a)).replace(/\s+/g,""),!0===e&&(r=this.expandShortMath(r)),(s=(s=(s=i?r:n.A.geonext2JS(r,this.board)).replace(/\\"/g,"'")).replace(/\\'/g,"'")).indexOf("toFixed")<0&&h.A.isNumber(h.A.bind(this.board.jc.snippet(s,!0,"",!1),this)())?l+="+("+s+").toFixed("+this.evalVisProp("digits")+")":l+="+("+s+")",o=(t=t.slice(a+8)).indexOf(""),a=t.indexOf("");return l+=' + "'+this.replaceSub(this.replaceSup(t))+'"',l=(l=(l=this.convertGeonextAndSketchometry2CSS(l)).replace(/&/g,"&")).replace(/"/g,"'")},valueTagToJessieCode:function(t){var e,i,s,r,o=[],n='"';if(s=(t=(t=(t=(t=(t=t||"").replace(/\r/g,"")).replace(/\n/g,"")).replace(/<value>/g,"")).replace(/<\/value>/g,"")).indexOf(""),r=t.indexOf(""),s>=0)for(;s>=0;)o.push(n+this.escapeTicks(t.slice(0,s))+n),i=(i=t.slice(s+7,r)).replace(/\s+/g,""),e=(e=i=this.expandShortMath(i)).replace(/\\"/g,"'").replace(/\\'/g,"'"),o.push("("+e+")"),s=(t=t.slice(r+8)).indexOf(""),r=t.indexOf("");for(o.push(n+this.escapeTicks(t)+n),s=0;s/g,"∠").replace(/<arc\s*\/*>/g,"∠").replace(//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,"")).replace(/(<|<)\/overline(>|>)/g,"")).replace(/(<|<)arrow(>|>)/g,"")).replace(/(<|<)\/arrow(>|>)/g,"")),t},convertSketchometry2CSS:function(t,e){var i='';return h.A.isString(t)&&(e&&(i=this.escapeTicks(i),s=this.escapeTicks(s)),t=(t=(t=(t=t.replace(/(<|<)sketchoicon(>|>)/g,i)).replace(/(<|<)\/sketchoicon(>|>)/g,s)).replace(/(<|<)sketchofont(>|>)/g,i)).replace(/(<|<)\/sketchofont(>|>)/g,s)),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,"")).replace(/<\/value>/g,"");do{null!==(i=(e=/([\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},getNumberOfConflicts:function(t,e,i,s,o){o=o||[];var n,a,h,l,c,d,u,p,f=0,A=this.board.options.precision.hasPoint;for(this.board.options.precision.hasPoint=.3*(i+s),n=0;n(f[2]-f[0])*this.board.unitX||c[1]<0||c[1]>(f[1]-f[3])*this.board.unitY)&&(l-=1),l-=this.getNumberOfConflicts(i,s,d,u,h.A.evaluate(this.visProp.autopositionwhitelist)),l-=t/this.evalVisProp("autopositionmindistance")/10-.1,(n=Math.atan2(p[1],p[0]))<0&&(n+=2*Math.PI),l-=(r>0&&Math.cos(n)>0&&Math.abs(e-n)>Math.PI?Math.abs(e-n-2*Math.PI):Math.abs(e-n))/10):0},setAutoPosition:function(){var t,e,i,s,r,o,n,a,h,l,c,d=-1/0,u=this.evalVisProp("autopositionmindistance"),p=this.evalVisProp("autopositionmaxdistance"),f=this.evalVisProp("offset");if(this===this.board.infobox||!this.element||!this.visPropCalc.visible||!this.evalVisProp("islabel"))return this;if(l=Math.sqrt(f[0]*f[0]+f[1]*f[1]),c=Math.atan2(f[1],f[0]),0===this.calculateScore(l,c))return this;for(t=u,i=(p-u)/3;p-t>-.01;){for(s=0;s<60;s++)if(e=s/60*2*Math.PI,(n=this.calculateScore(t,e))>d&&(o=e,r=t,d=n),0===d){t=p;break}t+=i}return a=Math.cos(o),h=Math.sin(o),this.visProp.anchorx=a<0?"right":"left",this.visProp.anchory=h<0?"top":"bottom",this.visProp.offset=[r*a,r*h],this}}),s.A.createText=function(t,e,i){var r,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,!(r=c.A.create(s.A.Text,t,n,o,a)))throw new 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&&r.addRotation(o.rotate),r},s.A.registerElement("text",s.A.createText),s.A.createHTMLSlider=function(t,e,i){var r,o,n=h.A.copyAttributes(i,t.options,"htmlslider");if(2!==e.length||2!==e[0].length||3!==e[1].length)throw new 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=h.A.def(n.parent,n.anchor),n.fixed=h.A.def(n.fixed,!0),o=[e[0][0],e[0][1],'
'],(r=s.A.createText(t,o,n)).type=h.A.OBJECT_TYPE_HTMLSLIDER,r.rendNodeForm=r.rendNode.childNodes[0],r.rendNodeRange=r.rendNodeForm.childNodes[0],r.rendNodeRange.min=e[1][0],r.rendNodeRange.max=e[1][2],r.rendNodeRange.step=n.step,r.rendNodeRange.value=e[1][1],r.rendNodeLabel=r.rendNodeForm.childNodes[1],r.rendNodeLabel.id=r.rendNode.id+"_label",n.withlabel&&(r.rendNodeLabel.innerText=r.name+"="),r.rendNodeOut=r.rendNodeForm.childNodes[2],r.rendNodeOut.value=e[1][1];try{r.rendNodeForm.id=r.rendNode.id+"_form",r.rendNodeRange.id=r.rendNode.id+"_range",r.rendNodeOut.id=r.rendNode.id+"_out"}catch(t){s.A.debug(t)}return r.rendNodeRange.style.width=n.widthrange+"px",r.rendNodeRange.style.verticalAlign="middle",r.rendNodeOut.style.width=n.widthout+"px",r._val=e[1][1],s.A.supportsVML()?a.A.addEvent(r.rendNodeForm,"change",d,r):a.A.addEvent(r.rendNodeForm,"input",d,r),r.Value=function(){return this._val},r},s.A.registerElement("htmlslider",s.A.createHTMLSlider),e.A=s.A.Text},443:function(t,e){"use strict";var i={};try{"object"!=typeof JXG||JXG.extend||(i=JXG)}catch(t){}i.extend=function(t,e,i,s){var r;for(r in i=i||!1,s=s||!1,e)(!i||i&&e.hasOwnProperty(r))&&(t[s?r.toLowerCase():r]=e[r])},i.defineConstant=function(t,e,s,r){(r=r||!1)&&i.exists(t[e])||Object.defineProperty(t,e,{value:s,writable:!1,enumerable:!0,configurable:!1})},i.extendConstants=function(t,e,i,s){var r,o;for(r in i=i||!1,s=s||!1,e)(!i||i&&e.hasOwnProperty(r))&&(o=s?r.toUpperCase():r,this.defineConstant(t,o,e[r]))},i.extend(i,{boards:{},readers:{},elements:{},registerElement:function(t,e){t=t.toLowerCase(),this.elements[t]=e},registerReader:function(t,e){var i,s;for(i=0;ia&&(h+=Math.PI),c=Math.cos(h)+p[1],d=Math.sin(h)+p[2],new o.A(r.A.COORDS_BY_USER,[1,c,d],s))},reflection:function(t,e,i){var s,n,a,h,c,d,u=e.coords.usrCoords,p=t.point1.coords.usrCoords,f=t.point2.coords.usrCoords;return l.A.exists(i)||(i=e.board),h=f[1]-p[1],c=f[2]-p[2],s=u[1]-p[1],d=(h*(u[2]-p[2])-c*s)/(h*h+c*c),n=u[1]+2*d*c,a=u[2]-2*d*h,new o.A(r.A.COORDS_BY_USER,[n,a],i)},rotation:function(t,e,i,s){var n,a,h,c,d,u,p=e.coords.usrCoords,f=t.coords.usrCoords;return l.A.exists(s)||(s=e.board),n=p[1]-f[1],a=p[2]-f[2],d=n*(h=Math.cos(i))-a*(c=Math.sin(i))+f[1],u=n*c+a*h+f[2],new o.A(r.A.COORDS_BY_USER,[d,u],s)},perpendicular:function(t,e,i){var s,a,h,c,d,u=t.point1.coords.usrCoords,p=t.point2.coords.usrCoords,f=e.coords.usrCoords;return l.A.exists(i)||(i=e.board),e===t.point1?(s=u[1]+p[2]-u[2],a=u[2]-p[1]+u[1],d=u[0]*p[0],Math.abs(d)n.A.eps&&Math.abs(s-f[1])n.A.eps&&(Math.abs(t[0])n.A.eps?(i[1]-t[1])/s:(i[2]-t[2])/(e[2]-t[2])},sortVertices:function(t){for(var e,i=c.A.each(t,c.A.coordsArray),s=i.length,r=null;i[0][0]===i[s-1][0]&&i[0][1]===i[s-1][1]&&i[0][2]===i[s-1][2];)r=i.pop(),s--;return e=i[0],i.sort(function(t,i){return(t[2]===e[2]&&t[1]===e[1]?-1/0:Math.atan2(t[2]-e[2],t[1]-e[1]))-(i[2]===e[2]&&i[1]===e[1]?-1/0:Math.atan2(i[2]-e[2],i[1]-e[1]))}),null!==r&&i.push(r),i},signedTriangle:function(t,e,i){var s=c.A.coordsArray(t),r=c.A.coordsArray(e),o=c.A.coordsArray(i);return.5*((r[1]-s[1])*(o[2]-s[2])-(r[2]-s[2])*(o[1]-s[1]))},signedPolygon:function(t,e){var i,s,r=0,o=c.A.each(t,c.A.coordsArray);for(void 0===e&&(e=!0),e?o.unshift(o[o.length-1]):o=this.sortVertices(o),s=o.length,i=1;i1024)for(h=o=N[0][1],d=a=N[0][2],A=p=N[0][1]-N[0][2],f=u=N[0][1]+N[0][2],_=0,m=0,g=0,b=0,y=0,P=0,v=0,C=0,e=1;eh&&(h=E,m=e),(E=N[e][2])d&&(d=E,b=e),(E=N[e][1]-N[e][2])A&&(A=E,P=e),(E=N[e][1]+N[e][2])f&&(f=E,C=e);for(e=0;e=0||_!==y&&this.signedTriangle(N[_],N[y],x)>=-M||y!==b&&this.signedTriangle(N[y],N[b],x)>=-M||b!==C&&this.signedTriangle(N[b],N[C],x)>=-M||C!==m&&this.signedTriangle(N[C],N[m],x)>=-M||m!==P&&this.signedTriangle(N[m],N[P],x)>=-M||P!==g&&this.signedTriangle(N[P],N[g],x)>=-M||g!==v&&this.signedTriangle(N[g],N[v],x)>=-M||v!==_&&this.signedTriangle(N[v],N[_],x)>=-M)&&S.push({i:e,c:x});for(O=S.length,r=0,o=S[0].c[1],a=S[0].c[2],e=1;e1&&this.signedTriangle(T[i-2].c,T[i-1].c,S[e].c)<=0;)T.pop(),i--;T.push(S[e]),i++}return T},convexHull:function(t,e){var i,s,r=[];for(s=this.GrahamScan(t),i=0;iMath.PI&&(f-=2*Math.PI),null===A){if(0===f)continue;A=f>0?1:-1}else if(A*f<-_)return!1;m+=f}return Math.abs(m/(2*Math.PI))-1<_},calcStraight:function(t,e,i,s){var o,a,h,c,d,u,p,f,A,_;if(l.A.exists(s)||(s=10),u=t.evalVisProp("straightfirst"),p=t.evalVisProp("straightlast"),Math.abs(e.scrCoords[0])=n.A.eps&&e.scrCoords[1]>=0&&e.scrCoords[1]<=t.board.canvasWidth&&e.scrCoords[2]>=0&&e.scrCoords[2]<=t.board.canvasHeight,a=!p&&Math.abs(i.usrCoords[0])>=n.A.eps&&i.scrCoords[1]>=0&&i.scrCoords[1]<=t.board.canvasWidth&&i.scrCoords[2]>=0&&i.scrCoords[2]<=t.board.canvasHeight,c=(h=this.meetLineBoard(f,t.board,s))[0],d=h[1],!o&&!a){if(!u&&p&&!this.isSameDirection(e,i,c)&&!this.isSameDirection(e,i,d))return;if(u&&!p&&!this.isSameDirection(i,e,c)&&!this.isSameDirection(i,e,d))return}o?a||(_=this.isSameDir(e,i,c,d)?d:c):a?A=this.isSameDir(e,i,c,d)?c:d:this.isSameDir(e,i,c,d)?(A=c,_=d):(_=c,A=d),A&&e.setCoordinates(r.A.COORDS_BY_USER,A.usrCoords),_&&i.setCoordinates(r.A.COORDS_BY_USER,_.usrCoords)}},calcLineDelimitingPoints:function(t,e,i){var s,o,a,h,l,c,d,u,p,f,A;if(l=t.evalVisProp("straightfirst"),c=t.evalVisProp("straightlast"),Math.abs(e.scrCoords[0])=0?(a=this.projectPointToLine({coords:{usrCoords:[1,o[2],o[1]]}},t,t.board),h=this.projectPointToLine({coords:{usrCoords:[1,o[0],o[3]]}},t,t.board)):(a=this.projectPointToLine({coords:{usrCoords:[1,o[0],o[1]]}},t,t.board),h=this.projectPointToLine({coords:{usrCoords:[1,o[2],o[3]]}},t,t.board)),!f&&!A){if(!l&&!c){if(s=e.distance(r.A.COORDS_BY_USER,i),Math.abs(e.distance(r.A.COORDS_BY_USER,a)+a.distance(r.A.COORDS_BY_USER,i)-s)>n.A.eps)return;if(Math.abs(e.distance(r.A.COORDS_BY_USER,h)+h.distance(r.A.COORDS_BY_USER,i)-s)>n.A.eps)return}if(!l&&c&&!this.isSameDirection(e,i,a)&&!this.isSameDirection(e,i,h))return;if(l&&!c&&!this.isSameDirection(i,e,a)&&!this.isSameDirection(i,e,h))return}f?A||(p=this.isSameDir(e,i,a,h)?h:a):A?u=this.isSameDir(e,i,a,h)?a:h:this.isSameDir(e,i,a,h)?(u=a,p=h):(p=a,u=h),u&&e.setCoordinates(r.A.COORDS_BY_USER,u.usrCoords),p&&i.setCoordinates(r.A.COORDS_BY_USER,p.usrCoords)}},calcLabelQuadrant:function(t){return t<0&&(t+=2*Math.PI),["rt","urt","top","ulft","lft","llft","bot","lrt"][Math.floor((t+Math.PI/8)/(Math.PI/4))%8]},isSameDir:function(t,e,i,s){var r=e.usrCoords[1]-t.usrCoords[1],o=e.usrCoords[2]-t.usrCoords[2],a=s.usrCoords[1]-i.usrCoords[1],h=s.usrCoords[2]-i.usrCoords[2];return Math.abs(e.usrCoords[0])=0},isSameDirection:function(t,e,i){var s,r,o,a,h=!1;return s=e.usrCoords[1]-t.usrCoords[1],r=e.usrCoords[2]-t.usrCoords[2],o=i.usrCoords[1]-t.usrCoords[1],a=i.usrCoords[2]-t.usrCoords[2],Math.abs(s)=0&&o>=0||s<=0&&o<=0)&&(h=r>=0&&a>=0||r<=0&&a<=0),h},det3p:function(t,e,i){var s,r,o;return s=l.A.isPoint(t)?t.Coords(!0):t,r=l.A.isPoint(e)?e.Coords(!0):e,o=l.A.isPoint(i)?i.Coords(!0):i,(s[1]-o[1])*(r[2]-o[2])-(r[1]-o[1])*(s[2]-o[2])},windingNumber:function(t,e,i){var s,r,o,a,h,c,d=0,u=e.length,p=t[1],f=t[2],A=0;if(0===u)return 0;if((i=i||!1)&&(A=1),isNaN(p)||isNaN(f))return 1;if(l.A.exists(e[0].coords)?(s=e[0].coords,r=e[u-1].coords):(s=e[0],r=e[u-1]),s.usrCoords[1]===p&&s.usrCoords[2]===f)return 1;for(c=0;cp==r[1]r[2]?1:0)-1,r[1]>=p)if(o[1]>p)d+=h;else{if(0===(a=this.det3p(r,o,t)))return 0;a>0+n.A.eps==o[2]>r[2]&&(d+=h)}else o[1]>p&&(a=this.det3p(r,o,t))>0+n.A.eps==o[2]>r[2]&&(d+=h)}return d},pnpoly:function(t,e,i,s,n){var a,h,c,d,u,p,f,A,_=i,m=!1;for(s===r.A.COORDS_BY_USER?(p=(A=new o.A(r.A.COORDS_BY_USER,[t,e],n)).scrCoords[1],f=A.scrCoords[2]):(p=t,f=e),a=0,h=(u=i.length)-2;af!=d.scrCoords[2]>f&&p<(d.scrCoords[1]-c.scrCoords[1])*(f-c.scrCoords[2])/(d.scrCoords[2]-c.scrCoords[2])+c.scrCoords[1]&&(m=!m);return m},intersectionFunction:function(t,e,i,a,h,c){var d,u,p=this;return d=e.elementClass===r.A.OBJECT_CLASS_CURVE&&(e.type===r.A.OBJECT_TYPE_ARC||e.type===r.A.OBJECT_TYPE_SECTOR),u=i.elementClass===r.A.OBJECT_CLASS_CURVE&&(i.type===r.A.OBJECT_TYPE_ARC||i.type===r.A.OBJECT_TYPE_SECTOR),e.elementClass!==r.A.OBJECT_CLASS_CURVE&&i.elementClass!==r.A.OBJECT_CLASS_CURVE||e.elementClass!==r.A.OBJECT_CLASS_CURVE&&e.elementClass!==r.A.OBJECT_CLASS_CIRCLE||i.elementClass!==r.A.OBJECT_CLASS_CURVE&&i.elementClass!==r.A.OBJECT_CLASS_CIRCLE?e.elementClass===r.A.OBJECT_CLASS_CURVE&&!d&&i.elementClass===r.A.OBJECT_CLASS_LINE||i.elementClass===r.A.OBJECT_CLASS_CURVE&&!u&&e.elementClass===r.A.OBJECT_CLASS_LINE?function(){return p.meetCurveLine(e,i,a,e.board,l.A.evaluate(c))}:e.type===r.A.OBJECT_TYPE_POLYGON||i.type===r.A.OBJECT_TYPE_POLYGON?e.elementClass===r.A.OBJECT_CLASS_LINE?function(){var t,s=e.evalVisProp("straightfirst"),r=e.evalVisProp("straightlast"),o=i.evalVisProp("straightfirst"),n=i.evalVisProp("straightlast");return t=!(l.A.evaluate(c)||s&&r&&o&&n),p.meetPolygonLine(i,e,a,e.board,t)}:i.elementClass===r.A.OBJECT_CLASS_LINE?function(){var t,s=e.evalVisProp("straightfirst"),r=e.evalVisProp("straightlast"),o=i.evalVisProp("straightfirst"),n=i.evalVisProp("straightlast");return t=!(l.A.evaluate(c)||s&&r&&o&&n),p.meetPolygonLine(e,i,a,e.board,t)}:function(){return p.meetPathPath(e,i,a,e.board)}:e.elementClass===r.A.OBJECT_CLASS_LINE&&i.elementClass===r.A.OBJECT_CLASS_LINE?function(){var t,s,n=e.evalVisProp("straightfirst"),h=e.evalVisProp("straightlast"),d=i.evalVisProp("straightfirst"),u=i.evalVisProp("straightlast");return l.A.evaluate(c)||n&&h&&d&&u?p.meet(e.stdform,i.stdform,a,e.board):(t=p.meetSegmentSegment(e.point1.coords.usrCoords,e.point2.coords.usrCoords,i.point1.coords.usrCoords,i.point2.coords.usrCoords),s=!n&&t[1]<0||!h&&t[1]>1||!d&&t[2]<0||!u&&t[2]>1?[0,NaN,NaN]:t[0],new o.A(r.A.COORDS_BY_USER,s,e.board))}:function(){var t,h,f,A=p.meet(e.stdform,i.stdform,a,e.board),_=!0;return l.A.evaluate(c)?A:(e.elementClass!==r.A.OBJECT_CLASS_LINE||(t=e.evalVisProp("straightfirst"),h=e.evalVisProp("straightlast"),t&&h||(f=p.affineRatio(e.point1.coords,e.point2.coords,A),!(!h&&f>1+n.A.eps||!t&&f<0-n.A.eps))))&&(i.elementClass!==r.A.OBJECT_CLASS_LINE||(t=i.evalVisProp("straightfirst"),h=i.evalVisProp("straightlast"),t&&h||(f=p.affineRatio(i.point1.coords,i.point2.coords,A),!(!h&&f>1+n.A.eps||!t&&f<0-n.A.eps))))?d&&((_=p.coordsOnArc(e,A))&&u&&(_=p.coordsOnArc(i,A)),!_)?new o.A(s.A.COORDS_BY_USER,[0,NaN,NaN],e.board):A:new o.A(s.A.COORDS_BY_USER,[0,NaN,NaN],e.board)}:function(){return p.meetCurveCurve(e,i,a,h,e.board)}},otherIntersectionFunction:function(t,e,i,o){var n,a,h,c=this;return a=t[0],h=t[1],n=a.board,function(){var t,d,u,p,f=e.length,A=l.A.evaluate(o);for(t=f;t>=0;t--)if(a.elementClass===r.A.OBJECT_CLASS_CIRCLE&&[r.A.OBJECT_CLASS_CIRCLE,r.A.OBJECT_CLASS_LINE].indexOf(h.elementClass)>=0?u=c.meet(a.stdform,h.stdform,t,n):a.elementClass===r.A.OBJECT_CLASS_CURVE&&[r.A.OBJECT_CLASS_CURVE,r.A.OBJECT_CLASS_CIRCLE].indexOf(h.elementClass)>=0?u=c.meetCurveCurve(a,h,t,0,n):a.elementClass===r.A.OBJECT_CLASS_CURVE&&h.elementClass===r.A.OBJECT_CLASS_LINE&&(u=l.A.exists(a.dataX)?s.A.Math.Geometry.meetCurveLine(a,h,t,a.board,l.A.evaluate(i)):s.A.Math.Geometry.meetCurveLineContinuous(a,h,t,a.board)),void 0!==u){for(p=!1,d=0;!p&&dMath.PI||"major"===o&&rr)},meet:function(t,e,i,s){var r=n.A.eps;return Math.abs(t[3])=r&&Math.abs(e[3])=r?this.meetLineCircle(t,e,i,s):this.meetCircleCircle(t,e,i,s)},meetLineBoard:function(t,e,i){var s,a,h,c,d=[];for(l.A.exists(i)||(i=0),d[0]=n.A.crossProduct(t,[i,0,1]),d[1]=n.A.crossProduct(t,[i,1,0]),d[2]=n.A.crossProduct(t,[-i-e.canvasHeight,0,1]),d[3]=n.A.crossProduct(t,[-i-e.canvasWidth,1,0]),h=0;h<4;h++)if(Math.abs(d[h][0])>n.A.eps){for(c=2;c>0;c--)d[h][c]/=d[h][0];d[h][0]=1}return Math.abs(d[1][0])e.canvasHeight?d[2]:d[3]):d[1][2]>e.canvasHeight?(s=d[2],a=d[3][2]<0?d[0]:d[3]):(s=d[1],a=d[3][2]<0?d[0]:d[3][2]>e.canvasHeight?d[2]:d[3]),[new o.A(r.A.COORDS_BY_SCREEN,s.slice(1),e),new o.A(r.A.COORDS_BY_SCREEN,a.slice(1),e)]},meetLineLine:function(t,e,i,s){var a=isNaN(t[5]+e[5])?[0,0,0]:n.A.crossProduct(t,e);return Math.abs(a[0])<1e-14&&(a[0]=0),new o.A(r.A.COORDS_BY_USER,a,s)},meetLineCircle:function(t,e,i,s){var a,h,c,d,u,p,f,A,_;return e[4]-n.A.eps*n.A.eps?(_=[(-f+(A=Math.sqrt(Math.abs(A))))/(2*p),(-f-A)/(2*p)],0===l.A.evaluate(i)?new o.A(r.A.COORDS_BY_USER,[-_[0]*-u[1]-d*u[0],-_[0]*u[0]-d*u[1]],s):new o.A(r.A.COORDS_BY_USER,[-_[1]*-u[1]-d*u[0],-_[1]*u[0]-d*u[1]],s)):new o.A(r.A.COORDS_BY_USER,[0,0,0],s))},meetCircleCircle:function(t,e,i,s){var a;return t[4]i[1]+n.A.eps||as[1]+n.A.eps||r&&(of+p||a_+p)?[l,o,a,1e4]:[l,o,a,c[1]]},_meetCurveCurveIterative:function(t,e,i,s,r,o){var a,h,c,d,u,p,f,A,_,m,g=100*n.A.eps,b=[];if(c=i[0],u=i[1],d=s[0],p=s[1],ur))return b;return b},meetCurveCurve:function(t,e,i,s,n,a,c){var d,u,p,f,A,_,m=l.A.evaluate(i);return n=n||t.board,"segment"===a||l.A.exists(t.dataX)||l.A.exists(e.dataX)?this.meetCurveCurveDiscrete(t,e,m,n):l.A.exists(a)&&"newton"===a&&m<0||parseInt(m)!==m?(d=h.A.generalizedNewton(t,e,m,s),new o.A(r.A.COORDS_BY_USER,d,n)):(p=t.minX(),f=t.maxX(),A=e.minX(),_=e.maxX(),(u=this._meetCurveCurveIterative(t,e,[p,f],[A,_],m,c)).length>m?(d=t.Ft(u[m]),new o.A(r.A.COORDS_BY_USER,d,n)):[0,NaN,NaN])},meetCurveLine:function(t,e,i,s,o){var n,a;return l.A.exists(s)||(s=t.board),t.elementClass===r.A.OBJECT_CLASS_CURVE?(n=t,a=e):(n=e,a=t),l.A.exists(n.dataX)?this.meetCurveLineDiscrete(n,a,i,s,!o):this.meetCurveLineContinuous(n,a,i,s,!o)},meetCurveLineContinuous:function(t,e,i,s,a){var l,c,d,u,p,f,A,_,m,g,b,v,y,C=n.A.eps,P=n.A.eps;for(u=this.meetCurveLineDiscrete(t,e,i,s,a),p=u.usrCoords[1],f=u.usrCoords[2],l=function(e){var i,s;return e>t.maxX()||eP?0:1,new o.A(r.A.COORDS_BY_USER,[A,t.X(d),t.Y(d)],s)},meetCurveLineDiscrete:function(t,e,i,s,a){var h,c,d,u,p,f,A,_=l.A.evaluate(i),m=e.point1.coords.usrCoords,g=e.point2.coords.usrCoords,b=0,v=t.numberPoints,y=e.evalVisProp("straightfirst"),C=e.evalVisProp("straightlast");for(f=new o.A(r.A.COORDS_BY_USER,[0,NaN,NaN],s),0===m[0]?m=[1,g[1]+e.stdform[2],g[2]-e.stdform[1]]:0===g[0]&&(g=[1,m[1]+e.stdform[2],m[2]-e.stdform[1]]),u=t.points[0].usrCoords,h=1;hn.A.eps)for(A=3===t.bezierDegree?this.meetBeziersegmentBeziersegment([t.points[h-1].usrCoords.slice(1),t.points[h].usrCoords.slice(1),t.points[h+1].usrCoords.slice(1),t.points[h+2].usrCoords.slice(1)],[m.slice(1),g.slice(1)],a):[this.meetSegmentSegment(d,u,m,g)],c=0;c1)?f:f=new o.A(r.A.COORDS_BY_USER,p[0],s);b+=1}return f},meetCurveRedBlueSegments:function(t,e,i){var s,r,o,n,a,h,c,d,u,p=l.A.evaluate(i),f=0,A=e.numberPoints,_=t.numberPoints;if(A<=1||_<=1)return[0,NaN,NaN];for(s=1;s<_;s++)for(o=t.points[s-1].usrCoords,n=t.points[s].usrCoords,d=Math.min(o[1],n[1]),u=Math.max(o[1],n[1]),h=e.points[0].usrCoords,r=1;rd&&(c=this.meetSegmentSegment(o,n,a,h))[1]>=0&&c[2]>=0&&(c[1]<1&&c[2]<1||s===_-1&&1===c[1]||r===A-1&&1===c[2])){if(f===p)return c[0];f++}return[0,NaN,NaN]},meetSegmentSegment:function(t,e,i,s){var r,o,a,h=n.A.crossProduct(t,e),l=n.A.crossProduct(i,s),c=n.A.crossProduct(h,l);return Math.abs(c[0])0&&this.distance(h[0].coords.usrCoords,h[d-1].coords.usrCoords,3)0&&this.distance(c[0].coords.usrCoords,c[d-1].coords.usrCoords,3)=0&&h[2]<1)&&h[1]>=0&&h[1]<1&&f.push(h[0]);return d>=0&&d=e[0]&&t[0]<=e[2]&&t[1]>=e[3]&&t[3]<=e[1]},_bezierListConcat:function(t,e,i,s){var r,o=l.A.exists(s),n=0,a=e.length,h=t.length;for(h>0&&a>0&&(1===t[h-1][1]&&0===e[0][1]||o&&1===t[h-1][2]&&0===e[0][2])&&(n=1),r=n;r=0&&c[2]>=0&&c[1]<=1&&c[2]<=1?[c]:[]):[]},_bezierLineMeetSubdivision:function(t,e,i,s){var r,o,n,a,h,l,c,d,u,p,f=[];return r=this._bezierBbox(e),o=this._bezierBbox(t),s&&!this._bezierOverlap(o,r)?[]:i<5?(a=(n=this._bezierSplit(t))[0],h=n[1],this._bezierListConcat(f,this._bezierLineMeetSubdivision(a,e,i+1),0),this._bezierListConcat(f,this._bezierLineMeetSubdivision(h,e,i+1),.5),f):(u=[1].concat(t[0]),p=[1].concat(t[3]),c=[1].concat(e[0]),d=[1].concat(e[1]),(l=this.meetSegmentSegment(u,p,c,d))[1]>=0&&l[1]<=1&&(!s||l[2]>=0&&l[2]<=1)?[l]:[])},meetBeziersegmentBeziersegment:function(t,e,i){var s,r,o;for((s=4===t.length&&4===e.length?this._bezierMeetSubdivision(t,e,0):this._bezierLineMeetSubdivision(t,e,0,i)).sort(function(t,e){return 1e7*(t[1]-e[1])+(t[2]-e[2])}),r=[],o=0;o1+n.A.eps||c[2]<-n.A.eps||c[2]>1+n.A.eps||C.push(c);if(C.length>b)return C[b][0]}return C.length>b?C[b][0]:[0,NaN,NaN]},bezierSegmentEval:function(t,e){var i,s,r,o=1-t;return s=0,r=0,s+=(i=o*o*o)*e[0][0],r+=i*e[0][1],s+=(i=3*t*o*o)*e[1][0],r+=i*e[1][1],s+=(i=3*t*t*o)*e[2][0],r+=i*e[2][1],[1,s+=(i=t*t*t)*e[3][0],r+=i*e[3][1]]},bezierArc:function(t,e,i,s,r){var o,a,h,c,d,u,p,f,A,_,m,g,b,v,y,C,P,E,x=e[1],O=e[2],M=e[0],w=[],S=[];for(d=this.distance(e,t),x/=M,O/=M,u=this.rad(t.slice(1),e.slice(1),i.slice(1)),-1===r&&(u=2*Math.PI-u),f=u/4,(o=t)[1]/=o[0],o[2]/=o[0],o[0]/=o[0],c=o.slice(0),s?(w=[x,x+.333*(o[1]-x),x+.666*(o[1]-x),o[1]],S=[O,O+.333*(o[2]-O),O+.666*(o[2]-O),o[2]]):(w=[o[1]],S=[o[2]]);u>n.A.eps;)u>f?(p=f,u-=f):(p=u,u=0),E=[[1,0,0],[x*(1-(A=Math.cos(r*p)))+O*(_=Math.sin(r*p)),A,-_],[O*(1-A)-x*_,_,A]],c=[(C=n.A.matVecMult(E,o))[0]/C[0],C[1]/C[0],C[2]/C[0]],m=o[1]-x,g=o[2]-O,b=c[1]-x,v=c[2]-O,P=n.A.hypot(m+b,g+v),y=Math.abs(v-g)>n.A.eps?(m+b)*(d/P-.5)/(v-g)*8/3:(g+v)*(d/P-.5)/(m-b)*8/3,a=[1,o[1]-y*g,o[2]+y*m],h=[1,c[1]+y*v,c[2]-y*b],l.A.concat(w,[a[1],h[1],c[1]]),l.A.concat(S,[a[2],h[2],c[2]]),o=c.slice(0);return s&&(l.A.concat(w,[c[1]+.333*(x-c[1]),c[1]+.666*(x-c[1]),x]),l.A.concat(S,[c[2]+.333*(O-c[2]),c[2]+.666*(O-c[2]),O])),[w,S]},projectPointToCircle:function(t,e,i){var s,a,h,c,d,u=e.center.coords.usrCoords;return l.A.exists(i)||(i=t.board),l.A.isPoint(t)?(s=t.coords.distance(r.A.COORDS_BY_USER,e.center.coords),a=t.coords.usrCoords):(s=t.distance(r.A.COORDS_BY_USER,e.center.coords),a=t.usrCoords),Math.abs(s)1)for(_=[1,t,e],3===s.bezierDegree?u=0:b=[s.Z(0),s.X(0),s.Y(0)],d=0;d1&&d===s.numberPoints-2&&(m=v,f=this.distance(m,_),g=s.numberPoints-1),fk?1/0:(r=t-s.X(i))*r+(o=e-s.Y(i))*o},x=C(i),M=(N-T)/50,P=T,d=0;d<50;d++)((E=C(P))k?k:i,c=new o.A(r.A.COORDS_BY_USER,[s.X(i),s.Y(i)],n)}return[s.updateTransform(c),i]},projectCoordsToPolygon:function(t,e){var i,r,o,n,a,h=e.vertices.length,l=1/0;for(i=0;ic&&((l=(s*o+r*a)/h)<0?l=0:l>1&&(l=1),s-=l*o,r-=l*a),n.A.hypot(s,r)},intersectionFunction3D:function(t,e,i){var s,o=this;return e.type===r.A.OBJECT_TYPE_PLANE3D?i.type===r.A.OBJECT_TYPE_PLANE3D?s=t.intersectionPlanePlane(e,i):i.type===r.A.OBJECT_TYPE_SPHERE3D&&(s=o.meetPlaneSphere(e,i)):e.type===r.A.OBJECT_TYPE_SPHERE3D&&(i.type===r.A.OBJECT_TYPE_PLANE3D?s=o.meetPlaneSphere(i,e):i.type===r.A.OBJECT_TYPE_SPHERE3D&&(s=o.meetSphereSphere(e,i))),s},meet3Planes:function(t,e,i,s,r,o){var a,h,l,c,d,u=[1,0,0,0];for(a=n.A.crossProduct(r.slice(1),t.slice(1)),h=n.A.crossProduct(t.slice(1),i.slice(1)),l=n.A.crossProduct(i.slice(1),r.slice(1)),c=n.A.innerProduct(t.slice(1),l,3),d=0;d<3;d++)u[d+1]=(e*l[d]+s*a[d]+o*h[d])/c;return u},meetPlanePlane:function(t,e,i,s){var r,o,a,h;return a=t.slice(1),h=e.slice(1),r=n.A.crossProduct(a,h),a=i.slice(1),h=s.slice(1),o=n.A.crossProduct(a,h),(h=n.A.crossProduct(r,o)).unshift(0),h},meetPlaneSphere:function(t,e){var i=function(){return n.A.innerProduct(t.normal,e.center.coords,4)-t.d};return[function(){return n.A.axpy(-i(),t.normal,e.center.coords)},t.normal,function(){var t=e.Radius(),s=i();return Math.sqrt(t*t-s*s)}]},meetSphereSphere:function(t,e){var i=function(){var i=t.center.distance(e.center),s=t.Radius(),r=e.Radius();return(s-r)*(s+r)/(i*i)};return[function(){var s=i();return[1,.5*((1-s)*t.center.coords[1]+(1+s)*e.center.coords[1]),.5*((1-s)*t.center.coords[2]+(1+s)*e.center.coords[2]),.5*((1-s)*t.center.coords[3]+(1+s)*e.center.coords[3])]},function(){return a.A.subtract(e.center.coords,t.center.coords)},function(){var s=t.center.distance(e.center),r=t.Radius(),o=e.Radius(),n=i(),a=.5*(r*r+o*o-.5*s*s*(1+n*n));return Math.sqrt(a)}]},_paramsOutOfRange:function(t,e,i){return t[0]e[1]||t.length>1&&(t[1]i[1])},projectCoordsToParametric:function(t,e,i,s){var r,o,a,h,c,d=.01*Math.random()+.5,u=2*i;return 1===i?r=.1*((h=[l.A.evaluate(e.range[0]),l.A.evaluate(e.range[1])])[1]-h[0]):2===i&&(h=[l.A.evaluate(e.range_u[0]),l.A.evaluate(e.range_u[1])],c=[l.A.evaluate(e.range_v[0]),l.A.evaluate(e.range_v[1])],r=.1*Math.min(h[1]-h[0],c[1]-c[0])),o=r/5e6,a=function(i,s,r,o){var n=[1,e.X.apply(e,r),e.Y.apply(e,r),e.Z.apply(e,r)],a=t[1]-n[1],l=t[2]-n[2],d=t[3]-n[3];return s>=2&&(o[0]=r[0]-h[0],o[1]=-r[0]+h[1]),s>=4&&(o[2]=r[1]-c[0],o[3]=-r[1]+c[1]),a*a+l*l+d*d},0===s.length?(s[0]=d*(h[0]+h[1]),2===i&&(s[1]=d*(c[0]+c[1]))):(s[0]=s[0]<=h[0]?h[0]+n.A.eps:s[0],s[0]=s[0]>=h[1]?h[1]-n.A.eps:s[0],2===i&&(s[1]=s[1]<=c[0]?c[0]+n.A.eps:s[1],s[1]=s[1]>=c[1]?c[1]-n.A.eps:s[1])),n.A.Nlp.FindMinimum(a,i,u,s,r,o,0,200),t=[1,e.X.apply(e,s),e.Y.apply(e,s),e.Z.apply(e,s)],this._paramsOutOfRange(s,h,c)&&(s[0]=s[0]<=h[0]?h[0]+n.A.eps:s[0],s[0]=s[0]>=h[1]?h[1]-n.A.eps:s[0],2===i&&(s[1]=s[1]<=c[0]?c[0]+n.A.eps:s[1],s[1]=s[1]>=c[1]?c[1]-n.A.eps:s[1]),n.A.Nlp.FindMinimum(a,i,u,s,r,o,0,200)),[1,e.X.apply(e,s),e.Y.apply(e,s),e.Z.apply(e,s)]},projectScreenCoordsToParametric:function(t,e,i,s){var r,o,a,h,c,d=i.length;return 1===d?r=.1*((a=[l.A.evaluate(e.range[0]),l.A.evaluate(e.range[1])])[1]-a[0]):2===d&&(a=[l.A.evaluate(e.range_u[0]),l.A.evaluate(e.range_u[1])],h=[l.A.evaluate(e.range_v[0]),l.A.evaluate(e.range_v[1])],r=.1*Math.min(a[1]-a[0],h[1]-h[0])),o=r/5e6,c=function(i,s,r,o){var n=[1,e.X.apply(e,r),e.Y.apply(e,r),e.Z.apply(e,r)],l=e.view.project3DTo2D(n),c=t[0]-l[1],d=t[1]-l[2];return 1===i?(o[0]=r[0]-a[0],o[1]=-r[0]+a[1]):2===i&&(o[0]=r[0]-a[0],o[1]=-r[0]+a[1],o[2]=r[1]-h[0],o[3]=-r[1]+h[1]),c*c+d*d},s?(n.A.Nlp.FindMinimum(c,d,0,i,r,o,0,200),i[0]=(i[0]+20*a[1])%(a[1]-a[0]),2===d&&(i[1]=(i[1]+20*h[1])%(h[1]-h[0]))):n.A.Nlp.FindMinimum(c,d,2*d,i,r,o,0,200),[1,e.X.apply(e,i),e.Y.apply(e,i),e.Z.apply(e,i)]},project3DTo3DPlane:function(t,e,i){var s,r;return i=i||[0,0,0],s=n.A.norm(e),r=(n.A.innerProduct(t,e,3)-n.A.innerProduct(i,e,3))/s,n.A.axpy(-r,e,t)},getPlaneBounds:function(t,e,i,s,r){var o,n,a,l,c;return t[2]+e[0]!==0?(a=[[t[0],e[0]],[t[1],e[1]]],l=[s-i[0],s-i[1]],o=(c=h.A.Gauss(a,l))[0],n=c[1],l=[r-i[0],r-i[1]],[o,(c=h.A.Gauss(a,l))[0],n,c[1]]):null},reuleauxPolygon:function(t,e){var i,s=2*Math.PI,r=s/e,o=(e-1)/2,a=0,h=function(h,l){return function(c,d){var u=(c%s+s)%s,p=Math.floor(u/r)%e;return d||(a=t[0].Dist(t[o]),i=n.A.Geometry.rad([t[0].X()+1,t[0].Y()],t[0],t[o%e])),isNaN(p)?p:(u=.5*u+p*r*.5+i,t[p][h]()+a*Math[l](u))}};return[h("X","cos"),h("Y","sin"),0,s]}}),e.A=n.A.Geometry},733:function(t,e,i){"use strict";var s=i(443),r=i(477),o=i(188);s.A.Math.DoubleBits=function(){var t,e,i,s,r,o,n,a,h=new Float64Array(1),l=new Uint32Array(h.buffer);void 0!==Float64Array&&(h[0]=1,1072693248===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]},s=function(t){return h[0]=t,l[1]},this.doubleBits=t,this.pack=e,this.lo=i,this.hi=s):1072693248===l[0]&&(r=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=r,this.pack=o,this.lo=n,this.hi=a))},s.A.extend(s.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),s=1048575&i;return 2146435072&i&&(s+=1<<20),[e,s]},denormalized:function(t){return!(2146435072&this.hi(t))}});var n=new s.A.Math.DoubleBits,a=function(t,e){if(void 0!==t&&void 0!==e){if(r.A.IntervalArithmetic.isInterval(t)){if(!r.A.IntervalArithmetic.isSingleton(t))throw new TypeError("JXG.Math.IntervalArithmetic: interval `lo` must be a singleton");this.lo=t.lo}else this.lo=t;if(r.A.IntervalArithmetic.isInterval(e)){if(!r.A.IntervalArithmetic.isSingleton(e))throw new 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}};s.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(r.A.IntervalArithmetic.prev(t),r.A.IntervalArithmetic.next(e))},boundedSingleton:function(t){return this.bounded(t,t)},assign:function(t,e){if("number"!=typeof t||"number"!=typeof e)throw new 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(Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY)},setWhole:function(){return this.set(Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY)},open:function(t,e){return this.assign(r.A.IntervalArithmetic.next(t),r.A.IntervalArithmetic.prev(e))},halfOpenLeft:function(t,e){return this.assign(r.A.IntervalArithmetic.next(t),e)},halfOpenRight:function(t,e){return this.assign(t,r.A.IntervalArithmetic.prev(e))},toArray:function(){return[this.lo,this.hi]},clone:function(){return(new a).set(this.lo,this.hi)}}),s.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,s,r,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,s=t.hi,r=e.lo,n=e.hi,h=new a,i<0?s>0?r<0?n>0?(h.lo=Math.min(this.mulLo(i,n),this.mulLo(s,r)),h.hi=Math.max(this.mulHi(i,r),this.mulHi(s,n))):(h.lo=this.mulLo(s,r),h.hi=this.mulHi(i,r)):n>0?(h.lo=this.mulLo(i,n),h.hi=this.mulHi(s,n)):(h.lo=0,h.hi=0):r<0?n>0?(h.lo=this.mulLo(i,n),h.hi=this.mulHi(i,r)):(h.lo=this.mulLo(s,n),h.hi=this.mulHi(i,r)):n>0?(h.lo=this.mulLo(i,n),h.hi=this.mulHi(s,r)):(h.lo=0,h.hi=0):s>0?r<0?n>0?(h.lo=this.mulLo(s,r),h.hi=this.mulHi(s,n)):(h.lo=this.mulLo(s,r),h.hi=this.mulHi(i,n)):n>0?(h.lo=this.mulLo(i,r),h.hi=this.mulHi(s,n)):(h.lo=0,h.hi=0):(h.lo=0,h.hi=0),h)},div: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)?this.EMPTY.clone():this.zeroIn(e)?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():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,s=t.hi,r=e.lo,o=e.hi,n=new a;return s<0?o<0?(n.lo=this.divLo(s,r),n.hi=this.divHi(i,o)):(n.lo=this.divLo(i,r),n.hi=this.divHi(s,o)):i<0?o<0?(n.lo=this.divLo(s,o),n.hi=this.divHi(i,o)):(n.lo=this.divLo(i,r),n.hi=this.divHi(s,r)):o<0?(n.lo=this.divLo(s,o),n.hi=this.divHi(i,r)):(n.lo=this.divLo(i,o),n.hi=this.divHi(s,r)),n},divPositive:function(t,e){return 0===t.lo&&0===t.hi?t:this.zeroIn(t)?this.WHOLE:t.hi<0?new a(Number.NEGATIVE_INFINITY,this.divHi(t.hi,e)):new a(this.divLo(t.lo,e),Number.POSITIVE_INFINITY)},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),Number.POSITIVE_INFINITY):new a(Number.NEGATIVE_INFINITY,this.divHi(t.lo,e))},divZero:function(t){return 0===t.lo&&0===t.hi?t:this.WHOLE},fmod:function(t,e){var i,s;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,s=(s=t.lo/i)<0?Math.ceil(s):Math.floor(s),this.sub(t,this.mul(e,new a(s))))},multiplicativeInverse:function(t){return o.A.isNumber(t)&&(t=this.Interval(t)),this.isEmpty(t)?this.EMPTY.clone():this.zeroIn(t)?0!==t.lo?0!==t.hi?this.WHOLE:new a(Number.NEGATIVE_INFINITY,this.divHi(1,t.lo)):0!==t.hi?new a(this.divLo(1,t.hi),Number.POSITIVE_INFINITY):this.EMPTY.clone():new a(this.divLo(1,t.hi),this.divHi(1,t.lo))},pow:function(t,e){var i,s;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}return 0===e?0===t.lo&&0===t.hi?this.EMPTY.clone():this.ONE.clone():e<0?this.pow(this.multiplicativeInverse(t),-e):e%1==0?t.hi<0?(i=this.powLo(-t.hi,e),s=this.powHi(-t.lo,e),1&~e?new a(i,s):new a(-s,-i)):t.lo<0?1&~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)):new a(this.powLo(t.lo,e),this.powHi(t.hi,e)):(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,s,r,n,h;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?this.EMPTY.clone():(s=this.powHi(-t.lo,i),r=this.powLo(-t.hi,i),new a(-s,-r)):t.lo<0?(n=this.powHi(t.hi,i),e%1!=0||1&~e?new a(0,n):(h=-this.powHi(-t.lo,i),new a(h,n))):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){var e;return o.A.isNumber(t)&&(t=this.Interval(t)),this.isEmpty(t)?this.EMPTY.clone():(e=t.lo<=0?Number.NEGATIVE_INFINITY:this.logLo(t.lo),new a(e,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),s=this.isEmpty(e);return i&&s?this.EMPTY.clone():i?e.clone():s?t.clone():new a(Math.min(t.lo,e.lo),Math.max(t.hi,e.hi))},intersection:function(t,e){var i,s;return this.isEmpty(t)||this.isEmpty(e)?this.EMPTY.clone():(i=Math.max(t.lo,e.lo))<=(s=Math.min(t.hi,e.hi))?new a(i,s):this.EMPTY.clone()},union:function(t,e){if(!this.intervalsOverlap(t,e))throw new 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=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),s=this.isEmpty(e);return i&&s?this.EMPTY.clone():i?e.clone():s?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),s=this.isEmpty(e);return i&&s?this.EMPTY.clone():i?e.clone():s?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,s,r,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,s=this.fmod(e,i),this.width(s)>=i.lo?new a(-1,1):s.lo>=this.piHigh?(r=this.cos(this.sub(s,this.PI)),this.negative(r)):(o=s.lo,n=s.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,s;return this.isEmpty(t)||this.onlyInfinity(t)?this.EMPTY.clone():(e=(new a).set(t.lo,t.hi),this._handleNegative(e),s=this.PI,(i=this.fmod(e,s)).lo>=this.piHalfLow&&(i=this.sub(i,s)),i.lo<=-this.piHalfLow||i.hi>=this.piHalfLow?this.WHOLE.clone():new a(this.tanLo(i.lo),this.tanHi(i.hi)))},asin:function(t){var e,i;return this.isEmpty(t)||t.hi<-1||t.lo>1?this.EMPTY.clone():(e=t.lo<=-1?-this.piHalfHigh:this.asinLo(t.lo),i=t.hi>=1?this.piHalfHigh:this.asinHi(t.hi),new a(e,i))},acos:function(t){var e,i;return this.isEmpty(t)||t.hi<-1||t.lo>1?this.EMPTY.clone():(e=t.hi>=1?0:this.acosLo(t.hi),i=t.lo<=-1?this.piHigh:this.acosHi(t.lo),new a(e,i))},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.hie.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.hie.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:3.141592653589793,piHigh:3.1415926535897936,piHalfLow:1.5707963267948966,piHalfHigh:1.5707963267948968,piTwiceLow:6.283185307179586,piTwiceHigh:6.283185307179587,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(r.A.acot(t))},acotHi:function(t){return this.next(r.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(r.A.sinh(t))},sinhHi:function(t){return this.next(r.A.sinh(t))},coshLo:function(t){return this.prev(r.A.cosh(t))},coshHi:function(t){return this.next(r.A.cosh(t))},tanhLo:function(t){return this.prev(r.A.tanh(t))},tanhHi:function(t){return this.next(r.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,e>>=1;e>0;)t=this.mulLo(t,t),1&~e||(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,e>>=1;e>0;)t=this.mulHi(t,t),1&~e||(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:Math.pow(2,-1074),UINT_MAX:-1>>>0,nextafter:function(t,e){var i,s;return isNaN(t)||isNaN(e)?NaN:t===e?t:0===t?e<0?-this.SMALLEST_DENORM:this.SMALLEST_DENORM:(s=n.hi(t),i=n.lo(t),e>t==t>0?i===this.UINT_MAX?(s+=1,i=0):i+=1:0===i?(i=this.UINT_MAX,s-=1):i-=1,n.pack(i,s))}},s.A.Math.IntervalArithmetic.PI=new a(r.A.IntervalArithmetic.piLow,r.A.IntervalArithmetic.piHigh),s.A.Math.IntervalArithmetic.PI_HALF=new a(r.A.IntervalArithmetic.piHalfLow,r.A.IntervalArithmetic.piHalfHigh),s.A.Math.IntervalArithmetic.PI_TWICE=new a(r.A.IntervalArithmetic.piTwiceLow,r.A.IntervalArithmetic.piTwiceHigh),s.A.Math.IntervalArithmetic.ZERO=new a(0),s.A.Math.IntervalArithmetic.ONE=new a(1),s.A.Math.IntervalArithmetic.WHOLE=(new a).setWhole(),s.A.Math.IntervalArithmetic.EMPTY=(new a).setEmpty(),e.A=s.A.Math.IntervalArithmetic},477:function(t,e,i){"use strict";var s,r=i(443),o=i(188),n=function(t){var e,i;return t.memo||(e={},i=Array.prototype.join,t.memo=function(){var r=i.call(arguments);return e[r]!==s?e[r]:e[r]=t.apply(this,arguments)}),t.memo};r.A.Math={eps:1e-6,relDif:function(t,e){var i=Math.abs(t),s=Math.abs(e);return 0===(s=Math.max(i,s))?0:Math.abs(t-e)/s},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,s){var r=.5*(e+i),o=.5*s;return this.clamp(this.wrap(t,r-o,r+o),e,i)},vector:function(t,e){var i,s;for(e=e||0,i=[],s=0;s0?e[0].length:0,h=e.length,l=this.matrix(n,a);for(i=0;i0?t[0].length:0,n=this.matrix(r,o);for(i=0;i0?t[0].length:0,n=this.matrix(r,o);for(i=0;i0?t[0].length:0,e=this.matrix(o,r),i=0;ia&&(a=Math.abs(d[e][i]),o=e);if(a<=l)return r.A.warn("JXG.Math.inverse: singular matrix"),[];if(o>i){for(s=0;s0?t[0].length:0))return NaN;for(e=0;et||e<0)return NaN;if(e=Math.round(e),t=Math.round(t),0===e||e===t)return 1;for(i=1,s=0;s=0?.5:-.5)*Math.PI-Math.atan(t)},nthroot:function(t,e){var i;return e<=0||Math.floor(e)!==e?NaN:(i=1/e,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?1:0:Math.floor(e)===e?Math.pow(t,e):t>0?Math.exp(e*Math.log(t)):NaN},ratpow:function(t,e,i){var s;return 0===e?1:0===i?NaN:(s=this.gcd(e,i),this.nthroot(this.pow(t,e/s),i/s))},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)?e<=0||Math.abs(e-1)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,s=1e5;if(t=Math.abs(t),e=Math.abs(e),!o.A.isNumber(t)||!o.A.isNumber(e))return NaN;if(isNaN(t)||isNaN(e)||t===1/0||e===1/0)return NaN;if(0===t||0===e)return NaN;if(!Number.isInteger(t)||!Number.isInteger(e))return r.A.warn("JSXGraph: JXG.Math.gcd requires integer parameters"),NaN;for(e>t&&(i=t,t=e,e=i);s>0;){if(0===(t%=e))return e;if(0===(e%=t))return t;s--}},lcm:function(t,e){var i;return o.A.isNumber(t)&&o.A.isNumber(e)?isNaN(t)||isNaN(e)||Math.abs(t)===1/0||Math.abs(e)===1/0?NaN:0===t||0===e?0:Number.isInteger(t)&&Number.isInteger(e)?0!==(i=t*e)?i/this.gcd(t,e):0:(r.A.warn("JSXGraph: JXG.Math.gcd requires integer parameters"),NaN):NaN},roundToStep:function(t,e,i,s){var n,a,h=t;if(!o.A.exists(e)&&!o.A.exists(i)&&!o.A.exists(s))return h;if(r.A.exists(s)&&(h=Math.min(h,s)),r.A.exists(i)&&(h=Math.max(h,i)),a=i||0,r.A.exists(e)){if(n=(h-a)/e,Number.isInteger(n))return h;h=a+(n=Math.round(n))*e}return r.A.exists(s)&&(h=Math.min(h,s)),r.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,s;for(e=arguments.length,t=0,s=0;t0?1:t<0?0:.5},gamma:function(t){var e,i,s,r,o,n=[1,676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,1.5056327351493116e-7];if(t<.5)i=Math.PI/(Math.sin(Math.PI*t)*this.gamma(1-t));else{for(t-=1,e=n[0],o=n.length,r=1;re},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,s,r,n,a,h,l,c,d,u=0;for(e=o.A.def(e,.001),s=(t=1e-12*Math.round(1e12*t))<0?-1:1,t=Math.abs(t),i=Math.floor(t),t-=Math.floor(t),h=1,n=a=r=0,d=0,l=c=1;t-Math.floor(t)>e&&u<20;)t=1/(t-r),n=h+(r=Math.floor(t))*a,l=d+r*c,h=a,d=c,a=n,c=l,u++;return[s,i,n,l]},normalize:function(t){var e,i,s=2*t[3],r=t[4]/s;return t[5]=r,t[6]=-t[1]/s,t[7]=-t[2]/s,isFinite(r)?Math.abs(r)>=1?(t[0]=(t[6]*t[6]+t[7]*t[7]-r*r)/(2*r),t[1]=-t[6]/r,t[2]=-t[7]/r,t[3]=1/(2*r),t[4]=1):(i=r<=0?-1:1,t[0]=i*(t[6]*t[6]+t[7]*t[7]-r*r)*.5,t[1]=-i*t[6],t[2]=-i*t[7],t[3]=i/2,t[4]=i*r):(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,s;if(e="function"==typeof Float32Array?new Float32Array(16):new Array(16),4!==t.length&&4!==t[0].length)return e;for(i=0;i<4;i++)for(s=0;s<4;s++)e[i+4*s]=t[i][s];return e},Vieta:function(t){var e,i,s,r=t.length,o=[];for(o=t.slice(),e=1;e=1;--i)o[i]+=o[i-1]*s;o[0]+=s}return o}},e.A=r.A.Math},171:function(t,e,i){"use strict";var s=i(443),r=i(188),o=i(133),n=i(477),a={rk4:{s:4,A:[[0,0,0,0],[.5,0,0,0],[0,.5,0,0],[0,0,1,0]],b:[1/6,1/3,1/3,1/6],c:[0,.5,.5,1]},heun:{s:2,A:[[0,0],[1,0]],b:[.5,.5],c:[0,1]},euler:{s:1,A:[[0]],b:[1],c:[0]}};n.A.Numerics={Gauss:function(t,e){var i,s,o,a,h,l=n.A.eps,c=t.length>0?t[0].length:0;if(c!==e.length||c!==t.length)throw new Error("JXG.Math.Numerics.Gauss: Dimensions don't match. A must be a square matrix and b must be of the same length as A.");for(a=[],h=e.slice(0,c),i=0;is;i--)if(Math.abs(a[i][s])>l)if(Math.abs(a[s][s])0?t[0].length:0,n=r-1;n>=0;n--){for(a=o-1;a>n;a--)s[n]-=t[n][a]*s[a];s[n]/=t[n][n]}return s},gaussBareiss:function(t){var e,i,s,r,o,a,h,l,c,d=n.A.eps;if((h=t.length)<=0)return 0;for(t[0].length=d);r++);if(r===h)return 0;for(o=e;oc&&(c=r),l+=r,r>=d){for(r=.5*Math.atan2(2*A[e][i],A[e][e]-A[i][i]),o=Math.sin(r),a=Math.cos(r),s=0;sd&&_<2e3);return[A,f]},NewtonCotes:function(t,e,i){var s,o,n,a=0,h=i&&r.A.isNumber(i.number_of_nodes)?i.number_of_nodes:28,l={trapez:!0,simpson:!0,milne:!0},c=i&&i.integration_type&&l.hasOwnProperty(i.integration_type)&&l[i.integration_type]?i.integration_type:"milne",d=(t[1]-t[0])/h;switch(c){case"trapez":for(a=.5*(e(t[0])+e(t[1])),s=t[0],o=0;o0)throw new Error("JSXGraph: INT_SIMPSON requires config.number_of_nodes dividable by 2.");for(n=h/2,a=e(t[0])+e(t[1]),s=t[0],o=0;o0)throw new Error("JSXGraph: Error in INT_MILNE: config.number_of_nodes must be a multiple of 4");for(n=.25*h,a=7*(e(t[0])+e(t[1])),s=t[0],o=0;o=0;--c)d*=4,f[c]=f[c+1]+(f[c+1]-f[c])/(d-1),A=f[c];if(Math.abs(A-_)18&&(A=18),p[2]=[.5773502691896257],f[2]=[1],p[4]=[.33998104358485626,.8611363115940526],f[4]=[.6521451548625461,.34785484513745385],p[6]=[.2386191860831969,.6612093864662645,.932469514203152],f[6]=[.46791393457269104,.3607615730481386,.17132449237917036],p[8]=[.1834346424956498,.525532409916329,.7966664774136267,.9602898564975363],f[8]=[.362683783378362,.31370664587788727,.22238103445337448,.10122853629037626],p[10]=[.14887433898163122,.4333953941292472,.6794095682990244,.8650633666889845,.9739065285171717],f[10]=[.29552422471475287,.26926671930999635,.21908636251598204,.1494513491505806,.06667134430868814],p[12]=[.1252334085114689,.3678314989981802,.5873179542866175,.7699026741943047,.9041172563704749,.9815606342467192],f[12]=[.24914704581340277,.2334925365383548,.20316742672306592,.16007832854334622,.10693932599531843,.04717533638651183],p[14]=[.10805494870734367,.31911236892788974,.5152486363581541,.6872929048116855,.827201315069765,.9284348836635735,.9862838086968123],f[14]=[.2152638534631578,.2051984637212956,.18553839747793782,.15720316715819355,.12151857068790319,.08015808715976021,.03511946033175186],p[16]=[.09501250983763744,.2816035507792589,.45801677765722737,.6178762444026438,.755404408355003,.8656312023878318,.9445750230732326,.9894009349916499],f[16]=[.1894506104550685,.18260341504492358,.16915651939500254,.14959598881657674,.12462897125553388,.09515851168249279,.062253523938647894,.027152459411754096],p[18]=[.0847750130417353,.2518862256915055,.41175116146284263,.5597708310739475,.6916870430603532,.8037049589725231,.8926024664975557,.9558239495713977,.9915651684209309],f[18]=[.1691423829631436,.16427648374583273,.15468467512626524,.14064291467065065,.12255520671147846,.10094204410628717,.07642573025488905,.0497145488949698,.02161601352648331],p[3]=[0,.7745966692414834],f[3]=[.8888888888888888,.5555555555555556],p[5]=[0,.5384693101056831,.906179845938664],f[5]=[.5688888888888889,.47862867049936647,.23692688505618908],p[7]=[0,.4058451513773972,.7415311855993945,.9491079123427585],f[7]=[.4179591836734694,.3818300505051189,.27970539148927664,.1294849661688697],p[9]=[0,.3242534234038089,.6133714327005904,.8360311073266358,.9681602395076261],f[9]=[.3302393550012598,.31234707704000286,.26061069640293544,.1806481606948574,.08127438836157441],p[11]=[0,.26954315595234496,.5190961292068118,.7301520055740494,.8870625997680953,.978228658146057],f[11]=[.2729250867779006,.26280454451024665,.23319376459199048,.18629021092773426,.1255803694649046,.05566856711617366],p[13]=[0,.2304583159551348,.44849275103644687,.6423493394403402,.8015780907333099,.9175983992229779,.9841830547185881],f[13]=[.2325515532308739,.22628318026289723,.2078160475368885,.17814598076194574,.13887351021978725,.09212149983772845,.04048400476531588],p[15]=[0,.20119409399743451,.3941513470775634,.5709721726085388,.7244177313601701,.8482065834104272,.937273392400706,.9879925180204854],f[15]=[.2025782419255613,.19843148532711158,.1861610000155622,.16626920581699392,.13957067792615432,.10715922046717194,.07036604748810812,.03075324199611727],p[17]=[0,.17848418149584785,.3512317634538763,.5126905370864769,.6576711592166907,.7815140038968014,.8802391537269859,.9506755217687678,.9905754753144174],f[17]=[.17944647035620653,.17656270536699264,.16800410215645004,.15404576107681028,.13513636846852548,.11188384719340397,.08503614831717918,.0554595293739872,.02414830286854793],s=t[0],o=t[1],a=A+1>>1,c=p[A],d=f[A],l=.5*(o-s),h=.5*(o+s),1&~A)for(u=0,n=0;n20041683600089728e-310&&(r=50*o*e)>t&&(t=r),t},_gaussKronrod:function(t,e,i,s,r,o,n){var a,h,l,c,d,u,p,f,A,_,m,g=t[0],b=t[1],v=.5*(g+b),y=.5*(b-g),C=Math.abs(y),P=e(v),E=0,x=P*o[i-1],O=Math.abs(x),M=0,w=[],S=[];for(i%2==0&&(E=P*r[i/2-1]),a=Math.floor((i-1)/2),d=0;d0&&t>this.elist[this.order[a-1]];)this.order[a]=this.order[a-1],a--;for(r=oi-2&&e>=this.elist[this.order[s]];)this.order[s+1]=this.order[s],s--;this.order[s+1]=o,h=this.order[a],this.i=h,this.nrmax=a},set_initial_result:function(t,e){this.size=1,this.rlist[0]=t,this.elist[0]=e},update:function(t,e,i,s,r,o,n,a){var h=this.i,l=this.size,c=this.level[this.i]+1;a>s?(this.alist[h]=r,this.rlist[h]=n,this.elist[h]=a,this.level[h]=c,this.alist[l]=t,this.blist[l]=e,this.rlist[l]=i,this.elist[l]=s,this.level[l]=c):(this.blist[h]=e,this.rlist[h]=i,this.elist[h]=s,this.level[h]=c,this.alist[l]=r,this.blist[l]=o,this.rlist[l]=n,this.elist[l]=a,this.level[l]=c),this.size++,c>this.maximum_level&&(this.maximum_level=c),this.qpsrt()},retrieve:function(){var t=this.i;return{a:this.alist[t],b:this.blist[t],r:this.rlist[t],e:this.elist[t]}},sum_results:function(){var t,e=this.size,i=0;for(t=0;tE.limit&&s.A.warn("iteration limit exceeds available workspace"),M<=0&&(O<50*n.A.eps||O<5e-29)&&s.A.warn("tolerance cannot be acheived with given epsabs and epsrel"),h=w.apply(this,[t,e,S]),l=S.abserr,c=S.resabs,d=S.resasc,E.set_initial_result(h,l),u=Math.max(M,O*Math.abs(h)),l<=11102230246251565e-30*c&&l>u)return s.A.warn("cannot reach tolerance because of roundoff error on first attempt"),-1/0;if(l<=u&&l!==d||0===l)return h;if(1===x)return s.A.warn("a maximum of one iteration was insufficient"),-1/0;o=h,a=l,T=1;do{L=0,R=0,B=0,I=0,j=0,Y=0,m=(C=E.retrieve()).a,g=C.b,b=C.r,v=C.e,p=m,A=f=.5*(m+g),_=g,L=w.apply(this,[[p,f],e,S]),I=S.abserr,y=S.resasc,R=w.apply(this,[[A,_],e,S]),a+=(Y=I+(j=S.abserr))-v,o+=(B=L+R)-b,y!==I&&S.resasc!==j&&(P=b-B,Math.abs(P)<=1e-5*Math.abs(B)&&Y>=.99*v&&N++,T>=10&&Y>v&&D++),a>(u=Math.max(M,O*Math.abs(o)))&&((N>=6||D>=20)&&(k=2),E.subinterval_too_small(p,A,_)&&(k=3)),E.update(p,f,L,I,A,_,R,j),m=(C=E.retrieve()).a,g=C.b,b=C.r,v=C.e,T++}while(Tu);return E.sum_results()},I:function(t,e){return this.Qag(t,e,{q:this.GaussKronrod15,limit:15,epsrel:1e-7,epsabs:1e-7})},Newton:function(t,e,i){var s,o=0,a=n.A.eps,h=t.apply(i,[e]);for(r.A.isArray(e)&&(e=e[0]);o<50&&Math.abs(h)>a;)s=this.D(t,i)(e),Math.abs(s)>a?e-=h/s:e+=.2*Math.random()-1,h=t.apply(i,[e]),o+=1;return e},root:function(t,e,i){return this.chandrupatla(t,e,i)},generalizedNewton:function(t,e,i,s){var r,o,a,h,l,c,d,u,p,f,A,_,m,g,b=0;for(r=i,o=s,f=(d=t.X(r)-e.X(o))*d+(u=t.Y(r)-e.Y(o))*u,A=this.D(t.X,t),_=this.D(e.X,e),m=this.D(t.Y,t),g=this.D(e.Y,e);f>n.A.eps&&b<10;)a=A(r),h=-_(o),l=m(r),r-=((c=-g(o))*d-h*u)/(p=a*c-h*l),o-=(a*u-l*d)/p,f=(d=t.X(r)-e.X(o))*d+(u=t.Y(r)-e.Y(o))*u,b+=1;return Math.abs(r)o&&y<40;)l=(v=b(a,h))[0][0],c=v[0][1],d=v[1][0],a-=r*((u=v[1][1])*p-c*f)/(A=l*u-c*d),h-=r*(l*f-d*p)/A,m=t.Ft(a),g=e.Ft(h),_=(p=m[1]-g[1])*p+(f=m[2]-g[2])*f,y+=1;return[a,h,_]},generalizedDampedNewton:function(t,e,i,s,r,o,a){var h,l,c,d,u,p,f,A,_,m,g,b,v=[],y=0;if(a=a||40,_=t(v=s.slice(0,i),i),2===i){for(g=(p=(_=t(v,i))[0])*p+(f=_[1])*f;g>o&&yo&&y=0;s--)d[s]=(a[s]-l[s+1]*d[s+1])/n[s];for(s=o-3;s>=0;s--)d[s+1]=d[s];return d[0]=0,d[o-1]=0,d},splineEval:function(t,e,i,s){var o,n,a,h,l,c,d,u=Math.min(e.length,i.length),p=1,f=!1,A=[];for(r.A.isArray(t)?(p=t.length,f=!0):t=[t],o=0;oe[u-1])return NaN;for(n=1;n=0;o--)r.A.concat(n,["(",t[o].toPrecision(s),")"]),o>1?r.A.concat(n,["*",i,"",o,"<","/sup> + "]):1===o&&r.A.concat(n,["*",i," + "]);return n.join("")},lagrangePolynomial:function(t){var e=[],i=this,s=function(i,s){var r,o,n,a,h=t.length,l=0,c=0;if(!s)for(r=0;r0?u:"-"+-u,f=!1):c+=u>0?" + "+u:" - "+-u,l-d>1?c+=r+i+"^"+(l-d):l-d===1&&(c+=r+i));return c}},lagrangePolynomialCoefficients:function(t){return function(){var e,i,s,r,o=t.length,a=[],h=[],l=[];for(i=0;i=v?t[v-1][e]():(d=Math.floor(r))===r?t[d][e]():(r-=d,void 0===(u=l[e][d])?NaN:((u[3]*r+u[2])*r+u[1])*r+u[0]))}},[o("X"),o("Y"),0,function(){return t.length-1}]},CatmullRomSpline:function(t,e){return this.CardinalSpline(t,.5,e)},regressionPolynomial:function(t,e,i){var s,o,a,h,l,c,d="";if(r.A.isPoint(t)&&r.A.isFunction(t.Value))o=function(){return t.Value()};else if(r.A.isFunction(t))o=t;else{if(!r.A.isNumber(t))throw new Error("JSXGraph: Can't create regressionPolynomial from degree of type'"+typeof t+"'.");o=function(){return t}}if(3===arguments.length&&r.A.isArray(e)&&r.A.isArray(i))l=0;else if(2===arguments.length&&r.A.isArray(e)&&e.length>0&&r.A.isPoint(e[0]))l=1;else{if(!(2===arguments.length&&r.A.isArray(e)&&e.length>0&&e[0].usrCoords&&e[0].scrCoords))throw new Error("JSXGraph: Can't create regressionPolynomial. Wrong parameters.");l=2}return(c=function(t,c){var u,p,f,A,_,m,g,b,v,y=e.length;if(v=Math.floor(o()),!c){if(1===l)for(a=[],h=[],u=0;u=0;u--)b=b*t+s[u];return b}).getTerm=function(){return d},c},bezier:function(t){var e,i,s=function(s){return function(r,o){var n=3*Math.floor(r),a=r%1,h=1-a;return o||(i=3*Math.floor((t.length-1)/3),e=Math.floor(i/3)),r<0?t[0][s]():r>=e?t[i][s]():isNaN(r)?NaN:h*h*(h*t[n][s]()+3*a*t[n+1][s]())+(3*h*t[n+2][s]()+a*t[n+3][s]())*a*a}};return[s("X"),s("Y"),0,function(){return Math.floor(t.length/3)}]},bspline:function(t,e){var i,s=function(s){return function(r,o){var n,a,h,l,c=t.length,d=c-1,u=e;if(d<=0)return NaN;if(d+2<=u&&(u=d+1),r<=0)return t[0][s]();if(r>=d-u+2)return t[d][s]();for(h=Math.floor(r)+u-1,i=function(t,e){var i,s=[];for(i=0;i=s?0:l[o+1],h=e[o+r-1]-e[o],l[o]=0===h?0:(t-e[o])/h*n,0!==(h=e[o+r]-e[o+1])&&(l[o]+=(e[o+r]-t)/h*a);return l}(r,i,u,h),n=0,a=h-u+1;a<=h;a++)a=0&&(n+=t[a][s]()*l[a]);return n}};return[s("X"),s("Y"),0,function(){return t.length-1}]},D:function(t,e){return r.A.exists(e)?function(i,s){var r=1e-5;return(t.apply(e,[i+r,s])-t.apply(e,[i-r,s]))/2e-5}:function(e,i){var s=1e-5;return(t(e+s,i)-t(e-s,i))/2e-5}},_riemannValue:function(t,e,i,s){var r,o,n,a;if(s<0&&("trapezoidal"!==i&&(t+=s),s*=-1,"lower"===i?i="upper":"upper"===i&&(i="lower")),a=.01*s,"right"===i)r=e(t+s);else if("middle"===i)r=e(t+.5*s);else if("left"===i||"trapezoidal"===i)r=e(t);else if("lower"===i){for(r=e(t),n=t+a;n<=t+s;n+=a)(o=e(n))r&&(r=o);(o=e(t+s))>r&&(r=o)}else r="random"===i?e(t+s*Math.random()):"simpson"===i?(e(t)+4*e(t+.5*s)+e(t+s))/6:e(t);return r},riemann:function(t,e,i,s,o){var n,a,h,l,c,d,u,p,f,A,_,m,g,b,v=[],y=[],C=s,P=0;if(r.A.isArray(t)?(b=t[0],g=t[1]):g=t,(e=Math.floor(e))<=0)return[v,y,P];for(a=(o-s)/e,n=0;n0)return r.A.isArray(e)?this.fminbr(t,[s,o],i):this.Newton(t,s,i);for(a=s,c=h;P=m&&Math.abs(h)>Math.abs(l)&&(_=a-o,s===a?(g=_*(f=l/h),b=1-f):(g=(A=l/h)*(_*(b=h/c)*(b-(f=l/c))-(o-s)*(f-1)),b=(b-1)*(f-1)*(A-1)),g>0?b=-b:g=-g,g<.75*_*b-.5*Math.abs(m*b)&&g0?m:-m),s=o,h=l,o+=v,((l=t.call(i,o))>0&&c>0||l<0&&c<0)&&(a=s,c=h),P++}return o},chandrupatla:function(t,e,i){var s,o,a,h,l,c,d,u,p,f,A,_,m,g,b,v,y,C,P,E,x=0,O=this.maxIterationsRoot,M=1+.001*Math.random(),w=.5*M,S=n.A.eps;if(r.A.isArray(e)){if(e.length<2)throw new Error("JXG.Math.Numerics.fzero: length of array x0 has to be at least two.");s=e[0],a=t.call(i,s),o=e[1],h=t.call(i,o)}else s=(l=this.findBracket(t,e,i))[0],a=l[1],o=l[2],h=l[3];if(a*h>0)return r.A.isArray(e)?this.fminbr(t,[s,o],i):this.Newton(t,s,i);c=s,d=o,f=a,A=h;do{if(p=c+w*(d-c),m=t.call(i,p),Math.sign(m)===Math.sign(f)?(u=c,c=p,_=f,f=m):(u=d,d=c,_=A,A=f),g=c=p,b=f=m,Math.abs(A).5||0===b)break;y=(c-d)/(u-d),C=(f-A)/(_-A),P=1-Math.sqrt(1-y),E=Math.sqrt(y),(w=P1-v&&(w=1-v),x++}while(x<=O);return g},findDomain:function(t,e,i,s){var o,n,a,h,l,c,d=1-1/1.61803398875;if(void 0===s&&(s=!0),!r.A.isArray(e)||e.length<2)throw new Error("JXG.Math.Numerics.findDomain: length of array x0 has to be at least two.");if(o=(l=e.slice())[0],n=l[1],h=t.call(i,o),isNaN(h)){for(c=0;n-o>.001&&c<20;)a=(n-o)*d+o,h=t.call(i,a),isNaN(h)?o=a:n=a,c++;l[0]=s?o:n}if(o=l[0],n=l[1],h=t.call(i,n),isNaN(h)){for(c=0;n-o>.001&&c<20;)a=n-(n-o)*d,h=t.call(i,a),isNaN(h)?n=a:o=a,c++;l[1]=s?n:o}return l},fminbr:function(t,e,i){var s,o,a,h,l,c,d,u,p,f,A,_,m,g,b,v,y,C=.5*(3-Math.sqrt(5)),P=n.A.eps,E=n.A.eps,x=this.maxIterationsMinimize,O=0;if(!r.A.isArray(e)||e.length<2)throw new Error("JXG.Math.Numerics.fminbr: length of array x0 has to be at least two.");for(a=h=(s=(p=this.findDomain(t,e,i))[0])+C*((o=p[1])-s),l=h,c=d=t.call(i,h),u=d;O=_&&(g=(a-h)*(b=(a-h)*(c-u))-(a-l)*(v=(a-l)*(c-d)),(b=2*(b-v))>0?g=-g:b=-b,Math.abs(g)b*(s-a+2*_)&&g0?_:-_),v=a+m,(y=t.call(i,v))<=c?(v0;r--)o.mult(e),o.add(s.A.C.mult(t[r],r));else for(o=s.A.C.copy(t[n]),r=n-1;r>=0;r--)o.mult(e),o.add(t[r]);return o},p=function(t,e,i){var r,o,n=t.length-1;if(i=i||!1)for(o=s.A.C.mult(n,t[0]),r=n-1;r>0;r--)o.mult(e),o.add(s.A.C.mult(t[n-r],r));else for(o=s.A.C.copy(t[0]),r=n-1;r>=0;r--)o.mult(e),o.add(t[n-r]);return o},f=function(t,e){var i,s,r=t.length-1;for(s=t[r],i=r-1;i>=0;i--)s=s*e+t[i];return s};for(i=i||Number.EPSILON,r=r||30,a=t.length,s.A.isNumber(e)&&e>=0&&e=0&&(0===l[n].real&&0===l[n].imaginary);n--)l.pop();if(0===(a=l.length))return[];if(o)for(n=0;n1?(h=s.A.C.div(1,r[n]),(_=p(t,h,!0)).div(p(t,h)),_.mult(h),c=s.A.C.sub(v,_),c=s.A.C.div(r[n],c)):c.div(u(t,r[n],!0)),d=new s.A.Complex(0),a=0;ae.real?1:0}),d},_RDPfindSplit:function(t,e,i,s){var r,o,a,h,l,c,d,u,p,f,A,_=n.A.eps*n.A.eps,m=1e4,g=0,b=e;if(i-e<2)return[-1,0];if(s?(a=t[e].usrCoords,h=t[i].usrCoords):(a=t[e].scrCoords,h=t[i].scrCoords),isNaN(a[1])||isNaN(a[2]))return[NaN,e];if(isNaN(h[1])||isNaN(h[2]))return[NaN,i];for(f=(u=(u=(u=h[1]-a[1])===1/0?m:u)===-1/0?-m:u)*u+(p=(p=(p=h[2]-a[2])===1/0?m:p)===-1/0?-m:p)*p,o=e+1;o_&&((A=(c*u+d*p)/f)<0?A=0:A>1&&(A=1),c-=A*u,d-=A*p),(r=c*c+d*d)>g&&(g=r,b=o)}return[Math.sqrt(g),b]},_RDP:function(t,e,i,s,r,o){var n,a=this._RDPfindSplit(t,e,i,o),h=a[1];if(isNaN(a[0])){this._RDP(t,e,h-1,s,r,o),r.push(t[h]);do{n=++h>i||void 0===t[h]||void 0===t[h].usrCoords||(o?isNaN(t[h].usrCoords[1]+t[h].usrCoords[2]):isNaN(t[h].scrCoords[1]+t[h].scrCoords[2]))}while(h<=i&&n);h<=i&&r.push(t[h]),this._RDP(t,h+1,i,s,r,o)}else a[0]>s?(this._RDP(t,e,h,s,r,o),this._RDP(t,h,i,s,r,o)):r.push(t[i])},RamerDouglasPeucker:function(t,e,i){var s,r,o,n=[],a=[];for(o=t.length,s=0;;){for(;ss&&(a=[t[s]],this._RDP(t,s,r,e,a,i),n=n.concat(a)),s>=o)break;re;)p.sort(function(t,e){return e.v-t.v}),u[i=p.pop().idx].used=!1,n=u[i].node.v,a=u[i].lft,h=u[i].rt,u[a].rt=h,u[h].lft=a,null!==(l=u[a].lft)&&(o=Math.abs(s.A.Math.Numerics.det([t[l].usrCoords,t[a].usrCoords,t[h].usrCoords])),u[a].node.v=o>=n?o:n),null!==(c=u[h].rt)&&(o=Math.abs(s.A.Math.Numerics.det([t[a].usrCoords,t[h].usrCoords,t[c].usrCoords])),u[h].node.v=o>=n?o:n);f=[t[i=0]];do{i=u[i].rt,f.push(t[i])}while(null!==u[i].rt);return f}},e.A=n.A.Numerics},588:function(t,e,i){"use strict";var s=i(443),r=i(477),o=i(188);r.A.Statistics={sum:function(t){var e,i=t.length,s=0;for(e=0;e0?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)]:.5*(e[.5*i-1]+e[.5*i])):0},_getPercentiles:function(t,e){var i,s,r,o,n=[];for(o=t.length,i=0;i=d[0]-c&&h<=d[2]+c?r.push(h):n.push(h);return d.unshift(this.min(r)),d.push(this.max(r)),d.push(n),d},variance:function(t){var e,i,s,r=t.length;if(r>1){for(e=this.mean(t),i=0,s=0;s0?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,s;if(o.A.isArray(t))if(t.map)s=t.map(Math.abs);else for(i=t.length,s=[],e=0;er.A.eps&&(o[i]=(t[i].usrCoords[2]-t[e].usrCoords[2])/(t[i].usrCoords[1]-t[e].usrCoords[1]));s[e]=this.median(o),n.push(t[e].usrCoords[2]-s[e]*t[e].usrCoords[1])}return[this.median(n),this.median(s),-1]},generateGaussian:function(t,e){var i,s,r;if(this.hasSpare)return this.hasSpare=!1,this.spare*e+t;do{r=(i=2*Math.random()-1)*i+(s=2*Math.random()-1)*s}while(r>=1||0===r);return r=Math.sqrt(-2*Math.log(r)/r),this.spare=s*r,this.hasSpare=!0,t+e*i*r},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 s,r,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{s=Math.random();do{r=Math.random()}while(0===r);s=h);return e*o+i}do{n=Math.tan(Math.PI*Math.random()),(o=Math.sqrt(2*t-1)*n+t-1)>0&&(r=Math.random())}while(o<=0||r>(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){return t<=0||e<=0?NaN:this.randomChisquare(t)*e/(this.randomChisquare(e)*t)},randomT:function(t){var e,i;return t<=0?NaN:(e=this.randomNormal(0,1),i=this.randomChisquare(t),e/Math.sqrt(i/t))},randomBinomial:function(t,e){var i,s,r,o,n;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().5)return t-this.randomBinomial(t,1-e);if(t<100){if(i=-1,s=0,0===(r=Math.log(1-e)))return 0;do{i+=1,s+=Math.floor(Math.log(Math.random())/r)+1}while(s=e?this.randomBinomial(o-1,e/i):o+this.randomBinomial(n-1,(e-i)/(1-i));return i},randomGeometric:function(t){var e;return t<0||t>1?NaN:(e=Math.random(),Math.ceil(Math.log(e)/Math.log(1-t)))},randomPoisson:function(t){var e,i,s=Math.exp(-t),r=0,o=1;if(t<=0)return NaN;if(t<10){do{o*=Math.random(),r+=1}while(o>s);e=r-1}else r=Math.floor(7/8*t),e=(i=this.randomGamma(r))t+e)return NaN;for(s=i;h*s>0;)r=Math.random(),h-=Math.floor(r+h/(n+s)),s-=1;return o=a-h,t<=e?o:i-o},histogram:function(t,e){var i,r,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=0&&o',scale:.85,id:null},ignoreLabels:!0,intl:{enabled:!1},jxgbox:{id:"jxgbox",outerbox:null,cssStyle:"width: 500px; aspect-ratio: 1/1; overflow: visible",cssClass:"jxgbox"},keepAspectRatio:!1,keyboard:{enabled:!0,dx:10,dy:10,panShift:!0,panCtrl:!1},logging:{enabled:!1},minimizeReflow:"none",maxBoundingBox:[-1/0,1/0,1/0,-1/0],maxFrameRate:40,maxNameLength:1,moveTarget:null,offsetX:0,offsetY:0,pan:{enabled:!0,needShift:!0,needTwoFingers:!1},registerEvents:!0,renderer:"auto",resize:{enabled:!0,throttle:10},screenshot:{scale:1,type:"png",symbol:"⌘",css:"background-color:#eeeeee; opacity:1.0; border:2px solid black; border-radius:10px; text-align:center",cssButton:"padding: 4px 10px; border: solid #356AA0 1px; border-radius: 5px; position: absolute; right: 2ex; top: 2ex; background-color: rgba(255, 255, 255, 0.3);"},selection:{enabled:!1,name:"selectionPolygon",needShift:!1,needCtrl:!0,fillColor:"#ffff00",visible:!1,withLines:!1,vertices:{visible:!1}},sketches:{enabled:!1,0:{visible:!0},1:{visible:!0}},showClearTraces:!1,showCopyright:!0,showFullscreen:!1,showInfobox:!0,showLogo:!1,showNavigation:!0,showReload:!1,showScreenshot:!1,showZoom:!0,takeFirst:!1,takeSizeFromFile:!1,theme:"default",title:"",zoom:{enabled:!0,factorX:1.25,factorY:1.25,wheel:!0,needShift:!0,center:"auto",min:1e-4,max:1e4,pinch:!0,pinchHorizontal:!0,pinchVertical:!0,pinchSensitivity:7},zoomX:1,zoomY:1},navbar:{strokeColor:"#333333",fillColor:"transparent",highlightFillColor:"#aaaaaa",padding:"2px",position:"absolute",fontSize:"14px",cursor:"pointer",zIndex:"100",right:"5px",bottom:"5px"},elements:{aria:{enabled:!1,label:"",live:"assertive"},clip:!0,cssClass:"",highlightCssClass:"",dash:0,dashScale:!1,draft:{draft:!1,strokeColor:"#565656",fillColor:"#565656",strokeOpacity:.8,fillOpacity:.8,strokeWidth:1},dragToTopOfLayer:!1,element3D:null,fillColor:"black",fillOpacity:1,fixed:!1,frozen:!1,gradient:null,gradientAngle:0,gradientCX:.5,gradientCY:.5,gradientEndOffset:1,gradientFX:.5,gradientFY:.5,gradientFR:0,gradientR:.5,gradientSecondColor:"#ffffff",gradientSecondOpacity:1,gradientStartOffset:0,highlight:!0,highlightFillColor:"none",highlightFillOpacity:1,highlightStrokeColor:"#c3d9ff",highlightStrokeOpacity:1,highlightStrokeWidth:2,isLabel:!1,layer:0,lineCap:"butt",needsRegularUpdate:!0,nonnegativeOnly:!1,precision:"inherit",priv:!1,rotatable:!0,scalable:!0,shadow:{enabled:!1,color:[0,0,0],opacity:1,blur:3,blend:.1,offset:[5,5]},snapToGrid:!1,strokeColor:n.A.palette.blue,strokeOpacity:1,strokeWidth:2,tabindex:-1,trace:!1,traceAttributes:{},transitionDuration:100,transitionProperties:["fill","fill-opacity","stroke","stroke-opacity","stroke-width"],visible:!0,withLabel:!1,ignoreForLabelAutoposition:!1},ticks:{generateLabelText:null,generateLabelValue:null,drawLabels:!1,label:{tabindex:null,layer:7,highlight:!1,autoPosition:!1},beautifulScientificTickLabels:!1,useUnicodeMinus:!0,anchor:"left",drawZero:!1,insertTicks:!1,minTicksDistance:10,minorHeight:4,majorHeight:10,tickEndings:[1,1],majorTickEndings:[1,1],ignoreInfiniteTickEndings:!0,minorTicks:4,ticksPerLabel:!1,scale:1,scaleSymbol:"",labels:[],maxLabelLength:5,precision:3,digits:3,ticksDistance:1,face:"|",strokeOpacity:1,strokeWidth:1,strokeColor:"#000000",highlightStrokeColor:"#888888",fillColor:"none",highlightFillColor:"none",visible:"inherit",includeBoundaries:!1,type:"linear",intl:{enabled:"inherit",options:{}},minorTicksInArrow:!1,majorTicksInArrow:!0,labelInArrow:!0,minorTicksInMargin:!1,majorTicksInMargin:!0,labelInMargin:!0,ignoreForLabelAutoposition:!0},hatch:{drawLabels:!1,drawZero:!0,majorHeight:20,anchor:"middle",face:"|",strokeWidth:2,strokeColor:n.A.palette.blue,ticksDistance:.2},precision:{touch:30,touchMax:100,mouse:4,pen:4,epsilon:1e-4,hasPoint:4},layer:{numlayers:20,unused9:19,unused8:18,unused7:17,unused6:16,unused5:15,unused4:14,unused3:13,unused2:12,unused1:11,unused0:10,text:9,point:9,glider:9,arc:8,line:7,circle:6,curve:5,turtle:5,polygon:3,sector:3,angle:3,integral:3,axis:2,ticks:2,grid:1,image:0,trace:0},angle:{withLabel:!0,radius:"auto",orientation:"counterclockwise",type:"sector",orthoType:"square",orthoSensitivity:1,fillColor:n.A.palette.orange,highlightFillColor:n.A.palette.orange,strokeColor:n.A.palette.orange,fillOpacity:.3,highlightFillOpacity:.3,radiuspoint:{withLabel:!1,visible:!1,name:""},pointsquare:{withLabel:!1,visible:!1,name:""},dot:{visible:!1,strokeColor:"none",fillColor:"#000000",size:2,face:"o",withLabel:!1,name:""},label:{position:"top",offset:[0,0],strokeColor:n.A.palette.blue},arc:{visible:!1,orientation:"inherit",fillColor:"none"}},arc:{selection:"auto",orientation:"counterclockwise",hasInnerPoints:!1,label:{anchorX:"auto",anchorY:"auto"},firstArrow:!1,lastArrow:!1,fillColor:"none",highlightFillColor:"none",strokeColor:n.A.palette.blue,highlightStrokeColor:"#c3d9ff",useDirection:!1,center:{name:"",visible:!1,withLabel:!1},radiusPoint:{name:"",visible:!1,withLabel:!1},anglePoint:{name:"",visible:!1,withLabel:!1}},arrow:{firstArrow:!1,lastArrow:{type:1,highlightSize:6,size:6}},arrowparallel:{firstArrow:!1,lastArrow:{type:1,highlightSize:6,size:6}},axis:{name:"",needsRegularUpdate:!1,strokeWidth:1,lastArrow:{type:1,highlightSize:8,size:8},strokeColor:"#666666",highlightStrokeWidth:1,highlightStrokeColor:"#888888",position:"static",anchor:"",anchorDist:"10%",ticksAutoPos:!1,ticksAutoPosThreshold:"5%",withTicks:!0,straightFirst:!0,straightLast:!0,margin:-4,withLabel:!1,scalable:!1,ticks:{label:{offset:[4,-9],parse:!1,needsRegularUpdate:!1,display:"internal",visible:"inherit",layer:9},visible:"inherit",needsRegularUpdate:!1,strokeWidth:1,strokeColor:"#666666",highlightStrokeColor:"#888888",drawLabels:!0,drawZero:!1,insertTicks:!0,minTicksDistance:5,minorHeight:10,majorHeight:-1,tickEndings:[0,1],majorTickEndings:[1,1],minorTicks:4,ticksDistance:1,strokeOpacity:.25},point1:{needsRegularUpdate:!1,visible:!1},point2:{needsRegularUpdate:!1,visible:!1},tabindex:-1,label:{position:"lft",offset:[10,10]},ignoreForLabelAutoposition:!0},bisector:{strokeColor:"#000000",point:{visible:!1,fixed:!1,withLabel:!1,name:""}},bisectorlines:{line1:{strokeColor:"#000000"},line2:{strokeColor:"#000000"}},boxplot:{dir:"vertical",smallWidth:.5,outlier:{size:3,face:"o"},strokeWidth:2,strokeColor:n.A.palette.blue,fillColor:n.A.palette.blue,fillOpacity:.2,highlightStrokeWidth:2,highlightStrokeColor:n.A.palette.blue,highlightFillColor:n.A.palette.blue,highlightFillOpacity:.1},button:{disabled:!1,display:"html"},cardinalspline:{createPoints:!0,isArrayOfCoordinates:!0,points:{strokeOpacity:.05,fillOpacity:.05,highlightStrokeOpacity:1,highlightFillOpacity:1,withLabel:!1,name:"",fixed:!1}},chart:{chartStyle:"line",colors:["#B02B2C","#3F4C6B","#C79810","#D15600","#FFFF88","#c3d9ff","#4096EE","#008C00"],highlightcolors:null,fillcolor:null,highlightonsector:!1,highlightbysize:!1,fillOpacity:.6,withLines:!1,label:{}},checkbox:{disabled:!1,checked:!1,display:"html"},circle:{hasInnerPoints:!1,fillColor:"none",highlightFillColor:"none",strokeColor:n.A.palette.blue,highlightStrokeColor:"#c3d9ff",center:{visible:!1,withLabel:!1,fixed:!1,fillColor:n.A.palette.red,strokeColor:n.A.palette.red,highlightFillColor:"#c3d9ff",highlightStrokeColor:"#c3d9ff",layer:9,name:""},point2:{fillColor:n.A.palette.red,strokeColor:n.A.palette.red,highlightFillColor:"#c3d9ff",highlightStrokeColor:"#c3d9ff",layer:9,visible:!1,withLabel:!1,fixed:!1,name:""},label:{position:"urt"}},circumcircle:{fillColor:"none",highlightFillColor:"none",strokeColor:n.A.palette.blue,highlightStrokeColor:"#c3d9ff",center:{visible:!1,fixed:!1,withLabel:!1,fillColor:n.A.palette.red,strokeColor:n.A.palette.red,highlightFillColor:"#c3d9ff",highlightStrokeColor:"#c3d9ff",name:""}},circumcirclearc:{fillColor:"none",highlightFillColor:"none",strokeColor:n.A.palette.blue,highlightStrokeColor:"#c3d9ff",useDirection:!0,center:{visible:!1,withLabel:!1,fixed:!1,name:""}},circumcirclesector:{useDirection:!0,fillColor:n.A.palette.yellow,highlightFillColor:n.A.palette.yellow,fillOpacity:.3,highlightFillOpacity:.3,strokeColor:n.A.palette.blue,highlightStrokeColor:"#c3d9ff",point:{visible:!1,fixed:!1,withLabel:!1,name:""}},comb:{frequency:.2,width:.4,angle:Math.PI/3,reverse:!1,point1:{visible:!1,withLabel:!1,fixed:!1,name:""},point2:{visible:!1,withLabel:!1,fixed:!1,name:""},strokeWidth:1,strokeColor:"#0000ff",fillColor:"none"},conic:{fillColor:"none",highlightFillColor:"none",strokeColor:n.A.palette.blue,highlightStrokeColor:"#c3d9ff",foci:{fixed:!1,visible:!1,withLabel:!1,name:""},center:{visible:!1,withLabel:!1,name:""},point:{withLabel:!1,name:""},line:{visible:!1}},curve:{strokeWidth:1,strokeColor:n.A.palette.blue,fillColor:"none",fixed:!0,curveType:null,doAdvancedPlot:!0,doAdvancedPlotOld:!1,firstArrow:!1,handDrawing:!1,label:{position:"rt"},lastArrow:!1,lineCap:"round",numberPointsHigh:1600,numberPointsLow:400,plotVersion:2,RDPsmoothing:!1,RDPthreshold:.2,recursionDepthHigh:17,recursionDepthLow:15},foreignobject:{fixed:!0,visible:!0,needsRegularUpdate:!1,attractors:[],evaluateOnlyOnce:!1},functiongraph:{label:{position:"rt"},RDPsmoothing:!0},glider:{label:{}},grid:{needsRegularUpdate:!1,hasGrid:!1,highlight:!1,gridX:null,gridY:null,majorStep:"auto",minorElements:0,forceSquare:!1,includeBoundaries:!1,size:void 0,face:void 0,margin:void 0,drawZero:void 0,polygonVertices:void 0,major:{size:5,face:"line",margin:0,drawZero:!0,polygonVertices:6},minor:{visible:"inherit",size:3,face:"point",margin:0,drawZero:!0,polygonVertices:6},snapToGrid:!1,strokeColor:"#c0c0c0",strokeWidth:1,strokeOpacity:.5,dash:0,theme:0,themes:[{},{forceSquare:"min",major:{face:"line"}},{major:{face:"line"},minor:{size:3,face:"point"},minorElements:"auto"},{major:{face:"line"},minor:{face:"line",strokeOpacity:.25},minorElements:"auto"},{major:{face:"line"},minor:{face:"+",size:"95%"},minorElements:"auto"},{major:{face:"+",size:10,strokeOpacity:1},minor:{face:"point",size:3},minorElements:"auto"},{major:{face:"circle",size:8,fillColor:"#c0c0c0"},minor:{face:"point",size:3},minorElements:"auto"}]},group:{needsRegularUpdate:!0},htmlslider:{widthRange:100,widthOut:34,step:.01,frozen:!0,isLabel:!1,strokeColor:"#000000",display:"html",anchorX:"left",anchorY:"middle",withLabel:!1},image:{imageString:null,fillOpacity:1,highlightFillOpacity:.6,cssClass:"JXGimage",highlightCssClass:"JXGimageHighlight",rotate:0,snapSizeX:1,snapSizeY:1,attractors:[]},implicitcurve:{margin:1,resolution_outer:5,resolution_inner:5,max_steps:1024,alpha_0:.05,tol_u0:o.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:.5,loop_dist:.09,loop_dir:.99,loop_detection:!0},incircle:{fillColor:"none",highlightFillColor:"none",strokeColor:n.A.palette.blue,highlightStrokeColor:"#c3d9ff",center:{visible:!1,fixed:!1,withLabel:!1,fillColor:n.A.palette.red,strokeColor:n.A.palette.red,highlightFillColor:"#c3d9ff",highlightStrokeColor:"#c3d9ff",name:""}},inequality:{fillColor:n.A.palette.red,fillOpacity:.2,strokeColor:"none",inverse:!1},infobox:{distanceX:-20,distanceY:25,intl:{enabled:"inherit",options:{}},fontSize:12,isLabel:!1,strokeColor:"#bbbbbb",display:"html",anchorX:"left",anchorY:"middle",cssClass:"JXGinfobox",rotate:0,visible:!0,parse:!1,transitionDuration:0,needsRegularUpdate:!1,tabindex:null,viewport:[0,0,0,0],ignoreForLabelAutoposition:!0},integral:{axis:"x",withLabel:!0,fixed:!0,strokeWidth:0,strokeOpacity:0,fillColor:n.A.palette.red,fillOpacity:.3,highlightFillColor:n.A.palette.red,highlightFillOpacity:.2,curveLeft:{visible:!0,withLabel:!1,color:n.A.palette.red,fillOpacity:.8,layer:9},baseLeft:{visible:!1,fixed:!1,withLabel:!1,name:""},curveRight:{visible:!0,withLabel:!1,color:n.A.palette.red,fillOpacity:.8,layer:9},baseRight:{visible:!1,fixed:!1,withLabel:!1,name:""},label:{fontSize:20,digits:4,intl:{enabled:!1,options:{}}}},input:{disabled:!1,maxlength:524288,display:"html"},intersection:{alwaysIntersect:!0},label:{visible:"inherit",clip:"inherit",strokeColor:"#000000",strokeOpacity:1,highlightStrokeOpacity:.666666,highlightStrokeColor:"#000000",fixed:!0,tabindex:null,position:"urt",distance:1.5,offset:[10,10],autoPosition:!1,autoPositionMinDistance:12,autoPositionMaxDistance:28,autoPositionWhitelist:[]},legend:{style:"vertical",labels:["1","2","3","4","5","6","7","8"],colors:["#B02B2C","#3F4C6B","#C79810","#D15600","#FFFF88","#c3d9ff","#4096EE","#008C00"],lineLength:1,strokeOpacity:[1],rowHeight:20,strokeWidth:5,frozen:!1},line:{firstArrow:!1,lastArrow:!1,margin:0,straightFirst:!0,straightLast:!0,fillColor:"none",highlightFillColor:"none",strokeColor:n.A.palette.blue,highlightStrokeColor:"#c3d9ff",withTicks:!1,point1:{fillColor:n.A.palette.red,strokeColor:n.A.palette.red,highlightFillColor:"#c3d9ff",highlightStrokeColor:"#c3d9ff",layer:9,visible:!1,withLabel:!1,fixed:!1,name:""},point2:{fillColor:n.A.palette.red,strokeColor:n.A.palette.red,highlightFillColor:"#c3d9ff",highlightStrokeColor:"#c3d9ff",layer:9,visible:!1,withLabel:!1,fixed:!1,name:""},ticks:{drawLabels:!0,label:{offset:[4,-9]},drawZero:!1,insertTicks:!1,ticksDistance:1,minTicksDistance:50,minorHeight:4,majorHeight:-1,minorTicks:4,strokeOpacity:.3,visible:"inherit"},label:{position:"llft"},snapToGrid:!1,snapSizeX:1,snapSizeY:1,touchFirstPoint:!1,touchLastPoint:!1,transitionProperties:[]},locus:{translateToOrigin:!1,translateTo10:!1,stretch:!1,toOrigin:null,to10:null},measurement:{baseUnit:"",units:{},showPrefix:!0,showSuffix:!0,prefix:"",suffix:"",dim:null,formatCoords:function(t,e,i,s){return 1!==parseFloat(s)?"Infinit coords":"("+e+", "+i+")"},formatDirection:function(t,e,i){return"("+e+", "+i+")"}},metapostspline:{createPoints:!0,isArrayOfCoordinates:!0,points:{strokeOpacity:.5,fillOpacity:.5,highlightStrokeOpacity:1,highlightFillOpacity:1,withLabel:!1,name:"",fixed:!1}},mirrorelement:{fixed:!0,point:{},center:{},type:"Euclidean"},nonreflexangle:{},normal:{strokeColor:"#000000",point:{visible:!1,fixed:!1,withLabel:!1,name:""}},orthogonalprojection:{},otherintersection:{alwaysIntersect:!0,precision:.001},parallel:{strokeColor:"#000000",point:{visible:!1,fixed:!1,withLabel:!1,name:""},label:{position:"llft"}},parallelogram:{parallelpoint:{withLabel:!1,name:""}},parallelpoint:{},perpendicular:{strokeColor:"#000000",straightFirst:!0,straightLast:!0},perpendicularsegment:{strokeColor:"#000000",straightFirst:!1,straightLast:!1,point:{visible:!1,fixed:!0,withLabel:!1,name:""}},point:{withLabel:!0,label:{},style:5,face:"o",size:3,sizeUnit:"screen",strokeWidth:2,transitionProperties:["fill","fill-opacity","stroke","stroke-opacity","stroke-width","width","height","rx","ry"],fillColor:n.A.palette.red,strokeColor:n.A.palette.red,highlightFillColor:"#c3d9ff",highlightStrokeColor:"#c3d9ff",zoom:!1,showInfobox:"inherit",infoboxDigits:"auto",attractors:[],attractorUnit:"user",attractorDistance:0,snatchDistance:0,snapToGrid:!1,attractToGrid:!1,snapSizeX:1,snapSizeY:1,snapToPoints:!1,ignoredSnapToPoints:[]},polygon:{hasInnerPoints:!1,fillColor:n.A.palette.yellow,highlightFillColor:n.A.palette.yellow,fillOpacity:.3,highlightFillOpacity:.2,withLines:!0,borders:{withLabel:!1,strokeWidth:1,highlightStrokeWidth:1,layer:5,label:{position:"top"},visible:"inherit"},highlightByStrokeWidth:!1,vertices:{layer:9,withLabel:!1,name:"",strokeColor:n.A.palette.red,fillColor:n.A.palette.red,fixed:!1,visible:"inherit"},label:{offset:[0,0]}},polygonalchain:{fillColor:"none",highlightFillColor:"none"},prescribedangle:{anglePoint:{size:2,visible:!1,withLabel:!1}},reflection:{fixed:!0,center:{},type:"Euclidean"},reflexangle:{},regularpolygon:{hasInnerPoints:!1,fillColor:n.A.palette.yellow,highlightFillColor:n.A.palette.yellow,fillOpacity:.3,highlightFillOpacity:.2,withLines:!0,borders:{withLabel:!1,strokeWidth:1,highlightStrokeWidth:1,layer:5,label:{position:"top"}},vertices:{layer:9,withLabel:!0,strokeColor:n.A.palette.red,fillColor:n.A.palette.red,fixed:!1},label:{offset:[0,0]}},riemannsum:{withLabel:!1,fillOpacity:.3,fillColor:n.A.palette.yellow},sector:{fillColor:n.A.palette.yellow,highlightFillColor:n.A.palette.yellow,fillOpacity:.3,highlightFillOpacity:.3,highlightOnSector:!1,highlightStrokeWidth:0,useDirection:!1,selection:"auto",orientation:"counterclockwise",arc:{visible:!1,fillColor:"none",withLabel:!1,name:"",orientation:"inherit",center:{visible:!1,withLabel:!1,name:""},radiusPoint:{visible:!1,withLabel:!1,name:""},anglePoint:{visible:!1,withLabel:!1,name:""}},radiusPoint:{name:"",visible:!1,withLabel:!1},center:{name:"",visible:!1,withLabel:!1},anglePoint:{name:"",visible:!1,withLabel:!1},label:{offset:[0,0],anchorX:"auto",anchorY:"auto"}},segment:{label:{position:"top"}},semicircle:{center:{visible:!1,withLabel:!1,fixed:!1,fillColor:n.A.palette.red,strokeColor:n.A.palette.red,highlightFillColor:"#eeeeee",highlightStrokeColor:n.A.palette.red,name:""},anglePoint:{name:""},radiusPoint:{name:""}},sketchcurve:{visible:!0,strokeColor:s.A.palette.red,highlight:!1,strokeWidth:1,lineCap:"round",deleteOnUp:!1,maxLength:null},slider:{snapWidth:-1,snapValues:[],snapValueDistance:0,precision:2,digits:2,intl:{enabled:"inherit",options:{}},firstArrow:!1,lastArrow:!1,withTicks:!0,withLabel:!0,suffixLabel:null,unitLabel:null,postLabel:null,layer:9,showInfobox:!1,name:"",visible:!0,strokeColor:"#000000",highlightStrokeColor:"#888888",fillColor:"#ffffff",highlightFillColor:"none",size:6,point1:{needsRegularUpdate:!1,showInfobox:!1,withLabel:!1,visible:!1,fixed:!0,frozen:"inherit",name:""},point2:{needsRegularUpdate:!1,showInfobox:!1,withLabel:!1,visible:!1,fixed:!0,frozen:"inherit",name:""},baseline:{needsRegularUpdate:!1,visible:"inherit",clip:"inherit",fixed:!0,scalable:!1,tabindex:null,name:"",strokeWidth:1,strokeColor:"#000000",highlightStrokeColor:"#888888"},ticks:{needsRegularUpdate:!1,fixed:!0,clip:"inherit",drawLabels:!1,digits:2,includeBoundaries:!0,drawZero:!0,label:{offset:[-4,-14],display:"internal"},minTicksDistance:30,insertTicks:!0,ticksDistance:1,minorHeight:4,majorHeight:5,minorTicks:0,strokeOpacity:1,strokeWidth:1,tickEndings:[0,1],majortickEndings:[0,1],strokeColor:"#000000",visible:"inherit"},highline:{strokeWidth:3,visible:"inherit",clip:"inherit",fixed:!0,tabindex:null,name:"",strokeColor:"#000000",highlightStrokeColor:"#888888"},label:{visible:"inherit",clip:"inherit",strokeColor:"#000000"},moveOnUp:!0},slopefield:{strokeWidth:.5,highlightStrokeWidth:.5,highlightStrokeColor:n.A.palette.blue,highlightStrokeOpacity:.8,scale:1,arrowhead:{enabled:!1,size:5,angle:.125*Math.PI}},slopetriangle:{fillColor:n.A.palette.red,fillOpacity:.4,highlightFillColor:n.A.palette.red,highlightFillOpacity:.3,borders:{lastArrow:{type:1,size:6}},glider:{fixed:!0,visible:!1,withLabel:!1},baseline:{visible:!1,withLabel:!1,name:""},basepoint:{visible:!1,withLabel:!1,name:""},tangent:{visible:!1,withLabel:!1,name:""},toppoint:{visible:!1,withLabel:!1,name:""},label:{visible:!0,position:"first",digits:function(t){return t.slopetriangle.evalVisProp("digits")},showPrefix:function(t){return t.slopetriangle.evalVisProp("showPrefix")},showSuffix:function(t){return t.slopetriangle.evalVisProp("showSuffix")},prefix:function(t){return t.slopetriangle.evalVisProp("prefix")},suffix:function(t){return t.slopetriangle.evalVisProp("suffix")}},digits:2,showPrefix:!0,showSuffix:!0,prefix:"",suffix:"",formatValue:null},smartlabel:{cssClass:"smart-label-solid",highlightCssClass:"smart-label-solid",unit:"",baseUnit:"",units:{},showPrefix:!0,showSuffix:!0,prefix:"",suffix:"",formatValue:null,measure:"",useMathJax:!0},smartlabelangle:{cssClass:"smart-label-solid smart-label-angle",highlightCssClass:"smart-label-solid smart-label-angle",anchorX:"left",anchorY:"middle"},smartlabelcircle:{cssClass:"smart-label-solid smart-label-circle",highlightCssClass:"smart-label-solid smart-label-circle",anchorX:"middle",measure:"radius",visibleThreshold:.6},smartlabelline:{cssClass:"smart-label-solid smart-label-line",highlightCssClass:"smart-label-solid smart-label-line",anchorX:"middle",measure:"length",orientation:"parallel",visibleThreshold:.7},smartlabelpoint:{cssClass:"smart-label-solid smart-label-point",highlightCssClass:"smart-label-solid smart-label-point",anchorX:"middle",anchorY:"top",measure:"coords",dir:"row"},smartlabelpolygon:{cssClass:"smart-label-solid smart-label-polygon",highlightCssClass:"smart-label-solid smart-label-polygon",anchorX:"middle",measure:"area"},stepfunction:{},tangent:{},tangentto:{polar:{visible:!1,strokeWidth:1,dash:3},point:{visible:!1}},tapemeasure:{strokeColor:"#000000",strokeWidth:2,highlightStrokeColor:"#000000",withTicks:!0,withLabel:!0,rotate:0,precision:2,digits:2,point1:{visible:!0,strokeColor:"#000000",fillColor:"#ffffff",fillOpacity:0,highlightFillOpacity:.1,size:6,snapToPoints:!0,attractorUnit:"screen",attractorDistance:20,showInfobox:!1,withLabel:!1,name:""},point2:{visible:!0,strokeColor:"#000000",fillColor:"#ffffff",fillOpacity:0,highlightFillOpacity:.1,size:6,snapToPoints:!0,attractorUnit:"screen",attractorDistance:20,showInfobox:!1,withLabel:!1,name:""},ticks:{drawLabels:!1,drawZero:!0,insertTicks:!0,ticksDistance:.1,minorHeight:8,majorHeight:16,minorTicks:4,tickEndings:[0,1],majorTickEndings:[0,1],strokeOpacity:1,strokeWidth:1,strokeColor:"#000000",visible:"inherit",label:{anchorY:"top",anchorX:"middle",offset:[0,-10]}},label:{position:"top"}},text:{fontSize:12,fontUnit:"px",formatNumber:!1,digits:2,intl:{enabled:"inherit",options:{minimumFractionDigits:0,maximumFractionDigits:2}},parse:!0,useCaja:!1,isLabel:!1,strokeColor:"#000000",highlightStrokeColor:"#000000",highlightStrokeOpacity:.666666,cssDefaultStyle:"font-family: Arial, Helvetica, Geneva, sans-serif;",highlightCssDefaultStyle:"font-family: Arial, Helvetica, Geneva, sans-serif;",cssStyle:"",highlightCssStyle:"",transitionProperties:["color","opacity"],useASCIIMathML:!1,useMathJax:!1,useKatex:!1,katexMacros:{},toFraction:!1,display:"html",anchor:null,anchorX:"left",anchorY:"middle",cssClass:"JXGtext",highlightCssClass:"JXGtext",dragArea:"all",withLabel:!1,rotate:0,visible:!0,snapSizeX:1,snapSizeY:1,attractors:[]},tracecurve:{strokeColor:"#000000",fillColor:"none",numberPoints:100},turtle:{strokeWidth:1,fillColor:"none",strokeColor:"#000000",arrow:{strokeWidth:2,withLabel:!1,strokeColor:n.A.palette.red,lastArrow:!0}},vectorfield:{strokeWidth:.5,highlightStrokeWidth:.5,highlightStrokeColor:n.A.palette.blue,highlightStrokeOpacity:.8,scale:1,arrowhead:{enabled:!0,size:5,angle:.125*Math.PI}},shortcuts:{color:["strokeColor","fillColor"],opacity:["strokeOpacity","fillOpacity"],highlightColor:["highlightStrokeColor","highlightFillColor"],highlightOpacity:["highlightStrokeOpacity","highlightFillOpacity"],strokeWidth:["strokeWidth","highlightStrokeWidth"]}},s.A.Validator=function(){var t,e=function(t){return a.A.isString(t)},i=function(t){return a.A.isNumber(t,!0,!1)},r=function(t){return Math.abs(t-Math.round(t))0},h=function(t){return t>0},l=function(t){return t>=0},c={},d={attractorDistance:l,color:e,display:function(t){return"html"===t||"internal"===t},doAdvancedPlot:!1,draft:!1,drawLabels:!1,drawZero:!1,face:function(t){return a.A.exists(s.A.normalizePointFace(t))},factor:i,fillColor:e,fillOpacity:i,firstArrow:!1,fontSize:r,dash:r,gridX:i,gridY:i,hasGrid:!1,highlightFillColor:e,highlightFillOpacity:i,highlightStrokeColor:e,highlightStrokeOpacity:i,insertTicks:!1,lastArrow:!1,layer:function(t){return r(t)&&t>=0},majorHeight:r,minorHeight:r,minorTicks:l,minTicksDistance:n,numberPointsHigh:n,numberPointsLow:n,opacity:i,radius:i,RDPsmoothing:!1,renderer:function(t){return"vml"===t||"svg"===t||"canvas"===t||"no"===t},right:function(t){return/^[0-9]+px$/.test(t)},showCopyright:!1,showInfobox:!1,showNavigation:!1,size:l,snapSizeX:h,snapSizeY:h,snapWidth:i,snapToGrid:!1,snatchDistance:l,straightFirst:!1,straightLast:!1,stretch:!1,strokeColor:e,strokeOpacity:i,strokeWidth:l,takeFirst:!1,takeSizeFromFile:!1,to10:!1,toOrigin:!1,translateTo10:!1,translateToOrigin:!1,useASCIIMathML:!1,useDirection:!1,useMathJax:!1,withLabel:!1,withTicks:!1,zoom:!1};for(t in d)d.hasOwnProperty(t)&&(c[t.toLowerCase()]=d[t]);return c}(),s.A.normalizePointFace=function(t){return{cross:"x",x:"x",circle:"o",o:"o",square:"[]","[]":"[]",plus:"+","+":"+",divide:"|","|":"|",minus:"-","-":"-",diamond:"<>","<>":"<>",diamond2:"<<>>","<<>>":"<<>>",triangleup:"^",A:"^",a:"^","^":"^",triangledown:"v",v:"v",triangleleft:"<","<":"<",triangleright:">",">":">"}[t]},s.A.useStandardOptions=function(t){var e,i,o,n,a=s.A.Options,h=t.hasGrid;for(e in t.options.grid.hasGrid=a.grid.hasGrid,t.options.grid.gridX=a.grid.gridX,t.options.grid.gridY=a.grid.gridY,t.options.grid.gridColor=a.grid.gridColor,t.options.grid.gridOpacity=a.grid.gridOpacity,t.options.grid.gridDash=a.grid.gridDash,t.options.grid.snapToGrid=a.grid.snapToGrid,t.options.grid.snapSizeX=a.grid.SnapSizeX,t.options.grid.snapSizeY=a.grid.SnapSizeY,t.takeSizeFromFile=a.takeSizeFromFile,n=function(t,e){t.visProp.fillcolor=e.fillColor,t.visProp.highlightfillcolor=e.highlightFillColor,t.visProp.strokecolor=e.strokeColor,t.visProp.highlightstrokecolor=e.highlightStrokeColor},t.objects)if(t.objects.hasOwnProperty(e))if((o=t.objects[e]).elementClass===r.A.OBJECT_CLASS_POINT)n(o,a.point);else if(o.elementClass===r.A.OBJECT_CLASS_LINE)for(n(o,a.line),i=0;i=0&&c=0&&e>0;)")"===(s=l.charAt(i))?e++:"("===s&&(e-=1),i-=1;if(0!==e)throw new Error("JSXGraph: Missing '(' in expression");for(o="",a=l.substring(0,i+1),h=i;h>=0&&a.slice(h,h+1).match(/([\w.]+)/);)o=RegExp.$1+o,h-=1;o=(o+=l.substring(i+1,l.length)).replace(/([()+*%^\-/\][])/g,"\\$1")}else o="[\\w\\.]+";if(d.match(/^([\w.]*\()/)){for(e=1,i=RegExp.$1.length;i0;)")"===(s=d.charAt(i))?e-=1:"("===s&&(e+=1),i+=1;if(0!==e)throw new Error("JSXGraph: Missing ')' in expression");n=(n=d.substring(0,i)).replace(/([()+*%^\-/[\]])/g,"\\$1")}else n="[\\w\\.]+";u=new RegExp("("+o+")\\^("+n+")"),c=(t=t.replace(u,"pow($1,$2)")).indexOf("^")}return t},replaceIf:function(t){var e,i,s,r,o,n,a,h,l,c="",d=null,u=null,p=null;if((s=t.indexOf("If("))<0)return t;for(t=t.replace(/""/g,"0");s>=0;){for(e=t.slice(0,s),i=t.slice(s+3),o=1,r=0,n=-1,a=-1;r0;)")"===(h=i.charAt(r))?o-=1:"("===h?o+=1:","===h&&1===o&&(n<0?n=r:a=r),r+=1;if(l=i.slice(0,r-1),i=i.slice(r),n<0)return"";if(a<0)return"";d=l.slice(0,n),u=l.slice(n+1,a),p=l.slice(a+1),c+=e+"(("+(d=this.replaceIf(d))+")?("+(u=this.replaceIf(u))+"):("+(p=this.replaceIf(p))+"))",d=null,u=null,s=(t=i).indexOf("If(")}return c+=i},replaceNameById:function(t,e,i){var s,r,o,n,a=0,h=["X","Y","L","V"],l=function(t){return i?"$('"+t+"')":t};for(n=0;n=0;)a>=0&&(s=t.indexOf(")",a+2))>=0&&(r=(r=t.slice(a+2,s)).replace(/\\(['"])?/g,"$1"),(o=e.elementsByName[r])&&(t=t.slice(0,a+2)+(i?"$('":"")+l(o.id)+t.slice(s))),s=t.indexOf(")",a+2),a=t.indexOf(h[n]+"(",s);for(a=t.indexOf("Dist(");a>=0;)a>=0&&(s=t.indexOf(",",a+5))>=0&&(r=(r=t.slice(a+5,s)).replace(/\\(['"])?/g,"$1"),(o=e.elementsByName[r])&&(t=t.slice(0,a+5)+l(o.id)+t.slice(s))),s=t.indexOf(",",a+5),a=t.indexOf(",",s),(s=t.indexOf(")",a+1))>=0&&(r=(r=t.slice(a+1,s)).replace(/\\(['"])?/g,"$1"),(o=e.elementsByName[r])&&(t=t.slice(0,a+1)+l(o.id)+t.slice(s))),s=t.indexOf(")",a+1),a=t.indexOf("Dist(",s);for(h=["Deg","Rad"],n=0;n=0;)a>=0&&(s=t.indexOf(",",a+4))>=0&&(r=(r=t.slice(a+4,s)).replace(/\\(['"])?/g,"$1"),(o=e.elementsByName[r])&&(t=t.slice(0,a+4)+l(o.id)+t.slice(s))),s=t.indexOf(",",a+4),a=t.indexOf(",",s),(s=t.indexOf(",",a+1))>=0&&(r=(r=t.slice(a+1,s)).replace(/\\(['"])?/g,"$1"),(o=e.elementsByName[r])&&(t=t.slice(0,a+1)+l(o.id)+t.slice(s))),s=t.indexOf(",",a+1),a=t.indexOf(",",s),(s=t.indexOf(")",a+1))>=0&&(r=(r=t.slice(a+1,s)).replace(/\\(['"])?/g,"$1"),(o=e.elementsByName[r])&&(t=t.slice(0,a+1)+l(o.id)+t.slice(s))),s=t.indexOf(")",a+1),a=t.indexOf(h[n]+"(",s);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,s,r,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=t=(t=(t=t.replace(/</g,"<")).replace(/>/g,">")).replace(/&/g,"&"),s=this.replaceNameById(s,e),s=this.replaceIf(s),s=this.replacePow(s),s=this.replaceIdByObj(s),r=0;r=0&&s[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")}},e.A=s.A.GeonextParser},428:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){"use strict";var _jxg_js__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(443),_base_constants_js__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(561),_base_text_js__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(925),_math_math_js__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(477),_math_ia_js__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(733),_math_geometry_js__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(571),_math_statistics_js__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(588),_utils_type_js__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__(188),_utils_env_js__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__(133);Object.create||(Object.create=function(t,e){if("object"!=typeof t&&"function"!=typeof t)throw new TypeError("Object prototype may only be an Object: "+t);if(null===t)throw new 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 new 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}},r,_ccache;_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)),_jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.CAS&&(this.CAS=new _jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.CAS(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 s,r=this.node(t,e,[]);for(s=2;s-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]},getvar:function(t,e,i){var s;if(e=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.def(e,!1),null!==(s=this.isLocalVariable(t)))return s.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)}return e||(s=this.board.select(t))===t?void 0:s},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 s,r="";return 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!==this.isParameter(t)?t:null===this.isLocalVariable(t)||i?this.isCreator(t)?"(function () { var a = Array.prototype.slice.call(arguments, 0), props = "+(i?"a.pop()":"{}")+"; return $jc$.board.create.apply($jc$.board, ['"+t+"'].concat([a, props])); })":(i&&this._error("Syntax error (attribute values are allowed with element creators only)"),this.isBuiltIn(t)?(r=this.builtIn[t].src||this.builtIn[t],_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isNumber(r)||r.match(/board\.select/)?r:(t=r.split(".").pop(),_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(this.board.mathLib)&&null!==(s=new RegExp("^Math."+t)).exec(r)?r.replace(s,"$jc$.board.mathLib."+t):_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(this.board.mathLibJXG)&&null!==(s=new RegExp("^JXG.Math.")).exec(r)?r.replace(s,"$jc$.board.mathLibJXG."):r)):this.isMathMethod(t)?"$jc$.board.mathLib."+t:e?"":(_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isId(this.board,t)?(r="$jc$.board.objects['"+t+"']","slider"===this.board.objects[t].elType&&(r+=".Value()")):_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isName(this.board,t)?(r="$jc$.board.elementsByName['"+t+"']","slider"===this.board.elementsByName[t].elType&&(r+=".Value()")):_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isGroup(this.board,t)&&(r="$jc$.board.groups['"+t+"']"),r)):"$jc$.resolve('"+t+"')"},makeMap:function(t){return t.isMap=!0,t},functionCodeJS:function(t){var e=t.children[0].join(", "),i="",s="";return"op_map"===t.value&&(i="{ return ",s=" }"),"function ("+e+") {\nvar $oldscope$ = $jc$.scope;\n$jc$.scope = $jc$.scopes["+this.scope.id+"];\nvar r = (function () "+i+this.compile(t.children[1],!0)+s+")();\n$jc$.scope = $oldscope$;\nreturn r;\n}"},defineFunction:function(node){var fun,i,that=this,list=node.children[0],scope=this.pushScope(list),_that;if(this.board.options.jc.compile){for(this.isLHS=!1,i=0;i0;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,s,r=!1;if(void 0!==e&&(r=e),s=t.value,"node_op"===t.type&&"op_lhs"===s&&1===t.children.length?this.isLHS=!0:"node_var"===t.type&&(this.isLHS?this.letvar(s,!0):!_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(this.getvar(s,!0))&&_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(this.board.elementsByName[s])&&(r&&"slider"!==this.board.elementsByName[s].elType&&(r=!1),t=this.createReplacementNode(t,r))),_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isArray(t))for(i=0;i0;i--)_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(t.children[i-1])&&(t.children[i-1]=this.replaceNames(t.children[i-1],r));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,s=this.board.elementsByName[i];return(t=this.createNode("node_op","op_execfun",this.createNode("node_var",!0===e?"$value":"$"),[this.createNode("node_str",s.id)])).replaced=!0,t},collectDependencies:function(t,e,i){var s,r,o,n;if(_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isArray(t))for(n=t.length,s=0;s1&&("$"===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(s=t.children.length;s>0;s--)_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(t.children[s-1])&&this.collectDependencies(t.children[s-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,s;if(_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isArray(e))for(i=0;ithis.execute(t.children[1]);break;case"op_lt":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,i){var s=this;function r(t){switch(t.type){case"node_const":case"node_const_bool":case"node_str":case"node_var":return 10;case"node_op":switch(t.value){case"op_none":default:return 0;case"op_assign":return 1;case"op_map":case"op_function":case"op_return":return 2;case"op_add":case"op_sub":return 3;case"op_mul":case"op_div":case"op_mod":return 5;case"op_neg":return 4;case"op_exp":return 6;case"op_array":case"op_execfun":return 7}default:return 0}}return _utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(e)||(e=!1),_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.exists(i)&&_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isObject(i)||(i={}),i=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.deepCopy({minParentheses:!1,constToFixed:!1,printable:!1},i),function t(o,n,a=-1){var h,l,c,d,u,p,f="";if(!o)return f;switch(o.type){case"node_op":switch(o.value){case"op_none":o.children[0]&&(f=t(o.children[0],"op_none")),o.children[1]&&(f+=t(o.children[1],"op_none"));break;case"op_block":f="{\n"+t(o.children[0],"op_block")+" }\n";break;case"op_assign":e?(h=s.getLHSCompiler(o.children[0],e),_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isArray(h)?f="$jc$.setProp("+h[0]+", "+h[1]+", "+t(o.children[1],"op_assign")+");\n":(s.isLocalVariable(h)!==s.scope&&(s.scope.locals[h]=!0),f="$jc$.scopes["+s.scope.id+"].locals['"+h+"'] = "+t(o.children[1],"op_assign")+";\n")):f=(h=t(o.children[0],"op_assign"))+" = "+t(o.children[1],"op_assign")+";\n";break;case"op_if":f=" if ("+t(o.children[0],"op_if")+") "+t(o.children[1],"op_if");break;case"op_if_else":f=" if ("+t(o.children[0],"op_if_else")+")"+t(o.children[1],"op_if_else"),f+=" else "+t(o.children[2],"op_if_else");break;case"op_conditional":f="(("+t(o.children[0],"op_conditional")+")?("+t(o.children[1],"op_conditional"),f+="):("+t(o.children[2],"op_conditional")+"))";break;case"op_while":f=" while ("+t(o.children[0],"op_while")+") {\n"+t(o.children[1],"op_while")+"}\n";break;case"op_do":f=" do {\n"+t(o.children[0],"op_do")+"} while ("+t(o.children[1],"op_do")+");\n";break;case"op_for":f=" for ("+t(o.children[0],"op_for")+t(o.children[1],"op_for")+"; "+t(o.children[2],"op_for").slice(0,-2)+") {\n"+t(o.children[3],"op_for")+"\n}\n";break;case"op_proplst":o.children[0]&&(f=t(o.children[0],"op_proplst")+", "),f+=t(o.children[1],"op_proplst");break;case"op_prop":f=o.children[0]+": "+t(o.children[1],"op_prop");break;case"op_emptyobject":f=e?"{}":"<< >>";break;case"op_proplst_val":f=t(o.children[0],"op_proplst_val");break;case"op_array":for(d=[],l=0;l "+t(o.children[1],"op_map");break;case"op_function":d=o.children[0],s.pushScope(d),f=e?s.functionCodeJS(o):" function ("+d.join(", ")+") "+t(o.children[1],"op_function"),s.popScope();break;case"op_execfunmath":console.log("op_execfunmath: TODO"),f="-1";break;case"op_execfun":if(o.children[2]){for(d=[],l=0;l "+t(o.children[1],"op_gt")+")";break;case"op_lt":f=e?"$jc$.lt("+t(o.children[0],"op_lt")+", "+t(o.children[1],"op_lt")+")":"("+t(o.children[0],"op_lt")+" < "+t(o.children[1],"op_lt")+")";break;case"op_geq":f=e?"$jc$.geq("+t(o.children[0],"op_geq")+", "+t(o.children[1],"op_geq")+")":"("+t(o.children[0],"op_geq")+" >= "+t(o.children[1],"op_geq")+")";break;case"op_leq":f=e?"$jc$.leq("+t(o.children[0],"op_leq")+", "+t(o.children[1],"op_leq")+")":"("+t(o.children[0],"op_leq")+" <= "+t(o.children[1],"op_leq")+")";break;case"op_or":f="("+t(o.children[0],"op_or")+" || "+t(o.children[1],"op_or")+")";break;case"op_and":f="("+t(o.children[0],"op_and")+" && "+t(o.children[1],"op_and")+")";break;case"op_not":f="!("+t(o.children[0],"op_not")+")";break;case"op_add":e?f="$jc$.add("+t(o.children[0],"op_add")+", "+t(o.children[1],"op_add")+")":i.minParentheses?(u=r(o),h=t(o.children[0],"op_add"),f=u>(p=r(o.children[0]))?"("+h+")":h,f+=" + ",h=t(o.children[1],"op_add"),f+=u>(p=r(o.children[1]))?"("+h+")":h):f="("+t(o.children[0],"op_add")+" + "+t(o.children[1],"op_add")+")";break;case"op_sub":e?f="$jc$.sub("+t(o.children[0],"op_sub")+", "+t(o.children[1],"op_sub")+")":i.minParentheses?(u=r(o),h=t(o.children[0],"op_sub"),f=u>(p=r(o.children[0]))?"("+h+")":h,f+=" - ",h=t(o.children[1],"op_sub"),f+=u>=(p=r(o.children[1]))?"("+h+")":h):f="("+t(o.children[0],"op_sub")+" - "+t(o.children[1],"op_sub")+")";break;case"op_div":e?f="$jc$.div("+t(o.children[0],"op_div")+", "+t(o.children[1],"op_div")+")":i.minParentheses?(u=r(o),h=t(o.children[0],"op_div"),f=u>(p=r(o.children[0]))?"("+h+")":h,f+=" / ",h=t(o.children[1],"op_div"),f+=u>=(p=r(o.children[1]))?"("+h+")":h):f="("+t(o.children[0],"op_div")+" / "+t(o.children[1],"op_div")+")";break;case"op_mod":e?f="$jc$.mod("+t(o.children[0],"op_mod")+", "+t(o.children[1],"op_mod")+", true)":i.minParentheses?(u=r(o),h=t(o.children[0],"op_mod"),f=u>(p=r(o.children[0]))?"("+h+")":h,f+=" % ",h=t(o.children[1],"op_mod"),f+=u>=(p=r(o.children[1]))?"("+h+")":h):f="("+t(o.children[0],"op_mod")+" % "+t(o.children[1],"op_mod")+")";break;case"op_mul":e?f="$jc$.mul("+t(o.children[0],"op_mul")+", "+t(o.children[1],"op_mul")+")":i.minParentheses?(u=r(o),h=t(o.children[0],"op_mul"),f=u>(p=r(o.children[0]))?"("+h+")":h,f+=" * ",h=t(o.children[1],"op_mul"),f+=u>(p=r(o.children[1]))?"("+h+")":h):f="("+t(o.children[0],"op_mul")+" * "+t(o.children[1],"op_mul")+")";break;case"op_exp":e?f="$jc$.pow("+t(o.children[0],"op_exp",0)+", "+t(o.children[1],"op_exp",1)+")":i.minParentheses?(u=r(o),h=t(o.children[0],"op_exp",0),f=u>=(p=r(o.children[0]))?"("+h+")":h,f+="^",h=t(o.children[1],"op_exp",1),f+=u>(p=r(o.children[1]))&&(!i.printable||"{"!==h[0]||"}"!==h[h.length-1])?"("+h+")":h):f="("+t(o.children[0],"op_exp",0)+"^"+t(o.children[1],"op_exp",1)+")";break;case"op_neg":e?f="$jc$.neg("+t(o.children[0],"op_neg")+")":i.minParentheses?(u=r(o),p=r(o.children[0]),h=t(o.children[0],"op_neg"),f=u>=p?"-("+h+")":"-"+h):f="(-"+t(o.children[0],"op_neg")+")"}break;case"node_var":f=e?s.getvarJS(o.value,!1,o.withProps):o.value;break;case"node_const":if(e){f=o.value;break}c=o.value,!1===i.constToFixed||!_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isNumber(c)||"op_exp"===n&&1===a||(c=parseFloat(c),c=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isNumber(i.constToFixed)?_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.toFixed(c,i.constToFixed):_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isFunction(i.constToFixed)?i.constToFixed(c):o.value),f=i.minParentheses&&parseFloat(c)<0&&"op_execfun"!==n&&0!==a?"("+c+")":c;break;case"node_const_bool":f=o.value;break;case"node_str":f="'"+o.value+"'"}return o.needsAngleBrackets&&(f=e?"{\n"+f+" }\n":"<< "+f+" >>\n"),i.printable&&"op_exp"===n&&1===a&&(f="{"+f+"}"),i.printable&&_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.isString(f)&&(f=f.replaceAll("\n","")),f}(t,"")},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 calculate 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,s,r;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))r=_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(s=Math.min(t.length,e.length),r=[],i=0;ie},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},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,s=!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],s=!0;break}}else i=t,s=!0;s?(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,s;for(s=-1===(e=_utils_type_js__WEBPACK_IMPORTED_MODULE_7__.A.def(e,-1))?this.scope:this.scopes[e];null!==s;){for(i in s.locals)if(s.locals.hasOwnProperty(i)&&s.locals[i]===t)return[i,s];s=s.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.asinh.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,s,r,o,n,a,h,l,c,d,u,p,f=["E"],A=this.builtIn||this.defineBuiltIn(),_=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=_[t]}if(!(f.indexOf(t)>=0))return _jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.isFunction(i)?{name:t,type:"function",numParams:i.length,origin:e}:_jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.isNumber(i)?{name:t,type:"constant",value:i,origin:e}:void(t.startsWith("$")||void 0!==i&&console.error("undefined type",i))},t=Object.getOwnPropertyNames(A).sort(u),e=Object.getOwnPropertyNames(_).sort(u),i=[],s=0,r=0;s":46,"<=":47,">=":48,MultiplicativeExpression:49,"+":50,"-":51,UnaryExpression:52,"*":53,"/":54,"%":55,ExponentExpression:56,"^":57,"!":58,MemberExpression: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,s,r,o,n,a,h){var l=a.length-1;switch(n){case 1:return a[l-1];case 2:this.$=e.createNode(i(h[l-4]),"node_op","op_if",a[l-2],a[l]);break;case 3:this.$=e.createNode(i(h[l-6]),"node_op","op_if_else",a[l-4],a[l-2],a[l]);break;case 4:this.$=e.createNode(i(h[l-4]),"node_op","op_while",a[l-2],a[l]);break;case 5:this.$=e.createNode(i(h[l-8]),"node_op","op_for",a[l-6],a[l-4],a[l-2],a[l]);break;case 6:this.$=e.createNode(i(h[l-6]),"node_op","op_do",a[l-5],a[l-2]);break;case 7:this.$=e.createNode(i(h[l-1]),"node_op","op_use",a[l]);break;case 8:this.$=e.createNode(i(h[l-1]),"node_op","op_delete",a[l]);break;case 9:this.$=e.createNode(i(h[l-1]),"node_op","op_return",void 0);break;case 10:this.$=e.createNode(i(h[l-2]),"node_op","op_return",a[l-1]);break;case 11:case 14:this.$=e.createNode(i(h[l]),"node_op","op_none");break;case 12:this.$=e.createNode(i(h[l-2]),"node_op","op_block",a[l-1]);break;case 13:this.$=e.createNode(i(h[l-1]),"node_op","op_none",a[l-1],a[l]);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.$=a[l];break;case 22:case 65:case 93:this.$=a[l-1];break;case 25:this.$=e.createNode(i(h[l-2]),"node_op","op_assign",a[l-2],a[l]),this.$.isMath=!1;break;case 27:this.$=e.createNode(i(h[l-4]),"node_op","op_conditional",a[l-4],a[l-2],a[l]),this.$.isMath=!1;break;case 29:this.$=e.createNode(i(h[l-2]),"node_op","op_or",a[l-2],a[l]),this.$.isMath=!1;break;case 31:this.$=e.createNode(i(h[l-2]),"node_op","op_and",a[l-2],a[l]),this.$.isMath=!1;break;case 33:this.$=e.createNode(i(h[l-2]),"node_op","op_eq",a[l-2],a[l]),this.$.isMath=!1;break;case 34:this.$=e.createNode(i(h[l-2]),"node_op","op_neq",a[l-2],a[l]),this.$.isMath=!1;break;case 35:this.$=e.createNode(i(h[l-2]),"node_op","op_approx",a[l-2],a[l]),this.$.isMath=!1;break;case 37:this.$=e.createNode(i(h[l-2]),"node_op","op_lt",a[l-2],a[l]),this.$.isMath=!1;break;case 38:this.$=e.createNode(i(h[l-2]),"node_op","op_gt",a[l-2],a[l]),this.$.isMath=!1;break;case 39:this.$=e.createNode(i(h[l-2]),"node_op","op_leq",a[l-2],a[l]),this.$.isMath=!1;break;case 40:this.$=e.createNode(i(h[l-2]),"node_op","op_geq",a[l-2],a[l]),this.$.isMath=!1;break;case 42:this.$=e.createNode(i(h[l-2]),"node_op","op_add",a[l-2],a[l]),this.$.isMath=!0;break;case 43:this.$=e.createNode(i(h[l-2]),"node_op","op_sub",a[l-2],a[l]),this.$.isMath=!0;break;case 45:this.$=e.createNode(i(h[l-2]),"node_op","op_mul",a[l-2],a[l]),this.$.isMath=!0;break;case 46:this.$=e.createNode(i(h[l-2]),"node_op","op_div",a[l-2],a[l]),this.$.isMath=!0;break;case 47:this.$=e.createNode(i(h[l-2]),"node_op","op_mod",a[l-2],a[l]),this.$.isMath=!0;break;case 49:this.$=e.createNode(i(h[l-2]),"node_op","op_exp",a[l-2],a[l]),this.$.isMath=!0;break;case 51:this.$=e.createNode(i(h[l-1]),"node_op","op_not",a[l]),this.$.isMath=!1;break;case 53:this.$=e.createNode(i(h[l-1]),"node_op","op_neg",a[l]),this.$.isMath=!0;break;case 57:case 63:case 64:case 66:case 67:case 68:case 97:this.$=a[l],this.$.isMath=!1;break;case 59:case 91:this.$=e.createNode(i(h[l-2]),"node_op","op_property",a[l-2],a[l]),this.$.isMath=!0;break;case 60:case 90:this.$=e.createNode(i(h[l-3]),"node_op","op_extvalue",a[l-3],a[l-1]),this.$.isMath=!0;break;case 61:this.$=e.createNode(i(h[l]),"node_var",a[l]);break;case 69:this.$=a[l],this.$.isMath=!0;break;case 70:this.$=e.createNode(i(h[l]),"node_const",null);break;case 71:this.$=e.createNode(i(h[l]),"node_const_bool",!0);break;case 72:this.$=e.createNode(i(h[l]),"node_const_bool",!1);break;case 73:this.$=e.createNode(i(h[l]),"node_str",a[l].substring(1,a[l].length-1));break;case 74:this.$=e.createNode(i(h[l]),"node_const",parseFloat(a[l]));break;case 75:this.$=e.createNode(i(h[l]),"node_const",NaN);break;case 76:this.$=e.createNode(i(h[l]),"node_const",1/0);break;case 77:this.$=e.createNode(i(h[l-1]),"node_op","op_array",[]);break;case 78:this.$=e.createNode(i(h[l-2]),"node_op","op_array",a[l-1]);break;case 79:this.$=e.createNode(i(h[l-1]),"node_op","op_emptyobject",{}),this.$.needsAngleBrackets=!0;break;case 80:this.$=e.createNode(i(h[l-2]),"node_op","op_proplst_val",a[l-1]),this.$.needsAngleBrackets=!0;break;case 82:this.$=e.createNode(i(h[l-2]),"node_op","op_proplst",a[l-2],a[l]);break;case 83:this.$=e.createNode(i(h[l-2]),"node_op","op_prop",a[l-2],a[l]);break;case 87:case 89:this.$=e.createNode(i(h[l-1]),"node_op","op_execfun",a[l-1],a[l]),this.$.isMath=!0;break;case 88:this.$=e.createNode(i(h[l-2]),"node_op","op_execfun",a[l-2],a[l-1],a[l],!0),this.$.isMath=!1;break;case 92:this.$=[];break;case 94:case 98:case 104:this.$=[a[l]];break;case 95:case 99:case 105:this.$=a[l-2].concat(a[l]);break;case 96:this.$=e.createNode(i(h[l]),"node_var",a[l]),this.$.isMath=!0;break;case 100:this.$=e.createNode(i(h[l-3]),"node_op","op_function",[],a[l]),this.$.isMath=!1;break;case 101:this.$=e.createNode(i(h[l-4]),"node_op","op_function",a[l-2],a[l]),this.$.isMath=!1;break;case 102:this.$=e.createNode(i(h[l-4]),"node_op","op_map",[],a[l]);break;case 103:this.$=e.createNode(i(h[l-5]),"node_op","op_map",a[l-3],a[l])}},table:[{3:1,4:2,5:[2,14],7:[2,14],8:[2,14],14:[2,14],15:[2,14],16:[2,14],17:[2,14],19:[2,14],20:[2,14],21:[2,14],23:[2,14],26:[2,14],50:[2,14],51:[2,14],58:[2,14],65:[2,14],74:[2,14],75:[2,14],76:[2,14],77:[2,14],78:[2,14],79:[2,14],80:[2,14],82:[2,14],91:[2,14],93:[2,14]},{1:[3]},{5:[1,3],6:6,7:[1,13],8:[1,37],9:20,11:4,13:7,14:[1,14],15:[1,15],16:[1,21],17:[1,16],18:8,19:[1,17],20:[1,33],21:[1,18],22:9,23:[1,19],24:11,25:5,26:[1,12],28:10,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{1:[2,1]},{5:[2,13],7:[2,13],8:[2,13],14:[2,13],15:[2,13],16:[2,13],17:[2,13],19:[2,13],20:[2,13],21:[2,13],23:[2,13],26:[2,13],27:[2,13],50:[2,13],51:[2,13],58:[2,13],65:[2,13],74:[2,13],75:[2,13],76:[2,13],77:[2,13],78:[2,13],79:[2,13],80:[2,13],82:[2,13],91:[2,13],93:[2,13]},{5:[2,15],7:[2,15],8:[2,15],12:[2,15],14:[2,15],15:[2,15],16:[2,15],17:[2,15],19:[2,15],20:[2,15],21:[2,15],23:[2,15],26:[2,15],27:[2,15],50:[2,15],51:[2,15],58:[2,15],65:[2,15],74:[2,15],75:[2,15],76:[2,15],77:[2,15],78:[2,15],79:[2,15],80:[2,15],82:[2,15],91:[2,15],93:[2,15]},{5:[2,16],7:[2,16],8:[2,16],12:[2,16],14:[2,16],15:[2,16],16:[2,16],17:[2,16],19:[2,16],20:[2,16],21:[2,16],23:[2,16],26:[2,16],27:[2,16],50:[2,16],51:[2,16],58:[2,16],65:[2,16],74:[2,16],75:[2,16],76:[2,16],77:[2,16],78:[2,16],79:[2,16],80:[2,16],82:[2,16],91:[2,16],93:[2,16]},{5:[2,17],7:[2,17],8:[2,17],12:[2,17],14:[2,17],15:[2,17],16:[2,17],17:[2,17],19:[2,17],20:[2,17],21:[2,17],23:[2,17],26:[2,17],27:[2,17],50:[2,17],51:[2,17],58:[2,17],65:[2,17],74:[2,17],75:[2,17],76:[2,17],77:[2,17],78:[2,17],79:[2,17],80:[2,17],82:[2,17],91:[2,17],93:[2,17]},{5:[2,18],7:[2,18],8:[2,18],12:[2,18],14:[2,18],15:[2,18],16:[2,18],17:[2,18],19:[2,18],20:[2,18],21:[2,18],23:[2,18],26:[2,18],27:[2,18],50:[2,18],51:[2,18],58:[2,18],65:[2,18],74:[2,18],75:[2,18],76:[2,18],77:[2,18],78:[2,18],79:[2,18],80:[2,18],82:[2,18],91:[2,18],93:[2,18]},{5:[2,19],7:[2,19],8:[2,19],12:[2,19],14:[2,19],15:[2,19],16:[2,19],17:[2,19],19:[2,19],20:[2,19],21:[2,19],23:[2,19],26:[2,19],27:[2,19],50:[2,19],51:[2,19],58:[2,19],65:[2,19],74:[2,19],75:[2,19],76:[2,19],77:[2,19],78:[2,19],79:[2,19],80:[2,19],82:[2,19],91:[2,19],93:[2,19]},{5:[2,20],7:[2,20],8:[2,20],12:[2,20],14:[2,20],15:[2,20],16:[2,20],17:[2,20],19:[2,20],20:[2,20],21:[2,20],23:[2,20],26:[2,20],27:[2,20],50:[2,20],51:[2,20],58:[2,20],65:[2,20],74:[2,20],75:[2,20],76:[2,20],77:[2,20],78:[2,20],79:[2,20],80:[2,20],82:[2,20],91:[2,20],93:[2,20]},{5:[2,21],7:[2,21],8:[2,21],12:[2,21],14:[2,21],15:[2,21],16:[2,21],17:[2,21],19:[2,21],20:[2,21],21:[2,21],23:[2,21],26:[2,21],27:[2,21],50:[2,21],51:[2,21],58:[2,21],65:[2,21],74:[2,21],75:[2,21],76:[2,21],77:[2,21],78:[2,21],79:[2,21],80:[2,21],82:[2,21],91:[2,21],93:[2,21]},{4:61,7:[2,14],8:[2,14],14:[2,14],15:[2,14],16:[2,14],17:[2,14],19:[2,14],20:[2,14],21:[2,14],23:[2,14],26:[2,14],27:[2,14],50:[2,14],51:[2,14],58:[2,14],65:[2,14],74:[2,14],75:[2,14],76:[2,14],77:[2,14],78:[2,14],79:[2,14],80:[2,14],82:[2,14],91:[2,14],93:[2,14]},{8:[1,62]},{8:[1,63]},{8:[1,64]},{6:6,7:[1,13],8:[1,37],9:20,11:65,13:7,14:[1,14],15:[1,15],16:[1,21],17:[1,16],18:8,19:[1,17],20:[1,33],21:[1,18],22:9,23:[1,19],24:11,25:5,26:[1,12],28:10,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{20:[1,66]},{20:[1,67]},{8:[1,37],9:69,16:[1,68],20:[1,33],29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{16:[1,70]},{5:[2,11],7:[2,11],8:[2,11],12:[2,11],14:[2,11],15:[2,11],16:[2,11],17:[2,11],19:[2,11],20:[2,11],21:[2,11],23:[2,11],26:[2,11],27:[2,11],50:[2,11],51:[2,11],58:[2,11],65:[2,11],74:[2,11],75:[2,11],76:[2,11],77:[2,11],78:[2,11],79:[2,11],80:[2,11],82:[2,11],91:[2,11],93:[2,11]},{8:[2,23],10:[2,23],16:[2,23],32:[2,23],34:[2,23],35:[2,23],37:[2,23],39:[2,23],41:[2,23],42:[2,23],43:[2,23],45:[2,23],46:[2,23],47:[2,23],48:[2,23],50:[2,23],51:[2,23],53:[2,23],54:[2,23],55:[2,23],57:[2,23],64:[2,23],65:[2,23],66:[2,23],83:[2,23],86:[2,23]},{8:[2,24],10:[2,24],16:[2,24],32:[2,24],34:[2,24],35:[2,24],37:[2,24],39:[2,24],41:[2,24],42:[2,24],43:[2,24],45:[2,24],46:[2,24],47:[2,24],48:[2,24],50:[2,24],51:[2,24],53:[2,24],54:[2,24],55:[2,24],57:[2,24],64:[2,24],65:[2,24],66:[2,24],83:[2,24],86:[2,24]},{8:[2,48],10:[2,48],16:[2,48],32:[1,71],34:[2,48],35:[2,48],37:[2,48],39:[2,48],41:[2,48],42:[2,48],43:[2,48],45:[2,48],46:[2,48],47:[2,48],48:[2,48],50:[2,48],51:[2,48],53:[2,48],54:[2,48],55:[2,48],57:[1,72],64:[2,48],65:[2,48],66:[2,48],83:[2,48],86:[2,48]},{8:[2,26],10:[2,26],16:[2,26],32:[2,26],34:[1,73],35:[2,26],37:[1,74],39:[2,26],41:[2,26],42:[2,26],43:[2,26],45:[2,26],46:[2,26],47:[2,26],48:[2,26],50:[2,26],51:[2,26],53:[2,26],54:[2,26],55:[2,26],57:[2,26],64:[2,26],65:[2,26],66:[2,26],83:[2,26],86:[2,26]},{8:[1,78],10:[2,54],16:[2,54],32:[2,54],34:[2,54],35:[2,54],37:[2,54],39:[2,54],41:[2,54],42:[2,54],43:[2,54],45:[2,54],46:[2,54],47:[2,54],48:[2,54],50:[2,54],51:[2,54],53:[2,54],54:[2,54],55:[2,54],57:[2,54],64:[1,75],65:[1,76],66:[2,54],83:[2,54],86:[2,54],88:77},{8:[1,78],10:[2,55],16:[2,55],32:[2,55],34:[2,55],35:[2,55],37:[2,55],39:[2,55],41:[2,55],42:[2,55],43:[2,55],45:[2,55],46:[2,55],47:[2,55],48:[2,55],50:[2,55],51:[2,55],53:[2,55],54:[2,55],55:[2,55],57:[2,55],64:[1,81],65:[1,80],66:[2,55],83:[2,55],86:[2,55],88:79},{8:[2,28],10:[2,28],16:[2,28],32:[2,28],34:[2,28],35:[2,28],37:[2,28],39:[1,82],41:[2,28],42:[2,28],43:[2,28],45:[2,28],46:[2,28],47:[2,28],48:[2,28],50:[2,28],51:[2,28],53:[2,28],54:[2,28],55:[2,28],57:[2,28],64:[2,28],65:[2,28],66:[2,28],83:[2,28],86:[2,28]},{8:[2,56],10:[2,56],16:[2,56],32:[2,56],34:[2,56],35:[2,56],37:[2,56],39:[2,56],41:[2,56],42:[2,56],43:[2,56],45:[2,56],46:[2,56],47:[2,56],48:[2,56],50:[2,56],51:[2,56],53:[2,56],54:[2,56],55:[2,56],57:[2,56],64:[2,56],65:[2,56],66:[2,56],83:[2,56],86:[2,56]},{8:[2,57],10:[2,57],16:[2,57],32:[2,57],34:[2,57],35:[2,57],37:[2,57],39:[2,57],41:[2,57],42:[2,57],43:[2,57],45:[2,57],46:[2,57],47:[2,57],48:[2,57],50:[2,57],51:[2,57],53:[2,57],54:[2,57],55:[2,57],57:[2,57],64:[2,57],65:[2,57],66:[2,57],83:[2,57],86:[2,57]},{8:[2,58],10:[2,58],16:[2,58],32:[2,58],34:[2,58],35:[2,58],37:[2,58],39:[2,58],41:[2,58],42:[2,58],43:[2,58],45:[2,58],46:[2,58],47:[2,58],48:[2,58],50:[2,58],51:[2,58],53:[2,58],54:[2,58],55:[2,58],57:[2,58],64:[2,58],65:[2,58],66:[2,58],83:[2,58],86:[2,58]},{8:[2,30],10:[2,30],16:[2,30],32:[2,30],34:[2,30],35:[2,30],37:[2,30],39:[2,30],41:[1,83],42:[1,84],43:[1,85],45:[2,30],46:[2,30],47:[2,30],48:[2,30],50:[2,30],51:[2,30],53:[2,30],54:[2,30],55:[2,30],57:[2,30],64:[2,30],65:[2,30],66:[2,30],83:[2,30],86:[2,30]},{8:[2,61],10:[2,61],16:[2,61],32:[2,61],34:[2,61],35:[2,61],37:[2,61],39:[2,61],41:[2,61],42:[2,61],43:[2,61],45:[2,61],46:[2,61],47:[2,61],48:[2,61],50:[2,61],51:[2,61],53:[2,61],54:[2,61],55:[2,61],57:[2,61],64:[2,61],65:[2,61],66:[2,61],83:[2,61],86:[2,61]},{8:[2,62],10:[2,62],16:[2,62],32:[2,62],34:[2,62],35:[2,62],37:[2,62],39:[2,62],41:[2,62],42:[2,62],43:[2,62],45:[2,62],46:[2,62],47:[2,62],48:[2,62],50:[2,62],51:[2,62],53:[2,62],54:[2,62],55:[2,62],57:[2,62],64:[2,62],65:[2,62],66:[2,62],83:[2,62],86:[2,62]},{8:[2,63],10:[2,63],16:[2,63],32:[2,63],34:[2,63],35:[2,63],37:[2,63],39:[2,63],41:[2,63],42:[2,63],43:[2,63],45:[2,63],46:[2,63],47:[2,63],48:[2,63],50:[2,63],51:[2,63],53:[2,63],54:[2,63],55:[2,63],57:[2,63],64:[2,63],65:[2,63],66:[2,63],83:[2,63],86:[2,63]},{8:[2,64],10:[2,64],16:[2,64],32:[2,64],34:[2,64],35:[2,64],37:[2,64],39:[2,64],41:[2,64],42:[2,64],43:[2,64],45:[2,64],46:[2,64],47:[2,64],48:[2,64],50:[2,64],51:[2,64],53:[2,64],54:[2,64],55:[2,64],57:[2,64],64:[2,64],65:[2,64],66:[2,64],83:[2,64],86:[2,64]},{8:[1,37],9:86,20:[1,33],29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{8:[1,87]},{8:[1,88]},{8:[2,32],10:[2,32],16:[2,32],32:[2,32],34:[2,32],35:[2,32],37:[2,32],39:[2,32],41:[2,32],42:[2,32],43:[2,32],45:[1,89],46:[1,90],47:[1,91],48:[1,92],50:[2,32],51:[2,32],53:[2,32],54:[2,32],55:[2,32],57:[2,32],64:[2,32],65:[2,32],66:[2,32],83:[2,32],86:[2,32]},{8:[2,66],10:[2,66],16:[2,66],32:[2,66],34:[2,66],35:[2,66],37:[2,66],39:[2,66],41:[2,66],42:[2,66],43:[2,66],45:[2,66],46:[2,66],47:[2,66],48:[2,66],50:[2,66],51:[2,66],53:[2,66],54:[2,66],55:[2,66],57:[2,66],64:[2,66],65:[2,66],66:[2,66],83:[2,66],86:[2,66]},{8:[2,67],10:[2,67],16:[2,67],32:[2,67],34:[2,67],35:[2,67],37:[2,67],39:[2,67],41:[2,67],42:[2,67],43:[2,67],45:[2,67],46:[2,67],47:[2,67],48:[2,67],50:[2,67],51:[2,67],53:[2,67],54:[2,67],55:[2,67],57:[2,67],64:[2,67],65:[2,67],66:[2,67],83:[2,67],86:[2,67]},{8:[2,68],10:[2,68],16:[2,68],32:[2,68],34:[2,68],35:[2,68],37:[2,68],39:[2,68],41:[2,68],42:[2,68],43:[2,68],45:[2,68],46:[2,68],47:[2,68],48:[2,68],50:[2,68],51:[2,68],53:[2,68],54:[2,68],55:[2,68],57:[2,68],64:[2,68],65:[2,68],66:[2,68],83:[2,68],86:[2,68]},{8:[2,69],10:[2,69],16:[2,69],32:[2,69],34:[2,69],35:[2,69],37:[2,69],39:[2,69],41:[2,69],42:[2,69],43:[2,69],45:[2,69],46:[2,69],47:[2,69],48:[2,69],50:[2,69],51:[2,69],53:[2,69],54:[2,69],55:[2,69],57:[2,69],64:[2,69],65:[2,69],66:[2,69],83:[2,69],86:[2,69]},{20:[1,97],72:98,73:99,77:[1,51],78:[1,52],79:[1,53],80:[1,54],83:[1,93],84:94,85:95,87:96},{8:[1,37],20:[1,33],29:102,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],66:[1,100],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],81:101,82:[1,45],91:[1,38],93:[1,39]},{8:[2,36],10:[2,36],16:[2,36],32:[2,36],34:[2,36],35:[2,36],37:[2,36],39:[2,36],41:[2,36],42:[2,36],43:[2,36],45:[2,36],46:[2,36],47:[2,36],48:[2,36],50:[1,103],51:[1,104],53:[2,36],54:[2,36],55:[2,36],57:[2,36],64:[2,36],65:[2,36],66:[2,36],83:[2,36],86:[2,36]},{8:[2,70],10:[2,70],16:[2,70],32:[2,70],34:[2,70],35:[2,70],37:[2,70],39:[2,70],41:[2,70],42:[2,70],43:[2,70],45:[2,70],46:[2,70],47:[2,70],48:[2,70],50:[2,70],51:[2,70],53:[2,70],54:[2,70],55:[2,70],57:[2,70],64:[2,70],65:[2,70],66:[2,70],83:[2,70],86:[2,70]},{8:[2,71],10:[2,71],16:[2,71],32:[2,71],34:[2,71],35:[2,71],37:[2,71],39:[2,71],41:[2,71],42:[2,71],43:[2,71],45:[2,71],46:[2,71],47:[2,71],48:[2,71],50:[2,71],51:[2,71],53:[2,71],54:[2,71],55:[2,71],57:[2,71],64:[2,71],65:[2,71],66:[2,71],83:[2,71],86:[2,71]},{8:[2,72],10:[2,72],16:[2,72],32:[2,72],34:[2,72],35:[2,72],37:[2,72],39:[2,72],41:[2,72],42:[2,72],43:[2,72],45:[2,72],46:[2,72],47:[2,72],48:[2,72],50:[2,72],51:[2,72],53:[2,72],54:[2,72],55:[2,72],57:[2,72],64:[2,72],65:[2,72],66:[2,72],83:[2,72],86:[2,72]},{8:[2,73],10:[2,73],16:[2,73],32:[2,73],34:[2,73],35:[2,73],37:[2,73],39:[2,73],41:[2,73],42:[2,73],43:[2,73],45:[2,73],46:[2,73],47:[2,73],48:[2,73],50:[2,73],51:[2,73],53:[2,73],54:[2,73],55:[2,73],57:[2,73],64:[2,73],65:[2,73],66:[2,73],83:[2,73],86:[2,73]},{8:[2,74],10:[2,74],16:[2,74],32:[2,74],34:[2,74],35:[2,74],37:[2,74],39:[2,74],41:[2,74],42:[2,74],43:[2,74],45:[2,74],46:[2,74],47:[2,74],48:[2,74],50:[2,74],51:[2,74],53:[2,74],54:[2,74],55:[2,74],57:[2,74],64:[2,74],65:[2,74],66:[2,74],83:[2,74],86:[2,74]},{8:[2,75],10:[2,75],16:[2,75],32:[2,75],34:[2,75],35:[2,75],37:[2,75],39:[2,75],41:[2,75],42:[2,75],43:[2,75],45:[2,75],46:[2,75],47:[2,75],48:[2,75],50:[2,75],51:[2,75],53:[2,75],54:[2,75],55:[2,75],57:[2,75],64:[2,75],65:[2,75],66:[2,75],83:[2,75],86:[2,75]},{8:[2,76],10:[2,76],16:[2,76],32:[2,76],34:[2,76],35:[2,76],37:[2,76],39:[2,76],41:[2,76],42:[2,76],43:[2,76],45:[2,76],46:[2,76],47:[2,76],48:[2,76],50:[2,76],51:[2,76],53:[2,76],54:[2,76],55:[2,76],57:[2,76],64:[2,76],65:[2,76],66:[2,76],83:[2,76],86:[2,76]},{8:[2,41],10:[2,41],16:[2,41],32:[2,41],34:[2,41],35:[2,41],37:[2,41],39:[2,41],41:[2,41],42:[2,41],43:[2,41],45:[2,41],46:[2,41],47:[2,41],48:[2,41],50:[2,41],51:[2,41],53:[1,105],54:[1,106],55:[1,107],57:[2,41],64:[2,41],65:[2,41],66:[2,41],83:[2,41],86:[2,41]},{8:[2,44],10:[2,44],16:[2,44],32:[2,44],34:[2,44],35:[2,44],37:[2,44],39:[2,44],41:[2,44],42:[2,44],43:[2,44],45:[2,44],46:[2,44],47:[2,44],48:[2,44],50:[2,44],51:[2,44],53:[2,44],54:[2,44],55:[2,44],57:[2,44],64:[2,44],65:[2,44],66:[2,44],83:[2,44],86:[2,44]},{8:[2,50],10:[2,50],16:[2,50],32:[2,50],34:[2,50],35:[2,50],37:[2,50],39:[2,50],41:[2,50],42:[2,50],43:[2,50],45:[2,50],46:[2,50],47:[2,50],48:[2,50],50:[2,50],51:[2,50],53:[2,50],54:[2,50],55:[2,50],57:[2,50],64:[2,50],65:[2,50],66:[2,50],83:[2,50],86:[2,50]},{8:[1,37],20:[1,33],31:109,50:[1,59],51:[1,60],52:108,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{8:[1,37],20:[1,33],31:109,50:[1,59],51:[1,60],52:110,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{8:[1,37],20:[1,33],31:109,50:[1,59],51:[1,60],52:111,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{6:6,7:[1,13],8:[1,37],9:20,11:4,13:7,14:[1,14],15:[1,15],16:[1,21],17:[1,16],18:8,19:[1,17],20:[1,33],21:[1,18],22:9,23:[1,19],24:11,25:5,26:[1,12],27:[1,112],28:10,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{8:[1,37],9:113,20:[1,33],29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{8:[1,37],9:114,20:[1,33],29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{8:[1,37],9:115,20:[1,33],29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{14:[1,116]},{5:[2,7],7:[2,7],8:[2,7],12:[2,7],14:[2,7],15:[2,7],16:[2,7],17:[2,7],19:[2,7],20:[2,7],21:[2,7],23:[2,7],26:[2,7],27:[2,7],50:[2,7],51:[2,7],58:[2,7],65:[2,7],74:[2,7],75:[2,7],76:[2,7],77:[2,7],78:[2,7],79:[2,7],80:[2,7],82:[2,7],91:[2,7],93:[2,7]},{5:[2,8],7:[2,8],8:[2,8],12:[2,8],14:[2,8],15:[2,8],16:[2,8],17:[2,8],19:[2,8],20:[2,8],21:[2,8],23:[2,8],26:[2,8],27:[2,8],50:[2,8],51:[2,8],58:[2,8],65:[2,8],74:[2,8],75:[2,8],76:[2,8],77:[2,8],78:[2,8],79:[2,8],80:[2,8],82:[2,8],91:[2,8],93:[2,8]},{5:[2,9],7:[2,9],8:[2,9],12:[2,9],14:[2,9],15:[2,9],16:[2,9],17:[2,9],19:[2,9],20:[2,9],21:[2,9],23:[2,9],26:[2,9],27:[2,9],50:[2,9],51:[2,9],58:[2,9],65:[2,9],74:[2,9],75:[2,9],76:[2,9],77:[2,9],78:[2,9],79:[2,9],80:[2,9],82:[2,9],91:[2,9],93:[2,9]},{16:[1,117]},{5:[2,22],7:[2,22],8:[2,22],12:[2,22],14:[2,22],15:[2,22],16:[2,22],17:[2,22],19:[2,22],20:[2,22],21:[2,22],23:[2,22],26:[2,22],27:[2,22],50:[2,22],51:[2,22],58:[2,22],65:[2,22],74:[2,22],75:[2,22],76:[2,22],77:[2,22],78:[2,22],79:[2,22],80:[2,22],82:[2,22],91:[2,22],93:[2,22]},{8:[1,37],20:[1,33],29:118,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{8:[1,37],20:[1,33],31:109,50:[1,59],51:[1,60],52:119,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{8:[1,37],20:[1,33],29:120,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{8:[1,37],20:[1,33],31:109,36:121,38:32,40:40,44:47,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{20:[1,122]},{8:[1,37],9:123,20:[1,33],29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{8:[2,87],10:[2,87],16:[2,87],20:[1,126],32:[2,87],34:[2,87],35:[2,87],37:[2,87],39:[2,87],41:[2,87],42:[2,87],43:[2,87],45:[2,87],46:[2,87],47:[2,87],48:[2,87],50:[2,87],51:[2,87],53:[2,87],54:[2,87],55:[2,87],57:[2,87],64:[2,87],65:[2,87],66:[2,87],68:127,82:[1,45],83:[2,87],86:[2,87],89:124,90:125},{8:[1,37],10:[1,128],20:[1,33],29:102,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],81:129,82:[1,45],91:[1,38],93:[1,39]},{8:[2,89],10:[2,89],16:[2,89],32:[2,89],34:[2,89],35:[2,89],37:[2,89],39:[2,89],41:[2,89],42:[2,89],43:[2,89],45:[2,89],46:[2,89],47:[2,89],48:[2,89],50:[2,89],51:[2,89],53:[2,89],54:[2,89],55:[2,89],57:[2,89],64:[2,89],65:[2,89],66:[2,89],83:[2,89],86:[2,89]},{8:[1,37],9:130,20:[1,33],29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{20:[1,131]},{8:[1,37],20:[1,33],31:109,38:132,40:40,44:47,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{8:[1,37],20:[1,33],31:109,40:133,44:47,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{8:[1,37],20:[1,33],31:109,40:134,44:47,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{8:[1,37],20:[1,33],31:109,40:135,44:47,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{10:[1,136]},{10:[1,137],20:[1,139],92:138},{10:[1,140],20:[1,139],92:141},{8:[1,37],20:[1,33],31:109,44:142,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{8:[1,37],20:[1,33],31:109,44:143,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{8:[1,37],20:[1,33],31:109,44:144,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{8:[1,37],20:[1,33],31:109,44:145,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{8:[2,79],10:[2,79],16:[2,79],32:[2,79],34:[2,79],35:[2,79],37:[2,79],39:[2,79],41:[2,79],42:[2,79],43:[2,79],45:[2,79],46:[2,79],47:[2,79],48:[2,79],50:[2,79],51:[2,79],53:[2,79],54:[2,79],55:[2,79],57:[2,79],64:[2,79],65:[2,79],66:[2,79],83:[2,79],86:[2,79]},{83:[1,146],86:[1,147]},{83:[2,81],86:[2,81]},{35:[1,148]},{35:[2,84]},{35:[2,85]},{35:[2,86]},{8:[2,77],10:[2,77],16:[2,77],32:[2,77],34:[2,77],35:[2,77],37:[2,77],39:[2,77],41:[2,77],42:[2,77],43:[2,77],45:[2,77],46:[2,77],47:[2,77],48:[2,77],50:[2,77],51:[2,77],53:[2,77],54:[2,77],55:[2,77],57:[2,77],64:[2,77],65:[2,77],66:[2,77],83:[2,77],86:[2,77]},{66:[1,149],86:[1,150]},{10:[2,98],66:[2,98],86:[2,98]},{8:[1,37],20:[1,33],31:109,49:151,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{8:[1,37],20:[1,33],31:109,49:152,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{8:[1,37],20:[1,33],31:109,50:[1,59],51:[1,60],52:153,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{8:[1,37],20:[1,33],31:109,50:[1,59],51:[1,60],52:154,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{8:[1,37],20:[1,33],31:109,50:[1,59],51:[1,60],52:155,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{8:[2,51],10:[2,51],16:[2,51],32:[2,51],34:[2,51],35:[2,51],37:[2,51],39:[2,51],41:[2,51],42:[2,51],43:[2,51],45:[2,51],46:[2,51],47:[2,51],48:[2,51],50:[2,51],51:[2,51],53:[2,51],54:[2,51],55:[2,51],57:[2,51],64:[2,51],65:[2,51],66:[2,51],83:[2,51],86:[2,51]},{8:[2,48],10:[2,48],16:[2,48],32:[2,48],34:[2,48],35:[2,48],37:[2,48],39:[2,48],41:[2,48],42:[2,48],43:[2,48],45:[2,48],46:[2,48],47:[2,48],48:[2,48],50:[2,48],51:[2,48],53:[2,48],54:[2,48],55:[2,48],57:[1,72],64:[2,48],65:[2,48],66:[2,48],83:[2,48],86:[2,48]},{8:[2,52],10:[2,52],16:[2,52],32:[2,52],34:[2,52],35:[2,52],37:[2,52],39:[2,52],41:[2,52],42:[2,52],43:[2,52],45:[2,52],46:[2,52],47:[2,52],48:[2,52],50:[2,52],51:[2,52],53:[2,52],54:[2,52],55:[2,52],57:[2,52],64:[2,52],65:[2,52],66:[2,52],83:[2,52],86:[2,52]},{8:[2,53],10:[2,53],16:[2,53],32:[2,53],34:[2,53],35:[2,53],37:[2,53],39:[2,53],41:[2,53],42:[2,53],43:[2,53],45:[2,53],46:[2,53],47:[2,53],48:[2,53],50:[2,53],51:[2,53],53:[2,53],54:[2,53],55:[2,53],57:[2,53],64:[2,53],65:[2,53],66:[2,53],83:[2,53],86:[2,53]},{5:[2,12],7:[2,12],8:[2,12],10:[2,12],12:[2,12],14:[2,12],15:[2,12],16:[2,12],17:[2,12],19:[2,12],20:[2,12],21:[2,12],23:[2,12],26:[2,12],27:[2,12],32:[2,12],34:[2,12],35:[2,12],37:[2,12],39:[2,12],41:[2,12],42:[2,12],43:[2,12],45:[2,12],46:[2,12],47:[2,12],48:[2,12],50:[2,12],51:[2,12],53:[2,12],54:[2,12],55:[2,12],57:[2,12],58:[2,12],64:[2,12],65:[2,12],66:[2,12],74:[2,12],75:[2,12],76:[2,12],77:[2,12],78:[2,12],79:[2,12],80:[2,12],82:[2,12],83:[2,12],86:[2,12],91:[2,12],93:[2,12]},{10:[1,156]},{10:[1,157]},{16:[1,158]},{8:[1,159]},{5:[2,10],7:[2,10],8:[2,10],12:[2,10],14:[2,10],15:[2,10],16:[2,10],17:[2,10],19:[2,10],20:[2,10],21:[2,10],23:[2,10],26:[2,10],27:[2,10],50:[2,10],51:[2,10],58:[2,10],65:[2,10],74:[2,10],75:[2,10],76:[2,10],77:[2,10],78:[2,10],79:[2,10],80:[2,10],82:[2,10],91:[2,10],93:[2,10]},{8:[2,25],10:[2,25],16:[2,25],32:[2,25],34:[2,25],35:[2,25],37:[2,25],39:[2,25],41:[2,25],42:[2,25],43:[2,25],45:[2,25],46:[2,25],47:[2,25],48:[2,25],50:[2,25],51:[2,25],53:[2,25],54:[2,25],55:[2,25],57:[2,25],64:[2,25],65:[2,25],66:[2,25],83:[2,25],86:[2,25]},{8:[2,49],10:[2,49],16:[2,49],32:[2,49],34:[2,49],35:[2,49],37:[2,49],39:[2,49],41:[2,49],42:[2,49],43:[2,49],45:[2,49],46:[2,49],47:[2,49],48:[2,49],50:[2,49],51:[2,49],53:[2,49],54:[2,49],55:[2,49],57:[2,49],64:[2,49],65:[2,49],66:[2,49],83:[2,49],86:[2,49]},{35:[1,160]},{8:[2,29],10:[2,29],16:[2,29],32:[2,29],34:[2,29],35:[2,29],37:[2,29],39:[1,82],41:[2,29],42:[2,29],43:[2,29],45:[2,29],46:[2,29],47:[2,29],48:[2,29],50:[2,29],51:[2,29],53:[2,29],54:[2,29],55:[2,29],57:[2,29],64:[2,29],65:[2,29],66:[2,29],83:[2,29],86:[2,29]},{8:[2,59],10:[2,59],16:[2,59],32:[2,59],34:[2,59],35:[2,59],37:[2,59],39:[2,59],41:[2,59],42:[2,59],43:[2,59],45:[2,59],46:[2,59],47:[2,59],48:[2,59],50:[2,59],51:[2,59],53:[2,59],54:[2,59],55:[2,59],57:[2,59],64:[2,59],65:[2,59],66:[2,59],83:[2,59],86:[2,59]},{66:[1,161]},{8:[2,88],10:[2,88],16:[2,88],32:[2,88],34:[2,88],35:[2,88],37:[2,88],39:[2,88],41:[2,88],42:[2,88],43:[2,88],45:[2,88],46:[2,88],47:[2,88],48:[2,88],50:[2,88],51:[2,88],53:[2,88],54:[2,88],55:[2,88],57:[2,88],64:[2,88],65:[2,88],66:[2,88],83:[2,88],86:[1,162]},{8:[2,94],10:[2,94],16:[2,94],32:[2,94],34:[2,94],35:[2,94],37:[2,94],39:[2,94],41:[2,94],42:[2,94],43:[2,94],45:[2,94],46:[2,94],47:[2,94],48:[2,94],50:[2,94],51:[2,94],53:[2,94],54:[2,94],55:[2,94],57:[2,94],64:[2,94],65:[2,94],66:[2,94],83:[2,94],86:[2,94]},{8:[2,96],10:[2,96],16:[2,96],32:[2,96],34:[2,96],35:[2,96],37:[2,96],39:[2,96],41:[2,96],42:[2,96],43:[2,96],45:[2,96],46:[2,96],47:[2,96],48:[2,96],50:[2,96],51:[2,96],53:[2,96],54:[2,96],55:[2,96],57:[2,96],64:[2,96],65:[2,96],66:[2,96],83:[2,96],86:[2,96]},{8:[2,97],10:[2,97],16:[2,97],32:[2,97],34:[2,97],35:[2,97],37:[2,97],39:[2,97],41:[2,97],42:[2,97],43:[2,97],45:[2,97],46:[2,97],47:[2,97],48:[2,97],50:[2,97],51:[2,97],53:[2,97],54:[2,97],55:[2,97],57:[2,97],64:[2,97],65:[2,97],66:[2,97],83:[2,97],86:[2,97]},{8:[2,92],10:[2,92],16:[2,92],20:[2,92],32:[2,92],34:[2,92],35:[2,92],37:[2,92],39:[2,92],41:[2,92],42:[2,92],43:[2,92],45:[2,92],46:[2,92],47:[2,92],48:[2,92],50:[2,92],51:[2,92],53:[2,92],54:[2,92],55:[2,92],57:[2,92],64:[2,92],65:[2,92],66:[2,92],82:[2,92],83:[2,92],86:[2,92]},{10:[1,163],86:[1,150]},{66:[1,164]},{8:[2,91],10:[2,91],16:[2,91],32:[2,91],34:[2,91],35:[2,91],37:[2,91],39:[2,91],41:[2,91],42:[2,91],43:[2,91],45:[2,91],46:[2,91],47:[2,91],48:[2,91],50:[2,91],51:[2,91],53:[2,91],54:[2,91],55:[2,91],57:[2,91],64:[2,91],65:[2,91],66:[2,91],83:[2,91],86:[2,91]},{8:[2,31],10:[2,31],16:[2,31],32:[2,31],34:[2,31],35:[2,31],37:[2,31],39:[2,31],41:[1,83],42:[1,84],43:[1,85],45:[2,31],46:[2,31],47:[2,31],48:[2,31],50:[2,31],51:[2,31],53:[2,31],54:[2,31],55:[2,31],57:[2,31],64:[2,31],65:[2,31],66:[2,31],83:[2,31],86:[2,31]},{8:[2,33],10:[2,33],16:[2,33],32:[2,33],34:[2,33],35:[2,33],37:[2,33],39:[2,33],41:[2,33],42:[2,33],43:[2,33],45:[1,89],46:[1,90],47:[1,91],48:[1,92],50:[2,33],51:[2,33],53:[2,33],54:[2,33],55:[2,33],57:[2,33],64:[2,33],65:[2,33],66:[2,33],83:[2,33],86:[2,33]},{8:[2,34],10:[2,34],16:[2,34],32:[2,34],34:[2,34],35:[2,34],37:[2,34],39:[2,34],41:[2,34],42:[2,34],43:[2,34],45:[1,89],46:[1,90],47:[1,91],48:[1,92],50:[2,34],51:[2,34],53:[2,34],54:[2,34],55:[2,34],57:[2,34],64:[2,34],65:[2,34],66:[2,34],83:[2,34],86:[2,34]},{8:[2,35],10:[2,35],16:[2,35],32:[2,35],34:[2,35],35:[2,35],37:[2,35],39:[2,35],41:[2,35],42:[2,35],43:[2,35],45:[1,89],46:[1,90],47:[1,91],48:[1,92],50:[2,35],51:[2,35],53:[2,35],54:[2,35],55:[2,35],57:[2,35],64:[2,35],65:[2,35],66:[2,35],83:[2,35],86:[2,35]},{8:[2,65],10:[2,65],16:[2,65],32:[2,65],34:[2,65],35:[2,65],37:[2,65],39:[2,65],41:[2,65],42:[2,65],43:[2,65],45:[2,65],46:[2,65],47:[2,65],48:[2,65],50:[2,65],51:[2,65],53:[2,65],54:[2,65],55:[2,65],57:[2,65],64:[2,65],65:[2,65],66:[2,65],83:[2,65],86:[2,65]},{25:165,26:[1,12]},{10:[1,166],86:[1,167]},{10:[2,104],86:[2,104]},{94:[1,168]},{10:[1,169],86:[1,167]},{8:[2,37],10:[2,37],16:[2,37],32:[2,37],34:[2,37],35:[2,37],37:[2,37],39:[2,37],41:[2,37],42:[2,37],43:[2,37],45:[2,37],46:[2,37],47:[2,37],48:[2,37],50:[1,103],51:[1,104],53:[2,37],54:[2,37],55:[2,37],57:[2,37],64:[2,37],65:[2,37],66:[2,37],83:[2,37],86:[2,37]},{8:[2,38],10:[2,38],16:[2,38],32:[2,38],34:[2,38],35:[2,38],37:[2,38],39:[2,38],41:[2,38],42:[2,38],43:[2,38],45:[2,38],46:[2,38],47:[2,38],48:[2,38],50:[1,103],51:[1,104],53:[2,38],54:[2,38],55:[2,38],57:[2,38],64:[2,38],65:[2,38],66:[2,38],83:[2,38],86:[2,38]},{8:[2,39],10:[2,39],16:[2,39],32:[2,39],34:[2,39],35:[2,39],37:[2,39],39:[2,39],41:[2,39],42:[2,39],43:[2,39],45:[2,39],46:[2,39],47:[2,39],48:[2,39],50:[1,103],51:[1,104],53:[2,39],54:[2,39],55:[2,39],57:[2,39],64:[2,39],65:[2,39],66:[2,39],83:[2,39],86:[2,39]},{8:[2,40],10:[2,40],16:[2,40],32:[2,40],34:[2,40],35:[2,40],37:[2,40],39:[2,40],41:[2,40],42:[2,40],43:[2,40],45:[2,40],46:[2,40],47:[2,40],48:[2,40],50:[1,103],51:[1,104],53:[2,40],54:[2,40],55:[2,40],57:[2,40],64:[2,40],65:[2,40],66:[2,40],83:[2,40],86:[2,40]},{8:[2,80],10:[2,80],16:[2,80],32:[2,80],34:[2,80],35:[2,80],37:[2,80],39:[2,80],41:[2,80],42:[2,80],43:[2,80],45:[2,80],46:[2,80],47:[2,80],48:[2,80],50:[2,80],51:[2,80],53:[2,80],54:[2,80],55:[2,80],57:[2,80],64:[2,80],65:[2,80],66:[2,80],83:[2,80],86:[2,80]},{20:[1,97],72:98,73:99,77:[1,51],78:[1,52],79:[1,53],80:[1,54],85:170,87:96},{8:[1,37],20:[1,33],29:171,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{8:[2,78],10:[2,78],16:[2,78],32:[2,78],34:[2,78],35:[2,78],37:[2,78],39:[2,78],41:[2,78],42:[2,78],43:[2,78],45:[2,78],46:[2,78],47:[2,78],48:[2,78],50:[2,78],51:[2,78],53:[2,78],54:[2,78],55:[2,78],57:[2,78],64:[2,78],65:[2,78],66:[2,78],83:[2,78],86:[2,78]},{8:[1,37],20:[1,33],29:172,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{8:[2,42],10:[2,42],16:[2,42],32:[2,42],34:[2,42],35:[2,42],37:[2,42],39:[2,42],41:[2,42],42:[2,42],43:[2,42],45:[2,42],46:[2,42],47:[2,42],48:[2,42],50:[2,42],51:[2,42],53:[1,105],54:[1,106],55:[1,107],57:[2,42],64:[2,42],65:[2,42],66:[2,42],83:[2,42],86:[2,42]},{8:[2,43],10:[2,43],16:[2,43],32:[2,43],34:[2,43],35:[2,43],37:[2,43],39:[2,43],41:[2,43],42:[2,43],43:[2,43],45:[2,43],46:[2,43],47:[2,43],48:[2,43],50:[2,43],51:[2,43],53:[1,105],54:[1,106],55:[1,107],57:[2,43],64:[2,43],65:[2,43],66:[2,43],83:[2,43],86:[2,43]},{8:[2,45],10:[2,45],16:[2,45],32:[2,45],34:[2,45],35:[2,45],37:[2,45],39:[2,45],41:[2,45],42:[2,45],43:[2,45],45:[2,45],46:[2,45],47:[2,45],48:[2,45],50:[2,45],51:[2,45],53:[2,45],54:[2,45],55:[2,45],57:[2,45],64:[2,45],65:[2,45],66:[2,45],83:[2,45],86:[2,45]},{8:[2,46],10:[2,46],16:[2,46],32:[2,46],34:[2,46],35:[2,46],37:[2,46],39:[2,46],41:[2,46],42:[2,46],43:[2,46],45:[2,46],46:[2,46],47:[2,46],48:[2,46],50:[2,46],51:[2,46],53:[2,46],54:[2,46],55:[2,46],57:[2,46],64:[2,46],65:[2,46],66:[2,46],83:[2,46],86:[2,46]},{8:[2,47],10:[2,47],16:[2,47],32:[2,47],34:[2,47],35:[2,47],37:[2,47],39:[2,47],41:[2,47],42:[2,47],43:[2,47],45:[2,47],46:[2,47],47:[2,47],48:[2,47],50:[2,47],51:[2,47],53:[2,47],54:[2,47],55:[2,47],57:[2,47],64:[2,47],65:[2,47],66:[2,47],83:[2,47],86:[2,47]},{6:6,7:[1,13],8:[1,37],9:20,11:173,13:7,14:[1,14],15:[1,15],16:[1,21],17:[1,16],18:8,19:[1,17],20:[1,33],21:[1,18],22:9,23:[1,19],24:11,25:5,26:[1,12],28:10,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{6:6,7:[1,13],8:[1,37],9:20,11:174,13:7,14:[1,14],15:[1,15],16:[1,21],17:[1,16],18:8,19:[1,17],20:[1,33],21:[1,18],22:9,23:[1,19],24:11,25:5,26:[1,12],28:10,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{8:[1,37],9:175,20:[1,33],29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{8:[1,37],9:176,20:[1,33],29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{8:[1,37],20:[1,33],29:177,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{8:[2,60],10:[2,60],16:[2,60],32:[2,60],34:[2,60],35:[2,60],37:[2,60],39:[2,60],41:[2,60],42:[2,60],43:[2,60],45:[2,60],46:[2,60],47:[2,60],48:[2,60],50:[2,60],51:[2,60],53:[2,60],54:[2,60],55:[2,60],57:[2,60],64:[2,60],65:[2,60],66:[2,60],83:[2,60],86:[2,60]},{20:[1,126],68:127,82:[1,45],90:178},{8:[2,93],10:[2,93],16:[2,93],20:[2,93],32:[2,93],34:[2,93],35:[2,93],37:[2,93],39:[2,93],41:[2,93],42:[2,93],43:[2,93],45:[2,93],46:[2,93],47:[2,93],48:[2,93],50:[2,93],51:[2,93],53:[2,93],54:[2,93],55:[2,93],57:[2,93],64:[2,93],65:[2,93],66:[2,93],82:[2,93],83:[2,93],86:[2,93]},{8:[2,90],10:[2,90],16:[2,90],32:[2,90],34:[2,90],35:[2,90],37:[2,90],39:[2,90],41:[2,90],42:[2,90],43:[2,90],45:[2,90],46:[2,90],47:[2,90],48:[2,90],50:[2,90],51:[2,90],53:[2,90],54:[2,90],55:[2,90],57:[2,90],64:[2,90],65:[2,90],66:[2,90],83:[2,90],86:[2,90]},{8:[2,100],10:[2,100],16:[2,100],32:[2,100],34:[2,100],35:[2,100],37:[2,100],39:[2,100],41:[2,100],42:[2,100],43:[2,100],45:[2,100],46:[2,100],47:[2,100],48:[2,100],50:[2,100],51:[2,100],53:[2,100],54:[2,100],55:[2,100],57:[2,100],64:[2,100],65:[2,100],66:[2,100],83:[2,100],86:[2,100]},{25:179,26:[1,12]},{20:[1,180]},{8:[1,37],9:181,20:[1,33],29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{94:[1,182]},{83:[2,82],86:[2,82]},{83:[2,83],86:[2,83]},{10:[2,99],66:[2,99],86:[2,99]},{5:[2,2],7:[2,2],8:[2,2],12:[1,183],14:[2,2],15:[2,2],16:[2,2],17:[2,2],19:[2,2],20:[2,2],21:[2,2],23:[2,2],26:[2,2],27:[2,2],50:[2,2],51:[2,2],58:[2,2],65:[2,2],74:[2,2],75:[2,2],76:[2,2],77:[2,2],78:[2,2],79:[2,2],80:[2,2],82:[2,2],91:[2,2],93:[2,2]},{5:[2,4],7:[2,4],8:[2,4],12:[2,4],14:[2,4],15:[2,4],16:[2,4],17:[2,4],19:[2,4],20:[2,4],21:[2,4],23:[2,4],26:[2,4],27:[2,4],50:[2,4],51:[2,4],58:[2,4],65:[2,4],74:[2,4],75:[2,4],76:[2,4],77:[2,4],78:[2,4],79:[2,4],80:[2,4],82:[2,4],91:[2,4],93:[2,4]},{16:[1,184]},{10:[1,185]},{8:[2,27],10:[2,27],16:[2,27],32:[2,27],34:[2,27],35:[2,27],37:[2,27],39:[2,27],41:[2,27],42:[2,27],43:[2,27],45:[2,27],46:[2,27],47:[2,27],48:[2,27],50:[2,27],51:[2,27],53:[2,27],54:[2,27],55:[2,27],57:[2,27],64:[2,27],65:[2,27],66:[2,27],83:[2,27],86:[2,27]},{8:[2,95],10:[2,95],16:[2,95],32:[2,95],34:[2,95],35:[2,95],37:[2,95],39:[2,95],41:[2,95],42:[2,95],43:[2,95],45:[2,95],46:[2,95],47:[2,95],48:[2,95],50:[2,95],51:[2,95],53:[2,95],54:[2,95],55:[2,95],57:[2,95],64:[2,95],65:[2,95],66:[2,95],83:[2,95],86:[2,95]},{8:[2,101],10:[2,101],16:[2,101],32:[2,101],34:[2,101],35:[2,101],37:[2,101],39:[2,101],41:[2,101],42:[2,101],43:[2,101],45:[2,101],46:[2,101],47:[2,101],48:[2,101],50:[2,101],51:[2,101],53:[2,101],54:[2,101],55:[2,101],57:[2,101],64:[2,101],65:[2,101],66:[2,101],83:[2,101],86:[2,101]},{10:[2,105],86:[2,105]},{8:[2,102],10:[2,102],16:[2,102],32:[2,102],34:[2,102],35:[2,102],37:[2,102],39:[2,102],41:[2,102],42:[2,102],43:[2,102],45:[2,102],46:[2,102],47:[2,102],48:[2,102],50:[2,102],51:[2,102],53:[2,102],54:[2,102],55:[2,102],57:[2,102],64:[2,102],65:[2,102],66:[2,102],83:[2,102],86:[2,102]},{8:[1,37],9:186,20:[1,33],29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{6:6,7:[1,13],8:[1,37],9:20,11:187,13:7,14:[1,14],15:[1,15],16:[1,21],17:[1,16],18:8,19:[1,17],20:[1,33],21:[1,18],22:9,23:[1,19],24:11,25:5,26:[1,12],28:10,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{8:[1,37],9:188,20:[1,33],29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{16:[1,189]},{8:[2,103],10:[2,103],16:[2,103],32:[2,103],34:[2,103],35:[2,103],37:[2,103],39:[2,103],41:[2,103],42:[2,103],43:[2,103],45:[2,103],46:[2,103],47:[2,103],48:[2,103],50:[2,103],51:[2,103],53:[2,103],54:[2,103],55:[2,103],57:[2,103],64:[2,103],65:[2,103],66:[2,103],83:[2,103],86:[2,103]},{5:[2,3],7:[2,3],8:[2,3],12:[2,3],14:[2,3],15:[2,3],16:[2,3],17:[2,3],19:[2,3],20:[2,3],21:[2,3],23:[2,3],26:[2,3],27:[2,3],50:[2,3],51:[2,3],58:[2,3],65:[2,3],74:[2,3],75:[2,3],76:[2,3],77:[2,3],78:[2,3],79:[2,3],80:[2,3],82:[2,3],91:[2,3],93:[2,3]},{10:[1,190]},{5:[2,6],7:[2,6],8:[2,6],12:[2,6],14:[2,6],15:[2,6],16:[2,6],17:[2,6],19:[2,6],20:[2,6],21:[2,6],23:[2,6],26:[2,6],27:[2,6],50:[2,6],51:[2,6],58:[2,6],65:[2,6],74:[2,6],75:[2,6],76:[2,6],77:[2,6],78:[2,6],79:[2,6],80:[2,6],82:[2,6],91:[2,6],93:[2,6]},{6:6,7:[1,13],8:[1,37],9:20,11:191,13:7,14:[1,14],15:[1,15],16:[1,21],17:[1,16],18:8,19:[1,17],20:[1,33],21:[1,18],22:9,23:[1,19],24:11,25:5,26:[1,12],28:10,29:22,30:23,31:24,33:25,36:28,38:32,40:40,44:47,49:55,50:[1,59],51:[1,60],52:56,56:57,58:[1,58],59:26,60:27,61:29,62:30,63:31,65:[1,46],67:34,68:35,69:36,70:41,71:42,72:43,73:44,74:[1,48],75:[1,49],76:[1,50],77:[1,51],78:[1,52],79:[1,53],80:[1,54],82:[1,45],91:[1,38],93:[1,39]},{5:[2,5],7:[2,5],8:[2,5],12:[2,5],14:[2,5],15:[2,5],16:[2,5],17:[2,5],19:[2,5],20:[2,5],21:[2,5],23:[2,5],26:[2,5],27:[2,5],50:[2,5],51:[2,5],58:[2,5],65:[2,5],74:[2,5],75:[2,5],76:[2,5],77:[2,5],78:[2,5],79:[2,5],80:[2,5],82:[2,5],91:[2,5],93:[2,5]}],defaultActions:{3:[2,1],97:[2,84],98:[2,85],99:[2,86]},parseError:function(t,e){throw new Error(t)},parse:function(t){var e=this,i=[0],s=[null],r=[],o=this.table,n="",a=0,h=0,l=0;this.lexer.setInput(t),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,this.yy.parser=this,void 0===this.lexer.yylloc&&(this.lexer.yylloc={});var c=this.lexer.yylloc;r.push(c);var d=this.lexer.options&&this.lexer.options.ranges;function u(){var t;return"number"!=typeof(t=e.lexer.lex()||1)&&(t=e.symbols_[t]||t),t}"function"==typeof this.yy.parseError&&(this.parseError=this.yy.parseError);for(var p,f,A,_,m,g,b,v,y,C={};;){if(A=i[i.length-1],this.defaultActions[A]?_=this.defaultActions[A]:(null==p&&(p=u()),_=o[A]&&o[A][p]),void 0===_||!_.length||!_[0]){var P="";if(!l){for(g in y=[],o[A])this.terminals_[g]&&g>2&&y.push("'"+this.terminals_[g]+"'");P=this.lexer.showPosition?"Parse error on line "+(a+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+y.join(", ")+", got '"+(this.terminals_[p]||p)+"'":"Parse error on line "+(a+1)+": Unexpected "+(1==p?"end of input":"'"+(this.terminals_[p]||p)+"'"),this.parseError(P,{text:this.lexer.match,token:this.terminals_[p]||p,line:this.lexer.yylineno,loc:c,expected:y})}}if(_[0]instanceof Array&&_.length>1)throw new Error("Parse Error: multiple actions possible at state: "+A+", token: "+p);switch(_[0]){case 1:i.push(p),s.push(this.lexer.yytext),r.push(this.lexer.yylloc),i.push(_[1]),p=null,f?(p=f,f=null):(h=this.lexer.yyleng,n=this.lexer.yytext,a=this.lexer.yylineno,c=this.lexer.yylloc,l>0&&l--);break;case 2:if(b=this.productions_[_[1]][1],C.$=s[s.length-b],C._$={first_line:r[r.length-(b||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(b||1)].first_column,last_column:r[r.length-1].last_column},d&&(C._$.range=[r[r.length-(b||1)].range[0],r[r.length-1].range[1]]),void 0!==(m=this.performAction.call(C,n,h,a,this.yy,_[1],s,r)))return m;b&&(i=i.slice(0,-1*b*2),s=s.slice(0,-1*b),r=r.slice(0,-1*b)),i.push(this.productions_[_[1]][0]),s.push(C.$),r.push(C._$),v=o[i[i.length-2]][i[i.length-1]],i.push(v);break;case 3:return!0}}return!0}},e={node:function(t,e,i){return{type:t,value:e,children:i}},createNode:function(t,e,i,s){var r,o=this.node(e,i,[]);for(r=3;r20?"...":"")+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=new Array(t.length+1).join("-");return _jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.escapeHTML(t+this.upcomingInput()+"\n"+e+"^")},next:function(){if(this.done)return this.EOF;var t,e,i,s,r;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var o=this._currentRules(),n=0;ne[0].length)||(e=i,s=n,this.options.flex));n++);return e?((r=e[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+e[0].length},this.yytext+=e[0],this.match+=e[0],this.matches=e,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._input=this._input.slice(e[0].length),this.matched+=e[0],t=this.performAction.call(this,this.yy,this,o[s],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),t||void 0):""===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 void 0!==t?t:this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(t){this.begin(t)},options:{},performAction:function(t,e,i,s){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}}};return t}();function r(){this.yy={}}return t.lexer=s,r.prototype=t,t.Parser=r,new r}();parser.yy.parseError=parser.parseError,__webpack_exports__.A=_jxg_js__WEBPACK_IMPORTED_MODULE_0__.A.JessieCode},873:function(t,e,i){"use strict";var s=i(443),r=i(188),o=i(477),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:"90ee90",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)]}}];s.A.rgbParser=function(t,e,i){var s,o,h,l,c,d,u,p,f,A,_=t;if(!r.A.exists(t))return[];if(r.A.exists(e)&&r.A.exists(i)&&(_=[t,e,i]),s=_,A=!1,r.A.isArray(s)){for(d=0;d<3;d++)A=A||/\./.test(_[d].toString());for(d=0;d<3;d++)A=A&&_[d]>=0&&_[d]<=1;return A?[Math.ceil(255*_[0]),Math.ceil(255*_[1]),Math.ceil(255*_[2])]:_}for("string"==typeof _&&(s=_),"#"===s.charAt(0)&&(s=s.slice(1,7)),s=s.replace(/ /g,"").toLowerCase(),s=n[s]||s,d=0;d255?255:u,p=p<0||isNaN(p)?0:p>255?255:p,f=f<0||isNaN(f)?0:f>255?255:f]},s.A.isColor=function(t){var e=(new Option).style;return e.color=t,""!==e.color},s.A.rgb2css=function(t,e,i){var r;return"rgb("+(r=s.A.rgbParser(t,e,i))[0]+", "+r[1]+", "+r[2]+")"},s.A.rgb2hex=function(t,e,i){var r,o,n;return o=(r=s.A.rgbParser(t,e,i))[1],n=r[2],r=(r=r[0]).toString(16),o=o.toString(16),n=n.toString(16),1===r.length&&(r="0"+r),1===o.length&&(o="0"+o),1===n.length&&(n="0"+n),"#"+r+o+n},s.A.hex2rgb=function(t){return s.A.deprecated("JXG.hex2rgb()","JXG.rgb2css()"),s.A.rgb2css(t)},s.A.hsv2hsl=function(t,e,i){var s=i*(1-.5*e);return[t,0===s||1===s?0:(i-s)/Math.min(s,1-s),s]},s.A.hsv2rgb=function(t,e,i){var s,r,n,a,h,l,c,d,u;if(t=(t%360+360)%360,0===e){if(!(isNaN(t)||t=360?0:t,c=i*(1-e),d=i*(1-e*(a=(l/=60)-(h=Math.floor(l)))),u=i*(1-e*(1-a)),h){case 0:s=i,r=u,n=c;break;case 1:s=d,r=i,n=c;break;case 2:s=c,r=i,n=u;break;case 3:s=c,r=d,n=i;break;case 4:s=u,r=c,n=i;break;case 5:s=i,r=c,n=d}return["#",s=2===(s=Math.round(255*s).toString(16)).length?s:1===s.length?"0"+s:"00",r=2===(r=Math.round(255*r).toString(16)).length?r:1===r.length?"0"+r:"00",n=2===(n=Math.round(255*n).toString(16)).length?n:1===n.length?"0"+n:"00"].join("")},s.A.rgb2hsv=function(t,e,i){var r,o,n,a,h,l,c,d,u,p,f,A,_;return o=(r=s.A.rgbParser(t,e,i))[1],n=r[2],a=(r=r[0])/255,h=o/255,l=n/255,A=Math.max(r,o,n),d=(_=Math.min(r,o,n))/255,p=0,(f=c=A/255)>0&&(p=(f-d)/f),u=1/(c-d),p>0&&(A===r?u*=h-l:u=A===o?2+(l-a)*u:4+(a-h)*u),(u*=60)<0&&(u+=360),A===_&&(u=0),[u,p,f]},s.A.rgb2LMS=function(t,e,i){var r,o,n,a,h,l,c,d=[[.05059983,.08585369,.0095242],[.01893033,.08925308,.01370054],[.00292202,.00975732,.07145979]];return o=(r=s.A.rgbParser(t,e,i))[1],n=r[2],r=r[0],r=Math.pow(r,.476190476),o=Math.pow(o,.476190476),n=Math.pow(n,.476190476),(c=[a=r*d[0][0]+o*d[0][1]+n*d[0][2],h=r*d[1][0]+o*d[1][1]+n*d[1][2],l=r*d[2][0]+o*d[2][1]+n*d[2][2]]).l=a,c.m=h,c.s=l,c},s.A.LMS2rgb=function(t,e,i){var s,r,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>4&15)+o.charAt(15&e))+i+i)},s.A.rgb2cb=function(t,e){var i,r,o,n,a,h,l,c,d,u,p,f="0123456789ABCDEF";if("none"===t)return t;switch(r=(a=s.A.rgb2LMS(t))[0],o=a[1],n=a[2],e=e.toLowerCase()){case"protanopia":h=-.06150039994295001,l=.08277001656812001,c=-.013200141220000003,d=.05858939668799999,u=-.07934519995360001,p=.013289415272000003,r=n/o<.6903216543277437?-(l*o+c*n)/h:-(u*o+p*n)/d;break;case"tritanopia":h=-.00058973116217,l=.007690316482,c=-.01011703519052,d=.025495080838999994,u=-.0422740347,p=.017005316784,n=o/r<.8349489908460004?-(h*r+l*o)/c:-(d*r+u*o)/p;break;default:h=-.06150039994295001,l=.08277001656812001,c=-.013200141220000003,d=.05858939668799999,u=-.07934519995360001,p=.013289415272000003,o=n/r<.5763833686400911?-(h*r+c*n)/l:-(d*r+p*n)/u}return i=s.A.LMS2rgb(r,o,n),t="#"+(f.charAt(i[0]>>4&15)+f.charAt(15&i[0])),t+=f.charAt(i[1]>>4&15)+f.charAt(15&i[1]),t+=f.charAt(i[2]>>4&15)+f.charAt(15&i[2])},s.A.shadeColor=function(t,e){var i=s.A.rgbParser(t),r=i[0],o=i[1],n=i[2];return r=(r=(r=parseInt(r+255*e))>0?r:0)<255?r:255,o=(o=(o=parseInt(o+255*e))>0?o:0)<255?o:255,n=(n=(n=parseInt(n+255*e))>0?n:0)<255?n:255,r=Math.round(r),o=Math.round(o),n=Math.round(n),s.A.rgb2hex([r,o,n])},s.A.lightenColor=function(t,e){return s.A.shadeColor(t,e)},s.A.darkenColor=function(t,e){return s.A.shadeColor(t,-1*e)},s.A.mixColor=function(t,e,i){var r,o=s.A.rgbParser(t),n=s.A.rgbParser(e),a=[];for(i=null!=i?i:.5,r=0;r<3;r++)a[r]=parseInt(o[r]*i+n[r]*(1-i));return s.A.rgb2hex(a)},s.A.autoHighlight=function(t){var e=s.A.rgba2rgbo(t),i=e[0],r=e[1];return"#"===t.charAt(0)?(r*=r<.3?1.8:.4,s.A.rgbo2rgba(i,r)):t},s.A.contrast=function(t,e,i,r){var o,n,a,h,l;return e=e||"#000000",i=i||"#ffffff",r=r||7,o=s.A.rgbParser(t),n=s.A.rgbParser("#000000"),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)),(l-=1)>r?e:i},s.A.setClassicColors=function(){s.A.Options.elements.strokeColor="blue",s.A.Options.elements.fillColor="red",s.A.Options.hatch.strokeColor="blue",s.A.Options.angle.fillColor="#ff7f00",s.A.Options.angle.highlightFillColor="#ff7f00",s.A.Options.angle.strokeColor="#ff7f00",s.A.Options.angle.label.strokeColor="blue",s.A.Options.arc.strokeColor="blue",s.A.Options.circle.center.fillColor="red",s.A.Options.circle.center.strokeColor="blue",s.A.Options.circumcircle.strokeColor="blue",s.A.Options.circumcircle.center.fillColor="red",s.A.Options.circumcircle.center.strokeColor="blue",s.A.Options.circumcirclearc.strokeColor="blue",s.A.Options.circumcirclesector.strokeColor="blue",s.A.Options.circumcirclesector.fillColor="green",s.A.Options.circumcirclesector.highlightFillColor="green",s.A.Options.conic.strokeColor="blue",s.A.Options.curve.strokeColor="blue",s.A.Options.incircle.strokeColor="blue",s.A.Options.incircle.center.fillColor="red",s.A.Options.incircle.center.strokeColor="blue",s.A.Options.inequality.fillColor="red",s.A.Options.integral.fillColor="red",s.A.Options.integral.curveLeft.color="red",s.A.Options.integral.curveRight.color="red",s.A.Options.line.strokeColor="blue",s.A.Options.point.fillColor="red",s.A.Options.point.strokeColor="red",s.A.Options.polygon.fillColor="green",s.A.Options.polygon.highlightFillColor="green",s.A.Options.polygon.vertices.strokeColor="red",s.A.Options.polygon.vertices.fillColor="red",s.A.Options.regularpolygon.fillColor="green",s.A.Options.regularpolygon.highlightFillColor="green",s.A.Options.regularpolygon.vertices.strokeColor="red",s.A.Options.regularpolygon.vertices.fillColor="red",s.A.Options.riemannsum.fillColor="yellow",s.A.Options.sector.fillColor="green",s.A.Options.sector.highlightFillColor="green",s.A.Options.semicircle.center.fillColor="red",s.A.Options.semicircle.center.strokeColor="blue",s.A.Options.slopetriangle.fillColor="red",s.A.Options.slopetriangle.highlightFillColor="red",s.A.Options.turtle.arrow.strokeColor="blue"},s.A.extend(s.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"}}),s.A.palette=s.A.paletteWong,e.A=s.A},133:function(t,e,i){"use strict";var s=i(443),r=i(188);s.A.extendConstants(s.A,{}),s.A.extend(s.A,{maxScreenCoord:16777215,isTouchEvent:function(t){return s.A.exists(t.touches)},isPointerEvent:function(t){return s.A.exists(t.pointerId)},isMouseEvent:function(t){return!s.A.isTouchEvent(t)&&!s.A.isPointerEvent(t)},getNumberOfTouchPoints:function(t){var e=-1;return s.A.isTouchEvent(t)&&(e=t.touches.length),e},isFirstTouch:function(t){var e=s.A.getNumberOfTouchPoints(t);return s.A.isPointerEvent(t)?t.isPrimary:1===e},isBrowser:"undefined"!=typeof window&&"undefined"!=typeof document&&"object"==typeof window&&"object"==typeof document,supportsES6:function(){try{return new 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&&"undefined"!=typeof process&&-1!==process.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 r.A.exists(navigator)&&navigator.userAgent.toLowerCase().indexOf("android")>-1},isWebkitAndroid:function(){return this.isAndroid()&&navigator.userAgent.indexOf(" AppleWebKit/")>-1},isApple:function(){return r.A.exists(navigator)&&(navigator.userAgent.indexOf("iPad")>-1||navigator.userAgent.indexOf("iPhone")>-1)},isWebkitApple:function(){return"GestureEvent"in window&&("ongesturechange"in window||void 0!==window&&"safari"in window&&"pushNotification"in window.safari)},isMetroApp:function(){return"object"==typeof window&&window.clientInformation&&window.clientInformation.appVersion&&window.clientInformation.appVersion.indexOf("MSAppHost")>-1},isMozilla:function(){return r.A.exists(navigator)&&navigator.userAgent.toLowerCase().indexOf("mozilla")>-1&&-1===navigator.userAgent.toLowerCase().indexOf("apple")},isFirefoxOS:function(){return r.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("undefined"==typeof document||null===document||"object"!=typeof document)return 0;e=(t=document.createElement("div")).getElementsByTagName("i");do{t.innerHTML="\x3c!--[if gt IE "+ ++i+"]>4?i:void 0}(),getDimensions:function(t,e){var i,s,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=r.A.isString(t)?e.getElementById(t):t,!r.A.exists(i))throw new Error("\nJSXGraph: HTML container element '"+t+"' not found.");return"none"!==(s=i.style.display)&&null!==s?i.clientWidth>0&&i.clientHeight>0?{width:i.clientWidth,height:i.clientHeight}:(d=window.getComputedStyle?window.getComputedStyle(i):i.style,{width:u.test(d.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,s,o){var n=function(){return i.apply(s,arguments)};n.origin=i,"object"==typeof s&&r.A.exists(s.BOARD_MODE_NONE)&&(s["x_internal"+e]=s["x_internal"+e]||[],s["x_internal"+e].push(n)),r.A.exists(t)&&r.A.exists(t.addEventListener)&&(o=o||!1,t.addEventListener(e,n,o)),r.A.exists(t)&&r.A.exists(t.attachEvent)&&t.attachEvent("on"+e,n)},removeEvent:function(t,e,i,o){var n;if(r.A.exists(o))if(r.A.exists(o["x_internal"+e]))if(r.A.isArray(o["x_internal"+e]))if(-1!==(n=r.A.indexOf(o["x_internal"+e],i,"origin"))){try{r.A.exists(t)&&r.A.exists(t.removeEventListener)&&t.removeEventListener(e,o["x_internal"+e][n],!1),r.A.exists(t)&&r.A.exists(t.detachEvent)&&t.detachEvent("on"+e,o["x_internal"+e][n])}catch(t){s.A.debug("removeEvent: event not registered in browser: ("+e+" -- "+i+")")}o["x_internal"+e].splice(n,1)}else s.A.debug("removeEvent: no such event function in internal list: "+i);else s.A.debug("owner[x_internal + "+e+"] is not an array");else s.A.debug("removeEvent: no such type: "+e);else s.A.debug("no such owner")},removeAllEvents:function(t,e,i){var r;if(i["x_internal"+e]){for(r=i["x_internal"+e].length-1;r>=0;r--)s.A.removeEvent(t,e,i["x_internal"+e][r].origin,i);i["x_internal"+e].length>0&&s.A.debug("removeAllEvents: Not all events could be removed.")}},getPosition:function(t,e,i){var s,o,n,a=0,h=0;if(t||(t=window.event),i=i||document,n=t.touches,r.A.exists(n)&&0===n.length&&(n=t.changedTouches),r.A.exists(e)&&r.A.exists(n))if(-1===e){for(o=n.length,s=0;s=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,s,o,n,a,h,l,c=["transform","webkitTransform","MozTransform","msTransform","oTransform"];for(a=c.length,i=0,o="";i0){for(a=o.length,s=0,h=(l=o.substring(n+1,a-1).split(",")).length;s0){for(a=s.length,i=0,h=(o=s.substring(n+1,a-1).split(",")).length;i0&&+new Date-n<300);r.length>0?window.setTimeout(o,1):s(t)};window.setTimeout(o,1)},scaleJSXGraphDiv:function(t,e,i,r){var o,n,a,h,l,c,d,u,p,f,A,_,m=r;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*m&&(d=(c=o*m)*A),d>n*m&&(c=(d=n*m)/A),h=c,p=A-1&&this.eventHandlers[t].splice(i,1),0===this.eventHandlers[t].length&&delete this.eventHandlers[t]):delete this.eventHandlers[t],this):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={}}},e.A=s.A.EventEmitter},713:function(t,e,i){"use strict";var s=i(443),r=i(188),o=i(561),n=i(904);s.A.Expect={each:function(t,e,i){var s,o,n=[];if(r.A.exists(t.length))for(o=t.length,s=0;s1))||(s=t.select(e),this.isPoint(s)))},isPointType3D:function(t,e){var i,s;return!!(this.isArray(e)&&e.length>=3)||(!!(this.isFunction(e)&&(i=e(),this.isArray(i)&&i.length>=3))||(s=t.select(e),this.isPoint3D(s)))},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===r.A.OBJECT_TYPE_TRANSFORMATION}return!1},isEmpty:function(t){return 0===Object.keys(t).length},exists:function(t,e){var i=!(null==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)?(e='{"'+(e=(e=(e=(e=e.replace(/\s*;\s*$/g,"")).replace(/\s*;\s*/g,'","')).replace(/\s*:\s*/g,'":"')).trim())+'"}',JSON.parse(e)):{}},css2js:function(t){var e,i,r,o,n,a=[],h=s.A.trim(t).replace(/;$/,"").split(";");for(i=h.length,e=0;e0&&(n=Math.min(o,c-1),h=this.copyAttributes(i,t.options,s,r[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,s,r){var o,n,a,h,l,c=0,d=[];for(this.isArray(e)||(e=[e]),a=e.length,this.exists(r)&&(c=r.length),0===c&&(h=this.copyAttributes(i,t.board.options,s)),o=0;o0&&(n=Math.min(o,c-1),h=this.copyAttributes(i,t.board.options,s,r[n])),this.isArray(e[o])&&e[o].length>0&&e[o].every(t=>this.isArray(t)&&this.isNumber(t[0])))for(n=0;nthis.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){var e,i,s;if(this.isFunction(t))return t();if(this.isArray(t)){for(i=t.length,s=[],e=0;e0;s--)Math.abs(i[s]-i[s-1])-1},coordsArrayToMatrix:function(t,e){var i,s=[],r=[];for(i=0;i=.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 s;return this.isString(t)&&t.indexOf("%")>-1?(s=t.replace(/\s+%\s+/,""),parseFloat(s)*e*.01):this.isString(t)&&t.indexOf("fr")>-1?(s=t.replace(/\s+fr\s+/,""),parseFloat(s)*e):this.isString(t)&&t.indexOf("px")>-1?(s=t.replace(/\s+px\s+/,""),s=parseFloat(s),this.isFunction(i)?i(s):this.isNumber(i)?s*i:s):parseFloat(t)},parsePosition:function(t){var e,i,s="",r="";if(""!==(t=t.trim()))for(e=t.split(/[ ,]+/),i=0;i/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"0"!==t&&(t=t.replace(/^0+/,"")),(t.indexOf(".")>=0||t.indexOf(",")>=0)&&(t=t.replace(/0+$/,"")),"."!==t[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,s,r,o,n,a,h,l=t.length,c=[];if(this.exists(e)&&"function"!=typeof e&&"object"!=typeof e)return c;for(i=0;i/g,">")),t)},evalSlider:function(t){return t&&t.type===r.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}}),e.A=s.A}},__webpack_module_cache__={};function __webpack_require__(t){var e=__webpack_module_cache__[t];if(void 0!==e)return e.exports;var i=__webpack_module_cache__[t]={exports:{}};return __webpack_modules__[t](i,i.exports,__webpack_require__),i.exports}__webpack_require__.d=function(t,e){for(var i in e)__webpack_require__.o(e,i)&&!__webpack_require__.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},__webpack_require__.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)};var __webpack_exports__={};return function(){"use strict";__webpack_require__.d(__webpack_exports__,{default:function(){return ct}});var t=__webpack_require__(443),e=__webpack_require__(133),i=__webpack_require__(561),s=__webpack_require__(188);t.A.XML={cleanWhitespace:function(t){for(var e=t.firstChild;s.A.exists(e);)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 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}},e=(new i).parseFromString(t,"text/xml"),this.cleanWhitespace(e),e}};t.A.XML;var r=__webpack_require__(454),o=(__webpack_require__(713),__webpack_require__(477));o.A.ProbFuncs={MAXNUM:17014118346046923e22,SQRTH:.7071067811865476,SQRT2:1.4142135623730951,MAXLOG:708.3964185322641,P:[2.461969814735305e-10,.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,s,r,o;return t=Math.abs(t),e<0&&(t=-t),i=(r=this.MINV*Math.floor(this.M*t+.5))*r,s=2*r*(o=t-r)+o*o,e<0&&(i=-i,s=-s),i+s>this.MAXLOG?1/0:i=Math.exp(i)*Math.exp(s)},polevl:function(t,e,i){var r,o;if(s.A.exists(e.reduce))return e.reduce(function(e,i){return e*t+i},0);for(o=0,r=0;o<=i;o++)r=r*t+e[o];return r},p1evl:function(t,e,i){var r,o;if(s.A.exists(e.reduce))return e.reduce(function(e,i){return e*t+i},1);for(o=0,r=1;o0&&(i=1-i)),i},_underflow:function(t){return t<0?2:0},erfc:function(t){var e,i,s,r,o;return(s=t<0?-t:t)<1?1-this.erf(t):(o=-t*t)<-this.MAXLOG?this._underflow(t):(o=this.expx2(t,-1),s<8?(e=this.polevl(s,this.P,8),i=this.p1evl(s,this.Q,8)):(e=this.polevl(s,this.R,5),i=this.p1evl(s,this.S,6)),r=o*e/i,t<0&&(r=2-r),0===r?this._underflow(t):r)},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.90562251262117,-1.1833162112133],P1:[4.0554489230596245,31.525109459989388,57.16281922464213,44.08050738932008,14.684956192885803,2.1866330685079025,-.1402560791713545,-.03504246268278482,-.0008574567851546854],Q1:[15.779988325646675,45.39076351288792,41.3172038254672,15.04253856929075,2.504649462083094,-.14218292285478779,-.03808064076915783,-.0009332594808954574],P2:[3.2377489177694603,6.915228890689842,3.9388102529247444,1.3330346081580755,.20148538954917908,.012371663481782003,.00030158155350823543,26580697468673755e-22,6.239745391849833e-9],Q2:[6.02427039364742,3.6798356385616087,1.3770209948908132,.21623699359449663,.013420400608854318,.00032801446468212774,28924786474538068e-22,6.790194080099813e-9],ndtri:function(t){var e,i,s,r,o;return t<=0?-1/0:t>=1?1/0:(o=1,(i=t)>.8646647167633873&&(i=1-i,o=0),i>.1353352832366127?(e=(i-=.5)+i*((r=i*i)*this.polevl(r,this.P0,4)/this.p1evl(r,this.Q0,8)),e*=this.s2pi):(s=1/(e=Math.sqrt(-2*Math.log(i))),e=e-Math.log(e)/e-(e<8?s*this.polevl(s,this.P1,8)/this.p1evl(s,this.Q1,8):s*this.polevl(s,this.P2,8)/this.p1evl(s,this.Q2,8)),0!==o&&(e=-e),e))},erfi:function(t){return this.ndtri(.5*(t+1))*this.SQRTH}};o.A.ProbFuncs;var n=__webpack_require__(733);o.A.Extrapolate={upper:15,infty:1e4,wynnEps:function(t,e,i){var s,r,o,n,a;if(i[e]=t,0===e)a=t;else{for(o=0,s=e;s>0;s--)r=o,o=i[s-1],n=i[s]-o,Math.abs(n)<=1e-15?i[s-1]=1e20:i[s-1]=1*r+1/n;a=i[e%2]}return a},aitken:function(t,e,i){var s,r,o,n,a,h;if(i[e]=t,e<2)s=t;else{for(n=e/2,a=1;a<=n;a++)r=i[(h=e-2*a)+2]-2*i[h+1]+i[h],Math.abs(r)<1e-15?i[h]=1e20:(o=i[h]-i[h+1],i[h]-=o*o/r);s=i[e%2]}return s},brezinski:function(t,e,i){var s,r,o,n,a,h,l,c;if(i[e]=t,e<3)s=t;else{for(h=e/3,c=e,l=1;l<=h;l++)o=i[(c-=3)+1]-i[c],n=i[c+2]-i[c+1],r=(a=i[c+3]-i[c+2])*(n-o)-o*(a-n),Math.abs(r)<1e-15?i[c]=1e20:i[c]=i[c+1]-o*n*(a-n)/r;s=i[e%3]}return s},iteration:function(t,e,i,s,r){var o,n,a,h,l=NaN,c=[],d="finite",u=e;for(r=r||0,o=1;o<=this.upper;o++){if(n=i(t+(u=0===r?e/(o+1):.5*u),!0),a=this[s](n,o-1,c),isNaN(a)){d="NaN";break}if(0!==n&&a/n>this.infty){l=a,d="infinite";break}if(h=a-l,Math.abs(h)<1e-7)break;l=a}return[l,d,1-(o-1)/this.upper]},levin:function(t,e,i,s,r,o){var n,a,h,l;if(l=1/(s+e),r[e]=t/i,o[e]=1/i,e>0&&(r[e-1]=r[e]-r[e-1],o[e-1]=o[e]-o[e-1],e>1))for(h=(s+e-1)*l,n=2;n<=e;n++)a=(s+e-n)*Math.pow(h,n-2)*l,r[e-n]=r[e-n+1]-a*r[e-n],o[e-n]=o[e-n+1]-a*o[e-n],l*=h;return Math.abs(o[0])<1e-15?1e20:r[0]/o[0]},iteration_levin:function(t,e,i,s){var r,o,n,a,h,l,c,d=NaN,u=[],p=[],f="finite",A=e;for(s=s||0,a=i(t+e,!0),r=1;r<=this.upper;r++){if(h=(o=i(t+(A=0===s?e/(r+1):.5*A),!0))-a,c="u"===(Math.abs(h)<1?"u":"t")?(1+r)*h:h,a=o,l=(n=this.levin(o,r-1,c,1,u,p))-d,isNaN(n)){f="NaN";break}if(0!==o&&n/o>this.infty){d=n,f="infinite";break}if(Math.abs(l)<1e-7)break;d=n}return[d,f,1-(r-1)/this.upper]},limit:function(t,e,i){return this.iteration_levin(t,e,i,0)}};var a=o.A.Extrapolate,h=__webpack_require__(571);o.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},s.A.extend(o.A.Quadtree.prototype,{contains:function(t,e){return this.xlbr?a.yub:r,o=a.xub>o?a.xub:o,n=a.ylbthis.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,s,r,o,n),this},insertItem:function(t){var e,i,s,r,o,n,a,h,l=[],c=[],d=[],u=[];return null===this.bbox?(e=r=1/0,s=i=-1/0,e=t.xlbi?t.yub:i,s=t.xub>s?t.xub:s,r=t.ylbthis.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,s,r),this)},subdivide:function(t,e,i,s,r,o,n,a){return t.length>0&&(null===this.northWest&&(this.northWest=new JXG.Math.BoxQuadtree(this.depth,this.capacity,[r,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,[r,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)),s.length>0&&(null===this.southEast&&(this.southEast=new JXG.Math.BoxQuadtree(this.depth,this.capacity,[this.cx,this.cy,n,a])),this.southEast.insert(s)),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},o=[];for(i=this.items.length,e=0;e=this.cy&&s.A.concat(o,this.northWest.find(t)),null!==this.southWest&&t[0]<=this.cx&t[3]<=this.cy&&s.A.concat(o,this.southWest.find(t)),null!==this.northEast&&t[2]>=this.cx&t[1]>=this.cy&&s.A.concat(o,this.northEast.find(t)),null!==this.southEast&&t[2]>=this.cx&t[3]<=this.cy&&s.A.concat(o,this.southEast.find(t)),o},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(),s.A.concat(e,t[0]),s.A.concat(i,t[1])),null!==this.northEast&&(t=this.northEast.plot(),s.A.concat(e,t[0]),s.A.concat(i,t[1])),null!==this.southEast&&(t=this.southEast.plot(),s.A.concat(e,t[0]),s.A.concat(i,t[1])),null!==this.southWest&&(t=this.southWest.plot(),s.A.concat(e,t[0]),s.A.concat(i,t[1])),[e,i]}});var c=o.A.BoxQuadtree,d=__webpack_require__(171);t.A.Math.Nlp={arr:function(t){return new Float64Array(t)},arr2:function(t,e){for(var i=0,s=new Array(t);i=2&&console.log("The initial value of RHO is "+z+" and PARMU is set to zero."),m=0,A=1/z,d=1;d<=e;++d)Z[d][U]=r[d],Z[d][d]=z,Q[d][d]=A;g=U,b=!1;t:for(;;){if(m>=h&&m>0){Y=this.MaxIterationsReached;break t}for(++m,V=t(e,i,r,q),X=0,p=1;p<=i;++p)X=Math.max(X,-q[p]);if(m!==a-1&&3!==a||this.PrintIterationResult(m,V,X,r,e,a),q[F]=V,q[s]=X,v=!0,!b){for(v=!1,d=1;d<=s;++d)tt[d][g]=q[d];if(m<=U){if(g<=e)if(tt[F][U]<=V)r[g]=Z[g][U];else{for(Z[g][U]=r[g],p=1;p<=s;++p)tt[p][g]=tt[p][U],tt[p][U]=q[p];for(p=1;p<=g;++p){for(Z[g][p]=-z,A=0,d=p;d<=g;++d)A-=Q[d][p];Q[g][p]=A}}if(m<=e){r[g=m]+=z;continue t}}b=!0}e:for(;;){i:do{if(!v){for(y=tt[F][U]+J*tt[s][U],C=U,u=1;u<=e;++u)(A=tt[F][u]+J*tt[s][u]).1){Y=this.DivergingRoundingErrors;break t}for(p=1;p<=F;++p){for(q[p]=-tt[p][U],u=1;u<=e;++u)nt[u]=tt[p][u]+q[p];for(d=1;d<=e;++d)et[d][p]=(p===F?-1:1)*this.DOT_PRODUCT_ROW_COL(nt,-1,Q,d,1,e)}for(G=!0,H=.25*z,E=2.1*z,u=1;u<=e;++u){for(x=0,O=0,p=1;p<=e;++p)x+=Q[u][p]*Q[u][p],O+=Z[p][u]*Z[p][u];it[u]=1/Math.sqrt(x),st[u]=Math.sqrt(O),(it[u]E)&&(G=!1)}if(!b&&!G){for(g=0,A=E,u=1;u<=e;++u)st[u]>A&&(g=u,A=st[u]);if(0===g)for(u=1;u<=e;++u)it[u]2*c?-1:1,A=0,d=1;d<=e;++d)ot[d]=S*ot[d],Z[d][g]=ot[d],A+=Q[g][d]*ot[d];for(p=1;p<=e;++p)Q[g][p]/=A;for(u=1;u<=e;++u){if(u!==g)for(A=this.DOT_PRODUCT_ROW_COL(Q,u,ot,-1,1,e),p=1;p<=e;++p)Q[u][p]-=A*Q[g][p];r[u]=Z[u][U]+ot[u]}continue t}if(!(W=this.trstlp(e,i,et,q,z,ot))){for(A=0,p=1;p<=e;++p)A+=ot[p]*ot[p];if(A<.25*z*z){b=!0;break i}}for(c=0,T=0,q[F]=0,p=1;p<=F;++p)c=q[p]-this.DOT_PRODUCT_ROW_COL(ot,-1,et,p,1,e),p0?c/$:0))for(J=2*N,a>=2&&console.log("Increase in PARMU to "+J),D=tt[F][U]+J*tt[s][U],u=1;u<=e;++u)if((A=tt[F][u]+J*tt[s][u])L&&(g=u,L=A),rt[u]=A*it[u];for(R=1.1*z,f=0,u=1;u<=e;++u)if(rt[u]>=H||rt[u]>=it[u]){if(A=st[u],k>0){for(A=0,p=1;p<=e;++p)A+=Math.pow(ot[p]-Z[p][u],2);A=Math.sqrt(A)}A>R&&(f=u,R=A)}if(f>0&&(g=f),0!==g){for(A=0,d=1;d<=e;++d)Z[d][g]=ot[d],A+=Q[g][d]*ot[d];for(p=1;p<=e;++p)Q[g][p]/=A;for(u=1;u<=e;++u)if(u!==g)for(A=this.DOT_PRODUCT_ROW_COL(Q,u,ot,-1,1,e),p=1;p<=e;++p)Q[u][p]-=A*Q[g][p];for(p=1;p<=s;++p)tt[p][g]=q[p];if(k>0&&k>=.1*K)continue e}}while(0);if(G){if(z<=n){Y=this.Normal;break t}if(B=0,I=0,(z*=.5)<=1.5*n&&(z=n),J>0){for(j=0,p=1;p<=F;++p){for(I=B=tt[p][U],d=1;d<=e;++d)B=Math.min(B,tt[p][d]),I=Math.max(I,tt[p][d]);p<=i&&B<.5*I&&(A=Math.max(I,0)-B,j=j<=0?A:Math.min(j,A))}0===j?J=0:I-B=2&&console.log("Reduction in RHO to "+z+" and PARMU = "+J),2===a&&this.PrintIterationResult(m,tt[F][U],tt[s][U],this.COL(Z,U),e,a)}else b=!1}}switch(Y){case this.Normal:if(a>=1&&console.log("%nNormal return from subroutine COBYLA%n"),W)return a>=1&&this.PrintIterationResult(m,V,X,r,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)r[p]=Z[p][U];return V=tt[F][U],X=tt[s][U],a>=1&&this.PrintIterationResult(m,V,X,r,e,a),Y},trstlp:function(t,e,i,s,r,n){var a,h,l,c,d,u,p,f,A,_,m,g,b,v,y,C,P,E,x,O,M,w,S,T,N,D,k,L,R,B,I,j,Y,V=0,X=0,U=0,F=this.arr2(1+t,1+t),z=this.arr(2+e),J=this.arr(2+e),G=this.arr(1+t),W=this.arr(1+t),H=this.arr(2+e),$=this.arr(2+e),K=e,q=0;for(l=1;l<=t;++l)F[l][l]=1,n[l]=0;if(a=0,h=0,e>=1){for(c=1;c<=e;++c)s[c]>h&&(h=s[c],a=c);for(c=1;c<=e;++c)$[c]=c,J[c]=h-s[c]}d=!0;do{t:for(;;){(!d||d&&0===h)&&(a=K=e+1,$[K]=K,J[K]=0),d=!1,u=0,p=0,f=0,A=0;e:do{if(_=K===e?h:-this.DOT_PRODUCT_ROW_COL(n,-1,i,K,1,t),0===p||_X?(X=q,p=3):--p,0===p)break t;if(m=0,a<=q){if(ae)for(V=1/z[q],c=1;c<=t;++c)G[c]=V*F[c][q];else for(V=this.DOT_PRODUCT_ROW_COL(G,-1,F,q+1,1,t),c=1;c<=t;++c)G[c]-=V*F[c][q+1]}else{for(C=$[a],c=1;c<=t;++c)W[c]=i[c][C];for(O=0,c=t;c>q;){for(P=0,M=0,l=1;l<=t;++l)P+=V=F[l][c]*W[l],M+=Math.abs(V);if(w=M+.1*Math.abs(P),S=M+.2*Math.abs(P),(M>=w||w>=S)&&(P=0),0===O)O=P;else for(y=c+1,E=P/(V=o.A.hypot(P,O)),x=O/V,O=V,l=1;l<=t;++l)V=E*F[l][c]+x*F[l][y],F[l][y]=E*F[l][y]-x*F[l][c],F[l][c]=V;--c}if(0===O){m=-1,c=q;do{for(T=0,N=0,l=1;l<=t;++l)T+=V=F[l][c]*W[l],N+=Math.abs(V);if(w=N+.1*Math.abs(T),S=N+.2*Math.abs(T),N0&&$[c]<=e&&(Y=J[c]/V,(m<0||Y=2)for(D=$[c],l=1;l<=t;++l)W[l]-=V*i[l][D];H[c]=V}else H[c]=0}while(--c>0);if(m<0)break t;for(c=1;c<=q;++c)J[c]=Math.max(0,J[c]-m*H[c]);if(ae&&C!==K){for(c=q-1,P=this.DOT_PRODUCT(this.PART(this.COL(F,c),1,t),this.PART(this.COL(i,C),1,t)),V=o.A.hypot(P,z[q]),E=z[q]/V,x=P/V,z[q]=E*z[c],z[c]=V,l=1;l<=t;++l)V=E*F[l][q]+x*F[l][c],F[l][q]=E*F[l][c]-x*F[l][q],F[l][c]=V;$[q]=$[c],$[c]=C,V=J[c],J[c]=J[q],J[q]=V}if(K>e)for(V=1/z[q],c=1;c<=t;++c)G[c]=V*F[c][q];else for(C=$[q],V=(this.DOT_PRODUCT_ROW_COL(G,-1,i,C,1,t)-1)/z[q],c=1;c<=t;++c)G[c]-=V*F[c][q]}for(k=r*r,R=0,L=0,l=1;l<=t;++l)Math.abs(n[l])>=1e-6*r&&(k-=n[l]*n[l]),R+=n[l]*G[l],L+=G[l]*G[l];if(k<=0)break t;if(V=Math.sqrt(L*k),Math.abs(R)>=1e-6*V&&(V=Math.sqrt(L*k+R*R)),f=A=k/(V+R),K===e){if(S=f+.2*h,f>=(w=f+.1*h)||w>=S)break e;f=Math.min(f,h)}for(c=1;c<=t;++c)W[c]=n[c]+f*G[c];if(K===e)for(U=h,h=0,c=1;c<=q;++c)V=s[C=$[c]]-this.DOT_PRODUCT_ROW_COL(W,-1,i,C,1,t),h=Math.max(h,V);c=q;do{for(B=0,I=0,l=1;l<=t;++l)B+=V=F[l][c]*W[l],I+=Math.abs(V);if(w=I+.1*Math.abs(B),S=I+.2*Math.abs(B),(I>=w||w>=S)&&(B=0),H[c]=B/z[c],c>=2)for(C=$[c],l=1;l<=t;++l)W[l]-=H[c]*i[l][C]}while(c-- >=2);for(K>e&&(H[q]=Math.max(0,H[q])),c=1;c<=t;++c)W[c]=n[c]+f*G[c];if(K>q)for(c=q+1;c<=K;++c){for(v=h-s[C=$[c]],j=h+Math.abs(s[C]),l=1;l<=t;++l)v+=V=i[l][C]*W[l],j+=Math.abs(V);w=j+.1*Math.abs(v),S=j+.2*Math.abs(v),(j>=w||w>=S)&&(v=0),H[c]=v}for(m=1,a=0,c=1;c<=K;++c)H[c]<0&&(V=J[c]/(J[c]-H[c]))0);if(f===A)return!0}}while(K===e);return!1},PrintIterationResult:function(t,e,i,s,r,o){o>1&&console.log("NFVALS = "+t+" F = "+e+" MAXCV = "+i),o>1&&console.log("X = "+this.PART(s,1,r))},ROW:function(t,e){return t[e].slice()},COL:function(t,e){var i,s=t.length,r=[];for(i=0;io.A.eps)){s=!0;break}return s},updateParametricCurveNaive:function(t,e,s,r){var o,n,a=!1,h=(s-e)/r;for(o=0;or.canvasHeight&&s>r.canvasHeight||t<0&&i<0||t>r.canvasWidth&&i>r.canvasWidth},isDistOK:function(t,e,i,s){return Math.abs(t)=o.A.eps&&(s=(r*a+n*h)/l)>0&&(s<=1?(r-=s*a,n-=s*h):(r-=a,n-=h)),o.A.hypot(r,n)};for(t.A.deprecated("Curve.updateParametricCurveOld()"),e.board.updateQuality===e.board.BOARD_QUALITY_LOW?(A=15,_=10,m=10):(A=21,_=.7,m=.7),P[0]=r-s,n=1;n1&&O(e.points[x-2].scrCoords,[h,l],e.points[x-1].scrCoords)<.015&&(x-=1),e.points[x]=new u.A(i.A.COORDS_BY_SCREEN,[h,l],e.board,!1),e.points[x]._t=a,x+=1,c=h,d=l,h=C[p-=1][0],l=C[p][1],f=y[p]+1,n=2*v[p]}while(p>0&&x<5e5);return e.numberPoints=e.points.length,e},_insertPoint_v2:function(t,e,i){var s=!isNaN(this._lastCrds[1]+this._lastCrds[2]),r=!isNaN(e.scrCoords[1]+e.scrCoords[2]),o=t.board.canvasWidth,n=t.board.canvasHeight,a=500;(!(r=r&&e.scrCoords[1]>-500&&e.scrCoords[2]>-500&&e.scrCoords[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 s,r,n=new u.A(i.A.COORDS_BY_USER,[0,0],t.board,!1);return s=e+o.A.eps,n.setCoordinates(i.A.COORDS_BY_USER,[t.X(s,!0),t.Y(s,!0)],!1),r=n.usrCoords,!!(isNaN(r[1]+r[2])||(s=e-o.A.eps,n.setCoordinates(i.A.COORDS_BY_USER,[t.X(s,!0),t.Y(s,!0)],!1),r=n.usrCoords,isNaN(r[1]+r[2])))},_borderCase:function(t,e,s,r,o,n,a,h){var l,c,d,p,f,A,_=null,m=!1;if(h<=1){if(c=new u.A(i.A.COORDS_BY_USER,[0,0],t.board,!1),isNaN(e[1]+e[2])&&!isNaN(r[1]+r[2])&&!this.neighborhood_isNaN_v2(t,o))return!1;if(isNaN(s[1]+s[2])&&!isNaN(r[1]+r[2])&&!this.neighborhood_isNaN_v2(t,n))return!1;if(isNaN(r[1]+r[2])&&(!isNaN(e[1]+e[2])||!isNaN(s[1]+s[2]))&&!this.neighborhood_isNaN_v2(t,a))return!1;p=0;do{if(isNaN(e[1]+e[2])&&!isNaN(r[1]+r[2]))f=o,A=a;else if(isNaN(s[1]+s[2])&&!isNaN(r[1]+r[2]))f=n,A=a;else if(isNaN(r[1]+r[2])&&!isNaN(s[1]+s[2]))f=a,A=n;else{if(!isNaN(r[1]+r[2])||isNaN(e[1]+e[2]))return!1;f=a,A=o}l=.5*(f+A),c.setCoordinates(i.A.COORDS_BY_USER,[t.X(l,!0),t.Y(l,!0)],!1),d=c.usrCoords,(m=isNaN(d[1]+d[2]))?f=l:A=l,++p}while(m&&p<30);if(p<30&&(_=d.slice(),r=d.slice(),A=l),null!==_)return this._insertPoint_v2(t,new u.A(i.A.COORDS_BY_USER,_,t.board,!1)),!0}return!1},_plotRecursive_v2:function(t,e,s,r,o,n,a){var h,l,c,d,p,f=0,A=new u.A(i.A.COORDS_BY_USER,[0,0],t.board,!1);if(!(t.numberPoints>65536))return n.99*c[0]||c[1]>.99*c[0]||c[0]===1/0||c[1]===1/0||c[2]===1/0),no.A.eps||Math.abs(n.left_y-n.right_y)>o.A.eps)||((h=new u.A(i.A.COORDS_BY_SCREEN,e,t.board))._t=s,t.points.push(h)),(l=new u.A(i.A.COORDS_BY_USER,[n.right_x,n.right_y],t.board))._t=s,t.points.push(l),this._lastScrCrds=l.copy("scrCoords"),this._lastUsrCrds=l.copy("usrCoords"))},_insertPoint:function(t,e,r,o,n){var a,h=!isNaN(this._lastScrCrds[1]+this._lastScrCrds[2]),l=!isNaN(e[1]+e[2]),c=t.board.canvasWidth,d=t.board.canvasHeight,p=500;s.A.exists(n)?this._insertLimesPoint(t,e,r,o,n):(l=l&&e[1]>-500&&e[2]>-500&&e[1]n+o&&i[1]>n+o||t[2]>a+o&&i[2]>a+o)},_isOutsidePoint:function(t,e){var i=500,s=e.canvasWidth,r=e.canvasHeight;return!!(t[1]<-500||t[2]<-500||t[1]>s+i||t[2]>r+i)},_findStartPoint:function(t,e,i,s,r){return[e,i]},_getBorderPos:function(t,e,s,r,n,a,h){var l,c,d,p,f,A;if(c=new u.A(i.A.COORDS_BY_USER,[0,0],t.board,!1),p=0,isNaN(s[1]+s[2])&&!isNaN(n[1]+n[2]))A=e,f=r;else if(isNaN(h[1]+h[2])&&!isNaN(n[1]+n[2]))A=a,f=r;else if(isNaN(n[1]+n[2])&&!isNaN(h[1]+h[2]))A=r,f=a;else{if(!isNaN(n[1]+n[2])||isNaN(s[1]+s[2]))return!1;A=r,f=e}do{l=.5*(f+A),c.setCoordinates(i.A.COORDS_BY_USER,[t.X(l,!0),t.Y(l,!0)],!1),d=c.usrCoords,isNaN(d[1]+d[2])?A=l:f=l,++p}while(p<30&&Math.abs(f-A)>o.A.eps);return l},_getCuspPos:function(t,e,i){var s=[t.X(e,!0),t.Y(e,!0)],r=[t.X(i,!0),t.Y(i,!0)];return d.A.fminbr(function(e){var i=[t.X(e,!0),t.Y(e,!0)];return-(o.A.hypot(s[0]-i[0],s[1]-i[1])+o.A.hypot(r[0]-i[0],r[1]-i[1]))},[e,i],t)},_getJumpPos:function(t,e,i){return d.A.fminbr(function(e){var i=o.A.eps*o.A.eps,s=[t.X(e,!0),t.Y(e,!0)],r=[t.X(e+i,!0),t.Y(e+i,!0)];return-Math.abs((r[1]-s[1])/(r[0]-s[0]))},[e,i],t)},_getLimits:function(t,e){var i,s,r,o,n,h=2/(t.maxX()-t.minX());return s=(i=a.limit(e,-h,t.X))[0],"infinite"===i[1]&&(s=Math.sign(s)*(1/0)),o=(i=a.limit(e,-h,t.Y))[0],"infinite"===i[1]&&(o=Math.sign(o)*(1/0)),r=(i=a.limit(e,h,t.X))[0],"infinite"===i[1]&&(r=Math.sign(r)*(1/0)),n=(i=a.limit(e,h,t.Y))[0],"infinite"===i[1]&&(n=Math.sign(n)*(1/0)),{left_x:s,left_y:o,right_x:r,right_y:n,t:e}},_getLimes:function(t,e,i,s,r,o,n,a,h){var l;return"border"===a?l=this._getBorderPos(t,e,i,s,r,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,s,r,o){var n,a,h,l,c,d,u,p,f,A,_,m=null,g=!1,b="",v=[],y=0;for(p=t.board.origin.scrCoords,v[y++]=[e,i,s,r,o,1/0];y>0;){if(e=(_=v[--y])[0],i=_[1],s=_[2],r=_[3],f=_[4],A=_[5],g=!1,b="",m=null,t.points.length>65536)return;if(f.66*A||h[0]5*h[2]||h[2]>5*h[1]?b="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)&&(b="jump"),g=""===b&&fn?(g.push({i:s,v:t[s],group:A}),d=s,c||(c=!0)):c&&s>d+4&&(g.length>0&&_.push(g.slice(0)),g=[],c=!1,A++);for(c&&g.length>1&&_.push(g.slice(0)),u&&0===_.length&&(f=!0),r=0;r<_.length;r++)if(m[r]="point",!((o=_[r].length)<64)){for(h=0,a=Math.sign(_[r][0].v),s=1;so&&(m[r]="interval")}return{smooth:f,groups:_,types:m}},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,s){var r,o,n,a,h,l,c=[],d=0,u=0,p=0,f=!1,A=!1;for(n=(i-e)/s,c[d]=new this.Component,l=c[d],r=0,o=e;r<=s;r++,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===r&&(A=!0);return f?l.len=u:c.pop(),c},getPointType:function(t,e,i,s,r,o,n){var a=r[0],h=o[0],l=s.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=s[0],c.x=a[0],c.y=h[0],c):e>n-6?(c.type="borderright",c.idx=l-1,c.t=s[l-1],c.x=a[l-1],c.y=h[l-1],c):c},newtonApprox:function(t,e,i,s,r){var o,n=0;for(o=s;o>0;o--)n=(n+r[o][t])*(e-(o-1)*i)/o;return n+r[0][t]},thiele:function(t,e,i,s,r){var o,n=0;for(o=r;o>1;o--)n=(t-i[s+o])/(e[o][s+1]-e[o-2][s+1]+n);return e[0][s+1]+(t-i[s+1])/(e[1][s+1]+n)},differenceMethodExperiments:function(t,e){var i,s,r,o,n,a,h,l,c,d,u,p=t.t_values,f=t.x_values,A=t.y_values,_=[],m=[],g=[],b=[],v=[],y=[],C=[],P=[],E=0,x=[];for(n=p[1]-p[0],v.push([]),y.push([]),C.push([]),P.push([]),r=A.length,i=0;i0&&++E>1&&s%2==0)break;r--}for(i=0;il&&(l=d,h=c);h=Math.floor(u[i][h].i+s/2),x.push(this.getPointType(e,h,p,f,A,g,b,r+1))}return[x,v,y,C,P]},getCenterOfCriticalInterval:function(t,e,i){var s,r,o,n,a,h=0,l=0,c=i[1]-i[0],d=[];for(s=-1/0,d=[],r=0;rs?(d=[r],s=n,o=r):s===n&&d.push(r);if(d.length>0&&(a=d.reduce(function(t,e){return t+e},0)/d.length,o=Math.floor(a),a+=t[0].i),s<1/0){for(r=0;r=0));s++){if(l.groups.length>0&&++m>2&&(s+1)%2==0){v=l.groups,d=l.types;break}r--}for(i=0;i0&&(h=t.points[t.points.length-1].scrCoords),o=new u.A(i.A.COORDS_BY_USER,e,t.board),null!==h&&(n=o.scrCoords[1]-h[1])*n+(a=o.scrCoords[2]-h[2])*a<.8*.8||(o._t=s,t.points.push(o))},getInterval:function(e,i,s){var r,o;return n.A.disable(),r=n.A.Interval(i,s),e.board.mathLib=n.A,e.board.mathLibJXG=n.A,o=e.Y(r,!0),e.board.mathLib=Math,e.board.mathLibJXG=t.A.Math,o},sign:function(t){return t<0?-1:t>0?1:0},handleBorder:function(t,e,i,r,o){var n,a,h,l,c,d,u,p,f,A,_,m,g=i.idx;if(m=e.t_values[1]-e.t_values[0],"borderleft"===i.type?h=(a=n=e.left_isNaN?e.left_t:i.t-m)+m:"borderright"===i.type?a=(h=n=e.right_isNaN?e.right_t:i.t+m)-m:console.log("No bordercase!!!"),0!==(A=this.findComponents(t,a,h,32)).length){for("borderleft"===i.type&&(a=A[0].left_t,h=A[0].t_values[0],m=A[0].t_values[1]-A[0].t_values[0],n=a=null===a?h-m:a,l=this.getInterval(t,a,h),s.A.isObject(l)&&(u=l.lo,p=l.hi,c=t.X(n,!0),d=o[1][g]<0?p:u,this._insertPoint_v4(t,[1,c,d],n))),_=A[0].t_values.length,f=0;f<_;f++)n=A[0].t_values[f],c=A[0].x_values[f],d=A[0].y_values[f],this._insertPoint_v4(t,[1,c,d],n);"borderright"===i.type&&(a=A[0].t_values[_-1],h=A[0].right_t,m=A[0].t_values[1]-A[0].t_values[0],n=h=null===h?a+m:h,l=this.getInterval(t,a,h),s.A.isObject(l)&&(u=l.lo,p=l.hi,c=t.X(n,!0),d=o[1][g]>0?p:u,this._insertPoint_v4(t,[1,c,d],n)))}},_seconditeration_v4:function(t,e,i,s,r){var o,n,a,h,l,c,d,u,p,f,A,_,m;for(n=e.t_values[i.idx-2],a=e.t_values[i.idx+2],l=this.findComponents(t,n,a,64),d=0;d2?this._recurse_v4(t,e,d,s,r,u,p,h-1):this._insertPoint_v4(t,[1,u,p],d),l=(u-n)*t.board.unitX,c=(p-a)*t.board.unitY,o.A.hypot(l,c)>2?this._recurse_v4(t,d,i,u,p,n,a,h-1):this._insertPoint_v4(t,[1,u,p],d)):this._insertPoint_v4(t,[1,NaN,NaN],d)},handleSingularity:function(t,e,i,r,o){var n,a,h,l,c,d,u,p,f,A,_,m=i.idx,g=100;n=i.t,console.log("HandleSingularity at t =",n),a=e.t_values[m-5],h=e.t_values[m+5],l=this.getInterval(t,a,h),s.A.isObject(l)?(p=l.lo,f=l.hi):o[0][m-1]g?(this._insertPoint_v4(t,[1,u,f],n),_>=-100&&this._insertPoint_v4(t,[1,NaN,NaN],n)):(p===-1/0&&(this._insertPoint_v4(t,[1,u,p],n,!0),this._insertPoint_v4(t,[1,NaN,NaN],n)),f===1/0&&(this._insertPoint_v4(t,[1,NaN,NaN],n),this._insertPoint_v4(t,[1,u,f],n,!0)),i.tg&&this._insertPoint_v4(t,[1,u,p],n)},steps:1021,criticalThreshold:1e3,plot_v4:function(t,e,i,r){var o,n,a,h,l,c,u,p,f,A,_,m,g,b,v,y=(i-e)/r,C=function(e){return t.Y(e,!0)},P=function(e){return-t.Y(e,!0)},E=.5*y;for(a=this.findComponents(t,e,i,r),h=0;h=p+3&&o3&&Math.abs(_[2][o])>.2*Math.abs(_[0][o])&&(m=l.t_values[o],E=.25*y,v=this.getInterval(t,m,m+y),s.A.isObject(v)?_[2][o]>0?this._insertPoint_v4(t,[1,m+E,v.lo],m+E):this._insertPoint_v4(t,[1,m+y-E,v.hi],m+y-E):(g=d.A.fminbr(C,[m,m+y]))<(b=d.A.fminbr(P,[m,m+y]))?(this._insertPoint_v4(t,[1,t.X(g,!0),t.Y(g,!0)],g),this._insertPoint_v4(t,[1,t.X(b,!0),t.Y(b,!0)],b)):(this._insertPoint_v4(t,[1,t.X(b,!0),t.Y(b,!0)],b),this._insertPoint_v4(t,[1,t.X(g,!0),t.Y(g,!0)],g)));u-O){if(g=u,u=Math.min(g,p),p=Math.max(g,p),A=t(f=d.A.fzero(t,[u,p])),Math.abs(A)>Math.max((m-_)*o.A.eps,.001))return!1;if("vertical"===n?(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+o.A.eps,this.curveContainsPoint(v,h,l,2*x,this.config.qdt_box))M;else if((P=this.traceComponent(v,1))[0].length>0){for(a>0&&(h.push(NaN),l.push(NaN)),E=h.length,C=P[0].length,y=1;yx&&c>0&&!1!==(P=this.searchLine(t,e,i,[w,b],n,a,h,l,c-1))&&(h=P[0],l=P[1],a=P[2]),S-(b=f+.01*x)>x&&c>0&&!1!==(P=this.searchLine(t,e,i,[b,S],n,a,h,l,c-1))&&(h=P[0],l=P[1],a=P[2]),[h,l,a]}return!1},curveContainsPoint:function(t,e,i,s,r){var o,n,a,l=t[1],c=t[2];for(n=(a=this.qdt.find([l-r,c+r,l+r,c-r])).length,o=0;o0&&e.length<6&&(e.push(e[e.length-1]),i.push(i[i.length-1])),[e,i]},tracing:function(t,e){var i,s,r,n,a,l,c,d,u,p,f,A,_,m,g,b,v,y,C,P,E=[],x=[],O=[],M=0,w=0,S=!1,T=!1,N=!1,D=this.config.kappa_0,k=this.config.delta_0,L=this.config.alpha_0,R=this.config.h_initial,B=this.config.max_steps,I=e,j=[],Y=[],V=[];if(E=t.slice(1),j.push(E[0]),Y.push(E[1]),!1===(r=this.tangent(E)))return[];this.dfx(E[0],E[1]),this.dfy(E[0],E[1]);do{if(!1===(r=this.tangent(E))){E=x.slice(),j.push(E[0]),Y.push(E[1]);break}if(1===j.length)a=r.slice();else if(2===j.length)V.push(j.length-1);else if(T&&j.length>2&&!N){if(h.A.distPointSegment([1,E[0],E[1]],[1,j[0],Y[0]],[1,j[1],Y[1]])this.config.loop_dir){E=t.slice(1),j.push(E[0]),Y.push(E[1]),S=!0;break}if(this.config.loop_detection){for(v=j.length-1,y=Math.floor(o.A.log2(v)),C=0;C<=y&&!(h.A.distPointSegment([1,E[0],E[1]],[1,j[V[C]-1],Y[V[C]-1]],[1,j[V[C]],Y[V[C]]])this.config.loop_dir));C++);if(C<=y){S=!0;break}for(y=1,P=0,C=0;C<100&&(v+1)%y===0;C++)y*=2,P++;V[P]=v}}x[0]=E[0]+R*I*r[0],x[1]=E[1]+R*I*r[1],w=0;do{A=(c=[this.dfx(x[0],x[1]),this.dfy(x[0],x[1])])[0]*c[0]+c[1]*c[1],d=this.f(x[0],x[1])/A,O[0]=x[0]-c[0]*d,O[1]=x[1]-c[1]*d,0===w?p=Math.abs(d)*Math.sqrt(A):1===w&&(f=Math.abs(d)*Math.sqrt(A)),x[0]=O[0],x[1]=O[1],w++}while(w<20&&Math.abs(this.f(x[0],x[1]))>this.config.tol_newton);if(m=p,_=w>1?f/p:0,n=this.tangent(x),u=o.A.innerProduct(r,n,2),u=Math.max(-1,Math.min(1,u)),g=Math.acos(u),N=!1,h.A.distance(E,x,2)this.config.h_critical);else{if(N=!0,!this.isBifurcation(E,this.config.tol_cusp)){E=x.slice(),j.push(E[0]),Y.push(E[1]);break}I*=-1,g=0}if(!N&&(b=Math.max(Math.sqrt(_/D),Math.sqrt(m/k),g/L),isNaN(b)&&(b=1),R/=b=Math.max(Math.min(b,2),.5),R=Math.min(this.config.h_max,R),b>=2)){if(++M>=3*B)break;T=!1}else E=x.slice(),j.push(E[0]),Y.push(E[1]),T=!0,M++}while(M=this.bbox[0]&&E[1]<=this.bbox[1]&&E[0]<=this.bbox[2]&&E[1]>=this.bbox[3]);return i=[j[(s=j.length)-2],Y[s-2]],E[0]this.bbox[2]&&(E[0]!==i[0]&&(l=(this.bbox[2]-i[0])/(E[0]-i[0]),E[1]!==i[1]&&(E[1]=i[1]+l*(E[1]-i[1]))),E[0]=this.bbox[2]),E[1]this.bbox[1]&&(E[1]!==i[1]&&(l=(this.bbox[1]-i[1])/(E[1]-i[1]),E[0]!==i[0]&&(E[0]=i[0]+l*(E[0]-i[0]))),E[1]=this.bbox[1]),j[s-1]=E[0],Y[s-1]=E[1],[j,Y,S]},isBifurcation:function(t,e){var i,s,r,n,a,h,l,c,d,u,p=o.A.eps*o.A.eps*100;return i=t[0],s=t[1],r=.5*(this.dfx(i+p,s)-this.dfx(i-p,s))/p,n=.5*(this.dfx(i,s+p)-this.dfx(i,s-p))/p,a=.5*(this.dfy(i+p,s)-this.dfy(i-p,s))/p,u=(l=r+(h=.5*(this.dfy(i,s+p)-this.dfy(i,s-p))/p))*l-4*(r*h-n*a),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,s){var r,o=Math.atan2(s*e[1],s*e[0]);return r=d.A.root(function(e){var s=t[0]+i*Math.cos(e),r=t[1]+i*Math.sin(e);return this.f(s,r)},o),[t[0]+i*Math.cos(r),t[1]+i*Math.sin(r)]},updateA:function(t,e,i){var s,r,o=[i[0]-e[0],i[1]-e[1]],n=this.f(i[0],i[1])-this.f(e[0],e[1]);return r=o[0]*o[0]+o[1]*o[1],s=n-(t[0]*o[0]+t[1]*o[1]),s/=r,t[0]+=s*o[0],t[1]+=s*o[1],t},tangent_A:function(t){var e=[-t[1],t[0]],i=o.A.norm(e,2);return o.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=o.A.norm(e,2);return!(ithis.MP_EXPLICIT&&(a.x-n.x)*(a.x-n.x)+(a.y-n.y)*(a.y-n.y)=this.MP_GIVEN){for(;n.ltype===this.MP_OPEN&&n.rtype===this.MP_OPEN;)n=n.next;for(s=0,h=a,o=t.length,u=[],p=[],f=[],A=[null];c=h.next,u.push(c.x-h.x),p.push(c.y-h.y),f.push(this.mp_pyth_add(u[s],p[s])),s>0&&(d=p[s-1]/f[s-1],l=u[s-1]/f[s-1],A.push(Math.atan2(p[s]*l-u[s]*d,u[s]*l+p[s]*d))),s++,(h=c)===n&&(o=s),!(s>=o&&h.ltype!==this.MP_END_CYCLE););s===o?A.push(0):A.push(A[1]),n.ltype===this.MP_OPEN&&((r=n.rx-n.x)*r+(e=n.ry-n.y)*eC&&(u*=Math.pow(C/m,2)),v=u/(u+P),_[p]=v*c,h=-n[p+1]*_[p],g.rtype===this.MP_CURL?(A[p]=0,l[p]=h-n[1]*(this.FRACTION_ONE-v)):(v=(this.FRACTION_ONE-v)/E,h-=n[p]*v,v*=a,l[p]=h-l[p-1]*v,A[p]=-A[p-1]*v),f.ltype===this.MP_END_CYCLE){for(a=0,c=this.FRACTION_ONE;0===(p-=1)&&(p=i),a=l[p]-a*_[p],c=A[p]-c*_[p],p!==i;);for(a/=this.FRACTION_ONE-c,y[i]=a,l[0]=a,D=1;D-1;p--)y[p]=l[p]-y[p+1]*_[p];for(f=t,p=0;b=f.next,O=(x=this.mp_n_sin_cos(y[p]))[0],M=x[1],S=(w=this.mp_n_sin_cos(-n[p+1]-y[p+1]))[0],T=w[1],this.mp_set_controls(f,b,s[p],r[p],M,O,T,S),f=b,++p!==i;);},mp_n_sin_cos:function(t){return[Math.cos(t),Math.sin(t)]},mp_set_controls:function(t,e,i,s,r,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(r,o,n,a,h),l=this.mp_velocity(n,a,r,o,c),(t.right_tension()<0||e.left_tension()<0)&&(r>=0&&n>=0||r<=0&&n<=0)&&(d=Math.abs(r)*a+Math.abs(n)*o)>0&&(d*=1.00024414062,t.right_tension()<0&&this.mp_ab_vs_cd(Math.abs(n),this.FRACTION_ONE,u,d)<0&&(u=Math.abs(n)/d),e.left_tension()<0&&this.mp_ab_vs_cd(Math.abs(r),this.FRACTION_ONE,l,d)<0&&(l=Math.abs(r)/d)),t.rx=t.x+(i*o-s*r)*u,t.ry=t.y+(s*o+i*r)*u,e.lx=e.x-(i*a+s*n)*l,e.ly=e.y-(s*a-i*n)*l,t.rtype=this.MP_EXPLICIT,e.ltype=this.MP_EXPLICIT},mp_pyth_add:function(t,e){return o.A.hypot(t,e)},mp_curl_ratio:function(t,e,i){var s=1/e,r=1/i;return Math.min(4,((3-s)*s*s*t+r*r*r)/(s*s*s*t+(3-r)*r*r))},mp_ab_vs_cd:function(t,e,i,s){return t*e===i*s?0:t*e>i*s?1:-1},mp_velocity:function(t,e,i,s,r){return Math.min(4,(2+Math.sqrt(2)*(t-i/16)*(i-t/16)*(e-s))/(1.5*r*(2+(Math.sqrt(5)-1)*e+(3-Math.sqrt(5))*s)))},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,s,r=[];for(s=t.length,i=0;i=r)continue;if(h=e[o],s.A.exists(h.type)&&"curl"===h.type)a=s.A.evaluate(h.curl),0===o?(i[o].rtype=this.MP_CURL,i[o].set_right_curl(a)):o===r-1?(i[o].ltype=this.MP_CURL,i[o].set_left_curl(a)):(i[o].ltype=this.MP_CURL,i[o].rtype=this.MP_CURL,i[o].lx=a,i[o].rx=a);s.A.exists(h.direction)&&(a=s.A.evaluate(h.direction),s.A.isArray(a)?(!1!==a[0]&&(i[o].lx=a[0]*Math.PI/180,i[o].ltype=this.MP_GIVEN),!1!==a[1]&&(i[o].rx=a[1]*Math.PI/180,i[o].rtype=this.MP_GIVEN)):(i[o].lx=a*Math.PI/180,i[o].rx=a*Math.PI/180,i[o].ltype=i[o].rtype=this.MP_GIVEN)),s.A.exists(h.tension)&&(a=s.A.evaluate(h.tension),s.A.isArray(a)?(!1!==a[0]&&(i[o].ly=s.A.evaluate(a[0])),!1!==a[1]&&(i[o].ry=s.A.evaluate(a[1]))):(i[o].ly=a,i[o].ry=a))}for(this.make_choices(i),o=0;o0)for(e=0;e0&&Math.abs(t[r-1].coords.usrCoords[0]-e.usrCoords[0])e.data.alpha?1:-1}),t[e].length>0){for(o=t[e].length-1,n=(r=(s=t[e][0]).data.path[s.pos])._next,e===h-1&&(r._end=!1),0===s.data.alpha&&"T"===s.data.type?(r.intersection=!0,r.data=s.data,r.neighbour=s.neighbour,r.neighbour.neighbour=r,r.entry_exit=!1,t[e][0]=r):(s._prev=r,s._prev._next=s),i=1;i<=o;i++)(s=t[e][i])._prev=t[e][i-1],s._prev._next=s;(s=t[e][o])._next=n,s._next._prev=s,e===h-1&&(s._end=!0),a=a.concat(t[e])}return a},_inbetween:function(t,e,i){var s,r=o.A.eps*o.A.eps,n=i[1]-e[1],a=i[2]-e[2],h=t[1]-e[1],l=t[2]-e[2];return 0===n&&0===a&&0===h&&0===l||(s=Math.abs(h)l+c){d=!0;break}return d},findIntersections:function(t,e,s){var r,n,a,l,c,d,p,f,A,_,m,g,b,v=[],y=100*o.A.eps,C=t.length,P=e.length,E=[],x=[],O=[],M=!1,w=!1,S=!1;for(n=0;n-y&&v[1]<1-y/f&&v[2]*A>-y&&v[2]<1-y/A||v[1]===1/0&&v[2]===1/0&&o.A.norm(v[0],3)=0&&_<1&&(m="T",a=new u.A(i.A.COORDS_BY_USER,l,s),v[1]=0,v[2]=_,g=new this.Vertex(a,r,v[1],t,"S",m),b=new this.Vertex(a,n,v[2],e,"C",m),g.neighbour=b,b.neighbour=g,x[r].push(g),O[n].push(b)),_=this._inbetween(d,l,c),h.A.distance(l,d,3)>y&&_>=0&&_<1&&(m="T",a=new u.A(i.A.COORDS_BY_USER,d,s),v[1]=_,v[2]=0,g=new this.Vertex(a,r,v[1],t,"S",m),b=new this.Vertex(a,n,v[2],e,"C",m),g.neighbour=b,b.neighbour=g,x[r].push(g),O[n].push(b));continue}S,g=new this.Vertex(a,r,v[1],t,"S",m),b=new this.Vertex(a,n,v[2],e,"C",m),g.neighbour=b,b.neighbour=g,x[r].push(g),O[n].push(b)}}}for(E=this.sortIntersections(x),r=0;r=0?r>=0&&o>=0?"left":"right":r>=0||o>=0?"left":"right"},_classifyDegenerateIntersections:function(t){var e,i,r,n,a,l,c,d,u,p,f,A,_,m,g=!1;for(g,u=h.A.det3p,c=0,t._tours=0;;){if(t.intersection&&"T"===t.data.type&&(e=t._next.coords.usrCoords,i=t._prev.coords.usrCoords,h.A.distance(t.coords.usrCoords,e,3)0&&(p=!0):0===m&&h.A.affineRatio(t.coords.usrCoords,e,n)>0&&(p=!0),p&&(d=n,n=r,r=d,d=f,f=_,_=d,d=A,A=m,m=d),s.A.exists(t.delayedStatus)||(t.delayedStatus=[]),0===f&&0===A?t.delayedStatus=["on","on"]:0===f?(l=this._getPosition(e,n,a.coords.usrCoords,r),t.delayedStatus=["on",l]):0===A?(l=this._getPosition(i,n,a.coords.usrCoords,r),t.delayedStatus=[l,"on"]):0===t.delayedStatus.length&&(this._getPosition(i,n,a.coords.usrCoords,r)!==this._getPosition(e,n,a.coords.usrCoords,r)?t.data.type="X":t.data.type="B")),s.A.exists(t._tours)&&t._tours++,t._tours>3||t._end||c>1e3){c>1e3&&console.log("Clipping: _classifyDegenerateIntersections exit"),s.A.exists(t._tours)&&delete t._tours;break}t.intersection&&c++,t=t._next}},_handleIntersectionChains:function(t){var e,i=0,s="Null",r=!1,o=!1,n=!1;for(n;!0===t.intersection&&("T"===t.data.type&&("on"!==t.delayedStatus[0]&&"on"===t.delayedStatus[1]?(r=!0,e=t,s=t.delayedStatus[0]):r&&"on"===t.delayedStatus[0]&&"on"===t.delayedStatus[1]?t.data.type="B":r&&"on"===t.delayedStatus[0]&&"on"!==t.delayedStatus[1]&&(r=!1,s===t.delayedStatus[1]?(e.data.type="DB",t.data.type="DB"):(e.data.type="DX",t.data.type="DX"))),i++),t._end&&(o=!0),!o||r;){if(i>1e3){console.log("Warning: _handleIntersectionChains: intersection chain reached maximum numbers of iterations");break}t=t._next}},_handleFullyDegenerateCase:function(t,e,s){var r,n,a,l,c,d,p,f,A,_,m,g,b,v,y=[t,e];for(a=0;a<2;a++){for(_=(r=y[a]).length,f=0,v=!0;f<_;f++)if(!r[f].intersection){v=!1;break}if(v)for(m=(n=y[(a+1)%2]).length,f=0;f<_;f++){for(c=r[f].coords.usrCoords,d=r[f]._next.coords.usrCoords,l=[.5*(c[0]+d[0]),.5*(c[1]+d[1]),.5*(c[2]+d[2])],A=0,g=!1;A1e4);)n++},_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){var s,r,o,n,a=0,h=1e4,l=0,c=[],d=!1,u=!1;for(u;l0&&c.push([NaN,NaN]),n=o.data.idx,s=t,d=this._addVertex(c,o,u),r=o.entry_exit;do{if(d)break;if("intersection"===i&&"entry"===o.entry_exit||"union"===i&&"exit"===o.entry_exit||"difference"===i&&s===t==("exit"===o.entry_exit)){u;do{if(o=o._next,d=this._addVertex(c,o,u))break}while(this._stayOnPath(o,r));a++}else{u;do{if(o=o._prev,d=this._addVertex(c,o,u))break}while(this._stayOnPath(o,r));a++}if(d)break;if(!o.neighbour)return console.log("Tracing: emergency break - no neighbour!!!!!!!!!!!!!!!!!",a),[[0],[0]];if((o=o.neighbour).data.done)break;o.data.done=!0,r=o.entry_exit,s=o.data.path}while(o.data.idx!==n&&a=h&&console.log("Tracing: stopping an infinite loop!",a),l++}return this._getCoordsArrays(c,!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,s=[],r=[],o=t.length;for(i=0;i0&&(t[0].coords?(s.push(t[0].coords.usrCoords[1]),r.push(t[0].coords.usrCoords[2])):(s.push(t[0][0]),r.push(t[0][1]))),[s,r]},handleEmptyIntersection:function(t,e,i){var r,o,n=!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(o=e[0];o.intersection&&!(o=o._next)._end;);return 0===h.A.windingNumber(r.coords.usrCoords,e)?0!==h.A.windingNumber(o.coords.usrCoords,t)?("union"===i?(s.A.concat(a,t),a.push(t[0])):"difference"===i&&(s.A.concat(a,t),a.push(t[0]),h.A.signedPolygon(t)*h.A.signedPolygon(e)>0&&a.reverse(),a.push([NaN,NaN])),"difference"!==i&&"intersection"!==i||(s.A.concat(a,e),a.push(e[0]),n=!1)):"difference"===i?(s.A.concat(a,t),n=!0):"union"===i&&(s.A.concat(a,t),a.push(t[0]),a.push([NaN,NaN]),s.A.concat(a,e),a.push(e[0])):"intersection"===i?(s.A.concat(a,t),n=!0):"union"===i&&(s.A.concat(a,e),a.push(e[0])),this._getCoordsArrays(a,n)},_countCrossingIntersections:function(t){var e,i=t.length,s=0;for(e=0;e0&&h.A.distance(c[0].coords.usrCoords,c[r-1].coords.usrCoords,3)0&&h.A.distance(d[0].coords.usrCoords,d[r-1].coords.usrCoords,3)-1?this.monomials[i].coefficient+=e*t.coefficient:(t.coefficient*=e,this.monomials.push(t))},add:function(t){var e;if(!s.A.exists(t)||t.ring!==this.ring)throw new Error("JSXGraph error: In JXG.Math.Poly.polynomial.add either summand is undefined or rings don't match.");if(s.A.isArray(t.exponents))this.addSubMonomial(t,1);else for(e=0;e0?o-.5:h),function(){var o=JXG.evaluate(e),a=JXG.evaluate(i),l=o[0]+h*(o[1]-o[0])/s,c=a[0]+n*(a[1]-a[0])/r,d=t.F(l,c);return 4===d.length?d.slice(1):d}}(o,n,h)),n>0&&(a=u.length-1,n%2==1?o>0&&(p.push([a-1,a,a-2-s]),o0&&p.push([a,a-2-s,a-1]),p.push([a,a-1-s,a-2-s])));return[u,p]},rectangulation:function(t,e,i,s,r){var o,n,a,h=[],l=[];for(n=0;n<=r;n++)for(o=0;o<=s;o++)h.push(function(o,n){return function(){var a=JXG.evaluate(e),h=JXG.evaluate(i),l=a[0]+o*(a[1]-a[0])/s,c=h[0]+n*(h[1]-h[0])/r,d=t.F(l,c);return 4===d.length?d.slice(1):d}}(o,n)),o>0&&n>0&&(a=h.length-1,l.push([a-1,a,a-1-s,a-1-s-1]));return[h,l]}};var b=o.A.Tiling,v=__webpack_require__(378);t.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]]},t.A.extend(t.A.AbstractRenderer.prototype,{_updateVisual:function(t,e,i){(i||this.enhancedRendering)&&(e=e||{},this.setObjectTransition(t),this.setClipPath(t,!!t.evalVisProp("clip")),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=!1;return s.A.exists(t.board)&&s.A.exists(t.board.highlightedObjects)||(e=!0),!e&&s.A.exists(t.board.highlightedObjects[t.id])?"highlight":""},drawPoint:function(t){var e,i=v.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"),s=v.A.normalizePointFace(t.evalVisProp("face")),r=t.evalVisProp("sizeunit"),o=t.evalVisProp("zoom");isNaN(t.coords.scrCoords[2]+t.coords.scrCoords[1])||("user"===r&&(i*=Math.sqrt(Math.abs(t.board.unitX*t.board.unitY))),e=0===(i*=t.board&&o?Math.sqrt(t.board.zoomX*t.board.zoomY):1)?0:i+1,"o"===s?this.updateEllipsePrim(t.rendNode,t.coords.scrCoords[1],t.coords.scrCoords[2],e,e):"[]"===s?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,s),t.board),this._updateVisual(t,{dash:!1,shadow:!1}),this.setShadow(t))},changePointStyle:function(t){var e=this.getElementById(t.id);s.A.exists(e)&&this.remove(e),this.drawPoint(t),s.A.clearVisPropOld(t),t.visPropCalc.visible||this.display(t,!1),t.evalVisProp("draft")&&this.setDraft(t)},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 s,r,o=e?"highlight":"";s=e&&t.evalVisProp("highlightstrokewidth")?Math.max(t.evalVisProp("highlightstrokewidth"),t.evalVisProp("strokewidth")):t.evalVisProp("strokewidth"),r=this.getArrowHeadData(t,s,o),this.makeArrows(t,r),t.elementClass===i.A.OBJECT_CLASS_LINE?this.updateLineWithEndings(t,r):t.elementClass===i.A.OBJECT_CLASS_CURVE&&this.updatePath(t),this.setArrowSize(t,r)},getArrowHeadData:function(t,e,r){var n,a,h,l,c=o.A.eps,d=0,u=0,p=0,f=0,A=t.evalVisProp("firstarrow"),_=t.evalVisProp("lastarrow");return(A||_)&&(n=s.A.exists(A.type)?t.eval(A.type):t.elementClass===i.A.OBJECT_CLASS_LINE?1:7,a=s.A.exists(_.type)?t.eval(_.type):t.elementClass===i.A.OBJECT_CLASS_LINE?1:7,A&&(l=6,s.A.exists(A.size)&&(l=t.eval(A.size)),""!==r&&s.A.exists(A[r+"size"])&&(l=t.eval(A[r+"size"])),h=e*l,2===n?(h*=.5,c+=e*l):3===n?(h=e*l/3,c+=e):4===n||5===n||6===n?(h=e*l/1.5,c+=e*l):7===n?(h=0,l=10,c+=e):c+=e*l,d+=h,p=l),_&&(l=6,s.A.exists(_.size)&&(l=t.eval(_.size)),""!==r&&s.A.exists(_[r+"size"])&&(l=t.eval(_[r+"size"])),h=e*l,2===a?(h*=.5,c+=e*l):3===a?(h=e*l/3,c+=e):4===a||5===a||6===a?(h=e*l/1.5,c+=e*l):7===a?(h=0,l=10,c+=e):c+=e*l,u+=h,f=l)),t.visPropCalc.typeFirst=n,t.visPropCalc.typeLast=a,{evFirst:A,evLast:_,typeFirst:n,typeLast:a,offFirst:d,offLast:u,sizeFirst:p,sizeLast:f,showFirst:1,showLast:1,minLen:c,strokeWidth:e}},updateLineWithEndings:function(t,e){var s,r,o=null;return s=new u.A(i.A.COORDS_BY_USER,t.point1.coords.usrCoords,t.board),r=new u.A(i.A.COORDS_BY_USER,t.point2.coords.usrCoords,t.board),o=t.evalVisProp("margin"),t.evalVisProp("clip")||(o+=4096),h.A.calcStraight(t,s,r,o),this.handleTouchpoints(t,s,r,e),this.getPositionArrowHead(t,s,r,e),this.updateLinePrim(t.rendNode,s.scrCoords[1],s.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,s,r){var o,n,a,h,l;return(r.evFirst||r.evLast)&&(n=a=h=l=0,o=e.distance(i.A.COORDS_BY_SCREEN,s),r.evFirst&&"vml"!==t.board.renderer.type&&(o>=r.minLen?(n=(s.scrCoords[1]-e.scrCoords[1])*r.offFirst/o,a=(s.scrCoords[2]-e.scrCoords[2])*r.offFirst/o):r.showFirst=0),r.evLast&&"vml"!==t.board.renderer.type&&(o>=r.minLen?(h=(s.scrCoords[1]-e.scrCoords[1])*r.offLast/o,l=(s.scrCoords[2]-e.scrCoords[2])*r.offLast/o):r.showLast=0),e.setCoordinates(i.A.COORDS_BY_SCREEN,[e.scrCoords[1]+n,e.scrCoords[2]+a],!1,!0),s.setCoordinates(i.A.COORDS_BY_SCREEN,[s.scrCoords[1]-h,s.scrCoords[2]-l],!1,!0)),this},handleTouchpoints:function(t,e,s,r){var o,n,a,h,l,c,d;return(r.evFirst||r.evLast)&&(a=h=l=c=d=0,o=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(i.A.COORDS_BY_SCREEN,s),h=(s.scrCoords[1]-e.scrCoords[1])*o/a,l=(s.scrCoords[2]-e.scrCoords[2])*o/a),r.evLast&&t.evalVisProp("touchlastpoint")&&t.point2.evalVisProp("visible")&&(a=e.distance(i.A.COORDS_BY_SCREEN,s),c=(s.scrCoords[1]-e.scrCoords[1])*n/a,d=(s.scrCoords[2]-e.scrCoords[2])*n/a),e.setCoordinates(i.A.COORDS_BY_SCREEN,[e.scrCoords[1]+h,e.scrCoords[2]+l],!1,!0),s.setCoordinates(i.A.COORDS_BY_SCREEN,[s.scrCoords[1]-c,s.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])>o.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){},displayLogo:function(t,e){},drawInternalText:function(t){},updateInternalText:function(t){},drawText:function(t){var i,r,o,n;"html"===t.evalVisProp("display")&&e.A.isBrowser&&"no"!==this.type?((i=this.container.ownerDocument.createElement("div")).style.position="absolute",i.className=t.evalVisProp("cssclass"),o=t.evalVisProp("layer"),s.A.exists(o)||(o=0),r=""===this.container.style.zIndex?0:parseInt(this.container.style.zIndex,10),i.style.zIndex=r+o,this.container.appendChild(i),i.setAttribute("id",this.container.id+"_"+t.id)):i=this.drawInternalText(t),t.rendNode=i,t.htmlStr="",t.visProp.islabel&&s.A.exists(t.visProp.anchor)?(n=t.visProp.anchor.evalVisProp("visible"),t.prepareUpdate().updateVisibility(n)):t.prepareUpdate().updateVisibility(),this.updateText(t)},updateClipPath:function(t,e){var i,s,r,o,n=t.rendNode.offsetWidth,a=t.rendNode.offsetHeight,h=t.rendNode.style.inset.split(" "),l=t.board.canvasWidth,c=t.board.canvasHeight;void 0===e&&(e=t.evalVisProp("clip")),e?("auto"!==h[3]?r=l-(i=parseFloat(h[3])):i=l-(r=parseFloat(h[1])+n),"auto"!==h[0]?o=c-(s=parseFloat(h[0])):s=c-(o=parseFloat(h[2])+a),t.rendNode.style.clipPath="rect("+-s+"px "+r+"px "+o+"px "+-i+"px)"):t.rendNode.style.removeProperty("clip-path")},updateText:function(e){var i,r,o,n,a,h,l,c,d,u,p,f=e.plaintext;if(e.visPropCalc.visible)if(this.updateTextStyle(e,!1),"html"===e.evalVisProp("display")&&"no"!==this.type){if(isNaN(e.coords.scrCoords[1]+e.coords.scrCoords[2])||(r=e.coords.scrCoords[1],r=Math.abs(r)<1e6?r:1e6,"right"===(a=e.getAnchorX())?(i=e.board.canvasWidth-r,u="right"):"middle"===a?(i=r-.5*e.size[0],u="center"):(i=r,u="left"),e.visPropOld.left!==a+i&&("right"===a?(e.rendNode.style.right=i+"px",e.rendNode.style.left="auto"):(e.rendNode.style.left=i+"px",e.rendNode.style.right="auto"),e.visPropOld.left=a+i),r=e.coords.scrCoords[2]+this.vOffsetText,r=Math.abs(r)<1e6?r:1e6,"bottom"===(h=e.getAnchorY())?(i=e.board.canvasHeight-r,p="bottom"):"middle"===h?(i=r-.5*e.size[1],p="center"):(i=r,p="top"),e.visPropOld.top!==h+i&&("bottom"===h?(e.rendNode.style.top="auto",e.rendNode.style.bottom=i+"px"):(e.rendNode.style.bottom="auto",e.rendNode.style.top=i+"px"),e.visPropOld.top=h+i)),e.htmlStr!==f){try{e.type===s.A.OBJECT_TYPE_BUTTON?e.rendNodeButton.innerHTML=f:e.type===s.A.OBJECT_TYPE_CHECKBOX||e.type===s.A.OBJECT_TYPE_INPUT?e.rendNodeLabel.innerHTML=f:e.rendNode.innerHTML=f}catch(t){o=e.rendNode.parentNode,e.rendNode.parentNode.removeChild(e.rendNode),e.rendNode.innerHTML=f,o.appendChild(e.rendNode)}if(e.htmlStr=f,e.evalVisProp("usemathjax"))try{MathJax.typeset?MathJax.typeset([e.rendNode]):MathJax.Hub.Queue(["Typeset",MathJax.Hub,e.rendNode])}catch(e){t.A.debug("MathJax (not yet) loaded")}else if(e.evalVisProp("usekatex"))try{(n=0===e.rendNode.innerHTML.indexOf("0&&(e.rendNode.innerHTML.indexOf("0||e.rendNode.innerHTML.indexOf("0)?e.rendNodeLabel:0===e.rendNode.innerHTML.indexOf("127&&i<2048?(s+=String.fromCharCode(i>>6|192),s+=String.fromCharCode(63&i|128)):(s+=String.fromCharCode(i>>12|224),s+=String.fromCharCode(i>>6&63|128),s+=String.fromCharCode(63&i|128));return s},decode:function(t){var e,i,s,r=0,o=0,n=0,a=[],h=t.length,l=[];for(e=0;e>s&i,0===(n=C[256+n+s])&&(o>65535?a.push(55232+(o>>10),56320+(1023&o)):a.push(o),++r%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;case 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}};var P=t.A.Util.UTF8,E="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",x="=";t.A.Util=t.A.Util||{},t.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,s,r,o,n=[];for(r=(s=(o=P.encode(t)).length)%3,e=0;e>18),E.charAt(i>>12&63),E.charAt(i>>6&63),E.charAt(63&i));switch(r){case 1:i=this._getByte(o,s-1),n.push(E.charAt(i>>2),E.charAt(i<<4&63),x,x);break;case 2:i=this._getByte(o,s-2)<<8|this._getByte(o,s-1),n.push(E.charAt(i>>10),E.charAt(i>>4&63),E.charAt(i<<2&63),x)}return n.join("")},decode:function(t,e){var i,s,r,o,n,a,h=[],l=[];if((r=(i=t.replace(/[^A-Za-z0-9+/=]/g,"")).length)%4!=0)throw new Error("JSXGraph/utils/base64: Can't decode string (invalid input length).");for(i.charAt(r-1)===x&&(o=1,i.charAt(r-2)===x&&(o=2),r-=4),s=0;s>16,n>>8&255,255&n),s%1e4==0&&(h.push(String.fromCharCode.apply(null,l)),l=[]);switch(o){case 1:n=this._getIndex(i,r)<<12|this._getIndex(i,r+1)<<6|this._getIndex(i,r+2),l.push(n>>10,n>>2&255);break;case 2:n=this._getIndex(i,s)<<6|this._getIndex(i,s+1),l.push(n>>4)}return h.push(String.fromCharCode.apply(null,l)),a=h.join(""),e&&(a=P.decode(a)),a},decodeAsArray:function(t){var e,i=this.decode(t),s=[],r=i.length;for(e=0;e\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');var M=t.A.FileReader,w=__webpack_require__(86),S=__webpack_require__(428),T=__webpack_require__(873);t.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;e0;r--)l+=e[h[r-1]];if(!s.A.exists(this.elementsByName[l+a]))return l+a}for(h[0]=e.length,r=1;r=1e3&&(e=!0),e&&(this.touchMoveLast=i),e},getCoordsTopLeftCorner:function(){var t,i,r,o,n,a=this.document.ownerDocument||this.document,h=a.documentElement||this.document.body.parentNode,l=a.body,c=this.containerObj;if(this.cPos.length>0&&(this.mode===this.BOARD_MODE_DRAG||this.mode===this.BOARD_MODE_MOVE_ORIGIN||(new Date).getTime()-this.positionAccessLast<1e3))return this.cPos;if(this.positionAccessLast=(new Date).getTime(),c.getBoundingClientRect){for(r=c.getBoundingClientRect(),o=1,n=c;n&&s.A.exists(n.parentNode);)s.A.exists(n.style)&&s.A.exists(n.style.zoom)&&""!==n.style.zoom&&(o*=parseFloat(n.style.zoom)),n=n.parentNode;return(t=[r.left*o,r.top*o])[0]+=e.A.getProp(c,"border-left-width"),t[1]+=e.A.getProp(c,"border-top-width"),"vml"!==this.renderer.type&&(t[0]+=e.A.getProp(c,"padding-left"),t[1]+=e.A.getProp(c,"padding-top")),this.cPos=t.slice(),this.cPos}return t=e.A.getOffset(c),i=this.document.documentElement.ownerDocument,!this.containerObj.currentStyle&&i.defaultView&&(t[0]+=e.A.getProp(h,"margin-left"),t[1]+=e.A.getProp(h,"margin-top"),t[0]+=e.A.getProp(h,"border-left-width"),t[1]+=e.A.getProp(h,"border-top-width"),t[0]+=e.A.getProp(h,"padding-left"),t[1]+=e.A.getProp(h,"padding-top")),l&&(t[0]+=e.A.getProp(l,"left"),t[1]+=e.A.getProp(l,"top")),"object"==typeof google&&google.translate&&(t[0]+=10,t[1]+=25),t[0]+=e.A.getProp(c,"border-left-width"),t[1]+=e.A.getProp(c,"border-top-width"),"vml"!==this.renderer.type&&(t[0]+=e.A.getProp(c,"padding-left"),t[1]+=e.A.getProp(c,"padding-top")),t[0]+=this.attr.offsetx,t[1]+=this.attr.offsety,this.cPos=t.slice(),this.cPos},getPointLoc:function(t,e){var i,r,o,n;return i=this.getBoundingBox(),2===(r=t).length&&r.unshift(void 0),o=[0,0],n=e||0,s.A.isNumber(n)&&(n=[n,n,n,n]),r[1]>i[2]-n[1]&&(o[0]=1),r[1]i[1]-n[0]&&(o[1]=1),r[2]u.visProp.layer||n.visProp.layer===u.visProp.layer&&n.lastDragTime.getTime()>=u.lastDragTime.getTime())&&(this.attr.ignorelabels&&s.A.exists(u.label)&&n===u.label||(u=n,l.push(u),s.A.exists(u.coords)?u.elementClass===i.A.OBJECT_CLASS_POINT||u.relativeCoords?c.push(p.A.subtract(u.coords.scrCoords.slice(1),[t,e])):c.push(p.A.subtract(u.actualCoords.scrCoords.slice(1),[t,e])):c.push([0,0])));return this.attr.drag.enabled&&l.length>0&&(this.mode=this.BOARD_MODE_DRAG),this.attr.takefirst?(l.length=1,this._drag_offset=c[0]):(l=l.slice(-1),this._drag_offset=c[c.length-1]),this._drag_offset||(this._drag_offset=[0,0]),"svg"===this.renderer.type&&s.A.exists(l[0])&&1===l.length&&s.A.exists(l[0].rendNode)&&(l[0].evalVisProp("dragtotopoflayer")&&l[0].rendNode.parentNode.appendChild(l[0].rendNode),l[0].hasLabel&&"html"===l[0].label.evalVisProp("display")&&l[0].label.evalVisProp("dragtotopoflayer")&&l[0].label.rendNode.parentNode.appendChild(l[0].label.rendNode)),l.length>=1&&(l[0].highlight(!0),this.triggerEventHandlers(["mousehit","hit"],[r,l[0]])),l},moveObject:function(t,e,r,o,n){var a,h,l,c=new u.A(i.A.COORDS_BY_SCREEN,this.getScrCoordsOfMouse(t,e),this);r&&r.obj&&((a=r.obj).coords&&(h=a.coords.scrCoords.slice()),this.addLogEntry("drag",a,c.usrCoords.slice(1)),this.drag_position=[c.scrCoords[1],c.scrCoords[2]],this.drag_position=p.A.add(this.drag_position,this._drag_offset),this._shiftKey=o.shiftKey,this._ctrlKey=o.ctrlKey,s.A.exists(a.coords)?a.setPositionDirectly(i.A.COORDS_BY_SCREEN,this.drag_position,[t,e]):(this.displayInfobox(!1),isNaN(r.targets[0].Xprev+r.targets[0].Yprev)||a.setPositionDirectly(i.A.COORDS_BY_SCREEN,[c.scrCoords[1],c.scrCoords[2]],[r.targets[0].Xprev,r.targets[0].Yprev]),r.targets[0].Xprev=c.scrCoords[1],r.targets[0].Yprev=c.scrCoords[2]),s.A.exists(a.coords)&&(a.prepareUpdate().update(!1).updateRenderer(),this.updateInfobox(a),a.prepareUpdate().update(!0).updateRenderer()),a.coords&&(l=a.coords.scrCoords),a.coords&&h[1]===l[1]&&h[2]===l[2]||(a.triggerEventHandlers([n+"drag","drag"],[o]),this.update(a)),a.highlight(!0),this.triggerEventHandlers(["mousehit","hit"],[o,a]),a.lastDragTime=new Date)},twoFingerMove:function(t,e,r){var o;s.A.exists(t)&&s.A.exists(t.obj)&&((o=t.obj).elementClass===i.A.OBJECT_CLASS_LINE||o.type===i.A.OBJECT_TYPE_POLYGON?this.twoFingerTouchObject(t.targets,o,e):o.elementClass===i.A.OBJECT_CLASS_CIRCLE&&this.twoFingerTouchCircle(t.targets,o,e),r&&o.triggerEventHandlers(["touchdrag","drag"],[r]))},getTwoFingerTransform(t,e,s,r){var n,a,h,l,c,d,p,f,A,_,m,g,b,v,y,C,P;return a=(n=new u.A(i.A.COORDS_BY_SCREEN,[t.Xprev,t.Yprev],this).usrCoords)[1],h=n[2],l=(n=new u.A(i.A.COORDS_BY_SCREEN,[e.Xprev,e.Yprev],this).usrCoords)[1],c=n[2],f=(n=new u.A(i.A.COORDS_BY_SCREEN,[t.X,t.Y],this).usrCoords)[1],A=n[2],v=((g=(_=(n=new u.A(i.A.COORDS_BY_SCREEN,[e.X,e.Y],this).usrCoords)[1])-f)*(d=l-a)+(b=(m=n[2])-A)*(p=c-h))/(C=d*d+p*p),y=(b*d-g*p)/C,s||(v/=P=o.A.hypot(v,y),y/=P),r||(y=0),[1,0,0,.5*(f+_-v*(a+l)+y*(h+c)),v,-y,.5*(A+m-y*(a+l)-v*(h+c)),y,v]},twoFingerTouchObject:function(t,e,r){var o,n,a,h,l,c=!1;if(s.A.exists(t[0])&&s.A.exists(t[1])&&!isNaN(t[0].Xprev+t[0].Yprev+t[1].Xprev+t[1].Yprev)){if(n=this.getTwoFingerTransform(t[0],t[1],e.evalVisProp("scalable"),e.evalVisProp("rotatable")),(o=this.create("transform",n,{type:"generic"})).update(),e.elementClass===i.A.OBJECT_CLASS_LINE)a=[],e.point1.draggable()&&a.push(e.point1),e.point2.draggable()&&a.push(e.point2),o.applyOnce(a);else if(e.type===i.A.OBJECT_TYPE_POLYGON){for(l=e.vertices.length-1,c=e.evalVisProp("snaptogrid")||e.evalVisProp("snaptopoints"),h=0;h0&&a.push(e.points[0].usrCoords);else try{a.push(e.coords.usrCoords)}catch(e){t.A.debug("JSXGraph+ saveStartPos: obj.coords.usrCoords not available: "+e)}for(n=a.length,o=0;o0&&e.A.isBrowser){for(t=0;t.2*Math.PI&&Math.abs(n)<1.8*Math.PI&&(g=!0),"pan"===this.isPreviousGesture||g||(Math.abs(t.scale)<.77||Math.abs(t.scale)>1.3)&&(g=!0),a=t.scale/this.prevScale,this.prevScale=t.scale,this.prevCoords=[[t.touches[0].clientX,t.touches[0].clientY],[t.touches[1].clientX,t.touches[1].clientY]],e=new u.A(i.A.COORDS_BY_SCREEN,this.getMousePosition(t,0),this),this.attr.pan.enabled&&this.attr.pan.needtwofingers&&!g?(this.isPreviousGesture="pan",this.moveOrigin(e.scrCoords[1],e.scrCoords[2],!0)):this.attr.zoom.enabled&&Math.abs(a-1)<.5&&(y=!1,p=this.attr.zoom.center,(this.attr.zoom.pinchhorizontal||this.attr.zoom.pinchvertical)&&(f=Math.abs(t.touches[0].clientX-t.touches[1].clientX),A=Math.abs(t.touches[0].clientY-t.touches[1].clientY),c=Math.abs(Math.atan2(A,f)),d=Math.PI*this.attr.zoom.pinchsensitivity/90),!this.keepaspectratio&&this.attr.zoom.pinchhorizontal&&c0&&this.dehighlightAll(),this.updateQuality=this.BOARD_QUALITY_HIGH,this.mode=this.BOARD_MODE_NONE,this._board_touches=[],this.touches=[]},_getPointerInputDevice:function(t){if(e.A.isBrowser){if("touch"===t.pointerType||window.navigator.msMaxTouchPoints&&window.navigator.msMaxTouchPoints>1)return"touch";if("mouse"===t.pointerType)return"mouse";if("pen"===t.pointerType)return"pen"}return"mouse"},pointerDownListener:function(t,i,r){var o,n,a,h,l,c,d,u,p,f,A;if(!i&&this._isPointerRegistered(t))return!1;if(null===s.A.evaluate(this.attr.movetarget)&&s.A.exists(t.target)&&s.A.exists(t.target.releasePointerCapture)&&t.target.releasePointerCapture(t.pointerId),!i&&t.isPrimary,this.hasPointerUp||(window.navigator.msPointerEnabled?e.A.addEvent(this.document,"MSPointerUp",this.pointerUpListener,this):(e.A.addEvent(this.document,"pointerup",this.pointerUpListener,this),e.A.addEvent(this.document,"pointercancel",this.pointerUpListener,this)),this.hasPointerUp=!0),this.hasMouseHandlers&&this.removeMouseEventHandlers(),this.hasTouchHandlers&&this.removeTouchEventHandlers(),this.document.selection&&s.A.isFunction(this.document.selection.empty))this.document.selection.empty();else if(window.getSelection&&(c=window.getSelection()).removeAllRanges)try{c.removeAllRanges()}catch(t){}if(this._inputDevice=this._getPointerInputDevice(t),u=this._inputDevice,this.options.precision.hasPoint=this.options.precision[u],h=this.getMousePosition(t),this._testForSelection(t),this.selectingMode)return this._startSelecting(h),void this.triggerEventHandlers(["touchstartselecting","pointerstartselecting","startselecting"],[t]);if(this.attr.drag.enabled&&i?(l=[i],this.mode=this.BOARD_MODE_DRAG):l=this.initMoveObject(h[0],h[1],t,u),d={num:t.pointerId,X:h[0],Y:h[1],Xprev:NaN,Yprev:NaN,Xstart:[],Ystart:[],Zstart:[]},l.length>0){for(f=l[l.length-1],p=!1,o=0;o0&&!r&&(t.preventDefault(),t.stopPropagation()),!!e.A.isBrowser&&("touch"!==this._getPointerInputDevice(t)?this.mode===this.BOARD_MODE_NONE&&this.mouseOriginMoveStart(t):(this._pointerStorePosition(t),t.touches=this._board_touches,1===t.touches.length&&this.mode===this.BOARD_MODE_NONE&&this.touchStartMoveOriginOneFinger(t)||2!==t.touches.length||this.mode!==this.BOARD_MODE_NONE&&this.mode!==this.BOARD_MODE_MOVE_ORIGIN||(this.mode===this.BOARD_MODE_MOVE_ORIGIN&&this.originMoveEnd(),this.gestureStartListener(t))),this.initSketchCurve(t),A="none",this.mode!==this.BOARD_MODE_NONE||!0!==s.A.evaluate(this.attr.browserpan)&&!0!==s.A.evaluate(this.attr.browserpan.enabled)||!1!==s.A.evaluate(this.attr.pan.enabled)&&!0!==s.A.evaluate(this.attr.pan.needtwofingers)||(A="auto"),this.containerObj.style.touchAction=A,this.triggerEventHandlers(["touchstart","down","pointerdown","MSPointerDown"],[t]),!0)},_handleClicks:function(t,e){var i,r,o=this;if(this.selectingMode)t.stopPropagation();else{if(r=s.A.evaluate(this.attr.clickdelay),s.A.evaluate(this.attr.dblclicksuppressclick))this._preventSingleClick=!1,this._singleClickTimer=setTimeout(function(){if(!o._preventSingleClick)for(i in o.triggerEventHandlers(e,[t]),o.clickObjects)o.clickObjects.hasOwnProperty(i)&&(o.clickObjects[i].triggerEventHandlers(e,[t]),delete o.clickObjects[i])},r);else{for(i in o.triggerEventHandlers(e,[t]),o.clickObjects)o.clickObjects.hasOwnProperty(i)&&o.clickObjects[i].triggerEventHandlers(e,[t]);setTimeout(function(){for(i in o.clickObjects)o.clickObjects.hasOwnProperty(i)&&delete o.clickObjects[i]},r)}t.stopPropagation()}},_handleDblClicks:function(t,e){var i;if(this.selectingMode)t.stopPropagation();else{for(i in this._preventSingleClick=!0,clearTimeout(this._singleClickTimer),this.triggerEventHandlers(e,[t]),this.clickObjects)this.clickObjects.hasOwnProperty(i)&&(this.clickObjects[i].triggerEventHandlers(e,[t]),delete this.clickObjects[i]);t.stopPropagation()}},pointerClickListener:function(t){this._handleClicks(t,["click","pointerclick"])},pointerDblClickListener:function(t){this._handleDblClicks(t,["dblclick","pointerdblclick"])},mouseClickListener:function(t){this._handleClicks(t,["click","mouseclick"])},mouseDblClickListener:function(t){this._handleDblClicks(t,["dblclick","mousedblclick"])},pointerMoveListener:function(t){var e,i,r,o,n,a;if("touch"===this._getPointerInputDevice(t)&&!this._isPointerRegistered(t))return this.BOARD_MODE_NONE;if(!this.checkFrameRate(t))return!1;if(this.mode!==this.BOARD_MODE_DRAG&&(this.dehighlightAll(),this.displayInfobox(!1)),this.mode!==this.BOARD_MODE_NONE&&(t.preventDefault(),t.stopPropagation()),this.updateQuality=this.BOARD_QUALITY_LOW,this._inputDevice=this._getPointerInputDevice(t),a=this._inputDevice,this.options.precision.hasPoint=this.options.precision[a],o=.3333*this.options.precision.hasPoint,r=this.getMousePosition(t),null===s.A.evaluate(this.attr.movetarget)&&(r[0]<=o||r[1]<=o||r[0]>=this.canvasWidth-o||r[1]>=this.canvasHeight-o))return this.mode===this.BOARD_MODE_NONE;if(this.selectingMode)this._moveSelecting(r),this.triggerEventHandlers(["touchmoveselecting","moveselecting","pointermoveselecting"],[t,this.mode]);else if(!this.mouseOriginMove(t))if(this.addToSketchCurve(t),this.mode===this.BOARD_MODE_DRAG){for(e=0;e-1;i--){for(o=!1,r=0;r0||s.A.exists(n.pointerclick)&&n.pointerclick.length>0||s.A.exists(n.dblclick)&&n.dblclick.length>0||s.A.exists(n.pointerdblclick)&&n.pointerdblclick.length>0)&&(this.clickObjects[this.downObjects[i].id]=this.downObjects[i]),this.downObjects.splice(i,1))}return this.hasPointerUp&&(window.navigator.msPointerEnabled?e.A.removeEvent(this.document,"MSPointerUp",this.pointerUpListener,this):(e.A.removeEvent(this.document,"pointerup",this.pointerUpListener,this),e.A.removeEvent(this.document,"pointercancel",this.pointerUpListener,this)),this.hasPointerUp=!1),this._pointerClearTouches(t.pointerId),"touch"!==this._getPointerInputDevice(t)&&this.dehighlightAll(),h&&this.update(),!0},pointerLeaveListener:function(t){return this.displayInfobox(!1),this.dehighlightAll(),!0},touchStartListener:function(r){var o,n,a,h,l,c,d,u,p,f,A=this.options.precision.touch,_=r.touches;for(this.hasTouchEnd||(e.A.addEvent(this.document,"touchend",this.touchEndListener,this),this.hasTouchEnd=!0),this.document.selection&&s.A.isFunction(this.document.selection.empty)?this.document.selection.empty():window.getSelection&&window.getSelection().removeAllRanges(),this._inputDevice="touch",this.options.precision.hasPoint=this.options.precision.touch,o=0;o<_.length;o++)_[o].jxg_isused=!1;for(o=0;o0;if(0!==(l=this.initMoveObject(h[0],h[1],r,"touch")).length)if(c=l[l.length-1],p={num:o,X:_[o].screenX,Y:_[o].screenY,Xprev:NaN,Yprev:NaN,Xstart:[],Ystart:[],Zstart:[]},s.A.isPoint(c)||c.elementClass===i.A.OBJECT_CLASS_TEXT||c.type===i.A.OBJECT_TYPE_TICKS||c.type===i.A.OBJECT_TYPE_IMAGE)u=[p],this.saveStartPos(c,u[0]),this.touches.push({obj:c,targets:u}),c.highlight(!0);else if(c.elementClass===i.A.OBJECT_CLASS_LINE||c.elementClass===i.A.OBJECT_CLASS_CIRCLE||c.elementClass===i.A.OBJECT_CLASS_CURVE||c.type===i.A.OBJECT_TYPE_POLYGON){for(d=!1,n=0;n0&&(r.preventDefault(),r.stopPropagation()),1===_.length&&this.mode===this.BOARD_MODE_NONE&&this.touchStartMoveOriginOneFinger(r)||2!==_.length||this.mode!==this.BOARD_MODE_NONE&&this.mode!==this.BOARD_MODE_MOVE_ORIGIN||(this.mode===this.BOARD_MODE_MOVE_ORIGIN&&this.originMoveEnd(),this.gestureStartListener(r)),this.initSketchCurve(r),this.options.precision.hasPoint=this.options.precision.mouse,this.triggerEventHandlers(["touchstart","down"],[r]),!1},touchMoveListener:function(t){var e,i,s,r,o=t.touches;if(!this.checkFrameRate(t))return!1;if(this.mode!==this.BOARD_MODE_NONE&&(t.preventDefault(),t.stopPropagation()),this.mode!==this.BOARD_MODE_DRAG&&(this.dehighlightAll(),this.displayInfobox(!1)),this._inputDevice="touch",this.options.precision.hasPoint=this.options.precision.touch,this.updateQuality=this.BOARD_QUALITY_LOW,this.selectingMode){for(e=0;ethis.canvasWidth||i[1]<0||i[1]>this.canvasHeight)return;r[0].X=i[0],r[0].Y=i[1],this.moveObject(i[0],i[1],this.touches[e],t,"touch")}}else if(2===r.length&&r[0].num>-1&&r[1].num>-1&&o[r[0].num]&&o[r[1].num]){if(i=this.getMousePosition(t,r[0].num),s=this.getMousePosition(t,r[1].num),i[0]<0||i[0]>this.canvasWidth||i[1]<0||i[1]>this.canvasHeight||s[0]<0||s[0]>this.canvasWidth||s[1]<0||s[1]>this.canvasHeight)return;r[0].X=i[0],r[0].Y=i[1],r[1].X=s[0],r[1].Y=s[1],this.twoFingerMove(this.touches[e],r[0].num,t),r[0].Xprev=i[0],r[0].Yprev=i[1],r[1].Xprev=s[0],r[1].Yprev=s[1]}}else 2===o.length&&this.gestureChangeListener(t),i=this.getMousePosition(t,0),this.highlightElements(i[0],i[1],t,-1);return this.mode!==this.BOARD_MODE_DRAG&&this.displayInfobox(!1),this.triggerEventHandlers(["touchmove","move"],[t,this.mode]),this.options.precision.hasPoint=this.options.precision.mouse,this.updateQuality=this.BOARD_QUALITY_HIGH,this.mode===this.BOARD_MODE_NONE},touchEndListener:function(t){var r,o,n,a,h,l,c=this.options.precision.touch,d=[],u=t&&t.touches,p=!1;if(this.triggerEventHandlers(["touchend","up"],[t]),this.displayInfobox(!1),this.finalizeSketchCurve(t),this.selectingMode)this._stopSelecting(t),this.triggerEventHandlers(["touchstopselecting","stopselecting"],[t]),this.stopSelectionMode();else if(u&&u.length>0){for(r=0;r-1;r--){for(a=!1,o=0;o0?this.zoomIn(s[1],s[2]):this.zoomOut(s[1],s[2]),this.triggerEventHandlers(["mousewheel"],[t]),t.preventDefault(),!1)},keyDownListener:function(e){var r,o,n,a,h,l,c=e.target.id,d=0,u=0,p=s.A.evaluate(this.attr.keyboard.dx)/this.unitX,f=s.A.evaluate(this.attr.keyboard.dy)/this.unitY,A=!1,_=!0;return!(!this.attr.keyboard.enabled||""===c)&&(9!==e.keyCode&&((!(a=this.containerObj.shadowRoot||document).activeElement||"INPUT"!==(o=a.activeElement).tagName&&"textarea"!==o.tagName)&&(r=c.replace(this.containerObj.id+"_",""),o=this.select(r),s.A.exists(o.coords)&&(l=o.coords.usrCoords.slice(1)),s.A.evaluate(this.attr.keyboard.panshift)&&e.shiftKey||s.A.evaluate(this.attr.keyboard.panctrl)&&e.ctrlKey?(!0===s.A.evaluate(this.attr.zoom.enabled)&&(A=!0),38===e.keyCode?this.clickUpArrow():40===e.keyCode?this.clickDownArrow():37===e.keyCode?this.clickLeftArrow():39===e.keyCode?this.clickRightArrow():A&&171===e.keyCode?this.zoomIn():A&&173===e.keyCode?this.zoomOut():A&&79===e.keyCode?this.zoom100():_=!1):e.shiftKey||e.ctrlKey||(s.A.exists(o.visProp)&&(s.A.exists(o.visProp.snaptogrid)&&o.visProp.snaptogrid&&o.evalVisProp("snapsizex")&&o.evalVisProp("snapsizey")?(p=d=(n=o.getSnapSizes())[0],f=u=n[1]):s.A.exists(o.visProp.attracttogrid)&&o.visProp.attracttogrid&&o.evalVisProp("attractordistance")&&o.evalVisProp("attractorunit")&&(u=d=1.1*o.evalVisProp("attractordistance"),"screen"===o.evalVisProp("attractorunit")&&(d/=this.unitX,u/=this.unitX),p=Math.max(d,p),f=Math.max(u,f))),38===e.keyCode?h=[0,f]:40===e.keyCode?h=[0,-f]:37===e.keyCode?h=[-p,0]:39===e.keyCode?h=[p,0]:_=!1,h&&o.isDraggable&&o.visPropCalc.visible&&(this.geonextCompatibilityMode&&(s.A.isPoint(o)||o.elementClass===i.A.OBJECT_CLASS_TEXT)||!this.geonextCompatibilityMode)&&!o.evalVisProp("fixed")&&(this.mode=this.BOARD_MODE_DRAG,s.A.exists(o.coords)&&(h[0]+=l[0],h[1]+=l[1]),s.A.exists(o.coords)?(o.setPosition(t.A.COORDS_BY_USER,h),this.updateInfobox(o)):(this.displayInfobox(!1),o.setPositionDirectly(i.A.COORDS_BY_USER,h,[0,0])),this.triggerEventHandlers(["keymove","move"],[e,this.mode]),o.triggerEventHandlers(["keydrag","drag"],[e]),this.mode=this.BOARD_MODE_NONE)),this.update(),_&&s.A.exists(e.preventDefault)&&e.preventDefault(),_)))},keyFocusInListener:function(t){var e,i,r=t.target.id;if(!this.attr.keyboard.enabled||""===r)return!1;e=r.replace(this.containerObj.id+"_",""),i=this.select(e),s.A.exists(i.highlight)&&(i.highlight(!0),this.focusObjects=[e],i.triggerEventHandlers(["hit"],[t])),s.A.exists(i.coords)&&this.updateInfobox(i)},keyFocusOutListener:function(t){if(!this.attr.keyboard.enabled)return!1;this.focusObjects=[],this.dehighlightAll(),this.displayInfobox(!1)},updateContainerDims:function(t,e){var i,r,o,n,a=t,h=e,l=0,c=0;return void 0===t&&(a=this.containerObj.offsetWidth,h=this.containerObj.offsetHeight),void 0===t&&window&&window.getComputedStyle&&(r=window.getComputedStyle(this.containerObj,null),o=parseFloat(r.getPropertyValue("border-left-width"))+parseFloat(r.getPropertyValue("border-right-width")),isNaN(o)||(a-=o),n=parseFloat(r.getPropertyValue("border-top-width"))+parseFloat(r.getPropertyValue("border-bottom-width")),isNaN(n)||(h-=n)),a<=0||h<=0||isNaN(a)||isNaN(h)?this:(isNaN(this.getBoundingBox()[0])&&(i=this.attr.boundingbox,s.A.exists(i)&&this.keepaspectratio?(this.unitX=a/(i[2]-i[0]),this.unitY=h/(i[1]-i[3]),Math.abs(this.unitX)0&&this.select(this.focusObjects[0]).elementClass===i.A.OBJECT_CLASS_POINT||this.infobox.hiddenByParent===t&&(this.infobox.hiddenByParent=!t,this.infobox.prepareUpdate().updateVisibility(t).updateRenderer()),this},showInfobox:function(t){return this.displayInfobox(t)},highlightInfobox:function(t,e,i){return this.highlightCustomInfobox("("+t+", "+e+")",i),this},highlightCustomInfobox:function(t,e){return this.infobox.setText(t),this},dehighlightAll:function(){var t,e,i={},s=!1;for(t in this.highlightedObjects)this.highlightedObjects.hasOwnProperty(t)&&(e=this.highlightedObjects[t],this.focusObjects.indexOf(t)<0?((this.hasMouseHandlers||this.hasPointerHandlers)&&e.noHighlight(),s=!0):i[t]=e);return this.highlightedObjects=i,"canvas"===this.renderer.type&&s&&(this.prepareUpdate(),this.renderer.suspendRedraw(this),this.updateRenderer(),this.renderer.unsuspendRedraw()),this},getScrCoordsOfMouse:function(t,e){return[t,e]},getUsrCoordsOfMouse:function(t){var s=this.getCoordsTopLeftCorner(),r=e.A.getPosition(t,null,this.document),o=r[0]-s[0],n=r[1]-s[1];return new u.A(i.A.COORDS_BY_SCREEN,[o,n],this).usrCoords.slice(1)},getAllUnderMouse:function(t){var e=this.getAllObjectsUnderMouse(t);return e.push(this.getUsrCoordsOfMouse(t)),e},getAllObjectsUnderMouse:function(t){var i,s,r=this.getCoordsTopLeftCorner(),o=e.A.getPosition(t,null,this.document),n=o[0]-r[0],a=o[1]-r[1],h=[],l=this.objectsList.length;for(i=0;ithis.maxboundingbox[1]+o.A.eps||l[1]>this.maxboundingbox[2]+o.A.eps||l[2]"),p=e.indexOf(""),f=function(t,e,s,r){return function(){var o,n;n=(o=t.select(e.id)).coords.usrCoords[r],2===r?o.setPositionDirectly(i.A.COORDS_BY_USER,[s(),n]):o.setPositionDirectly(i.A.COORDS_BY_USER,[n,s()]),o.prepareUpdate().update()}},A=function(t,e,i){return function(){var s,r;s=t.select(e.id),r=i(),s.setAttribute({visible:r})}},_=function(t,e,i,s){return function(){var r,o;r=t.select(e.id),o=i(),"strokewidth"===s?r.visProp.strokewidth=o:(o=T.A.rgba2rgbo(o),r.visProp[s+"color"]=o[0],r.visProp[s+"opacity"]=o[1])}},m=function(t,e,i){return function(){t.select(e.id).position=i()}},g=function(t,e,i){return function(){t.select(e.id).setStyle(i())}};if(!(u<0)){for(;u>=0;){if(o=(r=e.slice(u+6,p)).indexOf("="),n=r.slice(0,o),a=r.slice(o+1),o=n.indexOf("."),h=n.slice(0,o),l=this.elementsByName[s.A.unescapeHTML(h)],c=n.slice(o+1).replace(/\s+/g,"").toLowerCase(),a=s.A.createFunction(a,this,"",!0),s.A.exists(this.elementsByName[h]))switch(c){case"x":d.push(f(this,l,a,2));break;case"y":d.push(f(this,l,a,1));break;case"visible":d.push(A(this,l,a));break;case"position":d.push(m(this,l,a));break;case"stroke":d.push(_(this,l,a,"stroke"));break;case"style":d.push(g(this,l,a));break;case"strokewidth":d.push(_(this,l,a,"strokewidth"));break;case"fill":d.push(_(this,l,a,"fill"));break;case"label":break;default:t.A.debug('property "'+c+'" in conditions not yet implemented:'+a)}else t.A.debug("debug conditions: |"+h+"| undefined");u=(e=e.slice(p+7)).indexOf(""),p=e.indexOf("")}this.updateConditions=function(){var t;for(t=0;t25;)this.options.grid.snapSizeX*=2,r/=2;for(this.options.grid.snapSizeY=a[1];Math.abs(o)>25;)this.options.grid.snapSizeY*=2,o/=2;return this},applyZoom:function(){return this.updateCoords().calculateSnapSizes().clearTraces().fullUpdate(),this},zoomIn:function(t,e){var i=this.getBoundingBox(),r=s.A.evaluate(this.attr.zoom.factorx),o=s.A.evaluate(this.attr.zoom.factory),n=(i[2]-i[0])*(1-1/r),a=(i[1]-i[3])*(1-1/o),h=.5,l=.5,c=s.A.evaluate(this.attr.zoom.max),d=s.A.evaluate(this.attr.zoom.eps)||s.A.evaluate(this.attr.zoom.min)||.001;return this.zoomX>c&&r>1||this.zoomY>c&&o>1||this.zoomXn&&(n=r.coords.usrCoords[1]),r.coords.usrCoords[2]>h?h=r.coords.usrCoords[2]:r.coords.usrCoords[2]l[1]&&(l[1]=i[1]),i[2]>l[2]&&(l[2]=i[2]),i[3]-1){for(this.objectsList.splice(a,1),n=a;n=0&&(e+=""+this.objects[t].id+": "),this.objects[t].childElements)this.objects[t].childElements.hasOwnProperty(i)&&(e+=this.objects[t].childElements[i].id+"("+this.objects[t].childElements[i].name+"), ");e+="\n"}return e+="

\n",(s=window.open()).document.open(),s.document.write(e),s.document.close(),this},showXML:function(){var t=window.open("");return t.document.open(),t.document.write("
"+s.A.escapeHTML(this.xmlString)+"
"),t.document.close(),this},prepareUpdate:function(t){var e,r,o,n=this.objectsList.length;for(e=0;e=0;e--)this.dependentBoards[e]===t&&this.dependentBoards.splice(e,1);return this},update:function(t){var e,i,r,o,n;if(this.inUpdate||this.isSuspendedUpdate)return this;for(this.inUpdate=!0,"all"===this.attr.minimizereflow&&this.containerObj&&"vml"!==this.renderer.type&&(n=this.document.activeElement,o=this.renderer.removeToInsertLater(this.containerObj)),"svg"===this.attr.minimizereflow&&"svg"===this.renderer.type&&(n=this.document.activeElement,o=this.renderer.removeToInsertLater(this.renderer.svgRoot)),this.prepareUpdate(t).updateElements(t).updateConditions(),this.renderer.suspendRedraw(this),this.updateRenderer(),this.renderer.unsuspendRedraw(),this.triggerEventHandlers(["update"],[]),o&&(o(),n.focus()),i=this.dependentBoards.length,e=0;e0&&"view3d"===i[0].elType?i[n]=i[0].select(i[n]):i[n]=this.select(i[n]));if(!s.A.isFunction(t.A.elements[e]))throw new Error("JSXGraph: create: Unknown element type given: "+e);return o=t.A.elements[e](this,i,r),s.A.exists(o)?(o.prepareUpdate&&o.update&&o.updateRenderer&&o.fullUpdate(),o):(t.A.debug("JSXGraph: create: failure creating "+e),o)},createElement:function(){return t.A.deprecated("Board.createElement()","Board.create()"),this.create.apply(this,arguments)},clearTraces:function(){var t;for(t=0;tthis.maxboundingbox[1]+o.A.eps||t[2]>this.maxboundingbox[2]+o.A.eps||t[3]=n?p>=f?(this.unitY=n/u,this.unitX=this.unitY*c):(this.unitY=n/Math.abs(d)*o.A.sign(u)/m,this.unitX=this.unitY*c):f>p?(this.unitX=a/d,this.unitY=this.unitX/c):(this.unitX=a/Math.abs(u)*o.A.sign(d)*m,this.unitY=this.unitX/c),A=.5*(a/this.unitX-d),_=.5*(n/this.unitY-u),this.keepaspectratio=!0):(this.unitX=a/(t[2]-t[0]),this.unitY=n/(t[1]-t[3]),this.keepaspectratio=!1),this.moveOrigin(-this.unitX*(t[0]-A),this.unitY*(t[1]+_)),"update"===r?(this.zoomX*=this.unitX/h,this.zoomY*=this.unitY/l):"reset"===r&&(this.zoomX=s.A.exists(this.attr.zoomx)?this.attr.zoomx:1,this.zoomY=s.A.exists(this.attr.zoomy)?this.attr.zoomy:1)),this):this},getBoundingBox:function(){var t=new u.A(i.A.COORDS_BY_SCREEN,[0,0],this).usrCoords,e=new u.A(i.A.COORDS_BY_SCREEN,[this.canvasWidth,this.canvasHeight],this).usrCoords;return[t[1],t[2],e[1],e[2]]},_set:function(t,e){t=t.toLocaleLowerCase(),null===e||!s.A.isObject(e)||s.A.exists(e.id)||s.A.exists(e.name)?this.attr[t]=e:s.A.mergeAttr(this.attr[t],e)},setAttribute:function(e,r){var o,n,a,h,l,c,d,u,p,f={};for(o=0;or&&r>o[3])},updateCSSTransforms:function(){var t=this.containerObj,i=t,r=t;if(this.cssTransMat=e.A.getCSSTransformMatrix(i),s.A.exists(i.getRootNode)){for(i=i.parentNode===i.getRootNode()?i.parentNode.host:i.parentNode;i;)this.cssTransMat=o.A.matMatMult(e.A.getCSSTransformMatrix(i),this.cssTransMat),i=i.parentNode===i.getRootNode()?i.parentNode.host:i.parentNode;this.cssTransMat=o.A.inverse(this.cssTransMat)}else{for(i=i.offsetParent;i;){for(this.cssTransMat=o.A.matMatMult(e.A.getCSSTransformMatrix(i),this.cssTransMat),r=r.parentNode;r!==i;)this.cssTransMat=o.A.matMatMult(e.A.getCSSTransformMatrix(i),this.cssTransMat),r=r.parentNode;i=i.offsetParent}this.cssTransMat=o.A.inverse(this.cssTransMat)}return this},startSelectionMode:function(){this.selectingMode=!0,this.selectionPolygon.setAttribute({visible:!0}),this.selectingBox=[[0,0],[0,0]],this._setSelectionPolygonFromBox(),this.selectionPolygon.fullUpdate()},stopSelectionMode:function(){return this.selectingMode=!1,this.selectionPolygon.setAttribute({visible:!1}),[this.selectionPolygon.vertices[0].coords,this.selectionPolygon.vertices[2].coords]},_startSelecting:function(t){this.isSelecting=!0,this.selectingBox=[[t[0],t[1]],[t[0],t[1]]],this._setSelectionPolygonFromBox()},_moveSelecting:function(t){this.isSelecting&&(this.selectingBox[1]=[t[0],t[1]],this._setSelectionPolygonFromBox(),this.selectionPolygon.fullUpdate())},_stopSelecting:function(t){var e=this.getMousePosition(t);this.isSelecting=!1,this.selectingBox[1]=[e[0],e[1]],this._setSelectionPolygonFromBox()},_setSelectionPolygonFromBox:function(){var e=this.selectingBox[0],i=this.selectingBox[1];this.selectionPolygon.vertices[0].setPositionDirectly(t.A.COORDS_BY_SCREEN,[e[0],e[1]]),this.selectionPolygon.vertices[1].setPositionDirectly(t.A.COORDS_BY_SCREEN,[e[0],i[1]]),this.selectionPolygon.vertices[2].setPositionDirectly(t.A.COORDS_BY_SCREEN,[i[0],i[1]]),this.selectionPolygon.vertices[3].setPositionDirectly(t.A.COORDS_BY_SCREEN,[i[0],e[1]])},_testForSelection:function(t){this._isRequiredKeyPressed(t,"selection")&&(s.A.exists(this.selectionPolygon)||this._createSelectionPolygon(this.attr),this.startSelectionMode())},_createSelectionPolygon:function(t){var e;return s.A.exists(this.selectionPolygon)||!0===(e=s.A.copyAttributes(t,v.A,"board","selection")).enabled&&(this.selectionPolygon=this.create("polygon",[[0,0],[0,0],[0,0],[0,0]],e)),this},initSketchCurve:function(t){var e,i;this.mode!==this.BOARD_MODE_MOVE_ORIGIN&&(i=this.getUsrCoordsOfMouse(t),e=t.isPrimary?0:1,s.A.exists(this.sketches[e])&&(this.sketches[e].dataX=[i[0]],this.sketches[e].dataY=[i[1]],this.isSketching[e]=!0))},addToSketchCurve:function(t){var e,i,r;e=t.isPrimary?0:1,this.attr.sketches.enabled&&!0===this.isSketching[e]&&s.A.exists(this.sketches[e])&&(i=this.getUsrCoordsOfMouse(t),this.sketches[e].dataX.push(i[0]),this.sketches[e].dataY.push(i[1]),null!==(r=this.sketches[e].evalVisProp("maxlength"))&&this.sketches[e].dataX.length>r&&(this.sketches[e].dataX=this.sketches[e].dataX.slice(-r),this.sketches[e].dataY=this.sketches[e].dataY.slice(-r)),this.sketches[e].evalVisProp("visible")&&this.update())},finalizeSketchCurve:function(t){var e;e=t.isPrimary?0:1,this.attr.sketches.enabled&&s.A.exists(this.sketches[e])&&(this.isSketching[e]=!1,this.sketches[e].evalVisProp("deleteOnUp")&&(this.sketches[e].dataX=[],this.sketches[e].dataY=[]))},__evt__attribute:function(t){},__evt__down:function(t){},__evt__mousedown:function(t){},__evt__pendown:function(t){},__evt__pointerdown:function(t){},__evt__touchstart:function(t){},__evt__up:function(t){},__evt__mouseup:function(t){},__evt__pointerup:function(t){},__evt__touchend: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__move:function(t,e){},__evt__mousemove:function(t,e){},__evt__penmove:function(t,e){},__evt__pointermove:function(t,e){},__evt__touchmove:function(t,e){},__evt__keymove:function(t,e){},__evt__hit:function(t,e,i){},__evt__mousehit:function(t,e,i){},__evt__update:function(){},__evt__boundingbox:function(){},__evt__startselecting:function(){},__evt__mousestartselecting:function(){},__evt__pointerstartselecting:function(){},__evt__touchstartselecting:function(){},__evt__stopselecting:function(){},__evt__mousestopselecting:function(){},__evt__pointerstopselecting:function(){},__evt__touchstopselecting:function(){},__evt__moveselecting:function(){},__evt__mousemoveselecting:function(){},__evt__pointermoveselecting:function(){},__evt__touchmoveselecting:function(){},__evt:function(){},toFullscreen:function(t){var e,i,r,o,n=this.document;return t=t||this.container,this._fullscreen_inner_id=t,r=n.getElementById(t),e="fullscreenwrap_"+t,s.A.exists(r._cssFullscreenStore)||(o=this.containerObj.getBoundingClientRect(),r._cssFullscreenStore={w:o.width,h:o.height}),n.getElementById(e)?i=n.getElementById(e):((i=document.createElement("div")).classList.add("JXG_wrap_private"),i.setAttribute("id",e),r.parentNode.insertBefore(i,r),i.appendChild(r)),i.requestFullscreen=i.requestFullscreen||i.webkitRequestFullscreen||i.mozRequestFullScreen||i.msRequestFullscreen,null===(void 0!==n.fullscreenElement?n.fullscreenElement:void 0!==n.webkitFullscreenElement?n.webkitFullscreenElement:n.msFullscreenElement)?i.requestFullscreen&&(i.requestFullscreen(),this.startFullscreenResizeObserver(i)):(this.stopFullscreenResizeObserver(i),s.A.exists(document.exitFullscreen)?document.exitFullscreen():s.A.exists(document.webkitExitFullscreen)&&document.webkitExitFullscreen()),this},fullscreenListener:function(t){var i,r,o,n=this.document;i=this._fullscreen_inner_id,s.A.exists(i)&&(o=void 0!==n.fullscreenElement?n.fullscreenElement:void 0!==n.webkitFullscreenElement?n.webkitFullscreenElement:n.msFullscreenElement,r=n.getElementById(i),o?(r._cssFullscreenStore.id=o.id,r._cssFullscreenStore.isFullscreen=!0,r._cssFullscreenStore.margin=r.style.margin,r._cssFullscreenStore.width=r.style.width,r._cssFullscreenStore.height=r.style.height,r._cssFullscreenStore.transform=r.style.transform,r.style.width=r._cssFullscreenStore.w+"px",r.style.height=r._cssFullscreenStore.h+"px",r.style.margin="",e.A.scaleJSXGraphDiv(o.id,i,n,s.A.evaluate(this.attr.fullscreen.scale)),o=null):s.A.exists(r._cssFullscreenStore)&&(r._cssFullscreenStore.isFullscreen=!1,r.style.margin=r._cssFullscreenStore.margin,r.style.width=r._cssFullscreenStore.width,r.style.height=r._cssFullscreenStore.height,r.style.transform=r._cssFullscreenStore.transform,r._cssFullscreenStore=null,r.parentElement.replaceWith(r)),this.updateCSSTransforms())},startFullscreenResizeObserver:function(t){var i=this;return e.A.isBrowser&&this.attr.resize&&this.attr.resize.enabled?(this.resizeObserver=new ResizeObserver(function(r){var o,n,a=i.document;i._isResizing||(i._isResizing=!0,window.setTimeout(function(){try{o=i._fullscreen_inner_id,null!==(n=void 0!==a.fullscreenElement?a.fullscreenElement:void 0!==a.webkitFullscreenElement?a.webkitFullscreenElement:a.msFullscreenElement)&&e.A.scaleJSXGraphDiv(n.id,o,a,s.A.evaluate(i.attr.fullscreen.scale))}catch(e){i.stopFullscreenResizeObserver(t)}finally{i._isResizing=!1}},i.attr.resize.throttle))}),this.resizeObserver.observe(t),this):this},stopFullscreenResizeObserver:function(t){return e.A.isBrowser&&this.attr.resize&&this.attr.resize.enabled?(s.A.exists(this.resizeObserver)&&this.resizeObserver.unobserve(t),this):this},addLogEntry:function(t,e,i){var r,o,n=this.userLog.length-1;return s.A.exists(e.elementClass)&&(o=e.id),s.A.evaluate(this.attr.logging.enabled)&&(r=(new Date).getTime(),n>=0&&this.userLog[n].type===t&&this.userLog[n].id===o&&r-this.userLog[n].end<500?(this.userLog[n].end=r,this.userLog[n].endpos=i):this.userLog.push({type:t,id:o,start:r,startpos:i,end:r,endpos:i,bbox:this.getBoundingBox(),canvas:[this.canvasWidth,this.canvasHeight],zoom:[this.zoomX,this.zoomY]})),this},createRoulette:function(t,e,i,s,r,n,a){var h=this;return new function(){var l,c=0,u=0,p=0,f=i,A=d.A.root(function(i){var s=t.X(f),r=t.Y(f),o=e.X(i),n=e.Y(i);return(s-o)*(s-o)+(r-n)*(r-n)},[0,2*Math.PI]),_=0,m=0,b=h.create("transform",[function(){return c}],{type:"rotate"}),v=h.create("transform",[function(){return c},function(){return t.X(f)},function(){return t.Y(f)}],{type:"rotate"}),y=h.create("transform",[function(){return u},function(){return p}],{type:"translate"}),C=function(t,e,i){var s=d.A.D(t.X)(e),r=d.A.D(t.Y)(e),n=d.A.D(t.X)(i),a=d.A.D(t.Y)(i),h=d.A.D(t.X)(.5*(e+i)),l=d.A.D(t.Y)(.5*(e+i)),c=o.A.hypot(s,r),u=o.A.hypot(n,a);return(c+4*o.A.hypot(h,l)+u)*(i-e)/6},P=function(t){return l-C(e,A,t)},E=Math.PI/18,x=9*E,O=null;return this.rolling=function(){var i,o,n,O,M;l=C(t,f,_=f+r*s),m=d.A.root(P,A),i=new g(t.X(_),t.Y(_)),o=new g(e.X(m),e.Y(m)),n=new g(d.A.D(t.X)(_),d.A.D(t.Y)(_)),O=new g(d.A.D(e.X)(m),d.A.D(e.Y)(m)),M=g.C.div(n,O),c=Math.atan2(M.imaginary,M.real),M.div(g.C.abs(M)),M.mult(o),u=i.real-M.real,p=i.imaginary-M.imaginary,c<-E&&c>-x?(c=-E,v.applyOnce(a)):c>E&&c0&&(O=window.setInterval(this.rolling,n)),this},this.stop=function(){return window.clearInterval(O),this},this}}});var D=t.A.Board;t.A.SVGRenderer=function(t,e){var i;for(this.type="svg",this.isIE="undefined"!=typeof navigator&&(-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,o,n){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",n[0]),a.setAttributeNS(null,"dy",n[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||!s.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",o),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 s.A.exists(encodeURIComponent)&&(t=encodeURIComponent(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.createClip=function(){var t,i,r=this.uniqName("ClipFull"),o=this.container.ownerDocument.createElementNS(this.svgNamespace,"clipPath"),n=this.container.ownerDocument.createElementNS(this.svgNamespace,"rect");return o.setAttributeNS(null,"id",r),n.setAttributeNS(null,"x",0),n.setAttributeNS(null,"y",0),n.setAttributeNS(null,"width",e.width),n.setAttributeNS(null,"height",e.height),t=getComputedStyle(this.container),i=s.A.exists(t["border-radius"])&&""!==t["border-radius"]?parseFloat(t["border-radius"]):0,n.setAttributeNS(null,"rx",i),n.setAttributeNS(null,"ry",i),o.appendChild(n),o},this.defs.appendChild(this.createClip()),this.setClipPath=function(t,e){return e?t.rendNode.style.clipPath=this.toURL(this.uniqName("ClipFull")):t.rendNode.style.removeProperty("clip-path"),this},this.updateClipPathRect=function(t,e){var i,r,o=this.uniqName("ClipFull");i=this.container.ownerDocument.getElementById(o),s.A.exists(i)&&s.A.exists(i.firstChild)&&(r=i.firstChild,s.A.exists(r)&&(r.setAttributeNS(null,"width",t),r.setAttributeNS(null,"height",e)))},this.layer=[],i=0;i0&&(o=t.rendNode,-1===(s=[(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("+s+") ",t.elementClass===i.A.OBJECT_CLASS_TEXT&&"html"===t.visProp.display){switch(o.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]}o.style["transform-origin"]=n+"px "+a+"px"}else o.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.rendNode.setAttributeNS(null,"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 s.A.exists(e)?e>=v.A.layer.numlayers&&(e=v.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){s.A.exists(t)&&s.A.exists(t.parentNode)&&t.parentNode.removeChild(t)},setLayer:function(t,e){var i,r;s.A.exists(e)?e>=v.A.layer.numlayers&&(e=v.A.layer.numlayers-1):e=0,i=this.layer[e],s.A.exists(i.moveBefore)?(r=t.rendNode).isConnected&&i.isConnected&&r.ownerDocument===i.ownerDocument?i.moveBefore(r,null):i.insertBefore(r,null):i.appendChild(t.rendNode)},makeArrows:function(t,e){var i,r,o=e.evFirst,n=e.evLast;this.isIE&&t.visPropCalc.visible&&(o||n)?t.rendNode.parentNode.insertBefore(t.rendNode,t.rendNode):(i=t.rendNodeTriangleStart,o?(r=this.toStr(this.container.id,"_",t.id,"TriangleStart",e.typeFirst),s.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)))):(s.A.exists(i)&&(this.remove(i),t.rendNodeTriangleStart=null),t.rendNode.removeAttributeNS(null,"marker-start")),i=t.rendNodeTriangleEnd,n?(r=this.toStr(this.container.id,"_",t.id,"TriangleEnd",e.typeLast),s.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)))):(s.A.exists(i)&&(this.remove(i),t.rendNodeTriangleEnd=null),t.rendNode.removeAttributeNS(null,"marker-end")))},updateEllipsePrim:function(t,e,i,s,r){var o;o=2e5,e=Math.abs(e)"===i||"<<>>"===i?("<<>>"===i&&(e*=1.41),s=" M "+(r[1]-e)+" "+r[2]+" L "+r[1]+" "+(r[2]+e)+" L "+(r[1]+e)+" "+r[2]+" L "+r[1]+" "+(r[2]-e)+" Z "):"^"===i?s=" M "+r[1]+" "+(r[2]-e)+" L "+(r[1]-o)+" "+(r[2]+n)+" L "+(r[1]+o)+" "+(r[2]+n)+" Z ":"v"===i?s=" M "+r[1]+" "+(r[2]+e)+" L "+(r[1]-o)+" "+(r[2]-n)+" L "+(r[1]+o)+" "+(r[2]-n)+" Z ":">"===i?s=" M "+(r[1]+e)+" "+r[2]+" L "+(r[1]-n)+" "+(r[2]-o)+" L "+(r[1]-n)+" "+(r[2]+o)+" Z ":"<"===i&&(s=" M "+(r[1]-e)+" "+r[2]+" L "+(r[1]+n)+" "+(r[2]-o)+" L "+(r[1]+n)+" "+(r[2]+o)+" Z "),s},updatePathStringPrim:function(t){var i,s,r,o,n,a,h,l=" M ",c=l,d=e.A.maxScreenCoord,u="";if(t.numberPoints<=0)return"";if(n=Math.min(t.points.length,t.numberPoints),1===t.bezierDegree){for(i=0;id||Math.abs(o)>d){if(i>0)a=t.points[i-1].scrCoords;else{if(!(id&&(h=o-a[2],o=Math.max(Math.min(o,d),-d),r=a[1]+(r-a[1])*(o-a[2])/h),Math.abs(r)>d&&(h=r-a[1],r=Math.max(Math.min(r,d),-d),o=a[2]+(o-a[2])*(r-a[1])/h)}u+=c+r+" "+o,c=" L "}}else if(3===t.bezierDegree)for(i=0;i0?s.setAttributeNS(null,"stroke-dasharray",this.dashArray[e-1].map(function(t){return t*i}).join(",")):s.hasAttributeNS(null,"stroke-dasharray")&&s.removeAttributeNS(null,"stroke-dasharray")},setGradient:function(t){var e,i,s,r=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"),s=this.createPrim("stop",t.id+"_gradient2"),e.appendChild(i),e.appendChild(s),this.defs.appendChild(e),r.setAttributeNS(null,"style","fill:"+this.toURL(this.container.id+"_"+t.id+"_gradient")),t.gradNode1=i,t.gradNode2=s,t.gradNode=e):r.removeAttributeNS(null,"style")},setLineCap:function(t){var e=t.evalVisProp("linecap");void 0!==e&&""!==e&&t.visPropOld.linecap!==e&&s.A.exists(t.rendNode)&&(this.setPropertyPrim(t.rendNode,"stroke-linecap",e),t.visPropOld.linecap=e)},setObjectFillColor:function(e,i,r,o){var n,a,h,l,c=i,d=r,u=e.evalVisProp("gradient");d=d>0?d:0,e.visPropOld.fillcolor===c&&e.visPropOld.fillopacity===d&&null===u||(s.A.exists(c)&&!1!==c&&(9!==c.length?(a=c,l=d):(h=T.A.rgba2rgbo(c),a=h[0],l=d*h[1]),n=void 0===o?e.rendNode:o,"none"!==a&&""!==a&&!1!==a&&this._setAttribute(function(){n.setAttributeNS(null,"fill",a)},e.visPropOld.fillcolor),e.type===t.A.OBJECT_TYPE_IMAGE?this._setAttribute(function(){n.setAttributeNS(null,"opacity",l)},e.visPropOld.fillopacity):("none"===a?(l=0,n.setAttributeNS(null,"pointer-events","visibleStroke")):n.setAttributeNS(null,"pointer-events","visiblePainted"),this._setAttribute(function(){n.setAttributeNS(null,"fill-opacity",l)},e.visPropOld.fillopacity)),"linear"!==u&&"radial"!==u||this.updateGradient(e)),e.visPropOld.fillcolor=c,e.visPropOld.fillopacity=d)},setObjectStrokeColor:function(t,e,r){var o,n,a,h,l=e,c=r;c=c>0?c:0,t.visPropOld.strokecolor===l&&t.visPropOld.strokeopacity===c||(s.A.exists(l)&&!1!==l&&(9!==l.length?(o=l,a=c):(n=T.A.rgba2rgbo(l),o=n[0],a=c*n[1]),h=t.rendNode,t.elementClass===i.A.OBJECT_CLASS_TEXT?"html"===t.evalVisProp("display")?this._setAttribute(function(){h.style.color=o,h.style.opacity=a},t.visPropOld.strokecolor):this._setAttribute(function(){h.setAttributeNS(null,"fill",o),h.setAttributeNS(null,"fill-opacity",a)},t.visPropOld.strokecolor):this._setAttribute(function(){h.setAttributeNS(null,"stroke",o),h.setAttributeNS(null,"stroke-opacity",a)},t.visPropOld.strokecolor),t.elementClass!==i.A.OBJECT_CLASS_CURVE&&t.elementClass!==i.A.OBJECT_CLASS_LINE||(t.evalVisProp("firstarrow")&&this._setArrowColor(t.rendNodeTriangleStart,o,a,t,t.visPropCalc.typeFirst),t.evalVisProp("lastarrow")&&this._setArrowColor(t.rendNodeTriangleEnd,o,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"),s.A.exists(r)&&this.setPropertyPrim(i,"stroke-width",r+"px"),t.visPropOld.strokewidth=r)},setObjectTransition:function(t,e){var i,r,o,n=[],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(s.A.exists(i)&&(a=i.length),o=0;o0?i:0,e=t.evalVisProp("fillcolor"),r.setAttributeNS(null,"style","stop-color:"+e+";stop-opacity:"+i),o.setAttributeNS(null,"style","stop-color:"+t.evalVisProp("gradientsecondcolor")+";stop-opacity:"+t.evalVisProp("gradientsecondopacity")),r.setAttributeNS(null,"offset",100*t.evalVisProp("gradientstartoffset")+"%"),o.setAttributeNS(null,"offset",100*t.evalVisProp("gradientendoffset")+"%"),"linear"===n?this.updateGradientAngle(t.gradNode,t.evalVisProp("gradientangle")):"radial"===n&&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,s=Math.cos(e),r=Math.sin(e);Math.abs(s)>Math.abs(r)?i/=Math.abs(s):i/=Math.abs(r),s>=0?(t.setAttributeNS(null,"x1",0),t.setAttributeNS(null,"x2",s*i)):(t.setAttributeNS(null,"x1",-s*i),t.setAttributeNS(null,"x2",0)),r>=0?(t.setAttributeNS(null,"y1",0),t.setAttributeNS(null,"y2",r*i)):(t.setAttributeNS(null,"y1",-r*i),t.setAttributeNS(null,"y2",0))},updateGradientCircle:function(t,e,i,s,r,o,n){t.setAttributeNS(null,"cx",100*e+"%"),t.setAttributeNS(null,"cy",100*i+"%"),t.setAttributeNS(null,"r",100*s+"%"),t.setAttributeNS(null,"fx",100*r+"%"),t.setAttributeNS(null,"fy",100*o+"%"),t.setAttributeNS(null,"fr",100*n+"%")},suspendRedraw:function(){this.suspendHandle=this.svgRoot.suspendRedraw(1e4)},unsuspendRedraw:function(){this.svgRoot.unsuspendRedraw(this.suspendHandle)},resize:function(t,e){this.svgRoot.setAttribute("width",parseFloat(t)),this.svgRoot.setAttribute("height",parseFloat(e)),s.A.exists(this.updateClipPathRect)&&this.updateClipPathRect(t,e)},createTouchpoints:function(t){var e,i,s,r;for(this.touchpoints=[],e=0;e=0&&2*t=0&&2*t=0&&2*t0)for(s=document.createElement("canvas"),n=0;n1&&(e=e.replace(/xmlns="http:\/\/www.w3.org\/2000\/svg"\s+xmlns="http:\/\/www.w3.org\/2000\/svg"/g,"")),e=e.replace(/ /g," "),s.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,"+n(unescape(encodeURIComponent(e)))},dumpToCanvas:function(t,e,i,s){var r,o,n,a;return(n=this.container.ownerDocument.getElementById(t)).width=n.width,a=n.getContext("2d"),void 0!==e&&void 0!==i&&(n.style.width=parseFloat(e)+"px",n.style.height=parseFloat(i)+"px",n.setAttribute("width",parseFloat(e)),n.setAttribute("height",parseFloat(i))),o=new Image,r=this.dumpToDataURI(s),o.src=r,"Promise"in window?new Promise(function(t,s){try{o.onload=function(){a.drawImage(o,0,0,e,i),t()}}catch(t){s(t)}}):(o.onload=function(){window.setTimeout(function(){try{a.drawImage(o,0,0,e,i)}catch(t){console.log("screenshots not longer supported on IE")}},200)},this)},screenshot:function(t,e,i){var r,o,n,a,h,l,c,d,u,p,f,A,_=this.container.ownerDocument,m=this.container.parentNode,g=t.attr.screenshot,b=!1;return"no"===this.type||(c=g.scale*this.container.getBoundingClientRect().width,d=g.scale*this.container.getBoundingClientRect().height,void 0===e||""===e?(b=!0,(a=new Image).style.width=c+"px",a.style.height=d+"px"):(b=!1,a=_.getElementById(e)),b&&((r=_.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"),o=_.createElement("canvas"),n=Math.random().toString(36).slice(2,7),o.setAttribute("id",n),o.setAttribute("width",c),o.setAttribute("height",d),o.style.width=c+"px",o.style.height=c+"px",o.style.display="none",m.appendChild(o),b&&(h=_.createElement("span"),l=_.createTextNode("✖"),h.style.cssText=g.cssButton,h.appendChild(l),h.onclick=function(){r.parentNode.removeChild(r)},r.appendChild(a),r.appendChild(h),m.insertBefore(r,this.container.nextSibling)),u=_.getElementById(this.uniqName("navigationbar")),s.A.exists(u)&&(p=u.style.display,u.style.display="none",f=this.removeToInsertLater(u)),A=function(){a.src=o.toDataURL("image/png"),m.removeChild(o)},"Promise"in window?this.dumpToCanvas(n,c,d,i).then(A):(this.dumpToCanvas(n,c,d,i),window.setTimeout(A,200)),s.A.exists(u)&&(u.style.display=p,f())),this}});var k=t.A.SVGRenderer;t.A.VMLRenderer=function(e){this.type="vml",this.container=e,this.container.style.overflow="hidden",""===this.container.style.position&&(this.container.style.position="relative"),this.container.onselectstart=function(){return!1},this.resolution=10,s.A.exists(t.A.vmlStylesheet)||(e.ownerDocument.namespaces.add("jxgvml","urn:schemas-microsoft-com:vml"),t.A.vmlStylesheet=this.container.ownerDocument.createStyleSheet(),t.A.vmlStylesheet.addRule(".jxgvml","behavior:url(#default#VML)"));try{e.ownerDocument.namespaces.jxgvml||e.ownerDocument.namespaces.add("jxgvml","urn:schemas-microsoft-com:vml"),this.createNode=function(t){return e.ownerDocument.createElement("')}}catch(t){this.createNode=function(t){return e.ownerDocument.createElement("<"+t+' xmlns="urn:schemas-microsoft.com:vml" class="jxgvml">')}}this.dashArray=["Solid","1 1","ShortDash","Dash","LongDash","ShortDashDot","LongDashDot"]},t.A.VMLRenderer.prototype=new y,t.A.extend(t.A.VMLRenderer.prototype,{_setAttr:function(e,i,s,r){try{8===this.container.ownerDocument.documentMode?e[i]=s:e.setAttribute(i,s,r)}catch(e){t.A.debug("_setAttr: "+i+" "+s+"
\n")}},updateTicks:function(t){var e,i,r,o,n,a=this.resolution,h=[];for(i=t.ticks.length,e=0;e0){for(i=this.joinTransforms(t,e),c[0]=o.A.matVecMult(i,t.coords.scrCoords),c[0][1]/=c[0][0],c[0][2]/=c[0][0],c[1]=o.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]=o.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]=o.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],s=c[0][1],n=c[0][1],r=c[0][2],a=c[0][2],h=1;h<4;h++)s=Math.max(s,c[h][1]),n=Math.min(n,c[h][1]),r=Math.max(r,c[h][2]),a=Math.min(a,c[h][2]);l.style.left=Math.floor(n)+"px",l.style.top=Math.floor(a)+"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 s.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,s,r=this.createNode("fill"),o=this.createNode("stroke"),n=this.createNode("shadow");return this._setAttr(r,"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(r),i.appendChild(o),i.appendChild(n)):"polygon"===t||"path"===t||"shape"===t||"line"===t?((i=this.createNode("shape")).appendChild(r),i.appendChild(o),i.appendChild(n),s=this.createNode("path"),this._setAttr(s,"id",this.container.id+"_"+e+"_path"),i.appendChild(s)):((i=this.createNode(t)).appendChild(r),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){s.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,s.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,s.A.exists(e)&&this._setAttr(e,"endarrow","none")),t.visPropOld.firstarrow=i,t.visPropOld.lastarrow=r)},updateEllipsePrim:function(t,e,i,s,r){t.style.left=Math.floor(e-s)+"px",t.style.top=Math.floor(i-r)+"px",t.style.width=Math.floor(2*Math.abs(s))+"px",t.style.height=Math.floor(2*Math.abs(r))+"px"},updateLinePrim:function(t,e,i,s,r,o){var n,a=this.resolution;isNaN(e+i+s+r)||(n=["m ",Math.floor(a*e),", ",Math.floor(a*i)," l ",Math.floor(a*s),", ",Math.floor(a*r)],this.updatePathPrim(t,n,o))},updatePathPrim:function(t,e,i){var s=i.canvasWidth,r=i.canvasHeight;e.length<=0&&(e=["m 0,0"]),t.style.width=s,t.style.height=r,this._setAttr(t,"coordsize",[Math.floor(this.resolution*s),Math.floor(this.resolution*r)].join(",")),this._setAttr(t,"path",e.join(""))},updatePathStringPoint:function(t,e,i){var s=[],r=Math.round,o=t.coords.scrCoords,n=e*Math.sqrt(3)*.5,a=.5*e,h=this.resolution;return"x"===i?s.push([" m ",r(h*(o[1]-e)),", ",r(h*(o[2]-e))," l ",r(h*(o[1]+e)),", ",r(h*(o[2]+e))," m ",r(h*(o[1]+e)),", ",r(h*(o[2]-e))," l ",r(h*(o[1]-e)),", ",r(h*(o[2]+e))].join("")):"+"===i?s.push([" m ",r(h*(o[1]-e)),", ",r(h*o[2])," l ",r(h*(o[1]+e)),", ",r(h*o[2])," m ",r(h*o[1]),", ",r(h*(o[2]-e))," l ",r(h*o[1]),", ",r(h*(o[2]+e))].join("")):"<>"===i||"<<>>"===i?("<<>>"===i&&(e*=1.41),s.push([" m ",r(h*(o[1]-e)),", ",r(h*o[2])," l ",r(h*o[1]),", ",r(h*(o[2]+e))," l ",r(h*(o[1]+e)),", ",r(h*o[2])," l ",r(h*o[1]),", ",r(h*(o[2]-e))," x e "].join(""))):"^"===i?s.push([" m ",r(h*o[1]),", ",r(h*(o[2]-e))," l ",r(h*(o[1]-n)),", ",r(h*(o[2]+a))," l ",r(h*(o[1]+n)),", ",r(h*(o[2]+a))," x e "].join("")):"v"===i?s.push([" m ",r(h*o[1]),", ",r(h*(o[2]+e))," l ",r(h*(o[1]-n)),", ",r(h*(o[2]-a))," l ",r(h*(o[1]+n)),", ",r(h*(o[2]-a))," x e "].join("")):">"===i?s.push([" m ",r(h*(o[1]+e)),", ",r(h*o[2])," l ",r(h*(o[1]-a)),", ",r(h*(o[2]-n))," l ",r(h*(o[1]-a)),", ",r(h*(o[2]+n))," l ",r(h*(o[1]+e)),", ",r(h*o[2])].join("")):"<"===i&&s.push([" m ",r(h*(o[1]-e)),", ",r(h*o[2])," l ",r(h*(o[1]+a)),", ",r(h*(o[2]-n))," l ",r(h*(o[1]+a)),", ",r(h*(o[2]+n))," x e "].join("")),s},updatePathStringPrim:function(t){var e,i,s=[],r=this.resolution,o=Math.round,n=" m ",a=n,h=Math.min(t.numberPoints,8192);if(t.numberPoints<=0)return"";if(h=Math.min(h,t.points.length),1===t.bezierDegree)for(e=0;e2e4?i[1]=2e4:i[1]<-2e4&&(i[1]=-2e4),i[2]>2e4?i[2]=2e4:i[2]<-2e4&&(i[2]=-2e4),s.push([a,o(r*i[1]),", ",o(r*i[2])].join("")),a=" l ");else if(3===t.bezierDegree)for(e=0;e2e4?r[1]=2e4:r[1]<-2e4&&(r[1]=-2e4),r[2]>2e4?r[2]=2e4:r[2]<-2e4&&(r[2]=-2e4),p===u?a.push([p,c(l*r[1])," ",c(l*r[2])].join("")):(s=2*i,a.push([p,c(l*(o+.333*(r[1]-o)+h*(s*Math.random()-i)))," ",c(l*(n+.333*(r[2]-n)+h*(s*Math.random()-i)))," ",c(l*(o+.666*(r[1]-o)+h*(s*Math.random()-i)))," ",c(l*(n+.666*(r[2]-n)+h*(s*Math.random()-i)))," ",c(l*r[1])," ",c(l*r[2])].join(""))),p=" c ",o=r[1],n=r[2]);return a.push(" e"),a},updatePolygonPrim:function(t,e){var i,s,r=e.vertices.length,o=this.resolution,n=[];if(this._setAttr(t,"stroked","false"),s=e.vertices[0].coords.scrCoords,!isNaN(s[1]+s[2])){for(n.push(["m ",Math.floor(o*s[1]),",",Math.floor(o*s[2])," l "].join("")),i=1;i=0&&(t.style.width=s+"px"),r>=0&&(t.style.height=r+"px")},setPropertyPrim:function(t,e,i){var s,r="";switch(e){case"stroke":r="strokecolor";break;case"stroke-width":r="strokeweight";break;case"stroke-dasharray":r="dashstyle"}""!==r&&(s=i,this._setAttr(t,r,s))},display:function(t,e){t&&t.rendNode&&(t.visPropOld.visible=e,t.rendNode.style.visibility=e?"inherit":"hidden")},show:function(e){t.A.deprecated("Board.renderer.show()","Board.renderer.display()"),e&&e.rendNode&&(e.rendNode.style.visibility="inherit")},hide:function(e){t.A.deprecated("Board.renderer.hide()","Board.renderer.display()"),e&&e.rendNode&&(e.rendNode.style.visibility="hidden")},setDashStyle:function(t,e){var i;e.dash>=0&&(i=t.rendNodeStroke,this._setAttr(i,"dashstyle",this.dashArray[e.dash]))},setGradient:function(t){var e=t.rendNodeFill,i=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,r){var o,n,a,h=e,l=r,c=t.rendNode;l=l>0?l:0,t.visPropOld.fillcolor===h&&t.visPropOld.fillopacity===l||(s.A.exists(h)&&!1!==h&&(9!==h.length?(o=h,a=l):(o=(n=T.A.rgba2rgbo(h))[0],a=l*n[1]),"none"===o||!1===o?this._setAttr(t.rendNode,"filled","false"):(this._setAttr(t.rendNode,"filled","true"),this._setAttr(t.rendNode,"fillcolor",o),s.A.exists(a)&&t.rendNodeFill&&this._setAttr(t.rendNodeFill,"opacity",100*a+"%")),t.type===i.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,r){var o,n,a,h,l=e,c=r,d=t.rendNode;c=c>0?c:0,t.visPropOld.strokecolor===l&&t.visPropOld.strokeopacity===c||(s.A.exists(l)&&!1!==l&&(9!==l.length?(o=l,a=c):(o=(n=e.rgba2rgbo(l))[0],a=c*n[1]),t.elementClass===i.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=o):(!1!==o&&(this._setAttr(d,"stroked","true"),this._setAttr(d,"strokecolor",o)),h=t.rendNodeStroke,s.A.exists(a)&&t.type!==i.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=s.A.evaluate(e);isNaN(r)||t.visPropOld.strokewidth===r||(i=t.rendNode,this.setPropertyPrim(i,"stroked","true"),s.A.exists(r)&&(this.setPropertyPrim(i,"stroke-width",r),0===r&&s.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=""}});var L=t.A.VMLRenderer,R="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split("");t.A.Util=t.A.Util||{},t.A.Util.genUUID=function(t){var e,i,s=[],r=0;for(""!==(t=t||"")&&"-"!==t.slice(t.length-1)&&(t+="-"),i=0;i<36;i++)8===i||13===i||18===i||23===i?s[i]="-":14===i?s[i]="4":(r<=2&&(r=33554432+16777216*Math.random()|0),e=15&r,r>>=4,s[i]=R[19===i?3&e|8:e]);return t+s.join("")};var B=t.A.Util;t.A.CanvasRenderer=function(i,s){if(this.type="canvas",this.canvasRoot=null,this.suspendHandle=null,this.canvasId=B.genUUID(),this.canvasNamespace=null,e.A.isBrowser)this.container=i,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=[''].join(""),this.canvasRoot=this.container.ownerDocument.getElementById(this.canvasId),this.canvasRoot.style.display="block",this.context=this.canvasRoot.getContext("2d");else if(e.A.isNode())try{this.canvasRoot=t.A.createCanvas(500,500),this.context=this.canvasRoot.getContext("2d")}catch(t){throw new Error('JXG.createCanvas not available.\nInstall the npm package `canvas`\nand call:\n import { createCanvas } from "canvas.js"\n JXG.createCanvas = createCanvas;\n')}},t.A.CanvasRenderer.prototype=new y,t.A.extend(t.A.CanvasRenderer.prototype,{_drawPolygon:function(t,e,i){var s,r=t.length,o=this.context;if(r>0){if(i&&(o.lineWidth=0),o.beginPath(),o.moveTo(t[0][0],t[0][1]),1===e)for(s=1;sMath.abs(g)?_/=Math.abs(m):_/=Math.abs(g),m>=0?(o=0,n=m*_):(o=-m*_,n=0),g>=0?(a=0,h=g*_):(a=-g*_,h=0),s=new u.A(i.A.COORDS_BY_USER,[b[0],b[1]],t.board),f=(r=new u.A(i.A.COORDS_BY_USER,[b[2],b[3]],t.board)).scrCoords[1]-s.scrCoords[1],A=r.scrCoords[2]-s.scrCoords[2],l=s.scrCoords[1]+f*o,d=s.scrCoords[2]+A*a,c=s.scrCoords[1]+f*n,p=s.scrCoords[2]+A*h,this.context.createLinearGradient(l,d,c,p)},updateGradientCircle:function(t,e,s,r,o,n,a){var h,l,c,d,p,f,A,_,m,g,b,v=t.getBoundingBox();return h=new u.A(i.A.COORDS_BY_USER,[v[0],v[1]],t.board),m=(l=new u.A(i.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]+m*e,d=l.scrCoords[2]+g*s,f=h.scrCoords[1]+m*o,A=l.scrCoords[2]+g*n,b=Math.abs(m)+Math.abs(g),p=Math.max(r*b*.5,0),_=Math.max(a*b*.5,0),this.context.createRadialGradient(f,A,_,c,d,p)},updateGradient:function(t){var e,i,s=t.evalVisProp("gradient");return e=t.evalVisProp("fillcolor"),"linear"===s?i=this.updateGradientAngle(t,t.evalVisProp("gradientangle")):"radial"===s&&(i=this.updateGradientCircle(t,t.evalVisProp("gradientcx"),t.evalVisProp("gradientcy"),t.evalVisProp("gradientr"),t.evalVisProp("gradientfx"),t.evalVisProp("gradientfy"),t.evalVisProp("gradientfr"))),"none"!==e&&""!==e&&!1!==e&&(i.addColorStop(t.evalVisProp("gradientstartoffset"),e),i.addColorStop(t.evalVisProp("gradientendoffset"),t.evalVisProp("gradientsecondcolor"))),i},_setColor:function(t,e,i){var s,r,o,n,a,h,l,c,d,u=!0;return e=e||"stroke",i=i||e,r=this._getHighlighted(t),"none"!==(n=t.evalVisProp(r+e+"color"))&&""!==n&&!1!==n?(l=(l=t.evalVisProp(r+e+"opacity"))>0?l:0,9!==n.length?(h=n,c=l):(h=(a=T.A.rgba2rgbo(n))[0],c=l*a[1]),this.context.globalAlpha=c,this.context[i+"Style"]=h):u=!1,"stroke"===e||"linear"!==(d=t.evalVisProp("gradient"))&&"radial"!==d?(o=parseFloat(t.evalVisProp(r+"strokewidth")),"stroke"!==e||isNaN(o)||(0===o?this.context.globalAlpha=0:this.context.lineWidth=o),s=t.evalVisProp("linecap"),"stroke"===e&&void 0!==s&&""!==s&&(this.context.lineCap=s),u):(this.context.globalAlpha=c,this.context[i+"Style"]=this.updateGradient(t),u)},_stroke:function(t){var e=this.context,i=t.evalVisProp("dash"),s=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*s})):this.context.lineDashArray=[],this._setColor(t,"stroke")&&e.stroke(),e.restore()},_translateShape:function(t,e,i){var s,r=[],o=t.length;if(o<=0)return t;for(s=0;s>":i*=1.41;case"diamond":case"<>":a.beginPath(),a.moveTo(s[1]-i,s[2]),a.lineTo(s[1],s[2]+i),a.lineTo(s[1]+i,s[2]),a.lineTo(s[1],s[2]-i),a.closePath(),this._fill(t),this._stroke(t);break;case"triangleup":case"A":case"a":case"^":a.beginPath(),a.moveTo(s[1],s[2]-i),a.lineTo(s[1]-r,s[2]+o),a.lineTo(s[1]+r,s[2]+o),a.closePath(),this._fill(t),this._stroke(t);break;case"triangledown":case"v":a.beginPath(),a.moveTo(s[1],s[2]+i),a.lineTo(s[1]-r,s[2]-o),a.lineTo(s[1]+r,s[2]-o),a.closePath(),this._fill(t),this._stroke(t);break;case"triangleleft":case"<":a.beginPath(),a.moveTo(s[1]-i,s[2]),a.lineTo(s[1]+o,s[2]-r),a.lineTo(s[1]+o,s[2]+r),a.closePath(),this._fill(t),this._stroke(t);break;case"triangleright":case">":a.beginPath(),a.moveTo(s[1]+i,s[2]),a.lineTo(s[1]-o,s[2]-r),a.lineTo(s[1]-o,s[2]+r),a.closePath(),this._fill(t),this._stroke(t)}},updatePoint:function(t){this.drawPoint(t)},drawArrows:function(t,e,s,r,o){var n,a,h,l,c,d,u,p,f,A,_,m,g,b,v,y,C,P,E,x,O=this.context,M=1,w=1,S=1,T=o.evFirst,N=o.evLast;if("none"!==t.evalVisProp("strokecolor")&&(T||N)){if(t.elementClass===i.A.OBJECT_CLASS_LINE)n=e.scrCoords[1],a=e.scrCoords[2],h=s.scrCoords[1],l=s.scrCoords[2],E=x=Math.atan2(l-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],b=t.points[1].scrCoords[1]-t.points[0].scrCoords[1],v=t.points[1].scrCoords[2]-t.points[0].scrCoords[2],y=t.points[P].scrCoords[1]-t.points[P-1].scrCoords[1],C=t.points[P].scrCoords[2]-t.points[P-1].scrCoords[2],T&&(E=Math.atan2(v,b)),N&&(x=Math.atan2(C,y))}if(d=t.evalVisProp(r+"strokewidth"),T)if(c=d*o.sizeFirst,f=M=o.typeFirst,2===M)p=[[c,.5*-c],[0,0],[c,.5*c],[.5*c,0]];else if(3===M)p=[[c/3,.5*-c],[0,.5*-c],[0,.5*c],[c/3,.5*c]];else if(4===M)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,m=0;m1&&(e=this._getHighlighted(t),i=t.evalVisProp(e+"strokewidth"),((s=this.getArrowHeadData(t,i,e)).evFirst||s.evLast)&&this.drawArrows(t,null,null,e,s))},updateCurve:function(t){this.drawCurve(t)},drawEllipse:function(t){var e=t.center.coords.scrCoords[1],i=t.center.coords.scrCoords[2],s=t.board.unitX,r=t.board.unitY,o=2*t.Radius(),n=2*t.Radius(),a=o*s,h=n*r,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,_=c+h/2,m=this.context;o>0&&n>0&&!isNaN(e+i)&&(m.beginPath(),m.moveTo(l,_),m.bezierCurveTo(l,_-u,A-d,c,A,c),m.bezierCurveTo(A+d,c,p,_-u,p,_),m.bezierCurveTo(p,_+u,A+d,f,A,f),m.bezierCurveTo(A-d,f,l,_+u,l,_),m.closePath(),this._fill(t),this._stroke(t))},updateEllipse:function(t){return this.drawEllipse(t)},displayCopyright:function(t,e){var i=this.context,s=4+1.8*e,r=6+e;i.save(),i.font=e+"px Arial",i.globalAlpha=.2,i.lineWidth=.5,i.fillText(t+".",s,r),i.restore()},displayLogo:function(t,e,i){var r=this.context,o=1.5*e;s.A.isBrowser&&(s.A.exists(i._logo_image)||(i._logo_image=new Image,i._logo_image.src=t),i._logo_image.onload=function(){r.save(),r.globalAlpha=.2,r.drawImage(i._logo_image,5,5,o,o),r.restore()},r.save(),r.globalAlpha=.2,r.drawImage(i._logo_image,5,5,o,o),r.restore())},drawInternalText:function(t){var e=t.evalVisProp("fontsize"),i=t.evalVisProp("fontunit"),s=t.getAnchorX(),r=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"===s?o.textAlign="left":"right"===s?o.textAlign="right":"middle"===s&&(o.textAlign="center"),"bottom"===r?o.textBaseline="bottom":"top"===r?o.textBaseline="top":"middle"===r&&(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,r){var o,n,a,h,l=e,c=r;c=c>0?c:0,t.visPropOld.strokecolor===l&&t.visPropOld.strokeopacity===c||(s.A.exists(l)&&!1!==l&&(9!==l.length?(o=l,a=c):(o=(n=T.A.rgba2rgbo(l))[0],a=c*n[1]),h=t.rendNode,t.elementClass===i.A.OBJECT_CLASS_TEXT&&"html"===t.evalVisProp("display")&&(h.style.color=o,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=s.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 s,r,n,a,h,l=e.length,c=this.context;if(l>0)if(s=this.joinTransforms(t,e),t.elementClass===i.A.OBJECT_CLASS_TEXT&&"html"===t.visProp.display){if(-1===(r=" matrix("+[s[1][1],s[2][1],s[1][2],s[2][2],s[1][0],s[2][0]].join(",")+") ").indexOf("NaN")){switch((h=t.rendNode).style.transform=r,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]}h.style["transform-origin"]=n+"px "+a+"px"}}else Math.abs(d.A.det(s))>=o.A.eps&&c.transform(s[1][1],s[2][1],s[1][2],s[2][2],s[1][0],s[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){s.A.exists(t)&&s.A.exists(t.parentNode)&&t.parentNode.removeChild(t)},updatePathStringPrim:function(t){var e,i,s,r,o,n="M",a=n,h=this.context;if(!(t.numberPoints<=0)){if(o=Math.min(t.points.length,t.numberPoints),h.beginPath(),1===t.bezierDegree)for(e=0;ef.maxboundingbox[1]&&(p[1]=f.maxboundingbox[1]),p[2]>f.maxboundingbox[2]&&(p[2]=f.maxboundingbox[2]),p[3]-1)r.construct(e);else try{r.jc.parse(e)}catch(e){t.A.debug(e)}return r},P=function(e,i,s,r){return function(){var o;t.A.JSXGraph.freeBoard(e),(o=C(i,s,r)).reload=P(o,i,s,r)}};for(i=0;i/g,""),y[i].innerHTML=m,v||((a=C(m,e,f)).reload=P(a,m,e,f))):t.A.debug("JSXGraph: Apparently the div injection failed. Can't create a board, sorry.")}},window);t.A.JSXGraph;var Y=__webpack_require__(144),V=__webpack_require__(102);t.A.Point=function(t,e,s){this.constructor(t,s,i.A.OBJECT_TYPE_POINT,i.A.OBJECT_CLASS_POINT),this.element=this.board.select(s.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()},t.A.Point.prototype=new Y.A,s.A.copyPrototypeMethods(t.A.Point,V.A,"coordsConstructor"),t.A.extend(t.A.Point.prototype,{hasPoint:function(t,e){var i,r,o,n=this.coords.scrCoords,a=this.evalVisProp("sizeunit");return s.A.isObject(this.evalVisProp("precision"))?(o=this.board._inputDevice,r=this.evalVisProp("precision."+o)):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")))=0&&n[1]<=1)&&h.A.distPointLine(this.coords.usrCoords,e.stdform)1&&(h=s[0].type===i.A.OBJECT_TYPE_CONIC||s[0].elementClass===i.A.OBJECT_CLASS_CIRCLE,l=s[1].type===i.A.OBJECT_TYPE_CONIC||s[1].elementClass===i.A.OBJECT_CLASS_CIRCLE,c=s[0].elementClass===i.A.OBJECT_CLASS_LINE,d=s[1].elementClass===i.A.OBJECT_CLASS_LINE),2!==s.length||!(h&&d||c&&l))throw new Error("JSXGraph: Can't create 'pole point' with parent types '"+typeof s[0]+"' and '"+typeof s[1]+"'.\nPossible parent type: [conic|circle,line], [line,conic|circle]");return d?(n=e.select(s[0]),a=e.select(s[1])):(n=e.select(s[1]),a=e.select(s[0])),(o=e.create("point",[function(){var e=n.quadraticform,i=a.stdform.slice(0,3);return[t.A.Math.Numerics.det([i,e[1],e[2]]),t.A.Math.Numerics.det([e[0],i,e[2]]),t.A.Math.Numerics.det([e[0],e[1],i])]}],r)).elType="polepoint",o.setParents([n.id,a.id]),n.addChild(o),a.addChild(o),o},t.A.registerElement("point",t.A.createPoint),t.A.registerElement("glider",t.A.createGlider),t.A.registerElement("intersection",t.A.createIntersectionPoint),t.A.registerElement("otherintersection",t.A.createOtherIntersectionPoint),t.A.registerElement("polepoint",t.A.createPolePoint);var X=t.A.Point;t.A.Line=function(t,e,s,r){this.constructor(t,r,i.A.OBJECT_TYPE_LINE,i.A.OBJECT_CLASS_LINE),this.point1=this.board.select(e),this.point2=this.board.select(s),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()},t.A.Line.prototype=new Y.A,s.A.copyMethodMap(t.A.Line,{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",setFixedLength:"setFixedLength",setStraight:"setStraight"}),t.A.extend(t.A.Line.prototype,{hasPoint:function(t,e){var r,n,a,l,c,d,p,f,A,_=[],m=[1,t,e],g=this.evalVisProp("strokewidth");return s.A.isObject(this.evalVisProp("precision"))?(A=this.board._inputDevice,f=this.evalVisProp("precision."+A)):f=this.board.options.precision.hasPoint,f+=.5*g,_[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,_[1]=this.stdform[1]/this.board.unitX,_[2]=this.stdform[2]/-this.board.unitY,r=h.A.distPointLine(m,_),!(isNaN(r)||r>f)&&(!(!this.evalVisProp("straightfirst")||!this.evalVisProp("straightlast"))||(a=this.point1.coords,l=this.point2.coords,n=[0,_[1],_[2]],n=o.A.crossProduct(n,m),(n=o.A.crossProduct(n,_))[1]/=n[0],n[2]/=n[0],n[0]=1,n=new u.A(i.A.COORDS_BY_SCREEN,n.slice(1),this.board).usrCoords,c=a.distance(i.A.COORDS_BY_USER,l),a=a.usrCoords.slice(0),l=l.usrCoords.slice(0),c1)))},update:function(){var t;return this.needsUpdate?(this.constrained&&(s.A.isFunction(this.funps)?(t=this.funps())&&t.length&&2===t.length&&(this.point1=t[0],this.point2=t[1]):(s.A.isFunction(this.funp1)&&(t=this.funp1(),s.A.isPoint(t)?this.point1=t:t&&t.length&&2===t.length&&this.point1.setPositionDirectly(i.A.COORDS_BY_USER,t)),s.A.isFunction(this.funp2)&&(t=this.funp2(),s.A.isPoint(t)?this.point2=t:t&&t.length&&2===t.length&&this.point2.setPositionDirectly(i.A.COORDS_BY_USER,t)))),this.updateSegmentFixedLength(),this.updateStdform(),this.evalVisProp("trace")&&this.cloneToBackground(!0),this):this},updateSegmentFixedLength:function(){var t,e,s,r,n,a,h,l;return this.hasFixedLength?(t=this.point1.Dist(this.point2),e=this.evalVisProp("nonnegativeonly")?Math.max(0,this.fixedLength()):Math.abs(this.fixedLength()),s=this.fixedLengthOldCoords[0].distance(i.A.COORDS_BY_USER,this.point1.coords),r=this.fixedLengthOldCoords[1].distance(i.A.COORDS_BY_USER,this.point2.coords),(s>o.A.eps||r>o.A.eps||t!==e)&&(n=this.point1.isDraggable&&this.point1.type!==i.A.OBJECT_TYPE_GLIDER&&!this.point1.evalVisProp("fixed"),a=this.point2.isDraggable&&this.point2.type!==i.A.OBJECT_TYPE_GLIDER&&!this.point2.evalVisProp("fixed"),t>o.A.eps?s>r&&a||s<=r&&a&&!n?(this.point2.setPositionDirectly(i.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()):(s<=r&&n||s>r&&n&&!a)&&(this.point1.setPositionDirectly(i.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=o.A.hypot(h,l),a?(this.point2.setPositionDirectly(i.A.COORDS_BY_USER,[this.point1.X()+h*e/t,this.point1.Y()+l*e/t]),this.point2.fullUpdate()):n&&(this.point1.setPositionDirectly(i.A.COORDS_BY_USER,[this.point2.X()+h*e/t,this.point2.Y()+l*e/t]),this.point1.fullUpdate())),this.fixedLengthOldCoords[0].setCoordinates(i.A.COORDS_BY_USER,this.point1.coords.usrCoords),this.fixedLengthOldCoords[1].setCoordinates(i.A.COORDS_BY_USER,this.point2.coords.usrCoords)),this):this},updateStdform:function(){var t=o.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])&&o.A.innerProduct(this.stdform,this.stdform,3)>=o.A.eps*o.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(),this.board.renderer.updateText(this.label)),this.setDisplayRendNode(),this.needsUpdate=!1,this):this},generatePolynomial:function(t){var e=this.point1.symbolic.x,i=this.point1.symbolic.y,s=this.point2.symbolic.x,r=this.point2.symbolic.y,o=t.symbolic.x,n=t.symbolic.y;return[["(",i,")*(",o,")-(",i,")*(",s,")+(",n,")*(",s,")-(",e,")*(",n,")+(",e,")*(",r,")-(",o,")*(",r,")"].join("")]},getRise:function(){return Math.abs(this.stdform[2])>=o.A.eps?-this.stdform[0]/this.stdform[2]:1/0},Slope:function(){return Math.abs(this.stdform[2])>=o.A.eps?-this.stdform[1]/this.stdform[2]:1/0},getSlope:function(){return this.Slope()},getAngle:function(t){var e,i=Math.atan2(-this.stdform[1],this.stdform[2]);return s.A.isString(t)&&""!==t?(""===(t=t.toLocaleLowerCase())||0===t.indexOf("rad")?e=i:0===t.indexOf("deg")?e=180*i/Math.PI:0===t.indexOf("sem")?e=i/Math.PI:0===t.indexOf("cir")&&(e=.5*i/Math.PI),e):i},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 u.A(i.A.COORDS_BY_USER,[.5*(this.point2.X()+this.point1.X()),.5*(this.point2.Y()+this.point1.Y())],this.board)},setLabelRelativeCoords:function(t){s.A.exists(this.label)&&(this.label.relativeCoords=new u.A(i.A.COORDS_BY_SCREEN,[t[0],-t[1]],this.board))},getLabelAnchor:function(){var t,e,r,n,a,l,c,d,p=1.5,f=0,A=new u.A(i.A.COORDS_BY_USER,this.point1.coords.usrCoords,this.board),_=new u.A(i.A.COORDS_BY_USER,this.point2.coords.usrCoords,this.board),m=this.evalVisProp("straightfirst"),g=this.evalVisProp("straightlast");if((m||g)&&h.A.calcStraight(this,A,_,0),A=A.scrCoords,_=_.scrCoords,!s.A.exists(this.label))return new u.A(i.A.COORDS_BY_SCREEN,[NaN,NaN],this.board);if(r=this.label.evalVisProp("position"),!s.A.isString(r))return new u.A(i.A.COORDS_BY_SCREEN,[NaN,NaN],this.board);if(r.indexOf("right")<0&&r.indexOf("left")<0)switch(r){case"last":t=_[1],e=_[2];break;case"first":t=A[1],e=A[2];break;case"lft":case"llft":case"ulft":A[1]<_[1]+o.A.eps?(t=A[1],e=A[2]):(t=_[1],e=_[2]);break;case"rt":case"lrt":case"urt":A[1]>_[1]+o.A.eps?(t=A[1],e=A[2]):(t=_[1],e=_[2]);break;default:t=.5*(A[1]+_[1]),e=.5*(A[2]+_[2])}else n=s.A.parsePosition(r),a=s.A.parseNumber(n.pos,1,1),l=_[1]-A[1],c=_[2]-A[2],d=o.A.hypot(l,c),n.pos.indexOf("px")>=0||n.pos.indexOf("fr")>=0||n.pos.indexOf("%")>=0?(n.pos.indexOf("px")>=0&&(a/=d),t=A[1]+a*l,e=A[2]+a*c):(t=A[1]+a*this.board.unitX*l/d,e=A[2]+a*this.board.unitY*c/d),"left"===n.side?l*=-1:c*=-1,s.A.exists(this.label)&&(p=.5*this.label.evalVisProp("distance")/d),t+=c*this.label.size[0]*p,e+=l*this.label.size[1]*p;return(m||g)&&(s.A.exists(this.label)&&(f=this.label.evalVisProp("fontsize")),Math.abs(t)t&&t>this.board.canvasWidth-f-o.A.eps&&(t=this.board.canvasWidth-f),o.A.eps+f>e&&e>-o.A.eps?e=f:this.board.canvasHeight+o.A.eps>e&&e>this.board.canvasHeight-f-o.A.eps&&(e=this.board.canvasHeight-f)),new u.A(i.A.COORDS_BY_SCREEN,[t,e],this.board)},cloneToBackground:function(){var t,e,i,r=s.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=s.A.isArray(t)?t:[t],r=i.length;for(e=0;e0&&d>0&&(r=h.A.projectPointToLine({coords:e},this,this.board),o=p.A.subtract([1,Math.round(a/c)*c,Math.round(l/d)*d],r.usrCoords),this.board.create("transform",o.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.point1.coords.usrCoords,i=this.point2.coords.usrCoords,s=this.stdform[2];return 0!==e[0]?0!==i[0]?e[1]+(i[1]-e[1])*t:e[1]+1e5*s*t:0!==e[0]?i[1]-(e[1]-i[1])*t:i[1]+1e5*s*t},Y:function(t){var e=this.point1.coords.usrCoords,i=this.point2.coords.usrCoords,s=this.stdform[1];return 0!==e[0]?0!==i[0]?e[2]+(i[2]-e[2])*t:e[2]-1e5*s*t:0!==e[0]?i[2]-(e[2]-i[2])*t:i[2]-1e5*s*t},Z:function(t){var e=this.point1.coords.usrCoords,i=this.point2.coords.usrCoords;return 1===t&&e[0]*i[0]===0?0:1},Ft:function(t){var e=[this.Z(t),this.X(t),this.Y(t)];return e[1]/=e[0],e[2]/=e[0],e[0]/=e[0],e},L:function(){return this.point1.Dist(this.point2)},setFixedLength:function(t){return this.hasFixedLength?(this.fixedLength=s.A.createFunction(t,this.board),this.hasFixedLength=!0,this.addParentsFromJCFunctions([this.fixedLength]),this.board.update(),this):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(),Y.A.prototype.remove.call(this)}}),t.A.createLine=function(e,i,r){var o,n,a,h,l,c,d,u=[],p=!1,f=!1;if(2===i.length){if(c=s.A.copyAttributes(r,e.options,"line","point1"),s.A.isArray(i[0])&&i[0].length>1)a=e.create("point",i[0],c);else if(s.A.isString(i[0])||s.A.isPoint(i[0]))a=e.select(i[0]);else if(s.A.isFunction(i[0])&&s.A.isPoint(i[0]()))a=i[0](),f=!0;else if(s.A.isFunction(i[0])&&i[0]().length&&i[0]().length>=2)a=t.A.createPoint(e,i[0](),c),f=!0;else{if(!s.A.isObject(i[0])||!s.A.isTransformationOrArray(i[1]))throw new Error("JSXGraph: Can't create line with parent types '"+typeof i[0]+"' and '"+typeof i[1]+"'.\nPossible parent types: [point,point], [[x1,y1],[x2,y2]], [a,b,c]");p=!0,a=e.create("point",[i[0].point1,i[1]],c)}if(c=s.A.copyAttributes(r,e.options,"line","point2"),p)h=e.create("point",[i[0].point2,i[1]],c);else if(s.A.isArray(i[1])&&i[1].length>1)h=e.create("point",i[1],c);else if(s.A.isString(i[1])||s.A.isPoint(i[1]))h=e.select(i[1]);else if(s.A.isFunction(i[1])&&s.A.isPoint(i[1]()))h=i[1](),f=!0;else{if(!(s.A.isFunction(i[1])&&i[1]().length&&i[1]().length>=2))throw new Error("JSXGraph: Can't create line with parent types '"+typeof i[0]+"' and '"+typeof i[1]+"'.\nPossible parent types: [point,point], [[x1,y1],[x2,y2]], [a,b,c]");h=t.A.createPoint(e,i[1](),c),f=!0}c=s.A.copyAttributes(r,e.options,"line"),n=new t.A.Line(e,a,h,c),f?(n.constrained=!0,n.funp1=i[0],n.funp2=i[1]):p||(n.isDraggable=!0),n.setParents([a.id,h.id])}else if(3===i.length){for(d=!0,l=0;l<3;l++)if(s.A.isNumber(i[l]))u[l]=s.A.createFunction(i[l]);else{if(!s.A.isFunction(i[l]))throw new Error("JSXGraph: Can't create line with parent types '"+typeof i[0]+"' and '"+typeof i[1]+"' and '"+typeof i[2]+"'.\nPossible parent types: [point,point], [[x1,y1],[x2,y2]], [a,b,c]");u[l]=i[l],d=!1}c=s.A.copyAttributes(r,e.options,"line","point1"),a=d?e.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):e.create("point",[function(){return.5*(u[2]()*u[2]()+u[1]()*u[1]())},function(){return.5*(u[2]()-u[1]()*u[0]()+u[2]())},function(){return.5*(-u[1]()-u[2]()*u[0]()-u[1]())}],c),c=s.A.copyAttributes(r,e.options,"line","point2"),h=d?e.create("point",[u[2]()*u[2]()+u[1]()*u[1](),-u[1]()*u[0]()+u[2](),-u[2]()*u[0]()-u[1]()],c):e.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=s.A.copyAttributes(r,e.options,"line"),(n=new t.A.Line(e,a,h,c)).isDraggable=d,n.setParents([a,h])}else if(1===i.length&&s.A.isFunction(i[0])&&2===i[0]().length&&s.A.isPoint(i[0]()[0])&&s.A.isPoint(i[0]()[1]))o=i[0](),c=s.A.copyAttributes(r,e.options,"line"),(n=new t.A.Line(e,o[0],o[1],c)).constrained=!0,n.funps=i[0],n.setParents(o);else{if(!(1===i.length&&s.A.isFunction(i[0])&&3===i[0]().length&&s.A.isNumber(i[0]()[0])&&s.A.isNumber(i[0]()[1])&&s.A.isNumber(i[0]()[2])))throw new Error("JSXGraph: Can't create line with parent types '"+typeof i[0]+"' and '"+typeof i[1]+"'.\nPossible parent types: [point,point], [[x1,y1],[x2,y2]], [a,b,c]");o=i[0],c=s.A.copyAttributes(r,e.options,"line","point1"),a=e.create("point",[function(){var t=o();return[.5*(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])]}],c),c=s.A.copyAttributes(r,e.options,"line","point2"),h=e.create("point",[function(){var t=o();return[t[2]*t[2]+t[1]*t[1],-t[1]*t[0]+t[2],-t[2]*t[0]-t[1]]}],c),c=s.A.copyAttributes(r,e.options,"line"),(n=new t.A.Line(e,a,h,c)).constrained=!0,n.funps=i[0],n.setParents([a,h])}return n},t.A.registerElement("line",t.A.createLine),t.A.createSegment=function(t,e,r){var o,n;if(r.straightFirst=!1,r.straightLast=!1,n=s.A.copyAttributes(r,t.options,"segment"),o=t.create("line",e.slice(0,2),n),3===e.length){try{o.hasFixedLength=!0,o.fixedLengthOldCoords=[],o.fixedLengthOldCoords[0]=new u.A(i.A.COORDS_BY_USER,o.point1.coords.usrCoords.slice(1,3),t),o.fixedLengthOldCoords[1]=new u.A(i.A.COORDS_BY_USER,o.point2.coords.usrCoords.slice(1,3),t),o.setFixedLength(e[2])}catch(t){throw new Error("JSXGraph: Can't create segment with third parent type '"+typeof e[2]+"'.\nPossible third parent types: number or function")}o.getParents=function(){return this.parents.concat(this.fixedLength())}}return o.elType="segment",o},t.A.registerElement("segment",t.A.createSegment),t.A.createArrow=function(t,e,r){var o,n;return r.straightFirst=!1,r.straightLast=!1,n=s.A.copyAttributes(r,t.options,"arrow"),(o=t.create("line",e,n)).type=i.A.OBJECT_TYPE_VECTOR,o.elType="arrow",o},t.A.registerElement("arrow",t.A.createArrow),t.A.createAxis=function(e,r,o){var n,a,h,l;a=s.A.copyAttributes(o,e.options,"axis");try{n=e.create("line",r,a)}catch(t){throw new Error("JSXGraph: Can't create axis with parent types '"+typeof r[0]+"' and '"+typeof r[1]+"'.\nPossible parent types: [point,point], [[x1,y1],[x2,y2]]")}for(h in n.type=i.A.OBJECT_TYPE_AXIS,n.isDraggable=!1,n.point1.isDraggable=!1,n.point2.isDraggable=!1,n._point1UsrCoordsOrg=n.point1.coords.usrCoords.slice(),n._point2UsrCoordsOrg=n.point2.coords.usrCoords.slice(),n.ancestors)n.ancestors.hasOwnProperty(h)&&(n.ancestors[h].type=i.A.OBJECT_TYPE_AXISPOINT);return l=s.A.exists(a.ticks.ticksdistance)?a.ticks.ticksdistance:s.A.isArray(a.ticks.ticks)?a.ticks.ticks:1,n.defaultTicks=e.create("ticks",[n,l],a.ticks),n.defaultTicks.dump=!1,n.elType="axis",n.subs={ticks:n.defaultTicks},n.inherits.push(n.defaultTicks),n.update=function(){var e,i,r,o,a,h,l,c,d,u,p,f,A,_,m,g,b,v,y;if(!this.needsUpdate)return this;if(e=this.board.getBoundingBox(),i=this.evalVisProp("position"),o=this.Direction(),a=this.isHorizontal(),h=this.isVertical(),l=this.evalVisProp("ticksautopos"),c=this.evalVisProp("ticksautoposthreshold"),c=a?s.A.parseNumber(c,Math.abs(e[1]-e[3]),1/this.board.unitX)*this.board.unitX:h?s.A.parseNumber(c,Math.abs(e[1]-e[3]),1/this.board.unitY)*this.board.unitY:s.A.parseNumber(c,1,1),p=(u=this.evalVisProp("anchor")).indexOf("left")>-1,f=u.indexOf("right")>-1,A=this.evalVisProp("anchordist"),A=a?s.A.parseNumber(A,Math.abs(e[1]-e[3]),1/this.board.unitX):h?s.A.parseNumber(A,Math.abs(e[0]-e[2]),1/this.board.unitY):0,g=this.board.getPointLoc(this._point1UsrCoordsOrg,A),_=this.point1.coords.usrCoords.slice(),m=this.point2.coords.usrCoords.slice(),"static"===i||!h&&!a||("fixed"===i?(a&&(o[0]>0&&f||o[0]<0&&p?(_[2]=e[3]+A,m[2]=e[3]+A):o[0]>0&&p||o[0]<0&&f?(_[2]=e[1]-A,m[2]=e[1]-A):(_=this._point1UsrCoordsOrg.slice(),m=this._point2UsrCoordsOrg.slice())),h&&(o[1]>0&&p||o[1]<0&&f?(_[1]=e[0]+A,m[1]=e[0]+A):o[1]>0&&f||o[1]<0&&p?(_[1]=e[2]-A,m[1]=e[2]-A):(_=this._point1UsrCoordsOrg.slice(),m=this._point2UsrCoordsOrg.slice()))):"sticky"===i&&(a&&(g[1]<0&&(o[0]>0&&f||o[0]<0&&p)?(_[2]=e[3]+A,m[2]=e[3]+A):g[1]>0&&(o[0]>0&&p||o[0]<0&&f)?(_[2]=e[1]-A,m[2]=e[1]-A):(_=this._point1UsrCoordsOrg.slice(),m=this._point2UsrCoordsOrg.slice())),h&&(g[0]<0&&(o[1]>0&&p||o[1]<0&&f)?(_[1]=e[0]+A,m[1]=e[0]+A):g[0]>0&&(o[1]>0&&f||o[1]<0&&p)?(_[1]=e[2]-A,m[1]=e[2]-A):(_=this._point1UsrCoordsOrg.slice(),m=this._point2UsrCoordsOrg.slice())))),this.point1.setPositionDirectly(t.A.COORDS_BY_USER,_),this.point2.setPositionDirectly(t.A.COORDS_BY_USER,m),s.A.exists(this.defaultTicks)){if(b=this.defaultTicks.visProp.label,l&&(a||h)){if(s.A.exists(b._anchorx_org)||(b._anchorx_org=s.A.def(b.anchorx,this.board.options.text.anchorX)),s.A.exists(b._anchory_org)||(b._anchory_org=s.A.def(b.anchory,this.board.options.text.anchorY)),s.A.exists(b._offset_org)||(b._offset_org=b.offset.slice()),y=b.offset,a){for(d=n.point1.coords.scrCoords[2]-.5*this.board.canvasHeight,v=b.anchory,d<0&&Math.abs(d)>c?"bottom"===b._side&&("top"===b.anchory&&(v="bottom"),y[1]*=-1,b._side="top"):d>0&&Math.abs(d)>c?"top"===b._side&&("bottom"===b.anchory&&(v="top"),y[1]*=-1,b._side="bottom"):(v=b._anchory_org,y=b._offset_org.slice(),"top"===v?b._side="bottom":"bottom"===v?b._side="top":y[1]<0?b._side="bottom":b._side="top"),r=0;rc?"right"===b._side&&("left"===b.anchorx&&(v="right"),y[0]*=-1,b._side="left"):d>0&&Math.abs(d)>c?"left"===b._side&&("right"===b.anchorx&&(v="left"),y[0]*=-1,b._side="right"):(v=b._anchorx_org,y=b._offset_org.slice(),"left"===v?b._side="right":"right"===v||y[0]<0?b._side="left":b._side="right"),r=0;r=0;l--)u=o.A.transpose(o.A.inverse(m[l].transformMat)),r=o.A.matVecMult(u,r);return r}],p),n.addChild(u),u.glider=n):(f=function(t,e,i){var s,r,a,h,l,c,d,u,p,f,A,_,m=Math.floor(t);if(1===e.bezierDegree)m===e.numberPoints-1&&m--;else{if(3!==e.bezierDegree)return 0;a=(t*((_="sector"===e.elType?(A=e.points.slice(3,e.numberPoints-3)).length:(A=e.points).length)-1)-(m=3*Math.floor(t*(_-1)/3)))/3,m>=_-1&&(m=_-4,a=1)}if(m<0)return 1;switch(1===e.bezierDegree?(s=e.points[m].usrCoords,r=e.points[m+1].usrCoords):(h=A[m].usrCoords,l=A[m+1].usrCoords,c=A[m+2].usrCoords,d=A[m+3].usrCoords,u=(1-a)*(1-a)*(l[1]-h[1])+2*(1-a)*a*(c[1]-l[1])+a*a*(d[1]-c[1]),p=(1-a)*(1-a)*(l[2]-h[2])+2*(1-a)*a*(c[2]-l[2])+a*a*(d[2]-c[2]),u/=f=o.A.hypot(u,p),p/=f,r=[1,(s=n.coords.usrCoords)[1]+u,s[2]+p]),i){case 0:return s[2]*r[1]-s[1]*r[2];case 1:return r[2]-s[2];case 2:return s[1]-r[1];default:return[s[2]*r[1]-s[1]*r[2],r[2]-s[2],s[1]-r[1]]}},u=t.create("line",[function(){var e;return e=n.type===i.A.OBJECT_TYPE_GLIDER?n.position:h.A.projectPointToCurve(n,a,t)[1],f(e,a)}],p),n.addChild(u),u.glider=n)}else a.type===i.A.OBJECT_TYPE_TURTLE?(u=t.create("line",[function(){var e,s;for(s=n.type===i.A.OBJECT_TYPE_GLIDER?n.position:h.A.projectPointToTurtle(n,a,t)[1],e=Math.floor(s),l=0;l=0;l--)u=o.A.transpose(o.A.inverse(g[l].transformMat)),r=o.A.matVecMult(u,r);return r}],u):(A=function(t,e,i){var s,r,a,h,l,c,d,u,p,f,A,_,m,g,b,v,y=Math.floor(t);if(1===e.bezierDegree)y===e.numberPoints-1&&y--,h=t;else{if(3!==e.bezierDegree)return 0;h=(t*((v="sector"===e.elType?(b=e.points.slice(3,e.numberPoints-3)).length:(b=e.points).length)-1)-(y=3*Math.floor(t*(v-1)/3)))/3,y>=v-1&&(y=v-4,h=1)}if(y<0)return 1;switch(s=h-y,1===e.bezierDegree?(r=e.points[y].usrCoords,a=e.points[y+1].usrCoords,m=[r[0]+s*(a[0]-r[0]),r[1]+s*(a[1]-r[1]),r[2]+s*(a[2]-r[2])],_=o.A.crossProduct(r,a),g=[(g=o.A.crossProduct([1,0,0],_))[0],-g[2],g[1]],_=o.A.crossProduct(m,g)):(l=b[y].usrCoords,c=b[y+1].usrCoords,d=b[y+2].usrCoords,u=b[y+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]),p/=A=o.A.hypot(p,f),f/=A,a=[1,(r=n.coords.usrCoords)[1]-f,r[2]+p],_=[r[2]*a[1]-r[1]*a[2],a[2]-r[2],r[1]-a[1]]),i){case 0:return _[0];case 1:return _[1];case 2:return _[2];default:return _}},l=t.create("line",[function(){var e;return e=n.type===i.A.OBJECT_TYPE_GLIDER?n.position:h.A.projectPointToCurve(n,a,t)[1],A(e,a)}],u),n.addChild(l),l.glider=n)}else{if(a.type!==i.A.OBJECT_TYPE_TURTLE)throw new Error("JSXGraph: Can't create normal with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [point,line], [point,circle], [glider]");l=t.create("line",[function(){var t,e,s=Math.floor(n.position),r=n.position-s;for(e=0;e1&&(h=e[0].type===i.A.OBJECT_TYPE_CONIC||e[0].elementClass===i.A.OBJECT_CLASS_CIRCLE,l=e[1].type===i.A.OBJECT_TYPE_CONIC||e[1].elementClass===i.A.OBJECT_CLASS_CIRCLE,c=s.A.isPoint(e[0]),d=s.A.isPoint(e[1])),2!==e.length||!(h&&d||c&&l))throw new 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?(n=t.select(e[0]),a=t.select(e[1])):(n=t.select(e[1]),a=t.select(e[0])),(o=t.create("tangent",[n,a],r)).elType="polarline",o},t.A.createTangentTo=function(t,e,r){var o,n,a,h,l,c,d;if(a=t.select(e[0]),h=s.A.providePoints(t,e[1],r,"point")[0],l=s.A.def(e[2],0),a.type!==i.A.OBJECT_TYPE_CIRCLE&&a.type!==i.A.OBJECT_TYPE_CONIC||h.elementClass!==i.A.OBJECT_CLASS_POINT)throw new 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 n=s.A.copyAttributes(r,t.options,"tangentto"),d=t.create("polar",[a,h],n.polar),c=t.create("intersection",[d,a,l],n.point),(o=t.create("tangent",[a,c],n)).point=c,o.polar=d,o.elType="tangentto",o},t.A.registerElement("tangent",t.A.createTangent),t.A.registerElement("normal",t.A.createNormal),t.A.registerElement("tangentto",t.A.createTangentTo),t.A.registerElement("polar",t.A.createTangent),t.A.registerElement("radicalaxis",t.A.createRadicalAxis),t.A.registerElement("polarline",t.A.createPolarLine);t.A.Line;t.A.Group=function(t,e,r,o,n){var a,h,l,c;for(this.board=t,this.objects={},a=this.board.numObjects,this.board.numObjects+=1,""!==e&&s.A.exists(e)?this.id=e:this.id=this.board.id+"Group"+a,this.board.groups[this.id]=this,this.type=i.A.OBJECT_TYPE_POINT,this.elementClass=i.A.OBJECT_CLASS_POINT,""!==r&&s.A.exists(r)?this.name=r:this.name="group_"+this.board.generateName(this),delete this.type,this.coords={},this.needsRegularUpdate=n.needsregularupdate,this.rotationCenter="centroid",this.scaleCenter=null,this.rotationPoints=[],this.translationPoints=[],this.scalePoints=[],this.scaleDirections={},this.parents=[],h=s.A.isArray(o)?o:Array.prototype.slice.call(arguments,3),l=0;l=0&&delete e.groups[i]);return this.objects={},this},addParents:function(t){var e,i,r;for(i=(r=s.A.isArray(t)?t:arguments).length,e=0;e=0?c:1,u=this.scaleDirections[r.id].indexOf("y")>=0?c:1,(f=this.board.create("transform",[1,0,0,_[0]*(1-d),d,0,_[1]*(1-u),0,u],{type:"generic"})).update()}}for(n in this.objects)(m=this.objects[n].point).elementClass!==i.A.OBJECT_CLASS_POINT&&(s.A.exists(f.board)?f.meltTo(m):r.id!==m.id&&A.meltTo(m));for(n in this._update_apply_transformation(r,f),this.needsUpdate=!1,this.objects)if(this.objects.hasOwnProperty(n))for(l in this.objects[n].descendants)this.objects[n].descendants.hasOwnProperty(l)&&(this.objects[n].descendants.needsUpdate=this.objects[n].descendants.needsRegularUpdate||this.board.needsFullUpdate);for(n in this.board.updateElements(r),this.objects)this.objects.hasOwnProperty(n)&&this._updateCoordsCache(n);return this},_update_find_drag_type:function(){var t,e,r,n="nothing",a=[];for(t in this.objects)this.objects.hasOwnProperty(t)&&(e=this.objects[t].point).coords.distance(i.A.COORDS_BY_USER,this.coords[t])>o.A.eps&&a.push(e.id);return 0===a.length?{action:n,id:"",changed:a}:(r=a[0],e=this.objects[r].point,a.length>1?n="translation":s.A.isInArray(this.rotationPoints,e)&&s.A.exists(this.rotationCenter)?n="rotation":s.A.isInArray(this.scalePoints,e)&&s.A.exists(this.scaleCenter)?n="scaling":s.A.isInArray(this.translationPoints,e)&&(n="translation"),{action:n,id:r,changed:a})},_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 r,n;for(r in this.objects)this.objects.hasOwnProperty(r)&&(s.A.exists(this.board.objects[r])?(n=this.objects[r].point).id!==t.id?"translation"===t.action?s.A.isInArray(t.changed,n.id)||n.elementClass===i.A.OBJECT_CLASS_POINT&&n.coords.setCoordinates(i.A.COORDS_BY_USER,[this.coords[r].usrCoords[1]+e[0],this.coords[r].usrCoords[2]+e[1]]):"rotation"!==t.action&&"scaling"!==t.action||n.elementClass===i.A.OBJECT_CLASS_POINT&&e.applyOnce([n]):"rotation"!==t.action&&"scaling"!==t.action||n.coords.setCoordinates(i.A.COORDS_BY_USER,o.A.matVecMult(e.matrix,this.coords[n.id].usrCoords)):delete this.objects[r])},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=s.A.uniqueArray(t.groups),this},addPoints:function(t){var e;for(e=0;e-1&&this[t+"Points"].splice(i,1),this},setProperty:function(){t.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}}),t.A.createGroup=function(e,i,r){var o=s.A.copyAttributes(r,e.options,"group"),n=new t.A.Group(e,o.id,o.name,i,o);return n.elType="group",n.setParents(i),n},t.A.registerElement("group",t.A.createGroup);t.A.Group;t.A.Circle=function(t,e,r,o,n){this.constructor(t,n,i.A.OBJECT_TYPE_CIRCLE,i.A.OBJECT_CLASS_CIRCLE),this.method=e,this.midpoint=this.board.select(r),this.center=this.board.select(r),this.point2=null,this.radius=0,this.line=null,this.circle=null,this.points=[],"twoPoints"===e?(this.point2=t.select(o),this.radius=this.Radius()):"pointRadius"===e?(this.gxtterm=o,this.updateRadius=s.A.createFunction(o,this.board),this.updateRadius(),this.addParentsFromJCFunctions([this.updateRadius])):"pointLine"===e?(this.line=t.select(o),this.radius=this.line.point1.coords.distance(i.A.COORDS_BY_USER,this.line.point2.coords)):"pointCircle"===e&&(this.circle=t.select(o),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(),s.A.exists(this.center._is_new)?(this.addChild(this.center),delete this.center._is_new):this.center.addChild(this),"pointRadius"===e?this.notifyParents(o):"pointLine"===e?this.line.addChild(this):"pointCircle"===e?this.circle.addChild(this):"twoPoints"===e&&(s.A.exists(this.point2._is_new)?(this.addChild(this.point2),delete this.point2._is_new):this.point2.addChild(this))},t.A.Circle.prototype=new Y.A,s.A.copyMethodMap(t.A.Circle,{setRadius:"setRadius",getRadius:"getRadius",Area:"Area",area:"Area",Perimeter:"Perimeter",Circumference:"Perimeter",radius:"Radius",Radius:"Radius",Diameter:"Diameter",center:"center",line:"line",point2:"point2"}),t.A.extend(t.A.Circle.prototype,{hasPoint:function(t,e){var r,n,a,h,l,c=this.center.coords.usrCoords,d=new u.A(i.A.COORDS_BY_SCREEN,[t,e],this.board),p=this.Radius();return s.A.isObject(this.evalVisProp("precision"))?(n=this.board._inputDevice,r=this.evalVisProp("precision."+n)):r=this.board.options.precision.hasPoint,a=c[1]-d.usrCoords[1],h=c[2]-d.usrCoords[2],l=o.A.hypot(a,h),r+=.5*this.evalVisProp("strokewidth"),r/=Math.sqrt(Math.abs(this.board.unitX*this.board.unitY)),this.evalVisProp("hasinnerpoints")?l=0?n=0:n*=Math.PI/180),a=1,"left"===o.side&&(a=-1),s.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(n),e=c[2]-(l*this.board.unitY+this.label.size[1]*h)*Math.sin(n),new u.A(i.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 u.A(i.A.COORDS_BY_USER,[t,e],this.board)},cloneToBackground:function(){var t,e=this.Radius(),i=s.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=s.A.isArray(t)?t:[t],r=i.length;for(e=0;e1)p[c]=t.create("point",e[c],f);else if(s.A.isPoint(e[c]))p[c]=t.select(e[c]);else if(s.A.isFunction(e[c])&&s.A.isPoint(e[c]()))p[c]=e[c]();else{if(!s.A.isString(e[c]))throw new 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]");p[c]=t.select(e[c])}if(s.A.isNumber(e[2]))l=s.A.createFunction(e[2],t);else if(s.A.isFunction(e[2])&&s.A.isNumber(e[2]()))l=e[2];else{if(s.A.isPoint(e[2]))h=t.select(e[2]);else if(e[2].length>1)h=t.create("point",e[2],f);else if(s.A.isFunction(e[2])&&s.A.isPoint(e[2]()))h=e[2]();else{if(!s.A.isString(e[2]))throw new 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]");h=t.select(e[2])}l=function(){return h.Dist(p[0])+h.Dist(p[1])}}for(s.A.exists(e[4])||(e[4]=2*Math.PI),s.A.exists(e[3])||(e[3]=0),a=t.create("point",[function(){return.5*(p[0].X()+p[1].X())},function(){return.5*(p[0].Y()+p[1].Y())}],A),(n=t.create("curve",[function(t){return 0},function(t){return 0},e[3],e[4]],_)).majorAxis=l,d=n.hasPoint,o=function(t,e){var i,s,r,o,a,h,c,d,u;e||(s=(i=l())*i,r=p[0].X(),o=p[0].Y(),c=r-(a=p[1].X()),d=o-(h=p[1].Y()),u=(s-r*r-o*o+a*a+h*h)/(2*i),n.quadraticform=[[u*u-a*a-h*h,u*c/i+a,u*d/i+h],[u*c/i+a,c*c/s-1,c*d/s],[u*d/i+h,c*d/s,d*d/s-1]])},n.X=function(t,e){var i=l(),s=p[1].Dist(p[0]),r=.5*(s*s-i*i)/(s*Math.cos(t)-i),n=Math.atan2(p[1].Y()-p[0].Y(),p[1].X()-p[0].X());return e||o(0,e),p[0].X()+Math.cos(n+t)*r},n.Y=function(t,e){var i=l(),s=p[1].Dist(p[0]),r=.5*(s*s-i*i)/(s*Math.cos(t)-i),o=Math.atan2(p[1].Y()-p[0].Y(),p[1].X()-p[0].X());return p[0].Y()+Math.sin(o+t)*r},n.midpoint=n.center=a,n.type=i.A.OBJECT_TYPE_CONIC,n.subs={center:n.center},n.inherits.push(n.center,p[0],p[1]),s.A.isPoint(h)&&n.inherits.push(h),n.hasPoint=function(t,e){var s,r,o,n;return this.evalVisProp("hasinnerpoints")?(s=p[0].coords,r=p[1].coords,o=this.majorAxis(),(n=new u.A(i.A.COORDS_BY_SCREEN,[t,e],this.board)).distance(i.A.COORDS_BY_USER,s)+n.distance(i.A.COORDS_BY_USER,r)<=o):d.apply(this,arguments)},a.addChild(n),c=0;c<2;c++)s.A.isPoint(p[c])&&p[c].addChild(n);return s.A.isPoint(h)&&h.addChild(n),n.setParents(e),n},t.A.createHyperbola=function(t,e,r){var o,n,a,h,l,c,d=[],u=s.A.copyAttributes(r,t.options,"conic","foci"),p=s.A.copyAttributes(r,t.options,"conic","center"),f=s.A.copyAttributes(r,t.options,"conic");for(c=0;c<2;c++)if(e[c].length>1)d[c]=t.create("point",e[c],u);else if(s.A.isPoint(e[c]))d[c]=t.select(e[c]);else if(s.A.isFunction(e[c])&&s.A.isPoint(e[c]()))d[c]=e[c]();else{if(!s.A.isString(e[c]))throw new 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]");d[c]=t.select(e[c])}if(s.A.isNumber(e[2]))l=s.A.createFunction(e[2],t);else if(s.A.isFunction(e[2])&&s.A.isNumber(e[2]()))l=e[2];else{if(s.A.isPoint(e[2]))h=t.select(e[2]);else if(e[2].length>1)h=t.create("point",e[2],u);else if(s.A.isFunction(e[2])&&s.A.isPoint(e[2]()))h=e[2]();else{if(!s.A.isString(e[2]))throw new 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]");h=t.select(e[2])}l=function(){return h.Dist(d[0])-h.Dist(d[1])}}for(s.A.exists(e[4])||(e[4]=1.0001*Math.PI),s.A.exists(e[3])||(e[3]=-1.0001*Math.PI),a=t.create("point",[function(){return.5*(d[0].X()+d[1].X())},function(){return.5*(d[0].Y()+d[1].Y())}],p),(n=t.create("curve",[function(t){return 0},function(t){return 0},e[3],e[4]],f)).majorAxis=l,o=function(t,e){var i,s,r,o,a,h,c,u,p;e||(s=(i=l())*i,r=d[0].X(),o=d[0].Y(),c=r-(a=d[1].X()),u=o-(h=d[1].Y()),p=(s-r*r-o*o+a*a+h*h)/(2*i),n.quadraticform=[[p*p-a*a-h*h,p*c/i+a,p*u/i+h],[p*c/i+a,c*c/s-1,c*u/s],[p*u/i+h,c*u/s,u*u/s-1]])},n.X=function(t,e){var i=l(),s=d[1].Dist(d[0]),r=.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||o(0,e),d[0].X()+Math.cos(n+t)*r},n.Y=function(t,e){var i=l(),s=d[1].Dist(d[0]),r=.5*(s*s-i*i)/(s*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)*r},n.midpoint=n.center=a,n.subs={center:n.center},n.inherits.push(n.center,d[0],d[1]),s.A.isPoint(h)&&n.inherits.push(h),n.type=i.A.OBJECT_TYPE_CONIC,a.addChild(n),c=0;c<2;c++)s.A.isPoint(d[c])&&d[c].addChild(n);return s.A.isPoint(h)&&h.addChild(n),n.setParents(e),n},t.A.createParabola=function(t,e,r){var o,n,a,l,c=e[0],d=e[1],u=s.A.copyAttributes(r,t.options,"conic","foci"),p=s.A.copyAttributes(r,t.options,"conic","center"),f=s.A.copyAttributes(r,t.options,"conic");if(e[0].length>1)c=t.create("point",e[0],u);else if(s.A.isPoint(e[0]))c=t.select(e[0]);else if(s.A.isFunction(e[0])&&s.A.isPoint(e[0]()))c=e[0]();else{if(!s.A.isString(e[0]))throw new Error("JSXGraph: Can't create Parabola with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [point,line]");c=t.select(e[0])}return s.A.isArray(d)&&2===d.length&&(l=s.A.copyAttributes(r,t.options,"conic","line"),d=t.create("line",d,l)),s.A.exists(e[3])||(e[3]=2*Math.PI),s.A.exists(e[2])||(e[2]=0),a=t.create("point",[function(){return h.A.projectPointToLine(c,d,t).usrCoords}],p),(n=t.create("curve",[function(t){return 0},function(t){return 0},e[2],e[3]],f)).midpoint=n.center=a,n.subs={center:n.center},n.inherits.push(n.center),o=function(t,e){var i,s,r,o,a,h;e||(i=d.stdform[1],s=d.stdform[2],r=d.stdform[0],o=i*i+s*s,a=c.X(),h=c.Y(),n.quadraticform=[[r*r-o*(a*a+h*h),r*i+o*a,r*s+o*h],[r*i+o*a,-s*s,i*s],[r*s+o*h,i*s,-i*i]])},n.X=function(t,e){var i,s=d.getAngle(),r=h.A.distPointLine(c.coords.usrCoords,d.stdform),n=d.point1.coords.usrCoords,a=d.point2.coords.usrCoords,l=c.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])*(l[2]-n[2])-(a[2]-n[2])*(l[1]-n[1])>=0?1:-1)*r/(1-Math.sin(t)),e||o(0,e),c.X()+Math.cos(t+s)*i},n.Y=function(t,e){var i,s=d.getAngle(),r=h.A.distPointLine(c.coords.usrCoords,d.stdform),o=d.point1.coords.usrCoords,n=d.point2.coords.usrCoords,a=c.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)*r/(1-Math.sin(t)),c.Y()+Math.sin(t+s)*i},n.type=i.A.OBJECT_TYPE_CONIC,a.addChild(n),s.A.isPoint(c)&&(c.addChild(n),n.inherits.push(c)),d.addChild(n),n.setParents(e),n},t.A.createConic=function(t,e,r){var n,a,h,l,c,u,p,f,A,_,m,g,b,v,y=[[1,0,0],[0,1,0],[0,0,1]],C=[[1,0,0],[0,1,0],[0,0,1]],P=[],E=[],x=s.A.copyAttributes(r,t.options,"conic","point"),O=s.A.copyAttributes(r,t.options,"conic","center"),M=s.A.copyAttributes(r,t.options,"conic");if(5===e.length)v=!0;else{if(6!==e.length)throw new Error("JSXGraph: Can't create generic Conic with "+e.length+" parameters.");v=!1}if(v)for(g=0;g<5;g++)if(e[g].length>1)P[g]=t.create("point",e[g],x);else if(s.A.isPoint(e[g]))P[g]=t.select(e[g]);else if(s.A.isFunction(e[g])&&s.A.isPoint(e[g]()))P[g]=e[g]();else{if(!s.A.isString(e[g]))throw new Error("JSXGraph: Can't create Conic section with parent types '"+typeof e[g]+"'.\nPossible parent types: [point,point,point,point,point], [a00,a11,a22,a01,a02,a12]");P[g]=t.select(e[g])}else(b=[[0,0,0],[0,0,0],[0,0,0]])[0][0]=s.A.isFunction(e[2])?function(){return e[2]()}:function(){return e[2]},b[0][1]=s.A.isFunction(e[4])?function(){return e[4]()}:function(){return e[4]},b[0][2]=s.A.isFunction(e[5])?function(){return e[5]()}:function(){return e[5]},b[1][1]=s.A.isFunction(e[0])?function(){return e[0]()}:function(){return e[0]},b[1][2]=s.A.isFunction(e[3])?function(){return e[3]()}:function(){return e[3]},b[2][2]=s.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;ii&&(C[r][i]=C[i][r]);a.quadraticform=C,(u=d.A.Jacobi(C))[0][0][0]<0&&(u[0][0][0]*=-1,u[0][1][1]*=-1,u[0][2][2]*=-1),y=u[1],A=Math.sqrt(Math.abs(u[0][0][0])),p=Math.sqrt(Math.abs(u[0][1][1])),f=Math.sqrt(Math.abs(u[0][2][2]))}return u[0][1][1]<=0&&u[0][2][2]<=0?n=o.A.matVecMult(y,[1/A,Math.cos(t)/p,Math.sin(t)/f]):u[0][1][1]<=0&&u[0][2][2]>0?n=o.A.matVecMult(y,[Math.cos(t)/A,1/p,Math.sin(t)/f]):u[0][2][2]<0&&(n=o.A.matVecMult(y,[Math.sin(t)/A,Math.cos(t)/p,1/f])),s.A.exists(n)?(n[1]/=n[0],n[2]/=n[0],n[0]=1):n=[1,NaN,NaN],n},a.X=function(t,e){return n(t,e)[1]},a.Y=function(t,e){return n(t,e)[2]},a.midpoint=t.create("point",[function(){var t=a.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]]}],O),a.type=i.A.OBJECT_TYPE_CONIC,a.center=a.midpoint,a.subs={center:a.center},a.inherits.push(a.center),a.inherits=a.inherits.concat(P),v){for(g=0;g<5;g++)s.A.isPoint(P[g])&&P[g].addChild(a);a.setParents(e)}return a.addChild(a.center),a},t.A.registerElement("ellipse",t.A.createEllipse),t.A.registerElement("hyperbola",t.A.createHyperbola),t.A.registerElement("parabola",t.A.createParabola),t.A.registerElement("conic",t.A.createConic),t.A.Polygon=function(t,e,r){this.constructor(t,r,i.A.OBJECT_TYPE_POLYGON,i.A.OBJECT_CLASS_AREA);var o,n,a,h,l,c=s.A.copyAttributes(r,t.options,"polygon","borders");for(this.withLines=r.withlines,this.attr_line=c,this.vertices=[],o=0;o0&&this.vertices[this.vertices.length-1].id!==this.vertices[0].id&&this.vertices.push(this.vertices[0]),this.borders=[],this.withLines)for(a=this.vertices.length-1,h=0;h0&&(c.strokecolor=c.colors[o%c.colors.length]),c.visible=s.A.exists(r.borders.visible)?r.borders.visible:r.visible,!1===c.strokecolor&&(c.strokecolor="none"),(n=t.create("segment",[this.vertices[o],this.vertices[o+1]],c)).dump=!1,this.borders[o]=n,n.parentPolygon=this,this.addChild(n);for(this.inherits.push(this.vertices,this.borders),this.id=this.board.setId(this,"Py"),o=0;os&&(s=this.vertices[o].X()),this.vertices[o].Y()>e&&(e=this.vertices[o].Y()),this.vertices[o].Y()i[2]&&(i[2]=e),(e=this.vertices[t].Y())>i[1]?i[1]=e:eo)return this;for(r=arguments.length-1,i=1;i=0&&(t-1&&r-1;e--)n[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;e1&&this.vertices[this.vertices.length-1].id!==this.vertices[0].id&&this.vertices.push(this.vertices[0]),this.withLines){for(e=0;e2&&(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=Y.A.prototype.getAttributes.call(this);if(this.withLines)for(e.lines=e.lines||{},e.lines.ids=[],e.lines.colors=[],t=0;t=0};for(r=0;r 2 as input.");if(s.A.isNumber(t.select(a))?(l--,c=!1):(a=l,c=!0),!1===(u=s.A.providePoints(t,e.slice(0,l),r,"regularpolygon",["vertices"])))throw new 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(d=s.A.copyAttributes(r,t.options,"regularpolygon","vertices"),n=2;n=a-2&&(d.id=d.ids[n-2]),u[n]=t.create("point",[u[n-2],h],d),u[n].type=i.A.OBJECT_TYPE_CAS,u[n].isDraggable=!0,u[n].visProp.fixed=!1);return d=s.A.copyAttributes(r,t.options,"regularpolygon"),(o=t.create("polygon",u,d)).elType="regularpolygon",o},t.A.createPolygonalChain=function(t,e,i){var r,o;return r=s.A.copyAttributes(i,t.options,"polygonalchain"),(o=t.create("polygon",e,r)).elType="polygonalchain",o.vertices.pop(),t.removeObject(o.borders[o.borders.length-1]),o.borders.pop(),o},t.A.createParallelogram=function(t,e,i){var r,o,n,a,h;if(!1===(n=s.A.providePoints(t,e,i,"polygon",["vertices"]))||n.length<3)throw new Error("JSXGraph: Can't create parallelogram with parent types other than 'point' and 'coordinate arrays' or a function returning an array of coordinates.");return h=s.A.copyAttributes(i,t.options,"parallelogram","parallelpoint"),o=t.create("parallelpoint",n,h),a=s.A.copyAttributes(i,t.options,"parallelogram"),(r=t.create("polygon",[n[0],n[1],o,n[2]],a)).elType="parallelogram",r.parallelPoint=o,r.isDraggable=!0,o.isDraggable=!0,o.visProp.fixed=!1,r},t.A.registerElement("polygon",t.A.createPolygon),t.A.registerElement("regularpolygon",t.A.createRegularPolygon),t.A.registerElement("polygonalchain",t.A.createPolygonalChain),t.A.registerElement("parallelogram",t.A.createParallelogram);var F=t.A.Polygon;t.A.Curve=function(t,e,r){this.constructor(t,r,i.A.OBJECT_TYPE_CURVE,i.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,s.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(),s.A.isString(this.xterm)&&this.notifyParents(this.xterm),s.A.isString(this.yterm)&&this.notifyParents(this.yterm)},t.A.Curve.prototype=new Y.A,s.A.copyMethodMap(t.A.Curve,{generateTerm:"generateTerm",setTerm:"generateTerm",move:"moveTo",moveTo:"moveTo",MinX:"minX",MaxX:"maxX"}),t.A.extend(t.A.Curve.prototype,{minX:function(){return"polar"===this.evalVisProp("curvetype")?0:new u.A(i.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 u.A(i.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},Ft:function(t){var e=[this.Z(t),this.X(t),this.Y(t)];return this.transformations.length>0&&(e=o.A.matVecMult(this.transformMat,e)),e[1]/=e[0],e[2]/=e[0],e[0]/=e[0],e},hasPoint:function(t,e,r){var n,a,l,c,d,p,f,A,_,m,g,b,v,y,C,P,E=[],x=this.evalVisProp("numberpointslow"),O=(this.maxX()-this.minX())/x,M=1/0,w=!0;if(s.A.isObject(this.evalVisProp("precision"))?(b=this.board._inputDevice,g=this.evalVisProp("precision."+b)):g=this.board.options.precision.hasPoint,t=(p=new u.A(i.A.COORDS_BY_SCREEN,[t,e],this.board,!1)).usrCoords[1],e=p.usrCoords[2],1===this.bezierDegree&&this.evalVisProp("hasinnerpoints")&&0!==h.A.windingNumber([1,t,e],this.points,!0))return!0;if(g+=.5*this.evalVisProp("strokewidth"),g*=g,v=this.board.unitX*this.board.unitX,y=this.board.unitY*this.board.unitY,P=this.minX(),this.maxX(),s.A.exists(this._visibleArea)&&(P=this._visibleArea[0],O=(this._visibleArea[1]-P)/x),"parameter"===(C=this.evalVisProp("curvetype"))||"polar"===C)for(this.transformations.length>0&&(this.updateTransformMatrix(),A=o.A.inverse(this.transformMat),t=(a=o.A.matVecMult(A,[1,t,e]))[1],e=a[2]),l=0,n=P;l=0&&E[1]<=1&&(t-E[0][1])*(t-E[0][1])*v+(e-E[0][2])*(e-E[0][2])*y<=g)return!0;return!1}return M0&&(this.points[t].prev=this.points[t-1]),t0&&(e=o.A.matVecMult(this.transformMat,t.usrCoords),t.setCoordinates(i.A.COORDS_BY_USER,e,!1,!0)),t},addTransform:function(t){var e,i=s.A.isArray(t)?t:[t],r=i.length;for(e=0;e=(c-1)/3)return s.A.isFunction(l[l.length-1])?l[l.length-1]():l[l.length-1];for(o=3*Math.floor(t),h=1-(a=t%1),n=0;n<4;n++)s.A.isFunction(l[o+n])?d[n]=l[o+n]():d[n]=l[o+n];return h*h*(h*d[0]+3*a*d[1])+(3*h*d[2]+a*d[3])*a*a}if((o=t>c-2?c-2:parseInt(Math.floor(t),10))===t)return s.A.isFunction(l[o])?l[o]():l[o];for(n=0;n<2;n++)s.A.isFunction(l[o+n])?d[n]=l[o+n]():d[n]=l[o+n];return d[0]+(d[1]-d[0])*(t-o)}},generateTerm:function(t,e,i,r,n){var a,h,l,c;s.A.isArray(e)?(this.dataX=e,this.numberPoints=this.dataX.length,this.X=this.interpolationFunctionFromArray.apply(this,["X"]),this.visProp.curvetype="plot",this.isDraggable=!0):(this.X=s.A.createFunction(e,this.board,t),s.A.isString(e)?this.visProp.curvetype="functiongraph":(s.A.isFunction(e)||s.A.isNumber(e))&&(this.visProp.curvetype="parameter"),this.isDraggable=!0),s.A.isArray(i)?(this.dataY=i,this.Y=this.interpolationFunctionFromArray.apply(this,["Y"])):s.A.exists(i)?this.Y=s.A.createFunction(i,this.board,t):(c=(l=o.A.transpose(e)).length>2?1:0,this.dataX=l[c],this.dataY=l[c+1],this.numberPoints=this.dataX.length,this.Y=this.interpolationFunctionFromArray.apply(this,["Y"])),s.A.isFunction(e)&&s.A.isArray(i)&&(a=s.A.createFunction(i[0],this.board,""),h=s.A.createFunction(i[1],this.board,""),this.X=function(t){return e(t)*Math.cos(t)+a()},this.X.deps=a.deps,this.Y=function(t){return e(t)*Math.sin(t)+h()},this.Y.deps=h.deps,this.visProp.curvetype="polar"),s.A.exists(r)?this.minX=s.A.createFunction(r,this.board,""):delete this.minX,s.A.exists(n)?this.maxX=s.A.createFunction(n,this.board,""):delete this.maxX,this.addParentsFromJCFunctions([this.X,this.Y,this.minX,this.maxX])},notifyParents:function(t){var e,i,s,r=!1;for(e in s={xterm:1,yterm:1})if(s.hasOwnProperty(e)&&this.hasOwnProperty(e)&&this[e].origin)for(i in r=!0,this[e].origin.deps)this[e].origin.deps.hasOwnProperty(i)&&this[e].origin.deps[i].addChild(this);r||w.A.findDependencies(this,t,this.board)},getLabelPosition:function(t,e){var r,n,a,h,l,c,p,f,A,_,m,g,b,v,y,C,P,E=1.5;return g=this.minX(),b=this.maxX(),v=d.A.findDomain(this.X,[g,b],null,!1),v=d.A.findDomain(this.Y,v,null,!1),g=Math.max(v[0],v[0]),b=Math.min(v[1],v[1]),a=s.A.parsePosition(t),m=s.A.parseNumber(a.pos,b-g,1),a.pos.indexOf("fr")<0&&a.pos.indexOf("%")<0&&(m=0),y=g+m,r=(p=this.Ft(y))[1],n=p[2],isNaN(r+n)&&(y=g+(m/=b-g),_=this.Ft(g),A=this.Ft(b),r=_[1]+m*(A[1]-_[1]),n=_[2]+m*(A[2]-_[2])),h=new u.A(i.A.COORDS_BY_USER,[r,n],this.board).scrCoords,yb-c?(f=this.Ft(y-c),C=(p[1]-f[1])/c,P=(p[2]-f[2])/c):(f=this.Ft(y+c),p=this.Ft(y-c),C=.5*(f[1]-p[1])/c,P=.5*(f[2]-p[2])/c),C=isNaN(C)?1:C,P=isNaN(P)?1:P,l=o.A.hypot(C,P),"left"===a.side?P*=-1:C*=-1,s.A.exists(this.label)&&(E=.5*e/l),r=h[1]+P*this.label.size[0]*E,n=h[2]-C*this.label.size[1]*E,new u.A(i.A.COORDS_BY_SCREEN,[r,n],this.board)},getLabelAnchor:function(){var t,e,r,o,n=.1*this.board.canvasWidth,a=.1*this.board.canvasHeight,l=.9*this.board.canvasWidth,c=.9*this.board.canvasHeight;if(!s.A.exists(this.label))return new u.A(i.A.COORDS_BY_SCREEN,[NaN,NaN],this.board);if(r=this.label.evalVisProp("position"),!s.A.isString(r))return new u.A(i.A.COORDS_BY_SCREEN,[NaN,NaN],this.board);if(!(r.indexOf("right")<0&&r.indexOf("left")<0))return this.getLabelPosition(r,this.label.evalVisProp("distance"));switch(this.evalVisProp("label.position")){case"ulft":t=n,e=a;break;case"llft":t=n,e=c;break;case"rt":t=l,e=.5*c;break;case"lrt":t=l,e=c;break;case"urt":t=l,e=a;break;case"top":t=.5*l,e=a;break;case"bot":t=.5*l,e=c;break;default:t=n,e=.5*c}return o=new u.A(i.A.COORDS_BY_SCREEN,[t,e],this.board,!1),h.A.projectCoordsToCurve(o.usrCoords[1],o.usrCoords[2],0,this,this.board)[0]},cloneToBackground:function(){var t,e=s.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,o=-1/0,n=1/0,a=-1/0,h=this.points.length;if(3===this.bezierDegree){for(t=0;tthis.points[t].usrCoords[1]&&(r=this.points[t].usrCoords[1]),othis.points[t].usrCoords[2]&&(n=this.points[t].usrCoords[2]),a0&&!this.evalVisProp("fixed")?(e=this.points[0],s=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(i.A.COORDS_BY_USER,s),this.board.update(this)):this},getTransformationSource:function(){var t,e;return s.A.exists(this._transformationSource)&&(e=this._transformationSource).elementClass===i.A.OBJECT_CLASS_CURVE&&(t=!0),[t,e]},getCoords:function(){var t,e,i=[];for(t=this.numberPoints,e=0;e5&&s.A.isArray(this.Q[5]()))for(t.push(NaN),e.push(NaN),b=this.evalVisProp("outlier.face"),"vertical"===h?(f=this.evalVisProp("outlier.size")/this.board.unitX,A=this.evalVisProp("outlier.size")/this.board.unitY):(A=this.evalVisProp("outlier.size")/this.board.unitX,f=this.evalVisProp("outlier.size")/this.board.unitY),_=f*Math.sqrt(2),m=A*Math.sqrt(2),d=(u=this.Q[5]()).length,c=0;c":case"diamond":t.push(l,l+f,l,l-f,l,NaN),e.push(p+A,p,p-A,p,p+A,NaN);break;case"<<>>":case"diamond2":t.push(l,l+_,l,l-_,l,NaN),e.push(p+m,p,p-m,p,p+m,NaN);break;case"+":case"plus":t.push(l-f,l+f,NaN,l,l,NaN),e.push(p,p,NaN,p-A,p+A,NaN);break;case"-":case"minus":t.push(l-f,l+f,NaN),e.push(p,p,NaN);break;case"|":case"divide":t.push(l,l,NaN),e.push(p-A,p+A,NaN);break;default:for(g=0;g<=2*Math.PI;g+=2*Math.PI/17)t.push(l-f*Math.sin(g)),e.push(p-A*Math.cos(g));t.push(NaN),e.push(NaN)}"vertical"===h?(this.dataX=t,this.dataY=e):(this.dataX=e,this.dataY=t)},r.addParentsFromJCFunctions([r.Q,r.x,r.w]),r},t.A.registerElement("boxplot",t.A.createBoxPlot),t.A.createImplicitCurve=function(t,e,i){var r,o;if([1,3,5].indexOf(e.length)<0)throw new 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 o=s.A.copyAttributes(i,t.options,"implicitcurve"),(r=t.create("curve",[[],[]],o)).f=s.A.createFunction(e[0],t,"x, y"),5===e.length||s.A.isString(e[1])||s.A.isFunction(e[1])?r.dfx=s.A.createFunction(e[1],t,"x, y"):r.dfx=null,5===e.length||s.A.isString(e[2])||s.A.isFunction(e[2])?r.dfy=s.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,o,n,a;null===this.domain?(a=this.evalVisProp("margin"),(t=this.board.getBoundingBox())[0]-=a,t[1]+=a,t[2]+=a,t[3]-=a):(e=s.A.evaluate(this.domain[0]),i=s.A.evaluate(this.domain[1]),t=[Math.min(e[0],e[1]),Math.max(i[0],i[1]),Math.max(e[0],e[1]),Math.min(i[0],i[1])]),o={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 A(t,o,this.f,this.dfx,this.dfy),this.qdt=r.qdt,n=r.plot(),this.dataX=n[0],this.dataY=n[1]},r.elType="implicitcurve",r},t.A.registerElement("implicitcurve",t.A.createImplicitCurve),t.A.createSketchCurve=function(t,e,i){var r,o;return o=s.A.copyAttributes(i,t.options,"sketchcurve"),(r=t.create("curve",[[],[]],o)).elType="sketchcurve",r},t.A.registerElement("sketchcurve",t.A.createSketchCurve);t.A.Curve;t.A.createArc=function(e,r,n){var a,l,c;if(l=s.A.copyAttributes(n,e.options,"arc"),!1===(c=s.A.providePoints(e,r,l,"arc",["center","radiuspoint","anglepoint"]))||c.length<3)throw new Error("JSXGraph: Can't create Arc with parent types '"+typeof r[0]+"' and '"+typeof r[1]+"' and '"+typeof r[2]+"'.\nPossible parent types: [point,point,point], [arc, transformation]");return(a=e.create("curve",[[0],[0],0,4],l)).elType="arc",a.setParents(c),a.type=i.A.OBJECT_TYPE_ARC,a.center=c[0],a.radiuspoint=c[1],a.point2=a.radiuspoint,a.anglepoint=c[2],a.point3=a.anglepoint,s.A.exists(a.center._is_new)?(a.addChild(a.center),delete a.center._is_new):a.center.addChild(a),s.A.exists(a.radiuspoint._is_new)?(a.addChild(a.radiuspoint),delete a.radiuspoint._is_new):a.radiuspoint.addChild(a),s.A.exists(a.anglepoint._is_new)?(a.addChild(a.anglepoint),delete a.anglepoint._is_new):a.anglepoint.addChild(a),a.useDirection=l.usedirection,a.updateDataArray=function(){var t,e,i,s,r,o,n,a,l=1,d=this.radiuspoint,u=this.center,p=this.anglepoint,f=this.evalVisProp("selection"),A=this.evalVisProp("orientation");e=h.A.rad(d,u,p),("minor"===f&&e>Math.PI||"major"===f&&e0&&(this.updateTransformMatrix(),l=o.A.inverse(this.transformMat),c=o.A.matVecMult(l,n.usrCoords),n=new u.A(i.A.COORDS_BY_USER,c,this.board)),r=this.center.coords.distance(i.A.COORDS_BY_USER,n),(a=Math.abs(r-f)Math.PI||"major"===g&&c=0?1:-1):a.direction1=r[2]>=0?1:-1,s.A.isArray(r[3])?(2===r[3].length&&(r[3]=[1].concat(r[3])),f=h.A.projectPointToLine({coords:{usrCoords:r[3]}},a.line2,e),f=p.A.subtract(f.usrCoords,d.usrCoords),a.direction2=o.A.innerProduct(f,[0,a.line2.stdform[2],-a.line2.stdform[1]],3)>=0?1:-1):a.direction2=r[3]>=0?1:-1,a.updateDataArray=function(){var e,s,r,n,l,c,d=1e-14,f=[0,0,0];if(s=this.line1,r=this.line2,f=o.A.crossProduct(s.stdform,r.stdform),h.A.distance(f,[0,0,0],3)d&&(f[1]/=f[0],f[2]/=f[0],f[0]/=f[0]),e=this.direction1*this.Radius(),n=p.A.add(f,[0,e*s.stdform[2],-e*s.stdform[1]]),e=this.direction2*this.Radius(),l=p.A.add(f,[0,e*r.stdform[2],-e*r.stdform[1]]),this.point2.coords=new u.A(i.A.COORDS_BY_USER,n,a.board),this.point1.coords=new u.A(i.A.COORDS_BY_USER,f,a.board),this.point3.coords=new u.A(i.A.COORDS_BY_USER,l,a.board),Math.abs(n[0])Math.PI||"major"===f&&lMath.PI||"major"===f&&l=0&&(u=this.point2,c=this.point3)),o=c.coords.usrCoords,n=d.coords.usrCoords,a=u.coords.usrCoords,t=h.A.bezierArc(o,n,a,!0,p),this.dataX=t[0],this.dataY=t[1],this.bezierDegree=3},a.Radius=function(){return this.point2.Dist(this.point1)},s.A.extendInstanceMethodMap(a,{arc:"arc",center:"center",radiuspoint:"radiuspoint",anglepoint:"anglepoint"})}return a.center=a.point1,a.radiuspoint=a.point2,a.anglepoint=a.point3,l=s.A.copyAttributes(n,e.options,"arc"),(l=s.A.copyAttributes(l,e.options,"sector","arc")).withlabel=!1,l.selection=a.visProp.selection,l.name+="_arc","2lines"===m?(a.updateDataArray(),a.arc=e.create("arc",[function(){return a.point1.coords.usrCoords},function(){var t=a.point2.coords.distance(i.A.COORDS_BY_USER,a.point1.coords);return 0===t?[a.point1.coords.usrCoords[1],a.point1.coords.usrCoords[2]]:[a.point1.coords.usrCoords[1]+a.Radius()*(a.point2.coords.usrCoords[1]-a.point1.coords.usrCoords[1])/t,a.point1.coords.usrCoords[2]+a.Radius()*(a.point2.coords.usrCoords[2]-a.point1.coords.usrCoords[2])/t]},function(){return a.point3.coords.usrCoords}],l)):a.arc=e.create("arc",[a.point1,function(){var t,e,i=a.point2.Dist(a.point1);return t=a.point1,e=a.point2,0===i?[t.X(),t.Y()]:[t.X()+a.Radius()*(e.X()-t.X())/i,t.Y()+a.Radius()*(e.Y()-t.Y())/i]},a.point3],l),a.addChild(a.arc),a.inherits.push(a.arc),a.hasPointCurve=function(t,e){var r,o,n,a,l,c,d=new u.A(i.A.COORDS_BY_SCREEN,[t,e],this.board),p=this.Radius(),f=this.center.coords.distance(i.A.COORDS_BY_USER,d),A=this.evalVisProp("selection"),_=this.evalVisProp("orientation");return s.A.isObject(this.evalVisProp("precision"))?(l=this.board._inputDevice,a=this.evalVisProp("precision."+l)):a=this.board.options.precision.hasPoint,a/=Math.min(Math.abs(this.board.unitX),Math.abs(this.board.unitY)),(c=Math.abs(f-p)Math.PI||"major"===A&&nn)&&(c=!1)),c},a.hasPointSector=function(t,e){var s,r,o,n=new u.A(i.A.COORDS_BY_SCREEN,[t,e],this.board),a=this.Radius(),l=this.point1.coords.distance(i.A.COORDS_BY_USER,n)Math.PI||"major"===c&&oo)&&(l=!1)),l},a.hasPoint=function(t,e){return this.evalVisProp("highlightonsector")||this.evalVisProp("hasinnerpoints")?this.hasPointSector(t,e):this.hasPointCurve(t,e)},a.getTextAnchor=function(){return this.point1.coords},a.getLabelAnchor=function(){var t,e,r,n,a,l=this.label.evalVisProp("position"),c=h.A.rad(this.point2,this.point1,this.point3),d=13/this.board.unitX,p=13/this.board.unitY,f=this.point2.coords.usrCoords,A=this.point1.coords.usrCoords,_=f[1]-A[1],m=f[2]-A[2],g=this.evalVisProp("selection"),b=this.evalVisProp("orientation"),v=this.label?this.label.visProp:this.visProp.label;return!s.A.isString(l)||l.indexOf("right")<0&&l.indexOf("left")<0?(("minor"===g&&c>Math.PI||"major"===g&&cMath.PI||"major"===u&&r0&&(t.transformations.pop(),t.isDraggable=!0,t.parents=[],t.coords.off("update")),this.hasFixedAngle=!1,this},n.setParents(p)),s.A.exists(n.visProp.text)&&n.label.setText(n.evalVisProp("text")),n.elType="angle",n.type=i.A.OBJECT_TYPE_ANGLE,n.subs={},n.updateDataArraySquare=function(){var t,e,i,s,r,n,a,l,c=this.Radius();"2lines"===f&&this.updateDataArraySector(),t=this.point2,e=this.point1,i=this.point3,t=t.coords.usrCoords,e=e.coords.usrCoords,i=i.coords.usrCoords,s=h.A.distance(t,e,3),r=h.A.distance(i,e,3),t=[1,e[1]+(t[1]-e[1])*c/s,e[2]+(t[2]-e[2])*c/s],i=[1,e[1]+(i[1]-e[1])*c/r,e[2]+(i[2]-e[2])*c/r],n=o.A.crossProduct(i,e),a=[-t[1]*n[1]-t[2]*n[2],t[0]*n[1],t[0]*n[2]],n=o.A.crossProduct(t,e),l=[-i[1]*n[1]-i[2]*n[2],i[0]*n[1],i[0]*n[2]],(n=o.A.crossProduct(a,l))[1]/=n[0],n[2]/=n[0],this.dataX=[e[1],t[1],n[1],i[1],e[1]],this.dataY=[e[2],t[2],n[2],i[2],e[2]],this.bezierDegree=1},n.updateDataArrayNone=function(){this.dataX=[NaN],this.dataY=[NaN],this.bezierDegree=1},n.updateDataArray=function(){var t=this.evalVisProp("type"),e=h.A.trueAngle(this.point2,this.point1,this.point3),i=this.evalVisProp("selection"),s=this.evalVisProp("orientation");("minor"===i&&e>180||"major"===i&&e<180||"auto"===i&&"clockwise"===s)&&(e=360-e),Math.abs(e-90)Math.PI||"major"===u&&aMath.PI||"major"===_&&c=Math.PI?e:2*Math.PI-e,this.arc.Value(t,e)},o},t.A.registerElement("reflexangle",t.A.createReflexAngle),t.A.createOrthogonalProjection=function(t,e,r){var o,n,a,l,c={name:""};if(e[0]=t.select(e[0]),e[1]=t.select(e[1]),s.A.isPointType(t,e[0])&&e[1].elementClass===i.A.OBJECT_CLASS_LINE)n=s.A.providePoints(t,[e[0]],c,"point")[0],o=e[1];else{if(!s.A.isPointType(t,e[1])||e[0].elementClass!==i.A.OBJECT_CLASS_LINE)throw new Error("JSXGraph: Can't create perpendicular point with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [point,line]");n=s.A.providePoints(t,[e[1]],c,"point")[0],o=e[0]}return l=s.A.copyAttributes(r,t.options,"orthogonalprojection"),a=t.create("point",[function(){return h.A.projectPointToLine(n,o,t)}],l),s.A.exists(n._is_new)?(a.addChild(n),delete n._is_new):n.addChild(a),o.addChild(a),a.elType="orthogonalprojection",a.setParents([n.id,a.id]),a.update(),a.generatePolynomial=function(){var t=o.point1.symbolic.x,e=o.point1.symbolic.y,i=o.point2.symbolic.x,s=o.point2.symbolic.y,r=n.symbolic.x,h=n.symbolic.y,l=a.symbolic.x,c=a.symbolic.y;return["("+e+")*("+l+")-("+e+")*("+i+")+("+c+")*("+i+")-("+t+")*("+c+")+("+t+")*("+s+")-("+l+")*("+s+")","("+h+")*("+e+")-("+h+")*("+s+")-("+c+")*("+e+")+("+c+")*("+s+")+("+r+")*("+t+")-("+r+")*("+i+")-("+l+")*("+t+")+("+l+")*("+i+")"]},a},t.A.createPerpendicular=function(e,r,o){var n,a,h,l,c={name:""};if(r[0]=e.select(r[0]),r[1]=e.select(r[1]),s.A.isPointType(e,r[0])&&r[1].elementClass===i.A.OBJECT_CLASS_LINE)a=r[1],n=s.A.providePoints(e,[r[0]],c,"point")[0];else{if(!s.A.isPointType(e,r[1])||r[0].elementClass!==i.A.OBJECT_CLASS_LINE)throw new Error("JSXGraph: Can't create perpendicular with parent types '"+typeof r[0]+"' and '"+typeof r[1]+"'.\nPossible parent types: [line,point]");a=r[0],n=s.A.providePoints(e,[r[1]],c,"point")[0]}return l=s.A.copyAttributes(o,e.options,"perpendicular"),(h=t.A.createLine(e,[function(){return a.stdform[2]*n.X()-a.stdform[1]*n.Y()},function(){return-a.stdform[2]*n.Z()},function(){return a.stdform[1]*n.Z()}],l)).elType="perpendicular",h.setParents([a.id,n.id]),s.A.exists(n._is_new)?(h.addChild(n),delete n._is_new):n.addChild(h),a.addChild(h),h},t.A.createPerpendicularPoint=function(t,e,r){var o,n,a,l={name:""};if(e[0]=t.select(e[0]),e[1]=t.select(e[1]),s.A.isPointType(t,e[0])&&e[1].elementClass===i.A.OBJECT_CLASS_LINE)n=s.A.providePoints(t,[e[0]],l,"point")[0],o=e[1];else{if(!s.A.isPointType(t,e[1])||e[0].elementClass!==i.A.OBJECT_CLASS_LINE)throw new Error("JSXGraph: Can't create perpendicular point with parent types '"+typeof e[0]+"' and '"+typeof e[1]+"'.\nPossible parent types: [point,line]");n=s.A.providePoints(t,[e[1]],l,"point")[0],o=e[0]}return a=t.create("point",[function(){return h.A.perpendicular(o,n,t)[0]}],r),s.A.exists(n._is_new)?(a.addChild(n),delete n._is_new):n.addChild(a),o.addChild(a),a.elType="perpendicularpoint",a.setParents([n.id,o.id]),a.update(),a.generatePolynomial=function(){var t=o.point1.symbolic.x,e=o.point1.symbolic.y,i=o.point2.symbolic.x,s=o.point2.symbolic.y,r=n.symbolic.x,h=n.symbolic.y,l=a.symbolic.x,c=a.symbolic.y;return["("+e+")*("+l+")-("+e+")*("+i+")+("+c+")*("+i+")-("+t+")*("+c+")+("+t+")*("+s+")-("+l+")*("+s+")","("+h+")*("+e+")-("+h+")*("+s+")-("+c+")*("+e+")+("+c+")*("+s+")+("+r+")*("+t+")-("+r+")*("+i+")-("+l+")*("+t+")+("+l+")*("+i+")"]},a},t.A.createPerpendicularSegment=function(e,r,o){var n,a,l,c,d,u={name:""};if(r[0]=e.select(r[0]),r[1]=e.select(r[1]),s.A.isPointType(e,r[0])&&r[1].elementClass===i.A.OBJECT_CLASS_LINE)a=r[1],n=s.A.providePoints(e,[r[0]],u,"point")[0];else{if(!s.A.isPointType(e,r[1])||r[0].elementClass!==i.A.OBJECT_CLASS_LINE)throw new Error("JSXGraph: Can't create perpendicular with parent types '"+typeof r[0]+"' and '"+typeof r[1]+"'.\nPossible parent types: [line,point]");a=r[0],n=s.A.providePoints(e,[r[1]],u,"point")[0]}return d=s.A.copyAttributes(o,e.options,"perpendicularsegment","point"),(c=t.A.createPerpendicularPoint(e,[a,n],d)).dump=!1,s.A.exists(o.layer)||(o.layer=e.options.layer.line),d=s.A.copyAttributes(o,e.options,"perpendicularsegment"),(l=t.A.createLine(e,[function(){return h.A.perpendicular(a,n,e)[1]?[c,n]:[n,c]}],d)).point=c,s.A.exists(n._is_new)?(l.addChild(n),delete n._is_new):n.addChild(l),a.addChild(l),l.elType="perpendicularsegment",l.setParents([n.id,a.id]),l.subs={point:c},l.inherits.push(c),l},t.A.createMidpoint=function(t,e,r){var n,a,h,l,c;for(l=0;l=3&&s.A.isPoint(e[0])&&s.A.isPoint(e[1])&&s.A.isPoint(e[2])))throw new 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]");for(a=e[0],h=e[1],l=e[2],n=t.create("point",[function(){var e,s,r;return e=o.A.hypot(h.X()-l.X(),h.Y()-l.Y()),s=o.A.hypot(a.X()-l.X(),a.Y()-l.Y()),r=o.A.hypot(h.X()-a.X(),h.Y()-a.Y()),new u.A(i.A.COORDS_BY_USER,[(e*a.X()+s*h.X()+r*l.X())/(e+s+r),(e*a.Y()+s*h.Y()+r*l.Y())/(e+s+r)],t)}],r),c=0;c<3;c++)s.A.exists(e[c]._is_new)?(n.addChild(e[c]),delete e[c]._is_new):e[c].addChild(n);return n.elType="incenter",n.setParents(e),n},t.A.createCircumcircle=function(e,i,r){var o,n,a,h;if(!1===(i=s.A.providePoints(e,i,{name:""},"point")))throw new Error("JSXGraph: Can't create circumcircle with parent types '"+typeof i[0]+"', '"+typeof i[1]+"' and '"+typeof i[2]+"'.\nPossible parent types: [point,point,point]");try{for(a=s.A.copyAttributes(r,e.options,"circumcircle","center"),(o=t.A.createCircumcenter(e,i,a)).dump=!1,s.A.exists(r.layer)||(r.layer=e.options.layer.circle),a=s.A.copyAttributes(r,e.options,"circumcircle"),(n=t.A.createCircle(e,[o,i[0]],a)).elType="circumcircle",n.setParents(i),n.subs={center:o},n.inherits.push(n),h=0;h<3;h++)s.A.exists(i[h]._is_new)?(n.addChild(i[h]),delete i[h]._is_new):i[h].addChild(n)}catch(t){throw new Error("JSXGraph: Can't create circumcircle with parent types '"+typeof i[0]+"', '"+typeof i[1]+"' and '"+typeof i[2]+"'.\nPossible parent types: [point,point,point]")}return n},t.A.createIncircle=function(e,i,r){var n,a,h,l;if(!1===(i=s.A.providePoints(e,i,{name:""},"point")))throw new Error("JSXGraph: Can't create circumcircle with parent types '"+typeof i[0]+"', '"+typeof i[1]+"' and '"+typeof i[2]+"'.\nPossible parent types: [point,point,point]");try{for(l=s.A.copyAttributes(r,e.options,"incircle","center"),(a=t.A.createIncenter(e,i,l)).dump=!1,s.A.exists(r.layer)||(r.layer=e.options.layer.circle),l=s.A.copyAttributes(r,e.options,"incircle"),(h=t.A.createCircle(e,[a,function(){var t=o.A.hypot(i[1].X()-i[2].X(),i[1].Y()-i[2].Y()),e=o.A.hypot(i[0].X()-i[2].X(),i[0].Y()-i[2].Y()),s=o.A.hypot(i[1].X()-i[0].X(),i[1].Y()-i[0].Y()),r=(t+e+s)/2;return Math.sqrt((r-t)*(r-e)*(r-s)/r)}],l)).elType="incircle",h.setParents(i),n=0;n<3;n++)s.A.exists(i[n]._is_new)?(h.addChild(i[n]),delete i[n]._is_new):i[n].addChild(h);h.center=a,h.subs={center:h.center},h.inherits.push(a)}catch(t){throw new Error("JSXGraph: Can't create circumcircle with parent types '"+typeof i[0]+"', '"+typeof i[1]+"' and '"+typeof i[2]+"'.\nPossible parent types: [point,point,point]")}return h},t.A.createReflection=function(e,r,o){var n,a,h,l,c,d,u,p,f="\nPossible parent types: [point|line|curve|polygon|circle|arc|sector, line]";for(d=0;de[2]&&(r=e[2]-s),r+t.usrCoords[1]},function(){var t=new u.A(i.A.COORDS_BY_SCREEN,[0,this.evalVisProp("offset.1")+this.board.origin.scrCoords[2]],this.board,!1),e=this.board.getBoundingBox(),s=.1*(e[1]-e[3]),r=g.Y();return r>e[1]?r=e[1]-s:r=o.A.eps?h.A.perpendicular(e[0],u,t)[0].usrCoords:u.coords.usrCoords)[1]+p[1]*d,u[2]-p[0]*d],r=[1,u[1]-f[1]*d,u[2]+f[0]*d],this.dataX=[s[1],s[1]+p[0]*n,r[1]+f[0]*n,r[1],s[1]],this.dataY=[s[2],s[2]+p[1]*n,r[2]+f[1]*n,r[2],s[2]]};else if(e[0].elementClass===i.A.OBJECT_CLASS_CURVE&&"functiongraph"===e[0].visProp.curvetype)(a=t.create("curve",[[],[]],l)).updateDataArray=function(){var t,i,s,r,o,n,a,h,l,c,d=this.board.getBoundingBox(),u=[],p=1/0,f=-1/0,A=e[0].minX(),_=e[0].maxX(),m=1*(d[1]-d[3]);if(t=this.evalVisProp("inverse")?1:3,this.dataX=[],this.dataY=[],0!==(r=e[0].points.length))for(d[1]+=m,d[3]-=m,s=-1;s=r)break;for(o=i,s=r-1;o_?_:d[2],a=0===i?a:Math.max(a,l),h=s===r-1?h:Math.min(h,c),h=s===r-1?_:c,(u=[]).push([1,a=0===i?A:l,d[t]]),u.push([1,a,e[0].points[i].usrCoords[2]]),o=i;o<=s;o++)n=e[0].points[o].usrCoords,u.push(e[0].points[o].usrCoords),p=n[2]f?n[2]:f;for(u[0][2]=1===t?f+m:p-m,u.push([1,h,e[0].points[s].usrCoords[2]]),u.push([1,h,d[t]]),u.push(u[0]),o=0;o2||l.length>=1&&"axis"!==l[0].elType||l.length>=2&&"axis"!==l[1].elType)throw new Error("JSXGraph: Can't create 'grid' with parent type '"+r[0].elType+"'. Possible parent types: [axis,axis]");return!s.A.exists(l[0])&&s.A.exists(e.defaultAxes)&&(l[0]=e.defaultAxes.x),!s.A.exists(l[1])&&s.A.exists(e.defaultAxes)&&(l[1]=e.defaultAxes.y),f=function(t,e,i,s,r,o,n){var a,h,l,c,d,u,p;switch(t.toLowerCase()){case".":case"point":return e.visProp.linecap="round",e.visProp.strokewidth=r*e.board.unitX+o*e.board.unitY,[[i,i,NaN],[s,s,NaN]];case"o":case"circle":return e.visProp.linecap="square",e.bezierDegree=3,[[i+r,i+r,i+(h=4*Math.tan(Math.PI/8)/3)*r,i,i-h*r,i-r,i-r,i-r,i-h*r,i,i+h*r,i+r,i+r,NaN],[s,s+h*o,s+o,s+o,s+o,s+h*o,s,s-h*o,s-o,s-o,s-o,s-h*o,s,NaN]];case"regpol":case"regularpolygon":for(e.visProp.linecap="round",c=e.evalVisProp("polygonvertices"),d=[[],[]],a=0;a<=2*Math.PI;a+=2*Math.PI/c)d[0].push(i-r*Math.sin(a)),d[1].push(s-o*Math.cos(a));return d[0].push(NaN),d[1].push(NaN),d;case"[]":case"square":return e.visProp.linecap="square",[[i-r,i+r,i+r,i-r,i-r,NaN],[s+o,s+o,s-o,s-o,s+o,NaN]];case"<>":case"diamond":return e.visProp.linecap="square",[[i,i+r,i,i-r,i,NaN],[s+o,s,s-o,s,s+o,NaN]];case"<<>>":case"diamond2":return e.visProp.linecap="square",[[i,i+(u=r*Math.sqrt(2)),i,i-u,i,NaN],[s+(p=o*Math.sqrt(2)),s,s-p,s,s+p,NaN]];case"x":case"cross":return[[i-r,i+r,NaN,i-r,i+r,NaN],[s+o,s-o,NaN,s-o,s+o,NaN]];case"+":case"plus":return[[i-r,i+r,NaN,i,i,NaN],[s,s,NaN,s-o,s+o,NaN]];case"-":case"minus":return[[i-r,i+r,NaN],[s,s,NaN]];case"|":case"divide":return[[i,i,NaN],[s-o,s+o,NaN]];case"^":case"a":case"A":case"triangleup":return[[i-r,i,i+r,NaN],[s-o,s,s-o,NaN]];case"v":case"triangledown":return[[i-r,i,i+r,NaN],[s+o,s,s+o,NaN]];case"<":case"triangleleft":return[[i+r,i,i+r,NaN],[s+o,s,s-o,NaN]];case">":case"triangleright":return[[i-r,i,i-r,NaN],[s+o,s,s-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,s,s,NaN]];default:return[[],[]]}},c=s.A.copyAttributes(n,e.options,"grid"),s.A.mergeAttr(c,c.themes[c.theme],!1),d={},s.A.mergeAttr(d,c,!0,!0),s.A.mergeAttr(d,c.major,!0,!0),(a=e.create("curve",[[null],[null]],d)).elType="grid",a.type=i.A.OBJECT_TYPE_GRID,u={},s.A.mergeAttr(u,c,!0,!0),s.A.mergeAttr(u,c.minor,!0,!0),u.id===d.id&&(u.id=a.id+"_minor"),u.name===d.name&&(u.name=a.name+"_minor"),(h=e.create("curve",[[null],[null]],u)).elType="grid",h.type=i.A.OBJECT_TYPE_GRID,a.minorGrid=h,h.majorGrid=a,a.hasPoint=function(){return!1},h.hasPoint=function(){return!1},a.inherits.push(h),a.updateDataArray=function(){var e,i,r,n,h,c,d,u,b=this.board.getBoundingBox(),v=this.evalVisProp("gridx"),y=this.evalVisProp("gridy"),C=this.evalVisProp("face"),P=this.evalVisProp("drawzero"),E=!0===P||s.A.isObject(P)&&!0===this.eval(P.origin),x=!0===P||s.A.isObject(P)&&!0===this.eval(P.x),O=!0===P||s.A.isObject(P)&&!0===this.eval(P.y),M=this.evalVisProp("includeboundaries"),w=this.evalVisProp("forcesquare");if(this.dataX=[],this.dataY=[],p=this.evalVisProp("majorstep"),s.A.isArray(p)||(p=[p,p]),p.length<2&&(p=[p[0],p[0]]),s.A.exists(v)&&(t.A.deprecated("gridX","majorStep"),p[0]=v),s.A.exists(y)&&(t.A.deprecated("gridY","majorStep"),p[1]=y),"auto"===p[0]?(u=Math.pow(10,Math.floor(Math.log(50/this.board.unitX)/Math.LN10)),p[0]=u,s.A.exists(l[0])&&(p[0]=l[0].ticks[0].getDistanceMajorTicks())):p[0]=s.A.parseNumber(p[0],Math.abs(b[1]-b[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,s.A.exists(l[1])&&(p[1]=l[1].ticks[0].getDistanceMajorTicks())):p[1]=s.A.parseNumber(p[1],Math.abs(b[0]-b[2]),1/this.board.unitY),"min"===w||!0===w?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"===w&&(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),m=this.evalVisProp("size"),s.A.isArray(m)||(m=[m,m]),m.length<2&&(m=[m[0],m[0]]),s.A.isNumber(m[0],!0)&&(m[0]=m[0]+"px"),s.A.isNumber(m[1],!0)&&(m[1]=m[1]+"px"),m[0]=s.A.parseNumber(m[0],p[0],1/this.board.unitX),m[1]=s.A.parseNumber(m[1],p[1],1/this.board.unitY),g[0]=m[0]/2,g[1]=m[1]/2,e=o.A.roundToStep(b[0],p[0]),i=o.A.roundToStep(b[1],p[1]),d=isFinite(e)&&isFinite(i)&&isFinite(b[2])&&isFinite(b[3])&&Math.abs(b[2])=b[3];n-=p[1])!E&&Math.abs(n)=b[1]-g[1])||(c=[[b[0]-h/a.board.unitX,b[2]+h/a.board.unitX,NaN],[n,n,NaN]],s.A.concat(this.dataX,c[0]),s.A.concat(this.dataY,c[1]));for(r=e;d&&r<=b[2];r+=p[0])!E&&Math.abs(r)=b[2]-g[0])||(c=[[r,r,NaN],[b[1]+h/a.board.unitY,b[3]-h/a.board.unitY,NaN]],s.A.concat(this.dataX,c[0]),s.A.concat(this.dataY,c[1]))}else for(n=i;d&&n>=b[3];n-=p[1])for(r=e;d&&r<=b[2];r+=p[0])!E&&Math.abs(n)=A||!O&&Math.abs(r)=A||!M&&(r<=b[0]+g[0]||r>=b[2]-g[0]||n<=b[3]+g[1]||n>=b[1]-g[1])||(c=f(C,a,r,n,g[0],g[1],b),s.A.concat(this.dataX,c[0]),s.A.concat(this.dataY,c[1]))},h.updateDataArray=function(){var t,e,i,r,n,a,c,d,u,m,b,v,y,C,P,E,x,O,M,w=this.board.getBoundingBox(),S=[],T=[],N=this.evalVisProp("minorelements"),D=this.evalVisProp("size"),k=this.evalVisProp("face"),L=this.evalVisProp("drawzero"),R=!0===L||s.A.isObject(L)&&!0===this.eval(L.x),B=!0===L||s.A.isObject(L)&&!0===this.eval(L.y),I=this.majorGrid.evalVisProp("face"),j=this.majorGrid.evalVisProp("drawzero"),Y=!0===j||s.A.isObject(j)&&!0===this.eval(j.origin),V=!0===j||s.A.isObject(j)&&!0===this.eval(j.x),X=!0===j||s.A.isObject(j)&&!0===this.eval(j.y),U=this.evalVisProp("includeboundaries");if(this.dataX=[],this.dataY=[],s.A.isArray(N)||(N=[N,N]),N.length<2&&(N=[N[0],N[0]]),s.A.isNumber(N[0],!0)?N[0]=parseFloat(N[0]):(N[0]=3,s.A.exists(l[0])&&(N[0]=l[0].eval(l[0].getAttribute("ticks").minorticks))),S[0]=p[0]/(N[0]+1),s.A.isNumber(N[1],!0)?N[1]=parseFloat(N[1]):(N[1]=3,s.A.exists(l[1])&&(N[1]=l[1].eval(l[1].getAttribute("ticks").minorticks))),S[1]=p[1]/(N[1]+1),s.A.isArray(D)||(D=[D,D]),D.length<2&&(D=[D[0],D[0]]),s.A.isNumber(D[0],!0)&&(D[0]=D[0]+"px"),s.A.isNumber(D[1],!0)&&(D[1]=D[1]+"px"),D[0]=s.A.parseNumber(D[0],S[0],1/this.board.unitX),D[1]=s.A.parseNumber(D[1],S[1],1/this.board.unitY),T[0]=.5*D[0],T[1]=.5*D[1],t=o.A.roundToStep(w[0],S[0]),e=o.A.roundToStep(w[1],S[1]),c=isFinite(t)&&isFinite(e)&&isFinite(w[2])&&isFinite(w[3])&&Math.abs(w[2])<=Math.abs(S[0]*_)&&Math.abs(w[3])=w[3];r-=S[1])for(i=t;c&&i<=w[2];i+=S[0]){if(d=o.A.roundToStep(Math.abs(i),p[0]),d=Math.abs(d-Math.abs(i)),u=p[0]-d,m=o.A.roundToStep(Math.abs(r),p[1]),m=Math.abs(m-Math.abs(r)),b=p[1]-m,"line"===I){if(d-T[0]-g[0]=w[3];r-=S[1]){if(m=o.A.roundToStep(Math.abs(r),p[1]),m=Math.abs(m-Math.abs(r)),b=p[1]-m,"line"===I){if(m-T[1]-g[1]=-(a=l)&&r-this.size[0]<=a&&n>=-a&&n-this.size[1]<=a):(d=[(c=(c=new u.A(i.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<=(p=(f=o.A.innerProduct)(d,this.span[1]))&&p<=f(this.span[1],this.span[1])&&0<=(p=f(d,this.span[2]))&&p<=f(this.span[2],this.span[2]))},update:function(t){return this.needsUpdate?(this.updateCoords(t),this.updateSize(),this.updateSpan(),this):this},updateRenderer:function(){return this.updateRendererGeneric("updateImage")},updateSize:function(){return this.usrSize=[this.W(),this.H()],this.size=[Math.abs(this.usrSize[0]*this.board.unitX),Math.abs(this.usrSize[1]*this.board.unitY)],this},updateSpan:function(){var t,e,i=this.transformations.length,s=[];if(0===i)this.span=[[this.Z(),this.X(),this.Y()],[this.Z(),this.W(),0],[this.Z(),0,this.H()]];else{for(s[0]=[this.Z(),this.X(),this.Y()],s[1]=[this.Z(),this.X()+this.W(),this.Y()],s[2]=[this.Z(),this.X(),this.Y()+this.H()],t=0;to.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},C&&(b=t.create("text",[function(){return.05*(f.X()-p.X())+f.X()},function(){return.05*(f.Y()-p.Y())+f.Y()},function(){var t,e=A.evalVisProp("digits"),i=A.evalVisProp("suffixlabel"),r=A.evalVisProp("unitlabel"),o=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+=s.A.toFixed(A.Value(),e),null!==r&&(t+=r),null!==o&&(t+=o),t}],S.label),A.label=b,A.visProp.withlabel=!0,A.hasLabel=!0,A.inherits.push(b),b.addParents(A),A.addChild(b)),A.point1=p,A.point2=f,A.baseline=_,A.highline=m,P&&(s.A.exists(S.generatelabeltext)||(S.ticks.generateLabelText=function(t,e,i){var s=A.point1.Dist(A.point2),r=A._smin,n=A._smax,a=this.getDistanceFromZero(e,t)*(n-r)/s+r;return s=0&&(c="",3===t.length&&s.A.isString(t[2])&&(c=t[2].toLowerCase()),n=""===c?t[1].type===i.A.OBJECT_TYPE_ANGLE?0:1:0===c.indexOf("len")?1:0))}return n},toPrefix:function(t){var e,i,r,o;if(s.A.isNumber(t))return t;if(!s.A.isArray(t)||t.length<2)throw new Error("PrefixParser.toPrefix: term is not an array");for(e=t[0],r=t.length,o=[e],i=1;i1&&s.A.concat(o,this.getParents(t[i])):o.push(t[i]);return o}};var J=t.A.PrefixParser;t.A.createTapemeasure=function(t,e,i){var r,o,n,a,h,l,c,d,u,p;return r=e[0],o=e[1],n=s.A.copyAttributes(i,t.options,"tapemeasure","point1"),c=t.create("point",r,n),n=s.A.copyAttributes(i,t.options,"tapemeasure","point2"),d=t.create("point",o,n),c.setAttribute({ignoredSnapToPoints:[d.id]}),d.setAttribute({ignoredSnapToPoints:[c.id]}),n=s.A.copyAttributes(i,t.options,"tapemeasure"),a=n.withticks,h=n.withlabel,2===n.digits&&2!==n.precision&&n.precision,h&&(n.withlabel=!0),l=t.create("segment",[c,d],n),h&&(u=i.name&&""!==i.name?i.name+" = ":"",l.label.setText(function(){var t=l.label.evalVisProp("digits");return l.label.useLocale()?u+l.label.formatNumberLocale(c.Dist(d),t):u+s.A.toFixed(c.Dist(d),t)})),a&&(n=s.A.copyAttributes(i,t.options,"tapemeasure","ticks"),p=t.create("ticks",[l,.1],n),l.inherits.push(p)),l.remove=function(){a&&l.removeTicks(p),t.removeObject(d),t.removeObject(c),Y.A.prototype.remove.call(this)},l.Value=function(){return c.Dist(d)},c.dump=!1,d.dump=!1,l.elType="tapemeasure",l.getParents=function(){return[[c.X(),c.Y()],[d.X(),d.Y()]]},l.subs={point1:c,point2:d},a&&(p.dump=!1),l.prepareUpdate().update(),t.isSuspendedUpdate||(l.updateVisibility().updateRenderer(),l.point1.updateVisibility().updateRenderer(),l.point2.updateVisibility().updateRenderer()),s.A.extendInstanceMethodMap(l,{Value:"Value"}),l},t.A.registerElement("tapemeasure",t.A.createTapemeasure),t.A.createMeasurement=function(t,e,i){var r,o,n,a,h,l;for(o=s.A.copyAttributes(i,t.options,"measurement"),n=e[0],a=e[1],h=e[2],(r=t.create("text",[n,a,""],o)).type=s.A.OBJECT_TYPE_MEASUREMENT,r.elType="measurement",r.Value=function(){return J.parse(h,"execute")},r.Dimension=function(){var t=r.evalVisProp("dim");return null!==t?t:J.dimension(h)},r.Unit=function(t){var e,i="",o=r.evalVisProp("units"),n=t,a={};if(s.A.exists(n)||(n=r.Dimension()),s.A.isArray(t)){for(e=0;e1&&""!==i&&(i=i+"^{"+n+"}")),i},r.getTerm=function(){return h},r.getMethod=function(){var t=h[0];return"V"===t&&(t="Value"),t},r.toPrefix=function(){return J.toPrefix(h)},r.getParents=function(){return J.getParents(h)},r.addParents(r.getParents()),l=0;lt&&(i[e]=parseFloat(this.data[e][t]));return i},getRow:function(t){var e,i;if(s.A.isString(t))for(i=0;i=0?"left":"right"},f.anchorY="middle",n=t.create("text",[d,l,p.labels[o]],f))):(_[0]=t.create("point",[h,0],g),_[1]=t.create("point",[h,d],g),_[2]=t.create("point",[c,d],g),_[3]=t.create("point",[c,0],g),s.A.exists(p.labels)&&s.A.exists(p.labels[o])&&(f.anchorX="middle",f.anchorY=function(t){return t.Y()>=0?"bottom":"top"},n=t.create("text",[l,d,p.labels[o]],f))),s.A.isArray(p.colors)&&(u=p.colors,p.fillcolor=u[o%u.length]),A[o]=t.create("polygon",_,p),s.A.exists(p.labels)&&s.A.exists(p.labels[o])&&(A[o].text=n,A[o].addChild(n));return A},drawPoints:function(t,e,i,s){var r,o=[],n=s.infoboxarray;for(s.fixed=!0,s.name="",r=0;rc[a]&&(c[a]=r[n][a]),r[n][a]0&&i.length<=2&&(this.evalParam=s.A.createEvalFunction(t,i,1),2!==i.length||s.A.isArray(i[1])||(i[1]=t.select(i[1]))),this.update=function(){var t,e,r=this.evalParam(0),o=Math.cos(r),n=Math.sin(r);this.matrix[1][1]=o,this.matrix[1][2]=-n,this.matrix[2][1]=n,this.matrix[2][2]=o,i.length>1&&(3===i.length?(t=this.evalParam(1),e=this.evalParam(2)):s.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-o)+e*n,this.matrix[2][0]=e*(1-o)-t*n)};else if("shear"===e){if(2!==i.length)throw new Error("JSXGraph: shear transformation needs 2 parameters.");this.evalParam=s.A.createEvalFunction(t,i,2),this.update=function(){this.matrix[1][2]=this.evalParam(0),this.matrix[2][1]=this.evalParam(1)}}else if("affine"===e){if(4!==i.length)throw new Error("JSXGraph: affine transformation needs 4 parameters.");this.evalParam=s.A.createEvalFunction(t,i,9),this.update=function(){this.matrix[1][1]=this.evalParam(0),this.matrix[1][2]=this.evalParam(1),this.matrix[2][1]=this.evalParam(2),this.matrix[2][2]=this.evalParam(3)}}else if("affinematrix"===e){if(1!==i.length)throw new Error("JSXGraph: transformation of type 'matrix' needs 1 parameter.");this.evalParam=i[0].slice(),this.update=function(){var t,e;for(t=0;t<2;t++)for(e=0;e<2;e++)this.matrix[t+1][e+1]=s.A.evaluate(this.evalParam[t][e])}}else if("generic"===e){if(9!==i.length)throw new Error("JSXGraph: generic transformation needs 9 parameters.");this.evalParam=s.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)return;if(1!==i.length)throw new 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]=s.A.evaluate(this.evalParam[t][e])}}this.transformationType=e},setMatrix3D:function(t,e,i){var r,n=t.board;for(this.isNumericMatrix=!0,r=0;r0&&i[i.length-1].isNumericMatrix&&this.isNumericMatrix?i[i.length-1].melt(this):(r=this.clone(),i.push(r))},clone:function(){var e=null;return this.update(),this.isNumericMatrix&&((e=new t.A.Transformation(this.board,"none",[])).matrix=this.matrix.slice(),e.transformationType=this.transformationType),e},setProperty:function(e){t.A.deprecated("Transformation.setProperty()","Transformation.setAttribute()")},setAttribute:function(t){},melt:function(t){var e;return this.update(),t.update(),e=o.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}}),t.A.createTransform=function(e,i,s){return new t.A.Transformation(e,s.type,i)},t.A.registerElement("transform",t.A.createTransform),t.A.createTransform3D=function(e,i,s){return new t.A.Transformation(e,s.type,i,!0)},t.A.registerElement("transform3d",t.A.createTransform3D);t.A.Transformation;t.A.Turtle=function(t,e,r){var o,n,a;return this.constructor(t,r,i.A.OBJECT_TYPE_TURTLE,i.A.OBJECT_CLASS_OTHER),this.turtleIsHidden=!1,this.board=t,this.visProp.curveType="plot",this._attributes=s.A.copyAttributes(this.visProp,t.options,"turtle"),delete this._attributes.id,o=0,n=0,a=90,0!==e.length&&(3===e.length?(o=s.A.evaluate(e[0]),n=s.A.evaluate(e[1]),a=s.A.evaluate(e[2])):2===e.length?s.A.isArray(e[0])?(o=e[0][0],n=e[0][1],a=e[1]):(o=s.A.evaluate(e[0]),n=s.A.evaluate(e[1])):(o=e[0][0],n=e[0][1])),this.init(o,n,a),this},t.A.Turtle.prototype=new Y.A,s.A.copyMethodMap(t.A.Turtle,{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"}),t.A.extend(t.A.Turtle.prototype,{init:function(t,e,i){var s={fixed:!0,name:"",visible:!1,withLabel:!1};this.arrowLen=20/o.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,s),this.objects.push(this.turtle),this.turtle2=this.board.create("point",[this.pos[0],this.pos[1]+this.arrowLen],s),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),s=t*Math.sin(this.dir*Math.PI/180);return this.turtleIsHidden||((e=this.board.create("transform",[i,s],{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]+=s,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){(this.dir-=t,this.dir%=360,this.turtleIsHidden)||this.board.create("transform",[-t*Math.PI/180,this.turtle],{type:"rotate"}).applyOnce(this.turtle2);return 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=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 s,r,o,n,a=this.objects.length;for(s=0,r=0;s=1||Math.abs(n[1][0]-n[1][1])>=1))if(0===this.line.stdform[1]){if(Math.abs(e-this.line.point1.coords.scrCoords[2])<2*a&&n[0][0]-ao.A.eps?(r=h.usrCoords[1]/a.usrCoords[1],l[0]*=r,l[2]*=r,this.board.setBoundingBox(l,this.board.keepaspectratio,"update")):Math.abs(this.line.stdform[2])o.A.eps&&(n=h.usrCoords[2]/a.usrCoords[2],l[3]*=n,l[1]*=n,this.board.setBoundingBox(l,this.board.keepaspectratio,"update")),this):this},calculateTicksCoordinates:function(){var t,e,s,r;if(!(this.line.elementClass===i.A.OBJECT_CLASS_LINE&&(this.setTicksSizeVariables(),Math.abs(this.dx)=o.A.eps&&c.scrCoords[1]>=0&&c.scrCoords[1]<=this.board.canvasWidth&&c.scrCoords[2]>=0&&c.scrCoords[2]<=this.board.canvasHeight,f=Math.abs(d.usrCoords[0])>=o.A.eps&&d.scrCoords[1]>=0&&d.scrCoords[1]<=this.board.canvasWidth&&d.scrCoords[2]>=0&&d.scrCoords[2]<=this.board.canvasHeight,s.A.exists(e)&&"ticksdistance"===e?(h.A.calcStraight(this.line,c,d,0),v=this.getDistanceFromZero(t,c),y=this.getDistanceFromZero(t,d),h.A.calcStraight(this.line,c,d,this.line.evalVisProp("margin")),v=this.getDistanceFromZero(t,c)-v,y=this.getDistanceFromZero(t,d).m2):h.A.calcLineDelimitingPoints(this.line,c,d),a=this.line.evalVisProp("firstarrow"),l=this.line.evalVisProp("lastarrow"),g=this.getDistanceFromZero(t,c),b=this.getDistanceFromZero(t,d),(a||l)&&(m=this.board.renderer.getArrowHeadData(this.line,this.line.evalVisProp("strokewidth"),""),this.board.renderer.getPositionArrowHead(this.line,c,d,m)),(A=this.getDistanceFromZero(t,c))<(_=this.getDistanceFromZero(t,d))?(r=A,n=_,P||!p||x||(r+=C),E||!f||x||(n-=C)):_2048*a)t.A.warn("JSXGraph ticks: too many ticks (>2048). Please increase ticksDistance.");else{for(r=0,this.evalVisProp("drawzero")||(r=a),r=s.lower-h&&this.processTickPosition(e,r,a,n),r+=a,!(s.upper-r>1e4*a)););for((r=-a)>s.upper&&(r=Math.ceil((s.upper+h)/-a)*-a);r>=s.lower-h&&(r<=s.upper+h&&this.processTickPosition(e,r,a,n),!((r-=a)-s.lower>1e4*a)););}},getDistanceMajorTicks:function(){var t,e,i,s,r,n,a,h;return this.evalVisProp("insertticks")?(n=((i=this.getLowerAndUpperBounds(this.getZeroCoordinates(),"")).upper-i.lower)/6/(r=this.evalVisProp("scale")),a=this.evalVisProp("minticksdistance")/r,h=this.evalVisProp("minorticks"),(s=this.getXandYdeltas()).x*=this.board.unitX,s.y*=this.board.unitY,a/=o.A.hypot(s.x,s.y),a*=h+1,2*(t=Math.pow(10,Math.floor(Math.log(a)/Math.LN10)))>=a?t*=2:5*t>=a&&(t*=5),5*(e=Math.pow(10,Math.floor(Math.log(n)/Math.LN10)))=e.lower-f&&d<=e.upper+f&&(this.ticks.push(h),_&&(A||s.A.exists(this.visProp.labels[a]))?(n=A?this.evalVisProp("labels."+a):d,this.labelsData.push(this.generateLabelData(this.generateLabelText(r,t,n),r,a))):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 s=this.board.canvasWidth,r=this.board.canvasHeight;return void 0===i&&(i=0),t[0]>=i&&t[0]<=s-i&&e[0]>=i&&e[0]<=r-i||t[1]>=i&&t[1]<=s-i&&e[1]>=i&&e[1]<=r-i},createTickPath:function(t,e){var i,s,r,n,a,l,c,d,u,p,f,A,_,m,g,b,v,y=[-2e6,-2e6],C=[-2e6,-2e6];if(i=t.scrCoords,e?(n=this.dxMaj,a=this.dyMaj,u=this.majStyle,g=this.evalVisProp("majortickendings.0")>0,b=this.evalVisProp("majortickendings.1")>0):(n=this.dxMin,a=this.dyMin,u=this.minStyle,g=this.evalVisProp("tickendings.0")>0,b=this.evalVisProp("tickendings.1")>0),s=[-a*i[1]-n*i[2],a,n],e&&"polar"===this.evalVisProp("type")){if(A=this.board.getBoundingBox(),m=(_=2*Math.PI)/180,i=t.usrCoords,(f=o.A.hypot(i[1],i[2]))0)return[];v[0]>0?(y[0]=i[1],C[0]=i[2],y[1]=r[1].scrCoords[1],C[1]=r[1].scrCoords[2]):(y[0]=r[0].scrCoords[1],C[0]=r[0].scrCoords[2],y[1]=r[1].scrCoords[1],C[1]=r[1].scrCoords[2])}}else d=">"===this.evalVisProp("face")?Math.PI/4:"<"===this.evalVisProp("face")?-Math.PI/4:0,l=Math.cos(d)*n-Math.sin(d)*a,c=Math.sin(d)*n+Math.cos(d)*a,y[0]=i[1]+l*g,C[0]=i[2]-c*g,y[1]=i[1],C[1]=i[2],d=-d,l=Math.cos(d)*n-Math.sin(d)*a,c=Math.sin(d)*n+Math.cos(d)*a,y[2]=i[1]-l*b,C[2]=i[2]+c*b;if(!this.evalVisProp("clip")||this._isInsideCanvas(y,C))return[y,C,e]}return[]},formatLabelText:function(t){var e,i,r=this.evalVisProp("label.usemathjax"),o=this.evalVisProp("label.usekatex"),n=this.evalVisProp("scalesymbol");return s.A.isNumber(t)?(this.evalVisProp("label.tofraction")?e=r?"\\("+s.A.toFraction(t,!0)+"\\)":s.A.toFraction(t,o):(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(),n.length>0&&("1"===e?e=n:"-1"===e?e="-"+n:"0"!==e&&(e+=n)),this.evalVisProp("useunicodeminus")&&(e=e.replace(/-/g,"−")),e},beautifyScientificNotationLabel:function(t){return-1===t.indexOf("e")?t:(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,"¹").replace(/2/g,"²").replace(/3/g,"³").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(!s.A.exists(i)){if(r=this.getDistanceFromZero(e,t),Math.abs(r)>=1)&&(t=1&(f=C()),f=f>>1|128)}catch(t){throw console.log("Probably problems on iOS7 with >>"),t}return t}function x(t){var e=0,i=t;try{for(;i--;)e=e<<1|E();t&&(e=W[e]>>8-t)}catch(t){throw console.log("Probably problems on iOS7 with >>"),t}return e}function O(){c=0}function M(t){l[c++]=t,n.push(String.fromCharCode(t)),32768===c&&(c=0)}function w(){this.b0=0,this.b1=0,this.jump=null,this.jumppos=-1}function S(){for(;;){if(v[b]>=o)return-1;if(r[v[b]]===b)return v[b]++;v[b]++}}function T(){var t,e=g[m];if(17===b)return-1;if(m++,b++,(t=S())>=0)e.b0=t;else if(e.b0=32768,T())return-1;if((t=S())>=0)e.b1=t,e.jump=null;else if(e.b1=32768,e.jump=g[m],e.jumppos=m,T())return-1;return b--,0}function N(t,e,i,s){var n;for(g=t,m=0,r=i,o=e,n=0;n<17;n++)v[n]=0;return b=0,T()?-1:0}function D(t){for(var e,i,s=0,r=t[s];;)if(E()){if(!(32768&r.b1))return r.b1;for(r=r.jump,e=t.length,i=0;i>1)>23?(r=r<<1|E())>199?r=(r-=128)<<1|E():(r-=48)>143&&(r+=136):r+=256,r<256)M(r);else{if(256===r)break;for(h=x($[r-=257])+H[r],r=W[x(5)]>>3,q[r]>8?(u=x(8),u|=x(q[r]-8)<<8):u=x(q[r]),u+=K[r],r=0;rf)return O(),1;for(o=s?n[s-1]:0;r--;)n[s++]=o}else{if(s+(r=17===r?3+x(3):11+x(7))>f)return O(),1;for(;r--;)n[s++]=0}for(h=A.length,s=0;s=256){if(0===(r-=256))break;for(h=x($[r-=1])+H[r],r=D(_),q[r]>8?(u=x(8),u|=x(q[r]-8)<<8):u=x(q[r]),u+=K[r];h--;)M(l[c-u&32767])}else M(r)}}while(!e);return O(),P(),0}function L(){var t,e,r,o,l,c=[];try{if(n=[],d=!1,c[0]=C(),c[1]=C(),120===c[0]&&218===c[1]&&(k(),h[a]=[n.join(""),"geonext.gxt"],a++),31===c[0]&&139===c[1]&&(R(),h[a]=[n.join(""),"file"],a++),80===c[0]&&75===c[1]){if(d=!0,c[2]=C(),c[3]=C(),3===c[2]&&4===c[3]){for(c[0]=C(),c[1]=C(),i=C(),i|=C()<<8,l=C(),l|=C()<<8,C(),C(),C(),C(),C(),C()<<8,C()<<16,C()<<24,C(),C()<<8,C()<<16,C()<<24,C(),C()<<8,C()<<16,C()<<24,o=C(),o|=C()<<8,r=C(),r|=C()<<8,t=0,y=[];o--;)"/"===(e=C())|":"===e?t=0:t<255&&(y[t++]=String.fromCharCode(e));for(s||(s=y),t=0;t>"),t}return!1}function R(){var t,e,s=[];if(8&i&&(s[0]=C(),s[1]=C(),s[2]=C(),s[3]=C(),80===s[0]&&75===s[1]&&7===s[2]&&8===s[3]?(C(),C()<<8,C()<<16,C()<<24):s[0]|s[1]<<8|s[2]<<16|s[3]<<24,C(),C()<<8,C()<<16,C()<<24,C(),C()<<8,C()<<16,C()<<24),d&&L())return!1;if(s[0]=C(),8!==s[0])return!0;if(i=C(),C(),C(),C(),C(),C(),C(),4&i)for(s[0]=C(),s[2]=C(),b=s[0]+256*s[1],t=0;t=2?t.children[1][1].value:a.children[0][0],h=a.children[1]):(h=t.children[1][0],p=["x"],u=t.children[1].length>=2?t.children[1][1].value:"x"),c=h,(f=t.children[1].length>=3?t.children[1][2].value:1)>=1)for(;f>=1;)c=this.derivative(c,u),c=this.removeTrivialNodes(c),f--;l="node_op"==e.type&&"op_assign"==e.value?this.createNode("node_op","op_map",p,c):c,this.setMath(l),t.type=l.type,t.value=l.value,l.children.length>0&&(t.children[0]=l.children[0]),l.children.length>1&&(t.children[1]=l.children[1])}return t},removeTrivialNodes:function(t){var e,i,r,o,n;if(s.A.isArray(t))for(i=t.length,e=0;e0?r.value=1/0:r.value=-1/0,r;if("node_op"==r.type&&"op_neg"==r.value&&"node_op"==o.type&&"op_neg"==o.value)return t.children=[r.children[0],o.children[0]],this.mayNotBeSimplified=!0,t;if("op_neg"==r.value&&"op_neg"!=o.value)return t.type="node_op",t.value="op_neg",t.children=[this.createNode("node_op","op_div",r.children[0],o)],this.mayNotBeSimplified=!0,t;if("op_neg"!=r.value&&"op_neg"==o.value)return t.type="node_op",t.value="op_neg",t.children=[this.createNode("node_op","op_div",r,o.children[0])],this.mayNotBeSimplified=!0,t;if("node_op"==r.type&&"op_exp"==r.value&&(o.hash||(o.hash=this.parser.compile(o)),r.children[0].hash||(r.children[0].hash=this.parser.compile(r.children[0])),o.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"!=o.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],o)],this.mayNotBeSimplified=!0,t;if("node_op"==r.type&&"op_exp"==r.value&&"node_op"==o.type&&"op_exp"==o.value&&(r.children[0].hash=this.parser.compile(r.children[0]),o.children[0].hash=this.parser.compile(o.children[0]),r.children[0].hash===o.children[0].hash))return r.children[1]=this.createNode("node_op","op_sub",r.children[1],o.children[1]),this.mayNotBeSimplified=!0,r;break;case"op_exp":if(r=t.children[0],"node_const"==(o=t.children[1]).type&&0===o.value)return o.value=1,o;if("node_const"==o.type&&1==o.value)return r;if("node_const"==r.type&&1==r.value)return r;if("node_const"==r.type&&0===r.value&&"node_const"==o.type&&0!==o.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],o)],t}switch(t.value){case"op_add":if(r=t.children[0],o=t.children[1],"node_const"==r.type&&"node_const"==o.type&&r.value==o.value)return r.value+=o.value,r;if("node_var"==r.type&&"node_var"==o.type&&r.value==o.value)return t.children[0]=this.createNode("node_const",2),t.value="op_mul",t;if("node_op"==r.type&&"op_neg"==r.value)return t.value="op_sub",t.children[0]=o,t.children[1]=r.children[0],this.mayNotBeSimplified=!0,t;if("node_op"==o.type&&"op_neg"==o.value)return t.value="op_sub",t.children[1]=o.children[0],this.mayNotBeSimplified=!0,t;if("node_op"==r.type&&"op_mul"==r.value&&"node_op"==o.type&&"op_mul"==o.value&&(r.children[1].hash=this.parser.compile(r.children[1]),o.children[1].hash=this.parser.compile(o.children[1]),r.children[1].hash===o.children[1].hash))return t.value="op_mul",t.children=[this.createNode("node_op","op_add",r.children[0],o.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]),o.hash=this.parser.compile(o),r.children[1].hash===o.hash))return t.value="op_mul",t.children=[this.createNode("node_op","op_add",r.children[0],this.createNode("node_const",1)),o],this.mayNotBeSimplified=!0,t;if("node_op"==o.type&&"op_mul"==o.value&&(o.children[1].hash=this.parser.compile(o.children[1]),r.hash=this.parser.compile(r),o.children[1].hash===r.hash))return t.value="op_mul",t.children=[this.createNode("node_op","op_add",this.createNode("node_const",1),o.children[0]),r],this.mayNotBeSimplified=!0,t;break;case"op_sub":if(r=t.children[0],"node_op"==(o=t.children[1]).type&&"op_neg"==o.value)return t.value="op_add",t.children[1]=o.children[0],this.mayNotBeSimplified=!0,t;break;case"op_execfun":return this.simplifyElementary(t)}return t},simplifyElementary:function(t){var e=t.children[0].value,i=t.children[1];if(0==i.length)return t;switch(e){case"sin":case"tan":if("node_const"==i[0].type&&0===i[0].value)return t.type="node_const",t.value=0,t;if("node_var"==i[0].type&&"PI"==i[0].value)return t.type="node_const",t.value=0,t;if("node_op"==i[0].type&&"op_mul"==i[0].value&&"node_const"==i[0].children[0].type&&i[0].children[0].value%1==0&&"node_var"==i[0].children[1].type&&"PI"==i[0].children[1].value)return t.type="node_const",t.value=0,t;break;case"cos":if("node_const"==i[0].type&&0===i[0].value)return t.type="node_const",t.value=1,t;if("node_var"==i[0].type&&"PI"==i[0].value)return t.type="node_op",t.value="op_neg",t.children=[this.createNode("node_const",1)],t;break;case"exp":if("node_const"==i[0].type&&0===i[0].value)return t.type="node_const",t.value=1,t;break;case"pow":if("node_const"==i[1].type&&0===i[1].value)return t.type="node_const",t.value=1,t}return t}});t.A.CA;t.A.Dump={addMarkers:function(t,e,i){var r,o,n;for(r in s.A.isArray(e)||(e=[e]),s.A.isArray(i)||(i=[i]),o=Math.min(e.length,i.length),e.length=o,i.length=o,t.objects)if(t.objects.hasOwnProperty(r))for(n=0;n=0;r--)o=s.A.deepCopy(o,a[r],!0);return!0===this._minimizeSubObject(n,o," ")&&(n={}),n},prepareAttributes:function(e,i){var r,o,n;for(o in n=t.A.Options[i.elType]||{},r=this.minimizeObject(i.getAttributes(),n),i.subs)i.subs.hasOwnProperty(o)&&(r[o]=this.minimizeObject(i.subs[o].getAttributes(),n[o],t.A.Options[i.subs[o].elType]||{}),r[o].id=i.subs[o].id,r[o].name=i.subs[o].name);return s.A.exists(r.label)&&(n=t.A.Options.label||{},r.label=this.minimizeObject(r.label,n),s.A.isEmpty(r.label)&&delete r.label),s.A.exists(r.layer)&&(n=t.A.Options.layer||{},r.layer===n[i.elType]&&delete r.layer),s.A.exists(r.draft)&&!1===r.draft&&delete r.draft,r.id=i.id,r.name=i.name,r},setBoundingBox:function(t,e,i){return t.push({obj:i,method:"setBoundingBox",params:[e.getBoundingBox(),e.keepaspectratio]}),t},dump:function(t,e){var i,r,o,n,a=[],h=[],l=t.objectsList.length;for(this.addMarkers(t,"dumped",!1),i=0;i> "}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,e){var i,s,r,o,n=this.dump(t),a=[];if(n.methods=this.setBoundingBox(n.methods,t,"$board"),r=n.elements,!0===e)for(i=0;i0&&a.push("// "+r[i].attributes.name),a.push("s"+i+" = "+r[i].type+"("+r[i].parents.join(", ")+") "+this.toJCAN(r[i].attributes).replace(/\n/,"\\n")+";"),"axis"===r[i].type&&(o=r[i].attributes.id,null===t.objects[o].defaultTicks&&a.push("s"+i+".removeAllTicks();")),a.push("");for(i=0;i1)h=s.A.copyAttributes(r,e.options,"comb","point1"),o=e.create("point",i[0],h);else if(s.A.isString(i[0])||s.A.isPoint(i[0]))o=e.select(i[0]);else if(s.A.isFunction(i[0])&&s.A.isPoint(i[0]()))o=i[0]();else{if(!(s.A.isFunction(i[0])&&i[0]().length&&i[0]().length>=2))throw new Error("JSXGraph: Can't create comb with parent types '"+typeof i[0]+"' and '"+typeof i[1]+"'.\nPossible parent types: [point,point], [[x1,y1],[x2,y2]]");h=s.A.copyAttributes(r,e.options,"comb","point1"),o=t.A.createPoint(e,i[0](),h)}if(s.A.isArray(i[1])&&i[1].length>1)h=s.A.copyAttributes(r,e.options,"comb","point2"),n=e.create("point",i[1],h);else if(s.A.isString(i[1])||s.A.isPoint(i[1]))n=e.select(i[1]);else if(s.A.isFunction(i[1])&&s.A.isPoint(i[1]()))n=i[1]();else{if(!(s.A.isFunction(i[1])&&i[1]().length&&i[1]().length>=2))throw new Error("JSXGraph: Can't create comb with parent types '"+typeof i[0]+"' and '"+typeof i[1]+"'.\nPossible parent types: [point,point], [[x1,y1],[x2,y2]]");h=s.A.copyAttributes(r,e.options,"comb","point2"),n=t.A.createPoint(e,i[1](),h)}return h=s.A.copyAttributes(r,e.options,"comb"),(a=e.create("curve",[[0],[0]],h)).updateDataArray=function(){var t,e,i,s,r,h,l,c,d,u,p=0,f=o.Dist(n),A=o,_=n;for(c=a.evalVisProp("frequency"),d=-a.evalVisProp("angle"),u=a.evalVisProp("width"),a.evalVisProp("reverse")&&(A=n,_=o,d=-d),t=Math.cos(d),e=Math.sin(d),i=(_.X()-A.X())/f,s=(_.Y()-A.Y())/f,t*=u/Math.abs(e),e*=u/Math.abs(e),this.dataX=[],this.dataY=[];p'],h=z.A.prototype.setText,z.A.prototype.setText=z.A.prototype._setText,(n=i.create("text",a,l)).type=s.A.OBJECT_TYPE_CHECKBOX,z.A.prototype.setText=h,n.rendNodeCheckbox=n.rendNode.childNodes[0].childNodes[0],n.rendNodeLabel=n.rendNode.childNodes[0].childNodes[1],n.rendNodeTag=n.rendNodeCheckbox,n.rendNodeTag.disabled=!!l.disabled,n.rendNodeCheckbox.id=n.rendNode.id+"_checkbox",n.rendNodeLabel.id=n.rendNode.id+"_label",n.rendNodeLabel.setAttribute("for",n.rendNodeCheckbox.id),n.setText(r[2]),n.visPropOld.fontsize="0px",i.renderer.updateTextStyle(n,!1),n.rendNodeCheckbox.checked=l.checked,n._value=l.checked,n.Value=function(){return this._value},n.update=function(){return this.needsUpdate&&(t.A.Text.prototype.update.call(this),this._value=this.rendNodeCheckbox.checked),this},e.A.addEvent(n.rendNodeCheckbox,"change",ot,n),n},t.A.registerElement("checkbox",t.A.createCheckbox);var nt=function(t){this._value=this.rendNodeInput.value,this.board.update()};t.A.createInput=function(i,r,o){var n,a,h,l=s.A.copyAttributes(o,i.options,"input");return a=[r[0],r[1],''],h=z.A.prototype.setText,z.A.prototype.setText=z.A.prototype._setText,(n=i.create("text",a,l)).type=s.A.OBJECT_TYPE_INPUT,z.A.prototype.setText=h,n.rendNodeLabel=n.rendNode.childNodes[0].childNodes[0],n.rendNodeInput=n.rendNode.childNodes[0].childNodes[1],n.rendNodeInput.value=r[2],n.rendNodeTag=n.rendNodeInput,n.rendNodeTag.disabled=!!l.disabled,n.rendNodeLabel.id=n.rendNode.id+"_label",n.rendNodeInput.id=n.rendNode.id+"_input",n.rendNodeInput.setAttribute("aria-labelledby",n.rendNodeLabel.id),n.setText(r[3]),n._value=r[2],n.rendNodeInput.addEventListener("keydown",t=>{"ArrowLeft"!==t.key&&"ArrowRight"!==t.key||t.stopPropagation()}),n.update=function(){return this.needsUpdate&&(t.A.Text.prototype.update.call(this),this._value=this.rendNodeInput.value),this},n.Value=function(){return this._value},n.set=function(t){return this._value=t,this.rendNodeInput.value=t,this},e.A.addEvent(n.rendNodeInput,"input",nt,n),e.A.addEvent(n.rendNodeInput,"mousedown",function(t){s.A.exists(t.stopPropagation)&&t.stopPropagation()},n),e.A.addEvent(n.rendNodeInput,"touchstart",function(t){s.A.exists(t.stopPropagation)&&t.stopPropagation()},n),e.A.addEvent(n.rendNodeInput,"pointerdown",function(t){s.A.exists(t.stopPropagation)&&t.stopPropagation()},n),n.visPropOld.fontsize="0px",i.renderer.updateTextStyle(n,!1),n},t.A.registerElement("input",t.A.createInput);var at=function(){this._handler&&this._handler(),this.board.update()};t.A.createButton=function(i,r,o){var n,a,h,l=s.A.copyAttributes(o,i.options,"button");return h=z.A.prototype.setText,z.A.prototype.setText=z.A.prototype._setText,a=[r[0],r[1],''],(n=i.create("text",a,l)).type=s.A.OBJECT_TYPE_BUTTON,z.A.prototype.setText=h,n.rendNodeButton=n.rendNode.childNodes[0],n.rendNodeButton.id=n.rendNode.id+"_button",n.rendNodeTag=n.rendNodeButton,n.rendNodeTag.disabled=!!l.disabled,n.setText(r[2]),n.visPropOld.fontsize="0px",i.renderer.updateTextStyle(n,!1),r[3]&&(s.A.isString(r[3])?(n._jc=new t.A.JessieCode,n._jc.use(i),n._handler=function(){n._jc.parse(r[3])}):n._handler=r[3]),e.A.addEvent(n.rendNodeButton,"click",at,n),e.A.addEvent(n.rendNodeButton,"mousedown",function(t){s.A.exists(t.stopPropagation)&&t.stopPropagation()},n),e.A.addEvent(n.rendNodeButton,"touchstart",function(t){s.A.exists(t.stopPropagation)&&t.stopPropagation()},n),e.A.addEvent(n.rendNodeButton,"pointerdown",function(t){s.A.exists(t.stopPropagation)&&t.stopPropagation()},n),n},t.A.registerElement("button",t.A.createButton),t.A.createVectorField=function(t,e,i){var r,o;if(!(e.length>=3&&(s.A.isArray(e[0])||s.A.isFunction(e[0])||s.A.isString(e[0]))&&s.A.isArray(e[1])&&3===e[1].length&&s.A.isArray(e[2])&&3===e[2].length))throw new Error("JSXGraph: Can't create vector field with parent types '"+typeof e[0]+"', '"+typeof e[1]+"', '"+typeof e[2]+"'.");return o=s.A.copyAttributes(i,t.options,"vectorfield"),(r=t.create("curve",[[],[]],o)).elType="vectorfield",r.setF=function(t,e){var i,o;return s.A.isArray(t)?(i=s.A.createFunction(t[0],this.board,e),o=s.A.createFunction(t[1],this.board,e),this.F=function(t,e){return[i(t,e),o(t,e)]}):this.F=s.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,o,n,a,h,l,c,d,u,p,f=this.evalVisProp("scale"),A=s.A.evaluate(this.xData[0]),_=s.A.evaluate(this.xData[1]),m=(s.A.evaluate(this.xData[2])-A)/_,g=s.A.evaluate(this.yData[0]),b=s.A.evaluate(this.yData[1]),v=(s.A.evaluate(this.yData[2])-g)/b,y=this.evalVisProp("arrowhead.enabled");for(y&&(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<=_;e+=m,r++)for(o=0,i=g;o<=b;i+=v,o++)(n=this.F(e,i))[0]*=f,n[1]*=f,s.A.concat(this.dataX,[e,e+n[0],NaN]),s.A.concat(this.dataY,[i,i+n[1],NaN]),y&&Math.abs(n[0])+Math.abs(n[1])>0&&(h=(a=Math.atan2(n[1],n[0]))+p,l=a-p,s.A.concat(this.dataX,[e+n[0]-Math.cos(h)*d,e+n[0],e+n[0]-Math.cos(l)*d,NaN]),s.A.concat(this.dataY,[i+n[1]-Math.sin(h)*u,i+n[1],i+n[1]-Math.sin(l)*u,NaN]))},s.A.extendInstanceMethodMap(r,{setF:"setF"}),r},t.A.registerElement("vectorfield",t.A.createVectorField),t.A.createSlopeField=function(t,e,i){var r,o,n;if(!(e.length>=3&&(s.A.isFunction(e[0])||s.A.isString(e[0]))&&s.A.isArray(e[1])&&3===e[1].length&&s.A.isArray(e[2])&&3===e[2].length))throw new Error("JSXGraph: Can't create slope field with parent types '"+typeof e[0]+"', '"+typeof e[1]+"', '"+typeof e[2]+"'.");return o=s.A.createFunction(e[0],t,"x, y"),e[0]=function(t,e){var i=o(t,e),s=Math.sqrt(1+i*i);return[1/s,i/s]},n=s.A.copyAttributes(i,t.options,"slopefield"),(r=t.create("vectorfield",e,n)).elType="slopefield",r.setF=function(t,e){var i=s.A.createFunction(t,r.board,e);this.F=function(t,e){var s=i(t,e),r=Math.sqrt(1+s*s);return[1/r,s/r]}},s.A.extendInstanceMethodMap(r,{setF:"setF"}),r},t.A.registerElement("slopefield",t.A.createSlopeField),t.A.createSmartLabel=function(e,r,o){var n,a,h,l;if(0===r.length||[i.A.OBJECT_CLASS_POINT,i.A.OBJECT_CLASS_LINE,i.A.OBJECT_CLASS_CIRCLE].indexOf(r[0].elementClass)<0&&[i.A.OBJECT_TYPE_POLYGON,i.A.OBJECT_TYPE_ANGLE].indexOf(r[0].type)<0)throw new Error("JSXGraph: Can't create smartlabel with parent types '"+typeof r[0]+"', '"+typeof r[1]+"'.");return h=r[0],l=r[1]||"",a=s.A.copyAttributes(o,e.options,"smartlabel"),h.elementClass===i.A.OBJECT_CLASS_POINT?a=s.A.merge(a,s.A.copyAttributes(o,e.options,"smartlabelpoint")):h.elementClass===i.A.OBJECT_CLASS_LINE?((a=s.A.merge(a,s.A.copyAttributes(o,e.options,"smartlabelline"))).rotate=function(t){var e;switch(t.evalVisProp("orientation")){case"none":return 0;case"orthogonal":e=270;break;case"orthogonal-inverted":e=90;break;case"parallel-inverted":case"inverted":e=0;break;default:e=360}return(180*Math.atan(h.getSlope())/Math.PI+e)%360},a.visible=function(t){var e,i,s,r,o,n=t.evalVisProp("orientation"),a=t.evalVisProp("visibleThreshold"),l=t.getSize();switch(i=h.point1.coords.scrCoords,r=(s=h.point2.coords.scrCoords)[1]-i[1],o=s[2]-i[2],e=Math.floor(Math.sqrt(r*r+o*o)),n){case"parallel":case"parallel-inverted":case"inverted":return l[0]=1.5}}):h.elementClass===i.A.OBJECT_CLASS_CIRCLE?(a=s.A.merge(a,s.A.copyAttributes(o,e.options,"smartlabelcircle"))).visible=function(e){var i,s,r,o,n,a=e.getSize(),l=e.evalVisProp("visibleThreshold");return s=h.center.coords.scrCoords,o=(r=h.point2?h.point2.coords.scrCoords:new t.A.Coords(t.A.COORDS_BY_USER,[h.center.coords.usrCoords[0],h.center.coords.usrCoords[1]+h.Radius()],h.board).scrCoords)[1]-s[1],n=r[2]-s[2],i=2*Math.floor(Math.sqrt(o*o+n*n)),a[0]90&&i<270?i+180:i},a.anchorX=function(){var t=h.center.coords.usrCoords,e=h.getLabelAnchor().usrCoords,i=(180*Math.atan2(e[2]-t[2],e[1]-t[1])/Math.PI+360)%360;return i>90&&i<270?"right":"left"}),h.elementClass===i.A.OBJECT_CLASS_POINT?n=e.create("text",[function(){return h.X()},function(){return h.Y()},""],a):h.elementClass===i.A.OBJECT_CLASS_LINE?"length"===a.measure?n=e.create("text",[function(){return.5*(h.point1.X()+h.point2.X())},function(){return.5*(h.point1.Y()+h.point2.Y())},""],a):"slope"===a.measure&&(n=e.create("text",[function(){return.25*h.point1.X()+.75*h.point2.X()},function(){return.25*h.point1.Y()+.75*h.point2.Y()},""],a)):h.elementClass===i.A.OBJECT_CLASS_CIRCLE?"radius"===a.measure?n=e.create("text",[function(){return h.center.X()+.5*h.Radius()},function(){return h.center.Y()},""],a):"area"===a.measure?n=e.create("text",[function(){return h.center.X()},function(){return h.center.Y()+.5*h.Radius()},""],a):"circumference"!==a.measure&&"perimeter"!==a.measure||(n=e.create("text",[function(){return h.getLabelAnchor()},""],a)):h.type===i.A.OBJECT_TYPE_POLYGON?"area"===a.measure?n=e.create("text",[function(){return h.getTextAnchor()},""],a):"perimeter"===a.measure&&(n=e.create("text",[function(){var t=h.borders.length-1;return t>=0?[.5*(h.borders[t].point1.X()+h.borders[t].point2.X()),.5*(h.borders[t].point1.Y()+h.borders[t].point2.Y())]:h.getTextAnchor()},""],a)):h.type===i.A.OBJECT_TYPE_ANGLE&&(n=e.create("text",[function(){return h.getLabelAnchor()},""],a)),s.A.exists(n)?(n.elType="smartlabel",n.parentObject=h,n.Value=function(){switch(this.evalVisProp("measure")){case"length":return h.L();case"slope":return h.Slope();case"area":return h.Area();case"radius":return h.Radius();case"perimeter":case"circumference":return h.Perimeter();case"rad":return h.Value();case"deg":return 180*h.Value()/Math.PI;case"coords":return[h.X(),h.Y()];default:return 0}},n.Dimension=function(){switch(this.evalVisProp("measure")){case"area":return 2;case"length":case"radius":case"perimeter":case"circumference":case"coords":return 1;default:return 0}},n.Unit=function(t){var e,i="",r=n.evalVisProp("units"),o=t,a={};if(s.A.exists(o)||(o=n.Dimension()),s.A.isArray(t)){for(e=0;e1&&""!==i&&(i=i+"^{"+o+"}")),i},n.setText(function(){var t,e,i,r,o,a,h=s.A.evaluate(l),c="",d="",u="";if(""!==h)return h;if(e=n.Value(),t=n.evalVisProp("digits"),i=n.Unit(),d="",u="",r=n.evalVisProp("dir"),o=n.evalVisProp("usemathjax")||n.evalVisProp("usekatex"),n.evalVisProp("showPrefix")&&(d=n.evalVisProp("prefix")),n.evalVisProp("showSuffix")&&(u=n.evalVisProp("suffix")),n.useLocale())if(s.A.isArray(e))for(a=0;a");c.push(u)}c=c.join("")}}else c=o?["\\(",d,e,"\\,",i,u,"\\)"].join(""):[d,e,i,u].join("");return c}),h.addChild(n),n.setParents([h]),s.A.extendInstanceMethodMap(n,{Value:"Value",V:"Value",Dimension:"Dimension",Unit:"Unit",parent:"parentObject",parentObject:"parentObject"}),n):null},t.A.registerElement("smartlabel",t.A.createSmartLabel),t.A.ForeignObject=function(t,e,r,o,n){this.constructor(t,r,i.A.OBJECT_TYPE_FOREIGNOBJECT,i.A.OBJECT_CLASS_OTHER),this.element=this.board.select(r.anchor),this.coordsConstructor(e),this._useUserSize=!1,this.size=[1,1],s.A.exists(n)&&n.length>0&&(this._useUserSize=!0,this.W=s.A.createFunction(n[0],this.board,""),this.H=s.A.createFunction(n[1],this.board,""),this.addParentsFromJCFunctions([this.W,this.H]),this.usrSize=[this.W(),this.H()]),this.content=o,this.elType="foreignobject",this.id=this.board.setId(this,"Im"),this.board.renderer.drawForeignObject(this),this.board.finalizeAdding(this)},t.A.ForeignObject.prototype=new Y.A,s.A.copyPrototypeMethods(t.A.ForeignObject,V.A,"coordsConstructor"),s.A.copyMethodMap(t.A.ForeignObject,{addTransformation:"addTransform",trans:"addTransform",W:"W",Width:"W",H:"H",Height:"H"}),t.A.extend(t.A.ForeignObject.prototype,{hasPoint:function(t,e){var r,n,a,h,l,c,d,p,f,A=this.transformations.length;return s.A.isObject(this.evalVisProp("precision"))?(h=this.board._inputDevice,l=this.evalVisProp("precision."+h)):l=this.board.options.precision.hasPoint,0===A?(r=t-this.coords.scrCoords[1],n=this.coords.scrCoords[2]-e,r>=-(a=l)&&r-this.size[0]<=a&&n>=-a&&n-this.size[1]<=a):(d=[(c=(c=new u.A(i.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<=(p=(f=o.A.innerProduct)(d,this.span[1]))&&p<=f(this.span[1],this.span[1])&&0<=(p=f(d,this.span[2]))&&p<=f(this.span[2],this.span[2]))},update:function(t){return this.needsUpdate?(this.updateCoords(t),this.updateSize(),this):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,s=[];if(0===i)this.span=[[this.Z(),this.X(),this.Y()],[this.Z(),this.W(),0],[this.Z(),0,this.H()]];else{for(s[0]=[this.Z(),this.X(),this.Y()],s[1]=[this.Z(),this.X()+this.W(),this.Y()],s[2]=[this.Z(),this.X(),this.Y()+this.H()],t=0;t=2&&(l=i[2]),o=s.A.copyAttributes(r,e.options,"foreignobject"),!(n=V.A.create(t.A.ForeignObject,e,h,o,a,l)))throw new Error("JSXGraph: Can't create foreignObject with parent types '"+typeof i[0]+"' and '"+typeof i[1]+"'.\nPossible parent types: [string, [x, y], [w, h]], [string, [x, y]], [element,transformation]");return n},t.A.registerElement("foreignobject",t.A.createForeignObject),t.A.registerElement("fo",t.A.createForeignObject);t.A.ForeignObject;t.A.extend(v.A,{axes3d:{axesPosition:"center",xAxis:{name:"X",withlabel:!0,visible:!0,layer:12,point2:{name:"x"},strokeColor:t.A.palette.red},yAxis:{name:"Y",withlabel:!0,visible:!0,layer:12,point2:{name:"y"},strokeColor:t.A.palette.green},zAxis:{name:"Z",visible:!0,withlabel:!0,layer:12,point2:{name:""},strokeColor:t.A.palette.blue},xAxisBorder:{name:"x",visible:"ìnherit",withLabel:!1,label:{position:"50% left",offset:[30,0],fontsize:15},strokeWidth:1,lastArrow:!1,ticks3d:{visible:"ìnherit",label:{anchorX:"middle",anchorY:"middle"}}},yAxisBorder:{name:"y",visible:"ìnherit",withLabel:!1,label:{position:"50% right",offset:[0,-30],fontsize:15},strokeWidth:1,lastArrow:!1,ticks3d:{visible:"ìnherit",label:{anchorX:"middle"}}},zAxisBorder:{name:"z",visible:"ìnherit",withLabel:!1,label:{position:"50% right",offset:[30,0],fontsize:15},strokeWidth:1,lastArrow:!1,ticks3d:{visible:"ìnherit",label:{anchorX:"middle",anchorY:"middle"}}},xPlaneRear:{visible:!0,layer:0,strokeWidth:1,strokeColor:"#dddddd",fillColor:"#dddddd",mesh3d:{layer:1},stepsU:10,stepsV:10,tiling:"rectangle",polyhedron:{visible:"inherit",strokeWidth:.5,strokeOpacity:.7,strokeColor:"#cccccc",fillOpacity:.3,fillColorArray:["#e7e7e7"],shader:{enabled:!0,fixed:!0,type:"zIndex",hue:0,saturation:0,minlightness:65,maxLightness:98}}},yPlaneRear:{visible:!0,strokeWidth:1,strokeColor:"#dddddd",fillColor:"#dddddd",layer:0,mesh3d:{layer:1},stepsU:10,stepsV:10,tiling:"rectangle",polyhedron:{visible:"inherit",strokeWidth:.5,strokeOpacity:.7,strokeColor:"#cccccc",fillOpacity:.3,fillColorArray:["#e7e7e7"],shader:{enabled:!0,fixed:!0,type:"zIndex",hue:0,saturation:0,minlightness:65,maxLightness:98}}},zPlaneRear:{visible:!0,strokeWidth:1,strokeColor:"#dddddd",fillColor:"#dddddd",layer:0,mesh3d:{layer:1},stepsU:10,stepsV:10,tiling:"rectangle",polyhedron:{visible:"inherit",strokeWidth:.5,strokeOpacity:.7,strokeColor:"#cccccc",fillOpacity:.3,fillColorArray:["#e7e7e7"],shader:{enabled:!0,fixed:!0,type:"zIndex",hue:0,saturation:0,minlightness:65,maxLightness:98}}},xPlaneFront:{visible:!1,type:"wireframe",strokeWidth:1,strokeColor:"#dddddd",fillColor:"none",layer:0,mesh3d:{layer:1,visible:!1},stepsU:10,stepsV:10,tiling:"rectangle",polyhedron:{visible:"inherit",strokeWidth:.5,strokeOpacity:.7,strokeColor:"#cccccc",fillOpacity:.3,fillColorArray:["#e7e7e7"],shader:{enabled:!0,fixed:!0,type:"zIndex",hue:0,saturation:0,minlightness:65,maxLightness:98}}},yPlaneFront:{visible:!1,type:"wireframe",strokeWidth:1,strokeColor:"#dddddd",fillColor:"none",layer:0,mesh3d:{layer:1,visible:!1},stepsU:10,stepsV:10,tiling:"rectangle",polyhedron:{visible:"inherit",strokeWidth:.5,strokeOpacity:.7,strokeColor:"#cccccc",fillOpacity:.3,fillColorArray:["#e7e7e7"],shader:{enabled:!0,fixed:!0,type:"zIndex",hue:0,saturation:0,minlightness:65,maxLightness:98}}},zPlaneFront:{visible:!1,type:"wireframe",strokeWidth:1,strokeColor:"#dddddd",fillColor:"none",layer:0,mesh3d:{layer:1,visible:!1},stepsU:10,stepsV:10,tiling:"rectangle",polyhedron:{visible:"inherit",strokeWidth:.5,strokeOpacity:.7,strokeColor:"#cccccc",fillOpacity:.3,fillColorArray:["#e7e7e7"],shader:{enabled:!0,fixed:!0,type:"zIndex",hue:0,saturation:0,minlightness:65,maxLightness:98}}},xPlaneRearYAxis:{visible:"inherit",strokeColor:"#aaaaaa",strokeWidth:1.2,layer:12},xPlaneRearZAxis:{visible:"inherit",strokeColor:"#888888",strokeWidth:1.2,layer:12},xPlaneFrontYAxis:{visible:!1,strokeColor:"#888888",strokeWidth:1.2,layer:12},xPlaneFrontZAxis:{visible:!1,strokeColor:"#888888",strokeWidth:1.2,layer:12},yPlaneRearXAxis:{visible:"inherit",strokeColor:"#888888",strokeWidth:1.2,layer:12},yPlaneRearZAxis:{visible:"inherit",strokeColor:"#888888",strokeWidth:1.2,layer:12},yPlaneFrontXAxis:{visible:!1,strokeColor:"#888888",strokeWidth:1.2,layer:12},yPlaneFrontZAxis:{visible:!1,strokeColor:"#888888",strokeWidth:1.2,layer:12},zPlaneRearXAxis:{visible:"inherit",strokeColor:"#888888",strokeWidth:1.2,layer:12},zPlaneRearYAxis:{visible:"inherit",strokeColor:"#888888",strokeWidth:1.2,layer:12},zPlaneFrontXAxis:{visible:!1,strokeColor:"#888888",strokeWidth:1.2,layer:12},zPlaneFrontYAxis:{visible:!1,strokeColor:"#888888",strokeWidth:1.2,layer:12}},axis3d:{highlight:!1,fixed:!0,strokeColor:"black",strokeWidth:1,lastArrow:!0,tabindex:null,label:{position:"103% left",offset:[0,0]},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:t.A.palette.yellow,fillOpacity:.4,needsRegularUpdate:!0,visible:!0,shader:{enabled:!1,fixed:!0,type:"angle",hue:60,saturation:90,minLightness:30,maxLightness:90,light:{type:1,az:-45,el:20,bank:0,dir:-1}}},intersectionline3d:{point1:{visible:!1,name:""},point2:{visible:!1,name:""}},line3d:{layer:12,strokeWidth:1,strokeColor:"black",fixed:!0,tabindex:null,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:1,strokeColor:"black",strokeOpacity:1,highlight:!1,tabindex:null,needsRegularUpdate:!0,visible:!0,gradient:"linear",gradientSecondColor:"#ffffff",gradientAngle:Math.PI,fillColor:"#bbbbbb",fillOpacity:.3,type:"shader",tiling:"rectangle",mesh3d:{visible:"inherit"},stepsU:6,stepsV:6,colormap:{min:[-5,190],max:[5,0],s:.9,v:.9},polyhedron:{layer:12,visible:"inherit",strokeWidth:.1,fillOpacity:.8,fillColorArray:["white",t.A.palette.blue],shader:{enabled:!1,fixed:!0,hue:60,saturation:90,minLightness:55,maxLightness:90,light:{dir:-1}}},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,cyclic:!1},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:{visible:!0,layer:12,highlight:!1,tabindex:-1,type:"wireframe",tiling:"rectangle",strokeWidth:.75,colormap:{min:[-5,190],max:[5,0],s:.9,v:.9},polyhedron:{visible:"inherit",strokeWidth:.1,fillOpacity:.8,fillColorArray:["white",t.A.palette.blue],shader:{enabled:!1,fixed:!0,hue:60,saturation:90,minLightness:55,maxLightness:90,light:{dir:-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:!0,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}},r:"auto",trackball:{enabled:!1,outside:!0,button:-1,key:"none"},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}});t.A.Options;t.A.View3D=function(t,e,s){this.constructor(t,s,i.A.OBJECT_TYPE_VIEW3D,i.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=null,this.focalDist=-1,this.projectionType="parallel",this.trackballEnabled=!1,this._lastPos={x:0,y:0},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"},t.A.View3D.prototype=new Y.A,s.A.copyMethodMap(t.A.View3D,{}),t.A.extend(t.A.View3D.prototype,{create:function(t,e,i){var s=[];return t.indexOf("3d")>0&&s.push(this),this.board.create(t,s.concat(e),i)},select:function(t,e){var i,r,o,n,a=t;if(null===a)return a;if(s.A.isString(a)&&""!==a)s.A.exists(this.objects[a])?a=this.objects[a]:s.A.exists(this.elementsByName[a])&&(a=this.elementsByName[a]);else if(!e&&(s.A.isFunction(a)||s.A.isObject(a)&&!s.A.isFunction(a.setAttribute))){for(r={},n=(i=s.A.filterElements(this.objectsList,a)).length,o=0;oo.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=o.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),s=h[2][3],r=h[3][3],h=o.A.matMatMult([[1,0,0,0],[0,1,0,0],[0,0,s,r],[0,0,-r,s]],h),this.angles.el=Math.atan2(r,s),n=-h[1][1],a=h[3][1],this.angles.az=Math.atan2(a,n),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())>o.A.eps||Math.abs(this.angles.el-this.el_slide.Value())>o.A.eps||Math.abs(this.angles.bank-this.bank_slide.Value())>o.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,s,r,n,a=[[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,s=-Math.sin(e),a[1][1]=-Math.cos(t),a[1][2]=Math.sin(t),a[1][3]=0,a[2][1]=s*Math.sin(t),a[2][2]=s*Math.cos(t),a[2][3]=Math.cos(e),a[3][1]=Math.cos(e)*Math.sin(t),a[3][2]=Math.cos(e)*Math.cos(t),a[3][3]=Math.sin(e),r=Math.cos(i),n=Math.sin(i),a=o.A.matMatMult([[1,0,0,0],[0,r,n,0],[0,-n,r,0],[0,0,0,1]],a)},_projectToSphere:function(t,e,i){var s,r=o.A.hypot(e,i);return r<.7071067811865475*t?Math.sqrt(t*t-r*r):(s=t/1.414213562373095)*s/r},updateProjectionTrackball:function(t){var e,i,r,n,a,l,c,d,u,p,f,A,_=100,m=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]];return s.A.exists(this._trackball)?((e=this._trackball.dx)*e+(i=this._trackball.dy)*i>o.A.eps&&(_=.25*(this.size[0]*this.board.unitX+this.size[1]*this.board.unitY),n=[a=this._trackball.x,l=this._trackball.y,this._projectToSphere(_,a,l)],r=[a-=e,l-=i,this._projectToSphere(_,a,l)],A=o.A.crossProduct(r,n),u=o.A.hypot(A[0],A[1],A[2]),A[0]/=u,A[1]/=u,A[2]/=u,d=(d=(d=h.A.distance(n,r,3)/(2*_))>1?1:d)<-1?-1:d,c=2*Math.asin(d),d=1-(p=Math.cos(c)),f=Math.sin(c),m[1][1]=p+A[0]*A[0]*d,m[2][1]=A[1]*A[0]*d+A[2]*f,m[3][1]=A[2]*A[0]*d-A[1]*f,m[1][2]=A[0]*A[1]*d-A[2]*f,m[2][2]=p+A[1]*A[1]*d,m[3][2]=A[2]*A[1]*d+A[0]*f,m[1][3]=A[0]*A[2]*d+A[1]*f,m[2][3]=A[1]*A[2]*d-A[0]*f,m[3][3]=p+A[2]*A[2]*d),m=o.A.matMatMult(m,this.matrix3DRot)):this.matrix3DRot},updateAngleSliderBounds:function(){var t,e,i,s,r,n,a,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,s=this.el_slide._smin,c=this.bank_slide._smax,d=this.bank_slide._smin,this.trackballEnabled?(r=o.A.mod(this.angles.el,2*Math.PI),.5*Math.PIthis.zIndexMax&&(this.zIndexMax=i))},updateDepthOrdering:function(){var t,e,r,o,n,a,h;for(a=this.evalVisProp("depthorder.layers"),r=0;r=0&&this.depthOrdered[h].push(e));if(this.board.renderer&&"svg"===this.board.renderer.type)for(r=0;re[0][1]&&(t[1]=e[0][1],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 s,r,o,n,a;for(a=3===e.length?e:e.slice(1),s=i,r=0;r<3;r++)0!==a[r]&&(o=(this.bbox3D[r][0]-t[r+1])/a[r],n=(this.bbox3D[r][1]-t[r+1])/a[r],s=i<0?Math.max(s,Math.min(o,n)):Math.min(s,Math.max(o,n)));return s},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]-o.A.eps&&i[0]this.bbox3D[1][0]-o.A.eps&&i[1]this.bbox3D[2][0]-o.A.eps&&i[2]-o.A.eps&&s<1+o.A.eps&&(c=[1,a[1]+s*b[1],a[2]+s*b[2],a[3]+s*b[3]],y.push(c));return y},intersectionPlanePolyhedron:function(t,e){var i,s,r,o,n,a,l=1e-12,c=[],d=[],u=[],p=[];for(i=0;i1&&(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"]},freeR:function(){this.r=null},setView:function(t,e,i){return void 0!==i&&(this.r=i),i=this.getCameraDistance(),this.az_slide.setValue(t),this.el_slide.setValue(e),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},_az_elEventHandler:function(t){var e,i,s=this.az_slide._smax,r=this.az_slide._smin,n=(s-r)/this.board.canvasWidth*this.evalVisProp("az.pointer.speed"),a=this.az_slide.Value(),h=this.el_slide.Value();return e=t.screenX-this._lastPos.x,this._lastPos.x=t.screenX,i=t.screenY-this._lastPos.y,this._lastPos.y=t.screenY,this.board.mode!==this.board.BOARD_MODE_DRAG&&this.board._change3DView?(this.evalVisProp("az.pointer.enabled")&&0!==e&&null==t.key&&(a+=e*n),this.evalVisProp("el.pointer.enabled")&&0!==i&&null==t.key&&(h+=i*n),this.evalVisProp("az.continuous")?a=o.A.wrap(a,r,s):a>0?a=Math.min(s,a):a<0&&(a=Math.max(r,a)),s=this.el_slide._smax,r=this.el_slide._smin,this.evalVisProp("el.continuous")&&!this.trackballEnabled?h=o.A.wrap(h,r,s):h>0?h=Math.min(s,h):h<0&&(h=Math.max(r,h)),this.setView(a,h),this):this},_azEventHandler:function(t){var e,i=this.az_slide._smax,s=this.az_slide._smin,r=(i-s)/this.board.canvasWidth*this.evalVisProp("az.pointer.speed"),n=this.az_slide.Value(),a=this.el_slide.Value();return e=t.screenX-this._lastPos.x,this._lastPos.x=t.screenX,this.board.mode!==this.board.BOARD_MODE_DRAG&&this.board._change3DView?(this.evalVisProp("az.keyboard.enabled")&&("ArrowRight"===t.key?n+=this.evalVisProp("az.keyboard.step")*Math.PI/180:"ArrowLeft"===t.key&&(n-=this.evalVisProp("az.keyboard.step")*Math.PI/180)),this.evalVisProp("az.pointer.enabled")&&0!==e&&null==t.key&&(n+=e*r),this.evalVisProp("az.continuous")?n=o.A.wrap(n,s,i):n>0?n=Math.min(i,n):n<0&&(n=Math.max(s,n)),this.setView(n,a),this):this},_elEventHandler:function(t){var e,i=this.el_slide._smax,s=this.el_slide._smin,r=(i-s)/this.board.canvasHeight*this.evalVisProp("el.pointer.speed"),n=this.az_slide.Value(),a=this.el_slide.Value();return e=t.screenY-this._lastPos.y,this._lastPos.y=t.screenY,this.board.mode!==this.board.BOARD_MODE_DRAG&&this.board._change3DView?(this.evalVisProp("el.keyboard.enabled")&&("ArrowUp"===t.key?a-=this.evalVisProp("el.keyboard.step")*Math.PI/180:"ArrowDown"===t.key&&(a+=this.evalVisProp("el.keyboard.step")*Math.PI/180)),this.evalVisProp("el.pointer.enabled")&&0!==e&&null==t.key&&(a+=e*r),this.evalVisProp("el.continuous")&&!this.trackballEnabled?a=o.A.wrap(a,s,i):a>0?a=Math.min(i,a):a<0&&(a=Math.max(s,a)),this.setView(n,a),this):this},_bankEventHandler:function(t){var e,i=this.bank_slide._smax,s=this.bank_slide._smin,r=t.deltaY,n=this.bank_slide.Value();return this.board.mode!==this.board.BOARD_MODE_DRAG&&this.board._change3DView?(this.evalVisProp("bank.keyboard.enabled")&&(e=this.evalVisProp("bank.keyboard.step")*Math.PI/180,"."===t.key||"<"===t.key?n-=e:","!==t.key&&">"!==t.key||(n+=e)),this.evalVisProp("bank.pointer.enabled")&&0!==r&&null==t.key&&(n+=r*((i-s)/this.board.canvasHeight*this.evalVisProp("bank.pointer.speed")),t.preventDefault()),n=this.evalVisProp("bank.continuous")?o.A.wrap(n,s,i):o.A.clamp(n,s,i),this.bank_slide.setValue(n),this.board.update(),this):this},_trackballHandler:function(t){var e,s,r,o,n,a=this.board.getMousePosition(t);return n=new u.A(i.A.COORDS_BY_USER,[this.llftCorner[0]+.5*this.size[0],this.llftCorner[1]+.5*this.size[1]],this.board),e=a[0]-n.scrCoords[1],s=a[1]-n.scrCoords[2],r=t.screenX-this._lastPos.x,o=t.screenY-this._lastPos.y,this._lastPos.x=t.screenX,this._lastPos.y=t.screenY,this._trackball={dx:r,dy:-o,x:e,y:-s},this.board.update(),this},pointerDownHandler:function(t){var i,s,r;this._hasMoveAzEl=!1,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._lastPos.x=t.screenX,this._lastPos.y=t.screenY,this.evalVisProp("trackball.enabled")?(i=this.evalVisProp("trackball.button"),s=this.evalVisProp("trackball.key"),-1!==i&&i!==t.button||!("none"===s||s.indexOf("shift")>-1&&t.shiftKey||s.indexOf("ctrl")>-1&&t.ctrlKey)||(r=this.evalVisProp("trackball.outside")?document:this.board.containerObj,e.A.addEvent(r,"pointermove",this._trackballHandler,this),this._hasMoveTrackball=!0)):(this.evalVisProp("az.pointer.enabled")&&this.evalVisProp("el.pointer.enabled")&&(i=this.evalVisProp("az.pointer.button"),s=this.evalVisProp("az.pointer.key"),i===this.evalVisProp("el.pointer.button")&&s===this.evalVisProp("el.pointer.key")&&(-1!==i&&i!==t.button||!("none"===s||s.indexOf("shift")>-1&&t.shiftKey||s.indexOf("ctrl")>-1&&t.ctrlKey)||(r=this.evalVisProp("az.pointer.outside")?document:this.board.containerObj)===(this.evalVisProp("el.pointer.outside")?document:this.board.containerObj)&&(e.A.addEvent(r,"pointermove",this._az_elEventHandler,this),this._hasMoveAzEl=!0))),this._hasMoveAzEl||(this.evalVisProp("az.pointer.enabled")&&(i=this.evalVisProp("az.pointer.button"),s=this.evalVisProp("az.pointer.key"),-1!==i&&i!==t.button||!("none"===s||s.indexOf("shift")>-1&&t.shiftKey||s.indexOf("ctrl")>-1&&t.ctrlKey)||(r=this.evalVisProp("az.pointer.outside")?document:this.board.containerObj,e.A.addEvent(r,"pointermove",this._azEventHandler,this),this._hasMoveAz=!0)),this.evalVisProp("el.pointer.enabled")&&(i=this.evalVisProp("el.pointer.button"),s=this.evalVisProp("el.pointer.key"),-1!==i&&i!==t.button||!("none"===s||s.indexOf("shift")>-1&&t.shiftKey||s.indexOf("ctrl")>-1&&t.ctrlKey)||(r=this.evalVisProp("el.pointer.outside")?document:this.board.containerObj,e.A.addEvent(r,"pointermove",this._elEventHandler,this),this._hasMoveEl=!0))),this.evalVisProp("bank.pointer.enabled")&&(i=this.evalVisProp("bank.pointer.button"),s=this.evalVisProp("bank.pointer.key"),-1!==i&&i!==t.button||!("none"===s||s.indexOf("shift")>-1&&t.shiftKey||s.indexOf("ctrl")>-1&&t.ctrlKey)||(r=this.evalVisProp("bank.pointer.outside")?document:this.board.containerObj,e.A.addEvent(r,"wheel",this._bankEventHandler,this,{passive:!1}),this._hasMoveBank=!0))),e.A.addEvent(document,"pointerup",this.pointerUpHandler,this))},pointerUpHandler:function(t){var i;this._hasMoveAzEl&&(i=this.evalVisProp("az.pointer.outside")?document:this.board.containerObj,e.A.removeEvent(i,"pointermove",this._az_elEventHandler,this),this._hasMoveAzEl=!1),this._hasMoveAz&&(i=this.evalVisProp("az.pointer.outside")?document:this.board.containerObj,e.A.removeEvent(i,"pointermove",this._azEventHandler,this),this._hasMoveAz=!1),this._hasMoveEl&&(i=this.evalVisProp("el.pointer.outside")?document:this.board.containerObj,e.A.removeEvent(i,"pointermove",this._elEventHandler,this),this._hasMoveEl=!1),this._hasMoveBank&&(i=this.evalVisProp("bank.pointer.outside")?document:this.board.containerObj,e.A.removeEvent(i,"wheel",this._bankEventHandler,this),this._hasMoveBank=!1),this._hasMoveTrackball&&(i=this.evalVisProp("trackball.outside")?document:this.board.containerObj,e.A.removeEvent(i,"pointermove",this._trackballHandler,this),this._hasMoveTrackball=!1),e.A.removeEvent(document,"pointerup",this.pointerUpHandler,this),this.board._change3DView=!1,this.board.mode=this.board.BOARD_MODE_NONE}}),t.A.createView3D=function(i,r,n){var a,h,l,c,d,u,p,f,A,_,m,g,b=r[0],v=r[1];return h=s.A.copyAttributes(n,i.options,"view3d"),(a=new t.A.View3D(i,r,h)).defaultAxes=a.create("axes3d",[],h),u=b[0],p=b[1],f=v[0],A=v[1],(l=s.A.copyAttributes(h,i.options,"view3d","az","slider")).name="az",(c=s.A.copyAttributes(h,i.options,"view3d","el","slider")).name="el",(d=s.A.copyAttributes(h,i.options,"view3d","bank","slider")).name="bank",g=s.A.evaluate(l.point1.pos),_=s.A.isArray(g)?g:[u-1,p-2],g=s.A.evaluate(l.point2.pos),m=s.A.isArray(g)?g:[u+f+1,p-2],a.az_slide=i.create("slider",[_,m,[s.A.evaluate(l.min),s.A.evaluate(l.start),s.A.evaluate(l.max)]],l),a.inherits.push(a.az_slide),a.az_slide.elType="view3d_slider",g=s.A.evaluate(c.point1.pos),_=s.A.isArray(g)?g:[u-1,p],g=s.A.evaluate(c.point2.pos),m=s.A.isArray(g)?g:[u-1,p+A],a.el_slide=i.create("slider",[_,m,[s.A.evaluate(c.min),s.A.evaluate(c.start),s.A.evaluate(c.max)]],c),a.inherits.push(a.el_slide),a.el_slide.elType="view3d_slider",g=s.A.evaluate(d.point1.pos),_=s.A.isArray(g)?g:[u-1,p+A+2],g=s.A.evaluate(d.point2.pos),m=s.A.isArray(g)?g:[u+f+1,p+A+2],a.bank_slide=i.create("slider",[_,m,[s.A.evaluate(d.min),s.A.evaluate(d.start),s.A.evaluate(d.max)]],d),a.inherits.push(a.bank_slide),a.bank_slide.elType="view3d_slider",a.board.infobox.visProp=s.A.merge(a.board.infobox.visProp,h.infobox),a.board.highlightInfobox=function(t,e,i){var r,n,h,l,c,d,u="",p=i.board,f=null;for(this.mode===this.BOARD_MODE_DRAG&&(u=a.isVerticalDrag()?'⇅  ':'⇄  '),n=0;n-1&&t.shiftKey||e.indexOf("ctrl")>-1&&t.ctrlKey)&&(a._elEventHandler(t),i=!0),!a.evalVisProp("az.keyboard.enabled")||"ArrowLeft"!==t.key&&"ArrowRight"!==t.key||("none"===(e=a.evalVisProp("az.keyboard.key"))||e.indexOf("shift")>-1&&t.shiftKey||e.indexOf("ctrl")>-1&&t.ctrlKey)&&(a._azEventHandler(t),i=!0),!a.evalVisProp("bank.keyboard.enabled")||","!==t.key&&"<"!==t.key&&"."!==t.key&&">"!==t.key||("none"===(e=a.evalVisProp("bank.keyboard.key"))||e.indexOf("shift")>-1&&t.shiftKey||e.indexOf("ctrl")>-1&&t.ctrlKey)&&(a._bankEventHandler(t),i=!0),"PageUp"===t.key?(a.nextView(),i=!0):"PageDown"===t.key&&(a.previousView(),i=!0),i&&t.preventDefault(),this.board._change3DView=!1},a),e.A.addEvent(i.containerObj,"pointerdown",a.pointerDownHandler,a),a.getAnglesFromSliders(),a.matrix3DRot=a.getRotationFromAngles(),a.updateAngleSliderBounds(),a.board.update(),a},t.A.registerElement("view3d",t.A.createView3D);t.A.View3D;t.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)},t.A.extend(t.A.GeometryElement3D.prototype,{setAttr2D:function(t){var e=t;return e.name=this.name,e.element3d=this,e.id=null,e},setAttribute:function(e){var i,r,o,n,a,h={};for(i=0;io.A.norm(this.frame1)&&(this.frame1=h),this.frame2=o.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),s=Math.cos(t);return[l.center.coords[1]+e*(s*l.frame1[1]+i*l.frame2[1]),l.center.coords[2]+e*(s*l.frame1[2]+i*l.frame2[2]),l.center.coords[3]+e*(s*l.frame1[3]+i*l.frame2[3])]},[0,2*Math.PI]],a)},t.A.Circle3D.prototype=new t.A.GeometryElement,s.A.copyPrototypeMethods(t.A.Circle3D,t.A.GeometryElement3D,"constructor3D"),t.A.extend(t.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=s.A.createFunction(t,this.board),this.addParentsFromJCFunctions([this.updateRadius]),this.board.update(),this},Radius:function(t){return s.A.exists(t)?(this.setRadius(t),this.Radius()):Math.abs(this.updateRadius())},normalizeFrame:function(){var t,e=o.A.norm(this.frame1),i=o.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=o.A.eps*o.A.eps;if(this.normal=s.A.evaluate(this.normalFunc),e=o.A.norm(this.normal),Math.abs(e)>i)for(t=0;t<4;t++)this.normal[t]/=e;return this},updateFrame:function(){return this.frame1=o.A.crossProduct(this.frame2.slice(1),this.normal.slice(1)),this.frame1.unshift(0),this.frame2=o.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)},projectScreenCoords:function(t,e,i){return this.curve.projectScreenCoords(t,e,i)}}),t.A.createCircle3D=function(e,i,r){var o,n=i[0],a=s.A.copyAttributes(r,e.options,"circle3d"),h=s.A.providePoints3D(n,[i[1]],r,"circle3d",["point"])[0],l=i[2],c=i[3];return s.A.isArray(l)&&3===l.length&&l.unshift(0),(o=new t.A.Circle3D(n,h,l,c,a)).curve.addParents([o]),o.addChild(o.curve),o.update(),o},t.A.registerElement("circle3d",t.A.createCircle3D),t.A.createIntersectionCircle3D=function(t,e,r){var o,n,a,l=e[0],c=e[1],d=e[2],u=s.A.copyAttributes(r,t.options,"intersectioncircle3d");try{a=h.A.intersectionFunction3D(l,c,d),n=l.create("point3d",a[0],{visible:!1}),o=l.create("circle3d",[n,a[1],a[2]],u),c.addChild(o),d.addChild(o)}catch(t){throw new Error("JSXGraph: Can't create 'intersection' with parent types '"+typeof e[1]+"' and '"+typeof e[2]+"'.")}return o.type=i.A.OBJECT_TYPE_INTERSECTION_CIRCLE3D,o.elType="intersectioncircle3d",o.setParents([c.id,d.id]),o},t.A.registerElement("intersectioncircle3d",t.A.createIntersectionCircle3D),t.A.Point3D=function(t,e,s,r){this.constructor(t.board,r,i.A.OBJECT_TYPE_POINT3D,i.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=s,this.position=[],this.movePath=[],this.moveCallback=null,this.moveInterval=null,this._c2d=null},t.A.Point3D.prototype=new t.A.GeometryElement,s.A.copyPrototypeMethods(t.A.Point3D,t.A.GeometryElement3D,"constructor3D"),s.A.copyMethodMap(t.A.Point3D,{}),t.A.extend(t.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(s.A.isFunction(this.F))this.coords=s.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;t1e-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[3],this.normalizeCoords()),this},addTransform:function(t,e){return this.addTransformGeneric(t,e),this},removeTransform:function(t){return this.removeTransformGeneric(t),this},clearTransforms:function(){return this.clearTransformsGeneric(),this},updateTransform:function(){var t,e;if(0===this.transformations.length||null===this.baseElement)return this;for(t=this===this.baseElement?this.initialCoords:this.baseElement.coords,e=0;e1e-12},distance:function(t){var e=this.coords,i=t.coords;return e[0]*e[0]>1e-12&&i[0]*i[0]>1e-12?o.A.hypot(i[1]-e[1],i[2]-e[2],i[3]-e[3]):Number.POSITIVE_INFINITY},moveTo:function(t,e,i){i=i||{};var r,n,a=Math.ceil(e/this.board.attr.animationdelay),h=t[0],l=t[1],c=t[2],d=this.coords[1]-h,u=this.coords[2]-l,p=this.coords[3]-c,f=()=>{};if(i.callback&&(f=i.callback),n=function(t){var e=t/a;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/a;throw new Error("valid effects are '==', '<>', '>', and '<'.")}return t/a},!s.A.exists(e)||0===e)return this.setPosition([h,l,c],!0),this.board.update(this);if(!s.A.exists(i.callback)&&Math.abs(d)=0;r--)this.animationPath[a-r]=[h+d*n(r),l+u*n(r),c+p*n(r)];return this.moveAlong(this.animationPath,e,{callback:f})},moveAlong:function(t,e,i){let r=e/t.length;if(s.A.isObject(i)&&"callback"in i&&(this.moveCallback=i.callback),!(this.movePath.length>0))return this.movePath=t,new Promise((t,e)=>{this.moveInterval=setInterval(()=>{if(this.movePath.length>0){let t=this.movePath.shift();this.setPosition(t,!0),this.board.update(this)}0===this.movePath.length&&(clearInterval(this.moveInterval),t(),s.A.isFunction(this.moveCallback)&&this.moveCallback())},r)});this.movePath=t},__evt__update3D:function(t){}}),t.A.createPoint3D=function(e,i,r){var o,n,a,h,l,c=i[0],d=null,u=null;if(a=i.length>2&&s.A.exists(i[i.length-1].is3D)&&!s.A.isTransformationOrArray(i[i.length-1])?i.pop():null,2===i.length)n=i[1];else if(3===i.length&&s.A.isPoint3D(i[1])&&s.A.isTransformationOrArray(i[2]))n=[0,0,0],d=i[1],u=i[2];else if(4===i.length)n=i.slice(1);else{if(5!==i.length)throw new Error("JSXGraph: Can't create point3d with parent types '"+typeof i[1]+"' and '"+typeof i[2]+"'.\nPossible parent types: [[x,y,z]], [x,y,z], or [[x,y,z], slide], () => [x, y, z], or [point, transformation(s)]");n=i.slice(1)}return o=s.A.copyAttributes(r,e.options,"point3d"),(l=new t.A.Point3D(c,n,a,o)).initCoords(),null!==d&&null!==u&&l.addTransform(d,u),h=c.project3DTo2D(l.coords),o=l.setAttr2D(o),l.element2D=c.create("point",h,o),l.element2D.view=c,l.element2D.dump=!1,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},t.A.registerElement("point3d",t.A.createPoint3D),t.A.Curve3D=function(t,e,r,o,n,a,h){this.constructor(t.board,h,i.A.OBJECT_TYPE_CURVE3D,i.A.OBJECT_CLASS_3D),this.constructor3D(t,"curve3d"),this.board.finalizeAdding(this),this._F=e,this._X=r,this._Y=o,this._Z=n,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]}):s.A.isFunction(this._X)?this._F=function(t){return[this._X(t),this._Y(t),this._Z(t)]}:this._F=null,this.range=a},t.A.Curve3D.prototype=new t.A.GeometryElement,s.A.copyPrototypeMethods(t.A.Curve3D,t.A.GeometryElement3D,"constructor3D"),s.A.copyMethodMap(t.A.Curve3D,{}),t.A.extend(t.A.Curve3D.prototype,{updateCoords:function(){var t,e,i,r,o,n,a=this.evalVisProp("numberpointshigh"),h=[1,0,0,0];if(this.points=[],s.A.exists(this.dataX))for(a=this.dataX.length,o=0;o=5&&(s.A.isArray(e[1])||s.A.isFunction(e[1])||s.A.isString(e[1]))&&s.A.isArray(e[2])&&3===e[1].length&&s.A.isArray(e[3])&&3===e[2].length&&s.A.isArray(e[4])&&3===e[3].length))throw new Error("JSXGraph: Can't create vector field 3D with parent types '"+typeof e[1]+"', '"+typeof e[2]+"', '"+typeof e[3]+"'.'"+typeof e[4]+"', ");return n=s.A.copyAttributes(i,t.options,"vectorfield3d"),(r=a.create("curve3d",[[],[],[]],n)).setF=function(t,e){var i,o,n;return s.A.isArray(t)?(i=s.A.createFunction(t[0],this.board,e),o=s.A.createFunction(t[1],this.board,e),n=s.A.createFunction(t[2],this.board,e),this.F=function(t,e,s){return[i(t,e,s),o(t,e,s),n(t,e,s)]}):this.F=s.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,n,a,h,l,c,d,u,p,f,A,_,m,g,b,v=this.evalVisProp("scale"),y=[s.A.evaluate(this.xData[0]),s.A.evaluate(this.yData[0]),s.A.evaluate(this.zData[0])],C=[s.A.evaluate(this.xData[1]),s.A.evaluate(this.yData[1]),s.A.evaluate(this.zData[1])],P=[s.A.evaluate(this.xData[2]),s.A.evaluate(this.yData[2]),s.A.evaluate(this.zData[2])],E=[(P[0]-y[0])/C[0],(P[1]-y[1])/C[1],(P[2]-y[2])/C[2]],x=this.evalVisProp("arrowhead.enabled");for(x&&(A=this.evalVisProp("arrowhead.size"),b=this.evalVisProp("arrowhead.angle"),_=A/t.unitX,m=A/t.unitY,g=A/Math.sqrt(t.unitX*t.unitY)),this.dataX=[],this.dataY=[],this.dataZ=[],i=0,h=y[0];i<=C[0];h+=E[0],i++)for(r=0,l=y[1];r<=C[1];l+=E[1],r++)for(e=0,c=y[2];e<=C[2];c+=E[2],e++)n=this.F(h,l,c),(a=o.A.norm(n))o.A.eps*o.A.eps)for(t=0;t<3;t++)this.normal[t]/=e;return this.normal.unshift(0),this.d=o.A.innerProduct(this.point.coords,this.normal,4),this},updateDataArray:function(){var t,e,i,r,n,a,l,c,d,u,p,f,A,_,m=["xPlaneRear","yPlaneRear","zPlaneRear"],g=[],b=[0,0,0],v=[0,0,0],y=[0,0,0],C=[0,0,0],P=1e-12,E=this.view;if(this.dataX=[],this.dataY=[],this.updateNormal(),"axisplane3d"!==this.elType&&E.defaultAxes&&s.A.evaluate(this.range_u[0])===-1/0&&s.A.evaluate(this.range_u[1])===1/0&&s.A.evaluate(this.range_v[0])===-1/0&&s.A.evaluate(this.range_v[1])===1/0){for(u=0;u{var i,s,r=0,o=e.polyhedron,n=o.faces[e.faceNumber],a=n.length;if(N||(C=f.evalVisProp("colormap.max"),P=C[0],x=C[1],C=f.evalVisProp("colormap.min"),E=C[0],O=C[1]),0!==a){for(i=0;io.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[3],this.normalizeCoords()),this},update:function(t){var e,s,r;return this.element2D.draggable()&&0!==h.A.distance(this._c2d,this.element2D.coords.usrCoords)?(this.view.isVerticalDrag()?e=this.view.project2DTo3DVertical(this.element2D,this.coords):(s=[1,0,0,this.coords[3]],e=this.view.project2DTo3DPlane(this.element2D,[1,0,0,1],s)),0!==e[0]&&(r=this.view.project3DToCube(e),this.coords=r[0],r[1]&&this.element2D.coords.setCoordinates(i.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(i.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(i.A.COORDS_BY_USER,this.view.project3DTo2D(e)),this.zIndex=o.A.innerProduct(this.view.matrix3DRotShift[3],e),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])>o.A.eps},__evt__update3D:function(t){}}),t.A.createText3D=function(e,i,r){var o,n,a,h,l,c,d=i[0];if(a=i.length>2&&s.A.exists(i[i.length-1].is3D)?i.pop():null,3===i.length)n=i[1],h=i[2];else{if(5!==i.length)throw new Error("JSXGraph: Can't create text3d with parent types '"+typeof i[1]+"' and '"+typeof i[2]+"'.\nPossible parent types: [[x,y,z], text], [x,y,z, text]");n=i.slice(1,4),h=i[4]}return o=s.A.copyAttributes(r,e.options,"text3d"),(c=new t.A.Text3D(d,n,h,a,o)).initCoords(),l=d.project3DTo2D(c.coords),o=c.setAttr2D(o),c.element2D=d.create("text",[l[1],l[2],h],o),c.element2D.view=d,c.element2D.dump=!1,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},t.A.registerElement("text3d",t.A.createText3D),t.A.createTicks3D=function(e,i,r){var n,a,h=i[0],l=i[1],c=i[2],d=i[3],u=i[4];return a=s.A.copyAttributes(r,e.options,"ticks3d"),(n=h.create("curve",[[],[]],a)).point=l,n.direction1=c,n.len=d,n.direction2=u,n.drawLabels=function(i){var r,n,a,l,c,d,u,p=this.len,f=this.evalVisProp("ticksdistance"),A=this.evalVisProp("tickendings"),_=this.evalVisProp("majorheight"),m=[0,0,0],g=[0,0,0],b=[0,0,0],v=[];if(r=(_/=Math.sqrt(e.unitX*e.unitY))*A[1]*2,this.dataX=[],this.dataY=[],s.A.isFunction(this.point))b=this.point().slice(1);else for(l=0;l<3;l++)b[l]=s.A.evaluate(this.point[l]);for(l=0;l<3;l++)m[l]=s.A.evaluate(this.direction1[l]),g[l]=s.A.evaluate(this.direction2[l]);for(n=t.A.Math.norm(m,3),a=t.A.Math.norm(g,3),l=0;l<3;l++)m[l]/=n,g[l]/=a;if(!(Math.abs(f)s.A.isPoint3D(t)))p=r[1];else if(!1===(p=s.A.providePoints3D(u,r.slice(1),o,"polygon3d",["vertices"])))throw new 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((n=new t.A.Polygon3D(u,p,c)).isDraggable=!0,c=n.setAttr2D(c),a=0;a0&&(this.zIndex/=e),2!==e&&(r.push(r[0]),n.push(n[0])),{X:r,Y:n}},addTransform:function(t,e){return 0===this.faceNumber&&this.addTransformGeneric(t,e),this},removeTransform:function(t){return 0===this.faceNumber&&this.removeTransformGeneric(t),this},clearTransforms:function(){return 0===this.faceNumber&&this.clearTransformsGeneric(),this},updateTransform:function(){var t,e,i,s,r;if(0!==this.faceNumber)return this;if(0===this.transformations.length||null===this.baseElement)return this;for(t=this.transformations,i=0;i1e-12)for(t=1;t<4;t++)this.normal[t]/=i;this.d=o.A.innerProduct(s,this.normal,4)}return this},updateRenderer:function(){return this.needsUpdate&&(this.needsUpdate=!1),this},getRotationFromAngles:function(t){var e,i,s,r,n,a,h=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]];return e=t.az,i=t.el,s=t.bank,r=-Math.sin(i),h[1][1]=-Math.cos(e),h[1][2]=Math.sin(e),h[1][3]=0,h[2][1]=r*Math.sin(e),h[2][2]=r*Math.cos(e),h[2][3]=Math.cos(i),h[3][1]=Math.cos(i)*Math.sin(e),h[3][2]=Math.cos(i)*Math.cos(e),h[3][3]=Math.sin(i),n=Math.cos(s),a=Math.sin(s),h=o.A.matMatMult([[1,0,0,0],[0,n,a,0],[0,-a,n,0],[0,0,0,1]],h)},shader:function(){var t,e,i,s,r,n,a,h,l,c,d,u,p;if(this.evalVisProp("shader.enabled")){if(t=this.evalVisProp("shader.hue"),e=this.evalVisProp("shader.saturation"),u=this.evalVisProp("shader.minlightness"),p=this.evalVisProp("shader.maxlightness"),"angle"===this.evalVisProp("shader.type").toLowerCase()){switch((l=this.evalVisProp("shader.light")).type){case 2:a={az:l.az*Math.PI/180,el:l.el*Math.PI/180,bank:l.bank*Math.PI/180},n=this.getRotationFromAngles(a)[3],h=l.dir;break;case 3:a={az:this.view.angles.az+l.az*Math.PI/180,el:this.view.angles.el+l.el*Math.PI/180,bank:this.view.angles.bank},n=this.getRotationFromAngles(a)[3],h=l.dir;break;default:n=this.view.matrix3DRotShift[3],h=l.dir}s=o.A.innerProduct(n,this.normal),i=u+(p-u)*(s=0===h?Math.abs(s):h<0?-s:s)}else d=this.view.zIndexMax,c=this.view.zIndexMin,i=u+(p-u)*((this.zIndex-c)/(d-c));return r="hsl("+t+","+e+"%,"+i+"%)",this.element2D.visProp.fillcolor=r,this._shadingDone=!0,this.zIndex}}}),t.A.createFace3D=function(e,i,r){var o,n,a=i[0],h=i[1],l=i[2];return o=s.A.copyAttributes(r,e.options,"face3d"),o=(n=new t.A.Face3D(a,h,l,o)).setAttr2D(o),n.element2D=a.create("curve",[[],[]],o),n.element2D.view=a,n.element2D.dump=!1,n.element2D.updateDataArray=function(){var t=n.updateDataArray2D();this.dataX=t.X,this.dataY=t.Y},n.element2D.hasPoint=function(){},n.addChild(n.element2D),n.inherits.push(n.element2D),n.element2D.setParents(n),n.element2D.prepareUpdate().update(),e.isSuspendedUpdate||n.element2D.updateVisibility().updateRenderer(),n},t.A.registerElement("face3d",t.A.createFace3D),t.A.Polyhedron3D=function(t,e,r,o){var n,a,h,l=this;for(this.constructor(t.board,o,i.A.OBJECT_TYPE_POLYHEDRON3D,i.A.OBJECT_CLASS_3D),this.constructor3D(t,"polyhedron3d"),this.board.finalizeAdding(this),this.elType="polyhedron3d",this.faces=r,this.numberFaces=r.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)&&s.A.exists(l.faces[e][t])&&l.faces[e][t].apply(l.faces[e],arguments);return l}},n=0;n0&&t.faces.length>0))throw new Error("Adding transformation failed. At least one of the two polyhedra has no faces.");return this.faces[0].addTransform(t.faces[0],e),this},removeTransform:function(t){if(!(this.faces.length>0))throw new Error("Removing transformation failed. The polyhedron has no faces.");return this.faces[0].removeTransform(t),this},clearTransforms:function(){if(!(this.faces.length>0))throw new Error("Removing transformation failed. The polyhedron has no faces.");return this.faces[0].clearTransforms(),this},toSTL:function(t){var e,i,s,r,o,n,a="solid ";for(void 0===t&&(t=this.name),a+=t+"\n",e=0;e0&&(d.fillcolor=u.fillcolorarray[n%u.fillcolorarray.length]),l=m.faces[n],s.A.isArray(l)&&2===l.length&&s.A.isObject(l[1])&&s.A.isArray(l[0])&&(s.A.mergeAttr(d,l[1]),m.faces[n]=l[0]),h=p.create("face3d",[m,n],d),f.push(h);for((c=new t.A.Polyhedron3D(p,m,f,u)).setParents(c),n=0;n1e-8?[-(n[0]*h[1][1]+n[1]*h[2][1])/a,-(n[0]*h[1][2]+n[1]*h[2][2])/a,-(n[0]*h[1][3]+n[1]*h[2][3])/a]:[h[1][1],h[1][2],h[1][3]],r.project3DTo2D([t.center.X()+l*(u*s[0]+d*h[3][1]),t.center.Y()+l*(u*s[1]+d*h[3][2]),t.center.Z()+l*(u*s[2]+d*h[3][3])]))}},buildProjection:function(t){var e=this.view,i={visible:!1,withLabel:!1},s=e.create("point",this.focusFn(-1),i),r=e.create("point",this.focusFn(1),i),o=e.create("point",this.innerVertexFn(e),i);this.aux2D=[s,r,o],this.element2D=e.create("ellipse",this.aux2D,void 0===t?this.visProp:t),this.addChild(this.element2D),this.inherits.push(this.element2D),this.element2D.view=this.view,this.element2D.dump=!1},projectCoords:function(t,e){var i=this.Radius(),s=[1].concat(t),r=this.center.coords,o=h.A.distance(r,s,4),n=p.A.subtract(s,r);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)}}),t.A.createSphere3D=function(e,i,r){var o,n,a,h,l,c,d=i[0];for(o=s.A.copyAttributes(r,e.options,"sphere3d"),n=[],c=1;c0)for(e=0;e0)for(t=0;t0)for(h=this.baseElement.points[0].length,i=0;i{var i,s,r=0,o=e.polyhedron,n=o.faces[e.faceNumber],a=n.length;if(E||(_=O.evalVisProp("colormap.max"),m=_[0],v=_[1],_=O.evalVisProp("colormap.min"),g=_[0],y=_[1]),0!==a){for(i=0;iparseFloat(t)),c=!1,s=0;s 3, - "expressions" => "sin(x)*cos(y)\nx^2-y^2", - "z_min" => -2, - "z_max" => 2, - ) - graph = JSON.parse(result[:answer].lines[1]) - - expect(graph).to include( - "dimensions" => 3, - "functions" => %w[sin(x)*cos(y) x^2-y^2], - "z_domain" => [-2, 2], + it "prepares each additional 2D family through the same compact tool" do + cases = [ + ["implicit", "x^2+y^2-4", "functions", ["x^2+y^2-4"]], + ["parametric", "cos(t); sin(t)", "functions", [%w[cos(t) sin(t)]]], + ["polar", "2*cos(3*theta)", "functions", ["2*cos(3*theta)"]], + ["points", "0,1\n2,3", "points", [[0, 1], [2, 3]]], + ["polyline", "0,1\n2,3", "points", [[0, 1], [2, 3]]], + ["vector", "3,2\n1,1,-2,1", "vectors", [[0, 0, 3, 2], [1, 1, -2, 1]]], + ] + cases.each do |type, expressions, key, expected| + result = tool.process("plot_type" => type, "expressions" => expressions) + graph = JSON.parse(result[:answer].lines[1]) + expect(graph).to include("plot_type" => type, key => expected) + if %w[parametric polar].include?(type) + expect(graph["parameter_range"]).to eq([0, 2 * Math::PI]) + end + expect(result[:token_usage]).to eq(0) + end + expect(tool.parameters.map { |parameter| parameter[:name] }).to eq( + %w[expressions title plot_type x_min x_max y_min y_max parameter_min parameter_max], ) - expect(result[:token_usage]).to eq(0) end - it "ignores z arguments supplied for 2D plots by providers requiring all fields" do - result = - tool.process( - "expressions" => "exp(-0.15*x)*sin(3*x)\nexp(-0.15*x)\n-exp(-0.15*x)", - "title" => "Damped oscillation with exponential envelopes", - "dimensions" => 2, - "x_min" => 0, - "x_max" => 20, - "y_min" => -1.1, - "y_max" => 1.1, - "z_min" => 0, - "z_max" => 0, - ) - graph = JSON.parse(result[:answer].lines[1]) + it "uses parameter bounds for trajectories and ignores placeholders for ordinary functions" do + args = { + "expressions" => "exp(-0.15*x)*sin(3*x)\nexp(-0.15*x)\n-exp(-0.15*x)", + "parameter_min" => 0, + "parameter_max" => 0, + } + graph = JSON.parse(tool.process(args)[:answer].lines[1]) expect(graph["functions"].length).to eq(3) - expect(graph["x_domain"]).to eq([0, 20]) - expect(graph).not_to have_key("z_domain") + expect(graph).not_to have_key("parameter_range") + + graph = + JSON.parse( + tool.process( + "plot_type" => "polar", + "expressions" => "theta", + "parameter_min" => -2, + "parameter_max" => 4, + )[ + :answer + ].lines[ + 1 + ], + ) + expect(graph["parameter_range"]).to eq([-2, 4]) end it "rejects unsafe, malformed and oversized graph requests with correction guidance" do @@ -111,9 +123,28 @@ { "expressions" => "x", "title" => "a" * 121 }, { "expressions" => "x", "unexpected" => "value" }, { "expressions" => "y" }, - { "expressions" => "x", "dimensions" => 4 }, - { "expressions" => "x", "dimensions" => 3, "z_min" => 1 }, - { "expressions" => "x\ny\nx+y", "dimensions" => 3 }, + { "expressions" => "x", "plot_type" => "surface" }, + { "expressions" => "x", "plot_type" => "polar" }, + { "expressions" => "t", "plot_type" => "parametric" }, + { "expressions" => "t; t; t", "plot_type" => "parametric" }, + { "expressions" => "t; y", "plot_type" => "parametric" }, + { "expressions" => "x\ny\nx+y", "plot_type" => "implicit" }, + { "expressions" => "theta", "plot_type" => "polar", "parameter_min" => 0 }, + { + "expressions" => "theta", + "plot_type" => "polar", + "parameter_min" => 0, + "parameter_max" => 0, + }, + { "expressions" => "0,NaN", "plot_type" => "points" }, + { "expressions" => "0,1e309", "plot_type" => "points" }, + { "expressions" => "0,1000001", "plot_type" => "points" }, + { "expressions" => "0,1,2", "plot_type" => "polyline" }, + { "expressions" => "0,1,2", "plot_type" => "vector" }, + { "expressions" => "0,", "plot_type" => "points" }, + { "expressions" => "0,2*x", "plot_type" => "points" }, + { "expressions" => "0,1\n" * 151, "plot_type" => "points" }, + { "expressions" => "0,1\n" * 17, "plot_type" => "vector" }, ] invalid.each do |arguments| expect(tool.process(arguments)).to eq( diff --git a/spec/system/page_objects/components/function_plots.rb b/spec/system/page_objects/components/function_plots.rb index 918e2bb9..879ace25 100644 --- a/spec/system/page_objects/components/function_plots.rb +++ b/spec/system/page_objects/components/function_plots.rb @@ -5,7 +5,7 @@ module Components class FunctionPlots < PageObjects::Components::Base def has_rendered_graphs?(count:) page.has_css?(".chatbot-function-plot__canvas svg", count: count) && - page.has_css?(".chatbot-function-plot__curve", minimum: count) + page.has_css?(".chatbot-function-plot__canvas .graph", minimum: count) end def has_error? @@ -20,13 +20,12 @@ def has_no_error? end def has_separate_domain_segments? - path = find(".chatbot-function-plot__curve[data-curve='0']") - path["d"].scan(/M/i).length >= 2 + page.has_css?(".chatbot-function-plot__canvas .graph path.line-0", count: 2) end def move_over_2d_plot(relative_x:) page.driver.with_playwright_page do |browser_page| - canvas = browser_page.locator(".chatbot-function-plot__canvas[data-dimensions='2']").first + canvas = browser_page.locator(".chatbot-function-plot__canvas .zoom-and-drag").first canvas.scroll_into_view_if_needed box = canvas.bounding_box browser_page.mouse.move( @@ -64,16 +63,31 @@ def trace_point_positions all(".chatbot-function-plot__trace-point").map { |point| [point[:cx], point[:cy]] } end - def has_surface? - page.has_css?( - ".chatbot-function-plot__canvas[data-dimensions='3'] svg path[fill^='hsl']", - minimum: 100, - ) + def has_implicit_curve? + page.has_css?("[data-plot-type='implicit'] .graph path", minimum: 1) + end + + def has_scatter_points?(count:) + page.has_css?("[data-plot-type='points'] .graph circle", count: count) + end + + def has_vector_arrows?(count:) + page.has_css?("[data-plot-type='vector'] .graph path[marker-end^='url']", count: count) + end + + def has_finite_paths? + all(".chatbot-function-plot__canvas .graph path").all? do |path| + path[:d].present? && !path[:d].match?(/NaN|Infinity/) + end + end + + def has_no_visible_canvas? + page.has_no_css?(".chatbot-function-plot__canvas") end - def rotate_surface + def pan_plot page.driver.with_playwright_page do |browser_page| - canvas = browser_page.locator(".chatbot-function-plot__canvas[data-dimensions='3']") + canvas = browser_page.locator(".chatbot-function-plot__canvas .zoom-and-drag").first canvas.scroll_into_view_if_needed box = canvas.bounding_box browser_page.mouse.move(box["x"] + 200, box["y"] + 150) @@ -83,18 +97,13 @@ def rotate_surface end end - def surface_path - find( - ".chatbot-function-plot__canvas[data-dimensions='3'] svg path[fill^='hsl']", - match: :first, - )[ - "d" - ] + def curve_path + find(".chatbot-function-plot__canvas .graph path.line", match: :first)[:d] end - def zoom_surface(delta_y: -300) + def zoom_plot(delta_y: -300) page.driver.with_playwright_page do |browser_page| - canvas = browser_page.locator(".chatbot-function-plot__canvas[data-dimensions='3']") + canvas = browser_page.locator(".chatbot-function-plot__canvas .zoom-and-drag").first box = canvas.bounding_box browser_page.mouse.move(box["x"] + box["width"] / 2, box["y"] + box["height"] / 2) browser_page.mouse.wheel(0, delta_y) @@ -115,15 +124,6 @@ def scroll_outside_plot browser_page.mouse.wheel(0, 300) end end - - def has_changed_surface?(original_path) - path = - find( - ".chatbot-function-plot__canvas[data-dimensions='3'] svg path[fill^='hsl']", - match: :first, - ) - page.has_css?("path[id='#{path[:id]}']:not([d='#{original_path}'])") - end end end end diff --git a/spec/system/read_function_plots_spec.rb b/spec/system/read_function_plots_spec.rb index 76d187f0..da4970ed 100644 --- a/spec/system/read_function_plots_spec.rb +++ b/spec/system/read_function_plots_spec.rb @@ -108,33 +108,64 @@ expect(graphs).to have_no_error end - it "lets readers rotate and zoom a 3D surface without scrolling the page" do + it "renders the additional plot families locally" do + definitions = [ + { "plot_type" => "implicit", "expressions" => "x^2+y^2-4", "title" => "Circle" }, + { + "plot_type" => "parametric", + "expressions" => "cos(t); sin(t)", + "title" => "Parametric circle", + }, + { "plot_type" => "polar", "expressions" => "2*cos(3*theta)", "title" => "Rose" }, + { "plot_type" => "points", "expressions" => "0,1\n2,3\n3,2", "title" => "Scatter" }, + { + "plot_type" => "polyline", + "expressions" => "0,1\n2,3\n3,2", + "title" => "Connected points", + }, + { "plot_type" => "vector", "expressions" => "3,2\n1,1,-2,1", "title" => "Vectors" }, + ] + raw = definitions.map { |args| DiscourseChatbot::FunctionPlot.markdown(args) }.join("\n\n") + Fabricate(:post, topic: topic, raw: raw) + + topic_page.visit_topic(topic) + + expect(graphs).to have_rendered_graphs(count: 6) + expect(graphs).to have_implicit_curve + expect(graphs).to have_scatter_points(count: 3) + expect(graphs).to have_vector_arrows(count: 2) + expect(graphs).to have_no_error + expect(graphs).to have_finite_paths + end + + it "stops an expensive implicit definition with a useful fallback" do graph = - DiscourseChatbot::FunctionPlot.markdown( - "dimensions" => 3, - "expressions" => "sin(x)*cos(y)", - "title" => "A 3D wave", - "x_min" => -3, - "x_max" => 3, - "y_min" => -3, - "y_max" => 3, - "z_min" => -1.5, - "z_max" => 1.5, - ) + DiscourseChatbot::FunctionPlot.markdown("plot_type" => "implicit", "expressions" => "x-x+y-y") + Fabricate(:post, topic: topic, raw: graph) + + topic_page.visit_topic(topic) + + expect(graphs).to have_error + expect(graphs).to have_no_visible_canvas + expect(topic_page).to have_content(I18n.t("js.chatbot.function_plot.fallback")) + end + + it "lets readers pan and zoom a curve without scrolling the page" do + graph = DiscourseChatbot::FunctionPlot.markdown("expressions" => "sin(x)") Fabricate(:post, topic: topic, raw: graph + "\n\n" + ("More about the graph.\n\n" * 30)) topic_page.visit_topic(topic) - expect(graphs).to have_surface - original_path = graphs.surface_path - graphs.rotate_surface - expect(graphs).to have_changed_surface(original_path) - rotated_path = graphs.surface_path - graphs.zoom_surface - expect(graphs).to have_changed_surface(rotated_path) - zoomed_path = graphs.surface_path + expect(graphs).to have_rendered_graphs(count: 1) + original_path = graphs.curve_path + graphs.pan_plot + try_until_success { expect(graphs.curve_path).not_to eq(original_path) } + panned_path = graphs.curve_path + graphs.zoom_plot + try_until_success { expect(graphs.curve_path).not_to eq(panned_path) } + zoomed_path = graphs.curve_path scroll_position = graphs.page_scroll_position - graphs.zoom_surface(delta_y: 300) - expect(graphs).to have_changed_surface(zoomed_path) + graphs.zoom_plot(delta_y: 300) + try_until_success { expect(graphs.curve_path).not_to eq(zoomed_path) } expect(graphs.page_scroll_position).to eq(scroll_position) expect(graphs).to have_no_error graphs.scroll_outside_plot diff --git a/test/javascripts/unit/function-plot-expression-test.js b/test/javascripts/unit/function-plot-expression-test.js index 4c45261d..02b53a8f 100644 --- a/test/javascripts/unit/function-plot-expression-test.js +++ b/test/javascripts/unit/function-plot-expression-test.js @@ -58,10 +58,10 @@ module("Chatbot | function plot expressions", function () { title: "Two curves", }) ); - assert.strictEqual(graph.functions.length, 2); + assert.strictEqual(graph.series.length, 2); assert.deepEqual(graph.xDomain, [-7, 7]); assert.deepEqual(graph.yDomain, [-2, 2]); - assert.strictEqual(graph.functions[0].evaluate(0), 0); + assert.strictEqual(graph.series[0].evaluate(0), 0); [ { functions: [] }, { functions: ["x", "x", "x", "x", "x"] }, @@ -76,27 +76,64 @@ module("Chatbot | function plot expressions", function () { assert.throws(() => parseGraph("x".repeat(8193))); }); - test("supports two independent variables only for 3D surfaces", function (assert) { - const graph = parseGraph( - JSON.stringify({ - dimensions: 3, - functions: ["sin(x)*cos(y)", "x^2-y^2"], - z_domain: [-2, 2], - }) + test("uses the variables and data format for each selected family", function (assert) { + const parse = (value) => parseGraph(JSON.stringify(value)); + const implicit = parse({ plot_type: "implicit", functions: ["x^2+y^2-4"] }); + assert.strictEqual(implicit.series[0].evaluate(0, 2), 0); + const parametric = parse({ + plot_type: "parametric", + functions: [["cos(t)", "sin(t)"]], + }); + assert.strictEqual(parametric.series[0].evaluateX(0), 1); + assert.strictEqual(parametric.series[0].evaluateY(0), 0); + assert.deepEqual(parametric.parameterRange, [0, 2 * Math.PI]); + const polar = parse({ + plot_type: "polar", + functions: ["theta"], + parameter_range: [0, 8], + }); + assert.strictEqual(polar.series[0].evaluate(3), 3); + assert.deepEqual(polar.parameterRange, [0, 8]); + for (const plot_type of ["points", "polyline"]) { + assert.deepEqual( + parse({ + plot_type, + points: [ + [1, 2], + [3, 4], + ], + }).series[0].points, + [ + [1, 2], + [3, 4], + ] + ); + } + assert.deepEqual( + parse({ plot_type: "vector", vectors: [[1, 2, 3, 4]] }).series[0].vector, + [1, 2, 3, 4] + ); + assert.strictEqual( + parse({ dimensions: 2, functions: ["x"] }).plotType, + "function" ); - assert.strictEqual(graph.dimensions, 3); - assert.deepEqual(graph.zDomain, [-2, 2]); - assert.strictEqual(graph.functions[0].evaluate(Math.PI / 2, 0), 1); - assert.strictEqual(graph.functions[1].evaluate(3, 2), 5); - assert.throws(() => compileExpression("y")); [ { functions: ["y"] }, - { functions: ["x"], dimensions: 4 }, + { functions: ["x"], dimensions: 3 }, { functions: ["x"], z_domain: [-1, 1] }, - { functions: ["x"], dimensions: 3, z_domain: [2, 1] }, - { functions: ["x", "y", "x+y"], dimensions: 3 }, + { functions: ["x"], parameter_range: [0, 1] }, + { plot_type: "polar", functions: ["x"] }, + { plot_type: "parametric", functions: [["t", "y"]] }, + { plot_type: "parametric", functions: ["cos(t);sin(t)"] }, + { plot_type: "implicit", functions: ["x", "y", "x+y"] }, + { plot_type: "points", points: [[1, null]] }, + { plot_type: "points", points: Array(151).fill([0, 1]) }, + { plot_type: "polyline", points: [[1, "2"]] }, + { plot_type: "vector", vectors: [[1, 2]] }, + { plot_type: "polar", functions: ["theta"], parameter_range: [1, 0] }, + { plot_type: "points", points: [[0, 0]], functions: ["x"] }, ].forEach((value) => - assert.throws(() => parseGraph(JSON.stringify(value))) + assert.throws(() => parse(value), undefined, JSON.stringify(value)) ); }); }); diff --git a/test/javascripts/unit/function-plot-renderer-test.js b/test/javascripts/unit/function-plot-renderer-test.js new file mode 100644 index 00000000..6ea3b2aa --- /dev/null +++ b/test/javascripts/unit/function-plot-renderer-test.js @@ -0,0 +1,73 @@ +import { module, test } from "qunit"; +import loadScript from "discourse/lib/load-script"; +import { splitUndefinedSegments } from "discourse/plugins/discourse-chatbot/discourse/lib/function-plot-expression"; +import { compileIntervalExpression } from "discourse/plugins/discourse-chatbot/discourse/lib/function-plot-renderer"; + +module("Chatbot | function plot renderer", function () { + test("evaluates implicit expressions with conservative intervals without code generation", async function (assert) { + await loadScript( + "/plugins/discourse-chatbot/function-plot/1.26.0/function-plot.js" + ); + const interval = window.functionPlot.intervalMath; + const factory = interval.factory; + const cases = [ + ["x^2+y^2-4", factory(-1, 1), factory(1, 2), [-3, 1]], + ["sin(x)+cos(y)", factory(0, Math.PI / 2), factory(0), [1, 2]], + ["cbrt(x)-y", factory(-8, 8), factory(0), [-2, 2]], + ["floor(x)+ceil(y)", factory(1.1, 1.9), factory(1.1, 1.9), [3, 3]], + ["x^0.5", factory(1, 4), factory(0), [1, 2]], + ["x^y", factory(-2, 2), factory(1, 2), [-4, 4]], + ["log10(x)", factory(1, 100), factory(0), [0, 2]], + ]; + for (const [expression, x, y, expected] of cases) { + const actual = compileIntervalExpression(expression, interval)(x, y); + assert.true( + actual.lo <= expected[0] + 1e-12, + `${expression}: lower bound` + ); + assert.true( + actual.hi >= expected[1] - 1e-12, + `${expression}: upper bound` + ); + } + assert.throws(() => compileIntervalExpression("window.alert(1)", interval)); + }); + + test("keeps undefined curve domains and trajectory samples as separate segments", function (assert) { + assert.deepEqual( + splitUndefinedSegments( + [ + [ + [0, 2], + [1, 1], + [3, 1], + [4, 2], + ], + ], + (x) => Math.sqrt((x - 1) * (x - 3)), + 1 + ), + [ + [ + [0, 2], + [1, 1], + ], + [ + [3, 1], + [4, 2], + ], + ] + ); + assert.deepEqual( + splitUndefinedSegments([ + [ + [0, 0], + [NaN, 1], + [2, 2], + ], + ]), + [[[0, 0]], [[2, 2]]] + ); + assert.deepEqual(splitUndefinedSegments([[undefined]]), []); + }); +}); From 63ceb8eb5c05cedcc18bfe3bb42928b7c57d0495 Mon Sep 17 00:00:00 2001 From: merefield Date: Mon, 26 Oct 2026 21:52:03 +0000 Subject: [PATCH 7/8] Fix direct interval dependency in graph vendor lockfile --- public/function-plot/build/pnpm-lock.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/public/function-plot/build/pnpm-lock.yaml b/public/function-plot/build/pnpm-lock.yaml index 67cb2f26..1d71ab19 100644 --- a/public/function-plot/build/pnpm-lock.yaml +++ b/public/function-plot/build/pnpm-lock.yaml @@ -14,6 +14,9 @@ importers: function-plot: specifier: 1.26.0 version: 1.26.0 + interval-arithmetic-eval: + specifier: 0.5.3 + version: 0.5.3 packages: From 1a2417a5af2f883286f80e7568315644ccd5da4f Mon Sep 17 00:00:00 2001 From: merefield Date: Mon, 26 Oct 2026 21:55:36 +0000 Subject: [PATCH 8/8] Bump plugin minor version to 3.2.0 --- plugin.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.rb b/plugin.rb index adc17560..3520cc2f 100644 --- a/plugin.rb +++ b/plugin.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true # name: discourse-chatbot # about: a plugin that allows you to have a conversation with a configurable chatbot in Chat, Topics and Private Messages -# version: 3.1.9 +# version: 3.2.0 # authors: merefield # url: https://github.com/merefield/discourse-chatbot