/*
 Joel Espinosa Longi
 jlongi@im.unam.mx
 https://github.com/jlongi/DescartesJS
 LGPL - http://www.gnu.org/licenses/lgpl.html
 2024-05-29
*/
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.arrayIteratorImpl=function(a){var f=0;return function(){return f<a.length?{done:!1,value:a[f++]}:{done:!0}}};$jscomp.arrayIterator=function(a){return{next:$jscomp.arrayIteratorImpl(a)}};$jscomp.makeIterator=function(a){var f="undefined"!=typeof Symbol&&Symbol.iterator&&a[Symbol.iterator];return f?f.call(a):$jscomp.arrayIterator(a)};$jscomp.arrayFromIterator=function(a){for(var f,e=[];!(f=a.next()).done;)e.push(f.value);return e};
$jscomp.arrayFromIterable=function(a){return a instanceof Array?a:$jscomp.arrayFromIterator($jscomp.makeIterator(a))};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.SIMPLE_FROUND_POLYFILL=!1;$jscomp.objectCreate=$jscomp.ASSUME_ES5||"function"==typeof Object.create?Object.create:function(a){var f=function(){};f.prototype=a;return new f};$jscomp.underscoreProtoCanBeSet=function(){var a={a:!0},f={};try{return f.__proto__=a,f.a}catch(e){}return!1};
$jscomp.setPrototypeOf="function"==typeof Object.setPrototypeOf?Object.setPrototypeOf:$jscomp.underscoreProtoCanBeSet()?function(a,f){a.__proto__=f;if(a.__proto__!==f)throw new TypeError(a+" is not extensible");return a}:null;
$jscomp.inherits=function(a,f){a.prototype=$jscomp.objectCreate(f.prototype);a.prototype.constructor=a;if($jscomp.setPrototypeOf){var e=$jscomp.setPrototypeOf;e(a,f)}else for(e in f)if("prototype"!=e)if(Object.defineProperties){var d=Object.getOwnPropertyDescriptor(f,e);d&&Object.defineProperty(a,e,d)}else a[e]=f[e];a.superClass_=f.prototype};
$jscomp.checkStringArgs=function(a,f,e){if(null==a)throw new TypeError("The 'this' value for String.prototype."+e+" must not be null or undefined");if(f instanceof RegExp)throw new TypeError("First argument to String.prototype."+e+" must not be a regular expression");return a+""};$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(a,f,e){a!=Array.prototype&&a!=Object.prototype&&(a[f]=e.value)};
$jscomp.getGlobal=function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global&&null!=global?global:a};$jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(a,f,e,d){if(f){e=$jscomp.global;a=a.split(".");for(d=0;d<a.length-1;d++){var r=a[d];r in e||(e[r]={});e=e[r]}a=a[a.length-1];d=e[a];f=f(d);f!=d&&null!=f&&$jscomp.defineProperty(e,a,{configurable:!0,writable:!0,value:f})}};
$jscomp.polyfill("String.prototype.repeat",function(a){return a?a:function(a){var e=$jscomp.checkStringArgs(this,null,"repeat");if(0>a||1342177279<a)throw new RangeError("Invalid count value");a|=0;for(var d="";a;)if(a&1&&(d+=e),a>>>=1)e+=e;return d}},"es6","es3");$jscomp.owns=function(a,f){return Object.prototype.hasOwnProperty.call(a,f)};
$jscomp.assign="function"==typeof Object.assign?Object.assign:function(a,f){for(var e=1;e<arguments.length;e++){var d=arguments[e];if(d)for(var r in d)$jscomp.owns(d,r)&&(a[r]=d[r])}return a};$jscomp.polyfill("Object.assign",function(a){return a||$jscomp.assign},"es6","es3");
$jscomp.polyfill("Array.prototype.fill",function(a){return a?a:function(a,e,d){var f=this.length||0;0>e&&(e=Math.max(0,f+e));if(null==d||d>f)d=f;d=Number(d);0>d&&(d=Math.max(0,f+d));for(e=Number(e||0);e<d;e++)this[e]=a;return this}},"es6","es3");$jscomp.findInternal=function(a,f,e){a instanceof String&&(a=String(a));for(var d=a.length,r=0;r<d;r++){var n=a[r];if(f.call(e,n,r,a))return{i:r,v:n}}return{i:-1,v:void 0}};
$jscomp.polyfill("Array.prototype.find",function(a){return a?a:function(a,e){return $jscomp.findInternal(this,a,e).v}},"es6","es3");$jscomp.polyfill("Array.prototype.flat",function(a){return a?a:function(a){a=void 0===a?1:Number(a);for(var e=[],d=0;d<this.length;d++){var f=this[d];Array.isArray(f)&&0<a?(f=Array.prototype.flat.call(f,a-1),e.push.apply(e,f)):e.push(f)}return e}},"es9","es5");
$jscomp.polyfill("Math.trunc",function(a){return a?a:function(a){a=Number(a);if(isNaN(a)||Infinity===a||-Infinity===a||0===a)return a;var e=Math.floor(Math.abs(a));return 0>a?-e:e}},"es6","es3");$jscomp.polyfill("Math.sign",function(a){return a?a:function(a){a=Number(a);return 0===a||isNaN(a)?a:0<a?1:-1}},"es6","es3");$jscomp.polyfill("Number.isFinite",function(a){return a?a:function(a){return"number"!==typeof a?!1:!isNaN(a)&&Infinity!==a&&-Infinity!==a}},"es6","es3");
$jscomp.stringPadding=function(a,f){a=void 0!==a?String(a):" ";return 0<f&&a?a.repeat(Math.ceil(f/a.length)).substring(0,f):""};$jscomp.polyfill("String.prototype.padStart",function(a){return a?a:function(a,e){var d=$jscomp.checkStringArgs(this,null,"padStart");return $jscomp.stringPadding(e,a-d.length)+d}},"es8","es3");
$jscomp.polyfill("String.prototype.startsWith",function(a){return a?a:function(a,e){var d=$jscomp.checkStringArgs(this,a,"startsWith");a+="";var f=d.length,n=a.length;e=Math.max(0,Math.min(e|0,d.length));for(var b=0;b<n&&e<f;)if(d[e++]!=a[b++])return!1;return b>=n}},"es6","es3");
var babel=function(a){if(a.loadLib)return a;a.loadLib=!0;a.no=a.ez=a.non=a["n\u00e3o"]=a.falso=a["false"]=a.fals=a.gezurra=a.faux=a.fals="false";a["s\u00ed"]=a.yes=a.bai=a.oui=a.si=a.sim=a.verdadero=a["true"]=a.veritable=a.egia=a.vrai=a.verdadeiro=a.veritable="true";a.negro=a.black=a.negre=a.beltza=a.noir=a.preto=a["#000000"]="#000000";a.maxenta=a.magenta=a["#ff00ff"]="#ff00ff";a.azul=a.blue=a.blau=a.urdina=a.bleu=a["#0000ff"]="#0000ff";a.turquesa=a.cyan=a.turkesa=a.turquoise=a["#00ffff"]="#00ffff";
a.verde=a.green=a.verd=a.berdea=a.vert=a["#00ff00"]="#00ff00";a.amarillo=a.yellow=a.groc=a.horia=a.jaune=a.amarelo=a["#ffff00"]="#ffff00";a.naranja=a.orange=a.taronja=a.laranja=a.laranxa=a["#ffc800"]="#ffc800";a.rojo=a.red=a.vermell=a.gorria=a.rouge=a.vermello=a.vermelho=a["#ff0000"]="#ff0000";a.pink=a.rosa=a.arrosa=a.rose=a["#ffafaf"]="#ffafaf";a.grisObscuro=a.darkGray=a.grisFosc=a["gris iluna"]=a.grisObscur=a.grisEscuro=a.cinzaEscuro=a["#404040"]="#404040";a.gris=a.gray=a.grisa=a.cinza=a["#808080"]=
"#808080";a.grisClaro=a.lightGray=a.grisClar=a["gris argia"]=a.grisClair=a.cinzaClaro=a["#c0c0c0"]="#c0c0c0";a.blanco=a.white=a.blanc=a.zuria=a.branco=a["#ffffff"]="#ffffff";a.escala=a.scale=a.eskala=a["\u00e9chelle"]="scale";a.nombre=a.name=a.nom=a.izena=a.nome="name";a.ikusgai=a["vis\u00edvel"]=a.visible="visible";a.rastro=a.trace=a.rastre=a.arrastoa="trace";a.fondo=a.background=a.fons=a.hondoa=a.fond=a.fundo="background";a["par\u00e1metro"]=a.parameter=a.parametroa=a["par\u00e2metro"]=a["par\u00e0metre"]=
"parameter";a["sucesi\u00f3n"]=a.sequence=a["successi\u00f3"]=a.segida=a.succession=a["seq\u00fc\u00eancia"]="sequence";a["tama\u00f1o"]=a.size=a.neurria=a.taille=a.tamanho=a["grand\u00e0ria"]="size";a.decimales=a.decimals=a.hamartarra=a["d\u00e9cimales"]=a.decimais="decimals";a.red=a.net=a.xarxa=a.sarea=a["r\u00e9seau"]=a.rede=a.malha="net";a.red10=a.net10=a.xarxa10=a.sarea10=a["r\u00e9seau10"]=a.rede10=a.malha10="net10";a.ejes=a.axes=a.eixos=a.ardatzak=a.eixes="axes";a["cr\u00e9ditos"]=a.about=
a["cr\u00e8dits"]=a.kreditoak=a["cr\u00e9dits"]=a.sobre="about";a.config=a.konfig=a["configura\u00e7\u00e3o"]="config";a.inicio=a.init=a.inici=a.hasiera=a.commencement=a["in\u00edcio"]="init";a.limpiar=a.clear=a.neteja=a.ezabatu=a.nettoye=a.limpar="clear";a.incr=a.gehi=a.incremento="incr";a.min=a.inf="min";a.max=a.sup=a["m\u00e1x"]="max";a.relleno=a.fill=a.ple=a.betea=a.plein=a.recheo=a.preencher="fill";a["relleno+"]=a["fill+"]=a["ple+"]=a["betea+"]=a["plein+"]=a["recheo+"]=a["preencher+"]=a.fillP=
"fillP";a["relleno-"]=a["fill-"]=a["ple-"]=a["betea-"]=a["plein-"]=a["recheo-"]=a["preencher-"]=a.fillM="fillM";a.flecha=a.arrow=a.fletxa=a.gezia=a["fl\u00e8che"]=a.frecha=a.seta="arrow";a.punta=a.spear=a.muturra=a.pointe=a.ponta="spear";a["regi\u00f3n"]=a.region=a["regi\u00f3"]=a.eskualde=a["r\u00e9gion"]=a["rexi\u00f3n"]=a["regi\u00e3o"]="region";a.norte=a.north=a.nord=a.ipar="north";a.sur=a.south=a.sud=a.hego=a.sul="south";a.este=a.east=a.est=a.ekialde=a.leste="east";a.oeste=a.west=a.oest=a.hegoalde=
a.ouest="west";a.exterior=a.external=a.kanpoalde=a.externo="external";a["expresi\u00f3n"]=a.expresion=a["expresi\u00f3"]=a.adierazpen=a["express\u00e3o"]="expresion";a.tipo=a.type=a.tipus=a.mota="type";a["posici\u00f3n"]=a.position=a["posici\u00f3"]=a.posizio=a["posi\u00e7\u00e3o"]="position";a["constricci\u00f3n"]=a.constraint=a["constricci\u00f3"]=a.beharte=a.constriction=a["constrici\u00f3n"]=a["restri\u00e7\u00e3o"]="constraint";a.valor=a.value=a.balio=a.valeur="value";a["ecuaci\u00f3n"]=a.equation=
a["equaci\u00f3"]=a.ekuazio=a["\u00e9quation"]=a["equa\u00e7\u00e3o"]="equation";a.curva=a.curve=a.corba=a.kurba=a.courbe="curve";a.texto=a.text=a.testu=a.texte=a.testua="text";a.punto=a.point=a.punt=a.puntu=a.ponto=a.dot="point";a.segmento=a.segment=a.zuzenki="segment";a.arco=a.arc=a.arku="arc";a["pol\u00edgono"]=a.polygon=a["pol\u00edgon"]=a.poligono=a.polygone="polygon";a.imagen=a.image=a.imatge=a.irudi=a.imaxe=a.imagem=a.bg_image=a.irudia=a.imagem_de_fundo=a.irundia="image";a["Versi\u00f3n"]=
a.Version=a["Versi\u00f3"]=a["Vers\u00e3o"]=a.version="version";a.Idioma=a.Language=a.Hizkuntza=a.Langue=a.language="language";a["O.x"]="O.x";a["O.y"]="O.y";a.Botones=a.Buttons=a.Botons=a.Botoiak=a.Boutons=a["Bot\u00f3ns"]=a["Bot\u00f5es"]=a.Botons="Buttons";a["Animaci\u00f3n"]=a.Animation=a["Animaci\u00f3"]=a.Animazio=a["Anima\u00e7\u00e3o"]="Animation";a.constante=a.constant=a.Konstante="constant";a.fuente=a.font=a.iturri=a.source=a.fonte="font";a["num\u00e9rico"]=a.numeric=a["num\u00e8ric"]=a.zenbakizko=
a["num\u00e9rique"]="numeric";a["gr\u00e1fico"]=a.graphic=a["gr\u00e0fic"]=a.grafiko=a.graphique="graphic";a.hacer=a["do"]=a.fer=a.egin=a.faire=a.facer=a.fazer=a.doExpr="doExpr";a.mientras=a["while"]=a.mentre=a.bitartean=a["tandis que"]=a.mentres=a.enquanto=a.whileExpr="whileExpr";a.evaluar=a.evaluate=a.avalua=a.ebaluatu=a["\u00e9valuer"]=a.avaliar="evaluate";a.variable=a.aldagaia=a["vari\u00e1vel"]="variable";a["funci\u00f3n"]=a["function"]=a["funci\u00f3"]=a.funtzio=a.fonction=a["fun\u00e7\u00e3o"]=
"function";a.algoritmo=a.algorithm=a.algorisme=a.algorithme="algorithm";a.vector=a.array=a.bektore=a.vecteur=a.matriz="array";a["dibujar-si"]=a["draw-if"]=a["marraztu-baldin"]=a["dessiner-si"]=a["debuxar-se"]=a["desenhar-se"]=a["dibuixa-si"]=a.drawif="drawif";a.dominio=a.range=a.domini=a["izate-eremua"]=a.domain=a["dom\u00ednio"]="range";a.pausa=a.delay=a.eten="delay";a["eje-x"]=a["x-axis"]=a["eix-x"]=a["x-ardatza"]=a["axe-x"]=a["eixe-x"]=a["eixo-x"]=a.x_axis="x_axis";a["eje-y"]=a["y-axis"]=a["eix-y"]=
a["y-ardatza"]=a["axe-y"]=a["eixe-y"]=a["eixo-y"]=a.y_axis="y_axis";a["n\u00fameros"]=a.numbers=a.nombres=a.zenbakiak="numbers";a["exponencial-si"]=a["exponential-if"]=a["esponentzial-baldin"]=a["exponentiel-si"]=a["exponencial-se"]=a.exponentialif="exponentialif";a.familia=a.family=a["fam\u00edlia"]=a.famille="family";a.intervalo=a.interval=a.tarte=a.intervalle="interval";a.pasos=a.steps=a.passos=a.pausoak=a.pas="steps";a.centro=a.center=a.centre=a.zentro="center";a.radio=a.radius=a.radi=a.erradio=
a.rayon=a.raio="radius";a.fin=a.end=a.fi=a.bukaera=a.fim="end";a["una-sola-vez"]=a["only-once"]=a["una-sola-vegada"]=a["behin-bakarrik"]=a["une-seule-fois"]=a["unha-soa-vez"]=a["apenas-uma-vez"]=a.onlyOnce="onlyOnce";a.siempre=a.always=a.sempre=a.beti=a.toujours="always";a["color-int"]=a["int-colour"]=a["barruko-kolore"]=a["couleur-int"]=a["cor-int"]=a.colorInt="colorInt";a.repetir=a.loop=a.repeteix=a.errepikatu=a["r\u00e9p\u00e9ter"]="loop";a.controles=a.controls=a.kontrolak=a["contr\u00f4les"]=
a.controis="controls";a.animar=a.animate=a.anima=a.animatu=a.animer="animate";a.auto="auto";a.y=a.top="y";a.espacio=a.space=a.espai=a.espazio=a.espace=a.espazo=a["espa\u00e7o"]="space";a.Nu="Nu";a.Nv="Nv";a.alto=a.height=a.alt=a.altu=a.haut=a.altura=a["al\u00e7ada"]=a.hauteur=a.alto="height";a.ancho=a.depth=a.amplada=a.zabalera=a.largeur=a.profundidade=a.amplada=a.width=a.ample=a.large=a.largura="width";a.largo=a.length=a.llargada=a.luzera=a.longueur=a.longo=a.comprimento=a.llargada="length";a.color_reverso=
a.backcolor=a.color_revers=a["atzealde kolorea"]=a.couleur_revers=a.cor_reverso=a.cor_de_fundo="backcolor";a.aristas=a.edges=a.arestes=a.ertzak=a["ar\u00eates"]=a.arestas="edges";a.rotini=a.inirot="inirot";a.posini=a.inipos="inipos";a["tri\u00e1ngulo"]=a.triangle=a.hirukia=a["tri\u00e2ngulo"]="triangle";a.cara=a.face=a.aurpegi="face";a.polireg=a.regpoly=a["pol\u00edgonoRegular"]="polireg";a.superficie=a.surface=a["superf\u00edcie"]=a.azalera="surface";a.cubo=a.cube=a.cub=a.kubo="cube";a["paralelep\u00edpedo"]=
a.box=a["paral\u00b7lelep\u00edpede"]=a.paralelepipedo=a["parall\u00e9l\u00e9pip\u00e8de"]="box";a.cono=a.cone=a.con=a.kono=a["c\u00f4ne"]="cone";a.cilindro=a.cylinder=a.cilindre=a.zilindro=a.cylindre="cylinder";a.esfera=a.sphere=a["sph\u00e8re"]="sphere";a.tetraedro=a.tetrahedron=a.tetraedre=a["t\u00e9tra\u00e8dre"]="tetrahedron";a.octaedro=a.octahedron=a.octaedre=a.oktaedro=a["octa\u00e8dre"]="octahedron";a.dodecaedro=a.dodecahedron=a.dodecaedre=a.dodekaedro=a["dod\u00e9ca\u00e8dre"]="dodecahedron";
a.icosaedro=a.icosahedron=a.icosaedre=a.ikosaedro=a["icosa\u00e8dre"]="icosahedron";a.elipsoide=a.ellipsoid=a["el\u00b7lipsoide"]=a["ellipso\u00efde"]=a["elips\u00f3ide"]="ellipsoid";a.macro=a.makro="macro";a.id="id";a.modelo=a.model=a.eredu=a["mod\u00e8le"]="model";a.color=a.kolore=a.couleur=a.cor=a.colour=a.kolorea="color";a.luz=a.light=a.llum=a.argia=a["lumi\u00e8re"]="light";a.metal=a.metall=a["m\u00e9tal"]="metal";a.alambre=a.wire=a.filferro=a.alanbre=a["fil de fer"]=a.arame="wire";a.cortar=
a.split=a.talla=a.moztu=a.couper=a.dividir="split";a.despliegue=a.render=a.desplegament=a.zabaltze=a["d\u00e8ploiement"]=a.despregamento=a.processar="render";a.orden=a.sort=a.ordre=a.ordena=a.orde=a.ordenar="sort";a.pintor=a.painter=a.margolari=a.peintre="painter";a["trazado de rayos"]=a["ray trace"]=a["tra\u00e7at de raigs"]=a["izpi trazadura"]=a["trace de rayons"]=a["trazado de raios"]=a["tra\u00e7ado de raios"]=a.raytrace="raytrace";a.despl_imagen=a.bg_display=a.despl_imatge=a["irudi desplazamendu"]=
a.despl_image=a.despr_imaxe=a["apresenta\u00e7\u00e3o_de_imagem"]="bg_display";a["arr-izq"]=a.topleft=a["dalt-esq"]=a["goi-ezk"]=a["au-dessus-gau"]=a["arr-esq"]=a["acima-esquerda"]="topleft";a["expand."]=a.stretch=a.hedatu=a["expandir "]="stretch";a.mosaico=a.patch=a.mosaic=a.mosaiko=a["mosa\u00efque"]="patch";a.centrada=a.zentratu=a["centr\u00e9e"]=a.centrado=a.imgcenter="imgcenter";a.archivo=a.file=a.fitxer=a.artxibo=a.fichier=a.arquivo="file";a.filas_norte=a.rows_north=a.files_nord=a["HTML kodea"]=
a.files_nord=a.filas_norte=a.linhas_norte=a.files_nord=a.rowsNorth="rowsNorth";a.filas_sur=a.rows_south=a.files_sud=a.ipar_lerro=a.files_sud=a.filas_sur=a.linhas_sul=a.files_sud=a.rowsSouth="rowsSouth";a.ancho_este=a.width_east=a.ample_est=a.hego_lerro=a.ample_est=a.ancho_leste=a.largura_leste=a.ample_est=a.widthEast="widthEast";a.ancho_oeste=a.width_west=a.ample_oest=a.ekialde_zabalera=a.ample_ouest=a.ancho_oeste=a.largura_oeste=a.ample_oest=a.widthWest="widthWest";a.fijo=a.fixed=a.fix=a.hegoalde_zabalera=
a.fixe=a.fixo="fixed";a["Reiniciar Animaci\u00f3n"]=a["Init Animation"]=a["Reinicia Animaci\u00f3"]=a.finko=a["Recommencer l'Animation"]=a["Reiniciar Anima\u00e7\u00e3o"]=a.initAnimation="initAnimation";a["Explicaci\u00f3n"]=a.Explanation=a.Azalpena=a.Explication=a["Explica\u00e7\u00e3o"]=a["Explicaci\u00f3"]="Explanation";a.tooltip=a.dica="tooltip";a.discreto=a.discrete=a.discret=a.diskretu="discrete";a.interfaz=a.gui=a["interf\u00edcie"]=a.interfaze=a["interface"]="gui";a.pulsador=a.spinner=a.polsador=
a.pultsadore=a.bouton="spinner";a["campo de texto"]=a.textfield=a["camp de text"]=a["testu esarrua"]=a["champ de texte"]="textfield";a["men\u00fa"]=a.choice=a.menu=a.escolha="menu";a.barra=a.scrollbar=a.barre="scrollbar";a.opciones=a.options=a.opcions=a.aukerak=a["opci\u00f3ns"]=a["op\u00e7\u00f5es"]="options";a.interior=a.barruko=a["int\u00e9rieur"]="interior";a["condici\u00f3n"]=a.condition=a["condici\u00f3"]=a.baldintza=a["condi\u00e7\u00e3o"]="condition";a["acci\u00f3n"]=a.action=a["acci\u00f3"]=
a.ekintza=a["a\u00e7\u00e3o"]="action";a.evento=a.event=a.esdeveniment=a.gertaera=a["\u00e9v\u00e9nement"]="event";a["abrir URL"]=a["open URL"]=a["obre URL"]=a["URL zabaldu"]=a["ouvrir URL"]=a.openURL="openURL";a["abrir Escena"]=a["open Scene"]=a["obre Escena"]=a["eszena zabaldu"]=a["ouvrir Escena"]=a["abrir Cena"]=a.openScene="openScene";a["bot\u00f3n"]=a.button=a["bot\u00f3"]=a.botoi=a.bouton=a["bot\u00e3o"]="button";a.mensaje=a.message=a.mezua=a.mensaxe=a.mensagem=a.missatge="message";a.alternar=
a.alternate=a.alterna=a.txandakatu=a.alterner="alternate";a["ejecuci\u00f3n"]=a.execution=a["execuci\u00f3"]=a.gauzatze=a["ex\u00e9cution"]=a["execuci\u00f3n"]=a["execu\u00e7\u00e3o"]="execution";a.calcular=a.calculate=a.calcula=a.kalkulatu=a.calculer="calculate";a.coord_abs=a.abs_coord=a.koor_abs="abs_coord";a.negrita=a.bold=a.negreta=a.lodi=a["caract\u00e8re gras"]=a.negra=a.negrito="bold";a.cursiva=a.italics=a.etzana=a.italique=a["it\u00e1lico"]="italics";a.subrayada=a.underlined=a.subratllat=
a.azpimarratua=a.soulignement=a["subli\u00f1ada"]=a.sublinhado="underlined";a.pos_mensajes=a.msg_pos=a.pos_missatges=a.mezuen_pos=a.pos_messages=a.pos_mensaxes="msg_pos";a.izquierda=a.left=a.esquerra=a.eskerrean=a.gauche=a.esquerda=a.esquerda=a.esquerra=a.x="x";a.derecha=a.right=a.dreta=a.eskuinan=a.droite=a.dereita=a.direita=a.dreta="right";a["sensible_a_los_movimientos_del_rat\u00f3n"]=a.sensitive_to_mouse_movements=a["sensible_als_moviments_del_ratol\u00ed"]=a["xagu mugimenduarekiko sentikorra"]=
a.sensible_aux_mouvements_du_souris=a.sensible_aos_movementos_do_rato=a["sens\u00edvel_aos_movimentos_do_mouse"]="sensitive_to_mouse_movements";a.reproducir=a.play=a.reprodueix=a.erreproduzitu=a.reproduire=a.reproduzir=a.playAudio="playAudio";a["activo-si"]=a["active-if"]=a["actiu-si"]=a["altiboa-baldin"]=a["actif-si"]=a["activo-se"]=a["ativo-se"]=a.activeif="activeif";a.rotfin=a.finrot=a.bukrot=a.endrot="endrot";a.posfin=a.finpos=a.bukpos=a.endpos="endpos";a.editable=a.editagarria=a["edit\u00e1vel"]=
"editable";a.R2="2D";a.R3="3D";a.vectores=a.bektoreak=a.vecteurs=a.vetores=a.vectors="vectors";a["fuente puntos"]=a["font size"]=a["font punts"]=a["puntu iturria"]=a["source points"]=a["fonte puntos"]=a["fonte pontos"]=a.font_size="font_size";a.escenario=a.scenario=a.escenari=a.agertoki=a["sc\u00e8ne"]=a["cen\u00e1rio"]="scenario";a.cID="cID";a.matriz=a.matrix=a.matriu=a.matrice="matrix";a.filas=a.rows=a.files="rows";a.columnas=a.columns=a.colonnes="columns";a.solo_texto=a.only_text=a.seulement_texte=
a["s\u00f3_texto"]=a.tan_sols_texte=a.onlyText="onlyText";a.respuesta=a.answer="answer";a.peso=a.weight=a.pes="weight";a.decimal_symbol=a["signo decimal"]=a["decimal symbol"]="decimal_symbol";a.info="info";a.library="library";a.color_contorn_text=a.color_text_border=a.color_borde_texto=a.muga_testuaren_kolorea=a.couleur_contour_texte=a.cor_borde_texto=a.colore_bordo_testo=a.cor_borda_texto=a.color_contorn_text=a.border="border";a.video=a["vid\u00e9o"]="video";a.audio=a["\u00e0udio"]="audio";a.autoplay=
"autoplay";a.poster="poster";a.opacidad=a.opacity=a["opacit\u00e9"]=a.opacitat=a.opacidade="opacity";a.alinear=a.align=a["ali\u00f1ar"]=a.aligner="align";a.anchor="anchor";a.a_left="left";a.a_center="center";a.a_right="right";a.a_justify="justify";a.a_top_left="top_left";a.a_top_center="top_center";a.a_top_right="top_right";a.a_center_left="center_left";a.a_center_center="center_center";a.a_center_right="center_right";a.a_bottom_left="bottom_left";a.a_bottom_center="bottom_center";a.a_bottom_right=
"bottom_right";a.malla=a.mesh="mesh";a.local=a.Local="local";a.rectangle=a["rect\u00e1ngulo"]="rectangle";a.lineDash="lineDash";a.solid="solid";a.dot="dot";a.dash="dash";a.dash_dot="dash_dot";a.offset_dist="offset_dist";a.offset_angle="offset_angle";a.flat="flat";a.borderColor="borderColor";a.text_align="text_align";a.image_align="image_align";a.checkbox="checkbox";a.torus=a.toro="torus";a.R="R";a.r="r";a.border_radius="border_radius";a.radio_group="radio_group";a.font_family="font_family";a.resizable=
"resizable";a.slider="slider";a.antialias="antialias";a.image_loader="image_loader";a.expand="expand";a.cover=a.cubrir="cover";a.fit=a.escalar="fit";a.code="code";a.doc="doc";a.image_dec="image_dec";a.image_inc="image_inc";a.btn_pos="btn_pos";a.border_width="border_width";a.border_color="border_color";a.v_left="v_left";a.v_right="v_right";a.h_left="h_left";a.h_right="h_right";a.h_left_right="h_left_right";a.label_color="label_color";a.label_text_color="label_text_color";a.shadowColor="shadowColor";
a.shadowBlur="shadowBlur";a.shadowOffsetX="shadowOffsetX";a.shadowOffsetY="shadowOffsetY";a.border_size="border_size";a.clip="clip";a.keyboard="keyboard";a.kblayout="kblayout";a.kbexp="kbexp";a.extra_style="extra_style";return a}(babel||Object.create(null)),descartesJS=function(a){if(a.loadLib)return a;a.arimoBFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.arimoBIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.arimoIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.arimoRFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.cousineBFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.cousineBIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.cousineIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.cousineRFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.tinosBFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.tinosBIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.tinosIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.tinosRFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.mathBFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.mathRFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.addFonts=function(){return"@font-face{font-family:'DJS_sansserif';src:url('"+a.arimoBFont()+"') format('woff2');font-style:normal;font-weight:bold;}\n@font-face{font-family:'DJS_sansserif';src:url('"+a.arimoBIFont()+"') format('woff2');font-style:italic;font-weight:bold;}\n@font-face{font-family:'DJS_sansserif';src:url('"+a.arimoIFont()+"') format('woff2');font-style:italic;font-weight:normal;}\n@font-face{font-family:'DJS_sansserif';src:url('"+a.arimoRFont()+"') format('woff2');font-style:normal;font-weight:normal;}\n@font-face{font-family:'DJS_monospace';src:url('"+
a.cousineBFont()+"') format('woff2');font-style:normal;font-weight:bold;}\n@font-face{font-family:'DJS_monospace';src:url('"+a.cousineBIFont()+"') format('woff2');font-style:italic;font-weight:bold;}\n@font-face{font-family:'DJS_monospace';src:url('"+a.cousineIFont()+"') format('woff2');font-style:italic;font-weight:normal;}\n@font-face{font-family:'DJS_monospace';src:url('"+a.cousineRFont()+"') format('woff2');font-style:normal;font-weight:normal;}\n@font-face{font-family:'DJS_serif';src:url('"+
a.tinosBFont()+"') format('woff2');font-style:normal;font-weight:bold;}\n@font-face{font-family:'DJS_serif';src:url('"+a.tinosBIFont()+"') format('woff2');font-style:italic;font-weight:bold;}\n@font-face{font-family:'DJS_serif';src:url('"+a.tinosIFont()+"') format('woff2');font-style:italic;font-weight:normal;}\n@font-face{font-family:'DJS_serif';src:url('"+a.tinosRFont()+"') format('woff2');font-style:normal;font-weight:normal;}\n@font-face{font-family:'DJS_math';src:url('"+a.mathBFont()+"') format('woff2');font-style:normal;font-weight:bold;}\n@font-face{font-family:'DJS_math';src:url('"+
a.mathBFont()+"') format('woff2');font-style:italic;font-weight:bold;}\n@font-face{font-family:'DJS_math';src:url('"+a.mathRFont()+"') format('woff2');font-style:italic;font-weight:normal;}\n@font-face{font-family:'DJS_math';src:url('"+a.mathRFont()+"') format('woff2');font-style:normal;font-weight:normal;}\n"};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.symbolFont=function(){return"data:font/woff2;charset=utf-8;base64, "};a.addSymbolFont=
function(){return"@font-face{font-family:'DJS_symbol';src:url('"+a.symbolFont()+"') format('woff2');font-style:normal;font-weight:bold;}\n@font-face{font-family:'DJS_symbol';src:url('"+a.symbolFont()+"') format('woff2');font-style:italic;font-weight:bold;}\n@font-face{font-family:'DJS_symbol';src:url('"+a.symbolFont()+"') format('woff2');font-style:italic;font-weight:normal;}\n@font-face{font-family:'DJS_symbol';src:url('"+a.symbolFont()+"') format('woff2');font-style:normal;font-weight:normal;}"};
return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,e,d,r={bold:"Bold",italic:"Italic",italics:"Italic","bold+italic":"Italic Bold"};a.serif_font="descartesJS_serif,DJS_symbol,DJS_serif,Times,'Times New Roman','Liberation Serif','Nimbus Roman No9 L Regular',serif";a.sansserif_font="descartesJS_sansserif,DJS_symbol,DJS_sansserif,Helvetica,Arial,'Liberation Sans','Nimbus Sans L',sans-serif";a.monospace_font="descartesJS_monospace,DJS_symbol,DJS_monospace,'Courier New',Courier,'Liberation Mono','Nimbus Mono L',monospace";a.math_font=
"descartesJS_math,DJS_symbol,DJS_math,DJS_serif,Times,'Times New Roman','Liberation Serif','Nimbus Roman No9 L Regular',serif";a.convertFont=function(d){if(""==d)return"";f=d.split(",");e="";e+=a.getFontStyle(f[1])+" ";e+=f[2]+"px ";return e+=a.getFontName(f[0].split(" ")[0])};a.getFontName=function(e){e=e.toLowerCase();d=a.monospace_font;if("serif"===e||"times new roman"===e||"timesroman"===e||"times"===e)d=a.serif_font;else if("sansserif"===e||"arial"===e||"helvetica"===e)d=a.sansserif_font;return d};
a.getFontStyle=function(a){return r[a.toLowerCase()]||""};a.getTextWidth=function(d,b){a.ctx.font=b;return Math.round(a.ctx.measureText(d).width)};a.getFieldFontSize=function(a){a=Math.min(50,a);return a=24<=a?Math.floor(a/2+2-a/16):20<=a?12:17<=a?11:15<=a?10:9};return a}(descartesJS||{});
descartesJS=function(a){function f(){var a,b,g,d,e,h,l;Number.prototype.oToFixed=Number.prototype.toFixed;Number.prototype.toFixed=function(c){c=Math.max(0,parseInt(void 0===c?0:c));a=this.toString();-1!==a.indexOf("e")&&(d=a.split("e"),h="-"===d[0][0]?"-":"",e="-"===h?parseFloat(d[0].substring(1)).oToFixed(11):parseFloat(d[0]).oToFixed(11),l=parseInt(d[1]),b=e.indexOf("."),e=e.replace(".",""),0>b+l?(b=0>b?1:b,a=h+"0."+"0".repeat(Math.abs(b+l))+e):a=h+e+"0".repeat(l-e.length+1));b=a.indexOf(".");
-1===b?0<c&&(a+="."+"0".repeat(c)):(g=a.length-b-1,a=g>=c?11>=c?parseFloat(a).oToFixed(c):a.substring(0,b+c+1):a+"0".repeat(c-g));return a}}if(a.loadLib)return a;var e=360/(2*Math.PI),d=2*Math.PI/360,r=Math.floor,n,b,h,l;a.rangeOK=1;a.cssScale=1;a.radToDeg=function(a){return a*e};a.degToRad=function(a){return a*d};a.getFeatures=function(){var c="";try{c=navigator.appVersion.toLowerCase()}catch(k){console.warn("navigator.appVersion is deprecated")}a.hasTouchSupport=window.hasOwnProperty&&window.hasOwnProperty("ontouchstart")||
"ontouchstart"in window||/android/i.test(c);a.isIOS=/iPad|iPhone/i.test(navigator.userAgent);a.isMsEdge=/Edge/i.test(navigator.userAgent);c=a.newHTML("canvas");a.hasCanvas=c.getContext&&c.getContext("2d");a.hasCanvas&&(c.width=c.height=1,a.ctx=a.hasCanvas,a._ratio=2);f()};a.removeNeedlessDecimals=function(a){if("string"==typeof a&&(h=a.indexOf("."),-1!==h)){l=a.substring(h);if(0==parseFloat(l))return a.substring(0,h);for(var c=l.length-1;0<c;c--)if("0"!==l.charAt(c))return a.substring(0,h+c+1)}return a};
a.whichBtn=function(a){return a.touches?"L":0===a.button?"L":1===a.button?"M":"R"};a.createGradient=function(a,b,g){a=void 0===a?0:a;b=void 0===b?100:b;g="linear-gradient("+(void 0===g?0:g)+"deg,";for(var c=2*a,k=a;k<b;k++)a=r(100-k-35),g+="rgba(0,0,0,"+a*a*192/1E4/255+") "+(2*k-c)+"%, ";return g+"rgba(0,0,0,0.1) 100%)"};a.getCursorPosition=function(c,k){n=c.touches?c.touches[0]:c;b=k.getBoundingClientRect();return n?{x:(n.pageX-window.scrollX-b.left)/a.cssScale,y:(n.pageY-window.scrollY-b.top)/a.cssScale}:
null};a.splitSeparator=function(a){a=a.replace(/\\n/g,"\n");for(var c=!1,b,d=[],e=0,h=0,l=a.length;h<l;h++)b=a.charAt(h),"'"===b&&(c=!c),c||";"!==b&&"\n"!==b||(d.push(a.substring(e,h).replace(/\n/g,"\\n")),e=h+1);d.push(a.substring(e).replace(/\n/g,"\\n"));return d};a.preventDefault=function(a){a.preventDefault();return!1};a.convertHTMLEntities=function(c){var b=a.newHTML("textarea");b.innerHTML=c;return b.value};a.newHTML=function(a,b){a=document.createElement(a);for(var c in b)a.setAttribute(c,
b[c]);return a};window.requestAnimationFrame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame;window.cancelAnimationFrame=window.cancelAnimationFrame||window.mozCancelAnimationFrame;a.setInterval=function(a,b){function c(){Date.now()-k>=b&&(a.call(),k=Date.now());d.value=requestAnimationFrame(c)}if(!requestAnimationFrame)return setInterval(a,b);var k=Date.now(),d={};d.value=requestAnimationFrame(c);return d};a.clearInterval=
function(a){a&&(cancelAnimationFrame?cancelAnimationFrame(a.value):clearInterval(a))};a.setTimeout=function(a,b){function c(){Date.now()-k>=b?a.call():d.value=requestAnimationFrame(c)}if(!requestAnimationFrame)return setTimeout(a,b);var k=Date.now(),d={};d.value=requestAnimationFrame(c);return d};a.clearTimeout=function(a){a&&(cancelAnimationFrame?cancelAnimationFrame(a.value):clearTimeout(a))};a.showAbout=function(){var c="<html>\n<head>\n<style>\nbody{text-align:center;}\niframe{width:650px;height:73px;overflow:hidden;border:1px solid black;}\ndt{font-weight:bold;margin-top:10px;}\n</style>\n</head>\n<body>\n<iframe src='https://arquimedes.matem.unam.mx/Descartes5/creditos/bannerPatrocinadores.html'></iframe>\n<h2><a href='https://proyectodescartes.org/' target='_blank'>ProyectoDescartes.org</a><br><a href='https://descartesjs.org' target='_blank'>DescartesJS.org</a></h2>\n<dl>\n<dt>Dise\u00f1o funcional:</dt>\n<dd>\n<nobr>Jos\u00e9 Luis Abreu Leon,</nobr>\n<nobr>Jos\u00e9 R. Galo Sanchez,</nobr>\n<nobr>Juan Madrigal Muga</nobr>\n</dd>\n<dt>Autores del software:</dt>\n<dd>\n<nobr>Jos\u00e9 Luis Abreu Leon,</nobr>\n<nobr>Marta Oliver\u00e1 Serrat,</nobr>\n<nobr>Oscar Escamilla Gonz\u00e1lez,</nobr>\n<nobr>Joel Espinosa Longi</nobr>\n</dd></dl>\n<p>\nEl software en Java est\u00e1 bajo la licencia\n<a href='https://joinup.ec.europa.eu/software/page/eupl/licence-eupl'>EUPL v.1.1</a>\n<br>\nEl software en JavaScript est\u00e1 bajo licencia\n<a href='https://www.gnu.org/licenses/lgpl.html'>LGPL</a>\n</p>\n<p>\nLa documentaci\u00f3n y el c\u00f3digo fuente se encuentran en :\n<br>\n<a href='https://descartes.matem.unam.mx/'>https://descartes.matem.unam.mx/</a>\n</p>";
a.ccLicense&&(c+="<p>\nEste objeto, creado con Descartes, est\u00e1 licenciado\npor sus autores como\n<a href='https://creativecommons.org/licenses/by-nc-sa/4.0/deed.es'><nobr>Creative Commons</nobr></a>\n<br>\n<a href='https://creativecommons.org/licenses/by-nc-sa/4.0/deed.es'><img src='https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png'></a>\n</p>");c+="</body> </html>";var b=window.open("","creditos","width=700,height=500,titlebar=0,toolbar=0,location=0,menubar=0,resizable=0,scrollbars=0,status=0");
b.document.write(c);b.document.close()};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.cacheFiles=Object.create(null);a.openFile=function(f){if(a.cacheFiles[f])return a.cacheFiles[f];var e=null,d=new XMLHttpRequest;d.open("GET",f,!1);try{d.send(null),e=200===d.status||304===d.status?d.responseText:d.responseText||"",e=404===d.status?"":e,e.match(String.fromCharCode(65533))&&(d.open("GET",f,!1),d.overrideMimeType("text/plain;charset=ISO-8859-1"),d.send(null),e=d.responseText)}catch(r){e=null}return e};a.addExternalFileContent=function(f,
e){a.cacheFiles[f]=e};return a}(descartesJS||{});
descartesJS=function(a){function f(a){z=a.indexOf("--radial--");-1!=z&&(a=a.substring(0,z));a=a.replace(/\+/g,"\\+").replace(/\*/g,"\\*");n=a.trim();a={ignoreAccents:!1,ignoreCaps:!1,regExp:null};n[0]==n[n.length-1]&&"'"==n[0]&&(a.ignoreCaps=!0,n=n.substring(1,n.length-1),"`"==n[0]&&"\u00b4"==n[n.length-1]&&(a.ignoreAccents=!0,n=n.substring(1,n.length-1)));"`"==n[0]&&"\u00b4"==n[n.length-1]&&(a.ignoreAccents=!0,n=n.substring(1,n.length-1),n[0]==n[n.length-1]&&"'"==n[0]&&(a.ignoreCaps=!0,n=n.substring(1,
n.length-1)));"*"===n.charAt(0)&&"*"!==n.charAt(n.length-1)?n=n.substring(1)+"$":"*"!==n.charAt(0)&&"*"===n.charAt(n.length-1)?n="^"+n.substring(0,n.length-1):"*"!==n.charAt(0)&&"*"!==n.charAt(n.length-1)?n="^"+n+"$":"*"===n.charAt(0)&&"*"===n.charAt(n.length-1)&&(n=n.substring(1,n.length-1));a.regExp=n.replace(/\?/g,"[\\S\\s]{1}");return a}function e(a,c){n=(a||"").trim();a={ignoreAccents:!1,ignoreCaps:!1,regExp:null};a.expr=n.split(",");a.expr[0]=a.expr[0].trim();a.expr[0]={type:a.expr[0].charAt(0),
expr:c.parser.parse(a.expr[0].substring(1))};a.expr[1]=a.expr[1].trim();a.expr[1]={type:a.expr[1].charAt(a.expr[1].length-1),expr:c.parser.parse(a.expr[1].substring(0,a.expr[1].length-1))};return a}function d(a,b,d){b=parseFloat(b);c=a.expr[0];k=a.expr[1];g=d.eval(c.expr);v=d.eval(k.expr);u="("==c.type||"["==c.type;p=")"==k.type||"]"==k.type;return u&&b>g&&p&&b<=v?1:0}function r(a){return a.toString().replace(/\u00e1/g,"a").replace(/\u00e9/g,"e").replace(/\u00ed/g,"i").replace(/\u00f3/g,"o").replace(/\u00fa/g,
"u").replace(/\u00c1/g,"A").replace(/\u00c9/g,"E").replace(/\u00cd/g,"I").replace(/\u00d3/g,"O").replace(/\u00da/g,"U").replace(/\u00f1/g,"n").replace(/\u00d1/g,"N")}if(a.loadLib)return a;var n,b,h,l,c,k,g,v,u,p,z;a.buildRegularExpressionsPatterns=function(a,c){a=a||"";"("===a.charAt(0)&&")"===a.charAt(a.length-1)&&-1===a.indexOf(",")&&(a=a.substring(1,a.length-1));a=a.replace(/&squot;/g,"'").replace(/&amp;/g,"&").split("|");for(var g=0,m=a.length;g<m;g++){b=a[g].split("&");h=[];for(var k=0,d=b.length;k<
d;k++)n=b[k],-1===n.indexOf(",")||"("!==n.charAt(0)&&"["!==n.charAt(0)||")"!==n.charAt(n.length-1)&&"]"!==n.charAt(n.length-1)?h.push(f(n)):h.push(e(n,c));a[g]=h}return a};a.escorrecto=function(c,g,k,e){k=k||a.externalEvaluator;e=e||a.buildRegularExpressionsPatterns(c,k);g=r(g);c=0;for(var m=e.length;c<m;c++){b=e[c];l=!0;for(var h=0,u=b.length;h<u;h++)l=b[h].regExp?l&&!!g.match(new RegExp(r(b[h].regExp),"i")):l&&d(b[h],g,k);if(l)return 1}return 0};a.esCorrecto=function(c,g,k,e){k=k||a.externalEvaluator;
e=e||a.buildRegularExpressionsPatterns(c,k);g+="";c=0;for(var m=e.length;c<m;c++){b=e[c];l=!0;for(var h=0,u=b.length;h<u;h++)(n=b[h].regExp)?(b[h].ignoreAccents&&(g=r(g),n=r(n)),b[h].ignoreCaps&&(g=g.toLowerCase(),n=r(n).toLowerCase()),l=l&&!!g.match(n)):l=l=l&&d(b[h],g,k);if(l)return 1}return 0};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.loaderImg=new Image;a.loaderImg.src="data:image/svg+xml;base64,"+btoa("<svg xmlns='http://www.w3.org/2000/svg' width='880' height='840' viewBox='0 0 880 840'><path d='M440 80c-132.5 0-240 107.5-240 240s107.5 240 240 240 240-107.5 240-240S572.5 80 440 80zm-11.1 462.2c-122.7 0-224.4-99.5-224.4-222.2S306.2 97.8 428.9 97.8 651.1 197.3 651.1 320s-99.5 222.2-222.2 222.2zm-11.1-426.6c-112.9 0-208.9 91.5-208.9 204.4s96 204.4 208.9 204.4S622.2 432.9 622.2 320s-91.5-204.4-204.4-204.4zm-11.1 391.1c-103.1 0-193.3-83.6-193.3-186.7s90.2-186.7 193.3-186.7S593.3 216.9 593.3 320s-83.5 186.7-186.6 186.7zm-11.1-355.6c-93.3 0-177.8 75.6-177.8 168.9s84.5 168.9 177.8 168.9S564.4 413.3 564.4 320c0-93.3-75.6-168.9-168.8-168.9zm-11.2 320c-83.5 0-162.2-67.7-162.2-151.1S301 168.9 384.4 168.9 535.6 236.5 535.6 320s-67.7 151.1-151.2 151.1zm-11.1-284.4c-73.6 0-146.7 59.7-146.7 133.3s73 133.3 146.7 133.3S506.7 393.6 506.7 320 447 186.7 373.3 186.7zm-11.1 248.9c-63.8 0-131.1-51.7-131.1-115.6s67.3-115.6 131.1-115.6S477.8 256.2 477.8 320 426 435.6 362.2 435.6zm-11.1-213.4c-54 0-115.6 43.8-115.6 97.8s61.6 97.8 115.6 97.8c54 0 97.8-43.8 97.8-97.8s-43.8-97.8-97.8-97.8zM340 400c-44.2 0-100-35.8-100-80s55.8-80 100-80 80 35.8 80 80-35.8 80-80 80z' fill='#2daae4'/><path d='M115.8 600.7c32.5 0 48.8 24.8 48.8 49.7 0 24.9-16.2 49.6-48.8 49.6H80.2v-99.3zm0 85c23 0 34.6-17.6 34.6-35.2s-11.6-35.4-34.6-35.4H94.5v70.6zm118.2 0V700h-60.6v-99.3h60.5V615h-46v28h45v14.5h-45l-.05 28.2zm42.2.9c10.6 0 22.3-6 22.3-16.2 0-1-.1-2.1-.4-3.4-1.7-7.5-11.9-8.8-21.9-9.8-15.5-1.6-33.7-5-35.2-25.65-.6-6.65 1.1-13.25 5.4-18.85 6.7-8.7 18.6-13.2 30.1-13.2 15.3 0 31.2 8 33.8 26.1l-14.3.7c-2-8.9-11.6-12.8-20.3-12.6-6.7.1-14.1 2.4-18 7.5-2 2.6-2.7 5.8-2.4 9.2.7 10.2 11.9 11.5 22.6 12.5 13.6 1.7 30.5 5.3 34.4 21.2.4 2.1.7 4.5.7 6.5 0 19.2-19 30.2-36.9 30.2-15.3 0-33.9-9.1-35.8-26.8l-.1-2.7 14.5-.3.1 1.8c1 8.9 12.2 13.8 21.4 13.8zm58-71.7c8.7-8.9 20.9-14.8 34.4-14.8 22.7 0 40.6 14.2 46.3 36.6h-14.2c-5.3-14.9-17.5-22.4-32.1-22.4-9.5 0-18.2 4.1-24.4 10.7-6.2 6.5-10.2 15.3-10.2 25.6 0 9.9 4 18.7 10.2 25.3 6.2 6.6 14.9 10.6 24.4 10.6 15.1 0 27.8-8.7 32.9-23.7h14.1c-5.7 22.6-23.9 37.9-47 37.9-13.5 0-25.7-5.7-34.4-14.8-8.5-9.1-14.2-21.6-14.2-35.4 0-14 5.7-26.5 14.2-35.6zm144.6 55.8h-35.6c-3.8 9.1-8.8 21-11.9 29.3h-15.5l39.9-100.7h10.5L506 700h-15.3zm-30.3-13.4h24.7L461 622.2zm96.9-7.7c12.1 0 18-8.7 18-17.3 0-8.5-6-17.2-18-17.2h-22V700h-14.2v-99.4h36.2c21.6 0 32.4 15.9 32.4 31.7 0 14.1-8.7 27.4-25.7 30.4l31.4 37.3h-18.6l-36.2-43.6-.05-6.8zm64.9 50.8v-85.3h-30.1v-14.5h74.4v14.5h-30v85.3zm112.2-14.7V700H662v-99.3h60.5V615h-46v28h45v14.5h-45l-.05 28.2zm42.3.9c10.6 0 22.3-6 22.3-16.2 0-1-.1-2.1-.4-3.4-1.7-7.5-11.9-8.8-21.9-9.8-15.5-1.6-33.7-5-35.2-25.65-.6-6.65 1.1-13.25 5.4-18.85 6.7-8.7 18.6-13.2 30.1-13.2 15.3 0 31.2 8 33.8 26.1l-14.3.7c-2-8.9-11.6-12.8-20.3-12.6-6.7.1-14.1 2.4-18 7.5-2 2.6-2.7 5.8-2.4 9.2.7 10.2 11.9 11.5 22.6 12.5 13.6 1.7 30.5 5.3 34.4 21.2.4 2.1.7 4.5.7 6.5 0 19.2-19 30.2-36.9 30.2-15.3 0-33.9-9.1-35.8-26.8l-.1-2.7 14.5-.3.1 1.8c1 8.9 12.2 13.8 21.4 13.8z' fill='#868686'/></svg>");a.getCCLImg=
function(){var a=new Image;a.src="data:image/svg+xml;base64,"+btoa("<svg xmlns='http://www.w3.org/2000/svg' width='88' height='31' viewBox='0 0 120 42'><path fill='#aab2ab' stroke='#000' d='M.5.5h119v41H.5z'/><path d='M0 29.5h120V42H0z'/><circle cx='21' cy='19.5' r='18.25' fill='#aab2ab'/><path d='M49.935 33.105c.364.298.585.806.585 1.284 0 .403-.07.592-.228.833-.158.242-.377.405-.674.547.41.118.715.323.917.617.202.294.303.649.303 1.063 0 .68-.302 1.117-.721 1.465-.432.359-1.067.455-1.622.455H45.28v-6.622h3.122c.579 0 1.127.025 1.533.358zM48.8 35.24c.175-.141.307-.323.307-.6 0-.331-.126-.473-.307-.612-.188-.145-.351-.147-.697-.147H46.74v1.545h1.363c.26 0 .51-.035.697-.186zm-.5 2.996c.288 0 .553-.018.753-.181a.885.885 0 0 0 .325-.691c0-.34-.095-.552-.288-.727-.196-.177-.446-.218-.762-.218h-1.59v1.817zm2.795-5.489h1.633l1.55 2.616 1.543-2.616h1.623l-2.459 4.08v2.542h-1.46v-2.578zm21.34 6.622H71.07v-6.622h1.448l2.774 4.443.008-4.443h1.367v6.622H75.21l-2.765-4.433zm8.48-5.558c-1.07 0-1.893.887-1.893 2.224 0 1.336.91 2.263 1.893 2.263.823 0 1.503-.646 1.503-1.485h1.41c0 1.63-1.022 2.704-2.913 2.704-1.89 0-3.259-1.07-3.259-3.434 0-2.363 1.407-3.499 3.26-3.499 1.853 0 2.857.96 2.857 2.386h-1.41c0-.774-.755-1.159-1.448-1.159zm17.845 4.297c.27.228.68.283 1.023.283.485 0 .93-.072 1.157-.413.157-.235.118-.615-.043-.848-.223-.323-.713-.38-1.078-.474-.498-.129-.996-.18-1.437-.412-.411-.215-.835-.486-1.078-.881-.139-.225-.172-.506-.172-.775 0-.703.348-1.153.788-1.513.453-.371 1.11-.442 1.687-.49.698-.057 1.352.088 1.843.491.472.387.697 1.03.807 1.644h-1.414c.047-.386-.17-.615-.406-.798-.241-.188-.589-.207-.895-.204-.23.002-.486.028-.669.167-.177.135-.328.36-.328.584 0 .238.161.48.352.622.444.333 1.09.218 1.621.38.398.122.854.17 1.167.445.422.371.797.972.797 1.485 0 .672-.279 1.154-.701 1.517-.54.466-1.37.532-2.055.599-.756.021-1.449-.117-1.97-.558-.505-.427-.849-1.13-.849-1.792h1.413c0 .476.176.717.44.941zm7.886-5.361l2.477 6.622h-1.512l-.501-1.475h-2.477l-.52 1.475h-1.465l2.504-6.622zm-1.632 4.06h1.716l-.845-2.427z' fill='#fff'/><g stroke-width='2' fill='#fff' stroke='#000'><circle r='14.25' cy='19.5' cx='21' stroke-width='2.8'/><circle r='10.55' cx='52' cy='15'/><circle r='10.55' cy='15' cx='78'/><circle r='10.55' cx='104' cy='14.981'/></g><circle r='1.625' cy='9' cx='52'/><path d='M18.75 17.979c-.39-.852-.974-1.278-1.755-1.278-1.378 0-2.067.928-2.067 2.784 0 1.856.69 2.783 2.067 2.783.91 0 1.56-.452 1.951-1.357l1.91 1.017c-.91 1.618-2.277 2.428-4.098 2.428-1.406 0-2.531-.43-3.377-1.292-.846-.862-1.27-2.05-1.27-3.564 0-1.487.438-2.668 1.31-3.543.87-.875 1.958-1.312 3.259-1.312 1.926 0 3.304.759 4.14 2.275zm8.99 0c-.39-.852-.964-1.278-1.72-1.278-1.405 0-2.109.928-2.109 2.784 0 1.856.704 2.783 2.11 2.783.912 0 1.55-.452 1.915-1.357l1.953 1.017c-.91 1.618-2.274 2.428-4.092 2.428-1.404 0-2.526-.43-3.372-1.292-.843-.862-1.266-2.05-1.266-3.564 0-1.487.429-2.668 1.287-3.543.857-.875 1.947-1.312 3.273-1.312 1.923 0 3.3.759 4.13 2.275l-2.108 1.059zm27.381-5.862a.75.75 0 0 0-.75-.75h-4.743a.75.75 0 0 0-.749.75v4.742h1.324v5.617h3.594v-5.617h1.324zm13.779-.352l10.343 4.66a.867.867 0 0 1 .312.696c0 .887-.754 1.154-1.435 1.154-1.05 0-1.818-.324-2.588-1.048l-1.598 1.609c.962.84 2.22 1.374 3.52 1.389v1.789h1.332v-1.79c1.584-.115 2.895-1.108 3.191-2.58l4.471 2.048.852-2.129-10.391-4.682a.467.467 0 0 1-.106-.295c0-.723.814-.9 1.39-.9.71 0 1.42.281 1.983.68L81.7 10.8a5.005 5.005 0 0 0-2.914-1.065V7.95h-1.332v1.787c-1.417.083-2.587.83-2.987 2.059l-4.533-2.073zm29.88 1.58c.461-2.918 2.515-4.478 5.09-4.478 3.7 0 5.957 2.686 5.957 6.268 0 3.495-2.4 6.21-6.016 6.21-2.487 0-4.714-1.53-5.12-4.535h2.922c.087 1.56 1.1 2.109 2.546 2.109 1.648 0 2.718-1.53 2.718-3.87 0-2.456-.925-3.755-2.661-3.755-1.272 0-2.371.462-2.603 2.05l.85-.005-2.3 2.3-2.299-2.3.915.006z'/></svg>");
return a};a.getSvgArrowUp=function(a,e){return"data:image/svg+xml;base64,"+btoa('<svg xmlns=\'http://www.w3.org/2000/svg\' width="24" height="24" viewBox="0 0 24 24"><path transform="rotate('+(a?90:0)+',12,12)" fill="#'+(void 0===e?"24c":e)+'" d="m19.5 17.5-7.5-12-7.5 12z"/></svg>')};a.getSvgArrowDown=function(a,e){return"data:image/svg+xml;base64,"+btoa('<svg xmlns=\'http://www.w3.org/2000/svg\' width="24" height="24" viewBox="0 0 24 24"><path transform="rotate('+(a?90:0)+',12,12)" d="m19.5 5-7.5 12-7.5-12z" fill="#'+
(void 0===e?"d00018":e)+'"/></svg>')};a.getSvgMenu=function(){return"data:image/svg+xml;base64,"+btoa("<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'><path d='M6.64 8L12 12.962 17.36 8 19 9.519 12 16 5 9.519z'/></svg>")};a.getSvgCheckbox=function(){return"data:image/svg+xml;base64,"+btoa("<svg xmlns='http://www.w3.org/2000/svg' width='45' height='45' viewBox='0 0 45 45'><path d='M37.095 6.284L15.473 27.905l-7.568-7.567L2.5 25.743l12.973 12.973L42.5 11.69z' fill='#1e272e'/></svg>")};
a.getSvgRadio=function(){return"data:image/svg+xml;base64,"+btoa('<svg xmlns=\'http://www.w3.org/2000/svg\' width="45" height="45" viewBox="0 0 45 45"><circle cx="22.5" cy="22.5" r="15" fill="#1e272e"/></svg>')};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=Math.floor,e=/[\w-//]*(\.png|\.jpg|\.gif|\.svg|\.webp)/gi,d,r,n,b,h,l,c,k,g,v,u,p,z,q,m,y,w,x,A=function(c,g){this.r=this.g=this.b=0;this.a=1;this.evaluator=g;this.getColor=this.getColorStr;if(!c)this.colorStr="rgba("+this.r+","+this.g+","+this.b+","+this.a+")";else if(c.match(/^GradL/)){c=this.splitComa(c.substring(6,c.length-1));this.x1=this.evaluator.parser.parse(c[0]);this.y1=this.evaluator.parser.parse(c[1]);this.x2=this.evaluator.parser.parse(c[2]);
this.y2=this.evaluator.parser.parse(c[3]);this.stops=[];for(var k=4;k<c.length;k++)""!=c[k]&&(g=c[k].split("|"),this.stops.push({percentage:this.evaluator.parser.parse(g[1]),color:"#"+g[2]}));this.getColor=this.getLinearGradient}else if(c.match(/^Pattern/))this.img_src=c.substring(8,c.length-1),this.img_src.match(e)&&(this.img_src="'"+this.img_src+"'"),this.img_src=this.evaluator.parser.parse(this.img_src),this.getColor=this.getPattern;else if(babel[c])"net"===babel[c]&&(c="rojo"),c=babel[c],this.r=
a.toHex(c.substring(1,3)),this.g=a.toHex(c.substring(3,5)),this.b=a.toHex(c.substring(5,7)),this.colorStr=c;else if(6===c.length)this.r=a.toHex(c.substring(0,2)),this.g=a.toHex(c.substring(2,4)),this.b=a.toHex(c.substring(4,6)),this.colorStr="#"+c;else if(8===c.length)this.r=a.toHex(c.substring(2,4)),this.g=a.toHex(c.substring(4,6)),this.b=a.toHex(c.substring(6,8)),this.a=1-a.toHex(c.substring(0,2))/255,this.colorStr="rgba("+this.r+","+this.g+","+this.b+","+this.a+")";else if("("===c[0]){r=[];n=this.splitComa(c.substring(1,
c.length-1));c=0;for(g=n.length;c<g;c++)l=n[c],b=parseInt(l,16),l!==b.toString(16)&&l!=="0"+b.toString(16)?("["===l.charAt(0)&&"]"===l.charAt(l.length-1)&&(l=l.substring(1,l.length-1)),r.push(this.evaluator.parser.parse(l))):r.push(this.evaluator.parser.parse((b/255).toString()));this.rExpr=r[0];this.gExpr=r[1];this.bExpr=r[2];this.aExpr=r[3];this.getColor=this.getColorExp}};A.prototype.splitComa=function(a){h=[];for(var b=g=k=c=0,m=a.length;b<m;b++)v=a.charAt(b),"("===v?c++:")"===v?c--:"["===v?k++:
"]"===v?k--:","===v&&0===c&&0===k&&(h.push(a.substring(g,b)),g=b+1);h.push(a.substring(g));return h};A.prototype.getColorStr=function(){return this.colorStr};A.prototype.getColorExp=function(){d=this.evaluator;this.r=f(255*d.eval(this.rExpr));this.g=f(255*d.eval(this.gExpr));this.b=f(255*d.eval(this.bExpr));this.a=1-d.eval(this.aExpr);return"rgba("+this.r+","+this.g+","+this.b+","+this.a+")"};A.prototype.getLinearGradient=function(){y=a.ctx.createLinearGradient(this.evaluator.eval(this.x1),this.evaluator.eval(this.y1),
this.evaluator.eval(this.x2),this.evaluator.eval(this.y2));for(var c=0;c<this.stops.length;c++)m=this.evaluator.eval(this.stops[c].percentage),m=0>m?0:1<m?1:m,y.addColorStop(m,this.stops[c].color);return y};A.prototype.getPattern=function(){x=this.evaluator.parent;if(w=x.getImage(this.evaluator.eval(this.img_src)))try{return a.ctx.createPattern(w,"repeat")}catch(H){}return"ff00ff"};A.prototype.borderColor=function(){return 380>this.r+this.g+this.b?"#ffffff":"#000000"};a.toHex=function(a){return parseInt("0x"+
a,16)};a.RGBAToHexColor=function(a){a=a.substring(5,a.length-1).split(",");u=parseInt(a[0]).toString(16);p=parseInt(a[1]).toString(16);z=parseInt(a[2]).toString(16);q=(255-parseInt(255*parseFloat(a[3]))).toString(16);1===u.length&&(u="0"+u);1===p.length&&(p="0"+p);1===z.length&&(z="0"+z);1===q.length&&(q="0"+q);return new A(q+u+p+z)};a.Color=A;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=function(e){var d=this;this.parent=e;this.container=a.newHTML("div",{class:"DescartesKeyboardContainer"});this.container.oncontextmenu=function(){return!1};this.display=a.newHTML("textarea",{class:"DescartesKeyboardDisplay",spellcheck:"false",inputmode:"none"});this.container.appendChild(this.display);this.keyContainer=a.newHTML("div",{style:"position:absolute; padding-bottom:5px;",class:"DescartesKeysContainer"});this.container.appendChild(this.keyContainer);
this.additionalKeys=a.newHTML("div",{style:"position:absolute; padding: 0 5px 5px 0; display:none;",class:"DescartesKeysContainer"});this.container.appendChild(this.additionalKeys);this.newLine=a.newHTML("div",{style:"position:absolute; background-color:white; margin:0; font-family:DJS_sansserif; font-size:17px; font-weight:normal; line-height:38px",class:"new_line_btn"});this.newLine.textContent="\\n";this.newLine.addEventListener("pointerup",function(){d.insert("\n")});this.container.appendChild(this.newLine);
this.display.addEventListener("keydown",function(a){d.keypressed=!0;if(27===a.keyCode)d.close();else if(13===a.keyCode)d.onEnter()});this.key_pressed=!1;var f;this.delete_pressed=!1;var n;this.keyContainer.addEventListener("pointerdown",function(a){if("k_op"==a.target.id||"k_dot"==a.target.id||"k_a"==a.target.id||"k_e"==a.target.id||"k_i"==a.target.id||"k_o"==a.target.id||"k_u"==a.target.id){a.target.onpointerleave=function(){clearTimeout(f)};var b=a.target.textContent.trim().toLowerCase();f=setTimeout(function(){d.key_pressed=
!0;d.showAditionalKeys(b)},600)}else"k_delete"==a.target.id&&(a.target.onpointerleave=function(){clearTimeout(n)},n=setInterval(function(){d.delete_pressed=!0;d.delete()},200))});this.keyContainer.addEventListener("pointerup",function(a){if(a.target!=d.keyContainer&&a.target!=d.container)if(a.preventDefault(),a.stopPropagation(),"k_left"==a.target.id)d.display.selectionStart=d.display.selectionEnd=Math.max(0,d.display.selectionStart-1);else if("k_right"==a.target.id)d.display.selectionStart=d.display.selectionEnd=
Math.min(d.display.value.length,d.display.selectionStart+1);else if("k_delete"==a.target.id)d.delete_pressed||d.delete(),clearTimeout(n),d.delete_pressed=!1;else if("k_\u221a"==a.target.id)d.insert("\u221a(");else if("k_space"==a.target.id)d.insert(" ");else if("k_esc"==a.target.id)d.close();else if("k_shift"==a.target.id){a=d.keyContainer.querySelectorAll("div");var b=d.additionalKeys.querySelectorAll("div");d.shift=!d.shift;d.shift?(a.forEach(function(a){1==a.textContent.trim().length&&(a.textContent=
a.textContent.toUpperCase());"k_point_comma"==a.getAttribute("id")&&(a.textContent=",")}),b.forEach(function(a){a.textContent=a.textContent.toUpperCase()})):(a.forEach(function(a){1==a.textContent.trim().length&&(a.textContent=a.textContent.toLowerCase());"k_point_comma"==a.getAttribute("id")&&(a.textContent=".")}),b.forEach(function(a){a.textContent=a.textContent.toLowerCase()}))}else if("k_num_layout"==a.target.id)d["setLayout_"+d.layout_mode.replace("alfa","num")]();else if("k_alfa_layout"==a.target.id)d["setLayout_"+
d.layout_mode.replace("num","alfa")]();else if("k_clear"==a.target.id)d.display.value="";else if("k_op"==a.target.id||"k_dot"==a.target.id||"k_a"==a.target.id||"k_e"==a.target.id||"k_i"==a.target.id||"k_o"==a.target.id||"k_u"==a.target.id)clearTimeout(f),d.key_pressed||(d.insert(a.target.textContent.trim()),d.additionalKeys.style.display="none"),d.key_pressed=!1;else if("k_return"==a.target.id)d.onEnter();else a=a.target.textContent.trim(),d.insert(a),d.additionalKeys.style.display="none";d.display.focus()});
this.keyContainer.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation()});var b=!1;this.additionalKeys.addEventListener("pointerdown",function(a){b=!0});this.additionalKeys.addEventListener("pointerup",function(a){b&&(a.target!=d.keyContainer&&a.target!=d.container&&(a.preventDefault(),a.stopPropagation(),a=a.target.textContent.trim(),d.insert(a)),d.key_pressed=!1,d.additionalKeys.style.display="none");b=!1;d.display.focus()})};f.prototype.insert=function(a){this.display.setRangeText(a);
this.display.selectionStart+=a.length;this.display.selectionStart=this.display.selectionEnd;this.display.focus()};f.prototype.delete=function(){this.display.selectionStart==this.display.selectionEnd&&(this.display.selectionStart=Math.max(0,this.display.selectionStart-1));this.display.setRangeText("")};f.prototype.addKey=function(a,d,f){return"<div "+(d?"id='"+d+"'":"")+" "+(f?"style='"+f+"'":"")+">"+a+"</div>"};f.prototype.addKeys=function(a){var d=this,e="";a.forEach(function(a){e="object"===typeof a?
e+d.addKey(a.val,a.id,a.style):e+d.addKey(a)});return e};f.prototype.showAditionalKeys=function(a){var d=[];"."==a?d=",;:-_\u00bf?\u00a1!()".split(""):"+"==a?d=["-","\u00d7","\u00f7","^"]:"a"==a?d=["\u00e1","\u00e0","\u00e4","\u00e2"]:"e"==a?d=["\u00e9","\u00e8","\u00eb","\u00ea"]:"i"==a?d=["\u00ed","\u00ec","\u00ef","\u00ee"]:"o"==a?d=["\u00f3","\u00f2","\u00f6","\u00f4"]:"u"==a&&(d=["\u00fa","\u00f9","\u00fc","\u00fb"]);this.additionalKeys.innerHTML=this.addKeys(d);this.shift&&(this.additionalKeys.innerHTML=
this.additionalKeys.innerHTML.toUpperCase());this.additionalKeys.style.display="flex";this.additionalKeys.style.left=this.keyContainer.style.left;this.additionalKeys.style.top=parseFloat(this.keyContainer.style.top)-50+"px"};f.prototype.setLayout_14x1=function(){this.keyContainer.innerHTML=this.addKeys([1,2,3,4,5,6,7,8,9,0,{val:this.parent.decimal_symbol},"-",{val:"\u232b",id:"k_delete"},{val:"\u21b5",id:"k_return"}]);this.keyContainer.style.width="635px"};f.prototype.setLayout_7x2=function(){this.keyContainer.innerHTML=
this.addKeys([1,2,3,4,5,{val:this.parent.decimal_symbol},{val:"\u232b",id:"k_delete"},6,7,8,9,0,"-",{val:"\u21b5",id:"k_return"}]);this.keyContainer.style.width="320px"};f.prototype.setLayout_10x2=function(){this.keyContainer.innerHTML=this.addKeys(["(",1,2,3,4,5,"\u00b2","/","\u00d7",{val:"\u232b",id:"k_delete"},")",6,7,8,9,0,{val:this.parent.decimal_symbol},"-","+",{val:"\u21b5",id:"k_return"}]);this.keyContainer.style.width="455px"};f.prototype.setLayout_4x4=function(){this.keyContainer.innerHTML=
this.addKeys([7,8,9,{val:"\u232b",id:"k_delete"},4,5,6,"+",1,2,3,"-",{val:0,style:"width:85px;"},{val:this.parent.decimal_symbol},{val:"\u21b5",id:"k_return"}]);this.keyContainer.style.width="185px"};f.prototype.setLayout_5x4=function(){this.keyContainer.innerHTML=this.addKeys([7,8,9,"\u00b2",{val:"\u232b",id:"k_delete"},4,5,6,"/","\u00d7",1,2,3,"\u2212","+",{val:0,style:"width:85px;"},".",{val:"\u21b5",id:"k_return",style:"margin-left:50px;"}]);this.keyContainer.style.width="230px"};f.prototype.setLayout_11x3=
function(){this.keyContainer.innerHTML=this.addKeys(["q","w",{val:"e",id:"k_e"},"r","t","y",{val:"u",id:"k_u"},{val:"i",id:"k_i"},{val:"o",id:"k_o"},"p",{val:"\u232b",id:"k_delete"},{val:"a",id:"k_a"},"s","d","f","g","h","j","k","l","\u00f1",{val:".",id:"k_dot"},{val:"\u21c5",id:"k_shift"},"z","x","c","v","b","n","m",{val:"",id:"k_space",style:"width:85px;"},{val:"\u21b5",id:"k_return"}]);this.keyContainer.style.width="500px";this.shift=!1};f.prototype.setLayout_11x4=function(){this.keyContainer.innerHTML=
this.addKeys([1,2,3,4,5,6,7,8,9,0,{val:"\u232b",id:"k_delete"},"q","w",{val:"e",id:"k_e"},"r","t","y",{val:"u",id:"k_u"},{val:"i",id:"k_i"},{val:"o",id:"k_o"},"p",{val:"+",id:"k_op"},{val:"a",id:"k_a"},"s","d","f","g","h","j","k","l","\u00f1",{val:".",id:"k_dot"},{val:"\u21c5",id:"k_shift"},"z","x","c","v","b","n","m",{val:"",id:"k_space",style:"width:85px;"},{val:"\u21b5",id:"k_return"}]);this.keyContainer.style.width="500px"};f.prototype.setLayout_10x4_alfa=function(){this.keyContainer.innerHTML=
this.addKeys(["q","w",{val:"e",id:"k_e"},"r","t","y",{val:"u",id:"k_u"},{val:"i",id:"k_i"},{val:"o",id:"k_o"},"p",{val:"a",id:"k_a"},"s","d","f","g","h","j","k","l","\u00f1",{val:"\u21c5",id:"k_shift",style:"width:62.5px;"},"z","x","c","v","b","n","m",{val:"\u232b",id:"k_delete",style:"width:62.5px;"},{val:"123",id:"k_num_layout",style:"width:85px;"},{val:"",id:"k_space",style:"width:220px;transform:none !important;"},{val:"/",id:"k_slash"},{val:".",id:"k_dot"},{val:"\u21b5",id:"k_return"}]);this.keyContainer.style.width=
"455px"};f.prototype.setLayout_10x4_num=function(){this.keyContainer.innerHTML=this.addKeys(["1","2","3","4","5","6","7","8","9","0","@",'"',"$","_","-","+","(",")","/","*","&","|","\u00ba",":",";","\u00a1","!","\u00bf","?",{val:"\u232b",id:"k_delete"},{val:"ABC",id:"k_alfa_layout",style:"width:85px;"},{val:"",id:"k_space",style:"width:220px;transform:none !important;"},{val:",",id:"k_slash"},{val:".",id:"k_dot"},{val:"\u21b5",id:"k_return"}]);this.keyContainer.style.width="455px"};f.prototype.showCustomKB=
function(a){var d=a.querySelectorAll("div");a=parseInt(a.getAttribute("cols")||d.length);for(var e=[],f,b,h=0;h<d.length;h++){f={val:d[h].textContent};if(b=d[h].getAttribute("id"))f.id=b;if(b=d[h].getAttribute("size"))f.style="width:"+(40*parseInt(b)+5*(parseInt(b)-1))+"px;transform:none !important;";e.push(f)}this.keyContainer.innerHTML=this.addKeys(e);this.keyContainer.style.width=5+45*a+"px"};f.prototype.setLayout=function(a){this.layout_mode=a;var d=document.getElementById("kb_"+a);d?this.showCustomKB(d):
"14x1"==a?this.setLayout_14x1():"7x2"==a?this.setLayout_7x2():"10x2"==a?this.setLayout_10x2():"4x4"==a?this.setLayout_4x4():"5x4"==a?this.setLayout_5x4():"11x3"==a?this.setLayout_11x3():"11x4"==a?this.setLayout_11x4():"10x4_alfa"==a?this.setLayout_10x4_alfa():"10x4_num"==a?this.setLayout_10x4_num():this.setLayout_14x1()};f.prototype.show=function(a,d,f,n,b,h,l){this.ctr=a;this.var_id=b;this.onlyText=l;this.container.parentNode||this.parent.container.appendChild(this.container);this.container.style.display=
"block";this.setDisplay(h);this.setLayout(d);this.keyContainer.style.left=f+"px";this.keyContainer.style.top=n+"px";this.additionalKeys.style.display="none"};f.prototype.close=function(){this.container.style.display="none";this.parent.deactivateControls();this.parent.update()};f.prototype.setDisplay=function(e){if("custom"==e.type){var d=e.x;var f=e.y;var n=e.w;var b=e.h;var h=e.fs}else f=this.container.getBoundingClientRect(),b=e.getBoundingClientRect(),d=b.left/a.cssScale-f.left/a.cssScale,f=b.top/
a.cssScale-f.top/a.cssScale,n=b.width/a.cssScale,b=b.height/a.cssScale,h=e.style.fontSize;"textarea"==e.tagName.toLowerCase()?(this.display.setAttribute("style","left:"+d+"px;top:"+f+"px;width:"+n+"px;height:"+b+"px;font-size:"+h+";line-height:1.2em;padding:5px;font:"+e.style.font+";"),this.newLine.style.left=d+n-42+"px",this.newLine.style.top=f+b-42+"px",this.newLine.style.display="block"):(this.display.setAttribute("style","left:"+d+"px;top:"+f+"px;width:"+n+"px;height:"+b+"px;font-size:"+h+";line-height:"+
b+"px;white-space:nowrap;"),this.newLine.style.display="none");this.display.value=e.value||"";this.display.focus();this.display.selectionStart=this.display.selectionEnd=this.display.value.length};f.prototype.onEnter=function(){var a=this.display.value;if(!this.onlyText){var d=this.parent.evaluator.parser.parse(a.replace(/\u221a/g,"sqrt"));try{d&&(a=this.parent.evaluator.eval(d))}catch(b){a=0}}if(this.ctr)this.ctr.changeValue(a,!0);else if(this.var_id=(this.var_id+"").trim(),d=this.var_id.indexOf("["),
-1==d)this.parent.evaluator.setVariable(this.var_id,a);else{var f=this.var_id.indexOf(","),n=this.var_id.substring(0,d);-1==f?this.parent.evaluator.setVector(n,parseInt(this.var_id.substring(d+1)),a):this.parent.evaluator.setMatrix(n,parseInt(this.var_id.substring(d+1)),parseInt(this.var_id.substring(f+1)),a)}this.close()};a.Keyboard=f;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=document.head,e=a.newHTML("meta",{name:"viewport",content:"width=device-width,initial-scale=1.0,user-scalable=yes"});document.querySelector("meta[name=viewport]")||f.appendChild(e);e=a.newHTML("meta",{name:"mobile-web-app-capable",content:"yes"});f.appendChild(e);e=a.newHTML("meta",{name:"apple-mobile-web-app-capable",content:"yes"});f.appendChild(e);e=a.newHTML("meta",{name:"apple-mobile-web-app-status-bar-style",content:"black"});f.appendChild(e);
(f=document.getElementById("StyleDescartesApps2"))&&f.remove();f=a.newHTML("style",{rel:"stylesheet",type:"text/css",id:"StyleDescartesApps2"});document.head.insertBefore(f,document.head.firstChild);f.innerHTML="body{-webkit-font-smoothing:antialiased;}\n#descartesJS_north,#descartesJS_south,#descartesJS_east,#descartesJS_west{background:#c0c0c0;position:absolute;z-index:100;}\n.PBL{position:absolute;background-color:#f2f2f2;border:none;-webkit-appearance:none;-moz-appearance:none;appearance:none;color:#2daae4;visibility:hidden;border-radius:100vw;}\n.PBL::-moz-progress-bar{background:#2daae4;border-radius:inherit;}\n.PBL::-webkit-progress-bar{background:#f2f2f2;border-radius:100vw;}\n.PBL::-webkit-progress-value{background:#2daae4;border-radius:inherit;}\n.PBL::-ms-fill{background:#2daae4;border-radius:inherit;}\n.DescartesAppContainer *,.DescartesAppContainer *:before,.DescartesAppContainer *:after{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;transform:translate3d(0,0,0);}\n.DescartesAppContainer{border:none;overflow:hidden;position:relative;top:0;left:0;}\n.DescartesCatcher{background-color:rgba(0,0,0,0);cursor:pointer;position:absolute;}\n.DescartesLoader{background-color:#fff;overflow:hidden;position:absolute;top:0;left:0;z-index:1000;width:100%;height:100%;display:none;}\n.DescartesLoaderImage{position:absolute;background-repeat:no-repeat;background-position:center;overflow:hidden;top:0;left:0;width:100%;height:100%;}\n.DescartesSpace2DCanvas,.DescartesSpace3DCanvas,.blocker{touch-action:none;position:absolute;overflow:hidden;left:0;top:0;}\n.DescartesSpace2DContainer,.DescartesSpace3DContainer{position:absolute;overflow:hidden;line-height:0;}\n.DescartesCheckboxContainer input[type=checkbox],.DescartesCheckboxContainer input[type=radio]{display: none;}\n.DescartesCheckboxContainer input[type=checkbox]+label::after{position:absolute;left:0px;content:'';padding:0;margin:0;width:100%;height:100%;background:#fff;border:1px solid gray;}\n.DescartesCheckboxContainer input[type=checkbox]:checked+label::after{content:'';background:url("+
a.getSvgCheckbox()+") center center no-repeat;background-size:contain;background-color:#fff;}\n.DescartesCheckboxContainer input[type=radio]+label::after{position:absolute;left:0px;content:'';padding:0;margin:0;width:100%;height:100%;background:#fff;border:1px solid gray;border-radius:50%;}\n.DescartesCheckboxContainer input[type=radio]:checked+label::after{content:'';background:url("+a.getSvgRadio()+") center center no-repeat;background-size:contain;background-color:#fff;}\n.DescartesCheckbox{position:absolute;}\n.TextfieldCover{position:absolute;overflow:hidden;background-color:transparent;cursor:pointer;}\ninput[type=text]{-webkit-appearance:none;}\n.DescartesButton{position:absolute;cursor:pointer;}\n.DescartesButtonContainer,.DescartesSpinnerContainer,.DescartesCheckboxContainer,.DescartesTextFieldContainer,.DescartesMenuContainer{position:absolute;overflow:hidden;}\n.DescartesSpinnerContainer input,.DescartesCheckboxContainer,.DescartesTextFieldContainer input,.DescartesMenuContainer select{border-radius:0;}\n.DescartesSpinnerField,.DescartesTextFieldField,.DescartesMenuField,.DescartesScrollbarField,.DescartesSliderField{font-family:"+
a.sansserif_font+";padding:0 2px;border:solid #666 1px;position:absolute;}\ninput[type=text]:disabled,.DescartesMenuSelect:disabled{background-color:#e3e3e3;cursor:not-allowed;opacity:1;}\n.DescartesSpinnerLabel,.DescartesCheckboxLabel,.DescartesMenuLabel,.DescartesScrollbarLabel,.DescartesSliderLabel,.DescartesTextFieldLabel{font-family:"+a.sansserif_font+";font-weight:normal;text-align:center;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;position:absolute;left:0;top:0;}\n.DescartesGraphicControl{touch-action:none;border-style:none;position:absolute;}\n.DescartesTextAreaContainer{position:absolute;overflow:hidden;background:#F7F7F7;resize:none;border:solid #666 1px;}\n.DescartesTextAreaContainer *{border:none;}\n.DescartesMenuSelect{font-family:"+
a.sansserif_font+";padding-top:0;text-align:center;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;position:absolute;border:1px solid #7a8a99; background:#fff url('"+a.getSvgMenu()+"') 100%/22px no-repeat;padding:0 22px 0 5px;-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:none;}\n.DescartesMenuSelect::-ms-expand{display:none;}\n.DescartesScrollbarContainer,.DescartesSliderContainer{touch-action:none;background:#eee;overflow:hidden;position:absolute;}\n.DescartesSliderContainer{background:transparent;}\n.DescartesRange{-webkit-appearance:none;appearance:none;background:transparent;cursor: pointer;}\n.DescartesRange::-webkit-slider-runnable-track{background:var(--track_color);height:var(--track_h);border-radius:var(--track_h);}\n.DescartesRange::-moz-range-track{background:var(--track_color);height:var(--track_h);border-radius:var(--track_h);}\n.DescartesRange::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;margin-top:calc(var(--track_h) / 2 - var(--thumb_size) / 2);border-radius:50%;background-color:var(--thumb_color);height:var(--thumb_size);width:var(--thumb_size);}\n.DescartesRange::-moz-range-thumb{border:none;border-radius:50%;background-color:var(--thumb_color);height:var(--thumb_size);width:var(--thumb_size);}\n.DJS_Up,.DJS_Down{cursor:pointer;position:absolute;border-width:1px 0 1px 1px;background-size:cover;background-repeat:none;background-position:center;}\n.DJS_Up[horizontal=false]{background-color:#f0f8ff;background-image:"+
a.createGradient(50,100)+", url('"+a.getSvgArrowUp()+"');}\n.DJS_Up[horizontal=true]{background-color:#f0f8ff;background-image:"+a.createGradient(50,100,90)+", url('"+a.getSvgArrowUp(!0)+"');}\n.DJS_Up[active=false]::after{cursor:not-allowed;content:'';position:absolute;left:0;top:0;width:100%;height:100%;background:rgba(255,255,255,0.3);}\n.DJS_Down[horizontal=false]{background-color:#f0f8ff;background-image:"+a.createGradient(0,50)+", url('"+a.getSvgArrowDown()+"');}\n.DJS_Down[horizontal=true]{background-color:#f0f8ff;background-image:"+
a.createGradient(50,100,-90)+", url('"+a.getSvgArrowDown(!0)+"');}\n.DJS_Down[active=false]::after{cursor:not-allowed;content:'';position:absolute;left:0;top:0;width:100%;height:100%;background:rgba(255,255,255,0.3);}\n.DescartesKeyboardContainer{position:absolute;left:0;top:0;width:100%;height:100%;background-color:rgba(0,0,0,0.1);z-index:1000;}\n.DescartesKeysContainer{display:flex;flex-direction:row;flex-wrap:wrap;background-color:#c0c0c0;border-radius:4px;border:1px solid rgba(0,0,0,0.3);box-shadow:0 0 8px 0 rgba(0,0,0,0.75);box-sizing: content-box;}\n.DescartesKeysContainer > div, .new_line_btn{margin:5px 0 0 5px;display:inline-block;min-width:40px;min-height:40px;max-height:40px;line-height:35px;background-color:#ebeff3;font-family:"+
a.math_font+";font-size:18px;font-weight:bold;color:black;cursor:pointer;text-align:center;border-radius:4px;border:1px solid rgba(0,0,0,0.3);box-shadow:0 1px 2px 0 rgba(0,0,0,0.25);transform-origin:center;user-select:none;}\n.DescartesKeysContainer > div:hover, .new_line_btn:hover{background-color:rgba(0,0,0,0.05);transform:scale(1.1);}\n.DescartesKeysContainer > div:active, .new_line_btn:active{transform:scale(0.95);}\n.DescartesKeyboardDisplay{font-family:"+a.sansserif_font+";padding:0 2px;border:solid #666 1px;text-align:left;background-color:white;position:absolute;overflow:hidden;outline:2px solid black; resize: none;}\n.custom_keyboard{display:none;}\n.DJS_Gradient{position:absolute;display:none;}\n"+
(a.addSymbolFont?a.addSymbolFont():"")+(a.addFonts?a.addFonts():"");return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=Math.sin,e=Math.floor,d=Math.random,r=Math.round,n=Math.abs,b=String.fromCharCode,h,l,c,k,g,v,u,p,z,q,m=function(a){this.key=(void 0===a?0:a).toString()};m.prototype.getKey=function(a){h=[];for(var c=0;256>c;c++)h[c]=b(this.alfanum(e(n(7.5*(f(1*c-a)+f(1.4*c+a)+f(.6*c-a)+f(2.2*c+a))))));return h.join("")};m.prototype.encode=function(a){l=e(31*d());this.key=this.getKey(l);return b(this.alfanum(l))+this.encripta(a)};m.prototype.decode=function(a){l=
this.numalfa(a.charCodeAt(0));this.key=this.getKey(l);return this.desencripta(a.substring(1))};m.prototype.encripta=function(a){return this.bytesToString(this.encriptaAux(this.stringToBytes(a)))};m.prototype.encriptaAux=function(a){if(null==a||null==this.key)return null;v=Array(3*a.length);for(var c=0,b=a.length;c<b;c++)z=256*e(a[c]+128)+r(255*d())+65536*r(255*d()),q=e((z<<this.shift(c))/256),v[3*c]=this.alfanum(q%32),v[3*c+1]=this.alfanum(q/32%32),v[3*c+2]=this.alfanum(q/1024%32);return v};m.prototype.desencripta=
function(a){return this.bytesToString(this.desencriptaAux(this.stringToBytes(a)))};m.prototype.desencriptaAux=function(a){if(null==a||null==this.key)return null;u=Array(a.length/3);for(var c=0,b=u.length;c<b;c++)q=this.numalfa(a[3*c])+32*this.numalfa(a[3*c+1])+1024*this.numalfa(a[3*c+2]),z=e(256*q>>this.shift(c)),p=e(z/256)%256-128,0>p&&(p+=256),u[c]=p;return u};m.prototype.alfanum=function(a){return(10>a?48:87)+e(a)};m.prototype.numalfa=function(a){return a-(58>a?48:87)};m.prototype.stringToBytes=
function(a){k=[];for(var c=0,b=a.length;c<b;c++)k.push(a.charCodeAt(c));return k};m.prototype.bytesToString=function(a){for(var c=0,g=a.length;c<g;c++)a[c]=b(a[c]);return a.join("")};m.prototype.shift=function(a){c=this.key.charCodeAt(a%this.key.length);k=this.numalfa(c);g=e(k/2%8);0==g&&(g=4);return g};m.prototype.parseByte=function(a){a=parseInt(a);a=0>a?0:a;return 255<a?255:a};a.Krypto=m;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=function(e,d){this.parent=e;var f=e.evaluator,n=f.parser;e=new a.Auxiliary(e);var b=this;b.delay=n.parse(d.delay?d.delay:"60");b.loop=d.loop?d.loop:!1;b.auto=void 0==d.auto?!0:d.auto;b.controls=d.controls;b.init=e.splitInstructions(n,d.init);b.doExpr=e.splitInstructions(n,d.doExpr);d.whileExpr&&(b.whileExpr=n.parse(d.whileExpr));var h,l=b.doExpr.length;b.animExec=function(){for(h=0;h<l;h++)f.eval(b.doExpr[h]);b.parent.update();b.playing&&(0<f.eval(b.whileExpr)||
b.loop)?b.timer=a.setTimeout(b.animExec,f.eval(b.delay)):(b.stop(),b.pause=!1,b.parent.update())};b.playing=!1;b.auto&&b.play()};f.prototype.play=function(){this.playing?(this.pause=!0,this.stop()):(this.pause||this.reinit(),this.playing=!0,this.pause=!1,this.timer=a.setTimeout(this.animExec,Math.max(10,this.parent.evaluator.eval(this.delay))))};f.prototype.stop=function(){this.playing=!1;a.clearTimeout(this.timer)};f.prototype.reinit=function(){for(var a=0,d=this.init.length;a<d;a++)this.parent.evaluator.eval(this.init[a])};
a.Animation=f;return a}(descartesJS||{});descartesJS=function(a){if(a.loadLib)return a;var f=function(a){this.parent=a;this.evaluator=this.parent.evaluator};f.prototype.execute=function(){};a.Action=f;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=function(e,d){d=void 0===d?"":d;e=a.Action.call(this,e)||this;e.parameter=d.replace(/\\n/g,"\n").replace(/&squot;/g,"'");return e};$jscomp.inherits(f,a.Action);f.prototype.execute=function(){alert(this.parameter)};a.Message=f;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=function(e,d){d=void 0===d?"":d;e=a.Action.call(this,e)||this;d=a.splitSeparator((d||"").replace(/&squot;/g,"'"));e.inst=[];for(var f,n=0,b=d.length;n<b;n++)(f=e.evaluator.parser.parse(d[n],!0))&&e.inst.push(f);return e};$jscomp.inherits(f,a.Action);f.prototype.execute=function(){for(var a=0,d=this.inst.length;a<d;a++)this.evaluator.eval(this.inst[a])};a.Calculate=f;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=function(e,d){e=a.Action.call(this,e)||this;e.parameter=d.trim();e.target="_blank";return e};$jscomp.inherits(f,a.Action);f.prototype.execute=function(){var e=this.parameter;e.match(/^\[.*\]?/)&&(e=this.evaluator.eval(this.evaluator.parser.parse(e.substring(1,e.length-1))));var d=e.indexOf("target");-1!=d&&(this.target=e.substring(d),this.target=this.target.substring(this.target.indexOf("=")+1),e=e.substring(0,d-1));if("javascript"==e.substring(0,
10)){e=new a.SimpleText(this.parent,e.substring(11).replace(/&squot;/g,"'"));try{eval(e.toString())}catch(r){}}else"http"!=e.substring(0,4)&&(d=window.__dirname||window.location.href,e=d.substring(0,d.lastIndexOf("/")+1)+e),window.open(e,this.target)};a.OpenURL=f;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=function(e,d){d=void 0===d?"":d;e=a.Action.call(this,e)||this;e.parameter=d.trim();e.target="_blank";return e};$jscomp.inherits(f,a.Action);f.prototype.execute=function(){var a=this.parameter;a.match(/^\[.*\]?/)&&(a=this.evaluator.eval(this.evaluator.parser.parse(a.substring(1,a.length-1))));var d=a.indexOf("target");-1!=d&&(this.target=a.substring(d),this.target=this.target.substring(this.target.indexOf("=")+1),a=a.substring(0,d-1));if("javascript"==
a.substring(0,10)){a=a.substring(11).replace(/&squot;/g,"'");try{eval(a.toString())}catch(r){}}else"http"!=a.substring(0,4)&&(d=window.__dirname||window.location.href,a=d.substring(0,d.lastIndexOf("/")+1)+a),window.open(a,this.target,"width="+this.parent.width+",height="+this.parent.height+",left="+(window.screen.width-this.parent.width)/2+",top="+(window.screen.height-this.parent.height)/2+",location=0,menubar=0,scrollbars=0,status=0,titlebar=0,toolbar=0")};a.OpenScene=f;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=function(e){return a.Action.call(this,e)||this};$jscomp.inherits(f,a.Action);f.prototype.execute=function(){this.parent.editor?this.parent.editor.show():window.open("about:blank","_blank","width=800px,height=600px,location=no,menubar=no,scrollbars=yes").document.write("<xmp style='width:100%;height:100%;'>"+this.parent.applet.outerHTML.replace(/<applet/g,"<ajs").replace(/<\/applet/g,"</ajs")+"</xmp>")};a.Config=f;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=function(e){return a.Action.call(this,e)||this};$jscomp.inherits(f,a.Action);f.prototype.execute=function(){this.parent.init()};a.Init=f;return a}(descartesJS||{});descartesJS=function(a){if(a.loadLib)return a;var f=function(e){return a.Action.call(this,e)||this};$jscomp.inherits(f,a.Action);f.prototype.execute=function(){this.parent.clear()};a.Clear=f;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=function(e){return a.Action.call(this,e)||this};$jscomp.inherits(f,a.Action);f.prototype.execute=function(){this.parent.play()};a.Animate=f;return a}(descartesJS||{});descartesJS=function(a){if(a.loadLib)return a;var f=function(e){return a.Action.call(this,e)||this};$jscomp.inherits(f,a.Action);f.prototype.execute=function(){this.parent.reinitAnimation()};a.InitAnimation=f;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=/[\w\.\-//]*(\.ogg|\.oga|\.mp3|\.wav)/gi,e=function(d,e){e=void 0===e?"":e;d=a.Action.call(this,d)||this;e.match(f)?d.filename=d.evaluator.parser.parse("'"+e.match(f)+"'"):(e.match(/^\[.*\]?/)&&(e=e.substring(1,e.length-1)),d.filename=d.evaluator.parser.parse(e));return d};$jscomp.inherits(e,a.Action);e.prototype.execute=function(){var a=this.theAudio=this.parent.getAudio(this.evaluator.eval(this.filename));a.paused?a.play():(a.pause(),a.currentTime=
0)};a.PlayAudio=e;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,e,d=function(a,d){this.parent=a;this.evaluator=a.evaluator;this.local=this.expresion=this.id="";this.evaluate="onlyOnce";Object.assign(this,d)};d.prototype.firstRun=function(){};d.prototype.update=function(){};d.prototype.splitInstructions=function(d,n){e=[];n=n?a.splitSeparator(n):[""];for(var b=0,h=n.length;b<h;b++)a.DEBUG.lineCount=b,(f=d.parse(n[b],!0))&&e.push(f);return e};d.prototype.getPrivateVariables=function(a,d){e=[];d=d?d.split(/;|,/):
[""];for(var b=0,h=d.length;b<h;b++)(f=a.parse(d[b],!0))&&e.push(f);b=0;for(h=e.length;b<h;b++)e[b]="assign"===e[b].type?e[b].childs[0].value:"identifier"===e[b].type?e[b].value:"";return e};d.prototype.parseExpressions=function(d){a.DEBUG.paramName="inicio";this.init=this.splitInstructions(d,this.init);a.DEBUG.paramName="local";this.privateVars=this.getPrivateVariables(d,this.local);a.DEBUG.paramName="hacer";this.doExpr=this.splitInstructions(d,this.doExpr);a.DEBUG.paramName="mientras";this.whileExpr=
d.parse(this.whileExpr)};a.Auxiliary=d;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=function(e,d){e=a.Auxiliary.call(this,e,d)||this;d=e.evaluator.parser;e.expresionString=e.expresion;e.expresion=d.parse(e.expresionString);e.expresion&&d.setVariable(e.id,e.expresion);e.editable&&(e.registerTextField(),e.parent.editableRegionVisible=!0);return e};$jscomp.inherits(f,a.Auxiliary);f.prototype.registerTextField=function(){var e=a.newHTML("div"),d=a.newHTML("label");d.appendChild(document.createTextNode("___"+this.id+"=___"));var f=a.newHTML("input");
f.value=this.expresionString;f.disabled=!this.editable;e.appendChild(d);e.appendChild(f);var n=this,b=n.evaluator.parser;f.onkeydown=function(a){13==a.keyCode&&(n.expresion=b.parse(this.value),b.setVariable(n.id,n.expresion),n.parent.update())};this.parent.editableRegion.textFields.push({container:e,type:"div"})};a.Variable=f;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=function(e,d){e=a.Auxiliary.call(this,e,d)||this;e.expresion=e.evaluator.parser.parse(e.expresion);e.update();return e};$jscomp.inherits(f,a.Auxiliary);f.prototype.update=function(){this.evaluator.setVariable(this.id,this.evaluator.eval(this.expresion))};a.Constant=f;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,e,d,r,n=function(b,d){d=a.Auxiliary.call(this,b,d)||this;f=b.evaluator;e=f.parser;d.size=d.size||e.parse("3");d.expresion=d.expresion.split(";");d.parseFile=e.parse(d.file);d.update();return d};$jscomp.inherits(n,a.Auxiliary);n.prototype.update=function(){var b=this.expresion,h;f=this.evaluator;e=f.parser;this.oldFile=this.file;if(d=f.eval(this.parseFile))this.file=d;if(this.file){r=(h=document.getElementById(this.file))&&"descartes/vectorFile"==
h.type?h.text:a.openFile(this.file);if(null!=r){r=r.replace(/\r/g,"").split("\n");var l=[];h=0;for(var c=r.length;h<c;h++)""!=r[h]&&l.push(r[h]);r=l}null==r||1==r.length&&""==r[0]?(r=[],this.size=e.parse("0")):(b=r,this.size=null);null===this.size&&(this.size=e.parse(b.length+""))}var k;l=[];h=0;for(c=b.length;h<c;h++)(k=e.parse(b[h],!0))&&"assign"!=k.type&&(k=e.parse(this.id+"["+h+"]="+b[h],!0)),l.push(k);b=Array(parseInt(Math.abs(f.eval(this.size)))).fill(0);b._size_=b.length;f.vectors[this.id]=
b;f.setVariable(this.id+".long",b._size_);h=0;for(c=l.length;h<c;h++)f.eval(l[h])};a.Vector=n;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,e,d,r,n,b=function(b,l){l=a.Auxiliary.call(this,b,l)||this;f=b.evaluator;e=f.parser;l.rows=l.rows||e.parse("3");l.columns=l.columns||e.parse("3");l.expresion=l.splitInstructions(e,l.expresion);d=f.eval(l.rows);r=f.eval(l.columns);n=[];n.type="matrix";b=0;for(var c=r;b<c;b++)n[b]=Array(d).fill(0);f.matrices[l.id]=n;l.update();return l};$jscomp.inherits(b,a.Auxiliary);b.prototype.update=function(){f=this.evaluator;d=f.eval(this.rows);r=f.eval(this.columns);
f.setVariable(this.id+".filas",d);f.setVariable(this.id+".columnas",r);n=f.matrices[this.id];n.rows=d;n.cols=r;for(var a=0,b=this.expresion.length;a<b;a++)f.eval(this.expresion[a])};a.Matrix=b;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=function(e,d){var f=a.Auxiliary.call(this,e,d)||this;var n=f.evaluator;e=n.parser;d=f.id.indexOf("(");f.name=f.id.substring(0,d);f.params=f.id.substring(d+1,f.id.indexOf(")"));f.domain=f.range?e.parse(f.range):e.parse("1");f.params=""===f.params?[]:f.params.split(",");f.numParams=f.params.length;f.algorithm||(f.init="",f.doExpr="",f.whileExpr="");f.parseExpressions(e);f.expresion=e.parse(f.expresion);var b;f.functionExec=function(){f.iterations=
0;if(f.numParams<=arguments.length){for(var d=[],e=0,c=f.privateVars.length;e<c;e++)d.push(n.getVariable(f.privateVars[e])),n.setVariable(f.privateVars[e],0);var k=[];e=0;for(c=f.params.length;e<c;e++)k.push(n.getVariable(f.params[e])),n.setVariable(f.params[e],arguments[e]);e=0;for(c=f.init.length;e<c;e++)n.eval(f.init[e]);b=n.getVariable("_NUM_MAX_ITE_ALG_")||1E5;do{e=0;for(c=f.doExpr.length;e<c;e++)n.eval(f.doExpr[e]);if(++f.iterations>b)return console.warn("se ha excedido el l\u00edmite de "+
b+" repeticiones en la funci\u00f3n << "+f.name+" >>"),0}while(0<n.eval(f.whileExpr));var g=n.eval(f.expresion);a.rangeOK=n.eval(f.domain);e=0;for(c=f.params.length;e<c;e++)n.setVariable(f.params[e],k[e]);e=0;for(c=f.privateVars.length;e<c;e++)n.setVariable(f.privateVars[e],d[e]);return g}return 0};n.setFunction(f.name,f.functionExec);return f};$jscomp.inherits(f,a.Auxiliary);a.Function=f;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=function(e,d){var f=a.Auxiliary.call(this,e,d)||this;var n=f.evaluator;f.parseExpressions(n.parser);var b;f.algorithmExec=function(){f.iterations=0;b=n.getVariable("_NUM_MAX_ITE_ALG_")||1E5;for(var a=0,d=f.init.length;a<d;a++)n.eval(f.init[a]);do{a=0;for(d=f.doExpr.length;a<d;a++)n.eval(f.doExpr[a]);if(++f.iterations>b)return console.warn("se ha excedido el l\u00edmite de "+b+" repeticiones en el algoritmo << "+f.name+" >>"),0}while(0<n.eval(f.whileExpr))};
return f};$jscomp.inherits(f,a.Auxiliary);f.prototype.update=function(){this.algorithmExec();"onlyOnce"===this.evaluate&&(this.update=function(){})};a.Algorithm=f;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=function(e,d){e=a.Auxiliary.call(this,e,d)||this;d=e.evaluator;delete e.evaluate;e.condition=d.parser.parse(e.condition);e.lastEval=!1;e.action=e.parent.lessonParser.parseAction(e);"onlyOnce"==e.execution&&(e.eventExec=function(){0<this.evaluator.eval(this.condition)&&!this.lastEval&&(this.lastEval=!0,this.action.execute())});"alternate"==e.execution&&(e.eventExec=function(){var a=0<this.evaluator.eval(this.condition);a&&!this.lastEval?(this.action.execute(),
this.lastEval=!0):!a&&this.lastEval&&(this.lastEval=!1)});"always"==e.execution&&(e.eventExec=function(){0<this.evaluator.eval(this.condition)&&this.action.execute()});return e};$jscomp.inherits(f,a.Auxiliary);f.prototype.update=function(){this.eventExec()};a.Event=f;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=function(e,d){var f=a.Auxiliary.call(this,e,d)||this;d=d.file;if(d)var n=(n=document.getElementById(d))&&"descartes/library"===n.type?n.text:a.openFile(d);if(n){n=a.convertHTMLEntities(n).replace(/\r/g,"").split("\n");d=0;for(var b=n.length;d<b;d++)""!==n[d].trim()&&e.lessonParser.parseAuxiliar(n[d])}return f};$jscomp.inherits(f,a.Auxiliary);a.Library=f;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,e,d,r,n,b,h,l,c=function(c,b){this.parent=c;this.evaluator=c.evaluator;var g=this.evaluator.parser;this.spaceID="";this.background=!1;this.type="";this.drawif=g.parse("1");this.abs_coord=b&&b.type&&"text"===b.type.toLowerCase()?!0:!1;this.color=new a.Color("20303a");this.trace="";this.expresion=g.parse("(0,0)");this.family="";this.family_interval=g.parse("[0,1]");this.family_steps=g.parse("8");this.editable=this.visible=!1;this.font="SansSerif,PLAIN,"+
(5<=this.parent.version?"18":"12");this.fixed=!0;this.text="";this.decimals=g.parse("2");Object.assign(this,b);this.space=this.getSpace();this.canvas=this.background?this.space.backCanvas:this.space.canvas;this.ctx=this.canvas.getContext("2d");this.trace&&(this.traceCtx=this.space.backCtx);this.font_str=this.font;this.font=a.convertFont(this.font);this.fontSize=(this.fontSize=this.font.match(/([\d\.]+)px/))?parseFloat(this.fontSize[1]):10;this.font_style=a.getFontStyle(this.font_str.split(",")[1]);
if("boolean"===typeof this.bold||"boolean"===typeof this.italics)this.bold&&!this.italics?this.font_style="Bold ":!this.bold&&this.italics?this.font_style="Italic ":this.bold&&this.italics?this.font_style="Italic Bold ":this.bold||this.italics||(this.font_style=" ");this.font_family||(this.font_family=this.font_str.split(",")[0]);this.font_family=a.getFontName(this.font_family);"undefined"===typeof this.font_size&&(this.font_size=c.evaluator.parser.parse(this.fontSize.toString()))};c.prototype.getSpace=
function(){var a=this;return this.parent.spaces.find(function(c){return c.id===a.spaceID})||this.parent.spaces[0]};c.prototype.getFamilyValues=function(){f=this.evaluator;e=f.eval(this.family_interval);this.familyInf=e[0][0];this.familySup=e[0][1];this.fSteps=Math.round(f.eval(this.family_steps));this.family_sep=0<this.fSteps?(this.familySup-this.familyInf)/this.fSteps:0};c.prototype.drawFamilyAux=function(a,c,b){f=this.evaluator;this.getFamilyValues();d=f.getVariable(this.family);if(0<=this.fSteps)for(var g=
0,k=this.fSteps;g<=k;g++)f.setVariable(this.family,this.familyInf+g*this.family_sep),0<f.eval(this.drawif)&&(this.update(),a.oldTextNode=null,this.drawAux(a,c,b));f.setVariable("_Text_H_",0);f.setVariable(this.family,d)};c.prototype.draw=function(a,c){""!==this.family?this.drawFamilyAux(this.ctx,a,c):0<this.evaluator.eval(this.drawif)&&(this.update(),this.drawAux(this.ctx,a,c));this.ctx.setLineDash([])};c.prototype.drawTrace=function(a,c){""!=this.family?this.drawFamilyAux(this.traceCtx,a,c):0<this.evaluator.eval(this.drawif)&&
(this.update(),this.drawAux(this.traceCtx,a,c))};c.prototype.rotate=function(a,c,b){h=Math.cos(b);l=Math.sin(b);return{x:a*h-c*l,y:a*l+c*h}};c.prototype.dashStyle=function(){b=this.ctx;"dot"===this.lineDash?(b.lineCap="butt",b.setLineDash([b.lineWidth,b.lineWidth])):"dash"===this.lineDash?(b.lineCap="butt",b.setLineDash([4*b.lineWidth,3*b.lineWidth])):"dash_dot"===this.lineDash?(b.lineCap="butt",b.setLineDash([4*b.lineWidth,2*b.lineWidth,b.lineWidth,2*b.lineWidth])):b.setLineDash([])};c.prototype.drawText=
function(a,c,b,d,e,h,l,m,y,w,x){a.textNode=c;if("rtfNode"===c.type)a.fillStyle=a.strokeStyle=e.getColor(),a.textBaseline="alphabetic",a.textNode.pos={x:b,y:d},c.update(a,b,d,y,w,l,x,e.getColor());else for("simpleText"===c.type&&(c=c.toString(y,w).split("\\n")),f=this.evaluator,a.fillStyle=e.getColor(),a.font=h,a.textAlign=l,a.textBaseline=m,n=1.2*this.fontSize||0,e=0,h=c.length;e<h;e++)r=c[e],this.border&&(a.strokeStyle=this.border.getColor(),a.lineWidth=4,a.lineJoin="round",a.miterLimit=2,a.strokeText(r,
b,d+n*e)),a.fillText(r,b,d+n*e)};a.Graphic=c;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,e,d,r,n,b,h,l=function(a,k){this.text=k=k.replace("&#x2013","\u2013").replace(/&squot;/g,"'");this.textElements=[];this.textElementsMacros=[];this.parent=a;this.evaluator=a.evaluator;this.type="simpleText";f="'";r=d=0;for(n=-1;d<k.length;)b=k.charAt(d),h=k.charAt(d-1),"["===b&&"\\"===h?(this.textElements.push(k.substring(r,d-1)+"["),this.textElementsMacros.push("'"+k.substring(r,d-1)+"['"),r=d+1):"]"===b&&"\\"===h?(this.textElements.push(k.substring(r,
d-1)+"]"),this.textElementsMacros.push("'"+k.substring(r,d-1)+"]'"),r=d+1):"["===b&&-1===n?(this.textElements.push(k.substring(r,d)),this.textElementsMacros.push("'"+k.substring(r,d)+"'"),r=d,n++):"["===b?n++:"]"===b&&0===n?(this.textElements.push(this.evaluator.parser.parse(k.substring(r,d+1))),this.textElementsMacros.push("["+k.substring(r,d+1)+"]"),r=d+1,n--):("]"==k.charAt(d)&&(n=0>n?n:n-1),f+=k.charAt(d)),d++;this.textElements.push(k.substring(r,d));this.textElementsMacros.push("'"+k.substring(r,
d)+"'")};l.prototype.toString=function(c,b){f="";for(var g=0,k=this.textElements.length;g<k;g++)"string"===typeof this.textElements[g]?f+=this.textElements[g]:(e=this.evaluator.eval(this.textElements[g])[0][0],""!==e&&("string"===typeof e?f+=e:Infinity==e?f+="Infinity":-Infinity==e?f+="-Infinity":isNaN(e)||"NaN"==e?f+="NaN":(e=parseFloat(e),e=b?e.toFixed(c):a.removeNeedlessDecimals(e.toFixed(c)),f+=e.toString().replace(".",this.parent.decimal_symbol))));return f};a.SimpleText=l;return a}(descartesJS||
{});
descartesJS=function(a){if(a.loadLib)return a;var f,e,d,r,n,b,h,l,c,k,g,v,u,p,z,q,m,y,w,x,A,H,E,G,F,D,B,K,L,M,O,I,N,C,Q,J=function(c,b){b=a.Graphic.call(this,c,b)||this;b.width=b.width||c.evaluator.parser.parse("1");b.fillP=b.fillP||"";b.fillM=b.fillM||"";b.parseExpression();b.visible=2===b.parent.version&&void 0==b.visible?!0:b.visible;b.visible&&b.registerTextField();u=new a.R2;p=new a.R2;z=new a.R2;y=new a.R2;q=new a.R2;b.cInd=0;return b};$jscomp.inherits(J,a.Graphic);J.prototype.parseExpression=function(){if("compOperator"===
this.expresion.type){var c=this.expresion.childs[0],b=this.expresion.childs[1];"identifier"!=c.type||"y"!=c.value||b.contains("y")?"identifier"!=b.type||"y"!=b.value||c.contains("y")?"identifier"!=c.type||"x"!=c.value||b.contains("x")?"identifier"!=b.type||"x"!=b.value||c.contains("x")||(this.funExpr=b,this.of_y=!0,this.drawAux=this.drawAuxFun):(this.funExpr=b,this.of_y=!0,this.drawAux=this.drawAuxFun):(this.funExpr=c,this.of_y=!1,this.drawAux=this.drawAuxFun):(this.funExpr=b,this.of_y=!1,this.drawAux=
this.drawAuxFun)}this.newt=new a.R2Newton(this.evaluator,this.expresion)};J.prototype.update=function(){};J.prototype.draw=function(){""!=this.family?this.drawFamilyAux(this.ctx,this.fill,this.color):(this.update(),this.drawAux(this.ctx,this.fill,this.color))};J.prototype.drawFamilyAux=function(a,c,b){d=this.evaluator;this.getFamilyValues();e=d.getVariable(this.family);if(0<=this.fSteps)for(var g=0,m=this.fSteps;g<=m;g++)d.setVariable(this.family,this.familyInf+g*this.family_sep),this.update(),this.drawAux(a,
c,b);d.setVariable(this.family,e)};J.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.fill,this.trace)};J.prototype.drawAux=function(e,P,S){if(!(0>=this.evaluator.eval(this.drawif))){this.cInd=0;d=this.evaluator;r=d.parser;n=this.space;b=d.eval(this.width);e.strokeStyle=this.color.getColor();e.lineWidth=b;h=r.getVariable("x");l=r.getVariable("y");c=n.w+24;k=n.h+24;g=c/9;3>g&&(g=3);v=k/7;3>v&&(v=3);0==this.cInd?(f=[],this.cInd++):this.cInd=(this.cInd+1)%1E7;u.set(0,0);p.set(0,
0);z.set(0,0);C=.25;Q=8;this.abs_coord||(C/=n.scale,Q/=n.scale);e.beginPath();for(K=parseInt(v/2);K<k;K+=v)for(B=parseInt(g/2);B<c;B+=g){if(this.abs_coord){y.set(B,K);m=this.newt.findZero(y,C);if(null==m)continue;d.setVariable("x",m.x);d.setVariable("y",m.y);q.set(m.x,m.y)}else{y.set(n.getRelativeX(B),n.getRelativeY(K));m=this.newt.findZero(y,C);if(null==m)continue;d.setVariable("x",m.x);d.setVariable("y",m.y);q.set(n.getAbsoluteX(m.x),n.getAbsoluteY(m.y))}w=q.ix();x=q.iy();if(-12<=w&&w<c+24&&-12<=
x&&x<k+24){if(f[w+12+(x+12)*n.w]===this.cInd)continue;f[w+12+(x+12)*n.w]=this.cInd}a.rangeOK&&(e.moveTo(w,x),e.lineTo(w,x));u.x=m.x;u.y=m.y;p.x=m.x;p.y=m.y;A=this.newt.getUnitNormal();if(0!=A.x||0!=A.y)for(A.rotL90(),z.x=A.x,z.y=A.y,E=H=0,G=!1;2>E;)if(G&&(z.x=-A.x,z.y=-A.y,m.x=u.x,m.y=u.y,p.x=m.x,p.y=m.y,this.abs_coord?q.set(m.x,m.y):q.set(n.getAbsoluteX(m.x),n.getAbsoluteY(m.y)),w=q.ix(),x=q.iy(),G=!1,H=0),m.x+=Q*z.x,m.y+=Q*z.y,m=this.newt.findZero(m,C),null!=m){d.setVariable("x",m.x);d.setVariable("y",
m.y);z.x=m.x-p.x;z.y=m.y-p.y;z.normalize();if(0==z.x&&0==z.y)break;p.x=m.x;p.y=m.y;this.abs_coord?q.set(m.x,m.y):q.set(n.getAbsoluteX(m.x),n.getAbsoluteY(m.y));F=parseInt(q.ix());D=parseInt(q.iy());if(F!=w||D!=x)if(L=w,M=x,w=F,x=D,-12<=w&&w<c+24&&-12<=x&&x<k+24){H=0;O=f[w+12+(x+12)*n.w];f[w+12+(x+12)*n.w]=this.cInd;for(P=1;8>P;P++)I=L+Math.round((w-L)*P/8),N=M+Math.round((x-M)*P/8),0<=I&&I<c&&0<=N&&N<k&&(f[I+12+(N+12)*n.w]=this.cInd);a.rangeOK&&(e.moveTo(L,M),e.lineTo(w,x));if(O===this.cInd)break}else G=
!0,E++;else 4<++H&&(G=!0,E++)}}e.stroke()}};J.prototype.X=function(a,c,b){b||(c=this.space.w/2+this.space.Ox+this.space.scale*c);c<-a&&(c=-a);c>this.space.w+a&&(c=this.space.w+a);return c};J.prototype.Y=function(a,c,b){b||(c=this.space.h/2+this.space.Oy-this.space.scale*c);c<-a&&(c=-a);c>this.space.h+a&&(c=this.space.h+a);return c};J.prototype.XX=function(a,c,b){return Math.round(this.X(a,c,b))};J.prototype.YY=function(a,c,b){return Math.round(this.Y(a,c,b))};J.prototype.extrapolate=function(c,b,
g,m,k,d){for(var e=this.evaluator.getVariable(b),f=d/2,h=0,l,u,p,q,n,v;1E-15<Math.abs(f);){l=this.evaluator.getVariable(b);u=this.evaluator.getVariable(b)+f;this.evaluator.setVariable(b,u);p=!0;try{q=k,k=this.evaluator.eval(this.funExpr),this.evaluator.setVariable(g,k),0<this.evaluator.eval(c)?(n=new a.R2(Math.min(q,k),Math.max(q,k)),v=0,v=0<d?this.Singularity(Math.abs(f),b,m,l,q,u,k,n):this.Singularity(Math.abs(f),b,m,u,k,l,q,n),0<v&&(p=!1)):p=!1}catch(Z){p=!1}p?h+=f:this.evaluator.setVariable(b,
l);f/=2}this.evaluator.setVariable(b,e);return new a.R2(h/Math.abs(d),k)};J.prototype.extrapolateOnSingularity=function(c,b,g,m,k,d){m=this.evaluator.getVariable(b);for(var e=d/2,f=0,h=k,l;1E-15<Math.abs(e);){this.evaluator.setVariable(b,this.evaluator.getVariable(b)+e);l=!0;if(0<this.evaluator.eval(c))try{h=this.evaluator.eval(this.funExpr),this.evaluator.setVariable(g,h),0>=this.evaluator.eval(c)&&(l=!1)}catch(X){l=!1}else l=!1;l?f+=e:this.evaluator.setVariable(b,this.evaluator.getVariable(b)-e);
e/=2}if(0==f)for(e=d/2,f=d,h=k;1E-15<Math.abs(e);){this.evaluator.setVariable(b,this.evaluator.getVariable(b)-e);l=!0;if(0<this.evaluator.eval(c))try{h=this.evaluator.eval(this.funExpr)}catch(X){l=!1}else l=!1;l?f+=-e:this.evaluator.setVariable(b,this.evaluator.getVariable(b)+e);e/=2}this.evaluator.setVariable(b,m);return new a.R2(f/Math.abs(d),h)};J.prototype.Singularity=function(a,c,b,g,m,k,d,e){if(isNaN(d)||isNaN(m)||isNaN(e.y)||isNaN(e.x)||g>=k)return 2;var f=this.evaluator.getVariable(c),h=0;
try{if(1E-15>Math.abs(k-g)||1E-12>Math.abs(k-g)&&Math.abs(d-m)>Math.abs(a))return this.evaluator.setVariable(c,f),1;var l=(g+k)/2;this.evaluator.setVariable(c,l);var u=NaN;try{u=this.evaluator.eval(this.funExpr)}catch(Y){return 2}if(isNaN(u))return 5;if(Math.abs(d-m)>a){this.evaluator.setVariable(c,g-1E-12);var p=this.evaluator.eval(this.funExpr);p=(m-p)/1E-12;this.evaluator.setVariable(c,k+1E-12);var q=(this.evaluator.eval(this.funExpr)-d)/1E-12;if((10>Math.abs(q)||10>Math.abs(p))&&(0<=q&&0<=p||
0>=q&&0>=p)&&4*Math.abs(q)<Math.abs((d-m)/(k-g)))return this.evaluator.setVariable(c,f),2}if(isNaN(e.x)||isNaN(e.y)||isNaN(u))return 2;if(!(e.x<=u&&u<=e.y)){this.evaluator.setVariable(c,l);e.x=Math.min(m,u);e.y=Math.max(m,u);var n=this.Singularity(a/2,c,b,g,m,l,u,e);this.evaluator.setVariable(c,k);e.x=Math.min(d,u);e.y=Math.max(d,u);var v=this.Singularity(a/2,c,b,l,u,k,d,e);h=Math.max(n,v)}}catch(Y){h=1}this.evaluator.setVariable(c,f);return h};J.prototype.discontLR=function(a,c,b,g){var m=c+b,k=
m+b,d=c-b;b=d-b;this.evaluator.setVariable("x",c);c=this.evaluator.eval(a);if(isNaN(c)||!isFinite(c)||Math.abs(c)>g)return!0;this.evaluator.setVariable("x",m);m=this.evaluator.eval(a);if(isNaN(m)||!isFinite(m)||Math.abs(m)>g)return!0;this.evaluator.setVariable("x",k);k=this.evaluator.eval(a);if(isNaN(k)||!isFinite(k)||Math.abs(k)>g)return!0;this.evaluator.setVariable("x",d);d=this.evaluator.eval(a);if(isNaN(d)||!isFinite(d)||Math.abs(d)>g)return!0;this.evaluator.setVariable("x",b);a=this.evaluator.eval(a);
if(isNaN(a)||!isFinite(a)||Math.abs(a)>g)return!0;g=3*c-4*m+k;a=3*c-4*d+a;return.8<Math.abs((g*g-a*a)/(g*g+a*a+1E-4))?!0:!1};J.prototype.drawAuxFun1=function(c,b,g){h=this.evaluator.parser.getVariable("x");l=this.evaluator.parser.getVariable("y");a.rangeOK=1;if(this.evaluator.eval(this.drawif)){b="x";this.of_y&&(b="y");c.beginPath();c.lineWidth=this.evaluator.eval(this.width);c.strokeStyle=g.getColor();for(var m=-1;m<=this.space.w;m+=1){g=this.space.getRelativeX(m);this.evaluator.setVariable(b,g);
var k=this.evaluator.eval(this.funExpr);var d=this.space.getAbsoluteX(g);k=this.space.getAbsoluteY(k);this.discontLR(this.funExpr,g,.001,100)?c.moveTo(d,k):c.lineTo(d,k)}c.stroke();this.evaluator.parser.setVariable("x",h);this.evaluator.parser.setVariable("y",l)}};J.prototype.drawAuxFun=function(c,b,g){h=this.evaluator.parser.getVariable("x");l=this.evaluator.parser.getVariable("y");a.rangeOK=1;b="x";var m="y";this.of_y&&(b="y",m="x");var k=this.drawif,d=this.evaluator.eval(this.width),e=!1,f=new a.R2(this.space.w/
2+this.space.Ox,this.space.h/2+this.space.Oy),u=this.of_y?f.ix():f.iy(),p=0,q=0,n=0,v=0,r=1/this.space.scale;f=r*(this.of_y?-this.space.h+f.y:-f.x);var z=0;this.abs_coord&&(f=0,r=1);for(var y,H,x,A,w,F,B,L,D,E=this.of_y?this.space.h+2:this.space.w+2;n<=E;){y=!0;H=0;this.evaluator.setVariable(b,f);try{x=this.evaluator.eval(this.funExpr),isNaN(x)||(this.evaluator.setVariable(m,x),0<this.evaluator.eval(this.drawif)&&a.rangeOK?(e?(A=Math.min(z,x),w=Math.max(z,x),F=new a.R2(A,w),H=this.Singularity(r,b,
0,f-r,z,f,x,F),0===H?(z<=x?(z=F.x,x=F.y):(x=F.x,z=F.y),B=parseInt(this.of_y?this.XX(d,z,this.abs_coord):this.YY(d,z,this.abs_coord)),p=this.abs_coord?Math.round(x):parseInt(this.of_y?this.XX(d,x,this.abs_coord):this.YY(d,x,this.abs_coord)),this.fillM&&p>u&&(c.lineWidth=1,c.strokeStyle=this.fillM.getColor(),c.beginPath(),this.of_y?(c.moveTo(u+1,this.space.h-n+.5),c.lineTo(p,this.space.h-n+.5)):(c.moveTo(n+.5,u+1),c.lineTo(n+.5,p)),c.stroke()),this.fillP&&p<u&&(c.lineWidth=1,c.strokeStyle=this.fillP.getColor(),
c.beginPath(),this.of_y?(c.moveTo(u-1,this.space.h-n+.5),c.lineTo(p,this.space.h-n+.5)):(c.moveTo(n+.5,u-1),c.lineTo(n+.5,p)),c.stroke()),c.lineWidth=d,c.strokeStyle=g.getColor(),c.beginPath(),this.of_y?(c.moveTo(B+.5,this.space.h-v),c.lineTo(p+.5,this.space.h-n)):(c.moveTo(v+.5,B),c.lineTo(n+.5,p)),c.stroke()):1===H?(this.evaluator.setVariable(b,f-r),L=this.extrapolate(k,b,m,0,z,r),p=this.of_y?this.XX(d,L.y,this.abs_coord):this.YY(d,L.y,this.abs_coord),c.lineWidth=d,c.strokeStyle=g.getColor(),c.beginPath(),
this.of_y?(c.moveTo(q+.5,this.space.h-v),c.lineTo(p+.5,this.space.h-v+Math.round(L.x))):(c.moveTo(v+.5,q),c.lineTo(v+Math.round(L.x)+.5,p)),this.evaluator.setVariable(b,f),D=this.extrapolate(k,b,m,0,x,-r),q=this.of_y?this.XX(d,D.y,this.abs_coord):this.YY(d,D.y,this.abs_coord),p=this.of_y?this.XX(d,x,this.abs_coord):this.YY(d,x,this.abs_coord),c.lineWidth=d,c.strokeStyle=g.getColor(),c.beginPath(),this.of_y?(c.moveTo(q+.5,this.space.h-n),c.lineTo(p+.5,this.space.h-n)):(c.moveTo(n+.5,q),c.lineTo(n+
.5,p)),c.stroke()):2===H&&(p=this.of_y?this.XX(d,x,this.abs_coord):this.YY(d,x,this.abs_coord),c.lineWidth=d,c.strokeStyle=g.getColor(),c.beginPath(),this.of_y?(c.moveTo(q+.5,this.space.h-n),c.lineTo(p+.5,this.space.h-n)):(c.moveTo(n+.5,q),c.lineTo(n+.5,p)))):(D=this.extrapolateOnSingularity(k,b,m,0,x,-r),q=this.of_y?this.XX(d,D.y,this.abs_coord):this.YY(d,D.y,this.abs_coord),p=this.of_y?this.XX(d,x,this.abs_coord):this.YY(d,x,this.abs_coord),c.lineWidth=d,c.strokeStyle=g.getColor(),c.beginPath(),
this.of_y?(c.moveTo(q,this.space.h-(n+Math.round(D.x))+.5),c.lineTo(p,this.space.h-n+.5)):(c.moveTo(n+Math.round(D.x),q),c.lineTo(n,p)),c.stroke()),z=x):y=!1)}catch(aa){y=!1}e&&!y&&(this.evaluator.setVariable(b,f-r),this.evaluator.setVariable(m,z),L=this.extrapolate(k,b,m,0,z,r),p=parseInt(this.of_y?this.XX(d,L.y,this.abs_coord):this.YY(d,L.y,this.abs_coord)),0<this.evaluator.eval(this.drawif)&&a.rangeOK&&(c.lineWidth=d,c.strokeStyle=g.getColor(),c.beginPath(),this.of_y?(c.moveTo(q,this.space.h-(v+
Math.round(L.x))+.5),c.lineTo(p,this.space.h-(v+Math.round(L.x))+.5)):(c.moveTo(v+Math.round(L.x)+.5,q),c.lineTo(v+Math.round(L.x)+.5,p)),c.stroke()),this.evaluator.setVariable(b,f));e=y;f+=r;q=p;v=n++}this.evaluator.parser.setVariable("x",h);this.evaluator.parser.setVariable("y",l)};J.prototype.registerTextField=function(){var c=a.newHTML("input");c.value=this.expresionString;c.disabled=!this.editable;var b=this;oncontextmenu=function(a){return!1};c.onkeydown=function(a){13==a.keyCode&&(b.expresion=
b.evaluator.parser.parse(this.value),b.parseExpression(),b.parent.update())};this.parent.editableRegion.textFields.push(c)};a.Equation=J;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=Math.round,e,d,r,n,b,h,l,c=function(c,b){b=a.Graphic.call(this,c,b)||this;b.parameter=b.parameter||"t";b.parameter_interval=b.parameter_interval||c.evaluator.parser.parse("[0,1]");b.parameter_steps=b.parameter_steps||c.evaluator.parser.parse("8");b.width=b.width||c.evaluator.parser.parse("1");b.fill=b.fill||"";b.visible=2===b.parent.version&&void 0==b.visible?!0:b.visible;b.visible&&b.registerTextField();return b};$jscomp.inherits(c,a.Graphic);c.prototype.update=
function(){e=this.evaluator;d=e.eval(this.parameter_interval);this.paraInf=d[0][0];this.paraSup=d[0][1];this.pSteps=e.eval(this.parameter_steps);this.paraSep=0<this.pSteps?Math.abs(this.paraSup-this.paraInf)/this.pSteps:0};c.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.fill,this.color)};c.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.fill,this.trace)};c.prototype.drawAux=function(c,g,d){e=this.evaluator;r=this.space;c.lineWidth=Math.max(1E-6,f(e.eval(this.width)));
c.lineCap=c.lineJoin="round";c.strokeStyle=d.getColor();n=e.getVariable(this.parameter);c.beginPath();e.setVariable(this.parameter,this.paraInf);b=e.eval(this.expresion);this.exprX=f(this.abs_coord?b[0][0]:r.getAbsoluteX(b[0][0]));this.exprY=f(this.abs_coord?b[0][1]:r.getAbsoluteY(b[0][1]));this.rotateExp&&(h=a.degToRad(e.eval(this.rotateExp)),l=this.rotate(b[0][0],b[0][1],h),this.exprX=f(this.abs_coord?l.x:r.getAbsoluteX(l.x)),this.exprY=f(this.abs_coord?l.y:r.getAbsoluteY(l.y)));c.moveTo(this.exprX+
.5,this.exprY+.5);for(d=1;d<=this.pSteps;d++)e.setVariable(this.parameter,this.paraInf+d*this.paraSep),b=e.eval(this.expresion),this.rotateExp&&(l=this.rotate(b[0][0],b[0][1],h),b[0][0]=l.x,b[0][1]=l.y),this.exprX=f(this.abs_coord?b[0][0]:r.getAbsoluteX(b[0][0])),this.exprY=f(this.abs_coord?b[0][1]:r.getAbsoluteY(b[0][1])),!isNaN(this.exprX)&&!isNaN(this.exprY)&&-1E6<this.exprX&&1E6>this.exprX&&-1E6<this.exprY&&1E6>this.exprY&&c.lineTo(this.exprX+.5,this.exprY+.5);this.fill&&(c.fillStyle=g.getColor(),
c.fill("evenodd"));this.dashStyle();c.stroke();c.setLineDash([]);e.setVariable(this.parameter,n)};c.prototype.registerTextField=function(){var c=a.newHTML("input");c.value=this.expresionString;c.disabled=!this.editable;var b=this;c.oncontextmenu=function(){return!1};c.onkeydown=function(a){13==a.keyCode&&(b.expresion=b.evaluator.parser.parse(this.value),b.parent.update())};this.parent.editableRegion.textFields.push(c)};a.Curve=c;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=2*Math.PI,e=Math.round,d,r,n,b,h,l,c,k,g,v,u=function(c,b){b=a.Graphic.call(this,c,b)||this;b.size=b.size||c.evaluator.parser.parse("2");b.range=b.range||c.evaluator.parser.parse("[1, 100]");b.visible=2===b.parent.version&&void 0==b.visible?!0:b.visible;b.visible&&b.registerTextField();return b};$jscomp.inherits(u,a.Graphic);u.prototype.update=function(){d=this.evaluator;n=d.eval(this.expresion);this.exprX=n[0][0];this.exprY=n[0][1];this.rotateExp&&
(b=this.rotate(n[0][0],n[0][1],a.degToRad(d.eval(this.rotateExp))),this.exprX=b.x,this.exprY=b.y);c=d.eval(this.range);this.rangeInf=c[0][0];this.rangeMax=c[0][1]};u.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.color,this.color)};u.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.trace,this.trace)};u.prototype.drawAux=function(c,b){d=this.evaluator;r=this.space;g=k=Math.ceil(d.eval(this.size)-.4);c.fillStyle=b.getColor();c.beginPath();this.rangeInf>
this.rangeMax&&(v=this.rangeInf,this.rangeInf=this.rangeMax,this.rangeMax=v);b=d.getVariable("n");for(var u=this.rangeInf,m=this.rangeMax;u<=m;u++)d.setVariable("n",u),n=d.eval(this.expresion),this.exprX=n[0][0],this.exprY=n[0][1],h=e(this.abs_coord?this.exprX:r.getAbsoluteX(this.exprX)),l=e(this.abs_coord?this.exprY:r.getAbsoluteY(this.exprY)),c.beginPath(),c.arc(h,l,k,0,f,!0),c.fill();c.fill();this.text!=[""]&&(this.fontSize=Math.max(5,d.eval(this.font_size)),this.font=this.font_style+" "+this.fontSize+
"px "+this.font_family,a.Graphic.prototype.drawText.call(this,c,this.text,h+g,l-g,this.color,this.font,"start","alphabetic",d.eval(this.decimals),this.fixed,!0));d.setVariable("n",b)};u.prototype.registerTextField=function(){var c=a.newHTML("input");c.value=this.expresionString;c.disabled=!this.editable;var b=this;oncontextmenu=function(a){return!1};c.onkeydown=function(a){13==a.keyCode&&(b.expresion=b.evaluator.parser.parse(this.value),b.parent.update())};this.parent.editableRegion.textFields.push(c)};
a.Sequence=u;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=2*Math.PI,e=Math.round,d,r,n,b,h,l,c,k=function(c,b){b=a.Graphic.call(this,c,b)||this;b.size=b.size||c.evaluator.parser.parse("2");b.text=new a.TextObject(b,b.text);return b};$jscomp.inherits(k,a.Graphic);k.prototype.update=function(){d=this.evaluator;n=d.eval(this.expresion);this.exprX=n[0][0];this.exprY=n[0][1];this.rotateExp&&(b=this.rotate(n[0][0],n[0][1],a.degToRad(d.eval(this.rotateExp))),this.exprX=b.x,this.exprY=b.y)};k.prototype.draw=function(){a.Graphic.prototype.draw.call(this,
this.color,this.color)};k.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.trace,this.trace)};k.prototype.drawAux=function(a,b){r=this.space;a.fillStyle=b.getColor();h=e(this.abs_coord?this.exprX:r.getAbsoluteX(this.exprX));l=e(this.abs_coord?this.exprY:r.getAbsoluteY(this.exprY));c=e(this.evaluator.eval(this.size));0<c&&(a.beginPath(),a.arc(h,l,c,0,f),a.fill());this.text.hasContent&&this.text.draw(a,b,h,l)};a.Point=k;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=Math.round,e=2*Math.PI,d,r,n,b,h,l,c,k,g,v,u=function(c,b){b=a.Graphic.call(this,c,b)||this;b.width=b.width||c.evaluator.parser.parse("1");b.size=b.size||c.evaluator.parser.parse("2");b.text=new a.TextObject(b,b.text);return b};$jscomp.inherits(u,a.Graphic);u.prototype.update=function(){d=this.evaluator;n=d.eval(this.expresion);this.endPoints=[];for(var c=0,g=n.length;c<g;c++)this.endPoints[c]={x:n[c][0],y:n[c][1]};if(this.rotateExp)for(b=a.degToRad(d.eval(this.rotateExp)),
c=0,g=this.endPoints.length;c<g;c++)this.endPoints[c]=this.rotate(this.endPoints[c].x,this.endPoints[c].y,b)};u.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.color,this.color)};u.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.trace,this.trace)};u.prototype.drawAux=function(a,b,u){d=this.evaluator;r=this.space;a.lineWidth=Math.max(1E-6,f(d.eval(this.width)));h=d.eval(this.size);a.fillStyle=b.getColor();a.strokeStyle=u.getColor();a.lineCap="round";l=
0==a.lineWidth%2?0:.5;this.abs_coord?(c=f(this.endPoints[0].x),k=f(this.endPoints[0].y),g=f(this.endPoints[1].x),v=f(this.endPoints[1].y)):(c=f(r.getAbsoluteX(this.endPoints[0].x)),k=f(r.getAbsoluteY(this.endPoints[0].y)),g=f(r.getAbsoluteX(this.endPoints[1].x)),v=f(r.getAbsoluteY(this.endPoints[1].y)));a.beginPath();a.moveTo(c+l,k+l);a.lineTo(g+l,v+l);this.dashStyle();a.stroke();0<h&&(a.beginPath(),a.arc(c,k,h,0,e),a.arc(g,v,h,0,e),a.fill());a.setLineDash([]);this.text.hasContent&&this.text.draw(a,
u,parseInt((c+g)/2)-3,parseInt((k+v)/2)+3)};a.Segment=u;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=Math.floor,e=Math.round,d,r,n,b,h,l,c,k,g,v,u,p,z,q=function(c,b){b=a.Graphic.call(this,c,b)||this;b.width=b.width||c.evaluator.parser.parse("5");b.size=b.size||c.evaluator.parser.parse("2");b.spear=b.spear||c.evaluator.parser.parse("8");b.arrow=b.arrow||new a.Color("ee0022");b.text=new a.TextObject(b,b.text);b.endPoints=[];b.vect=new a.Vector2D(0,0);return b};$jscomp.inherits(q,a.Graphic);q.prototype.update=function(){d=this.evaluator;r=d.eval(this.expresion);
for(var c=0,b=r.length;c<b;c++)this.endPoints[c]={x:r[c][0],y:r[c][1]};if(this.rotateExp)for(n=a.degToRad(d.eval(this.rotateExp)),c=0,b=this.endPoints.length;c<b;c++)this.endPoints[c]=this.rotate(this.endPoints[c].x,this.endPoints[c].y,n)};q.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.arrow,this.color)};q.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.arrow,this.trace)};q.prototype.drawAux=function(a,q,n){d=this.evaluator;b=this.space;h=Math.max(0,
d.eval(this.width));l=Math.ceil(h/2);c=b.scale;this.vect.x=this.endPoints[1].x-this.endPoints[0].x;this.vect.y=this.endPoints[1].y-this.endPoints[0].y;k=this.vect.vectorLength();this.angle=Math.atan2(this.vect.y,this.vect.x);a.fillStyle=q.getColor();a.strokeStyle=n.getColor();a.lineWidth=2;this.abs_coord?(g=e(this.endPoints[0].x),v=e(this.endPoints[0].y),u=e(this.endPoints[1].x),p=e(this.endPoints[1].y)):(g=e(b.getAbsoluteX(this.endPoints[0].x)),v=e(b.getAbsoluteY(this.endPoints[0].y)),u=e(b.getAbsoluteX(this.endPoints[1].x)),
p=e(b.getAbsoluteY(this.endPoints[1].y)));z=Math.max(0,d.eval(this.spear));a.save();a.translate(g,v);this.abs_coord?a.rotate(this.angle):(k*=c,a.rotate(-this.angle));a.beginPath();a.moveTo(-l,f(-l));a.lineTo(f(k-z-h),f(-l));a.lineTo(f(k-2*z),f(-z-l));a.lineTo(f(k),0);a.lineTo(f(k-2*z),f(z+l));a.lineTo(f(k-z-h),f(l));a.lineTo(-l,f(l));a.closePath();a.stroke();a.fill();a.restore();this.text.hasContent&&this.text.draw(a,n,parseInt((g+u)/2)-3,parseInt((v+p)/2)+3)};a.Arrow=q;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=Math.round,e,d,r,n,b,h,l=function(c,b){b=a.Graphic.call(this,c,b)||this;b.width=b.width||c.evaluator.parser.parse("1");b.fill=b.fill||"";b.endPoints=[];return b};$jscomp.inherits(l,a.Graphic);l.prototype.update=function(){e=this.evaluator;r=e.eval(this.expresion);for(var c=0,b=r.length;c<b;c++)this.endPoints[c]={x:r[c][0],y:r[c][1]};if(this.rotateExp)for(n=a.degToRad(e.eval(this.rotateExp)),c=0,b=this.endPoints.length;c<b;c++)this.endPoints[c]=this.rotate(this.endPoints[c].x,
this.endPoints[c].y,n)};l.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.fill,this.color)};l.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.trace,this.trace)};l.prototype.drawAux=function(a,k,g){e=this.evaluator;d=this.space;a.lineWidth=Math.max(1E-6,f(e.eval(this.width)));a.strokeStyle=g.getColor();a.lineCap=a.lineJoin="round";b=f(this.abs_coord?this.endPoints[0].x:d.getAbsoluteX(this.endPoints[0].x));h=f(this.abs_coord?this.endPoints[0].y:d.getAbsoluteY(this.endPoints[0].y));
a.beginPath();a.moveTo(b+0,h+0);g=1;for(var c=this.endPoints.length;g<c;g++)b=f(this.abs_coord?this.endPoints[g].x:d.getAbsoluteX(this.endPoints[g].x)),h=f(this.abs_coord?this.endPoints[g].y:d.getAbsoluteY(this.endPoints[g].y)),a.lineTo(b+0,h+0);this.fill&&(a.fillStyle=k.getColor(),a.fill());this.dashStyle();a.stroke();a.setLineDash([])};a.Polygon=l;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=Math.round,e=Math.min,d=Math.max,r=Math.abs,n,b,h,l,c,k,g,v,u,p,z=function(c,b){b=a.Graphic.call(this,c,b)||this;b.width=b.width||c.evaluator.parser.parse("1");b.fill=b.fill||"";b.border_radius=b.border_radius||c.evaluator.parser.parse("0");b.endPoints=[];return b};$jscomp.inherits(z,a.Graphic);z.prototype.update=function(){n=this.evaluator;l=n.eval(this.expresion);this.exprX=l[0][0];this.exprY=l[0][1];this.w=150;this.h=100;this.rotateExp&&(h=this.rotate(l[0][0],
l[0][1],a.degToRad(n.eval(this.rotateExp))),this.exprX=h.x,this.exprY=h.y);4<=l[0].length&&(this.w=l[0][2],this.h=l[0][3]);l[1]&&2==l[1].length&&(this.w=l[1][0],this.h=l[1][1]);this.w=d(0,this.w);this.h=d(0,this.h)};z.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.fill,this.color)};z.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.fill,this.trace,"trace")};z.prototype.drawAux=function(a,m,h,l){n=this.evaluator;b=this.space;a.lineWidth=Math.max(1E-6,f(n.eval(this.width)));
a.strokeStyle=h.getColor();a.lineCap="round";a.lineJoin="miter";c=f(this.abs_coord?this.exprX:b.getAbsoluteX(this.exprX))+0;k=f(this.abs_coord?this.exprY:b.getAbsoluteY(this.exprY))+0;g=this.abs_coord?this.w:this.w*b.scale;v=this.abs_coord?this.h:-this.h*b.scale;u=e(d(0,n.eval(this.border_radius)),.5*r(g),.5*r(v));p=this.abs_coord?1:-1;a.beginPath();0!==u?(a.moveTo(c+u,k),a.lineTo(c+g-u,k),a.quadraticCurveTo(c+g,k,c+g,k+p*u),a.lineTo(c+g,k+v-p*u),a.quadraticCurveTo(c+g,k+v,c+g-u,k+v),a.lineTo(c+u,
k+v),a.quadraticCurveTo(c,k+v,c,k+v-p*u),a.lineTo(c,k+p*u),a.quadraticCurveTo(c,k,c+u,k),a.lineTo(c+u,k)):(a.moveTo(c,k),a.lineTo(c+g,k),a.lineTo(c+g,k+v),a.lineTo(c,k+v),a.lineTo(c,k));this.fill&&(a.fillStyle=m.getColor(),a.fill());this.dashStyle();a.stroke();a.setLineDash([])};a.Rectangle=z;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=Math.round,e=Math.min,d=Math.max,r=Math.acos,n=Math.sqrt,b=Math.PI,h=b/2,l=2*b,c,k,g,v,u,p,z,q,m,y,w,x,A,H,E,G,F,D,B,K,L=function(c,b){b=a.Graphic.call(this,c,b)||this;b.width=b.width||c.evaluator.parser.parse("1");b.fill=b.fill||"";b.center=b.center||c.evaluator.parser.parse("(0,0)");b.radius=b.radius||c.evaluator.parser.parse("1");b.init=b.init||"0";b.end=b.end||"90";b.init.match(/^_\(/)&&(b.initFlag=!0,b.init=b.init.substring(1));b.end.match(/^_\(/)&&
(b.endFlag=!0,b.end=b.end.substring(1));b.initExpr=c.evaluator.parser.parse(b.init);b.endExpr=c.evaluator.parser.parse(b.end);b.text=new a.TextObject(b,b.text);return b};$jscomp.inherits(L,a.Graphic);L.prototype.update=function(){c=this.evaluator;k=c.eval(this.center);this.exprX=k[0][0];this.exprY=k[0][1];g=0;this.rotateExp&&(g=a.degToRad(c.eval(this.rotateExp)),v=Math.cos(g),u=Math.sin(g),p=this.exprX*v-this.exprY*u,z=this.exprX*u+this.exprY*v,this.exprX=p,this.exprY=z);var f=c.eval(this.initExpr),
F=c.eval(this.endExpr);/^(\(|\[)expr(\)|\])$/i.test(this.initExpr.type)&&/^(\(|\[)expr(\)|\])$/i.test(this.endExpr.type)?(q=f[0][0],m=f[0][1],y=F[0][0],w=F[0][1],this.vectors?this.abs_coord&&(m=-m,w=-w):(q-=this.exprX,m=-m+this.exprY,y-=this.exprX,w=-w+this.exprY,this.abs_coord||(m=-m,w=-w)),x=0==q?0>m?3*h:h:r(1*q/n(q*q+m*m)),A=0==y?0>w?3*h:h:r(1*y/n(y*y+w*w)),x+=g,A+=g,0<q&&0<m&&this.abs_coord&&(x=l-x),0<q&&0>m&&!this.abs_coord&&(x=l-x),0>q&&0>m&&!this.abs_coord&&(x=l-x),0>q&&0<m&&this.abs_coord&&
(x=l-x),0<y&&0<w&&this.abs_coord&&(A=l-A),0<y&&0>w&&!this.abs_coord&&(A=l-A),0>y&&0>w&&!this.abs_coord&&(A=l-A),0>y&&0<w&&this.abs_coord&&(A=l-A),this.initFlag?(H=x,x=A,A=H):(H=e(x,A),E=d(x,A),x=H,A=E,A-x>b&&this.abs_coord&&(x=E,A=H),A-x<=b&&!this.abs_coord&&(x=E,A=H)),this.iniAng=x,this.endAng=A,this.drawPoints=!0):(this.iniAng=a.degToRad(f)+g,this.endAng=a.degToRad(F)+g,this.drawAngle=!0)};L.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.fill,this.color)};L.prototype.drawTrace=
function(){a.Graphic.prototype.drawTrace.call(this,this.fill,this.trace)};L.prototype.drawAux=function(a,b,g){c=this.evaluator;G=this.space;B=Math.max(0,c.eval(this.radius));a.lineWidth=Math.max(1E-6,f(c.eval(this.width)));a.lineCap="round";a.strokeStyle=g.getColor();this.abs_coord?(F=f(this.exprX),D=f(this.exprY)):(F=f(G.getAbsoluteX(this.exprX)),D=f(G.getAbsoluteY(this.exprY)),B*=G.scale,this.iniAng=-this.iniAng,this.endAng=-this.endAng);this.drawAngle&&this.iniAng>this.endAng&&(K=this.iniAng,this.iniAng=
this.endAng,this.endAng=K);this.fill&&(a.fillStyle=b.getColor(),a.beginPath(),a.moveTo(F,D),a.arc(F,D,B,this.iniAng,this.endAng,void 0),a.fill());a.beginPath();a.arc(F,D,B,this.iniAng,this.endAng,void 0);this.dashStyle();a.stroke();this.text.hasContent&&this.text.draw(a,this.color,F,D)};a.Arc=L;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,e,d,r,n,b=function(b,d){d=a.Graphic.call(this,b,d)||this;d.width=d.width||b.evaluator.parser.parse("0");d.align||(d.align="left");d.anchor||(d.anchor="top_left");d.shadowColor=d.shadowColor?d.shadowColor.getColor():"transparent";d.text=new a.TextObject(d,d.text);return d};$jscomp.inherits(b,a.Graphic);b.prototype.update=function(){f=this.evaluator;e=f.eval(this.expresion);this.exprX=e[0][0];this.exprY=e[0][1];this.rotateExp&&(d=this.rotate(e[0][0],
e[0][1],a.degToRad(f.eval(this.rotateExp))),this.exprX=d.x,this.exprY=d.y)};b.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.color)};b.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.trace)};b.prototype.drawAux=function(a,b){this.abs_coord?(r=parseInt(this.exprX),n=parseInt(this.exprY)):(r=parseInt(this.space.getAbsoluteX(this.exprX)),n=parseInt(this.space.getAbsoluteY(this.exprY)));this.text.draw(a,b,r,n)};a.Text=b;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=Math.round,e,d,r,n,b,h,l,c,k,g,v,u,p,z=function(c,b){b=a.Graphic.call(this,c,b)||this;b.file=b.file||"";b.inirot=b.inirot||c.evaluator.parser.parse("0");b.img=new Image;b.scaleX=b.scaleY=1;b.ratio=c.ratio;c=b.expresion.getChildren();b.x_e=c[0];b.y_e=c[1];2<c.length&&(b.centered=!0,b.s_x_e=c[2],b.s_y_e=3<c.length?c[3]:c[2]);b.evaluator.eval(b.clip)&&(b.clip=b.clip.getChildren());b.update();return b};$jscomp.inherits(z,a.Graphic);z.prototype.update=
function(){e=this.evaluator;v=e.eval(this.x_e);u=e.eval(this.y_e);this.exprX=v;this.exprY=u;this.rotateExp&&(d=this.rotate(v,u,a.degToRad(e.eval(this.rotateExp))),this.exprX=d.x,this.exprY=d.y);this.centered&&(this.scaleX=e.eval(this.s_x_e),this.scaleY=e.eval(this.s_y_e),0==this.scaleX&&(this.scaleX=1E-5),0==this.scaleY&&(this.scaleY=1E-5));p=this;if((r=e.eval(this.file))||""==r)this.img=this.parent.getImage(r),this.img.ready||this.img.addEventListener("load",function(a){p.space.update(!0)})};z.prototype.draw=
function(){a.Graphic.prototype.draw.call(this)};z.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this)};z.prototype.drawAux=function(d){e=this.evaluator;this.img&&this.img.ready&&this.img.complete&&(this.clip?(k=e.eval(this.clip[2]),g=e.eval(this.clip[3])):(k=this.img.width,g=this.img.height,this.img.canvas&&(k=f(k/this.img.ratio),g=f(g/this.img.ratio))),n=this.centered?0:f(k/2),b=this.centered?0:f(g/2),h=f(this.abs_coord?this.exprX:this.space.getAbsoluteX(this.exprX)),l=f(this.abs_coord?
this.exprY:this.space.getAbsoluteY(this.exprY)),c=a.degToRad(-e.eval(this.inirot)),d.save(),d.translate(h+n,l+b),d.rotate(c),this.opacity&&(d.globalAlpha=e.eval(this.opacity)),d.scale(this.scaleX,this.scaleY),this.clip?this.img.canvas?d.drawImage(this.img,e.eval(this.clip[0])*this.img.ratio,e.eval(this.clip[1])*this.img.ratio,k*this.img.ratio,g*this.img.ratio,-k/2,-g/2,k,g):d.drawImage(this.img,e.eval(this.clip[0]),e.eval(this.clip[1]),k,g,-k/2,-g/2,k,g):d.drawImage(this.img,-k/2,-g/2,k,g),d.restore())};
a.Image=z;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,e,d,r,n,b,h,l,c=document.createElement("canvas").getContext("2d");c.canvas.width=1;c.canvas.height=1;var k=function(c,b){return a.Graphic.call(this,c,b)||this};$jscomp.inherits(k,a.Graphic);k.prototype.update=function(){f=this.evaluator.eval(this.expresion);this.exprX=f[0][0];this.exprY=f[0][1]};k.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.color,this.color)};k.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.trace,
this.trace)};k.prototype.drawAux=function(a,k){k=k.getColor();c.clearRect(0,0,1,1);c.fillStyle=k;c.fillRect(0,0,1,1);k=(new Uint32Array(c.getImageData(0,0,1,1).data.buffer))[0];h=a.getImageData(0,0,this.space.w,this.space.h);l=new Uint32Array(h.data.buffer);this.abs_coord?(e=parseInt(this.exprX),d=parseInt(this.exprY)):(e=parseInt(this.space.getAbsoluteX(this.exprX)),d=parseInt(this.space.getAbsoluteY(this.exprY)));if(!(0>e||0>d||e>=this.space.w||d>=this.space.h)){r=[e,d];var g=h.width;n=0>e||0>d||
e>=g||d>=h.height?-1:l[e+d*g];for(b=0;0<r.length&&!(b++,d=r.pop(),e=r.pop(),g=h.width,n==(0>e||0>d||e>=g||d>=h.height?-1:l[e+d*g])&&(l[e+d*h.width]=k,r.push(e-1,d),r.push(e+1,d),r.push(e,d-1),r.push(e,d+1)),b>=this.space.w*this.space.h*8););a.putImageData(h,0,0)}};a.Fill=k;return a}(descartesJS||{});
descartesJS=function(a,f){if(a.loadLib)return a;var e=new String("-text-image-point-polygon-arc-segment-arrow-macro-curve-equation-sequence-rectangle-fill-"),d=/[\w\.\-//]*(\.png|\.jpg|\.gif|\.svg|\.webp)/gi,r,n=function(b,h){var l=a.Graphic.call(this,b,h)||this;l.hasExpresion=l.hasExpresion||!1;l.inirot=l.inirot||b.evaluator.parser.parse("0");l.inipos=l.inipos||b.evaluator.parser.parse("(0,0)");Object.assign(l,h);l.hasExpresion=void 0!==l.expresion;l.graphics=[];b=b.lessonParser;var c=new a.Tokenizer;
if(!l.hasExpresion)return l;"'"!==l.expresion.charAt(0)&&(l.expresion="'"+l.expresion+"'");l.expresion=l.evaluator.parser.parse(l.expresion);h=l.evaluator.eval(l.expresion);if(h)var k=(k=document.getElementById(h))&&"descartes/macro"==k.type?k.text:a.openFile(h);if(k){var g=a.convertHTMLEntities(k).replace(/\r/g,"").split("\n");k=[];h=0;for(var n=g.length;h<n;h++)if(g[h].trim()){var u=g[h].indexOf("=");if(-1!==u){u=b.split(g[h]);for(var p=0,r=u.length;p<r;p++)if(u[p]&&1<u.length&&("id"===f[u[p][0]]||
"type"===f[u[p][0]])){k.push(u);break}}}p=function(b,g){g=c.tokenize(g.replace(/&squot;/g,"'"));for(var d=0,k=g.length;d<k;d++)if("identifier"==g[d].type&&!a.reservedIds.match("-"+g[d].value+"-")||"R"===g[d].value||"G"===g[d].value||"B"===g[d].value)g[d].value=l.name+"."+g[d].value;return(b.match(/^\\expr/)?"\\expr ":"\\decimals ")+c.flatTokens(g)};h=0;for(n=k.length;h<n;h++){var q=(r=k[h]||[],r[0])&&"id"===r[0][0];g=0;for(u=r.length;g<u;g++){var m=r[g][0].indexOf(".");-1===m||q?m=f[r[g][0]]:(m=f[r[g][0].substring(m+
1)],r[g][0]=l.name+"."+r[g][0]);if(!("font"===m||"font_family"===m||("fill"===m||"color"===m||"border"===m||"arrow"===m)&&"("!==r[g][1].charAt(0)||"file"===m&&r[g][1].match(d)||"id"!==m&&void 0!==f[r[g][1]])||"radius"===m)if("text"==m)if(r[g][1].match(/\{\\rtf1/))m=r[g][1],m=m.replace(/\\expr ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,p),m=m.replace(/\\decimals ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,p),r[g][1]=m;else{var y=b.parseText(r[g][1]).textElementsMacros;for(var w=
0,x=y.length;w<x;w++){m=c.tokenize(y[w].replace(/&squot;/g,"'"));for(var A=0,H=m.length;A<H;A++)if("identifier"===m[A].type&&!a.reservedIds.match("-"+m[A].value+"-")||"R"===m[A].value||"G"===m[A].value||"B"===m[A].value)m[A].value=l.name+"."+m[A].value;m=c.flatTokens(m).replace(/&squot;/g,"'").replace(/'\+\(/g,"[").replace(/\)\+'/g,"]");y[w]=m.substring(1,m.length-1)}r[g][1]=y.join("")}else{y=r[g][1].replace(/&squot;/g,"'").split(";");w=0;for(x=y.length;w<x;w++){m=c.tokenize(y[w].replace(/\\n/g,";"));
A=0;for(H=m.length;A<H;A++)if("identifier"===m[A].type&&!a.reservedIds.match("-"+m[A].value+"-")||"R"===m[A].value||"G"===m[A].value||"B"===m[A].value)m[A].value=l.name+"."+m[A].value;y[w]=c.flatTokens(m)}r[g][1]=y.join(";")}}}h=0;for(n=k.length;h<n;h++)if(k[h][0]){p="";r=!1;g=0;for(u=k[h].length;g<u;g++)"type"===f[k[h][g][0]]&&e.match("-"+f[k[h][g][1]]+"-")&&(r=!0),p=p+k[h][g][0]+"='"+k[h][g][1]+"' ";k[h]=p+(r?" space='"+l.spaceID+"'":"");r?l.graphics.push(b.parseGraphic(k[h],l.abs_coord,l.background,
l.inirot)):b.parseAuxiliar(k[h])}}return l};$jscomp.inherits(n,a.Graphic);n.prototype.update=function(){r=this.evaluator.eval(this.inipos);this.iniPosX=r[0][0];this.iniPosY=r[0][1]};n.prototype.drawAux=function(a){for(var b=0,d=this.graphics.length;b<d;b++)this.graphics[b]&&(a.save(),this.graphics[b].abs_coord?a.translate(this.iniPosX,this.iniPosY):a.translate(this.iniPosX*this.space.scale,-this.iniPosY*this.space.scale),this.graphics[b].draw(),a.restore())};a.Macro=n;return a}(descartesJS||{},babel);
descartesJS=function(a){if(a.loadLib)return a;var f=Math.sqrt,e=Math.sin,d=Math.cos,r=Math.abs,n,b,h,l,c,k,g,v,u,p,z,q,m,y,w,x=function(a,c,b,g){this.x=a||0;this.y=c||0;this.z=b||0;this.w=g||0;this.adjustDec()};x.prototype.adjustDec=function(){this.x=parseInt(1E9*this.x)/1E9;this.y=parseInt(1E9*this.y)/1E9;this.z=parseInt(1E9*this.z)/1E9};var A=function(a,c,b,g,d,k,m,e,f,h,l,u,p,n,q,v){this.a00=a||0;this.a01=c||0;this.a02=b||0;this.a03=g||0;this.a10=d||0;this.a11=k||0;this.a12=m||0;this.a13=e||0;
this.a20=f||0;this.a21=h||0;this.a22=l||0;this.a23=u||0;this.a30=p||0;this.a31=n||0;this.a32=q||0;this.a33=v||0};A.prototype.setIdentity=function(){this.a00=1;this.a10=this.a03=this.a02=this.a01=0;this.a11=1;this.a21=this.a20=this.a13=this.a12=0;this.a22=1;this.a32=this.a31=this.a30=this.a23=0;this.a33=1;return this};A.prototype.multiplyVector4=function(a){return new x(a.x*this.a00+a.y*this.a10+a.z*this.a20+a.w*this.a30,a.x*this.a01+a.y*this.a11+a.z*this.a21+a.w*this.a31,a.x*this.a02+a.y*this.a12+
a.z*this.a22+a.w*this.a32,a.x*this.a03+a.y*this.a13+a.z*this.a23+a.w*this.a33)};A.prototype.translate=function(a){return new A(this.a00,this.a01,this.a02,this.a03,this.a10,this.a11,this.a12,this.a13,this.a20,this.a21,this.a22,this.a23,this.a00*a.x+this.a10*a.y+this.a20*a.z+this.a30,this.a01*a.x+this.a11*a.y+this.a21*a.z+this.a31,this.a02*a.x+this.a12*a.y+this.a22*a.z+this.a32,this.a03*a.x+this.a13*a.y+this.a23*a.z+this.a33)};A.prototype.rotateX=function(a){b=e(a);h=d(a);v=this.a10;u=this.a11;p=this.a12;
z=this.a13;q=this.a20;m=this.a21;y=this.a22;w=this.a23;return new A(this.a00,this.a01,this.a02,this.a03,v*h+q*b,u*h+m*b,p*h+y*b,z*h+w*b,v*-b+q*h,u*-b+m*h,p*-b+y*h,z*-b+w*h,this.a30,this.a31,this.a32,this.a33)};A.prototype.rotateY=function(a){b=e(a);h=d(a);l=this.a00;c=this.a01;k=this.a02;g=this.a03;q=this.a20;m=this.a21;y=this.a22;w=this.a23;return new A(l*h+q*-b,c*h+m*-b,k*h+y*-b,g*h+w*-b,this.a10,this.a11,this.a12,this.a13,l*b+q*h,c*b+m*h,k*b+y*h,g*b+w*h,this.a30,this.a31,this.a32,this.a33)};A.prototype.rotateZ=
function(a){b=e(a);h=d(a);l=this.a00;c=this.a01;k=this.a02;g=this.a03;v=this.a10;u=this.a11;p=this.a12;z=this.a13;return new A(l*h+v*b,c*h+u*b,k*h+p*b,g*h+z*b,l*-b+v*h,c*-b+u*h,k*-b+p*h,g*-b+z*h,this.a20,this.a21,this.a22,this.a23,this.a30,this.a31,this.a32,this.a33)};a.norm3D=function(a){return f(a.x*a.x+a.y*a.y+a.z*a.z)};a.normalize3D=function(c){n=a.norm3D(c);if(0===n)return{x:0,y:0,z:0};if(1===n)return{x:c.x,y:c.y,z:c.z};n=1/n;return{x:c.x*n,y:c.y*n,z:c.z*n}};a.dotProduct3D=function(a,c){return a.x*
c.x+a.y*c.y+a.z*c.z};a.crossProduct3D=function(a,c){return{x:a.y*c.z-a.z*c.y,y:a.z*c.x-a.x*c.z,z:a.x*c.y-a.y*c.x}};a.scalarProduct3D=function(a,c){return{x:a.x*c,y:a.y*c,z:a.z*c}};a.subtract3D=function(a,c){return{x:a.x-c.x,y:a.y-c.y,z:a.z-c.z}};a.add3D=function(a,c){return{x:a.x+c.x,y:a.y+c.y,z:a.z+c.z}};a.equals3DEpsilon=function(a,c,b){return r(a.x-c.x)<=b&&r(a.y-c.y)<=b&&r(a.z-c.z)<=b};a.Vector4D=x;a.Matrix4x4=A;return a}(descartesJS||{});
descartesJS=function(a){function f(a){a.textNode=null;0!==parseInt(this.size)&&(a.lineWidth=1,a.fillStyle=this.backColor,a.strokeStyle=this.frontColor,a.beginPath(),a.arc(this.projVert[0].x,this.projVert[0].y,this.size,0,b),a.fill(),a.stroke())}function e(a,c){a.textNode=null;a.lineCap=h;a.lineJoin=lineJoin;a.lineWidth=.4;a.beginPath();a.moveTo(this.projVert[0].x,this.projVert[0].y);u=1;for(p=this.projVert.length;u<p;u++)a.lineTo(this.projVert[u].x,this.projVert[u].y);a.closePath();"color"===this.model?
(a.fillStyle=0>this.direction?this.backColor:this.frontColor,a.strokeStyle=a.fillStyle,a.stroke(),a.fill()):"light"===this.model||"metal"===this.model?(a.fillStyle=c.computeColor(0>this.direction?this.backColor:this.frontColor,this,"metal"===this.model),a.strokeStyle=a.fillStyle,a.stroke(),a.fill()):"wire"===this.model&&(a.lineWidth=1.25,a.strokeStyle=this.frontColor,a.stroke());this.edges&&"wire"!==this.model&&(a.lineWidth=1,a.strokeStyle=this.edges,a.stroke())}function d(a){a.textNode=null;a.oldTextNode=
"_a1b2c3_";g=this.evaluator.getVariable(this.family);this.evaluator.setVariable(this.family,this.familyValue);this.fontSize=Math.max(5,this.evaluator.eval(this.font_size));this.font=this.font_style+" "+this.fontSize+"px "+this.font_family;this.drawText(a,this.text,this.projVert[0].x,this.projVert[0].y,this.frontColor,this.font,"left","alphabetic",this.decimals,this.fixed,!0);this.evaluator.setVariable(this.family,g)}function r(a){a.textNode=null;a.lineCap=h;a.lineJoin=lineJoin;a.lineWidth=this.lineWidth;
a.strokeStyle=this.frontColor;a.beginPath();a.moveTo(this.projVert[0].x,this.projVert[0].y);a.lineTo(this.projVert[1].x,this.projVert[1].y);"dot"===this.lineDash?(a.lineCap="butt",a.setLineDash([a.lineWidth,a.lineWidth])):"dash"===this.lineDash?(a.lineCap="butt",a.setLineDash([4*a.lineWidth,3*a.lineWidth])):"dash_dot"===this.lineDash?(a.lineCap="butt",a.setLineDash([4*a.lineWidth,2*a.lineWidth,a.lineWidth,2*a.lineWidth])):a.setLineDash([]);a.stroke()}function n(c,b,g){return a.normalize3D(a.crossProduct3D(a.subtract3D(c,
b),a.subtract3D(c,g)))}if(a.loadLib)return a;var b=2*Math.PI,h=lineJoin="round",l,c,k,g,v,u,p,z,q,m,y,w,x,A=function(a,c){Object.assign(this,a);this.space=c;this.projVert=[];this.spaceVertices=[];this.newProjVert=[];this.newSpaceVert=[];"vertex"===this.type?this.draw=f:"face"===this.type?(this.normal=n(this.vertices[0],this.vertices[1],this.vertices[2]),this.draw=e):"text"===this.type?this.draw=d:"edge"===this.type&&(this.draw=r);this.isText&&(this.computeDepth=function(){this.normal={x:0,y:0,z:0};
this.projVert=this.vertices;this.depth=this.vertices[0].z;this.average=this.vertices[0]})};A.prototype.computeDepth=function(c){this.space=c;this.average={x:0,y:0,z:0};this.removeDoubles();this.normal={x:0,y:1,z:0};this.direction={x:1,y:0,z:0};u=0;for(p=this.vertices.length;u<p;u++)this.spaceVertices[u]=c.rotateVertex(this.vertices[u]),this.average.x+=this.spaceVertices[u].x,this.average.y+=this.spaceVertices[u].y,this.average.z+=this.spaceVertices[u].z;this.average=a.scalarProduct3D(this.average,
1/p);this.average_proy=c.project(this.average);this.depth=a.norm3D(a.subtract3D(c.eye,this.average));2<this.vertices.length&&(this.normal=n(this.spaceVertices[0],this.spaceVertices[1],this.spaceVertices[2]));u=0;for(p=this.vertices.length;u<p;u++)this.newSpaceVert[u]=this.spaceVertices[u],this.projVert[u]=this.newProjVert[u]=c.project(this.spaceVertices[u]);2<this.vertices.length&&(this.direction=n(this.projVert[0],this.projVert[1],this.projVert[2]).z);this.minDistanceToEye=Infinity;this.maxDistanceToEye=
-Infinity;this.minx=Infinity;this.maxx=-Infinity;this.miny=Infinity;this.maxy=-Infinity;u=0;for(p=this.vertices.length;u<p;u++)z=a.norm3D(a.subtract3D(this.spaceVertices[u],c.eye)),this.minDistanceToEye=Math.min(this.minDistanceToEye,z),this.maxDistanceToEye=Math.max(this.maxDistanceToEye,z);u=0;for(p=this.vertices.length;u<p;u++)this.minx>this.projVert[u].x&&(this.minx=this.projVert[u].x),this.maxx<this.projVert[u].x&&(this.maxx=this.projVert[u].x),this.miny>this.projVert[u].y&&(this.miny=this.projVert[u].y),
this.maxy<this.projVert[u].y&&(this.maxy=this.projVert[u].y)};A.prototype.removeDoubles=function(){if("edge"!==this.type){v=[];u=0;for(p=this.vertices.length;u<p;u++)(1E-8<Math.abs(this.vertices[u].x-this.vertices[(u+1)%p].x)||1E-8<Math.abs(this.vertices[u].y-this.vertices[(u+1)%p].y)||1E-8<Math.abs(this.vertices[u].z-this.vertices[(u+1)%p].z)||1E-8<Math.abs(this.vertices[u].w-this.vertices[(u+1)%p].w))&&v.push(this.vertices[u]);0===v.length&&v.push(this.vertices[0]);this.vertices=v}};A.prototype.drawText=
function(b,g,d,m,e,f,h,u,p,n,q){l=this.evaluator;b.textNode=g;f=l.eval(this.offset_dist);h=-a.degToRad(l.eval(this.offset_angle));d+=f*Math.cos(h);m+=f*Math.sin(h);b.textNode.pos={x:d,y:m};g.hasContent&&(g.draw(b,e,d,m,!0),k=this.fromPoint?g.textNodes.metrics.w/2:0,c=this.fromPoint?g.textNodes.metrics.h/2:0,g.draw(b,e,d-k,m-c))};A.prototype.splitFace=function(c){if(this.intersects(c)){var b=i2=null,g=ix2=0,d,k;var m=this.vertices;var e=c.vertices;var f=0;for(k=e.length;f<k;f++){var h=this.intersection(e[f],
e[(f+1)%k]);if(null!==h)if(null===b){if(b=h,g=f,2===e.length){i2=b;break}}else if(!a.equals3DEpsilon(h,b,1E-8)){i2=h;ix2=f;break}}if(null!==b&&null!==i2){f=this.isInterior(b)||this.isInterior(i2);var l=d=null;if(!f&&3<=e.length)for(k=0,m=m.length;k<m;k++)if(h=c.intersection(this.vertices[k],this.vertices[(k+1)%m]),null!==h)if(null===d)d=h;else if(!a.equals3DEpsilon(h,d,1E-8)){l=h;break}if(f||null!==d&&null!==l&&c.isInterior(d)&&c.isInterior(l)){l=!0;m=h=null;if(2===e.length)a.equals3DEpsilon(b,e[0],
1E-8)||a.equals3DEpsilon(b,e[1],1E-8)?l=!1:(h=[],h[0]=e[0],h[1]=b,m=[],m[0]=b,m[1]=e[1]);else for(h=[],m=[],f=k=d=0;f<e.length;f++)f<g?h[d++]=e[f]:f==g?(h[d++]=e[f],h[d++]=b,m[k++]=b):f<ix2?m[k++]=e[f]:f==ix2?(m[k++]=e[f],m[k++]=i2,h[d++]=i2):h[d++]=e[f];if(l){b=[];b[0]=new A({vertices:h,type:"face",frontColor:c.frontColor,backColor:c.backColor,edges:c.edges,model:c.model},this.space);b[0].removeDoubles();b[0].normal=c.normal;b[1]=new A({vertices:m,type:"face",frontColor:c.frontColor,backColor:c.backColor,
edges:c.edges,model:c.model},this.space);b[1].removeDoubles();b[1].normal=c.normal;if(2<b[0].vertices.length)return 2<b[1].vertices.length?b:[b[0]];if(2<b[1].vertices.length)return[b[1]]}}}}return[c]};A.prototype.intersects=function(a){return this.intersectsPlane(a)&&a.intersectsPlane(this)};A.prototype.intersectsPlane=function(c){var b=this.vertices;var g=c.vertices;if(0<b.length){var d=a.dotProduct3D(g[0],c.normal);var k=a.dotProduct3D(b[0],c.normal);if(1E-8>Math.abs(d-k))return!0;for(var m=1,e=
b.length;m<e;m++)if(g=a.dotProduct3D(b[m],c.normal),1E-8>Math.abs(d-g)||g>d&&k<d||g<d&&k>d)return!0}return!1};A.prototype.intersection=function(c,b){var g=this.vertices;if(0<g.length){b=a.subtract3D(b,c);var d=a.dotProduct3D(b,this.normal);if(0!==d&&(g=a.dotProduct3D(a.subtract3D(g[0],c),this.normal)/d,-1E-8<g&&1.00000001>g))return a.add3D(c,a.scalarProduct3D(b,g))}return null};A.prototype.isInterior=function(c){var b=this.vertices;if(0<b.length)for(var g=0,d=a.subtract3D(b[0],c),k=0,m=b.length;k<
m;k++){var e=a.subtract3D(b[(k+1)%m],c),f=a.dotProduct3D(a.crossProduct3D(d,e),this.normal);if(1E-8>Math.abs(f)){if(0>a.dotProduct3D(d,e))break}else{if(0>g&&0<f||0<g&&0>f)return!1;d=e;g=f}}return!0};A.prototype.inFrontOf=function(a,c,b){if(this.minDistanceToEye>=c.maxDistanceToEye||this.maxx<=c.minx||this.minx>=c.maxx||this.maxy<=c.miny||this.miny>=c.maxy)return!1;for(w=0;3>w;w++)if(q=null,q=0===w?this.intersections(c):1===w?c.verticesContainedIn(this):this.verticesContainedIn(c),null!=q&&0<q.length){for(x=
0;x<q.length;x++)a.push(q[x]);u=0;for(p=q.length;u<p;u++){m=q[u];y=this.space.rayFromEye(m.x,m.y);try{t=this.distanceToEyeAlong(y)-c.distanceToEyeAlong(y);if(t<=-b)return!0;if(t>=b)return!1}catch(F){}}}return!1};A.prototype.intersections=function(c){for(var b=[],g,d,k,m=new a.R2,e=this.newSpaceVert,f=c.newSpaceVert,h=this.newProjVert,l=c.newProjVert,u=0,p=e.length;u<p;u++){c=e[u];g=e[(u+1)%p];for(var n=0,q=f.length;n<q;n++)d=f[n],k=f[(n+1)%q],c!=d&&c!=k&&g!=d&&g!=k&&(d=m.intersection(h[u],h[(u+1)%
p],l[n],l[(n+1)%q]),null!=d&&b.push(d))}return b};A.prototype.distanceToEyeAlong=function(c){c=a.dotProduct3D(this.normal,c);if(1E-6<Math.abs(c))return a.dotProduct3D(a.subtract3D(this.average,this.space.eye),this.normal)/c;throw new Exception("Face is invisible");};A.prototype.verticesContainedIn=function(a){for(var c=[],b=this.newSpaceVert,g=this.newProjVert,d=0,k=b.length;d<k;d++)!a.isVertex(b[d])&&a.appearsToContain(g[d])&&c.push(g[d]);return c};A.prototype.appearsToContain=function(a){for(var c=
0,b,g=this.newProjVert,d=0,k=this.newSpaceVert.length;d<k;d++){b=(g[d].x-a.x)*(g[(d+1)%k].y-a.y)-(g[(d+1)%k].x-a.x)*(g[d].y-a.y);if(0!=c)if(1E-8>Math.abs(b)){if(1E-8<Math.abs(g[d].x-g[(d+1)%k].x))return Math.min(g[d].x,g[(d+1)%k].x)<=a.x+1E-8&&a.x<=Math.max(g[d].x,g[(d+1)%k].x)+1E-8;if(1E-8<Math.abs(g[d].y-g[(d+1)%k].y))return Math.min(g[d].y,g[(d+1)%k].y)<=a.y+1E-8&&a.y<=Math.max(g[d].y,g[(d+1)%k].y)+1E-8}else if(0<c&&0>b||0>c&&0<b)return!1;c=b}return!0};A.prototype.isVertex=function(c){for(var b=
this.newSpaceVert,g=0,d=b.length;g<d;g++)if(a.equals3DEpsilon(c,b[g],1E-8))return!0;return!1};a.Primitive3D=A;return a}(descartesJS||{});
descartesJS=function(a){function f(a){for(var c=[],b=0,g,d=a.length,k=a.length-1;-1<k;k--)g=a.charAt(k),0==b?"="==g&&(b=1):1==b?" "!=g&&(b="<"===g||">"===g?0:2):2==b&&" "==g&&(c.unshift(a.substring(k+1,d)),d=k,b=0);c.unshift(a.substring(0,d));return c}if(a.loadLib)return a;var e={x:0,y:0,z:0},d,r,n,b,h,l=a.degToRad,c,k=function(c,b){this.parent=c;this.evaluator=c.evaluator;var g=c.evaluator.parser;this.spaceID="E0";this.background=!1;this.type="";this.color=new a.Color("eeffaa");this.backcolor=new a.Color("6090a0");
this.Nu=this.evaluator.parser.parse("7");this.Nv=this.evaluator.parser.parse("7");this.drawif=g.parse("1");this.abs_coord=!1;this.family="";this.family_interval=g.parse("[0,1]");this.family_steps=g.parse("8");this.font="SansSerif,PLAIN,18";this.fixed=!0;this.text="";this.decimals=g.parse("2");this.inirot="(0,0,0)";this.inirotEuler=!1;this.inipos=g.parse("(0,0,0)");this.endrot="(0,0,0)";this.endrotEuler=!1;this.endpos=g.parse("(0,0,0)");this.model="color";Object.assign(this,b);void 0==this.expresion&&
"macro"!=this.type&&(this.expresion=g.parse("(0,0)"));this.space=this.getSpace();this.canvas=this.background?this.space.backCanvas:this.space.canvas;this.ctx=this.canvas.getContext("2d");this.font_str=this.font;this.font=a.convertFont(this.font);this.fontSize=(this.fontSize=this.font.match(/([\d\.]+)px/))?parseFloat(this.fontSize[1]):10;this.font_style=a.getFontStyle(this.font_str.split(",")[1]);if("boolean"===typeof this.bold||"boolean"===typeof this.italics)this.bold&&!this.italics?this.font_style=
"Bold ":!this.bold&&this.italics?this.font_style="Italic ":this.bold&&this.italics?this.font_style="Italic Bold ":this.bold||this.italics||(this.font_style=" ");this.font_family||(this.font_family=this.font_str.split(",")[0]);this.font_family=a.getFontName(this.font_family);"undefined"===typeof this.font_size&&(this.font_size=c.evaluator.parser.parse(this.fontSize.toString()));this.inirot.match("Euler")&&(this.inirot=this.inirot.replace("Euler",""),this.inirotEuler=!0);this.endrot.match("Euler")&&
(this.endrot=this.endrot.replace("Euler",""),this.endrotEuler=!0);this.inirot=g.parse(this.inirot);this.endrot=g.parse(this.endrot);this.inirotM=new a.Matrix4x4;this.inirotM_X=new a.Matrix4x4;this.inirotM_Y=new a.Matrix4x4;this.inirotM_Z=new a.Matrix4x4;this.iniposM=new a.Matrix4x4;this.endrotM=new a.Matrix4x4;this.endrotM_X=new a.Matrix4x4;this.endrotM_Y=new a.Matrix4x4;this.endrotM_Z=new a.Matrix4x4;this.endposM=new a.Matrix4x4};k.prototype.getSpace=function(){for(var a=this.parent.spaces,c,b=0,
d=a.length;b<d;b++)if(c=a[b],c.id==this.spaceID)return c;return a[0]};k.prototype.getFamilyValues=function(){d=this.evaluator;r=d.eval(this.family_interval);this.familyInf=r[0][0];this.familySup=r[0][1];this.fSteps=Math.round(d.eval(this.family_steps));this.family_sep=0<this.fSteps?(this.familySup-this.familyInf)/this.fSteps:0};k.prototype.buildFamilyPrimitives=function(){d=this.evaluator;this.getFamilyValues();n=d.getVariable(this.family);if(0<=this.fSteps)for(var a=0,c=this.fSteps;a<=c;a++)d.setVariable(this.family,
this.familyInf+a*this.family_sep),this.familyValue=this.familyInf+a*this.family_sep,d.eval(this.drawif)&&this.buildPrimitives();d.setVariable(this.family,n)};k.prototype.update=function(){this.primitives=[];this.evaluator.eval(this.drawif)&&(this.family||this.buildPrimitives());this.family&&this.buildFamilyPrimitives()};k.prototype.updateMVMatrix=function(){b=this.evaluator.eval(this.inirot);this.inirotEuler?(this.inirotM=this.inirotM.setIdentity(),this.inirotM=this.inirotM.rotateZ(l(b[0][0])),this.inirotM=
this.inirotM.rotateX(l(b[0][1])),this.inirotM=this.inirotM.rotateZ(l(b[0][2]))):(this.inirotM_X=this.inirotM_X.setIdentity().rotateX(l(b[0][0])),this.inirotM_Y=this.inirotM_Y.setIdentity().rotateY(l(b[0][1])),this.inirotM_Z=this.inirotM_Z.setIdentity().rotateZ(l(b[0][2])));b=this.evaluator.eval(this.inipos);e={x:b[0][0],y:b[0][1],z:b[0][2]};this.iniposM=this.iniposM.setIdentity().translate(e);b=this.evaluator.eval(this.endrot);this.endrotEuler?(this.endrotM=this.endrotM.setIdentity(),this.endrotM=
this.endrotM.rotateZ(l(b[0][0])),this.endrotM=this.endrotM.rotateX(l(b[0][1])),this.endrotM=this.endrotM.rotateZ(l(b[0][2]))):(this.endrotM_X=this.endrotM_X.setIdentity().rotateX(l(b[0][0])),this.endrotM_Y=this.endrotM_Y.setIdentity().rotateY(l(b[0][1])),this.endrotM_Z=this.endrotM_Z.setIdentity().rotateZ(l(b[0][2])));b=this.evaluator.eval(this.endpos);e={x:b[0][0],y:b[0][1],z:b[0][2]};this.endposM=this.endposM.setIdentity().translate(e)};k.prototype.transformVertex=function(a){this.inirotEuler?h=
this.inirotM.multiplyVector4(a):(h=this.inirotM_X.multiplyVector4(a),h=this.inirotM_Y.multiplyVector4(h),h=this.inirotM_Z.multiplyVector4(h));h=this.iniposM.multiplyVector4(h);this.endrotEuler?h=this.endrotM.multiplyVector4(h):(h=this.endrotM_X.multiplyVector4(h),h=this.endrotM_Y.multiplyVector4(h),h=this.endrotM_Z.multiplyVector4(h));h=this.endposM.multiplyVector4(h);this.macroChildren&&(h=this.applyMacroTransform(h));h.adjustDec();return h};k.prototype.applyMacroTransform=function(a){this.macro_inirotEuler?
h=this.macro_inirotM.multiplyVector4(a):(h=this.macro_inirotM_X.multiplyVector4(a),h=this.macro_inirotM_Y.multiplyVector4(h),h=this.macro_inirotM_Z.multiplyVector4(h));h=this.macro_iniposM.multiplyVector4(h);this.macro_endrotEuler?h=this.macro_endrotM.multiplyVector4(h):(h=this.macro_endrotM_X.multiplyVector4(h),h=this.macro_endrotM_Y.multiplyVector4(h),h=this.macro_endrotM_Z.multiplyVector4(h));return h=this.macro_endposM.multiplyVector4(h)};k.prototype.parseExpression=function(){for(var a=this.expresion.split(";"),
c=[],b=0,d=a.length;b<d;b++)""!==a[b].trim()&&(c=c.concat(f(a[b])));b=0;for(d=c.length;b<d;b++)c[b]=this.evaluator.parser.parse(c[b],!0);return c};k.prototype.splitFace=function(a){for(var b=0,d=this.primitives.length;b<d;b++)if(c=[],"face"===this.primitives[b].type){for(var g=0,k=a.primitives.length;g<k;g++)"face"===a.primitives[g].type?c=c.concat(this.primitives[b].splitFace(a.primitives[g])):c.push(a.primitives[g]);a.primitives=c}};a.Graphic3D=k;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,e,d,r,n,b=function(b,d){return a.Graphic3D.call(this,b,d)||this};$jscomp.inherits(b,a.Graphic3D);b.prototype.buildPrimitives=function(){f=this.evaluator;this.updateMVMatrix();e=f.eval(this.expresion);d=e[0][0];r=e[0][1];n=e[0][2];this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(d,r,n,1))],type:"vertex",backColor:this.backcolor.getColor(),frontColor:this.color.getColor(),size:f.eval(this.width)}));""!==this.text&&
(this.offset_dist=this.offset_dist||f.parser.parse("10"),this.offset_angle=this.offset_angle||f.parser.parse("270"),this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(d,r,n,1))],type:"text",fromPoint:!0,frontColor:this.color.getColor(),font_size:this.font_size,font_style:this.font_style,font_family:this.font_family,decimals:f.eval(this.decimals),fixed:this.fixed,evaluator:f,text:new a.TextObject(this,this.text),family:this.family,familyValue:this.familyValue,offset_dist:this.offset_dist,
offset_angle:this.offset_angle},this.space)))};a.Point3D=b;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,e,d,r,n,b,h,l,c,k=function(c,b){b=a.Graphic3D.call(this,c,b)||this;b.width=b.width||c.evaluator.parser.parse("1");return b};$jscomp.inherits(k,a.Graphic3D);k.prototype.buildPrimitives=function(){l=this.evaluator;this.updateMVMatrix();h=l.getVariable("u");l.setVariable("u",this.Nu);c=l.eval(this.expresion);f=c[0][0];e=c[0][1];d=c[0][2];r=c[1][0];n=c[1][1];b=c[1][2];this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(f,
e,d,1)),this.transformVertex(new a.Vector4D(r,n,b,1))],type:"edge",lineDash:this.lineDash,frontColor:this.color.getColor(),lineWidth:l.eval(this.width)},this.space));l.setVariable("u",h)};a.Segment3D=k;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,e,d,r,n,b,h,l,c,k,g,v,u,p,z=function(c,b){b=a.Graphic3D.call(this,c,b)||this;b.parameter=b.parameter||"t";b.parameter_interval=b.parameter_interval||c.evaluator.parser.parse("[0,1]");b.parameter_steps=b.parameter_steps||c.evaluator.parser.parse("8");b.expresion=b.parseExpression();return b};$jscomp.inherits(z,a.Graphic3D);z.prototype.buildPrimitives=function(){f=this.evaluator;this.updateMVMatrix();r=f.getVariable("x");n=f.getVariable("y");b=f.getVariable("z");
e=f.getVariable("u");d=f.getVariable("v");f.setVariable("u",0);f.setVariable("v",0);h=parseInt(f.eval(this.Nu));l=parseInt(f.eval(this.Nv));c=[];for(g=0;g<=h;g++)for(f.setVariable("u",g/h),v=0;v<=l;v++){f.setVariable("v",v/l);u=0;for(p=this.expresion.length;u<p;u++)f.eval(this.expresion[u]);c.push(this.transformVertex(new a.Vector4D(f.getVariable("x"),f.getVariable("y"),f.getVariable("z"),1)))}var q=this.color.getColor(),m=this.backcolor.getColor(),y=this.edges?this.edges.getColor():"";for(g=0;g<
h;g++)for(v=0;v<l;v++)k=[],k.push(c[v+g*l+g]),k.push(c[v+1+g*l+g]),k.push(c[v+2+(g+1)*l+g]),k.push(c[v+1+(g+1)*l+g]),this.primitives.push(new a.Primitive3D({vertices:k,type:"face",frontColor:q,backColor:m,edges:y,model:this.model},this.space));f.setVariable("x",r);f.setVariable("y",n);f.setVariable("z",b);f.setVariable("u",e);f.setVariable("v",d)};a.Surface3D=z;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,e,d,r,n,b,h,l,c=function(c,b){b=a.Graphic3D.call(this,c,b)||this;b.width=b.width||c.evaluator.parser.parse("1");return b};$jscomp.inherits(c,a.Graphic3D);c.prototype.buildPrimitives=function(){h=this.evaluator;this.updateMVMatrix();l=h.eval(this.expresion);for(var c=this.color.getColor(),g=0,v=l.length-1;g<v;g++)f=l[g][0],e=l[g][1],d=l[g][2],r=l[g+1][0],n=l[g+1][1],b=l[g+1][2],this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(f,
e,d,1)),this.transformVertex(new a.Vector4D(r,n,b,1))],type:"edge",frontColor:c,lineWidth:h.eval(this.width)},this.space))};a.Polygon3D=c;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,e,d,r,n,b,h,l=function(c,b){b=a.Graphic3D.call(this,c,b)||this;b.width=b.width||c.evaluator.parser.parse("1");b.expresion=b.parseExpression();return b};$jscomp.inherits(l,a.Graphic3D);l.prototype.buildPrimitives=function(){h=this.evaluator;this.updateMVMatrix();r=h.getVariable("x");n=h.getVariable("y");b=h.getVariable("z");d=h.getVariable("u");h.setVariable("u",0);e=h.eval(this.Nu);f=[];for(var c=0;c<=e;c++){h.setVariable("u",c/e);for(var k=0,g=
this.expresion.length;k<g;k++)h.eval(this.expresion[k]);f.push(this.transformVertex(new a.Vector4D(h.getVariable("x"),h.getVariable("y"),h.getVariable("z"),1)))}c=0;for(k=f.length-1;c<k;c++)this.primitives.push(new a.Primitive3D({vertices:[f[c],f[c+1]],type:"edge",frontColor:this.color.getColor(),lineWidth:h.eval(this.width)},this.space));this.fill&&2<f.length&&this.primitives.push(new a.Primitive3D({vertices:f,type:"face",frontColor:this.fill.getColor(),backColor:this.fill.getColor(),edges:"",model:this.model},
this.space));h.setVariable("x",r);h.setVariable("y",b);h.setVariable("z",n);h.setVariable("u",d)};a.Curve3D=l;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,e,d,r,n,b,h,l,c,k,g,v=function(c,b){return a.Graphic3D.call(this,c,b)||this};$jscomp.inherits(v,a.Graphic3D);v.prototype.buildPrimitives=function(){k=this.evaluator;this.updateMVMatrix();g=k.eval(this.expresion);f=g[0][0];e=g[0][1];d=g[0][2];r=g[1][0];n=g[1][1];b=g[1][2];h=g[2][0];l=g[2][1];c=g[2][2];var u=this.edges?this.edges.getColor():"";this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(f,e,d,1)),this.transformVertex(new a.Vector4D(h,
l,c,1)),this.transformVertex(new a.Vector4D(r,n,b,1))],type:"face",frontColor:this.color.getColor(),backColor:this.backcolor.getColor(),edges:u,model:this.model},this.space))};a.Triangle3D=v;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,e,d,r=function(d,b){return a.Graphic3D.call(this,d,b)||this};$jscomp.inherits(r,a.Graphic3D);r.prototype.buildPrimitives=function(){e=this.evaluator;this.updateMVMatrix();d=e.eval(this.expresion);f=[];for(var n=d.length-1;0<=n;n--)f.push(this.transformVertex(new a.Vector4D(d[n][0],d[n][1],d[n][2],1)));n=this.edges?this.edges.getColor():"";this.primitives.push(new a.Primitive3D({vertices:f,type:"face",frontColor:this.color.getColor(),backColor:this.backcolor.getColor(),
edges:n,model:this.model},this.space))};a.Face3D=r;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,e,d,r,n,b,h=function(b,c){c=a.Graphic3D.call(this,b,c)||this;c.width=c.width||b.evaluator.parser.parse("2");c.length=c.length||b.evaluator.parser.parse("2");return c};$jscomp.inherits(h,a.Graphic3D);h.prototype.buildPrimitives=function(){b=this.evaluator;this.updateMVMatrix();f=b.eval(this.Nu);e=[this.transformVertex(new a.Vector4D(0,0,0,1))];d=b.eval(this.width)/2;r=b.eval(this.length)/2;n=2*Math.PI/f;for(var h=0;h<f;h++)e.push(this.transformVertex(new a.Vector4D(d*
Math.cos(n*h),r*Math.sin(n*h),0,1)));var c=this.color.getColor(),k=this.backcolor.getColor(),g=this.edges?this.edges.getColor():"";for(h=0;h<f;h++)this.primitives.push(new a.Primitive3D({vertices:[e[0],h+2<=f?e[h+2]:e[1],e[h+1]],type:"face",frontColor:c,backColor:k,edges:g,model:this.model},this.space))};a.Polireg3D=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,e,d,r,n=function(b,d){b=a.Graphic3D.call(this,b,d)||this;b.shadowColor=b.shadowColor?b.shadowColor.getColor():"transparent";return b};$jscomp.inherits(n,a.Graphic3D);n.prototype.buildPrimitives=function(){f=this.evaluator;e=f.eval(this.expresion);d=e[0][0];r=e[0][1];this.primitives.push(new a.Primitive3D({vertices:[new a.Vector4D(d,r,0,1)],type:"text",frontColor:this.color.getColor(),font_size:this.font_size,font_style:this.font_style,font_family:this.font_family,
decimals:f.eval(this.decimals),fixed:this.fixed,displace:0,isText:!0,evaluator:f,text:new a.TextObject(this,this.text),family:this.family,familyValue:this.familyValue},this.space))};a.Text3D=n;return a}(descartesJS||{});
descartesJS=function(a,f){if(a.loadLib)return a;var e=new String("-point-segment-polygon-curve-triangle-face-polireg-surface-text-cube-box-tetrahedron-octahedron-sphere-dodecahedron-icosahedron-ellipsoid-cone-cylinder-torus-mesh-macro-"),d=/[\w\.\-//]*(\.png|\.jpg|\.gif|\.svg|\.webp)/gi,r,n,b=0,h=function(h,c){var k=a.Graphic.call(this,h,c)||this;k.expresion=k.expresion||void 0;k.inirot=k.inirot||"(0,0,0)";k.inirotEuler=k.inirotEuler||!1;k.inipos=k.inipos||h.evaluator.parser.parse("(0,0,0)");k.endrot=
k.endrot||"(0,0,0)";k.endrotEuler=k.endrotEuler||!1;k.endpos=k.endpos||h.evaluator.parser.parse("(0,0,0)");k.name=k.name||"_descartes_empty_name_"+b++;Object.assign(k,c);k.inirot.match("Euler")&&(k.inirot=k.inirot.replace("Euler",""),k.inirotEuler=!0);k.endrot.match("Euler")&&(k.endrot=k.endrot.replace("Euler",""),k.endrotEuler=!0);k.inirot=k.evaluator.parser.parse(k.inirot);k.endrot=k.evaluator.parser.parse(k.endrot);k.inirotM=new a.Matrix4x4;k.inirotM_X=new a.Matrix4x4;k.inirotM_Y=new a.Matrix4x4;
k.inirotM_Z=new a.Matrix4x4;k.iniposM=new a.Matrix4x4;k.endrotM=new a.Matrix4x4;k.endrotM_X=new a.Matrix4x4;k.endrotM_Y=new a.Matrix4x4;k.endrotM_Z=new a.Matrix4x4;k.endposM=new a.Matrix4x4;k.graphics=[];h=h.lessonParser;var g=new a.Tokenizer;if(void 0==k.expresion)return k;"'"!==k.expresion.charAt(0)&&(k.expresion="'"+k.expresion+"'");k.expresion=k.evaluator.parser.parse(k.expresion);c=k.evaluator.eval(k.expresion);if(c)var l=(l=document.getElementById(c))&&"descartes/macro"==l.type?l.text:a.openFile(c);
if(l){var u=a.convertHTMLEntities(l).replace(/\r/g,"").split("\n");l=[];c=0;for(var n=u.length;c<n;c++){var r=u[c].indexOf("=");if(-1!==r){r=h.split(u[c]);for(var q=0,m=r.length;q<m;q++)if(r[q]&&1<r.length&&("id"===f[r[q][0]]||"type"===f[r[q][0]])){l.push(r);break}}}c=0;for(n=l.length;c<n;c++){m=(q=l[c]||[],q[0])&&"id"===q[0][0];var y=!1;u=0;for(r=q.length;u<r;u++){var w=q[u][0].indexOf(".");-1===w||m?w=f[q[u][0]]:(w=f[q[u][0].substring(w+1)],q[u][0]=k.name+"."+q[u][0]);"type"===w&&"surface"===f[q[u][1]]&&
(y=!0);if(!("font"===w||"font_family"===w||("fill"===w||"color"===w||"backcolor"===w||"arrow"===w)&&"("!==q[u][1].charAt(0)||"file"===w&&q[u][1].match(d)||"id"!==w&&void 0!==f[q[u][1]])||"width"===w||"height"===w||"length"===w)if(y&&"expresion"===w){var x=q[u][1].split(" ");for(var A="",H=0,E=x.length;H<E;H++){for(var G=x[H].replace(/&squot;/g,"'").split(";"),F=0,D=G.length;F<D;F++){w=g.tokenize(G[F].replace(/\\n/g,";"));for(var B=0,K=w.length;B<K;B++)if("identifier"===w[B].type&&!(a.reservedIds+
"-x-y-z-u-v-").match("-"+w[B].value+"-")||"R"===w[B].value||"G"===w[B].value||"B"===w[B].value)w[B].value=k.name+"."+w[B].value;G[F]=g.flatTokens(w)}A+=G.join(";")+" "}q[u][1]=A}else if("text"==w)if(q[u][1].match(/\{\\rtf1/)){w=q[u][1];var L=k;x=function(c,b){b=g.tokenize(b.replace(/&squot;/g,"'"));for(var d=0,k=b.length;d<k;d++)if("identifier"==b[d].type&&!a.reservedIds.match("-"+b[d].value+"-")||"R"===b[d].value||"G"===b[d].value||"B"===b[d].value)b[d].value=L.name+"."+b[d].value;return(c.match(/^\\expr/)?
"\\expr ":"\\decimals ")+g.flatTokens(b)};w=w.replace(/\\expr ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,x);w=w.replace(/\\decimals ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,x);q[u][1]=w}else{x=h.parseText(q[u][1]).textElementsMacros;A=0;for(H=x.length;A<H;A++){w=g.tokenize(x[A].replace(/&squot;/g,"'"));E=0;for(G=w.length;E<G;E++)if("identifier"===w[E].type&&!a.reservedIds.match("-"+w[E].value+"-")||"R"===w[E].value||"G"===w[E].value||"B"===w[E].value)w[E].value=k.name+"."+w[E].value;
w=g.flatTokens(w).replace(/&squot;/g,"'").replace(/'\+\(/g,"[").replace(/\)\+'/g,"]");x[A]=w.substring(1,w.length-1)}q[u][1]=x.join("")}else{G=q[u][1].replace(/&squot;/g,"'").split(";");F=0;for(D=G.length;F<D;F++){w=g.tokenize(G[F].replace(/\\n/g,";"));B=0;for(K=w.length;B<K;B++)if("identifier"===w[B].type&&!(a.reservedIds+"-Euler-").match("-"+w[B].value+"-")||"R"===w[B].value||"G"===w[B].value||"B"===w[B].value)w[B].value=k.name+"."+w[B].value;G[F]=g.flatTokens(w)}q[u][1]=G.join(";")}}}c=0;for(n=
l.length;c<n;c++)if(l[c][0]){q="";m=!1;u=0;for(r=l[c].length;u<r;u++)"type"===f[l[c][u][0]]&&e.match("-"+f[l[c][u][1]]+"-")&&(m=!0),q=q+l[c][u][0]+"='"+l[c][u][1]+"' ";l[c]=q+(m?" space='"+k.spaceID+"'":"");m?k.graphics.push(h.parse3DGraphic(l[c],k.abs_coord,k.background,k.inirot)):h.parseAuxiliar(l[c])}}c=0;for(n=k.graphics.length;c<n;c++)k.graphics[c].macroChildren=!0;return k};$jscomp.inherits(h,a.Graphic);h.prototype.buildFamilyPrimitives=function(){evaluator=this.evaluator;this.getFamilyValues();
var a=evaluator.getVariable(this.family);if(0<=this.fSteps)for(var c=0,b=this.fSteps;c<=b;c++)evaluator.setVariable(this.family,this.familyInf+c*this.family_sep),this.familyValue=this.familyInf+c*this.family_sep,evaluator.eval(this.drawif)&&this.updateMacro();evaluator.setVariable(this.family,a)};h.prototype.update=function(){this.primitives=[];this.evaluator.eval(this.drawif)&&(this.family||this.updateMacro());this.family&&this.buildFamilyPrimitives()};h.prototype.updateMacro=function(){this.updateTransformation();
if(this.inipos){var a=this.evaluator.eval(this.inipos);this.iniPosX=a[0][0];this.iniPosY=a[0][1]}a=0;for(var c=this.graphics.length;a<c;a++)r=this.graphics[a],r.macro_inirotEuler=this.inirotEuler,r.macro_inirotM=this.inirotM,r.macro_inirotM_X=this.inirotM_X,r.macro_inirotM_Y=this.inirotM_Y,r.macro_inirotM_Z=this.inirotM_Z,r.macro_iniposM=this.iniposM,r.macro_endrotEuler=this.endrotEuler,r.macro_endrotM=this.endrotM,r.macro_endrotM_X=this.endrotM_X,r.macro_endrotM_Y=this.endrotM_Y,r.macro_endrotM_Z=
this.endrotM_Z,r.macro_endposM=this.endposM,r.update();a=0;for(c=this.graphics.length;a<c;a++){r=this.graphics[a];if(r.split||this.split)for(var b=a+1;b<c;b++)n=this.graphics[b],(n.split||this.split)&&r.splitFace(n);this.primitives=this.primitives.concat(r.primitives||[])}};h.prototype.updateTransformation=function(){tmpExpr=this.evaluator.eval(this.inirot);this.inirotEuler?(this.inirotM=this.inirotM.setIdentity(),this.inirotM=this.inirotM.rotateZ(a.degToRad(tmpExpr[0][0])),this.inirotM=this.inirotM.rotateX(a.degToRad(tmpExpr[0][1])),
this.inirotM=this.inirotM.rotateZ(a.degToRad(tmpExpr[0][2]))):(this.inirotM_X=this.inirotM_X.setIdentity().rotateX(a.degToRad(tmpExpr[0][0])),this.inirotM_Y=this.inirotM_Y.setIdentity().rotateY(a.degToRad(tmpExpr[0][1])),this.inirotM_Z=this.inirotM_Z.setIdentity().rotateZ(a.degToRad(tmpExpr[0][2])));tmpExpr=this.evaluator.eval(this.inipos);translate={x:tmpExpr[0][0],y:tmpExpr[0][1],z:tmpExpr[0][2]};this.iniposM=this.iniposM.setIdentity().translate(translate);tmpExpr=this.evaluator.eval(this.endrot);
this.endrotEuler?(this.endrotM=this.endrotM.setIdentity(),this.endrotM=this.endrotM.rotateZ(a.degToRad(tmpExpr[0][0])),this.endrotM=this.endrotM.rotateX(a.degToRad(tmpExpr[0][1])),this.endrotM=this.endrotM.rotateZ(a.degToRad(tmpExpr[0][2]))):(this.endrotM_X=this.endrotM_X.setIdentity().rotateX(a.degToRad(tmpExpr[0][0])),this.endrotM_Y=this.endrotM_Y.setIdentity().rotateY(a.degToRad(tmpExpr[0][1])),this.endrotM_Z=this.endrotM_Z.setIdentity().rotateZ(a.degToRad(tmpExpr[0][2])));tmpExpr=this.evaluator.eval(this.endpos);
translate={x:tmpExpr[0][0],y:tmpExpr[0][1],z:tmpExpr[0][2]};this.endposM=this.endposM.setIdentity().translate(translate)};h.prototype.drawAux=function(a){};a.Macro3D=h;return a}(descartesJS||{},babel);
descartesJS=function(a){function f(a,c,b,d,g){e.call(this,a/q,a/q,a/q,d,g)}function e(a,c,b,d,g){a/=2;c/=2;b/=2;this.changeGeometry(a,c,b,d,g)||(this.vertices=[new m(a,b,c,1),new m(a,-b,c,1),new m(a,b,-c,1),new m(a,-b,-c,1),new m(-a,b,c,1),new m(-a,-b,c,1),new m(-a,b,-c,1),new m(-a,-b,-c,1)],this.faces=[[2,3,1,0],[1,5,4,0],[5,7,6,4],[6,7,3,2],[4,6,2,0],[3,7,5,1]],this.updateValues(a,c,b,d,g))}function d(a,c,b,d,g){a/=2;if(!this.changeGeometry(a,c,b,d,g)){var k=2*Math.PI/3,e=2*a*Math.sqrt(2)/3,f=-a/
3,h=e*Math.cos(k)+0*Math.sin(k);k=-e*Math.sin(k)+0*Math.cos(k);this.vertices=[new m(0,0,a,1),new m(h,k,f,1),new m(h,-k,f,1),new m(e,0,f,1)];this.faces=[[1,3,2],[0,1,2],[0,2,3],[0,3,1]];this.updateValues(a,c,b,d,g)}}function r(a,c,b,d,g){a/=2;this.changeGeometry(a,c,b,d,g)||(this.vertices=[new m(0,0,a,1),new m(a,0,0,1),new m(-a,0,0,1),new m(0,a,0,1),new m(0,-a,0,1),new m(0,0,-a,1)],this.faces=[[3,1,0],[2,3,0],[1,4,0],[4,2,0],[1,3,5],[3,2,5],[4,1,5],[2,4,5]],this.updateValues(a,c,b,d,g))}function n(c,
b,d,g,k){c/=Math.PI;if(!this.changeGeometry(c,b,d,g,k)){B=c/1.6180339887;K=1.6180339887*c;this.vertices=[new m(c,c,c,1),new m(c,c,-c,1),new m(c,-c,c,1),new m(c,-c,-c,1),new m(-c,c,c,1),new m(-c,c,-c,1),new m(-c,-c,c,1),new m(-c,-c,-c,1),new m(0,B,K,1),new m(0,B,-K,1),new m(0,-B,K,1),new m(0,-B,-K,1),new m(B,K,0,1),new m(B,-K,0,1),new m(-B,K,0,1),new m(-B,-K,0,1),new m(K,0,B,1),new m(K,0,-B,1),new m(-K,0,B,1),new m(-K,0,-B,1)];L=(new a.Matrix4x4).setIdentity().rotateY(-p/6);I=0;for(N=this.vertices.length;I<
N;I++)this.vertices[I]=L.multiplyVector4(this.vertices[I]);this.faces=[[0,16,2,10,8],[12,1,17,16,0],[8,4,14,12,0],[2,16,17,3,13],[13,15,6,10,2],[6,18,4,8,10],[3,17,1,9,11],[13,3,11,7,15],[1,12,14,5,9],[11,9,5,19,7],[5,14,4,18,19],[6,15,7,19,18]];this.updateValues(c,b,d,g,k)}}function b(c,b,d,g,k){c/=3.8;if(!this.changeGeometry(c,b,d,g,k)){K=1.6180339887*c;this.vertices=[new m(0,c,K,1),new m(0,c,-K,1),new m(0,-c,K,1),new m(0,-c,-K,1),new m(c,K,0,1),new m(c,-K,0,1),new m(-c,K,0,1),new m(-c,-K,0,1),
new m(K,0,c,1),new m(K,0,-c,1),new m(-K,0,c,1),new m(-K,0,-c,1)];this.faces=[[10,0,2],[0,8,2],[8,5,2],[5,7,2],[7,10,2],[6,0,10],[11,6,10],[7,11,10],[7,3,11],[5,3,7],[9,3,5],[8,9,5],[4,9,8],[0,4,8],[6,4,0],[11,3,1],[6,11,1],[4,6,1],[9,4,1],[3,9,1]];L=(new a.Matrix4x4).setIdentity().rotateY(-1.0285);I=0;for(N=this.vertices.length;I<N;I++)this.vertices[I]=L.multiplyVector4(this.vertices[I]);this.updateValues(c,b,d,g,k)}}function h(a,c,b,d,g){a/=2;this.isSphere?b=c=a:(c/=2,b/=2);if(!this.changeGeometry(a,
c,b,d,g)){this.vertices=[new m(0,0,c,1)];for(I=1;I<d;I++)for(G=I*p/d,C=0;C<g;C++)E=C*z/g,x=a*v(G)*u(E),A=b*v(G)*v(E),H=c*u(G),this.vertices.push(new m(x,A,H,1));this.vertices.push(new m(0,0,-c,1));this.faces=[];for(I=0;I<g;I++)this.faces.push([0,(I+1)%g+1,I%g+1]);for(I=1;I<d-1;I++)for(C=0;C<g;C++)this.faces.push([C+1+(I-1)*g,(C+1)%g+1+(I-1)*g,(C+1)%g+1+I*g,C+1+I*g]);for(I=0;I<g;I++)this.faces.push([this.vertices.length-1,this.vertices.length-1-g+I,this.vertices.length-1-g+(I+1)%g]);this.updateValues(a,
c,b,d,g)}}function l(a,c,b,d,g){a/=2;c/=2;b/=2;if(!this.changeGeometry(a,c,b,d,g)){this.vertices=[];for(I=0;I<g;I++)for(C=0;C<d;C++)x=a*(g-I)/g*u(C*z/d),A=b*(g-I)/g*v(C*z/d),H=c-2*I*c/g,this.vertices.push(new m(x,A,H,1));this.vertices.push(new m(0,0,-c,1));this.faces=[];for(I=0;I<g-1;I++)for(C=0;C<d;C++)this.faces.push([C+I*d,(C+1)%d+I*d,(C+1)%d+(I+1)*d,C+(I+1)*d]);for(I=0;I<d;I++)this.faces.push([this.vertices.length-1,this.vertices.length-1-d+I,this.vertices.length-1-d+(I+1)%d]);this.updateValues(a,
c,b,d,g)}}function c(a,c,b,d,g){a/=2;c/=2;b/=2;if(!this.changeGeometry(a,c,b,d,g)){this.vertices=[];for(I=0;I<g+1;I++)for(C=0;C<d;C++)x=a*u(C*z/d),A=b*v(C*z/d),H=c-2*I*c/g,this.vertices.push(new m(x,A,H,1));this.faces=[];for(I=0;I<g;I++)for(C=0;C<d;C++)this.faces.push([C+I*d,(C+1)%d+I*d,(C+1)%d+(I+1)*d,C+(I+1)*d]);this.updateValues(a,c,b,d,g)}}function k(a,c,b,d,g){a/=2;c/=2;b/=2;F=y.eval(this.R);D=y.eval(this.r);if(!this.changeGeometry(a,c,b,d,g)){this.vertices=[];for(I=0;I<g+1;I++)for(C=0;C<d;C++)x=
-(F+D*v(z*C/d))*v(z*I/g),A=(F+D*v(z*C/d))*u(z*I/g),H=D*u(z*C/d),this.vertices.push(new m(x,A,H,1));this.faces=[];for(I=0;I<g;I++)for(C=0;C<d;C++)this.faces.push([C+I*d,C+(I+1)*d,(C+1)%d+(I+1)*d,(C+1)%d+I*d]);this.updateValues(a,c,b,d,g)}}function g(){this.vertices=[];this.faces=[];I=0;for(N=this.fileData.length;I<N;I++)M=this.fileData[I],M.match(/^V\(/)?(O=M.substring(2,M.length-1).split(",").map(parseFloats),this.vertices.push(new m(O[0]||0,O[1]||0,O[2]||0,1))):M.match(/^F\(/)&&(O=M.substring(2,
M.length-1).split(",").map(parseInt),this.faces.push(O.reverse()))}if(a.loadLib)return a;var v=Math.sin,u=Math.cos,p=Math.PI,z=2*p,q=Math.sqrt(3),m,y,w,x,A,H,E,G,F,D,B,K,L,M,O,I,N,C,Q,J=function(u,p){p=a.Graphic3D.call(this,u,p)||this;p.width=p.width||u.evaluator.parser.parse("2");p.height=p.height||u.evaluator.parser.parse("2");p.length=p.length||u.evaluator.parser.parse("2");p.R=p.R||u.evaluator.parser.parse("2");p.r=p.r||u.evaluator.parser.parse("1");m=a.Vector4D;switch(p.subType){case "cube":p.buildGeometry=
f;break;case "box":p.buildGeometry=e;break;case "tetrahedron":p.buildGeometry=d;break;case "octahedron":p.buildGeometry=r;break;case "sphere":p.isSphere=!0;case "ellipsoid":p.buildGeometry=h;break;case "dodecahedron":p.buildGeometry=n;break;case "icosahedron":p.buildGeometry=b;break;case "cone":p.buildGeometry=l;break;case "cylinder":p.buildGeometry=c;break;case "torus":p.buildGeometry=k;break;case "mesh":p.fileData=a.openFile(p.evaluator.eval(p.file)).split(/\r/),p.buildGeometry=g}return p};$jscomp.inherits(J,
a.Graphic3D);J.prototype.buildPrimitives=function(){y=this.evaluator;this.updateMVMatrix();this.buildGeometry(y.eval(this.width),y.eval(this.height),y.eval(this.length),y.eval(this.Nu),y.eval(this.Nv));var c=this.color.getColor(),b=this.backcolor.getColor(),d=this.edges?this.edges.getColor():"";I=0;for(N=this.faces.length;I<N;I++){w=[];C=0;for(Q=this.faces[I].length;C<Q;C++)w.push(this.transformVertex(this.vertices[this.faces[I][C]]));this.primitives.push(new a.Primitive3D({vertices:w,type:"face",
frontColor:c,backColor:b,edges:d,model:this.model},this.space))}};J.prototype.changeGeometry=function(a,c,b,d,g){return this.oldWidth===a&&this.oldHeight===c&&this.oldLength===b&&this.oldNu===d&&this.oldNv===g};J.prototype.updateValues=function(a,c,b,d,g){this.oldWidth=a;this.oldHeight=c;this.oldLength=b;this.oldNv=g;this.oldNu=d};a.OtherGeometry3D=J;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=Math.max,e=Math.min,d=Math.PI,r=Math.cos,n=Math.sin,b=Math.abs,h=Math.round,l,c,k,g,v,u,p,z,q,m,y,w,x,A,H,E,G,F,D=function(a,c){this.x=void 0===a?0:a;this.y=void 0===c?0:c};D.prototype.set=function(a,c){this.x=void 0===a?0:a;this.y=void 0===c?0:c;return this};D.prototype.copy=function(){return new D(this.x,this.y)};D.prototype.ix=function(){return h(f(e(this.x,32E3),-32E3))};D.prototype.iy=function(){return h(f(e(this.y,32E3),-32E3))};D.prototype.equals=
function(a){return this.x===a.x&&this.y===a.y};D.prototype.norm2=function(){return this.x*this.x+this.y*this.y};D.prototype.norm=function(){return Math.sqrt(this.norm2())};D.prototype.distance=function(a){c=this.copy();c.sub(a);return c.norm()};D.prototype.dot=function(a){return this.x*a.x+this.y*a.y};D.prototype.det=function(a){return this.x*a.y-this.y*a.x};D.prototype.mul=function(a){this.x*=a;this.y*=a};D.prototype.div=function(a){this.x/=a;this.y/=a};D.prototype.add=function(a){this.x+=a.x;this.y+=
a.y};D.prototype.sub=function(a){this.x-=a.x;this.y-=a.y};D.prototype.normalize=function(){l=this.norm();0!=l&&this.div(l)};D.prototype.rotR90=function(){l=this.x;this.x=this.y;this.y=-l};D.prototype.rotL90=function(){l=this.x;this.x=-this.y;this.y=l};D.prototype.rot=function(a){k=this.copy();u=r(a);p=n(a);this.x=k.x*u-k.y*p;this.y=k.x*p+k.y*u};D.prototype.rot2=function(a){this.rot(a*d/180)};D.prototype.intersection=function(a,c,d,k){z=c.x-a.x;q=d.x-k.x;m=d.x-a.x;y=c.y-a.y;w=d.y-k.y;x=d.y-a.y;F=z*
w-q*y;return 1E-6<b(F)?(g=(m*w-x*q)/F,v=(-m*y+x*z)/F,0<=g&&1>=g&&0<=v&&1>=v?new D(a.x+z*g,a.y+y*g):null):(c.x-d.x)*x!=(c.y-d.y)*m?null:a.x!=c.x?(A=e(a.x,c.x),H=f(a.x,c.x),A<=d.x&&d.x<=H?d:A<=k.x&&k.x<=H?k:null):d.x!=k.x?(E=e(d.x,k.x),G=f(d.x,k.x),E<=a.x&&a.x<=G?a:E<=c.x&&c.x<=G?c:null):a.y!=c.y?(A=e(a.y,c.y),H=f(a.y,c.y),A<=d.y&&d.y<=H?d:A<=k.y&&k.y<=H?k:null):d.y!=k.y?(E=e(d.y,k.y),G=f(d.y,k.y),E<=a.y&&a.y<=G?a:E<=c.y&&c.y<=G?c:null):a.x==d.x&&a.y==d.y?a:null};a.R2=D;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,e,d,r,n,b,h,l,c,k=function(d,k){this.evaluator=d;this.constraint=k;if("=="==this.constraint.value||"<"==this.constraint.value||"<="==this.constraint.value||">"==this.constraint.value||">="==this.constraint.value)this.sign="<"==this.constraint.value||"<="==this.constraint.value?"menor":">"==this.constraint.value||">="==this.constraint.value?"mayor":"igual",this.constraint=this.constraint.equalToMinus(),this.constraint=this.constraint.childs[0];b=
new a.R2(0,0);n=new a.R2(0,0);c=new a.R2(0,0)};k.prototype.getUnitNormal=function(){this.normal.normalize();return c.set(this.normal.x,this.normal.y)};k.prototype.gradient=function(a){f=this.evaluator;b.x=0;b.y=0;h=f.getVariable("x");l=f.getVariable("y");f.setVariable("x",a.x);f.setVariable("y",a.y);this.f0=f.eval(this.constraint);f.setVariable("x",f.getVariable("x")+1E-6);e=f.eval(this.constraint);b.x=(e-this.f0)/1E-6;b.x=isNaN(b.x)?Infinity:b.x;f.setVariable("x",f.getVariable("x")-1E-6);f.setVariable("y",
f.getVariable("y")+1E-6);e=f.eval(this.constraint);b.y=(e-this.f0)/1E-6;b.y=isNaN(b.y)?Infinity:b.y;f.setVariable("x",h);f.setVariable("y",l);return b};k.prototype.findZero=function(a,c,b){f=this.evaluator;n.x=a.x;n.y=a.y;h=f.getVariable("x");l=f.getVariable("y");f.setVariable("x",a.x);f.setVariable("y",a.y);this.f0=f.eval(this.constraint);if("menor"===this.sign&&0>=this.f0||"mayor"===this.sign&&0<=this.f0)return n;f.setVariable("x",h);f.setVariable("y",l);for(var g=0;16>g;g++)if(d=n.x,r=n.y,this.normal=
this.gradient(n),0!=this.normal.norm2()&&this.normal.mul(-this.f0/this.normal.norm2()),n.x=d+this.normal.x,n.y=r+this.normal.y,this.normal.norm()<c)return 0===this.normal.x&&0===this.normal.y&&(this.normal.x=n.x-a.x,this.normal.y=n.y-a.y),n;return b?n:null};a.R2Newton=k;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=function(a,d){this.x=a;this.y=d};f.prototype.vectorLength=function(){return Math.sqrt(this.x*this.x+this.y*this.y)};f.prototype.dotProduct=function(a){return this.x*a.x+this.y*a.y};f.prototype.angleBetweenVectors=function(a){return Math.acos(this.dotProduct(a)/(this.vectorLength()*a.vectorLength()))};f.AXIS_X=new f(1,0);f.AXIS_Y=new f(0,1);a.Vector2D=f;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=Math.floor,e=Math.round,d,r,n,b,h,l,c,k,g,v,u,p,z,q=function(c,b){this.parent=c;this.evaluator=c.evaluator;var d=this.parser=c.evaluator.parser;this.id="GraphicControl"!==b.type?"C":"G";this.gui=this.type="";this.region="south";this.y=this.x=0;this.w="Video"!==b.type?100:350;this.h="Video"!==b.type?23:120;this.keyboard=!1;this.kblayout="1x16";"GraphicControl"!==b.type&&"Audio"!==b.type&&"Video"!==b.type?"TextArea"!==b.type?this.expresion=d.parse("(0,0,100,23)"):
(this.expresion=d.parse("(0,0,300,200)"),this.w=300,this.h=200):this.expresion=d.parse("(0,0)");this.visible=this.fixed=!0;this.color=new a.Color("Scrollbar"==b.gui?"e0e4e8":"222222");this.colorInt="cc0022";"Scrollbar"==b.gui?this.colorInt="182C61":"GraphicControl"!==b.type&&(this.colorInt="f0f8ff");this.colorInt=new a.Color(this.colorInt);this.font_size=d.parse("0");this.cID=this.msg_pos=this.Explanation=this.tooltip=this.parameter=this.action=this.underlined=this.italics=this.bold="";this.parameterFont=
this.tooltipFont=this.ExplanationFont="Monospace 12px";this.drawif=d.parse("1");this.activeif=d.parse("1");this.valueExpr=d.parse("0");this.decimals=d.parse("2");this.min=d.parse("-Infinity");this.max=d.parse("Infinity");this.incr=d.parse("0.1");this.exponentialif=this.discrete=!1;this.zIndex=-1;Object.assign(this,b);"Video"!==this.type&&"Audio"!==this.type||"interior"===this.region||(this.region="interior");void 0==this.name&&(this.name=2==this.parent.version?this.id:"_nada_");this.name="_._"==this.name||
"_nada_"==this.name||"_void_"==this.name?"":this.name;b=this.evaluator.eval(this.expresion);this.x=e(b[0][0]);this.y=e(b[0][1]);4==b[0].length&&(this.w=e(b[0][2]),this.h=e(b[0][3]));this.actionExec=c.lessonParser.parseAction(this)};q.prototype.init=function(){};q.prototype.update=function(){};q.prototype.draw=function(){};q.prototype.getContainer=function(){var a=this.parent.spaces;if("interior"===this.region)for(var c=0,b=a.length;c<b;c++){var d=a[c];if(d.id===this.spaceID)return d.addCtr(this),
this.zIndex=d.zIndex,this.space=d,d.numCtrContainer}else{if("external"===this.region)return this.parent.externalSpace.addCtr(this),this.parent.externalSpace.container;if("scenario"===this.region)return this.cID?(this.expresion=this.evaluator.parser.parse("(0,-1000,"+this.w+","+this.h+")"),this.parent.stage.stageSpace.addCtr(this),this.zIndex=this.parent.stage.stageSpace.zIndex,this.parent.stage.stageSpace.numCtrContainer):this.parent.externalSpace.container;if(/north|south|east|west/.test(this.region))return this.parent[this.region+
"Space"].controls.push(this),this.parent[this.region+"Space"].container}a[0].addCtr(this);this.zIndex=a[0].zIndex;return a[0].numCtrContainer};q.prototype.addControlContainer=function(a){var c=this.getContainer();c.childNodes[0]?c.insertBefore(a,c.childNodes[0]):c.appendChild(a)};q.prototype.updatePositionAndSize=function(){n=b=h=l=!1;c=this.evaluator.eval(this.expresion);k=e(c[0][0]);n=e(this.x)!==k;this.x=k;k=e(c[0][1]);b=e(this.y)!==k;this.y=k;4===c[0].length&&(k=e(c[0][2]),h=e(this.w)!==k,this.w=
k,k=e(c[0][3]),l=e(this.h)!==k,this.h=k);if(h||l||n||b)this.init(!0,!0),this.draw()};q.prototype.formatOutputValue=function(a){z=this.parent;g=a+"";v=this.evaluator.eval(this.decimals);u=g.indexOf(".");-1!=u&&(p=g.substring(u+1),p.length>v&&(g=parseFloat(g).toFixed(v)));this.fixed&&(2!==z.version||2===z.version&&!this.exponentialif)&&(g=parseFloat(a).toFixed(v));this.exponentialif&&0!=parseFloat(g)&&(g=this.fixed&&2!==z.version?parseFloat(g).toExponential(v):parseFloat(g).toExponential(),g=g.toUpperCase().replace("+",
""));return g.replace(".",z.decimal_symbol)};q.prototype.updateAndExecAction=function(){this.parent.updateControls();"init"===this.action&&(this.click=!1);this.actionExec.execute();this.parent.updateControls();"animate"!==this.action&&this.parent.update();this.parent.updateControls()};q.prototype.createGradient=function(a,c){this.linearGradient=this.ctx.createLinearGradient(0,0,0,c);d=c*c;for(a=0;a<c;a++)r=f(a-35*c/100),this.linearGradient.addColorStop(a/c,"rgba(0,0,0,"+r*r*192/d/255+")")};a.Control=
q;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=Math.floor,e=Math.abs,d=/[\w\.\-//]*(\.gif)/gi,r,n,b,h,l,c,k,g,v,u,p,z,q,m,y,w,x,A,H,E,G,F,D,B,K,L,M,O,I,N,C,Q,J,R,P,S,T=function(c,b){var d=a.Control.call(this,c,b)||this;d.imageSrc=b.imageSrc||"";d.image=b.image||new Image;d.imageOver=b.imageOver||new Image;d.imageDown=b.imageDown||new Image;d.flat=b.flat||!1;d.borderColor=b.borderColor||!1;d.text_align=b.text_align||"center_center";d.image_align=b.image_align||"center_center";d.font_family=a.getFontName(b.font_family||
"arial");d.ratio=c.ratio;-1===d.font_size&&(d.noFSize=!0);d.borderColor&&(d.borderColor=new a.Color(d.borderColor));d.text_align=d.text_align.split("_");d.image_align=d.image_align.split("_");d.old_name=d.name;d.name.match(/^\[.*\]?/)?d.name=d.parser.parse(d.name.substring(1,d.name.length-1)):d.name=d.parser.parse("'"+d.name+"'");d.classContainer=d.cssClass?" "+d.cssClass+" ":"";d.extra_style=d.imageSrc.trim().match("^_STYLE_")?d.imageSrc.trim().substring(8):d.extra_style||"";d.imageSrc.trim().match("^_STYLE_")&&
(d.imageSrc="vacio.gif");if(d.extra_style){d.customStyle=!0;d.btnStyle=[];d.conStyle=[];d.conStyle.textBorder=3;c=d.extra_style.split("|");for(var g,k=0,m=c.length;k<m;k++)b=c[k],g=b.match(/rgb/g),b.match("class=")?d.classContainer=" "+b.substring(6):b.match("border=")?(d.btnStyle.push({type:"border-style",value:"solid"}),d.btnStyle.push({type:"border-width",value:b.substring(7).trim()+"px"})):b.match("borderRadius=")?(d.btnStyle.push({type:"border-radius",value:b.substring(13).trim()+"px"}),d.conStyle.push({type:"border-radius",
value:b.substring(13).trim()+"px"})):b.match("borderColor=")?d.btnStyle.push({type:"border-color",value:(g?"":"#")+b.substring(12).trim()}):b.match("overColor=")?d.conStyle.overColor=(g?"":"#")+b.substring(10).trim():b.match("downColor=")?d.conStyle.downColor=(g?"":"#")+b.substring(10).trim():b.match("font=")?d.conStyle.font=b.substring(5).trim().toLowerCase():b.match("inactiveColor=")?d.conStyle.inactiveColor=(g?"":"#")+b.substring(14).trim():b.match("inactiveColorBorder=")?d.conStyle.inactiveColorBorder=
(g?"":"#")+b.substring(20).trim():b.match("shadowTextBlur=")?d.conStyle.shadowTextBlur=parseFloat(b.substring(15).trim()):b.match("shadowTextOffsetX=")?d.conStyle.shadowTextOffsetX=parseFloat(b.substring(18).trim()):b.match("shadowTextOffsetY=")?d.conStyle.shadowTextOffsetY=parseFloat(b.substring(18).trim()):b.match("shadowTextColor=")?d.conStyle.shadowTextColor=(g?"":"#")+b.substring(16).trim():b.match("shadowBoxBlur=")?d.conStyle.shadowBoxBlur=parseFloat(b.substring(14).trim()):b.match("shadowBoxOffsetX=")?
d.conStyle.shadowBoxOffsetX=parseFloat(b.substring(17).trim()):b.match("shadowBoxOffsetY=")?d.conStyle.shadowBoxOffsetY=parseFloat(b.substring(17).trim()):b.match("shadowBoxColor=")?d.conStyle.shadowBoxColor=(g?"":"#")+b.substring(15).trim():b.match("shadowInsetBoxBlur=")?d.conStyle.shadowInsetBoxBlur=parseFloat(b.substring(19).trim()):b.match("shadowInsetBoxOffsetX=")?d.conStyle.shadowInsetBoxOffsetX=parseFloat(b.substring(22).trim()):b.match("shadowInsetBoxOffsetY=")?d.conStyle.shadowInsetBoxOffsetY=
parseFloat(b.substring(22).trim()):b.match("shadowInsetBoxColor=")?d.conStyle.shadowInsetBoxColor=(g?"":"#")+b.substring(20).trim():b.match("textBorder=")?d.conStyle.textBorder=parseFloat(b.substring(11).trim()):b.match("flat=")?d.flat=1==parseInt(b.substring(5).trim()):b.match("imgSizeW=")?d.imgSizeW=parseFloat(b.substring(9))||0:b.match("imgSizeH=")&&(d.imgSizeH=parseFloat(b.substring(9))||0)}d.imageSrc.match("_COLORES_")&&(c=d.imageSrc.split("_"),d.colorInt=new a.Color(c[2]),d.color=new a.Color(c[3]),
d.font_size=d.parser.parse(c[5]),d.imageSrc="");d.imageSrc.match(/^\[.*\]?/)?d.imageSrc=d.parser.parse(d.imageSrc.substring(1,d.imageSrc.length-1)):d.imageSrc=d.parser.parse("'"+d.imageSrc+"'");c=d.evaluator.eval(d.imageSrc).toString().trim();if(""!=c)if(b=c.substr(0,c.lastIndexOf(".")),g=c.substr(c.lastIndexOf(".")),c.match(/vacio.gif$/i))d.imageSrc=d.parser.parse("'vacio.gif'"),d.image.ready=1,3===d.parent.version&&(d.name=d.parser.parse("")),d.emptyImage={ready:!0},d.parser.parse("'vacio.gif'");
else if(d.image=d.parent.getImage(c),b)try{d.imageOver=d.parent.getImage(b+"_over"+g),d.imageDown=d.parent.getImage(b+"_down"+g)}catch(X){}d.container=a.newHTML("div",{class:"DescartesButtonContainer"+d.classContainer,id:d.id,style:"width:"+d.w+"px;height:"+d.h+"px;left:"+d.x+"px;top:"+d.y+"px;z-index:"+d.zIndex+";"});d.btn=a.newHTML("canvas",{width:d.w*d.ratio,height:d.h*d.ratio,style:"position:absolute;left:0;top:0;width:"+d.w+"px;height:"+d.h+"px;"});d.ctx=d.btn.getContext("2d");d.ctx.imageSmoothingEnabled=
!1;d.tooltip&&(d.btn.title=d.tooltip);d.container.appendChild(d.btn);d.addControlContainer(d.container);d.addEvents();d.init();return d};$jscomp.inherits(T,a.Control);T.prototype.init=function(c){r=this.evaluator;E=this.container;n=this.btn;b=this.ctx;h=r.eval(this.expresion);this.x=h[0][0];this.y=h[0][1];4==h[0].length&&(this.w=parseInt(h[0][2]),this.h=parseInt(h[0][3]));n.width=this.w*this.ratio;n.height=this.h*this.ratio;n.setAttribute("style","position:absolute;left:0;top:0;width:"+this.w+"px;height:"+
this.h+"px;box-sizing:border-box;");E.setAttribute("style","width:"+this.w+"px;height:"+this.h+"px;left:"+this.x+"px;top:"+this.y+"px;z-index:"+this.zIndex+";display:block;");if(this.btnStyle)for(var d=0,g=this.btnStyle.length;d<g;d++)n.style[this.btnStyle[d].type]=this.btnStyle[d].value;if(this.conStyle){d=0;for(g=this.conStyle.length;d<g;d++)E.style[this.conStyle[d].type]=this.conStyle[d].value;if(this.conStyle.shadowBoxColor){d=this.conStyle.shadowBoxOffsetX||0;g=this.conStyle.shadowBoxOffsetY||
2;var k=this.conStyle.shadowBoxBlur||2;E.style.boxShadow=d+"px "+g+"px "+k+"px 1px "+this.conStyle.shadowBoxColor}this.conStyle.shadowInsetBoxColor&&(d=this.conStyle.shadowInsetBoxOffsetX||0,g=this.conStyle.shadowInsetBoxOffsetY||-2,k=this.conStyle.shadowInsetBoxBlur||1,n.style.boxShadow=d+"px "+g+"px "+k+"px 1px "+this.conStyle.shadowInsetBoxColor+" inset")}this.noFSize&&(this.font_size=r.parser.parse(a.getFieldFontSize(this.h)+""));this.fs_evaluated=r.eval(this.font_size);this.createGradient(this.w,
this.h);E.style.display=0<r.eval(this.drawif)?"block":"none";b.lineJoin="round";b.font=this.italics+" "+this.bold+" "+this.fs_evaluated+"px "+this.font_family;this.text_object=new a.TextObject({parent:{decimal_symbol:this.parent.decimal_symbol},evaluator:this.evaluator,decimals:this.decimals,fixed:!1,align:"left",anchor:"center_center",width:this.parser.parse("0"),font_size:this.font_size,font_family:this.font_family,italics:this.italics,bold:this.bold,border:this.borderColor,border_size:this.conStyle?
this.conStyle.textBorder:void 0,shadowBlur:this.conStyle&&this.conStyle.shadowTextColor?this.conStyle.shadowTextBlur||1:void 0,shadowOffsetX:this.conStyle&&this.conStyle.shadowTextColor?this.conStyle.shadowTextOffsetX||0:void 0,shadowOffsetY:this.conStyle&&this.conStyle.shadowTextColor?this.conStyle.shadowTextOffsetY||2:void 0,shadowColor:this.conStyle&&this.conStyle.shadowTextColor?this.conStyle.shadowTextColor:void 0},this.old_name);this.draw(c)};T.prototype.update=function(){r=this.evaluator;E=
this.container;n=this.btn;this.activeIfValue=0<r.eval(this.activeif);this.drawIfValue=0<r.eval(this.drawif);(this.space?this.space.drawIfValue:1)&&this.drawIfValue?(E.style.display="block",this.draw(),E.style.cursor=n.style.cursor=this.activeIfValue?"pointer":"not-allowed",E.setAttribute("active",this.activeIfValue),this.updatePositionAndSize()):(E.style.display="none",this.buttonClick=!1)};T.prototype.draw=function(e){E=this.container;r=this.evaluator;n=this.btn;b=this.ctx;c=r.eval(this.name);this.text_object.draw(a.ctx,
"#000000",0,0);c=this.text_object.textNodes.toStr();k=this.evaluator.eval(this.imageSrc).toString().trim();if(!e&&(G=this.over===this.oldOver,F=this.buttonClick===this.oldButtonClick,D=this.activeIfValue===this.oldActiveIfValue,B=this.drawIfValue===this.oldDrawIfValue,K=c===this.oldName,L=k===this.oldImageSrc,M=this.colorInt.getColor()===this.oldBackColor,O=this.color.getColor()===this.oldTextColor,I=this.image.ready===this.oldImageReady,this.oldOver=this.over,this.oldButtonClick=this.buttonClick,
this.oldActiveIfValue=this.activeIfValue,this.oldDrawIfValue=this.drawIfValue,this.oldName=c,this.oldImageSrc=k,this.oldBackColor=this.colorInt.getColor(),this.oldTextColor=this.color.getColor(),this.oldImageReady=this.image.ready,G&&F&&D&&B&&K&&L&&M&&O&&I))return;b.save();b.setTransform(this.ratio,0,0,this.ratio,0,0);l=this.fs_evaluated;E.setAttribute("data-name",c);k?(g="vacio.gif"===k?this.emptyImage:this.parent.getImage(k),N=k.substr(0,k.lastIndexOf(".")),C=k.substr(k.lastIndexOf(".")),Q=N+"_over"+
C,J=N+"_down"+C,R="vacio.gif"===k?this.emptyImage:this.parent.getImage(Q),P="vacio.gif"===k?this.emptyImage:this.parent.getImage(J)):P=R=g=this.emptyImage;b.clearRect(0,0,this.w,this.h);u=p=0;this.buttonClick&&(u=p=1);this.text_object.draw(b,this.color.getColor(),0,0,!0);z=this.text_object.textNodes.metrics.w;q=this.text_object.textNodes.metrics.h;"center"==this.text_align[1]?A=f(this.w/2+u)-.5:"left"==this.text_align[1]?A=z/2+5+u:"right"==this.text_align[1]&&(A=this.w-z/2+u-5);"center"==this.text_align[0]?
H=f(this.h/2+p)-.5:"top"==this.text_align[0]?H=q/2+p+4:"bottom"==this.text_align[0]&&(H=this.h-q/2+p-3);if(g){if(m=this.imgSizeW?this.imgSizeW:g.width,y=this.imgSizeH?this.imgSizeH:g.height,"center"==this.image_align[1]?w=parseInt((this.w-m)/2)+u:"left"==this.image_align[1]?w=u:"right"==this.image_align[1]&&(w=this.w-m+u),"center"==this.image_align[0]?x=parseInt((this.h-y)/2)+p:"top"==this.image_align[0]?x=p:"bottom"==this.image_align[0]&&(x=this.h-y+p),g&&g.ready)if(g!==this.emptyImage&&g.complete)if(k.match(d))this.btn.style.backgroundRepeat=
"no-repeat",this.btn.style.backgroundImage="url('"+k+"')",this.btn.style.backgroundPosition=w+"px "+x+"px";else{if("center"!=this.image_align[0]||"center"!=this.image_align[1])S=this.colorInt.getColor(),!S||"CanvasGradient"!==S.constructor.name&&"CanvasPattern"!==S.constructor.name?E.style.backgroundColor=S:(b.fillStyle=S,b.fillRect(0,0,this.w,this.h));b.drawImage(g,0,0,g.width,g.height,w,x,m,y)}else this.emptyImage&&this.customStyle&&(S=this.colorInt.getColor(),!S||"CanvasGradient"!==S.constructor.name&&
"CanvasPattern"!==S.constructor.name?E.style.backgroundColor=S:(b.fillStyle=S,b.fillRect(0,0,this.w,this.h)))}else S=this.colorInt.getColor(),!S||"CanvasGradient"!==S.constructor.name&&"CanvasPattern"!==S.constructor.name?(E.style.backgroundColor=S,this.flat||(this.buttonClick||(this.drawLine(b,this.w-1,0,this.w-1,this.h,"rgba(0,0,0,0.5)"),this.drawLine(b,0,0,0,this.h,"rgba(0,0,0,0.09)"),this.drawLine(b,1,0,1,this.h,"rgba(0,0,0,0.03)")),b.fillStyle=this.linearGradient,b.fillRect(0,0,this.w,this.h))):
(b.fillStyle=S,b.fillRect(0,0,this.w,this.h));this.activeIfValue&&(R!==this.emptyImage&&this.over&&R.ready&&R.complete?Q.match(d)?(this.btn.style.backgroundImage="url('"+Q+"')",this.btn.style.backgroundPosition=w+"px "+x+"px"):b.drawImage(R,w,x):this.customStyle&&this.conStyle.overColor&&this.over&&(E.style.backgroundColor=this.conStyle.overColor));this.activeIfValue?P!==this.emptyImage&&this.buttonClick&&P.ready&&P.complete?J.match(d)?(this.btn.style.backgroundImage="url('"+J+"')",this.btn.style.backgroundPosition=
w+"px "+x+"px"):b.drawImage(P,w,x):this.customStyle&&this.conStyle.downColor&&this.buttonClick&&(E.style.backgroundColor=this.conStyle.downColor):this.buttonClick&&!g&&(b.fillStyle="rgba(0,0,0,0.09)",b.fillRect(0,0,this.w,this.h));b.fillStyle=this.color.getColor();this.customStyle&&this.conStyle.shadowTextColor&&0<this.conStyle.textBorder&&(b.lineWidth=this.conStyle.textBorder,b.strokeStyle=this.conStyle.shadowTextColor);this.borderColor&&(b.lineWidth=parseInt(l/6),b.strokeStyle=this.borderColor.getColor());
this.text_object.draw(b,this.color.getColor(),A,H);this.underlined&&(b.strokeStyle=this.color.getColor(),b.lineWidth=f(l/10)||2,b.lineCap="round",b.beginPath(),b.moveTo(A-z/2+u,H+f(l/2)+f(l/5)-1.5),b.lineTo(A+z/2+u,H+f(l/2)+f(l/5)-1.5),b.stroke());this.activeIfValue||(this.customStyle&&this.conStyle.inactiveColor?E.style.backgroundColor=this.conStyle.inactiveColor:(b.fillStyle="rgba(240,240,240,0.6)",b.fillRect(0,0,this.w,this.h)));b.restore();this._image_pos_x=w;this._image_pos_y=x};T.prototype.drawLine=
function(a,c,b,d,g,k,m){a.lineWidth=void 0===m?1:m;a.strokeStyle=void 0===k?"black":k;v=a.lineWidth%2*.5;a.beginPath();a.moveTo(f(c)+v,f(b)+v);a.lineTo(f(d)+v,f(g)+v);a.stroke()};T.prototype.drawTextBorder=function(){this.colorInt.getColor();this.color.getColor();return!(.5>(e(this.colorInt.r-this.color.r)+e(this.colorInt.g-this.color.g)+e(this.colorInt.b-this.color.b))/255)};T.prototype.buttonPressed=function(){this.updateAndExecAction()};T.prototype.addEvents=function(){function c(b,d,m){a.clearTimeout(k);
g.buttonClick&&g.drawIfValue&&g.activeIfValue&&(d.call(g),b=m?b:100,k=a.setTimeout(function(){c(b,d,!1)},b))}function b(b){this.focus();b.preventDefault();b.stopPropagation();document.activeElement!=document.body&&document.activeElement.blur();g.whichBtn=a.whichBtn(b);"L"==g.whichBtn&&g.activeIfValue&&(g.buttonClick=!0,g.draw(),"calculate"==g.action&&(g.evaluator.setVariable(g.id,g.evaluator.eval(g.valueExpr)),c(1E3,g.buttonPressed,!0)),g.btn.removeEventListener("touchend",d),g.btn.addEventListener("touchend",
d),g.btn.removeEventListener("mouseup",d),g.btn.addEventListener("mouseup",d))}function d(c){a.newBlobContent=null;this.focus();c.preventDefault();c.stopPropagation();if(g.activeIfValue||g.buttonClick)g.buttonClick=!1,g.draw(),"calculate"!=g.action&&(g.evaluator.setVariable(g.id,g.evaluator.eval(g.valueExpr)),g.buttonPressed()),g.btn.removeEventListener("touchend",d),g.btn.removeEventListener("mouseup",d);g.parent.update()}var g=this,k;g.btn.oncontextmenu=function(){return!1};this.over=this.buttonClick=
!1;this.btn.addEventListener("touchstart",b);this.btn.addEventListener("mousedown",b);this.btn.addEventListener("mouseover",function(a){a.preventDefault();a.stopPropagation();g.over=!0;g.draw()});this.btn.addEventListener("mouseout",function(c){a.newBlobContent=null;c.preventDefault();c.stopPropagation();g.over=!1;g.buttonClick=!1;g.draw()});document.addEventListener("visibilitychange",function(c){a.newBlobContent=null;g.buttonClick=!1})};a.Button=T;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,e,d,r,n,b,h,l,c,k,g,v,u,p,z=function(c,b){b=a.Control.call(this,c,b)||this;b.flat=b.image_dec_src&&b.image_inc_src;b.btn_pos=b.btn_pos||"v_left";b.horizontal="h_left"===b.btn_pos||"h_right"===b.btn_pos||"h_left_right"===b.btn_pos;b.label_color=b.label_color||new a.Color("e0e4e8",c.evaluator);b.label_text_color=b.label_text_color||new a.Color("000000",c.evaluator);b.tabindex=++b.parent.tabindex;b.name_str=b.name;b.initial_value=0;try{b.initial_value=
b.evaluator.eval(b.parser.parse(b.valueExprString))}catch(y){console.log(y)}b.name.match(/^\[.*\]?/)?b.name=b.parser.parse(b.name.substring(1,b.name.length-1)):b.name=b.parser.parse("'"+b.name+"'");b.container=a.newHTML("div",{class:"DescartesSpinnerContainer",id:b.id});b.divUp=a.newHTML("div",{class:"DJS_Up"});b.divDown=a.newHTML("div",{class:"DJS_Down"});b.field=a.newHTML("input",{type:"text",id:b.id+"_spinner",class:"DescartesSpinnerField",tabindex:b.tabindex});b.label=a.newHTML("canvas",{class:"DescartesSpinnerLabel"});
b.label_ctx=b.label.getContext("2d");b.ratio=c.ratio;b.container.appendChild(b.label);b.container.appendChild(b.field);b.container.appendChild(b.divUp);b.container.appendChild(b.divDown);b.cover=a.newHTML("div",{class:"TextfieldCover"});b.keyboard&&b.visible&&b.container.appendChild(b.cover);b.addControlContainer(b.container);g=b.evaluator.parser.parse("1");b.originalIncr=b.incr;if(0>b.evaluator.eval(b.decimals)||0===b.evaluator.eval(b.incr))c=b.evaluator.eval(b.incr),0<c?(b.incr=b.evaluator.parser.parse(parseInt(c).toString()),
b.originalIncr=b.incr):b.incr=g;b.image_dec_src&&(b.image_dec_src.match(/^\[.*\]?/)?b.image_dec_src=b.parser.parse(b.image_dec_src.substring(1,b.image_dec_src.length-1)):b.image_dec_src=b.parser.parse("'"+b.image_dec_src+"'"),b.old_image_dec_src=b.evaluator.eval(b.image_dec_src).toString().trim(),b.image_dec=b.parent.getImage(b.old_image_dec_src));b.image_inc_src&&(b.image_inc_src.match(/^\[.*\]?/)?b.image_inc_src=b.parser.parse(b.image_inc_src.substring(1,b.image_inc_src.length-1)):b.image_inc_src=
b.parser.parse("'"+b.image_inc_src+"'"),b.old_image_inc_src=b.evaluator.eval(b.image_inc_src).toString().trim(),b.image_inc=b.parent.getImage(b.old_image_inc_src));b.addEvents();b.init();return b};$jscomp.inherits(z,a.Control);z.prototype.init=function(c,b){f=this.evaluator;this.label.innerHTML=f.eval(this.name).toString();var d=this.label.textContent;b||(this.value=this.validateValue(f.eval(this.valueExpr)));b=this.formatOutputValue(this.value);this.fieldFontSize=0<f.eval(this.font_size)?f.eval(this.font_size):
a.getFieldFontSize(this.h);this.text_object=new a.TextObject({parent:{decimal_symbol:this.parent.decimal_symbol},evaluator:this.evaluator,decimals:this.decimals,fixed:!1,align:"left",anchor:"center_center",width:this.parser.parse("0"),font_size:this.parser.parse(""+this.fieldFontSize),font_family:this.font_family,italics:this.italics,bold:this.bold},this.name_str);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0,!0);var g=2!==this.parent.version?"__":"_____",k=a.getTextWidth(b+
"_",this.fieldFontSize+"px "+a.sansserif_font);if(this.horizontal){c=parseInt(this.h);var e=parseInt(this.w/2-c);g=this.text_object.textNodes.metrics.w+parseInt(this.fieldFontSize);this.visible||(e=this.w-2*c,k=0);e<g&&(e=g);""==d&&(e=0);this.w-e-c<k&&(e=this.w-c-k);0>e&&(e=0);d=this.w-(e+2*c);this.container.setAttribute("style","width:"+this.w+"px;height:"+this.h+"px;left:"+this.x+"px;top:"+this.y+"px;z-index:"+this.zIndex+";background-color:transparent;");this.divUp.setAttribute("style","width:"+
c+"px;height:"+c+"px;"+("h_left"===this.btn_pos?"left:"+(e+c):"right:0")+"px;top:0;"+(this.flat?"border-width:0;":""));this.divDown.setAttribute("style","width:"+c+"px;height:"+c+"px;left:"+(e+("h_right"===this.btn_pos?d:0))+"px;top:0;"+(this.flat?"border-width:0;":""));this.field.setAttribute("style","font-family:"+a.sansserif_font+";font-size:"+this.fieldFontSize+"px;width:"+d+"px;height:"+this.h+"px;left:"+(c+e+("h_left"===this.btn_pos?c:"h_right"===this.btn_pos?-c:0))+"px;text-align:center;");
this.cover.setAttribute("style","width:"+d+"px;height:"+this.h+"px;left:"+(c+e+("h_left"===this.btn_pos?c:"h_right"===this.btn_pos?-c:0))+"px;text-align:center;")}else c=2+parseInt(this.h/2),e=parseInt(this.w/2-c/2),g=a.getTextWidth(d+g,this.fieldFontSize+"px "+a.sansserif_font),this.visible||(e=this.w-c,k=0),e<g&&(e=g),""==d&&(e=0),this.w-e-c<k&&(e=this.w-c-k),0>e&&(e=0),d=this.w-(e+c),this.container.setAttribute("style","width:"+this.w+"px;height:"+this.h+"px;left:"+this.x+"px;top:"+this.y+"px;z-index:"+
this.zIndex+";background-color:transparent;"),g="width:"+c+"px;left:"+(e+("v_right"===this.btn_pos?d:0))+"px;",this.divUp.setAttribute("style",g+";height:"+(this.h/2+1)+"px;top:0;"+(this.flat?"border-width:0;":"")),this.divDown.setAttribute("style",g+";height:"+(this.h/2-1)+"px;top:"+(this.h/2+1)+"px;"+(this.flat?"border-width:0;":"")),this.field.setAttribute("style","font-family:"+a.sansserif_font+";font-size:"+this.fieldFontSize+"px;width:"+d+"px;height:"+this.h+"px;left:"+(("v_left"===this.btn_pos?
c:0)+e)+"px;"),this.cover.setAttribute("style","width:"+d+"px;height:"+this.h+"px;left:"+(("v_left"===this.btn_pos?c:0)+e)+"px;");this.field.value=b;this.visible||(this.field.style.display="none");this.label.setAttribute("style","font-size:"+this.fieldFontSize+"px;width:"+e+"px;height:"+this.h+"px;line-height:"+this.h+"px;background-color:"+this.label_color.getColor()+";color:"+this.label_text_color.getColor()+";");this.label.width=e*this.ratio;this.label.height=this.h*this.ratio;this.image_dec&&
this.image_dec.ready&&(this.divDown.style["background-image"]="url("+this.image_dec.src+")");this.image_inc&&this.image_inc.ready&&(this.divUp.style["background-image"]="url("+this.image_inc.src+")");this.divUp.setAttribute("horizontal",this.horizontal?!0:!1);this.divDown.setAttribute("horizontal",this.horizontal?!0:!1);f.setVariable(this.id,this.value)};z.prototype.update=function(){f=this.evaluator;0>f.eval(this.decimals)?(e=f.eval(this.incr),0<e?this.originalIncr=this.incr=f.parser.parse(parseInt(e).toString()):
this.incr=g):this.incr=0!==f.eval(this.originalIncr)?this.originalIncr:g;this.activeIfValue=0<f.eval(this.activeif);this.drawIfValue=0<f.eval(this.drawif);this.field.disabled=!this.activeIfValue;this.divUp.setAttribute("active",!this.field.disabled);this.divDown.setAttribute("active",!this.field.disabled);this.drawIfValue?(this.updateStyle(),this.container.style.display="block"):(this.click=!1,this.container.style.display="none");this.image_dec&&(v=this.evaluator.eval(this.image_dec_src).toString().trim(),
this.old_image_dec_src!==v&&(this.divDown.style["background-image"]="url("+v+")",this.old_image_dec_src=v));this.image_inc&&(u=this.evaluator.eval(this.image_inc_src).toString().trim(),this.old_image_inc_src!==u&&(this.divUp.style["background-image"]="url("+u+")",this.image_inc_src=u));this.updatePositionAndSize();this.parent.animation.playing&&document.activeElement==this.field||(d=this.field.value,r=this.value,this.value=this.validateValue(f.getVariable(this.id)),this.field.value=this.formatOutputValue(this.value),
this.value==r&&this.field.value!=d&&(this.value=this.validateValue(d),this.field.value=this.formatOutputValue(this.value)),f.setVariable(this.id,this.value));this.label_ctx.setTransform(this.ratio,0,0,this.ratio,0,0);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0);this.label_ctx.clearRect(0,0,this.label.width,this.label.height);!(p=this.label_color.getColor())||"CanvasGradient"!==p.constructor.name&&"CanvasPattern"!==p.constructor.name||(this.label_ctx.fillStyle=p,this.label_ctx.fillRect(0,
0,this.label_ctx.canvas.width,this.label_ctx.canvas.height));this.text_object.textNodes.metrics.w>this.label.width/this.ratio?(this.text_object.anchor="center_left",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),5,this.label.height/this.ratio/2)):(this.text_object.anchor="center_center",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),this.label.width/this.ratio/2,this.label.height/this.ratio/2));this.label_ctx.setTransform(1,0,0,1,0,0)};z.prototype.updateStyle=
function(){this.divUp.style.borderStyle=this.up?"inset":"outset";this.divUp.style.borderColor=this.up?"gray":"#f0f8ff";this.divUp.style.backgroundColor=this.up?"#bfbfbf":"";this.divUp.style.backgroundColor=this.flat?"transparent":this.divUp.style.backgroundColor;this.divUp.style.backgroundPosition=this.up?"calc(50% + 1px) calc(50% + 1px)":"center";this.divDown.style.borderStyle=this.down?"inset":"outset";this.divDown.style.borderColor=this.down?"gray":"#f0f8ff";this.divDown.style.backgroundColor=
this.down?"#bfbfbf":"";this.divDown.style.backgroundColor=this.flat?"transparent":this.divDown.style.backgroundColor;this.divDown.style.backgroundPosition=this.down?"calc(50% + 1px) calc(50% + 1px)":"center"};z.prototype.validateValue=function(a){f=this.evaluator;isNaN(parseFloat(a))||a.toString().match("e")&&(a=parseFloat(a).toFixed(20));a=void 0!=a?a.toString():"0";a=a.replace(this.parent.decimal_symbol,".");n=a==parseFloat(a)?parseFloat(a):parseFloat(f.eval(f.parser.parse(a)));isNaN(n)&&(n=0);
l=f.eval(this.min);c=f.eval(this.max);""===l&&(l=-Infinity);""===c&&(c=Infinity);n=Math.min(Math.max(n,l),c);this.discrete&&(b=f.eval(this.incr),n=0==b?0:this.initial_value+b*Math.round((n-this.initial_value)/b));h=f.eval(this.decimals);0>=h&&(h=0);return n=parseFloat(parseFloat(n).toFixed(h))};z.prototype.increase=function(){this.changeValue(parseFloat(this.value)+this.evaluator.eval(this.incr))};z.prototype.decrease=function(){this.changeValue(parseFloat(this.value)-this.evaluator.eval(this.incr))};
z.prototype.changeValue=function(a){this.activeIfValue&&(this.value=this.validateValue(a),this.field.value=this.formatOutputValue(this.value),this.evaluator.setVariable(this.id,this.value),this.updateAndExecAction())};z.prototype.addEvents=function(){function c(b,d,g){a.clearTimeout(l);if(f.up||f.down)d.call(f),b=g?b:10,l=a.setTimeout(function(){c(b,d)},b)}function b(b){b.preventDefault();f.whichBtn=a.whichBtn(b);"L"==f.whichBtn&&f.activeIfValue&&(f.up=!0,c(h,f.increase,!0))}function d(b){b.preventDefault();
f.whichBtn=a.whichBtn(b);"L"==f.whichBtn&&f.activeIfValue&&(f.down=!0,c(h,f.decrease,!0))}function g(c){f.up=!1;a.clearTimeout(l);f.updateStyle()}function e(c){f.down=!1;a.clearTimeout(l);f.updateStyle()}k=a.hasTouchSupport;var f=this,h=k?500:200,l;f.divUp.oncontextmenu=f.divDown.oncontextmenu=f.field.oncontextmenu=f.label.oncontextmenu=f.cover.oncontextmenu=function(){return!1};this.label.addEventListener("touchstart",a.preventDefault);this.label.addEventListener("mousedown",a.preventDefault);this.field.addEventListener("keydown",
function(a){13==a.keyCode&&f.changeValue(f.field.value)});this.divUp.addEventListener("touchstart",b);this.divUp.addEventListener("mousedown",b);this.divDown.addEventListener("touchstart",d);this.divDown.addEventListener("mousedown",d);this.divUp.addEventListener("mouseout",function(c){f.up=!1;a.clearTimeout(l);c.preventDefault();f.updateStyle()});this.divDown.addEventListener("mouseout",function(c){f.down=!1;a.clearTimeout(l);c.preventDefault();f.updateStyle()});this.divUp.addEventListener("touchend",
g);window.addEventListener("touchend",g);this.divUp.addEventListener("mouseup",g);window.addEventListener("mouseup",g);this.divDown.addEventListener("touchend",e);window.addEventListener("touchend",e);this.divDown.addEventListener("mouseup",e);window.addEventListener("mouseup",e);document.addEventListener("visibilitychange",function(c){f.up=!1;f.down=!1;a.clearTimeout(l);f.updateStyle()});this.field.addEventListener("blur",function(a){f.drawIfValue&&f.changeValue(f.field.value,!0)});f.field.addEventListener("click",
function(a){this.focus()});f.cover.addEventListener("click",function(a){a=f.evaluator.eval(f.kbexp);f.activeIfValue&&f.parent.keyboard.show(f,f.kblayout,a[0][0]||0,a[0][1]||0,f.id,f.field,f.onlyText)})};a.Spinner=z;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,e,d=function(d,e){var b=a.Control.call(this,d,e)||this;b.label_color=b.label_color||new a.Color("e0e4e8",d.evaluator);b.label_text_color=b.label_text_color||new a.Color("000000",d.evaluator);b.typeCtr="checkbox";b.pressed=e.pressed||!1;b.radio_group=(e.radio_group||"").trim();""!==b.radio_group&&(b.typeCtr="radio");b.name_str=b.name;b.name.match(/^\[.*\]?/)?b.name=b.parser.parse(b.name.substring(1,b.name.length-1)):b.name=b.parser.parse("'"+b.name.trim()+
"'");b.tabindex=++b.parent.tabindex;b.containerControl=a.newHTML("div",{class:"DescartesCheckboxContainer",id:b.id});b.checkbox=a.newHTML("input",{type:b.typeCtr,id:b.id+b.typeCtr,class:"DescartesCheckbox",tabindex:b.tabindex});""!==b.radio_group&&b.checkbox.setAttribute("name",b.radio_group);b.checkbox.internalID=b.id;b.label=a.newHTML("canvas",{class:"DescartesCheckboxLabel"});b.label_ctx=b.label.getContext("2d");b.ratio=d.ratio;b.dummyLabel=a.newHTML("label",{"for":b.id+b.typeCtr});b.value=b.evaluator.eval(b.valueExpr);
b.evaluator.setVariable(b.id,b.value);b.containerControl.appendChild(b.label);b.containerControl.appendChild(b.checkbox);b.containerControl.appendChild(b.dummyLabel);b.addControlContainer(b.containerControl);b.addEvents();b.init();return b};$jscomp.inherits(d,a.Control);d.prototype.init=function(d){f=this.evaluator;this.label.innerHTML=f.eval(this.name).toString();this.labelFontSize=0<f.eval(this.font_size)?f.eval(this.font_size):a.getFieldFontSize(this.h);d=Math.max(this.w-this.h,0);this.text_object=
new a.TextObject({parent:{decimal_symbol:this.parent.decimal_symbol},evaluator:this.evaluator,decimals:this.decimals,fixed:!1,align:"left",anchor:"center_center",width:this.parser.parse("0"),font_size:this.parser.parse(""+this.labelFontSize),font_family:this.font_family,italics:this.italics,bold:this.bold},this.name_str);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0,!0);this.containerControl.setAttribute("style","width:"+this.w+"px;height:"+this.h+"px;left:"+this.x+"px;top:"+
this.y+"px;z-index:"+this.zIndex+";");"right"==this.position?(this.dummyLabel.setAttribute("style","position:absolute;width:"+this.h+"px;height:"+this.h+"px;left:"+d+"px;"),this.checkbox.setAttribute("style","width:"+this.h+"px;height:"+this.h+"px;left:"+d+"px;"),this.label.setAttribute("style","font-size:"+this.labelFontSize+"px;width:"+d+"px;height:"+this.h+"px;line-height:"+this.h+"px;background-color:"+this.label_color.getColor()+";color:"+this.label_text_color.getColor()+";")):(this.dummyLabel.setAttribute("style",
"position:absolute;width:"+this.h+"px;height:"+this.h+"px;left:0;"),this.checkbox.setAttribute("style","width:"+this.h+"px;height:"+this.h+"px;left:0;"),this.label.setAttribute("style","font-size:"+this.labelFontSize+"px;width:"+d+"px;height:"+this.h+"px;line-height:"+this.h+"px;background-color:"+this.label_color.getColor()+";color:"+this.label_text_color.getColor()+";left:"+this.h+"px"));this.checkbox.checked=0!=this.evaluator.getVariable(this.id);this.label.width=d*this.ratio;this.label.height=
this.h*this.ratio;this.update()};d.prototype.update=function(){f=this.evaluator;this.activeIfValue=0<f.eval(this.activeif);this.drawIfValue=0<f.eval(this.drawif);this.checkbox.disabled=!this.activeIfValue;this.containerControl.style.display=this.drawIfValue?"block":"none";if(!this.parent.animation.playing||document.activeElement!=this.checkbox){var a=0!==f.getVariable(this.id)?1:0;if(""===this.radio_group)this.pressed?(this.value=this.checkbox.checked?1:0,this.pressed=!1):(this.value=a,this.checkbox.checked=
0!==this.value),f.setVariable(this.id,this.value);else{this.value=f.getVariable(this.id);f.setVariable(this.radio_group,0);a=document.querySelectorAll("[name="+this.radio_group+"]");var d=-1;if(this.pressed){for(var b=a.length-1;0<=b;b--)f.setVariable(a[b].internalID,0),a[b].checked=!1;f.setVariable(this.id,1);this.checkbox.checked=!0;this.value=1;f.setVariable(this.radio_group,this.id);this.pressed=0}else{for(b=a.length-1;0<=b;b--)d=0!=f.getVariable(a[b].internalID)?b:d,f.setVariable(a[b].internalID,
0),a[b].checked=!1;0<=d&&(f.setVariable(a[d].internalID,1),a[d].checked=!0,f.setVariable(this.radio_group,a[d].internalID));this.value=this.checkbox.checked?1:0}}}this.updatePositionAndSize();this.label_ctx.setTransform(this.ratio,0,0,this.ratio,0,0);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0);this.label_ctx.clearRect(0,0,this.label.width,this.label.height);!(e=this.label_color.getColor())||"CanvasGradient"!==e.constructor.name&&"CanvasPattern"!==e.constructor.name||
(this.label_ctx.fillStyle=e,this.label_ctx.fillRect(0,0,this.label_ctx.canvas.width,this.label_ctx.canvas.height));this.text_object.textNodes.metrics.w>this.label.width/this.ratio?(this.text_object.anchor="center_left",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),5,this.label.height/this.ratio/2)):(this.text_object.anchor="center_center",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),this.label.width/this.ratio/2,this.label.height/this.ratio/2));this.label_ctx.setTransform(1,
0,0,1,0,0)};d.prototype.addEvents=function(){var d=this;d.checkbox.oncontextmenu=d.label.oncontextmenu=d.dummyLabel.oncontextmenu=function(){return!1};d.label.addEventListener("touchstart",a.preventDefault);d.label.addEventListener("mousedown",a.preventDefault);d.dummyLabel.addEventListener("mousedown",a.preventDefault);d.checkbox.addEventListener("click",function(){d.pressed=!0;d.updateAndExecAction()})};a.Checkbox=d;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,e,d,r,n,b,h,l=function(c,b){b=a.Control.call(this,c,b)||this;b.label_color=b.label_color||new a.Color("e0e4e8",c.evaluator);b.label_text_color=b.label_text_color||new a.Color("000000",c.evaluator);b.name_str=b.name;b.name.match(/^\[.*\]?/)?b.name=b.parser.parse(b.name.substring(1,b.name.length-1)):b.name=b.parser.parse("'"+b.name.trim()+"'");void 0===b.valueExprString&&(b.valueExprString=b.onlyText?"0":"");b.emptyString=!1;b.ok=0;b.tabindex=++b.parent.tabindex;
b.regExpDecimalSymbol=new RegExp("\\"+b.parent.decimal_symbol,"g");if(b.answer)if(b.answer.match("krypto_")&&(b.answer=(new a.Krypto).decode(b.answer.substring(7))),b.answerPattern=b.answer,b.answer=a.buildRegularExpressionsPatterns(b.answer,b.evaluator),b.onlyText){var d=b.answerPattern.indexOf("|");b.firstAnswer=-1==d?b.answerPattern:b.answerPattern.substring(0,d)}else b.firstAnswer=b.parser.parse(b.answerPattern.substring(1,b.answerPattern.indexOf(",")));b.onlyText&&(b.valueExprString.match(/^'/)&&
b.valueExprString.match(/'$/)||(b.valueExpr=b.evaluator.parser.parse("'"+b.valueExprString+"'")),b.validateValue=function(a){a=a.toString();return"''"==a||"'"==a?"":a&&a.match(/^'/)&&a.match(/'$/)?a.substring(1,a.length-1):a},b.formatOutputValue=function(a){return a.toString()});b.containerControl=a.newHTML("div",{class:"DescartesTextFieldContainer",id:b.id});b.field=a.newHTML("input",{type:"text",id:b.id+"TextField",class:"DescartesTextFieldField",tabindex:b.tabindex});b.label=a.newHTML("canvas",
{class:"DescartesTextFieldLabel"});b.label_ctx=b.label.getContext("2d");b.ratio=c.ratio;b.containerControl.appendChild(b.label);b.containerControl.appendChild(b.field);b.cover=a.newHTML("div",{class:"TextfieldCover"});b.keyboard&&b.containerControl.appendChild(b.cover);b.activoStr=b.id+".activo";b.activeStr=b.id+".active";b.addControlContainer(b.containerControl);b.addEvents();b.init();return b};$jscomp.inherits(l,a.Control);l.prototype.init=function(b){f=this.evaluator;this.label.innerHTML=f.eval(this.name).toString();
var c=this.label.textContent;b||(this.value=this.validateValue(f.eval(this.valueExpr)));b=this.formatOutputValue(this.value);this.fieldFontSize=0<f.eval(this.font_size)?f.eval(this.font_size):a.getFieldFontSize(this.h);this.text_object=new a.TextObject({parent:{decimal_symbol:this.parent.decimal_symbol},evaluator:this.evaluator,decimals:this.decimals,fixed:!1,align:"left",anchor:"center_center",width:this.parser.parse("0"),font_size:this.parser.parse(""+this.fieldFontSize),font_family:this.font_family,
italics:this.italics,bold:this.bold},this.name_str);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0,!0);var d=a.getTextWidth(b+"_",this.fieldFontSize+"px "+a.sansserif_font),e=parseInt(this.w/2),h=this.text_object.textNodes.metrics.w+parseInt(this.fieldFontSize);this.visible||(e=this.w,d=0);e<h&&(e=h);""==c&&(e=0);this.w-e<d&&(e=this.w-d);0>e&&(e=0);c=this.w-e;this.containerControl.setAttribute("style","width:"+this.w+"px;height:"+this.h+"px;left:"+this.x+"px;top:"+this.y+
"px;z-index:"+this.zIndex+";");this.field.setAttribute("style","font-size:"+this.fieldFontSize+"px;width:"+c+"px;height:"+this.h+"px;left:"+e+"px; font-family:"+("Serif"==this.font_family?a.serif_font:"Monospaced"==this.font_family?a.monospace_font:a.sansserif_font)+";");this.field.value=b;this.cover.setAttribute("style",";width:"+c+"px;height:"+this.h+"px;left:"+e+"px;");this.label.setAttribute("style","font-size:"+this.fieldFontSize+"px;width:"+e+"px;height:"+this.h+"px;line-height:"+this.h+"px;background-color:"+
this.label_color.getColor()+";color:"+this.label_text_color.getColor()+";");this.label.width=e*this.ratio;this.label.height=this.h*this.ratio;this.evaluate&&(this.ok=this.evaluateAnswer());this.evaluator.setVariable(this.id,this.value);this.evaluator.setVariable(this.id+".ok",this.ok);this.oldValue=this.value;this.update()};l.prototype.update=function(){f=this.evaluator;this.activeIfValue=0<f.eval(this.activeif);this.drawIfValue=0<f.eval(this.drawif);this.field.disabled=!this.activeIfValue;this.containerControl.style.display=
this.drawIfValue?"block":"none";this.parent.animation.playing&&document.activeElement==this.field||(e=this.field.value,d=this.value,this.value=this.validateValue(f.getVariable(this.id)),this.field.value=this.formatOutputValue(this.value),this.value===d&&this.field.value!=e&&(this.value=this.validateValue(e),this.field.value=this.formatOutputValue(this.value)),f.setVariable(this.id,this.value));this.updatePositionAndSize();this.label_ctx.setTransform(this.ratio,0,0,this.ratio,0,0);this.text_object.draw(this.label_ctx,
this.label_text_color.getColor(),0,0);this.label_ctx.clearRect(0,0,this.label.width,this.label.height);!(h=this.label_color.getColor())||"CanvasGradient"!==h.constructor.name&&"CanvasPattern"!==h.constructor.name||(this.label_ctx.fillStyle=h,this.label_ctx.fillRect(0,0,this.label_ctx.canvas.width,this.label_ctx.canvas.height));this.text_object.textNodes.metrics.w>this.label.width/this.ratio?(this.text_object.anchor="center_left",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),
5,this.label.height/this.ratio/2)):(this.text_object.anchor="center_center",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),this.label.width/this.ratio/2,this.label.height/this.ratio/2));this.label_ctx.setTransform(1,0,0,1,0,0)};l.prototype.validateValue=function(a){if(""===a||"''"==a)return"";f=this.evaluator;a=a.toString().replace(this.regExpDecimalSymbol,".","g");r=a==parseFloat(a)?parseFloat(a):parseFloat(f.eval(f.parser.parse(a)));isNaN(r)&&(r=0);n=f.eval(this.min);b=f.eval(this.max);
""===n&&(n=-Infinity);""===b&&(b=Infinity);r<n&&(r=n);r>b&&(r=b);this.discrete&&(a=f.eval(this.incr),r=0===a?0:a*Math.round(r/a));return r=parseFloat(parseFloat(r).toFixed(f.eval(this.decimals)))};l.prototype.formatOutputValue=function(b){return""===b?"":a.Control.prototype.formatOutputValue.call(this,b)};l.prototype.changeValue=function(a){this.activeIfValue&&(this.value=this.validateValue(a),this.field.value=this.formatOutputValue(this.value),this.evaluate&&(this.ok=this.evaluateAnswer()),this.evaluator.setVariable(this.id,
this.value),this.evaluator.setVariable(this.id+".ok",this.ok),this.updateAndExecAction())};l.prototype.evaluateAnswer=function(){return a.esCorrecto(this.answer,this.value,this.evaluator,this.answer)};l.prototype.getFirstAnswer=function(){return this.answer?this.onlyText?this.firstAnswer:this.evaluator.eval(this.firstAnswer):""};l.prototype.deactivate=function(){this.evaluator.setVariable(this.activoStr,0);this.evaluator.setVariable(this.activeStr,0)};l.prototype.addEvents=function(){var b=this;b.field.oncontextmenu=
b.label.oncontextmenu=b.cover.oncontextmenu=function(){return!1};b.label.addEventListener("touchstart",a.preventDefault);b.label.addEventListener("mousedown",a.preventDefault);this.field.addEventListener("mousedown",function(a){b.parent.deactivateControls();b.evaluator.setVariable(b.activoStr,1);b.evaluator.setVariable(b.activeStr,1);b.parent.update()});this.field.addEventListener("blur",function(a){b.drawIfValue&&b.changeValue(b.field.value,!0)});this.field.addEventListener("keydown",function(a){b.activeIfValue&&
13==a.keyCode&&b.changeValue(b.field.value,!0)});b.field.addEventListener("click",function(a){this.focus()});b.cover.addEventListener("click",function(a){b.parent.deactivateControls();b.evaluator.setVariable(b.activoStr,1);b.evaluator.setVariable(b.activeStr,1);b.parent.update();a=b.evaluator.eval(b.kbexp);b.activeIfValue&&b.parent.keyboard.show(b,b.kblayout,a[0][0]||0,a[0][1]||0,b.id,b.field,b.onlyText)})};a.TextField=l;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=Math.abs,e,d,r,n,b,h,l,c,k,g,v,u=function(b,c){function g(b){f.options=b.split(",");f.menuOptions=[];f.strValue=[];b=0;for(var c=f.options.length;b<c;b++){var g=f.customSplit(f.options[b]);1==g.length?(f.menuOptions.push(g[0]),f.strValue.push(b.toString())):2==g.length&&(f.menuOptions.push(g[0]),""==g[1]?f.strValue.push(b.toString()):f.strValue.push(g[1]))}b=0;for(c=f.menuOptions.length;b<c;b++)f.menuOptions[b].match(/^\[/)&&f.menuOptions[b].match(/\]$/)?
f.menuOptions[b]=e.parse(f.menuOptions[b].substring(1,f.menuOptions[b].length-1)):f.menuOptions[b]=e.parse("'"+f.menuOptions[b]+"'");b=0;for(c=f.strValue.length;b<c;b++)f.strValue[b].match(/^\[/)&&f.strValue[b].match(/\]$/)?f.strValue[b]=e.parse(f.strValue[b].substring(1,f.strValue[b].length-1)):f.strValue[b]=e.parse(f.strValue[b]);f.select.innerHTML="";b=0;for(c=f.menuOptions.length;b<c;b++)g=a.newHTML("option"),g.innerHTML=d.eval(f.menuOptions[b]),f.select.appendChild(g);return 0}var k,f=k=a.Control.call(this,
b,c)||this;f.label_color=f.label_color||new a.Color("e0e4e8",b.evaluator);f.label_text_color=f.label_text_color||new a.Color("000000",b.evaluator);f.options=c.options||"";e=f.parser;d=f.evaluator;f.ok=0;f.tabindex=++f.parent.tabindex;f.answer&&(f.answer.match("krypto_")&&(f.answer=(new a.Krypto).decode(f.answer.substring(7))),f.answer=parseInt(f.answer.split(",")[0].replace("[",""))||0);f.name_str=f.name;f.name.match(/^\[.*\]?/)?f.name=f.parser.parse(f.name.substring(1,f.name.length-1)):f.name=f.parser.parse("'"+
f.name+"'");f.evaluator.setFunction(f.id+".setOptions",g);f.containerControl=a.newHTML("div",{class:"DescartesMenuContainer",id:f.id});f.label=a.newHTML("canvas",{class:"DescartesMenuLabel"});f.label_ctx=f.label.getContext("2d");f.ratio=b.ratio;f.select=a.newHTML("select",{id:f.id+"_menuSelect",class:"DescartesMenuSelect",tabindex:f.tabindex});f.field=a.newHTML("input",{type:"text",id:f.id+"_menuField",class:"DescartesMenuField",tabindex:f.tabindex});g(f.options);f.containerControl.appendChild(f.label);
f.containerControl.appendChild(f.select);f.visible&&f.containerControl.appendChild(f.field);f.cover=a.newHTML("div",{class:"TextfieldCover"});f.keyboard&&f.visible&&f.containerControl.appendChild(f.cover);f.addControlContainer(f.containerControl);f.addEvents();f.init();return k};$jscomp.inherits(u,a.Control);u.prototype.init=function(b){d=this.evaluator;this.label.innerHTML=d.eval(this.name).toString();var c=this.label.textContent;this.fieldFontSize=0<d.eval(this.font_size)?d.eval(this.font_size):
a.getFieldFontSize(this.h);this.text_object=new a.TextObject({parent:{decimal_symbol:this.parent.decimal_symbol},evaluator:this.evaluator,decimals:this.decimals,fixed:!1,align:"left",anchor:"center_center",width:this.parser.parse("0"),font_size:this.parser.parse(""+this.fieldFontSize),font_family:this.font_family,italics:this.italics,bold:this.bold},this.name_str);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0,!0);var g=0,k=0;this.value=b?this.value:d.eval(this.valueExpr);
this.indexValue=this.getIndex(this.value);for(var e=0,f=this.menuOptions.length;e<f;e++)b=a.getTextWidth(d.eval(this.menuOptions[e]).toString(),this.fieldFontSize+"px "+a.sansserif_font),b>g&&(g=b,k=e);g+=25;b=a.getTextWidth(this.formatOutputValue(d.eval(this.strValue[k])),this.fieldFontSize+"px "+a.sansserif_font)+7;k=this.text_object.textNodes.metrics.w+parseInt(this.fieldFontSize);""==c&&(k=0);this.visible||(b=0);for(c=this.w-b-k;c<g&&0<k;)k--,c++;for(;c<g&&0<b;)b--,c++;for(;k+c+b+1<this.w;)c++,
b++;g=k;e=g+c;b=this.w-e;f=this.formatOutputValue(d.eval(this.strValue[this.indexValue]));this.containerControl.setAttribute("style","width:"+this.w+"px;height:"+this.h+"px;left:"+this.x+"px;top:"+this.y+"px;z-index:"+this.zIndex+";");this.label.setAttribute("style","font-size:"+this.fieldFontSize+"px;width:"+k+"px;height:"+this.h+"px;line-height:"+this.h+"px;background-color:"+this.label_color.getColor()+";color:"+this.label_text_color.getColor()+";");this.label.width=k*this.ratio;this.label.height=
this.h*this.ratio;this.field.value=f;this.field.setAttribute("style","font-size:"+this.fieldFontSize+"px;width:"+b+"px;height:"+this.h+"px;left:"+e+"px;");this.cover.setAttribute("style","width:"+b+"px;height:"+this.h+"px;left:"+e+"px;");this.select.setAttribute("style","text-align:left;font-size:"+this.fieldFontSize+"px;width:"+c+"px;height:"+this.h+"px;left:"+g+"px;");this.select.selectedIndex=this.indexValue;d.setVariable(this.id,parseFloat(f.replace(this.parent.decimal_symbol,".")));this.update()};
u.prototype.update=function(){d=this.evaluator;this.activeIfValue=0<d.eval(this.activeif);this.drawIfValue=0<d.eval(this.drawif);this.field.disabled=this.activeIfValue?!1:!0;this.select.disabled=this.activeIfValue?!1:!0;this.drawIfValue?this.containerControl.style.display="block":(this.click=!1,this.containerControl.style.display="none");if(!this.parent.animation.playing||document.activeElement!=this.select){for(var a=0,b=this.menuOptions.length;a<b;a++)this.select.options[a].innerHTML=(d.eval(this.menuOptions[a])||
"").replace(/\\u002C/g,",");this.value=d.getVariable(this.id);isNaN(this.value)&&(this.value=0);this.field.value=this.formatOutputValue(this.value);d.setVariable(this.id,parseFloat(this.value));this.select.selectedIndex=parseFloat(this.getIndex(this.value))}this.ok=this.value==this.answer?1:0;this.evaluator.setVariable(this.id+".ok",this.ok);this.updatePositionAndSize();this.label_ctx.setTransform(this.ratio,0,0,this.ratio,0,0);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),
0,0);this.label_ctx.clearRect(0,0,this.label.width,this.label.height);!(v=this.label_color.getColor())||"CanvasGradient"!==v.constructor.name&&"CanvasPattern"!==v.constructor.name||(this.label_ctx.fillStyle=v,this.label_ctx.fillRect(0,0,this.label_ctx.canvas.width,this.label_ctx.canvas.height));this.text_object.textNodes.metrics.w>this.label.width/this.ratio?(this.text_object.anchor="center_left",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),5,this.label.height/this.ratio/
2)):(this.text_object.anchor="center_center",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),this.label.width/this.ratio/2,this.label.height/this.ratio/2));this.label_ctx.setTransform(1,0,0,1,0,0)};u.prototype.customSplit=function(a){h=!1;l="";c=0;for(k=-1;c<a.length;){g=a.charAt(c);if("["===g&&-1===k){if(h||""!=l)l+="\u00a6";k++}else"["===g?k++:"]"===g&&0===k?(h=!0,k--):"]"==a.charAt(c)&&(k=0>k?k:k-1);l+=a.charAt(c);c++}return l.split("\u00a6")};u.prototype.getIndex=function(a){a=
parseFloat(a.toString().replace(this.parent.decimal_symbol,"."));r=-1;n=Infinity;for(var c=0,d=this.strValue.length;c<d;c++)b=f(a-parseFloat(this.evaluator.eval(this.strValue[c]))),b<=n&&(n=b,r=c);return r};u.prototype.changeValue=function(a,b){this.activeIfValue&&(b&&(this.indexValue=this.getIndex(a),this.value=this.evaluator.eval(this.strValue[this.indexValue]),this.field.value=this.formatOutputValue(this.indexValue),this.select.selectedIndex=this.indexValue),this.evaluator.setVariable(this.id,
this.value),this.updateAndExecAction())};u.prototype.addEvents=function(){var b=this;b.select.oncontextmenu=b.label.oncontextmenu=b.field.oncontextmenu=b.cover.oncontextmenu=function(){return!1};b.label.addEventListener("touchstart",a.preventDefault);b.label.addEventListener("mousedown",a.preventDefault);b.select.addEventListener("change",function(a){b.value=b.evaluator.eval(b.strValue[this.selectedIndex]);b.field.value=b.formatOutputValue(b.value);b.evaluator.setVariable(b.id,b.field.value);b.changeValue();
a.preventDefault()});b.field.addEventListener("keydown",function(a){13==a.keyCode&&(b.indexValue=b.getIndex(b.field.value),b.value=b.evaluator.eval(b.strValue[b.indexValue]),b.field.value=b.formatOutputValue(b.indexValue),b.select.selectedIndex=b.indexValue,b.changeValue())});b.field.addEventListener("blur",function(a){b.drawIfValue&&b.changeValue(b.field.value,!0)});b.field.addEventListener("click",function(a){b.field.focus()});b.cover.addEventListener("click",function(a){a=b.evaluator.eval(b.kbexp);
b.activeIfValue&&b.parent.keyboard.show(b,b.kblayout,a[0][0]||0,a[0][1]||0,b.id,b.field,b.onlyText)})};a.Menu=u;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=Math.floor,e,d,r,n,b,h,l,c,k,g,v,u,p,z,q,m,y,w,x=function(b,c){c=a.Control.call(this,b,c)||this;c.label_color=c.label_color||new a.Color("e0e4e8",b.evaluator);c.label_text_color=c.label_text_color||new a.Color("000000",b.evaluator);c.name_str=c.name;c.name.match(/^\[.*\]?/)?c.name=c.parser.parse(c.name.substring(1,c.name.length-1)):c.name=c.parser.parse("'"+c.name+"'");c.orientation=c.w>=c.h?"h":"v";c.container=a.newHTML("div",{class:"DescartesScrollbarContainer",
id:c.id});c.canvas=a.newHTML("canvas");c.divUp=a.newHTML("div",{class:"DescartesCatcher up"});c.divDown=a.newHTML("div",{class:"DescartesCatcher down"});c.field=a.newHTML("input",{type:"text",id:c.id+"scrollbar",class:"DescartesScrollbarField"});c.scrollHandler=a.newHTML("div",{class:"DescartesCatcher manipulator"});c.label=a.newHTML("canvas",{class:"DescartesScrollbarLabel"});c.label_ctx=c.label.getContext("2d");c.ratio=b.ratio;c.container.appendChild(c.canvas);c.container.appendChild(c.label);c.container.appendChild(c.divUp);
c.container.appendChild(c.divDown);c.container.appendChild(c.field);c.container.appendChild(c.scrollHandler);c.cover=a.newHTML("div",{class:"TextfieldCover"});c.keyboard&&c.visible&&c.container.appendChild(c.cover);c.addControlContainer(c.container);c.addEvents();c.init();return c};$jscomp.inherits(x,a.Control);x.prototype.init=function(){e=this.evaluator;0==e.eval(this.decimals)?this.incr=1:this.incr=(e.eval(this.max)-e.eval(this.min))/100;this.value=this.validateValue(e.eval(this.valueExpr));r=
this.formatOutputValue(this.value);n=this.evaluator.eval(this.expresion);this.x=n[0][0];this.y=n[0][1];4==n[0].length&&(this.w=n[0][2],this.h=n[0][3]);this.orientation=this.w>=this.h?"h":"v";this.initScroll(r);this.changeScrollPositionFromValue();this.prePos=this.pos;e.setVariable(this.id,this.value)};x.prototype.initScroll=function(b){d=this;e=d.evaluator;d.label.innerHTML=e.eval(d.name).toString();y=d.label.textContent;var c="v"===d.orientation?parseInt(19+5*(d.h-100)/100):d.h;d.fieldFontSize=0<
e.eval(d.font_size)?e.eval(d.font_size):"v"===d.orientation?c-parseInt(d.h/20)-1:a.getFieldFontSize(c);this.text_object=new a.TextObject({parent:{decimal_symbol:this.parent.decimal_symbol},evaluator:this.evaluator,decimals:this.decimals,fixed:!1,align:"left",anchor:"center_center",width:this.parser.parse("0"),font_size:this.parser.parse(""+this.fieldFontSize),font_family:this.font_family,italics:this.italics,bold:this.bold},d.name_str);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),
0,0,!0);b=a.getTextWidth(b+"_",d.fieldFontSize+"px "+a.sansserif_font);var g=d.parent.getSpaceById(d.spaceID).h;d.labelHeight=""==y?0:c;d.fieldHeight=""==d.visible?0:c;if("v"===d.orientation)d.canvasWidth=d.w,d.canvasHeight=d.h-d.labelHeight-d.fieldHeight,18<=d.canvasHeight+d.y-g&&(d.canvasHeight=g),c=d.fieldHeight,b=c+d.canvasHeight,d.canvasX=0,d.canvasY=d.fieldHeight,d.labelWidth=d.w,d.labelY=b,d.upWidth=d.downW=d.w,d.upHeight=d.downH=d.w,d.upX=0,d.upY=d.fieldHeight,d.downX=0,d.downY=b-d.downH,
d.fieldWidth=d.w,d.fieldX=0,d.scrollHandlerW=d.w,d.scrollHandlerH=parseInt((d.canvasHeight-d.upHeight-d.downH-d.labelHeight-d.fieldHeight)/10),d.scrollHandlerH=d.canvasHeight-d.upHeight-d.downH-d.labelHeight-d.fieldHeight>2*d.w?d.w:d.scrollHandlerH,d.scrollHandlerH=15>d.scrollHandlerH?15:d.scrollHandlerH,d.limInf=b-d.downH-d.scrollHandlerH,d.limSup=c+d.downH;else{c=this.text_object.textNodes.metrics.w+parseInt(this.fieldFontSize);d.labelWidth=c;d.fieldWidth=b;""==y&&(d.labelWidth=0);d.visible||(d.fieldWidth=
0);for(b=d.w-d.fieldWidth-d.labelWidth;58>b&&0<d.labelWidth;)d.labelWidth--,b++;for(;58>b&&0<d.fieldWidth;)d.fieldWidth--,b++;c=d.labelWidth;g=c+b;d.fieldWidth=d.w-g;d.canvasWidth=b;d.canvasHeight=d.h;d.canvasX=d.labelWidth;d.canvasY=0;d.fieldX=d.canvasWidth+d.labelWidth;d.labelHeight=d.h;d.labelY=0;d.upWidth=d.downW=d.h;d.upHeight=d.downH=d.h;d.upX=g-d.downW;d.upY=0;d.downX=d.labelWidth;d.downY=0;d.scrollHandlerW=parseInt((d.canvasWidth-d.upWidth-d.downW)/10);d.scrollHandlerW=d.canvasWidth-d.upWidth-
d.downW>2*d.h?d.h:d.scrollHandlerW;d.scrollHandlerW=15>d.scrollHandlerW?15:d.scrollHandlerW;d.scrollHandlerH=d.h;d.limInf=c+d.downW;d.limSup=c+d.canvasWidth-d.downW-d.scrollHandlerW}d.container.setAttribute("style","width:"+d.w+"px;height:"+d.h+"px;left:"+d.x+"px;top:"+d.y+"px;z-index:"+d.zIndex+";");d.canvas.setAttribute("width",d.w+"px");d.canvas.setAttribute("height",d.h+"px");d.canvas.setAttribute("style","position:absolute;left:0;top:0;");d.ctx=d.canvas.getContext("2d");d.ctx.imageSmoothingEnabled=
!1;d.divUp.setAttribute("style","width:"+d.upWidth+"px;height:"+d.upHeight+"px;left:"+d.upX+"px;top:"+d.upY+"px;");d.divDown.setAttribute("style","width:"+d.downW+"px;height:"+d.downH+"px;left:"+d.downX+"px;top:"+d.downY+"px;");d.scrollHandler.setAttribute("style","width:"+d.scrollHandlerW+"px;height:"+d.scrollHandlerH+"px;left:"+("v"===d.orientation?0:d.limInf)+"px;top:"+("v"===d.orientation?d.limInf:0)+"px;");d.field.setAttribute("style","font-size:"+d.fieldFontSize+"px;width:"+d.fieldWidth+"px;height:"+
d.fieldHeight+"px;left:"+d.fieldX+"px;top:0;");d.cover.setAttribute("style","width:"+d.fieldWidth+"px;height:"+d.fieldHeight+"px;left:"+d.fieldX+"px;top:0;");0===d.fieldHeight&&(d.field.style.display="none");d.label.setAttribute("style","font-size:"+d.fieldFontSize+"px;width:"+d.labelWidth+"px;height:"+d.labelHeight+"px;line-height:"+d.labelHeight+"px;left:0;top:"+d.labelY+"px;background-color:"+this.label_color.getColor()+";color:"+this.label_text_color.getColor()+";");this.label.width=d.labelWidth*
this.ratio;this.label.height=d.labelHeight*this.ratio};x.prototype.update=function(){e=this.evaluator;0==e.eval(this.decimals)?this.incr=1:this.incr=(e.eval(this.max)-e.eval(this.min))/100;this.activeIfValue=0<e.eval(this.activeif);this.drawIfValue=0<e.eval(this.drawif);this.field.disabled=!this.activeIfValue;this.drawIfValue?(this.container.style.display="block",this.draw()):this.container.style.display="none";this.updatePositionAndSize();var a=this.validateValue(e.getVariable(this.id));a==this.value||
0<Math.abs(a-this.value)&&1E-9>Math.abs(a-this.value)||(this.value=a,this.changeScrollPositionFromValue(),this.prePos=this.pos);this.value=a;this.field.value=this.formatOutputValue(this.value);e.setVariable(this.id,this.value);this.label_ctx.setTransform(this.ratio,0,0,this.ratio,0,0);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0);this.label_ctx.clearRect(0,0,this.label.width,this.label.height);!(w=this.label_color.getColor())||"CanvasGradient"!==w.constructor.name&&"CanvasPattern"!==
w.constructor.name||(this.label_ctx.fillStyle=w,this.label_ctx.fillRect(0,0,this.label_ctx.canvas.width,this.label_ctx.canvas.height));this.text_object.textNodes.metrics.w>this.label.width/this.ratio?(this.text_object.anchor="center_left",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),5,this.label.height/this.ratio/2)):(this.text_object.anchor="center_center",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),this.label.width/this.ratio/2,this.label.height/
this.ratio/2));this.label_ctx.setTransform(1,0,0,1,0,0)};x.prototype.draw=function(){d=this;b=d.ctx;l=f(this.w);h=f(this.h);b.fillStyle=this.color.getColor();b.fillRect(0,0,l,h);b.fillStyle="black";b.beginPath();"h"===d.orientation?(b.lineWidth=1,b.strokeStyle="rgba(0,0,0,0.3)",b.strokeRect(parseInt(d.labelWidth)+.5,.5,l-1-parseInt(d.labelWidth),h-1),b.lineWidth=Math.ceil(12*d.upWidth/100)||1,b.strokeStyle=d.colorInt.getColor(),b.moveTo(d.downX+62.215*d.upWidth/100,20*d.downH/100),b.lineTo(d.downX+
32.449*d.upWidth/100,d.downH/2),b.lineTo(d.downX+62.215*d.upWidth/100,80*d.downH/100),b.moveTo(d.upX+32.449*d.upWidth/100,20*d.downH/100),b.lineTo(d.upX+62.215*d.upWidth/100,d.downH/2),b.lineTo(d.upX+32.449*d.upWidth/100,80*d.downH/100),b.stroke(),k=f(d.pos),c=Math.ceil(h/10)||1,b.fillStyle=this.colorInt.getColor(),b.fillRect(k+.5,c,f(d.scrollHandlerW),h-2*c)):(b.lineWidth=1,b.strokeStyle="rgba(0,0,0,0.3)",b.strokeRect(.5,.5,l-1,h-parseInt(d.labelHeight)-.5),b.lineWidth=Math.ceil(12*d.upWidth/100)||
1,b.strokeStyle=d.colorInt.getColor(),b.moveTo(20*d.upWidth/100,d.h-d.labelHeight-70*d.downH/100),b.lineTo(50*d.upWidth/100,d.h-d.labelHeight-40.237*d.downH/100),b.lineTo(80*d.upWidth/100,d.h-d.labelHeight-70*d.downH/100),b.moveTo(20*d.upWidth/100,d.upY+70*d.downH/100),b.lineTo(50*d.upWidth/100,d.upY+40.237*d.downH/100),b.lineTo(80*d.upWidth/100,d.upY+70*d.downH/100),b.stroke(),k=f(d.pos),c=Math.ceil(l/10)||1,b.fillStyle=this.colorInt.getColor(),b.fillRect(c,k+.5,l-2*c,f(d.scrollHandlerH)));d.activeIfValue||
(b.fillStyle="rgba(255,255,255,0.5)",b.fillRect(0,0,b.canvas.width,b.canvas.height))};x.prototype.validateValue=function(a){e=this.evaluator;g=a.toString();g=parseFloat(g.replace(this.parent.decimal_symbol,"."));isNaN(g)&&(g=0);this.minimo=e.eval(this.min);g<this.minimo&&(this.value=null,g=this.minimo);this.maximo=e.eval(this.max);g>this.maximo&&(this.value=null,g=this.maximo);v=this.incr;g=0!=v?g*v/v:0;this.fixed&&(g=parseFloat(parseFloat(g).toFixed(e.eval(this.decimals))));return g};x.prototype.increase=
function(){this.changeValue(parseFloat(this.value)+this.incr)};x.prototype.decrease=function(){this.changeValue(parseFloat(this.value)-this.incr)};x.prototype.increase10=function(){c=(this.evaluator.eval(this.max)-this.evaluator.eval(this.min))/10;"h"==this.orientation?this.clickPos.x>this.prePos&&this.changeValue(parseFloat(this.value)+c):this.clickPos.y<this.prePos&&this.changeValue(parseFloat(this.value)+c)};x.prototype.decrease10=function(){c=(this.evaluator.eval(this.max)-this.evaluator.eval(this.min))/
10;"h"==this.orientation?this.clickPos.x<this.prePos&&this.changeValue(parseFloat(this.value)-c):this.clickPos.y>this.prePos&&this.changeValue(parseFloat(this.value)-c)};x.prototype.changeValue=function(a){this.activeIfValue&&(u=this.validateValue(a),u!=this.value&&(this.value=u,this.field.value=this.formatOutputValue(u),this.changeScrollPositionFromValue(),this.prePos=this.pos,this.evaluator.setVariable(this.id,this.value)),this.updateAndExecAction())};x.prototype.changeValueForScrollMovement=function(){e=
this.evaluator;p=this.limInf;z=this.limSup;q=e.eval(this.min);m=e.eval(this.max);v=this.incr;u=f((this.pos-p)*(m-q)/(z-p)/v)*v+q;u!=this.value&&(this.value=u,this.field.value=this.formatOutputValue(u),e.setVariable(this.id,this.value),this.parent.updateControls(),this.actionExec.execute(),this.parent.update())};x.prototype.changeScrollPositionFromValue=function(){e=this.evaluator;p=this.limInf;z=this.limSup;q=e.eval(this.min);m=e.eval(this.max);v=this.incr;this.pos=(this.value-q)*(z-p)/(m-q)+p;this.scrollHandler.style["h"==
this.orientation?"left":"top"]=this.pos+"px"};x.prototype.addEvents=function(){function b(c,d,g,k){a.clearTimeout(q);(p.up||p.down||p.canvasClick)&&1E-7<Math.abs(p.value-k)&&(d.call(p),c=g?c:30,q=a.setTimeout(function(){b(c,d,!1,k)},c))}function c(c){c.preventDefault();p.whichBtn=a.whichBtn(c);"L"==p.whichBtn&&p.activeIfValue&&(p.clickPos=a.getCursorPosition(c,p.container),p.canvasClick=!0,"h"==p.orientation?p.clickPos.x<p.prePos?b(350,p.decrease10,!0,p.minimo):b(350,p.increase10,!0,p.maximo):p.clickPos.y<
p.prePos?b(350,p.increase10,!0,p.maximo):b(350,p.decrease10,!0,p.minimo))}function d(b){p.canvasClick=!1;a.clearTimeout(q)}function g(b){1==p.canvasClick&&(p.clickPos=a.getCursorPosition(b,p.container),b.preventDefault())}function k(a){p.scrollClick=!1;p.prePos=p.pos;window.removeEventListener("mouseup",k,!1);window.removeEventListener("mousemove",f,!1);a.preventDefault()}function e(a){p.scrollClick=!1;p.prePos=p.pos;window.removeEventListener("touchend",e,!1);window.removeEventListener("touchmove",
f,!1);a.preventDefault()}function f(b){var c=a.getCursorPosition(b,p.container);"h"==p.orientation?(p.pos=p.prePos-(p.initPos.x-c.x),p.pos<p.limInf&&(p.pos=p.limInf),p.pos>p.limSup&&(p.pos=p.limSup),p.scrollHandler.setAttribute("style","width:"+p.scrollHandlerW+"px;height:"+p.h+"px;left:"+p.pos+"px;top:0;")):(p.pos=p.prePos-(p.initPos.y-c.y),p.pos>p.limInf&&(p.pos=p.limInf),p.pos<p.limSup&&(p.pos=p.limSup),p.scrollHandler.setAttribute("style","width:"+p.w+"px;height:"+p.scrollHandlerH+"px;left:0;top:"+
p.pos+"px;"));p.changeValueForScrollMovement();b.preventDefault()}function m(c){c.preventDefault();p.whichBtn=a.whichBtn(c);"L"==p.whichBtn&&p.activeIfValue&&(p.up=!0,b(350,p.increase,!0,p.maximo))}function h(c){c.preventDefault();p.whichBtn=a.whichBtn(c);"L"==p.whichBtn&&p.activeIfValue&&(p.down=!0,b(350,p.decrease,!0,p.minimo))}function l(b){p.down=!1;a.clearTimeout(q);b.preventDefault()}function u(b){p.up=!1;a.clearTimeout(q);p.draw()}function n(b){p.down=!1;a.clearTimeout(q);p.draw()}var p=this,
q;p.canvas.oncontextmenu=p.divUp.oncontextmenu=p.divDown.oncontextmenu=p.label.oncontextmenu=p.field.oncontextmenu=p.scrollHandler.oncontextmenu=p.cover.oncontextmenu=function(){return!1};this.field.addEventListener("keydown",function(a){13==a.keyCode&&p.changeValue(p.field.value)});this.field.addEventListener("blur",function(a){p.drawIfValue&&p.changeValue(p.field.value,!0)});this.canvas.addEventListener("touchstart",c);this.canvas.addEventListener("mousedown",c);this.divDown.addEventListener("mouseout",
l);window.addEventListener("touchend",d);window.addEventListener("mouseup",d);this.canvas.addEventListener("touchmove",g);this.canvas.addEventListener("mousemove",g);this.scrollHandler.addEventListener("touchstart",function(b){p.activeIfValue&&(p.scrollClick=!0,p.initPos=a.getCursorPosition(b,p.container),window.addEventListener("touchend",e),window.addEventListener("touchmove",f),b.preventDefault())});this.scrollHandler.addEventListener("mousedown",function(b){p.activeIfValue&&(p.scrollClick=!0,
p.initPos=a.getCursorPosition(b,p.container),window.addEventListener("mouseup",k),window.addEventListener("mousemove",f),b.preventDefault())});this.divUp.addEventListener("touchstart",m);this.divUp.addEventListener("mousedown",m);this.divDown.addEventListener("touchstart",h);this.divDown.addEventListener("mousedown",h);this.divUp.addEventListener("mouseout",function(b){p.up=!1;a.clearTimeout(q);b.preventDefault()});this.divDown.addEventListener("mouseout",l);window.addEventListener("touchend",u);
window.addEventListener("mouseup",u);window.addEventListener("touchend",n);window.addEventListener("mouseup",n);p.cover.addEventListener("click",function(a){a=p.evaluator.eval(p.kbexp);p.activeIfValue&&p.parent.keyboard.show(p,p.kblayout,a[0][0]||0,a[0][1]||0,p.id,p.field,p.onlyText)})};a.Scrollbar=x;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=Math.floor,e,d,r,n,b,h,l,c,k,g,v,u=function(b,c){c=a.Control.call(this,b,c)||this;c.label_color=c.label_color||new a.Color("e0e4e8",b.evaluator);c.label_text_color=c.label_text_color||new a.Color("000000",b.evaluator);c.name_str=c.name;c.name.match(/^\[.*\]?/)?c.name=c.parser.parse(c.name.substring(1,c.name.length-1)):c.name=c.parser.parse("'"+c.name+"'");c.orientation=c.w>=c.h?"h":"v";c.container=a.newHTML("div",{class:"DescartesSliderContainer",
id:c.id});c.field=a.newHTML("input",{type:"text",id:c.id+"slider",class:"DescartesSliderField"});c.sliderCtr=a.newHTML("input",{type:"range",id:c.id+"range",min:0,max:100,step:"any",class:"DescartesRange"});c.label=a.newHTML("canvas",{class:"DescartesSliderLabel"});c.label_ctx=c.label.getContext("2d");c.ratio=b.ratio;c.container.appendChild(c.label);c.container.appendChild(c.field);c.container.appendChild(c.sliderCtr);c.cover=a.newHTML("div",{class:"TextfieldCover"});c.keyboard&&c.visible&&c.container.appendChild(c.cover);
c.addControlContainer(c.container);c.addEvents();c.init();return c};$jscomp.inherits(u,a.Control);u.prototype.init=function(){e=this.evaluator;this.value=this.validateValue(e.eval(this.valueExpr));r=this.formatOutputValue(this.value);n=this.evaluator.eval(this.expresion);this.x=n[0][0];this.y=n[0][1];4==n[0].length&&(this.w=n[0][2],this.h=n[0][3]);this.orientation=this.w>=this.h?"h":"v";this.initSlider(r);this.changeSliderPositionFromValue();this.prePos=this.pos;e.setVariable(this.id,this.value)};
u.prototype.initSlider=function(b){d=this;e=d.evaluator;d.label.innerHTML=e.eval(d.name).toString();g=d.label.textContent;var c="v"===d.orientation?parseInt(19+5*(d.h-100)/100):d.h;d.fieldFontSize=0<e.eval(d.font_size)?e.eval(d.font_size):"v"===d.orientation?c-parseInt(d.h/20)-1:a.getFieldFontSize(c);this.text_object=new a.TextObject({parent:{decimal_symbol:this.parent.decimal_symbol},evaluator:this.evaluator,decimals:this.decimals,fixed:!1,align:"left",anchor:"center_center",width:this.parser.parse("0"),
font_size:this.parser.parse(""+this.fieldFontSize),font_family:this.font_family,italics:this.italics,bold:this.bold},d.name_str);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0,!0);b=a.getTextWidth(b+"_",d.fieldFontSize+"px "+a.sansserif_font);var k=d.parent.getSpaceById(d.spaceID).h;d.labelHeight=""==g?0:c;d.fieldHeight=""==d.visible?0:c;if("v"===d.orientation)d.canvasWidth=d.w,d.canvasHeight=d.h-d.labelHeight-d.fieldHeight,18<=d.canvasHeight+d.y-k&&(d.canvasHeight=k),c=
d.fieldHeight+d.canvasHeight,d.canvasX=0,d.canvasY=d.fieldHeight,d.labelWidth=d.w,d.labelY=c,d.upWidth=d.downW=d.w,d.upHeight=d.downH=d.w,d.fieldWidth=d.w,d.fieldX=0,d.sliderCtr.style="position:absolute;left:0;top:"+d.canvasY+"px;width:"+d.canvasHeight+"px;height:"+d.canvasWidth+"px;transform-origin:"+d.canvasWidth/2+"px "+d.canvasWidth/2+"px;transform:rotate(90deg);margin:0;padding:0;--thumb_size:"+d.canvasWidth+"px;--track_h:"+parseInt(d.canvasWidth/3)+"px;";else{c=this.text_object.textNodes.metrics.w+
parseInt(this.fieldFontSize);d.labelWidth=c;d.fieldWidth=b;""==g&&(d.labelWidth=0);d.visible||(d.fieldWidth=0);for(b=d.w-d.fieldWidth-d.labelWidth;58>b&&0<d.labelWidth;)d.labelWidth--,b++;for(;58>b&&0<d.fieldWidth;)d.fieldWidth--,b++;c=d.labelWidth;d.fieldWidth=d.w-(c+b);d.canvasWidth=b;d.canvasHeight=d.h;d.canvasX=d.labelWidth;d.canvasY=0;d.fieldX=d.canvasWidth+d.labelWidth;d.labelHeight=d.h;d.labelY=0;d.upWidth=d.downW=d.h;d.upHeight=d.downH=d.h;d.sliderCtr.style="position:absolute;left:"+d.canvasX+
"px;top:0;width:"+d.canvasWidth+"px;height:"+d.canvasHeight+"px;margin:0;padding:0;--thumb_size:"+d.canvasHeight+"px;--track_h:"+parseInt(d.canvasHeight/3)+"px;"}d.container.setAttribute("style","width:"+d.w+"px;height:"+d.h+"px;left:"+d.x+"px;top:"+d.y+"px;z-index:"+d.zIndex+";");d.field.setAttribute("style","font-size:"+d.fieldFontSize+"px;width:"+d.fieldWidth+"px;height:"+d.fieldHeight+"px;left:"+d.fieldX+"px;top:0;");d.cover.setAttribute("style","width:"+d.fieldWidth+"px;height:"+d.fieldHeight+
"px;left:"+d.fieldX+"px;top:0;");0===d.fieldHeight&&(d.field.style.display="none");d.label.setAttribute("style","font-size:"+d.fieldFontSize+"px;width:"+d.labelWidth+"px;height:"+d.labelHeight+"px;line-height:"+d.labelHeight+"px;left:0;top:"+d.labelY+"px;background-color:"+this.label_color.getColor()+";color:"+this.label_text_color.getColor()+";");this.label.width=d.labelWidth*this.ratio;this.label.height=d.labelHeight*this.ratio};u.prototype.update=function(){e=this.evaluator;this.activeIfValue=
0<e.eval(this.activeif);this.drawIfValue=0<e.eval(this.drawif);this.field.disabled=!this.activeIfValue;this.drawIfValue?(this.container.style.display="block",this.draw()):this.container.style.display="none";this.updatePositionAndSize();var a=this.validateValue(e.getVariable(this.id));a==this.value||0<Math.abs(a-this.value)&&1E-9>Math.abs(a-this.value)||(this.value=a,this.changeSliderPositionFromValue(),this.prePos=this.pos);this.value=a;this.field.value=this.formatOutputValue(this.value);e.setVariable(this.id,
this.value);this.label_ctx.setTransform(this.ratio,0,0,this.ratio,0,0);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0);this.label_ctx.clearRect(0,0,this.label.width,this.label.height);!(v=this.label_color.getColor())||"CanvasGradient"!==v.constructor.name&&"CanvasPattern"!==v.constructor.name||(this.label_ctx.fillStyle=v,this.label_ctx.fillRect(0,0,this.label_ctx.canvas.width,this.label_ctx.canvas.height));this.text_object.textNodes.metrics.w>this.label.width/this.ratio?
(this.text_object.anchor="center_left",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),5,this.label.height/this.ratio/2)):(this.text_object.anchor="center_center",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),this.label.width/this.ratio/2,this.label.height/this.ratio/2));this.label_ctx.setTransform(1,0,0,1,0,0)};u.prototype.draw=function(){d=this;this.sliderCtr.style.setProperty("--track_color",this.color.getColor());this.sliderCtr.style.setProperty("--thumb_color",
this.colorInt.getColor());this.sliderCtr.value=this.pos};u.prototype.validateValue=function(a){e=this.evaluator;b=a.toString();b=parseFloat(b.replace(this.parent.decimal_symbol,"."));isNaN(b)&&(b=0);this.minimo=e.eval(this.min);b<this.minimo&&(this.value=null,b=this.minimo);this.maximo=e.eval(this.max);b>this.maximo&&(this.value=null,b=this.maximo);h=e.eval(this.incr);b=0!=h?b*h/h:0;this.fixed&&(b=parseFloat(parseFloat(b).toFixed(e.eval(this.decimals))));return b};u.prototype.changeValue=function(a){this.activeIfValue&&
(l=this.validateValue(a),l!=this.value&&(this.value=l,this.field.value=this.formatOutputValue(l),this.changeSliderPositionFromValue(),this.prePos=this.pos,this.evaluator.setVariable(this.id,this.value)),this.updateAndExecAction())};u.prototype.changeValueForSliderMovement=function(){e=this.evaluator;c=e.eval(this.min);k=e.eval(this.max);h=e.eval(this.incr);l=f(this.pos*(k-c)/100/h)*h+c;l!=this.value&&(this.value=l,this.field.value=this.formatOutputValue(l),e.setVariable(this.id,this.value),this.parent.updateControls(),
this.actionExec.execute(),this.parent.update())};u.prototype.changeSliderPositionFromValue=function(){e=this.evaluator;c=e.eval(this.min);k=e.eval(this.max);h=e.eval(this.incr);this.pos=100*(this.value-c)/(k-c)};u.prototype.addEvents=function(){var a=this;a.label.oncontextmenu=a.field.oncontextmenu=a.cover.oncontextmenu=function(){return!1};this.field.addEventListener("keydown",function(b){13==b.keyCode&&a.changeValue(a.field.value)});this.field.addEventListener("blur",function(b){a.drawIfValue&&
a.changeValue(a.field.value,!0)});a.cover.addEventListener("click",function(b){b=a.evaluator.eval(a.kbexp);a.activeIfValue&&a.parent.keyboard.show(a,a.kblayout,b[0][0]||0,b[0][1]||0,a.id,a.field,a.onlyText)});a.sliderCtr.addEventListener("input",function(b){a.pos=b.target.value;a.changeValueForSliderMovement()})};a.Slider=u;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,e,d=function(d,e){var b=a.Control.call(this,d,e)||this;b.controls=e.controls||!0;b.file=e.file||"";b.oldDrawIf=0;d=b.evaluator.eval(b.expresion);4==d[0].length?(b.w=d[0][2],b.h=d[0][3]):(b.w=200,b.h=28);b.audio=b.parent.getAudio(b.file);b.oldFile=b.file;"]"===b.file.charAt(b.file.length-1)&&(b.file=b.evaluator.parser.parse(b.file.substring(1,b.file.length-1)));b.autoplay&&(b.audio.setAttribute("autoplay","autoplay"),b.audio.play());b.loop&&b.audio.setAttribute("loop",
"loop");b.controls&&b.audio.setAttribute("controls","controls");b.audio.setAttribute("style","position:absolute;width:"+b.w+"px;left:"+b.x+"px;top:"+b.y+"px;z-index:"+b.zIndex+";");b.addControlContainer(b.audio);b.evaluator.setFunction(b.id+".play",function(){try{b.audio.play()}catch(h){}return 0});b.evaluator.setFunction(b.id+".pause",function(){try{b.audio.pause()}catch(h){}return 0});b.evaluator.setFunction(b.id+".stop",function(){try{b.audio.pause(),b.audio.currentTime=0}catch(h){}return 0});
b.evaluator.setFunction(b.id+".currentTime",function(a){try{b.audio.currentTime=parseFloat(a)}catch(l){}return 0});b.audio.addEventListener("timeupdate",function(){b.evaluator.setVariable(b.id+".currentTime",b.audio.currentTime);b.evaluator.setVariable(b.id+".playing",b.audio.paused?0:1);b.evaluator.setVariable(b.id+".duration",b.audio.duration)});return b};$jscomp.inherits(d,a.Control);d.prototype.init=function(){this.audio.style.left=this.x+"px";this.audio.style.top=this.y+"px";this.update()};d.prototype.update=
function(){f=this.evaluator;"string"!==typeof this.file&&(this.tmpFile=f.eval(this.file),this.oldFile!==this.tmpFile&&(this.oldFile=this.audio.src=this.tmpFile));(e=0<f.eval(this.drawif))?this.audio.style.display="block":(this.audio.style.display="none",e!==this.oldDrawIf&&this.audio.pause());this.oldDrawIf=e;this.updatePositionAndSize()};a.Audio=d;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,e,d=function(d,e){var b=a.Control.call(this,d,e)||this;b.controls=e.controls||!0;b.file=e.file||"";b.oldDrawIf=0;f=b.evaluator;d=f.eval(b.expresion);4==d[0].length?(b.w=d[0][2],b.h=d[0][3]):(b.w=null,b.h=null);d=b.file;e=d.lastIndexOf(".");-1!=e&&(d=b.file.substring(0,e));b.video=a.newHTML("video",{poster:d+".png",style:"position:absolute;overflow:hidden;left:"+b.x+"px;top:"+b.y+"px;outline:none;background:rgba(0,0,0,0);"});b.autoplay&&b.video.setAttribute("autoplay",
"autoplay");b.loop&&b.video.setAttribute("loop","loop");b.controls&&b.video.setAttribute("controls","controls");b.w&&(b.video.setAttribute("width",b.w),b.video.setAttribute("height",b.h));b.video.canPlayType("video/mp4")&&(e=a.newHTML("source",{src:d+".mp4",type:"video/mp4"}),b.video.appendChild(e));b.video.canPlayType("video/ogg")&&(e=a.newHTML("source",{src:d+".ogg",type:"video/ogg"}),b.video.appendChild(e),e=a.newHTML("source",{src:d+".ogv",type:"video/ogg"}),b.video.appendChild(e));b.video.canPlayType("video/webm")&&
(e=a.newHTML("source",{src:d+".webm",type:"video/webm"}),b.video.appendChild(e));b.addControlContainer(b.video);f.setFunction(b.id+".play",function(){try{b.video.play()}catch(h){}return 0});f.setFunction(b.id+".pause",function(){try{b.video.pause()}catch(h){}return 0});f.setFunction(b.id+".stop",function(){try{b.video.pause(),b.video.currentTime=0}catch(h){}return 0});f.setFunction(b.id+".currentTime",function(a){try{b.video.currentTime=parseFloat(a)}catch(l){}return 0});b.video.addEventListener("timeupdate",
function(a){f.setVariable(b.id+".currentTime",b.video.currentTime)});return b};$jscomp.inherits(d,a.Control);d.prototype.init=function(){this.video.style.left=this.x+"px";this.video.style.top=this.y+"px";this.update()};d.prototype.update=function(){f=this.evaluator;(e=0<f.eval(this.drawif))?this.video.style.display="block":(this.video.style.display="none",e!==this.oldDrawIf&&this.video.pause());this.oldDrawIf=e;this.updatePositionAndSize()};a.Video=d;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,e,d,r=function(d,b){var e=a.Control.call(this,d,b)||this;e.font_family=b.font_family||"sansserif";e.style=b.style||",PLAIN,";e.font_size=b.font_size||12;typeof("number"!==e.font_size)&&(e.font_size=e.evaluator.eval(e.font_size));e.font=e.font_family+e.style+e.font_size;e.evaluator.setVariable(e.id+"._scroll_x",0);e.evaluator.setVariable(e.id+"._scroll_y",0);e.region="interior";e.tabindex=++e.parent.tabindex;if(e.answer){e.answer.match("krypto_")&&
(e.answer=(new a.Krypto).decode(e.answer.substring(7)));var f=e.parent.lessonParser.parseText(e.answer)}e.containerControl=a.newHTML("div",{class:"DescartesTextAreaContainer",id:e.id,spellcheck:"false"});e.textArea=a.newHTML("textarea",{class:"DescartesTextAreaContainer",spellcheck:"false"});e.textAreaAnswer=a.newHTML("div",{class:"DescartesTextAreaContainer"});e.showButton=a.newHTML("div",{class:"DJS_Gradient"});e.containerControl.appendChild(e.textArea);e.containerControl.appendChild(e.textAreaAnswer);
e.containerControl.appendChild(e.showButton);e.cover=a.newHTML("div",{class:"TextfieldCover"});e.keyboard&&e.containerControl.appendChild(e.cover);e.addControlContainer(e.containerControl);e.showAnswer=!1;e.text=e.rawText||"";f&&"simpleText"!==f.type&&(e.answer=e.text.hasFormula?"":f.toHTML());e.evaluator.setVariable(e.id,e.text);var c;e.evaluator.setFunction(e.id+".insertAtCursor",function(a){c=e.textArea.selectionStart+a.length;e.textArea.value=e.textArea.value.substring(0,e.textArea.selectionStart)+
a+e.textArea.value.substring(e.textArea.selectionEnd);e.textArea.selectionStart=e.textArea.selectionEnd=c;e.textArea.focus();return 0});e.evaluator.setFunction(e.id+".update",function(){e.update()});e.evaluator.setFunction(e.id+".scrollTo",function(a){e.textArea.scrollTop=a});e.addEvents();e.init();return e};$jscomp.inherits(r,a.Control);r.prototype.init=function(){e=this.answer?28:4;f=this.evaluator;var d=this.text.replace(/\\n/g,"\n");this.containerControl.setAttribute("style","width:"+this.w+"px;height:"+
this.h+"px;left:"+this.x+"px;top:"+this.y+"px;z-index:"+this.zIndex+";");var b="padding:5px;width:"+(this.w-4)+"px;height:"+(this.h-e)+"px;left:2px;top:2px;background-color:white;text-align:left;font:"+a.convertFont(this.font)+";line-height:"+this.font_size+"px;";this.textArea.setAttribute("style",b);this.textArea.value=d;this.textAreaAnswer.setAttribute("style",b+"display:"+(this.showAnswer?"block":"none")+";");this.textAreaAnswer.innerHTML="<span>"+this.answer+"</span>";this.showButton.setAttribute("style",
"width:20px;height:16px;position:absolute;bottom:4px;right:4px;cursor:pointer;border:1px outset #f0f8ff;display:"+(this.answer?"block":"none")+";");this.showButton.innerHTML='<span style="position:relative;top:1px;text-align:center;font:11px '+a.sansserif_font+';">S</span>';this.cover.setAttribute("style","position:absolute;width:"+this.w+"px;height:"+this.h+"px;left:0px;top:0px;");this.update()};r.prototype.update=function(){f=this.evaluator;this.activeIfValue=0<f.eval(this.activeif);this.drawIfValue=
0<f.eval(this.drawif);f.getVariable(this.id)!==this.oldValue&&(this.textArea.value=(f.getVariable(this.id)||"").replace(/\\n/g,"\n"));d=this.textArea.value||"";d="\n"===d.charAt(d.length-1)?d.substring(0,d.length-1):d;d=d.replace(/\n/g,"\\n").replace(/\s/g," ");f.setVariable(this.id,d);this.oldFieldValue=d;this.oldValue=f.getVariable(this.id);this.activeIfValue?this.textArea.removeAttribute("disabled"):this.textArea.setAttribute("disabled",!0);this.containerControl.style.display=this.drawIfValue?
"block":"none";this.textArea.style["overflow-x"]=0<f.getVariable(this.id+"._scroll_x")?"auto":"unset";this.textArea.style["overflow-y"]=0<f.getVariable(this.id+"._scroll_y")?"auto":"unset";this.updatePositionAndSize()};r.prototype.changeValue=function(a){this.textArea.value=a;this.update()};r.prototype.addEvents=function(){function a(a){a.preventDefault()}var b=this;b.cover.oncontextmenu=function(){return!1};b.showButton.addEventListener("mousedown",function(a){a.preventDefault();b.showAnswer=!b.showAnswer;
b.textAreaAnswer.style.display=b.showAnswer?"block":"none";b.showButton.childNodes[0].childNodes[0].textContent=b.showAnswer?"T":"S"});b.showButton.addEventListener("mouseup",a);b.showButton.addEventListener("mouseout",a);b.textArea.addEventListener("blur",function(){var a=window.getSelection();b.cursorInd=a.focusOffset});b.textArea.addEventListener("paste",function(a){a.preventDefault();document.execCommand("insertHTML",!1,a.clipboardData.getData("text/plain").replace(/\n/g,"<br>"))});b.textArea.addEventListener("keydown",
function(a){if("PageDown"===a.key||"PageUp"===a.key)a.stopPropagation(),a.preventDefault()});b.cover.addEventListener("pointerdown",function(a){a=b.evaluator.eval(b.kbexp);b.activeIfValue&&b.parent.keyboard.show(b,b.kblayout,a[0][0]||0,a[0][1]||0,b.id,b.textArea,!0)})};a.TextArea=r;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=2*Math.PI,e,d,r,n,b,h,l,c,k,g,v,u,p=function(b,c){var e=a.Control.call(this,b,c)||this;d=b.evaluator.parser;e.spaceID=c.spaceID||"";e.text=c.text||"";e.size=c.size||d.parse("4");e.font=c.font||"Serif,PLAIN,12";e.image=new Image;e.image.onload=function(){this.ready=1};e.imageSrc=c.imageSrc||"";e.imageSrc.match(/^\[.*\]?/)?e.imageSrc=e.parser.parse(e.imageSrc.substring(1,e.imageSrc.length-1)):e.imageSrc=e.parser.parse("'"+e.imageSrc+"'");e.font=a.convertFont(e.font);
if(e.constraintExpr){e.constraint=d.parse(e.constraintExpr);"(expr)"==e.constraint.type&&(e.constraint=d.parse(e.constraintExpr.substring(1,e.constraintExpr.length-1)));if("compOperator"==e.constraint.type){c=e.constraint.childs[0];var k=e.constraint.childs[1];"identifier"!=c.type||"y"!=c.value||k.contains("y")?"identifier"!=c.type||"x"!=c.value||k.contains("x")?e.newt=new a.R2Newton(e.evaluator,e.constraint):(e.constVar="y",e.noConstVar="x",e.evalConst=e.evalConstXoY,e.constraint=k):(e.constVar=
"x",e.noConstVar="y",e.evalConst=e.evalConstXoY,e.constraint=k)}else e.constraint=null;g=new a.R2(0,0)}e.container=e.getContainer();e.mouseCatcher=a.newHTML("div",{class:"DescartesGraphicControl",id:e.id,dragged:!0,tabindex:"-1",style:"cursor:pointer;background-color:transparent;z-index:"+e.zIndex+";"});e.ctx=e.space.ctx;e.container.appendChild(e.mouseCatcher);e.addEvents();e.xStr=e.id+".x";e.yStr=e.id+".y";e.activoStr=e.id+".activo";e.activeStr=e.id+".active";""!==e.space.id&&2!==b.version?(e.mX=
e.space.id+".mouse_x",e.mY=e.space.id+".mouse_y",e.mClicked=e.space.id+".mouse_clicked",e.mClicIzq=e.space.id+".clic_izquierdo"):(e.mX="mouse_x",e.mY="mouse_y",e.mClicked="mouse_clicked",e.mClicIzq="clic_izquierdo");e.init();return e};$jscomp.inherits(p,a.Control);p.prototype.init=function(b){e=this.evaluator;v=a.hasTouchSupport;b||(b=e.eval(this.expresion),this.x=b[0][0],this.y=b[0][1],e.setVariable(this.xStr,this.x),e.setVariable(this.yStr,this.y));this.img_src_eval=e.eval(this.imageSrc).toString().trim();
""==this.img_src_eval||this.img_src_eval.toLowerCase().match(/vacio.gif$/)?(this.width=2*e.eval(this.size),this.height=2*e.eval(this.size),this._w=v&&48>this.width?48:this.width,this._h=v&&48>this.height?48:this.height,this.mouseCatcher.style.borderRadius=parseInt(Math.min(this._w,this._h)/2)+"px"):(this.image=this.parent.getImage(this.img_src_eval),this.width=this.image.width,this.height=this.image.height,this._w=Math.max(this.width,32),this._h=Math.max(this.height,32));this.mouseCatcher.style.width=
this._w+"px";this.mouseCatcher.style.height=this._h+"px";this.mouseCatcher.style.left=parseInt(this.space.getAbsoluteX(this.x)-this._w/2)+"px";this.mouseCatcher.style.top=parseInt(this.space.getAbsoluteY(this.y)-this._h/2)+"px";e.setVariable(this.activoStr,0);e.setVariable(this.activeStr,0);this.setImage=!1;this.update()};p.prototype.update=function(){e=this.evaluator;e.eval(this.imageSrc).toString().trim()!==this.img_src_eval&&this.init(!0);this.activeIfValue=0<e.eval(this.activeif);this.drawIfValue=
0<e.eval(this.drawif);this.x=e.getVariable(this.xStr);this.y=e.getVariable(this.yStr);r=this.space.getAbsoluteX(this.x);n=this.space.getAbsoluteY(this.y);this.mouseCatcher.style.display=this.activeIfValue?"block":"none";this.mouseCatcher.style.left=parseInt(r-this._w/2)+"px";this.mouseCatcher.style.top=parseInt(n-this._h/2)+"px";this.constraint&&this.evalConst();this.draw()};p.prototype.draw=function(){e=this.evaluator;this.drawIfValue&&(c=this.ctx,k=this.space.backgroundCtx,r=parseInt(this.space.getAbsoluteX(this.x))+
.5,n=parseInt(this.space.getAbsoluteY(this.y))+.5,""!=this.text&&this.drawText(r,n),this.image.ready?(b=this.image.width/2,h=this.image.height/2,this.image.complete&&!this.setImage&&c.drawImage(this.image,parseInt(r-b),parseInt(n-h)),this.trace&&(k.save(),k.translate(r,n),k.scale(parseInt(b),parseInt(h)),k.beginPath(),k.arc(0,0,1,0,f),k.restore(),k.lineWidth=1,k.strokeStyle=this.trace.getColor(),k.stroke())):(b=parseInt(this.width/2),c.beginPath(),c.arc(r,n,b,0,f),c.fillStyle=this.colorInt.getColor(),
c.fill(),c.lineWidth=1,c.strokeStyle=this.color.getColor(),c.stroke(),this.active&&(c.strokeStyle=this.colorInt.borderColor(),c.beginPath(),c.arc(r,n,b-2,0,f),c.stroke()),this.trace&&(k.strokeStyle=this.trace.getColor(),k.beginPath(),k.arc(r,n,b,0,f),k.stroke())))};p.prototype.evalConst=function(){g.set(this.x,this.y);l=this.newt.findZero(g,1/this.space.scale,!0);this.x=l.x;this.y=l.y;this.evaluator.setVariable(this.xStr,this.x);this.evaluator.setVariable(this.yStr,this.y)};p.prototype.evalConstXoY=
function(){e=this.evaluator;u=e.getVariable(this.constVar);e.setVariable(this.constVar,this[this.constVar]);this[this.noConstVar]=e.eval(this.constraint);e.setVariable(this.xStr,this.x);e.setVariable(this.yStr,this.y);e.setVariable(this.constVar,u)};p.prototype.drawText=function(a,b){c=this.ctx;e=this.evaluator;"simpleText"==this.text.type?(c.fillStyle=this.color.getColor(),c.font=this.font,c.textBaseline="alphabetic",c.fillText(this.text.toString(e.eval(this.decimals),this.fixed),parseInt(a+1+this.width/
2),parseInt(b-1-this.height/2))):(c.fillStyle=this.color.getColor(),c.strokeStyle=this.color.getColor(),c.textBaseline="alphabetic",this.text.draw(c,parseInt(a+1+this.width/2),parseInt(b-1-this.height/2),this.decimals,this.fixed,"start",!0,this.color.getColor()))};p.prototype.getContainer=function(){for(var a=this.parent.spaces,b,c=0,d=a.length;c<d;c++)if(b=a[c],b.id==this.spaceID)return b.addCtr(this),this.zIndex=b.zIndex,this.space=b,b.graphicControlContainer;a[0].addCtr(this);this.zIndex=a[0].zIndex;
this.space=a[0];return a[0].graphicControlContainer};p.prototype.deactivate=function(){this.active=!1;this.evaluator.setVariable(this.activoStr,0);this.evaluator.setVariable(this.activeStr,0);this.evaluator.setVariable(this.mClicIzq,0)};p.prototype.addEvents=function(){function b(b){document.body.focus();b.preventDefault();k.whichBtn=a.whichBtn(b);"L"==k.whichBtn&&k.activeIfValue&&(k.parent.deactivateControls(),k.click=k.active=!0,k.evaluator.setVariable(k.activoStr,1),k.evaluator.setVariable(k.activeStr,
1),k.evaluator.setVariable(k.mClicked,0),k.evaluator.setVariable(k.mClicIzq,0),k.posAnte=a.getCursorPosition(b,k.container),k.prePos={x:k.space.getAbsoluteX(k.x),y:k.space.getAbsoluteY(k.y)},k.evaluator.setVariable(k.mX,k.space.getRelativeX(k.posAnte.x)),k.evaluator.setVariable(k.mY,k.space.getRelativeY(k.posAnte.y)),k.parent.update(),window.addEventListener("touchend",c),window.addEventListener("touchmove",d),window.addEventListener("mouseup",c),window.addEventListener("mousemove",d))}function c(b){document.body.focus();
b.preventDefault();b.stopPropagation();k.evaluator.setVariable(k.mClicked,1);k.evaluator.setVariable(k.mClicIzq,1);if(k.activeIfValue||k.active)k.click=!1,window.removeEventListener("mouseup",c),window.removeEventListener("mousemove",d),window.removeEventListener("touchend",c),window.removeEventListener("touchmove",d),e=a.getCursorPosition(b,k.container)||e,k.posX=k.prePos.x-(k.posAnte.x-e.x),k.posY=k.prePos.y-(k.posAnte.y-e.y),k.evaluator.setVariable(k.xStr,k.space.getRelativeX(k.posX)),k.evaluator.setVariable(k.yStr,
k.space.getRelativeY(k.posY)),k.evaluator.setVariable(k.mX,k.space.getRelativeX(e.x)),k.evaluator.setVariable(k.mY,k.space.getRelativeY(e.y)),k.parent.updateControls(),k.parent.update(),k.mouseCatcher.style.left=k.space.getAbsoluteX(k.x)-k._w/2+"px",k.mouseCatcher.style.top=k.space.getAbsoluteY(k.y)-k._h/2+"px";b=k.evaluator.getVariable(k.activeStr);k.parent.deactivateControls();k.parent.updateControls();k.evaluator.setVariable(k.activoStr,b);k.evaluator.setVariable(k.activeStr,b);k.parent.update()}
function d(b){b.preventDefault();k.evaluator.setVariable(k.mClicked,0);k.evaluator.setVariable(k.mClicIzq,0);e=a.getCursorPosition(b,k.container);k.posX=k.prePos.x-(k.posAnte.x-e.x);k.posY=k.prePos.y-(k.posAnte.y-e.y);k.evaluator.setVariable(k.xStr,k.space.getRelativeX(k.posX));k.evaluator.setVariable(k.yStr,k.space.getRelativeY(k.posY));k.evaluator.setVariable(k.mX,k.space.getRelativeX(e.x));k.evaluator.setVariable(k.mY,k.space.getRelativeY(e.y));80<Date.now()-g&&(k.parent.updateControls(),k.parent.update(),
g=Date.now())}var g=0,e,k=this;this.active=this.over=this.click=!1;this.mouseCatcher.oncontextmenu=function(){return!1};this.mouseCatcher.addEventListener("touchstart",b);this.mouseCatcher.addEventListener("mousedown",b);this.mouseCatcher.addEventListener("mouseover",function(a){k.over=!0});this.mouseCatcher.addEventListener("mouseout",function(a){k.over=!1;k.click=!1})};a.GraphicControl=p;return a}(descartesJS||{});
descartesJS=function(a,f){var e,d,r,n,b,h,l,c,k,g;function v(a){return a.charAt(0).toUpperCase()+a.substring(1)}if(a.loadLib)return a;var u=/[\w-//]*(\.png|\.jpg|\.gif|\.svg|\.webp)/gi,p,z,q,m,y,w,x,A,H,E,G,F,D,B,K,L,M,O,I,N,C,Q,J,R,P,S,T,W,V,U=function(b){this.parent=b;this.parser=b.evaluator.parser;this.RTFparser=new a.RTFParser(b.evaluator)};U.prototype.parseButtonsConfig=function(a){var b={rowsNorth:0,rowsSouth:0,widthEast:125,widthWest:125,height:23};a=this.split(a);for(var c=0,d=a.length;c<
d;c++)switch(q=a[c][0],m=a[c][1],z=f[q],z){case "rowsNorth":case "rowsSouth":case "widthEast":case "widthWest":case "height":b[z]=parseInt(m);break;case "about":case "config":case "init":case "clear":b[z]="true"===f[m];break;default:console.warn("Propiedad de botones no identificada: <"+q+"> valor: <"+m+">")}return b};U.prototype.parseSpace=function(b){y={};b=this.split(b);for(var c=0,d=b.length;c<d;c++)switch(q=b[c][0],m=b[c][1],z=f[q],a.DEBUG.paramName=q,a.DEBUG.objectName="Space",z){case "type":if("R2"===
m||"R3"===m)m=f[m];y[z]=m;break;case "id":a.DEBUG.idName=m;case "x_axis":case "y_axis":case "cID":case "file":case "border_width":case "border_radius":case "info":y[z]=m;break;case "fixed":case "numbers":case "sensitive_to_mouse_movements":case "3D":case "split":case "resizable":y[z]="true"===f[m];break;case "bg_display":case "render":y[z]=f[m];break;case "border_color":case "net":case "net10":case "axes":case "text":y[z]=""!=m?"false"===f[m]?"":new a.Color(m,this.parent.evaluator):"";break;case "O.x":y.OxExpr=
m;break;case "O.y":y.OyExpr=m;break;case "image":y.imageSrc=m;break;case "x":p=m;"%"===p[p.length-1]?(y.xPercentExpr=p.trim(),p=(this.parent.container.width*parseFloat(p)/100).toString()):p=m;y.xExpr=this.parser.parse(p);break;case "y":p=m;"%"===p[p.length-1]?(y.yPercentExpr=p.trim(),p=(this.parent.container.height*parseFloat(p)/100).toString()):p=m;y.yExpr=this.parser.parse(p);break;case "width":p=m.trim();y.wModExpr=p;"%"===p[p.length-1]?(y.wExpr=p,p=this.parent.container.width*parseFloat(p)/100):
(p=parseFloat(m),p!=m&&(p=this.parent.container.width,y._w_=m.trim()));y.w=p;break;case "height":p=m.trim();y.hModExpr=p;"%"===p[p.length-1]?(y.hExpr=p,p=this.parent.container.height*parseFloat(p)/100):(p=parseFloat(m),p!=m&&(p=this.parent.container.height,y._h_=m.trim()));y.h=p;break;case "drawif":""!=m&&(y.drawif=this.parser.parse(m));break;case "scale":p=parseFloat(m);isNaN(p)&&(p=48);y.scale=p;break;case "background":y.background=new a.Color(m,this.parent.evaluator);break;default:console.warn("Propiedad del espacio no identificada: <"+
q+"> valor: <"+m+">")}return new a["Space"+y.type](this.parent,y)};U.prototype.parseControl=function(b){w={type:"Numeric",gui:"Spinner"};b=this.split(b);for(var c=0,d=b.length;c<d;c++)switch(q=b[c][0],m=b[c][1],z=f[q],a.DEBUG.paramName=q,a.DEBUG.objectName="Control",z){case "type":p=f[m.trim()];"graphic"===p?p="GraphicControl":"text"===p&&(p="TextArea");w.type=v(p);break;case "gui":p=f[m];"textfield"===p&&(p="TextField");w[z]=v(p);break;case "id":a.DEBUG.idName=m;case "name":case "parameter":case "tooltip":case "tooltipFont":case "Explanation":case "ExplanationFont":case "cID":case "options":case "font":case "font_family":case "file":case "answer":case "cssClass":case "radio_group":case "extra_style":case "kblayout":case "info":w[z]=
m;break;case "region":case "position":case "action":case "msg_pos":case "poster":case "text_align":case "image_align":case "btn_pos":w[z]=f[m];break;case "fixed":case "visible":case "discrete":case "onlyText":case "evaluate":case "autoplay":case "loop":case "controls":case "flat":case "keyboard":w[z]="true"===f[m];break;case "color":case "colorInt":case "label_color":case "label_text_color":case "trace":w[z]=new a.Color(m,this.parent.evaluator);break;case "font_size":case "drawif":case "activeif":case "decimals":case "min":case "max":case "size":""!==
m&&(w[z]=this.parser.parse(m));break;case "constraint":w.constraintExpr=m;break;case "image":w.imageSrc=m;break;case "image_dec":w.image_dec_src=m;break;case "image_inc":w.image_inc_src=m;break;case "space":w.spaceID=m;break;case "expresion":w.expresion=this.parser.parse(m.replace(")(",","));case "kbexp":w.kbexp=this.parser.parse(m.replace(")(",","));break;case "borderColor":w[z]="false"===f[m]?"":m;break;case "bold":"false"!=f[m]&&(w.bold="bold");break;case "italics":"false"!=f[m]&&(w.italics="italic");
break;case "underlined":"false"!=f[m]&&(w.underlined=!0);break;case "value":var g=m.replace(/&squot;/g,"'");g.match(/^\|/)&&(g="'"+g.substring(1),g.match(/\|$/)&&(g=g.substring(0,g.length-1)+"'"));w.valueExpr=this.parser.parse(g);w.valueExprString=g;break;case "incr":0!=m&&(w.incr=this.parser.parse(m));break;case "exponentialif":w.exponentialif=parseFloat(m);break;case "text":w.rawText=m;g=this.parseText(m);for(var k=0,e=g.length;k<e;k++)g[k]=this.parser.parse(g[k],!1);w.text=g;break;default:k=q.indexOf("."),
g=f[q.substring(0,k)],k=f[q.substring(k+1)],"parameter"===g&&"font"===k?w.parameterFont=m:"Explanation"===g&&"font"===k?w.ExplanationFont=m:"tooltip"===g&&"font"===k?w.tooltipFont=m:console.warn("Propiedad de control no identificada: <"+q+"> valor: <"+m+">")}return new a["Numeric"===w.type?w.gui:w.type](this.parent,w)};U.prototype.parseGraphic=function(b,c,d,g){x={rotateExp:g,parameter:"t"};b=this.split(b);g=0;for(var k=b.length;g<k;g++)if(q=b[g][0],m=b[g][1],z=f[q],a.DEBUG.paramName=q,a.DEBUG.objectName=
"Graphic",""!=m)switch(z){case "type":a.DEBUG.idName=m;x[z]=v(f[m]);break;case "align":case "anchor":case "lineDash":x[z]=f[m];break;case "background":case "abs_coord":case "visible":case "editable":case "fixed":case "vectors":case "bold":case "italics":case "underlined":x[z]="true"===f[m];break;case "shadowColor":case "color":case "fill":case "fillP":case "fillM":case "arrow":case "trace":x[z]="false"===f[m]?"":new a.Color(m,this.parent.evaluator);break;case "border_size":case "shadowBlur":case "shadowOffsetX":case "shadowOffsetY":case "family":case "parameter":case "info":case "font":case "font_family":case "name":case "init":case "end":x[z]=
m;break;case "drawif":case "width":case "decimals":case "size":case "spear":case "center":case "radius":case "border_radius":case "opacity":case "inirot":case "inipos":case "range":case "clip":""!==m&&(x[z]=this.parser.parse(m));break;case "font_size":m=m.trim();m.match(/^\[.*\]?/)&&(m=m.substring(1,m.length-1));""!==m&&(x[z]=this.parser.parse(m));break;case "space":x.spaceID=m;break;case "expresion":""!==m&&("Macro"!==x.type?(x.expresion=this.parser.parse(m),x.expresionString=m):x.expresion=m);break;
case "text":x.text=m;break;case "file":var e=m.replace(/&squot;/g,"'").trim();"["===e.charAt(0)&&"]"===e.charAt(e.length-1)&&(e=e.substring(1,e.length-1));e.match(u)&&(e="'"+e+"'");x.file=this.parser.parse(e);break;case "border":""!=m&&"false"!=f[m]&&(x.border=new a.Color(m,this.parent.evaluator));break;default:if(void 0!=x.family&&q.substring(0,x.family.length+1)===x.family+".")switch(f[q.substring(x.family.length+1)]){case "interval":""!=m&&(x.family_interval=this.parser.parse(m));break;case "steps":""!=
m&&(x.family_steps=this.parser.parse(m))}else if(void 0!=x.parameter&&q.match(x.parameter+"."))switch(x.parameter!==q.substring(0,q.indexOf(x.parameter)+x.parameter.length)&&(x.parameter=q.substring(0,q.indexOf(x.parameter)+x.parameter.length)),f[q.substring(x.parameter.length+1)]){case "interval":""!=m&&(x.parameter_interval=this.parser.parse(m));break;case "steps":""!=m&&(x.parameter_steps=this.parser.parse(m))}else console.warn("Propiedad del gr\u00e1fico no identificada: <"+q+"> valor: <"+m+">")}c&&
(x.abs_coord=c);d&&(x.background=d);return new a[x.type](this.parent,x)};U.prototype.parse3DGraphic=function(b,c,d,g){x={rotateExp:g,parameter:"t"};b=this.split(b);c=0;for(d=b.length;c<d;c++)switch(q=b[c][0],m=b[c][1],z=f[q],a.DEBUG.paramName=q,a.DEBUG.objectName="Graphic3D",z){case "type":a.DEBUG.idName=m;p=f[m];switch(p){case "cube":case "box":case "tetrahedron":case "octahedron":case "sphere":case "dodecahedron":case "icosahedron":case "ellipsoid":case "cone":case "cylinder":case "torus":case "mesh":x.subType=
p,p="OtherGeometry"}x[z]=v(p);break;case "model":case "align":case "anchor":case "lineDash":x[z]=f[m];break;case "shadowColor":case "fill":x[z]="false"===f[m]?"":new a.Color(m,this.parent.evaluator);break;case "background":case "fixed":case "split":case "bold":case "italics":case "underlined":x[z]="true"===f[m];break;case "edges":"false"===f[m]?x[z]="":("true"===f[m]&&(m="808080"),x[z]=new a.Color(m,this.parent.evaluator));break;case "border":""!=m&&"false"!=f[m]&&(x.border=new a.Color(m,this.parent.evaluator));
break;case "color":case "backcolor":x[z]=new a.Color(m,this.parent.evaluator);break;case "drawif":case "width":case "length":case "height":case "R":case "r":case "decimals":case "Nu":case "Nv":case "inipos":case "endpos":case "offset_angle":case "offset_dist":case "font_size":""!=m&&(x[z]=this.parser.parse(m));break;case "border_size":case "shadowBlur":case "shadowOffsetX":case "shadowOffsetY":case "family":case "parameter":case "font":case "font_family":case "name":case "inirot":case "endrot":case "info":x[z]=
m;break;case "space":x.spaceID=m;break;case "expresion":"Macro"!=x.type&&"Curve"!=x.type&&"Surface"!=x.type?(x.expresion=this.parser.parse(m),x.expresionString=m):x.expresion=m.replace(/\\n/g,";");break;case "text":x.text=m;break;case "file":g=m.replace(/&squot;/g,"'");"["===g.charAt(0)&&"]"===g.charAt(g.length-1)&&(g=g.substring(1,g.length-1));g.match(/./)&&(g="'"+g+"'");x.file=this.parser.parse(g);break;default:void 0!==x.family&&q.substring(0,x.family.length+1)===x.family+"."?"interval"===f[q.substring(x.family.length+
1)]?""!=m&&(x.family_interval=this.parser.parse(m)):""!=m&&(x.family_steps=this.parser.parse(m)):console.warn("Propiedad del gr\u00e1fico 3D no identificada: <"+q+"> valor: <"+m+">")}return new a[x.type+"3D"](this.parent,x)};U.prototype.parseAuxiliar=function(b){A={};b=this.split(b);for(var c=0,d=b.length;c<d;c++)b[c][1]=b[c][1].replace(/&squot;/g,"'");c=0;for(d=b.length;c<d;c++)switch(q=b[c][0],m=b[c][1],z=f[q],a.DEBUG.paramName=q,a.DEBUG.objectName="Auxiliar",z){case "info":case "code":case "doc":break;
case "id":a.DEBUG.idName=m;case "file":case "init":case "doExpr":case "whileExpr":case "range":case "local":case "expresion":case "condition":case "parameter":A[z]=m.replace(/&squot;/g,"'");break;case "editable":case "constant":case "array":case "matrix":case "algorithm":case "event":case "sequence":A[z]="true"===f[m];break;case "size":case "rows":case "columns":case "x":case "y":case "width":case "height":A[z]=this.parser.parse(m);break;case "evaluate":case "execution":case "msg_pos":case "action":case "type":A[z]=
f[m];break;default:var g=q.indexOf("."),k=f[q.substring(0,g)];g=f[q.substring(g+1)];"parameter"===k&&"font"===g?A.parameterFont=m:console.warn("Propiedad del auxiliar no identificada: <"+q+"> valor: <"+m+">")}A.sequence?A.type="sequence":A.constant?A.type="constant":A.algorithm&&A.evaluate?A.type="algorithm":A.array&&!A.matrix&&")"!=A.id.charAt(A.id.length-1)?A.type="vector":A.matrix&&")"!=A.id.charAt(A.id.length-1)?A.type="matrix":A.event&&")"!=A.id.charAt(A.id.length-1)?A.type="event":"library"===
A.type?A.type="library":")"===A.id.charAt(A.id.length-1)?A.type="function":A.type="variable";a.DEBUG.typeName=A.type;switch(A.type){case "sequence":new a.Function(this.parent,A);break;case "constant":b=new a.Constant(this.parent,A);A.evaluate&&"always"===A.evaluate&&this.parent.auxiliaries.push(b);break;case "algorithm":this.parent.auxiliaries.push(new a.Algorithm(this.parent,A));break;case "vector":b=new a.Vector(this.parent,A);A.evaluate&&"always"===A.evaluate&&this.parent.auxiliaries.push(b);break;
case "matrix":b=new a.Matrix(this.parent,A);A.evaluate&&"always"===A.evaluate&&this.parent.auxiliaries.push(b);break;case "event":this.parent.events.push(new a.Event(this.parent,A));break;case "library":new a.Library(this.parent,A);break;case "variable":new a.Variable(this.parent,A);break;default:new a.Function(this.parent,A)}};U.prototype.parseAction=function(b){H=b.action;E=b.parent;G=b.parameter;return H?new (a[v(H)])(E,G):{execute:function(){}}};U.prototype.parseAnimation=function(b){var c={};
b=this.split(b);for(var d=0,g=b.length;d<g;d++)switch(q=b[d][0],m=b[d][1],z=f[q],z){case "id":case "delay":case "init":case "doExpr":case "whileExpr":c[z]=m.replace(/&squot;/g,"'");break;case "controls":case "auto":case "loop":case "algorithm":case "evaluate":c[z]="true"===f[m];break;default:console.warn("Propiedad de la animaci\u00f3n no identificada: <"+q+">  <"+m+">")}return new a.Animation(this.parent,c)};U.prototype.parsePleca=function(f,u){f=this.split(f);d=e="";r=0;n="#536891";b="white";h=
"left";l="";c="SansSerif,BOLD,20";k="SansSerif,PLAIN,18";g=void 0;for(var p=0,v=f.length;p<v;p++)switch(q=f[p][0],m=f[p][1],q){case "title":e=m;break;case "subtitle":d=m;break;case "subtitlines":r=m;break;case "bgcolor":""!=m&&(n=(new a.Color(m,this.parent.evaluator)).getColor());break;case "fgcolor":""!=m&&(b=(new a.Color(m,this.parent.evaluator)).getColor());break;case "align":""!=m&&(h=m);break;case "titleimage":l=m;break;case "titlefont":c=""!=m?a.convertFont(m):a.convertFont(c);break;case "subtitlefont":k=
""!=m?a.convertFont(m):a.convertFont(k);break;default:console.warn("Propiedad de la pleca no identificada: <"+q+">  <"+m+">")}if(""===e&&""===d)return a.newHTML("div");O=k.substring(0,k.indexOf("px"));O=O.substring(O.lastIndexOf(" "));""!=l&&(I=this.parent.getImage(l),N=I.height);g=a.newHTML("div",{id:"descartesPleca"});N?(g.setAttribute("style","position:absolute;left:0;top:0;text-align:"+h+";width:"+u+"px;height:"+N+"px;background-color:"+n+";color:"+b+";padding-top:8px;padding:8px 15px 8px 15px;margin:0;overflow:hidden;z-index:1;"),
I.setAttribute("style","position: absolute;left:0;top:0;z-index:-1;width:100%;height:100%;"),g.appendChild(I)):g.setAttribute("style","position:absolute;left:0;top:0;text-align:"+h+";width:"+u+"px;background:"+n+";color:"+b+";padding:12px 15px 12px 15px;margin:0;z-index:100;");C=a.newHTML("div",{style:"padding:0;margin:0;font:"+c+";overflow:hidden;white-space:nowrap;"});C.innerHTML=e;Q=a.newHTML("div");if(1===parseInt(r)){T=0;J=a.newHTML("div");J.innerHTML=d;document.body.appendChild(J);P=O;do P-=
T,J.setAttribute("style","padding:0;margin:0;font:"+k+";font-size:"+P+"px;width:"+(u-30)+"px;line-height:"+P+"px;"),R=J.offsetHeight,S=R/P,T=1;while(1<S&&8<P);document.body.removeChild(J);Q.setAttribute("style","padding:0;margin:0;font:"+k+";font-size:"+P+"px;line-height:1em;overflow:hidden;white-space:nowrap;")}else Q.setAttribute("style","padding:0;margin:0;font:"+k+";line-height:1em;");Q.innerHTML=d;g.appendChild(C);g.appendChild(Q);g.imageHeight=N;return g};U.prototype.split=function(a){if("string"!==
typeof a)return[];F=[];a=(a||"").replace(/\\'/g,"\u2019");D=B=L=0;for(K=M=!1;D<a.length;)" "!==a.charAt(D)||K||D++," "===a.charAt(D)||K||(K=!0,L=D),"="!==a.charAt(D)||"'"!==a.charAt(D+1)||M||(M=!0,F[B]=[a.substring(L,D)],L=D+2,D+=2),M&&"'"===a.charAt(D)&&(K=M=!1,F[B].push(a.substring(L,D)),B++),"="!==a.charAt(D)||"'"===a.charAt(D+1)||M||(F[B]=[a.substring(L,D)],L=D+1,D++,W=a.substring(D).indexOf("="),-1===W?V=W=a.length:(W+=D,V=a.substring(D,W).lastIndexOf(" "),V=-1===V?a.length:V+D),F[B].push(a.substring(L,
V)),B++,K=!1,D=V),D++;return F};U.prototype.parseText=function(b){b=b||"";return b.match(/^\{\\rtf1/)?this.RTFparser.parse(b.substring(10)):new a.SimpleText(this.parent,b)};a.LessonParser=U;return a}(descartesJS||{},babel);
descartesJS=function(a){function f(a,c){if(0==c)return 1;if(0>c)return NaN;if(0<=a||b(c)===c)return Math.pow(a,c);if(0>a){var d=1/c,g=b(d);if(g===d&&1===g%2)return-Math.pow(-a,c)}return NaN}function e(a,b){z=[];z.type="matrix";z.rows=a;z.cols=b;m=0;for(y=b;m<y;m++)z[m]=Array(a).fill(0);return z}function d(a,b){u=a.rows;p=a.cols;z=e(u,p);var c;for(m=0;m<u;m++)for(q=0;q<p;q++){for(y=c=0;y<p;y++)c+=a[y][m]*b[q][y];z[q][m]=c}return z}function r(a,b,c){for(var d=e(c.length-1,c.length-1),g=0,k=d.length;g<
k;g++)for(var f=0;f<k;f++)d[g][f]=g<a?f<b?c[g][f]:c[g][f+1]:g<b?c[g+1][f]:c[g+1][f+1];return d}function n(a){if(1<a.cols){for(var b=0,c=1,d=0,g=a.cols;d<g;d++)b+=c*a[0][d]*n(r(0,d,a)),c=-c;return b}return a[0][0]}if(a.loadLib)return a;var b=Math.floor,h={},l,c,k,g,v,u,p,z,q,m,y,w=function(a,b){this.sep="";this.type=a;this.value=b;this.parent=null;this.childs=[]};w.prototype.getRoot=function(){return null===this.parent?this:this.parent.getRoot()};w.prototype.addChild=function(a){a.parent=this;this.childs.push(a)};
w.prototype.replaceLastChild=function(a){k=this.childs.length-1;c=this.childs[k];c.parent=null;this.childs[k]=a;a.parent=this;return a};w.prototype.contains=function(a){if(this.value===a)return!0;for(var b=0,c=this.childs.length;b<c;b++)if(this.childs[b].contains(a))return!0;return!1};w.prototype.equalToMinus=function(){return"compOperator"===this.type?(this.type="operator",this.value="-",v=new w("compOperator","=="),v.addChild(this),v.addChild(new w("number","0")),g=this.getRoot(),g.setAllEvalFun(),
g):this};w.prototype.getChildren=function(){if("(expr)"===this.type||"[expr]"===this.type){if(this.childArray)return this.childArray;this.childArray=[];for(var a=0,b=this.childs.length;a<b;a++)if("square_bracket"===this.childs[a].type||"parentheses"===this.childs[a].type)this.childArray=this.childArray.concat(this.childs[a].childs);return this.childArray}return null};w.prototype.setAllEvalFun=function(){this.setEvalFun();for(var a=0,b=this.childs.length;a<b;a++)this.childs[a].setAllEvalFun()};w.prototype.setEvalFun=
function(){if("number"===this.type)this.evaluate=function(){return parseFloat(this.value)};else if("string"===this.type)this.evaluate=function(){return this.value.replace(/\\u0027/g,"'")};else if("identifier"===this.type&&0===this.childs.length)if("rnd"===this.value)this.evaluate=function(){return Math.random()};else{var c;this.evaluate=function(a,b){c=a.variables[this.value];if("object"===typeof c&&void 0==c.length)return c.evaluate(a);void 0==c&&(b||a.matrices[this.value]?c=a.matrices[this.value]:
a.vectors[this.value]&&(c=a.vectors[this.value]));return void 0!==c?c:0}}else if("identifier"===this.type&&"square_bracket"===this.childs[0].type&&1===this.childs[0].childs.length){var g;this.evaluate=function(a){try{return g=a.getVector(this.value,this.childs[0].childs[0].evaluate(a)),void 0!==g?g:0}catch(M){return 0}}}else if("identifier"===this.type&&"square_bracket"===this.childs[0].type&&1<this.childs[0].childs.length)this.evaluate=function(a){try{return g=a.getMatrix(this.value,this.childs[0].childs[0].evaluate(a),
this.childs[0].childs[1].evaluate(a)),void 0!==g?g:0}catch(M){return 0}};else if("identifier"===this.type&&"parentheses"===this.childs[0].type){var k,v,y;this.evaluate=function(a){k=[];for(var b=0,c=this.childs[0].childs.length;b<c;b++)k[b]=this.childs[0].childs[b].evaluate(a);if("_Eval_"===this.value){l=0<k.length?k[0]:0;if("number"==typeof l)return"NaN";l.match(",")&&parseFloat(l.replace(",","."))==l.replace(",",".")&&(l=l.replace(",","."));if(void 0==h[l]){v=l.match(/:=/g)?!0:!1;if(l.match(";")){var d=
!1,g=[],e=0;b=0;for(c=l.length;b<c;b++){var f=l.charAt(b);"'"===f&&(d=!d);d||";"!==f||(g.push(l.substring(e,b)),e=b+1)}g.push(l.substring(e));l="("+g.join(")(")+")"}h[l]=a.parser.parse(l,v)}y=a.eval(h[l]);return void 0!=y?y:NaN}return a.functions[this.value].apply(a,k)}}else if("operator"===this.type)"+"===this.value?this.evaluate=function(b){var c=this.childs[0].evaluate(b,!0);b=this.childs[1].evaluate(b,!0);if("matrix"!==c.type||"matrix"!==b.type)return"number"==typeof c&&"string"==typeof b?c=a.removeNeedlessDecimals(c.toString()):
"string"==typeof c&&"number"==typeof b&&(b=a.removeNeedlessDecimals(b.toString())),c+b;u=c.rows;p=c.cols;z=e(u,p);for(m=0;m<u;m++)for(q=0;q<p;q++)z[q][m]=c[q][m]+b[q][m];return z}:"-"===this.value?this.evaluate=function(a){var b=this.childs[0].evaluate(a,!0);a=this.childs[1].evaluate(a,!0);if("matrix"!==b.type||"matrix"!==a.type)return b-a;u=b.rows;p=b.cols;z=e(u,p);for(m=0;m<u;m++)for(q=0;q<p;q++)z[q][m]=b[q][m]-a[q][m];return z}:"*"===this.value?this.evaluate=function(a){var b=this.childs[0].evaluate(a,
!0);a=this.childs[1].evaluate(a,!0);return"matrix"!==b.type||"matrix"!==a.type?b*a:d(b,a)}:"/"===this.value?this.evaluate=function(a){var b=this.childs[0].evaluate(a,!0);a=this.childs[1].evaluate(a,!0);if("matrix"!==b.type||"matrix"!==a.type)return b/a;var c=e(a.length,a.length),g=n(a);if(0===g)a=0;else{g=1/g;if(1<a.length)for(var k=0,f=a.length;k<f;k++){var m=g;for(var l=0;l<f;l++)c[l][k]=m*n(r(k,l,a)),m=-m;g=-g}else c[0][0]=g;a=c}b=0===a?e(b.rows,b.cols):d(b,a);return b}:"%"===this.value?this.evaluate=
function(a){var c=this.childs[0].evaluate(a);a=this.childs[1].evaluate(a);return c-b(c/a)*a}:"^"===this.value&&(this.evaluate=function(a){var b=this.childs[0].evaluate(a);a=this.childs[1].evaluate(a);return 0<=a?f(b,a):1/f(b,-a)});else if("compOperator"===this.type)"<"===this.value?this.evaluate=function(a){return+(this.childs[0].evaluate(a)<this.childs[1].evaluate(a))}:"<="===this.value?this.evaluate=function(a){return+(this.childs[0].evaluate(a)<=this.childs[1].evaluate(a))}:">"===this.value?this.evaluate=
function(a){return+(this.childs[0].evaluate(a)>this.childs[1].evaluate(a))}:">="===this.value?this.evaluate=function(a){return+(this.childs[0].evaluate(a)>=this.childs[1].evaluate(a))}:"=="===this.value?this.evaluate=function(a){var b=this.childs[0].evaluate(a);a=this.childs[1].evaluate(a);return"number"==typeof b&&"number"==typeof a?+(1E-8>Math.abs(b-a)):+(b===a)}:"!="===this.value&&(this.evaluate=function(a){var b=this.childs[0].evaluate(a);a=this.childs[1].evaluate(a);return"number"==typeof b&&
"number"==typeof a?+!(1E-8>Math.abs(b-a)):+(b!==a)});else if("boolOperator"===this.type)"&"===this.value?this.evaluate=function(a){return this.childs[0].evaluate(a)?this.childs[1].evaluate(a)?1:0:0}:"|"===this.value?this.evaluate=function(a){return this.childs[0].evaluate(a)?1:this.childs[1].evaluate(a)?1:0}:"!"===this.value&&(this.evaluate=function(a){return+!this.childs[0].evaluate(a)});else if("conditional"===this.type)this.evaluate=function(a){return 0<this.childs[0].evaluate(a)?this.childs[1].evaluate(a):
this.childs[2]?this.childs[2].evaluate(a):0};else if("sign"===this.type)this.evaluate="sign+"===this.value?function(a){return this.childs[0].evaluate(a)}:function(a){return-this.childs[0].evaluate(a)};else if("parentheses"===this.type)this.evaluate=function(a,b){return this.childs[0].evaluate(a,b)};else if("(expr)"===this.type||"[expr]"===this.type)this.evaluate=function(a){var b=this.childs.length,c=[];if(1===b&&1===this.childs[0].childs.length&&"(expr)"===this.type)c=this.childs[0].childs[0].evaluate(a);
else for(var d=0;d<b;d++){var g=[];for(var k=0,e=this.childs[d].childs.length;k<e;k++)g.push(this.childs[d].childs[k].evaluate(a));c[d]=g}return c};else if("assign"===this.type){var F,w=this.childs[0],B=this.childs[1],K=w.childs[0]?w.childs[0].childs:null;this.evaluate=1===w.childs.length&&"square_bracket"===w.childs[0].type&&1===K.length?function(a){F=B.evaluate(a);a.setVector(w.value,K[0].evaluate(a),F);return F}:1===w.childs.length&&"square_bracket"===w.childs[0].type&&2===K.length?function(a){F=
B.evaluate(a);a.setMatrix(w.value,K[0].evaluate(a),K[1].evaluate(a),F);return F}:function(a){F=B.evaluate(a);return F.type?a.matrices[w.value]=F:"object"!==typeof a.variables[w.value]?a.variables[w.value]=F:0}}};a.Node=w;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,e,d,r,n,b,h,l,c=/^\s+/,k=/^[a-zA-Z_\u00C0-\u021B\u0391-\u03C9]+[a-zA-Z_0-9\u00C0-\u021B\u0391-\u03C9]*([.]*[0-9a-zA-Z_\u00C0-\u021B\u0391-\u03C9]+[0-9]*)*/,g=/^[0-9]+[.][0-9]+|^[.][0-9]+|^[0-9]+/,v=/^==|^!=|^<=|^<|^>=|^>|^#/,u=/^!|^~|^&&|^&|^\|\||^\|/,p=/^=|^:=/,z=/^[\?:]/,q=/^[\+\-\*\/%\^\u2212\u00b7\u00D7\u00F7]/,m=/^\[|^\]/,y=/^\(|^\)/,w=/^,/,x=/^;/,A=/\|/g,H=/\|\*/g,E=/\*\|/g,G,F=/rnd|pi|e|Infinity|-Infinity|sqr|sqrt|ra\u00edz|exp|log|log10|abs|ent|sgn|ind|sin|sen|cos|tan|cot|sec|csc|sinh|senh|cosh|tanh|coth|sech|csch|asin|asen|acos|atan|min|max/,
D=function(){};D.prototype.tokenize=function(F){function B(a,c,d){e.push({type:a,value:c});b=b.slice(d);r+=d;l=a}if(f=F){var D=F.indexOf("//");0<=D&&":"!==F[D-1]&&(F=F.substring(0,D));F=F.replace(/\\u(\S+) /g,function(a,b){return 39!==parseInt(b,16)?String.fromCharCode(parseInt(b,16)):a});F=F.replace(/&sup(.+?);/g,"^$1 ");F=F.replace(/&squot;/g,"'");F.match(/=\|\*/g)&&(F=F.replace(H,"'").replace(E,"'"));F.match(/=\|/g)&&(F=F.replace(A,"'"));D=F.trim();"|"==D.charAt(0)&&"|"==D.charAt(D.length-1)&&
(F=D.replace(A,"'"))}e=[];d=!1;r=0;b=F;for(l="";F&&r<F.length;)if(d=r,"'"==b[0]){for(h=1;"'"!=b[h];)if(h<b.length)h++;else{console.info(">Error, unknown symbol: ["+b+"], in the string \u300a"+f+"\u300b");return}n=b.substring(1,h);B("string",n,n.length+2)}else if(n=b.match(c))b=b.slice(n[0].length),r+=n[0].length;else if(n=b.match(q))n[0]=n[0].replace(/\u00F7/g,"/").replace(/\u2212/g,"-").replace(/\u00b7/g,"*").replace(/\u00D7/g,"*"),B("operator",n[0],n[0].length);else if(n=b.match(k))"number"===l&&
e.push({type:"operator",value:"*"}),B("identifier",n[0],n[0].length);else if(n=b.match(g))B("number",n[0],n[0].length);else if(n=b.match(v))D=n[0],"#"==D&&(D="!="),B("compOperator",D,n[0].length);else if(n=b.match(u))D=n[0],"||"==D?D="|":"&&"==D?D="&":"~"==D&&(D="!"),B("boolOperator",D,n[0].length);else if((n=b.match(p))&&!b.match(/^==/))B("assign",n[0],n[0].length);else if(n=b.match(z))B("conditional",n[0],n[0].length);else if(n=b.match(m))B("square_bracket",n[0],n[0].length);else if(n=b.match(y))"("==
n&&"number"===l&&e.push({type:"operator",value:"*"}),B("parentheses",n[0],n[0].length);else if(n=b.match(w))B("separator",n[0],n[0].length);else if(178===b.charCodeAt(0))e.push({type:"operator",value:"^"}),B("number",2,1);else if(179===b.charCodeAt(0))e.push({type:"operator",value:"^"}),B("number",3,1);else if(n=b.match(x))B("final_of_expression",n[0],n[0].length);else if(d==r){a.DEBUG.setError(a.DEBUG.EXPRESSION,f);return}return e};D.prototype.flatTokens=function(a,b){a=a||[];b=b||"";G="";for(var c=
0,d=a.length;c<d;c++)G="string"==a[c].type?G+"&squot;"+a[c].value+"&squot;":"identifier"!=a[c].type||a[c].value.match(F)?G+a[c].value:G+b+a[c].value;return G};a.Tokenizer=D;return a}(descartesJS||{});
descartesJS=function(a){function f(a){switch(a){case "=":return 1;case ":=":return 1;case "(":return 2;case "[":return 2;case "?":return 2;case ":":return 3;case "?:":return 3;case "|":return 6;case "&":return 7;case "<":return 5;case "<=":return 5;case ">":return 5;case ">=":return 5;case "==":return 5;case "!=":return 5;case "+":return 6;case "-":return 6;case "/":return 7;case "*":return 7;case "sign-":return 7;case "sign+":return 7;case "!":return 8;case "%":return 8;case "^":return 9;default:return 9}}
function e(a){return isNaN(parseFloat(a))?a.replace(/^\s|\s$/g,"").replace(/^'|'$/g,""):parseFloat(a)==a?parseFloat(a):a.replace(/^\s|\s$/g,"").replace(/^'|'$/g,"")}if(a.loadLib)return a;a.reservedIds=new String("-_-_NUM_MAX_ITE_ALG_-rnd-pi-\u03c0-e-Infinity-isTouch-esT\u00e1ctil-device-dispositivo-screenOrientation-screenWidth-screenHeight-sqr-sqrt-ra\u00edz-exp-log-log10-abs-ent-sgn-ind-sin-sen-cos-tan-cot-sec-csc-sinh-senh-cosh-tanh-coth-sech-csch-asin-asen-acos-atan-atan2-floor-piso-ceil-techo-round-redondeo-trunc-truncamiento-min-max-_Trace_-_Print_-_Num_-isNumber-esN\u00famero-random-aleatorio-_Stop_Audios_-esCorrecto-escorrecto-parent.set-parent.update-parent.exec-toFixed-_NumToStr_-_NumACadena_-charAt-_charAt_-_letraEn_-substring-_substring_-_subcadena_-strLength-_length_-_longitud_-indexOf-_indexOf_-\u00edndiceDe-lastIndexOf-replace-_replace_-_reemplazar_-toLowerCase-toUpperCase-trim-_Load_-_GetValues_-_GetMatrix_-_MatrixToStr_-_StrToMatrix_-_GetVector_-_VectorToStr_-_StrToVector_-_ExecStr_-_ExecBlock_-_Save_-_SaveSpace_-_Open_-_SaveState_-_OpenState_-_AnchoDeCadena_-_strWidth_-R-G-B-_Rojo_-_Red_-_Verde_-_Green_-_Azul_-_Blue_-DJS.typeof-DJS.squote-DJS.comma-DJS.w-DJS.h-");
var d=Date.now(),r,n,b,h,l,c,k,g,v,u,p,z,q=function(b){this.evaluator=b;this.tokenizer=new a.Tokenizer;this.vectors={};this.matrices={};this.variables={};this.functions={};this.definitions={};this.registerDefaultValues();this.registerExternalValues&&this.registerExternalValues()};q.prototype.setDefinition=function(a,b){this.definitions[a]=b};q.prototype.getDefinition=function(a){return this.definitions[a]};q.prototype.setVariable=function(a,b){this.variables[a]=b};q.prototype.getVariable=function(a){return this.variables[a]};
q.prototype.setVector=function(a,b,c){this.vectors[a][b]=c};q.prototype.getVector=function(a){this.vectors.hasOwnProperty(a)||(this.vectors[a]=[0,0,0]);return this.vectors[a]};q.prototype.setMatrix=function(a,b,c,d){this.matrices[a][b][c]=d};q.prototype.getMatrix=function(a){this.matrices.hasOwnProperty(a)||(this.matrices[a]=[[0,0,0],[0,0,0],[0,0,0]]);return this.matrices[a]};q.prototype.setFunction=function(a,b){this.functions[a]=b};q.prototype.getFunction=function(a){this.functions.hasOwnProperty(a)||
(this.functions[a]=function(){return 0});return this.functions[a]};q.prototype.parse=function(d,e){(b=this.tokenizer.tokenize(d))||(b=[]);h=null;e=!e||!1;r=g=k=c=0;for(n=b.length;r<n;r++){v=b[r];u=v.value;p=v.type;if("identifier"===p)if(r+1<n&&"parentheses"===b[r+1].type&&"("===b[r+1].value)this.getFunction(u);else if(r+1<n&&"square_bracket"===b[r+1].type&&"["===b[r+1].value)b[r+3]&&"square_bracket"===b[r+3].type&&"]"===b[r+3].value?this.getVector(u):this.getMatrix(u);else{var m=u.match(/(\w*)\.mouse_x|(\w*)\.mouse_y|(\w*)\.mouse_pressed|(\w*)\.mouse_clicked|(\w*)\.clic_izquierdo/);
m&&(this.variables[(m[1]||m[2]||m[3]||m[4]||m[5])+".DESCARTESJS_no_fixed"]=1);this.getVariable(u,!0)}"assign"===p&&e&&":="!=u&&(p="compOperator",u="==");if("assign"===p)if(l=new a.Node(p,u),null!=h)if("identifier"===h.type)h.parent&&h.parent.replaceLastChild(l),l.addChild(h),h=l,e=!0;else if("square_bracket"===h.type)l.addChild(h.parent),h=l,e=!0;else{l.type="compOperator";l.value="==";for(e=!0;h.parent&&f(h.parent.value)>=f(l.value);)h=h.parent;h.parent&&h.parent.replaceLastChild(l);l.addChild(h);
h=l}else{console.info("Error1: en la expresi\u00f3n \u300a "+d+" \u300b, en el token {valor: "+u+", tipo: "+p+"}");break}else if("parentheses"===p&&"("===u||"square_bracket"===p&&"["===u)if(l=new a.Node(p,u),"("===u&&c++,"["===u&&k++,null===h)"("===u&&(new a.Node("(expr)","(expr)")).addChild(l),"["===u&&(new a.Node("[expr]","[expr]")).addChild(l),h=l;else if("operator"===h.type||"boolOperator"===h.type||"compOperator"===h.type||"conditional"===h.type||"assign"===h.type)h.addChild(l),h=l;else if("sign"===
h.type)h.addChild(l),h=l;else if("parentheses"===h.type&&"("===h.value)h.addChild(l),h=l;else if("square_bracket"===h.type&&"["===h.value)h.addChild(l),h=l;else if("parentheses"===h.type&&"()"===h.value)h.parent.addChild(l),h=l;else if("square_bracket"===h.type&&"[]"===h.value)h.parent.addChild(l),h=l;else if("identifier"===h.type)h.addChild(l),h=l;else{console.info("Error2: en la expresi\u00f3n \u300a "+d+" \u300b, en el token ["+r+"] {valor: "+u+", tipo: "+p+"}");break}else if("parentheses"===p&&
")"===u)if(c--,null===h)console.info("Error3: en la expresi\u00f3n \u300a "+d+" \u300b, en el token (valor:"+u+", tipo:"+p);else{for(;h&&h.parent&&("("!=h.value||"("==h.value&&"parentheses"!=h.type);)h=h.parent;if(h&&"("===h.value)h.value="()";else break}else if("square_bracket"===p&&"]"===u)if(k--,null===h)console.info("Error5: en la expresi\u00f3n \u300a "+d+" \u300b, en el token (valor:"+u+", tipo:"+p);else{for(;h&&h.parent&&("["!=h.value||"["==h.value&&"square_bracket"!=h.type);)h=h.parent;if(h&&
"["===h.value)h.value="[]";else{console.info("Error6: en la expresi\u00f3n \u300a "+d+" \u300b, en el token {valor: "+u+", tipo: "+p+"}");break}}else if("number"===p||"string"===p||"identifier"===p)if(l=new a.Node(p,u),null===h)h=l;else if("operator"===h.type||"compOperator"===h.type||"boolOperator"===h.type||"parentheses"===h.type&&"("===h.value||"square_bracket"===h.type&&"["===h.value||"sign"===h.type||"conditional"===h.type||"assign"===h.type)h.addChild(l),h=l;else{a.DEBUG.setError(a.DEBUG.EXPRESSION,
d);break}else if("operator"===p||"compOperator"===p||"boolOperator"===p)if(l=new a.Node(p,u),null===h)if("-"===u||"+"===u)l.type="sign",l.value="sign"+u,h=l;else if("!"===u)h=l;else{console.info("Error8: en la expresi\u00f3n \u300a "+d+" \u300b, en el token {valor: "+u+", tipo: "+p+"}");break}else if("operator"===h.type||"compOperator"===h.type||"boolOperator"===h.type||"assign"===h.type||"conditional"===h.type||"square_bracket"===h.type&&"["===h.value&&("-"===u||"+"===u||"!"===u)||"parentheses"===
h.type&&"("===h.value&&("-"===u||"+"===u||"!"===u)){if("-"===u||"+"===u)l.type="sign",l.value="sign"+u;h.addChild(l);h=l}else if("number"===h.type||"parentheses"===h.type&&"()"===h.value||"square_bracket"===h.type&&"[]"===h.value||"string"===h.type||"identifier"===h.type||"conditional"===h.type||"assign"===h.type){for(;h.parent&&f(h.parent.value)>=f(l.value);)h=h.parent;h.parent&&h.parent.replaceLastChild(l);l.addChild(h);h=l}else{console.info("Error9: en la expresi\u00f3n \u300a "+d+" \u300b, en el token {valor: "+
u+", tipo: "+p+"}");break}else if("conditional"===p)if(l=new a.Node(p,u),null!=h)if("?"===l.value){for(g++;h.parent&&f(h.parent.value)>f(l.value);)h=h.parent;h.parent&&h.parent.replaceLastChild(l);l.addChild(h);h=l}else{for(g--;h&&h.parent&&("?"!=h.value||"?"==h.value&&"conditional"!=h.type);)h=h.parent;if(h&&"?"===h.value)h.value="?:";else{console.info("Error10: en la expresi\u00f3n \u300a "+d+" \u300b, en el token {valor: "+u+", tipo: "+p+"}");break}}else{console.info("Error11: en la expresi\u00f3n \u300a "+
d+" \u300b, en el token {valor: "+u+", tipo: "+p+"}");break}else if("separator"===p)if(null!=h)for(;h.parent&&"("!=h.value&&"["!=h.value;)h=h.parent;else{console.info("Error12: en la expresi\u00f3n \u300a "+d+" \u300b, en el token {valor: "+u+", tipo: "+p+"}");break}else{console.info("Error13: en la expresi\u00f3n \u300a "+d+" \u300b, en el token {valor: "+u+", tipo: "+p+"}");break}}0<c&&a.DEBUG.setError(a.DEBUG.PARENTHESIS_CLOSING,d);0>c&&a.DEBUG.setError(a.DEBUG.PARENTHESIS_OPENING,d);0<k&&a.DEBUG.setError(a.DEBUG.BRACKET_CLOSING,
d);0>k&&a.DEBUG.setError(a.DEBUG.BRACKET_OPENING,d);0!=g&&a.DEBUG.setError(a.DEBUG.INCOMPLETE_IF,d);(z=h?h.getRoot():null)&&z.setAllEvalFun();return z};q.prototype.registerDefaultValues=function(){var b=this;b.variables._NUM_MAX_ITE_ALG_=1E5;b.variables.rnd=Math.random;b.variables.pi=b.variables["\u03c0"]=Math.PI;b.variables.e=Math.E;b.variables.Infinity=Infinity;b.variables["-Infinity"]=-Infinity;b.variables.isTouch=b.variables["esT\u00e1ctil"]=a.hasTouchSupport?1:0;b.variables.device=b.variables.dispositivo=
function(){var a=navigator.userAgent;return/(tablet|ipad|playbook|silk)|(android(?!.*mobi))/i.test(a)?"tablet":/Mobile|iP(hone|od)|Android|BlackBerry|IEMobile|Kindle|Silk-Accelerated|(hpw|web)OS|Opera M(obi|ini)/.test(a)?"mobile":"desktop"}();Object.defineProperties(b.variables,{screenOrientation:{get:function(){return window.matchMedia("(orientation: landscape)").matches?"landscape":"portrait"}},screenWidth:{get:function(){return window.innerWidth}},screenHeight:{get:function(){return window.innerHeight}}});
b.variables["DJS.squote"]="\\u0027";b.variables["DJS.comma"]="\\u002C";b.functions.sqr=function(a){return a*a};b.functions.sqrt=b.functions["ra\u00edz"]=Math.sqrt;b.functions.exp=Math.exp;b.functions.log=Math.log;b.functions.log10=Math.log10?Math.log10:function(a){return Math.log(a)/Math.log(10)};b.functions.abs=Math.abs;b.functions.ent=function(a){return Math.trunc(parseFloat(a)+1E-16*Math.sign(a))};b.functions.sgn=Math.sign;b.functions.ind=function(a){return a?1:0};b.functions.sin=b.functions.sen=
Math.sin;b.functions.cos=Math.cos;b.functions.tan=Math.tan;b.functions.cot=function(a){return 1/Math.tan(a)};b.functions.sec=function(a){return 1/Math.cos(a)};b.functions.csc=function(a){return 1/Math.sin(a)};b.functions.sinh=b.functions.senh=Math.sinh?Math.sinh:function(a){return(Math.exp(a)-Math.exp(-a))/2};b.functions.cosh=Math.cosh?Math.cosh:function(a){return(Math.exp(a)+Math.exp(-a))/2};b.functions.tanh=Math.tanh?Math.tanh:function(a){return(Math.exp(a)-Math.exp(-a))/(Math.exp(a)+Math.exp(-a))};
b.functions.coth=function(a){return 1/b.functions.tanh(a)};b.functions.sech=function(a){return 1/b.functions.cosh(a)};b.functions.csch=function(a){return 1/b.functions.sinh(a)};b.functions.asin=b.functions.asen=Math.asin;b.functions.acos=Math.acos;b.functions.atan=Math.atan;b.functions.atan2=Math.atan2;b.functions.floor=b.functions.piso=Math.floor;b.functions.ceil=b.functions.techo=Math.ceil;b.functions.round=b.functions.redondeo=Math.round;b.functions.trunc=b.functions.truncamiento=Math.trunc;b.functions.min=
Math.min;b.functions.max=Math.max;b.functions._Trace_=b.functions._Print_=function(){console.info.apply(console,arguments);return 0};b.functions._Num_=function(a){if("number"==typeof a)return"NaN";a=a.replace(",",".");return parseFloat(a)==a?parseFloat(a):"NaN"};b.functions.isNumber=b.functions["esN\u00famero"]=function(a){return Number.isFinite(a)?1:0};b.functions.random=b.functions.aleatorio=function(a,b){a=isNaN(parseFloat(a))?0:parseFloat(a);b=isNaN(parseFloat(b))?1:parseFloat(b);a>b&&(b=$jscomp.makeIterator([b,
a]),a=b.next().value,b=b.next().value);return a+Math.random()*b};b.functions._Stop_Audios_=function(){b.evaluator.parent.stopAudios()};b.functions.esCorrecto=function(c,d,g){return a.esCorrecto(c,d,b.evaluator,g)};b.functions.escorrecto=function(c,d,g){return a.escorrecto(c,d,b.evaluator,g)};window.parent!==window&&(b.functions["parent.set"]=function(a,b){window.parent.postMessage({type:"set",name:a,value:b},"*");return 0},b.functions["parent.update"]=function(){window.parent.postMessage({type:"update"},
"*");return 0},b.functions["parent.exec"]=function(a,b){window.parent.postMessage({type:"exec",name:a,value:b},"*");return 0});b.functions.toFixed=b.functions._NumToStr_=b.functions._NumACadena_=function(a,b){a=isNaN(parseFloat(a))?0:parseFloat(a);return a.toFixed(parseInt(b||0))};b.functions.charAt=b.functions._charAt_=b.functions._letraEn_=function(a,b){a=(a||"").toString();b=isNaN(parseInt(b))?0:parseInt(b);return a.charAt(b)};b.functions.substring=b.functions._substring_=b.functions._subcadena_=
function(a,b,c){a=(a||"").toString();b=isNaN(parseInt(b))?0:parseInt(b);c=isNaN(parseInt(c))?0:parseInt(c);return 0<=b&&0<=c?a.substring(b,c):0>b&&0<=c?a.substring(c):0>c&&0<=b?a.substring(b):""};b.functions.strLength=b.functions._length_=b.functions._longitud_=function(a){return(a||"").toString().length};b.functions.indexOf=b.functions._indexOf_=b.functions["_\u00edndiceDe_"]=function(a,b){return(a||"").toString().indexOf((b||"").toString())};b.functions.lastIndexOf=function(a,b){return(a||"").toString().lastIndexOf((b||
"").toString())};b.functions.replace=b.functions._replace_=b.functions._reemplazar_=function(a,b,c){a=(a||"").toString();b=(b||"").toString();c=(c||"").toString();for(var d=a.indexOf(b);0<=d;)a=a.substring(0,d)+c+a.substring(d+b.length),d=a.indexOf(b,d+c.length);return a};b.functions.toLowerCase=function(a){return(a||"").toString().toLowerCase()};b.functions.toUpperCase=function(a){return(a||"").toString().toUpperCase()};b.functions.trim=function(a){return(a||"").toString().trim()};b.functions._Load_=
function(b){var c="";b&&(c=(c=document.getElementById(b))&&"descartes/archivo"==c.type?c.text:a.openFile(b));return c||""};b.functions._GetValues_=function(a,c){return b.functions._ExecBlock_(b.functions._Load_(a).replace(/&brvbar;/g,String.fromCharCode("166")),c)};b.functions._GetMatrix_=function(a,c){return b.functions._StrToMatrix_(b.functions._Load_(a).replace(/&brvbar;/g,String.fromCharCode("166")),c)};b.functions._MatrixToStr_=function(c){var d=b.matrices[c];if(d){for(var g="<"+c+">\\n",k=b.getVariable(c+
".columnas_usadas")||d.cols||0,e=b.getVariable(c+".filas_usadas")||d.rows||0,f,l=0;l<k;l++){for(var h=0;h<e;h++)f=d[l][h],void 0!==f&&("string"==typeof f?f="'"+f+"'":"number"==typeof f&&(f=a.removeNeedlessDecimals(f.toFixed(6))),g+=f+(h<e-1?" \u00a6 ":""));g=g.replace(/(\u00A6 )$/g,"")+"\\n"}return g+"</"+c+">"}return""};b.functions._StrToMatrix_=function(a,c){var d=[],g=!1,k=!1;d.type="matrix";if(a){a=a.replace(/\r|\\r/g,"").split(/\n|\\n/);for(var f=0,l=a.length;f<l;f++)a[f].match("<"+c+">")?(k=
!0,g=a[f].trim().split("<"+c+">"),2==g.length&&""!=g[1]&&d.push(g[1].split(String.fromCharCode("166")).map(e)),g=!0):(a[f].match("</"+c+">")&&(g=a[f].trim().split("</"+c+">"),2==g.length&&""!=g[0]&&d.push(g[0].split(String.fromCharCode("166")).map(e)),g=!1,f=a.length),g&&d.push(a[f].split(String.fromCharCode("166")).map(e)));b.matrices[c]=d;b.matrices[c].rows=d&&d[0]&&d[0].length?d[0].length:0;b.matrices[c].cols=d&&d.length?d.length:0;b.setVariable(c+".filas",b.matrices[c].rows);b.setVariable(c+".columnas",
b.matrices[c].cols)}return k?"OK":"ERROR"};b.functions._GetVector_=function(a,c){return b.functions._StrToVector_(b.functions._Load_(a),c)};b.functions._VectorToStr_=function(a){var c=b.vectors[a];if(c){for(var d="<"+a+">\\n",g=b.getVariable(a+".long_usada")||c._size_||0,k,e=0;e<g;e++)k=c[e],void 0!==k?("number"==typeof k&&(k=parseFloat(k)),d+=k+"\\n"):d+="0\\n";return d+"</"+a+">"}return""};b.functions._StrToVector_=function(a,c){var d=[],g=!1,k=!1;d.type="vector";if(a){a=a.replace(/\r|\\r/g,"").split(/\n|\\n/);
for(var f=0,l=a.length;f<l;f++)a[f].match("<"+c+">")?g=k=!0:(a[f].match("</"+c+">")&&(g=!1,f=a.length),g&&d.push(e(a[f])));d._size_=d.length;b.vectors[c]=d;b.setVariable(c+".long",d.length);b.setVariable(c+".long_usada",d.length)}return k?"OK":"ERROR"};b.functions._ExecStr_=function(a){return b.functions._ExecBlock_(a,"")};b.functions._ExecBlock_=function(a,c){var d=[],g=""==c;if(a){a=a.replace(/\r|\\r/g,"").split(/\n|\\n/);for(var k=0,e=a.length;k<e;k++)a[k].match("<"+c+">")?(g=a[k].trim().split("<"+
c+">"),2==g.length&&""!=g[1]&&(d=d.concat(g[1].split(String.fromCharCode("166")))),g=!0):a[k].match("</"+c+">")?(g=a[k].trim().split("</"+c+">"),2==g.length&&""!=g[0]&&(d=d.concat(g[0].split(String.fromCharCode("166")))),g=!1):g&&(d=d.concat(a[k].split(String.fromCharCode("166"))));k=0;for(e=d.length;k<e;k++)g=d[k].split("="),g[0]=g[0].trim(),2==g.length&&""!=g[0]&&(isNaN(parseFloat(g[1]))?b.setVariable(g[0],g[1].replace(/^\s|\s$/g,"").replace(/^'|'$/g,"")):b.setVariable(g[0],parseFloat(g[1])))}return 0};
var c=a.newHTML("a",{target:"_blank"}),g,k=null;a.newBlobContent=null;b.functions._Save_=function(e,f){b.evaluator.parent.removeButtonClick();1500<Date.now()-d&&(d=Date.now(),document.body.appendChild(c),k=f.replace(/\\r/g,"").replace(/\\n/g,"\r\n").replace(/\\q/g,"'").replace(/\\_/g,"\\"),g=new Blob(["\ufeff",k],{type:"text/plain;charset=utf-8"}),c.setAttribute("href",window.URL.createObjectURL(g)),c.setAttribute("download",e),k!=a.newBlobContent&&(c.click(),a.newBlobContent=k),document.body.removeChild(c));
return 0};var f=a.newHTML("a",{target:"_blank"});b.functions._SaveSpace_=function(c,g){b.evaluator.parent.removeButtonClick();1500<Date.now()-d&&(d=Date.now(),document.body.appendChild(f),k=g,f.setAttribute("href",k),f.setAttribute("download",c),k!=a.newBlobContent&&(f.click(),a.newBlobContent=k),document.body.removeChild(f));return 0};var l,h,u=a.newHTML("input",{type:"file"});u.addEventListener("change",function(c){l=c.target.files;h=new FileReader;h.onload=function(c){a.addExternalFileContent(l[0].name,
c.target.result);b.setVariable("DJS.fileName",l[0].name);b.setVariable("DJS.fileContent",c.target.result);b.getFunction(b._callback)&&(b.getFunction(b._callback).apply(b.evaluator,[]),b.evaluator.parent.update());u.value=""};0<l.length&&h.readAsText(l[0])});b.functions._Open_=function(a){b.evaluator.parent.removeButtonClick();1500<Date.now()-d&&(b._callback=a,u.click(),d=Date.now());return 0};b.functions._AnchoDeCadena_=b.functions._strWidth_=function(b,c,d,g){return a.getTextWidth(b,a.convertFont(c+
","+d+","+g))};b.functions.R=b.functions._Rojo_=b.functions._Red_=function(b){return(new a.Color(b)).r/255};b.functions.G=b.functions._Verde_=b.functions._Green_=function(b){return(new a.Color(b)).g/255};b.functions.B=b.functions._Azul_=b.functions._Blue_=function(b){return(new a.Color(b)).b/255};b.functions.HSV2RGB=function(a,b,c){a=parseInt(a)%360;b*=c;var d=b*(1-Math.abs(a/60%2-1));c-=b;if(0<=a&&60>a){var g=b;var k=d;var e=0}else 60<=a&&120>a?(g=d,k=b,e=0):120<=a&&180>a?(g=0,k=b,e=d):180<=a&&240>
a?(g=0,k=d,e=b):240<=a&&300>a?(g=d,k=0,e=b):300<=a&&360>a&&(g=b,k=0,e=d);g=parseInt(255*(g+c));k=parseInt(255*(k+c));e=parseInt(255*(e+c));return""+g.toString(16).padStart(2,"0")+k.toString(16).padStart(2,"0")+e.toString(16).padStart(2,"0")};b.functions["DJS.typeof"]=function(a){return a.rows?"matrix":a._size_?"vector":typeof a}};a.Parser=q;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=Math.floor,e=function(d){this.parent=d;this.parser=new a.Parser(this);this.variables=this.parser.variables;this.functions=this.parser.functions;this.vectors=this.parser.vectors;this.matrices=this.parser.matrices;this.definitions=this.parser.definitions};e.prototype.setDefinition=function(a,e){this.definitions[a]=e};e.prototype.getDefinition=function(a){return this.definitions[a]};e.prototype.setVariable=function(a,e){this.variables[a]=e};e.prototype.getVariable=
function(a){return this.variables[a]};e.prototype.setVector=function(a,e,n){e=0>e?0:f(e);this.vectors[a][e]=n};e.prototype.getVector=function(a,e){e=0>e?0:f(e);return this.vectors[a][e]};e.prototype.setMatrix=function(a,e,n,b){e=0>e?0:f(e);n=0>n?0:f(n);void 0==this.matrices[a][e]&&(this.matrices[a][e]=[]);this.matrices[a][e][n]=b};e.prototype.getMatrix=function(a,e,n){e=0>e?0:f(e);n=0>n?0:f(n);return this.matrices[a][e][n]};e.prototype.setFunction=function(a,e){this.functions[a]=e};e.prototype.getFunction=
function(a){return this.functions[a]};e.prototype.eval=function(a){return a?a.evaluate(this):0};a.externalEvaluator=new e;a.Evaluator=e;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,e,d,r,n,b,h,l,c,k,g,v,u,p,z,q=function(b,c){this.parent=b;this.evaluator=b.evaluator;this.decimals=b.decimals;this.fixed=b.fixed;this.align=b.align||"left";this.anchor=b.anchor||"a_top_left";this.decimal_symbol=b.parent.decimal_symbol;this.w=this.h=100;this.hasContent=""!==c;this.textStr=(c||"").replace(/\\{/g,"\\curlyBracketOpen ").replace(/\\}/g,"\\curlyBracketClose ").replace(/\\\[/g,"\\squareBracketOpen ").replace(/\\\]/g,"\\squareBracketClose ");
this.oldTextStr=this.oldWidth=this.oldSize=this.oldColor=this.oldPosX=this.oldPoxY=null;c.match(/^\{\\rtf1/)?(this.type="rtfNode",this.text=c,this.textNodes=(new a.RTFParser(b.evaluator)).parse(c.substring(10)),this.draw=this.drawRTF):(this.descarTeXParser=new a.DescarTeXParser,this.text=this.parseSimpleText(this.textStr),this.textNodes=new a.TextNode("","textLineBlock",null,null),this.draw=this.drawText)};q.prototype.drawText=function(c,g,k,l,h){f=this.evaluator.eval(this.decimals);e=this.evaluator.eval(this.parent.width);
d=this.evaluator.eval(this.parent.font_size);r=g.getColor?g.getColor():g;n=this.textToString(this.text,f,this.fixed).replace(/\\{/g,"\\curlyBracketOpen ").replace(/\\}/g,"\\curlyBracketClose ").replace(/\\\[/g,"\\squareBracketOpen ").replace(/\\\]/g,"\\squareBracketClose ");0<=n.indexOf("[")&&(n=this.textToString(this.parseSimpleText(n),f,this.fixed));if(this.oldTextStr!==n||this.oldWidth!==e||this.oldSize!==d||this.oldColor!==r||this.oldPosX!==k||this.oldPoxY!==l)b=new a.TextStyle({size:d,family:this.parent.font_family||
"arial",italic:this.parent.italics||!1,bold:this.parent.bold||!1,color:r,align:this.align,border:this.parent.border,border_size:this.parent.border_size,shadowBlur:this.parent.shadowBlur,shadowOffsetX:this.parent.shadowOffsetX,shadowOffsetY:this.parent.shadowOffsetY,shadowColor:this.parent.shadowColor||"transparent"}),this.textNodes=this.descarTeXParser.parse(n,this.evaluator,b),this.textNodes.update(k,l,f,this.fixed,this.align,this.anchor,r,e);h||this.textNodes.draw(c);this.oldTextStr=n;this.oldWidth=
e;this.oldSize=d;this.oldColor=r;this.oldPosX=k;this.oldPoxY=l};q.prototype.drawRTF=function(a,b,c,d,g){b=b.getColor?b.getColor():b;a.fillStyle=a.strokeStyle=b;a.textBaseline="alphabetic";this.textNodes.style.align!==this.align&&this.textNodes.propagateStyle("align",this.align);this.textNodes.update(c,d,this.evaluator.eval(this.decimals),this.fixed,this.align,this.anchor,b,this.evaluator.eval(this.parent.width));g||this.textNodes.draw(a)};q.prototype.parseSimpleText=function(a){a=a.replace("&#x2013",
"\u2013").replace(/&squot;/g,"'");h=[];l="'";k=c=0;g=-1;for(p=a.length;c<p;)v=a.charAt(c),u=a.charAt(c-1),"["===v&&"\\"===u?(h.push(a.substring(k,c-1)+"["),k=c+1):"]"===v&&"\\"===u?(h.push(a.substring(k,c-1)+"]"),k=c+1):"["===v&&-1===g?(h.push(a.substring(k,c)),k=c,g++):"["===v?g++:"]"===v&&0===g?(h.push(this.evaluator.parser.parse(a.substring(k,c+1))),k=c+1,g--):("]"==a.charAt(c)&&(g=0>g?g:g-1),l+=a.charAt(c)),c++;h.push(a.substring(k,c));return h};q.prototype.textToString=function(b,c,d){l="";if("rtfNode"!==
b.type)for(var g=0,k=b.length;g<k;g++)"string"===typeof b[g]?l+=b[g]:(z=this.evaluator.eval(b[g])[0][0],""!==z&&("string"===typeof z?l+=z:Infinity===z?l+="Infinity":-Infinity===z?l+="-Infinity":isNaN(z)||"NaN"===z?l+="NaN":(z=parseFloat(z),z=d?z.toFixed(c):a.removeNeedlessDecimals(z.toFixed(c)),l+=z.toString().replace(".",this.decimal_symbol))));return l};a.TextObject=q;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,e=function(){};e.prototype.tokenize=function(a){a=a.replace(/\\n/g,"\\newline ");var d=[],e=null,b=0,h=a.length;a.charAt(0);var l=!1,c=!1,k=0;f="";for(var g=0;g<h;g++){var v=a.charAt(g);var u=a.charAt(g+1);"\\"===v&&"$"===u&&(c=!0);"{"===v?k++:"}"===v&&(k--,c&&0===k&&(c=!1));c?"_"===v?"{"===u?f+="\\subindex":(f+="\\subindex{"+u+"}",g++):"^"===v?"{"===u?f+="\\superindex":(f+="\\superindex{"+u+"}",g++):f+=v:f+=v}a=f;u=a.charAt(0);for(h=a.length;b<
h;)v=u,u=a.charAt(b+1),l&&("{"===v||"["===v||"\\"===v||" "===v?(l=!1," "===v&&(e={type:"ignore"},d.push(e))):e.value+=v),l||"\\"!==v?l||"{"!==v&&"["!==v?l||"}"!==v&&"]"!==v?l||(e&&"text"===e.type?e.value+=v:e&&"ignore"===e.type?(d.pop(),e=d[d.length-1]):(e={type:"text",value:v},d.push(e))):(e={type:"close",value:v},d.push(e)):(e={type:"open",value:v},d.push(e)):(l=!0,e={type:"command",value:""},d.push(e)),b++;return d};a.DescarTeXTokenizer=e;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=function(){this.tokenizer=new a.DescarTeXTokenizer};f.prototype.parse=function(e,d,f){e=this.tokenizer.tokenize(e);var n=new a.TextNode("","textBlock",f,null),b=new a.TextNode("","textLineBlock",f.clone(),null);n.addChild(b);for(var h=[],l=void 0,c=f,k=[f],g,v,u,p,r=!1,q=0,m=e.length;q<m;q++)if("text"===e[q].type)if("color_parameter"===l)v=new a.Color(e[q].value,d);else if("text_size_parameter"===l)u=parseFloat(e[q].value);else if("textLineBlock"===
b.nodeType){g=e[q].value.split(" ");for(var y=0,w=g.length;y<w;y++)""!==g[y]&&b.addChild(new a.TextNode(g[y],"text",c.clone(),null)),y+1<w&&b.addChild(new a.TextNode(" ","space",c.clone(),null))}else b.addChild(new a.TextNode(e[q].value,"text",c.clone(),null));else"command"===e[q].type&&"curlyBracketOpen"===e[q].value?b.addChild(new a.TextNode("{","text",c.clone(),null)):"command"===e[q].type&&"curlyBracketClose"===e[q].value?b.addChild(new a.TextNode("}","text",c.clone(),null)):"command"===e[q].type&&
"squareBracketOpen"===e[q].value?b.addChild(new a.TextNode("[","text",c.clone(),null)):"command"===e[q].type&&"squareBracketClose"===e[q].value?b.addChild(new a.TextNode("]","text",c.clone(),null)):"command"===e[q].type&&"newline"===e[q].value?(0===b.children.length&&b.addChild(new a.TextNode("","text",c.clone(),null)),b=new a.TextNode("","textLineBlock",f.clone(),null),n.addChild(b)):"command"===e[q].type&&"b"===e[q].value?(l="bold",h.push(l)):"command"===e[q].type&&"i"===e[q].value?(l="italic",
h.push(l)):"command"===e[q].type&&"o"===e[q].value?(l="overline",h.push(l)):"command"===e[q].type&&"u"===e[q].value?(l="underline",h.push(l)):"command"===e[q].type&&"color"===e[q].value?(l="color",h.push(l)):"command"===e[q].type&&"ts"===e[q].value?(l="text_size",h.push(l)):"command"===e[q].type&&"sansserif"===e[q].value.toLowerCase()?(l="sansserif",h.push(l)):"command"===e[q].type&&"serif"===e[q].value.toLowerCase()?(l="serif",h.push(l)):"command"===e[q].type&&"monospace"===e[q].value.toLowerCase()?
(l="monospace",h.push(l)):"command"===e[q].type&&"c"===e[q].value?(l="center",h.push(l)):"command"===e[q].type&&"l"===e[q].value?(l="left",h.push(l)):"command"===e[q].type&&"r"===e[q].value?(l="right",h.push(l)):"command"===e[q].type&&"j"===e[q].value?(l="justify",h.push(l)):"command"===e[q].type&&"$"===e[q].value?(l="formula",h.push(l),r=!0):"command"===e[q].type&&"sum"===e[q].value?(l="sum",h.push(l)):"command"===e[q].type&&"prod"===e[q].value?(l="prod",h.push(l)):"command"===e[q].type&&"int"===
e[q].value?(l="integral",h.push(l)):"command"===e[q].type&&"lim"===e[q].value?(l="limit",h.push(l)):"command"===e[q].type&&"sqrt"===e[q].value?(l="radical",h.push(l)):"command"===e[q].type&&"subindex"===e[q].value?(l="subIndex",h.push(l)):"command"===e[q].type&&"superindex"===e[q].value?(l="superIndex",h.push(l)):"command"===e[q].type&&"frac"===e[q].value?(l="numerator",h.push(l)):"open"===e[q].type&&"{"===e[q].value&&void 0!==l?"bold"===l||"italic"===l||"overline"===l||"underline"===l?(c=c.clone(),
c[l]=!0,k.push(c)):"sansserif"===l?(c=c.clone(),c.family="sansserif",k.push(c)):"serif"===l?(c=c.clone(),c.family="serif",k.push(c)):"monospace"===l?(c=c.clone(),c.family="monospaced",k.push(c)):"text_size"===l?l="text_size_parameter":"text_size_text"===l?(c=c.clone(),c.size=u,k.push(c)):"color"===l?l="color_parameter":"color_text"===l?(c=c.clone(),c.color=v,k.push(c)):"center"===l||"left"===l||"right"===l||"justify"===l?(c=c.clone(),c.align=l,k.push(c),b=new a.TextNode("","textLineBlock",c.clone(),
null),n.addChild(b)):"formula"===l?(c=c.clone(),k.push(c),p=new a.TextNode("","formula",c.clone(),null),b.addChild(p),b=p):"subIndex"===l||"superIndex"===l?r?(c=c.clone(),k.push(c),p=new a.TextNode("",l,c.clone(),null),b.addChild(p),b=p):b.addChild(new a.TextNode("subIndex"===l?"_":"^","text",c.clone(),null)):"radical"===l?r&&(p=new a.TextNode("","radical",c.clone(),null),b.addChild(p),b=p,c=c.clone(),k.push(c),p=new a.TextNode("","index",c.clone(),null),b.addChild(p),b=p,l="index"):"index"===l?r&&
(k.pop(),c=k[k.length-1],p=new a.TextNode("","radicand",c.clone(),null),b.addChild(p),b=p,l="radicand"):"sum"===l||"integral"===l||"limit"===l||"prod"===l?r&&(p=new a.TextNode("",l,c.clone(),null),b.addChild(p),b=p,c=c.clone(),k.push(c),p=new a.TextNode("","from",c.clone(),null),b.addChild(p),b=p,l="from",h[h.length-1]=l):"from"===l?r&&(p=new a.TextNode("","to",c.clone(),null),b.addChild(p),b=p,l="to",h[h.length-1]=l):"to"===l?r&&(k.pop(),c=k[k.length-1],p=new a.TextNode("","what",c.clone(),null),
b.addChild(p),b=p,l="what",h[h.length-1]=l):"numerator"===l?r&&(p=new a.TextNode("","fraction",c.clone(),null),b.addChild(p),b=p,c=c.clone(),k.push(c),p=new a.TextNode("","numerator",c.clone(),null),b.addChild(p),b=p,l="numerator"):"denominator"===l&&(p=new a.TextNode("",l,c.clone(),null),b.addChild(p),b=p):"close"===e[q].type&&"}"===e[q].value&&void 0!==l&&("bold"===l||"italic"===l||"overline"===l||"underline"===l||"color_text"===l||"color"===l||"text_size_text"===l||"text_size"===l||"sansserif"===
l||"serif"===l||"monospace"===l?(k.pop(),c=k[k.length-1],h.pop(),l=h[h.length-1]):"color_parameter"===l?l="color_text":"text_size_parameter"===l?l="text_size_text":"center"===l||"left"===l||"right"===l||"justify"===l?(k.pop(),c=k[k.length-1],h.pop(),l=h[h.length-1],e[q+1]&&"command"===e[q+1].type&&"newline"===e[q+1].value?b=n:(b=new a.TextNode("","textLineBlock",c.clone(),null),n.addChild(b))):"formula"===b.nodeType?(r=!1,k.pop(),c=k[k.length-1],h.pop(),l=h[h.length-1],b=b.parent):"subIndex"===b.nodeType||
"superIndex"===b.nodeType?r&&(k.pop(),c=k[k.length-1],h.pop(),l=h[h.length-1],b=b.parent):"index"===b.nodeType?b=b.parent:"radicand"===b.nodeType?(h.pop(),l=h[h.length-1],b=b.parent.parent):"from"===b.nodeType?b=b.parent:"to"===b.nodeType?b=b.parent:"what"===b.nodeType?(h.pop(),l=h[h.length-1],b=b.parent.parent):"numerator"===b.nodeType?(l="denominator",b=b.parent):"denominator"===b.nodeType&&(k.pop(),c=k[k.length-1],h.pop(),l=h[h.length-1],b=b.parent.parent));var x,A,H=null,E=[];n.children.forEach(function(a){for(var b=
0,c=a.children.length;b<c-1;b++)x=a.children[b],A=a.children[b+1],"text"===x.nodeType&&"text"===A.nodeType&&x.style.equals(A.style)?(null===H&&(H=x,p=x.clone(),H.changeNodeType("word"),H.value="___"+p.value,H.addChild(p)),p=A.clone(),H.addChild(p),E.push(A),H.value+=p.value):H=null});E.forEach(function(a){a.parent.removeChild(a)});n.normalize();n.adjustFontSize();return n};a.DescarTeXParser=f;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,e=function(a){this.size=20;this.family="Arimo";this.overline=this.underline=this.bold=this.italic=!1;this.border=this.color=null;this.align="left";a=a||{};this.set(a)};e.prototype.clone=function(){return new e(Object.assign({},this))};e.prototype.set=function(a){Object.assign(this,a)};e.prototype.equals=function(a){var d=!0,e;for(e in this)this.hasOwnProperty(e)&&(d=d&&this[e]===a[e]);return d};e.prototype.toString=function(d){/arial|sansserif/i.test(this.family)?
f=a.sansserif_font:/times|serif/i.test(this.family)?f=d?a.math_font:a.serif_font:/courier|monospaced/i.test(this.family)&&(f=a.monospace_font);return((this.bold?"bold":"")+" "+(this.italic?"italic":"")+" "+this.size+"px "+f).trim()};a.TextStyle=e;return a}(descartesJS||{});
descartesJS=function(a){function f(a,b){for(var c=0,d=0;d<b;d++)c+=a[d];return c}function e(a){var b={ascent:0,descent:0,h:0,w:0,x:0,y:0,offsetX:0,offsetY:0,marginX:0,marginY:0,paddingX:0,paddingY:0};if(""==a.trim())return b;var c=parseInt(a.match(/(\d+\.*)+px/)[0]);a=a.match("sansserif")?"sansserif":a.match("serif")?"serif":"monospace";b.ascent=Math.ceil((l[a].ascent+25)*c/l[a].unitsPerEm);b.descent=Math.ceil(Math.abs((l[a].descent-25)*c/l[a].unitsPerEm));b.h=b.ascent+b.descent;return b}if(a.loadLib)return a;
var d=!1,r="#000000",n=2,b=!1,h=function(b,d,g,e){this.type="rtfNode";this.evaluator=e;this.parent=null;this.children=[];this.metrics={ascent:0,descent:0,h:0,w:0,x:0,y:0,offsetX:0,offsetY:0,marginX:0,marginY:0,paddingX:0,paddingY:0};this.value=b;this.style=g;this.changeNodeType(d);this.drawBorder=a.in_editor?this.drawBorderSpecial:function(){}};h.prototype.changeNodeType=function(a){this.nodeType=a;this.draw=null;switch(this.nodeType){case "textBlock":this.draw=this.drawTextBlock;break;case "textLineBlock":this.draw=
this.drawTextLineBlock;break;case "formula":this.draw=this.drawFormula;break;case "superIndex":this.draw=this.drawSuperIndex;break;case "subIndex":this.draw=this.drawSubIndex;break;case "dynamicText":this.draw=this.drawDynamicText;this.decimal_symbol=this.evaluator.parent.decimal_symbol;break;case "fraction":this.draw=this.drawFraction;break;case "numerator":case "denominator":this.draw=this.drawNumDen;break;case "radical":this.draw=this.drawRadical;break;case "limit":this.draw=this.drawLimit;break;
case "integral":this.draw=this.drawIntegral;break;case "prod":this.draw=this.drawProd;break;case "sum":this.draw=this.drawSum;break;case "matrix":this.draw=this.drawMatrix;break;case "defparts":this.draw=this.drawDefparts;break;case "text":case "newLine":case "mathSymbol":this.draw=this.drawText;break;case "space":this.draw=this.drawSpace;break;case "word":this.draw=this.drawWord;break;case "hyperlink":this.draw=this.drawHyperlink;break;case "index":case "radicand":case "from":case "to":case "what":case "element":this.draw=
this.drawGenericBlock;break;case "componentNumCtrl":this.draw=this.drawComponentNumCtrl;break;case "componentSpace":this.draw=this.drawComponentSpace}};h.prototype.clone=function(){for(var a=new h(this.value,this.nodeType,this.style.clone()),b=0,d=this.children.length;b<d;b++)a.addChild(this.children[b].clone());return a};h.prototype.toStr=function(){for(var a=this.value,b=0,d=this.children.length;b<d;b++)a+=" "+this.children[b].toStr();return a};h.prototype.stringify=function(){var a="{"+('"NT":"'+
this.nodeType+'",');a+='"V":"'+(this.value||"")+'",';a+='"C":[';for(var b=0,d=this.children.length;b<d;b++)a+=this.children[b].stringify()+(b==d-1?"":",");a=a+"],"+('"S":'+JSON.stringify(this.style));return a+"}"};h.prototype.addChild=function(a,b){b&&null!==a.parent&&a.parent.removeChild(a);a.parent=this;this.children.push(a)};h.prototype.removeChild=function(a){var b=this.children.indexOf(a);-1!==b&&(a.parent=null,this.children.splice(b,1))};h.prototype.getFirstTextNode=function(){for(var a=this;0<
a.children.length;)a=a.children[0];return a};h.prototype.getLastTextNode=function(){for(var a=this;0<a.children.length;)a=a.children[a.children.length-1];return a};h.prototype.nextSibling=function(){if(this.parent)for(var a=null,b=0,d=this.parent.children.length;b<d;b++){if(a)return this.parent.children[b];this.parent.children[b]===this&&(a=!0)}return null};h.prototype.prevSibling=function(){if(this.parent)for(var a=0,b=this.parent.children.length-1;a<b;a++)if(this.parent.children[a+1]===this)return this.parent.children[a];
return null};h.prototype.queryAll=function(a){var b=[];"string"===typeof a&&(a=new RegExp(a));for(var c=0,d=this.children.length;c<d;c++)b=b.concat(this.children[c].queryAll(a));this.nodeType.match(a)&&b.push(this);return b};h.prototype.insertBefore=function(a,b){a=this.children.indexOf(a);-1!==a&&(b.parent=this,this.children.splice(a,0,b))};h.prototype.insertAfter=function(a,b){a=this.children.indexOf(a);-1!==a&&(b.parent=this,this.children.splice(a+1,0,b))};h.prototype.normalize=function(){for(var a=
this.queryAll(/textLineBlock|formula|numerator|denominator|superIndex|subIndex|index|subIndex|radicand|from|to|what|element/),b=0,d=a.length;b<d;b++)0===a[b].children.length&&a[b].addChild(new h("","text",a[b].style));a=this.queryAll(/formula|fraction|superIndex|subIndex|radical|sum|integral|prod|limit|matrix|defparts|dynamicText|componentNumCtrl|componentSpace/);b=0;for(d=a.length;b<d;b++){var e=a[b];(null===e.prevSibling()||null!==e.prevSibling()&&"text"!==e.prevSibling().nodeType)&&e.parent.insertBefore(e,
new h("","text",e.parent.style));(null===e.nextSibling()||null!==e.nextSibling()&&"text"!==e.nextSibling().nodeType)&&e.parent.insertAfter(e,new h("","text",e.parent.style))}return this};h.prototype.removeEmptyText=function(){for(var a=this.queryAll(/text/),b=0,d=a.length;b<d;b++)""===a[b].value&&a[b].parent&&a[b].parent.removeChild(a[b])};h.prototype.adjustFontSize=function(a){var b=this.style.size;"formula"===this.nodeType&&(a=!0);for(var c=0,d=this.children.length;c<d;c++)"text"===this.children[c].nodeType&&
a?(this.children[c].style.size=b,this.children[c].styleString=this.children[c].style.toString()):"index"===this.children[c].nodeType?(this.children[c].style.size=Math.max(parseInt(b-.5*b),8),this.children[c].styleString=this.children[c].style.toString(),this.children[c].adjustFontSize(!0)):"to"===this.children[c].nodeType||"from"===this.children[c].nodeType?(this.children[c].style.size=Math.max(parseInt(b-.2*b),8),this.children[c].styleString=this.children[c].style.toString(),this.children[c].adjustFontSize(!0)):
"numerator"===this.children[c].nodeType||"denominator"===this.children[c].nodeType?(this.children[c].style.size=Math.max(parseInt(b-.1*b),8),this.children[c].styleString=this.children[c].style.toString(),this.children[c].adjustFontSize(!0)):"subIndex"===this.children[c].nodeType||"superIndex"===this.children[c].nodeType?(this.children[c].style.size=Math.max(parseInt(b-.33*b),8),this.children[c].styleString=this.children[c].style.toString(),this.children[c].adjustFontSize(!0)):(a&&(this.children[c].style.size=
b,this.children[c].styleString=this.children[c].style.toString()),this.children[c].adjustFontSize(a))};h.prototype.propagateStyle=function(a,b){this.style[a]=b;this.styleString=this.style.toString();for(var c=0,d=this.children.length;c<d;c++)this.children[c].propagateStyle(a,b)};h.prototype.update=function(a,d,g,e,f,l,h,q){n=g;b=e;r=h;this.metrics.w=this.metrics.h=0;h=d;if(20<=q)for(g=0;g<this.children.length;g++)this.children[g].breakLines(q);g=0;for(e=this.children.length;g<e;g++){var c=this.children[g];
c.updateLine();c.metrics.offsetX=a;c.metrics.y=d;d+=parseInt(c.metrics.ascent+.5);c.metrics.offsetY=d;f=parseInt(c.metrics.descent+.5)+parseInt(1.5+.05*c.style.size);d+=f;this.metrics.h+=c.metrics.h;this.metrics.w=Math.max(this.metrics.w,c.metrics.w)}d=h;l=l||"";l.match("right")?a-=this.metrics.w:l.match("_center")&&(a-=this.metrics.w/2);l.match("bottom")?d-=this.metrics.h:l.match("center_")&&(d-=this.metrics.h/2);l=this.children;g=0;for(e=l.length;g<e;g++)"left"===l[g].style.align?l[g].metrics.offsetX=
a:"right"===l[g].style.align?l[g].metrics.offsetX=a+this.metrics.w-l[g].metrics.w:"center"===l[g].style.align?l[g].metrics.offsetX=a+(this.metrics.w-l[g].metrics.w)/2:"justify"===l[g].style.align&&20<=q&&(f=g<e-1?l[g+1].value:null,l[g].metrics.offsetX=a,"wrap"===f&&l[g].justifyAux(q)),l[g].metrics.y=d,d+=parseInt(l[g].metrics.ascent+.5),l[g].metrics.offsetY=d,f=parseInt(l[g].metrics.descent+.5)+parseInt(1.5+.05*l[g].style.size),d+=f};h.prototype.breakLines=function(b){for(var c,d=0,e=!1,f=[],l=0,
n=this.children.length;l<n;l++)c=this.children[l],e?f.push(c):("text"===c.nodeType||"space"===c.nodeType?(a.ctx.font=c.style.toString(),c.metrics.w=a.ctx.measureText(c.value).width):"word"===c.nodeType?c.updateLine():"formula"===c.nodeType&&c.updateFormula(),d+=c.metrics.w,d>b&&"space"!==c.nodeType&&0<l&&(e=!0,f.push(c)));if(0<f.length)for(b=new h("wrap","textLineBlock",this.style.clone(),null),this.parent.insertAfter(this,b),l=0,n=f.length;l<n;l++)f[l].parent&&f[l].parent.removeChild(f[l]),b.addChild(f[l])};
h.prototype.updateLine=function(b){var c=this;if("textLineBlock"===this.nodeType||"word"===this.nodeType){this.metrics.w=0;this.metrics.ascent=0;for(var d=this.metrics.descent=0,f=this.children,l,h=0,n=f.length;h<n;h++){l=f[h];if("text"===l.nodeType){a.ctx.font=l.style.toString();var q=""!==l.value?l.value:a.in_editor?"\u200a":"";l.metrics=e(a.ctx.font);l.metrics.w=a.ctx.measureText(q).width;l.metrics.offsetX=d;Object.defineProperties(l.metrics,{x:{get:function(){return c.metrics.offsetX+this.offsetX}},
y:{get:function(){return c.metrics.offsetY+this.offsetY}}})}"space"===l.nodeType?(a.ctx.font=l.style.toString(),l.metrics=e(a.ctx.font),l.metrics.w=h===n-1?0:b?b:a.ctx.measureText(" ").width,l.metrics.offsetX=d,Object.defineProperties(l.metrics,{x:{get:function(){return c.metrics.offsetX+this.offsetX}},y:{get:function(){return c.metrics.offsetY+this.offsetY}}})):"word"===l.nodeType&&(l.updateLine(),l.metrics.offsetX_aux=d,Object.defineProperties(l.metrics,{offsetX:{get:function(){return c.metrics.offsetX+
this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY}}}));"hyperlink"===l.nodeType&&(a.ctx.font=l.styleString,q=""!==l.value?l.value:a.in_editor?"\u200a":"",l.metrics=e(a.ctx.font),l.metrics.w=a.ctx.measureText(q).width,l.metrics.offsetX=d,Object.defineProperties(l.metrics,{x:{get:function(){return c.metrics.offsetX+this.offsetX}},y:{get:function(){return c.metrics.offsetY}}}),l.clickCatcher||(l.clickCatcher=a.newHTML("div",{style:"position:absolute;width:"+l.metrics.w+"px;height:"+
l.metrics.h+"px;cursor:pointer;"}),l.clickCatcher.rtfNode=l,l.clickCatcher.action=new a.OpenURL(this.evaluator.parent,l.URL),l.clickCatcher.addEventListener("click",function(a){this.rtfNode.click=!0;this.action.execute();this.rtfNode.draw(this.rtfNode.ctx)})));"componentNumCtrl"===l.nodeType&&(l.componentNumCtrl=this.evaluator.parent.getControlByCId(l.value),a.ctx.font=l.styleString,l.metrics=e(a.ctx.font),l.metrics.w=l.componentNumCtrl.w,l.metrics.h=l.componentNumCtrl.h,l.metrics.offsetX=d,Object.defineProperties(l.metrics,
{x:{get:function(){return c.metrics.offsetX+this.offsetX}},y:{get:function(){return c.metrics.offsetY}}}));"componentSpace"===l.nodeType?(l.componentSpace=this.evaluator.parent.getSpaceByCId(l.value),a.ctx.font=l.styleString,l.metrics=e(a.ctx.font),l.metrics.w=l.componentSpace.w,l.metrics.h=l.componentSpace.h,l.metrics.offsetX=d,Object.defineProperties(l.metrics,{x:{get:function(){return c.metrics.offsetX+this.offsetX}},y:{get:function(){return c.metrics.offsetY}}})):"formula"===l.nodeType&&(l.updateFormula(),
l.metrics.marginX=l.metrics.marginY=l.metrics.paddingX=l.metrics.paddingY=0,l.metrics.offsetX_aux=d,Object.defineProperties(l.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY}}}),l.metrics.w+=2*l.metrics.paddingX,l.metrics.ascent+=l.metrics.paddingY,l.metrics.descent+=l.metrics.paddingY,l.metrics.h+=2*l.metrics.paddingY,d+=2*l.metrics.marginX);
this.metrics.w+=l.metrics.w+2*l.metrics.marginX;this.metrics.ascent=Math.max(this.metrics.ascent,l.metrics.ascent);this.metrics.descent=Math.max(this.metrics.descent,l.metrics.descent);d+=l.metrics.w}this.metrics.h=this.metrics.ascent+this.metrics.descent}};h.prototype.updateFormula=function(){var c=this;this.metrics={ascent:0,descent:0,h:0,w:0,x:0,y:0,offsetX:0,offsetY:0,marginX:0,marginY:0,paddingX:0,paddingY:0};for(var d=this.children,g,l=0,h={metrics:{ascent:0,descent:0,h:0,w:0,x:0,y:0,offsetX:0,
offsetY:0,marginX:0,marginY:0,paddingX:0,paddingY:0}},p=0,r=d.length;p<r;p++){g=d[p];if("text"===g.nodeType){a.ctx.font=g.style.toString(!0);var q=""!==g.value?g.value:a.in_editor?"\u200a":"";g.metrics=e(a.ctx.font);g.metrics.w=a.ctx.measureText(q).width;g.metrics.offsetX=l;Object.defineProperties(g.metrics,{x:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.offsetX}},y:{get:function(){return c.metrics.offsetY}}});l+=c.metrics.marginX}else if("dynamicText"===g.nodeType){q=void 0===
g.decimals?n:g.evaluator.eval(g.decimals);var m=void 0===g.fixed?b:g.fixed,y=g.evaluator.eval(g.value);parseFloat(y).toString()===y.toString()&&(y=m?parseFloat(y).toFixed(q):a.removeNeedlessDecimals(parseFloat(y).toFixed(q)),y=(""+y).replace(".",g.decimal_symbol));g.evalValue=y;a.ctx.font=g.style.toString(!0);g.metrics=e(a.ctx.font);g.metrics.marginX=0;g.metrics.paddingX=0;g.metrics.w=a.ctx.measureText(y).width+2*g.metrics.paddingX;g.metrics.offsetX_aux=l;Object.defineProperties(g.metrics,{x:{get:function(){return this.offsetX}},
y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.offsetX_aux+this.marginX}},offsetY:{get:function(){return c.metrics.offsetY}}});l+=2*g.metrics.marginX}if("superIndex"===g.nodeType)q=g,q.updateFormula(),q.metrics.marginX=0,q.metrics.paddingX=0,q.metrics.paddingY=0,q.metrics.offsetX_aux=l,q.metrics.prevChild=h,Object.defineProperties(q.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+
c.metrics.paddingX+this.offsetX_aux+this.marginX}},offsetY:{get:function(){return c.metrics.offsetY+this.ascent+(this.prevChild.metrics.descent-this.prevChild.metrics.ascent)/2-this.h}}}),q.metrics.w+=2*q.metrics.paddingX,q.metrics.ascent+=q.metrics.paddingY,q.metrics.descent+=q.metrics.paddingY,q.metrics.h+=2*q.metrics.paddingY,q.metrics.tmp_ascent=q.metrics.h+(q.metrics.prevChild.metrics.ascent-q.metrics.prevChild.metrics.descent)/2,l+=2*q.metrics.marginX;else if("subIndex"===g.nodeType)q=g,q.updateFormula(),
q.metrics.marginX=0,q.metrics.paddingX=0,q.metrics.paddingY=0,q.metrics.offsetX_aux=l,q.metrics.prevChild=h,Object.defineProperties(q.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY+this.ascent+(this.prevChild.metrics.descent-this.prevChild.metrics.ascent)/2}}}),q.metrics.w+=q.metrics.paddingX,q.metrics.ascent+=q.metrics.paddingY,
q.metrics.descent+=q.metrics.paddingY,q.metrics.h+=2*q.metrics.paddingY,this.metrics.descent=q.metrics.ascent+(q.metrics.prevChild.metrics.descent-q.metrics.prevChild.metrics.ascent)/2+q.metrics.descent,l+=q.metrics.marginX;else if("fraction"===g.nodeType){m=g;m.updateFormula();q=m.children;y=q[0];q=q[1];m.metrics.marginX=parseInt(.5+.075*this.style.size);m.metrics.paddingX=0;m.metrics.paddingY=0;var w=Math.max(y.metrics.w,q.metrics.w)+2*m.metrics.paddingX;m.metrics.prevChild=h;m.metrics.offsetX_aux=
l;var x=parseInt(-h.metrics.descent+4*h.metrics.h/9);Object.defineProperties(m.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY+x}},offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY-x}}});Object.defineProperties(y.metrics,{parent:{value:m},maxWidth:{value:w},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+
parseInt((this.maxWidth-this.w)/2)}},offsetY:{get:function(){return this.parent.metrics.offsetY-this.descent-this.parent.metrics.paddingY}}});Object.defineProperties(q.metrics,{parent:{value:m},maxWidth:{value:w},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+parseInt((this.maxWidth-this.w)/2)}},offsetY:{get:function(){return this.parent.metrics.offsetY+this.ascent+this.parent.metrics.paddingY}}});m.metrics.w=
w;m.metrics.ascent=y.metrics.h+x+2*m.metrics.paddingY;m.metrics.descent=q.metrics.h-x+2*m.metrics.paddingY;m.metrics.h=y.metrics.h+q.metrics.h+4*m.metrics.paddingY;l+=2*m.metrics.marginX}else if("radical"===g.nodeType){h=g;h.updateFormula();q=h.children;m=q[0];var A=q[1];h.metrics.marginX=parseInt(1.5+.075*this.style.size);h.metrics.paddingX=parseInt(1.5+.075*this.style.size);h.metrics.paddingY=parseInt(1.5+.05*this.style.size);h.metrics.offsetX_aux=l;Object.defineProperties(h.metrics,{x:{get:function(){return this.offsetX}},
y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY}}});q=h.style.size;h.radicalSign={w:q,scaleX:q/722,scaleY:A.metrics.h/1E3};y=parseInt(m.metrics.w-2*h.radicalSign.w/3);Object.defineProperties(h.radicalSign,{parent:{value:h},displaceIndex:{value:y},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+Math.max(this.displaceIndex,0)}},
y:{get:function(){return c.metrics.offsetY-A.metrics.ascent}}});Object.defineProperties(m.metrics,{parent:{value:h},displaceIndex:{value:y},fontSize:{value:q},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+Math.max(this.displaceIndex,0)-this.displaceIndex}},offsetY:{get:function(){return c.metrics.offsetY-this.descent-2*this.fontSize/5}}});Object.defineProperties(A.metrics,{parent:{value:h},
displaceIndex:{value:y},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+this.parent.radicalSign.w+Math.max(this.displaceIndex,0)}},offsetY:{get:function(){return c.metrics.offsetY}}});y=m.metrics.w<2*h.radicalSign.w/3?h.radicalSign.w:parseInt(m.metrics.w+h.radicalSign.w/3);h.metrics.w=y+2*h.metrics.paddingX+A.metrics.w;h.metrics.ascent=Math.max(A.metrics.ascent,m.metrics.h+2*q/5)+
h.metrics.paddingY;h.metrics.descent=A.metrics.descent+h.metrics.paddingY;h.metrics.h=h.metrics.ascent+h.metrics.descent;l+=2*h.metrics.marginX}else if("sum"===g.nodeType){m=g;m.updateFormula();q=m.children;y=q[0];w=q[1];var H=q[2];m.metrics.marginX=parseInt(1.5+.075*this.style.size);m.metrics.paddingX=parseInt(1.5+.075*this.style.size);m.metrics.paddingY=parseInt(1.5+.05*this.style.size);m.metrics.offsetX_aux=l;Object.defineProperties(m.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},
offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY}}});a.ctx.font=g.style.toString();var E=e(a.ctx.font);h=parseInt(1.2*E.h);q=parseInt(.5+780*h/1E3);m.sigmaSign={w:q,h:h,scale:h/1E3};var G=Math.max(w.metrics.w,y.metrics.w,m.sigmaSign.w);m.sigmaSign.parent=m;Object.defineProperties(m.sigmaSign,{sumWidth:{value:G},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.sumWidth-
this.w)/2)}},y:{get:function(){return c.metrics.offsetY+E.descent-(this.h+E.h)/2}}});q=E.descent-w.metrics.descent-(h+E.h)/2-m.metrics.paddingY;Object.defineProperties(w.metrics,{parent:{value:m},sumWidth:{value:G},newBaselineTo:{value:q},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.sumWidth-this.w)/2)}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaselineTo}}});
h=y.metrics.ascent+E.descent+(h-E.h)/2+m.metrics.paddingY;Object.defineProperties(y.metrics,{parent:{value:m},sumWidth:{value:G},newBaselineFrom:{value:h},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.sumWidth-this.w)/2)}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaselineFrom}}});Object.defineProperties(H.metrics,{parent:{value:m},sumWidth:{value:G},
x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+2*this.parent.metrics.paddingX+this.sumWidth}},offsetY:{get:function(){return c.metrics.offsetY}}});m.metrics.w=G+H.metrics.w+3*m.metrics.paddingX;m.metrics.ascent=Math.max(H.metrics.ascent,-q+w.metrics.ascent)+m.metrics.paddingY;m.metrics.descent=Math.max(H.metrics.descent,h+y.metrics.descent)+m.metrics.paddingY;m.metrics.h=m.metrics.ascent+m.metrics.descent;
l+=2*m.metrics.marginX}else if("integral"===g.nodeType){m=g;m.updateFormula();q=m.children;y=q[0];w=q[1];H=q[2];m.metrics.marginX=parseInt(1.5+.075*this.style.size);m.metrics.paddingX=parseInt(1.5+.075*this.style.size);m.metrics.paddingY=parseInt(1.5+.05*this.style.size);m.metrics.offsetX_aux=l;Object.defineProperties(m.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.marginX+this.offsetX_aux}},
offsetY:{get:function(){return c.metrics.offsetY}}});a.ctx.font=g.style.toString();E=e(a.ctx.font);G=parseInt(1.2*E.h);var F=parseInt(10.5+529*G/1E3);m.sign={w:F,h:G,scale:G/1E3};m.sign.parent=m;Object.defineProperties(m.sign,{x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX}},y:{get:function(){return c.metrics.offsetY+E.descent-(this.h+E.h)/2}}});q=E.descent-(G+E.h)/2-w.metrics.descent+G/3;Object.defineProperties(w.metrics,{parent:{value:m},integralWidth:{value:F},
newBaselineTo:{value:q},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt(4*this.integralWidth/5)}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaselineTo}}});h=E.descent+y.metrics.ascent/2;Object.defineProperties(y.metrics,{parent:{value:m},integralWidth:{value:F},newBaselineFrom:{value:h},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},
offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt(2*this.integralWidth/5)}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaselineFrom}}});F=Math.max(parseInt(3*F/5)+w.metrics.w,parseInt(2*F/5+y.metrics.w))+m.metrics.paddingX;Object.defineProperties(H.metrics,{parent:{value:m},whatDisplace:{value:F},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+
this.whatDisplace}},offsetY:{get:function(){return c.metrics.offsetY}}});m.metrics.w=F+H.metrics.w+2*m.metrics.paddingX;m.metrics.ascent=Math.max(H.metrics.ascent,-q+w.metrics.ascent)+m.metrics.paddingY;m.metrics.descent=Math.max(H.metrics.descent,h+y.metrics.descent,G-m.metrics.ascent)+m.metrics.paddingY;m.metrics.h=Math.max(m.metrics.ascent+m.metrics.descent,G);l+=2*m.metrics.marginX}else if("prod"===g.nodeType)m=g,m.updateFormula(),q=m.children,y=q[0],w=q[1],H=q[2],m.metrics.marginX=parseInt(1.5+
.075*this.style.size),m.metrics.paddingX=parseInt(1.5+.075*this.style.size),m.metrics.paddingY=parseInt(1.5+.05*this.style.size),m.metrics.offsetX_aux=l,Object.defineProperties(m.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY}}}),a.ctx.font=g.style.toString(),E=e(a.ctx.font),h=parseInt(1.2*E.h),q=parseInt(.5+
876*h/1E3),m.piSign={w:q,h:h,scale:h/1E3},G=Math.max(w.metrics.w,y.metrics.w,m.piSign.w),m.piSign.parent=m,Object.defineProperties(m.piSign,{prodWidth:{value:G},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.prodWidth-this.w)/2)}},y:{get:function(){return c.metrics.offsetY+E.descent-(this.h+E.h)/2}}}),q=E.descent-w.metrics.descent-(h+E.h)/2-m.metrics.paddingY,Object.defineProperties(w.metrics,{parent:{value:m},prodWidth:{value:G},newBaselineTo:{value:q},
x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.prodWidth-this.w)/2)}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaselineTo}}}),h=y.metrics.ascent+E.descent+(h-E.h)/2+m.metrics.paddingY,Object.defineProperties(y.metrics,{parent:{value:m},prodWidth:{value:G},newBaselineFrom:{value:h},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},
offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.prodWidth-this.w)/2)}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaselineFrom}}}),Object.defineProperties(H.metrics,{parent:{value:m},prodWidth:{value:G},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+2*this.parent.metrics.paddingX+this.prodWidth}},offsetY:{get:function(){return c.metrics.offsetY}}}),
m.metrics.w=G+H.metrics.w+3*m.metrics.paddingX,m.metrics.ascent=Math.max(H.metrics.ascent,-q+w.metrics.ascent)+m.metrics.paddingY,m.metrics.descent=Math.max(H.metrics.descent,h+y.metrics.descent)+m.metrics.paddingY,m.metrics.h=m.metrics.ascent+m.metrics.descent,l+=2*m.metrics.marginX;else if("limit"===g.nodeType){h=g;h.updateFormula();q=h.children;var D=q[0];m=q[1];q=q[2];h.metrics.marginX=parseInt(1.5+.075*this.style.size);h.metrics.paddingX=parseInt(1.5+.075*this.style.size);h.metrics.paddingY=
parseInt(1.5+.05*this.style.size);h.metrics.offsetX_aux=l;Object.defineProperties(h.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY}}});a.ctx.font=g.style.toString();E=e(a.ctx.font);y=parseInt(.5+a.ctx.measureText("l\u00edm").width);w=parseInt(.5+a.ctx.measureText("\u2192").width);H=Math.max(y,D.metrics.w+w+m.metrics.w);
h.limitText={parent:h};Object.defineProperties(h.limitText,{limitWidth:{value:H},limitTextWidth:{value:y},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+(this.limitWidth-this.limitTextWidth)/2}}});y=E.descent+Math.max(D.metrics.ascent,m.metrics.ascent,2*E.ascent/3)+h.metrics.paddingY;h.limitArrow={parent:h};Object.defineProperties(h.limitArrow,{newBaseline:{value:y},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+D.metrics.w}},y:{get:function(){return c.metrics.offsetY+
this.newBaseline}}});Object.defineProperties(D.metrics,{parent:{value:h},newBaseline:{value:y},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaseline}}});Object.defineProperties(m.metrics,{parent:{value:h},arrowWidth:{value:w},newBaseline:{value:y},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},
offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+D.metrics.w+this.arrowWidth}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaseline}}});Object.defineProperties(q.metrics,{parent:{value:h},limitWidth:{value:H},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+2*this.parent.metrics.paddingX+this.limitWidth}},offsetY:{get:function(){return c.metrics.offsetY}}});
h.metrics.w=H+q.metrics.w+3*h.metrics.paddingX;h.metrics.ascent=Math.max(q.metrics.ascent,E.ascent)+h.metrics.paddingY;w=0;q=Math.max(D.metrics.descent,m.metrics.descent,q.metrics.descent);if(0!=D.metrics.h||0!=m.metrics.h)w=y,q=Math.max(D.metrics.descent,m.metrics.descent,q-w);h.metrics.descent=w+q+h.metrics.paddingY;h.metrics.h=h.metrics.ascent+h.metrics.descent;l+=2*h.metrics.marginX}else if("matrix"===g.nodeType){y=g;y.updateFormula();q=y.children;w=y.rows;H=y.columns;y.metrics.marginX=parseInt(1.5+
.075*this.style.size);y.metrics.paddingX=parseInt(5+.075*this.style.size);y.metrics.paddingY=parseInt(1.5+.05*this.style.size);y.metrics.offsetX_aux=l;Object.defineProperties(y.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY}}});a.ctx.font=g.style.toString();E=e(a.ctx.font);G=[];F=[];h=0;for(var B=w*H;h<B;h++){var K=
parseInt(h/H);var L=h%H;G[K]=Math.max(G[K]||0,q[h].metrics.h);F[L]=Math.max(F[L]||0,q[h].metrics.w)}var M=(1+H)*y.metrics.paddingX;for(h=0;h<H;h++)M+=F[h];var O=(1+w)*y.metrics.paddingY;for(h=0;h<w;h++)O+=G[h];m=E.descent-E.h/2;h=0;for(B=w*H;h<B;h++)K=parseInt(h/H),L=h%H,q[h].metrics.offsetX_aux=f(F,L)+(F[L]-q[h].metrics.w)/2+L*y.metrics.paddingX,q[h].metrics.offsetY_aux=f(G,K)+(G[K]-q[h].metrics.h)/2+(1+K)*y.metrics.paddingY,Object.defineProperties(q[h].metrics,{parent:{value:y},matrixH:{value:O},
dispY:{value:m},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY-this.matrixH/2+this.ascent+this.offsetY_aux+this.dispY}}});y.metrics.w=M;y.metrics.ascent=O/2-m;y.metrics.descent=O/2+m;y.metrics.h=y.metrics.ascent+y.metrics.descent;l+=2*y.metrics.marginX}else if("defparts"===g.nodeType){y=g;y.updateFormula();q=g.children;
w=g.parts;y.metrics.marginX=parseInt(1.5+.075*this.style.size);y.metrics.paddingX=parseInt(1.5+.075*this.style.size);y.metrics.paddingY=parseInt(1.5+.05*this.style.size);y.metrics.offsetX_aux=l;Object.defineProperties(y.metrics,{parent:{value:c},x:{get:function(){return this.offsetX-2*this.marginX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+3*this.marginX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY}}});a.ctx.font=
g.style.toString();E=e(a.ctx.font);H=0;G=y.metrics.paddingY;m=E.descent-E.h/2;for(h=0;h<w;h++)q[h].metrics.offsetY_aux=G,H=Math.max(H,q[h].metrics.w),G+=q[h].metrics.h+y.metrics.paddingY,Object.defineProperties(q[h].metrics,{parent:{value:y},dispY:{value:m},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX}},offsetY:{get:function(){return c.metrics.offsetY-this.parent.metrics.defpartsH/
2+this.ascent+this.offsetY_aux+this.dispY}}});y.metrics.defpartsH=G;y.metrics.w=H+4*y.metrics.paddingX;y.metrics.ascent=G/2-m;y.metrics.descent=G/2+m;y.metrics.h=y.metrics.ascent+y.metrics.descent;l+=2*y.metrics.marginX}else if("numerator"===g.nodeType||"denominator"===g.nodeType||"index"===g.nodeType||"radicand"===g.nodeType||"from"===g.nodeType||"to"===g.nodeType||"what"===g.nodeType||"element"===g.nodeType)g.updateFormula(),g.metrics.paddingX=parseInt(1.5+.075*this.style.size),g.metrics.paddingY=
parseInt(1.5+.05*this.style.size),g.metrics.ascent+=g.metrics.paddingY,g.metrics.descent+=g.metrics.paddingY,g.metrics.h=g.metrics.ascent+g.metrics.descent,1==g.children.length&&"text"==g.children[0].nodeType&&""==g.children[0].value?(g.metrics.w=0,a.in_editor||(g.metrics.ascent=g.metrics.descent=g.metrics.h=0)):g.metrics.w+=2*g.metrics.paddingX;h=g;this.metrics.ascent=Math.max(this.metrics.ascent,g.metrics.tmp_ascent||g.metrics.ascent);this.metrics.descent=Math.max(this.metrics.descent,g.metrics.descent);
this.metrics.w+=g.metrics.w+2*g.metrics.marginX;this.metrics.h=this.metrics.ascent+this.metrics.descent;l+=g.metrics.w}};h.prototype.justifyAux=function(a){for(var b=0,c=0,d=0,e=this.children.length;d<e-1;d++)"space"===this.children[d].nodeType?b++:c+=this.children[d].metrics.w;this.updateLine((a-c)/b)};h.prototype.drawTextBlock=function(a){a.fillStyle=r;a.shadowBlur=this.style.shadowBlur;a.shadowOffsetX=this.style.shadowOffsetX;a.shadowOffsetY=this.style.shadowOffsetY;a.shadowColor=this.style.shadowColor;
for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);a.shadowColor="transparent"};h.prototype.drawTextLineBlock=function(a){for(var b=0,c=this.children.length;b<c;b++)d=!1,this.children[b].draw(a)};h.prototype.drawText=function(a){if(""!==this.value){var b=this.metrics.x,c=this.metrics.y;a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:r;a.font=this.style.toString(d);a.beginPath();this.style.overline&&(a.rect(b,c-this.metrics.ascent+
parseInt(1+this.style.size/25),this.metrics.w,parseInt(1+this.style.size/25)),a.fill());this.style.underline&&(a.rect(b,c+parseInt(1+this.style.size/10),this.metrics.w,parseInt(1+this.style.size/25)),a.fill());if(this.style.border){var e=a.strokeStyle;a.lineWidth=this.style.border_size&&0<parseInt(this.style.border_size)?parseInt(this.style.border_size):1+parseInt(this.style.size/8);a.lineJoin="round";a.miterLimit=2;a.strokeStyle=this.style.border.getColor();a.strokeText(this.value,b,c);a.strokeStyle=
e}a.fillText(this.value,b,c)}};h.prototype.drawWord=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a)};h.prototype.drawSpace=function(a){};h.prototype.drawDynamicText=function(a){var b=this.metrics.x+this.metrics.paddingX,c=this.metrics.y;a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:r;a.font=this.style.toString(d);a.beginPath();this.style.overline&&(a.rect(b,c-this.metrics.ascent+parseInt(1+this.style.size/
25),this.metrics.w,parseInt(1+this.style.size/25)),a.fill());this.style.underline&&(a.rect(b,c+parseInt(1+this.style.size/10),this.metrics.w,parseInt(1+this.style.size/25)),a.fill());a.fillText(this.evalValue,b,c);this.drawBorder(a,"blue")};h.prototype.drawHyperlink=function(a){var b=this.metrics.x,c=this.metrics.y;this.ctx=a;this.clickCatcher.parentNode||(a.canvas.nextSibling.className?a.canvas.parentNode.insertBefore(this.clickCatcher,a.canvas.nextSibling.nextSibling):a.canvas.parentNode.insertBefore(this.clickCatcher,
a.canvas.nextSibling));this.clickCatcher.style.left=b+"px";this.clickCatcher.style.top=c-this.metrics.ascent+"px";a.fillStyle="blue";this.click&&(a.fillStyle="white",a.fillRect(b,c-this.metrics.ascent,this.metrics.w,this.metrics.h),a.fillStyle="red");a.font=this.style.toString(d);a.beginPath();a.rect(b,c+parseInt(1+this.style.size/10),this.metrics.w,parseInt(1+this.style.size/25));a.fill();a.fillText(this.value,b,c)};h.prototype.drawFormula=function(a){for(var b=0,c=this.children.length;b<c;b++)d=
!0,this.children[b].draw(a);this.drawBorder(a,"blue")};h.prototype.drawFraction=function(a){a.lineWidth=5;a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:r;a.beginPath();var b=parseInt(1+this.style.size/24);a.rect(this.metrics.x,this.metrics.offsetY-parseInt(b/2),this.metrics.w,b);a.fill();this.children[0].draw(a);this.children[1].draw(a);this.drawBorder(a,"blue")};h.prototype.drawNumDen=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);
this.drawBorder(a,"blue")};h.prototype.drawSuperIndex=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};h.prototype.drawSubIndex=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};h.prototype.drawRadical=function(a){a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:r;a.save();a.translate(this.radicalSign.x,this.radicalSign.y);a.scale(this.radicalSign.scaleX,
this.radicalSign.scaleY);this.drawRadicalSign(a);a.restore();a.beginPath();a.fillRect(this.children[1].metrics.x+2.5,this.radicalSign.y-.5,this.children[1].metrics.w-1.5,parseInt(1+this.style.size/18));for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};h.prototype.drawSum=function(a){a.save();a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:r;a.translate(this.sigmaSign.x,this.sigmaSign.y);a.scale(this.sigmaSign.scale,
this.sigmaSign.scale);if(this.style.border){var b=a.strokeStyle;a.lineWidth=this.style.border_size&&0<parseInt(this.style.border_size)?parseInt(this.style.border_size):1+parseInt(this.style.size/8);a.lineWidth=parseInt(a.lineWidth/this.sigmaSign.scale);a.lineJoin="round";a.miterLimit=2;a.strokeStyle=this.style.border.getColor();a.strokeStyle=b}this.drawSigmaSign(a);a.restore();b=0;for(var c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};h.prototype.drawIntegral=function(a){a.save();
a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:r;a.translate(this.sign.x,this.sign.y);a.scale(this.sign.scale,this.sign.scale);this.drawIntegralSign(a);a.restore();for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};h.prototype.drawProd=function(a){a.save();a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:r;a.translate(this.piSign.x,this.piSign.y);
a.scale(this.piSign.scale,this.piSign.scale);this.drawProdSign(a);a.restore();for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};h.prototype.drawLimit=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:r;a.font=this.style.toString();a.fillText("l\u00edm",this.limitText.x,this.metrics.y);0!=this.children[1].metrics.h&&a.fillText("\u2192",
this.limitArrow.x,this.limitArrow.y);this.drawBorder(a,"blue")};h.prototype.drawMatrix=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);c=parseInt(1.5+this.style.size/25);b=c/2;a.lineWidth=c;a.strokeStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:r;a.beginPath();if(0==this.matrix_type)a.moveTo(this.metrics.x+b+1.5*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+b,this.metrics.y+b-
this.metrics.ascent),a.lineTo(this.metrics.x+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.lineTo(this.metrics.x+b+1.5*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.moveTo(this.metrics.x+this.metrics.w-b-1.5*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+this.metrics.w-b,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+this.metrics.w-b,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.lineTo(this.metrics.x+
this.metrics.w-b-1.5*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent+this.metrics.h);else if(1==this.matrix_type)a.moveTo(this.metrics.x+b+2*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent),a.bezierCurveTo(this.metrics.x-b,this.metrics.y+b-this.metrics.ascent,this.metrics.x-b,this.metrics.y+b-this.metrics.ascent+this.metrics.h,this.metrics.x+b+2*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.moveTo(this.metrics.x+this.metrics.w-b-2*this.metrics.marginX,
this.metrics.y+b-this.metrics.ascent),a.bezierCurveTo(this.metrics.x+this.metrics.w+b,this.metrics.y+b-this.metrics.ascent,this.metrics.x+this.metrics.w+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h,this.metrics.x+this.metrics.w-b-2*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent+this.metrics.h);else if(2==this.matrix_type){c=3*this.metrics.marginX;var d=c/2;a.moveTo(this.metrics.x+b+c,this.metrics.y+b-this.metrics.ascent);a.bezierCurveTo(this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent,
this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent,this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+2*this.metrics.marginX);a.lineTo(this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2-5*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2);a.bezierCurveTo(this.metrics.x+
b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2+5*this.metrics.marginX);a.lineTo(this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h-2*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+b+d,this.metrics.y-b-this.metrics.ascent+this.metrics.h,this.metrics.x+b+d,this.metrics.y-b-this.metrics.ascent+this.metrics.h,this.metrics.x+
b+c,this.metrics.y-b-this.metrics.ascent+this.metrics.h);a.moveTo(this.metrics.x+this.metrics.w+b-c,this.metrics.y+b-this.metrics.ascent);a.bezierCurveTo(this.metrics.x+this.metrics.w+b-d,this.metrics.y+b-this.metrics.ascent,this.metrics.x+this.metrics.w+b-d,this.metrics.y+b-this.metrics.ascent,this.metrics.x+this.metrics.w+b-d,this.metrics.y+b-this.metrics.ascent+2*this.metrics.marginX);a.lineTo(this.metrics.x+this.metrics.w+b-d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2-5*this.metrics.marginX);
a.bezierCurveTo(this.metrics.x+this.metrics.w+b-d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+this.metrics.w+b-d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+this.metrics.w+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2);a.bezierCurveTo(this.metrics.x+this.metrics.w+b-d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+this.metrics.w+b-d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+this.metrics.w+
b-d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2+5*this.metrics.marginX);a.lineTo(this.metrics.x+this.metrics.w+b-d,this.metrics.y+b-this.metrics.ascent+this.metrics.h-2*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+this.metrics.w+b-d,this.metrics.y-b-this.metrics.ascent+this.metrics.h,this.metrics.x+this.metrics.w+b-d,this.metrics.y-b-this.metrics.ascent+this.metrics.h,this.metrics.x+this.metrics.w+b-c,this.metrics.y-b-this.metrics.ascent+this.metrics.h)}else 3==this.matrix_type?
(a.moveTo(this.metrics.x+b,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.moveTo(this.metrics.x+this.metrics.w-b,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+this.metrics.w-b,this.metrics.y+b-this.metrics.ascent+this.metrics.h)):4==this.matrix_type&&(a.moveTo(this.metrics.x+b,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.moveTo(this.metrics.x+
b+1.25*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+b+1.25*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.moveTo(this.metrics.x+this.metrics.w-b,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+this.metrics.w-b,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.moveTo(this.metrics.x+this.metrics.w-b-1.25*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+this.metrics.w-b-1.25*this.metrics.marginX,
this.metrics.y+b-this.metrics.ascent+this.metrics.h));a.stroke();this.drawBorder(a,"blue")};h.prototype.drawDefparts=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);c=parseInt(1.5+this.style.size/25);b=c/2;a.lineWidth=c;a.strokeStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:r;a.beginPath();c=3*this.metrics.marginX;var d=c/2;a.moveTo(this.metrics.x+b+c,this.metrics.y+b-this.metrics.ascent);a.bezierCurveTo(this.metrics.x+
b+d,this.metrics.y+b-this.metrics.ascent,this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent,this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+2*this.metrics.marginX);a.lineTo(this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2-5*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h/
2);a.bezierCurveTo(this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2+5*this.metrics.marginX);a.lineTo(this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h-2*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+b+d,this.metrics.y-b-this.metrics.ascent+this.metrics.h,this.metrics.x+b+d,this.metrics.y-b-this.metrics.ascent+
this.metrics.h,this.metrics.x+b+c,this.metrics.y-b-this.metrics.ascent+this.metrics.h);a.stroke();this.drawBorder(a,"blue")};h.prototype.drawGenericBlock=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};h.prototype.drawComponentNumCtrl=function(a){this.componentNumCtrl.expresion=this.evaluator.parser.parse("("+this.metrics.x+","+(this.metrics.y-this.metrics.ascent)+","+this.componentNumCtrl.w+","+this.componentNumCtrl.h+")");this.componentNumCtrl&&
this.componentNumCtrl.parent&&this.componentNumCtrl.parent.readyApp&&this.componentNumCtrl.update(!0)};h.prototype.drawComponentSpace=function(a){this.componentSpace.xExpr=this.evaluator.parser.parse(this.metrics.x.toString());this.componentSpace.yExpr=this.evaluator.parser.parse((this.metrics.y-this.metrics.ascent).toString());this.componentSpace&&this.componentSpace.parent&&this.componentSpace.parent.readyApp&&this.componentSpace.update(!0)};h.prototype.drawRadicalSign=function(a){a.beginPath();
a.moveTo(759,1);a.bezierCurveTo(751,1,744,5,739,15);a.lineTo(325,878);a.lineTo(153,500);a.bezierCurveTo(148,489,142,486,136,491);a.lineTo(2,596);a.bezierCurveTo(-3,600,19,626,24,622);a.lineTo(89,575);a.lineTo(282,997);a.bezierCurveTo(285,1003,309,1003,314,993);a.lineTo(773,40);a.lineTo(773,1);a.closePath();a.stroke();a.fill()};h.prototype.drawSigmaSign=function(a){a.beginPath();a.moveTo(780,707);a.lineTo(750,707);a.bezierCurveTo(728,805,695,872,585,872);a.lineTo(180,872);a.lineTo(509,447);a.lineTo(225,
65);a.lineTo(538,65);a.bezierCurveTo(668,65,705,114,726,246);a.lineTo(756,246);a.lineTo(756,0);a.lineTo(25,0);a.lineTo(384,500);a.lineTo(0,1E3);a.lineTo(729,1E3);a.closePath();a.stroke();a.fill()};h.prototype.drawIntegralSign=function(a){a.beginPath();a.moveTo(150,828);a.bezierCurveTo(129,916,108,972,67,972);a.bezierCurveTo(61,972,58,970,58,966);a.bezierCurveTo(58,957,73,958,73,932);a.bezierCurveTo(73,918,60,910,46,910);a.bezierCurveTo(22,910,1,932,1,961);a.bezierCurveTo(1,981,22,1E3,57,1E3);a.bezierCurveTo(154,
1E3,198,895,216,824);a.lineTo(375,181);a.bezierCurveTo(398,90,420,27,464,28);a.bezierCurveTo(470,28,473,30,473,34);a.bezierCurveTo(473,41,458,47,458,69);a.bezierCurveTo(458,83,471,89,485,89);a.bezierCurveTo(509,89,530,67,530,38);a.bezierCurveTo(530,18,508,0,473,0);a.bezierCurveTo(368,0,326,120,309,190);a.closePath();a.stroke();a.fill()};h.prototype.drawProdSign=function(a){a.beginPath();a.moveTo(876.3561,999.59384);a.lineTo(876.3561,972.20771);a.lineTo(858.75073,972.20771);a.bezierCurveTo(794.19771,
972.20771,761.92121,931.12852,761.92121,847.99206);a.lineTo(761.92121,144.75542);a.bezierCurveTo(761.92121,61.618964,789.30733,27.386304,876.3561,27.386304);a.lineTo(876.3561,1.7633057E-4);a.lineTo(1.184082E-5,1.7633057E-4);a.lineTo(1.184082E-5,27.386304);a.lineTo(16.627304,27.386304);a.bezierCurveTo(77.268015,27.386304,115.41298,51.838204,115.41298,148.66773);a.lineTo(115.41298,865.59743);a.bezierCurveTo(115.41298,936.99697,84.114547,972.20771,18.583456,972.20771);a.lineTo(1.184082E-5,972.20771);
a.lineTo(1.184082E-5,999.59384);a.lineTo(359.93198,999.59384);a.lineTo(359.93198,972.20771);a.lineTo(329.61162,972.20771);a.bezierCurveTo(265.0586,972.20771,243.54093,932.10659,243.54093,841.14553);a.lineTo(243.54093,64.553192);a.lineTo(633.79325,64.553192);a.lineTo(633.79325,841.14553);a.bezierCurveTo(633.79325,916.45738,616.18788,972.20771,547.72257,972.20771);a.lineTo(516.42413,972.20771);a.lineTo(516.42413,999.59384);a.closePath();a.stroke();a.fill()};h.prototype.drawBorderSpecial=function(a,
b){a.beginPath();a.setLineDash([1,2]);a.strokeStyle=b;a.lineWidth=1;a.rect(parseInt(this.metrics.x)+.5,parseInt(this.metrics.y-this.metrics.ascent)+.5,this.metrics.w,this.metrics.h);a.stroke();a.setLineDash([])};h.prototype.toRTF=function(){var a=[],b=[],d="";this.mergeTextNodes();for(var e=0,f=this.children.length;e<f;e++){var l=this.children[e];"textLineBlock"===l.nodeType&&(d+=l.toRTFAux(a,b)+(1<f&&e<f-1?"\\par":""))}l="{\\fonttbl";e=0;for(f=a.length;e<f;e++)l+="\\f"+e+"\\fcharset0 "+a[e]+";";
a="";if(0<b.length){a="{\\colortbl";e=0;for(f=b.length;e<f;e++)a+=b[e];a+="}"}return"{\\rtf1\\uc0"+(l+"}")+a+d+"}"};h.prototype.toRTFAux=function(a,b){for(var c,d,e,f=null,l="",k,h,n,w,x,A=0,H=this.children.length;A<H;A++)k=h="",c=this.children[A],n=this.addToFontTable(c.style.family,a),w=c.style.size,x=this.addToColorTable(c.style.color,b),null===x&&0<b.length&&(x=this.addToColorTable(r,b)),x!==f&&(k+="\\cf"+x,f=x),n!==d&&(k+="\\f"+n,d=n),w!==e&&(k+="\\fs"+2*w,e=w),c.style.italic&&(k+="\\i",h="\\i0"+
h),c.style.bold&&(k+="\\b",h="\\b0"+h),c.style.underline&&(k+="\\ul",h="\\ulnone"+h),c.style.overline&&(k+="\\ol",h="\\olnone"+h),"text"===c.nodeType?(c.value=c.value.replace(/\\{/g,"{").replace(/\\}/g,"}").replace(/{/g,"\\{").replace(/}/g,"\\}"),c=""!==k?k+" "+c.value+h:""!==l&&"}"!==l.charAt(l.length-1)?" "+c.value:c.value,l+=c):"formula"===c.nodeType?l+="{\\*\\mjaformula"+c.formulaToRTF(d,e,f,a,b)+"}":"componentSpace"===c.nodeType?l+="{\\*\\component\\Space "+c.value+"}":"componentNumCtrl"===c.nodeType&&
(l+="{\\*\\component\\NumCtrl "+c.value+"}");return l};h.prototype.formulaToRTF=function(a,b,d,e,f){for(var c,g="",l,k,h,n,u=0,v=this.children.length;u<v;u++)l=k="",c=this.children[u],h=this.addToFontTable(c.style.family,e),n=this.addToColorTable(c.style.color,f),null===n&&0<f.length&&(n=this.addToColorTable(r,f)),h!==a&&(l+="\\f"+h,a=h),n!==d&&(l+="\\cf"+n,"text"!==c.nodeType||"text"===c.nodeType&&""!==c.value)&&(d=n),c.style.italic&&(l+="\\i",k="\\i0"+k),c.style.bold&&(l+="\\b",k="\\b0"+k),c.style.underline&&
(l+="\\ul",k="\\ulnone"+k),c.style.overline&&(l+="\\ol",k="\\olnone"+k),"text"===c.nodeType&&""!==c.value?(c.value=c.value.replace(/\\{/g,"{").replace(/\\}/g,"}").replace(/{/g,"\\{").replace(/}/g,"\\}"),tmpRTF=""!==l?l+" "+c.value+k:"}"!==g.charAt(g.length-1)?" "+c.value:c.value,g+=tmpRTF):"dynamicText"===c.nodeType?(c.value=""===c.value?" ":c.value,g+=l+"{\\expr "+c.value+"\\decimals "+(c.decimals||2)+"\\fixed"+(c.fixed?1:0)+"}"+k):"fraction"===c.nodeType||"radical"===c.nodeType||"index"===c.nodeType||
"radicand"===c.nodeType||"sum"===c.nodeType||"integral"===c.nodeType||"prod"===c.nodeType||"limit"===c.nodeType||"from"===c.nodeType||"to"===c.nodeType||"what"===c.nodeType||"element"===c.nodeType?g+="{\\"+c.nodeType+c.formulaToRTF(a,b,d,e,f)+"}":"numerator"===c.nodeType?g+="{\\num"+c.formulaToRTF(a,b,d,e,f)+"}":"denominator"===c.nodeType?g+="{\\den"+c.formulaToRTF(a,b,d,e,f)+"}":"superIndex"===c.nodeType?g+="{\\supix"+c.formulaToRTF(a,b,d,e,f)+"}":"subIndex"===c.nodeType?g+="{\\subix"+c.formulaToRTF(a,
b,d,e,f)+"}":"matrix"===c.nodeType?g+="{\\matrix\\rows "+(c.rows||2)+"\\columns "+(c.columns||2)+c.formulaToRTF(a,b,d,e,f)+"}":"defparts"===c.nodeType&&(g+="{\\defparts\\parts "+(c.parts||2)+c.formulaToRTF(a,b,d,e,f)+"}");return g};h.prototype.addToFontTable=function(a,b){var c;a.match(/times/i)?c="Times New Roman":a.match(/courier/i)?c="Courier New":a.match(/arial/i)&&(c="Arial");a=b.indexOf(c);-1===a&&(a=b.length,b.push(c));return a};h.prototype.addToColorTable=function(a,b){if(a){a="\\red"+parseInt(a.substring(1,
3),16)+"\\green"+parseInt(a.substring(3,5),16)+"\\blue"+parseInt(a.substring(5,7),16)+";";var c=b.indexOf(a);-1===c&&(c=b.length,b.push(a));return c}return null};h.prototype.mergeTextNodes=function(){for(var a=[],b=null,d=0,e=this.children.length;d<e;d++)"text"===this.children[d].nodeType?null!==b&&"text"===b.nodeType&&b.style.equals(this.children[d].style)&&(this.children[d].value=b.value+this.children[d].value,a.push(b)):this.children[d].mergeTextNodes(),b=this.children[d];d=0;for(e=a.length;d<
e;d++)this.removeChild(a[d])};var l={sansserif:{ascent:1854,descent:-434,lineGap:67,capHeight:1409,xHeight:1082,unitsPerEm:2048},serif:{ascent:1825,descent:-443,lineGap:87,capHeight:1341,xHeight:940,unitsPerEm:2048},monospace:{ascent:1705,descent:-615,lineGap:0,capHeight:1349,xHeight:1082,unitsPerEm:2048}};a.TextNode=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=String.fromCharCode,e,d,r,n,b,h,l,c,k,g,v,u=function(){};u.prototype.tokenize=function(a){if(a)a=a.replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&quote;/g,"''").replace(/&squot;/g,"'").replace(/\\rquote /g,"'").replace(/\\endash /g,"-").replace(/\n/g," ").replace(/\r/g,"").replace(/\\uc(\d+) /g,"").replace(/\\uc(\d+)/g,"");else return[];e=[];d="";n=r=0;h=a.charAt(0);l=!1;for(c="text";r<a.length;)b=h,h=a.charAt(r+1),l?"\\"===h||"{"===h||"}"===
h||" "===h||";"===h?(l=!1,d+=b," "===h?(r++,h=a.charAt(r+1),v=!0):v=!1,(k=d.match(/^'([0-9a-f]{2})/))?(g="","text"===c&&(g=e.pop().value),d=g+=f(parseInt(k[1],16))+d.substring(3)):(k=d.match(/^u[0-9]+/))?(g="","text"===c&&(g=e.pop().value),d=g+=f(k[0].substring(1))):("{"===d||"}"===d||"\\"==b?(e.push({type:"text",value:d+(v?" ":"")}),c="text"):(e.push({type:"controlWord",value:d}),c="controlWord"),d="")):"{"==b||"}"==b||"\\"==b?(l=!1,e.push({type:"text",value:b}),c="text"):d+=b:"\\"===b?(l=!0,""!==
d&&(e.push({type:"text",value:d}),c="text",d="")):"{"===b?(n++,""!==d&&(e.push({type:"text",value:d}),d=""),e.push({type:"openBlock",value:n}),c="openBlock"):"}"===b?(""!==d&&(e.push({type:"text",value:d}),d=""),e.push({type:"closeBlock",value:n}),c="closeBlock",n--):d+=b,r++;""!==d&&e.push({type:"text",value:d});return e};a.RTFTokenizer=u;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=Math.max,e,d,r,n,b,h,l,c,k,g,v,u,p,z,q,m,y,w,x,A,H,E,G,F,D,B,K,L,M,O,I,N=function(b){this.evaluator=b;this.tokenizer=new a.RTFTokenizer};N.prototype.parse=function(C){e=this.tokenizer.tokenize(C);d={};n=2;if("openBlock"===e[0].type&&"fonttbl"===e[1].value){for(r=e[0].value;"closeBlock"!==e[n].type&&e[n].value!==r;)d[e[n].value]=e[n+2].value.substring(0,e[n+2].value.length-1),n+=3;n++}b={};h=0;if("openBlock"===e[n].type&&"colortbl"===e[n+1].value){r=
e[n++].value;for(n++;"closeBlock"!==e[n].type&&e[n].value!==r;)l=parseInt(e[n++].value.substring(3)).toString(16),c=parseInt(e[n++].value.substring(5)).toString(16),k=parseInt(e[n++].value.substring(4)).toString(16),";"===e[n].value&&n++,b[h++]="#"+(2>l.length?"0"+l:l)+(2>c.length?"0"+c:c)+(2>k.length?"0"+k:k);n++}z=p=u=null;M=L=K=H=A=x=w=y=m=q=!1;E=[new a.TextStyle];G=E[0];D=F=-1;B=[];g=O=new a.TextNode("","textBlock",G,this.evaluator);v=new a.TextNode("","textLineBlock",G,this.evaluator);g.addChild(v);
O.stableWidth=!0;O.hasFormula=!1;C=n;for(var N=e.length;C<N;C++){if("controlWord"==e[C].type)if(d[e[C].value])G.set({family:d[e[C].value]});else if(e[C].value.match(/^fs(\d+)/))G.set({size:parseInt(e[C].value.match(/^fs(\d+)/)[1]/2)});else if("b"==e[C].value)G.set({bold:!0}),0<B.length&&B[B.length-1].style.set({bold:!0});else if("b0"==e[C].value)G.set({bold:!1}),0<B.length&&B[B.length-1].style.set({bold:!1});else if("i"==e[C].value)G.set({italic:!0}),0<B.length&&B[B.length-1].style.set({italic:!0});
else if("i0"==e[C].value)G.set({italic:!1}),0<B.length&&B[B.length-1].style.set({italic:!1});else if("ul"==e[C].value)G.set({underline:!0}),0<B.length&&B[B.length-1].style.set({underline:!0});else if("ulnone"==e[C].value)G.set({underline:!1}),0<B.length&&B[B.length-1].style.set({underline:!1});else if("ol"==e[C].value)G.set({overline:!0}),0<B.length&&B[B.length-1].style.set({overline:!0});else if("olnone"==e[C].value)G.set({overline:!1}),0<B.length&&B[B.length-1].style.set({overline:!1});else if(e[C].value.match(/^cf(\d+)/))G.set({color:b[parseInt(e[C].value.substring(2))]}),
0<B.length&&(B[B.length-1].style.color=G.color);else if("par"==e[C].value){g=new a.TextNode("","textLineBlock",G.clone(),this.evaluator);if("textBlock"!=v.nodeType)for(v=v.parent;"textBlock"!=v.nodeType;)v=v.parent;v.addChild(g);v=g}else if("mjaformula"==e[C].value)O.hasFormula=!0,D=F,q=!0,g=new a.TextNode("","formula",G.clone(),this.evaluator),v.addChild(g),v=g,B[B.length-1]=g;else if("fraction"==e[C].value||"radicand"==e[C].value||"radical"==e[C].value||"what"==e[C].value||"sum"==e[C].value||"integral"==
e[C].value||"limit"==e[C].value){var J=B[B.length-2].style.clone();g=new a.TextNode("",e[C].value,J,this.evaluator);B[B.length-2].addChild(g);B[B.length-1]=g}else"index"==e[C].value?(J=B[B.length-2].style.clone(),J.size=f(parseInt(J.size-.5*J.size),8),g=new a.TextNode("",e[C].value,J,this.evaluator),B[B.length-2].addChild(g),B[B.length-1]=g):"to"==e[C].value||"from"==e[C].value?(J=B[B.length-2].style.clone(),J.size=f(parseInt(J.size-.2*J.size),8),g=new a.TextNode("",e[C].value,J,this.evaluator),B[B.length-
2].addChild(g),B[B.length-1]=g):"num"==e[C].value||"den"==e[C].value?(J=B[B.length-2].style.clone(),J.size=f(Math.round(J.size-.1*J.size),8),"num"==e[C].value?g=new a.TextNode("","numerator",J,this.evaluator):"den"==e[C].value&&(g=new a.TextNode("","denominator",J,this.evaluator)),B[B.length-2].addChild(g),B[B.length-1]=g):"subix"==e[C].value||"supix"==e[C].value?(J=B[B.length-2].style.clone(),J.size=f(Math.floor(J.size-.33*J.size),8),"subix"==e[C].value?g=new a.TextNode("","subIndex",J,this.evaluator):
"supix"==e[C].value&&(g=new a.TextNode("","superIndex",J,this.evaluator)),g.originalStyle=B[B.length-2].style.clone(),B[B.length-2].addChild(g),B[B.length-1]=g):"defparts"==e[C].value||"matrix"==e[C].value||"element"==e[C].value?(J=B[B.length-2].style.clone(),g=new a.TextNode("",e[C].value,J,this.evaluator),B[B.length-2].addChild(g),B[B.length-1]=g,"defparts"==e[C].value?z=g:"matrix"==e[C].value&&(p=g,p.matrix_type=0)):"parts"==e[C].value?H=!0:"type"==e[C].value?w=!0:"rows"==e[C].value?x=!0:"columns"==
e[C].value?A=!0:"expr"==e[C].value?(O.stableWidth=!1,m=!0):"decimals"==e[C].value?y=!0:"fixed1"==e[C].value?u.fixed=!0:"fixed0"==e[C].value?u.fixed=!1:"component"!=e[C].value&&("NumCtrl"==e[C].value?K=!0:"Space"==e[C].value?L=!0:"hyperlink"==e[C].value&&(M=!0));if("text"==e[C].type)if(H)z.parts=parseInt(e[C].value),H=!1;else if(w)p.matrix_type=parseInt(e[C].value),w=!1;else if(x)p.rows=parseInt(e[C].value),x=!1;else if(A)p.columns=parseInt(e[C].value),A=!1;else if(y)u.decimals=this.evaluator.parser.parse(e[C].value+
""),y=!1;else if(M){I=e[C].value.split("|")[0];J=G.clone();g=new a.TextNode(I,"hyperlink",J,this.evaluator);g.URL=e[C].value.split("|")[1];if("textLineBlock"!=v.nodeType)for(v=v.parent;"textLineBlock"!=v.nodeType;)v=v.parent;v.addChild(g);M=!1}else if(K)g=new a.TextNode(e[C].value,"componentNumCtrl",G.clone(),this.evaluator),v.addChild(g),K=!1;else if(L)g=new a.TextNode(e[C].value,"componentSpace",G.clone(),this.evaluator),v.addChild(g),L=!1;else if(m)J=B[B.length-2].style.clone(),I=this.evaluator.parser.parse(e[C].value),
g=new a.TextNode(I,"dynamicText",J,this.evaluator),B[B.length-2].addChild(g),u=B[B.length-1]=g,m=!1;else if(m||q)!m&&q&&(I=e[C].value,g=new a.TextNode(I,"text",B[B.length-1].style.clone(),this.evaluator),B[B.length-1].addChild(g));else{I=e[C].value;g=new a.TextNode(I,"text",G.clone(),this.evaluator);if("textLineBlock"!=v.nodeType)for(v=v.parent;"textLineBlock"!=v.nodeType;)v=v.parent;v.addChild(g)}else if("openBlock"==e[C].type)F=e[C].value,G=G.clone(),E.push(G),B.push(null);else if("closeBlock"==
e[C].type)e[C].value==D&&(D=-1,q=!1,v=v.parent),E.pop(),G=E[E.length-1],B.pop();else if("("==e[C].type||")"==e[C].type)J=B[B.length-1].style.clone(),J.italic="",g=new a.TextNode(e[C].type,"mathSymbol",J,this.evaluator),B[B.length-1].addChild(g);else if("+"==e[C].type||"-"==e[C].type||"*"==e[C].type||"="==e[C].type)g=new a.TextNode(e[C].type,"mathSymbol",B[B.length-1].style.clone(),this.evaluator),B[B.length-1].addChild(g)}return O.normalize()};a.RTFParser=N;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,e,d,r,n,b,h,l,c,k,g,v=function(b,c){this.parent=b;e=this.evaluator=this.parent.evaluator;d=e.parser;this.id="";this.type="2D";this.xExpr=d.parse("0");this.yExpr=d.parse("0");this.w=parseInt(b.container.width);this.h=parseInt(b.container.height);this.drawif=d.parse("1");this.fixed=!1;this.scale=48;this.Oy=this.Ox=0;this.image=new Image;this.image.onload=function(){this.ready=1};this.imageSrc="";this.bg_display="topleft";this.background=new a.Color("ffffff");
this.net=new a.Color("b8c4c8");this.net10=new a.Color("889498");this.axes=new a.Color("405860");this.numbers=this.text=!1;this.y_axis=this.x_axis="";this.sensitive_to_mouse_movements=!1;this.cID="";this.mouse_y=this.mouse_x=0;this.ctrs=[];this.graphicsCtr=[];this.graphics=[];this.backGraphics=[];this.zIndex=b.zIndex;this.border_width=0;this.border_color=new a.Color("000000");this.border_radius=0;this.plecaHeight=b.plecaHeight||0;this.displaceRegionNorth=b.displaceRegionNorth||0;this.displaceRegionWest=
b.displaceRegionWest||0;Object.assign(this,c);this.initSpace()};v.prototype.initSpace=function(){var a=this;f=a.parent;e=a.evaluator;r=a.id;a.resizable||(a.displaceRegionNorth=f.displaceRegionNorth||0,a.displaceRegionSouth=f.displaceRegionSouth||0,a.displaceRegionEast=f.displaceRegionEast||0,a.displaceRegionWest=f.displaceRegionWest||0,l=parseInt(f.container.width),h=parseInt(f.container.height),void 0!=a.wExpr&&(a.w=parseInt(l-a.displaceRegionWest-a.displaceRegionEast)*parseFloat(a.wExpr)/100),void 0!=
a.hExpr&&(a.h=parseInt(h-a.displaceRegionNorth-a.displaceRegionSouth)*parseFloat(a.hExpr)/100),void 0!=a.xPercentExpr&&(a.xExpr=e.parser.parse((parseInt(l-a.displaceRegionWest-this.displaceRegionEast)*parseFloat(a.xPercentExpr)/100).toString())),void 0!=a.yPercentExpr&&(a.yExpr=e.parser.parse((parseInt(h-a.displaceRegionNorth-a.displaceRegionSouth)*parseFloat(a.yPercentExpr)/100).toString())),a.x=e.eval(a.xExpr)+a.displaceRegionWest,a.y=e.eval(a.yExpr)+a.plecaHeight+a.displaceRegionNorth,a.container&&
(a.container.style.left=a.x+"px",a.container.style.top=a.y+"px"),0<=a.y?(n=h-a.y,a.h>n&&(a.h=n)):(n=a.h+a.y,a.h=n>=h?h:n),0<=a.x?(b=l-a.x,a.w>b&&(a.w=b)):(b=a.w+a.x,a.w=b>=l?l:b));""==a.imageSrc&&/vacio.gif$/i.test(a.imageSrc.trim())||(a.image=f.getImage(a.imageSrc));a.OxExpr&&(k=a.OxExpr,"%"===k[k.length-1]?a.Ox=a.w*parseFloat(k)/100:(c=parseFloat(k),c!=k&&(c=0),a.Ox=c));a.OyExpr&&(g=a.OyExpr,"%"===g[g.length-1]?a.Oy=a.h*parseFloat(g)/100:(c=parseFloat(g),c!=g&&(c=0),a.Oy=c));""!==a.id&&2!==f.version?
(e.setVariable(r+"._w",a.w),e.setVariable(r+"._h",a.h),e.setVariable(r+".escala",e.getVariable(r+".escala")||a.scale),e.setVariable(r+".Ox",e.getVariable(r+".Ox")||a.Ox),e.setVariable(r+".Oy",e.getVariable(r+".Oy")||a.Oy),e.setVariable(r+".mouse_x",0),e.setVariable(r+".mouse_y",0),e.setVariable(r+".mouse_pressed",0),e.setVariable(r+".mouse_clicked",0),e.setVariable(r+".clic_izquierdo",0)):(c=e.getVariable("_w"),e.setVariable("_w",void 0===c?a.w:c),c=e.getVariable("_h"),void 0===c&&(c=a.h),e.setVariable("_h",
c),c=e.getVariable("escala"),void 0===c&&(c=a.scale),e.setVariable("escala",c),c=e.getVariable("Ox"),void 0===c&&(c=a.Ox),e.setVariable("Ox",c),c=e.getVariable("Oy"),void 0===c&&(c=a.Oy),e.setVariable("Oy",c),e.setVariable("mouse_x",0),e.setVariable("mouse_y",0),e.setVariable("mouse_pressed",0),e.setVariable("mouse_clicked",0),e.setVariable("clic_izquierdo",0),2==f.version&&""===a.x_axis&&""===a.y_axis&&(a.axes=""));a.w_2=a.w/2;a.h_2=a.h/2;e.setFunction(r+".download_image",function(b){a.evaluator.functions._SaveSpace_(b,
a.canvas.toDataURL("image/png"))})};v.prototype.addCtr=function(a){"GraphicControl"===a.type?this.graphicsCtr.push(a):this.ctrs.push(a)};v.prototype.addGraph=function(a,b){"2D"===this.type&&b||"3D"===this.type&&!b||(a.background&&"3D"!==this.type?this.backGraphics.push(a):this.graphics.push(a))};v.prototype.clearClick=function(){this.evaluator.setVariable(this.mclickedString,0);this.evaluator.setVariable(this.mclicizquierdoString,0)};v.prototype.getRelativeX=function(a){return(parseInt(a)-this.w_2-
this.Ox)/this.scale};v.prototype.getRelativeY=function(a){return(-parseInt(a)+this.h_2+this.Oy)/this.scale};v.prototype.getAbsoluteX=function(a){return a*this.scale+this.w_2+this.Ox};v.prototype.getAbsoluteY=function(a){return-a*this.scale+this.h_2+this.Oy};a.Space=v;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,e=function(d){f=this;f.parent=d;f.width=228;f.vSpace=25;f.container=a.newHTML("div",{style:"box-sizing:border-box;border-style:ridge;border-width:5px;border-color:gray;box-shadow:#000 0 0 25px 5px;overflow-y:scroll;overflow-x:hidden;position:fixed;left:0;top:0;z-index:10000;background-color:#63b4fb;width:"+(f.width+27)+"px;height:460px;"});f.movable=a.newHTML("div",{style:"position:absolute;left:0;top:0;width:"+(f.width+27)+"px;height:"+f.vSpace+
"px;line-height:"+f.vSpace+"px;background-color:#ddd;cursor:move;padding-left:75px;font-family:"+a.sansserif_font+";font-size:18px;"});f.movable.innerHTML="Descartes";f.container.appendChild(f.movable);f.ctrs=[]};e.prototype.init=function(){function d(b){f.newPos=a.getCursorPosition(b,document.body);f.container.style.left=f.initialPosition.x+(f.newPos.x-f.oldPos.x)*a.cssScale+"px";f.container.style.top=f.initialPosition.y+(f.newPos.y-f.oldPos.y)*a.cssScale+"px"}function e(a){a.preventDefault();document.body.removeEventListener("mousemove",
d);document.body.removeEventListener("mouseup",e)}f=this;document.body.appendChild(this.container);for(var n=f.parent.evaluator.parser,b=0,h=f.ctrs.length;b<h;b++)f.ctrs[b].expresion=n.parse("(0,"+(f.vSpace+23+35*b)+","+f.width+",35)"),f.ctrs[b].update();f.numCtr=h;b=new a.Button(f.parent,{region:"external",name:"english"==f.language?"about":"cr\u00e9ditos",font_size:n.parse("15"),expresion:n.parse("(0,"+f.vSpace+","+f.width/2+",25)")});b.actionExec={execute:a.showAbout};b.update();(new a.Button(f.parent,
{region:"external",name:"config",font_size:n.parse("15"),action:"config",expresion:n.parse("("+f.width/2+","+f.vSpace+","+f.width/2+",25)")})).update();(new a.Button(f.parent,{region:"external",name:"english"==f.language?"init":"inicio",font_size:n.parse("15"),action:"init",expresion:n.parse("(0,"+(f.vSpace+23+35*h)+","+f.width/2+",25)")})).update();(new a.Button(f.parent,{region:"external",name:"english"==f.language?"clear":"limpiar",font_size:n.parse("15"),action:"clear",expresion:n.parse("("+f.width/
2+","+(f.vSpace+23+35*h)+","+f.width/2+",25)")})).update();n=new a.Button(f.parent,{region:"external",name:"english"==f.language?"close":"cerrar",font_size:n.parse("15"),expresion:n.parse("("+f.width/4+","+(f.vSpace+46+35*h)+","+f.width/2+",25)")});n.update();n.btn.addEventListener("click",function(a){f.hide()});f.setPositionAndSize();f.movable.addEventListener("mousedown",function(b){b.preventDefault();f.oldPos=a.getCursorPosition(b,document.body);f.initialPosition={x:f.container.offsetLeft,y:f.container.offsetTop};
document.body.addEventListener("mousemove",d);document.body.addEventListener("mouseup",e)});f.hide()};e.prototype.addCtr=function(a){this.ctrs.push(a)};e.prototype.show=function(){this.setPositionAndSize();this.container.style.display="block"};e.prototype.hide=function(){this.container.style.display="none"};e.prototype.setPositionAndSize=function(){f=this;var a=f.vSpace+46+35*f.numCtr+25+10;f.container.style.left=Math.max(parseInt(window.innerWidth-f.width)/2,0)+"px";f.container.style.top="5px";f.container.style.height=
window.innerHeight<f.vSpace+75?f.vSpace+75+"px":a>window.innerHeight-10?window.innerHeight-10:a+"px"};a.SpaceExternal=e;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=Math.floor,e=Math.round,d=2*Math.PI,r=a.convertFont("Serif,BOLD+ITALIC,16"),n=a.convertFont("Monospaced,PLAIN,12"),b,h,l,c,k,g,v,u,p,z,q,m,y,w,x,A,H,E,G,F,D,B,K,L,M,O,I,N,C,Q,J,R,P=function(c,d){b=d=a.Space.call(this,c,d)||this;b.ratio=c.ratio;b.canvas=a.newHTML("canvas",{id:b.id+"_canvas",class:"DescartesSpace2DCanvas",width:b.w*b.ratio+"px",height:b.h*b.ratio+"px"});b.backCanvas=a.newHTML("canvas",{id:b.id+"_background",width:b.w*b.ratio+"px",
height:b.h*b.ratio+"px"});b.canvas.style=b.backCanvas.style=(0<b.border_width?"border:"+b.border_width+"px solid "+b.border_color.getColor()+";":"")+(b.border_radius?"border-radius:"+b.border_radius+"px;":"");b.canvas.style.zIndex=b.zIndex;b.canvas.style.width=b.backCanvas.style.width=b.w+"px";b.canvas.style.height=b.backCanvas.style.height=b.h+"px";b.ctx=b.canvas.getContext("2d");b.backCtx=b.backCanvas.getContext("2d");b.ctx.imageSmoothingEnabled=b.backCtx.imageSmoothingEnabled=!1;b.canvas.ratio=
b.ratio;b.backCanvas.ratio=b.ratio;b.graphicControlContainer=a.newHTML("div",{id:b.id+"_graphicControls",style:"position:absolute;left:0;top:0;z-index:"+b.zIndex+";"});b.numCtrContainer=a.newHTML("div",{id:b.id+"_numericalControls",style:"position:absolute;left:0;top:0;z-index:"+b.zIndex+";"});b.container=a.newHTML("div",{id:b.id,class:"DescartesSpace2DContainer",style:"z-index:"+b.zIndex+";"});b.parent.arquimedes&&"#f0f8fa"===b.background.getColor()&&(b.container.style.boxShadow="0 0 5px 0 #b8c4c8");
b.container.appendChild(b.backCanvas);b.container.appendChild(b.canvas);b.container.appendChild(b.graphicControlContainer);b.container.appendChild(b.numCtrContainer);c.container.insertBefore(b.container,c.loader);var e=b.id+".image";b.parent.images[e]=b.canvas;b.parent.images[e].ready=1;b.parent.images[e].complete=b.parent.images[e].canvas=!0;b.evaluator.setVariable(e,e);e=b.id+".back";b.parent.images[e]=b.backCanvas;b.parent.images[e].ready=1;b.parent.images[e].complete=b.parent.images[e].canvas=
!0;b.evaluator.setVariable(e,e);e=""!==b.id&&2!==c.version?b.id+".":"";b.OxStr=e+"Ox";b.OyStr=e+"Oy";b.scaleStr=e+"escala";b.wStr=e+"_w";b.hStr=e+"_h";b.mxStr=e+"mouse_x";b.myStr=e+"mouse_y";b.mpressedStr=e+"mouse_pressed";b.mclickedStr=e+"mouse_clicked";b.mclickIzqStr=e+"clic_izquierdo";b.click=0;b.resizable&&(b.wModExpr=c.evaluator.parser.parse(b.wModExpr),b.hModExpr=c.evaluator.parser.parse(b.hModExpr));"descartesJS_stage"!==b.id?b.addEvents():b.canvas.oncontextmenu=function(a){return!1};c.evaluator.setVariable(b.id+
"._refresh_back_",1);return d};$jscomp.inherits(P,a.Space);P.prototype.init=function(){b=this;this.initSpace();b.canvas&&(b.old_w=b.w,b.old_h=b.h,b.canvas.width=b.backCanvas.width=b.w*b.ratio,b.canvas.height=b.backCanvas.height=b.h*b.ratio,b.canvas.style.width=b.backCanvas.style.width=b.w+"px",b.canvas.style.height=b.backCanvas.style.height=b.h+"px")};P.prototype.update=function(a){b=this;h=b.evaluator;l=b.parent;if(b.resizable){if(C=b.evaluator.eval(b.wModExpr),Q=b.evaluator.eval(b.hModExpr),b.old_w!=
C||b.old_h!=Q)b.w=C,b.h=Q,b.w_2=b.w/2,b.h_2=b.h/2,h.setVariable(b.wStr,b.w),h.setVariable(b.hStr,b.h),b.old_w=b.w,b.old_h=b.h,b.canvas.width=b.backCanvas.width=b.w*b.ratio,b.canvas.height=b.backCanvas.height=b.h*b.ratio,b.canvas.style.width=b.backCanvas.style.width=b.w+"px",b.canvas.style.height=b.backCanvas.style.height=b.h+"px",a=!0}else h.setVariable(b.wStr,b.w),h.setVariable(b.hStr,b.h);b.drawIfValue=0<h.eval(b.drawif);if(b.drawIfValue){k=b.x!==h.eval(b.xExpr)+b.displaceRegionWest;g=b.y!==h.eval(b.yExpr)+
l.plecaHeight+b.displaceRegionNorth;b.spaceChange=a||k||g||b.drawBefore!==b.drawIfValue||b.Ox!==h.getVariable(b.OxStr)||b.Oy!==h.getVariable(b.OyStr)||b.scale!==h.getVariable(b.scaleStr)||b.backColor!==b.background.getColor();b.x=k?h.eval(b.xExpr)+b.displaceRegionWest:b.x;b.y=g?h.eval(b.yExpr)+l.plecaHeight+b.displaceRegionNorth:b.y;b.Ox=h.getVariable(b.OxStr);b.Oy=h.getVariable(b.OyStr);b.scale=h.getVariable(b.scaleStr);b.drawBefore=b.drawIfValue;b.scale=Math.max(1E-6,Math.min(1E6,b.scale));h.setVariable(b.scaleStr,
b.scale);if(k||g)b.container.style.left=b.x+"px",b.container.style.top=b.y+"px";b.container.style.display="block";b.drawTrace=!b.spaceChange&&(!b.fixed&&!b.click||b.fixed);b.spaceChange&&(b.backCtx.setTransform(b.ratio,0,0,b.ratio,0,0),b.drawBackground());b.ctx.setTransform(b.ratio,0,0,b.ratio,0,0);b.draw()}else b.container.style.display="none"};P.prototype.drawBackground=function(){b=this;h=b.evaluator;c=b.backCtx;c.clearRect(0,0,b.backCanvas.width,b.backCanvas.height);c.fillStyle=b.backColor=b.background.getColor();
c.fillRect(0,0,b.backCanvas.width,b.backCanvas.height);b.image&&""!=b.image.src&&b.image.ready&&b.image.complete&&("topleft"===b.bg_display?c.drawImage(b.image,0,0):"stretch"===b.bg_display?c.drawImage(b.image,0,0,b.w,b.h):"patch"===b.bg_display?(c.fillStyle=c.createPattern(b.image,"repeat"),c.fillRect(0,0,b.w,b.h)):"imgcenter"===b.bg_display&&c.drawImage(b.image,(b.w-b.image.width)/2,(b.h-b.image.height)/2));u=b.scale;p=0;for(z=0>b.w+b.h?0:b.w+b.h;u>z;)u/=10,p++;for(;u<z/10;)u*=10;c.lineWidth=1;
""!==b.net&&(c.strokeStyle=b.net.getColor(),b.drawMarks(c,u/10,-1));if(2!==b.parent.version&&""!==b.net10||2===b.parent.version&&""!==b.net&&""!==b.net10)c.strokeStyle=b.net10.getColor(),b.drawMarks(c,u,-1);if(""!==b.axes){var a="";"no"==b.x_axis&&(a+="x");"no"==b.y_axis&&(a+="y");c.strokeStyle=b.axes.getColor();c.beginPath();"no"==b.x_axis||""===b.x_axis&&2===b.parent.version||(c.moveTo(0,f(b.h/2+b.Oy)+.5),c.lineTo(b.w,f(b.h/2+b.Oy)+.5));"no"==b.y_axis||""===b.y_axis&&2===b.parent.version||(c.moveTo(f(b.w/
2+b.Ox)+.5,0),c.lineTo(f(b.w/2+b.Ox)+.5,b.h));c.lineWidth=1.2;c.stroke();c.lineWidth=1;b.drawMarks(c,u,4,a);b.drawMarks(c,u/2,2,a);b.drawMarks(c,u/10,1,a)}if(""!==b.x_axis||""!==b.y_axis)c.fillStyle=""!==b.axes?b.axes.getColor():"#000",c.font=r,c.textAlign="right",c.textBaseline="alphabetic","no"!=b.x_axis&&c.fillText(b.x_axis,f(b.w)-2,f(b.h/2+b.Oy)+12),"no"!=b.y_axis&&c.fillText(b.y_axis,f(b.w/2+b.Ox)-2,12);b.numbers&&""!=b.axes&&(c.fillStyle=b.axes.getColor(),c.font=r,c.textAlign="start",c.textBaseline=
"bottom",u>(b.w+b.h)/2?b.drawNumbers(c,u/5,u<=b.scale?p+1:p):u>(b.w+b.h)/4?b.drawNumbers(c,u/2,u<=b.scale?p+1:p):b.drawNumbers(c,u,p));a=0;for(var d=this.backGraphics.length;a<d;a++)this.backGraphics[a].draw()};P.prototype.draw=function(){b=this;c=b.ctx;h.getVariable(b.id+"._refresh_back_")&&c.clearRect(0,0,b.canvas.width,b.canvas.height);for(var a=0,e=b.graphics.length;a<e;a++)v=b.graphics[a],""!==v.trace&&b.drawTrace&&v.drawTrace(),v.draw();a=0;for(e=b.graphicsCtr.length;a<e;a++)b.graphicsCtr[a].draw();
""!=b.text&&b.click&&"L"===b.whichBtn&&(c.save(),c.strokeStyle=c.fillStyle=b.text.getColor(),c.lineWidth=1,c.font=n,c.textAlign="center",c.textBaseline="alphabetic",D=1>=b.scale?b.mouse_x.toFixed(0):b.mouse_x.toFixed(parseInt(b.scale).toString().length+1),B=1>=b.scale?b.mouse_y.toFixed(0):b.mouse_y.toFixed(parseInt(b.scale).toString().length+1),K="("+D+","+B+")",L=f(c.measureText(K).width/2),M=b.getAbsoluteX(b.mouse_x),O=b.getAbsoluteY(b.mouse_y),I=f(M),N=f(O-10),I+L>b.w?I=b.w-L:0>I-L&&(I=L),N+1>
b.h?N=b.h:0>N-14&&(N=15),c.fillText(K,I,N),c.beginPath(),c.arc(M,O,2.5,0,d,!0),c.stroke(),c.restore())};P.prototype.drawMarks=function(a,b,c,d){q=this.w;m=this.h;G=H=0;E=q;F=m;x=f(q/2+this.Ox);A=f(m/2+this.Oy);0<=c&&(H=x-c,E=x+c,G=A-c,F=A+c);a.beginPath();if(!d||d&&!d.match("x"))for(c=-e(x/b);(y=x+e(c*b))<q;c++)a.moveTo(y+.5,G+.5),a.lineTo(y+.5,F+.5);if(!d||d&&!d.match("y"))for(c=-e(A/b);(w=A+e(c*b))<m;c++)a.moveTo(H+.5,w+.5),a.lineTo(E+.5,w+.5);a.stroke()};P.prototype.drawNumbers=function(a,b,c){q=
this.w;m=this.h;x=f(q/2+this.Ox);A=f(m/2+this.Oy);for(c=-e(x/b);(y=x+e(c*b))<q;c++)a.fillText(parseFloat((c*b/this.scale).toFixed(4)),y+1,A-2);for(c=-e(A/b);(w=A+e(c*b))<m;c++)0!==parseFloat(-c*b/this.scale)&&a.fillText(parseFloat((-c*b/this.scale).toFixed(4)),x+5,w+5)};P.prototype.addEvents=function(){function b(a){window.focus();document.activeElement.blur();if(f.evaluator.variables[f.id+".DESCARTESJS_no_fixed"]||!f.fixed||f.sensitive_to_mouse_movements)f.click=0,f.evaluator.setVariable(f.mpressedStr,
0),f.evaluator.setVariable(f.mclickedStr,1),f.evaluator.setVariable(f.mclickIzqStr,1),window.removeEventListener("touchmove",g),window.removeEventListener("touchend",b),a.stopPropagation(),a.preventDefault(),f.parent.update()}function c(b){document.activeElement.blur();window.focus();b.stopPropagation();b.preventDefault();f.click=0;f.evaluator.setVariable(f.mpressedStr,0);f.evaluator.setVariable(f.mclickedStr,1);f.evaluator.setVariable(f.mclickIzqStr,1);"R"===f.whichBtn&&(window.removeEventListener("mousemove",
e),f.posZoom==f.posZoomNew&&a.showConfig&&(f.parent.externalSpace.show(),f.posZoom=!1,f.posZoomNew=!0));window.removeEventListener("mousemove",g);window.removeEventListener("mouseup",c);f.parent.deactivateControls();f.parent.update()}function d(b){f.posAnte=a.getCursorPosition(b,f.container);f.mouse_x=f.getRelativeX(f.posAnte.x);f.mouse_y=f.getRelativeY(f.posAnte.y);f.evaluator.setVariable(f.mxStr,f.mouse_x);f.evaluator.setVariable(f.myStr,f.mouse_y);f.evaluator.setVariable(f.mclickedStr,0);f.evaluator.setVariable(f.mclickIzqStr,
0);f.parent.update()}function e(b){b.preventDefault();f.posZoomNew=a.getCursorPosition(b,f.container).y;f.evaluator.setVariable(f.scaleStr,f.tempScale+f.tempScale/45*((f.posZoom-f.posZoomNew)/10));f.parent.update()}function g(b){b.preventDefault();b.stopPropagation();f.fixed||(f.posNext=a.getCursorPosition(b,f.container),J=f.posAnte.x-f.posNext.x,R=f.posAnte.y-f.posNext.y,f.evaluator.setVariable(f.OxStr,f.Ox-J),f.evaluator.setVariable(f.OyStr,f.Oy-R));d(b)}var f=this;f.posZoom=f.posZoomNew=null;f.canvas.oncontextmenu=
function(a){return!1};this.sensitive_to_mouse_movements&&this.canvas.addEventListener("touchmove",d);this.canvas.addEventListener("touchstart",function(a){window.focus();document.activeElement.blur();if(f.evaluator.variables[f.id+".DESCARTESJS_no_fixed"]||!f.fixed||f.sensitive_to_mouse_movements)f.parent.clearClick(),f.click=1,f.evaluator.setVariable(f.mpressedStr,1),f.evaluator.setVariable(f.mclickedStr,0),f.evaluator.setVariable(f.mclickIzqStr,0),f.parent.deactivateControls(),d(a),window.addEventListener("touchmove",
g),window.addEventListener("touchend",b),a.stopPropagation(),a.preventDefault()});this.sensitive_to_mouse_movements&&this.canvas.addEventListener("mousemove",d);this.canvas.addEventListener("mousedown",function(b){window.focus();document.activeElement.blur();b.stopPropagation();b.preventDefault();f.parent.clearClick();f.click=1;f.parent.deactivateControls();f.whichBtn=a.whichBtn(b);"R"===f.whichBtn?(window.addEventListener("mouseup",c),f.posZoom=a.getCursorPosition(b,f.container).y,f.posZoomNew=f.posZoom,
f.fixed||(f.tempScale=f.scale,window.addEventListener("mousemove",e))):"L"===f.whichBtn&&(f.evaluator.setVariable(f.mpressedStr,1),f.evaluator.setVariable(f.mclickedStr,0),f.evaluator.setVariable(f.mclickIzqStr,0),d(b),window.addEventListener("mousemove",g),window.addEventListener("mouseup",c))});document.addEventListener("visibilitychange",function(a){c(a)});document.addEventListener("mouseleave",function(a){f.click=0;f.evaluator.setVariable(f.mpressedStr,0);f.evaluator.setVariable(f.mclickedStr,
1);f.evaluator.setVariable(f.mclickIzqStr,1);window.removeEventListener("mousemove",g);window.removeEventListener("mouseup",c)})};a.Space2D=P;return a}(descartesJS||{});
descartesJS=function(a){var f,e,d;function r(b,c){I=a.subtract3D(b,a.scalarProduct3D(c,a.dotProduct3D(b,c)));N=a.add3D(b,a.scalarProduct3D(I,-2));C=a.norm3D(N);return 0!==C?a.scalarProduct3D(N,1/C):a.scalarProduct3D(b,-1)}if(a.loadLib)return a;var n=Math.floor,b=Math.max,h=Math.cos,l=Math.sin,c,k,g,v,u,p,z,q,m,y,w,x,A,H,E,G,F=[],D,B,K,L,M,O,I,N,C,Q,J,R=function(b,c){g=c=a.Space.call(this,b,c)||this;g.ratio=1;g.backCanvas=a.newHTML("canvas",{id:g.id+"_background",width:g.w*g.ratio+"px",height:g.h*
g.ratio+"px"});g.canvas=a.newHTML("canvas",{id:g.id+"_canvas",width:g.w*g.ratio+"px",height:g.h*g.ratio+"px",class:"DescartesSpace3DCanvas",style:"z-index: "+g.zIndex+";"});g.ctx=g.canvas.getContext("2d");g.ctx.imageSmoothingEnabled=!1;g.canvas.ratio=g.ratio;g.canvas.style=g.backCanvas.style=(0<g.border_width?"border:"+g.border_width+"px solid "+g.border_color.getColor()+";":"")+(g.border_radius?"border-radius:"+g.border_radius+"px;":"");var d=g.id+".image";g.parent.images[d]=g.canvas;g.parent.images[d].ready=
1;g.parent.images[d].complete=!0;g.parent.images[d].canvas=!0;g.evaluator.setVariable(d,d);g.graphicControlContainer=a.newHTML("div",{id:g.id+"_graphicControls",style:"position:absolute;left:0px;top:0px;z-index:"+g.zIndex+";"});g.numCtrContainer=a.newHTML("div",{id:g.id+"_numericalControls",style:"position:absolute;left:0px;top:0px;z-index:"+g.zIndex+";"});g.container=a.newHTML("div",{id:g.id,class:"DescartesSpace3DContainer",style:"z-index:"+g.zIndex+";"});g.container.appendChild(g.backCanvas);g.container.appendChild(g.canvas);
g.container.appendChild(g.graphicControlContainer);g.container.appendChild(g.numCtrContainer);b.container.insertBefore(g.container,b.loader);g.eye={x:0,y:0,z:0};g.lights=[{x:50,y:50,z:70},{x:50,y:-50,z:30},{x:20,y:0,z:-80},{x:0,y:0,z:0}];d=0;for(var e=g.lights.length;d<e;d++)g.lights[d]=a.normalize3D(g.lights[d]);g.light3={x:0,y:0,z:0};g.intensity=[.4,.5,.3,0];g.userIntensity=0;g.dim=1;g.tmpIntensity=[];g.OxStr=g.id+".Ox";g.OyStr=g.id+".Oy";g.scaleStr=g.id+".escala";g.wStr=g.id+"._w";g.hStr=g.id+
"._h";g.obsStr=g.id+".observador";g.ojoXStr=g.id+".Ojo.x";g.ojoYStr=g.id+".Ojo.y";g.ojoZStr=g.id+".Ojo.z";g.rotZStr=g.id+".rot.z";g.rotYStr=g.id+".rot.y";g.userIDimStr=g.id+".userIlum.dim";g.userIIStr=g.id+".userIlum.I";g.userIxStr=g.id+".userIlum.x";g.userIyStr=g.id+".userIlum.y";g.userIzStr=g.id+".userIlum.z";g.evaluator.setVariable(g.rotZStr,0);g.evaluator.setVariable(g.rotYStr,0);g.evaluator.setVariable(g.userIDimStr,g.dim);g.evaluator.setVariable(g.userIIStr,g.userIntensity);g.evaluator.setVariable(g.userIxStr,
0);g.evaluator.setVariable(g.userIyStr,0);g.evaluator.setVariable(g.userIzStr,0);J=new a.Primitive3D({vertices:[new a.Vector4D(0,0,0,1)],type:"vertex"},g);g.evaluator.setFunction(g.id+"._X3D2D_",function(a,b,c){J.vertices[0].x=a;J.vertices[0].y=b;J.vertices[0].z=c;J.computeDepth(g);return J.projVert[0].x});g.evaluator.setFunction(g.id+"._Y3D2D_",function(a,b,c){J.vertices[0].x=a;J.vertices[0].y=b;J.vertices[0].z=c;J.computeDepth(g);return J.projVert[0].y});g.resizable&&(g.wModExpr=b.evaluator.parser.parse(g.wModExpr),
g.hModExpr=b.evaluator.parser.parse(g.hModExpr));g.addEvents();return c};$jscomp.inherits(R,a.Space);R.prototype.init=function(a){g=this;g.initSpace();g.canvas&&(g.old_w=g.w,g.old_h=g.h,g.canvas.width=g.backCanvas.width=g.w*g.ratio,g.canvas.height=g.backCanvas.height=g.h*g.ratio,g.canvas.style.width=g.backCanvas.style.width=g.w+"px",g.canvas.style.height=g.backCanvas.style.height=g.h+"px");g.w_2=g.w/2;g.h_2=g.h/2;g.w_plus_h=g.w+g.h;g.oldMouse={x:0,y:0};g.S={x:g.h/1080*-20.6*(40/g.scale),y:0,z:0};
g.Ojo={x:3*g.w_2,y:0,z:0};g.evaluator.setVariable(g.ojoXStr,g.Ojo.x);g.evaluator.setVariable(g.ojoYStr,g.Ojo.y);g.evaluator.setVariable(g.ojoZStr,g.Ojo.z)};R.prototype.update=function(a){g=this;c=g.evaluator;k=g.parent;c.setVariable(g.wStr,g.w);c.setVariable(g.hStr,g.h);g.drawIfValue=0<c.eval(g.drawif);if(g.drawIfValue){g.resizable&&(wModExpr=g.evaluator.eval(g.wModExpr),hModExpr=g.evaluator.eval(g.hModExpr),g.old_w!=wModExpr||g.old_h!=hModExpr)&&(g.w=wModExpr,g.h=hModExpr,g.w_2=g.w/2,g.h_2=g.h/2,
c.setVariable(g.wStr,g.w),c.setVariable(g.hStr,g.h),g.old_w=g.w,g.old_h=g.h,g.canvas.width=g.backCanvas.width=g.w*g.ratio,g.canvas.height=g.backCanvas.height=g.h*g.ratio,g.canvas.style.width=g.backCanvas.style.width=g.w+"px",g.canvas.style.height=g.backCanvas.style.height=g.h+"px",a=!0,g.S={x:g.h/1080*-20.6*(40/g.scale),y:0,z:0},g.Ojo={x:3*g.w_2,y:0,z:0},g.evaluator.setVariable(g.ojoXStr,g.Ojo.x),g.evaluator.setVariable(g.ojoYStr,g.Ojo.y),g.evaluator.setVariable(g.ojoZStr,g.Ojo.z));p=g.x!==c.eval(g.xExpr)+
g.displaceRegionWest;z=g.y!==c.eval(g.yExpr)+k.plecaHeight+g.displaceRegionNorth;g.spaceChange=a||p||z||g.drawBefore!==g.drawIfValue||g.Ox!==c.getVariable(g.OxStr)||g.Oy!==c.getVariable(g.OyStr)||g.Ojo.x!==c.getVariable(g.ojoXStr)||g.Ojo.y!==c.getVariable(g.ojoYStr)||g.Ojo.z!==c.getVariable(g.ojoZStr)||g.scale!==c.getVariable(g.scaleStr);g.x=p?c.eval(g.xExpr)+g.displaceRegionWest:g.x;g.y=z?c.eval(g.yExpr)+k.plecaHeight+g.displaceRegionNorth:g.y;g.Ojo.x=c.getVariable(g.ojoXStr);g.Ojo.y=c.getVariable(g.ojoYStr);
g.Ojo.z=c.getVariable(g.ojoZStr);g.Ox=c.getVariable(g.OxStr);g.Oy=c.getVariable(g.OyStr);g.scale=c.getVariable(g.scaleStr);g.drawBefore=g.drawIfValue;if(a||void 0==g.observer){a=0;for(var d=g.parent.controls.length;a<d;a++)g.parent.controls[a].id===g.obsStr&&(Q=!0);g.observer=Q?c.getVariable(g.obsStr)||2.5*g.w_plus_h:2.5*g.w_plus_h;g.observer=b(g.observer,.25*g.w_plus_h);c.setVariable(g.obsStr,g.observer)}1E-6>g.scale?(g.scale=1E-6,c.setVariable(g.scaleStr,1E-6)):1E6<g.scale&&(g.scale=1E6,c.setVariable(g.scaleStr,
1E6));if(p||z)g.container.style.left=g.x+"px",g.container.style.top=g.y+"px";g.container.style.display="block";g.dim=c.getVariable(g.userIDimStr);g.userIntensity=c.getVariable(g.userIIStr);g.light3={x:parseInt(c.getVariable(g.userIxStr)),y:parseInt(c.getVariable(g.userIyStr)),z:parseInt(c.getVariable(g.userIzStr))};g.updateCamera();g.ctx.setTransform(g.ratio,0,0,g.ratio,0,0);g.draw()}else g.container.style.display="none"};R.prototype.updateCamera=function(){this.eye=a.scalarProduct3D(this.Ojo,1/this.scale)};
R.prototype.rotateVertex=function(b){y=a.degToRad(g.evaluator.getVariable(g.rotZStr));w=h(y);x=l(y);f=b.x*w-b.y*x;e=b.x*x+b.y*w;d=b.z;y=a.degToRad(g.evaluator.getVariable(g.rotYStr));w=h(y);x=l(y);return{x:d*x+f*w,y:e,z:d*w-f*x}};R.prototype.project=function(a){g=this;this.evaluator.getVariable("URL.oldProj");var b=g.eye.x/(a.x-g.eye.x);return{x:g.getAbsoluteX(b*(g.eye.y-a.y)),y:g.getAbsoluteY(b*(g.eye.z-a.z)),z:g.eye.x-a.x}};R.prototype.computeColor=function(b,c,d){"object"!=typeof b&&(b.match("rgba")?
b=a.RGBAToHexColor(b):b.match("#")&&(b=new a.Color(b.substring(1))));L=a.subtract3D(this.eye,c.average);M=a.norm3D(L);O=a.scalarProduct3D(L,1/M);this.lights[3]=a.subtract3D(this.light3,c.average);G=a.norm3D(this.lights[3]);for(var e=0,g=this.intensity.length-1;e<g;e++)F[e]=this.intensity[e]*this.dim;F[3]=this.userIntensity*this.userIntensity/G||0;D=d?this.dim/2:this.dim/4;B=0;K=0>c.direction?c.normal:a.scalarProduct3D(c.normal,-1);e=0;for(g=this.lights.length;e<g;e++)d?(B=Math.max(0,a.dotProduct3D(r(this.lights[e],
K),O)),B*=B*B):B=Math.max(0,a.dotProduct3D(this.lights[e],K)),D+=F[e]*B;D=Math.min(D,1);A=n(b.r*D);H=n(b.g*D);E=n(b.b*D);return"rgba("+A+","+H+","+E+","+b.a+")"};R.prototype.draw=function(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height);this.ctx.fillStyle=this.background.getColor();this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height);this.image&&""!=this.image.src&&this.image.ready&&this.image.complete&&("topleft"===this.bg_display?this.ctx.drawImage(this.image,0,0):"stretch"===
this.bg_display?this.ctx.drawImage(this.image,0,0,this.w,this.h):"patch"===this.bg_display?(this.ctx.fillStyle=ctx.createPattern(this.image,"repeat"),this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height)):"center"===this.bg_display&&this.ctx.drawImage(this.image,(this.w-this.image.width)/2,(this.h-this.image.height)/2));if(!this.click){for(var a=0,b=this.graphics.length;a<b;a++)this.graphics[a].update();this.primitives=[];if(this.split)for(a=0,b=this.graphics.length;a<b;a++){v=this.graphics[a];
for(var c=a+1;c<b;c++)u=this.graphics[c],v.splitFace(u),u.splitFace(v);this.primitives=this.primitives.concat(v.primitives||[])}else for(a=0,b=this.graphics.length;a<b;a++){v=this.graphics[a];if(v.split)for(c=a+1;c<b;c++)u=this.graphics[c],u.split&&v.splitFace(u);this.primitives=this.primitives.concat(v.primitives||[])}}a=0;for(b=this.primitives.length;a<b;a++)this.primitives[a].computeDepth(this);this.primitives=this.primitives.sort(function(a,b){return b.depth-a.depth});if("painter"===this.render)this.drawPainter(this.primitives);
else for(a=0,b=this.primitives.length;a<b;a++)this.primitives[a].draw(this.ctx,this);a=0;for(b=this.graphicsCtr.length;a<b;a++)this.graphicsCtr[a].draw()};R.prototype.drawPainter=function(a){for(var b=a.length,c=0;c<b;c++)a[c].drawn=!1,a[c].draw(this.ctx,this);for(var d=[],e=[],g=0,f=a.length,l=.001,k,h;;){k=f;for(c=0;c<b;c++)if(!a[c].drawn){h=!0;for(var m=0;m<b;m++)if(m!=c&&!a[m].drawn&&a[c].inFrontOf(d,a[m],l)){h=!1;break}h&&(f--,e[g++]=a[c],a[c].drawn=!0)}if(0==f)break;else if(f==k){if(l*=10,.1<
l){for(c=0;c<b;c++)a[c].drawn||(e[g++]=a[c],a[c].drawn=!0);break}}else l=.001}for(c=0;c<b;c++)e[c].draw(this.ctx,this)};R.prototype.rayFromEye=function(a,b){return{x:-this.eye.x,y:(a-(this.w_2+this.Ox))/this.scale-this.eye.y,z:(this.h_2+this.Oy-b)/this.scale-this.eye.z}};R.prototype.addEvents=function(){function b(a){window.focus();document.activeElement.blur();f.click=0;f.evaluator.setVariable(f.id+".mouse_pressed",0);window.removeEventListener("touchmove",g,!1);window.removeEventListener("touchend",
b,!1);a.preventDefault();f.parent.update()}function c(b){document.body.focus();f.click=0;f.evaluator.setVariable(f.id+".mouse_pressed",0);b.preventDefault();"R"===f.whichBtn&&(window.removeEventListener("mousemove",e,!1),f.posZoom==f.posZoomNew&&a.showConfig&&f.parent.externalSpace.show());window.removeEventListener("mousemove",g,!1);window.removeEventListener("mouseup",c,!1);f.parent.update()}function d(b){f.posAnte=a.getCursorPosition(b,f.container);f.mouse_x=f.getRelativeX(f.posAnte.x);f.mouse_y=
f.getRelativeY(f.posAnte.y);f.evaluator.setVariable(f.id+".mouse_x",f.mouse_x);f.evaluator.setVariable(f.id+".mouse_y",f.mouse_y);f.parent.update()}function e(b){b.preventDefault();f.posZoomNew=a.getCursorPosition(b,f.container).y;f.evaluator.setVariable(f.scaleStr,f.tempScale+f.tempScale/45*((f.posZoom-f.posZoomNew)/10));f.posObserverNew=a.getCursorPosition(b,f.container).x;f.evaluator.setVariable(f.obsStr,f.tempObserver-2.5*(f.posObserver-f.posObserverNew));f.parent.update()}function g(b){if(!f.fixed&&
f.click){q=(f.getAbsoluteX(f.oldMouse.x)-f.getAbsoluteX(f.mouse_x))/4;m=(-f.getAbsoluteY(f.oldMouse.y)+f.getAbsoluteY(f.mouse_y))/4;if(q!==f.disp.x||m!==f.disp.y)f.alpha=a.degToRad(f.evaluator.getVariable(f.rotZStr)),f.beta=a.degToRad(-f.evaluator.getVariable(f.rotYStr)),f.alpha=a.radToDeg(f.alpha)-q,f.beta=a.radToDeg(f.beta)-m,f.evaluator.setVariable(f.rotZStr,f.alpha),f.evaluator.setVariable(f.rotYStr,-f.beta),f.disp.x=q,f.disp.y=m,f.oldMouse.x=f.getRelativeX(f.posAnte.x),f.oldMouse.y=f.getRelativeY(f.posAnte.y);
d(b);b.preventDefault()}}var f=this;this.canvas.oncontextmenu=function(){return!1};this.canvas.addEventListener("touchstart",function(c){window.focus();document.activeElement.blur();f.click=1;f.evaluator.setVariable(f.id+".mouse_pressed",1);f.parent.deactivateControls();f.posAnte=a.getCursorPosition(c,f.container);f.oldMouse.x=f.getRelativeX(f.posAnte.x);f.oldMouse.y=f.getRelativeY(f.posAnte.y);d(c);window.addEventListener("touchmove",g);window.addEventListener("touchend",b);c.preventDefault()});
this.canvas.addEventListener("mousedown",function(b){document.body.focus();f.click=1;f.parent.deactivateControls();f.whichBtn=a.whichBtn(b);"R"===f.whichBtn?(window.addEventListener("mouseup",c),f.posObserver=a.getCursorPosition(b,f.container).x,f.posObserverNew=f.posObserver,f.posZoom=a.getCursorPosition(b,f.container).y,f.posZoomNew=f.posZoom,f.fixed||(f.tempScale=f.scale,f.tempObserver=f.observer,window.addEventListener("mousemove",e))):"L"==f.whichBtn&&(f.evaluator.setVariable(f.id+".mouse_pressed",
1),f.posAnte=a.getCursorPosition(b,f.container),f.oldMouse.x=f.getRelativeX(f.posAnte.x),f.oldMouse.y=f.getRelativeY(f.posAnte.y),d(b),window.addEventListener("mousemove",g),window.addEventListener("mouseup",c));b.preventDefault()});this.disp={x:0,y:0};document.addEventListener("visibilitychange",function(a){c(a)});document.addEventListener("mouseleave",function(a){c(a)})};a.Space3D=R;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f,e,d,r,n,b,h=function(b,c){var d=a.Space.call(this,b,c)||this;f=d.parent.evaluator;void 0!=d._w_&&(b=f.parser.parse(d._w_),d._w_="number"!=b.type?b:void 0);void 0!=d._h_&&(b=f.parser.parse(d._h_),d._h_="number"!=b.type?b:void 0);d.isFirefox=/firefox/i.test(window.navigator.userAgent);d.file=d.file?d.file.trim():"";d.file.match(/^\[/)&&d.file.match(/\]$/)?d.file=f.parser.parse(d.file.substring(1,d.file.length-1)):d.file.match(/^'/)&&d.file.match(/'$/)?
d.file=f.parser.parse(d.file):d.file=f.parser.parse("'"+d.file+"'");d.oldFile=f.eval(d.file);d.MyIFrame=a.newHTML("iframe",{marginheight:0,marginwidth:0,frameborder:0,scrolling:"auto",style:"position:absolute;left:0;top:0;"});0!=d.oldFile&&d.MyIFrame.setAttribute("src",d.oldFile);d.container=a.newHTML("div",{id:d.id,style:(a.isIOS?"overflow:scroll;-webkit-overflow-scrolling:touch;overflow-scrolling:touch;":"")+"position:absolute;width:"+d.w+"px;height:"+d.h+"px;left:"+d.x+"px;top:"+d.y+"px;z-index:"+
d.zIndex+";background-repeat:no-repeat;background-position:center;"});d.container.appendChild(d.MyIFrame);d.imageSrc&&(d.container.style.backgroundImage="url("+d.imageSrc+")");d.parent.container.insertBefore(d.container,d.parent.loader);d.MyIFrame.onload=function(b){var c=this;d.evaluator.setFunction(d.id+".set",function(a,b){c.contentWindow.postMessage({type:"set",name:a,value:b},"*");return 0});d.evaluator.setFunction(d.id+".update",function(){c.contentWindow.postMessage({type:"update"},"*");return 0});
d.evaluator.setFunction(d.id+".exec",function(a,b){c.contentWindow.postMessage({type:"exec",name:a,value:b},"*");return 0});d.evaluator.setFunction(d.id+".changeConf",function(b){if(b){if(a.cacheFiles[b])var d=a.cacheFiles[b];else d=(d=document.getElementById(b))&&"descartes/embed"===d.type?d.textContent:a.openFile(b),d=(d=(new DOMParser).parseFromString(d,"text/html").querySelector("ajs"))?d.innerHTML:"",a.cacheFiles[b]=d;c.contentWindow.postMessage({type:"change_config",filename:b,content:d},"*")}return 0});
d.evaluator.setFunction(d.id+".changeContent",function(a){a&&(a=(a=(new DOMParser).parseFromString(a.replace(/&sq;/g,"'"),"text/html").querySelector("ajs"))?a.innerHTML:"",c.contentWindow.postMessage({type:"change_content",content:a},"*"))});d.ImReady=!d.isFirefox;d.isFirefox||(d.container.style.visibility="visible",d.container.style.opacity="1",d.container.style.zIndex=d.zIndex,d.container.style.display=d.drawIfValue?"block":"none");d.MyIFrame.style.visibility="visible";d.container.style.backgroundImage=
""};d.update=d.iframeUpdate;d.evaluator.setVariable(d.id+"._scroll",0);return d};$jscomp.inherits(h,a.Space);h.prototype.init=function(){n=this;n.initSpace();n.MyIFrame&&Object.assign(n.MyIFrame.style,{width:n.w+"px",height:n.h+"px"})};h.prototype.iframeUpdate=function(a){f=this.evaluator;this.drawIfValue=0<f.eval(this.drawif);this.ImReady?this.container.style.display=this.drawIfValue?"block":"none":(this.container.style.visibility=this.drawIfValue?"visible":"hidden",this.container.style.opacity=
this.drawIfValue?"1":"0",this.container.style.zIndex=this.drawIfValue?this.zIndex:-1E3);if(this.drawIfValue){a&&(this.x=this.y=Infinity);e=this.x!==f.eval(this.xExpr)+this.displaceRegionWest;d=this.y!==f.eval(this.yExpr)+this.parent.plecaHeight+this.displaceRegionNorth;this.x=e?f.eval(this.xExpr)+this.displaceRegionWest:this.x;this.y=d?f.eval(this.yExpr)+this.parent.plecaHeight+this.displaceRegionNorth:this.y;void 0!=this._w_&&(a=f.eval(this._w_),this.w!==a&&(this.container.style.width=this.MyIFrame.style.width=
a+"px",this.w=a));void 0!=this._h_&&(a=f.eval(this._h_),this.h!==a&&(this.container.style.height=this.MyIFrame.style.height=a+"px",this.h=a));if(e||d)this.container.style.left=this.x+"px",this.container.style.top=this.y+"px";r=f.eval(this.file);r!==this.oldFile&&(this.ImReady=!1,this.isFirefox||(this.container.style.display="block",this.container.style.visibility=this.drawIfValue?"visible":"hidden",this.container.style.opacity=this.drawIfValue?"1":"0",this.container.style.zIndex=this.drawIfValue?
this.zIndex:-1E3),this.imageSrc&&(this.container.style.backgroundImage="url("+this.imageSrc+")"),this.MyIFrame.style.visibility="hidden",this.oldFile=r,this.MyIFrame.contentWindow.location.replace(r));b=f.getVariable(this.id+"._scroll");1==b?(this.MyIFrame.setAttribute("scrolling","yes"),this.MyIFrame.style.overflow=""):-1==b?(this.MyIFrame.setAttribute("scrolling","no"),this.MyIFrame.style.overflow="hidden"):(this.MyIFrame.setAttribute("scrolling","auto"),this.MyIFrame.style.overflow="")}else this.MyIFrame.contentWindow.blur()};
a.SpaceHTMLIFrame=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var f=1,e=function(d){this.children=d.children;this.lessonParser=d.lessonParser;this.images=d.images;this.images.length=d.images.length;this.audios=d.audios;this.audios.length=d.audios.length;this.descartesApp=d;this.imgLoader=a.newHTML("div",{class:"DescartesLoaderImage"});this.progress=a.newHTML("progress",{class:"PBL",value:0,max:100});d.imgLoader?(d.loader.style.backgroundColor="transparent",this.imgLoader.setAttribute("style","background-image:url("+
d.imgLoader+");background-size:contain;")):(f=d.width<d.height?d.width/1144:d.height/1092,f=2.5<f?2.5:f,this.imgLoader.setAttribute("style","background-image:url("+a.loaderImg.src+");background-position:50% 33.5%;background-size:"+880*f+"px;"),this.progress.setAttribute("style","visibility:visible;left:"+(d.width-726*f)/2+"px;top:"+(33.5*d.height/100+940*f/2)+"px;width:"+726*f+"px;height:"+14*f+"px;"));d.loader.appendChild(this.imgLoader);d.loader.appendChild(this.progress);d.firstRun=!1;this.initPreloader()};
e.prototype.initPreloader=function(){var d=this,e=d.children,f=d.images,b=d.audios,h=/[\w\.\-//]*(\.png|\.jpg|\.gif|\.svg|\.webp)/gi,l=/[\w\.\-//]*(\.ogg|\.oga|\.mp3|\.wav)/gi;f["lib/DescartesCCLicense.png"]=a.getCCLImg();f["lib/DescartesCCLicense.png"].ready=1;var c;var k=0;for(c=e.length;k<c;k++)if("rtf"!==e[k].name){if(e[k].value.match(/'macro'|'makro'/g)){var g="";var v=void 0;var u=d.lessonParser.split(e[k].value);var p=0;for(var z=u.length;p<z;p++)"expresion"===babel[u[p][0]]&&(g=u[p][1]);g&&
(v=(v=document.getElementById(g))&&"descartes/macro"==v.type?v.text:a.openFile(g));if(v&&(v=v.match(h)))for(g=0,p=v.length;g<p;g++)u=v[g],u.toLowerCase().match(/vacio.gif$/)||""==u.substring(0,u.length-4)||(f[u]=new Image,f[u].addEventListener("load",function(){this.ready=1}),f[u].addEventListener("error",function(){this.errorload=1}),f[u].src=u)}if(v=e[k].value.match(h))for(g=0,p=v.length;g<p;g++)u=v[g],u.toLowerCase().match(/vacio.gif$/)||""==u.substring(0,u.length-4)||(f[u]=new Image,f[u].addEventListener("load",
function(){this.ready=1}),f[u].addEventListener("error",function(){this.errorload=1}),f[u].src=u);if(v=e[k].value.match(l))for(g=0,u=v.length;g<u;g++)d.initAudio(v[g])}for(var q in f)f.hasOwnProperty(q)&&d.images.length++;for(var m in b)b.hasOwnProperty(m)&&d.audios.length++;var y=d.images.length+d.audios.length;0<y&&d.progress.setAttribute("max",y);var w,x=function(){w=0;for(var c in f)f.hasOwnProperty(c)&&(f[c].ready||f[c].errorload)&&w++;for(var e in b)b.hasOwnProperty(e)&&(b[e].ready||b[e].errorload)&&
w++;d.progress.setAttribute("value",w);w!=y?d.timer=a.setTimeout(x,1):d.descartesApp.initBuildApp()};x()};e.prototype.initAudio=function(d){var e=this.audios;e[d]=new Audio(d);e[d].filename=d;var f=function(){this.ready=1},b=function(){this.canPlayType("audio/"+this.filename.substring(this.filename.length-3))||"mp3"!=this.filename.substring(this.filename.length-3)?(console.warn("El archivo "+d+" no puede ser reproducido"),this.errorload=1):(e[d]=new Audio(this.filename.replace("mp3","ogg")),e[d].filename=
this.filename.replace("mp3","ogg"),e[d].addEventListener("canplaythrough",f),e[d].addEventListener("load",f),e[d].addEventListener("error",b),e[d].load())};e[d].addEventListener("canplaythrough",f);e[d].addEventListener("load",f);e[d].addEventListener("error",b);a.hasTouchSupport?(e[d].load(),e[d].play(),a.setTimeout(function(){e[d].pause()},20),e[d].ready=1):e[d].load()};a.DescartesLoader=e;return a}(descartesJS||{});
descartesJS=function(a){function f(a){for(var b="[",e=0,g=a.length;e<g;e++)Array.isArray(a[e])?b+=f(a[e]):(d=a[e]||0,"string"==typeof d&&(d="'"+d+"'"),b+=d),e<g-1&&(b+=",");return b+"]"}function e(){r=window.innerWidth/this.width;n=window.innerHeight/this.height;a.cssScale=b=Math.min(r,n);this.container.style.transformOrigin="0 0";this.container.parentNode.style.width=window.innerWidth+"px";this.container.parentNode.style.height=window.innerHeight+"px";r<n?(this.container.style.left="0",this.container.style.top=
"50%",this.container.style.transform="translate3d(0px,0px,0px) scale("+b+") translate(0,-50%)"):(this.container.style.left="50%",this.container.style.top="0",this.container.style.transform="translate3d(0px,0px,0px) scale("+b+") translate(-50%,0)")}if(a.loadLib)return a;var d,r,n,b,h=function(b){this.animation={playing:!1,play:function(){},stop:function(){},reinit:function(){}};this.ratio=a._ratio;this.applet=b;this.parentC=b.parentNode;this.width=parseFloat(b.getAttribute("width"));this.height=parseFloat(b.getAttribute("height"));
this.decimal_symbol=".";this.decimal_symbol_regexp=/\./g;this.language="espa\u00f1ol";this.children=b.getElementsByTagName("param");a.ccLicense=!0;for(var c=$jscomp.makeIterator(this.children),d=c.next();!d.done;d=c.next())d=d.value,"CreativeCommonsLicense"===d.name&&(a.ccLicense="no"!==d.value);this.code=b.getAttribute("code");this.saveState=[];this.images={length:-1};this.audios={length:-1};this.firstRun=!0;this.keyboard=new a.Keyboard(this);this.scaleToFit=function(){};this.init()};h.prototype.init=
function(){this.stop();this.evaluator=new a.Evaluator(this);this.evaluator.setVariable("DJS.w",this.width);this.evaluator.setVariable("DJS.h",this.height);this.getURLParameters();this.lessonParser=new a.LessonParser(this);this.arquimedes=/DescartesWeb2_0|Arquimedes|Discurso/i.test(this.code);this.licenseA=a.ccLicense?"{\\rtf1\\uc0{\\fonttbl\\f0\\fcharset0 Arial;}{\\f0\\fs34 __________________________________________________________________________________\\par \\fs22                                        Los contenidos de esta unidad did\u00e1ctica interactiva est\u00e1n bajo una licencia {\\*\\hyperlink Creative Commons|https://creativecommons.org/licenses/by-nc-sa/4.0/deed.es}, si no se indica lo contrario.\\par                                        La unidad did\u00e1ctica fue creada con Descartes, que es un producto de c\u00f3digo abierto, {\\*\\hyperlink Cr\u00e9ditos|https://arquimedes.matem.unam.mx/Descartes5/creditos/conCCL.html}\\par }":
"";var b,c=0,d=0,f=a.ccLicense?90:0,h=$jscomp.makeIterator(this.children);for(b=h.next();!b.done;b=h.next())if(b=b.value,"rtf_height"==b.name)c=parseInt(b.value)+120||this.height;else if("Buttons"==babel[b.name])this.buttonsConfig=this.lessonParser.parseButtonsConfig(b.value),d=this.buttonsConfig.height;else if("image_loader"==b.name)this.imgLoader=b.value;else if("expand"==b.name)this.expand=b.value;else if("docBase"==b.name)document.head.appendChild(a.newHTML("base",{id:"descartesJS_base",href:b.value}));
else if(b.name.startsWith("E_"))break;this.arquimedes&&(this.ratio=1,c&&(this.height=c+d+f));this.externalSpace&&document.body.removeChild(this.externalSpace.container);this.externalSpace=new a.SpaceExternal(this);this.northSpace={container:a.newHTML("div"),controls:[]};this.southSpace={container:a.newHTML("div"),controls:[]};this.eastSpace={container:a.newHTML("div"),controls:[]};this.westSpace={container:a.newHTML("div"),controls:[]};this.editableRegion={container:a.newHTML("div"),textFields:[]};
this.controls=[];this.auxiliaries=[];this.events=[];this.nIframes=this.plecaHeight=this.tabindex=this.zIndex=0;void 0!=this.container&&(this.cleanCanvasImages(),this.parentC.removeChild(this.container),delete this.container,delete this.loader);this.container=a.newHTML("div");this.loader=a.newHTML("div",{class:"DescartesLoader"});this.parentC.insertBefore(this.container,this.parentC.firstChild);this.container.width=this.loader.width=this.width;this.container.height=this.loader.height=this.height;this.container.className=
"DescartesAppContainer";this.container.setAttribute("style","width:"+this.width+"px;height:"+this.height+"px;");this.container.appendChild(this.loader);"fit"==this.expand&&(this.container.parentNode.removeAttribute("align"),this.container.parentNode.style.overflow="hidden",this.scaleToFit=e,this.scaleToFit());"cover"==this.expand&&(this.scaleToFit=function(){this.container.width=this.width=window.innerWidth;this.container.height=this.height=window.innerHeight;this.container.setAttribute("style","width:"+
this.width+"px;height:"+this.height+"px;");if(this.spaces)for(var a=$jscomp.makeIterator(this.spaces),b=a.next();!b.done;b=a.next())b=b.value,b.initSpace(),b.init(),b.update(!0)},this.scaleToFit());this.spaces=[];this.firstRun?(this.loader.style.display="block",new a.DescartesLoader(this)):this.initBuildApp()};h.prototype.initBuildApp=function(){a.showConfig=!0;var b,c=this.lessonParser,d=[],e=[],f=[],h=[],n=[],r=[],q=$jscomp.makeIterator(this.children);for(b=q.next();!b.done;b=q.next())if(b=b.value,
"editable"==babel[b.name])a.showConfig="false"!=babel[b.value];else if("language"==babel[b.name])this.language=b.value;else if("pleca"==b.name)b=c.parsePleca(b.value,this.width),this.container.insertBefore(b,this.loader),this.plecaHeight=b.imageHeight?b.imageHeight:b.offsetHeight;else if("Buttons"==babel[b.name])this.buttonsConfig=c.parseButtonsConfig(b.value);else if("decimal_symbol"==babel[b.name])this.decimal_symbol=b.value,this.decimal_symbol_regexp=new RegExp("\\"+this.decimal_symbol,"g");else if("version"==
babel[b.name])this.version=parseInt(b.value);else if("language"==babel[b.name])this.language=b.value;else if("rtf"==b.name){var m=(this.width-780)/2,y=parseInt(this.height)-this.plecaHeight-this.buttonsConfig.height-45;h.push("space='descartesJS_stage' type='text' abs_coord='yes' expresion='[10,20]' background='yes' text='"+b.value.replace(/'/g,"&squot;")+"'","space='descartesJS_stage' type='text' abs_coord='yes' expresion='["+m+","+(y-25)+"]' background='yes' text='"+this.licenseA+"'");a.ccLicense&&
h.push("space='descartesJS_stage' type='image' expresion='["+(m+15)+","+y+"]' background='yes' abs_coord='yes' file='lib/DescartesCCLicense.png'")}else b.name.startsWith("E_")?(b.value.match(/'HTMLIFrame'/)&&this.nIframes++,d.push(b.value)):b.name.startsWith("C_")?e.push(b.value):b.name.startsWith("A_")?f.push(b.value):b.name.startsWith("G_")?(b.value.match(/type='fill'|tipo='relleno'|tipus='ple'|mota='betea'|type='plein'|tipo='recheo'|tipo='curva_piena'|tipo='preencher'|tipus='ple'/)&&(this.ratio=
1),h.push(b.value)):b.name.startsWith("S_")?n.push(b.value):"Animation"==babel[b.name]&&r.push(b.value);this.arquimedes&&(this.stage={container:a.newHTML("div",{id:"descartesJS_Stage"}),scroll:0},this.stage.stageSpace=this.lessonParser.parseSpace("tipo='R2' id='descartesJS_stage' fondo='"+(a.TextController?"ffffffff":"blanco")+"' x='0' y='0' fijo='yes' red='no' red10='no' ejes='no' text='no' ancho='"+this.width+"' alto='"+this.height+"'"),this.stage.container.appendChild(this.stage.stageSpace.container),
this.container.appendChild(this.stage.container),this.spaces.push(this.stage.stageSpace));b=0;for(m=d.length;b<m;b++)q=c.parseSpace(d[b]),this.arquimedes&&this.stage.container.appendChild(q.container),this.spaces.push(q),this.zIndex++;q=0;for(b=h.length;q<b;q++)if(a.DEBUG.elemIndex=q,d=c.parseGraphic(h[q]))this.editableRegionVisible=this.editableRegionVisible||d.visible,d.space.addGraph(d);h=0;for(q=n.length;h<q;h++)(d=c.parse3DGraphic(n[h]))&&d.space.addGraph(d,!0);n=0;for(h=e.length;n<h;n++)this.controls.push(c.parseControl(e[n]));
e=0;for(n=f.length;e<n;e++)c.parseAuxiliar(f[e]);f=0;for(e=r.length;f<e;f++)this.animation=c.parseAnimation(r[f]);this.configRegions();this.updateAuxiliaries();this.updateAuxiliaries();c=0;for(r=this.controls.length;c<r;c++)this.controls[c].init();this.updateControls();this.updateSpaces(!0);var w=this;a.setTimeout(function(){w.finishInit()},200*w.nIframes)};h.prototype.finishInit=function(){this.evaluator.setVariable("decimalSymbol",this.decimal_symbol);this.update();this.loader.style.display="none";
window.parent!==window&&(this.parentC.style.margin=this.parentC.style.padding="0px","fit"==this.expand&&window.addEventListener("touchmove",function(a){a.preventDefault();a.stopPropagation()}),window.parent.postMessage({type:"reportSize",href:window.location.href,width:this.width,height:this.height},"*"),window.parent.postMessage({type:"ready",value:window.location.href},"*"),a.onResize());window.opener&&window.opener.postMessage({type:"isResizeNeeded",href:window.location.href},"*");this.externalSpace.init();
try{var b=new CustomEvent("descartesReady",{detail:this});window.dispatchEvent(b)}catch(k){console.warn("CustomEvents not supported in this browser")}var c=this;this.evaluator.setFunction("openKB",function(a,b,d,e,f,h,l,m,n,r,x){c.keyboard.show(null,a,b,d,e,{x:f,y:h,w:l,h:m,fs:n+"px",value:r+"",type:"custom",tagName:"textfield"},x)});this.readyApp=!0};h.prototype.adjustSize=function(){document.body.style.margin=document.body.style.padding=this.parentC.style.margin=this.parentC.style.padding="0px";
var b=parseInt(this.width)+30,c=parseInt(this.height)+90;window.moveTo((parseInt(screen.width)-b)/2,(parseInt(screen.height)-c)/2);window.resizeTo(b,c);a.onResize()};h.prototype.configRegions=function(){var b=this.evaluator.parser,c=this.buttonsConfig||{},d=this.container,e="15",f=100,h=100,n=100,r=100;2===this.version&&(e="14",f=63,h=50,n=44,r=53);var q=0,m=0,y=0,w=0,x=0,A=this.northSpace.controls,H=this.southSpace.controls;var E=this.eastSpace.controls;var G=this.westSpace.controls;if(0<c.rowsNorth||
0<A.length||c.about||c.config){0>=c.rowsNorth?(q=c.height,c.rowsNorth=1):q=c.height*c.rowsNorth;var F=this.northSpace.container;F.id="descartesJS_north";F.setAttribute("style","width:"+d.width+"px;height:"+q+"px;left:0;top:"+this.plecaHeight+"px;");d.insertBefore(F,this.loader);F=d.width;var D=0;c.about?(D=f,F-=D):f=0;c.config&&(F-=h);for(var B=Math.ceil(A.length/c.rowsNorth),K=F/B,L=0,M=A.length;L<M;L++)A[L].expresion=b.parse("("+(D+L%B*K)+","+c.height*Math.floor(L/B)+","+K+","+c.height+")"),A[L].init();
c.about&&(A=new a.Button(this,{region:"north",name:"english"==this.language?"about":"cr\u00e9ditos",font_size:b.parse(e),expresion:b.parse("(0,0,"+f+","+q+")")}),A.actionExec={execute:a.showAbout},A.update());c.config&&(new a.Button(this,{region:"north",name:"config",font_size:b.parse(e),action:"config",expresion:b.parse("("+(F+f)+",0,"+h+","+q+")")})).update()}if(0<c.rowsSouth||0<H.length||c.init||c.clear){0>=c.rowsSouth?(m=c.height,c.rowsSouth=1):m=c.height*c.rowsSouth;f=d.width;h=0;c.init?(h=n,
f-=h):n=0;c.clear&&(f-=r);F=this.southSpace.container;F.id="descartesJS_south";F.setAttribute("style","width:"+d.width+"px;height:"+m+"px;left:0;bottom:0;");d.insertBefore(F,this.loader);F=Math.ceil(H.length/c.rowsSouth);A=f/F;D=0;for(B=H.length;D<B;D++)H[D].expresion=b.parse("("+(h+D%F*A)+","+c.height*Math.floor(D/F)+","+A+","+c.height+")"),H[D].init();c.init&&(new a.Button(this,{region:"south",name:"english"==this.language?"init":"inicio",font_size:b.parse(e),action:"init",expresion:b.parse("(0,0,"+
n+","+m+")")})).update();c.clear&&(new a.Button(this,{region:"south",name:"english"==this.language?"clear":"limpiar",font_size:b.parse(e),action:"clear",expresion:b.parse("("+(f+n)+",0,"+r+","+m+")")})).update()}if(0<E.length)for(e=d.height-q-m,w=c.widthEast,n=this.eastSpace.container,n.id="descartesJS_east",n.setAttribute("style","width:"+w+"px;height:"+e+"px;right:0;top:"+q+"px;"),d.insertBefore(n,this.loader),e=0,n=E.length;e<n;e++)E[e].expresion=b.parse("(0,"+c.height*e+","+w+","+c.height+")"),
E[e].init();if(0<G.length)for(E=d.height-q-m,x=c.widthWest,e=this.westSpace.container,e.id="descartesJS_west",e.setAttribute("style","width:"+x+"px;height:"+E+"px;left:0;top:"+q+"px;"),d.insertBefore(e,this.loader),E=0,e=G.length;E<e;E++)G[E].expresion=b.parse("(0,"+c.height*E+","+x+","+c.height),G[E].init();if(this.editableRegionVisible)for(y=c.height,b=this.editableRegion.container,b.id="descartesJS_editableRegion",b.setAttribute("style","position:absolute;width:"+d.width+"px;height:"+y+"px;left:0;top:"+
(d.height-m-c.height)+"px;"),d.insertBefore(b,this.loader),c=this.editableRegion.textFields,d=d.width/c.length,G=a.getFieldFontSize(y),E=0,e=c.length;E<e;E++)"div"==c[E].type?(b.appendChild(c[E].container),c[E].container.setAttribute("style","font-family:"+a.sansserif_font+";width:"+(d-4)+"px;height:"+y+"px;position:absolute;left:"+E*d+"px;top:0;"),n=c[E].container.firstChild,n.setAttribute("style","font-family:"+a.sansserif_font+";font-size:"+G+"px;padding-top:0;background-color:#e0e4e8;position:absolute;left:0;top:0;height:"+
y+"px;text-align:center;line-height:"+y+"px;"),r=n.offsetWidth,n.style.width=r+"px",n.firstChild.textContent=n.firstChild.textContent.substring(3,n.firstChild.textContent.length-3),c[E].container.lastChild.setAttribute("style","font-family:"+a.monospace_font+";font-size:"+G+"px;width:"+(d-r)+"px;height:"+y+"px;position:absolute;left:"+r+"px;top:0;border:2px groove white;")):(b.appendChild(c[E]),c[E].setAttribute("style","font-family:"+a.monospace_font+";font-size:"+G+"px;width:"+d+"px;height:"+y+
"px;position:absolute;left:"+E*d+"px;top:0;border:2px groove white;"));this.displaceRegionNorth=q;this.displaceRegionSouth=m+(y||0);this.displaceRegionEast=w;this.displaceRegionWest=x;q=$jscomp.makeIterator(this.spaces);for(m=q.next();!m.done;m=q.next())m.value.init()};h.prototype.update=function(){this.updateAuxiliaries();this.updateControls();this.updateEvents();this.updateControls();this.updateSpaces()};h.prototype.clearClick=function(){for(var a=$jscomp.makeIterator(this.spaces),b=a.next();!b.done;b=
a.next())b.value.clearClick()};h.prototype.removeButtonClick=function(){a.newBlobContent=null;for(var b=$jscomp.makeIterator(this.controls),c=b.next();!c.done;c=b.next())c.value.buttonClick=!1};h.prototype.deactivateControls=function(){if(this.controls)for(var a=$jscomp.makeIterator(this.controls),b=a.next();!b.done;b=a.next())b=b.value,b.deactivate&&b.deactivate()};h.prototype.updateAuxiliaries=function(){for(var a=$jscomp.makeIterator(this.auxiliaries),b=a.next();!b.done;b=a.next())b.value.update()};
h.prototype.updateEvents=function(){for(var a=$jscomp.makeIterator(this.events),b=a.next();!b.done;b=a.next())b.value.update()};h.prototype.updateControls=function(){for(var a=$jscomp.makeIterator(this.controls),b=a.next();!b.done;b=a.next())b.value.update()};h.prototype.updateSpaces=function(a){for(var b=$jscomp.makeIterator(this.spaces),d=b.next();!d.done;d=b.next())d.value.update(a)};h.prototype.clear=function(){for(var a=$jscomp.makeIterator(this.spaces),b=a.next();!b.done;b=a.next())b=b.value,
b.spaceChange=!0,b.drawBackground&&b.drawBackground()};h.prototype.play=function(){this.animation.play()};h.prototype.stop=function(){this.animation.stop()};h.prototype.reinitAnimation=function(){this.animation.reinit()};h.prototype.stopAudios=function(){this.stop();for(var a in this.audios)this.audios.hasOwnProperty(a)&&this.audios[a].pause&&(this.audios[a].pause(),this.audios[a].currentTime=0)};h.prototype.getImage=function(a){if(a){if(this.images[a])return this.images[a];var b=this.images;b[a]=
new Image;b[a].addEventListener("load",function(){this.ready=1});b[a].addEventListener("error",function(){this.ready=0;this.errorload=1});b[a].src=a;return b[a]}return new Image};h.prototype.getAudio=function(b){var c=this.audios;if(b){if(!c[b]){b.lastIndexOf(".");c[b]=new Audio(b);var d=function(a){this.ready=1};c[b].addEventListener("canplaythrough",d);var e=function(a){this.canPlayType("audio/"+b.substring(b.length-3))||"mp3"!=b.substring(b.length-3)?(console.warn("El archivo '"+b+"' no puede ser reproducido"),
this.errorload=1):(c[b]=new Audio(b.replace("mp3","ogg")),c[b].addEventListener("canplaythrough",d),c[b].addEventListener("load",d),c[b].addEventListener("error",e),c[b].load())};c[b].addEventListener("error",e);c[b].play();a.setTimeout(function(){c[b].pause()},15)}return c[b]}return new Audio};h.prototype.getControlByCId=function(a){return this.getControlById(a,!0)};h.prototype.getControlById=function(a,b){b=b?"cID":"id";for(var c=$jscomp.makeIterator(this.controls),d=c.next();!d.done;d=c.next())if(d=
d.value,d[b]==a)return d;return{update:function(){},w:0,h:0}};h.prototype.getSpaceByCId=function(a){return this.getSpaceById(a,!0)};h.prototype.getSpaceById=function(a,b){b=b?"cID":"id";for(var c=$jscomp.makeIterator(this.spaces),d=c.next();!d.done;d=c.next())if(d=d.value,d[b]==a)return d;return{update:function(){},w:0,h:0}};h.prototype.getURLParameters=function(){var a=window.location.href,b=a.indexOf("?");if(-1!=b)for(a=decodeURIComponent(a.substring(b+1)).split("&"),a=$jscomp.makeIterator(a),b=
a.next();!b.done;b=a.next())b=b.value.split("="),2==b.length&&this.evaluator.setVariable("URL."+b[0],+b[1]==+b[1]?parseFloat(b[1]):b[1])};h.prototype.getState=function(){var a="",b=this.evaluator.variables,d=this.evaluator.vectors,e=this.evaluator.matrices,h;for(h in b)if(b.hasOwnProperty(h)){var n=b[h];"string"==typeof n&&(n="'"+n+"'");void 0!=n&&"rnd"!=h&&"\u03c0"!=h&&"pi"!=h&&"e"!=h&&"Infinity"!=h&&"-Infinity"!=h&&"object"!=typeof n&&(a=""!=a?a+"\n"+h+"="+n:h+"="+n)}for(var p in d)d.hasOwnProperty(p)&&
(a+="\n"+p+"="+f(d[p]));for(var r in e)e.hasOwnProperty(r)&&(a+="\n"+r+"="+f(e[r]));return a};h.prototype.setState=function(a,b){a=a.split("\n");for(var c,d,e=0,f=a.length;e<f;e++)c=a[e].split("="),2<=c.length&&(d=eval(c[1]),-1!=c[1].indexOf("[[")?(this.evaluator.matrices[c[0]]=d,this.evaluator.matrices[c[0]].rows=d.length,this.evaluator.matrices[c[0]].cols=d[0].length):-1!=c[1].indexOf("[")?(this.evaluator.vectors[c[0]]=d,this.evaluator.variables[c[0]+".long"]=d.length):this.evaluator.variables[c[0]]=
d);b||this.update()};h.prototype.getEvaluation=function(){for(var a=correct=0,b="",d=0,e=this.controls.length;d<e;d++)"textfield"==this.controls[d].gui&&this.controls[d].evaluate&&(a++,correct+=this.controls[d].ok,this.controls[d].value=""==this.controls[d].value?"''":this.controls[d].value,b+=" \\n "+this.controls[d].id+"="+this.controls[d].value+"|"+this.controls[d].ok);return"questions="+a+" \\n correct="+correct+" \\n wrong="+(a-correct)+b};h.prototype.showSolution=function(){for(var a=this.controls,
b=0,d=a.length;b<d;b++)"textfield"==a[b].gui&&a[b].evaluate&&a[b].changeValue(a[b].getFirstAnswer());this.update()};h.prototype.showAnswer=function(){for(var a=0,b=this.saveState.length;a<b;a++)this.evaluator.eval(this.saveState[a]);this.update()};h.prototype.cleanCanvasImages=function(){this.container.querySelectorAll("canvas").forEach(function(a){a.width=a.height=1;a.style.width=a.style.height="1px"});this.spaces.forEach(function(a){a.canvas&&(a.canvas=a.ctx=null);a.backCanvas&&(a.backCanvas=a.backCtx=
null)});for(var a in this.images)this.images[a].nodeName&&"canvas"===this.images[a].nodeName.toLowerCase()&&delete this.images[a]};a.DescartesApp=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.DEBUG={PARENTHESIS_CLOSING:"Faltan par\u00e9ntesis por cerrar",PARENTHESIS_OPENING:"Faltan par\u00e9ntesis por abrir",BRACKET_CLOSING:"Faltan corchetes por cerrar",BRACKET_OPENING:"Faltan corchetes por abrir",INCOMPLETE_IF:"Condicional incompleta",EXPRESSION:"En la expresi\u00f3n",setError:function(f,e){f="Error: "+f+" en\u300a "+e+" \u300b";var d="";switch(a.DEBUG.objectName){case "Auxiliar":e="event"===a.DEBUG.typeName||"algorithm"===a.DEBUG.typeName||
"constant"===a.DEBUG.typeName?"En el programa ":"En la definici\u00f3n ";if("doExpr"==babel[a.DEBUG.paramName]||"init"==babel[a.DEBUG.paramName])d=" en la l\u00ednea "+(a.DEBUG.lineCount+1);f+=e+"\u300c"+a.DEBUG.idName+"\u300d, en el par\u00e1metro \u300c"+a.DEBUG.paramName+"\u300d"+d+".";break;case "Graphic":f+="En el gr\u00e1fico #"+(a.DEBUG.elemIndex+1)+" de tipo \u300c"+a.DEBUG.idName+"\u300d, en el par\u00e1metro \u300c"+a.DEBUG.paramName+"\u300d."}console.info(f)}};return a}(descartesJS||{});
descartesJS=function(a){function f(){e().forEach(function(b){a.apps.push(new a.DescartesApp(b));b.className="DescartesJS"})}function e(){return[].concat($jscomp.arrayFromIterable(document.querySelectorAll("applet,ajs"))).filter(function(a){return/Descartes|DescartesJS|descinst.DescartesWeb2_0.class|Arquimedes|Discurso/i.test(a.getAttribute("code"))})}function d(){document.querySelectorAll(".DescartesAppContainer").forEach(function(a){a.remove()})}function r(b){b=a.newHTML("div");var e='<div style="font-size:12px;visibility:hidden;">';
"descartesJS_serif descartesJS_sansserif descartesJS_monospace DJS_symbol DJS_sansserif DJS_serif DJS_monospace DJS_math".split(" ").forEach(function(a){e+='<div style="font-family:'+a+';"><span>_</span><span style="font-weight:bold;">_</span><span style="font-style:italic;">_</span><span style="font-weight:bold;font-style:italic;">_</span></div>'});b.innerHTML=e+"</div>";document.body.appendChild(b);a.getFeatures();a.hasCanvas?(window.scrollTo(0,100),d(),f(),window.addEventListener("resize",a.onResize),
window.scrollTo(0,0)):document.getElementById("StyleDescartesApps").innerHTML="applet.DescartesJS,applet,ajs.DescartesJS,ajs{display:block;}";b.remove()}if(a.loadLib)return a;a.apps=[];a.getDescartesApps=function(){return a.apps};(function(){var b=document.getElementById("StyleDescartesApps");b&&b.remove();b=a.newHTML("style",{id:"StyleDescartesApps",type:"text/css",rel:"stylesheet"});b.innerHTML="applet.DescartesJS,applet,ajs.DescartesJS,ajs{display:none;}";document.head.appendChild(b)})();a.onResize=
function(b){0<a.apps.length&&a.apps[0].scaleToFit()};var n={};a.onMessage=function(b){if(0<a.apps.length){var d=b.data;d&&("set"===d.type?"string"==typeof d.value||"number"==typeof d.value?a.apps[0].evaluator.setVariable(d.name,d.value):d.value&&void 0!=d.value.rows?a.apps[0].evaluator.matrices[d.name]=d.value:a.apps[0].evaluator.vectors[d.name]=d.value:"update"===d.type?a.apps[0].update():"exec"===d.type?(b=a.apps[0].evaluator.getFunction(d.name))&&b.apply(a.apps[0].evaluator,d.value.toString().split(",")):
"isResizeNeeded"===d.type?b.source.postMessage({type:"doResize"},"*"):"doResize"===d.type?0<a.apps.length&&a.apps[0].adjustSize():"change_config"===d.type?(n[d.filename]?b=n[d.filename]:(b=a.newHTML("div"),b.innerHTML=d.content,b=b.getElementsByTagName("param"),n[d.filename]=b),a.apps[0].children=b,a.apps[0].init()):"change_content"===d.type&&(b=a.newHTML("div"),b.innerHTML=d.content,b=b.getElementsByTagName("param"),a.apps[0].children=b,a.apps[0].init()))}};void 0==a.loadLib&&(a.loadLib=!0,window.addEventListener("load",
r),window.addEventListener("message",a.onMessage),["webkitTransitionEnd","transitionend","oTransitionEnd","MSTransitionEnd"].forEach(function(b){window.addEventListener(b,function(b){a.onResize(b)})}),document.fonts.ready.then(function(){setTimeout(function(){for(var b=$jscomp.makeIterator(a.apps),d=b.next();!d.done;d=b.next())d=d.value,d.updateControls(),d.updateSpaces(!0)},15)}));return a}(descartesJS||{});
