pimath 0.0.22 → 0.0.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/pi.js CHANGED
@@ -1,2 +1,2 @@
1
- (()=>{"use strict";var e={760:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Equation=void 0;const n=i(38),r=i(956),o=i(534),s=i(534);class a{_left;_right;_sign;_polynom;_solutions;_varnothing="\\varnothing";_real="\\mathbb{R}";constructor(...e){if(this._left=(new n.Polynom).zero(),this._right=(new n.Polynom).zero(),this._sign="=",1===e.length){if(!0===e[0].isEquation)return e[0].clone();this.parse(e[0])}else{if(2!==e.length)return this;this.left=e[0]instanceof n.Polynom?e[0].clone():new n.Polynom(e[0]),this.right=e[1]instanceof n.Polynom?e[1].clone():new n.Polynom(e[1])}return this}get isEquation(){return!0}get solutions(){return this._solutions}get solution(){return 1!==this._solutions.length||this._solutions[0]!==this._real&&this._solutions[0]!==this._varnothing&&!this._solutions[0].includes("\\left")?`S = \\left{ ${this._solutions.join(";")} \\right}`:`S = ${this._solutions[0]}`}get isReal(){return void 0===this._solutions&&this.solve(),this._solutions[0]===this._real}get isVarnothing(){return void 0===this._solutions&&this.solve(),this._solutions[0]===this._varnothing}get signAsTex(){return">="===this._sign||"=>"===this._sign||"geq"===this._sign?"\\geq":"<="===this._sign||"=<"===this._sign||"leq"===this._sign?"\\leq":this._sign}get tex(){return`${this._left.tex}${this.signAsTex}${this._right.tex}`}get display(){return`${this._left.display}${this.signAsTex}${this._right.display}`}get raw(){return`${this._left.raw}${this.signAsTex}${this._right.raw}`}get variables(){return[...new Set(this._right.variables.concat(this._left.variables))]}get numberOfVars(){return this.variables.length}get left(){return this._left}set left(e){this._left=e}get right(){return this._right}set right(e){this._right=e}get sign(){return this._sign}set sign(e){this._sign=this._formatSign(e)}parse=e=>{let t,i;if(i=this._findSign(e),!1!==i)return t=e.split(i),this.create(new n.Polynom(t[0]),new n.Polynom(t[1]),this._formatSign(i));console.log("The equation is not valid (no sign found)")};_findSign=e=>e.includes("geq")?e.includes("\\geq")?"\\geq":"geq":e.includes("leq")?e.includes("\\leq")?"\\leq":"leq":e.includes(">=")?">=":e.includes("=>")?"=>":e.includes(">")?">":e.includes("<=")?"<=":e.includes("=<")?"=<":e.includes("<")?"<":e.includes("=")?"=":(console.log("Equation: parse string : sign not found"),!1);_formatSign=e=>void 0===e?"=":e.includes("geq")||e.includes(">=")||e.includes("=>")?">=":e.includes(">")?">":e.includes("leq")||e.includes("<=")||e.includes("=<")?"<=":e.includes("<")?"<":"=";_reverseSign=()=>"="===this._sign?this:this._sign.includes("<")?(this._sign.replace("<",">"),this):this._sign.includes(">")?(this._sign.replace(">","<"),this):this;create=(e,t,i)=>(this._left=e,this._right=t,this._sign=this._formatSign(i),this);clone=()=>(new a).create(this._left.clone(),this._right.clone(),this._sign+"");_randomizeDefaults={degree:2};get randomizeDefaults(){return this._randomizeDefaults}set randomizeDefaults(e){this._randomizeDefaults=e}randomize=(e,t)=>(new a).create(new n.Polynom,new n.Polynom,t);moveLeft=()=>(this._left=this._left.clone().subtract(this._right),this._right.zero(),this);reorder=e=>{if(this._left.subtract(this._right),this._right.zero(),e)return this.moveLeft();let t;for(let e of this._left.monoms)e.degree().isZero()&&(t=e.clone(),this._left.subtract(t),this._right.subtract(t));return this._left.reorder(),this._right.reorder(),this};simplify=()=>(this.multiply(r.Numeric.lcm(...this._left.getDenominators(),...this._right.getDenominators())),this.divide(r.Numeric.gcd(...this._left.getNumerators(),...this._right.getNumerators())),this);isolate=e=>{if(!this.degree(e).isOne())return!1;if(this.isMultiVariable())return!1;let t,i;this._left.subtract(this._right),this._right.zero();for(let i of this._left.monoms)i.hasLetter(e)||(t=i.clone(),this._left.add(t.clone().opposed()),this._right.add(t.clone().opposed()));return 1===this._left.length&&(i=this._left.monoms[0].coefficient.clone(),this._left.divide(i),this._right.divide(i),this)};replaceBy=(e,t)=>(this._left.replaceBy(e,t),this._right.replaceBy(e,t),this);multiply=e=>{let t=new o.Fraction(e);return this._left.multiply(t),this._right.multiply(t),"="!==this._sign&&-1===t.sign()&&this._reverseSign(),this};divide=e=>{let t=new o.Fraction(e);return t.isZero()?this:this.multiply(t.invert())};degree=e=>o.Fraction.max(this._left.degree(e),this._right.degree(e));isMultiVariable=()=>this._left.isMultiVariable||this._right.isMultiVariable;letters=()=>[...new Set([...this._left.letters(),...this._right.letters()])];solve=e=>{switch(this._solutions=[],this._polynom=this._left.clone().subtract(this._right),this._polynom.degree(e).value){case 0:case 1:this._solveDegree1(e);break;case 2:this._solveDegree2(e);break;default:this._solveDegree3plus(e)}return this};isGreater=()=>-1!==this._sign.indexOf(">")||-1!==this._sign.indexOf("geq");isStrictEqual=()=>"="===this._sign;isAlsoEqual=()=>-1!==this._sign.indexOf("=")||-1!==this._sign.indexOf("geq")||-1!==this._sign.indexOf("leq")||void 0;_solveDegree1=e=>{const t=this._polynom.monomByDegree(1,e).coefficient,i=this._polynom.monomByDegree(0,e).coefficient,n=i.clone().opposed().divide(t).display;let r;return this.isStrictEqual()?0===t.value?0===i.value?this._solutions=[this._real]:this._solutions=[this._varnothing]:this._solutions=[n]:(r=0===t.value?0===i.value&&this.isAlsoEqual()?"\\mathbb{R}":i.value>0?this.isGreater()?this._real:this._varnothing:this.isGreater()?this._varnothing:this._real:this.isGreater()&&1===t.sign()||!this.isGreater()&&-1===t.sign()?`\\left${this.isAlsoEqual()?"\\[":"\\]"}${n};+\\infty\\right\\[`:`\\left\\]-\\infty;${n} \\right\\${this.isAlsoEqual()?"\\]":"\\["}`,this._solutions=[r]),this._solutions};_solveDegree2=e=>{let t,i,n,a,l,h,c=this._polynom.monomByDegree(2,e).coefficient,u=this._polynom.monomByDegree(1,e).coefficient,f=this._polynom.monomByDegree(0,e).coefficient,m=r.Numeric.lcm(c.denominator,u.denominator,f.denominator),d=c.multiply(m).value,_=u.multiply(m).value;if(t=_*_-4*d*f.multiply(m).value,t>0)if(n=(-_-Math.sqrt(t))/(2*d),a=(-_+Math.sqrt(t))/(2*d),t>1e5)this._solutions=[((-_-Math.sqrt(t))/(2*d)).toFixed(5),((-_+Math.sqrt(t))/(2*d)).toFixed(5)];else if(i=(new s.Nthroot).parse(t).reduce(),i.hasRadical()){let e=r.Numeric.gcd(_,2*d,i.coefficient);i.coefficient=i.coefficient/e,this._solutions=0!==_?2*d/e==1?[`${-_/e} - ${i.tex}`,`${-_/e} + ${i.tex}`]:[`\\dfrac{${-_/e} - ${i.tex} }{ ${2*d/e} }`,`\\dfrac{${-_/e} + ${i.tex} }{ ${2*d/e} }`]:2*d/e==1?[`- ${i.tex}`,`${i.tex}`]:[`\\dfrac{- ${i.tex} }{ ${2*d/e} }`,`\\dfrac{${i.tex} }{ ${2*d/e} }`]}else this._solutions=[new o.Fraction(-_-i.coefficient,2*d).reduce().dfrac,new o.Fraction(-_+i.coefficient,2*d).reduce().dfrac];else this._solutions=0===t?[new o.Fraction(-_,2*d).reduce().dfrac]:[this._varnothing];return this.isStrictEqual()||(2===this._solutions.length?(l=n<a?this._solutions[0]:this._solutions[1],h=n<a?this._solutions[1]:this._solutions[0],this.isGreater()&&1===c.sign()||!this.isGreater()&&-1===c.sign()?this._solutions=[`\\left]-\\infty ; ${l}\\right${this.isAlsoEqual()?"]":"["} \\cup \\left${this.isAlsoEqual()?"[":"]"}${h};+\\infty\\right[`]:this._solutions=[`\\left${this.isAlsoEqual()?"[":"]"}${l} ; ${h}\\right${this.isAlsoEqual()?"]":"["}`]):1===this._solutions.length&&this._solutions[0]!==this._varnothing?this.isAlsoEqual()?(this.isGreater()&&1===c.sign()||!this.isGreater()&&-1===c.sign())&&(this._solutions=[this._real]):this.isGreater()&&1===c.sign()||!this.isGreater()&&-1===c.sign()?this._solutions=[`\\left]-\\infty ; ${this._solutions[0]}\\right[ \\cup \\left]${this._solutions[0]};+\\infty\\right[`]:this._solutions=[this._varnothing]:this.isGreater()?this._solutions=[1===c.sign()?this._real:this._varnothing]:this._solutions=[-1===c.sign()?this._real:this._varnothing]),this._solutions};_solveDegree3plus=e=>(this._solutions=[e],this._solutions)}t.Equation=a},667:function(e,t,i){var n=this&&this.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[i]}})}:function(e,t,i,n){void 0===n&&(n=i),e[n]=t[i]}),r=this&&this.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||n(t,e,i)};Object.defineProperty(t,"__esModule",{value:!0}),r(i(760),t),r(i(554),t),r(i(236),t),r(i(937),t),r(i(38),t),r(i(107),t)},554:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinearSystem=void 0;const n=i(534),r=i(760),o=i(38),s=i(984);class a{_solutions;_resolutionSteps;_equations;_letters;constructor(...e){return this._equations=[],this._letters="xy".split(""),void 0!==e&&e.length>0&&this.parse(...e),this}get isLinearSystem(){return!0}get equations(){return this._equations}set equations(e){this._equations=e}get letters(){return this._letters.join("")}set letters(e){this._letters=e.split("")}get isSolvable(){return this.variables.length===this._equations.length}get variables(){let e=[];for(let t of this._equations)e=e.concat(t.variables);return[...new Set(e)].sort()}get tex(){let e,t,i=this.clone().reorder(),n=i.variables,r=[];for(let o of i.equations){e=[];for(let i of n)t=o.left.monomByLetter(i),0===e.length?e.push(t.isZero()?"":t.tex):e.push(t.isZero()?"":(1===t.coefficient.sign()?"+":"")+t.tex);e.push("="),e.push(o.right.tex),r.push(e.join("&"))}return`\\left\\{\\begin{array}{${"r".repeat(n.length)}cl}${r.join("\\\\ ")}\\end{array}\\right.`}get texSolution(){let e=[];void 0===this._solutions&&this.solve();for(let t in this._solutions){if(this._solutions[t].isReal)return void console.log(`Undetermined (letter ${t})`);if(this._solutions[t].isVarnothing)return void console.log(`Undefined (letter ${t})`);e.push(this._solutions[t].value.dfrac)}return`(${e.join(";")})`}parse=(...e)=>(this._equations=e.map((e=>new r.Equation(e))),this._findLetters(),this);setCoefficient=(...e)=>{this._equations=[];let t=0;for(;t<e.length-this._letters.length;){let i=(new o.Polynom).parse(this._letters.join(""),...e.slice(t,t+this._letters.length)),n=new o.Polynom(e[t+this._letters.length].toString()),s=(new r.Equation).create(i,n);this._equations.push(s.clone()),t=t+this._letters.length+1}return this};clone=()=>(new a).parse(...this._equations.map((e=>e.clone())));setLetters=(...e)=>(this._letters=e,this);_findLetters=()=>{let e=new Set;for(let t of this._equations)e=new Set([...e,...t.variables]);return this._letters=[...e],this};generate=(...e)=>{let t=[];for(let i of e)"number"==typeof i?t.push(new n.Fraction(i.toString())):t.push(i.clone());this._equations=[];for(let i=0;i<e.length;i++)this._equations.push(this._generateOneEquation(...t));return this};_generateOneEquation=(...e)=>{let t,i=[],o=(new n.Fraction).zero(),a=["x","y","z","t","u","v","w","a","b","c","d","e","f","g","h","i","j","k","l"],l="";for(let t=0;t<e.length;t++)i.push(s.Random.numberSym(5)),o.add(e[t].clone().multiply(i[t])),l+=`${i[t]<0?i[t]:"+"+i[t]}${a[t]}`;return t=new r.Equation(`${l}=${o.display}`),1!=t.right.monoms[0].coefficient.denominator&&t.multiply(new n.Fraction(t.right.monoms[0].coefficient.denominator,1)),this._checkIfLinerCombination(t)?t:this._generateOneEquation(...e)};_linearReduction(e,t,i){let n=e.left.monomByDegree(1,i).coefficient.clone(),r=t.left.monomByDegree(1,i).coefficient.clone().opposed();return this.mergeEquations(e,t,r,n)}mergeEquations=(e,t,i,r)=>{let o=e.clone().multiply(new n.Fraction(i)),s=t.clone().multiply(new n.Fraction(r));return o.left.add(s.left),o.right.add(s.right),o};reorder=()=>{for(let e of this._equations)e.reorder();return this};solve=()=>{this._solutions={},this._resolutionSteps=[],this.reorder();let e=this.variables.sort();for(let t of e)this._solutions[t]=this._solveOneLetter(t,e);return this};_checkIfLinerCombination=e=>!0;_solveOneLetter(e,t){let i=this.clone().equations,r=[];for(let n of t)if(n!==e){for(let e=0;e<i.length-1;e++)r.push(this._linearReduction(i[e],i[e+1],n));this._resolutionSteps.push((new a).parse(...r)),i=this._resolutionSteps[this._resolutionSteps.length-1].clone().equations,r=[]}let o=this._resolutionSteps[this._resolutionSteps.length-1].equations[0];return o.solve(),{value:new n.Fraction(o.solutions[0]),isReal:o.isReal,isVarnothing:o.isVarnothing}}log=()=>{let e="";for(let t of this._equations)console.log(t.tex),e+=`${t.tex}\\n}`;return e}}t.LinearSystem=a},236:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Logicalset=void 0;const n=i(505);t.Logicalset=class{_rawString;_rpn;constructor(e){return this._rawString=e,this.parse(e),this}get isLogicalset(){return!0}parse=e=>(this._rpn=new n.Shutingyard("set").parse(e).rpn,this);evaluate(e,t){let i,n=[];if(void 0===t){i=new Set;for(let t in e)i=new Set([...i,...e[t]])}else i=new Set(t);for(let t of this._rpn)if("variable"===t.tokenType)void 0===e[t.token]?n.push(new Set):n.push(new Set(e[t.token]));else switch(t.token){case"&":if(n.length>=2){let e=n.pop(),t=n.pop();n.push(new Set([...t].filter((t=>e.has(t)))))}break;case"|":if(n.length>=2){let e=n.pop(),t=n.pop();n.push(new Set([...t,...e]))}break;case"-":if(n.length>=2){let e=n.pop(),t=n.pop();n.push(new Set([...t].filter((t=>!e.has(t)))))}break;case"!":if(n.length>=1){let e=n.pop();n.push(new Set([...i].filter((t=>!e.has(t)))))}}return[...n[0]].sort()}vennAB(){return this.evaluate({A:["A","AB"],B:["B","AB"]},["A","B","AB","E"])}vennABC(){return this.evaluate({A:["A","AB","AC","ABC"],B:["B","AB","BC","ABC"],C:["C","AC","BC","ABC"]},["A","B","C","AB","AC","BC","E"])}get rpn(){return this._rpn}get tex(){let e=[];for(let t of this._rpn)if("variable"===t.tokenType)e.push(t);else switch(t.token){case"&":if(e.length>=2){let t=e.pop(),i=e.pop();"mix"===i.tokenType&&(i.token=`( ${i.token} )`),"mix"===t.tokenType&&(t.token=`( ${t.token} )`),e.push({token:`${i.token} \\cap ${t.token}`,tokenType:"mix"})}break;case"|":if(e.length>=2){let t=e.pop(),i=e.pop();"mix"===i.tokenType&&(i.token=`( ${i.token} )`),"mix"===t.tokenType&&(t.token=`( ${t.token} )`),e.push({token:`${i.token} \\cup ${t.token}`,tokenType:"mix"})}break;case"-":if(e.length>=2){let t=e.pop(),i=e.pop();"mix"===i.tokenType&&(i.token=`( ${i.token} )`),"mix"===t.tokenType&&(t.token=`( ${t.token} )`),e.push({token:`${i.token} \\setminus ${t.token}`,tokenType:"mix"})}break;case"!":if(e.length>=1){let t=e.pop();e.push({token:`\\overline{ ${t.token} }`,tokenType:"variable"})}}return e[0].token}}},937:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Monom=void 0;const n=i(534),r=i(956),o=i(505);class s{_coefficient;_literal;constructor(e){return this.zero(),void 0!==e&&this.parse(e),this}get coefficient(){return this._coefficient}set coefficient(e){this._coefficient=e}get literal(){return this._literal}get literalSqrt(){if(this.isLiteralSquare()){let e={};for(let t in this._literal)e[t]=this._literal[t].clone().sqrt();return e}return this._literal}set literal(e){this._literal=e}set literalStr(e){for(const t of[...e.matchAll(/([a-z])\^([+-]?[0-9]+)/g)])t[1]in this._literal||(this._literal[t[1]]=(new n.Fraction).zero()),this._literal[t[1]].add(+t[2]);for(const t of[...e.matchAll(/([a-z](?!\^))/g)])t[1]in this._literal||(this._literal[t[1]]=(new n.Fraction).zero()),this._literal[t[1]].add(1)}get variables(){return this.clone().clean(),Object.keys(this._literal)}get display(){let e="",t=Object.keys(this._literal).sort();for(let i of t)this._literal[i].isNotZero()&&(e+=`${i}`,this._literal[i].isNotEqual(1)&&(e+=`^${this._literal[i].display}`));return""===e?0!=this._coefficient.value?`${this._coefficient.display}`:"":1===this._coefficient.value?e:-1===this._coefficient.value?`-${e}`:0===this._coefficient.value?"0":`${this._coefficient.display}${e}`}get dividers(){if(1!==this.coefficient.denominator)return[this.clone()];if(this.hasFractionCoefficient)return[this.clone()];if(this.coefficient.numerator>1e4)return[this.clone()];const e=r.Numeric.dividers(Math.abs(this.coefficient.numerator));let t=[];for(let e in this.literal)t=this._getLiteralDividers(t,e);const i=[];if(t.length>0&&e.length>0)for(let r of e)for(let e of t){let t=new s;t.coefficient=new n.Fraction(r),t.literal=e,i.push(t)}else if(0===e.length)for(let e of t){let t=new s;t.coefficient=(new n.Fraction).one(),t.literal=e,i.push(t)}else for(let t of e){let e=new s;e.coefficient=new n.Fraction(t),i.push(e)}return 0===i.length?[(new s).one()]:i}_getLiteralDividers(e,t){let i=[];for(let r=0;r<=this.literal[t].value;r++)if(0===e.length){let e={};e[t]=new n.Fraction(r),i.push(e)}else for(let o of e){let e={};for(let t in o)e[t]=o[t];e[t]=new n.Fraction(r),i.push(e)}return i}get displayWithSign(){let e=this.display;return("-"!==e[0]?"+":"")+e}get tex(){let e="",t=Object.keys(this._literal).sort();for(let i of t)this._literal[i].isNotZero()&&(e+=`${i}`,this._literal[i].isNotEqual(1)&&(e+=`^{${this._literal[i].display}}`));return""===e?0!=this._coefficient.value?`${this._coefficient.dfrac}`:"0":1===this._coefficient.value?e:-1===this._coefficient.value?`-${e}`:0===this._coefficient.value?"0":`${this._coefficient.dfrac}${e}`}parse=e=>(this._shutingYardToReducedMonom(e),this);_shutingYardToReducedMonom=e=>{const t=(new o.Shutingyard).parse(e).rpn;let i,r,a,l,h,c=[];if(0===t.length)return this.zero(),this;if(1===t.length){const e=t[0];return this.one(),"coefficient"===e.tokenType?this.coefficient=new n.Fraction(e.token):"variable"===e.tokenType&&this.setLetter(e.token,1),this}for(const e of t)if("coefficient"===e.tokenType){let t=(new s).one();t.coefficient=new n.Fraction(e.token),c.push(t.clone())}else if("variable"===e.tokenType){let t=(new s).one();t.setLetter(e.token,1),c.push(t.clone())}else if("operation"===e.tokenType)switch(e.token){case"-":h=c.pop()||(new s).zero(),l=c.pop()||(new s).zero(),c.push(l.subtract(h));break;case"*":h=c.pop()||(new s).one(),l=c.pop()||(new s).one(),c.push(l.multiply(h));break;case"^":r=c.pop().coefficient||(new n.Fraction).one(),i=c.pop()||(new s).one(),a=i.variables[0],void 0!==a&&i.setLetter(a,r),c.push(i)}return this.one(),this.multiply(c[0]),this};clone=()=>{let e=new s;e.coefficient=this._coefficient.clone();for(let t in this._literal)e.setLetter(t,this._literal[t].clone());return e};makeSame=e=>{for(let t in e._literal)this.setLetter(t,e._literal[t].clone());return this};zero=()=>(this._coefficient=(new n.Fraction).zero(),this._literal={},this);one=()=>(this._coefficient=(new n.Fraction).one(),this._literal={},this);clean=()=>{for(let e in this._literal)this._literal[e].isZero()&&delete this._literal[e];return this};opposed=()=>(this._coefficient.opposed(),this);add=(...e)=>{for(let t of e)this.isSameAs(t)?(this.isZero()&&this.makeSame(t),this._coefficient.add(t.coefficient)):console.log("Add: Is not similar: ",t.display);return this};subtract=(...e)=>{for(let t of e)this.isSameAs(t)?(this.isZero()&&this.makeSame(t),this._coefficient.add(t.clone().coefficient.opposed())):console.log("Subtract: Is not similar: ",t.display);return this};multiply=(...e)=>{for(let t of e){this._coefficient.multiply(t.coefficient);for(let e in t.literal)void 0===this._literal[e]?this._literal[e]=t.literal[e].clone():this._literal[e].add(t.literal[e])}return this};multiplyByNumber=e=>(this._coefficient.multiply(e),this);divide=(...e)=>{for(let t of e){this._coefficient.divide(t.coefficient);for(let e in t.literal)this._literal[e]=void 0===this._literal[e]?t.literal[e].clone().opposed():this._literal[e].subtract(t.literal[e]),this._literal[e].isZero()&&delete this._literal[e]}return this};pow=e=>{this._coefficient.pow(e);for(let t in this._literal)this._literal[t].pow(e);return this};root=e=>this;sqrt=()=>{if(this.isSquare()){this._coefficient.sqrt();for(let e in this._literal)this._literal[e].clone().divide(2)}return this.root(2)};compare=(e,t)=>{switch(void 0===t&&(t="="),t){case"=":return!!this.compare(e,"same")&&this._coefficient.isEqual(e.coefficient);case"same":let t=this.variables,i=e.variables,n=t.concat(i.filter((e=>t.indexOf(e)<0)));if(!this.isZero()&&!e.isZero())for(let t of n){if(void 0===this._literal[t]||void 0===e.literal[t])return!1;if(!this._literal[t].isEqual(e.literal[t]))return!1}return!0;default:return!1}};isZero(){return 0===this._coefficient.value}isOne(){return 1===this._coefficient.value&&0===this.variables.length}isEqual=e=>this.compare(e,"=");isSameAs=e=>this.compare(e,"same");isSquare=()=>!!this.coefficient.isSquare()&&this.isLiteralSquare();isLiteralSquare=()=>{for(let e in this.literal){if(this.literal[e].isRational())return!1;if(this.literal[e].isEven())return!1}return!0};hasFractionCoefficient=()=>{for(let e in this._literal)if(this._literal[e].isRational())return!0;return!1};hasLetter=e=>void 0!==this._literal[void 0===e?"x":e]&&this._literal[void 0===e?"x":e].isNotZero();setLetter=(e,t)=>{t instanceof n.Fraction?(this.hasLetter(e)&&t.isZero()&&delete this._literal[e],this._literal[e]=t.clone()):this.setLetter(e,new n.Fraction(t))};degree=e=>0===this.variables.length?(new n.Fraction).zero():void 0===e?Object.values(this._literal).reduce(((e,t)=>e.clone().add(t))):void 0===this._literal[e]?(new n.Fraction).zero():this._literal[e].clone();evaluate=e=>{let t=this.coefficient.clone();if("number"==typeof e||e instanceof n.Fraction){let t={};return t[this.variables[0]]=new n.Fraction(e),this.evaluate(t)}if("object"==typeof e)for(let i in this._literal){if(void 0===e[i])return(new n.Fraction).zero();let r=new n.Fraction(e[i]);t.multiply(r.pow(this._literal[i]))}return t};derivative=e=>{if(void 0===e&&(e="x"),this.hasLetter(e)){let t=this._literal[e].clone(),i=this.clone();return i._literal[e].subtract(1),i._coefficient.multiply(new n.Fraction(t.clone())),i}return(new s).zero()};primitive=e=>{void 0===e&&(e="x");let t,i=this.clone();return i.hasLetter(e)?(t=i.degree(e).clone().add(1),i.coefficient=i.coefficient.clone().divide(t),i.setLetter(e,t)):(i.coefficient.isZero()&&(i.coefficient=(new n.Fraction).one()),i.setLetter(e,1)),i};static lcm=(...e)=>{for(let t of e)if(t.hasFractionCoefficient())return(new s).zero();let t=new s,i=e.map((e=>e.coefficient.numerator)),o=e.map((e=>e.coefficient.denominator)),a=r.Numeric.gcd(...i),l=r.Numeric.lcm(...o);t.coefficient=new n.Fraction(a,l).reduce();for(let i of e){for(let e in t.literal)e in i.literal||t.literal[e].zero();for(let e in i.literal)void 0===t.literal[e]&&i.literal[e].isStrictlyPositive()?t.literal[e]=i.literal[e].clone():t.literal[e]=new n.Fraction(Math.min(i.literal[e].value,t.literal[e].value))}return t};static xmultiply=(...e)=>{let t=(new s).one();for(let i of e)t.multiply(i);return t};areSameAs=(...e)=>{for(let t=0;t<e.length;t++)if(!this.isSameAs(e[t]))return!1;return!0};areEquals=(...e)=>{if(!this.areSameAs(...e))return!1;for(let t of e)if(!this._coefficient.isEqual(t.coefficient))return!1;return!0}}t.Monom=s},38:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Polynom=void 0;const n=i(937),r=i(505),o=i(956),s=i(534);class a{_rawString;_monoms;_factors;_texString;constructor(e,...t){return this._monoms=[],this._factors=[],void 0!==e&&this.parse(e,...t),this}get monoms(){return this._monoms}set monoms(e){this._monoms=e}get factors(){return this._factors}set factors(e){this._factors=e}get texFactors(){this.factorize();let e="";for(let t of this.factors)t.monoms.length>1?e+=`(${t.tex})`:e=t.tex+e;return e}get texString(){return this._texString}get length(){return this._monoms.length}get display(){return this.genDisplay()}get raw(){return this._rawString}get tex(){return this.genDisplay("tex")}get isMultiVariable(){for(const e of this._monoms)if(e.variables.length>1)return!0;return!1}get variables(){let e=[];for(const t of this._monoms)e=e.concat(t.variables);return e=[...new Set(e)],e}get numberOfVars(){return this.variables.length}genDisplay=(e,t,i)=>{let n="";for(const i of this._monoms)0!==i.coefficient.value&&(n+=`${1!==i.coefficient.sign()||""===n&&!0!==t?"":"+"}${"tex"===e?i.tex:i.display}`);return!0===i&&this.length>1&&(n="tex"===e?`\\left( ${n} \\right)`:`(${n})`),""===n&&(n="0"),n};parse=(e,...t)=>{if(void 0===t||0===t.length){if(e=""+e,this._rawString=e,""!==e&&!isNaN(Number(e))){this.empty();let t=new n.Monom(e);return this.add(t),this}return this.shutingYardToReducedPolynom(e)}if(/^[a-z]/.test(e)){this.empty();let i=t.map((e=>new s.Fraction(e)));if(e.length>1){let t=e.split(""),r=0;for(let e of i){let i=new n.Monom;i.coefficient=e.clone(),i.literalStr=t[r]||"",this.add(i),r++}}else{let t=i.length-1;for(let r of i){let i=new n.Monom;i.coefficient=r.clone(),i.literalStr=`${e}^${t}`,this.add(i),t--}}return this}return this.zero()};shutingYardToReducedPolynom=e=>{const t=(new r.Shutingyard).parse(e).rpn;let i,o,s,l=[],h=null;for(const e of t){if("coefficient"===e.tokenType||"variable"===e.tokenType)s=(new a).zero(),s.monoms=[new n.Monom(e.token)],l.push(s.clone());else if("operation"===e.tokenType)switch(o=l.pop()||(new a).zero(),i=l.pop()||(new a).zero(),e.token){case"+":l.push(i.add(o));break;case"-":l.push(i.subtract(o));break;case"*":l.push(i.multiply(o));break;case"^":l.push(i.pow(+h))}h=e.token}return this._monoms=l[0].monoms,this};clone=()=>{const e=new a,t=[];for(const e of this._monoms)t.push(e.clone());return e.monoms=t,e};zero=()=>(this._monoms=[],this._monoms.push((new n.Monom).zero()),this._rawString="0",this);one=()=>(this._monoms=[],this._monoms.push((new n.Monom).one()),this._rawString="1",this);empty=()=>(this._monoms=[],this._rawString="",this);opposed=()=>(this._monoms=this._monoms.map((e=>e.opposed())),this);add=(...e)=>{for(let t of e)t instanceof a?this._monoms=this._monoms.concat(t.monoms):t instanceof n.Monom?this._monoms.push(t.clone()):Number.isSafeInteger(t)?this._monoms.push(new n.Monom(t.toString())):this._monoms.push(new n.Monom(t));return this.reduce()};subtract=(...e)=>{for(let t of e)t instanceof a?this._monoms=this._monoms.concat(t.clone().opposed().monoms):t instanceof n.Monom?this._monoms.push(t.clone().opposed()):Number.isSafeInteger(t)?this._monoms.push(new n.Monom(t.toString()).opposed()):this._monoms.push(new n.Monom(t).opposed());return this.reduce()};multiply=e=>e instanceof a?this.multiplyByPolynom(e):e instanceof s.Fraction?this.multiplyByFraction(e):e instanceof n.Monom?this.multiplyByMonom(e):Number.isSafeInteger(e)?this.multiplyByInteger(e):this;multiplyByPolynom=e=>{const t=[];for(const i of this._monoms)for(const r of e.monoms)t.push(n.Monom.xmultiply(i,r));return this._monoms=t,this.reduce()};multiplyByFraction=e=>{for(const t of this._monoms)t.coefficient.multiply(e);return this.reduce()};multiplyByInteger=e=>this.multiplyByFraction(new s.Fraction(e));multiplyByMonom=e=>{for(const t of this._monoms)t.multiply(e);return this.reduce()};euclidian=e=>{const t=e.variables[0],i=(new a).zero(),n=this.clone().reorder(t);if(0===e.variables.length)return{quotient:i,reminder:n};const r=e.monomByDegree(void 0,t),o=e.degree(t);let s,l=this.degree(t).clone().multiply(2);for(;n.degree(t)>=o&&l.isPositive()&&(l.subtract(1),s=n.monomByDegree(void 0,t).clone().divide(r),!s.isZero());)i.add(s),n.subtract(e.clone().multiply(s));return{quotient:i,reminder:n}};divide=e=>{if(e.isFraction)this.divideByFraction(e);else if(Number.isSafeInteger(e))return this.divideByInteger(e)};divideByInteger=e=>{const t=new s.Fraction(e);for(const e of this._monoms)e.coefficient.divide(t);return this};divideByFraction=e=>{for(const t of this._monoms)t.coefficient.divide(e);return this};pow=e=>{if(!Number.isSafeInteger(e))return this.zero();if(e<0)return this.zero();if(0===e)return new a;const t=this.clone();for(let i=1;i<e;i++)this.multiply(t);return this.reduce()};compare=(e,t)=>{void 0===t&&(t="=");const i=this.clone().reduce().reorder(),n=e.clone().reduce().reorder();switch(t){case"=":if(i.length!==n.length||i.degree().isNotEqual(n.degree()))return!1;for(const e in i.monoms)if(!i.monoms[e].isEqual(n.monoms[e]))return!1;return!0;case"same":if(i.length!==n.length||i.degree()!==n.degree())return!1;for(const e in i.monoms)if(!i.monoms[e].isSameAs(n.monoms[e]))return!1;return!0;default:return!1}};isZero(){return 1===this._monoms.length&&this._monoms[0].coefficient.isZero()||0===this._monoms.length}isOne(){return 1===this._monoms.length&&this._monoms[0].coefficient.isOne()}isEqual=e=>this.compare(e,"=");isSameAs=e=>this.compare(e,"same");isOpposedAt=e=>this.compare(e.clone().opposed(),"=");isFactorized=e=>{let t;if(e.match(/\(/g).length!==e.match(/\)/g).length)return!1;try{t=new a(e)}catch(e){return!1}if(!this.isEqual(t))return!1;let i=e.replaceAll("*",""),n=""+i,r=[];for(let e of i.matchAll(/\(([a-z0-9+\-]+)\)(\^[0-9]*)?/g)){if(void 0!==e[2])for(let t=0;t<+e[2].substr(1);t++)r.push(e[1]);else r.push(e[1]);n=n.replaceAll(e[0],"")}""!==n&&r.push(n);let o=r.map((e=>new a(e)));this.factorize();let s=1;for(let e of this.factors)for(let t=0;t<o.length;t++){if(e.isEqual(o[t])){o.splice(t,1);break}if(e.isOpposedAt(o[t])){o.splice(t,1),s=-s;break}}return 0===o.length&&1===s};isDeveloped=e=>{let t;if(e.match(/\(/g).length+e.match(/\)/g).length)return!1;try{t=new a(e)}catch(e){return!1}return!!this.isEqual(t)&&e.replaceAll("[*s]","")===t.reduce().reorder().display};reduce=()=>{for(let e=0;e<this._monoms.length;e++)for(let t=e+1;t<this._monoms.length;t++)this._monoms[e].isSameAs(this.monoms[t])&&(this._monoms[e].add(this.monoms[t]),this._monoms.splice(t,1));this._monoms=this._monoms.filter((e=>0!==e.coefficient.value));for(const e of this._monoms)e.coefficient.reduce();return 0===this.length?(new a).zero():this};reorder=(e="x")=>(this._monoms.sort((function(t,i){return i.degree(e).clone().subtract(t.degree(e)).value})),this.reduce());degree=e=>{let t=(new s.Fraction).zero();for(const i of this._monoms)t=s.Fraction.max(i.degree(e).value,t);return t};letters=()=>{let e=new Set;for(let t of this._monoms)e=new Set([...e,...t.variables]);return[...e]};replaceBy=(e,t)=>{let i;const n=(new a).zero();for(const r of this.monoms)void 0===r.literal[e]||r.literal[e].isZero()?n.add(r.clone()):(i=r.literal[e].clone(),delete r.literal[e],n.add(t.clone().pow(Math.abs(i.numerator)).multiply(r)));return this._monoms=n.reduce().reorder().monoms,this};evaluate=e=>{const t=(new s.Fraction).zero();return this._monoms.forEach((i=>{t.add(i.evaluate(e))})),t};derivative=e=>{let t=new a;for(let i of this._monoms)t.add(i.derivative(e));return t};primitive=e=>{let t=new a;for(let i of this._monoms)t.add(i.primitive(e));return t};integrate=(e,t,i)=>{const n=this.primitive(i);void 0===i&&(i="x");let r={},o={};return r[i]=new s.Fraction(e),o[i]=new s.Fraction(t),n.evaluate(o).subtract(n.evaluate(r))};factorize=e=>{let t,i=[],n=this.clone().reorder(),r=n.commonMonom();r.isOne()||(t=new a,t.monoms=[r],i=[t.clone()],n=n.euclidian(t).quotient);let o=n.degree().clone().multiply(2).value;for(;o>=0;){if(o--,n.monoms.length<2){n.isOne()||i.push(n.clone());break}{let e=n.monoms[0].dividers,t=n.monoms[n.monoms.length-1].dividers;for(let r of e)for(let e of t){let t,o=new a;o.monoms=[r.clone(),e.clone()],t=n.euclidian(o),t.reminder.isZero()?(n=t.quotient.clone(),i.push(o)):(o.monoms=[r.clone(),e.clone().opposed()],t=n.euclidian(o),t.reminder.isZero()&&(n=t.quotient.clone(),i.push(o)))}}}return this.factors=i,i};_factorize2ndDegree=e=>{let t,i,n,r,o,s,l,h,c;if(1===this.numberOfVars)return n=this.monomByDegree(2,e).coefficient,r=this.monomByDegree(1,e).coefficient,o=this.monomByDegree(0,e).coefficient,s=r.clone().pow(2).subtract(n.clone().multiply(o).multiply(4)),s.isZero()?(l=r.clone().opposed().divide(n.clone().multiply(2)),t=new a(e).subtract(l.display).multiply(l.denominator),i=new a(e).subtract(l.display).multiply(l.denominator),c=n.divide(l.denominator).divide(l.denominator),c.isOne()?[t,i]:[new a(c.display),t,i]):s.isPositive()&&s.isSquare()?(l=r.clone().opposed().add(s.clone().sqrt()).divide(n.clone().multiply(2)),h=r.clone().opposed().subtract(s.clone().sqrt()).divide(n.clone().multiply(2)),c=n.divide(l.denominator).divide(h.denominator),c.isOne()?[new a(e).subtract(l.display).multiply(l.denominator),new a(e).subtract(h.display).multiply(h.denominator)]:[new a(c.display),new a(e).subtract(l.display).multiply(l.denominator),new a(e).subtract(h.display).multiply(h.denominator)]):[this.clone()];if(n=this.monomByDegree(2,e),r=this.monomByDegree(1,e),o=this.monomByDegree(0,e),n.isLiteralSquare()&&o.isLiteralSquare()&&r.clone().pow(2).isSameAs(n.clone().multiply(o))){let e,t=new a("x",n.coefficient,r.coefficient,o.coefficient)._factorize2ndDegree("x"),i=[];if(t.length>=2){for(let r of t)r.degree().isZero()?i.push(r.clone()):(e=r.clone(),e.monoms[0].literal=n.literalSqrt,e.monoms[1].literal=o.literalSqrt,i.push(e.clone()));return i}}return[this.clone()]};_factorizeByGroups=()=>[];getZeroes=()=>{switch(this.degree().value){case 0:return 0===this._monoms[0].coefficient.value?[!0]:[!1];case 1:if(1===this._monoms.length)return[(new s.Fraction).zero()];{const e=this.clone().reduce().reorder();return[e.monoms[1].coefficient.opposed().divide(e.monoms[0].coefficient)]}default:0===this._factors.length&&this.factorize();let e=[],t=[];for(let i of this._factors)if(i.degree().greater(2));else if(2===i.degree().value){let t=i.monomByDegree(2).coefficient,n=i.monomByDegree(1).coefficient,r=i.monomByDegree(0).coefficient,o=n.clone().pow(2).subtract(t.clone().multiply(r).multiply(4));if(o.value>0){let i=(-n.value+Math.sqrt(o.value))/(2*t.value),r=(-n.value-Math.sqrt(o.value))/(2*t.value);e.push(new s.Fraction(i.toFixed(3)).reduce()),e.push(new s.Fraction(r.toFixed(3)).reduce())}else 0===o.value||console.log("No zero for ",i.tex)}else for(let n of i.getZeroes())!1!==n&&!0!==n&&-1===t.indexOf(n.frac)&&(e.push(n),t.push(n.frac));return e}return[]};monomByDegree=(e,t)=>{if(void 0===e)return this.monomByDegree(this.degree(t),t);const i=this.clone().reduce();for(const n of i._monoms)if(n.degree(t).isEqual(e))return n.clone();return(new n.Monom).zero()};monomsByDegree=(e,t)=>{if(void 0===e)return this.monomsByDegree(this.degree(t));let i=[];const n=this.clone().reduce();for(const r of n._monoms)r.degree(t)===e&&i.push(r.clone());return i};monomByLetter=e=>{const t=this.clone().reduce();for(const i of t._monoms)if(i.hasLetter(e))return i.clone();return(new n.Monom).zero()};getDenominators=()=>{const e=[];for(const t of this._monoms)e.push(t.coefficient.denominator);return e};getNumerators=()=>{const e=[];for(const t of this._monoms)e.push(t.coefficient.numerator);return e};lcmDenominator=()=>o.Numeric.lcm(...this.getDenominators());gcdDenominator=()=>o.Numeric.gcd(...this.getDenominators());lcmNumerator=()=>o.Numeric.lcm(...this.getNumerators());gcdNumerator=()=>o.Numeric.gcd(...this.getNumerators());commonMonom=()=>{let e,t,i=(new n.Monom).one(),r=this.degree();e=this.gcdNumerator(),t=this.gcdDenominator(),i.coefficient=new s.Fraction(e,t);for(let e of this.variables){i.setLetter(e,r);for(let t of this._monoms)if(i.setLetter(e,s.Fraction.min(t.degree(e),i.degree(e))),i.degree(e).isZero())break}return i}}t.Polynom=a},107:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Rational=void 0;const n=i(38),r=i(506);t.Rational=class{_rawString;_numerator;_denominator;constructor(e,t){this._numerator=e?e.clone():new n.Polynom,this._denominator=t?t.clone():new n.Polynom}clone=()=>(this._numerator=this._numerator.clone(),this._denominator=this._denominator.clone(),this);get tex(){return`\\dfrac{ ${this._numerator.tex} }{ ${this._denominator.tex} }`}get texFactors(){return this._numerator.factorize(),this._denominator.factorize(),`\\dfrac{ ${this._numerator.texFactors} }{ ${this._denominator.texFactors} }`}get numerator(){return this._numerator}get denominator(){return this._denominator}domain=()=>{let e=this._denominator.getZeroes();return 0===e.length||!1===e[0]?"\\mathbb{R}":!0===e[0]?"\\varnothing":"\\mathbb{R}\\setminus\\left{"+e.map((e=>"boolean"==typeof e?"":e.frac)).join(";")+"\\right}"};amplify=e=>(this._numerator.multiply(e),this._denominator.multiply(e),this);simplify=e=>{let t=this._numerator.euclidian(e);if(!t.reminder.isZero())return this;let i=this._denominator.euclidian(e);return i.reminder.isZero()?(this._numerator=t.quotient,this._denominator=i.quotient,this):this};reduce=()=>{console.log(this._numerator.tex),this._numerator.factorize(),console.log(this._numerator.factors.map((e=>e.tex)));for(let e of this._numerator.factors)this.simplify(e);return this};opposed=()=>(this._numerator.opposed(),this);add=e=>{let t=this._denominator.clone();return this.amplify(e._denominator),this._numerator.add(e._numerator.clone().multiply(t)),this};subtract=e=>this.add(e.clone().opposed());limits=(e,t)=>{if(e!==1/0&&e!==-1/0)return this._numerator.evaluate({letter:new r.Fraction(e)}).divide(this._denominator.evaluate({letter:new r.Fraction(e)}));{let i=this._numerator.monomByDegree(this._numerator.degree(t),t),n=this._denominator.monomByDegree(this._denominator.degree(t),t);if(i.divide(n),i.degree(t).isStrictlyPositive())return i.coefficient.sign()*Math.pow(e>0?1:-1,i.degree(t).value%2)==1?1/0:-1/0;if(i.degree(t).isZero())return i.coefficient;if(i.degree(t).isStrictlyPositive())return i.coefficient.sign()*Math.pow(-1,i.degree(t).value%2)==1?0:-0}}}},506:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Fraction=void 0;const n=i(956);class r{_numerator;_denominator;constructor(e,t){return this._numerator=1,this._denominator=1,void 0!==e&&this.parse(e,t),this}get isFraction(){return!0}get numerator(){return this._numerator}set numerator(e){this._numerator=e}get denominator(){return this._denominator}set denominator(e){this._denominator=e}get value(){return this._numerator/this._denominator}get tex(){return 1===this._denominator?`${this._numerator}`:this._numerator<0?`-\\frac{ ${-this._numerator} }{ ${this._denominator} }`:`\\frac{ ${this._numerator} }{ ${this._denominator} }`}get display(){return 1===this._denominator?`${this._numerator}`:`${this._numerator}/${this._denominator}`}get frac(){return this.tex}get dfrac(){return this.tex.replace("\\frac","\\dfrac")}parse=(e,t)=>{let i;if(null===e||""===e)return this._numerator=0,this._denominator=1,this;switch(typeof e){case"string":if(i=e.split("/"),i.length>2)throw"Two many divide signs";if(i.map((e=>""===e||isNaN(Number(e)))).includes(!0))throw"Not a number";if(1===i.length)return this.parse(+i[0]);2===i.length?"0"===i[1]?(this._numerator=NaN,this._denominator=1):(this._numerator=+i[0],this._denominator=+i[1]):(this._numerator=NaN,this._denominator=1);break;case"number":if(Number.isSafeInteger(e))this._numerator=+e,void 0!==t&&Number.isSafeInteger(t)?this._denominator=+t:this._denominator=1;else{let i=e.toString().split(".")[1].length;void 0===t?(this._numerator=e*Math.pow(10,i),this._denominator=Math.pow(10,i)):Number.isSafeInteger(t)&&(this._numerator=e*Math.pow(10,i)-Math.floor(e*Math.pow(10,i-t)),this.denominator=Math.pow(10,i)-Math.pow(10,i-t))}break;case"object":e.isFraction&&(this._numerator=+e.numerator,this._denominator=+e.denominator)}return this};clone=()=>{let e=new r;return e.numerator=+this._numerator,e.denominator=+this._denominator,e};zero=()=>(this._numerator=0,this._denominator=1,this);one=()=>(this._numerator=1,this._denominator=1,this);infinite=()=>(this._numerator=1/0,this._denominator=1,this);invalid=()=>(this._numerator=NaN,this._denominator=1,this);opposed=()=>(this._numerator=-this._numerator,this);add=e=>{if(!(e instanceof r))return this.add(new r(e));{let t=this._numerator,i=this._denominator;this._numerator=t*e.denominator+e.numerator*i,this._denominator=i*e.denominator}return this.reduce()};subtract=e=>e instanceof r?this.add(e.clone().opposed()):this.add(-e);multiply=e=>{let t=new r(e);return this._numerator=this._numerator*t.numerator,this._denominator=this._denominator*t.denominator,this.reduce()};divide=e=>{let t=new r(e);if(0===t.numerator)return(new r).infinite();let i=+this._numerator,n=+this._denominator;return this._numerator=i*t.denominator,this._denominator=n*t.numerator,this.reduce()};invert=()=>{let e=+this._numerator,t=+this._denominator;return this._numerator=t,this._denominator=e,this};pow=e=>e instanceof r?this.pow(e.value):Number.isSafeInteger(e)?(this.reduce(),e<0&&this.invert(),this._numerator=this._numerator**Math.abs(e),this._denominator=this._denominator**Math.abs(e),this):this.invalid();root=e=>(0===e||(e<0&&this.invert(),Math.pow(this._numerator,Math.abs(1/e)),Math.pow(this._denominator,Math.abs(1/e)),this._numerator=Math.pow(this._numerator,Math.abs(1/e)),this._denominator=Math.pow(this._denominator,Math.abs(1/e))),this);sqrt=()=>this.root(2);abs=()=>(this._numerator=Math.abs(this._numerator),this._denominator=Math.abs(this._denominator),this);static max=(...e)=>{let t=new r(e[0]);for(let i of e){let e=new r(i);e.greater(t)&&(t=e.clone())}return t};static min=(...e)=>{let t=new r(e[0]);for(let i of e){let e=new r(i);e.lesser(t)&&(t=e.clone())}return t};reduce=()=>{let e=n.Numeric.gcd(this._numerator,this._denominator);return this._numerator=this._numerator/e,this._denominator=this._denominator/e,this._denominator<0&&(this._denominator=-this._denominator,this._numerator=-this._numerator),this};amplify=e=>(Number.isSafeInteger(e)&&(this._numerator*=e,this._denominator*=e),this);compare=(e,t)=>{let i;switch(void 0===t&&(t="="),i=e instanceof r?e.clone():new r(e),t){case">":return this.value>i.value;case">=":return this.value>=i.value;case"<":return this.value<i.value;case"<=":return this.value<=i.value;case"=":return this.value===i.value;case"<>":return this.value!==i.value;default:return!1}};lesser=e=>this.compare(e,"<");leq=e=>this.compare(e,"<=");greater=e=>this.compare(e,">");geq=e=>this.compare(e,">=");isEqual=e=>this.compare(e,"=");isNotEqual=e=>this.compare(e,"<>");isOpposed=e=>this.isEqual(e.clone().opposed());isInverted=e=>this.isEqual((new r).one().divide(e.clone()));isZero=()=>0===this._numerator;isNotZero=()=>0!==this._numerator;isOne=()=>1===this._numerator&&1===this._denominator;isNegativeOne=()=>-1===this._numerator&&1===this._denominator;isPositive=()=>1===this.sign();isNegative=()=>-1===this.sign();isStrictlyPositive=()=>this.value>0;isStrictlyNegative=()=>this.value<0;isNaN=()=>isNaN(this._numerator);isInfinity=()=>this._numerator===1/0;isFinite=()=>!this.isInfinity();isSquare=()=>Math.sqrt(this._numerator)%1==0&&Math.sqrt(this._denominator)%1==0;isReduced=()=>1===Math.abs(n.Numeric.gcd(this._numerator,this._denominator));isNatural=()=>1===this.clone().reduce().denominator;isRational=()=>!this.isNatural();isEven=()=>this.isNatural()&&this.value%2==0;isOdd=()=>this.isNatural()&&this.value%2==1;sign=()=>this._numerator*this._denominator>=0?1:-1;areEquals=(...e)=>{for(let t=0;t<e.length;t++)if(!this.isEqual(e[t]))return!1;return!0}}t.Fraction=r},534:function(e,t,i){var n=this&&this.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[i]}})}:function(e,t,i,n){void 0===n&&(n=i),e[n]=t[i]}),r=this&&this.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||n(t,e,i)};Object.defineProperty(t,"__esModule",{value:!0}),r(i(506),t),r(i(330),t)},330:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Nthroot=void 0,t.Nthroot=class{_radical;_nth;_coefficient;_isValid;constructor(){this._radical=1,this._coefficient=1,this._nth=2,this._isValid=!0}get radical(){return this._radical}set radical(e){this._radical=e}get nth(){return this._nth}set nth(e){Number.isSafeInteger(e)&&e>=2?this._nth=e:(console.log("Error setting the nth root"),this._nth=2)}get coefficient(){return this._coefficient}set coefficient(e){this._coefficient=e}get tex(){let e;return e=1===this._coefficient?"":-1===this._coefficient?"-":this._coefficient.toString(),1===this._radical?`${this._coefficient}`:2===this._nth?`${e}\\sqrt{${this._radical}}`:`${e}\\sqrt[${this._nth}]{${this._radical}}`}get value(){return this._coefficient*Math.pow(this._radical,1/this._nth)}parse=(e,t,i)=>(this._coefficient=void 0===i?1:i,this._nth=void 0===t?2:t,this._radical=void 0===e?1:e,this._nth%2==0&&this._radical<0&&(this._isValid=!1),this);reduce=()=>{let e=Math.floor(Math.pow(this._radical,1/this._nth));for(;e>1;)this._radical%Math.pow(e,this._nth)!=0?e--:(this._coefficient*=e,this._radical=this._radical/Math.pow(e,this._nth),e=Math.floor(Math.pow(this._radical,1/this._nth)));return this};multiply=e=>(this._radical*=e.radical,this.reduce());hasRadical=()=>!(1===this._radical||0===this._radical||!1===this._isValid)}},699:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Circle=void 0;const n=i(557),r=i(534),o=i(667),s=i(586);t.Circle=class{_center;_radius;_squareRadius;_cartesian;_exists;constructor(...e){this._exists=!1,void 0!==e&&this.parse(...e)}get center(){return this._center}get radius(){return this._squareRadius.isSquare()?{tex:this._squareRadius.clone().sqrt().tex,display:this._squareRadius.clone().sqrt().display}:{tex:`\\sqrt{${this._squareRadius.tex}}`,display:`sqrt(${this._squareRadius.display})`}}get tex(){let e,t;return e=this._center.x.isZero()?"x^2":`\\left(x${this._center.x.isNegative()?"+":"-"}${this._center.x.clone().abs().tex}\\right)^2`,t=this._center.y.isZero()?"y^2":`\\left(y${this._center.y.isNegative()?"+":"-"}${this._center.y.clone().abs().tex}\\right)^2`,`${e}+${t}=${this._squareRadius.tex}`}get developed(){return this._cartesian.tex}get display(){return this._cartesian.display}get cartesian(){return this._cartesian}parse(...e){1===e.length&&"string"==typeof e[0]?this.checkCircle(new o.Equation(e[0])):e.length>=2&&(this._center=new n.Point(e[0]),e[1]instanceof n.Point?this._squareRadius=new s.Vector(this._center,e[1]).normSquare:!0===e[2]?this._squareRadius=new r.Fraction(e[1]):(this._radius=new r.Fraction(e[1]),this._squareRadius=this._radius.clone().pow(2)),this._cartesian=new o.Equation(new o.Polynom(`(x-(${this._center.x.display}))^2+(y-(${this._center.y.display}))^2`),new o.Polynom(`${this._squareRadius.display}`)).moveLeft())}checkCircle=e=>{if(2===e.degree("x").value&&2===e.degree("y").value){let t,i,r,o=e.left.monomByDegree(2,"x"),s=e.left.monomByDegree(2,"y");o.coefficient.isEqual(s.coefficient)&&(e.divide(o.coefficient),t=e.left.monomByDegree(1,"x"),i=e.left.monomByDegree(1,"y"),r=e.left.monomByDegree(0),this._center=new n.Point(t.coefficient.clone().divide(2).opposed(),i.coefficient.clone().divide(2).opposed()),this._squareRadius=r.coefficient.clone().opposed().add(this._center.x.clone().pow(2)).add(this._center.y.clone().pow(2)))}return!1};relativePosition=e=>{let t=e.distanceTo(this.center),i=Math.sqrt(this._squareRadius.value);return t.value-i>1e-10?0:Math.abs(t.value-i)<1e-10?1:2};lineIntersection=e=>{const t=this._cartesian.clone(),i=e.equation.clone().isolate("y");return i instanceof o.Equation&&(t.replaceBy("y",i.right),t.solve()),[]}}},272:function(e,t,i){var n=this&&this.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[i]}})}:function(e,t,i,n){void 0===n&&(n=i),e[n]=t[i]}),r=this&&this.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||n(t,e,i)};Object.defineProperty(t,"__esModule",{value:!0}),r(i(586),t),r(i(164),t),r(i(557),t),r(i(699),t),r(i(9),t)},9:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Line=void 0;const n=i(534),r=i(586),o=i(557),s=i(667),a=i(956);var l;!function(e){e[e.None=0]="None",e[e.Parallel=1]="Parallel",e[e.Perpendicular=2]="Perpendicular"}(l||(l={}));class h{_a;_b;_c;_OA;_d;_n;_exists;_referencePropriety;_referenceLine;static PERPENDICULAR=l.Perpendicular;static PARALLEL=l.Parallel;constructor(...e){return this._exists=!1,e.length>0&&this.parse(...e),this}get isLine(){return!0}get exists(){return this._exists}get equation(){return new s.Equation((new s.Polynom).parse("xy",this._a,this._b,this._c),new s.Polynom("0")).simplify()}get tex(){let e=this.equation;return this._a.isNegative()&&e.multiply(-1),{canonical:e.tex,mxh:this.slope.isInfinity()?"x="+this.OA.x.tex:"y="+(new s.Polynom).parse("x",this.slope,this.height).tex,parametric:`${o.Point.pmatrix("x","y")} = ${o.Point.pmatrix(this._OA.x,this._OA.y)} + k\\cdot ${o.Point.pmatrix(this._d.x,this._d.y)}`}}get a(){return this._a}set a(e){this._a=e}get b(){return this._b}set b(e){this._b=e}get c(){return this._c}set c(e){this._c=e}get OA(){return this._OA}set OA(e){this._OA=e}get d(){return this._d}get n(){return this._n}get normal(){return new r.Vector(this._a,this._b)}get director(){return this._d.clone()}set d(e){this._d=e}get slope(){return this._a.clone().opposed().divide(this._b)}get height(){return this._c.clone().opposed().divide(this._b)}parse=(...e)=>{if(this._exists=!1,0===e.length)return this;if(1===e.length){if(e[0]instanceof h)return e[0].clone();if(e[0]instanceof s.Equation)return this.parseEquation(e[0]);if("string"==typeof e[0])try{let t=new s.Equation(e[0]);return this.parse(t)}catch(e){return this}}if(2===e.length){if(e[0]instanceof o.Point&&e[1]instanceof r.Vector)return this.parseByPointAndVector(e[0],e[1]);if(e[0]instanceof o.Point&&e[1]instanceof o.Point)return this.parseByPointAndVector(e[0],new r.Vector(e[0],e[1]));if(e[0]instanceof r.Vector&&e[1]instanceof o.Point)return this.parseByPointAndNormal(e[1],e[0])}if(3===e.length){if((e[0]instanceof n.Fraction||"number"==typeof e[0])&&(e[1]instanceof n.Fraction||"number"==typeof e[1])&&(e[2]instanceof n.Fraction||"number"==typeof e[2]))return this.parseByCoefficient(e[0],e[1],e[2]);if(e[0]instanceof o.Point&&e[1]instanceof r.Vector){if(e[2]===l.Perpendicular)return this.parseByPointAndNormal(e[0],e[1]);if(e[2]===l.Parallel)return this.parseByPointAndVector(e[0],e[1])}}return console.log("Someting wrong happend while creating the line"),this};parseEquation=e=>{e.reorder(!0);let t=new Set(e.letters());if(!t.has("x")&&!t.has("y"))return this;for(let e of["x","y"])t.has(e)&&t.delete(e);return t.size>0?this:this.parseByCoefficient(e.left.monomByLetter("x").coefficient,e.left.monomByLetter("y").coefficient,e.left.monomByDegree(0).coefficient)};parseByCoefficient=(e,t,i)=>(this._a=new n.Fraction(e),this._b=new n.Fraction(t),this._c=new n.Fraction(i),this._d=new r.Vector(this._b.clone(),this._a.clone().opposed()),this._OA=new o.Point((new n.Fraction).zero(),this._c.clone()),this._n=this._d.clone().normal(),this._exists=!0,this);parseByPointAndVector=(e,t)=>(this.parseByCoefficient(t.y,t.x.clone().opposed(),e.x.clone().multiply(t.y).subtract(e.y.clone().multiply(t.x)).opposed()),this._OA=e.clone(),this._d=t.clone(),this._n=this._d.clone().normal(),this._exists=!0,this);parseByPointAndNormal=(e,t)=>this.parseByCoefficient(t.x,t.y,e.x.clone().multiply(t.x).add(e.y.clone().multiply(t.y)).opposed());parseByPointAndLine=(e,t,i)=>(void 0===i&&(i=l.Parallel),i===l.Parallel?this.parseByPointAndNormal(e,t.normal):i===l.Perpendicular?this.parseByPointAndNormal(e,t.director):(this._exists=!1,this));clone=()=>(this._a=this._a.clone(),this._b=this._b.clone(),this._c=this._c.clone(),this._d=this._d.clone(),this._OA=this._OA.clone(),this._n=this._n.clone(),this._exists=this.exists,this);isParellelTo=e=>this.slope.isEqual(e.slope)&&this.height.isNotEqual(e.height);isSameAs=e=>this.slope.isEqual(e.slope)&&this.height.isEqual(e.height);simplify=()=>{let e=a.Numeric.lcm(this._a.denominator,this._b.denominator,this._c.denominator),t=a.Numeric.gcd(this._a.numerator,this._b.numerator,this._c.denominator);return new h(this._a.denominator*e/t,this._b.denominator*e/t,this._c.denominator*e/t)};simplifyDirection=()=>{let e=a.Numeric.lcm(this._d.x.denominator,this._d.y.denominator),t=a.Numeric.gcd(this._d.x.numerator,this._d.y.numerator);return this._d.x.multiply(e).divide(t),this._d.y.multiply(e).divide(t),this};intersection=e=>{let t=new o.Point,i=!1,n=!1;return this._b.isZero()||e.b.isZero(),this.isParellelTo(e)?(t.x=null,t.y=null,i=!0):this.isSameAs(e)?(t.x=null,t.y=null,n=!0):(t.x=this._b.clone().multiply(e.c).subtract(this._c.clone().multiply(e.b)).divide(this._a.clone().multiply(e.b).subtract(this._b.clone().multiply(e.a))),t.y=this._a.clone().multiply(e.c).subtract(this._c.clone().multiply(e.a)).divide(this._b.clone().multiply(e.a).subtract(this._a.clone().multiply(e.b)))),{point:t,hasIntersection:!(i||n),isParallel:i,isSame:n}};distanceTo(e){let t=e.x.clone().multiply(this._a).add(e.y.clone().multiply(this._b)).add(this._c).abs(),i=this.normal.normSquare;if(i.isZero())return{value:NaN,tex:"Not a line",fraction:(new n.Fraction).infinite()};let r=t.value/Math.sqrt(i.value),o=t.clone().divide(i.clone().sqrt());return i.isSquare()?{value:r,tex:o.tex,fraction:o}:{value:r,tex:`\\frac{${t.tex}}{\\sqrt{${i.tex}}}`,fraction:o}}hitSegment(e,t){let i=this.intersection(new h(e,t));return!!i.hasIntersection&&i.point.x.value>=Math.min(e.x.value,t.x.value)&&i.point.x.value<=Math.max(e.x.value,t.x.value)&&i.point.y.value>=Math.min(e.y.value,t.y.value)&&i.point.y.value<=Math.max(e.y.value,t.y.value)}getValueAtX=e=>{const t=this.equation.clone().isolate("y"),i=new n.Fraction(e);if(t instanceof s.Equation)return t.right.evaluate({x:i})};getValueAtY=e=>{const t=this.equation.clone().isolate("x"),i=new n.Fraction(e);if(t instanceof s.Equation)return t.right.evaluate({y:i})};canonicalAsFloatCoefficient(e){void 0===e&&(e=2),this._a.value,this._b.value,this._c.value;let t="";return this._a.isZero()||(t=this._a.isOne()?"x":this._a.clone().opposed().isOne()?"-x":this._a.value.toFixed(e)+"x"),this._b.isZero()||(this._b.isPositive()&&(t+="+"),t+=this._b.value.toFixed(e)+"y"),this._c.isZero()||(this._c.isPositive()&&(t+="+"),t+=this._c.value.toFixed(e)),t+"=0"}}t.Line=h},557:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Point=void 0;const n=i(506);class r{_x;_y;_exist;constructor(...e){return this._x=(new n.Fraction).zero(),this._y=(new n.Fraction).zero(),void 0!==e&&this.parse(...e),this}get isPoint(){return!0}get x(){return this._x}set x(e){this._x=e}get y(){return this._y}set y(e){this._y=e}get tex(){let e=[];return e.push(this._x.tex),e.push(this._y.tex),`\\left(${e.join(";")}\\right)`}get display(){let e=[];return e.push(this._x.tex),e.push(this._y.tex),`(${e.join(";")})`}parse=(...e)=>{if(this.zero(),0===e.length)return this;if(1===e.length){if(e[0]instanceof r)return this._x=e[0].x.clone(),this._y=e[0].y.clone(),this;if("string"==typeof e[0]){let t=e[0].split(",");if(2===t.length)return this._x=new n.Fraction(t[0]).reduce(),this._y=new n.Fraction(t[1]).reduce(),this}if(void 0===e[0].x||void 0===e[0].y)return this.zero();this._x=new n.Fraction(e[0].x).reduce(),this._y=new n.Fraction(e[0].y).reduce()}return 2===e.length&&(this._x=new n.Fraction(e[0]).reduce(),this._y=new n.Fraction(e[1]).reduce()),this};clone=()=>(this._x=this._x.clone(),this._y=this._y.clone(),this);zero=()=>(this._x=new n.Fraction(null),this._y=new n.Fraction(null),this);origin=()=>(this.zero(),this);middleOf=(e,t)=>(this._x=e.x.clone().add(t.x).divide(2),this._y=e.y.clone().add(t.y).divide(2),this);texValues=e=>{let t=[];return t.push(this._x.value.toFixed(void 0===e?2:e)),t.push(this._y.value.toFixed(void 0===e?2:e)),`\\left(${t.join(";")}\\right)`};static pmatrix=(e,t,i)=>void 0===i?`\\begin{pmatrix} ${e.tex?e.tex:e} \\\\ ${t.tex?t.tex:t} \\end{pmatrix}`:`\\begin{pmatrix} ${e.tex?e.tex:e} \\\\ ${t.tex?t.tex:t} \\\\ ${i.tex?i.tex:i} \\end{pmatrix}`}t.Point=r},164:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Triangle=void 0;const n=i(557),r=i(506),o=i(586),s=i(9),a=i(760);t.Triangle=class{_A;_B;_C;_lines;_middles;_remarquables;constructor(...e){return e.length>0&&this.parse(...e),this}get isTriangle(){return!0}get A(){return this._A}get B(){return this._B}get C(){return this._C}get AB(){return this.getSegment("A","B")}get BA(){return this.getSegment("B","A")}get BC(){return this.getSegment("B","C")}get CB(){return this.getSegment("C","B")}get AC(){return this.getSegment("A","C")}get CA(){return this.getSegment("C","A")}get isRectangle(){return!!this.AB.isNormalTo(this.BC)||!!this.AB.isNormalTo(this.AC)||!!this.BC.isNormalTo(this.AC)}get isEquilateral(){return this.AB.normSquare.isEqual(this.BC.normSquare)&&this.AB.normSquare.isEqual(this.AC.normSquare)}get isIsocele(){return this.AB.normSquare.isEqual(this.BC.normSquare)||this.AB.normSquare.isEqual(this.AC.normSquare)||this.BC.normSquare.isEqual(this.AC.normSquare)}get lines(){return this._lines}get remarquables(){return this._remarquables}parse=(...e)=>{if(6===e.length){let t=e.map((e=>new r.Fraction(e)));return this.parse(new n.Point(t[0],t[1]),new n.Point(t[2],t[3]),new n.Point(t[4],t[5]))}if(3===e.length){if(3===e.filter((e=>"string"==typeof e)).length)return this.parse(...e.map((e=>new s.Line(e))));if(3===e.filter((e=>!0===e.isLine)).length){this._lines={AB:e[0],BC:e[1],AC:e[2]};let t=e[0].intersection(e[1]);if(!t.hasIntersection)return this;if(this._B=t.point.clone(),t=e[1].intersection(e[2]),!t.hasIntersection)return this;if(this._C=t.point.clone(),t=e[2].intersection(e[0]),!t.hasIntersection)return this;this._A=t.point.clone()}else{if(e.filter((e=>!0===e.isPoint)).length<3)return this.parse(new n.Point(e[0]),new n.Point(e[1]),new n.Point(e[2]));this._A=e[0].clone(),this._B=e[1].clone(),this._C=e[2].clone(),this._lines={AB:new s.Line(this._A,this._B),BC:new s.Line(this._B,this._C),AC:new s.Line(this._A,this._C)}}}else if(1===e.length&&!0===e[0].isTriangle)return e[0].clone();return this._updateTriangle(),this};clone=()=>(this._A=this._A.clone(),this._B=this._B.clone(),this._C=this._C.clone(),this._lines={AB:this._lines.AB.clone(),BC:this._lines.BC.clone(),AC:this._lines.AC.clone()},this._updateTriangle(),this);_updateTriangle=()=>{this._middles={AB:(new n.Point).middleOf(this._A,this._B),AC:(new n.Point).middleOf(this._A,this._C),BC:(new n.Point).middleOf(this._B,this._C)},this._remarquables=this._calculateRemarquableLines()};getPointByName=e=>{switch(e.toUpperCase()){case"A":return this._A;case"B":return this._B;case"C":return this._C}return this._A};getSegment=(e,t)=>new o.Vector(this.getPointByName(e),this.getPointByName(t));_calculateRemarquableLines=()=>{let e={medians:{A:new s.Line(this._A,this._middles.BC),B:new s.Line(this._B,this._middles.AC),C:new s.Line(this._C,this._middles.AB),intersection:null},mediators:{AB:new s.Line(this._middles.AB,new o.Vector(this._A,this._B).normal()),AC:new s.Line(this._middles.AC,new o.Vector(this._A,this._C).normal()),BC:new s.Line(this._middles.BC,new o.Vector(this._B,this._C).normal()),intersection:null},heights:{A:new s.Line(this._A,new o.Vector(this._B,this._C).normal()),B:new s.Line(this._B,new o.Vector(this._A,this._C).normal()),C:new s.Line(this._C,new o.Vector(this._A,this._B).normal()),intersection:null},bisectors:{A:this._calculateBisectors("A"),B:this._calculateBisectors("B"),C:this._calculateBisectors("C"),intersection:null}};return e.medians.intersection=e.medians.A.intersection(e.medians.B).point,e.mediators.intersection=e.mediators.AB.intersection(e.mediators.BC).point,e.heights.intersection=e.heights.A.intersection(e.heights.B).point,e.bisectors.intersection=e.bisectors.A.intersection(e.bisectors.B).point,e};_calculateBisectors=e=>{let t,i,n=this.lines;"A"===e?(t=n.AB,i=n.AC):"B"===e?(t=n.AB,i=n.BC):"C"===e&&(t=n.BC,i=n.AC);let r=new s.Line(new a.Equation(t.equation.left.clone().multiply(i.n.simplify().norm),i.equation.left.clone().multiply(t.n.simplify().norm)).reorder(!0).simplify()),o=new s.Line(new a.Equation(t.equation.left.clone().multiply(i.n.simplify().norm),i.equation.left.clone().multiply(t.n.simplify().norm).opposed()).reorder(!0).simplify());return"A"===e?r.hitSegment(this.B,this.C)?r:o:"B"===e?r.hitSegment(this.A,this.C)?r:o:"C"===e?r.hitSegment(this.B,this.A)?r:o:r}}},586:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Vector=void 0;const n=i(506),r=i(956);class o{_x;_y;constructor(...e){this._x=(new n.Fraction).zero(),this._y=(new n.Fraction).zero(),void 0!==e&&this.parse(...e)}get x(){return this._x}set x(e){this._x=e}get y(){return this._y}set y(e){this._y=e}get normSquare(){return this._x.clone().pow(2).add(this._y.clone().pow(2))}get norm(){return Math.sqrt(this.normSquare.value)}get tex(){return`\\begin{pmatrix}${this._x.tex} \\\\ ${this._y.tex} \\end{pmatrix}`}parse=(...e)=>{if(this.zero(),0===e.length)return this;if(1===e.length)return e[0]instanceof o?e[0].clone():this._parseString(e[0]);if(e.length>=2){if(e[0].isPoint&&e[1].isPoint)return this._x=e[1].x.clone().subtract(e[0].x),this._y=e[1].y.clone().subtract(e[0].y),this;!e[0].isFraction&&isNaN(e[0])||(this._x=new n.Fraction(e[0])),!e[1].isFraction&&isNaN(e[1])||(this._y=new n.Fraction(e[1]))}return this};clone=()=>{let e=new o;return null!==this._x&&(e.x=this._x.clone()),null!==this._y&&(e.y=this._y.clone()),e};reset=()=>(this._x=null,this._y=null,this);zero=()=>(this.reset(),this._x=new n.Fraction(null),this._y=new n.Fraction(null),this);one=()=>(this._x=new n.Fraction,this._y=new n.Fraction,this);_parseString=e=>{let t=e.split(/[,;\s]/g);return this.x=new n.Fraction(t[0]||null),this.y=new n.Fraction(t[1]||null),this};opposed=()=>(this._x.opposed(),this._y.opposed(),this);add=e=>(this._x.add(e.x),this._y.add(e.y),this);subtract=e=>this.add(e.clone().opposed());scalarProductWithVector=e=>this._x.clone().multiply(e.x).add(this._y.clone().multiply(e.y));static scalarProduct=(e,t)=>e.x.value*t.x.value+e.y.value*t.y.value;normal=()=>{let e=this.x.clone().opposed(),t=this.y.clone();return this._x=t,this._y=e,this};isNormalTo=e=>this.scalarProductWithVector(e).isZero();multiplyByScalar=e=>{let t=new n.Fraction(e);return this._x.multiply(t),this._y.multiply(t),this};divideByScalar=e=>this.multiplyByScalar(new n.Fraction(e).invert());simplify=()=>this.multiplyByScalar(r.Numeric.lcm(this._x.denominator,this._y.denominator)).divideByScalar(r.Numeric.gcd(this._x.numerator,this._y.numerator));angleWith=(e,t,i)=>{let n=this.scalarProductWithVector(e).value,r=i?1:180/Math.PI;return t&&(n=Math.abs(n)),r*Math.acos(n/(this.norm*e.norm))}}t.Vector=o},956:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Numeric=void 0;class i{static round(e,t=2){return Number(Math.round(Number(e+"e"+t))+"e-"+t)}static prime(e){let t=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997,1009,1013,1019,1021,1031,1033,1039,1049,1051,1061,1063,1069,1087,1091,1093,1097,1103,1109,1117,1123,1129,1151,1153,1163,1171,1181,1187,1193,1201,1213,1217,1223,1229,1231,1237,1249,1259,1277,1279,1283,1289,1291,1297,1301,1303,1307,1319,1321,1327,1361,1367,1373,1381,1399,1409,1423,1427,1429,1433,1439,1447,1451,1453,1459,1471,1481,1483,1487,1489,1493,1499,1511,1523,1531,1543,1549,1553,1559,1567,1571,1579,1583,1597,1601,1607,1609,1613,1619,1621,1627,1637,1657,1663,1667,1669,1693,1697,1699,1709,1721,1723,1733,1741,1747,1753,1759,1777,1783,1787,1789,1801,1811,1823,1831,1847,1861,1867,1871,1873,1877,1879,1889,1901,1907,1913,1931,1933,1949,1951,1973,1979,1987,1993,1997,1999,2003,2011,2017,2027,2029,2039,2053,2063,2069,2081,2083,2087,2089,2099,2111,2113,2129,2131,2137,2141,2143,2153,2161,2179,2203,2207,2213,2221,2237,2239,2243,2251,2267,2269,2273,2281,2287,2293,2297,2309,2311,2333,2339,2341,2347,2351,2357,2371,2377,2381,2383,2389,2393,2399,2411,2417,2423,2437,2441,2447,2459,2467,2473,2477,2503,2521,2531,2539,2543,2549,2551,2557,2579,2591,2593,2609,2617,2621,2633,2647,2657,2659,2663,2671,2677,2683,2687,2689,2693,2699,2707,2711,2713,2719,2729,2731,2741,2749,2753,2767,2777,2789,2791,2797,2801,2803,2819,2833,2837,2843,2851,2857,2861,2879,2887,2897,2903,2909,2917,2927,2939,2953,2957,2963,2969,2971,2999,3001,3011,3019,3023,3037,3041,3049,3061,3067,3079,3083,3089,3109,3119,3121,3137,3163,3167,3169,3181,3187,3191,3203,3209,3217,3221,3229,3251,3253,3257,3259,3271,3299,3301,3307,3313,3319,3323,3329,3331,3343,3347,3359,3361,3371,3373,3389,3391,3407,3413,3433,3449,3457,3461,3463,3467,3469,3491,3499,3511,3517,3527,3529,3533,3539,3541,3547,3557,3559,3571,3581,3583,3593,3607,3613,3617,3623,3631,3637,3643,3659,3671,3673,3677,3691,3697,3701,3709,3719,3727,3733,3739,3761,3767,3769,3779,3793,3797,3803,3821,3823,3833,3847,3851,3853,3863,3877,3881,3889,3907,3911,3917,3919,3923,3929,3931,3943,3947,3967,3989,4001,4003,4007,4013,4019,4021,4027,4049,4051,4057,4073,4079,4091,4093,4099,4111,4127,4129,4133,4139,4153,4157,4159,4177,4201,4211,4217,4219,4229,4231,4241,4243,4253,4259,4261,4271,4273,4283,4289,4297,4327,4337,4339,4349,4357,4363,4373,4391,4397,4409,4421,4423,4441,4447,4451,4457,4463,4481,4483,4493,4507,4513,4517,4519,4523,4547,4549,4561,4567,4583,4591,4597,4603,4621,4637,4639,4643,4649,4651,4657,4663,4673,4679,4691,4703,4721,4723,4729,4733,4751,4759,4783,4787,4789,4793,4799,4801,4813,4817,4831,4861,4871,4877,4889,4903,4909,4919,4931,4933,4937,4943,4951,4957,4967,4969,4973,4987,4993,4999,5003,5009,5011,5021,5023,5039,5051,5059,5077,5081,5087,5099,5101,5107,5113,5119,5147,5153,5167,5171,5179,5189,5197,5209,5227,5231,5233,5237,5261,5273,5279,5281,5297,5303,5309,5323,5333,5347,5351,5381,5387,5393,5399,5407,5413,5417,5419,5431,5437,5441,5443,5449,5471,5477,5479,5483,5501,5503,5507,5519,5521,5527,5531,5557,5563,5569,5573,5581,5591,5623,5639,5641,5647,5651,5653,5657,5659,5669,5683,5689,5693,5701,5711,5717,5737,5741,5743,5749,5779,5783,5791,5801,5807,5813,5821,5827,5839,5843,5849,5851,5857,5861,5867,5869,5879,5881,5897,5903,5923,5927,5939,5953,5981,5987,6007,6011,6029,6037,6043,6047,6053,6067,6073,6079,6089,6091,6101,6113,6121,6131,6133,6143,6151,6163,6173,6197,6199,6203,6211,6217,6221,6229,6247,6257,6263,6269,6271,6277,6287,6299,6301,6311,6317,6323,6329,6337,6343,6353,6359,6361,6367,6373,6379,6389,6397,6421,6427,6449,6451,6469,6473,6481,6491,6521,6529,6547,6551,6553,6563,6569,6571,6577,6581,6599,6607,6619,6637,6653,6659,6661,6673,6679,6689,6691,6701,6703,6709,6719,6733,6737,6761,6763,6779,6781,6791,6793,6803,6823,6827,6829,6833,6841,6857,6863,6869,6871,6883,6899,6907,6911,6917,6947,6949,6959,6961,6967,6971,6977,6983,6991,6997,7001,7013,7019,7027,7039,7043,7057,7069,7079,7103,7109,7121,7127,7129,7151,7159,7177,7187,7193,7207,7211,7213,7219,7229,7237,7243,7247,7253,7283,7297,7307,7309,7321,7331,7333,7349,7351,7369,7393,7411,7417,7433,7451,7457,7459,7477,7481,7487,7489,7499,7507,7517,7523,7529,7537,7541,7547,7549,7559,7561,7573,7577,7583,7589,7591,7603,7607,7621,7639,7643,7649,7669,7673,7681,7687,7691,7699,7703,7717,7723,7727,7741,7753,7757,7759,7789,7793,7817,7823,7829,7841,7853,7867,7873,7877,7879,7883,7901,7907,7919,7927,7933,7937,7949,7951,7963,7993,8009,8011,8017,8039,8053,8059,8069,8081,8087,8089,8093,8101,8111,8117,8123,8147,8161,8167,8171,8179,8191,8209,8219,8221,8231,8233,8237,8243,8263,8269,8273,8287,8291,8293,8297,8311,8317,8329,8353,8363,8369,8377,8387,8389,8419,8423,8429,8431,8443,8447,8461,8467,8501,8513,8521,8527,8537,8539,8543,8563,8573,8581,8597,8599,8609,8623,8627,8629,8641,8647,8663,8669,8677,8681,8689,8693,8699,8707,8713,8719,8731,8737,8741,8747,8753,8761,8779,8783,8803,8807,8819,8821,8831,8837,8839,8849,8861,8863,8867,8887,8893,8923,8929,8933,8941,8951,8963,8969,8971,8999,9001,9007,9011,9013,9029,9041,9043,9049,9059,9067,9091,9103,9109,9127,9133,9137,9151,9157,9161,9173,9181,9187,9199,9203,9209,9221,9227,9239,9241,9257,9277,9281,9283,9293,9311,9319,9323,9337,9341,9343,9349,9371,9377,9391,9397,9403,9413,9419,9421,9431,9433,9437,9439,9461,9463,9467,9473,9479,9491,9497,9511,9521,9533,9539,9547,9551,9587,9601,9613,9619,9623,9629,9631,9643,9649,9661,9677,9679,9689,9697,9719,9721,9733,9739,9743,9749,9767,9769,9781,9787,9791,9803,9811,9817,9829,9833,9839,9851,9857,9859,9871,9883,9887,9901,9907,9923,9929,9931,9941,9949,9967,9973];return void 0===e?t:t.slice(0,Math.max(t.length,e))}static dividers(e){let t;const i=Math.sqrt(Math.abs(e));t=[];for(let n=1;n<=i;n++)e%n==0&&(t.push(n),t.push(e/n));return t.sort((function(e,t){return e-t})),[...new Set(t)]}static gcd(...e){let t=function(e,i){return 0===i?e:t(i,e%i)},i=1,n=2;if(0===e.length)return 1;if(1===e.length)return 0===e[0]?1:e[0];if(i=t(e[0],e[1]),1===i)return 1;for(n=2;n<e.length&&(i=t(i,e[n]),1!==i);n++);return Math.abs(i)}static lcm(...e){return e.reduce((function(e,t){return Math.abs(e*t/i.gcd(e,t))}))}}t.Numeric=i},984:function(e,t,i){var n=this&&this.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[i]}})}:function(e,t,i,n){void 0===n&&(n=i),e[n]=t[i]}),r=this&&this.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||n(t,e,i)};Object.defineProperty(t,"__esModule",{value:!0}),t.Random=void 0;const o=i(773),s=i(41),a=i(890),l=i(538);var h;r(i(233),t),(h=t.Random||(t.Random={})).polynom=function(e){return new o.rndPolynom(e).generate()},h.monom=function(e){return new s.rndMonom(e).generate()},h.fraction=function(e){return new l.rndFraction(e).generate()},h.number=function(e,t){return a.rndHelpers.randomInt(e,t)},h.numberSym=function(e,t){return a.rndHelpers.randomIntSym(e,t)},h.bool=function(e){return a.rndHelpers.randomBool(e)},h.array=function(e,t){return a.rndHelpers.randomArray(e,t)},h.item=function(e){return a.rndHelpers.randomItem(e)},h.shuffle=function(e){a.rndHelpers.shuffleArray(e)}},43:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.randomCore=void 0,t.randomCore=class{_config;_defaultConfig;mergeConfig=(e,t)=>void 0!==e?{...t,...e}:t;generate=()=>{};config=e=>(this._config=this.mergeConfig(e,this._defaultConfig),this)}},538:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.rndFraction=void 0;const n=i(43),r=i(534),o=i(984);class s extends n.randomCore{constructor(e){super(),this._defaultConfig={negative:!0,reduced:!0,zero:!0,natural:!1},this._config=this.mergeConfig(e,this._defaultConfig)}generate=()=>{let e=new r.Fraction;return this._config.negative?e.numerator=o.Random.numberSym(10,this._config.zero):e.numerator=o.Random.number(this._config.zero?0:1,10),this._config.natural?e.denominator=1:e.denominator=o.Random.number(1,10),this._config.reduced?e.reduce():e}}t.rndFraction=s},890:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.rndHelpers=void 0;class i{static randomBool(e=.5){return Math.random()<e}static randomInt(e,t){return void 0===t?this.randomInt(0,e):Math.floor(Math.random()*(t-e+1)+e)}static randomIntSym(e,t){return!1===t?this.randomBool()?this.randomInt(1,e):-this.randomInt(1,e):this.randomInt(-e,e)}static randomArray(e,t){return void 0===t&&(t=1),e.length<=0?Object.values(e):i.shuffleArray(e).slice(0,t)}static randomItem(e){return 0===e.length?"":this.randomArray(e,1)[0]}static shuffleArray(e){let t=Object.values(e);for(let e=t.length-1;e>0;e--){const i=Math.floor(Math.random()*(e+1)),n=t[e];t[e]=t[i],t[i]=n}return t}}t.rndHelpers=i},41:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.rndMonom=void 0;const n=i(43),r=i(984),o=i(937);class s extends n.randomCore{constructor(e){super(),this._defaultConfig={letters:"x",degree:2,fraction:!0,zero:!1},this._config=this.mergeConfig(e,this._defaultConfig)}generate=()=>{let e=new o.Monom;if(e.coefficient=r.Random.fraction({zero:this._config.zero,reduced:!0,natural:!this._config.fraction}),this._config.letters.length>1){for(let t of this._config.letters.split(""))e.setLetter(t,0);for(let t=0;t<this._config.degree;t++){const t=r.Random.item(this._config.letters.split(""));e.setLetter(t,e.degree(t).clone().add(1))}}else e.setLetter(this._config.letters,this._config.degree);return e}}t.rndMonom=s},773:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.rndPolynom=void 0;const n=i(43),r=i(41),o=i(984),s=i(667);class a extends n.randomCore{constructor(e){super(),this._defaultConfig={letters:"x",degree:2,fraction:!1,zero:!1,unit:!1,factorable:!1,allowNullMonom:!0,numberOfMonoms:0},this._config=this.mergeConfig(e,this._defaultConfig)}generate=()=>{if(this._config.factorable&&this._config.degree>1)return this.factorable();let e,t=(new s.Polynom).empty();for(let i=this._config.degree;i>=0;i--)e=new r.rndMonom({letters:this._config.letters,degree:i,fraction:this._config.fraction,zero:i!==this._config.degree&&this._config.allowNullMonom}).generate(),this._config.unit&&this._config.degree===i&&e.coefficient.one(),t.add(e);return this._config.numberOfMonoms>0&&this._config.numberOfMonoms<t.length&&(t.monoms=o.Random.array(t.monoms,this._config.numberOfMonoms)),t};factorable=()=>{let e=(new s.Polynom).one(),t={...this._config};t.degree=1,t.factorable=!1;for(let i=0;i<this._config.degree;i++)e.multiply(o.Random.polynom(t));return e}}t.rndPolynom=a},233:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},505:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Shutingyard=void 0,t.Shutingyard=class{_rpn=[];_mode;_tokenConfig;_uniformize;constructor(e){this._mode=void 0===e?"polynom":e,this.tokenConfigInitialization()}isOperation(e){return!!e[0].match(/[+\-*/^]/g)}tokenConfigInitialization(){return"set"===this._mode?(this._tokenConfig={"&":{precedence:3,associative:"left"},"|":{precedence:3,associative:"left"},"!":{precedence:4,associative:"right"},"-":{precedence:2,associative:"left"}},this._uniformize=!1):(this._tokenConfig={"^":{precedence:4,associative:"right"},"*":{precedence:3,associative:"left"},"/":{precedence:3,associative:"left"},"+":{precedence:2,associative:"left"},"-":{precedence:2,associative:"left"},"%":{precedence:3,associative:"right"},sin:{precedence:4,associative:"right"},cos:{precedence:4,associative:"right"},tab:{precedence:4,associative:"right"}},this._uniformize=!0),this._tokenConfig}NextToken2(e,t){let i,n;if(i="",n="","("===e[t])i="(",n="(";else if(")"===e[t])i=")",n=")";else if(","===e[t])i=",",n="function-argument";else{const r=Object.keys(this._tokenConfig).sort(((e,t)=>t.length-e.length));for(let o of r)if(e.substr(t,o.length)===o){i+=o,n="operation";break}""===i&&(e[t].match(/[0-9]/)?(i=e.substr(t).match(/^([0-9.,/]+)/)[0],n="coefficient"):e[t].match(/[a-zA-Z]/)?(i=e.substr(t).match(/^([a-zA-Z])/)[0],n="variable"):(console.log("Unidentified token",e[t],e,t),i=e[t],n="monom"))}return[i,t+i.length,n]}NextToken(e,t){let i,n,r;return this.NextToken2(e,t),i=e.substr(t).match(/^[0-9/a-zA-Z^]+/g)||[],e.substr(t,t+3).match(/^(sin|cos|tan)/g)?(n=e.substr(t,3),r="function"):i.length>0?(n=i[0],r="monom"):e[t].match(/[+\-*/^]/g)||e[t].match(/[&|!]/g)?(n=e[t],r="operation"):"("===e[t]?(n="(",r="("):")"===e[t]?(n=")",r=")"):","===e[t]?(n=",",r="function-argument"):(n=i[0],r="monom",""===n&&(n=e[t],r="monom",console.log("SHUTING YARD - NEXT TOKEN: error at ",t))),[n,t+n.length,r]}Uniformizer(e){if(!this._uniformize)return e;let t;t=e.replace(/\)\(/g,")*("),t=t.replace(/([\da-zA-Z])(\()/g,"$1*$2"),t=t.replace(/(\))([\da-zA-Z])/g,"$1*$2"),t=t.replace(/([0-9])([a-zA-Z])/g,"$1*$2"),t=t.replace(/([a-zA-Z])([0-9])/g,"$1*$2"),t=t.replace(/([abcxyz])([abcxyz])/g,"$1*$2");let i=["sin","cos","tan"];for(let e of i)t=t.replace(new RegExp(e+"\\*","g"),e);return t}parse(e,t){let i=[],n=[],r="",o=0,s="",a=0;e=this.Uniformizer(e);let l,h=50;for(;o<e.length;){if(h--,0===h){console.log("SECURITY LEVEL 1 EXIT");break}switch([r,o,s]=this.NextToken2(e,o),s){case"monom":case"coefficient":case"variable":i.push({token:r,tokenType:s});break;case"operation":if(a=n.length,n.length>0){let e=n[n.length-1];for(l=50;e.token in this._tokenConfig&&("left"===this._tokenConfig[r].associative&&this._tokenConfig[r].precedence<=this._tokenConfig[e.token].precedence||"right"===this._tokenConfig[r].associative&&this._tokenConfig[r].precedence<this._tokenConfig[e.token].precedence);){if(l--,0===l){console.log("SECURITY LEVEL 2 OPERATION EXIT");break}if(i.push(n.pop()||{token:"",tokenType:"operation"}),0===n.length)break;e=n[n.length-1]}}n.push({token:r,tokenType:s});break;case"function-argument":for(l=50;"("!==n[n.length-1].token&&n.length>0;){if(l--,0===l){console.log("SECURITY LEVEL 2 FUNCTION ARGUMENT EXIT");break}i.push(n.pop()||{token:r,tokenType:s})}break;case"(":n.push({token:r,tokenType:s}),"-"===e[o]&&i.push({token:"0",tokenType:"coefficient"});break;case")":for(l=50;"("!==n[n.length-1].token&&n.length>1;){if(l--,0===l){console.log("SECURITY LEVEL 2 CLOSING PARENTHESE EXIT");break}i.push(n.pop()||{token:r,tokenType:s})}n.pop();break;case"function":n.push({token:r,tokenType:s});break;default:console.log(`SHUTING YARD: ${s} : ${r} `)}}return this._rpn=i.concat(n.reverse()),this}get rpn(){return this._rpn}}}},t={};function i(n){var r=t[n];if(void 0!==r)return r.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,i),o.exports}(()=>{const e=i(956),t=i(505),n=i(984),r=i(534),o=i(667),s=i(272);window.Pi={ShutingYard:t.Shutingyard,Numeric:e.Numeric,Fraction:r.Fraction,Root:r.Nthroot,Monom:o.Monom,Polynom:o.Polynom,Equation:o.Equation,LinearSystem:o.LinearSystem,Rational:o.Rational,Logicalset:o.Logicalset,Random:n.Random,Geometry:{Vector:s.Vector,Point:s.Point,Line:s.Line,Triangle:s.Triangle,Circle:s.Circle}}})()})();
1
+ (()=>{"use strict";var e={760:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Equation=void 0;const n=i(38),r=i(956),o=i(534),s=i(534);class a{_left;_right;_sign;_polynom;_solutions;_varnothing="\\varnothing";_real="\\mathbb{R}";constructor(...e){if(this._left=(new n.Polynom).zero(),this._right=(new n.Polynom).zero(),this._sign="=",1===e.length){if(!0===e[0].isEquation)return e[0].clone();this.parse(e[0])}else{if(2!==e.length)return this;this.left=e[0]instanceof n.Polynom?e[0].clone():new n.Polynom(e[0]),this.right=e[1]instanceof n.Polynom?e[1].clone():new n.Polynom(e[1])}return this}get isEquation(){return!0}get solutions(){return this._solutions}get solution(){return 1!==this._solutions.length||this._solutions[0]!==this._real&&this._solutions[0]!==this._varnothing&&!this._solutions[0].includes("\\left")?`S = \\left{ ${this._solutions.join(";")} \\right}`:`S = ${this._solutions[0]}`}get isReal(){return void 0===this._solutions&&this.solve(),this._solutions[0]===this._real}get isVarnothing(){return void 0===this._solutions&&this.solve(),this._solutions[0]===this._varnothing}get signAsTex(){return">="===this._sign||"=>"===this._sign||"geq"===this._sign?"\\geq":"<="===this._sign||"=<"===this._sign||"leq"===this._sign?"\\leq":this._sign}get tex(){return`${this._left.tex}${this.signAsTex}${this._right.tex}`}get display(){return`${this._left.display}${this.signAsTex}${this._right.display}`}get raw(){return`${this._left.raw}${this.signAsTex}${this._right.raw}`}get variables(){return[...new Set(this._right.variables.concat(this._left.variables))]}get numberOfVars(){return this.variables.length}get left(){return this._left}set left(e){this._left=e}get right(){return this._right}set right(e){this._right=e}get sign(){return this._sign}set sign(e){this._sign=this._formatSign(e)}parse=e=>{let t,i;if(i=this._findSign(e),!1!==i)return t=e.split(i),this.create(new n.Polynom(t[0]),new n.Polynom(t[1]),this._formatSign(i));console.log("The equation is not valid (no sign found)")};_findSign=e=>e.includes("geq")?e.includes("\\geq")?"\\geq":"geq":e.includes("leq")?e.includes("\\leq")?"\\leq":"leq":e.includes(">=")?">=":e.includes("=>")?"=>":e.includes(">")?">":e.includes("<=")?"<=":e.includes("=<")?"=<":e.includes("<")?"<":e.includes("=")?"=":(console.log("Equation: parse string : sign not found"),!1);_formatSign=e=>void 0===e?"=":e.includes("geq")||e.includes(">=")||e.includes("=>")?">=":e.includes(">")?">":e.includes("leq")||e.includes("<=")||e.includes("=<")?"<=":e.includes("<")?"<":"=";_reverseSign=()=>"="===this._sign?this:this._sign.includes("<")?(this._sign.replace("<",">"),this):this._sign.includes(">")?(this._sign.replace(">","<"),this):this;create=(e,t,i)=>(this._left=e,this._right=t,this._sign=this._formatSign(i),this);clone=()=>(new a).create(this._left.clone(),this._right.clone(),this._sign+"");_randomizeDefaults={degree:2};get randomizeDefaults(){return this._randomizeDefaults}set randomizeDefaults(e){this._randomizeDefaults=e}randomize=(e,t)=>(new a).create(new n.Polynom,new n.Polynom,t);moveLeft=()=>(this._left=this._left.clone().subtract(this._right),this._right.zero(),this);reorder=e=>{if(this._left.subtract(this._right),this._right.zero(),e)return this.moveLeft();let t;for(let e of this._left.monoms)e.degree().isZero()&&(t=e.clone(),this._left.subtract(t),this._right.subtract(t));return this._left.reorder(),this._right.reorder(),this};simplify=()=>(this.multiply(r.Numeric.lcm(...this._left.getDenominators(),...this._right.getDenominators())),this.divide(r.Numeric.gcd(...this._left.getNumerators(),...this._right.getNumerators())),this);isolate=e=>{if(!this.degree(e).isOne())return!1;if(this.isMultiVariable())return!1;let t,i;this._left.subtract(this._right),this._right.zero();for(let i of this._left.monoms)i.hasLetter(e)||(t=i.clone(),this._left.add(t.clone().opposed()),this._right.add(t.clone().opposed()));return 1===this._left.length&&(i=this._left.monoms[0].coefficient.clone(),this._left.divide(i),this._right.divide(i),this)};replaceBy=(e,t)=>(this._left.replaceBy(e,t),this._right.replaceBy(e,t),this);multiply=e=>{let t=new o.Fraction(e);return this._left.multiply(t),this._right.multiply(t),"="!==this._sign&&-1===t.sign()&&this._reverseSign(),this};divide=e=>{let t=new o.Fraction(e);return t.isZero()?this:this.multiply(t.invert())};degree=e=>o.Fraction.max(this._left.degree(e),this._right.degree(e));isMultiVariable=()=>this._left.isMultiVariable||this._right.isMultiVariable;letters=()=>[...new Set([...this._left.letters(),...this._right.letters()])];solve=e=>{switch(this._solutions=[],this._polynom=this._left.clone().subtract(this._right),this._polynom.degree(e).value){case 0:case 1:this._solveDegree1(e);break;case 2:this._solveDegree2(e);break;default:this._solveDegree3plus(e)}return this};isGreater=()=>-1!==this._sign.indexOf(">")||-1!==this._sign.indexOf("geq");isStrictEqual=()=>"="===this._sign;isAlsoEqual=()=>-1!==this._sign.indexOf("=")||-1!==this._sign.indexOf("geq")||-1!==this._sign.indexOf("leq")||void 0;_solveDegree1=e=>{const t=this._polynom.monomByDegree(1,e).coefficient,i=this._polynom.monomByDegree(0,e).coefficient,n=i.clone().opposed().divide(t).display;let r;return this.isStrictEqual()?0===t.value?0===i.value?this._solutions=[this._real]:this._solutions=[this._varnothing]:this._solutions=[n]:(r=0===t.value?0===i.value&&this.isAlsoEqual()?"\\mathbb{R}":i.value>0?this.isGreater()?this._real:this._varnothing:this.isGreater()?this._varnothing:this._real:this.isGreater()&&1===t.sign()||!this.isGreater()&&-1===t.sign()?`\\left${this.isAlsoEqual()?"\\[":"\\]"}${n};+\\infty\\right\\[`:`\\left\\]-\\infty;${n} \\right\\${this.isAlsoEqual()?"\\]":"\\["}`,this._solutions=[r]),this._solutions};_solveDegree2=e=>{let t,i,n,a,l,h,c=this._polynom.monomByDegree(2,e).coefficient,u=this._polynom.monomByDegree(1,e).coefficient,f=this._polynom.monomByDegree(0,e).coefficient,m=r.Numeric.lcm(c.denominator,u.denominator,f.denominator),d=c.multiply(m).value,_=u.multiply(m).value;if(t=_*_-4*d*f.multiply(m).value,t>0)if(n=(-_-Math.sqrt(t))/(2*d),a=(-_+Math.sqrt(t))/(2*d),t>1e5)this._solutions=[((-_-Math.sqrt(t))/(2*d)).toFixed(5),((-_+Math.sqrt(t))/(2*d)).toFixed(5)];else if(i=(new s.Nthroot).parse(t).reduce(),i.hasRadical()){let e=r.Numeric.gcd(_,2*d,i.coefficient);i.coefficient=i.coefficient/e,this._solutions=0!==_?2*d/e==1?[`${-_/e} - ${i.tex}`,`${-_/e} + ${i.tex}`]:[`\\dfrac{${-_/e} - ${i.tex} }{ ${2*d/e} }`,`\\dfrac{${-_/e} + ${i.tex} }{ ${2*d/e} }`]:2*d/e==1?[`- ${i.tex}`,`${i.tex}`]:[`\\dfrac{- ${i.tex} }{ ${2*d/e} }`,`\\dfrac{${i.tex} }{ ${2*d/e} }`]}else this._solutions=[new o.Fraction(-_-i.coefficient,2*d).reduce().dfrac,new o.Fraction(-_+i.coefficient,2*d).reduce().dfrac];else this._solutions=0===t?[new o.Fraction(-_,2*d).reduce().dfrac]:[this._varnothing];return this.isStrictEqual()||(2===this._solutions.length?(l=n<a?this._solutions[0]:this._solutions[1],h=n<a?this._solutions[1]:this._solutions[0],this.isGreater()&&1===c.sign()||!this.isGreater()&&-1===c.sign()?this._solutions=[`\\left]-\\infty ; ${l}\\right${this.isAlsoEqual()?"]":"["} \\cup \\left${this.isAlsoEqual()?"[":"]"}${h};+\\infty\\right[`]:this._solutions=[`\\left${this.isAlsoEqual()?"[":"]"}${l} ; ${h}\\right${this.isAlsoEqual()?"]":"["}`]):1===this._solutions.length&&this._solutions[0]!==this._varnothing?this.isAlsoEqual()?(this.isGreater()&&1===c.sign()||!this.isGreater()&&-1===c.sign())&&(this._solutions=[this._real]):this.isGreater()&&1===c.sign()||!this.isGreater()&&-1===c.sign()?this._solutions=[`\\left]-\\infty ; ${this._solutions[0]}\\right[ \\cup \\left]${this._solutions[0]};+\\infty\\right[`]:this._solutions=[this._varnothing]:this.isGreater()?this._solutions=[1===c.sign()?this._real:this._varnothing]:this._solutions=[-1===c.sign()?this._real:this._varnothing]),this._solutions};_solveDegree3plus=e=>(this._solutions=[e],this._solutions)}t.Equation=a},667:function(e,t,i){var n=this&&this.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[i]}})}:function(e,t,i,n){void 0===n&&(n=i),e[n]=t[i]}),r=this&&this.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||n(t,e,i)};Object.defineProperty(t,"__esModule",{value:!0}),r(i(760),t),r(i(554),t),r(i(236),t),r(i(937),t),r(i(38),t),r(i(107),t)},554:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinearSystem=void 0;const n=i(534),r=i(760),o=i(38),s=i(984);class a{_solutions;_resolutionSteps;_equations;_letters;constructor(...e){return this._equations=[],this._letters="xy".split(""),void 0!==e&&e.length>0&&this.parse(...e),this}get isLinearSystem(){return!0}get equations(){return this._equations}set equations(e){this._equations=e}get letters(){return this._letters.join("")}set letters(e){this._letters=e.split("")}get isSolvable(){return this.variables.length===this._equations.length}get variables(){let e=[];for(let t of this._equations)e=e.concat(t.variables);return[...new Set(e)].sort()}get tex(){let e,t,i=this.clone().reorder(),n=i.variables,r=[];for(let o of i.equations){e=[];for(let i of n)t=o.left.monomByLetter(i),0===e.length?e.push(t.isZero()?"":t.tex):e.push(t.isZero()?"":(1===t.coefficient.sign()?"+":"")+t.tex);e.push("="),e.push(o.right.tex),r.push(e.join("&"))}return`\\left\\{\\begin{array}{${"r".repeat(n.length)}cl}${r.join("\\\\ ")}\\end{array}\\right.`}get texSolution(){let e=[];void 0===this._solutions&&this.solve();for(let t in this._solutions){if(this._solutions[t].isReal)return void console.log(`Undetermined (letter ${t})`);if(this._solutions[t].isVarnothing)return void console.log(`Undefined (letter ${t})`);e.push(this._solutions[t].value.dfrac)}return`(${e.join(";")})`}parse=(...e)=>(this._equations=e.map((e=>new r.Equation(e))),this._findLetters(),this);setCoefficient=(...e)=>{this._equations=[];let t=0;for(;t<e.length-this._letters.length;){let i=(new o.Polynom).parse(this._letters.join(""),...e.slice(t,t+this._letters.length)),n=new o.Polynom(e[t+this._letters.length].toString()),s=(new r.Equation).create(i,n);this._equations.push(s.clone()),t=t+this._letters.length+1}return this};clone=()=>(new a).parse(...this._equations.map((e=>e.clone())));setLetters=(...e)=>(this._letters=e,this);_findLetters=()=>{let e=new Set;for(let t of this._equations)e=new Set([...e,...t.variables]);return this._letters=[...e],this};generate=(...e)=>{let t=[];for(let i of e)"number"==typeof i?t.push(new n.Fraction(i.toString())):t.push(i.clone());this._equations=[];for(let i=0;i<e.length;i++)this._equations.push(this._generateOneEquation(...t));return this};_generateOneEquation=(...e)=>{let t,i=[],o=(new n.Fraction).zero(),a=["x","y","z","t","u","v","w","a","b","c","d","e","f","g","h","i","j","k","l"],l="";for(let t=0;t<e.length;t++)i.push(s.Random.numberSym(5)),o.add(e[t].clone().multiply(i[t])),l+=`${i[t]<0?i[t]:"+"+i[t]}${a[t]}`;return t=new r.Equation(`${l}=${o.display}`),1!=t.right.monoms[0].coefficient.denominator&&t.multiply(new n.Fraction(t.right.monoms[0].coefficient.denominator,1)),this._checkIfLinerCombination(t)?t:this._generateOneEquation(...e)};_linearReduction(e,t,i){let n=e.left.monomByDegree(1,i).coefficient.clone(),r=t.left.monomByDegree(1,i).coefficient.clone().opposed();return this.mergeEquations(e,t,r,n)}mergeEquations=(e,t,i,r)=>{let o=e.clone().multiply(new n.Fraction(i)),s=t.clone().multiply(new n.Fraction(r));return o.left.add(s.left),o.right.add(s.right),o};reorder=()=>{for(let e of this._equations)e.reorder();return this};solve=()=>{this._solutions={},this._resolutionSteps=[],this.reorder();let e=this.variables.sort();for(let t of e)this._solutions[t]=this._solveOneLetter(t,e);return this};_checkIfLinerCombination=e=>!0;_solveOneLetter(e,t){let i=this.clone().equations,r=[];for(let n of t)if(n!==e){for(let e=0;e<i.length-1;e++)r.push(this._linearReduction(i[e],i[e+1],n));this._resolutionSteps.push((new a).parse(...r)),i=this._resolutionSteps[this._resolutionSteps.length-1].clone().equations,r=[]}let o=this._resolutionSteps[this._resolutionSteps.length-1].equations[0];return o.solve(),{value:new n.Fraction(o.solutions[0]),isReal:o.isReal,isVarnothing:o.isVarnothing}}log=()=>{let e="";for(let t of this._equations)console.log(t.tex),e+=`${t.tex}\\n}`;return e}}t.LinearSystem=a},236:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Logicalset=void 0;const n=i(505);t.Logicalset=class{_rawString;_rpn;constructor(e){return this._rawString=e,this.parse(e),this}get isLogicalset(){return!0}parse=e=>(this._rpn=new n.Shutingyard("set").parse(e).rpn,this);evaluate(e,t){let i,n=[];if(void 0===t){i=new Set;for(let t in e)i=new Set([...i,...e[t]])}else i=new Set(t);for(let t of this._rpn)if("variable"===t.tokenType)void 0===e[t.token]?n.push(new Set):n.push(new Set(e[t.token]));else switch(t.token){case"&":if(n.length>=2){let e=n.pop(),t=n.pop();n.push(new Set([...t].filter((t=>e.has(t)))))}break;case"|":if(n.length>=2){let e=n.pop(),t=n.pop();n.push(new Set([...t,...e]))}break;case"-":if(n.length>=2){let e=n.pop(),t=n.pop();n.push(new Set([...t].filter((t=>!e.has(t)))))}break;case"!":if(n.length>=1){let e=n.pop();n.push(new Set([...i].filter((t=>!e.has(t)))))}}return[...n[0]].sort()}vennAB(){return this.evaluate({A:["A","AB"],B:["B","AB"]},["A","B","AB","E"])}vennABC(){return this.evaluate({A:["A","AB","AC","ABC"],B:["B","AB","BC","ABC"],C:["C","AC","BC","ABC"]},["A","B","C","AB","AC","BC","E"])}get rpn(){return this._rpn}get tex(){let e=[];for(let t of this._rpn)if("variable"===t.tokenType)e.push(t);else switch(t.token){case"&":if(e.length>=2){let t=e.pop(),i=e.pop();"mix"===i.tokenType&&(i.token=`( ${i.token} )`),"mix"===t.tokenType&&(t.token=`( ${t.token} )`),e.push({token:`${i.token} \\cap ${t.token}`,tokenType:"mix"})}break;case"|":if(e.length>=2){let t=e.pop(),i=e.pop();"mix"===i.tokenType&&(i.token=`( ${i.token} )`),"mix"===t.tokenType&&(t.token=`( ${t.token} )`),e.push({token:`${i.token} \\cup ${t.token}`,tokenType:"mix"})}break;case"-":if(e.length>=2){let t=e.pop(),i=e.pop();"mix"===i.tokenType&&(i.token=`( ${i.token} )`),"mix"===t.tokenType&&(t.token=`( ${t.token} )`),e.push({token:`${i.token} \\setminus ${t.token}`,tokenType:"mix"})}break;case"!":if(e.length>=1){let t=e.pop();e.push({token:`\\overline{ ${t.token} }`,tokenType:"variable"})}}return e[0].token}}},937:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Monom=void 0;const n=i(534),r=i(956),o=i(505);class s{_coefficient;_literal;constructor(e){return this.zero(),void 0!==e&&this.parse(e),this}get coefficient(){return this._coefficient}set coefficient(e){this._coefficient=e}get literal(){return this._literal}get literalSqrt(){if(this.isLiteralSquare()){let e={};for(let t in this._literal)e[t]=this._literal[t].clone().sqrt();return e}return this._literal}set literal(e){this._literal=e}set literalStr(e){for(const t of[...e.matchAll(/([a-z])\^([+-]?[0-9]+)/g)])t[1]in this._literal||(this._literal[t[1]]=(new n.Fraction).zero()),this._literal[t[1]].add(+t[2]);for(const t of[...e.matchAll(/([a-z](?!\^))/g)])t[1]in this._literal||(this._literal[t[1]]=(new n.Fraction).zero()),this._literal[t[1]].add(1)}get variables(){return this.clone().clean(),Object.keys(this._literal)}get display(){let e="",t=Object.keys(this._literal).sort();for(let i of t)this._literal[i].isNotZero()&&(e+=`${i}`,this._literal[i].isNotEqual(1)&&(e+=`^${this._literal[i].display}`));return""===e?0!=this._coefficient.value?`${this._coefficient.display}`:"":1===this._coefficient.value?e:-1===this._coefficient.value?`-${e}`:0===this._coefficient.value?"0":`${this._coefficient.display}${e}`}get dividers(){if(1!==this.coefficient.denominator)return[this.clone()];if(this.hasFractionCoefficient)return[this.clone()];if(this.coefficient.numerator>1e4)return[this.clone()];const e=r.Numeric.dividers(Math.abs(this.coefficient.numerator));let t=[];for(let e in this.literal)t=this._getLiteralDividers(t,e);const i=[];if(t.length>0&&e.length>0)for(let r of e)for(let e of t){let t=new s;t.coefficient=new n.Fraction(r),t.literal=e,i.push(t)}else if(0===e.length)for(let e of t){let t=new s;t.coefficient=(new n.Fraction).one(),t.literal=e,i.push(t)}else for(let t of e){let e=new s;e.coefficient=new n.Fraction(t),i.push(e)}return 0===i.length?[(new s).one()]:i}_getLiteralDividers(e,t){let i=[];for(let r=0;r<=this.literal[t].value;r++)if(0===e.length){let e={};e[t]=new n.Fraction(r),i.push(e)}else for(let o of e){let e={};for(let t in o)e[t]=o[t];e[t]=new n.Fraction(r),i.push(e)}return i}get displayWithSign(){let e=this.display;return("-"!==e[0]?"+":"")+e}get tex(){let e="",t=Object.keys(this._literal).sort();for(let i of t)this._literal[i].isNotZero()&&(e+=`${i}`,this._literal[i].isNotEqual(1)&&(e+=`^{${this._literal[i].display}}`));return""===e?0!=this._coefficient.value?`${this._coefficient.dfrac}`:"0":1===this._coefficient.value?e:-1===this._coefficient.value?`-${e}`:0===this._coefficient.value?"0":`${this._coefficient.dfrac}${e}`}parse=e=>(this._shutingYardToReducedMonom(e),this);_shutingYardToReducedMonom=e=>{const t=(new o.Shutingyard).parse(e).rpn;let i,r,a,l,h,c=[];if(0===t.length)return this.zero(),this;if(1===t.length){const e=t[0];return this.one(),"coefficient"===e.tokenType?this.coefficient=new n.Fraction(e.token):"variable"===e.tokenType&&this.setLetter(e.token,1),this}for(const e of t)if("coefficient"===e.tokenType){let t=(new s).one();t.coefficient=new n.Fraction(e.token),c.push(t.clone())}else if("variable"===e.tokenType){let t=(new s).one();t.setLetter(e.token,1),c.push(t.clone())}else if("operation"===e.tokenType)switch(e.token){case"-":h=c.pop()||(new s).zero(),l=c.pop()||(new s).zero(),c.push(l.subtract(h));break;case"*":h=c.pop()||(new s).one(),l=c.pop()||(new s).one(),c.push(l.multiply(h));break;case"^":r=c.pop().coefficient||(new n.Fraction).one(),i=c.pop()||(new s).one(),a=i.variables[0],void 0!==a&&i.setLetter(a,r),c.push(i)}return this.one(),this.multiply(c[0]),this};clone=()=>{let e=new s;e.coefficient=this._coefficient.clone();for(let t in this._literal)e.setLetter(t,this._literal[t].clone());return e};makeSame=e=>{for(let t in e._literal)this.setLetter(t,e._literal[t].clone());return this};zero=()=>(this._coefficient=(new n.Fraction).zero(),this._literal={},this);one=()=>(this._coefficient=(new n.Fraction).one(),this._literal={},this);clean=()=>{for(let e in this._literal)this._literal[e].isZero()&&delete this._literal[e];return this};opposed=()=>(this._coefficient.opposed(),this);add=(...e)=>{for(let t of e)this.isSameAs(t)?(this.isZero()&&this.makeSame(t),this._coefficient.add(t.coefficient)):console.log("Add: Is not similar: ",t.display);return this};subtract=(...e)=>{for(let t of e)this.isSameAs(t)?(this.isZero()&&this.makeSame(t),this._coefficient.add(t.clone().coefficient.opposed())):console.log("Subtract: Is not similar: ",t.display);return this};multiply=(...e)=>{for(let t of e){this._coefficient.multiply(t.coefficient);for(let e in t.literal)void 0===this._literal[e]?this._literal[e]=t.literal[e].clone():this._literal[e].add(t.literal[e])}return this};multiplyByNumber=e=>(this._coefficient.multiply(e),this);divide=(...e)=>{for(let t of e){this._coefficient.divide(t.coefficient);for(let e in t.literal)this._literal[e]=void 0===this._literal[e]?t.literal[e].clone().opposed():this._literal[e].subtract(t.literal[e]),this._literal[e].isZero()&&delete this._literal[e]}return this};pow=e=>{this._coefficient.pow(e);for(let t in this._literal)this._literal[t].pow(e);return this};root=e=>this;sqrt=()=>{if(this.isSquare()){this._coefficient.sqrt();for(let e in this._literal)this._literal[e].clone().divide(2)}return this.root(2)};compare=(e,t)=>{switch(void 0===t&&(t="="),t){case"=":return!!this.compare(e,"same")&&this._coefficient.isEqual(e.coefficient);case"same":let t=this.variables,i=e.variables,n=t.concat(i.filter((e=>t.indexOf(e)<0)));if(!this.isZero()&&!e.isZero())for(let t of n){if(void 0===this._literal[t]||void 0===e.literal[t])return!1;if(!this._literal[t].isEqual(e.literal[t]))return!1}return!0;default:return!1}};isZero(){return 0===this._coefficient.value}isOne(){return 1===this._coefficient.value&&0===this.variables.length}isEqual=e=>this.compare(e,"=");isSameAs=e=>this.compare(e,"same");isSquare=()=>!!this.coefficient.isSquare()&&this.isLiteralSquare();isLiteralSquare=()=>{for(let e in this.literal){if(this.literal[e].isRational())return!1;if(this.literal[e].isEven())return!1}return!0};hasFractionCoefficient=()=>{for(let e in this._literal)if(this._literal[e].isRational())return!0;return!1};hasLetter=e=>void 0!==this._literal[void 0===e?"x":e]&&this._literal[void 0===e?"x":e].isNotZero();setLetter=(e,t)=>{t instanceof n.Fraction?(this.hasLetter(e)&&t.isZero()&&delete this._literal[e],this._literal[e]=t.clone()):this.setLetter(e,new n.Fraction(t))};degree=e=>0===this.variables.length?(new n.Fraction).zero():void 0===e?Object.values(this._literal).reduce(((e,t)=>e.clone().add(t))):void 0===this._literal[e]?(new n.Fraction).zero():this._literal[e].clone();evaluate=e=>{let t=this.coefficient.clone();if("number"==typeof e||e instanceof n.Fraction){let t={};return t[this.variables[0]]=new n.Fraction(e),this.evaluate(t)}if("object"==typeof e)for(let i in this._literal){if(void 0===e[i])return(new n.Fraction).zero();let r=new n.Fraction(e[i]);t.multiply(r.pow(this._literal[i]))}return t};derivative=e=>{if(void 0===e&&(e="x"),this.hasLetter(e)){let t=this._literal[e].clone(),i=this.clone();return i._literal[e].subtract(1),i._coefficient.multiply(new n.Fraction(t.clone())),i}return(new s).zero()};primitive=e=>{void 0===e&&(e="x");let t,i=this.clone();return i.hasLetter(e)?(t=i.degree(e).clone().add(1),i.coefficient=i.coefficient.clone().divide(t),i.setLetter(e,t)):(i.coefficient.isZero()&&(i.coefficient=(new n.Fraction).one()),i.setLetter(e,1)),i};static lcm=(...e)=>{for(let t of e)if(t.hasFractionCoefficient())return(new s).zero();let t=new s,i=e.map((e=>e.coefficient.numerator)),o=e.map((e=>e.coefficient.denominator)),a=r.Numeric.gcd(...i),l=r.Numeric.lcm(...o);t.coefficient=new n.Fraction(a,l).reduce();for(let i of e){for(let e in t.literal)e in i.literal||t.literal[e].zero();for(let e in i.literal)void 0===t.literal[e]&&i.literal[e].isStrictlyPositive()?t.literal[e]=i.literal[e].clone():t.literal[e]=new n.Fraction(Math.min(i.literal[e].value,t.literal[e].value))}return t};static xmultiply=(...e)=>{let t=(new s).one();for(let i of e)t.multiply(i);return t};areSameAs=(...e)=>{for(let t=0;t<e.length;t++)if(!this.isSameAs(e[t]))return!1;return!0};areEquals=(...e)=>{if(!this.areSameAs(...e))return!1;for(let t of e)if(!this._coefficient.isEqual(t.coefficient))return!1;return!0}}t.Monom=s},38:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Polynom=void 0;const n=i(937),r=i(505),o=i(956),s=i(534);class a{_rawString;_monoms;_factors;_texString;constructor(e,...t){return this._monoms=[],this._factors=[],void 0!==e&&this.parse(e,...t),this}get monoms(){return this._monoms}set monoms(e){this._monoms=e}get factors(){return this._factors}set factors(e){this._factors=e}get texFactors(){this.factorize();let e="";for(let t of this.factors)t.monoms.length>1?e+=`(${t.tex})`:e=t.tex+e;return e}get texString(){return this._texString}get length(){return this._monoms.length}get display(){return this.genDisplay()}get raw(){return this._rawString}get tex(){return this.genDisplay("tex")}get isMultiVariable(){for(const e of this._monoms)if(e.variables.length>1)return!0;return!1}get variables(){let e=[];for(const t of this._monoms)e=e.concat(t.variables);return e=[...new Set(e)],e}get numberOfVars(){return this.variables.length}genDisplay=(e,t,i)=>{let n="";for(const i of this._monoms)0!==i.coefficient.value&&(n+=`${1!==i.coefficient.sign()||""===n&&!0!==t?"":"+"}${"tex"===e?i.tex:i.display}`);return!0===i&&this.length>1&&(n="tex"===e?`\\left( ${n} \\right)`:`(${n})`),""===n&&(n="0"),n};parse=(e,...t)=>{if(void 0===t||0===t.length){if(e=""+e,this._rawString=e,""!==e&&!isNaN(Number(e))){this.empty();let t=new n.Monom(e);return this.add(t),this}return this.shutingYardToReducedPolynom(e)}if(/^[a-z]/.test(e)){this.empty();let i=t.map((e=>new s.Fraction(e)));if(e.length>1){let t=e.split(""),r=0;for(let e of i){let i=new n.Monom;i.coefficient=e.clone(),i.literalStr=t[r]||"",this.add(i),r++}}else{let t=i.length-1;for(let r of i){let i=new n.Monom;i.coefficient=r.clone(),i.literalStr=`${e}^${t}`,this.add(i),t--}}return this}return this.zero()};shutingYardToReducedPolynom=e=>{const t=(new r.Shutingyard).parse(e).rpn;let i,o,s,l=[],h=null;for(const e of t){if("coefficient"===e.tokenType||"variable"===e.tokenType)s=(new a).zero(),s.monoms=[new n.Monom(e.token)],l.push(s.clone());else if("operation"===e.tokenType)switch(o=l.pop()||(new a).zero(),i=l.pop()||(new a).zero(),e.token){case"+":l.push(i.add(o));break;case"-":l.push(i.subtract(o));break;case"*":l.push(i.multiply(o));break;case"^":l.push(i.pow(+h))}h=e.token}return this._monoms=l[0].monoms,this};clone=()=>{const e=new a,t=[];for(const e of this._monoms)t.push(e.clone());return e.monoms=t,e};zero=()=>(this._monoms=[],this._monoms.push((new n.Monom).zero()),this._rawString="0",this);one=()=>(this._monoms=[],this._monoms.push((new n.Monom).one()),this._rawString="1",this);empty=()=>(this._monoms=[],this._rawString="",this);opposed=()=>(this._monoms=this._monoms.map((e=>e.opposed())),this);add=(...e)=>{for(let t of e)t instanceof a?this._monoms=this._monoms.concat(t.monoms):t instanceof n.Monom?this._monoms.push(t.clone()):Number.isSafeInteger(t)?this._monoms.push(new n.Monom(t.toString())):this._monoms.push(new n.Monom(t));return this.reduce()};subtract=(...e)=>{for(let t of e)t instanceof a?this._monoms=this._monoms.concat(t.clone().opposed().monoms):t instanceof n.Monom?this._monoms.push(t.clone().opposed()):Number.isSafeInteger(t)?this._monoms.push(new n.Monom(t.toString()).opposed()):this._monoms.push(new n.Monom(t).opposed());return this.reduce()};multiply=e=>e instanceof a?this.multiplyByPolynom(e):e instanceof s.Fraction?this.multiplyByFraction(e):e instanceof n.Monom?this.multiplyByMonom(e):Number.isSafeInteger(e)?this.multiplyByInteger(e):this;multiplyByPolynom=e=>{const t=[];for(const i of this._monoms)for(const r of e.monoms)t.push(n.Monom.xmultiply(i,r));return this._monoms=t,this.reduce()};multiplyByFraction=e=>{for(const t of this._monoms)t.coefficient.multiply(e);return this.reduce()};multiplyByInteger=e=>this.multiplyByFraction(new s.Fraction(e));multiplyByMonom=e=>{for(const t of this._monoms)t.multiply(e);return this.reduce()};euclidian=e=>{const t=e.variables[0],i=(new a).zero(),n=this.clone().reorder(t);if(0===e.variables.length)return{quotient:i,reminder:n};const r=e.monomByDegree(void 0,t),o=e.degree(t);let s,l=this.degree(t).clone().multiply(2);for(;n.degree(t)>=o&&l.isPositive()&&(l.subtract(1),s=n.monomByDegree(void 0,t).clone().divide(r),!s.isZero());)i.add(s),n.subtract(e.clone().multiply(s));return{quotient:i,reminder:n}};divide=e=>{if(e.isFraction)this.divideByFraction(e);else if(Number.isSafeInteger(e))return this.divideByInteger(e)};divideByInteger=e=>{const t=new s.Fraction(e);for(const e of this._monoms)e.coefficient.divide(t);return this};divideByFraction=e=>{for(const t of this._monoms)t.coefficient.divide(e);return this};pow=e=>{if(!Number.isSafeInteger(e))return this.zero();if(e<0)return this.zero();if(0===e)return new a;const t=this.clone();for(let i=1;i<e;i++)this.multiply(t);return this.reduce()};compare=(e,t)=>{void 0===t&&(t="=");const i=this.clone().reduce().reorder(),n=e.clone().reduce().reorder();switch(t){case"=":if(i.length!==n.length||i.degree().isNotEqual(n.degree()))return!1;for(const e in i.monoms)if(!i.monoms[e].isEqual(n.monoms[e]))return!1;return!0;case"same":if(i.length!==n.length||i.degree()!==n.degree())return!1;for(const e in i.monoms)if(!i.monoms[e].isSameAs(n.monoms[e]))return!1;return!0;default:return!1}};isZero(){return 1===this._monoms.length&&this._monoms[0].coefficient.isZero()||0===this._monoms.length}isOne(){return 1===this._monoms.length&&this._monoms[0].coefficient.isOne()}isEqual=e=>this.compare(e,"=");isSameAs=e=>this.compare(e,"same");isOpposedAt=e=>this.compare(e.clone().opposed(),"=");isFactorized=e=>{let t;if(e.match(/\(/g).length!==e.match(/\)/g).length)return!1;try{t=new a(e)}catch(e){return!1}if(!this.isEqual(t))return!1;let i=e.replaceAll("*",""),n=""+i,r=[];for(let e of i.matchAll(/\(([a-z0-9+\-]+)\)(\^[0-9]*)?/g)){if(void 0!==e[2])for(let t=0;t<+e[2].substr(1);t++)r.push(e[1]);else r.push(e[1]);n=n.replaceAll(e[0],"")}""!==n&&r.push(n);let o=r.map((e=>new a(e)));this.factorize();let s=1;for(let e of this.factors)for(let t=0;t<o.length;t++){if(e.isEqual(o[t])){o.splice(t,1);break}if(e.isOpposedAt(o[t])){o.splice(t,1),s=-s;break}}return 0===o.length&&1===s};isDeveloped=e=>{let t;if(e.match(/\(/g).length+e.match(/\)/g).length)return!1;try{t=new a(e)}catch(e){return!1}return!!this.isEqual(t)&&e.replaceAll("[*s]","")===t.reduce().reorder().display};reduce=()=>{for(let e=0;e<this._monoms.length;e++)for(let t=e+1;t<this._monoms.length;t++)this._monoms[e].isSameAs(this.monoms[t])&&(this._monoms[e].add(this.monoms[t]),this._monoms.splice(t,1));this._monoms=this._monoms.filter((e=>0!==e.coefficient.value));for(const e of this._monoms)e.coefficient.reduce();return 0===this.length?(new a).zero():this};reorder=(e="x")=>(this._monoms.sort((function(t,i){return i.degree(e).clone().subtract(t.degree(e)).value})),this.reduce());degree=e=>{let t=(new s.Fraction).zero();for(const i of this._monoms)t=s.Fraction.max(i.degree(e).value,t);return t};letters=()=>{let e=new Set;for(let t of this._monoms)e=new Set([...e,...t.variables]);return[...e]};replaceBy=(e,t)=>{let i;const n=(new a).zero();for(const r of this.monoms)void 0===r.literal[e]||r.literal[e].isZero()?n.add(r.clone()):(i=r.literal[e].clone(),delete r.literal[e],n.add(t.clone().pow(Math.abs(i.numerator)).multiply(r)));return this._monoms=n.reduce().reorder().monoms,this};evaluate=e=>{const t=(new s.Fraction).zero();return this._monoms.forEach((i=>{t.add(i.evaluate(e))})),t};derivative=e=>{let t=new a;for(let i of this._monoms)t.add(i.derivative(e));return t};primitive=e=>{let t=new a;for(let i of this._monoms)t.add(i.primitive(e));return t};integrate=(e,t,i)=>{const n=this.primitive(i);void 0===i&&(i="x");let r={},o={};return r[i]=new s.Fraction(e),o[i]=new s.Fraction(t),n.evaluate(o).subtract(n.evaluate(r))};factorize=e=>{let t,i=[],n=this.clone().reorder(),r=n.commonMonom();r.isOne()||(t=new a,t.monoms=[r],i=[t.clone()],n=n.euclidian(t).quotient);let o=n.degree().clone().multiply(2).value;for(;o>=0;){if(o--,n.monoms.length<2){n.isOne()||i.push(n.clone());break}{let e=n.monoms[0].dividers,t=n.monoms[n.monoms.length-1].dividers;for(let r of e)for(let e of t){let t,o=new a;o.monoms=[r.clone(),e.clone()],t=n.euclidian(o),t.reminder.isZero()?(n=t.quotient.clone(),i.push(o)):(o.monoms=[r.clone(),e.clone().opposed()],t=n.euclidian(o),t.reminder.isZero()&&(n=t.quotient.clone(),i.push(o)))}}}return this.factors=i,i};_factorize2ndDegree=e=>{let t,i,n,r,o,s,l,h,c;if(1===this.numberOfVars)return n=this.monomByDegree(2,e).coefficient,r=this.monomByDegree(1,e).coefficient,o=this.monomByDegree(0,e).coefficient,s=r.clone().pow(2).subtract(n.clone().multiply(o).multiply(4)),s.isZero()?(l=r.clone().opposed().divide(n.clone().multiply(2)),t=new a(e).subtract(l.display).multiply(l.denominator),i=new a(e).subtract(l.display).multiply(l.denominator),c=n.divide(l.denominator).divide(l.denominator),c.isOne()?[t,i]:[new a(c.display),t,i]):s.isPositive()&&s.isSquare()?(l=r.clone().opposed().add(s.clone().sqrt()).divide(n.clone().multiply(2)),h=r.clone().opposed().subtract(s.clone().sqrt()).divide(n.clone().multiply(2)),c=n.divide(l.denominator).divide(h.denominator),c.isOne()?[new a(e).subtract(l.display).multiply(l.denominator),new a(e).subtract(h.display).multiply(h.denominator)]:[new a(c.display),new a(e).subtract(l.display).multiply(l.denominator),new a(e).subtract(h.display).multiply(h.denominator)]):[this.clone()];if(n=this.monomByDegree(2,e),r=this.monomByDegree(1,e),o=this.monomByDegree(0,e),n.isLiteralSquare()&&o.isLiteralSquare()&&r.clone().pow(2).isSameAs(n.clone().multiply(o))){let e,t=new a("x",n.coefficient,r.coefficient,o.coefficient)._factorize2ndDegree("x"),i=[];if(t.length>=2){for(let r of t)r.degree().isZero()?i.push(r.clone()):(e=r.clone(),e.monoms[0].literal=n.literalSqrt,e.monoms[1].literal=o.literalSqrt,i.push(e.clone()));return i}}return[this.clone()]};_factorizeByGroups=()=>[];getZeroes=()=>{switch(this.degree().value){case 0:return 0===this._monoms[0].coefficient.value?[!0]:[!1];case 1:if(1===this._monoms.length)return[(new s.Fraction).zero()];{const e=this.clone().reduce().reorder();return[e.monoms[1].coefficient.opposed().divide(e.monoms[0].coefficient)]}default:0===this._factors.length&&this.factorize();let e=[],t=[];for(let i of this._factors)if(i.degree().greater(2));else if(2===i.degree().value){let t=i.monomByDegree(2).coefficient,n=i.monomByDegree(1).coefficient,r=i.monomByDegree(0).coefficient,o=n.clone().pow(2).subtract(t.clone().multiply(r).multiply(4));if(o.value>0){let i=(-n.value+Math.sqrt(o.value))/(2*t.value),r=(-n.value-Math.sqrt(o.value))/(2*t.value);e.push(new s.Fraction(i.toFixed(3)).reduce()),e.push(new s.Fraction(r.toFixed(3)).reduce())}else 0===o.value||console.log("No zero for ",i.tex)}else for(let n of i.getZeroes())!1!==n&&!0!==n&&-1===t.indexOf(n.frac)&&(e.push(n),t.push(n.frac));return e}return[]};monomByDegree=(e,t)=>{if(void 0===e)return this.monomByDegree(this.degree(t),t);const i=this.clone().reduce();for(const n of i._monoms)if(n.degree(t).isEqual(e))return n.clone();return(new n.Monom).zero()};monomsByDegree=(e,t)=>{if(void 0===e)return this.monomsByDegree(this.degree(t));let i=[];const n=this.clone().reduce();for(const r of n._monoms)r.degree(t)===e&&i.push(r.clone());return i};monomByLetter=e=>{const t=this.clone().reduce();for(const i of t._monoms)if(i.hasLetter(e))return i.clone();return(new n.Monom).zero()};getDenominators=()=>{const e=[];for(const t of this._monoms)e.push(t.coefficient.denominator);return e};getNumerators=()=>{const e=[];for(const t of this._monoms)e.push(t.coefficient.numerator);return e};lcmDenominator=()=>o.Numeric.lcm(...this.getDenominators());gcdDenominator=()=>o.Numeric.gcd(...this.getDenominators());lcmNumerator=()=>o.Numeric.lcm(...this.getNumerators());gcdNumerator=()=>o.Numeric.gcd(...this.getNumerators());commonMonom=()=>{let e,t,i=(new n.Monom).one(),r=this.degree();e=this.gcdNumerator(),t=this.gcdDenominator(),i.coefficient=new s.Fraction(e,t);for(let e of this.variables){i.setLetter(e,r);for(let t of this._monoms)if(i.setLetter(e,s.Fraction.min(t.degree(e),i.degree(e))),i.degree(e).isZero())break}return i}}t.Polynom=a},107:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Rational=void 0;const n=i(38),r=i(506);t.Rational=class{_rawString;_numerator;_denominator;constructor(e,t){this._numerator=e?e.clone():new n.Polynom,this._denominator=t?t.clone():new n.Polynom}clone=()=>(this._numerator=this._numerator.clone(),this._denominator=this._denominator.clone(),this);get tex(){return`\\dfrac{ ${this._numerator.tex} }{ ${this._denominator.tex} }`}get texFactors(){return this._numerator.factorize(),this._denominator.factorize(),`\\dfrac{ ${this._numerator.texFactors} }{ ${this._denominator.texFactors} }`}get numerator(){return this._numerator}get denominator(){return this._denominator}domain=()=>{let e=this._denominator.getZeroes();return 0===e.length||!1===e[0]?"\\mathbb{R}":!0===e[0]?"\\varnothing":"\\mathbb{R}\\setminus\\left{"+e.map((e=>"boolean"==typeof e?"":e.frac)).join(";")+"\\right}"};amplify=e=>(this._numerator.multiply(e),this._denominator.multiply(e),this);simplify=e=>{let t=this._numerator.euclidian(e);if(!t.reminder.isZero())return this;let i=this._denominator.euclidian(e);return i.reminder.isZero()?(this._numerator=t.quotient,this._denominator=i.quotient,this):this};reduce=()=>{console.log(this._numerator.tex),this._numerator.factorize(),console.log(this._numerator.factors.map((e=>e.tex)));for(let e of this._numerator.factors)this.simplify(e);return this};opposed=()=>(this._numerator.opposed(),this);add=e=>{let t=this._denominator.clone();return this.amplify(e._denominator),this._numerator.add(e._numerator.clone().multiply(t)),this};subtract=e=>this.add(e.clone().opposed());limits=(e,t)=>{if(e!==1/0&&e!==-1/0)return this._numerator.evaluate({letter:new r.Fraction(e)}).divide(this._denominator.evaluate({letter:new r.Fraction(e)}));{let i=this._numerator.monomByDegree(this._numerator.degree(t),t),n=this._denominator.monomByDegree(this._denominator.degree(t),t);if(i.divide(n),i.degree(t).isStrictlyPositive())return i.coefficient.sign()*Math.pow(e>0?1:-1,i.degree(t).value%2)==1?1/0:-1/0;if(i.degree(t).isZero())return i.coefficient;if(i.degree(t).isStrictlyPositive())return i.coefficient.sign()*Math.pow(-1,i.degree(t).value%2)==1?0:-0}}}},506:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Fraction=void 0;const n=i(956);class r{_numerator;_denominator;constructor(e,t){return this._numerator=1,this._denominator=1,void 0!==e&&this.parse(e,t),this}get isFraction(){return!0}get numerator(){return this._numerator}set numerator(e){this._numerator=e}get denominator(){return this._denominator}set denominator(e){this._denominator=e}get value(){return this._numerator/this._denominator}get tex(){return 1===this._denominator?`${this._numerator}`:this._numerator<0?`-\\frac{ ${-this._numerator} }{ ${this._denominator} }`:`\\frac{ ${this._numerator} }{ ${this._denominator} }`}get display(){return 1===this._denominator?`${this._numerator}`:`${this._numerator}/${this._denominator}`}get frac(){return this.tex}get dfrac(){return this.tex.replace("\\frac","\\dfrac")}parse=(e,t)=>{let i;if(null===e||""===e)return this._numerator=0,this._denominator=1,this;switch(typeof e){case"string":if(i=e.split("/"),i.length>2)throw"Two many divide signs";if(i.map((e=>""===e||isNaN(Number(e)))).includes(!0))throw"Not a number";if(1===i.length)return this.parse(+i[0]);2===i.length?"0"===i[1]?(this._numerator=NaN,this._denominator=1):(this._numerator=+i[0],this._denominator=+i[1]):(this._numerator=NaN,this._denominator=1);break;case"number":if(Number.isSafeInteger(e))this._numerator=+e,void 0!==t&&Number.isSafeInteger(t)?this._denominator=+t:this._denominator=1;else{let i=e.toString().split(".")[1].length;void 0===t?(this._numerator=e*Math.pow(10,i),this._denominator=Math.pow(10,i)):Number.isSafeInteger(t)&&(this._numerator=e*Math.pow(10,i)-Math.floor(e*Math.pow(10,i-t)),this.denominator=Math.pow(10,i)-Math.pow(10,i-t))}break;case"object":e.isFraction&&(this._numerator=+e.numerator,this._denominator=+e.denominator)}return this};clone=()=>{let e=new r;return e.numerator=+this._numerator,e.denominator=+this._denominator,e};zero=()=>(this._numerator=0,this._denominator=1,this);one=()=>(this._numerator=1,this._denominator=1,this);infinite=()=>(this._numerator=1/0,this._denominator=1,this);invalid=()=>(this._numerator=NaN,this._denominator=1,this);opposed=()=>(this._numerator=-this._numerator,this);add=e=>{if(!(e instanceof r))return this.add(new r(e));{let t=this._numerator,i=this._denominator;this._numerator=t*e.denominator+e.numerator*i,this._denominator=i*e.denominator}return this.reduce()};subtract=e=>e instanceof r?this.add(e.clone().opposed()):this.add(-e);multiply=e=>{let t=new r(e);return this._numerator=this._numerator*t.numerator,this._denominator=this._denominator*t.denominator,this.reduce()};divide=e=>{let t=new r(e);if(0===t.numerator)return(new r).infinite();let i=+this._numerator,n=+this._denominator;return this._numerator=i*t.denominator,this._denominator=n*t.numerator,this.reduce()};invert=()=>{let e=+this._numerator,t=+this._denominator;return this._numerator=t,this._denominator=e,this};pow=e=>e instanceof r?this.pow(e.value):Number.isSafeInteger(e)?(this.reduce(),e<0&&this.invert(),this._numerator=this._numerator**Math.abs(e),this._denominator=this._denominator**Math.abs(e),this):this.invalid();root=e=>(0===e||(e<0&&this.invert(),Math.pow(this._numerator,Math.abs(1/e)),Math.pow(this._denominator,Math.abs(1/e)),this._numerator=Math.pow(this._numerator,Math.abs(1/e)),this._denominator=Math.pow(this._denominator,Math.abs(1/e))),this);sqrt=()=>this.root(2);abs=()=>(this._numerator=Math.abs(this._numerator),this._denominator=Math.abs(this._denominator),this);static max=(...e)=>{let t=new r(e[0]);for(let i of e){let e=new r(i);e.greater(t)&&(t=e.clone())}return t};static min=(...e)=>{let t=new r(e[0]);for(let i of e){let e=new r(i);e.lesser(t)&&(t=e.clone())}return t};reduce=()=>{let e=n.Numeric.gcd(this._numerator,this._denominator);return this._numerator=this._numerator/e,this._denominator=this._denominator/e,this._denominator<0&&(this._denominator=-this._denominator,this._numerator=-this._numerator),this};amplify=e=>(Number.isSafeInteger(e)&&(this._numerator*=e,this._denominator*=e),this);compare=(e,t)=>{let i;switch(void 0===t&&(t="="),i=e instanceof r?e.clone():new r(e),t){case">":return this.value>i.value;case">=":return this.value>=i.value;case"<":return this.value<i.value;case"<=":return this.value<=i.value;case"=":return this.value===i.value;case"<>":return this.value!==i.value;default:return!1}};lesser=e=>this.compare(e,"<");leq=e=>this.compare(e,"<=");greater=e=>this.compare(e,">");geq=e=>this.compare(e,">=");isEqual=e=>this.compare(e,"=");isNotEqual=e=>this.compare(e,"<>");isOpposed=e=>this.isEqual(e.clone().opposed());isInverted=e=>this.isEqual((new r).one().divide(e.clone()));isZero=()=>0===this._numerator;isNotZero=()=>0!==this._numerator;isOne=()=>1===this._numerator&&1===this._denominator;isNegativeOne=()=>-1===this._numerator&&1===this._denominator;isPositive=()=>1===this.sign();isNegative=()=>-1===this.sign();isStrictlyPositive=()=>this.value>0;isStrictlyNegative=()=>this.value<0;isNaN=()=>isNaN(this._numerator);isInfinity=()=>this._numerator===1/0;isFinite=()=>!this.isInfinity();isSquare=()=>Math.sqrt(this._numerator)%1==0&&Math.sqrt(this._denominator)%1==0;isReduced=()=>1===Math.abs(n.Numeric.gcd(this._numerator,this._denominator));isNatural=()=>1===this.clone().reduce().denominator;isRational=()=>!this.isNatural();isEven=()=>this.isNatural()&&this.value%2==0;isOdd=()=>this.isNatural()&&this.value%2==1;sign=()=>this._numerator*this._denominator>=0?1:-1;areEquals=(...e)=>{for(let t=0;t<e.length;t++)if(!this.isEqual(e[t]))return!1;return!0}}t.Fraction=r},534:function(e,t,i){var n=this&&this.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[i]}})}:function(e,t,i,n){void 0===n&&(n=i),e[n]=t[i]}),r=this&&this.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||n(t,e,i)};Object.defineProperty(t,"__esModule",{value:!0}),r(i(506),t),r(i(330),t)},330:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Nthroot=void 0,t.Nthroot=class{_radical;_nth;_coefficient;_isValid;constructor(){this._radical=1,this._coefficient=1,this._nth=2,this._isValid=!0}get radical(){return this._radical}set radical(e){this._radical=e}get nth(){return this._nth}set nth(e){Number.isSafeInteger(e)&&e>=2?this._nth=e:(console.log("Error setting the nth root"),this._nth=2)}get coefficient(){return this._coefficient}set coefficient(e){this._coefficient=e}get tex(){let e;return e=1===this._coefficient?"":-1===this._coefficient?"-":this._coefficient.toString(),1===this._radical?`${this._coefficient}`:2===this._nth?`${e}\\sqrt{${this._radical}}`:`${e}\\sqrt[${this._nth}]{${this._radical}}`}get value(){return this._coefficient*Math.pow(this._radical,1/this._nth)}parse=(e,t,i)=>(this._coefficient=void 0===i?1:i,this._nth=void 0===t?2:t,this._radical=void 0===e?1:e,this._nth%2==0&&this._radical<0&&(this._isValid=!1),this);reduce=()=>{let e=Math.floor(Math.pow(this._radical,1/this._nth));for(;e>1;)this._radical%Math.pow(e,this._nth)!=0?e--:(this._coefficient*=e,this._radical=this._radical/Math.pow(e,this._nth),e=Math.floor(Math.pow(this._radical,1/this._nth)));return this};multiply=e=>(this._radical*=e.radical,this.reduce());hasRadical=()=>!(1===this._radical||0===this._radical||!1===this._isValid)}},699:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Circle=void 0;const n=i(557),r=i(534),o=i(667),s=i(586);t.Circle=class{_center;_radius;_squareRadius;_cartesian;_exists;constructor(...e){this._exists=!1,void 0!==e&&this.parse(...e)}get center(){return this._center}get radius(){return this._squareRadius.isSquare()?{tex:this._squareRadius.clone().sqrt().tex,display:this._squareRadius.clone().sqrt().display}:{tex:`\\sqrt{${this._squareRadius.tex}}`,display:`sqrt(${this._squareRadius.display})`}}get tex(){let e,t;return e=this._center.x.isZero()?"x^2":`\\left(x${this._center.x.isNegative()?"+":"-"}${this._center.x.clone().abs().tex}\\right)^2`,t=this._center.y.isZero()?"y^2":`\\left(y${this._center.y.isNegative()?"+":"-"}${this._center.y.clone().abs().tex}\\right)^2`,`${e}+${t}=${this._squareRadius.tex}`}get developed(){return this._cartesian.tex}get display(){return this._cartesian.display}get cartesian(){return this._cartesian}parse(...e){1===e.length&&"string"==typeof e[0]?this.checkCircle(new o.Equation(e[0])):e.length>=2&&(this._center=new n.Point(e[0]),e[1]instanceof n.Point?this._squareRadius=new s.Vector(this._center,e[1]).normSquare:!0===e[2]?this._squareRadius=new r.Fraction(e[1]):(this._radius=new r.Fraction(e[1]),this._squareRadius=this._radius.clone().pow(2)),this._cartesian=new o.Equation(new o.Polynom(`(x-(${this._center.x.display}))^2+(y-(${this._center.y.display}))^2`),new o.Polynom(`${this._squareRadius.display}`)).moveLeft())}checkCircle=e=>{if(2===e.degree("x").value&&2===e.degree("y").value){let t,i,r,o=e.left.monomByDegree(2,"x"),s=e.left.monomByDegree(2,"y");o.coefficient.isEqual(s.coefficient)&&(e.divide(o.coefficient),t=e.left.monomByDegree(1,"x"),i=e.left.monomByDegree(1,"y"),r=e.left.monomByDegree(0),this._center=new n.Point(t.coefficient.clone().divide(2).opposed(),i.coefficient.clone().divide(2).opposed()),this._squareRadius=r.coefficient.clone().opposed().add(this._center.x.clone().pow(2)).add(this._center.y.clone().pow(2)))}return!1};relativePosition=e=>{let t=e.distanceTo(this.center),i=Math.sqrt(this._squareRadius.value);return t.value-i>1e-10?0:Math.abs(t.value-i)<1e-10?1:2};lineIntersection=e=>{const t=this._cartesian.clone(),i=e.equation.clone().isolate("y");return i instanceof o.Equation&&(t.replaceBy("y",i.right),t.solve()),[]}}},272:function(e,t,i){var n=this&&this.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[i]}})}:function(e,t,i,n){void 0===n&&(n=i),e[n]=t[i]}),r=this&&this.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||n(t,e,i)};Object.defineProperty(t,"__esModule",{value:!0}),r(i(586),t),r(i(164),t),r(i(557),t),r(i(699),t),r(i(9),t)},9:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Line=void 0;const n=i(534),r=i(586),o=i(557),s=i(667),a=i(956);var l;!function(e){e[e.None=0]="None",e[e.Parallel=1]="Parallel",e[e.Perpendicular=2]="Perpendicular"}(l||(l={}));class h{_a;_b;_c;_OA;_d;_n;_exists;_referencePropriety;_referenceLine;static PERPENDICULAR=l.Perpendicular;static PARALLEL=l.Parallel;constructor(...e){return this._exists=!1,e.length>0&&this.parse(...e),this}get isLine(){return!0}get exists(){return this._exists}get equation(){return new s.Equation((new s.Polynom).parse("xy",this._a,this._b,this._c),new s.Polynom("0")).simplify()}get tex(){let e=this.equation;return this._a.isNegative()&&e.multiply(-1),{canonical:e.tex,mxh:this.slope.isInfinity()?"x="+this.OA.x.tex:"y="+(new s.Polynom).parse("x",this.slope,this.height).tex,parametric:`${o.Point.pmatrix("x","y")} = ${o.Point.pmatrix(this._OA.x,this._OA.y)} + k\\cdot ${o.Point.pmatrix(this._d.x,this._d.y)}`}}get a(){return this._a}set a(e){this._a=e}get b(){return this._b}set b(e){this._b=e}get c(){return this._c}set c(e){this._c=e}get OA(){return this._OA}set OA(e){this._OA=e}get d(){return this._d}get n(){return this._n}get normal(){return new r.Vector(this._a,this._b)}get director(){return this._d.clone()}set d(e){this._d=e}get slope(){return this._a.clone().opposed().divide(this._b)}get height(){return this._c.clone().opposed().divide(this._b)}parse=(...e)=>{if(this._exists=!1,0===e.length)return this;if(1===e.length){if(e[0]instanceof h)return e[0].clone();if(e[0]instanceof s.Equation)return this.parseEquation(e[0]);if("string"==typeof e[0])try{let t=new s.Equation(e[0]);return this.parse(t)}catch(e){return this}}if(2===e.length){if(e[0]instanceof o.Point&&e[1]instanceof r.Vector)return this.parseByPointAndVector(e[0],e[1]);if(e[0]instanceof o.Point&&e[1]instanceof o.Point)return this.parseByPointAndVector(e[0],new r.Vector(e[0],e[1]));if(e[0]instanceof r.Vector&&e[1]instanceof o.Point)return this.parseByPointAndNormal(e[1],e[0])}if(3===e.length){if((e[0]instanceof n.Fraction||"number"==typeof e[0])&&(e[1]instanceof n.Fraction||"number"==typeof e[1])&&(e[2]instanceof n.Fraction||"number"==typeof e[2]))return this.parseByCoefficient(e[0],e[1],e[2]);if(e[0]instanceof o.Point&&e[1]instanceof r.Vector){if(e[2]===l.Perpendicular)return this.parseByPointAndNormal(e[0],e[1]);if(e[2]===l.Parallel)return this.parseByPointAndVector(e[0],e[1])}}return console.log("Someting wrong happend while creating the line"),this};parseEquation=e=>{e.reorder(!0);let t=new Set(e.letters());if(!t.has("x")&&!t.has("y"))return this;for(let e of["x","y"])t.has(e)&&t.delete(e);return t.size>0?this:this.parseByCoefficient(e.left.monomByLetter("x").coefficient,e.left.monomByLetter("y").coefficient,e.left.monomByDegree(0).coefficient)};parseByCoefficient=(e,t,i)=>(this._a=new n.Fraction(e),this._b=new n.Fraction(t),this._c=new n.Fraction(i),this._d=new r.Vector(this._b.clone(),this._a.clone().opposed()),this._OA=new o.Point((new n.Fraction).zero(),this._c.clone()),this._n=this._d.clone().normal(),this._exists=!0,this);parseByPointAndVector=(e,t)=>(this.parseByCoefficient(t.y,t.x.clone().opposed(),e.x.clone().multiply(t.y).subtract(e.y.clone().multiply(t.x)).opposed()),this._OA=e.clone(),this._d=t.clone(),this._n=this._d.clone().normal(),this._exists=!0,this);parseByPointAndNormal=(e,t)=>this.parseByCoefficient(t.x,t.y,e.x.clone().multiply(t.x).add(e.y.clone().multiply(t.y)).opposed());parseByPointAndLine=(e,t,i)=>(void 0===i&&(i=l.Parallel),i===l.Parallel?this.parseByPointAndNormal(e,t.normal):i===l.Perpendicular?this.parseByPointAndNormal(e,t.director):(this._exists=!1,this));clone=()=>(this._a=this._a.clone(),this._b=this._b.clone(),this._c=this._c.clone(),this._d=this._d.clone(),this._OA=this._OA.clone(),this._n=this._n.clone(),this._exists=this.exists,this);isParellelTo=e=>this.slope.isEqual(e.slope)&&this.height.isNotEqual(e.height);isSameAs=e=>this.slope.isEqual(e.slope)&&this.height.isEqual(e.height);simplify=()=>{let e=a.Numeric.lcm(this._a.denominator,this._b.denominator,this._c.denominator),t=a.Numeric.gcd(this._a.numerator,this._b.numerator,this._c.numerator);return this.parseByCoefficient(this._a.denominator*e/t,this._b.denominator*e/t,this._c.denominator*e/t),this};simplifyDirection=()=>{let e=a.Numeric.lcm(this._d.x.denominator,this._d.y.denominator),t=a.Numeric.gcd(this._d.x.numerator,this._d.y.numerator);return this._d.x.multiply(e).divide(t),this._d.y.multiply(e).divide(t),this};intersection=e=>{let t=new o.Point,i=!1,n=!1;return this._b.isZero()||e.b.isZero(),this.isParellelTo(e)?(t.x=null,t.y=null,i=!0):this.isSameAs(e)?(t.x=null,t.y=null,n=!0):(t.x=this._b.clone().multiply(e.c).subtract(this._c.clone().multiply(e.b)).divide(this._a.clone().multiply(e.b).subtract(this._b.clone().multiply(e.a))),t.y=this._a.clone().multiply(e.c).subtract(this._c.clone().multiply(e.a)).divide(this._b.clone().multiply(e.a).subtract(this._a.clone().multiply(e.b)))),{point:t,hasIntersection:!(i||n),isParallel:i,isSame:n}};distanceTo(e){let t=e.x.clone().multiply(this._a).add(e.y.clone().multiply(this._b)).add(this._c).abs(),i=this.normal.normSquare;if(i.isZero())return{value:NaN,tex:"Not a line",fraction:(new n.Fraction).infinite()};let r=t.value/Math.sqrt(i.value),o=t.clone().divide(i.clone().sqrt());return i.isSquare()?{value:r,tex:o.tex,fraction:o}:{value:r,tex:`\\frac{${t.tex}}{\\sqrt{${i.tex}}}`,fraction:o}}hitSegment(e,t){let i=this.intersection(new h(e,t));return!!i.hasIntersection&&i.point.x.value>=Math.min(e.x.value,t.x.value)&&i.point.x.value<=Math.max(e.x.value,t.x.value)&&i.point.y.value>=Math.min(e.y.value,t.y.value)&&i.point.y.value<=Math.max(e.y.value,t.y.value)}getValueAtX=e=>{const t=this.equation.clone().isolate("y"),i=new n.Fraction(e);if(t instanceof s.Equation)return t.right.evaluate({x:i})};getValueAtY=e=>{const t=this.equation.clone().isolate("x"),i=new n.Fraction(e);if(t instanceof s.Equation)return t.right.evaluate({y:i})};canonicalAsFloatCoefficient(e){void 0===e&&(e=2),this._a.value,this._b.value,this._c.value;let t="";return this._a.isZero()||(t=this._a.isOne()?"x":this._a.clone().opposed().isOne()?"-x":this._a.value.toFixed(e)+"x"),this._b.isZero()||(this._b.isPositive()&&(t+="+"),t+=this._b.value.toFixed(e)+"y"),this._c.isZero()||(this._c.isPositive()&&(t+="+"),t+=this._c.value.toFixed(e)),t+"=0"}}t.Line=h},557:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Point=void 0;const n=i(506);class r{_x;_y;_exist;constructor(...e){return this._x=(new n.Fraction).zero(),this._y=(new n.Fraction).zero(),void 0!==e&&this.parse(...e),this}get isPoint(){return!0}get x(){return this._x}set x(e){this._x=e}get y(){return this._y}set y(e){this._y=e}get tex(){let e=[];return e.push(this._x.tex),e.push(this._y.tex),`\\left(${e.join(";")}\\right)`}get display(){let e=[];return e.push(this._x.tex),e.push(this._y.tex),`(${e.join(";")})`}parse=(...e)=>{if(this.zero(),0===e.length)return this;if(1===e.length){if(e[0]instanceof r)return this._x=e[0].x.clone(),this._y=e[0].y.clone(),this;if("string"==typeof e[0]){let t=e[0].split(",");if(2===t.length)return this._x=new n.Fraction(t[0]).reduce(),this._y=new n.Fraction(t[1]).reduce(),this}if(void 0===e[0].x||void 0===e[0].y)return this.zero();this._x=new n.Fraction(e[0].x).reduce(),this._y=new n.Fraction(e[0].y).reduce()}return 2===e.length&&(this._x=new n.Fraction(e[0]).reduce(),this._y=new n.Fraction(e[1]).reduce()),this};clone=()=>(this._x=this._x.clone(),this._y=this._y.clone(),this);zero=()=>(this._x=new n.Fraction(null),this._y=new n.Fraction(null),this);origin=()=>(this.zero(),this);middleOf=(e,t)=>(this._x=e.x.clone().add(t.x).divide(2),this._y=e.y.clone().add(t.y).divide(2),this);texValues=e=>{let t=[];return t.push(this._x.value.toFixed(void 0===e?2:e)),t.push(this._y.value.toFixed(void 0===e?2:e)),`\\left(${t.join(";")}\\right)`};static pmatrix=(e,t,i)=>void 0===i?`\\begin{pmatrix} ${e.tex?e.tex:e} \\\\ ${t.tex?t.tex:t} \\end{pmatrix}`:`\\begin{pmatrix} ${e.tex?e.tex:e} \\\\ ${t.tex?t.tex:t} \\\\ ${i.tex?i.tex:i} \\end{pmatrix}`}t.Point=r},164:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Triangle=void 0;const n=i(557),r=i(506),o=i(586),s=i(9),a=i(760);t.Triangle=class{_A;_B;_C;_lines;_middles;_remarquables;constructor(...e){return e.length>0&&this.parse(...e),this}get isTriangle(){return!0}get A(){return this._A}get B(){return this._B}get C(){return this._C}get AB(){return this.getSegment("A","B")}get BA(){return this.getSegment("B","A")}get BC(){return this.getSegment("B","C")}get CB(){return this.getSegment("C","B")}get AC(){return this.getSegment("A","C")}get CA(){return this.getSegment("C","A")}get isRectangle(){return!!this.AB.isNormalTo(this.BC)||!!this.AB.isNormalTo(this.AC)||!!this.BC.isNormalTo(this.AC)}get isEquilateral(){return this.AB.normSquare.isEqual(this.BC.normSquare)&&this.AB.normSquare.isEqual(this.AC.normSquare)}get isIsocele(){return this.AB.normSquare.isEqual(this.BC.normSquare)||this.AB.normSquare.isEqual(this.AC.normSquare)||this.BC.normSquare.isEqual(this.AC.normSquare)}get lines(){return this._lines}get remarquables(){return this._remarquables}parse=(...e)=>{if(6===e.length){let t=e.map((e=>new r.Fraction(e)));return this.parse(new n.Point(t[0],t[1]),new n.Point(t[2],t[3]),new n.Point(t[4],t[5]))}if(3===e.length){if(3===e.filter((e=>"string"==typeof e)).length)return this.parse(...e.map((e=>new s.Line(e))));if(3===e.filter((e=>!0===e.isLine)).length){this._lines={AB:e[0],BC:e[1],AC:e[2]};let t=e[0].intersection(e[1]);if(!t.hasIntersection)return this;if(this._B=t.point.clone(),t=e[1].intersection(e[2]),!t.hasIntersection)return this;if(this._C=t.point.clone(),t=e[2].intersection(e[0]),!t.hasIntersection)return this;this._A=t.point.clone()}else{if(e.filter((e=>!0===e.isPoint)).length<3)return this.parse(new n.Point(e[0]),new n.Point(e[1]),new n.Point(e[2]));this._A=e[0].clone(),this._B=e[1].clone(),this._C=e[2].clone(),this._lines={AB:new s.Line(this._A,this._B),BC:new s.Line(this._B,this._C),AC:new s.Line(this._A,this._C)}}}else if(1===e.length&&!0===e[0].isTriangle)return e[0].clone();return this._updateTriangle(),this};clone=()=>(this._A=this._A.clone(),this._B=this._B.clone(),this._C=this._C.clone(),this._lines={AB:this._lines.AB.clone(),BC:this._lines.BC.clone(),AC:this._lines.AC.clone()},this._updateTriangle(),this);_updateTriangle=()=>{this._middles={AB:(new n.Point).middleOf(this._A,this._B),AC:(new n.Point).middleOf(this._A,this._C),BC:(new n.Point).middleOf(this._B,this._C)},this._remarquables=this._calculateRemarquableLines()};getPointByName=e=>{switch(e.toUpperCase()){case"A":return this._A;case"B":return this._B;case"C":return this._C}return this._A};getSegment=(e,t)=>new o.Vector(this.getPointByName(e),this.getPointByName(t));_calculateRemarquableLines=()=>{let e={medians:{A:new s.Line(this._A,this._middles.BC),B:new s.Line(this._B,this._middles.AC),C:new s.Line(this._C,this._middles.AB),intersection:null},mediators:{AB:new s.Line(this._middles.AB,new o.Vector(this._A,this._B).normal()),AC:new s.Line(this._middles.AC,new o.Vector(this._A,this._C).normal()),BC:new s.Line(this._middles.BC,new o.Vector(this._B,this._C).normal()),intersection:null},heights:{A:new s.Line(this._A,new o.Vector(this._B,this._C).normal()),B:new s.Line(this._B,new o.Vector(this._A,this._C).normal()),C:new s.Line(this._C,new o.Vector(this._A,this._B).normal()),intersection:null},bisectors:{A:this._calculateBisectors("A"),B:this._calculateBisectors("B"),C:this._calculateBisectors("C"),intersection:null}};return e.medians.intersection=e.medians.A.intersection(e.medians.B).point,e.mediators.intersection=e.mediators.AB.intersection(e.mediators.BC).point,e.heights.intersection=e.heights.A.intersection(e.heights.B).point,e.bisectors.intersection=e.bisectors.A.intersection(e.bisectors.B).point,e};_calculateBisectors=e=>{let t,i,n=this.lines;"A"===e?(t=n.AB,i=n.AC):"B"===e?(t=n.AB,i=n.BC):"C"===e&&(t=n.BC,i=n.AC);let r=new s.Line(new a.Equation(t.equation.left.clone().multiply(i.n.simplify().norm),i.equation.left.clone().multiply(t.n.simplify().norm)).reorder(!0).simplify()),o=new s.Line(new a.Equation(t.equation.left.clone().multiply(i.n.simplify().norm),i.equation.left.clone().multiply(t.n.simplify().norm).opposed()).reorder(!0).simplify());return"A"===e?r.hitSegment(this.B,this.C)?r:o:"B"===e?r.hitSegment(this.A,this.C)?r:o:"C"===e?r.hitSegment(this.B,this.A)?r:o:r}}},586:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Vector=void 0;const n=i(506),r=i(956);class o{_x;_y;constructor(...e){this._x=(new n.Fraction).zero(),this._y=(new n.Fraction).zero(),void 0!==e&&this.parse(...e)}get x(){return this._x}set x(e){this._x=e}get y(){return this._y}set y(e){this._y=e}get normSquare(){return this._x.clone().pow(2).add(this._y.clone().pow(2))}get norm(){return Math.sqrt(this.normSquare.value)}get tex(){return`\\begin{pmatrix}${this._x.tex} \\\\ ${this._y.tex} \\end{pmatrix}`}parse=(...e)=>{if(this.zero(),0===e.length)return this;if(1===e.length)return e[0]instanceof o?e[0].clone():this._parseString(e[0]);if(e.length>=2){if(e[0].isPoint&&e[1].isPoint)return this._x=e[1].x.clone().subtract(e[0].x),this._y=e[1].y.clone().subtract(e[0].y),this;!e[0].isFraction&&isNaN(e[0])||(this._x=new n.Fraction(e[0])),!e[1].isFraction&&isNaN(e[1])||(this._y=new n.Fraction(e[1]))}return this};clone=()=>{let e=new o;return null!==this._x&&(e.x=this._x.clone()),null!==this._y&&(e.y=this._y.clone()),e};reset=()=>(this._x=null,this._y=null,this);zero=()=>(this.reset(),this._x=new n.Fraction(null),this._y=new n.Fraction(null),this);one=()=>(this._x=new n.Fraction,this._y=new n.Fraction,this);_parseString=e=>{let t=e.split(/[,;\s]/g);return this.x=new n.Fraction(t[0]||null),this.y=new n.Fraction(t[1]||null),this};opposed=()=>(this._x.opposed(),this._y.opposed(),this);add=e=>(this._x.add(e.x),this._y.add(e.y),this);subtract=e=>this.add(e.clone().opposed());scalarProductWithVector=e=>this._x.clone().multiply(e.x).add(this._y.clone().multiply(e.y));static scalarProduct=(e,t)=>e.x.value*t.x.value+e.y.value*t.y.value;normal=()=>{let e=this.x.clone().opposed(),t=this.y.clone();return this._x=t,this._y=e,this};isNormalTo=e=>this.scalarProductWithVector(e).isZero();multiplyByScalar=e=>{let t=new n.Fraction(e);return this._x.multiply(t),this._y.multiply(t),this};divideByScalar=e=>this.multiplyByScalar(new n.Fraction(e).invert());simplify=()=>this.multiplyByScalar(r.Numeric.lcm(this._x.denominator,this._y.denominator)).divideByScalar(r.Numeric.gcd(this._x.numerator,this._y.numerator));angleWith=(e,t,i)=>{let n=this.scalarProductWithVector(e).value,r=i?1:180/Math.PI;return t&&(n=Math.abs(n)),r*Math.acos(n/(this.norm*e.norm))}}t.Vector=o},956:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Numeric=void 0;class i{static round(e,t=2){return Number(Math.round(Number(e+"e"+t))+"e-"+t)}static prime(e){let t=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997,1009,1013,1019,1021,1031,1033,1039,1049,1051,1061,1063,1069,1087,1091,1093,1097,1103,1109,1117,1123,1129,1151,1153,1163,1171,1181,1187,1193,1201,1213,1217,1223,1229,1231,1237,1249,1259,1277,1279,1283,1289,1291,1297,1301,1303,1307,1319,1321,1327,1361,1367,1373,1381,1399,1409,1423,1427,1429,1433,1439,1447,1451,1453,1459,1471,1481,1483,1487,1489,1493,1499,1511,1523,1531,1543,1549,1553,1559,1567,1571,1579,1583,1597,1601,1607,1609,1613,1619,1621,1627,1637,1657,1663,1667,1669,1693,1697,1699,1709,1721,1723,1733,1741,1747,1753,1759,1777,1783,1787,1789,1801,1811,1823,1831,1847,1861,1867,1871,1873,1877,1879,1889,1901,1907,1913,1931,1933,1949,1951,1973,1979,1987,1993,1997,1999,2003,2011,2017,2027,2029,2039,2053,2063,2069,2081,2083,2087,2089,2099,2111,2113,2129,2131,2137,2141,2143,2153,2161,2179,2203,2207,2213,2221,2237,2239,2243,2251,2267,2269,2273,2281,2287,2293,2297,2309,2311,2333,2339,2341,2347,2351,2357,2371,2377,2381,2383,2389,2393,2399,2411,2417,2423,2437,2441,2447,2459,2467,2473,2477,2503,2521,2531,2539,2543,2549,2551,2557,2579,2591,2593,2609,2617,2621,2633,2647,2657,2659,2663,2671,2677,2683,2687,2689,2693,2699,2707,2711,2713,2719,2729,2731,2741,2749,2753,2767,2777,2789,2791,2797,2801,2803,2819,2833,2837,2843,2851,2857,2861,2879,2887,2897,2903,2909,2917,2927,2939,2953,2957,2963,2969,2971,2999,3001,3011,3019,3023,3037,3041,3049,3061,3067,3079,3083,3089,3109,3119,3121,3137,3163,3167,3169,3181,3187,3191,3203,3209,3217,3221,3229,3251,3253,3257,3259,3271,3299,3301,3307,3313,3319,3323,3329,3331,3343,3347,3359,3361,3371,3373,3389,3391,3407,3413,3433,3449,3457,3461,3463,3467,3469,3491,3499,3511,3517,3527,3529,3533,3539,3541,3547,3557,3559,3571,3581,3583,3593,3607,3613,3617,3623,3631,3637,3643,3659,3671,3673,3677,3691,3697,3701,3709,3719,3727,3733,3739,3761,3767,3769,3779,3793,3797,3803,3821,3823,3833,3847,3851,3853,3863,3877,3881,3889,3907,3911,3917,3919,3923,3929,3931,3943,3947,3967,3989,4001,4003,4007,4013,4019,4021,4027,4049,4051,4057,4073,4079,4091,4093,4099,4111,4127,4129,4133,4139,4153,4157,4159,4177,4201,4211,4217,4219,4229,4231,4241,4243,4253,4259,4261,4271,4273,4283,4289,4297,4327,4337,4339,4349,4357,4363,4373,4391,4397,4409,4421,4423,4441,4447,4451,4457,4463,4481,4483,4493,4507,4513,4517,4519,4523,4547,4549,4561,4567,4583,4591,4597,4603,4621,4637,4639,4643,4649,4651,4657,4663,4673,4679,4691,4703,4721,4723,4729,4733,4751,4759,4783,4787,4789,4793,4799,4801,4813,4817,4831,4861,4871,4877,4889,4903,4909,4919,4931,4933,4937,4943,4951,4957,4967,4969,4973,4987,4993,4999,5003,5009,5011,5021,5023,5039,5051,5059,5077,5081,5087,5099,5101,5107,5113,5119,5147,5153,5167,5171,5179,5189,5197,5209,5227,5231,5233,5237,5261,5273,5279,5281,5297,5303,5309,5323,5333,5347,5351,5381,5387,5393,5399,5407,5413,5417,5419,5431,5437,5441,5443,5449,5471,5477,5479,5483,5501,5503,5507,5519,5521,5527,5531,5557,5563,5569,5573,5581,5591,5623,5639,5641,5647,5651,5653,5657,5659,5669,5683,5689,5693,5701,5711,5717,5737,5741,5743,5749,5779,5783,5791,5801,5807,5813,5821,5827,5839,5843,5849,5851,5857,5861,5867,5869,5879,5881,5897,5903,5923,5927,5939,5953,5981,5987,6007,6011,6029,6037,6043,6047,6053,6067,6073,6079,6089,6091,6101,6113,6121,6131,6133,6143,6151,6163,6173,6197,6199,6203,6211,6217,6221,6229,6247,6257,6263,6269,6271,6277,6287,6299,6301,6311,6317,6323,6329,6337,6343,6353,6359,6361,6367,6373,6379,6389,6397,6421,6427,6449,6451,6469,6473,6481,6491,6521,6529,6547,6551,6553,6563,6569,6571,6577,6581,6599,6607,6619,6637,6653,6659,6661,6673,6679,6689,6691,6701,6703,6709,6719,6733,6737,6761,6763,6779,6781,6791,6793,6803,6823,6827,6829,6833,6841,6857,6863,6869,6871,6883,6899,6907,6911,6917,6947,6949,6959,6961,6967,6971,6977,6983,6991,6997,7001,7013,7019,7027,7039,7043,7057,7069,7079,7103,7109,7121,7127,7129,7151,7159,7177,7187,7193,7207,7211,7213,7219,7229,7237,7243,7247,7253,7283,7297,7307,7309,7321,7331,7333,7349,7351,7369,7393,7411,7417,7433,7451,7457,7459,7477,7481,7487,7489,7499,7507,7517,7523,7529,7537,7541,7547,7549,7559,7561,7573,7577,7583,7589,7591,7603,7607,7621,7639,7643,7649,7669,7673,7681,7687,7691,7699,7703,7717,7723,7727,7741,7753,7757,7759,7789,7793,7817,7823,7829,7841,7853,7867,7873,7877,7879,7883,7901,7907,7919,7927,7933,7937,7949,7951,7963,7993,8009,8011,8017,8039,8053,8059,8069,8081,8087,8089,8093,8101,8111,8117,8123,8147,8161,8167,8171,8179,8191,8209,8219,8221,8231,8233,8237,8243,8263,8269,8273,8287,8291,8293,8297,8311,8317,8329,8353,8363,8369,8377,8387,8389,8419,8423,8429,8431,8443,8447,8461,8467,8501,8513,8521,8527,8537,8539,8543,8563,8573,8581,8597,8599,8609,8623,8627,8629,8641,8647,8663,8669,8677,8681,8689,8693,8699,8707,8713,8719,8731,8737,8741,8747,8753,8761,8779,8783,8803,8807,8819,8821,8831,8837,8839,8849,8861,8863,8867,8887,8893,8923,8929,8933,8941,8951,8963,8969,8971,8999,9001,9007,9011,9013,9029,9041,9043,9049,9059,9067,9091,9103,9109,9127,9133,9137,9151,9157,9161,9173,9181,9187,9199,9203,9209,9221,9227,9239,9241,9257,9277,9281,9283,9293,9311,9319,9323,9337,9341,9343,9349,9371,9377,9391,9397,9403,9413,9419,9421,9431,9433,9437,9439,9461,9463,9467,9473,9479,9491,9497,9511,9521,9533,9539,9547,9551,9587,9601,9613,9619,9623,9629,9631,9643,9649,9661,9677,9679,9689,9697,9719,9721,9733,9739,9743,9749,9767,9769,9781,9787,9791,9803,9811,9817,9829,9833,9839,9851,9857,9859,9871,9883,9887,9901,9907,9923,9929,9931,9941,9949,9967,9973];return void 0===e?t:t.slice(0,Math.max(t.length,e))}static dividers(e){let t;const i=Math.sqrt(Math.abs(e));t=[];for(let n=1;n<=i;n++)e%n==0&&(t.push(n),t.push(e/n));return t.sort((function(e,t){return e-t})),[...new Set(t)]}static gcd(...e){let t=function(e,i){return 0===i?e:t(i,e%i)},i=1,n=2;if(0===e.length)return 1;if(1===e.length)return 0===e[0]?1:e[0];if(i=t(e[0],e[1]),1===i)return 1;for(n=2;n<e.length&&(i=t(i,e[n]),1!==i);n++);return Math.abs(i)}static lcm(...e){return e.reduce((function(e,t){return Math.abs(e*t/i.gcd(e,t))}))}}t.Numeric=i},984:function(e,t,i){var n=this&&this.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[i]}})}:function(e,t,i,n){void 0===n&&(n=i),e[n]=t[i]}),r=this&&this.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||n(t,e,i)};Object.defineProperty(t,"__esModule",{value:!0}),t.Random=void 0;const o=i(773),s=i(41),a=i(890),l=i(538);var h;r(i(233),t),(h=t.Random||(t.Random={})).polynom=function(e){return new o.rndPolynom(e).generate()},h.monom=function(e){return new s.rndMonom(e).generate()},h.fraction=function(e){return new l.rndFraction(e).generate()},h.number=function(e,t){return a.rndHelpers.randomInt(e,t)},h.numberSym=function(e,t){return a.rndHelpers.randomIntSym(e,t)},h.bool=function(e){return a.rndHelpers.randomBool(e)},h.array=function(e,t){return a.rndHelpers.randomArray(e,t)},h.item=function(e){return a.rndHelpers.randomItem(e)},h.shuffle=function(e){a.rndHelpers.shuffleArray(e)}},43:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.randomCore=void 0,t.randomCore=class{_config;_defaultConfig;mergeConfig=(e,t)=>void 0!==e?{...t,...e}:t;generate=()=>{};config=e=>(this._config=this.mergeConfig(e,this._defaultConfig),this)}},538:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.rndFraction=void 0;const n=i(43),r=i(534),o=i(984);class s extends n.randomCore{constructor(e){super(),this._defaultConfig={negative:!0,reduced:!0,zero:!0,natural:!1},this._config=this.mergeConfig(e,this._defaultConfig)}generate=()=>{let e=new r.Fraction;return this._config.negative?e.numerator=o.Random.numberSym(10,this._config.zero):e.numerator=o.Random.number(this._config.zero?0:1,10),this._config.natural?e.denominator=1:e.denominator=o.Random.number(1,10),this._config.reduced?e.reduce():e}}t.rndFraction=s},890:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.rndHelpers=void 0;class i{static randomBool(e=.5){return Math.random()<e}static randomInt(e,t){return void 0===t?this.randomInt(0,e):Math.floor(Math.random()*(t-e+1)+e)}static randomIntSym(e,t){return!1===t?this.randomBool()?this.randomInt(1,e):-this.randomInt(1,e):this.randomInt(-e,e)}static randomArray(e,t){return void 0===t&&(t=1),e.length<=0?Object.values(e):i.shuffleArray(e).slice(0,t)}static randomItem(e){return 0===e.length?"":this.randomArray(e,1)[0]}static shuffleArray(e){let t=Object.values(e);for(let e=t.length-1;e>0;e--){const i=Math.floor(Math.random()*(e+1)),n=t[e];t[e]=t[i],t[i]=n}return t}}t.rndHelpers=i},41:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.rndMonom=void 0;const n=i(43),r=i(984),o=i(937);class s extends n.randomCore{constructor(e){super(),this._defaultConfig={letters:"x",degree:2,fraction:!0,zero:!1},this._config=this.mergeConfig(e,this._defaultConfig)}generate=()=>{let e=new o.Monom;if(e.coefficient=r.Random.fraction({zero:this._config.zero,reduced:!0,natural:!this._config.fraction}),this._config.letters.length>1){for(let t of this._config.letters.split(""))e.setLetter(t,0);for(let t=0;t<this._config.degree;t++){const t=r.Random.item(this._config.letters.split(""));e.setLetter(t,e.degree(t).clone().add(1))}}else e.setLetter(this._config.letters,this._config.degree);return e}}t.rndMonom=s},773:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.rndPolynom=void 0;const n=i(43),r=i(41),o=i(984),s=i(667);class a extends n.randomCore{constructor(e){super(),this._defaultConfig={letters:"x",degree:2,fraction:!1,zero:!1,unit:!1,factorable:!1,allowNullMonom:!0,numberOfMonoms:0},this._config=this.mergeConfig(e,this._defaultConfig)}generate=()=>{if(this._config.factorable&&this._config.degree>1)return this.factorable();let e,t=(new s.Polynom).empty();for(let i=this._config.degree;i>=0;i--)e=new r.rndMonom({letters:this._config.letters,degree:i,fraction:this._config.fraction,zero:i!==this._config.degree&&this._config.allowNullMonom}).generate(),this._config.unit&&this._config.degree===i&&e.coefficient.one(),t.add(e);return this._config.numberOfMonoms>0&&this._config.numberOfMonoms<t.length&&(t.monoms=o.Random.array(t.monoms,this._config.numberOfMonoms)),t};factorable=()=>{let e=(new s.Polynom).one(),t={...this._config};t.degree=1,t.factorable=!1;for(let i=0;i<this._config.degree;i++)e.multiply(o.Random.polynom(t));return e}}t.rndPolynom=a},233:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},505:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Shutingyard=void 0,t.Shutingyard=class{_rpn=[];_mode;_tokenConfig;_uniformize;constructor(e){this._mode=void 0===e?"polynom":e,this.tokenConfigInitialization()}isOperation(e){return!!e[0].match(/[+\-*/^]/g)}tokenConfigInitialization(){return"set"===this._mode?(this._tokenConfig={"&":{precedence:3,associative:"left"},"|":{precedence:3,associative:"left"},"!":{precedence:4,associative:"right"},"-":{precedence:2,associative:"left"}},this._uniformize=!1):(this._tokenConfig={"^":{precedence:4,associative:"right"},"*":{precedence:3,associative:"left"},"/":{precedence:3,associative:"left"},"+":{precedence:2,associative:"left"},"-":{precedence:2,associative:"left"},"%":{precedence:3,associative:"right"},sin:{precedence:4,associative:"right"},cos:{precedence:4,associative:"right"},tab:{precedence:4,associative:"right"}},this._uniformize=!0),this._tokenConfig}NextToken2(e,t){let i,n;if(i="",n="","("===e[t])i="(",n="(";else if(")"===e[t])i=")",n=")";else if(","===e[t])i=",",n="function-argument";else{const r=Object.keys(this._tokenConfig).sort(((e,t)=>t.length-e.length));for(let o of r)if(e.substr(t,o.length)===o){i+=o,n="operation";break}""===i&&(e[t].match(/[0-9]/)?(i=e.substr(t).match(/^([0-9.,/]+)/)[0],n="coefficient"):e[t].match(/[a-zA-Z]/)?(i=e.substr(t).match(/^([a-zA-Z])/)[0],n="variable"):(console.log("Unidentified token",e[t],e,t),i=e[t],n="monom"))}return[i,t+i.length,n]}NextToken(e,t){let i,n,r;return this.NextToken2(e,t),i=e.substr(t).match(/^[0-9/a-zA-Z^]+/g)||[],e.substr(t,t+3).match(/^(sin|cos|tan)/g)?(n=e.substr(t,3),r="function"):i.length>0?(n=i[0],r="monom"):e[t].match(/[+\-*/^]/g)||e[t].match(/[&|!]/g)?(n=e[t],r="operation"):"("===e[t]?(n="(",r="("):")"===e[t]?(n=")",r=")"):","===e[t]?(n=",",r="function-argument"):(n=i[0],r="monom",""===n&&(n=e[t],r="monom",console.log("SHUTING YARD - NEXT TOKEN: error at ",t))),[n,t+n.length,r]}Uniformizer(e){if(!this._uniformize)return e;let t;t=e.replace(/\)\(/g,")*("),t=t.replace(/([\da-zA-Z])(\()/g,"$1*$2"),t=t.replace(/(\))([\da-zA-Z])/g,"$1*$2"),t=t.replace(/([0-9])([a-zA-Z])/g,"$1*$2"),t=t.replace(/([a-zA-Z])([0-9])/g,"$1*$2"),t=t.replace(/([abcxyz])([abcxyz])/g,"$1*$2");let i=["sin","cos","tan"];for(let e of i)t=t.replace(new RegExp(e+"\\*","g"),e);return t}parse(e,t){let i=[],n=[],r="",o=0,s="",a=0;e=this.Uniformizer(e);let l,h=50;for(;o<e.length;){if(h--,0===h){console.log("SECURITY LEVEL 1 EXIT");break}switch([r,o,s]=this.NextToken2(e,o),s){case"monom":case"coefficient":case"variable":i.push({token:r,tokenType:s});break;case"operation":if(a=n.length,n.length>0){let e=n[n.length-1];for(l=50;e.token in this._tokenConfig&&("left"===this._tokenConfig[r].associative&&this._tokenConfig[r].precedence<=this._tokenConfig[e.token].precedence||"right"===this._tokenConfig[r].associative&&this._tokenConfig[r].precedence<this._tokenConfig[e.token].precedence);){if(l--,0===l){console.log("SECURITY LEVEL 2 OPERATION EXIT");break}if(i.push(n.pop()||{token:"",tokenType:"operation"}),0===n.length)break;e=n[n.length-1]}}n.push({token:r,tokenType:s});break;case"function-argument":for(l=50;"("!==n[n.length-1].token&&n.length>0;){if(l--,0===l){console.log("SECURITY LEVEL 2 FUNCTION ARGUMENT EXIT");break}i.push(n.pop()||{token:r,tokenType:s})}break;case"(":n.push({token:r,tokenType:s}),"-"===e[o]&&i.push({token:"0",tokenType:"coefficient"});break;case")":for(l=50;"("!==n[n.length-1].token&&n.length>1;){if(l--,0===l){console.log("SECURITY LEVEL 2 CLOSING PARENTHESE EXIT");break}i.push(n.pop()||{token:r,tokenType:s})}n.pop();break;case"function":n.push({token:r,tokenType:s});break;default:console.log(`SHUTING YARD: ${s} : ${r} `)}}return this._rpn=i.concat(n.reverse()),this}get rpn(){return this._rpn}}}},t={};function i(n){var r=t[n];if(void 0!==r)return r.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,i),o.exports}(()=>{const e=i(956),t=i(505),n=i(984),r=i(534),o=i(667),s=i(272);window.Pi={ShutingYard:t.Shutingyard,Numeric:e.Numeric,Fraction:r.Fraction,Root:r.Nthroot,Monom:o.Monom,Polynom:o.Polynom,Equation:o.Equation,LinearSystem:o.LinearSystem,Rational:o.Rational,Logicalset:o.Logicalset,Random:n.Random,Geometry:{Vector:s.Vector,Point:s.Point,Line:s.Line,Triangle:s.Triangle,Circle:s.Circle}}})()})();
2
2
  //# sourceMappingURL=pi.js.map