/*
 Joel Espinosa Longi
 jlongi@im.unam.mx
 https://github.com/jlongi/DescartesJS
 LGPL - http://www.gnu.org/licenses/lgpl.html
 2022-02-21
*/
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.arrayIteratorImpl=function(a){var g=0;return function(){return g<a.length?{done:!1,value:a[g++]}:{done:!0}}};$jscomp.arrayIterator=function(a){return{next:$jscomp.arrayIteratorImpl(a)}};$jscomp.makeIterator=function(a){var g="undefined"!=typeof Symbol&&Symbol.iterator&&a[Symbol.iterator];return g?g.call(a):$jscomp.arrayIterator(a)};$jscomp.arrayFromIterator=function(a){for(var g,e=[];!(g=a.next()).done;)e.push(g.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 g=function(){};g.prototype=a;return new g};$jscomp.underscoreProtoCanBeSet=function(){var a={a:!0},g={};try{return g.__proto__=a,g.a}catch(e){}return!1};
$jscomp.setPrototypeOf="function"==typeof Object.setPrototypeOf?Object.setPrototypeOf:$jscomp.underscoreProtoCanBeSet()?function(a,g){a.__proto__=g;if(a.__proto__!==g)throw new TypeError(a+" is not extensible");return a}:null;
$jscomp.inherits=function(a,g){a.prototype=$jscomp.objectCreate(g.prototype);a.prototype.constructor=a;if($jscomp.setPrototypeOf){var e=$jscomp.setPrototypeOf;e(a,g)}else for(e in g)if("prototype"!=e)if(Object.defineProperties){var f=Object.getOwnPropertyDescriptor(g,e);f&&Object.defineProperty(a,e,f)}else a[e]=g[e];a.superClass_=g.prototype};
$jscomp.checkStringArgs=function(a,g,e){if(null==a)throw new TypeError("The 'this' value for String.prototype."+e+" must not be null or undefined");if(g 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,g,e){a!=Array.prototype&&a!=Object.prototype&&(a[g]=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,g,e,f){if(g){e=$jscomp.global;a=a.split(".");for(f=0;f<a.length-1;f++){var q=a[f];q in e||(e[q]={});e=e[q]}a=a[a.length-1];f=e[a];g=g(f);g!=f&&null!=g&&$jscomp.defineProperty(e,a,{configurable:!0,writable:!0,value:g})}};
$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 f="";a;)if(a&1&&(f+=e),a>>>=1)e+=e;return f}},"es6","es3");$jscomp.owns=function(a,g){return Object.prototype.hasOwnProperty.call(a,g)};
$jscomp.assign="function"==typeof Object.assign?Object.assign:function(a,g){for(var e=1;e<arguments.length;e++){var f=arguments[e];if(f)for(var q in f)$jscomp.owns(f,q)&&(a[q]=f[q])}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,f){var g=this.length||0;0>e&&(e=Math.max(0,g+e));if(null==f||f>g)f=g;f=Number(f);0>f&&(f=Math.max(0,g+f));for(e=Number(e||0);e<f;e++)this[e]=a;return this}},"es6","es3");$jscomp.findInternal=function(a,g,e){a instanceof String&&(a=String(a));for(var f=a.length,q=0;q<f;q++){var p=a[q];if(g.call(e,p,q,a))return{i:q,v:p}}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=[],f=0;f<this.length;f++){var g=this[f];Array.isArray(g)&&0<a?(g=Array.prototype.flat.call(g,a-1),e.push.apply(e,g)):e.push(g)}return e}},"es9","es5");
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.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;}\n"};
return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,e,f,q={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(f){if(""==f)return"";g=f.split(",");e="";e+=a.getFontStyle(g[1])+" ";e+=g[2]+"px ";return e+=a.getFontName(g[0].split(" ")[0])};a.getFontName=function(e){e=e.toLowerCase();f=a.monospace_font;if("serif"===e||"times new roman"===e||"timesroman"===e||"times"===e)f=a.serif_font;else if("sansserif"===e||"arial"===e||"helvetica"===e)f=a.sansserif_font;return f};
a.getFontStyle=function(a){return q[a.toLowerCase()]||""};a.getTextWidth=function(f,c){a.ctx.font=c;return Math.round(a.ctx.measureText(f).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 g(){var a,b,d,c,h,m,f;Number.prototype.oToFixed=Number.prototype.toFixed;Number.prototype.toFixed=function(k){k=k||0;k=0>k?0:parseInt(k);a=this.toString();-1!==a.indexOf("e")&&(c=a.split("e"),m="-"===c[0][0]?"-":"",h="-"===m?parseFloat(c[0].substring(1)).oToFixed(11):parseFloat(c[0]).oToFixed(11),f=parseInt(c[1]),b=h.indexOf("."),h=h.replace(".",""),0>b+f?(b=0>b?1:b,a=m+"0."+"0".repeat(Math.abs(b+f))+h):a=m+h+"0".repeat(f-h.length+1));b=a.indexOf(".");-1===b?0<k&&
(a+="."+"0".repeat(k)):(d=a.length-b-1,a=d>=k?11>=k?parseFloat(a).oToFixed(k):a.substring(0,b+k+1):a+"0".repeat(k-d));return a}}if(a.loadLib)return a;var e=2*Math.PI,f=360/e,q=e/360,p=Math.floor,c,k,l,b;a.rangeOK=1;a.cssScale=1;a.radToDeg=function(a){return a*f};a.degToRad=function(a){return a*q};a.drawLine=function(a,d,c,h,f,m,k){a.lineWidth=k||1;a.strokeStyle=m||"black";b=a.lineWidth%2*.5;a.beginPath();a.moveTo(p(d)+b,p(c)+b);a.lineTo(p(h)+b,p(f)+b);a.stroke()};a.getColor=function(a,b){if("string"===
typeof b)return b;c=a.eval(b);return"rgba("+p(255*c[0][0])+","+p(255*c[0][1])+","+p(255*c[0][2])+","+(1-c[0][3])+")"};a.getFeatures=function(){var b=navigator.appVersion.toLowerCase();a.hasTouchSupport=window.hasOwnProperty&&window.hasOwnProperty("ontouchstart")||"ontouchstart"in window||/android/i.test(b);a.isIOS=/iPad|iPhone/i.test(navigator.userAgent);a.isMsEdge=/Edge/i.test(navigator.userAgent);b=a.newHTML("canvas");a.hasCanvas=b.getContext&&b.getContext("2d");a.hasCanvas&&(b.width=b.height=1,
a.ctx=a.hasCanvas,a._ratio=2);g()};var h,d;a.removeNeedlessDecimals=function(a){if("string"==typeof a&&(h=a.indexOf("."),-1!==h)){d=a.substring(h);if(0==parseFloat(d))return a.substring(0,h);for(var b=d.length-1;0<b;b--)if("0"!==d.charAt(b))return a.substring(0,h+b+1)}return a};a.returnValue=function(a){return"number"===typeof a?parseFloat(a.toFixed(11)):a};a.whichBtn=function(a){return a.touches?"L":0===a.button?"L":1===a.button?"M":"R"};a.createGradient=function(a,b,d){a=void 0===a?0:a;b=void 0===
b?100:b;d="linear-gradient("+(void 0===d?0:d)+"deg,";for(var c=2*a,h=a;h<b;h++)a=p(100-h-35),d+="rgba(0,0,0,"+a*a*192/1E4/255+") "+(2*h-c)+"%, ";return d+"rgba(0,0,0,0.1) 100%)"};a.getCursorPosition=function(b,d){k=b.touches?b.touches[0]:b;l=d.getBoundingClientRect();return k?{x:(k.pageX-window.pageXOffset-l.left)/a.cssScale,y:(k.pageY-window.pageYOffset-l.top)/a.cssScale}:null};a.splitSeparator=function(a){a=a.replace(/\\n/g,"\n");for(var b=!1,d,c=[],h=0,m=0,f=a.length;m<f;m++)d=a.charAt(m),"'"===
d&&(b=!b),b||";"!==d&&"\n"!==d||(c.push(a.substring(h,m).replace(/\n/g,"\\n")),h=m+1);c.push(a.substring(h).replace(/\n/g,"\\n"));return c};a.preventDefault=function(a){a.preventDefault();return!1};a.convertHTMLEntities=function(b){var d=a.newHTML("textarea");d.innerHTML=b;return d.value};a.newHTML=function(a,b){a=document.createElement(a);for(var d in b)a.setAttribute(d,b[d]);return a};window.requestAnimationFrame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||
window.msRequestAnimationFrame;window.cancelAnimationFrame=window.cancelAnimationFrame||window.mozCancelAnimationFrame;a.setInterval=function(a,b){function d(){Date.now()-c>=b&&(a.call(),c=Date.now());h.value=requestAnimationFrame(d)}if(!requestAnimationFrame)return setInterval(a,b);var c=Date.now(),h={};h.value=requestAnimationFrame(d);return h};a.clearInterval=function(a){a&&(cancelAnimationFrame?cancelAnimationFrame(a.value):clearInterval(a))};a.setTimeout=function(a,b){function d(){Date.now()-
c>=b?a.call():h.value=requestAnimationFrame(d)}if(!requestAnimationFrame)return setTimeout(a,b);var c=Date.now(),h={};h.value=requestAnimationFrame(d);return h};a.clearTimeout=function(a){a&&(cancelAnimationFrame?cancelAnimationFrame(a.value):clearTimeout(a))};a.showAbout=function(){var b="<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='http://arquimedes.matem.unam.mx/Descartes5/creditos/bannerPatrocinadores.html'></iframe>\n<h2><a href='http://proyectodescartes.org/' target='_blank'>ProyectoDescartes.org</a><br><a href='http://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='http://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='http://descartes.matem.unam.mx/'>http://descartes.matem.unam.mx/</a>\n</p>";
a.ccLicense&&(b+="<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>");b+="</body> </html>";var d=window.open("","creditos","width=700,height=500,titlebar=0,toolbar=0,location=0,menubar=0,resizable=0,scrollbars=0,status=0");
d.document.write(b);d.document.close()};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.cacheFiles=Object.create(null);a.openExternalFile=function(g){if(a.cacheFiles[g])return a.cacheFiles[g];var e=null,f=new XMLHttpRequest;f.open("GET",g,!1);try{f.send(null),e=200===f.status||304===f.status?f.responseText:f.responseText||"",e=404===f.status?"":e,e.match(String.fromCharCode(65533))&&(f.open("GET",g,!1),f.overrideMimeType("text/plain;charset=ISO-8859-1"),f.send(null),e=f.responseText)}catch(q){e=null}return e};a.addExternalFileContent=function(g,
e){a.cacheFiles[g]=e};return a}(descartesJS||{});
descartesJS=function(a){function g(a){A=a.indexOf("--radial--");-1!=A&&(a=a.substring(0,A));a=a.replace(/\+/g,"\\+").replace(/\*/g,"\\*");p=a.trim();a={ignoreAccents:!1,ignoreCaps:!1,regExp:null};p[0]==p[p.length-1]&&"'"==p[0]&&(a.ignoreCaps=!0,p=p.substring(1,p.length-1),"`"==p[0]&&"\u00b4"==p[p.length-1]&&(a.ignoreAccents=!0,p=p.substring(1,p.length-1)));"`"==p[0]&&"\u00b4"==p[p.length-1]&&(a.ignoreAccents=!0,p=p.substring(1,p.length-1),p[0]==p[p.length-1]&&"'"==p[0]&&(a.ignoreCaps=!0,p=p.substring(1,
p.length-1)));"*"===p.charAt(0)&&"*"!==p.charAt(p.length-1)?p=p.substring(1)+"$":"*"!==p.charAt(0)&&"*"===p.charAt(p.length-1)?p="^"+p.substring(0,p.length-1):"*"!==p.charAt(0)&&"*"!==p.charAt(p.length-1)?p="^"+p+"$":"*"===p.charAt(0)&&"*"===p.charAt(p.length-1)&&(p=p.substring(1,p.length-1));a.regExp=p.replace(/\?/g,"[\\S\\s]{1}");return a}function e(a,b){p=(a||"").trim();a={ignoreAccents:!1,ignoreCaps:!1,regExp:null};a.expr=p.split(",");a.expr[0]=a.expr[0].trim();a.expr[0]={type:a.expr[0].charAt(0),
expr:b.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:b.parser.parse(a.expr[1].substring(0,a.expr[1].length-1))};return a}function f(a,c,f){c=parseFloat(c);b=a.expr[0];h=a.expr[1];d=f.eval(b.expr);v=f.eval(h.expr);r="("==b.type||"["==b.type;u=")"==h.type||"]"==h.type;return r&&c>d&&u&&c<=v?1:0}function q(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 p,c,k,l,b,h,d,v,r,u,A;a.buildRegularExpressionsPatterns=function(a,b){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 d=0,m=a.length;d<m;d++){c=a[d].split("&");k=[];for(var h=0,f=c.length;h<
f;h++)p=c[h],-1===p.indexOf(",")||"("!==p.charAt(0)&&"["!==p.charAt(0)||")"!==p.charAt(p.length-1)&&"]"!==p.charAt(p.length-1)?k.push(g(p)):k.push(e(p,b));a[d]=k}return a};a.escorrecto=function(b,d,h,k){h=h||a.externalEvaluator;k=k||a.buildRegularExpressionsPatterns(b,h);d=q(d);b=0;for(var m=k.length;b<m;b++){c=k[b];l=!0;for(var e=0,r=c.length;e<r;e++)l=c[e].regExp?l&&!!d.match(new RegExp(q(c[e].regExp),"i")):l&&f(c[e],d,h);if(l)return 1}return 0};a.esCorrecto=function(b,d,h,k){h=h||a.externalEvaluator;
k=k||a.buildRegularExpressionsPatterns(b,h);d+="";b=0;for(var m=k.length;b<m;b++){c=k[b];l=!0;for(var e=0,r=c.length;e<r;e++)(p=c[e].regExp)?(c[e].ignoreAccents&&(d=q(d),p=q(p)),c[e].ignoreCaps&&(d=d.toLowerCase(),p=q(p).toLowerCase()),l=l&&!!d.match(p)):l=l=l&&f(c[e],d,h);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 g=Math.floor,e,f,q,p,c,k,l,b,h,d,v,r,u,A,n=function(b,d){this.r=this.g=this.b=0;this.a=1;this.evaluator=d;this.getColor=this.getColorStr;if(b){if(babel[b]&&("net"===babel[b]&&(b="rojo"),b=babel[b],this.r=a.toHex(b.substring(1,3)),this.g=a.toHex(b.substring(3,5)),this.b=a.toHex(b.substring(5,7)),this.colorStr=b),6===b.length&&(this.r=a.toHex(b.substring(0,2)),this.g=a.toHex(b.substring(2,4)),this.b=a.toHex(b.substring(4,6)),this.colorStr="#"+b),8===
b.length&&(this.r=a.toHex(b.substring(2,4)),this.g=a.toHex(b.substring(4,6)),this.b=a.toHex(b.substring(6,8)),this.a=1-a.toHex(b.substring(0,2))/255,this.colorStr="rgba("+this.r+","+this.g+","+this.b+","+this.a+")"),"("===b[0]){f=[];q=this.splitComa(b.substring(1,b.length-1));b=0;for(d=q.length;b<d;b++)k=q[b],p=parseInt(k,16),k!==p.toString(16)&&k!=="0"+p.toString(16)?("["===k.charAt(0)&&"]"===k.charAt(k.length-1)&&(k=k.substring(1,k.length-1)),f.push(this.evaluator.parser.parse(k))):f.push(this.evaluator.parser.parse((p/
255).toString()));this.rExpr=f[0];this.gExpr=f[1];this.bExpr=f[2];this.aExpr=f[3];this.getColor=this.getColorExp}}else this.colorStr="rgba("+this.r+","+this.g+","+this.b+","+this.a+")"};n.prototype.splitComa=function(a){c=[];for(var m=h=b=l=0,f=a.length;m<f;m++)d=a.charAt(m),"("===d?l++:")"===d?l--:"["===d?b++:"]"===d?b--:","===d&&0===l&&0===b&&(c.push(a.substring(h,m)),h=m+1);c.push(a.substring(h));return c};n.prototype.getColorStr=function(){return this.colorStr};n.prototype.getColorExp=function(){e=
this.evaluator;this.r=g(255*e.eval(this.rExpr));this.g=g(255*e.eval(this.gExpr));this.b=g(255*e.eval(this.bExpr));this.a=1-e.eval(this.aExpr);return"rgba("+this.r+","+this.g+","+this.b+","+this.a+")"};n.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(",");v=parseInt(a[0]).toString(16);r=parseInt(a[1]).toString(16);u=parseInt(a[2]).toString(16);A=(255-
parseInt(255*parseFloat(a[3]))).toString(16);1===v.length&&(v="0"+v);1===r.length&&(r="0"+r);1===u.length&&(u="0"+u);1===A.length&&(A="0"+A);return new n(A+v+r+u)};a.Color=n;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=function(e){var f=this;this.parent=e;this.container=a.newHTML("div",{class:"DescartesKeyboardContainer"});this.container.oncontextmenu=function(){return!1};this.display=a.newHTML("input",{type:"text",class:"DescartesKeyboardDisplay",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.aditionalKeys=a.newHTML("div",{style:"position:absolute; padding: 0 5px 5px 0; display:none;",class:"DescartesKeysContainer"});this.container.appendChild(this.aditionalKeys);this.display.addEventListener("keydown",function(a){f.keypressed=!0;if(27===a.keyCode)f.close();else if(13===a.keyCode)f.onEnter()});this.key_pressed=!1;var g;this.delete_pressed=!1;var p;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(g)};var c=a.target.textContent.trim().toLowerCase();g=setTimeout(function(){f.key_pressed=!0;f.showAditionalKeys(c)},600)}else"k_delete"==a.target.id&&(a.target.onpointerleave=function(){clearTimeout(p)},p=setInterval(function(){f.delete_pressed=!0;f.delete()},200))});this.keyContainer.addEventListener("pointerup",function(a){if(a.target!=f.keyContainer&&a.target!=f.container)if(a.preventDefault(),
a.stopPropagation(),"k_left"==a.target.id)f.display.selectionStart=f.display.selectionEnd=Math.max(0,f.display.selectionStart-1);else if("k_right"==a.target.id)f.display.selectionStart=f.display.selectionEnd=Math.min(f.display.value.length,f.display.selectionStart+1);else if("k_delete"==a.target.id)f.delete_pressed||f.delete(),clearTimeout(p),f.delete_pressed=!1;else if("k_\u221a"==a.target.id)f.insert("\u221a(");else if("k_space"==a.target.id)f.insert(" ");else if("k_esc"==a.target.id)f.close();
else if("k_shift"==a.target.id){a=f.keyContainer.querySelectorAll("div");var c=f.aditionalKeys.querySelectorAll("div");f.shift=!f.shift;f.shift?(a.forEach(function(a){1==a.textContent.trim().length&&(a.textContent=a.textContent.toUpperCase());"k_point_comma"==a.getAttribute("id")&&(a.textContent=",")}),c.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=".")}),c.forEach(function(a){a.textContent=a.textContent.toLowerCase()}))}else if("k_num_layout"==a.target.id)f["setLayout_"+f.layout_mode.replace("alfa","num")]();else if("k_alfa_layout"==a.target.id)f["setLayout_"+f.layout_mode.replace("num","alfa")]();else if("k_clear"==a.target.id)f.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(g),f.key_pressed||
(f.insert(a.target.textContent.trim()),f.aditionalKeys.style.display="none"),f.key_pressed=!1;else if("k_return"==a.target.id)f.onEnter();else a=a.target.textContent.trim(),f.insert(a),f.aditionalKeys.style.display="none";f.display.focus()});this.keyContainer.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation()});var c=!1;this.aditionalKeys.addEventListener("pointerdown",function(a){c=!0});this.aditionalKeys.addEventListener("pointerup",function(a){c&&(a.target!=f.keyContainer&&
a.target!=f.container&&(a.preventDefault(),a.stopPropagation(),a=a.target.textContent.trim(),f.insert(a)),f.key_pressed=!1,f.aditionalKeys.style.display="none");c=!1;f.display.focus()})};g.prototype.insert=function(a){this.display.setRangeText(a);this.display.selectionStart+=a.length;this.display.selectionStart=this.display.selectionEnd};g.prototype.delete=function(){this.display.selectionStart==this.display.selectionEnd&&(this.display.selectionStart=Math.max(0,this.display.selectionStart-1));this.display.setRangeText("")};
g.prototype.addKey=function(a,f,g){return"<div "+(f?"id='"+f+"'":"")+" "+(g?"style='"+g+"'":"")+">"+a+"</div>"};g.prototype.addKeys=function(a){var f=this,e="";a.forEach(function(a){e="object"===typeof a?e+f.addKey(a.val,a.id,a.style):e+f.addKey(a)});return e};g.prototype.showAditionalKeys=function(a){var f=[];"."==a?f=",;:-_\u00bf?\u00a1!()".split(""):"+"==a?f=["-","\u00d7","\u00f7","^"]:"a"==a?f=["\u00e1","\u00e0","\u00e4","\u00e2"]:"e"==a?f=["\u00e9","\u00e8","\u00eb","\u00ea"]:"i"==a?f=["\u00ed",
"\u00ec","\u00ef","\u00ee"]:"o"==a?f=["\u00f3","\u00f2","\u00f6","\u00f4"]:"u"==a&&(f=["\u00fa","\u00f9","\u00fc","\u00fb"]);this.aditionalKeys.innerHTML=this.addKeys(f);this.shift&&(this.aditionalKeys.innerHTML=this.aditionalKeys.innerHTML.toUpperCase());this.aditionalKeys.style.display="flex";this.aditionalKeys.style.left=this.keyContainer.style.left;this.aditionalKeys.style.top=parseFloat(this.keyContainer.style.top)-50+"px"};g.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"};g.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"};g.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"};g.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"};g.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"};g.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};g.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"};g.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"};g.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"};g.prototype.setLayout=function(a){this.layout_mode=a;"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()};g.prototype.show=function(a,f,g,p,c,k,l){this.ctr=a;this.var_id=c;this.onlyText=l;this.container.parentNode||this.parent.container.appendChild(this.container);this.container.style.display="block";this.setDisplay(k);this.setLayout(f);this.keyContainer.style.left=g+"px";this.keyContainer.style.top=p+"px"};g.prototype.close=function(){this.container.style.display="none"};g.prototype.setDisplay=function(e){if("custom"==
e.type){var f=e.x;var g=e.y;var p=e.w;var c=e.h;var k=e.fs}else g=this.container.getBoundingClientRect(),c=e.getBoundingClientRect(),f=c.left/a.cssScale-g.left/a.cssScale,g=c.top/a.cssScale-g.top/a.cssScale,p=c.width/a.cssScale,c=c.height/a.cssScale,k=e.style.fontSize;this.display.setAttribute("style","left:"+f+"px;top:"+g+"px;width:"+p+"px;height:"+c+"px;font-size:"+k+";line-height:"+c+"px;");this.display.value=e.value||"";this.display.focus();this.display.selectionStart=this.display.selectionEnd=
this.display.value.length};g.prototype.onEnter=function(){var a=this.display.value;if(!this.onlyText){var f=this.parent.evaluator.parser.parse(a.replace(/\u221a/g,"sqrt"));try{f&&(a=this.parent.evaluator.eval(f))}catch(q){a=0}}this.ctr?this.ctr.changeValue(a,!0):this.parent.evaluator.setVariable(this.var_id,a);this.parent.update();this.close()};a.Keyboard=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=document.head,e=a.newHTML("meta",{"http-equiv":"X-UA-Compatible",content:"IE=edge,chrome=1"});g.appendChild(e);e=a.newHTML("meta",{name:"viewport",content:"width=device-width,initial-scale=1.0,user-scalable=yes"});document.querySelector("meta[name=viewport]")||g.appendChild(e);e=a.newHTML("meta",{name:"mobile-web-app-capable",content:"yes"});g.appendChild(e);e=a.newHTML("meta",{name:"apple-mobile-web-app-capable",content:"yes"});g.appendChild(e);
e=a.newHTML("meta",{name:"apple-mobile-web-app-status-bar-style",content:"black"});g.appendChild(e);(g=document.getElementById("StyleDescartesApps2"))&&g.remove();g=a.newHTML("style",{rel:"stylesheet",type:"text/css",id:"StyleDescartesApps2"});document.head.insertBefore(g,document.head.firstChild);g.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{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,.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;}\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{touch-action:none;background:#eee;overflow:hidden;position:absolute;}\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{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{background-color:rgba(0,0,0,0.05);transform:scale(1.1);}\n.DescartesKeysContainer > div: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;}\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 g=Math.sin,e=Math.floor,f=Math.random,q=Math.round,p=Math.abs,c=String.fromCharCode,k,l,b,h,d,v,r,u,A,n,m=function(a){this.key=(void 0===a?0:a).toString()};m.prototype.getKey=function(a){k=[];for(var b=0;256>b;b++)k[b]=c(this.alfanum(e(p(7.5*(g(1*b-a)+g(1.4*b+a)+g(.6*b-a)+g(2.2*b+a))))));return k.join("")};m.prototype.encode=function(a){l=e(31*f());this.key=this.getKey(l);return c(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 b=0,d=a.length;b<d;b++)A=256*e(a[b]+128)+q(255*f())+65536*q(255*f()),n=e((A<<this.shift(b))/256),v[3*b]=this.alfanum(n%32),v[3*b+1]=this.alfanum(n/32%32),v[3*b+2]=this.alfanum(n/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;r=Array(a.length/3);for(var b=0,d=r.length;b<d;b++)n=this.numalfa(a[3*b])+32*this.numalfa(a[3*b+1])+1024*this.numalfa(a[3*b+2]),A=e(256*n>>this.shift(b)),u=e(A/256)%256-128,0>u&&(u+=256),r[b]=u;return r};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){h=[];for(var b=0,d=a.length;b<d;b++)h.push(a.charCodeAt(b));return h};m.prototype.bytesToString=function(a){for(var b=0,d=a.length;b<d;b++)a[b]=c(a[b]);return a.join("")};m.prototype.shift=function(a){b=this.key.charCodeAt(a%this.key.length);h=this.numalfa(b);d=e(h/2%8);0==d&&(d=4);return d};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 g=function(e,f){this.parent=e;var g=e.evaluator,p=g.parser;e=new a.Auxiliary(e);var c=this;c.delay=f.delay?p.parse(f.delay):p.parse("60");c.loop=f.loop?f.loop:!1;c.auto=void 0==f.auto?!0:f.auto;c.controls=f.controls;c.init=e.splitInstructions(p,f.init);c.doExpr=e.splitInstructions(p,f.doExpr);f.whileExpr&&(c.whileExpr=p.parse(f.whileExpr));var k,l=c.doExpr.length;c.animExec=function(){for(k=0;k<l;k++)g.eval(c.doExpr[k]);c.parent.update();c.playing&&
(0<g.eval(c.whileExpr)||c.loop)?c.timer=a.setTimeout(c.animExec,g.eval(c.delay)):(c.stop(),c.pause=!1,c.parent.update())};c.playing=!1;c.auto&&c.play()};g.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))))};g.prototype.stop=function(){this.playing=!1;a.clearTimeout(this.timer)};g.prototype.reinit=function(){for(var a=0,f=this.init.length;a<
f;a++)this.parent.evaluator.eval(this.init[a])};a.Animation=g;return a}(descartesJS||{});descartesJS=function(a){if(a.loadLib)return a;var g=function(a,f){this.parent=a;this.evaluator=this.parent.evaluator};g.prototype.execute=function(){};a.Action=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=function(e,f){e=a.Action.call(this,e,f)||this;e.parameter=(f||"").replace(/\\n/g,"\n").replace(/&squot;/g,"'");return e};$jscomp.inherits(g,a.Action);g.prototype.execute=function(){alert(this.parameter)};a.Message=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=function(e,f){e=a.Action.call(this,e,f)||this;var g=e.evaluator,p=g.parser;f=a.splitSeparator((f||"").replace(/&squot;/g,"'"));for(var c=[],k,l=0,b=f.length;l<b;l++)(k=p.parse(f[l],!0))&&c.push(k);b=c.length;e.execute=function(){for(l=0;l<b;l++)g.eval(c[l])};return e};$jscomp.inherits(g,a.Action);a.Calculate=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=function(e,f){var g=a.Action.call(this,e,f)||this;g.parser=e.evaluator.parser;g.evaluator=e.evaluator;g.parameter=f;g.target="_blank";return g};$jscomp.inherits(g,a.Action);g.prototype.execute=function(){var e=this.parameter;e.match(/^\[.*\]?/)&&(e=this.evaluator.eval(this.parser.parse(e.substring(1,e.length-1))));var f=e.indexOf("target");-1!=f&&(this.target=e.substring(f),this.target=this.target.substring(this.target.indexOf("=")+1),e=e.substring(0,
f-1));if("javascript"==e.substring(0,10)){e=new a.SimpleText(parent,e.substring(11).replace(/&squot;/g,"'"));try{eval(e.toString())}catch(q){}}else"http"!=e.substring(0,4)&&(f=window.__dirname||window.location.href,e=f.substring(0,f.lastIndexOf("/")+1)+e),window.open(e,this.target)};a.OpenURL=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=function(e,f){var g=a.Action.call(this,e,f)||this;g.parser=e.evaluator.parser;g.evaluator=e.evaluator;g.parameter=f.trim();g.target="_blank";return g};$jscomp.inherits(g,a.Action);g.prototype.execute=function(){var a=this.parameter;a.match(/^\[.*\]?/)&&(a=this.evaluator.eval(this.parser.parse(a.substring(1,a.length-1))));var f=a.indexOf("target");-1!=f&&(this.target=a.substring(f),this.target=this.target.substring(this.target.indexOf("=")+1),a=a.substring(0,
f-1));if("javascript"==a.substring(0,10)){a=a.substring(11).replace(/&squot;/g,"'");try{eval(a.toString())}catch(q){}}else"http"!=a.substring(0,4)&&(f=window.__dirname||window.location.href,a=f.substring(0,f.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=g;return a}(descartesJS||
{});
descartesJS=function(a){if(a.loadLib)return a;var g=function(e,f){return a.Action.call(this,e,f)||this};$jscomp.inherits(g,a.Action);g.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%;'><script type='text/javascript' src='http://arquimedes.matem.unam.mx/Descartes5/lib/descartes-min.js'>\x3c/script>"+this.parent.applet.outerHTML.replace(/<applet/g,"<ajs").replace(/<\/applet/g,
"</ajs")+"</xmp>")};a.Config=g;return a}(descartesJS||{});descartesJS=function(a){if(a.loadLib)return a;var g=function(e,f){return a.Action.call(this,e,f)||this};$jscomp.inherits(g,a.Action);g.prototype.execute=function(){this.parent.init()};a.Init=g;return a}(descartesJS||{});descartesJS=function(a){if(a.loadLib)return a;var g=function(e,f){return a.Action.call(this,e,f)||this};$jscomp.inherits(g,a.Action);g.prototype.execute=function(){this.parent.clear()};a.Clear=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=function(e,f){return a.Action.call(this,e,f)||this};$jscomp.inherits(g,a.Action);g.prototype.execute=function(){this.parent.play()};a.Animate=g;return a}(descartesJS||{});descartesJS=function(a){if(a.loadLib)return a;var g=function(e,f){return a.Action.call(this,e,f)||this};$jscomp.inherits(g,a.Action);g.prototype.execute=function(){this.parent.reinitAnimation()};a.InitAnimation=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=/[\w\.\-//]*(\.ogg|\.oga|\.mp3|\.wav)/gi,e=function(f,e){f=a.Action.call(this,f,e)||this;e=e||"";e.match(g)?f.filenameExpr=f.evaluator.parser.parse("'"+e.match(g)+"'"):(e.match(/^\[.*\]?/)&&(e=e.substring(1,e.length-1)),f.filenameExpr=f.evaluator.parser.parse(e));return f};$jscomp.inherits(e,a.Action);e.prototype.execute=function(){var a=this.theAudio=this.parent.getAudio(this.evaluator.eval(this.filenameExpr));a.paused?a.play():(a.pause(),a.currentTime=
0)};a.PlayAudio=e;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,e,f=function(a,f){this.parent=a;this.evaluator=this.parent.evaluator;this.local=this.expresion=this.id="";this.evaluate="onlyOnce";Object.assign(this,f)};f.prototype.firstRun=function(){};f.prototype.update=function(){};f.prototype.splitInstructions=function(f,p){e=[];p=p?a.splitSeparator(p):[""];for(var c=0,k=p.length;c<k;c++)a.DEBUG.lineCount=c,(g=f.parse(p[c],!0))&&e.push(g);return e};f.prototype.getPrivateVariables=function(a,f){e=[];f=f?f.split(/;|,/):
[""];for(var c=0,k=f.length;c<k;c++)(g=a.parse(f[c],!0))&&e.push(g);c=0;for(k=e.length;c<k;c++)e[c]="assign"===e[c].type?e[c].childs[0].value:"identifier"===e[c].type?e[c].value:"";return e};f.prototype.parseExpressions=function(f){a.DEBUG.paramName="inicio";this.init=this.splitInstructions(f,this.init);a.DEBUG.paramName="local";this.privateVars=this.getPrivateVariables(f,this.local);a.DEBUG.paramName="hacer";this.doExpr=this.splitInstructions(f,this.doExpr);a.DEBUG.paramName="mientras";this.whileExpr=
f.parse(this.whileExpr)};a.Auxiliary=f;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=function(e,f){e=a.Auxiliary.call(this,e,f)||this;f=e.evaluator.parser;e.expresionString=e.expresion;e.expresion=f.parse(e.expresionString);e.expresion&&f.setVariable(e.id,e.expresion);e.editable&&(e.registerTextField(),e.parent.editableRegionVisible=!0);return e};$jscomp.inherits(g,a.Auxiliary);g.prototype.registerTextField=function(){var e=a.newHTML("div"),f=a.newHTML("label");f.appendChild(document.createTextNode("___"+this.id+"=___"));var g=a.newHTML("input");
g.value=this.expresionString;g.disabled=!this.editable;e.appendChild(f);e.appendChild(g);var p=this,c=p.evaluator.parser;g.onkeydown=function(a){13==a.keyCode&&(p.expresion=c.parse(this.value),c.setVariable(p.id,p.expresion),p.parent.update())};this.parent.editableRegion.textFields.push({container:e,type:"div"})};a.Variable=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=function(e,f){e=a.Auxiliary.call(this,e,f)||this;e.expresion=e.evaluator.parser.parse(e.expresion);e.update();return e};$jscomp.inherits(g,a.Auxiliary);g.prototype.update=function(){this.evaluator.setVariable(this.id,this.evaluator.eval(this.expresion))};a.Constant=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,e,f,q,p=function(c,f){f=a.Auxiliary.call(this,c,f)||this;g=c.evaluator;e=g.parser;f.size=f.size||e.parse("3");f.expresion=f.expresion.split(";");f.parseFile=e.parse(f.file);f.update();return f};$jscomp.inherits(p,a.Auxiliary);p.prototype.update=function(){var c=this.expresion,k;g=this.evaluator;e=g.parser;this.oldFile=this.file;if(f=g.eval(this.parseFile))this.file=f;if(this.file){q=(k=document.getElementById(this.file))&&"descartes/vectorFile"==
k.type?k.text:a.openExternalFile(this.file);if(null!=q){q=q.replace(/\r/g,"").split("\n");k=[];for(var l=0,b=q.length;l<b;l++)""!=q[l]&&k.push(q[l]);q=k}null==q||1==q.length&&""==q[0]?(q=[],this.size=e.parse("0")):(c=q,this.size=null);null===this.size&&(this.size=e.parse(c.length+""))}var h;k=[];l=0;for(b=c.length;l<b;l++)(h=e.parse(c[l],!0))&&"assign"!=h.type&&(h=e.parse(this.id+"["+l+"]="+c[l],!0)),k.push(h);c=parseInt(Math.abs(g.eval(this.size)));c=Array(c).fill(0);c._size_=c.length;g.vectors[this.id]=
c;g.setVariable(this.id+".long",c._size_);l=0;for(b=k.length;l<b;l++)g.eval(k[l])};a.Vector=p;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,e,f,q,p,c=function(c,l){l=a.Auxiliary.call(this,c,l)||this;g=c.evaluator;e=g.parser;l.rows=l.rows||e.parse("3");l.columns=l.columns||e.parse("3");l.expresion=l.splitInstructions(e,l.expresion);f=g.eval(l.rows);q=g.eval(l.columns);p=[];p.type="matrix";c=0;for(var b=q;c<b;c++)p[c]=Array(f).fill(0);g.matrices[l.id]=p;l.update();return l};$jscomp.inherits(c,a.Auxiliary);c.prototype.update=function(){g=this.evaluator;f=g.eval(this.rows);q=g.eval(this.columns);
g.setVariable(this.id+".filas",f);g.setVariable(this.id+".columnas",q);p=g.matrices[this.id];p.rows=f;p.cols=q;for(var a=0,c=this.expresion.length;a<c;a++)g.eval(this.expresion[a])};a.Matrix=c;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=function(e,f){var g=a.Auxiliary.call(this,e,f)||this;var p=g.evaluator;e=p.parser;f=g.id.indexOf("(");g.name=g.id.substring(0,f);g.params=g.id.substring(f+1,g.id.indexOf(")"));g.domain=g.range?e.parse(g.range):e.parse("1");g.params=""===g.params?[]:g.params.split(",");g.numberOfParams=g.params.length;g.algorithm||(g.init="",g.doExpr="",g.whileExpr="");g.parseExpressions(e);g.expresion=e.parse(g.expresion);g.functionExec=function(){g.iterations=0;
if(g.numberOfParams<=arguments.length){for(var c=[],f=0,e=g.privateVars.length;f<e;f++)c.push(p.getVariable(g.privateVars[f])),p.setVariable(g.privateVars[f],0);var b=[];f=0;for(e=g.params.length;f<e;f++)b[f]=p.getVariable(g.params[f]),p.setVariable(g.params[f],arguments[f]);f=0;for(e=g.init.length;f<e;f++)p.eval(g.init[f]);do{f=0;for(e=g.doExpr.length;f<e;f++)p.eval(g.doExpr[f]);if(1E5<++g.iterations)return console.warn("se ha excedido el l\u00edmite de 100000 repeticiones en la funci\u00f3n << "+
g.name+" >>"),0}while(0<p.eval(g.whileExpr));var h=p.eval(g.expresion);a.rangeOK=p.eval(g.domain);f=0;for(e=g.params.length;f<e;f++)p.setVariable(g.params[f],b[f]);f=0;for(e=g.privateVars.length;f<e;f++)p.setVariable(g.privateVars[f],c[f]);return h}return 0};p.setFunction(g.name,g.functionExec);return g};$jscomp.inherits(g,a.Auxiliary);a.Function=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=function(e,f){var g=a.Auxiliary.call(this,e,f)||this;var p=g.evaluator;g.parseExpressions(p.parser);g.algorithmExec=function(){for(var a=g.iterations=0,f=g.init.length;a<f;a++)p.eval(g.init[a]);do{a=0;for(f=g.doExpr.length;a<f;a++)p.eval(g.doExpr[a]);if(1E5<++g.iterations)return console.warn("se ha excedido el l\u00edmite de 100000 repeticiones en el algoritmo << "+g.name+" >>"),0}while(0<p.eval(g.whileExpr))};return g};$jscomp.inherits(g,a.Auxiliary);
g.prototype.update=function(){this.algorithmExec();"onlyOnce"===this.evaluate&&(this.update=function(){})};a.Algorithm=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=function(e,f){e=a.Auxiliary.call(this,e,f)||this;f=e.evaluator;delete e.evaluate;e.condition=f.parser.parse(e.condition);e.lastEvaluation=!1;e.action=e.parent.lessonParser.parseAction(e);"onlyOnce"==e.execution&&(e.eventExec=function(){0<this.evaluator.eval(this.condition)&&!this.lastEvaluation&&(this.lastEvaluation=!0,this.action.execute())});"alternate"==e.execution&&(e.eventExec=function(){var a=0<this.evaluator.eval(this.condition);a&&!this.lastEvaluation?
(this.action.execute(),this.lastEvaluation=!0):!a&&this.lastEvaluation&&(this.lastEvaluation=!1)});"always"==e.execution&&(e.eventExec=function(){0<this.evaluator.eval(this.condition)&&this.action.execute()});return e};$jscomp.inherits(g,a.Auxiliary);g.prototype.update=function(){this.eventExec()};a.Event=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=function(e,f){var g=a.Auxiliary.call(this,e,f)||this;if(f=f.file){var p=document.getElementById(f);p=p&&"descartes/library"===p.type?p.text:a.openExternalFile(f)}if(p){p=a.convertHTMLEntities(p).replace(/\r/g,"").split("\n");f=0;for(var c=p.length;f<c;f++)""!==p[f].trim()&&e.lessonParser.parseAuxiliar(p[f])}return g};$jscomp.inherits(g,a.Auxiliary);a.Library=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,e,f,q,p,c,k,l,b=function(b,d){this.parent=b;this.evaluator=b.evaluator;var c=this.evaluator.parser;this.spaceID="";this.background=!1;this.type="";this.drawif=c.parse("1");this.abs_coord=d.type&&"text"===d.type.toLowerCase()?!0:!1;this.color=new a.Color("20303a");this.trace="";this.expresion=c.parse("(0,0)");this.family="";this.family_interval=c.parse("[0,1]");this.family_steps=c.parse("8");this.editable=this.visible=!1;this.font="SansSerif,PLAIN,"+
(5<=this.parent.version?"18":"12");this.fixed=!0;this.text="";this.decimals=c.parse("2");Object.assign(this,d);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=b.evaluator.parser.parse(this.fontSize.toString()))};b.prototype.getSpace=
function(){var a=this;return this.parent.spaces.find(function(b){return b.id===a.spaceID})||this.parent.spaces[0]};b.prototype.getFamilyValues=function(){g=this.evaluator;e=g.eval(this.family_interval);this.familyInf=e[0][0];this.familySup=e[0][1];this.fSteps=Math.round(g.eval(this.family_steps));this.family_sep=0<this.fSteps?(this.familySup-this.familyInf)/this.fSteps:0};b.prototype.drawFamilyAux=function(a,b,c){g=this.evaluator;this.getFamilyValues();f=g.getVariable(this.family);if(0<=this.fSteps)for(var d=
0,h=this.fSteps;d<=h;d++)g.setVariable(this.family,this.familyInf+d*this.family_sep),0<g.eval(this.drawif)&&(this.update(),a.oldTextNode=null,this.drawAux(a,b,c));g.setVariable("_Text_H_",0);g.setVariable(this.family,f)};b.prototype.draw=function(a,b){""!==this.family?this.drawFamilyAux(this.ctx,a,b):0<this.evaluator.eval(this.drawif)&&(this.update(),this.drawAux(this.ctx,a,b));this.ctx.setLineDash([])};b.prototype.drawTrace=function(a,b){""!=this.family?this.drawFamilyAux(this.traceCtx,a,b):0<this.evaluator.eval(this.drawif)&&
(this.update(),this.drawAux(this.traceCtx,a,b))};b.prototype.rotate=function(a,b,c){k=Math.cos(c);l=Math.sin(c);return{x:a*k-b*l,y:a*l+b*k}};b.prototype.dashStyle=function(){c=this.ctx;"dot"===this.lineDash?(c.lineCap="butt",c.setLineDash([c.lineWidth,c.lineWidth])):"dash"===this.lineDash?(c.lineCap="butt",c.setLineDash([4*c.lineWidth,3*c.lineWidth])):"dash_dot"===this.lineDash?(c.lineCap="butt",c.setLineDash([4*c.lineWidth,2*c.lineWidth,c.lineWidth,2*c.lineWidth])):c.setLineDash([])};b.prototype.drawText=
function(a,b,c,f,e,l,k,m,w,x,y){a.textNode=b;if("rtfNode"===b.type)a.fillStyle=a.strokeStyle=e.getColor(),a.textBaseline="alphabetic",a.textNode.pos={x:c,y:f},b.update(a,c,f,w,x,k,y,e.getColor());else for("simpleText"===b.type&&(b=b.toString(w,x).split("\\n")),g=this.evaluator,a.fillStyle=e.getColor(),a.font=l,a.textAlign=k,a.textBaseline=m,p=1.2*this.fontSize||0,e=0,l=b.length;e<l;e++)q=b[e],this.border&&(a.strokeStyle=this.border.getColor(),a.lineWidth=4,a.lineJoin="round",a.miterLimit=2,a.strokeText(q,
c,f+p*e)),a.fillText(q,c,f+p*e)};a.Graphic=b;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,e,f,q,p,c,k,l=function(a,h){this.text=h=h.replace("&#x2013","\u2013").replace(/&squot;/g,"'");this.textElements=[];this.textElementsMacros=[];this.parent=a;this.evaluator=a.evaluator;this.type="simpleText";g="'";q=f=0;for(p=-1;f<h.length;)c=h.charAt(f),k=h.charAt(f-1),"["===c&&"\\"===k?(this.textElements.push(h.substring(q,f-1)+"["),this.textElementsMacros.push("'"+h.substring(q,f-1)+"['"),q=f+1):"]"===c&&"\\"===k?(this.textElements.push(h.substring(q,
f-1)+"]"),this.textElementsMacros.push("'"+h.substring(q,f-1)+"]'"),q=f+1):"["===c&&-1===p?(this.textElements.push(h.substring(q,f)),this.textElementsMacros.push("'"+h.substring(q,f)+"'"),q=f,p++):"["===c?p++:"]"===c&&0===p?(this.textElements.push(this.evaluator.parser.parse(h.substring(q,f+1))),this.textElementsMacros.push("["+h.substring(q,f+1)+"]"),q=f+1,p--):("]"==h.charAt(f)&&(p=0>p?p:p-1),g+=h.charAt(f)),f++;this.textElements.push(h.substring(q,f));this.textElementsMacros.push("'"+h.substring(q,
f)+"'")};l.prototype.toString=function(b,c){g="";for(var d=0,h=this.textElements.length;d<h;d++)"string"===typeof this.textElements[d]?g+=this.textElements[d]:(e=this.evaluator.eval(this.textElements[d])[0][0],""!==e&&("string"===typeof e?g+=e:Infinity==e?g+="Infinity":-Infinity==e?g+="-Infinity":isNaN(e)||"NaN"==e?g+="NaN":(e=parseFloat(e),e=c?e.toFixed(b):a.removeNeedlessDecimals(e.toFixed(b)),g+=e.toString().replace(".",this.parent.decimal_symbol))));return g};a.SimpleText=l;return a}(descartesJS||
{});
descartesJS=function(a){if(a.loadLib)return a;var g,e,f,q,p,c,k,l,b,h,d,v,r,u,A,n,m,w,x,y,z,G,J,E,F,D,B,L,I,M,O,H,P,C,N=function(b,d){d=a.Graphic.call(this,b,d)||this;d.width=d.width||b.evaluator.parser.parse("1");d.fillP=d.fillP||"";d.fillM=d.fillM||"";d.parseExpression();d.visible=2===d.parent.version&&void 0==d.visible?!0:d.visible;d.visible&&d.registerTextField();v=new a.R2;r=new a.R2;u=new a.R2;m=new a.R2;A=new a.R2;d.cInd=0;return d};$jscomp.inherits(N,a.Graphic);N.prototype.parseExpression=function(){if("compOperator"===
this.expresion.type){var b=this.expresion.childs[0],d=this.expresion.childs[1];"identifier"!=b.type||"y"!=b.value||d.contains("y")?"identifier"!=d.type||"y"!=d.value||b.contains("y")?"identifier"!=b.type||"x"!=b.value||d.contains("x")?"identifier"!=d.type||"x"!=d.value||b.contains("x")||(this.funExpr=d,this.of_y=!0,this.drawAux=this.drawAuxFun):(this.funExpr=d,this.of_y=!0,this.drawAux=this.drawAuxFun):(this.funExpr=b,this.of_y=!1,this.drawAux=this.drawAuxFun):(this.funExpr=d,this.of_y=!1,this.drawAux=
this.drawAuxFun)}this.newt=new a.R2Newton(this.evaluator,this.expresion)};N.prototype.update=function(){};N.prototype.draw=function(){""!=this.family?this.drawFamilyAux(this.ctx,this.fill,this.color):(this.update(),this.drawAux(this.ctx,this.fill,this.color))};N.prototype.drawFamilyAux=function(a,b,d){e=this.evaluator;this.getFamilyValues();tempParam=e.getVariable(this.family);if(0<=this.fSteps)for(var c=0,h=this.fSteps;c<=h;c++)e.setVariable(this.family,this.familyInf+c*this.family_sep),this.update(),
this.drawAux(a,b,d);e.setVariable(this.family,tempParam)};N.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.fill,this.trace)};N.prototype.drawAux=function(K,Q,R){if(!(0>=this.evaluator.eval(this.drawif))){this.cInd=0;e=this.evaluator;f=e.parser;q=this.space;p=e.eval(this.width);K.strokeStyle=this.color.getColor();K.lineWidth=p;c=f.getVariable("x");k=f.getVariable("y");l=q.w+24;b=q.h+24;h=l/9;3>h&&(h=3);d=b/7;3>d&&(d=3);0==this.cInd?(g=[],this.cInd++):this.cInd=(this.cInd+
1)%1E7;v.set(0,0);r.set(0,0);u.set(0,0);P=.25;C=8;this.abs_coord||(P/=q.scale,C/=q.scale);K.beginPath();for(B=parseInt(d/2);B<b;B+=d)for(D=parseInt(h/2);D<l;D+=h){if(this.abs_coord){m.set(D,B);n=this.newt.findZero(m,P);if(null==n)continue;e.setVariable("x",n.x);e.setVariable("y",n.y);A.set(n.x,n.y)}else{m.set(q.getRelativeX(D),q.getRelativeY(B));n=this.newt.findZero(m,P);if(null==n)continue;e.setVariable("x",n.x);e.setVariable("y",n.y);A.set(q.getAbsoluteX(n.x),q.getAbsoluteY(n.y))}w=A.ix();x=A.iy();
if(-12<=w&&w<l+24&&-12<=x&&x<b+24){if(g[w+12+(x+12)*q.w]===this.cInd)continue;g[w+12+(x+12)*q.w]=this.cInd}a.rangeOK&&(K.moveTo(w,x),K.lineTo(w,x));v.x=n.x;v.y=n.y;r.x=n.x;r.y=n.y;y=this.newt.getUnitNormal();if(0!=y.x||0!=y.y)for(y.rotL90(),u.x=y.x,u.y=y.y,G=z=0,J=!1;2>G;)if(J&&(u.x=-y.x,u.y=-y.y,n.x=v.x,n.y=v.y,r.x=n.x,r.y=n.y,this.abs_coord?A.set(n.x,n.y):A.set(q.getAbsoluteX(n.x),q.getAbsoluteY(n.y)),w=A.ix(),x=A.iy(),J=!1,z=0),n.x+=C*u.x,n.y+=C*u.y,n=this.newt.findZero(n,P),null!=n){e.setVariable("x",
n.x);e.setVariable("y",n.y);u.x=n.x-r.x;u.y=n.y-r.y;u.normalize();if(0==u.x&&0==u.y)break;r.x=n.x;r.y=n.y;this.abs_coord?A.set(n.x,n.y):A.set(q.getAbsoluteX(n.x),q.getAbsoluteY(n.y));E=parseInt(A.ix());F=parseInt(A.iy());if(E!=w||F!=x)if(L=w,I=x,w=E,x=F,-12<=w&&w<l+24&&-12<=x&&x<b+24){z=0;M=g[w+12+(x+12)*q.w];g[w+12+(x+12)*q.w]=this.cInd;for(Q=1;8>Q;Q++)O=L+Math.round((w-L)*Q/8),H=I+Math.round((x-I)*Q/8),0<=O&&O<l&&0<=H&&H<b&&(g[O+12+(H+12)*q.w]=this.cInd);a.rangeOK&&(K.moveTo(L,I),K.lineTo(w,x));
if(M===this.cInd)break}else J=!0,G++;else 4<++z&&(J=!0,G++)}}K.stroke()}};N.prototype.X=function(a,b,d){d||(b=this.space.w/2+this.space.Ox+this.space.scale*b);b<-a&&(b=-a);b>this.space.w+a&&(b=this.space.w+a);return b};N.prototype.Y=function(a,b,d){d||(b=this.space.h/2+this.space.Oy-this.space.scale*b);b<-a&&(b=-a);b>this.space.h+a&&(b=this.space.h+a);return b};N.prototype.XX=function(a,b,d){return Math.round(this.X(a,b,d))};N.prototype.YY=function(a,b,d){return Math.round(this.Y(a,b,d))};N.prototype.extrapolate=
function(b,d,c,h,m,f){for(var e=this.evaluator.getVariable(d),g=f/2,l=0,r,k,n,p,u,v;1E-15<Math.abs(g);){r=this.evaluator.getVariable(d);k=this.evaluator.getVariable(d)+g;this.evaluator.setVariable(d,k);n=!0;try{p=m,m=this.evaluator.eval(this.funExpr),this.evaluator.setVariable(c,m),0<this.evaluator.eval(b)?(u=new a.R2(Math.min(p,m),Math.max(p,m)),v=0,v=0<f?this.Singularity(Math.abs(g),d,h,r,p,k,m,u):this.Singularity(Math.abs(g),d,h,k,m,r,p,u),0<v&&(n=!1)):n=!1}catch(Z){n=!1}n?l+=g:this.evaluator.setVariable(d,
r);g/=2}this.evaluator.setVariable(d,e);return new a.R2(l/Math.abs(f),m)};N.prototype.extrapolateOnSingularity=function(b,d,c,h,m,f){h=this.evaluator.getVariable(d);for(var e=f/2,g=0,l=m,r;1E-15<Math.abs(e);){this.evaluator.setVariable(d,this.evaluator.getVariable(d)+e);r=!0;if(0<this.evaluator.eval(b))try{l=this.evaluator.eval(this.funExpr),this.evaluator.setVariable(c,l),0>=this.evaluator.eval(b)&&(r=!1)}catch(X){r=!1}else r=!1;r?g+=e:this.evaluator.setVariable(d,this.evaluator.getVariable(d)-e);
e/=2}if(0==g)for(e=f/2,g=f,l=m;1E-15<Math.abs(e);){this.evaluator.setVariable(d,this.evaluator.getVariable(d)-e);r=!0;if(0<this.evaluator.eval(b))try{l=this.evaluator.eval(this.funExpr)}catch(X){r=!1}else r=!1;r?g+=-e:this.evaluator.setVariable(d,this.evaluator.getVariable(d)+e);e/=2}this.evaluator.setVariable(d,h);return new a.R2(g/Math.abs(f),l)};N.prototype.Singularity=function(a,b,d,c,h,m,f,e){if(isNaN(f)||isNaN(h)||isNaN(e.y)||isNaN(e.x)||c>=m)return 2;var g=this.evaluator.getVariable(b),l=0;
try{if(1E-15>Math.abs(m-c)||1E-12>Math.abs(m-c)&&Math.abs(f-h)>Math.abs(a))return this.evaluator.setVariable(b,g),1;var r=(c+m)/2;this.evaluator.setVariable(b,r);var k=NaN;try{k=this.evaluator.eval(this.funExpr)}catch(Y){return 2}if(isNaN(k))return 5;if(Math.abs(f-h)>a){this.evaluator.setVariable(b,c-1E-12);var n=this.evaluator.eval(this.funExpr);n=(h-n)/1E-12;this.evaluator.setVariable(b,m+1E-12);var p=(this.evaluator.eval(this.funExpr)-f)/1E-12;if((10>Math.abs(p)||10>Math.abs(n))&&(0<=p&&0<=n||
0>=p&&0>=n)&&4*Math.abs(p)<Math.abs((f-h)/(m-c)))return this.evaluator.setVariable(b,g),2}if(isNaN(e.x)||isNaN(e.y)||isNaN(k))return 2;if(!(e.x<=k&&k<=e.y)){this.evaluator.setVariable(b,r);e.x=Math.min(h,k);e.y=Math.max(h,k);var u=this.Singularity(a/2,b,d,c,h,r,k,e);this.evaluator.setVariable(b,m);e.x=Math.min(f,k);e.y=Math.max(f,k);var v=this.Singularity(a/2,b,d,r,k,m,f,e);l=Math.max(u,v)}}catch(Y){l=1}this.evaluator.setVariable(b,g);return l};N.prototype.drawAuxFun=function(b,d,h){c=this.evaluator.parser.getVariable("x");
k=this.evaluator.parser.getVariable("y");a.rangeOK=1;d="x";var m="y";this.of_y&&(d="y",m="x");var f=this.drawif,e=this.evaluator.eval(this.width),g=!1,l=new a.R2(this.space.w/2+this.space.Ox,this.space.h/2+this.space.Oy),r=this.of_y?l.ix():l.iy(),n=0,p=0,u=0,v=0,y=1/this.space.scale;l=y*(this.of_y?-this.space.h+l.y:-l.x);var q=0;this.abs_coord&&(l=0,y=1);for(var A,G,w,B,I,F,x,z,D,R=this.of_y?this.space.h+2:this.space.w+2;u<=R;){A=!0;G=0;this.evaluator.setVariable(d,l);try{w=this.evaluator.eval(this.funExpr),
isNaN(w)||(this.evaluator.setVariable(m,w),0<this.evaluator.eval(this.drawif)&&a.rangeOK?(g?(B=Math.min(q,w),I=Math.max(q,w),F=new a.R2(B,I),G=this.Singularity(y,d,0,l-y,q,l,w,F),0===G?(q<=w?(q=F.x,w=F.y):(w=F.x,q=F.y),x=parseInt(this.of_y?this.XX(e,q,this.abs_coord):this.YY(e,q,this.abs_coord)),n=this.abs_coord?Math.round(w):parseInt(this.of_y?this.XX(e,w,this.abs_coord):this.YY(e,w,this.abs_coord)),this.fillM&&n>r&&(b.lineWidth=1,b.strokeStyle=this.fillM.getColor(),b.beginPath(),this.of_y?(b.moveTo(r+
1,this.space.h-u+.5),b.lineTo(n,this.space.h-u+.5)):(b.moveTo(u+.5,r+1),b.lineTo(u+.5,n)),b.stroke()),this.fillP&&n<r&&(b.lineWidth=1,b.strokeStyle=this.fillP.getColor(),b.beginPath(),this.of_y?(b.moveTo(r-1,this.space.h-u+.5),b.lineTo(n,this.space.h-u+.5)):(b.moveTo(u+.5,r-1),b.lineTo(u+.5,n)),b.stroke()),b.lineWidth=e,b.strokeStyle=h.getColor(),b.beginPath(),this.of_y?(b.moveTo(x+.5,this.space.h-v),b.lineTo(n+.5,this.space.h-u)):(b.moveTo(v+.5,x),b.lineTo(u+.5,n)),b.stroke()):1===G?(this.evaluator.setVariable(d,
l-y),z=this.extrapolate(f,d,m,0,q,y),n=this.of_y?this.XX(e,z.y,this.abs_coord):this.YY(e,z.y,this.abs_coord),b.lineWidth=e,b.strokeStyle=h.getColor(),b.beginPath(),this.of_y?(b.moveTo(p+.5,this.space.h-v),b.lineTo(n+.5,this.space.h-v+Math.round(z.x))):(b.moveTo(v+.5,p),b.lineTo(v+Math.round(z.x)+.5,n)),this.evaluator.setVariable(d,l),D=this.extrapolate(f,d,m,0,w,-y),p=this.of_y?this.XX(e,D.y,this.abs_coord):this.YY(e,D.y,this.abs_coord),n=this.of_y?this.XX(e,w,this.abs_coord):this.YY(e,w,this.abs_coord),
b.lineWidth=e,b.strokeStyle=h.getColor(),b.beginPath(),this.of_y?(b.moveTo(p+.5,this.space.h-u),b.lineTo(n+.5,this.space.h-u)):(b.moveTo(u+.5,p),b.lineTo(u+.5,n)),b.stroke()):2===G&&(n=this.of_y?this.XX(e,w,this.abs_coord):this.YY(e,w,this.abs_coord),b.lineWidth=e,b.strokeStyle=h.getColor(),b.beginPath(),this.of_y?(b.moveTo(p+.5,this.space.h-u),b.lineTo(n+.5,this.space.h-u)):(b.moveTo(u+.5,p),b.lineTo(u+.5,n)))):(D=this.extrapolateOnSingularity(f,d,m,0,w,-y),p=this.of_y?this.XX(e,D.y,this.abs_coord):
this.YY(e,D.y,this.abs_coord),n=this.of_y?this.XX(e,w,this.abs_coord):this.YY(e,w,this.abs_coord),b.lineWidth=e,b.strokeStyle=h.getColor(),b.beginPath(),this.of_y?(b.moveTo(p,this.space.h-(u+Math.round(D.x))+.5),b.lineTo(n,this.space.h-u+.5)):(b.moveTo(u+Math.round(D.x),p),b.lineTo(u,n)),b.stroke()),q=w):A=!1)}catch(aa){A=!1}g&&!A&&(this.evaluator.setVariable(d,l-y),this.evaluator.setVariable(m,q),z=this.extrapolate(f,d,m,0,q,y),n=parseInt(this.of_y?this.XX(e,z.y,this.abs_coord):this.YY(e,z.y,this.abs_coord)),
0<this.evaluator.eval(this.drawif)&&a.rangeOK&&(b.lineWidth=e,b.strokeStyle=h.getColor(),b.beginPath(),this.of_y?(b.moveTo(p,this.space.h-(v+Math.round(z.x))+.5),b.lineTo(n,this.space.h-(v+Math.round(z.x))+.5)):(b.moveTo(v+Math.round(z.x)+.5,p),b.lineTo(v+Math.round(z.x)+.5,n)),b.stroke()),this.evaluator.setVariable(d,l));g=A;l+=y;p=n;v=u++}this.evaluator.parser.setVariable("x",c);this.evaluator.parser.setVariable("y",k)};N.prototype.registerTextField=function(){var b=a.newHTML("input");b.value=this.expresionString;
b.disabled=!this.editable;var d=this;oncontextmenu=function(a){return!1};b.onkeydown=function(a){13==a.keyCode&&(d.expresion=d.evaluator.parser.parse(this.value),d.parseExpression(),d.parent.update())};this.parent.editableRegion.textFields.push(b)};a.Equation=N;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.round,e,f,q,p,c,k,l,b=function(b,d){d=a.Graphic.call(this,b,d)||this;d.parameter=d.parameter||"t";d.parameter_interval=d.parameter_interval||b.evaluator.parser.parse("[0,1]");d.parameter_steps=d.parameter_steps||b.evaluator.parser.parse("8");d.width=d.width||b.evaluator.parser.parse("1");d.fill=d.fill||"";d.visible=2===d.parent.version&&void 0==d.visible?!0:d.visible;d.visible&&d.registerTextField();return d};$jscomp.inherits(b,a.Graphic);b.prototype.update=
function(){e=this.evaluator;f=e.eval(this.parameter_interval);this.paraInf=f[0][0];this.paraSup=f[0][1];this.pSteps=e.eval(this.parameter_steps);this.paraSep=0<this.pSteps?Math.abs(this.paraSup-this.paraInf)/this.pSteps:0};b.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.fill,this.color)};b.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.fill,this.trace)};b.prototype.drawAux=function(b,d,f){e=this.evaluator;q=this.space;b.lineWidth=Math.max(1E-6,g(e.eval(this.width)));
b.lineCap=b.lineJoin="round";b.strokeStyle=f.getColor();p=e.getVariable(this.parameter);b.beginPath();e.setVariable(this.parameter,this.paraInf);c=e.eval(this.expresion);this.exprX=g(this.abs_coord?c[0][0]:q.getAbsoluteX(c[0][0]));this.exprY=g(this.abs_coord?c[0][1]:q.getAbsoluteY(c[0][1]));this.rotateExp&&(k=a.degToRad(e.eval(this.rotateExp)),l=this.rotate(c[0][0],c[0][1],k),this.exprX=g(this.abs_coord?l.x:q.getAbsoluteX(l.x)),this.exprY=g(this.abs_coord?l.y:q.getAbsoluteY(l.y)));b.moveTo(this.exprX+
.5,this.exprY+.5);for(f=1;f<=this.pSteps;f++)e.setVariable(this.parameter,this.paraInf+f*this.paraSep),c=e.eval(this.expresion),this.rotateExp&&(l=this.rotate(c[0][0],c[0][1],k),c[0][0]=l.x,c[0][1]=l.y),this.exprX=g(this.abs_coord?c[0][0]:q.getAbsoluteX(c[0][0])),this.exprY=g(this.abs_coord?c[0][1]:q.getAbsoluteY(c[0][1])),!isNaN(this.exprX)&&!isNaN(this.exprY)&&-1E6<this.exprX&&1E6>this.exprX&&-1E6<this.exprY&&1E6>this.exprY&&b.lineTo(this.exprX+.5,this.exprY+.5);this.fill&&(b.fillStyle=d.getColor(),
b.fill("evenodd"));this.dashStyle();b.stroke();b.setLineDash([]);e.setVariable(this.parameter,p)};b.prototype.registerTextField=function(){var b=a.newHTML("input");b.value=this.expresionString;b.disabled=!this.editable;var d=this;b.oncontextmenu=function(){return!1};b.onkeydown=function(a){13==a.keyCode&&(d.expresion=d.evaluator.parser.parse(this.value),d.parent.update())};this.parent.editableRegion.textFields.push(b)};a.Curve=b;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=2*Math.PI,e=Math.round,f,q,p,c,k,l,b,h,d,v,r=function(b,d){d=a.Graphic.call(this,b,d)||this;d.size=d.size||b.evaluator.parser.parse("2");d.range=d.range||b.evaluator.parser.parse("[1, 100]");d.visible=2===d.parent.version&&void 0==d.visible?!0:d.visible;d.visible&&d.registerTextField();return d};$jscomp.inherits(r,a.Graphic);r.prototype.update=function(){f=this.evaluator;p=f.eval(this.expresion);this.exprX=p[0][0];this.exprY=p[0][1];this.rotateExp&&
(c=this.rotate(p[0][0],p[0][1],a.degToRad(f.eval(this.rotateExp))),this.exprX=c.x,this.exprY=c.y);b=f.eval(this.range);this.rangeInf=b[0][0];this.rangeMax=b[0][1]};r.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.color,this.color)};r.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.trace,this.trace)};r.prototype.drawAux=function(b,c){f=this.evaluator;q=this.space;d=h=Math.ceil(f.eval(this.size)-.4);b.fillStyle=c.getColor();b.beginPath();this.rangeInf>
this.rangeMax&&(v=this.rangeInf,this.rangeInf=this.rangeMax,this.rangeMax=v);c=f.getVariable("n");for(var r=this.rangeInf,m=this.rangeMax;r<=m;r++)f.setVariable("n",r),p=f.eval(this.expresion),this.exprX=p[0][0],this.exprY=p[0][1],k=e(this.abs_coord?this.exprX:q.getAbsoluteX(this.exprX)),l=e(this.abs_coord?this.exprY:q.getAbsoluteY(this.exprY)),b.beginPath(),b.arc(k,l,h,0,g,!0),b.fill();b.fill();this.text!=[""]&&(this.fontSize=Math.max(5,f.eval(this.font_size)),this.font=this.font_style+" "+this.fontSize+
"px "+this.font_family,a.Graphic.prototype.drawText.call(this,b,this.text,k+d,l-d,this.color,this.font,"start","alphabetic",f.eval(this.decimals),this.fixed,!0));f.setVariable("n",c)};r.prototype.registerTextField=function(){var b=a.newHTML("input");b.value=this.expresionString;b.disabled=!this.editable;var d=this;oncontextmenu=function(a){return!1};b.onkeydown=function(a){13==a.keyCode&&(d.expresion=d.evaluator.parser.parse(this.value),d.parent.update())};this.parent.editableRegion.textFields.push(b)};
a.Sequence=r;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=2*Math.PI,e=Math.round,f,q,p,c,k,l,b,h=function(b,c){c=a.Graphic.call(this,b,c)||this;c.size=c.size||b.evaluator.parser.parse("2");c.text=new a.TextObject(c,c.text);return c};$jscomp.inherits(h,a.Graphic);h.prototype.update=function(){f=this.evaluator;p=f.eval(this.expresion);this.exprX=p[0][0];this.exprY=p[0][1];this.rotateExp&&(c=this.rotate(p[0][0],p[0][1],a.degToRad(f.eval(this.rotateExp))),this.exprX=c.x,this.exprY=c.y)};h.prototype.draw=function(){a.Graphic.prototype.draw.call(this,
this.color,this.color)};h.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.trace,this.trace)};h.prototype.drawAux=function(a,c){q=this.space;a.fillStyle=c.getColor();k=e(this.abs_coord?this.exprX:q.getAbsoluteX(this.exprX));l=e(this.abs_coord?this.exprY:q.getAbsoluteY(this.exprY));b=e(this.evaluator.eval(this.size));0<b&&(a.beginPath(),a.arc(k,l,b,0,g),a.fill());this.text.hasContent&&this.text.draw(a,c,k,l)};a.Point=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.round,e=2*Math.PI,f,q,p,c,k,l,b,h,d,v,r=function(b,d){d=a.Graphic.call(this,b,d)||this;d.width=d.width||b.evaluator.parser.parse("1");d.size=d.size||b.evaluator.parser.parse("2");d.text=new a.TextObject(d,d.text);return d};$jscomp.inherits(r,a.Graphic);r.prototype.update=function(){f=this.evaluator;p=f.eval(this.expresion);this.endPoints=[];for(var b=0,d=p.length;b<d;b++)this.endPoints[b]={x:p[b][0],y:p[b][1]};if(this.rotateExp)for(c=a.degToRad(f.eval(this.rotateExp)),
b=0,d=this.endPoints.length;b<d;b++)this.endPoints[b]=this.rotate(this.endPoints[b].x,this.endPoints[b].y,c)};r.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.color,this.color)};r.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.trace,this.trace)};r.prototype.drawAux=function(a,c,r){f=this.evaluator;q=this.space;a.lineWidth=Math.max(1E-6,g(f.eval(this.width)));k=f.eval(this.size);a.fillStyle=c.getColor();a.strokeStyle=r.getColor();a.lineCap="round";l=
0==a.lineWidth%2?0:.5;this.abs_coord?(b=g(this.endPoints[0].x),h=g(this.endPoints[0].y),d=g(this.endPoints[1].x),v=g(this.endPoints[1].y)):(b=g(q.getAbsoluteX(this.endPoints[0].x)),h=g(q.getAbsoluteY(this.endPoints[0].y)),d=g(q.getAbsoluteX(this.endPoints[1].x)),v=g(q.getAbsoluteY(this.endPoints[1].y)));a.beginPath();a.moveTo(b+l,h+l);a.lineTo(d+l,v+l);this.dashStyle();a.stroke();0<k&&(a.beginPath(),a.arc(b,h,k,0,e),a.arc(d,v,k,0,e),a.fill());a.setLineDash([]);this.text.hasContent&&this.text.draw(a,
r,parseInt((b+d)/2)-3,parseInt((h+v)/2)+3)};a.Segment=r;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.floor,e=Math.round,f,q,p,c,k,l,b,h,d,v,r,u,A,n=function(b,d){d=a.Graphic.call(this,b,d)||this;d.width=d.width||b.evaluator.parser.parse("5");d.size=d.size||b.evaluator.parser.parse("2");d.spear=d.spear||b.evaluator.parser.parse("8");d.arrow=d.arrow||new a.Color("ee0022");d.text=new a.TextObject(d,d.text);d.endPoints=[];d.vect=new a.Vector2D(0,0);return d};$jscomp.inherits(n,a.Graphic);n.prototype.update=function(){f=this.evaluator;q=f.eval(this.expresion);
for(var b=0,d=q.length;b<d;b++)this.endPoints[b]={x:q[b][0],y:q[b][1]};if(this.rotateExp)for(p=a.degToRad(f.eval(this.rotateExp)),b=0,d=this.endPoints.length;b<d;b++)this.endPoints[b]=this.rotate(this.endPoints[b].x,this.endPoints[b].y,p)};n.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.arrow,this.color)};n.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.arrow,this.trace)};n.prototype.drawAux=function(a,n,p){f=this.evaluator;c=this.space;k=Math.max(0,
f.eval(this.width));l=Math.ceil(k/2);b=c.scale;this.vect.x=this.endPoints[1].x-this.endPoints[0].x;this.vect.y=this.endPoints[1].y-this.endPoints[0].y;h=this.vect.vectorLength();this.angle=Math.atan2(this.vect.y,this.vect.x);a.fillStyle=n.getColor();a.strokeStyle=p.getColor();a.lineWidth=2;this.abs_coord?(d=e(this.endPoints[0].x),v=e(this.endPoints[0].y),r=e(this.endPoints[1].x),u=e(this.endPoints[1].y)):(d=e(c.getAbsoluteX(this.endPoints[0].x)),v=e(c.getAbsoluteY(this.endPoints[0].y)),r=e(c.getAbsoluteX(this.endPoints[1].x)),
u=e(c.getAbsoluteY(this.endPoints[1].y)));A=Math.max(0,f.eval(this.spear));a.save();a.translate(d,v);this.abs_coord?a.rotate(this.angle):(h*=b,a.rotate(-this.angle));a.beginPath();a.moveTo(-l,g(-l));a.lineTo(g(h-A-k),g(-l));a.lineTo(g(h-2*A),g(-A-l));a.lineTo(g(h),0);a.lineTo(g(h-2*A),g(A+l));a.lineTo(g(h-A-k),g(l));a.lineTo(-l,g(l));a.closePath();a.stroke();a.fill();a.restore();this.text.hasContent&&this.text.draw(a,p,parseInt((d+r)/2)-3,parseInt((v+u)/2)+3)};a.Arrow=n;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.round,e,f,q,p,c,k,l=function(b,c){c=a.Graphic.call(this,b,c)||this;c.width=c.width||b.evaluator.parser.parse("1");c.fill=c.fill||"";c.endPoints=[];return c};$jscomp.inherits(l,a.Graphic);l.prototype.update=function(){e=this.evaluator;q=e.eval(this.expresion);for(var b=0,c=q.length;b<c;b++)this.endPoints[b]={x:q[b][0],y:q[b][1]};if(this.rotateExp)for(p=a.degToRad(e.eval(this.rotateExp)),b=0,c=this.endPoints.length;b<c;b++)this.endPoints[b]=this.rotate(this.endPoints[b].x,
this.endPoints[b].y,p)};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,h,d){e=this.evaluator;f=this.space;a.lineWidth=Math.max(1E-6,g(e.eval(this.width)));a.strokeStyle=d.getColor();a.lineCap=a.lineJoin="round";c=g(this.abs_coord?this.endPoints[0].x:f.getAbsoluteX(this.endPoints[0].x));k=g(this.abs_coord?this.endPoints[0].y:f.getAbsoluteY(this.endPoints[0].y));
a.beginPath();a.moveTo(c+0,k+0);d=1;for(var b=this.endPoints.length;d<b;d++)c=g(this.abs_coord?this.endPoints[d].x:f.getAbsoluteX(this.endPoints[d].x)),k=g(this.abs_coord?this.endPoints[d].y:f.getAbsoluteY(this.endPoints[d].y)),a.lineTo(c+0,k+0);this.fill&&(a.fillStyle=h.getColor(),a.fill());this.dashStyle();a.stroke();a.setLineDash([])};a.Polygon=l;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.round,e=Math.min,f=Math.max,q=Math.abs,p,c,k,l,b,h,d,v,r,u,A=function(b,d){d=a.Graphic.call(this,b,d)||this;d.width=d.width||b.evaluator.parser.parse("1");d.fill=d.fill||"";d.border_radius=d.border_radius||b.evaluator.parser.parse("0");d.endPoints=[];return d};$jscomp.inherits(A,a.Graphic);A.prototype.update=function(){p=this.evaluator;l=p.eval(this.expresion);this.exprX=l[0][0];this.exprY=l[0][1];this.w=150;this.h=100;this.rotateExp&&(k=this.rotate(l[0][0],
l[0][1],a.degToRad(p.eval(this.rotateExp))),this.exprX=k.x,this.exprY=k.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=f(0,this.w);this.h=f(0,this.h)};A.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.fill,this.color)};A.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.fill,this.trace,"trace")};A.prototype.drawAux=function(a,m,l,k){p=this.evaluator;c=this.space;a.lineWidth=Math.max(1E-6,g(p.eval(this.width)));
a.strokeStyle=l.getColor();a.lineCap="round";a.lineJoin="miter";b=g(this.abs_coord?this.exprX:c.getAbsoluteX(this.exprX))+0;h=g(this.abs_coord?this.exprY:c.getAbsoluteY(this.exprY))+0;d=this.abs_coord?this.w:this.w*c.scale;v=this.abs_coord?this.h:-this.h*c.scale;r=e(f(0,p.eval(this.border_radius)),.5*q(d),.5*q(v));u=this.abs_coord?1:-1;a.beginPath();0!==r?(a.moveTo(b+r,h),a.lineTo(b+d-r,h),a.quadraticCurveTo(b+d,h,b+d,h+u*r),a.lineTo(b+d,h+v-u*r),a.quadraticCurveTo(b+d,h+v,b+d-r,h+v),a.lineTo(b+r,
h+v),a.quadraticCurveTo(b,h+v,b,h+v-u*r),a.lineTo(b,h+u*r),a.quadraticCurveTo(b,h,b+r,h),a.lineTo(b+r,h)):(a.moveTo(b,h),a.lineTo(b+d,h),a.lineTo(b+d,h+v),a.lineTo(b,h+v),a.lineTo(b,h));this.fill&&(a.fillStyle=m.getColor(),a.fill());this.dashStyle();a.stroke();a.setLineDash([])};a.Rectangle=A;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.round,e=Math.min,f=Math.max,q=Math.acos,p=Math.sqrt,c=Math.PI,k=c/2,l=2*c,b,h,d,v,r,u,A,n,m,w,x,y,z,G,J,E,F,D,B,L,I=function(b,d){d=a.Graphic.call(this,b,d)||this;d.width=d.width||b.evaluator.parser.parse("1");d.fill=d.fill||"";d.center=d.center||b.evaluator.parser.parse("(0,0)");d.radius=d.radius||b.evaluator.parser.parse("1");d.init=d.init||"0";d.end=d.end||"90";d.init.match(/^_\(/)&&(d.initFlag=!0,d.init=d.init.substring(1));d.end.match(/^_\(/)&&
(d.endFlag=!0,d.end=d.end.substring(1));d.initExpr=b.evaluator.parser.parse(d.init);d.endExpr=b.evaluator.parser.parse(d.end);d.text=new a.TextObject(d,d.text);return d};$jscomp.inherits(I,a.Graphic);I.prototype.update=function(){b=this.evaluator;h=b.eval(this.center);this.exprX=h[0][0];this.exprY=h[0][1];d=0;this.rotateExp&&(d=a.degToRad(b.eval(this.rotateExp)),v=Math.cos(d),r=Math.sin(d),u=this.exprX*v-this.exprY*r,A=this.exprX*r+this.exprY*v,this.exprX=u,this.exprY=A);var g=b.eval(this.initExpr),
B=b.eval(this.endExpr);/^(\(|\[)expr(\)|\])$/i.test(this.initExpr.type)&&/^(\(|\[)expr(\)|\])$/i.test(this.endExpr.type)?(n=g[0][0],m=g[0][1],w=B[0][0],x=B[0][1],this.vectors?this.abs_coord&&(m=-m,x=-x):(n-=this.exprX,m=-m+this.exprY,w-=this.exprX,x=-x+this.exprY,this.abs_coord||(m=-m,x=-x)),y=0==n?0>m?3*k:k:q(1*n/p(n*n+m*m)),z=0==w?0>x?3*k:k:q(1*w/p(w*w+x*x)),y+=d,z+=d,0<n&&0<m&&this.abs_coord&&(y=l-y),0<n&&0>m&&!this.abs_coord&&(y=l-y),0>n&&0>m&&!this.abs_coord&&(y=l-y),0>n&&0<m&&this.abs_coord&&
(y=l-y),0<w&&0<x&&this.abs_coord&&(z=l-z),0<w&&0>x&&!this.abs_coord&&(z=l-z),0>w&&0>x&&!this.abs_coord&&(z=l-z),0>w&&0<x&&this.abs_coord&&(z=l-z),this.initFlag?(G=y,y=z,z=G):(G=e(y,z),J=f(y,z),y=G,z=J,z-y>c&&this.abs_coord&&(y=J,z=G),z-y<=c&&!this.abs_coord&&(y=J,z=G)),this.iniAng=y,this.endAng=z,this.drawPoints=!0):(this.iniAng=a.degToRad(g)+d,this.endAng=a.degToRad(B)+d,this.drawAngle=!0)};I.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.fill,this.color)};I.prototype.drawTrace=
function(){a.Graphic.prototype.drawTrace.call(this,this.fill,this.trace)};I.prototype.drawAux=function(a,d,c){b=this.evaluator;E=this.space;B=Math.max(0,b.eval(this.radius));a.lineWidth=Math.max(1E-6,g(b.eval(this.width)));a.lineCap="round";a.strokeStyle=c.getColor();this.abs_coord?(F=g(this.exprX),D=g(this.exprY)):(F=g(E.getAbsoluteX(this.exprX)),D=g(E.getAbsoluteY(this.exprY)),B*=E.scale,this.iniAng=-this.iniAng,this.endAng=-this.endAng);this.drawAngle&&this.iniAng>this.endAng&&(L=this.iniAng,this.iniAng=
this.endAng,this.endAng=L);this.fill&&(a.fillStyle=d.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=I;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,e,f,q,p,c=function(c,f){f=a.Graphic.call(this,c,f)||this;f.width=f.width||c.evaluator.parser.parse("0");f.align||(f.align="left");f.anchor||(f.anchor="top_left");f.shadowColor=f.shadowColor?f.shadowColor.getColor():"transparent";f.text=new a.TextObject(f,f.text);return f};$jscomp.inherits(c,a.Graphic);c.prototype.update=function(){g=this.evaluator;e=g.eval(this.expresion);this.exprX=e[0][0];this.exprY=e[0][1];this.rotateExp&&(f=this.rotate(e[0][0],
e[0][1],a.degToRad(g.eval(this.rotateExp))),this.exprX=f.x,this.exprY=f.y)};c.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.color)};c.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.trace)};c.prototype.drawAux=function(a,c){this.abs_coord?(q=parseInt(this.exprX),p=parseInt(this.exprY)):(q=parseInt(this.space.getAbsoluteX(this.exprX)),p=parseInt(this.space.getAbsoluteY(this.exprY)));this.text.draw(a,c,q,p)};a.Text=c;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.round,e,f,q,p,c,k,l,b,h,d,v,r=function(b,d){d=a.Graphic.call(this,b,d)||this;d.file=d.file||"";d.inirot=d.inirot||b.evaluator.parser.parse("0");d.img=new Image;d.scaleX=d.scaleY=1;d.ratio=b.ratio;b=d.expresion.getChildren();d.x_e=b[0];d.y_e=b[1];2<b.length&&(d.centered=!0,d.s_x_e=b[2],d.s_y_e=3<b.length?b[3]:b[2]);d.evaluator.eval(d.clip)&&(d.clip=d.clip.getChildren());d.update();return d};$jscomp.inherits(r,a.Graphic);r.prototype.update=function(){e=
this.evaluator;var b=e.eval(this.x_e),d=e.eval(this.y_e);this.exprX=b;this.exprY=d;this.rotateExp&&(f=this.rotate(b,d,a.degToRad(e.eval(this.rotateExp))),this.exprX=f.x,this.exprY=f.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));var c=this;if((q=e.eval(this.file))||""==q)this.img=this.parent.getImage(q),this.img.addEventListener("load",function(a){c.space.update(!0)})};r.prototype.draw=function(){a.Graphic.prototype.draw.call(this)};
r.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this)};r.prototype.drawAux=function(f){e=this.evaluator;p=this.space;this.img&&this.img.ready&&this.img.complete&&(this.clip?(d=e.eval(this.clip[2]),v=e.eval(this.clip[3])):(d=this.img.width,v=this.img.height),this.img.canvas&&(d=g(d/this.ratio),v=g(v/this.ratio)),c=this.centered?0:g(d/2),k=this.centered?0:g(v/2),l=g(this.abs_coord?this.exprX:p.getAbsoluteX(this.exprX)),b=g(this.abs_coord?this.exprY:p.getAbsoluteY(this.exprY)),h=
a.degToRad(-e.eval(this.inirot)),f.save(),f.translate(l+c,b+k),f.rotate(h),this.opacity&&(f.globalAlpha=e.eval(this.opacity)),f.scale(this.scaleX,this.scaleY),this.clip?f.drawImage(this.img,e.eval(this.clip[0]),e.eval(this.clip[1]),d,v,-d/2,-v/2,d,v):f.drawImage(this.img,-d/2,-v/2,d,v),f.restore())};a.Image=r;return a}(descartesJS||{});
descartesJS=function(a){function g(a,b,c){l=4*(b+c*a.width);return{r:a.data[l],g:a.data[l+1],b:a.data[l+2],a:a.data[l+3]}}if(a.loadLib)return a;var e,f,q,p,c,k,l,b,h=function(b,c){return a.Graphic.call(this,b,c)||this};$jscomp.inherits(h,a.Graphic);h.prototype.update=function(){e=this.evaluator.eval(this.expresion);this.exprX=e[0][0];this.exprY=e[0][1]};h.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.color,this.color)};h.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,
this.trace,this.trace)};h.prototype.drawAux=function(a,h){h.getColor();imageData=a.getImageData(0,0,this.space.w,this.space.h);this.abs_coord?(f=parseInt(this.exprX),q=parseInt(this.exprY)):(f=parseInt(this.space.getAbsoluteX(this.exprX)),q=parseInt(this.space.getAbsoluteY(this.exprY)));if(!(0>f||0>q||f>=this.space.w||q>=this.space.h)){p=[[f,q]];k=g(imageData,f,q);for(b=0;0<p.length;){b++;c=p.pop();f=c[0];q=c[1];var d=g(imageData,f,q);if(k.r===d.r&&k.g===d.g&&k.b===d.b&&k.a===d.a){d=imageData;var e=
h;l=4*(f+q*d.width);d.data[l+0]=e.r;d.data[l+1]=e.g;d.data[l+2]=e.b;d.data[l+3]=255*e.a;0<f&&p.push([f-1,q]);f<imageData.width-1&&p.push([f+1,q]);p.push([f,q-1]);p.push([f,q+1])}if(b>=this.space.w*this.space.h*3)break}a.putImageData(imageData,0,0)}};a.Fill=h;return a}(descartesJS||{});
descartesJS=function(a,g){if(a.loadLib)return a;var e=new String("-text-image-point-polygon-arc-segment-arrow-macro-curve-equation-sequence-rectangle-fill-"),f=/[\w\.\-//]*(\.png|\.jpg|\.gif|\.svg|\.webp)/gi,q,p=function(c,k){var l=a.Graphic.call(this,c,k)||this;l.hasExpresion=l.hasExpresion||!1;l.inirot=l.inirot||c.evaluator.parser.parse("0");l.inipos=l.inipos||c.evaluator.parser.parse("(0,0)");Object.assign(l,k);l.hasExpresion=void 0!==l.expresion;l.graphics=[];c=c.lessonParser;var b=new a.Tokenizer;
if(!l.hasExpresion)return l;"'"!==l.expresion.charAt(0)&&(l.expresion="'"+l.expresion+"'");l.expresion=l.evaluator.parser.parse(l.expresion);k=l.evaluator.eval(l.expresion);if(k)var h=(h=document.getElementById(k))&&"descartes/macro"==h.type?h.text:a.openExternalFile(k);if(h){var d=a.convertHTMLEntities(h).replace(/\r/g,"").split("\n");h=[];k=0;for(var p=d.length;k<p;k++)if(d[k].trim()){var r=d[k].indexOf("=");if(-1!==r){r=c.split(d[k]);for(var u=0,q=r.length;u<q;u++)if(r[u]&&1<r.length&&("id"===
g[r[u][0]]||"type"===g[r[u][0]])){h.push(r);break}}}u=function(d,c){c=b.tokenize(c.replace(/&squot;/g,"'"));for(var h=0,f=c.length;h<f;h++)if("identifier"==c[h].type&&!a.reservedIds.match("-"+c[h].value+"-")||"R"===c[h].value||"G"===c[h].value||"B"===c[h].value)c[h].value=l.name+"."+c[h].value;return(d.match(/^\\expr/)?"\\expr ":"\\decimals ")+b.flatTokens(c)};k=0;for(p=h.length;k<p;k++){var n=(q=h[k]||[],q[0])&&"id"===q[0][0];d=0;for(r=q.length;d<r;d++){var m=q[d][0].indexOf(".");-1===m||n?m=g[q[d][0]]:
(m=g[q[d][0].substring(m+1)],q[d][0]=l.name+"."+q[d][0]);if(!("font"===m||"font_family"===m||("fill"===m||"color"===m||"border"===m||"arrow"===m)&&"("!==q[d][1].charAt(0)||"file"===m&&q[d][1].match(f)||"id"!==m&&void 0!==g[q[d][1]])||"radius"===m)if("text"==m)if(q[d][1].match(/\{\\rtf1/))m=q[d][1],m=m.replace(/\\expr ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,u),m=m.replace(/\\decimals ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,u),q[d][1]=m;else{var w=c.parseText(q[d][1]).textElementsMacros;
for(var x=0,y=w.length;x<y;x++){m=b.tokenize(w[x].replace(/&squot;/g,"'"));for(var z=0,G=m.length;z<G;z++)if("identifier"===m[z].type&&!a.reservedIds.match("-"+m[z].value+"-")||"R"===m[z].value||"G"===m[z].value||"B"===m[z].value)m[z].value=l.name+"."+m[z].value;m=b.flatTokens(m).replace(/&squot;/g,"'").replace(/'\+\(/g,"[").replace(/\)\+'/g,"]");w[x]=m.substring(1,m.length-1)}q[d][1]=w.join("")}else{w=q[d][1].replace(/&squot;/g,"'").split(";");x=0;for(y=w.length;x<y;x++){m=b.tokenize(w[x].replace(/\\n/g,
";"));z=0;for(G=m.length;z<G;z++)if("identifier"===m[z].type&&!a.reservedIds.match("-"+m[z].value+"-")||"R"===m[z].value||"G"===m[z].value||"B"===m[z].value)m[z].value=l.name+"."+m[z].value;w[x]=b.flatTokens(m)}q[d][1]=w.join(";")}}}k=0;for(p=h.length;k<p;k++)if(h[k][0]){u="";q=!1;d=0;for(r=h[k].length;d<r;d++)"type"===g[h[k][d][0]]&&e.match("-"+g[h[k][d][1]]+"-")&&(q=!0),u=u+h[k][d][0]+"='"+h[k][d][1]+"' ";h[k]=u+(q?" space='"+l.spaceID+"'":"");q?l.graphics.push(c.parseGraphic(h[k],l.abs_coord,l.background,
l.inirot)):c.parseAuxiliar(h[k])}}return l};$jscomp.inherits(p,a.Graphic);p.prototype.update=function(){q=this.evaluator.eval(this.inipos);this.iniPosX=q[0][0];this.iniPosY=q[0][1]};p.prototype.drawAux=function(a){for(var c=0,f=this.graphics.length;c<f;c++)this.graphics[c]&&(a.save(),this.graphics[c].abs_coord?a.translate(this.iniPosX,this.iniPosY):a.translate(this.iniPosX*this.space.scale,-this.iniPosY*this.space.scale),this.graphics[c].draw(),a.restore())};a.Macro=p;return a}(descartesJS||{},babel);
descartesJS=function(a){if(a.loadLib)return a;var g=Math.sqrt,e=Math.sin,f=Math.cos,q=Math.abs,p,c,k,l,b,h,d,v,r,u,A,n,m,w,x,y=function(a,b,d,c){this.x=a||0;this.y=b||0;this.z=d||0;this.w=c||0;this.adjustDec()};y.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 z=function(a,b,d,c,h,f,m,e,g,l,r,k,n,p,u,v){this.a00=a||0;this.a01=b||0;this.a02=d||0;this.a03=c||0;this.a10=h||0;this.a11=f||0;this.a12=m||0;this.a13=e||0;
this.a20=g||0;this.a21=l||0;this.a22=r||0;this.a23=k||0;this.a30=n||0;this.a31=p||0;this.a32=u||0;this.a33=v||0};z.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};z.prototype.multiplyVector4=function(a){return new y(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)};z.prototype.translate=function(a){return new z(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)};z.prototype.rotateX=function(a){c=e(a);k=f(a);v=this.a10;r=this.a11;u=this.a12;
A=this.a13;n=this.a20;m=this.a21;w=this.a22;x=this.a23;return new z(this.a00,this.a01,this.a02,this.a03,v*k+n*c,r*k+m*c,u*k+w*c,A*k+x*c,v*-c+n*k,r*-c+m*k,u*-c+w*k,A*-c+x*k,this.a30,this.a31,this.a32,this.a33)};z.prototype.rotateY=function(a){c=e(a);k=f(a);l=this.a00;b=this.a01;h=this.a02;d=this.a03;n=this.a20;m=this.a21;w=this.a22;x=this.a23;return new z(l*k+n*-c,b*k+m*-c,h*k+w*-c,d*k+x*-c,this.a10,this.a11,this.a12,this.a13,l*c+n*k,b*c+m*k,h*c+w*k,d*c+x*k,this.a30,this.a31,this.a32,this.a33)};z.prototype.rotateZ=
function(a){c=e(a);k=f(a);l=this.a00;b=this.a01;h=this.a02;d=this.a03;v=this.a10;r=this.a11;u=this.a12;A=this.a13;return new z(l*k+v*c,b*k+r*c,h*k+u*c,d*k+A*c,l*-c+v*k,b*-c+r*k,h*-c+u*k,d*-c+A*k,this.a20,this.a21,this.a22,this.a23,this.a30,this.a31,this.a32,this.a33)};a.norm3D=function(a){return g(a.x*a.x+a.y*a.y+a.z*a.z)};a.normalize3D=function(b){p=a.norm3D(b);if(0===p)return{x:0,y:0,z:0};if(1===p)return{x:b.x,y:b.y,z:b.z};p=1/p;return{x:b.x*p,y:b.y*p,z:b.z*p}};a.dotProduct3D=function(a,b){return a.x*
b.x+a.y*b.y+a.z*b.z};a.crossProduct3D=function(a,b){return{x:a.y*b.z-a.z*b.y,y:a.z*b.x-a.x*b.z,z:a.x*b.y-a.y*b.x}};a.scalarProduct3D=function(a,b){return{x:a.x*b,y:a.y*b,z:a.z*b}};a.subtract3D=function(a,b){return{x:a.x-b.x,y:a.y-b.y,z:a.z-b.z}};a.add3D=function(a,b){return{x:a.x+b.x,y:a.y+b.y,z:a.z+b.z}};a.equals3DEpsilon=function(a,b,d){return q(a.x-b.x)<=d&&q(a.y-b.y)<=d&&q(a.z-b.z)<=d};a.Vector4D=y;a.Matrix4x4=z;return a}(descartesJS||{});
descartesJS=function(a){function g(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,c),a.fill(),a.stroke())}function e(a,b){a.textNode=null;a.lineCap=k;a.lineJoin=lineJoin;a.lineWidth=.4;a.beginPath();a.moveTo(this.projVert[0].x,this.projVert[0].y);r=1;for(u=this.projVert.length;r<u;r++)a.lineTo(this.projVert[r].x,this.projVert[r].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=b.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 f(a){a.textNode=null;a.oldTextNode=
"_a1b2c3_";d=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,d)}function q(a){a.textNode=null;a.lineCap=k;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 p(b,d,c){return a.normalize3D(a.crossProduct3D(a.subtract3D(b,
d),a.subtract3D(b,c)))}if(a.loadLib)return a;var c=2*Math.PI,k=lineJoin="round",l,b,h,d,v,r,u,A,n,m,w,x,y,z=function(a,b){Object.assign(this,a);this.space=b;this.projVert=[];this.spaceVertices=[];this.newProjVert=[];this.newSpaceVert=[];"vertex"===this.type?this.draw=g:"face"===this.type?(this.normal=p(this.vertices[0],this.vertices[1],this.vertices[2]),this.draw=e):"text"===this.type?this.draw=f:"edge"===this.type&&(this.draw=q);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]})};z.prototype.computeDepth=function(b){this.space=b;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};r=0;for(u=this.vertices.length;r<u;r++)this.spaceVertices[r]=b.rotateVertex(this.vertices[r]),this.average.x+=this.spaceVertices[r].x,this.average.y+=this.spaceVertices[r].y,this.average.z+=this.spaceVertices[r].z;this.average=a.scalarProduct3D(this.average,
1/u);this.average_proy=b.project(this.average);this.depth=a.norm3D(a.subtract3D(b.eye,this.average));2<this.vertices.length&&(this.normal=p(this.spaceVertices[0],this.spaceVertices[1],this.spaceVertices[2]));r=0;for(u=this.vertices.length;r<u;r++)this.newSpaceVert[r]=this.spaceVertices[r],this.projVert[r]=this.newProjVert[r]=b.project(this.spaceVertices[r]);2<this.vertices.length&&(this.direction=p(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;r=0;for(u=this.vertices.length;r<u;r++)A=a.norm3D(a.subtract3D(this.spaceVertices[r],b.eye)),this.minDistanceToEye=Math.min(this.minDistanceToEye,A),this.maxDistanceToEye=Math.max(this.maxDistanceToEye,A);r=0;for(u=this.vertices.length;r<u;r++)this.minx>this.projVert[r].x&&(this.minx=this.projVert[r].x),this.maxx<this.projVert[r].x&&(this.maxx=this.projVert[r].x),this.miny>this.projVert[r].y&&(this.miny=this.projVert[r].y),
this.maxy<this.projVert[r].y&&(this.maxy=this.projVert[r].y)};z.prototype.removeDoubles=function(){if("edge"!==this.type){v=[];r=0;for(u=this.vertices.length;r<u;r++)(1E-8<Math.abs(this.vertices[r].x-this.vertices[(r+1)%u].x)||1E-8<Math.abs(this.vertices[r].y-this.vertices[(r+1)%u].y)||1E-8<Math.abs(this.vertices[r].z-this.vertices[(r+1)%u].z)||1E-8<Math.abs(this.vertices[r].w-this.vertices[(r+1)%u].w))&&v.push(this.vertices[r]);0===v.length&&v.push(this.vertices[0]);this.vertices=v}};z.prototype.drawText=
function(d,c,f,m,e,g,r,k,n,p,u){l=this.evaluator;d.textNode=c;g=l.eval(this.offset_dist);r=-a.degToRad(l.eval(this.offset_angle));f+=g*Math.cos(r);m+=g*Math.sin(r);d.textNode.pos={x:f,y:m};c.hasContent&&(c.draw(d,e,f,m,!0),h=this.fromPoint?c.textNodes.metrics.w/2:0,b=this.fromPoint?c.textNodes.metrics.h/2:0,c.draw(d,e,f-h,m-b))};z.prototype.splitFace=function(b){if(this.intersects(b)){var d=i2=null,c=ix2=0,h,f;var m=this.vertices;var e=b.vertices;var g=0;for(f=e.length;g<f;g++){var r=this.intersection(e[g],
e[(g+1)%f]);if(null!==r)if(null===d){if(d=r,c=g,2===e.length){i2=d;break}}else if(!a.equals3DEpsilon(r,d,1E-8)){i2=r;ix2=g;break}}if(null!==d&&null!==i2){g=this.isInterior(d)||this.isInterior(i2);var l=h=null;if(!g&&3<=e.length)for(f=0,m=m.length;f<m;f++)if(r=b.intersection(this.vertices[f],this.vertices[(f+1)%m]),null!==r)if(null===h)h=r;else if(!a.equals3DEpsilon(r,h,1E-8)){l=r;break}if(g||null!==h&&null!==l&&b.isInterior(h)&&b.isInterior(l)){l=!0;m=r=null;if(2===e.length)a.equals3DEpsilon(d,e[0],
1E-8)||a.equals3DEpsilon(d,e[1],1E-8)?l=!1:(r=[],r[0]=e[0],r[1]=d,m=[],m[0]=d,m[1]=e[1]);else for(r=[],m=[],g=f=h=0;g<e.length;g++)g<c?r[h++]=e[g]:g==c?(r[h++]=e[g],r[h++]=d,m[f++]=d):g<ix2?m[f++]=e[g]:g==ix2?(m[f++]=e[g],m[f++]=i2,r[h++]=i2):r[h++]=e[g];if(l){d=[];d[0]=new z({vertices:r,type:"face",frontColor:b.frontColor,backColor:b.backColor,edges:b.edges,model:b.model},this.space);d[0].removeDoubles();d[0].normal=b.normal;d[1]=new z({vertices:m,type:"face",frontColor:b.frontColor,backColor:b.backColor,
edges:b.edges,model:b.model},this.space);d[1].removeDoubles();d[1].normal=b.normal;if(2<d[0].vertices.length)return 2<d[1].vertices.length?d:[d[0]];if(2<d[1].vertices.length)return[d[1]]}}}}return[b]};z.prototype.intersects=function(a){return this.intersectsPlane(a)&&a.intersectsPlane(this)};z.prototype.intersectsPlane=function(b){var d=this.vertices;var c=b.vertices;if(0<d.length){var h=a.dotProduct3D(c[0],b.normal);var f=a.dotProduct3D(d[0],b.normal);if(1E-8>Math.abs(h-f))return!0;for(var m=1,e=
d.length;m<e;m++)if(c=a.dotProduct3D(d[m],b.normal),1E-8>Math.abs(h-c)||c>h&&f<h||c<h&&f>h)return!0}return!1};z.prototype.intersection=function(b,d){var c=this.vertices;if(0<c.length){d=a.subtract3D(d,b);var h=a.dotProduct3D(d,this.normal);if(0!==h&&(c=a.dotProduct3D(a.subtract3D(c[0],b),this.normal)/h,-1E-8<c&&1.00000001>c))return a.add3D(b,a.scalarProduct3D(d,c))}return null};z.prototype.isInterior=function(b){var d=this.vertices;if(0<d.length)for(var c=0,h=a.subtract3D(d[0],b),f=0,m=d.length;f<
m;f++){var e=a.subtract3D(d[(f+1)%m],b),g=a.dotProduct3D(a.crossProduct3D(h,e),this.normal);if(1E-8>Math.abs(g)){if(0>a.dotProduct3D(h,e))break}else{if(0>c&&0<g||0<c&&0>g)return!1;h=e;c=g}}return!0};z.prototype.inFrontOf=function(a,b,d){if(this.minDistanceToEye>=b.maxDistanceToEye||this.maxx<=b.minx||this.minx>=b.maxx||this.maxy<=b.miny||this.miny>=b.maxy)return!1;for(x=0;3>x;x++)if(n=null,n=0===x?this.intersections(b):1===x?b.verticesContainedIn(this):this.verticesContainedIn(b),null!=n&&0<n.length){for(y=
0;y<n.length;y++)a.push(n[y]);r=0;for(u=n.length;r<u;r++){m=n[r];w=this.space.rayFromEye(m.x,m.y);try{t=this.distanceToEyeAlong(w)-b.distanceToEyeAlong(w);if(t<=-d)return!0;if(t>=d)return!1}catch(F){}}}return!1};z.prototype.intersections=function(b){for(var d=[],c,h,f,m=new a.R2,e=this.newSpaceVert,g=b.newSpaceVert,r=this.newProjVert,l=b.newProjVert,k=0,n=e.length;k<n;k++){b=e[k];c=e[(k+1)%n];for(var p=0,u=g.length;p<u;p++)h=g[p],f=g[(p+1)%u],b!=h&&b!=f&&c!=h&&c!=f&&(h=m.intersection(r[k],r[(k+1)%
n],l[p],l[(p+1)%u]),null!=h&&d.push(h))}return d};z.prototype.distanceToEyeAlong=function(b){b=a.dotProduct3D(this.normal,b);if(1E-6<Math.abs(b))return a.dotProduct3D(a.subtract3D(this.average,this.space.eye),this.normal)/b;throw new Exception("Face is invisible");};z.prototype.verticesContainedIn=function(a){for(var b=[],d=this.newSpaceVert,c=this.newProjVert,h=0,f=d.length;h<f;h++)!a.isVertex(d[h])&&a.appearsToContain(c[h])&&b.push(c[h]);return b};z.prototype.appearsToContain=function(a){for(var b=
0,d,c=this.newProjVert,h=0,f=this.newSpaceVert.length;h<f;h++){d=(c[h].x-a.x)*(c[(h+1)%f].y-a.y)-(c[(h+1)%f].x-a.x)*(c[h].y-a.y);if(0!=b)if(1E-8>Math.abs(d)){if(1E-8<Math.abs(c[h].x-c[(h+1)%f].x))return Math.min(c[h].x,c[(h+1)%f].x)<=a.x+1E-8&&a.x<=Math.max(c[h].x,c[(h+1)%f].x)+1E-8;if(1E-8<Math.abs(c[h].y-c[(h+1)%f].y))return Math.min(c[h].y,c[(h+1)%f].y)<=a.y+1E-8&&a.y<=Math.max(c[h].y,c[(h+1)%f].y)+1E-8}else if(0<b&&0>d||0>b&&0<d)return!1;b=d}return!0};z.prototype.isVertex=function(b){for(var d=
this.newSpaceVert,c=0,h=d.length;c<h;c++)if(a.equals3DEpsilon(b,d[c],1E-8))return!0;return!1};a.Primitive3D=z;return a}(descartesJS||{});
descartesJS=function(a){function g(a){for(var b=[],d=0,c,h=a.length,f=a.length-1;-1<f;f--)c=a.charAt(f),0==d?"="==c&&(d=1):1==d?" "!=c&&(d="<"===c||">"===c?0:2):2==d&&" "==c&&(b.unshift(a.substring(f+1,h)),h=f,d=0);b.unshift(a.substring(0,h));return b}if(a.loadLib)return a;var e={x:0,y:0,z:0},f,q,p,c,k,l=a.degToRad,b,h=function(b,c){this.parent=b;this.evaluator=b.evaluator;var d=b.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=d.parse("1");this.abs_coord=!1;this.family="";this.family_interval=d.parse("[0,1]");this.family_steps=d.parse("8");this.font="SansSerif,PLAIN,18";this.fixed=!0;this.text="";this.decimals=d.parse("2");this.inirot="(0,0,0)";this.inirotEuler=!1;this.inipos=d.parse("(0,0,0)");this.endrot="(0,0,0)";this.endrotEuler=!1;this.endpos=d.parse("(0,0,0)");this.model="color";Object.assign(this,c);void 0==this.expresion&&
"macro"!=this.type&&(this.expresion=d.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=b.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=d.parse(this.inirot);this.endrot=d.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};h.prototype.getSpace=function(){for(var a=this.parent.spaces,b,c=0,
h=a.length;c<h;c++)if(b=a[c],b.id==this.spaceID)return b;return a[0]};h.prototype.getFamilyValues=function(){f=this.evaluator;q=f.eval(this.family_interval);this.familyInf=q[0][0];this.familySup=q[0][1];this.fSteps=Math.round(f.eval(this.family_steps));this.family_sep=0<this.fSteps?(this.familySup-this.familyInf)/this.fSteps:0};h.prototype.buildFamilyPrimitives=function(){f=this.evaluator;this.getFamilyValues();p=f.getVariable(this.family);if(0<=this.fSteps)for(var a=0,b=this.fSteps;a<=b;a++)f.setVariable(this.family,
this.familyInf+a*this.family_sep),this.familyValue=this.familyInf+a*this.family_sep,f.eval(this.drawif)&&this.buildPrimitives();f.setVariable(this.family,p)};h.prototype.update=function(){this.primitives=[];this.evaluator.eval(this.drawif)&&(this.family||this.buildPrimitives());this.family&&this.buildFamilyPrimitives()};h.prototype.updateMVMatrix=function(){c=this.evaluator.eval(this.inirot);this.inirotEuler?(this.inirotM=this.inirotM.setIdentity(),this.inirotM=this.inirotM.rotateZ(l(c[0][0])),this.inirotM=
this.inirotM.rotateX(l(c[0][1])),this.inirotM=this.inirotM.rotateZ(l(c[0][2]))):(this.inirotM_X=this.inirotM_X.setIdentity().rotateX(l(c[0][0])),this.inirotM_Y=this.inirotM_Y.setIdentity().rotateY(l(c[0][1])),this.inirotM_Z=this.inirotM_Z.setIdentity().rotateZ(l(c[0][2])));c=this.evaluator.eval(this.inipos);e={x:c[0][0],y:c[0][1],z:c[0][2]};this.iniposM=this.iniposM.setIdentity().translate(e);c=this.evaluator.eval(this.endrot);this.endrotEuler?(this.endrotM=this.endrotM.setIdentity(),this.endrotM=
this.endrotM.rotateZ(l(c[0][0])),this.endrotM=this.endrotM.rotateX(l(c[0][1])),this.endrotM=this.endrotM.rotateZ(l(c[0][2]))):(this.endrotM_X=this.endrotM_X.setIdentity().rotateX(l(c[0][0])),this.endrotM_Y=this.endrotM_Y.setIdentity().rotateY(l(c[0][1])),this.endrotM_Z=this.endrotM_Z.setIdentity().rotateZ(l(c[0][2])));c=this.evaluator.eval(this.endpos);e={x:c[0][0],y:c[0][1],z:c[0][2]};this.endposM=this.endposM.setIdentity().translate(e)};h.prototype.transformVertex=function(a){this.inirotEuler?k=
this.inirotM.multiplyVector4(a):(k=this.inirotM_X.multiplyVector4(a),k=this.inirotM_Y.multiplyVector4(k),k=this.inirotM_Z.multiplyVector4(k));k=this.iniposM.multiplyVector4(k);this.endrotEuler?k=this.endrotM.multiplyVector4(k):(k=this.endrotM_X.multiplyVector4(k),k=this.endrotM_Y.multiplyVector4(k),k=this.endrotM_Z.multiplyVector4(k));k=this.endposM.multiplyVector4(k);this.macroChildren&&(k=this.applyMacroTransform(k));k.adjustDec();return k};h.prototype.applyMacroTransform=function(a){this.macro_inirotEuler?
k=this.macro_inirotM.multiplyVector4(a):(k=this.macro_inirotM_X.multiplyVector4(a),k=this.macro_inirotM_Y.multiplyVector4(k),k=this.macro_inirotM_Z.multiplyVector4(k));k=this.macro_iniposM.multiplyVector4(k);this.macro_endrotEuler?k=this.macro_endrotM.multiplyVector4(k):(k=this.macro_endrotM_X.multiplyVector4(k),k=this.macro_endrotM_Y.multiplyVector4(k),k=this.macro_endrotM_Z.multiplyVector4(k));return k=this.macro_endposM.multiplyVector4(k)};h.prototype.parseExpression=function(){for(var a=this.expresion.split(";"),
b=[],c=0,h=a.length;c<h;c++)""!==a[c].trim()&&(b=b.concat(g(a[c])));c=0;for(h=b.length;c<h;c++)b[c]=this.evaluator.parser.parse(b[c],!0);return b};h.prototype.splitFace=function(a){for(var d=0,c=this.primitives.length;d<c;d++)if(b=[],"face"===this.primitives[d].type){for(var h=0,f=a.primitives.length;h<f;h++)"face"===a.primitives[h].type?b=b.concat(this.primitives[d].splitFace(a.primitives[h])):b.push(a.primitives[h]);a.primitives=b}};a.Graphic3D=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,e,f,q,p,c=function(c,f){return a.Graphic3D.call(this,c,f)||this};$jscomp.inherits(c,a.Graphic3D);c.prototype.buildPrimitives=function(){g=this.evaluator;this.updateMVMatrix();e=g.eval(this.expresion);f=e[0][0];q=e[0][1];p=e[0][2];this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(f,q,p,1))],type:"vertex",backColor:this.backcolor.getColor(),frontColor:this.color.getColor(),size:g.eval(this.width)}));""!==this.text&&
(this.offset_dist=this.offset_dist||g.parser.parse("10"),this.offset_angle=this.offset_angle||g.parser.parse("270"),this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(f,q,p,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:g.eval(this.decimals),fixed:this.fixed,evaluator:g,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=c;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,e,f,q,p,c,k,l,b,h=function(b,c){c=a.Graphic3D.call(this,b,c)||this;c.width=c.width||b.evaluator.parser.parse("1");return c};$jscomp.inherits(h,a.Graphic3D);h.prototype.buildPrimitives=function(){l=this.evaluator;this.updateMVMatrix();k=l.getVariable("u");l.setVariable("u",this.Nu);b=l.eval(this.expresion);g=b[0][0];e=b[0][1];f=b[0][2];q=b[1][0];p=b[1][1];c=b[1][2];this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(g,
e,f,1)),this.transformVertex(new a.Vector4D(q,p,c,1))],type:"edge",lineDash:this.lineDash,frontColor:this.color.getColor(),lineWidth:l.eval(this.width)},this.space));l.setVariable("u",k)};a.Segment3D=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,e,f,q,p,c,k,l,b,h,d,v,r,u,A=function(b,d){d=a.Graphic3D.call(this,b,d)||this;d.parameter=d.parameter||"t";d.parameter_interval=d.parameter_interval||b.evaluator.parser.parse("[0,1]");d.parameter_steps=d.parameter_steps||b.evaluator.parser.parse("8");d.expresion=d.parseExpression();return d};$jscomp.inherits(A,a.Graphic3D);A.prototype.buildPrimitives=function(){g=this.evaluator;this.updateMVMatrix();q=g.getVariable("x");p=g.getVariable("y");c=g.getVariable("z");
e=g.getVariable("u");f=g.getVariable("v");g.setVariable("u",0);g.setVariable("v",0);k=parseInt(g.eval(this.Nu));l=parseInt(g.eval(this.Nv));b=[];for(d=0;d<=k;d++)for(g.setVariable("u",d/k),v=0;v<=l;v++){g.setVariable("v",v/l);r=0;for(u=this.expresion.length;r<u;r++)g.eval(this.expresion[r]);b.push(this.transformVertex(new a.Vector4D(g.getVariable("x"),g.getVariable("y"),g.getVariable("z"),1)))}var n=this.color.getColor(),m=this.backcolor.getColor(),w=this.edges?this.edges.getColor():"";for(d=0;d<
k;d++)for(v=0;v<l;v++)h=[],h.push(b[v+d*l+d]),h.push(b[v+1+d*l+d]),h.push(b[v+2+(d+1)*l+d]),h.push(b[v+1+(d+1)*l+d]),this.primitives.push(new a.Primitive3D({vertices:h,type:"face",frontColor:n,backColor:m,edges:w,model:this.model},this.space));g.setVariable("x",q);g.setVariable("y",p);g.setVariable("z",c);g.setVariable("u",e);g.setVariable("v",f)};a.Surface3D=A;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,e,f,q,p,c,k,l,b=function(b,d){d=a.Graphic3D.call(this,b,d)||this;d.width=d.width||b.evaluator.parser.parse("1");return d};$jscomp.inherits(b,a.Graphic3D);b.prototype.buildPrimitives=function(){k=this.evaluator;this.updateMVMatrix();l=k.eval(this.expresion);for(var b=this.color.getColor(),d=0,v=l.length-1;d<v;d++)g=l[d][0],e=l[d][1],f=l[d][2],q=l[d+1][0],p=l[d+1][1],c=l[d+1][2],this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(g,
e,f,1)),this.transformVertex(new a.Vector4D(q,p,c,1))],type:"edge",frontColor:b,lineWidth:k.eval(this.width)},this.space))};a.Polygon3D=b;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,e,f,q,p,c,k,l=function(b,c){c=a.Graphic3D.call(this,b,c)||this;c.width=c.width||b.evaluator.parser.parse("1");c.expresion=c.parseExpression();return c};$jscomp.inherits(l,a.Graphic3D);l.prototype.buildPrimitives=function(){k=this.evaluator;this.updateMVMatrix();q=k.getVariable("x");p=k.getVariable("y");c=k.getVariable("z");f=k.getVariable("u");k.setVariable("u",0);e=k.eval(this.Nu);g=[];for(var b=0;b<=e;b++){k.setVariable("u",b/e);for(var h=0,d=
this.expresion.length;h<d;h++)k.eval(this.expresion[h]);g.push(this.transformVertex(new a.Vector4D(k.getVariable("x"),k.getVariable("y"),k.getVariable("z"),1)))}b=0;for(h=g.length-1;b<h;b++)this.primitives.push(new a.Primitive3D({vertices:[g[b],g[b+1]],type:"edge",frontColor:this.color.getColor(),lineWidth:k.eval(this.width)},this.space));this.fill&&2<g.length&&this.primitives.push(new a.Primitive3D({vertices:g,type:"face",frontColor:this.fill.getColor(),backColor:this.fill.getColor(),edges:"",model:this.model},
this.space));k.setVariable("x",q);k.setVariable("y",c);k.setVariable("z",p);k.setVariable("u",f)};a.Curve3D=l;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,e,f,q,p,c,k,l,b,h,d,v=function(b,d){return a.Graphic3D.call(this,b,d)||this};$jscomp.inherits(v,a.Graphic3D);v.prototype.buildPrimitives=function(){h=this.evaluator;this.updateMVMatrix();d=h.eval(this.expresion);g=d[0][0];e=d[0][1];f=d[0][2];q=d[1][0];p=d[1][1];c=d[1][2];k=d[2][0];l=d[2][1];b=d[2][2];var r=this.edges?this.edges.getColor():"";this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(g,e,f,1)),this.transformVertex(new a.Vector4D(k,
l,b,1)),this.transformVertex(new a.Vector4D(q,p,c,1))],type:"face",frontColor:this.color.getColor(),backColor:this.backcolor.getColor(),edges:r,model:this.model},this.space))};a.Triangle3D=v;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,e,f,q=function(f,c){return a.Graphic3D.call(this,f,c)||this};$jscomp.inherits(q,a.Graphic3D);q.prototype.buildPrimitives=function(){e=this.evaluator;this.updateMVMatrix();f=e.eval(this.expresion);g=[];for(var p=f.length-1;0<=p;p--)g.push(this.transformVertex(new a.Vector4D(f[p][0],f[p][1],f[p][2],1)));p=this.edges?this.edges.getColor():"";this.primitives.push(new a.Primitive3D({vertices:g,type:"face",frontColor:this.color.getColor(),backColor:this.backcolor.getColor(),
edges:p,model:this.model},this.space))};a.Face3D=q;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,e,f,q,p,c,k=function(c,b){b=a.Graphic3D.call(this,c,b)||this;b.width=b.width||c.evaluator.parser.parse("2");b.length=b.length||c.evaluator.parser.parse("2");return b};$jscomp.inherits(k,a.Graphic3D);k.prototype.buildPrimitives=function(){c=this.evaluator;this.updateMVMatrix();g=c.eval(this.Nu);e=[this.transformVertex(new a.Vector4D(0,0,0,1))];f=c.eval(this.width)/2;q=c.eval(this.length)/2;p=2*Math.PI/g;for(var l=0;l<g;l++)e.push(this.transformVertex(new a.Vector4D(f*
Math.cos(p*l),q*Math.sin(p*l),0,1)));var b=this.color.getColor(),h=this.backcolor.getColor(),d=this.edges?this.edges.getColor():"";for(l=0;l<g;l++)this.primitives.push(new a.Primitive3D({vertices:[e[0],l+2<=g?e[l+2]:e[1],e[l+1]],type:"face",frontColor:b,backColor:h,edges:d,model:this.model},this.space))};a.Polireg3D=k;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,e,f,q,p=function(c,f){c=a.Graphic3D.call(this,c,f)||this;c.shadowColor=c.shadowColor?c.shadowColor.getColor():"transparent";return c};$jscomp.inherits(p,a.Graphic3D);p.prototype.buildPrimitives=function(){g=this.evaluator;e=g.eval(this.expresion);f=e[0][0];q=e[0][1];this.primitives.push(new a.Primitive3D({vertices:[new a.Vector4D(f,q,0,1)],type:"text",frontColor:this.color.getColor(),font_size:this.font_size,font_style:this.font_style,font_family:this.font_family,
decimals:g.eval(this.decimals),fixed:this.fixed,displace:0,isText:!0,evaluator:g,text:new a.TextObject(this,this.text),family:this.family,familyValue:this.familyValue},this.space))};a.Text3D=p;return a}(descartesJS||{});
descartesJS=function(a,g){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-"),f=/[\w\.\-//]*(\.png|\.jpg|\.gif|\.svg|\.webp)/gi,q,p,c=0,k=function(l,b){var h=a.Graphic.call(this,l,b)||this;h.expresion=h.expresion||void 0;h.inirot=h.inirot||"(0,0,0)";h.inirotEuler=h.inirotEuler||!1;h.inipos=h.inipos||l.evaluator.parser.parse("(0,0,0)");h.endrot=
h.endrot||"(0,0,0)";h.endrotEuler=h.endrotEuler||!1;h.endpos=h.endpos||l.evaluator.parser.parse("(0,0,0)");h.name=h.name||"_descartes_empty_name_"+c++;Object.assign(h,b);h.inirot.match("Euler")&&(h.inirot=h.inirot.replace("Euler",""),h.inirotEuler=!0);h.endrot.match("Euler")&&(h.endrot=h.endrot.replace("Euler",""),h.endrotEuler=!0);h.inirot=h.evaluator.parser.parse(h.inirot);h.endrot=h.evaluator.parser.parse(h.endrot);h.inirotM=new a.Matrix4x4;h.inirotM_X=new a.Matrix4x4;h.inirotM_Y=new a.Matrix4x4;
h.inirotM_Z=new a.Matrix4x4;h.iniposM=new a.Matrix4x4;h.endrotM=new a.Matrix4x4;h.endrotM_X=new a.Matrix4x4;h.endrotM_Y=new a.Matrix4x4;h.endrotM_Z=new a.Matrix4x4;h.endposM=new a.Matrix4x4;h.graphics=[];l=l.lessonParser;var d=new a.Tokenizer;if(void 0==h.expresion)return h;"'"!==h.expresion.charAt(0)&&(h.expresion="'"+h.expresion+"'");h.expresion=h.evaluator.parser.parse(h.expresion);b=h.evaluator.eval(h.expresion);if(b)var k=(k=document.getElementById(b))&&"descartes/macro"==k.type?k.text:a.openExternalFile(b);
if(k){var r=a.convertHTMLEntities(k).replace(/\r/g,"").split("\n");k=[];b=0;for(var p=r.length;b<p;b++){var q=r[b].indexOf("=");if(-1!==q){q=l.split(r[b]);for(var n=0,m=q.length;n<m;n++)if(q[n]&&1<q.length&&("id"===g[q[n][0]]||"type"===g[q[n][0]])){k.push(q);break}}}b=0;for(p=k.length;b<p;b++){m=(n=k[b]||[],n[0])&&"id"===n[0][0];var w=!1;r=0;for(q=n.length;r<q;r++){var x=n[r][0].indexOf(".");-1===x||m?x=g[n[r][0]]:(x=g[n[r][0].substring(x+1)],n[r][0]=h.name+"."+n[r][0]);"type"===x&&"surface"===g[n[r][1]]&&
(w=!0);if(!("font"===x||"font_family"===x||("fill"===x||"color"===x||"backcolor"===x||"arrow"===x)&&"("!==n[r][1].charAt(0)||"file"===x&&n[r][1].match(f)||"id"!==x&&void 0!==g[n[r][1]]||w&&"expresion"===x)||"width"===x||"height"===x||"length"===x)if("text"==x)if(n[r][1].match(/\{\\rtf1/)){x=n[r][1];var y=h;var z=function(b,c){c=d.tokenize(c.replace(/&squot;/g,"'"));for(var h=0,f=c.length;h<f;h++)if("identifier"==c[h].type&&!a.reservedIds.match("-"+c[h].value+"-")||"R"===c[h].value||"G"===c[h].value||
"B"===c[h].value)c[h].value=y.name+"."+c[h].value;return(b.match(/^\\expr/)?"\\expr ":"\\decimals ")+d.flatTokens(c)};x=x.replace(/\\expr ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,z);x=x.replace(/\\decimals ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,z);n[r][1]=x}else{z=l.parseText(n[r][1]).textElementsMacros;for(var G=0,J=z.length;G<J;G++){x=d.tokenize(z[G].replace(/&squot;/g,"'"));for(var E=0,F=x.length;E<F;E++)if("identifier"===x[E].type&&!a.reservedIds.match("-"+x[E].value+
"-")||"R"===x[E].value||"G"===x[E].value||"B"===x[E].value)x[E].value=h.name+"."+x[E].value;x=d.flatTokens(x).replace(/&squot;/g,"'").replace(/'\+\(/g,"[").replace(/\)\+'/g,"]");z[G]=x.substring(1,x.length-1)}n[r][1]=z.join("")}else{z=n[r][1].replace(/&squot;/g,"'").split(";");G=0;for(J=z.length;G<J;G++){x=d.tokenize(z[G].replace(/\\n/g,";"));E=0;for(F=x.length;E<F;E++)if("identifier"===x[E].type&&!a.reservedIds.match("-"+x[E].value+"-")||"R"===x[E].value||"G"===x[E].value||"B"===x[E].value)x[E].value=
h.name+"."+x[E].value;z[G]=d.flatTokens(x)}n[r][1]=z.join(";")}}}b=0;for(p=k.length;b<p;b++)if(k[b][0]){n="";m=!1;r=0;for(q=k[b].length;r<q;r++)"type"===g[k[b][r][0]]&&e.match("-"+g[k[b][r][1]]+"-")&&(m=!0),n=n+k[b][r][0]+"='"+k[b][r][1]+"' ";k[b]=n+(m?" space='"+h.spaceID+"'":"");m?h.graphics.push(l.parse3DGraphic(k[b],h.abs_coord,h.background,h.inirot)):l.parseAuxiliar(k[b])}}b=0;for(p=h.graphics.length;b<p;b++)h.graphics[b].macroChildren=!0;return h};$jscomp.inherits(k,a.Graphic);k.prototype.buildFamilyPrimitives=
function(){evaluator=this.evaluator;this.getFamilyValues();var a=evaluator.getVariable(this.family);if(0<=this.fSteps)for(var b=0,c=this.fSteps;b<=c;b++)evaluator.setVariable(this.family,this.familyInf+b*this.family_sep),this.familyValue=this.familyInf+b*this.family_sep,evaluator.eval(this.drawif)&&this.updateMacro();evaluator.setVariable(this.family,a)};k.prototype.update=function(){this.primitives=[];this.evaluator.eval(this.drawif)&&(this.family||this.updateMacro());this.family&&this.buildFamilyPrimitives()};
k.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 b=this.graphics.length;a<b;a++)q=this.graphics[a],q.macro_inirotEuler=this.inirotEuler,q.macro_inirotM=this.inirotM,q.macro_inirotM_X=this.inirotM_X,q.macro_inirotM_Y=this.inirotM_Y,q.macro_inirotM_Z=this.inirotM_Z,q.macro_iniposM=this.iniposM,q.macro_endrotEuler=this.endrotEuler,q.macro_endrotM=this.endrotM,q.macro_endrotM_X=this.endrotM_X,
q.macro_endrotM_Y=this.endrotM_Y,q.macro_endrotM_Z=this.endrotM_Z,q.macro_endposM=this.endposM,q.update();a=0;for(b=this.graphics.length;a<b;a++){q=this.graphics[a];if(q.split||this.split)for(var c=a+1;c<b;c++)p=this.graphics[c],(p.split||this.split)&&q.splitFace(p);this.primitives=this.primitives.concat(q.primitives||[])}};k.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)};k.prototype.drawAux=function(a){};a.Macro3D=k;return a}(descartesJS||{},babel);
descartesJS=function(a){function g(a,b,d,c,h){e.call(this,a/n,a/n,a/n,c,h)}function e(a,b,d,c,h){a/=2;b/=2;d/=2;this.changeGeometry(a,b,d,c,h)||(this.vertices=[new m(a,d,b,1),new m(a,-d,b,1),new m(a,d,-b,1),new m(a,-d,-b,1),new m(-a,d,b,1),new m(-a,-d,b,1),new m(-a,d,-b,1),new m(-a,-d,-b,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,b,d,c,h))}function f(a,b,d,c,h){a/=2;if(!this.changeGeometry(a,b,d,c,h)){var f=2*Math.PI/3,e=2*a*Math.sqrt(2)/3,g=-a/
3,k=e*Math.cos(f)+0*Math.sin(f);f=-e*Math.sin(f)+0*Math.cos(f);this.vertices=[new m(0,0,a,1),new m(k,f,g,1),new m(k,-f,g,1),new m(e,0,g,1)];this.faces=[[1,3,2],[0,1,2],[0,2,3],[0,3,1]];this.updateValues(a,b,d,c,h)}}function q(a,b,d,c,h){a/=2;this.changeGeometry(a,b,d,c,h)||(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,b,d,c,h))}function p(b,
d,c,h,f){b/=Math.PI;if(!this.changeGeometry(b,d,c,h,f)){B=b/1.6180339887;L=1.6180339887*b;this.vertices=[new m(b,b,b,1),new m(b,b,-b,1),new m(b,-b,b,1),new m(b,-b,-b,1),new m(-b,b,b,1),new m(-b,b,-b,1),new m(-b,-b,b,1),new m(-b,-b,-b,1),new m(0,B,L,1),new m(0,B,-L,1),new m(0,-B,L,1),new m(0,-B,-L,1),new m(B,L,0,1),new m(B,-L,0,1),new m(-B,L,0,1),new m(-B,-L,0,1),new m(L,0,B,1),new m(L,0,-B,1),new m(-L,0,B,1),new m(-L,0,-B,1)];I=(new a.Matrix4x4).setIdentity().rotateY(-u/6);H=0;for(P=this.vertices.length;H<
P;H++)this.vertices[H]=I.multiplyVector4(this.vertices[H]);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(b,d,c,h,f)}}function c(b,d,c,h,f){b/=3.8;if(!this.changeGeometry(b,d,c,h,f)){L=1.6180339887*b;this.vertices=[new m(0,b,L,1),new m(0,b,-L,1),new m(0,-b,L,1),new m(0,-b,-L,1),new m(b,L,0,1),new m(b,-L,0,1),new m(-b,L,0,1),new m(-b,-L,0,1),
new m(L,0,b,1),new m(L,0,-b,1),new m(-L,0,b,1),new m(-L,0,-b,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]];I=(new a.Matrix4x4).setIdentity().rotateY(-1.0285);H=0;for(P=this.vertices.length;H<P;H++)this.vertices[H]=I.multiplyVector4(this.vertices[H]);this.updateValues(b,d,c,h,f)}}function k(a,b,d,c,h){a/=2;this.isSphere?d=b=a:(b/=2,d/=2);if(!this.changeGeometry(a,
b,d,c,h)){this.vertices=[new m(0,0,b,1)];for(H=1;H<c;H++)for(E=H*u/c,C=0;C<h;C++)J=C*A/h,y=a*v(E)*r(J),z=d*v(E)*v(J),G=b*r(E),this.vertices.push(new m(y,z,G,1));this.vertices.push(new m(0,0,-b,1));this.faces=[];for(H=0;H<h;H++)this.faces.push([0,(H+1)%h+1,H%h+1]);for(H=1;H<c-1;H++)for(C=0;C<h;C++)this.faces.push([C+1+(H-1)*h,(C+1)%h+1+(H-1)*h,(C+1)%h+1+H*h,C+1+H*h]);for(H=0;H<h;H++)this.faces.push([this.vertices.length-1,this.vertices.length-1-h+H,this.vertices.length-1-h+(H+1)%h]);this.updateValues(a,
b,d,c,h)}}function l(a,b,d,c,h){a/=2;b/=2;d/=2;if(!this.changeGeometry(a,b,d,c,h)){this.vertices=[];for(H=0;H<h;H++)for(C=0;C<c;C++)y=a*(h-H)/h*r(C*A/c),z=d*(h-H)/h*v(C*A/c),G=b-2*H*b/h,this.vertices.push(new m(y,z,G,1));this.vertices.push(new m(0,0,-b,1));this.faces=[];for(H=0;H<h-1;H++)for(C=0;C<c;C++)this.faces.push([C+H*c,(C+1)%c+H*c,(C+1)%c+(H+1)*c,C+(H+1)*c]);for(H=0;H<c;H++)this.faces.push([this.vertices.length-1,this.vertices.length-1-c+H,this.vertices.length-1-c+(H+1)%c]);this.updateValues(a,
b,d,c,h)}}function b(a,b,d,c,h){a/=2;b/=2;d/=2;if(!this.changeGeometry(a,b,d,c,h)){this.vertices=[];for(H=0;H<h+1;H++)for(C=0;C<c;C++)y=a*r(C*A/c),z=d*v(C*A/c),G=b-2*H*b/h,this.vertices.push(new m(y,z,G,1));this.faces=[];for(H=0;H<h;H++)for(C=0;C<c;C++)this.faces.push([C+H*c,(C+1)%c+H*c,(C+1)%c+(H+1)*c,C+(H+1)*c]);this.updateValues(a,b,d,c,h)}}function h(a,b,d,c,h){a/=2;b/=2;d/=2;F=w.eval(this.R);D=w.eval(this.r);if(!this.changeGeometry(a,b,d,c,h)){this.vertices=[];for(H=0;H<h+1;H++)for(C=0;C<c;C++)y=
-(F+D*v(A*C/c))*v(A*H/h),z=(F+D*v(A*C/c))*r(A*H/h),G=D*r(A*C/c),this.vertices.push(new m(y,z,G,1));this.faces=[];for(H=0;H<h;H++)for(C=0;C<c;C++)this.faces.push([C+H*c,C+(H+1)*c,(C+1)%c+(H+1)*c,(C+1)%c+H*c]);this.updateValues(a,b,d,c,h)}}function d(){this.vertices=[];this.faces=[];H=0;for(P=this.fileData.length;H<P;H++)M=this.fileData[H],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,r=Math.cos,u=Math.PI,A=2*u,n=Math.sqrt(3),m,w,x,y,z,G,J,E,F,D,B,L,I,M,O,H,P,C,N,K=function(r,n){n=a.Graphic3D.call(this,r,n)||this;n.width=n.width||r.evaluator.parser.parse("2");n.height=n.height||r.evaluator.parser.parse("2");n.length=n.length||r.evaluator.parser.parse("2");n.R=n.R||r.evaluator.parser.parse("2");n.r=n.r||r.evaluator.parser.parse("1");m=a.Vector4D;switch(n.subType){case "cube":n.buildGeometry=
g;break;case "box":n.buildGeometry=e;break;case "tetrahedron":n.buildGeometry=f;break;case "octahedron":n.buildGeometry=q;break;case "sphere":n.isSphere=!0;case "ellipsoid":n.buildGeometry=k;break;case "dodecahedron":n.buildGeometry=p;break;case "icosahedron":n.buildGeometry=c;break;case "cone":n.buildGeometry=l;break;case "cylinder":n.buildGeometry=b;break;case "torus":n.buildGeometry=h;break;case "mesh":n.fileData=a.openExternalFile(n.evaluator.eval(n.file)).split(/\r/),n.buildGeometry=d}return n};
$jscomp.inherits(K,a.Graphic3D);K.prototype.buildPrimitives=function(){w=this.evaluator;this.updateMVMatrix();this.buildGeometry(w.eval(this.width),w.eval(this.height),w.eval(this.length),w.eval(this.Nu),w.eval(this.Nv));var b=this.color.getColor(),d=this.backcolor.getColor(),c=this.edges?this.edges.getColor():"";H=0;for(P=this.faces.length;H<P;H++){x=[];C=0;for(N=this.faces[H].length;C<N;C++)x.push(this.transformVertex(this.vertices[this.faces[H][C]]));this.primitives.push(new a.Primitive3D({vertices:x,
type:"face",frontColor:b,backColor:d,edges:c,model:this.model},this.space))}};K.prototype.changeGeometry=function(a,b,d,c,h){return this.oldWidth===a&&this.oldHeight===b&&this.oldLength===d&&this.oldNu===c&&this.oldNv===h};K.prototype.updateValues=function(a,b,d,c,h){this.oldWidth=a;this.oldHeight=b;this.oldLength=d;this.oldNv=h;this.oldNu=c};a.OtherGeometry3D=K;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.max,e=Math.min,f=Math.PI,q=Math.cos,p=Math.sin,c=Math.abs,k=Math.round,l,b,h,d,v,r,u,A,n,m,w,x,y,z,G,J,E,F,D=function(a,b){this.x=void 0===a?0:a;this.y=void 0===b?0:b};D.prototype.set=function(a,b){this.x=void 0===a?0:a;this.y=void 0===b?0:b;return this};D.prototype.copy=function(){return new D(this.x,this.y)};D.prototype.ix=function(){return k(g(e(this.x,32E3),-32E3))};D.prototype.iy=function(){return k(g(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){b=this.copy();b.sub(a);return b.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){h=this.copy();r=q(a);u=p(a);this.x=h.x*r-h.y*u;this.y=h.x*u+h.y*r};D.prototype.rot2=function(a){this.rot(a*f/180)};D.prototype.intersection=function(a,b,h,f){A=b.x-a.x;n=h.x-f.x;m=h.x-a.x;w=b.y-a.y;x=h.y-f.y;y=h.y-a.y;F=A*
x-n*w;return 1E-6<c(F)?(d=(m*x-y*n)/F,v=(-m*w+y*A)/F,0<=d&&1>=d&&0<=v&&1>=v?new D(a.x+A*d,a.y+w*d):null):(b.x-h.x)*y!=(b.y-h.y)*m?null:a.x!=b.x?(z=e(a.x,b.x),G=g(a.x,b.x),z<=h.x&&h.x<=G?h:z<=f.x&&f.x<=G?f:null):h.x!=f.x?(J=e(h.x,f.x),E=g(h.x,f.x),J<=a.x&&a.x<=E?a:J<=b.x&&b.x<=E?b:null):a.y!=b.y?(z=e(a.y,b.y),G=g(a.y,b.y),z<=h.y&&h.y<=G?h:z<=f.y&&f.y<=G?f:null):h.y!=f.y?(J=e(h.y,f.y),E=g(h.y,f.y),J<=a.y&&a.y<=E?a:J<=b.y&&b.y<=E?b:null):a.x==h.x&&a.y==h.y?a:null};a.R2=D;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,e,f,q,p,c,k,l,b,h=function(d,h){this.evaluator=d;this.constraint=h;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];c=
new a.R2(0,0);p=new a.R2(0,0);b=new a.R2(0,0)};h.prototype.getUnitNormal=function(){this.normal.normalize();return b.set(this.normal.x,this.normal.y)};h.prototype.gradient=function(a){g=this.evaluator;c.x=0;c.y=0;k=g.getVariable("x");l=g.getVariable("y");g.setVariable("x",a.x);g.setVariable("y",a.y);this.f0=g.eval(this.constraint);g.setVariable("x",g.getVariable("x")+1E-6);e=g.eval(this.constraint);c.x=(e-this.f0)/1E-6;c.x=isNaN(c.x)?Infinity:c.x;g.setVariable("x",g.getVariable("x")-1E-6);g.setVariable("y",
g.getVariable("y")+1E-6);e=g.eval(this.constraint);c.y=(e-this.f0)/1E-6;c.y=isNaN(c.y)?Infinity:c.y;g.setVariable("x",k);g.setVariable("y",l);return c};h.prototype.findZero=function(a,b,c){g=this.evaluator;p.x=a.x;p.y=a.y;k=g.getVariable("x");l=g.getVariable("y");g.setVariable("x",a.x);g.setVariable("y",a.y);this.f0=g.eval(this.constraint);if("menor"===this.sign&&0>=this.f0||"mayor"===this.sign&&0<=this.f0)return p;g.setVariable("x",k);g.setVariable("y",l);for(var d=0;16>d;d++)if(f=p.x,q=p.y,this.normal=
this.gradient(p),0!=this.normal.norm2()&&this.normal.mul(-this.f0/this.normal.norm2()),p.x=f+this.normal.x,p.y=q+this.normal.y,this.normal.norm()<b)return 0===this.normal.x&&0===this.normal.y&&(this.normal.x=p.x-a.x,this.normal.y=p.y-a.y),p;return c?p:null};a.R2Newton=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=function(a,f){this.x=a;this.y=f};g.prototype.vectorLength=function(){return Math.sqrt(this.x*this.x+this.y*this.y)};g.prototype.dotProduct=function(a){return this.x*a.x+this.y*a.y};g.prototype.angleBetweenVectors=function(a){return Math.acos(this.dotProduct(a)/(this.vectorLength()*a.vectorLength()))};g.AXIS_X=new g(1,0);g.AXIS_Y=new g(0,1);a.Vector2D=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.floor,e=Math.round,f,q,p,c,k,l,b,h,d,v,r,u,A,n=function(b,d){this.parent=b;this.evaluator=b.evaluator;var c=this.parser=b.evaluator.parser;this.id="GraphicControl"!==d.type?"C":"G";this.gui=this.type="";this.region="south";this.y=this.x=0;this.w="Video"!==d.type?100:350;this.h="Video"!==d.type?23:120;this.keyboard=!1;this.kblayout="1x16";"GraphicControl"!==d.type&&"Audio"!==d.type&&"Video"!==d.type?"TextArea"!==d.type?this.expresion=c.parse("(0,0,100,23)"):
(this.expresion=c.parse("(0,0,300,200)"),this.w=300,this.h=200):this.expresion=c.parse("(0,0)");this.visible=this.fixed=!0;this.color=new a.Color("222222");this.colorInt=new a.Color("GraphicControl"!==d.type?"f0f8ff":"cc0022");this.font_size=c.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=c.parse("1");this.activeif=c.parse("1");
this.valueExpr=c.parse("0");this.decimals=c.parse("2");this.min=c.parse("-Infinity");this.max=c.parse("Infinity");this.incr=c.parse("0.1");this.exponentialif=this.discrete=!1;this.zIndex=-1;Object.assign(this,d);"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;d=this.evaluator.eval(this.expresion);this.x=
e(d[0][0]);this.y=e(d[0][1]);4==d[0].length&&(this.w=e(d[0][2]),this.h=e(d[0][3]));this.actionExec=b.lessonParser.parseAction(this)};n.prototype.init=function(){};n.prototype.update=function(){};n.prototype.draw=function(){};n.prototype.getContainer=function(){var a=this.parent.spaces;if("interior"===this.region)for(var b=0,d=a.length;b<d;b++){var c=a[b];if(c.id===this.spaceID)return c.addCtr(this),this.zIndex=c.zIndex,this.space=c,c.numericalControlContainer}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.numericalControlContainer):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].numericalControlContainer};n.prototype.addControlContainer=function(a){var b=this.getContainer();b.childNodes[0]?b.insertBefore(a,b.childNodes[0]):b.appendChild(a)};n.prototype.updatePositionAndSize=function(){p=c=k=l=!1;b=this.evaluator.eval(this.expresion);h=e(b[0][0]);p=e(this.x)!==h;this.x=h;h=e(b[0][1]);c=e(this.y)!==h;this.y=h;4===b[0].length&&(h=e(b[0][2]),k=e(this.w)!==h,this.w=h,h=e(b[0][3]),l=e(this.h)!==h,this.h=h);if(k||l||p||c)this.init(!0,!0),this.draw()};
n.prototype.formatOutputValue=function(a){A=this.parent;console.log("joel",a);d=a+"";v=this.evaluator.eval(this.decimals);r=d.indexOf(".");-1!=r&&(u=d.substring(r+1),u.length>v&&(d=parseFloat(d).toFixed(v)));this.fixed&&(2!==A.version||2===A.version&&!this.exponentialif)&&(d=parseFloat(a).toFixed(v));this.exponentialif&&0!=parseFloat(d)&&(d=this.fixed&&2!==A.version?parseFloat(d).toExponential(v):parseFloat(d).toExponential(),d=d.toUpperCase().replace("+",""));return d.replace(".",A.decimal_symbol)};
n.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()};n.prototype.createGradient=function(a,b){this.linearGradient=this.ctx.createLinearGradient(0,0,0,b);f=b*b;for(a=0;a<b;a++)q=g(a-35*b/100),this.linearGradient.addColorStop(a/b,"rgba(0,0,0,"+q*q*192/f/255+")")};a.Control=n;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.floor,e=Math.abs,f=/[\w\.\-//]*(\.gif)/gi,q,p,c,k,l,b,h,d,v,r,u,A,n,m,w,x,y,z,G,J,E,F,D,B,L,I,M,O,H,P,C,N,K=function(b,d){var c=a.Control.call(this,b,d)||this;c.imageSrc=d.imageSrc||"";c.image=d.image||new Image;c.imageOver=d.imageOver||new Image;c.imageDown=d.imageDown||new Image;c.flat=d.flat||!1;c.borderColor=d.borderColor||!1;c.text_align=d.text_align||"center_center";c.image_align=d.image_align||"center_center";c.font_family=a.getFontName(d.font_family||
"arial");c.ratio=b.ratio;-1===c.font_size&&(c.fontSizeNotSet=!0);c.borderColor&&(c.borderColor=new a.Color(c.borderColor));c.text_align=c.text_align.split("_");c.image_align=c.image_align.split("_");c.old_name=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.classContainer=c.cssClass?" "+c.cssClass+" ":"";c.extra_style=c.imageSrc.trim().match("^_STYLE_")?c.imageSrc.trim().substring(8):c.extra_style||"";c.imageSrc.trim().match("^_STYLE_")&&
(c.imageSrc="vacio.gif");if(c.extra_style){c.customStyle=!0;c.btnStyle=[];c.conStyle=[];c.conStyle.textBorder=3;b=c.extra_style.split("|");for(var h,f=0,m=b.length;f<m;f++)d=b[f],h=d.match(/rgb/g),d.match("class=")?c.classContainer=" "+d.substring(6):d.match("border=")?(c.btnStyle.push({type:"border-style",value:"solid"}),c.btnStyle.push({type:"border-width",value:d.substring(7).trim()+"px"})):d.match("borderRadius=")?(c.btnStyle.push({type:"border-radius",value:d.substring(13).trim()+"px"}),c.conStyle.push({type:"border-radius",
value:d.substring(13).trim()+"px"})):d.match("borderColor=")?c.btnStyle.push({type:"border-color",value:(h?"":"#")+d.substring(12).trim()}):d.match("overColor=")?c.conStyle.overColor=(h?"":"#")+d.substring(10).trim():d.match("downColor=")?c.conStyle.downColor=(h?"":"#")+d.substring(10).trim():d.match("font=")?c.conStyle.font=d.substring(5).trim().toLowerCase():d.match("inactiveColor=")?c.conStyle.inactiveColor=(h?"":"#")+d.substring(14).trim():d.match("inactiveColorBorder=")?c.conStyle.inactiveColorBorder=
(h?"":"#")+d.substring(20).trim():d.match("shadowTextBlur=")?c.conStyle.shadowTextBlur=parseFloat(d.substring(15).trim()):d.match("shadowTextOffsetX=")?c.conStyle.shadowTextOffsetX=parseFloat(d.substring(18).trim()):d.match("shadowTextOffsetY=")?c.conStyle.shadowTextOffsetY=parseFloat(d.substring(18).trim()):d.match("shadowTextColor=")?c.conStyle.shadowTextColor=(h?"":"#")+d.substring(16).trim():d.match("shadowBoxBlur=")?c.conStyle.shadowBoxBlur=parseFloat(d.substring(14).trim()):d.match("shadowBoxOffsetX=")?
c.conStyle.shadowBoxOffsetX=parseFloat(d.substring(17).trim()):d.match("shadowBoxOffsetY=")?c.conStyle.shadowBoxOffsetY=parseFloat(d.substring(17).trim()):d.match("shadowBoxColor=")?c.conStyle.shadowBoxColor=(h?"":"#")+d.substring(15).trim():d.match("shadowInsetBoxBlur=")?c.conStyle.shadowInsetBoxBlur=parseFloat(d.substring(19).trim()):d.match("shadowInsetBoxOffsetX=")?c.conStyle.shadowInsetBoxOffsetX=parseFloat(d.substring(22).trim()):d.match("shadowInsetBoxOffsetY=")?c.conStyle.shadowInsetBoxOffsetY=
parseFloat(d.substring(22).trim()):d.match("shadowInsetBoxColor=")?c.conStyle.shadowInsetBoxColor=(h?"":"#")+d.substring(20).trim():d.match("textBorder=")?c.conStyle.textBorder=parseFloat(d.substring(11).trim()):d.match("flat=")&&(c.flat=1==parseInt(d.substring(5).trim()))}c.imageSrc.match("_COLORES_")&&(b=c.imageSrc.split("_"),c.colorInt=new a.Color(b[2]),c.color=new a.Color(b[3]),c.font_size=c.parser.parse(b[5]),c.imageSrc="");c.imageSrc.match(/^\[.*\]?/)?c.imageSrc=c.parser.parse(c.imageSrc.substring(1,
c.imageSrc.length-1)):c.imageSrc=c.parser.parse("'"+c.imageSrc+"'");b=c.evaluator.eval(c.imageSrc).toString().trim();if(""!=b)if(d=b.substr(0,b.lastIndexOf(".")),h=b.substr(b.lastIndexOf(".")),b.match(/vacio.gif$/i))c.imageSrc=c.parser.parse("'vacio.gif'"),c.image.ready=1,3===c.parent.version&&(c.name=c.parser.parse("")),c.emptyImage={ready:!0},c.parser.parse("'vacio.gif'");else if(c.image=c.parent.getImage(b),d)try{c.imageOver=c.parent.getImage(d+"_over"+h),c.imageDown=c.parent.getImage(d+"_down"+
h)}catch(S){}c.container=a.newHTML("div",{class:"DescartesButtonContainer"+c.classContainer,id:c.id,style:"width:"+c.w+"px;height:"+c.h+"px;left:"+c.x+"px;top:"+c.y+"px;z-index:"+c.zIndex+";"});c.btn=a.newHTML("canvas",{width:c.w*c.ratio,height:c.h*c.ratio,style:"position:absolute;left:0;top:0;width:"+c.w+"px;height:"+c.h+"px;"});c.ctx=c.btn.getContext("2d");c.ctx.imageSmoothingEnabled=!1;c.tooltip&&(c.btn.title=c.tooltip);c.container.appendChild(c.btn);c.addControlContainer(c.container);c.addEvents();
c.init();return c};$jscomp.inherits(K,a.Control);K.prototype.init=function(b){q=this.evaluator;y=this.container;p=this.btn;c=this.ctx;k=q.eval(this.expresion);this.x=k[0][0];this.y=k[0][1];4==k[0].length&&(this.w=parseInt(k[0][2]),this.h=parseInt(k[0][3]));p.width=this.w*this.ratio;p.height=this.h*this.ratio;p.setAttribute("style","position:absolute;left:0;top:0;width:"+this.w+"px;height:"+this.h+"px;box-sizing:border-box;");y.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,h=this.btnStyle.length;d<h;d++)p.style[this.btnStyle[d].type]=this.btnStyle[d].value;if(this.conStyle){d=0;for(h=this.conStyle.length;d<h;d++)y.style[this.conStyle[d].type]=this.conStyle[d].value;if(this.conStyle.shadowBoxColor){d=this.conStyle.shadowBoxOffsetX||0;h=this.conStyle.shadowBoxOffsetY||2;var f=this.conStyle.shadowBoxBlur||2;y.style.boxShadow=d+"px "+h+"px "+f+"px 1px "+this.conStyle.shadowBoxColor}this.conStyle.shadowInsetBoxColor&&
(d=this.conStyle.shadowInsetBoxOffsetX||0,h=this.conStyle.shadowInsetBoxOffsetY||-2,f=this.conStyle.shadowInsetBoxBlur||1,p.style.boxShadow=d+"px "+h+"px "+f+"px 1px "+this.conStyle.shadowInsetBoxColor+" inset")}this.fontSizeNotSet&&(this.font_size=q.parser.parse(a.getFieldFontSize(this.h)+""));this.fs_evaluated=q.eval(this.font_size);this.createGradient(this.w,this.h);y.style.display=0<q.eval(this.drawif)?"block":"none";c.lineJoin="round";c.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(b)};K.prototype.update=function(){q=this.evaluator;y=this.container;p=this.btn;this.activeIfValue=0<q.eval(this.activeif);this.drawIfValue=0<q.eval(this.drawif);(this.space?this.space.drawIfValue:1)&&this.drawIfValue?
(y.style.display="block",this.draw(),y.style.cursor=p.style.cursor=this.activeIfValue?"pointer":"not-allowed",y.setAttribute("active",this.activeIfValue),this.updatePositionAndSize()):(y.style.display="none",this.buttonClick=!1)};K.prototype.draw=function(e){y=this.container;q=this.evaluator;p=this.btn;c=this.ctx;b=q.eval(this.name);this.text_object.draw(a.ctx,"#000000",0,0);b=this.text_object.textNodes.toStr();h=this.evaluator.eval(this.imageSrc).toString().trim();if(!e&&(z=this.over===this.oldOver,
G=this.buttonClick===this.oldButtonClick,J=this.activeIfValue===this.oldActiveIfValue,E=this.drawIfValue===this.oldDrawIfValue,F=b===this.oldName,D=h===this.oldImageSrc,B=this.colorInt.getColor()===this.oldBackColor,L=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=b,this.oldImageSrc=h,this.oldBackColor=this.colorInt.getColor(),
this.oldTextColor=this.color.getColor(),this.oldImageReady=this.image.ready,z&&G&&J&&E&&F&&D&&B&&L&&I))return;c.save();c.setTransform(this.ratio,0,0,this.ratio,0,0);l=this.fs_evaluated;y.setAttribute("data-name",b);h?(d="vacio.gif"===h?this.emptyImage:this.parent.getImage(h),M=h.substr(0,h.lastIndexOf(".")),O=h.substr(h.lastIndexOf(".")),H=M+"_over"+O,P=M+"_down"+O,C="vacio.gif"===h?this.emptyImage:this.parent.getImage(H),N="vacio.gif"===h?this.emptyImage:this.parent.getImage(P)):N=C=d=this.emptyImage;
c.clearRect(0,0,this.w,this.h);v=r=0;this.buttonClick&&(v=r=1);this.text_object.draw(c,this.color.getColor(),0,0,!0);u=this.text_object.textNodes.metrics.w;A=this.text_object.textNodes.metrics.h;"center"==this.text_align[1]?w=g(this.w/2+v)-.5:"left"==this.text_align[1]?w=u/2+5+v:"right"==this.text_align[1]&&(w=this.w-u/2+v-5);"center"==this.text_align[0]?x=g(this.h/2+r)-.5:"top"==this.text_align[0]?x=A/2+r+4:"bottom"==this.text_align[0]&&(x=this.h-A/2+r-3);d&&("center"==this.image_align[1]?n=parseInt((this.w-
d.width)/2)+v:"left"==this.image_align[1]?n=v:"right"==this.image_align[1]&&(n=this.w-d.width+v),"center"==this.image_align[0]?m=parseInt((this.h-d.height)/2)+r:"top"==this.image_align[0]?m=r:"bottom"==this.image_align[0]&&(m=this.h-d.height+r));if(d&&d.ready)if(d!==this.emptyImage&&d.complete)if(h.match(f))this.btn.style.backgroundRepeat="no-repeat",this.btn.style.backgroundImage="url('"+h+"')",this.btn.style.backgroundPosition=n+"px "+m+"px";else{if("center"!=this.image_align[0]||"center"!=this.image_align[1])y.style.backgroundColor=
this.colorInt.getColor();c.drawImage(d,n,m)}else this.emptyImage&&this.customStyle&&(y.style.backgroundColor=this.colorInt.getColor());else y.style.backgroundColor=this.colorInt.getColor(),this.flat||(this.buttonClick||(a.drawLine(c,this.w-1,0,this.w-1,this.h,"rgba(0,0,0,0.5)"),a.drawLine(c,0,0,0,this.h,"rgba(0,0,0,0.09)"),a.drawLine(c,1,0,1,this.h,"rgba(0,0,0,0.03)")),c.fillStyle=this.linearGradient,c.fillRect(0,0,this.w,this.h));this.activeIfValue&&(C!==this.emptyImage&&this.over&&C.ready&&C.complete?
H.match(f)?(this.btn.style.backgroundImage="url('"+H+"')",this.btn.style.backgroundPosition=n+"px "+m+"px"):c.drawImage(C,n,m):this.customStyle&&this.conStyle.overColor&&this.over&&(y.style.backgroundColor=this.conStyle.overColor));this.activeIfValue?N!==this.emptyImage&&this.buttonClick&&N.ready&&N.complete?P.match(f)?(this.btn.style.backgroundImage="url('"+P+"')",this.btn.style.backgroundPosition=n+"px "+m+"px"):c.drawImage(N,n,m):this.customStyle&&this.conStyle.downColor&&this.buttonClick&&(y.style.backgroundColor=
this.conStyle.downColor):this.buttonClick&&!d&&(c.fillStyle="rgba(0,0,0,0.09)",c.fillRect(0,0,this.w,this.h));c.fillStyle=this.color.getColor();this.customStyle&&this.conStyle.shadowTextColor&&0<this.conStyle.textBorder&&(c.lineWidth=this.conStyle.textBorder,c.strokeStyle=this.conStyle.shadowTextColor);this.borderColor&&(c.lineWidth=parseInt(l/6),c.strokeStyle=this.borderColor.getColor());this.text_object.draw(c,this.color.getColor(),w,x);this.underlined&&(c.strokeStyle=this.color.getColor(),c.lineWidth=
g(l/10)||2,c.lineCap="round",c.beginPath(),c.moveTo(w-u/2+v,x+g(l/2)+g(l/5)-1.5),c.lineTo(w+u/2+v,x+g(l/2)+g(l/5)-1.5),c.stroke());this.activeIfValue||(this.customStyle&&this.conStyle.inactiveColor?y.style.backgroundColor=this.conStyle.inactiveColor:(c.fillStyle="rgba(240,240,240,0.6)",c.fillRect(0,0,this.w,this.h)));c.restore();this._image_pos_x=n;this._image_pos_y=m};K.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)};K.prototype.buttonPressed=function(){this.updateAndExecAction()};K.prototype.addEvents=function(){function b(d,c,m){a.clearTimeout(f);h.buttonClick&&h.drawIfValue&&h.activeIfValue&&(c.call(h),d=m?d:100,f=a.setTimeout(function(){b(d,c,!1)},d))}function d(d){this.focus();d.preventDefault();d.stopPropagation();document.activeElement!=document.body&&document.activeElement.blur();h.whichBtn=a.whichBtn(d);"L"==h.whichBtn&&h.activeIfValue&&
(h.buttonClick=!0,h.draw(),"calculate"==h.action&&(h.evaluator.setVariable(h.id,h.evaluator.eval(h.valueExpr)),b(1E3,h.buttonPressed,!0)),h.btn.removeEventListener("touchend",c),h.btn.addEventListener("touchend",c),h.btn.removeEventListener("mouseup",c),h.btn.addEventListener("mouseup",c))}function c(b){a.newBlobContent=null;this.focus();b.preventDefault();b.stopPropagation();if(h.activeIfValue||h.buttonClick)h.buttonClick=!1,h.draw(),"calculate"!=h.action&&(h.evaluator.setVariable(h.id,h.evaluator.eval(h.valueExpr)),
h.buttonPressed()),h.btn.removeEventListener("touchend",c),h.btn.removeEventListener("mouseup",c);h.parent.update()}var h=this,f;h.btn.oncontextmenu=function(){return!1};this.over=this.buttonClick=!1;this.btn.addEventListener("touchstart",d);this.btn.addEventListener("mousedown",d);this.btn.addEventListener("mouseover",function(a){a.preventDefault();a.stopPropagation();h.over=!0;h.draw()});this.btn.addEventListener("mouseout",function(b){a.newBlobContent=null;b.preventDefault();b.stopPropagation();
h.over=!1;h.buttonClick=!1;h.draw()});document.addEventListener("visibilitychange",function(b){a.newBlobContent=null;h.buttonClick=!1})};a.Button=K;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,e,f,q,p,c,k,l,b,h,d,v,r,u=function(b,c){c=a.Control.call(this,b,c)||this;c.flat=c.image_dec_src&&c.image_inc_src;c.btn_pos=c.btn_pos||"v_left";c.horizontal="h_left"===c.btn_pos||"h_right"===c.btn_pos||"h_left_right"===c.btn_pos;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.tabindex=++c.parent.tabindex;c.name_str=c.name;c.initial_value=0;try{c.initial_value=
c.evaluator.eval(c.parser.parse(c.valueExprString))}catch(m){console.log(m)}c.name.match(/^\[.*\]?/)?c.name=c.parser.parse(c.name.substring(1,c.name.length-1)):c.name=c.parser.parse("'"+c.name+"'");c.container=a.newHTML("div",{class:"DescartesSpinnerContainer",id:c.id});c.divUp=a.newHTML("div",{class:"DJS_Up"});c.divDown=a.newHTML("div",{class:"DJS_Down"});c.field=a.newHTML("input",{type:"text",id:c.id+"_spinner",class:"DescartesSpinnerField",tabindex:c.tabindex});c.label=a.newHTML("canvas",{class:"DescartesSpinnerLabel"});
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.divUp);c.container.appendChild(c.divDown);c.cover=a.newHTML("div",{class:"TextfieldCover"});c.keyboard&&c.visible&&c.container.appendChild(c.cover);c.addControlContainer(c.container);d=c.evaluator.parser.parse("1");c.originalIncr=c.incr;if(0>c.evaluator.eval(c.decimals)||0===c.evaluator.eval(c.incr))b=c.evaluator.eval(c.incr),0<b?(c.incr=c.evaluator.parser.parse(parseInt(b).toString()),
c.originalIncr=c.incr):c.incr=d;c.image_dec_src&&(c.image_dec_src.match(/^\[.*\]?/)?c.image_dec_src=c.parser.parse(c.image_dec_src.substring(1,c.image_dec_src.length-1)):c.image_dec_src=c.parser.parse("'"+c.image_dec_src+"'"),c.old_image_dec_src=c.evaluator.eval(c.image_dec_src).toString().trim(),c.image_dec=c.parent.getImage(c.old_image_dec_src));c.image_inc_src&&(c.image_inc_src.match(/^\[.*\]?/)?c.image_inc_src=c.parser.parse(c.image_inc_src.substring(1,c.image_inc_src.length-1)):c.image_inc_src=
c.parser.parse("'"+c.image_inc_src+"'"),c.old_image_inc_src=c.evaluator.eval(c.image_inc_src).toString().trim(),c.image_inc=c.parent.getImage(c.old_image_inc_src));c.addEvents();c.init();return c};$jscomp.inherits(u,a.Control);u.prototype.init=function(b,c){g=this.evaluator;this.label.innerHTML=g.eval(this.name).toString();var d=this.label.textContent;c||(this.value=this.validateValue(g.eval(this.valueExpr)));c=this.formatOutputValue(this.value);this.fieldFontSize=0<g.eval(this.font_size)?g.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 h=2!==this.parent.version?"__":"_____",f=a.getTextWidth(c+
"_",this.fieldFontSize+"px "+a.sansserif_font);if(this.horizontal){b=parseInt(this.h);var e=parseInt(this.w/2-b);h=this.text_object.textNodes.metrics.w+parseInt(this.fieldFontSize);this.visible||(e=this.w-2*b,f=0);e<h&&(e=h);""==d&&(e=0);this.w-e-b<f&&(e=this.w-b-f);0>e&&(e=0);d=this.w-(e+2*b);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:"+
b+"px;height:"+b+"px;"+("h_left"===this.btn_pos?"left:"+(e+b):"right:0")+"px;top:0;"+(this.flat?"border-width:0;":""));this.divDown.setAttribute("style","width:"+b+"px;height:"+b+"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:"+(b+e+("h_left"===this.btn_pos?b:"h_right"===this.btn_pos?-b:0))+"px;text-align:center;");
this.cover.setAttribute("style","width:"+d+"px;height:"+this.h+"px;left:"+(b+e+("h_left"===this.btn_pos?b:"h_right"===this.btn_pos?-b:0))+"px;text-align:center;")}else b=2+parseInt(this.h/2),e=parseInt(this.w/2-b/2),h=a.getTextWidth(d+h,this.fieldFontSize+"px "+a.sansserif_font),this.visible||(e=this.w-b,f=0),e<h&&(e=h),""==d&&(e=0),this.w-e-b<f&&(e=this.w-b-f),0>e&&(e=0),d=this.w-(e+b),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;"),h="width:"+b+"px;left:"+(e+("v_right"===this.btn_pos?d:0))+"px;",this.divUp.setAttribute("style",h+";height:"+(this.h/2+1)+"px;top:0;"+(this.flat?"border-width:0;":"")),this.divDown.setAttribute("style",h+";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?
b:0)+e)+"px;"),this.cover.setAttribute("style","width:"+d+"px;height:"+this.h+"px;left:"+(("v_left"===this.btn_pos?b:0)+e)+"px;");this.field.value=c;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);g.setVariable(this.id,this.value)};u.prototype.update=function(){g=this.evaluator;0>g.eval(this.decimals)?(e=g.eval(this.incr),0<e?this.originalIncr=this.incr=g.parser.parse(parseInt(e).toString()):
this.incr=d):this.incr=0!==g.eval(this.originalIncr)?this.originalIncr:d;this.activeIfValue=0<g.eval(this.activeif);this.drawIfValue=0<g.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&&(r=this.evaluator.eval(this.image_inc_src).toString().trim(),this.old_image_inc_src!==r&&(this.divUp.style["background-image"]="url("+r+")",this.image_inc_src=r));this.updatePositionAndSize();this.parent.animation.playing&&document.activeElement==this.field||(f=this.field.value,q=this.value,this.value=this.validateValue(g.getVariable(this.id)),this.field.value=this.formatOutputValue(this.value),
this.value==q&&this.field.value!=f&&(this.value=this.validateValue(f),this.field.value=this.formatOutputValue(this.value)),g.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);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.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"};u.prototype.validateValue=
function(a){g=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,".");p=a==parseFloat(a)?parseFloat(a):parseFloat(g.eval(g.parser.parse(a)));isNaN(p)&&(p=0);l=g.eval(this.min);b=g.eval(this.max);""===l&&(l=-Infinity);""===b&&(b=Infinity);p=Math.min(Math.max(p,l),b);this.discrete&&(c=g.eval(this.incr),p=0==c?0:this.initial_value+c*Math.round((p-this.initial_value)/c));k=g.eval(this.decimals);
0>=k&&(k=0);return p=parseFloat(parseFloat(p).toFixed(k))};u.prototype.increase=function(){this.changeValue(parseFloat(this.value)+this.evaluator.eval(this.incr))};u.prototype.decrease=function(){this.changeValue(parseFloat(this.value)-this.evaluator.eval(this.incr))};u.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())};u.prototype.addEvents=
function(){function b(c,d,h){a.clearTimeout(k);if(g.up||g.down)d.call(g),c=h?c:10,k=a.setTimeout(function(){b(c,d)},c)}function c(c){c.preventDefault();g.whichBtn=a.whichBtn(c);"L"==g.whichBtn&&g.activeIfValue&&(g.up=!0,b(r,g.increase,!0))}function d(c){c.preventDefault();g.whichBtn=a.whichBtn(c);"L"==g.whichBtn&&g.activeIfValue&&(g.down=!0,b(r,g.decrease,!0))}function f(b){g.up=!1;a.clearTimeout(k);g.updateStyle()}function e(b){g.down=!1;a.clearTimeout(k);g.updateStyle()}h=a.hasTouchSupport;var g=
this,r=h?500:200,k;g.divUp.oncontextmenu=g.divDown.oncontextmenu=g.field.oncontextmenu=g.label.oncontextmenu=g.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&&g.changeValue(g.field.value)});this.divUp.addEventListener("touchstart",c);this.divUp.addEventListener("mousedown",c);this.divDown.addEventListener("touchstart",d);this.divDown.addEventListener("mousedown",
d);this.divUp.addEventListener("mouseout",function(b){g.up=!1;a.clearTimeout(k);b.preventDefault();g.updateStyle()});this.divDown.addEventListener("mouseout",function(b){g.down=!1;a.clearTimeout(k);b.preventDefault();g.updateStyle()});this.divUp.addEventListener("touchend",f);window.addEventListener("touchend",f);this.divUp.addEventListener("mouseup",f);window.addEventListener("mouseup",f);this.divDown.addEventListener("touchend",e);window.addEventListener("touchend",e);this.divDown.addEventListener("mouseup",
e);window.addEventListener("mouseup",e);document.addEventListener("visibilitychange",function(b){g.up=!1;g.down=!1;a.clearTimeout(k);g.updateStyle()});this.field.addEventListener("blur",function(a){g.drawIfValue&&g.changeValue(g.field.value,!0)});g.field.addEventListener("click",function(a){this.focus()});g.cover.addEventListener("click",function(a){a=g.evaluator.eval(g.kbexp);g.activeIfValue&&g.parent.keyboard.show(g,g.kblayout,a[0][0]||0,a[0][1]||0,g.id,g.field,g.onlyText)})};a.Spinner=u;return a}(descartesJS||
{});
descartesJS=function(a){if(a.loadLib)return a;var g,e=function(f,e){var g=a.Control.call(this,f,e)||this;g.label_color=g.label_color||new a.Color("e0e4e8",f.evaluator);g.label_text_color=g.label_text_color||new a.Color("000000",f.evaluator);g.typeCtr="checkbox";g.pressed=e.pressed||!1;g.radio_group=(e.radio_group||"").trim();""!==g.radio_group&&(g.typeCtr="radio");g.name_str=g.name;g.name.match(/^\[.*\]?/)?g.name=g.parser.parse(g.name.substring(1,g.name.length-1)):g.name=g.parser.parse("'"+g.name.trim()+"'");
g.tabindex=++g.parent.tabindex;g.containerControl=a.newHTML("div",{class:"DescartesCheckboxContainer",id:g.id});g.checkbox=a.newHTML("input",{type:g.typeCtr,id:g.id+g.typeCtr,class:"DescartesCheckbox",tabindex:g.tabindex});""!==g.radio_group&&g.checkbox.setAttribute("name",g.radio_group);g.checkbox.internalID=g.id;g.label=a.newHTML("canvas",{class:"DescartesCheckboxLabel"});g.label_ctx=g.label.getContext("2d");g.ratio=f.ratio;g.dummyLabel=a.newHTML("label",{"for":g.id+g.typeCtr});g.value=g.evaluator.eval(g.valueExpr);
g.evaluator.setVariable(g.id,g.value);g.containerControl.appendChild(g.label);g.containerControl.appendChild(g.checkbox);g.containerControl.appendChild(g.dummyLabel);g.addControlContainer(g.containerControl);g.addEvents();g.init();return g};$jscomp.inherits(e,a.Control);e.prototype.init=function(f){g=this.evaluator;this.label.innerHTML=g.eval(this.name).toString();this.labelFontSize=0<g.eval(this.font_size)?g.eval(this.font_size):a.getFieldFontSize(this.h);f=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:"+f+"px;"),this.checkbox.setAttribute("style","width:"+this.h+"px;height:"+this.h+"px;left:"+f+"px;"),this.label.setAttribute("style","font-size:"+this.labelFontSize+"px;width:"+f+"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:"+f+"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=f*this.ratio;this.label.height=
this.h*this.ratio;this.update()};e.prototype.update=function(){g=this.evaluator;this.activeIfValue=0<g.eval(this.activeif);this.drawIfValue=0<g.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!==g.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),g.setVariable(this.id,this.value);else{this.value=g.getVariable(this.id);g.setVariable(this.radio_group,0);a=document.querySelectorAll("[name="+this.radio_group+"]");var e=-1;if(this.pressed){for(var p=a.length-1;0<=p;p--)g.setVariable(a[p].internalID,0),a[p].checked=!1;g.setVariable(this.id,1);this.checkbox.checked=!0;this.value=1;g.setVariable(this.radio_group,this.id);this.pressed=0}else{for(p=a.length-1;0<=p;p--)e=0!=g.getVariable(a[p].internalID)?p:e,g.setVariable(a[p].internalID,
0),a[p].checked=!1;0<=e&&(g.setVariable(a[e].internalID,1),a[e].checked=!0,g.setVariable(this.radio_group,a[e].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);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)};e.prototype.addEvents=function(){var f=this;f.checkbox.oncontextmenu=f.label.oncontextmenu=f.dummyLabel.oncontextmenu=function(){return!1};f.label.addEventListener("touchstart",a.preventDefault);f.label.addEventListener("mousedown",
a.preventDefault);f.dummyLabel.addEventListener("mousedown",a.preventDefault);f.checkbox.addEventListener("click",function(a){f.pressed=!0;f.updateAndExecAction()})};a.Checkbox=e;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,e,f,q,p,c,k=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 h=b.answerPattern.indexOf("|");b.firstAnswer=-1==h?b.answerPattern:b.answerPattern.substring(0,h)}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.addControlContainer(b.containerControl);b.addEvents();b.init();return b};$jscomp.inherits(k,a.Control);k.prototype.init=function(c){g=this.evaluator;this.label.innerHTML=g.eval(this.name).toString();var b=this.label.textContent;c||
(this.value=this.validateValue(g.eval(this.valueExpr)));c=this.formatOutputValue(this.value);this.fieldFontSize=0<g.eval(this.font_size)?g.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 h=a.getTextWidth(c+"_",this.fieldFontSize+"px "+a.sansserif_font),d=parseInt(this.w/2),f=this.text_object.textNodes.metrics.w+parseInt(this.fieldFontSize);this.visible||(d=this.w,h=0);d<f&&(d=f);""==b&&(d=0);this.w-d<h&&(d=this.w-h);0>d&&(d=0);b=this.w-d;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:"+b+"px;height:"+this.h+"px;left:"+d+"px;");this.field.value=c;this.cover.setAttribute("style",";width:"+b+"px;height:"+this.h+"px;left:"+d+"px;");this.label.setAttribute("style","font-size:"+this.fieldFontSize+"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.label.width=d*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()};k.prototype.update=function(){g=this.evaluator;this.activeIfValue=0<g.eval(this.activeif);this.drawIfValue=0<g.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,f=this.value,this.value=
this.validateValue(g.getVariable(this.id)),this.field.value=this.formatOutputValue(this.value),this.value===f&&this.field.value!=e&&(this.value=this.validateValue(e),this.field.value=this.formatOutputValue(this.value)),g.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);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)};k.prototype.validateValue=function(a){if(""===a||"''"==a)return"";g=this.evaluator;a=a.toString().replace(this.regExpDecimalSymbol,
".","g");q=a==parseFloat(a)?parseFloat(a):parseFloat(g.eval(g.parser.parse(a)));isNaN(q)&&(q=0);p=g.eval(this.min);c=g.eval(this.max);""===p&&(p=-Infinity);""===c&&(c=Infinity);q<p&&(q=p);q>c&&(q=c);this.discrete&&(a=g.eval(this.incr),q=0===a?0:a*Math.round(q/a));return q=parseFloat(parseFloat(q).toFixed(g.eval(this.decimals)))};k.prototype.formatOutputValue=function(c){return""===c?"":a.Control.prototype.formatOutputValue.call(this,c)};k.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())};k.prototype.evaluateAnswer=function(){return a.esCorrecto(this.answer,this.value,this.evaluator,this.answer)};k.prototype.getFirstAnswer=function(){return this.answer?this.onlyText?this.firstAnswer:this.evaluator.eval(this.firstAnswer):""};k.prototype.addEvents=
function(){var c=this;c.field.oncontextmenu=c.label.oncontextmenu=c.cover.oncontextmenu=function(){return!1};c.label.addEventListener("touchstart",a.preventDefault);c.label.addEventListener("mousedown",a.preventDefault);this.field.addEventListener("blur",function(a){c.drawIfValue&&c.changeValue(c.field.value,!0)});this.field.addEventListener("keydown",function(a){c.activeIfValue&&13==a.keyCode&&c.changeValue(c.field.value,!0)});c.field.addEventListener("click",function(a){this.focus()});c.cover.addEventListener("click",
function(a){a=c.evaluator.eval(c.kbexp);c.activeIfValue&&c.parent.keyboard.show(c,c.kblayout,a[0][0]||0,a[0][1]||0,c.id,c.field,c.onlyText)})};a.TextField=k;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.abs,e,f,q,p,c,k,l,b,h,d,v=function(b,c){function d(b){m.options=b.split(",");m.menuOptions=[];m.strValue=[];b=0;for(var c=m.options.length;b<c;b++){var d=m.customSplit(m.options[b]);1==d.length?(m.menuOptions.push(d[0]),m.strValue.push(b.toString())):2==d.length&&(m.menuOptions.push(d[0]),""==d[1]?m.strValue.push(b.toString()):m.strValue.push(d[1]))}b=0;for(c=m.menuOptions.length;b<c;b++)m.menuOptions[b].match(/^\[/)&&m.menuOptions[b].match(/\]$/)?
m.menuOptions[b]=e.parse(m.menuOptions[b].substring(1,m.menuOptions[b].length-1)):m.menuOptions[b]=e.parse("'"+m.menuOptions[b]+"'");b=0;for(c=m.strValue.length;b<c;b++)m.strValue[b].match(/^\[/)&&m.strValue[b].match(/\]$/)?m.strValue[b]=e.parse(m.strValue[b].substring(1,m.strValue[b].length-1)):m.strValue[b]=e.parse(m.strValue[b]);m.select.innerHTML="";b=0;for(c=m.menuOptions.length;b<c;b++)d=a.newHTML("option"),d.innerHTML=f.eval(m.menuOptions[b]),m.select.appendChild(d);return 0}var h=a.Control.call(this,
b,c)||this;h.label_color=h.label_color||new a.Color("e0e4e8",b.evaluator);h.label_text_color=h.label_text_color||new a.Color("000000",b.evaluator);h.options=c.options||"";e=h.parser;f=h.evaluator;h.ok=0;h.tabindex=++h.parent.tabindex;h.answer&&(h.answer.match("krypto_")&&(h.answer=(new a.Krypto).decode(h.answer.substring(7))),h.answer=parseInt(h.answer.split(",")[0].replace("[",""))||0);h.name_str=h.name;h.name.match(/^\[.*\]?/)?h.name=h.parser.parse(h.name.substring(1,h.name.length-1)):h.name=h.parser.parse("'"+
h.name+"'");var m=h;h.evaluator.setFunction(h.id+".setOptions",d);h.containerControl=a.newHTML("div",{class:"DescartesMenuContainer",id:h.id});h.label=a.newHTML("canvas",{class:"DescartesMenuLabel"});h.label_ctx=h.label.getContext("2d");h.ratio=b.ratio;h.select=a.newHTML("select",{id:h.id+"_menuSelect",class:"DescartesMenuSelect",tabindex:h.tabindex});h.field=a.newHTML("input",{type:"text",id:h.id+"_menuField",class:"DescartesMenuField",tabindex:h.tabindex});d(h.options);h.containerControl.appendChild(h.label);
h.containerControl.appendChild(h.select);h.visible&&h.containerControl.appendChild(h.field);h.cover=a.newHTML("div",{class:"TextfieldCover"});h.keyboard&&h.visible&&h.containerControl.appendChild(h.cover);h.addControlContainer(h.containerControl);h.addEvents();h.init();return h};$jscomp.inherits(v,a.Control);v.prototype.init=function(b){f=this.evaluator;this.label.innerHTML=f.eval(this.name).toString();var c=this.label.textContent;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=0,h=0;this.value=b?this.value:f.eval(this.valueExpr);
this.indexValue=this.getIndex(this.value);for(var m=0,g=this.menuOptions.length;m<g;m++)b=a.getTextWidth(f.eval(this.menuOptions[m]).toString(),this.fieldFontSize+"px "+a.sansserif_font),b>d&&(d=b,h=m);d+=25;b=a.getTextWidth(this.formatOutputValue(f.eval(this.strValue[h])),this.fieldFontSize+"px "+a.sansserif_font)+7;h=this.text_object.textNodes.metrics.w+parseInt(this.fieldFontSize);""==c&&(h=0);this.visible||(b=0);for(c=this.w-b-h;c<d&&0<h;)h--,c++;for(;c<d&&0<b;)b--,c++;for(;h+c+b+1<this.w;)c++,
b++;d=h;m=d+c;b=this.w-m;g=this.formatOutputValue(f.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:"+h+"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=h*this.ratio;this.label.height=
this.h*this.ratio;this.field.value=g;this.field.setAttribute("style","font-size:"+this.fieldFontSize+"px;width:"+b+"px;height:"+this.h+"px;left:"+m+"px;");this.cover.setAttribute("style","width:"+b+"px;height:"+this.h+"px;left:"+m+"px;");this.select.setAttribute("style","text-align:left;font-size:"+this.fieldFontSize+"px;width:"+c+"px;height:"+this.h+"px;left:"+d+"px;");this.select.selectedIndex=this.indexValue;f.setVariable(this.id,parseFloat(g.replace(this.parent.decimal_symbol,".")));this.update()};
v.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?!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=f.eval(this.menuOptions[a]);
this.value=f.getVariable(this.id);isNaN(this.value)&&(this.value=0);this.field.value=this.formatOutputValue(this.value);f.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);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)};v.prototype.customSplit=function(a){k=
!1;l="";b=0;for(h=-1;b<a.length;){d=a.charAt(b);if("["===d&&-1===h){if(k||""!=l)l+="\u00a6";h++}else"["===d?h++:"]"===d&&0===h?(k=!0,h--):"]"==a.charAt(b)&&(h=0>h?h:h-1);l+=a.charAt(b);b++}return l.split("\u00a6")};v.prototype.getIndex=function(a){a=parseFloat(a.toString().replace(this.parent.decimal_symbol,"."));q=-1;p=Infinity;for(var b=0,d=this.strValue.length;b<d;b++)c=g(a-parseFloat(this.evaluator.eval(this.strValue[b]))),c<=p&&(p=c,q=b);return q};v.prototype.changeValue=function(){this.activeIfValue&&
(this.evaluator.setVariable(this.id,this.value),this.updateAndExecAction())};v.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);this.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()});this.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())});this.field.addEventListener("blur",function(a){b.drawIfValue&&b.changeValue(b.field.value,!0)});b.field.addEventListener("click",function(a){this.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=v;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.floor,e,f,q,p,c,k,l,b,h,d,v,r,u,A,n,m,w,x,y=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(y,a.Control);y.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));q=
this.formatOutputValue(this.value);p=this.evaluator.eval(this.expresion);this.x=p[0][0];this.y=p[0][1];4==p[0].length&&(this.w=p[0][2],this.h=p[0][3]);this.orientation=this.w>=this.h?"h":"v";this.initScroll(q);this.changeScrollPositionFromValue();this.prePos=this.pos;e.setVariable(this.id,this.value)};y.prototype.initScroll=function(b){f=this;e=f.evaluator;f.label.innerHTML=e.eval(f.name).toString();x=this.label.textContent;var c="v"===f.orientation?parseInt(19+5*(f.h-100)/100):f.h;f.fieldFontSize=
0<e.eval(f.font_size)?e.eval(f.font_size):"v"===f.orientation?c-parseInt(f.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},f.name_str);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),
0,0,!0);b=a.getTextWidth(b+"_",f.fieldFontSize+"px "+a.sansserif_font);var d=f.parent.getSpaceById(f.spaceID).h;f.labelHeight=""==x?0:c;f.fieldHeight=""==f.visible?0:c;if("v"===f.orientation)f.canvasWidth=f.w,f.canvasHeight=f.h-f.labelHeight-f.fieldHeight,18<=f.canvasHeight+f.y-d&&(f.canvasHeight=d),c=f.fieldHeight,b=c+f.canvasHeight,f.canvasX=0,f.canvasY=f.fieldHeight,f.labelWidth=f.w,f.labelY=b,f.upWidth=f.downW=f.w,f.upHeight=f.downH=15,f.upX=0,f.upY=f.fieldHeight,f.downX=0,f.downY=b-f.downH,f.fieldWidth=
f.w,f.fieldX=0,f.scrollHandlerW=f.w,f.scrollHandlerH=parseInt((f.canvasHeight-f.upHeight-f.downH-f.labelHeight-f.fieldHeight)/10),f.scrollHandlerH=15>f.scrollHandlerH?15:f.scrollHandlerH,f.limInf=b-f.downH-f.scrollHandlerH,f.limSup=c+f.downH;else{c=this.text_object.textNodes.metrics.w+parseInt(this.fieldFontSize);f.labelWidth=c;f.fieldWidth=b;""==x&&(f.labelWidth=0);f.visible||(f.fieldWidth=0);for(b=f.w-f.fieldWidth-f.labelWidth;58>b&&0<f.labelWidth;)f.labelWidth--,b++;for(;58>b&&0<f.fieldWidth;)f.fieldWidth--,
b++;c=f.labelWidth;d=c+b;f.fieldWidth=f.w-d;f.canvasWidth=b;f.canvasHeight=f.h;f.canvasX=f.labelWidth;f.canvasY=0;f.fieldX=f.canvasWidth+f.labelWidth;f.labelHeight=f.h;f.labelY=0;f.upWidth=f.downW=15;f.upHeight=f.downH=f.h;f.upX=d-f.downW;f.upY=0;f.downX=f.labelWidth;f.downY=0;f.scrollHandlerW=parseInt((f.canvasWidth-f.upWidth-f.downW)/10);f.scrollHandlerW=15>f.scrollHandlerW?15:f.scrollHandlerW;f.scrollHandlerH=f.h;f.limInf=c+f.downW;f.limSup=c+f.canvasWidth-f.downW-f.scrollHandlerW}f.container.setAttribute("style",
"width:"+f.w+"px;height:"+f.h+"px;left:"+f.x+"px;top:"+f.y+"px;z-index:"+f.zIndex+";");f.canvas.setAttribute("width",f.w+"px");f.canvas.setAttribute("height",f.h+"px");f.canvas.setAttribute("style","position:absolute;left:0;top:0;");f.ctx=f.canvas.getContext("2d");f.ctx.imageSmoothingEnabled=!1;f.divUp.setAttribute("style","width:"+f.upWidth+"px;height:"+f.upHeight+"px;left:"+f.upX+"px;top:"+f.upY+"px;");f.divDown.setAttribute("style","width:"+f.downW+"px;height:"+f.downH+"px;left:"+f.downX+"px;top:"+
f.downY+"px;");f.scrollHandler.setAttribute("style","width:"+f.scrollHandlerW+"px;height:"+f.scrollHandlerH+"px;left:"+("v"===f.orientation?0:f.limInf)+"px;top:"+("v"===f.orientation?f.limInf:0)+"px;");f.field.setAttribute("style","font-size:"+f.fieldFontSize+"px;width:"+f.fieldWidth+"px;height:"+f.fieldHeight+"px;left:"+f.fieldX+"px;top:0;");f.cover.setAttribute("style","width:"+f.fieldWidth+"px;height:"+f.fieldHeight+"px;left:"+f.fieldX+"px;top:0;");0===f.fieldHeight&&(f.field.style.display="none");
f.label.setAttribute("style","font-size:"+f.fieldFontSize+"px;width:"+f.labelWidth+"px;height:"+f.labelHeight+"px;line-height:"+f.labelHeight+"px;left:0;top:"+f.labelY+"px;background-color:"+this.label_color.getColor()+";color:"+this.label_text_color.getColor()+";");this.label.width=f.labelWidth*this.ratio;this.label.height=f.labelHeight*this.ratio};y.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);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)};y.prototype.draw=function(){f=this;c=f.ctx;l=g(this.w);k=g(this.h);c.fillStyle="#e0e4e8";c.fillRect(0,0,l,k);c.strokeStyle="#7a8a99";c.fillStyle="#ccdcec";f.down&&c.fillRect(f.downX+.5,f.downY+.5,f.downW,f.downH-1);c.strokeRect(f.downX+.5,f.downY+.5,f.downW,f.downH-1);f.up&&c.fillRect(f.upX+.5,f.upY-.5,f.upWidth,f.upHeight+1);c.strokeRect(f.upX+.5,f.upY-.5,f.upWidth,f.upHeight+1);b=4;c.fillStyle=
"black";c.beginPath();"h"===f.orientation?(c.moveTo(f.downX+b,f.downH/2),c.lineTo(f.downX+f.downW-b,b),c.lineTo(f.downX+f.downW-b,f.downH-b),c.moveTo(f.upX+f.upWidth-b,f.downH/2),c.lineTo(f.upX+b,b),c.lineTo(f.upX+b,f.downH-b),c.fill(),f.activeIfValue&&(h=g(f.pos),c.fillStyle="#ccdcec",c.fillRect(h+.5,0,g(f.scrollHandlerW),k),c.strokeStyle="#6382bf",c.strokeRect(h+.5,0,g(f.scrollHandlerW),k),d=g(f.scrollHandlerW/2),c.beginPath(),c.moveTo(h+d+.5-2,3),c.lineTo(h+d+.5-2,k-3),c.moveTo(h+d+.5,3),c.lineTo(h+
d+.5,k-3),c.moveTo(h+d+.5+2,3),c.lineTo(h+d+.5+2,k-3),c.stroke())):(c.moveTo(f.downX+f.downW/2,f.downY+f.downH-b),c.lineTo(f.downX+b,f.downY+b),c.lineTo(f.downX+f.downW-b,f.downY+b),c.moveTo(f.upX+f.upWidth/2,f.upY+b),c.lineTo(f.upX+b,f.upY+f.upHeight-b),c.lineTo(f.upX+f.upWidth-b,f.upY+f.upHeight-b),c.fill(),f.activeIfValue&&(h=g(f.pos),c.fillStyle="#ccdcec",c.fillRect(0,h+.5,l,g(f.scrollHandlerH)),c.strokeStyle="#6382bf",c.strokeRect(0,h+.5,l,g(f.scrollHandlerH)),d=g(f.scrollHandlerH/2),c.beginPath(),
c.moveTo(3,h+d+.5-2),c.lineTo(l-3,h+d+.5-2),c.moveTo(3,h+d+.5),c.lineTo(l-3,h+d+.5),c.moveTo(3,h+d+.5+2),c.lineTo(l-3,h+d+.5+2),c.stroke()));c.strokeRect(.5,.5,l-1,k-1);f.activeIfValue||(c.fillStyle="rgba(240,240,240,"+160/255+")",c.fillRect(0,0,l,k.h))};y.prototype.validateValue=function(a){e=this.evaluator;v=a.toString();v=parseFloat(v.replace(this.parent.decimal_symbol,"."));isNaN(v)&&(v=0);this.minimo=e.eval(this.min);v<this.minimo&&(this.value=null,v=this.minimo);this.maximo=e.eval(this.max);
v>this.maximo&&(this.value=null,v=this.maximo);r=this.incr;v=0!=r?v*r/r:0;this.fixed&&(v=parseFloat(parseFloat(v).toFixed(e.eval(this.decimals))));return v};y.prototype.increase=function(){this.changeValue(parseFloat(this.value)+this.incr)};y.prototype.decrease=function(){this.changeValue(parseFloat(this.value)-this.incr)};y.prototype.increase10=function(){b=(this.evaluator.eval(this.max)-this.evaluator.eval(this.min))/10;"h"==this.orientation?this.clickPos.x>this.prePos&&this.changeValue(parseFloat(this.value)+
b):this.clickPos.y<this.prePos&&this.changeValue(parseFloat(this.value)+b)};y.prototype.decrease10=function(){b=(this.evaluator.eval(this.max)-this.evaluator.eval(this.min))/10;"h"==this.orientation?this.clickPos.x<this.prePos&&this.changeValue(parseFloat(this.value)-b):this.clickPos.y>this.prePos&&this.changeValue(parseFloat(this.value)-b)};y.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())};y.prototype.changeValueForScrollMovement=function(){e=this.evaluator;A=this.limInf;n=this.limSup;m=e.eval(this.min);w=e.eval(this.max);r=this.incr;u=g((this.pos-A)*(w-m)/(n-A)/r)*r+m;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())};y.prototype.changeScrollPositionFromValue=
function(){e=this.evaluator;A=this.limInf;n=this.limSup;m=e.eval(this.min);w=e.eval(this.max);r=this.incr;this.pos=(this.value-m)*(n-A)/(w-m)+A;this.scrollHandler.style["h"==this.orientation?"left":"top"]=this.pos+"px"};y.prototype.addEvents=function(){function b(c,d,h,f){a.clearTimeout(u);(n.up||n.down||n.canvasClick)&&1E-7<Math.abs(n.value-f)&&(d.call(n),c=h?c:30,u=a.setTimeout(function(){b(c,d,!1,f)},c))}function c(c){c.preventDefault();n.whichBtn=a.whichBtn(c);"L"==n.whichBtn&&n.activeIfValue&&
(n.clickPos=a.getCursorPosition(c,n.container),n.canvasClick=!0,"h"==n.orientation?n.clickPos.x<n.prePos?b(350,n.decrease10,!0,n.minimo):b(350,n.increase10,!0,n.maximo):n.clickPos.y<n.prePos?b(350,n.increase10,!0,n.maximo):b(350,n.decrease10,!0,n.minimo))}function d(b){n.canvasClick=!1;a.clearTimeout(u)}function h(b){1==n.canvasClick&&(n.clickPos=a.getCursorPosition(b,n.container),b.preventDefault())}function f(a){n.scrollClick=!1;n.prePos=n.pos;window.removeEventListener("mouseup",f,!1);window.removeEventListener("mousemove",
g,!1);a.preventDefault()}function m(a){n.scrollClick=!1;n.prePos=n.pos;window.removeEventListener("touchend",m,!1);window.removeEventListener("touchmove",g,!1);a.preventDefault()}function g(b){var c=a.getCursorPosition(b,n.container);"h"==n.orientation?(n.pos=n.prePos-(n.initPos.x-c.x),n.pos<n.limInf&&(n.pos=n.limInf),n.pos>n.limSup&&(n.pos=n.limSup),n.scrollHandler.setAttribute("style","width:"+n.scrollHandlerW+"px;height:"+n.h+"px;left:"+n.pos+"px;top:0;")):(n.pos=n.prePos-(n.initPos.y-c.y),n.pos>
n.limInf&&(n.pos=n.limInf),n.pos<n.limSup&&(n.pos=n.limSup),n.scrollHandler.setAttribute("style","width:"+n.w+"px;height:"+n.scrollHandlerH+"px;left:0;top:"+n.pos+"px;"));n.changeValueForScrollMovement();b.preventDefault()}function e(c){c.preventDefault();n.whichBtn=a.whichBtn(c);"L"==n.whichBtn&&n.activeIfValue&&(n.up=!0,b(350,n.increase,!0,n.maximo))}function k(c){c.preventDefault();n.whichBtn=a.whichBtn(c);"L"==n.whichBtn&&n.activeIfValue&&(n.down=!0,b(350,n.decrease,!0,n.minimo))}function l(b){n.down=
!1;a.clearTimeout(u);b.preventDefault()}function r(b){n.up=!1;a.clearTimeout(u);n.draw()}function p(b){n.down=!1;a.clearTimeout(u);n.draw()}var n=this,u;n.canvas.oncontextmenu=n.divUp.oncontextmenu=n.divDown.oncontextmenu=n.label.oncontextmenu=n.field.oncontextmenu=n.scrollHandler.oncontextmenu=n.cover.oncontextmenu=function(){return!1};this.field.addEventListener("keydown",function(a){13==a.keyCode&&n.changeValue(n.field.value)});this.field.addEventListener("blur",function(a){n.drawIfValue&&n.changeValue(n.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",h);this.canvas.addEventListener("mousemove",h);this.scrollHandler.addEventListener("touchstart",function(b){n.activeIfValue&&(n.scrollClick=!0,n.initPos=a.getCursorPosition(b,n.container),window.addEventListener("touchend",m),window.addEventListener("touchmove",
g),b.preventDefault())});this.scrollHandler.addEventListener("mousedown",function(b){n.activeIfValue&&(n.scrollClick=!0,n.initPos=a.getCursorPosition(b,n.container),window.addEventListener("mouseup",f),window.addEventListener("mousemove",g),b.preventDefault())});this.divUp.addEventListener("touchstart",e);this.divUp.addEventListener("mousedown",e);this.divDown.addEventListener("touchstart",k);this.divDown.addEventListener("mousedown",k);this.divUp.addEventListener("mouseout",function(b){n.up=!1;a.clearTimeout(u);
b.preventDefault()});this.divDown.addEventListener("mouseout",l);window.addEventListener("touchend",r);window.addEventListener("mouseup",r);window.addEventListener("touchend",p);window.addEventListener("mouseup",p);n.cover.addEventListener("click",function(a){a=n.evaluator.eval(n.kbexp);n.activeIfValue&&n.parent.keyboard.show(n,n.kblayout,a[0][0]||0,a[0][1]||0,n.id,n.field,n.onlyText)})};a.Scrollbar=y;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,e,f=function(f,g){var c=a.Control.call(this,f,g)||this;c.controls=g.controls||!0;c.file=g.file||"";c.oldDrawIf=0;f=c.evaluator.eval(c.expresion);4==f[0].length?(c.w=f[0][2],c.h=f[0][3]):(c.w=200,c.h=28);c.audio=c.parent.getAudio(c.file);c.oldFile=c.file;"]"===c.file.charAt(c.file.length-1)&&(c.file=c.evaluator.parser.parse(c.file.substring(1,c.file.length-1)));c.autoplay&&(c.audio.setAttribute("autoplay","autoplay"),c.audio.play());c.loop&&c.audio.setAttribute("loop",
"loop");c.controls&&c.audio.setAttribute("controls","controls");c.audio.setAttribute("style","position:absolute;width:"+c.w+"px;left:"+c.x+"px;top:"+c.y+"px;z-index:"+c.zIndex+";");c.addControlContainer(c.audio);c.evaluator.setFunction(c.id+".play",function(){try{c.audio.play()}catch(k){}return 0});c.evaluator.setFunction(c.id+".pause",function(){try{c.audio.pause()}catch(k){}return 0});c.evaluator.setFunction(c.id+".stop",function(){try{c.audio.pause(),c.audio.currentTime=0}catch(k){}return 0});
c.evaluator.setFunction(c.id+".currentTime",function(a){try{c.audio.currentTime=parseFloat(a)}catch(l){}return 0});c.audio.addEventListener("timeupdate",function(a){c.evaluator.setVariable(c.id+".currentTime",c.audio.currentTime);c.evaluator.setVariable(c.id+".playing",c.audio.paused?0:1);c.evaluator.setVariable(c.id+".duration",c.audio.duration)});return c};$jscomp.inherits(f,a.Control);f.prototype.init=function(){this.audio.style.left=this.x+"px";this.audio.style.top=this.y+"px";this.update()};
f.prototype.update=function(){g=this.evaluator;"string"!==typeof this.file&&(this.tmpFile=g.eval(this.file),this.oldFile!==this.tmpFile&&(this.oldFile=this.audio.src=this.tmpFile));(e=0<g.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=f;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,e,f=function(f,e){var c=a.Control.call(this,f,e)||this;c.controls=e.controls||!0;c.file=e.file||"";c.oldDrawIf=0;g=c.evaluator;f=g.eval(c.expresion);4==f[0].length?(c.w=f[0][2],c.h=f[0][3]):(c.w=null,c.h=null);f=c.file;e=f.lastIndexOf(".");-1!=e&&(f=c.file.substring(0,e));c.video=a.newHTML("video",{poster:f+".png",style:"position:absolute;overflow:hidden;left:"+c.x+"px;top:"+c.y+"px;outline:none;background:rgba(0,0,0,0);"});c.autoplay&&c.video.setAttribute("autoplay",
"autoplay");c.loop&&c.video.setAttribute("loop","loop");c.controls&&c.video.setAttribute("controls","controls");c.w&&(c.video.setAttribute("width",c.w),c.video.setAttribute("height",c.h));c.video.canPlayType("video/mp4")&&(e=a.newHTML("source",{src:f+".mp4",type:"video/mp4"}),c.video.appendChild(e));c.video.canPlayType("video/ogg")&&(e=a.newHTML("source",{src:f+".ogg",type:"video/ogg"}),c.video.appendChild(e),e=a.newHTML("source",{src:f+".ogv",type:"video/ogg"}),c.video.appendChild(e));c.video.canPlayType("video/webm")&&
(e=a.newHTML("source",{src:f+".webm",type:"video/webm"}),c.video.appendChild(e));c.addControlContainer(c.video);g.setFunction(c.id+".play",function(){try{c.video.play()}catch(k){}return 0});g.setFunction(c.id+".pause",function(){try{c.video.pause()}catch(k){}return 0});g.setFunction(c.id+".stop",function(){try{c.video.pause(),c.video.currentTime=0}catch(k){}return 0});g.setFunction(c.id+".currentTime",function(a){try{c.video.currentTime=parseFloat(a)}catch(l){}return 0});c.video.addEventListener("timeupdate",
function(a){g.setVariable(c.id+".currentTime",c.video.currentTime)});return c};$jscomp.inherits(f,a.Control);f.prototype.init=function(){this.video.style.left=this.x+"px";this.video.style.top=this.y+"px";this.update()};f.prototype.update=function(){g=this.evaluator;(e=0<g.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=f;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,e,f,q=function(f,c){var e=a.Control.call(this,f,c)||this;e.font_family=c.font_family||"Monospaced";e.style=c.style||",PLAIN,";e.font_size=c.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.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 g=e.parent.lessonParser.parseText(e.answer)}e.containerControl=
a.newHTML("div",{class:"DescartesTextAreaContainer",id:e.id,spellcheck:"false"});e.textArea=a.newHTML("div",{class:"DescartesTextAreaContainer",contenteditable:"true"});e.textAreaAnswer=a.newHTML("div",{class:"DescartesTextAreaContainer"});e.showButton=a.newHTML("div",{class:"DJS_Gradient"});e.activeCover=a.newHTML("div");e.containerControl.appendChild(e.textArea);e.containerControl.appendChild(e.textAreaAnswer);e.containerControl.appendChild(e.showButton);e.containerControl.appendChild(e.activeCover);
e.addControlContainer(e.containerControl);e.showAnswer=!1;e.text=void 0==e.text||"simpleText"==e.text.type?e.rawText||"":e.text.hasFormula?e.rawText:e.text.toHTML();g&&"simpleText"!==g.type&&(e.answer=e.text.hasFormula?"":g.toHTML());e.evaluator.setVariable(e.id,e.text);var b,h,d;e.evaluator.setFunction(e.id+".insertAtCursor",function(a){(b=window.getSelection())&&b.getRangeAt&&b.rangeCount&&(d=document.createTextNode(a),h=b.getRangeAt(0),h.deleteContents(),h.insertNode(d),h.setStart(d,d.length),
h.setEnd(d,d.length),b.removeAllRanges(),b.addRange(h),e.textArea.focus());return 0});e.evaluator.setFunction(e.id+".update",function(){e.update()});e.addEvents();e.init();return e};$jscomp.inherits(q,a.Control);q.prototype.init=function(){e=this.answer?28:4;g=this.evaluator;var f=this.text.match(/<span/)?this.text:this.text.replace(/\\n/g,"<br/>");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 c=
"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",c);this.textArea.innerHTML=f;this.textAreaAnswer.setAttribute("style",c+"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.activeCover.setAttribute("style","position:absolute;width:"+this.w+"px;height:"+this.h+"px;left:"+this.x+"px;top:"+this.y+"px;");this.update()};q.prototype.update=function(){g=this.evaluator;this.activeIfValue=0<g.eval(this.activeif);this.drawIfValue=0<g.eval(this.drawif);g.getVariable(this.id)!==this.oldValue&&(this.textArea.innerText=
(g.getVariable(this.id)||"").replace(/\\n/g,"\n"));f=this.textArea.innerText||"";f="\n"===f.charAt(f.length-1)?f.substring(0,f.length-1):f;f=f.replace(/\n/g,"\\n").replace(/\s/g," ");g.setVariable(this.id,f);this.oldFieldValue=f;this.oldValue=g.getVariable(this.id);this.activeCover.style.display=this.activeIfValue?"none":"block";this.containerControl.style.display=this.drawIfValue?"block":"none";this.updatePositionAndSize()};q.prototype.addEvents=function(){function a(a){a.preventDefault()}var c=
this;this.showButton.addEventListener("mousedown",function(a){a.preventDefault();c.showAnswer=!c.showAnswer;c.textAreaAnswer.style.display=c.showAnswer?"block":"none";c.showButton.childNodes[0].childNodes[0].textContent=c.showAnswer?"T":"S"});this.showButton.addEventListener("mouseup",a);this.showButton.addEventListener("mouseout",a);this.textArea.addEventListener("blur",function(){var a=window.getSelection();c.cursorInd=a.focusOffset});this.textArea.addEventListener("paste",function(a){a.preventDefault();
document.execCommand("insertHTML",!1,a.clipboardData.getData("text/plain").replace(/\n/g,"<br>"))});this.textArea.addEventListener("keydown",function(a){if("PageDown"===a.key||"PageUp"===a.key)a.stopPropagation(),a.preventDefault()})};a.TextArea=q;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=2*Math.PI,e,f,q,p,c,k,l,b,h,d,v,r,u=function(b,c){var h=a.Control.call(this,b,c)||this;f=b.evaluator.parser;h.spaceID=c.spaceID||"";h.text=c.text||"";h.size=c.size||f.parse("4");h.font=c.font||"Serif,PLAIN,12";h.image=new Image;h.image.onload=function(){this.ready=1};h.imageSrc=c.imageSrc||"";h.imageSrc.match(/^\[.*\]?/)?h.imageSrc=h.parser.parse(h.imageSrc.substring(1,h.imageSrc.length-1)):h.imageSrc=h.parser.parse("'"+h.imageSrc+"'");h.font=a.convertFont(h.font);
if(h.constraintExpr){h.constraint=f.parse(h.constraintExpr);"(expr)"==h.constraint.type&&(h.constraint=f.parse(h.constraintExpr.substring(1,h.constraintExpr.length-1)));if("compOperator"==h.constraint.type){c=h.constraint.childs[0];var e=h.constraint.childs[1];"identifier"!=c.type||"y"!=c.value||e.contains("y")?"identifier"!=c.type||"x"!=c.value||e.contains("x")?h.newt=new a.R2Newton(h.evaluator,h.constraint):(h.constVar="y",h.noConstVar="x",h.evalConst=h.evalConstXoY,h.constraint=e):(h.constVar=
"x",h.noConstVar="y",h.evalConst=h.evalConstXoY,h.constraint=e)}else h.constraint=null;d=new a.R2(0,0)}h.container=h.getContainer();h.mouseCatcher=a.newHTML("div",{class:"DescartesGraphicControl",id:h.id,dragged:!0,tabindex:"-1",style:"cursor:pointer;background-color:transparent;z-index:"+h.zIndex+";"});h.ctx=h.space.ctx;h.container.appendChild(h.mouseCatcher);h.addEvents();h.xStr=h.id+".x";h.yStr=h.id+".y";h.activoStr=h.id+".activo";h.activeStr=h.id+".active";""!==h.space.id&&2!==b.version?(h.mxStr=
h.space.id+".mouse_x",h.myStr=h.space.id+".mouse_y",h.mclickedStr=h.space.id+".mouse_clicked",h.mclicizquierdoStr=h.space.id+".clic_izquierdo"):(h.mxStr="mouse_x",h.myStr="mouse_y",h.mclickedStr="mouse_clicked",h.mclicizquierdoStr="clic_izquierdo");h.init();return h};$jscomp.inherits(u,a.Control);u.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()};u.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);q=this.space.getAbsoluteX(this.x);p=this.space.getAbsoluteY(this.y);this.mouseCatcher.style.display=this.activeIfValue?"block":"none";this.mouseCatcher.style.left=parseInt(q-this._w/2)+"px";this.mouseCatcher.style.top=parseInt(p-this._h/2)+"px";this.constraint&&this.evalConst();this.draw()};u.prototype.draw=function(){e=this.evaluator;this.drawIfValue&&(b=this.ctx,h=this.space.backgroundCtx,
q=parseInt(this.space.getAbsoluteX(this.x))+.5,p=parseInt(this.space.getAbsoluteY(this.y))+.5,""!=this.text&&this.drawText(q,p),this.image.ready?(c=this.image.width/2,k=this.image.height/2,this.image.complete&&!this.setImage&&b.drawImage(this.image,parseInt(q-c),parseInt(p-k)),this.trace&&(h.save(),h.translate(q,p),h.scale(parseInt(c),parseInt(k)),h.beginPath(),h.arc(0,0,1,0,g),h.restore(),h.lineWidth=1,h.strokeStyle=this.trace.getColor(),h.stroke())):(c=parseInt(this.width/2),b.beginPath(),b.arc(q,
p,c,0,g),b.fillStyle=this.colorInt.getColor(),b.fill(),b.lineWidth=1,b.strokeStyle=this.color.getColor(),b.stroke(),this.active&&(b.strokeStyle=this.colorInt.borderColor(),b.beginPath(),b.arc(q,p,c-2,0,g),b.stroke()),this.trace&&(h.strokeStyle=this.trace.getColor(),h.beginPath(),h.arc(q,p,c,0,g),h.stroke())))};u.prototype.evalConst=function(){d.set(this.x,this.y);l=this.newt.findZero(d,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)};u.prototype.evalConstXoY=function(){e=this.evaluator;r=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,r)};u.prototype.drawText=function(a,c){b=this.ctx;e=this.evaluator;"simpleText"==this.text.type?(b.fillStyle=this.color.getColor(),b.font=this.font,b.textBaseline="alphabetic",b.fillText(this.text.toString(e.eval(this.decimals),
this.fixed),parseInt(a+1+this.width/2),parseInt(c-1-this.height/2))):(b.fillStyle=this.color.getColor(),b.strokeStyle=this.color.getColor(),b.textBaseline="alphabetic",this.text.draw(b,parseInt(a+1+this.width/2),parseInt(c-1-this.height/2),this.decimals,this.fixed,"start",!0,this.color.getColor()))};u.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};u.prototype.deactivate=function(){this.active=!1;this.evaluator.setVariable(this.activoStr,0);this.evaluator.setVariable(this.activeStr,0);this.evaluator.setVariable(this.mclicizquierdoStr,0)};u.prototype.addEvents=function(){function b(b){document.body.focus();b.preventDefault();e.whichBtn=a.whichBtn(b);"L"==e.whichBtn&&e.activeIfValue&&(e.parent.deactivateGraphicControls(),e.click=e.active=!0,e.evaluator.setVariable(e.activoStr,
1),e.evaluator.setVariable(e.activeStr,1),e.evaluator.setVariable(e.mclickedStr,0),e.evaluator.setVariable(e.mclicizquierdoStr,0),e.posAnte=a.getCursorPosition(b,e.container),e.prePos={x:e.space.getAbsoluteX(e.x),y:e.space.getAbsoluteY(e.y)},e.evaluator.setVariable(e.mxStr,e.space.getRelativeX(e.posAnte.x)),e.evaluator.setVariable(e.myStr,e.space.getRelativeY(e.posAnte.y)),e.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();e.evaluator.setVariable(e.mclickedStr,1);e.evaluator.setVariable(e.mclicizquierdoStr,1);if(e.activeIfValue||e.active)e.click=!1,window.removeEventListener("mouseup",c),window.removeEventListener("mousemove",d),window.removeEventListener("touchend",c),window.removeEventListener("touchmove",d),f=a.getCursorPosition(b,e.container)||f,e.posX=e.prePos.x-(e.posAnte.x-f.x),e.posY=e.prePos.y-
(e.posAnte.y-f.y),e.evaluator.setVariable(e.xStr,e.space.getRelativeX(e.posX)),e.evaluator.setVariable(e.yStr,e.space.getRelativeY(e.posY)),e.evaluator.setVariable(e.mxStr,e.space.getRelativeX(f.x)),e.evaluator.setVariable(e.myStr,e.space.getRelativeY(f.y)),e.parent.updateControls(),e.parent.update(),e.mouseCatcher.style.left=e.space.getAbsoluteX(e.x)-e._w/2+"px",e.mouseCatcher.style.top=e.space.getAbsoluteY(e.y)-e._h/2+"px";b=e.evaluator.getVariable(e.activeStr);e.parent.deactivateGraphicControls();
e.parent.updateControls();e.evaluator.setVariable(e.activoStr,b);e.evaluator.setVariable(e.activeStr,b);e.parent.update()}function d(b){b.preventDefault();e.evaluator.setVariable(e.mclickedStr,0);e.evaluator.setVariable(e.mclicizquierdoStr,0);f=a.getCursorPosition(b,e.container);e.posX=e.prePos.x-(e.posAnte.x-f.x);e.posY=e.prePos.y-(e.posAnte.y-f.y);e.evaluator.setVariable(e.xStr,e.space.getRelativeX(e.posX));e.evaluator.setVariable(e.yStr,e.space.getRelativeY(e.posY));e.evaluator.setVariable(e.mxStr,
e.space.getRelativeX(f.x));e.evaluator.setVariable(e.myStr,e.space.getRelativeY(f.y));80<Date.now()-h&&(e.parent.updateControls(),e.parent.update(),h=Date.now())}var h=0,f,e=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){e.over=!0});this.mouseCatcher.addEventListener("mouseout",function(a){e.over=
!1;e.click=!1})};a.GraphicControl=u;return a}(descartesJS||{});
descartesJS=function(a,g){var e,f,q,p,c,k,l,b,h,d;function v(a){return a.charAt(0).toUpperCase()+a.substring(1)}if(a.loadLib)return a;var r=/[\w-//]*(\.png|\.jpg|\.gif|\.svg|\.webp)/gi,u,A,n,m,w,x,y,z,G,J,E,F,D,B,L,I,M,O,H,P,C,N,K,Q,R,W,V,U,T,S=function(b){this.parent=b;this.parser=b.evaluator.parser;this.RTFparser=new a.RTFParser(b.evaluator)};S.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(n=a[c][0],m=a[c][1],A=g[n],A){case "rowsNorth":case "rowsSouth":case "widthEast":case "widthWest":case "height":b[A]=parseInt(m);break;case "about":case "config":case "init":case "clear":b[A]="true"===g[m];break;default:console.warn("Propiedad de botones no identificada: <"+n+"> valor: <"+m+">")}return b};S.prototype.parseSpace=function(b){w={};b=this.split(b);for(var c=0,d=b.length;c<d;c++)switch(n=b[c][0],m=b[c][1],A=g[n],a.DEBUG.paramName=n,a.DEBUG.objectName="Space",A){case "type":if("R2"===
m||"R3"===m)m=g[m];w[A]=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":w[A]=m;break;case "fixed":case "numbers":case "sensitive_to_mouse_movements":case "3D":case "split":case "resizable":w[A]="true"===g[m];break;case "bg_display":case "render":w[A]=g[m];break;case "border_color":case "net":case "net10":case "axes":case "text":w[A]=""!=m?"false"===g[m]?"":new a.Color(m,this.parent.evaluator):"";break;case "O.x":w.OxExpr=
m;break;case "O.y":w.OyExpr=m;break;case "image":w.imageSrc=m;break;case "x":u=m;"%"===u[u.length-1]?(w.xPercentExpr=u.trim(),u=(this.parent.container.width*parseFloat(u)/100).toString()):u=m;w.xExpr=this.parser.parse(u);break;case "y":u=m;"%"===u[u.length-1]?(w.yPercentExpr=u.trim(),u=(this.parent.container.height*parseFloat(u)/100).toString()):u=m;w.yExpr=this.parser.parse(u);break;case "width":u=m.trim();w.wModExpr=u;"%"===u[u.length-1]?(w.wExpr=u,u=this.parent.container.width*parseFloat(u)/100):
(u=parseFloat(m),u!=m&&(u=this.parent.container.width,w._w_=m.trim()));w.w=u;break;case "height":u=m.trim();w.hModExpr=u;"%"===u[u.length-1]?(w.hExpr=u,u=this.parent.container.height*parseFloat(u)/100):(u=parseFloat(m),u!=m&&(u=this.parent.container.height,w._h_=m.trim()));w.h=u;break;case "drawif":""!=m&&(w.drawif=this.parser.parse(m));break;case "scale":u=parseFloat(m);isNaN(u)&&(u=48);w.scale=u;break;case "background":w.background=new a.Color(m,this.parent.evaluator);break;default:console.warn("Propiedad del espacio no identificada: <"+
n+"> valor: <"+m+">")}return new a["Space"+w.type](this.parent,w)};S.prototype.parseControl=function(b){x={type:"Numeric",gui:"Spinner"};b=this.split(b);for(var c=0,d=b.length;c<d;c++)switch(n=b[c][0],m=b[c][1],A=g[n],a.DEBUG.paramName=n,a.DEBUG.objectName="Control",A){case "type":u=g[m.trim()];"graphic"===u?u="GraphicControl":"text"===u&&(u="TextArea");x.type=v(u);break;case "gui":u=g[m];"textfield"===u&&(u="TextField");x[A]=v(u);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":x[A]=
m;break;case "region":case "position":case "action":case "msg_pos":case "poster":case "text_align":case "image_align":case "btn_pos":x[A]=g[m];break;case "fixed":case "visible":case "discrete":case "onlyText":case "evaluate":case "autoplay":case "loop":case "controls":case "flat":case "keyboard":x[A]="true"===g[m];break;case "color":case "colorInt":case "label_color":case "label_text_color":case "trace":x[A]=new a.Color(m,this.parent.evaluator);break;case "font_size":case "drawif":case "activeif":case "decimals":case "min":case "max":case "size":""!==
m&&(x[A]=this.parser.parse(m));break;case "constraint":x.constraintExpr=m;break;case "image":x.imageSrc=m;break;case "image_dec":x.image_dec_src=m;break;case "image_inc":x.image_inc_src=m;break;case "space":x.spaceID=m;break;case "expresion":x.expresion=this.parser.parse(m.replace(")(",","));case "kbexp":x.kbexp=this.parser.parse(m.replace(")(",","));break;case "borderColor":x[A]="false"===g[m]?"":m;break;case "bold":"false"!=g[m]&&(x.bold="bold");break;case "italics":"false"!=g[m]&&(x.italics="italic");
break;case "underlined":"false"!=g[m]&&(x.underlined=!0);break;case "value":var h=m.replace(/&squot;/g,"'");h.match(/^\|/)&&(h="'"+h.substring(1),h.match(/\|$/)&&(h=h.substring(0,h.length-1)+"'"));x.valueExpr=this.parser.parse(h);x.valueExprString=h;break;case "incr":0!=m&&(x.incr=this.parser.parse(m));break;case "exponentialif":x.exponentialif=parseFloat(m);break;case "text":x.rawText=m;h=this.parseText(m);for(var e=0,f=h.length;e<f;e++)h[e]=this.parser.parse(h[e],!1);x.text=h;break;default:e=n.indexOf("."),
h=g[n.substring(0,e)],e=g[n.substring(e+1)],"parameter"===h&&"font"===e?x.parameterFont=m:"Explanation"===h&&"font"===e?x.ExplanationFont=m:"tooltip"===h&&"font"===e?x.tooltipFont=m:console.warn("Propiedad de control no identificada: <"+n+"> valor: <"+m+">")}return new a["Numeric"===x.type?x.gui:x.type](this.parent,x)};S.prototype.parseGraphic=function(b,c,d,h){y={rotateExp:h,parameter:"t"};b=this.split(b);h=0;for(var e=b.length;h<e;h++)if(n=b[h][0],m=b[h][1],A=g[n],a.DEBUG.paramName=n,a.DEBUG.objectName=
"Graphic",""!=m)switch(A){case "type":a.DEBUG.idName=m;y[A]=v(g[m]);break;case "align":case "anchor":case "lineDash":y[A]=g[m];break;case "background":case "abs_coord":case "visible":case "editable":case "fixed":case "vectors":case "bold":case "italics":case "underlined":y[A]="true"===g[m];break;case "shadowColor":case "color":case "fill":case "fillP":case "fillM":case "arrow":case "trace":y[A]="false"===g[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":y[A]=
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&&(y[A]=this.parser.parse(m));break;case "font_size":m=m.trim();m.match(/^\[.*\]?/)&&(m=m.substring(1,m.length-1));""!==m&&(y[A]=this.parser.parse(m));break;case "space":y.spaceID=m;break;case "expresion":""!==m&&("Macro"!==y.type?(y.expresion=this.parser.parse(m),y.expresionString=m):y.expresion=m);break;
case "text":y.text=m;break;case "file":var f=m.replace(/&squot;/g,"'");"["===f.charAt(0)&&"]"===f.charAt(f.length-1)&&(f=f.substring(1,f.length-1));f.match(r)&&(f="'"+f+"'");y.file=this.parser.parse(f);break;case "border":""!=m&&"false"!=g[m]&&(y.border=new a.Color(m,this.parent.evaluator));break;default:if(void 0!=y.family&&n.substring(0,y.family.length+1)===y.family+".")switch(g[n.substring(y.family.length+1)]){case "interval":""!=m&&(y.family_interval=this.parser.parse(m));break;case "steps":""!=
m&&(y.family_steps=this.parser.parse(m))}else if(void 0!=y.parameter&&n.match(y.parameter+"."))switch(y.parameter!==n.substring(0,n.indexOf(y.parameter)+y.parameter.length)&&(y.parameter=n.substring(0,n.indexOf(y.parameter)+y.parameter.length)),g[n.substring(y.parameter.length+1)]){case "interval":""!=m&&(y.parameter_interval=this.parser.parse(m));break;case "steps":""!=m&&(y.parameter_steps=this.parser.parse(m))}else console.warn("Propiedad del gr\u00e1fico no identificada: <"+n+"> valor: <"+m+">")}c&&
(y.abs_coord=c);d&&(y.background=d);return new a[y.type](this.parent,y)};S.prototype.parse3DGraphic=function(b,c,d,h){y={rotateExp:h,parameter:"t"};b=this.split(b);c=0;for(d=b.length;c<d;c++)switch(n=b[c][0],m=b[c][1],A=g[n],a.DEBUG.paramName=n,a.DEBUG.objectName="Graphic3D",A){case "type":a.DEBUG.idName=m;u=g[m];switch(u){case "cube":case "box":case "tetrahedron":case "octahedron":case "sphere":case "dodecahedron":case "icosahedron":case "ellipsoid":case "cone":case "cylinder":case "torus":case "mesh":y.subType=
u,u="OtherGeometry"}y[A]=v(u);break;case "model":case "align":case "anchor":case "lineDash":y[A]=g[m];break;case "shadowColor":case "fill":y[A]="false"===g[m]?"":new a.Color(m,this.parent.evaluator);break;case "background":case "fixed":case "split":case "bold":case "italics":case "underlined":y[A]="true"===g[m];break;case "edges":"false"===g[m]?y[A]="":("true"===g[m]&&(m="808080"),y[A]=new a.Color(m,this.parent.evaluator));break;case "border":""!=m&&"false"!=g[m]&&(y.border=new a.Color(m,this.parent.evaluator));
break;case "color":case "backcolor":y[A]=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&&(y[A]=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":y[A]=
m;break;case "space":y.spaceID=m;break;case "expresion":"Macro"!=y.type&&"Curve"!=y.type&&"Surface"!=y.type?(y.expresion=this.parser.parse(m),y.expresionString=m):y.expresion=m.replace(/\\n/g,";");break;case "text":y.text=m;break;case "file":h=m.replace(/&squot;/g,"'");"["===h.charAt(0)&&"]"===h.charAt(h.length-1)&&(h=h.substring(1,h.length-1));h.match(/./)&&(h="'"+h+"'");y.file=this.parser.parse(h);break;default:void 0!==y.family&&n.substring(0,y.family.length+1)===y.family+"."?"interval"===g[n.substring(y.family.length+
1)]?""!=m&&(y.family_interval=this.parser.parse(m)):""!=m&&(y.family_steps=this.parser.parse(m)):console.warn("Propiedad del gr\u00e1fico 3D no identificada: <"+n+"> valor: <"+m+">")}return new a[y.type+"3D"](this.parent,y)};S.prototype.parseAuxiliar=function(b){z={};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(n=b[c][0],m=b[c][1],A=g[n],a.DEBUG.paramName=n,a.DEBUG.objectName="Auxiliar",A){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":z[A]=m.replace(/&squot;/g,"'");break;case "editable":case "constant":case "array":case "matrix":case "algorithm":case "event":case "sequence":z[A]="true"===g[m];break;case "size":case "rows":case "columns":case "x":case "y":case "width":case "height":z[A]=this.parser.parse(m);break;case "evaluate":case "execution":case "msg_pos":case "action":case "type":z[A]=
g[m];break;default:var h=n.indexOf("."),e=g[n.substring(0,h)];h=g[n.substring(h+1)];"parameter"===e&&"font"===h?z.parameterFont=m:console.warn("Propiedad del auxiliar no identificada: <"+n+"> valor: <"+m+">")}z.sequence?z.type="sequence":z.constant?z.type="constant":z.algorithm&&z.evaluate?z.type="algorithm":z.array&&!z.matrix&&")"!=z.id.charAt(z.id.length-1)?z.type="vector":z.matrix&&")"!=z.id.charAt(z.id.length-1)?z.type="matrix":z.event&&")"!=z.id.charAt(z.id.length-1)?z.type="event":"library"===
z.type?z.type="library":")"===z.id.charAt(z.id.length-1)?z.type="function":z.type="variable";a.DEBUG.typeName=z.type;switch(z.type){case "sequence":new a.Function(this.parent,z);break;case "constant":b=new a.Constant(this.parent,z);z.evaluate&&"always"===z.evaluate&&this.parent.auxiliaries.push(b);break;case "algorithm":this.parent.auxiliaries.push(new a.Algorithm(this.parent,z));break;case "vector":b=new a.Vector(this.parent,z);z.evaluate&&"always"===z.evaluate&&this.parent.auxiliaries.push(b);break;
case "matrix":b=new a.Matrix(this.parent,z);z.evaluate&&"always"===z.evaluate&&this.parent.auxiliaries.push(b);break;case "event":this.parent.events.push(new a.Event(this.parent,z));break;case "library":new a.Library(this.parent,z);break;case "variable":new a.Variable(this.parent,z);break;default:new a.Function(this.parent,z)}};S.prototype.parseAction=function(b){G=b.action;J=b.parent;E=b.parameter;return G?new (a[v(G)])(J,E):{execute:function(){}}};S.prototype.parseAnimation=function(b){var c={};
b=this.split(b);for(var d=0,h=b.length;d<h;d++)switch(n=b[d][0],m=b[d][1],A=g[n],A){case "id":case "delay":case "init":case "doExpr":case "whileExpr":c[A]=m.replace(/&squot;/g,"'");break;case "controls":case "auto":case "loop":case "algorithm":case "evaluate":c[A]="true"===g[m];break;default:console.warn("Propiedad de la animaci\u00f3n no identificada: <"+n+">  <"+m+">")}return new a.Animation(this.parent,c)};S.prototype.parsePleca=function(g,r){g=this.split(g);f=e="";q=0;p="#536891";c="white";k=
"left";l="";b="SansSerif,BOLD,20";h="SansSerif,PLAIN,18";d=void 0;for(var u=0,v=g.length;u<v;u++)switch(n=g[u][0],m=g[u][1],n){case "title":e=m;break;case "subtitle":f=m;break;case "subtitlines":q=m;break;case "bgcolor":""!=m&&(p=(new a.Color(m,this.parent.evaluator)).getColor());break;case "fgcolor":""!=m&&(c=(new a.Color(m,this.parent.evaluator)).getColor());break;case "align":""!=m&&(k=m);break;case "titleimage":l=m;break;case "titlefont":b=""!=m?a.convertFont(m):a.convertFont(b);break;case "subtitlefont":h=
""!=m?a.convertFont(m):a.convertFont(h);break;default:console.warn("Propiedad de la pleca no identificada: <"+n+">  <"+m+">")}if(""===e&&""===f)return a.newHTML("div");O=h.substring(0,h.indexOf("px"));O=O.substring(O.lastIndexOf(" "));""!=l&&(H=this.parent.getImage(l),P=H.height);d=a.newHTML("div",{id:"descartesPleca"});P?(d.setAttribute("style","position:absolute;left:0;top:0;text-align:"+k+";width:"+r+"px;height:"+P+"px;background-color:"+p+";color:"+c+";padding-top:8px;padding:8px 15px 8px 15px;margin:0;overflow:hidden;z-index:1;"),
H.setAttribute("style","position: absolute;left:0;top:0;z-index:-1;width:100%;height:100%;"),d.appendChild(H)):d.setAttribute("style","position:absolute;left:0;top:0;text-align:"+k+";width:"+r+"px;background:"+p+";color:"+c+";padding:12px 15px 12px 15px;margin:0;z-index:100;");C=a.newHTML("div",{style:"padding:0;margin:0;font:"+b+";overflow:hidden;white-space:nowrap;"});C.innerHTML=e;N=a.newHTML("div");if(1===parseInt(q)){V=0;K=a.newHTML("div");K.innerHTML=f;document.body.appendChild(K);R=O;do R-=
V,K.setAttribute("style","padding:0;margin:0;font:"+h+";font-size:"+R+"px;width:"+(r-30)+"px;line-height:"+R+"px;"),Q=K.offsetHeight,W=Q/R,V=1;while(1<W&&8<R);document.body.removeChild(K);N.setAttribute("style","padding:0;margin:0;font:"+h+";font-size:"+R+"px;line-height:1em;overflow:hidden;white-space:nowrap;")}else N.setAttribute("style","padding:0;margin:0;font:"+h+";line-height:1em;");N.innerHTML=f;d.appendChild(C);d.appendChild(N);d.imageHeight=P;return d};S.prototype.split=function(a){if("string"!==
typeof a)return[];F=[];a=(a||"").replace(/\\'/g,"\u2019");D=B=I=0;for(L=M=!1;D<a.length;)" "!==a.charAt(D)||L||D++," "===a.charAt(D)||L||(L=!0,I=D),"="!==a.charAt(D)||"'"!==a.charAt(D+1)||M||(M=!0,F[B]=[a.substring(I,D)],I=D+2,D+=2),M&&"'"===a.charAt(D)&&(L=M=!1,F[B].push(a.substring(I,D)),B++),"="!==a.charAt(D)||"'"===a.charAt(D+1)||M||(F[B]=[a.substring(I,D)],I=D+1,D++,U=a.substring(D).indexOf("="),-1===U?T=U=a.length:(U+=D,T=a.substring(D,U).lastIndexOf(" "),T=-1===T?a.length:T+D),F[B].push(a.substring(I,
T)),B++,L=!1,D=T),D++;return F};S.prototype.parseText=function(b){b=b||"";return b.match(/^\{\\rtf1/)?this.RTFparser.parse(b.substring(10)):new a.SimpleText(this.parent,b)};a.LessonParser=S;return a}(descartesJS||{},babel);
descartesJS=function(a){function g(a,b){if(0==b)return 1;if(0>b)return NaN;if(0<=a||k(b)===b)return Math.pow(a,b);if(0>a){var c=1/b,d=k(c);if(d===c&&1===d%2)return-Math.pow(-a,b)}return NaN}function e(a,b){A=[];A.type="matrix";A.rows=a;A.cols=b;m=0;for(w=b;m<w;m++)A[m]=Array(a).fill(0);return A}function f(a,b){r=a.rows;u=a.cols;A=e(r,u);var c;for(m=0;m<r;m++)for(n=0;n<u;n++){for(w=c=0;w<u;w++)c+=a[w][m]*b[n][w];A[n][m]=c}return A}function q(a,b,c){for(var d=e(c.length-1,c.length-1),h=0,f=d.length;h<
f;h++)for(var g=0;g<f;g++)d[h][g]=h<a?g<b?c[h][g]:c[h][g+1]:h<b?c[h+1][g]:c[h+1][g+1];return d}function p(a){if(1<a.cols){for(var b=0,c=1,d=0,h=a.cols;d<h;d++)b+=c*a[0][d]*p(q(0,d,a)),c=-c;return b}return a[0][0]}if(a.loadLib)return a;var c={},k=Math.floor,l,b,h,d,v,r,u,A,n,m,w,x=function(a,b){this.sep="";this.type=a;this.value=b;this.parent=null;this.childs=[]};x.prototype.getRoot=function(){return null===this.parent?this:this.parent.getRoot()};x.prototype.addChild=function(a){a.parent=this;this.childs.push(a)};
x.prototype.replaceLastChild=function(a){h=this.childs.length-1;b=this.childs[h];b.parent=null;this.childs[h]=a;a.parent=this;return a};x.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};x.prototype.equalToMinus=function(){return"compOperator"===this.type?(this.type="operator",this.value="-",v=new x("compOperator","=="),v.addChild(this),v.addChild(new x("number","0")),d=this.getRoot(),d.setAllEvalFun(),
d):this};x.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};x.prototype.setAllEvalFun=function(){this.setEvalFun();for(var a=0,b=this.childs.length;a<b;a++)this.childs[a].setAllEvalFun()};x.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 b;this.evaluate=function(a,c){b=a.variables[this.value];if("object"===typeof b&&void 0==b.length)return b.evaluate(a);void 0==b&&(c||a.matrices[this.value]?b=a.matrices[this.value]:
a.vectors[this.value]&&(b=a.vectors[this.value]));return void 0!==b?b:0}}else if("identifier"===this.type&&"square_bracket"===this.childs[0].type&&1===this.childs[0].childs.length){var d;this.evaluate=function(a){try{return d=a.getVector(this.value,this.childs[0].childs[0].evaluate(a)),void 0!==d?d: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 d=a.getMatrix(this.value,this.childs[0].childs[0].evaluate(a),
this.childs[0].childs[1].evaluate(a)),void 0!==d?d:0}catch(M){return 0}};else if("identifier"===this.type&&"parentheses"===this.childs[0].type){var h,v,w;this.evaluate=function(a){h=[];for(var b=0,d=this.childs[0].childs.length;b<d;b++)h[b]=this.childs[0].childs[b].evaluate(a);if("_Eval_"===this.value){l=0<h.length?h[0]:0;if("number"==typeof l)return"NaN";l.match(",")&&parseFloat(l.replace(",","."))==l.replace(",",".")&&(l=l.replace(",","."));if(void 0==c[l]){v=l.match(/:=/g)?!0:!1;if(l.match(";")){var e=
!1,f=[],g=0;b=0;for(d=l.length;b<d;b++){var m=l.charAt(b);"'"===m&&(e=!e);e||";"!==m||(f.push(l.substring(g,b)),g=b+1)}f.push(l.substring(g));l="("+f.join(")(")+")"}c[l]=a.parser.parse(l,v)}w=a.eval(c[l]);return void 0!=w?w:NaN}return a.functions[this.value].apply(a,h)}}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;r=c.rows;u=c.cols;A=e(r,u);for(m=0;m<r;m++)for(n=0;n<u;n++)A[n][m]=c[n][m]+b[n][m];return 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;r=b.rows;u=b.cols;A=e(r,u);for(m=0;m<r;m++)for(n=0;n<u;n++)A[n][m]=b[n][m]-a[n][m];return A}:"*"===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:f(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),d=p(a);if(0===d)a=0;else{d=1/d;if(1<a.length)for(var h=0,g=a.length;h<g;h++){var m=d;for(var l=0;l<g;l++)c[l][h]=m*p(q(h,l,a)),m=-m;d=-d}else c[0][0]=d;a=c}b=0===a?e(b.rows,b.cols):f(b,a);return b}:"%"===this.value?this.evaluate=
function(a){var b=this.childs[0].evaluate(a);a=this.childs[1].evaluate(a);return b-k(b/a)*a}:"^"===this.value&&(this.evaluate=function(a){var b=this.childs[0].evaluate(a);a=this.childs[1].evaluate(a);return 0<=a?g(b,a):1/g(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 h=[];for(var e=0,f=this.childs[d].childs.length;e<f;e++)h.push(this.childs[d].childs[e].evaluate(a));c[d]=h}return c};else if("assign"===this.type){var x,D=this.childs[0],B=this.childs[1],L=D.childs[0]?D.childs[0].childs:null;this.evaluate=1===D.childs.length&&"square_bracket"===D.childs[0].type&&1===L.length?function(a){x=B.evaluate(a);a.setVector(D.value,L[0].evaluate(a),x);return x}:1===D.childs.length&&"square_bracket"===D.childs[0].type&&2===L.length?function(a){x=
B.evaluate(a);a.setMatrix(D.value,L[0].evaluate(a),L[1].evaluate(a),x);return x}:function(a){x=B.evaluate(a);return x.type?a.matrices[D.value]=x:"object"!==typeof a.variables[D.value]?a.variables[D.value]=x:0}}};a.Node=x;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,e,f,q,p,c,k,l,b=/^\s+/,h=/^[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]*)*/,d=/^[0-9]+[.][0-9]+|^[.][0-9]+|^[0-9]+/,v=/^==|^!=|^<=|^<|^>=|^>|^#/,r=/^!|^~|^&&|^&|^\|\||^\|/,u=/^=|^:=/,A=/^[\?:]/,n=/^[\+\-\*\/%\^\u2212\u00b7\u00D7\u00F7]/,m=/^\[|^\]/,w=/^\(|^\)/,x=/^,/,y=/^;/,z=/\|/g,G=/\|\*/g,J=/\*\|/g,E,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,b,d){e.push({type:a,value:b});c=c.slice(d);q+=d;l=a}if(g=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(G,"'").replace(J,"'"));F.match(/=\|/g)&&(F=F.replace(z,"'"));D=F.trim();"|"==D.charAt(0)&&"|"==D.charAt(D.length-1)&&
(F=D.replace(z,"'"))}e=[];f=!1;q=0;c=F;for(l="";F&&q<F.length;)if(f=q,"'"==c[0]){for(k=1;"'"!=c[k];)if(k<c.length)k++;else{console.info(">Error, unknown symbol: ["+c+"], in the string \u300a"+g+"\u300b");return}p=c.substring(1,k);B("string",p,p.length+2)}else if(p=c.match(b))c=c.slice(p[0].length),q+=p[0].length;else if(p=c.match(n))p[0]=p[0].replace(/\u00F7/g,"/").replace(/\u2212/g,"-").replace(/\u00b7/g,"*").replace(/\u00D7/g,"*"),B("operator",p[0],p[0].length);else if(p=c.match(h))"number"===l&&
e.push({type:"operator",value:"*"}),B("identifier",p[0],p[0].length);else if(p=c.match(d))B("number",p[0],p[0].length);else if(p=c.match(v))D=p[0],"#"==D&&(D="!="),B("compOperator",D,p[0].length);else if(p=c.match(r))D=p[0],"||"==D?D="|":"&&"==D?D="&":"~"==D&&(D="!"),B("boolOperator",D,p[0].length);else if((p=c.match(u))&&!c.match(/^==/))B("assign",p[0],p[0].length);else if(p=c.match(A))B("conditional",p[0],p[0].length);else if(p=c.match(m))B("square_bracket",p[0],p[0].length);else if(p=c.match(w))"("==
p&&"number"===l&&e.push({type:"operator",value:"*"}),B("parentheses",p[0],p[0].length);else if(p=c.match(x))B("separator",p[0],p[0].length);else if(178===c.charCodeAt(0))e.push({type:"operator",value:"^"}),B("number",2,1);else if(179===c.charCodeAt(0))e.push({type:"operator",value:"^"}),B("number",3,1);else if(p=c.match(y))B("final_of_expression",p[0],p[0].length);else if(f==q){a.DEBUG.setError(a.DEBUG.EXPRESSION,g);return}return e};D.prototype.flatTokens=function(a,b){a=a||[];b=b||"";E="";for(var c=
0,d=a.length;c<d;c++)E="string"==a[c].type?E+"&squot;"+a[c].value+"&squot;":"identifier"!=a[c].type||a[c].value.match(F)?E+a[c].value:E+b+a[c].value;return E};a.Tokenizer=D;return a}(descartesJS||{});
descartesJS=function(a){function g(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("-_-rnd-pi-\u03c0-e-Infinity-isTouch-esT\u00e1ctil-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-ceil-round-min-max-_Trace_-_Print_-_Num_-_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_-_Open_-_SaveState_-_OpenState_-_AnchoDeCadena_-_strWidth_-R-G-B-_Rojo_-_Red_-_Verde_-_Green_-_Azul_-_Blue_-DJS.typeof-");
var f=Date.now(),q,p,c,k,l,b,h,d,v,r,u,A,n=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()};n.prototype.setDefinition=function(a,b){this.definitions[a]=b};n.prototype.getDefinition=function(a){return this.definitions[a]};n.prototype.setVariable=function(a,b){this.variables[a]=b};n.prototype.getVariable=function(a,
b){return this.variables[a]};n.prototype.setVector=function(a,b,c){this.vectors[a][b]=c};n.prototype.getVector=function(a){this.vectors.hasOwnProperty(a)||(this.vectors[a]=[0,0,0]);return this.vectors[a]};n.prototype.setMatrix=function(a,b,c,d){this.matrices[a][b][c]=d};n.prototype.getMatrix=function(a){this.matrices.hasOwnProperty(a)||(this.matrices[a]=[[0,0,0],[0,0,0],[0,0,0]]);return this.matrices[a]};n.prototype.setFunction=function(a,b){this.functions[a]=b};n.prototype.getFunction=function(a){this.functions.hasOwnProperty(a)||
(this.functions[a]=function(){return 0});return this.functions[a]};n.prototype.parse=function(e,f){(c=this.tokenizer.tokenize(e))||(c=[]);k=null;f=!f||!1;q=d=h=b=0;for(p=c.length;q<p;q++){v=c[q];r=v.value;u=v.type;if("identifier"===u)if(q+1<p&&"parentheses"===c[q+1].type&&"("===c[q+1].value)this.getFunction(r);else if(q+1<p&&"square_bracket"===c[q+1].type&&"["===c[q+1].value)c[q+3]&&"square_bracket"===c[q+3].type&&"]"===c[q+3].value?this.getVector(r):this.getMatrix(r);else{var m=r.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(r,!0)}"assign"===u&&f&&":="!=r&&(u="compOperator",r="==");if("assign"===u)if(l=new a.Node(u,r),null!=k)if("identifier"===k.type)k.parent&&k.parent.replaceLastChild(l),l.addChild(k),k=l,f=!0;else if("square_bracket"===k.type)l.addChild(k.parent),k=l,f=!0;else{l.type="compOperator";l.value="==";for(f=!0;k.parent&&g(k.parent.value)>=g(l.value);)k=k.parent;k.parent&&k.parent.replaceLastChild(l);l.addChild(k);
k=l}else{console.info("Error1: en la expresi\u00f3n \u300a "+e+" \u300b, en el token {valor: "+r+", tipo: "+u+"}");break}else if("parentheses"===u&&"("===r||"square_bracket"===u&&"["===r)if(l=new a.Node(u,r),"("===r&&b++,"["===r&&h++,null===k)"("===r&&(new a.Node("(expr)","(expr)")).addChild(l),"["===r&&(new a.Node("[expr]","[expr]")).addChild(l),k=l;else if("operator"===k.type||"boolOperator"===k.type||"compOperator"===k.type||"conditional"===k.type||"assign"===k.type)k.addChild(l),k=l;else if("sign"===
k.type)k.addChild(l),k=l;else if("parentheses"===k.type&&"("===k.value)k.addChild(l),k=l;else if("square_bracket"===k.type&&"["===k.value)k.addChild(l),k=l;else if("parentheses"===k.type&&"()"===k.value)k.parent.addChild(l),k=l;else if("square_bracket"===k.type&&"[]"===k.value)k.parent.addChild(l),k=l;else if("identifier"===k.type)k.addChild(l),k=l;else{console.info("Error2: en la expresi\u00f3n \u300a "+e+" \u300b, en el token ["+q+"] {valor: "+r+", tipo: "+u+"}");break}else if("parentheses"===u&&
")"===r)if(b--,null===k)console.info("Error3: en la expresi\u00f3n \u300a "+e+" \u300b, en el token (valor:"+r+", tipo:"+u);else{for(;k&&k.parent&&("("!=k.value||"("==k.value&&"parentheses"!=k.type);)k=k.parent;if(k&&"("===k.value)k.value="()";else break}else if("square_bracket"===u&&"]"===r)if(h--,null===k)console.info("Error5: en la expresi\u00f3n \u300a "+e+" \u300b, en el token (valor:"+r+", tipo:"+u);else{for(;k&&k.parent&&("["!=k.value||"["==k.value&&"square_bracket"!=k.type);)k=k.parent;if(k&&
"["===k.value)k.value="[]";else{console.info("Error6: en la expresi\u00f3n \u300a "+e+" \u300b, en el token {valor: "+r+", tipo: "+u+"}");break}}else if("number"===u||"string"===u||"identifier"===u)if(l=new a.Node(u,r),null===k)k=l;else if("operator"===k.type||"compOperator"===k.type||"boolOperator"===k.type||"parentheses"===k.type&&"("===k.value||"square_bracket"===k.type&&"["===k.value||"sign"===k.type||"conditional"===k.type||"assign"===k.type)k.addChild(l),k=l;else{a.DEBUG.setError(a.DEBUG.EXPRESSION,
e);break}else if("operator"===u||"compOperator"===u||"boolOperator"===u)if(l=new a.Node(u,r),null===k)if("-"===r||"+"===r)l.type="sign",l.value="sign"+r,k=l;else if("!"===r)k=l;else{console.info("Error8: en la expresi\u00f3n \u300a "+e+" \u300b, en el token {valor: "+r+", tipo: "+u+"}");break}else if("operator"===k.type||"compOperator"===k.type||"boolOperator"===k.type||"assign"===k.type||"conditional"===k.type||"square_bracket"===k.type&&"["===k.value&&("-"===r||"+"===r||"!"===r)||"parentheses"===
k.type&&"("===k.value&&("-"===r||"+"===r||"!"===r)){if("-"===r||"+"===r)l.type="sign",l.value="sign"+r;k.addChild(l);k=l}else if("number"===k.type||"parentheses"===k.type&&"()"===k.value||"square_bracket"===k.type&&"[]"===k.value||"string"===k.type||"identifier"===k.type||"conditional"===k.type||"assign"===k.type){for(;k.parent&&g(k.parent.value)>=g(l.value);)k=k.parent;k.parent&&k.parent.replaceLastChild(l);l.addChild(k);k=l}else{console.info("Error9: en la expresi\u00f3n \u300a "+e+" \u300b, en el token {valor: "+
r+", tipo: "+u+"}");break}else if("conditional"===u)if(l=new a.Node(u,r),null!=k)if("?"===l.value){for(d++;k.parent&&g(k.parent.value)>g(l.value);)k=k.parent;k.parent&&k.parent.replaceLastChild(l);l.addChild(k);k=l}else{for(d--;k&&k.parent&&("?"!=k.value||"?"==k.value&&"conditional"!=k.type);)k=k.parent;if(k&&"?"===k.value)k.value="?:";else{console.info("Error10: en la expresi\u00f3n \u300a "+e+" \u300b, en el token {valor: "+r+", tipo: "+u+"}");break}}else{console.info("Error11: en la expresi\u00f3n \u300a "+
e+" \u300b, en el token {valor: "+r+", tipo: "+u+"}");break}else if("separator"===u)if(null!=k)for(;k.parent&&"("!=k.value&&"["!=k.value;)k=k.parent;else{console.info("Error12: en la expresi\u00f3n \u300a "+e+" \u300b, en el token {valor: "+r+", tipo: "+u+"}");break}else{console.info("Error13: en la expresi\u00f3n \u300a "+e+" \u300b, en el token {valor: "+r+", tipo: "+u+"}");break}}0<b&&a.DEBUG.setError(a.DEBUG.PARENTHESIS_CLOSING,e);0>b&&a.DEBUG.setError(a.DEBUG.PARENTHESIS_OPENING,e);0<h&&a.DEBUG.setError(a.DEBUG.BRACKET_CLOSING,
e);0>h&&a.DEBUG.setError(a.DEBUG.BRACKET_OPENING,e);0!=d&&a.DEBUG.setError(a.DEBUG.INCOMPLETE_IF,e);(A=k?k.getRoot():null)&&A.setAllEvalFun();return A};n.prototype.registerDefaultValues=function(){var b=this;b.variables.rnd=Math.random;b.variables.pi=b.variables["\u03c0"]=a.returnValue(Math.PI);b.variables.e=a.returnValue(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.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=function(a){return Math.log(a)/Math.log(10)};b.functions.abs=Math.abs;b.functions.ent=Math.floor;b.functions.sgn=function(a){return 0<a?1:0>a?-1:0};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=function(a){return(Math.exp(a)-Math.exp(-a))/2};b.functions.cosh=function(a){return(Math.exp(a)+Math.exp(-a))/2};b.functions.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=Math.floor;b.functions.ceil=Math.ceil;b.functions.round=Math.round;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._Stop_Audios_=function(){b.evaluator.parent.stopAudios()};
b.functions.esCorrecto=function(c,d,h){return a.esCorrecto(c,d,b.evaluator,h)};b.functions.escorrecto=function(c,d,h){return a.escorrecto(c,d,b.evaluator,h)};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.openExternalFile(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 h="<"+c+">\\n",e=b.getVariable(c+".columnas_usadas")||d.cols||0,f=b.getVariable(c+".filas_usadas")||d.rows||0,g,l=0;l<e;l++){for(var r=
0;r<f;r++)g=d[l][r],void 0!==g&&("string"==typeof g?g="'"+g+"'":"number"==typeof g&&(g=a.removeNeedlessDecimals(g.toFixed(6))),h+=g+(r<f-1?" \u00a6 ":""));h=h.replace(/(\u00A6 )$/g,"")+"\\n"}return h+"</"+c+">"}return""};b.functions._StrToMatrix_=function(a,c){var d=[],h=!1,f=!1;d.type="matrix";if(a){a=a.replace(/\r|\\r/g,"").split(/\n|\\n/);for(var g=0,l=a.length;g<l;g++)a[g].match("<"+c+">")?(f=!0,h=a[g].trim().split("<"+c+">"),2==h.length&&""!=h[1]&&d.push(h[1].split(String.fromCharCode("166")).map(e)),
h=!0):(a[g].match("</"+c+">")&&(h=a[g].trim().split("</"+c+">"),2==h.length&&""!=h[0]&&d.push(h[0].split(String.fromCharCode("166")).map(e)),h=!1,g=a.length),h&&d.push(a[g].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 f?"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",h=b.getVariable(a+".long_usada")||c._size_||0,e,f=0;f<h;f++)e=c[f],void 0!==e?("number"==typeof e&&(e=parseFloat(e)),d+=e+"\\n"):d+="0\\n";return d+"</"+a+">"}return""};b.functions._StrToVector_=function(a,c){var d=[],h=!1,f=!1;d.type="vector";if(a){a=a.replace(/\r|\\r/g,"").split(/\n|\\n/);for(var g=0,l=a.length;g<l;g++)a[g].match("<"+c+">")?h=f=!0:(a[g].match("</"+c+">")&&(h=!1,g=a.length),h&&d.push(e(a[g])));
d._size_=d.length;b.vectors[c]=d;b.setVariable(c+".long",d.length);b.setVariable(c+".long_usada",d.length)}return f?"OK":"ERROR"};b.functions._ExecStr_=function(a){return b.functions._ExecBlock_(a,"")};b.functions._ExecBlock_=function(a,c){var d=[],h=""==c;if(a){a=a.replace(/\r|\\r/g,"").split(/\n|\\n/);for(var e=0,f=a.length;e<f;e++)a[e].match("<"+c+">")?(h=a[e].trim().split("<"+c+">"),2==h.length&&""!=h[1]&&(d=d.concat(h[1].split(String.fromCharCode("166")))),h=!0):a[e].match("</"+c+">")?(h=a[e].trim().split("</"+
c+">"),2==h.length&&""!=h[0]&&(d=d.concat(h[0].split(String.fromCharCode("166")))),h=!1):h&&(d=d.concat(a[e].split(String.fromCharCode("166"))));e=0;for(f=d.length;e<f;e++)h=d[e].split("="),h[0]=h[0].trim(),2==h.length&&""!=h[0]&&(isNaN(parseFloat(h[1]))?b.setVariable(h[0],h[1].replace(/^\s|\s$/g,"").replace(/^'|'$/g,"")):b.setVariable(h[0],parseFloat(h[1])))}return 0};var c=a.newHTML("a",{target:"_blank"}),d,h=null;a.newBlobContent=null;b.functions._Save_=function(e,g){b.evaluator.parent.removeButtonClick();
1500<Date.now()-f&&(f=Date.now(),document.body.appendChild(c),h=g.replace(/\\r/g,"").replace(/\\n/g,"\r\n").replace(/\\q/g,"'").replace(/\\_/g,"\\"),d=new Blob(["\ufeff",h],{type:"text/plain;charset=utf-8"}),c.setAttribute("href",window.URL.createObjectURL(d)),c.setAttribute("download",e),h!=a.newBlobContent&&(c.click(),a.newBlobContent=h),document.body.removeChild(c));return 0};var g=a.newHTML("a",{target:"_blank"});b.functions._SaveSpace_=function(c,d){b.evaluator.parent.removeButtonClick();1500<
Date.now()-f&&(f=Date.now(),document.body.appendChild(g),h=d,g.setAttribute("href",h),g.setAttribute("download",c),h!=a.newBlobContent&&(g.click(),a.newBlobContent=h),document.body.removeChild(g));return 0};var l,r,k=a.newHTML("input",{type:"file"});k.addEventListener("change",function(c){l=c.target.files;r=new FileReader;r.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());k.value=""};0<l.length&&r.readAsText(l[0])});b.functions._Open_=function(a){b.evaluator.parent.removeButtonClick();1500<Date.now()-f&&(b._callback=a,k.click(),f=Date.now());return 0};b.functions._AnchoDeCadena_=b.functions._strWidth_=function(b,c,d,h){return a.getTextWidth(b,a.convertFont(c+","+d+","+h))};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["DJS.typeof"]=function(a){return a.rows?"matrix":a._size_?"vector":typeof a}};a.Parser=n;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.floor,e=function(e){this.parent=e;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,p){e=0>e?0:g(e);this.vectors[a][e]=p};e.prototype.getVector=function(a,e){e=0>e?0:g(e);return this.vectors[a][e]};e.prototype.setMatrix=function(a,e,p,c){e=0>e?0:g(e);p=0>p?0:g(p);void 0==this.matrices[a][e]&&(this.matrices[a][e]=[]);this.matrices[a][e][p]=c};e.prototype.getMatrix=function(a,e,p){e=0>e?0:g(e);p=0>p?0:g(p);return this.matrices[a][e][p]};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 g,e,f,q,p,c,k,l,b,h,d,v,r,u,A,n=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)};n.prototype.drawText=function(b,d,h,l,r){g=this.evaluator.eval(this.decimals);e=this.evaluator.eval(this.parent.width);
f=this.evaluator.eval(this.parent.font_size);q=d.getColor?d.getColor():d;p=this.textToString(this.text,g,this.fixed).replace(/\\{/g,"\\curlyBracketOpen ").replace(/\\}/g,"\\curlyBracketClose ").replace(/\\\[/g,"\\squareBracketOpen ").replace(/\\\]/g,"\\squareBracketClose ");0<=p.indexOf("[")&&(p=this.textToString(this.parseSimpleText(p),g,this.fixed));if(this.oldTextStr!==p||this.oldWidth!==e||this.oldSize!==f||this.oldColor!==q||this.oldPosX!==h||this.oldPoxY!==l)c=new a.TextStyle({size:f,family:this.parent.font_family||
"arial",italic:this.parent.italics||!1,bold:this.parent.bold||!1,color:q,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(p,this.evaluator,c),this.textNodes.update(h,l,g,this.fixed,this.align,this.anchor,q,e);r||this.textNodes.draw(b);this.oldTextStr=p;this.oldWidth=
e;this.oldSize=f;this.oldColor=q;this.oldPosX=h;this.oldPoxY=l};n.prototype.drawRTF=function(a,b,c,d,h){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));h||this.textNodes.draw(a)};n.prototype.parseSimpleText=function(a){a=a.replace("&#x2013",
"\u2013").replace(/&squot;/g,"'");k=[];l="'";h=b=0;d=-1;for(u=a.length;b<u;)v=a.charAt(b),r=a.charAt(b-1),"["===v&&"\\"===r?(k.push(a.substring(h,b-1)+"["),h=b+1):"]"===v&&"\\"===r?(k.push(a.substring(h,b-1)+"]"),h=b+1):"["===v&&-1===d?(k.push(a.substring(h,b)),h=b,d++):"["===v?d++:"]"===v&&0===d?(k.push(this.evaluator.parser.parse(a.substring(h,b+1))),h=b+1,d--):("]"==a.charAt(b)&&(d=0>d?d:d-1),l+=a.charAt(b)),b++;k.push(a.substring(h,b));return k};n.prototype.textToString=function(b,c,d){l="";if("rtfNode"!==
b.type)for(var h=0,e=b.length;h<e;h++)"string"===typeof b[h]?l+=b[h]:(A=this.evaluator.eval(b[h])[0][0],""!==A&&("string"===typeof A?l+=A:Infinity===A?l+="Infinity":-Infinity===A?l+="-Infinity":isNaN(A)||"NaN"===A?l+="NaN":(A=parseFloat(A),A=d?A.toFixed(c):a.removeNeedlessDecimals(A.toFixed(c)),l+=A.toString().replace(".",this.decimal_symbol))));return l};a.TextObject=n;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,e=function(){};e.prototype.tokenize=function(a){a=a.replace(/\\n/g,"\\newline ");var e=[],f=null,c=0,k=a.length;a.charAt(0);var l=!1,b=!1,h=0;g="";for(var d=0;d<k;d++){var v=a.charAt(d);var r=a.charAt(d+1);"\\"===v&&"$"===r&&(b=!0);"{"===v?h++:"}"===v&&(h--,b&&0===h&&(b=!1));b?"_"===v?"{"===r?g+="\\subindex":(g+="\\subindex{"+r+"}",d++):"^"===v?"{"===r?g+="\\superindex":(g+="\\superindex{"+r+"}",d++):g+=v:g+=v}a=g;r=a.charAt(0);for(k=a.length;c<
k;)v=r,r=a.charAt(c+1),l&&("{"===v||"["===v||"\\"===v||" "===v?(l=!1," "===v&&(f={type:"ignore"},e.push(f))):f.value+=v),l||"\\"!==v?l||"{"!==v&&"["!==v?l||"}"!==v&&"]"!==v?l||(f&&"text"===f.type?f.value+=v:f&&"ignore"===f.type?(e.pop(),f=e[e.length-1]):(f={type:"text",value:v},e.push(f))):(f={type:"close",value:v},e.push(f)):(f={type:"open",value:v},e.push(f)):(l=!0,f={type:"command",value:""},e.push(f)),c++;return e};a.DescarTeXTokenizer=e;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=function(){this.tokenizer=new a.DescarTeXTokenizer};g.prototype.parse=function(e,f,g){e=this.tokenizer.tokenize(e);var p=new a.TextNode("","textBlock",g,null),c=new a.TextNode("","textLineBlock",g.clone(),null);p.addChild(c);for(var k=[],l=void 0,b=g,h=[g],d,v,r,u,q=!1,n=0,m=e.length;n<m;n++)if("text"===e[n].type)if("color_parameter"===l)v=new a.Color(e[n].value,f);else if("text_size_parameter"===l)r=parseFloat(e[n].value);else if("textLineBlock"===
c.nodeType){d=e[n].value.split(" ");for(var w=0,x=d.length;w<x;w++)""!==d[w]&&c.addChild(new a.TextNode(d[w],"text",b.clone(),null)),w+1<x&&c.addChild(new a.TextNode(" ","space",b.clone(),null))}else c.addChild(new a.TextNode(e[n].value,"text",b.clone(),null));else"command"===e[n].type&&"curlyBracketOpen"===e[n].value?c.addChild(new a.TextNode("{","text",b.clone(),null)):"command"===e[n].type&&"curlyBracketClose"===e[n].value?c.addChild(new a.TextNode("}","text",b.clone(),null)):"command"===e[n].type&&
"squareBracketOpen"===e[n].value?c.addChild(new a.TextNode("[","text",b.clone(),null)):"command"===e[n].type&&"squareBracketClose"===e[n].value?c.addChild(new a.TextNode("]","text",b.clone(),null)):"command"===e[n].type&&"newline"===e[n].value?(0===c.children.length&&c.addChild(new a.TextNode("","text",b.clone(),null)),c=new a.TextNode("","textLineBlock",g.clone(),null),p.addChild(c)):"command"===e[n].type&&"b"===e[n].value?(l="bold",k.push(l)):"command"===e[n].type&&"i"===e[n].value?(l="italic",
k.push(l)):"command"===e[n].type&&"o"===e[n].value?(l="overline",k.push(l)):"command"===e[n].type&&"u"===e[n].value?(l="underline",k.push(l)):"command"===e[n].type&&"color"===e[n].value?(l="color",k.push(l)):"command"===e[n].type&&"ts"===e[n].value?(l="text_size",k.push(l)):"command"===e[n].type&&"sansserif"===e[n].value.toLowerCase()?(l="sansserif",k.push(l)):"command"===e[n].type&&"serif"===e[n].value.toLowerCase()?(l="serif",k.push(l)):"command"===e[n].type&&"monospace"===e[n].value.toLowerCase()?
(l="monospace",k.push(l)):"command"===e[n].type&&"c"===e[n].value?(l="center",k.push(l)):"command"===e[n].type&&"l"===e[n].value?(l="left",k.push(l)):"command"===e[n].type&&"r"===e[n].value?(l="right",k.push(l)):"command"===e[n].type&&"j"===e[n].value?(l="justify",k.push(l)):"command"===e[n].type&&"$"===e[n].value?(l="formula",k.push(l),q=!0):"command"===e[n].type&&"sum"===e[n].value?(l="sum",k.push(l)):"command"===e[n].type&&"prod"===e[n].value?(l="prod",k.push(l)):"command"===e[n].type&&"int"===
e[n].value?(l="integral",k.push(l)):"command"===e[n].type&&"lim"===e[n].value?(l="limit",k.push(l)):"command"===e[n].type&&"sqrt"===e[n].value?(l="radical",k.push(l)):"command"===e[n].type&&"subindex"===e[n].value?(l="subIndex",k.push(l)):"command"===e[n].type&&"superindex"===e[n].value?(l="superIndex",k.push(l)):"command"===e[n].type&&"frac"===e[n].value?(l="numerator",k.push(l)):"open"===e[n].type&&"{"===e[n].value&&void 0!==l?"bold"===l||"italic"===l||"overline"===l||"underline"===l?(b=b.clone(),
b[l]=!0,h.push(b)):"sansserif"===l?(b=b.clone(),b.family="sansserif",h.push(b)):"serif"===l?(b=b.clone(),b.family="serif",h.push(b)):"monospace"===l?(b=b.clone(),b.family="monospaced",h.push(b)):"text_size"===l?l="text_size_parameter":"text_size_text"===l?(b=b.clone(),b.size=r,h.push(b)):"color"===l?l="color_parameter":"color_text"===l?(b=b.clone(),b.color=v,h.push(b)):"center"===l||"left"===l||"right"===l||"justify"===l?(b=b.clone(),b.align=l,h.push(b),c=new a.TextNode("","textLineBlock",b.clone(),
null),p.addChild(c)):"formula"===l?(b=b.clone(),h.push(b),u=new a.TextNode("","formula",b.clone(),null),c.addChild(u),c=u):"subIndex"===l||"superIndex"===l?q?(b=b.clone(),h.push(b),u=new a.TextNode("",l,b.clone(),null),c.addChild(u),c=u):c.addChild(new a.TextNode("subIndex"===l?"_":"^","text",b.clone(),null)):"radical"===l?q&&(u=new a.TextNode("","radical",b.clone(),null),c.addChild(u),c=u,b=b.clone(),h.push(b),u=new a.TextNode("","index",b.clone(),null),c.addChild(u),c=u,l="index"):"index"===l?q&&
(h.pop(),b=h[h.length-1],u=new a.TextNode("","radicand",b.clone(),null),c.addChild(u),c=u,l="radicand"):"sum"===l||"integral"===l||"limit"===l||"prod"===l?q&&(u=new a.TextNode("",l,b.clone(),null),c.addChild(u),c=u,b=b.clone(),h.push(b),u=new a.TextNode("","from",b.clone(),null),c.addChild(u),c=u,l="from",k[k.length-1]=l):"from"===l?q&&(u=new a.TextNode("","to",b.clone(),null),c.addChild(u),c=u,l="to",k[k.length-1]=l):"to"===l?q&&(h.pop(),b=h[h.length-1],u=new a.TextNode("","what",b.clone(),null),
c.addChild(u),c=u,l="what",k[k.length-1]=l):"numerator"===l?q&&(u=new a.TextNode("","fraction",b.clone(),null),c.addChild(u),c=u,b=b.clone(),h.push(b),u=new a.TextNode("","numerator",b.clone(),null),c.addChild(u),c=u,l="numerator"):"denominator"===l&&(u=new a.TextNode("",l,b.clone(),null),c.addChild(u),c=u):"close"===e[n].type&&"}"===e[n].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?(h.pop(),b=h[h.length-1],k.pop(),l=k[k.length-1]):"color_parameter"===l?l="color_text":"text_size_parameter"===l?l="text_size_text":"center"===l||"left"===l||"right"===l||"justify"===l?(h.pop(),b=h[h.length-1],k.pop(),l=k[k.length-1],e[n+1]&&"command"===e[n+1].type&&"newline"===e[n+1].value?c=p:(c=new a.TextNode("","textLineBlock",b.clone(),null),p.addChild(c))):"formula"===c.nodeType?(q=!1,h.pop(),b=h[h.length-1],k.pop(),l=k[k.length-1],c=c.parent):"subIndex"===c.nodeType||
"superIndex"===c.nodeType?q&&(h.pop(),b=h[h.length-1],k.pop(),l=k[k.length-1],c=c.parent):"index"===c.nodeType?c=c.parent:"radicand"===c.nodeType?(k.pop(),l=k[k.length-1],c=c.parent.parent):"from"===c.nodeType?c=c.parent:"to"===c.nodeType?c=c.parent:"what"===c.nodeType?(k.pop(),l=k[k.length-1],c=c.parent.parent):"numerator"===c.nodeType?(l="denominator",c=c.parent):"denominator"===c.nodeType&&(h.pop(),b=h[h.length-1],k.pop(),l=k[k.length-1],c=c.parent.parent));var y,z,G=null,J=[];p.children.forEach(function(a){for(var b=
0,c=a.children.length;b<c-1;b++)y=a.children[b],z=a.children[b+1],"text"===y.nodeType&&"text"===z.nodeType&&y.style.equals(z.style)?(null===G&&(G=y,u=y.clone(),G.changeNodeType("word"),G.value="___"+u.value,G.addChild(u)),u=z.clone(),G.addChild(u),J.push(z),G.value+=u.value):G=null});J.forEach(function(a){a.parent.removeChild(a)});p.normalize();p.adjustFontSize();return p};a.DescarTeXParser=g;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,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 e=!0,f;for(f in this)this.hasOwnProperty(f)&&(e=e&&this[f]===a[f]);return e};e.prototype.toString=function(e){/arial|sansserif/i.test(this.family)?
g=a.sansserif_font:/times|serif/i.test(this.family)?g=e?a.math_font:a.serif_font:/courier|monospaced/i.test(this.family)&&(g=a.monospace_font);return((this.bold?"bold":"")+" "+(this.italic?"italic":"")+" "+this.size+"px "+g).trim()};a.TextStyle=e;return a}(descartesJS||{});
descartesJS=function(a){function g(a,c){for(var b=0,h=0;h<c;h++)b+=a[h];return b}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 f=!1,q="#000000",p=2,c=!1;(new Path2D("m 759,1 c -8,0 -15,4 -20,14 L 325,878 153,500 c -5,-11 -11,-14 -17,-9 L 2,596 c -5,4 17,30 22,26 l 65,-47 193,422 c 3,6 27,6 32,-4 L 773,40 V 1 Z")).svgData="m 759,1 c -8,0 -15,4 -20,14 L 325,878 153,500 c -5,-11 -11,-14 -17,-9 L 2,596 c -5,4 17,30 22,26 l 65,-47 193,422 c 3,6 27,6 32,-4 L 773,40 V 1 Z";(new Path2D("M 780,707 H 750 C 728,805 695,872 585,872 H 180 L 509,447 225,65 h 313 c 130,0 167,49 188,181 h 30 V 0 H 25 L 384,500 0,1000 h 729 z")).svgData=
"M 780,707 H 750 C 728,805 695,872 585,872 H 180 L 509,447 225,65 h 313 c 130,0 167,49 188,181 h 30 V 0 H 25 L 384,500 0,1000 h 729 z";(new Path2D("m 150,828 c -21,88 -42,144 -83,144 -6,0 -9,-2 -9,-6 0,-9 15,-8 15,-34 0,-14 -13,-22 -27,-22 -24,0 -45,22 -45,51 0,20 21,39 56,39 97,0 141,-105 159,-176 L 375,181 c 23,-91 45,-154 89,-153 6,0 9,2 9,6 0,7 -15,13 -15,35 0,14 13,20 27,20 24,0 45,-22 45,-51 C 530,18 508,0 473,0 368,0 326,120 309,190 Z")).svgData="m 150,828 c -21,88 -42,144 -83,144 -6,0 -9,-2 -9,-6 0,-9 15,-8 15,-34 0,-14 -13,-22 -27,-22 -24,0 -45,22 -45,51 0,20 21,39 56,39 97,0 141,-105 159,-176 L 375,181 c 23,-91 45,-154 89,-153 6,0 9,2 9,6 0,7 -15,13 -15,35 0,14 13,20 27,20 24,0 45,-22 45,-51 C 530,18 508,0 473,0 368,0 326,120 309,190 Z";
(new Path2D("m 876.3561,999.59384 v -27.38613 h -17.60537 c -64.55302,0 -96.82952,-41.07919 -96.82952,-124.21565 V 144.75542 c 0,-83.136456 27.38612,-117.369116 114.43489,-117.369116 V 1.7633057e-4 H 1.184082e-5 V 27.386304 H 16.627304 c 60.640711,0 98.785676,24.4519 98.785676,121.281426 v 716.9297 c 0,71.39954 -31.298433,106.61028 -96.829524,106.61028 H 1.184082e-5 v 27.38613 H 359.93198 v -27.38613 h -30.32036 c -64.55302,0 -86.07069,-40.10112 -86.07069,-131.06218 V 64.553192 H 633.79325 V 841.14553 c 0,75.31185 -17.60537,131.06218 -86.07068,131.06218 h -31.29844 v 27.38613 z")).svgData=
"m 876.3561,999.59384 v -27.38613 h -17.60537 c -64.55302,0 -96.82952,-41.07919 -96.82952,-124.21565 V 144.75542 c 0,-83.136456 27.38612,-117.369116 114.43489,-117.369116 V 1.7633057e-4 H 1.184082e-5 V 27.386304 H 16.627304 c 60.640711,0 98.785676,24.4519 98.785676,121.281426 v 716.9297 c 0,71.39954 -31.298433,106.61028 -96.829524,106.61028 H 1.184082e-5 v 27.38613 H 359.93198 v -27.38613 h -30.32036 c -64.55302,0 -86.07069,-40.10112 -86.07069,-131.06218 V 64.553192 H 633.79325 V 841.14553 c 0,75.31185 -17.60537,131.06218 -86.07068,131.06218 h -31.29844 v 27.38613 z";
var k=function(b,c,d,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=d;this.changeNodeType(c);this.drawBorder=a.in_editor?this.drawBorderSpecial:function(){}};k.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}};k.prototype.clone=function(){for(var a=new k(this.value,this.nodeType,this.style.clone()),c=0,d=this.children.length;c<d;c++)a.addChild(this.children[c].clone());return a};k.prototype.toStr=function(){for(var a=this.value,c=0,d=this.children.length;c<d;c++)a+=" "+this.children[c].toStr();return a};k.prototype.stringify=function(){var a="{"+('"NT":"'+
this.nodeType+'",');a+='"V":"'+(this.value||"")+'",';a+='"C":[';for(var c=0,d=this.children.length;c<d;c++)a+=this.children[c].stringify()+(c==d-1?"":",");a=a+"],"+('"S":'+JSON.stringify(this.style));return a+"}"};k.prototype.addChild=function(a,c){c&&null!==a.parent&&a.parent.removeChild(a);a.parent=this;this.children.push(a)};k.prototype.removeChild=function(a){var b=this.children.indexOf(a);-1!==b&&(a.parent=null,this.children.splice(b,1))};k.prototype.getFirstTextNode=function(){for(var a=this;0<
a.children.length;)a=a.children[0];return a};k.prototype.getLastTextNode=function(){for(var a=this;0<a.children.length;)a=a.children[a.children.length-1];return a};k.prototype.nextSibling=function(){if(this.parent)for(var a=null,c=0,d=this.parent.children.length;c<d;c++){if(a)return this.parent.children[c];this.parent.children[c]===this&&(a=!0)}return null};k.prototype.prevSibling=function(){if(this.parent)for(var a=0,c=this.parent.children.length-1;a<c;a++)if(this.parent.children[a+1]===this)return this.parent.children[a];
return null};k.prototype.queryAll=function(a){var b=[];"string"===typeof a&&(a=new RegExp(a));for(var c=0,e=this.children.length;c<e;c++)b=b.concat(this.children[c].queryAll(a));this.nodeType.match(a)&&b.push(this);return b};k.prototype.insertBefore=function(a,c){a=this.children.indexOf(a);-1!==a&&(c.parent=this,this.children.splice(a,0,c))};k.prototype.insertAfter=function(a,c){a=this.children.indexOf(a);-1!==a&&(c.parent=this,this.children.splice(a+1,0,c))};k.prototype.normalize=function(){for(var a=
this.queryAll(/textLineBlock|formula|numerator|denominator|superIndex|subIndex|index|subIndex|radicand|from|to|what|element/),c=0,d=a.length;c<d;c++)0===a[c].children.length&&a[c].addChild(new k("","text",a[c].style));a=this.queryAll(/formula|fraction|superIndex|subIndex|radical|sum|integral|prod|limit|matrix|defparts|dynamicText|componentNumCtrl|componentSpace/);c=0;for(d=a.length;c<d;c++){var e=a[c];(null===e.prevSibling()||null!==e.prevSibling()&&"text"!==e.prevSibling().nodeType)&&e.parent.insertBefore(e,
new k("","text",e.parent.style));(null===e.nextSibling()||null!==e.nextSibling()&&"text"!==e.nextSibling().nodeType)&&e.parent.insertAfter(e,new k("","text",e.parent.style))}return this};k.prototype.removeEmptyText=function(){for(var a=this.queryAll(/text/),c=0,d=a.length;c<d;c++)""===a[c].value&&a[c].parent&&a[c].parent.removeChild(a[c])};k.prototype.adjustFontSize=function(a){var b=this.style.size;"formula"===this.nodeType&&(a=!0);for(var c=0,e=this.children.length;c<e;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))};k.prototype.propagateStyle=function(a,c){this.style[a]=c;this.styleString=this.style.toString();for(var b=0,h=this.children.length;b<h;b++)this.children[b].propagateStyle(a,c)};k.prototype.update=function(a,h,d,e,f,g,l,k){p=d;c=e;q=l;this.metrics.w=this.metrics.h=0;l=h;if(20<=k)for(d=0;d<this.children.length;d++)this.children[d].breakLines(k);d=0;for(e=this.children.length;d<e;d++){var b=this.children[d];
b.updateLine();b.metrics.offsetX=a;b.metrics.y=h;h+=parseInt(b.metrics.ascent+.5);b.metrics.offsetY=h;f=parseInt(b.metrics.descent+.5)+parseInt(1.5+.05*b.style.size);h+=f;this.metrics.h+=b.metrics.h;this.metrics.w=Math.max(this.metrics.w,b.metrics.w)}h=l;g=g||"";g.match("right")?a-=this.metrics.w:g.match("_center")&&(a-=this.metrics.w/2);g.match("bottom")?h-=this.metrics.h:g.match("center_")&&(h-=this.metrics.h/2);g=this.children;d=0;for(e=g.length;d<e;d++)"left"===g[d].style.align?g[d].metrics.offsetX=
a:"right"===g[d].style.align?g[d].metrics.offsetX=a+this.metrics.w-g[d].metrics.w:"center"===g[d].style.align?g[d].metrics.offsetX=a+(this.metrics.w-g[d].metrics.w)/2:"justify"===g[d].style.align&&20<=k&&(f=d<e-1?g[d+1].value:null,g[d].metrics.offsetX=a,"wrap"===f&&g[d].justifyAux(k)),g[d].metrics.y=h,h+=parseInt(g[d].metrics.ascent+.5),g[d].metrics.offsetY=h,f=parseInt(g[d].metrics.descent+.5)+parseInt(1.5+.05*g[d].style.size),h+=f};k.prototype.breakLines=function(b){for(var c,d=0,e=!1,f=[],g=0,
l=this.children.length;g<l;g++)c=this.children[g],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<g&&(e=!0,f.push(c)));if(0<f.length)for(b=new k("wrap","textLineBlock",this.style.clone(),null),this.parent.insertAfter(this,b),g=0,l=f.length;g<l;g++)f[g].parent&&f[g].parent.removeChild(f[g]),b.addChild(f[g])};
k.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,g,l=0,k=f.length;l<k;l++){g=f[l];if("text"===g.nodeType){a.ctx.font=g.style.toString();var n=""!==g.value?g.value:a.in_editor?"\u200a":"";g.metrics=e(a.ctx.font);g.metrics.w=a.ctx.measureText(n).width;g.metrics.offsetX=d;Object.defineProperties(g.metrics,{x:{get:function(){return c.metrics.offsetX+this.offsetX}},
y:{get:function(){return c.metrics.offsetY+this.offsetY}}})}"space"===g.nodeType?(a.ctx.font=g.style.toString(),g.metrics=e(a.ctx.font),g.metrics.w=l===k-1?0:b?b:a.ctx.measureText(" ").width,g.metrics.offsetX=d,Object.defineProperties(g.metrics,{x:{get:function(){return c.metrics.offsetX+this.offsetX}},y:{get:function(){return c.metrics.offsetY+this.offsetY}}})):"word"===g.nodeType&&(g.updateLine(),g.metrics.offsetX_aux=d,Object.defineProperties(g.metrics,{offsetX:{get:function(){return c.metrics.offsetX+
this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY}}}));"hyperlink"===g.nodeType&&(a.ctx.font=g.styleString,n=""!==g.value?g.value:a.in_editor?"\u200a":"",g.metrics=e(a.ctx.font),g.metrics.w=a.ctx.measureText(n).width,g.metrics.offsetX=d,Object.defineProperties(g.metrics,{x:{get:function(){return c.metrics.offsetX+this.offsetX}},y:{get:function(){return c.metrics.offsetY}}}),g.clickCatcher||(g.clickCatcher=a.newHTML("div",{style:"position:absolute;width:"+g.metrics.w+"px;height:"+
g.metrics.h+"px;cursor:pointer;"}),g.clickCatcher.rtfNode=g,g.clickCatcher.action=new a.OpenURL(this.evaluator.parent,g.URL),g.clickCatcher.addEventListener("click",function(a){this.rtfNode.click=!0;this.action.execute();this.rtfNode.draw(this.rtfNode.ctx)})));"componentNumCtrl"===g.nodeType&&(g.componentNumCtrl=this.evaluator.parent.getControlByCId(g.value),a.ctx.font=g.styleString,g.metrics=e(a.ctx.font),g.metrics.w=g.componentNumCtrl.w,g.metrics.h=g.componentNumCtrl.h,g.metrics.offsetX=d,Object.defineProperties(g.metrics,
{x:{get:function(){return c.metrics.offsetX+this.offsetX}},y:{get:function(){return c.metrics.offsetY}}}));"componentSpace"===g.nodeType?(g.componentSpace=this.evaluator.parent.getSpaceByCId(g.value),a.ctx.font=g.styleString,g.metrics=e(a.ctx.font),g.metrics.w=g.componentSpace.w,g.metrics.h=g.componentSpace.h,g.metrics.offsetX=d,Object.defineProperties(g.metrics,{x:{get:function(){return c.metrics.offsetX+this.offsetX}},y:{get:function(){return c.metrics.offsetY}}})):"formula"===g.nodeType&&(g.updateFormula(),
g.metrics.marginX=g.metrics.marginY=g.metrics.paddingX=g.metrics.paddingY=0,g.metrics.offsetX_aux=d,Object.defineProperties(g.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}}}),g.metrics.w+=2*g.metrics.paddingX,g.metrics.ascent+=g.metrics.paddingY,g.metrics.descent+=g.metrics.paddingY,g.metrics.h+=2*g.metrics.paddingY,d+=2*g.metrics.marginX);
this.metrics.w+=g.metrics.w+2*g.metrics.marginX;this.metrics.ascent=Math.max(this.metrics.ascent,g.metrics.ascent);this.metrics.descent=Math.max(this.metrics.descent,g.metrics.descent);d+=g.metrics.w}this.metrics.h=this.metrics.ascent+this.metrics.descent}};k.prototype.updateFormula=function(){var b=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 h=this.children,d,f=0,l={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}},k=0,q=h.length;k<q;k++){d=h[k];if("text"===d.nodeType){a.ctx.font=d.style.toString(!0);var n=""!==d.value?d.value:a.in_editor?"\u200a":"";d.metrics=e(a.ctx.font);d.metrics.w=a.ctx.measureText(n).width;d.metrics.offsetX=f;Object.defineProperties(d.metrics,{x:{get:function(){return b.metrics.offsetX+b.metrics.paddingX+this.offsetX}},y:{get:function(){return b.metrics.offsetY}}});f+=b.metrics.marginX}else if("dynamicText"===d.nodeType){n=void 0===
d.decimals?p:d.evaluator.eval(d.decimals);var m=void 0===d.fixed?c:d.fixed,w=d.evaluator.eval(d.value);parseFloat(w).toString()===w.toString()&&(w=m?parseFloat(w).toFixed(n):a.removeNeedlessDecimals(parseFloat(w).toFixed(n)),w=(""+w).replace(".",d.decimal_symbol));d.evalValue=w;a.ctx.font=d.style.toString(!0);d.metrics=e(a.ctx.font);d.metrics.marginX=0;d.metrics.paddingX=0;d.metrics.w=a.ctx.measureText(w).width+2*d.metrics.paddingX;d.metrics.offsetX_aux=f;Object.defineProperties(d.metrics,{x:{get:function(){return this.offsetX}},
y:{get:function(){return this.offsetY}},offsetX:{get:function(){return b.metrics.offsetX+b.metrics.paddingX+this.offsetX_aux+this.marginX}},offsetY:{get:function(){return b.metrics.offsetY}}});f+=2*d.metrics.marginX}if("superIndex"===d.nodeType)n=d,n.updateFormula(),n.metrics.marginX=0,n.metrics.paddingX=0,n.metrics.paddingY=0,n.metrics.offsetX_aux=f,n.metrics.prevChild=l,Object.defineProperties(n.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return b.metrics.offsetX+
b.metrics.paddingX+this.offsetX_aux+this.marginX}},offsetY:{get:function(){return b.metrics.offsetY+this.ascent+(this.prevChild.metrics.descent-this.prevChild.metrics.ascent)/2-this.h}}}),n.metrics.w+=2*n.metrics.paddingX,n.metrics.ascent+=n.metrics.paddingY,n.metrics.descent+=n.metrics.paddingY,n.metrics.h+=2*n.metrics.paddingY,n.metrics.tmp_ascent=n.metrics.h+(n.metrics.prevChild.metrics.ascent-n.metrics.prevChild.metrics.descent)/2,f+=2*n.metrics.marginX;else if("subIndex"===d.nodeType)n=d,n.updateFormula(),
n.metrics.marginX=0,n.metrics.paddingX=0,n.metrics.paddingY=0,n.metrics.offsetX_aux=f,n.metrics.prevChild=l,Object.defineProperties(n.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return b.metrics.offsetX+b.metrics.paddingX+this.offsetX_aux}},offsetY:{get:function(){return b.metrics.offsetY+this.ascent+(this.prevChild.metrics.descent-this.prevChild.metrics.ascent)/2}}}),n.metrics.w+=n.metrics.paddingX,n.metrics.ascent+=n.metrics.paddingY,
n.metrics.descent+=n.metrics.paddingY,n.metrics.h+=2*n.metrics.paddingY,this.metrics.descent=n.metrics.ascent+(n.metrics.prevChild.metrics.descent-n.metrics.prevChild.metrics.ascent)/2+n.metrics.descent,f+=n.metrics.marginX;else if("fraction"===d.nodeType){m=d;m.updateFormula();n=m.children;w=n[0];n=n[1];m.metrics.marginX=parseInt(.5+.075*this.style.size);m.metrics.paddingX=0;m.metrics.paddingY=0;var x=Math.max(w.metrics.w,n.metrics.w)+2*m.metrics.paddingX;m.metrics.prevChild=l;m.metrics.offsetX_aux=
f;var y=parseInt(-l.metrics.descent+4*l.metrics.h/9);Object.defineProperties(m.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY+y}},offsetX:{get:function(){return b.metrics.offsetX+b.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return b.metrics.offsetY-y}}});Object.defineProperties(w.metrics,{parent:{value:m},maxWidth:{value:x},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(n.metrics,{parent:{value:m},maxWidth:{value:x},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=
x;m.metrics.ascent=w.metrics.h+y+2*m.metrics.paddingY;m.metrics.descent=n.metrics.h-y+2*m.metrics.paddingY;m.metrics.h=w.metrics.h+n.metrics.h+4*m.metrics.paddingY;f+=2*m.metrics.marginX}else if("radical"===d.nodeType){l=d;l.updateFormula();n=l.children;m=n[0];var z=n[1];l.metrics.marginX=parseInt(1.5+.075*this.style.size);l.metrics.paddingX=parseInt(1.5+.075*this.style.size);l.metrics.paddingY=parseInt(1.5+.05*this.style.size);l.metrics.offsetX_aux=f;Object.defineProperties(l.metrics,{x:{get:function(){return this.offsetX}},
y:{get:function(){return this.offsetY}},offsetX:{get:function(){return b.metrics.offsetX+b.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return b.metrics.offsetY}}});n=l.style.size;l.radicalSign={w:n,scaleX:n/722,scaleY:z.metrics.h/1E3};w=parseInt(m.metrics.w-2*l.radicalSign.w/3);Object.defineProperties(l.radicalSign,{parent:{value:l},displaceIndex:{value:w},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+Math.max(this.displaceIndex,0)}},
y:{get:function(){return b.metrics.offsetY-z.metrics.ascent}}});Object.defineProperties(m.metrics,{parent:{value:l},displaceIndex:{value:w},fontSize:{value:n},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 b.metrics.offsetY-this.descent-2*this.fontSize/5}}});Object.defineProperties(z.metrics,{parent:{value:l},
displaceIndex:{value:w},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 b.metrics.offsetY}}});w=m.metrics.w<2*l.radicalSign.w/3?l.radicalSign.w:parseInt(m.metrics.w+l.radicalSign.w/3);l.metrics.w=w+2*l.metrics.paddingX+z.metrics.w;l.metrics.ascent=Math.max(z.metrics.ascent,m.metrics.h+2*n/5)+
l.metrics.paddingY;l.metrics.descent=z.metrics.descent+l.metrics.paddingY;l.metrics.h=l.metrics.ascent+l.metrics.descent;f+=2*l.metrics.marginX}else if("sum"===d.nodeType){m=d;m.updateFormula();n=m.children;w=n[0];x=n[1];var G=n[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=f;Object.defineProperties(m.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},
offsetX:{get:function(){return b.metrics.offsetX+b.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return b.metrics.offsetY}}});a.ctx.font=d.style.toString();var J=e(a.ctx.font);l=parseInt(1.2*J.h);n=parseInt(.5+780*l/1E3);m.sigmaSign={w:n,h:l,scale:l/1E3};var E=Math.max(x.metrics.w,w.metrics.w,m.sigmaSign.w);m.sigmaSign.parent=m;Object.defineProperties(m.sigmaSign,{sumWidth:{value:E},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.sumWidth-
this.w)/2)}},y:{get:function(){return b.metrics.offsetY+J.descent-(this.h+J.h)/2}}});n=J.descent-x.metrics.descent-(l+J.h)/2-m.metrics.paddingY;Object.defineProperties(x.metrics,{parent:{value:m},sumWidth:{value:E},newBaselineTo:{value:n},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 b.metrics.offsetY+this.newBaselineTo}}});
l=w.metrics.ascent+J.descent+(l-J.h)/2+m.metrics.paddingY;Object.defineProperties(w.metrics,{parent:{value:m},sumWidth:{value:E},newBaselineFrom:{value:l},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 b.metrics.offsetY+this.newBaselineFrom}}});Object.defineProperties(G.metrics,{parent:{value:m},sumWidth:{value:E},
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 b.metrics.offsetY}}});m.metrics.w=E+G.metrics.w+3*m.metrics.paddingX;m.metrics.ascent=Math.max(G.metrics.ascent,-n+x.metrics.ascent)+m.metrics.paddingY;m.metrics.descent=Math.max(G.metrics.descent,l+w.metrics.descent)+m.metrics.paddingY;m.metrics.h=m.metrics.ascent+m.metrics.descent;
f+=2*m.metrics.marginX}else if("integral"===d.nodeType){m=d;m.updateFormula();n=m.children;w=n[0];x=n[1];G=n[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=f;Object.defineProperties(m.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return b.metrics.offsetX+b.metrics.paddingX+this.marginX+this.offsetX_aux}},
offsetY:{get:function(){return b.metrics.offsetY}}});a.ctx.font=d.style.toString();J=e(a.ctx.font);E=parseInt(1.2*J.h);var F=parseInt(10.5+529*E/1E3);m.sign={w:F,h:E,scale:E/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 b.metrics.offsetY+J.descent-(this.h+J.h)/2}}});n=J.descent-(E+J.h)/2-x.metrics.descent+E/3;Object.defineProperties(x.metrics,{parent:{value:m},integralWidth:{value:F},
newBaselineTo:{value:n},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 b.metrics.offsetY+this.newBaselineTo}}});l=J.descent+w.metrics.ascent/2;Object.defineProperties(w.metrics,{parent:{value:m},integralWidth:{value:F},newBaselineFrom:{value:l},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 b.metrics.offsetY+this.newBaselineFrom}}});F=Math.max(parseInt(3*F/5)+x.metrics.w,parseInt(2*F/5+w.metrics.w))+m.metrics.paddingX;Object.defineProperties(G.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 b.metrics.offsetY}}});m.metrics.w=F+G.metrics.w+2*m.metrics.paddingX;m.metrics.ascent=Math.max(G.metrics.ascent,-n+x.metrics.ascent)+m.metrics.paddingY;m.metrics.descent=Math.max(G.metrics.descent,l+w.metrics.descent,E-m.metrics.ascent)+m.metrics.paddingY;m.metrics.h=Math.max(m.metrics.ascent+m.metrics.descent,E);f+=2*m.metrics.marginX}else if("prod"===d.nodeType)m=d,m.updateFormula(),n=m.children,w=n[0],x=n[1],G=n[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=f,Object.defineProperties(m.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return b.metrics.offsetX+b.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return b.metrics.offsetY}}}),a.ctx.font=d.style.toString(),J=e(a.ctx.font),l=parseInt(1.2*J.h),n=parseInt(.5+
876*l/1E3),m.piSign={w:n,h:l,scale:l/1E3},E=Math.max(x.metrics.w,w.metrics.w,m.piSign.w),m.piSign.parent=m,Object.defineProperties(m.piSign,{prodWidth:{value:E},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.prodWidth-this.w)/2)}},y:{get:function(){return b.metrics.offsetY+J.descent-(this.h+J.h)/2}}}),n=J.descent-x.metrics.descent-(l+J.h)/2-m.metrics.paddingY,Object.defineProperties(x.metrics,{parent:{value:m},prodWidth:{value:E},newBaselineTo:{value:n},
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 b.metrics.offsetY+this.newBaselineTo}}}),l=w.metrics.ascent+J.descent+(l-J.h)/2+m.metrics.paddingY,Object.defineProperties(w.metrics,{parent:{value:m},prodWidth:{value:E},newBaselineFrom:{value:l},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 b.metrics.offsetY+this.newBaselineFrom}}}),Object.defineProperties(G.metrics,{parent:{value:m},prodWidth:{value:E},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 b.metrics.offsetY}}}),
m.metrics.w=E+G.metrics.w+3*m.metrics.paddingX,m.metrics.ascent=Math.max(G.metrics.ascent,-n+x.metrics.ascent)+m.metrics.paddingY,m.metrics.descent=Math.max(G.metrics.descent,l+w.metrics.descent)+m.metrics.paddingY,m.metrics.h=m.metrics.ascent+m.metrics.descent,f+=2*m.metrics.marginX;else if("limit"===d.nodeType){l=d;l.updateFormula();n=l.children;var D=n[0];m=n[1];n=n[2];l.metrics.marginX=parseInt(1.5+.075*this.style.size);l.metrics.paddingX=parseInt(1.5+.075*this.style.size);l.metrics.paddingY=
parseInt(1.5+.05*this.style.size);l.metrics.offsetX_aux=f;Object.defineProperties(l.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return b.metrics.offsetX+b.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return b.metrics.offsetY}}});a.ctx.font=d.style.toString();J=e(a.ctx.font);w=parseInt(.5+a.ctx.measureText("l\u00edm").width);x=parseInt(.5+a.ctx.measureText("\u2192").width);G=Math.max(w,D.metrics.w+x+m.metrics.w);
l.limitText={parent:l};Object.defineProperties(l.limitText,{limitWidth:{value:G},limitTextWidth:{value:w},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+(this.limitWidth-this.limitTextWidth)/2}}});w=J.descent+Math.max(D.metrics.ascent,m.metrics.ascent,2*J.ascent/3)+l.metrics.paddingY;l.limitArrow={parent:l};Object.defineProperties(l.limitArrow,{newBaseline:{value:w},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+D.metrics.w}},y:{get:function(){return b.metrics.offsetY+
this.newBaseline}}});Object.defineProperties(D.metrics,{parent:{value:l},newBaseline:{value:w},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 b.metrics.offsetY+this.newBaseline}}});Object.defineProperties(m.metrics,{parent:{value:l},arrowWidth:{value:x},newBaseline:{value:w},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 b.metrics.offsetY+this.newBaseline}}});Object.defineProperties(n.metrics,{parent:{value:l},limitWidth:{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.limitWidth}},offsetY:{get:function(){return b.metrics.offsetY}}});
l.metrics.w=G+n.metrics.w+3*l.metrics.paddingX;l.metrics.ascent=Math.max(n.metrics.ascent,J.ascent)+l.metrics.paddingY;x=0;n=Math.max(D.metrics.descent,m.metrics.descent,n.metrics.descent);if(0!=D.metrics.h||0!=m.metrics.h)x=w,n=Math.max(D.metrics.descent,m.metrics.descent,n-x);l.metrics.descent=x+n+l.metrics.paddingY;l.metrics.h=l.metrics.ascent+l.metrics.descent;f+=2*l.metrics.marginX}else if("matrix"===d.nodeType){w=d;w.updateFormula();n=w.children;x=w.rows;G=w.columns;w.metrics.marginX=parseInt(1.5+
.075*this.style.size);w.metrics.paddingX=parseInt(5+.075*this.style.size);w.metrics.paddingY=parseInt(1.5+.05*this.style.size);w.metrics.offsetX_aux=f;Object.defineProperties(w.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return b.metrics.offsetX+b.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return b.metrics.offsetY}}});a.ctx.font=d.style.toString();J=e(a.ctx.font);E=[];F=[];l=0;for(var B=x*G;l<B;l++){var L=
parseInt(l/G);var I=l%G;E[L]=Math.max(E[L]||0,n[l].metrics.h);F[I]=Math.max(F[I]||0,n[l].metrics.w)}var M=(1+G)*w.metrics.paddingX;for(l=0;l<G;l++)M+=F[l];var O=(1+x)*w.metrics.paddingY;for(l=0;l<x;l++)O+=E[l];m=J.descent-J.h/2;l=0;for(B=x*G;l<B;l++)L=parseInt(l/G),I=l%G,n[l].metrics.offsetX_aux=g(F,I)+(F[I]-n[l].metrics.w)/2+I*w.metrics.paddingX,n[l].metrics.offsetY_aux=g(E,L)+(E[L]-n[l].metrics.h)/2+(1+L)*w.metrics.paddingY,Object.defineProperties(n[l].metrics,{parent:{value:w},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 b.metrics.offsetY-this.matrixH/2+this.ascent+this.offsetY_aux+this.dispY}}});w.metrics.w=M;w.metrics.ascent=O/2-m;w.metrics.descent=O/2+m;w.metrics.h=w.metrics.ascent+w.metrics.descent;f+=2*w.metrics.marginX}else if("defparts"===d.nodeType){w=d;w.updateFormula();n=d.children;
x=d.parts;w.metrics.marginX=parseInt(1.5+.075*this.style.size);w.metrics.paddingX=parseInt(1.5+.075*this.style.size);w.metrics.paddingY=parseInt(1.5+.05*this.style.size);w.metrics.offsetX_aux=f;Object.defineProperties(w.metrics,{parent:{value:b},x:{get:function(){return this.offsetX-2*this.marginX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return b.metrics.offsetX+b.metrics.paddingX+3*this.marginX+this.offsetX_aux}},offsetY:{get:function(){return b.metrics.offsetY}}});a.ctx.font=
d.style.toString();J=e(a.ctx.font);G=0;E=w.metrics.paddingY;m=J.descent-J.h/2;for(l=0;l<x;l++)n[l].metrics.offsetY_aux=E,G=Math.max(G,n[l].metrics.w),E+=n[l].metrics.h+w.metrics.paddingY,Object.defineProperties(n[l].metrics,{parent:{value:w},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 b.metrics.offsetY-this.parent.metrics.defpartsH/
2+this.ascent+this.offsetY_aux+this.dispY}}});w.metrics.defpartsH=E;w.metrics.w=G+4*w.metrics.paddingX;w.metrics.ascent=E/2-m;w.metrics.descent=E/2+m;w.metrics.h=w.metrics.ascent+w.metrics.descent;f+=2*w.metrics.marginX}else if("numerator"===d.nodeType||"denominator"===d.nodeType||"index"===d.nodeType||"radicand"===d.nodeType||"from"===d.nodeType||"to"===d.nodeType||"what"===d.nodeType||"element"===d.nodeType)d.updateFormula(),d.metrics.paddingX=parseInt(1.5+.075*this.style.size),d.metrics.paddingY=
parseInt(1.5+.05*this.style.size),d.metrics.ascent+=d.metrics.paddingY,d.metrics.descent+=d.metrics.paddingY,d.metrics.h=d.metrics.ascent+d.metrics.descent,1==d.children.length&&"text"==d.children[0].nodeType&&""==d.children[0].value?(d.metrics.w=0,a.in_editor||(d.metrics.ascent=d.metrics.descent=d.metrics.h=0)):d.metrics.w+=2*d.metrics.paddingX;l=d;this.metrics.ascent=Math.max(this.metrics.ascent,d.metrics.tmp_ascent||d.metrics.ascent);this.metrics.descent=Math.max(this.metrics.descent,d.metrics.descent);
this.metrics.w+=d.metrics.w+2*d.metrics.marginX;this.metrics.h=this.metrics.ascent+this.metrics.descent;f+=d.metrics.w}};k.prototype.justifyAux=function(a){for(var b=0,c=0,e=0,f=this.children.length;e<f-1;e++)"space"===this.children[e].nodeType?b++:c+=this.children[e].metrics.w;this.updateLine((a-c)/b)};k.prototype.drawTextBlock=function(a){a.fillStyle=q;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"};k.prototype.drawTextLineBlock=function(a){for(var b=0,c=this.children.length;b<c;b++)f=!1,this.children[b].draw(a)};k.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:q;a.font=this.style.toString(f);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)}};k.prototype.drawWord=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a)};k.prototype.drawSpace=function(a){};k.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:q;a.font=this.style.toString(f);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")};k.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(f);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)};k.prototype.drawFormula=function(a){for(var b=0,c=this.children.length;b<c;b++)f=
!0,this.children[b].draw(a);this.drawBorder(a,"blue")};k.prototype.drawFraction=function(a){a.lineWidth=5;a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:q;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")};k.prototype.drawNumDen=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);
this.drawBorder(a,"blue")};k.prototype.drawSuperIndex=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};k.prototype.drawSubIndex=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};k.prototype.drawRadical=function(a){a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:q;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")};k.prototype.drawSum=function(a){a.save();a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:q;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")};k.prototype.drawIntegral=function(a){a.save();
a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:q;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")};k.prototype.drawProd=function(a){a.save();a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:q;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")};k.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:q;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")};k.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:q;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 e=c/2;a.moveTo(this.metrics.x+b+c,this.metrics.y+b-this.metrics.ascent);a.bezierCurveTo(this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent,
this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent,this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+2*this.metrics.marginX);a.lineTo(this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2-5*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+e,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+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2+5*this.metrics.marginX);a.lineTo(this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h-2*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+b+e,this.metrics.y-b-this.metrics.ascent+this.metrics.h,this.metrics.x+b+e,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-e,this.metrics.y+b-this.metrics.ascent,this.metrics.x+this.metrics.w+b-e,this.metrics.y+b-this.metrics.ascent,this.metrics.x+this.metrics.w+b-e,this.metrics.y+b-this.metrics.ascent+2*this.metrics.marginX);a.lineTo(this.metrics.x+this.metrics.w+b-e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2-5*this.metrics.marginX);
a.bezierCurveTo(this.metrics.x+this.metrics.w+b-e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+this.metrics.w+b-e,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-e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+this.metrics.w+b-e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+this.metrics.w+
b-e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2+5*this.metrics.marginX);a.lineTo(this.metrics.x+this.metrics.w+b-e,this.metrics.y+b-this.metrics.ascent+this.metrics.h-2*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+this.metrics.w+b-e,this.metrics.y-b-this.metrics.ascent+this.metrics.h,this.metrics.x+this.metrics.w+b-e,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")};k.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:q;a.beginPath();c=3*this.metrics.marginX;var e=c/2;a.moveTo(this.metrics.x+b+c,this.metrics.y+b-this.metrics.ascent);a.bezierCurveTo(this.metrics.x+
b+e,this.metrics.y+b-this.metrics.ascent,this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent,this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+2*this.metrics.marginX);a.lineTo(this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2-5*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+e,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+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2+5*this.metrics.marginX);a.lineTo(this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h-2*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+b+e,this.metrics.y-b-this.metrics.ascent+this.metrics.h,this.metrics.x+b+e,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")};k.prototype.drawGenericBlock=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};k.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)};k.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)};k.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()};k.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()};k.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()};k.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()};k.prototype.drawBorderSpecial=function(a,
c){a.beginPath();a.setLineDash([1,2]);a.strokeStyle=c;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([])};k.prototype.toRTF=function(){var a=[],c=[],d="";this.mergeTextNodes();for(var e=0,f=this.children.length;e<f;e++){var g=this.children[e];"textLineBlock"===g.nodeType&&(d+=g.toRTFAux(a,c)+(1<f&&e<f-1?"\\par":""))}g="{\\fonttbl";e=0;for(f=a.length;e<f;e++)g+="\\f"+e+"\\fcharset0 "+a[e]+";";
a="";if(0<c.length){a="{\\colortbl";e=0;for(f=c.length;e<f;e++)a+=c[e];a+="}"}return"{\\rtf1\\uc0"+(g+"}")+a+d+"}"};k.prototype.toRTFAux=function(a,c){for(var b,e,f,h=null,g="",l,k,p,x,y,z=0,G=this.children.length;z<G;z++)l=k="",b=this.children[z],p=this.addToFontTable(b.style.family,a),x=b.style.size,y=this.addToColorTable(b.style.color,c),null===y&&0<c.length&&(y=this.addToColorTable(q,c)),y!==h&&(l+="\\cf"+y,h=y),p!==e&&(l+="\\f"+p,e=p),x!==f&&(l+="\\fs"+2*x,f=x),b.style.italic&&(l+="\\i",k="\\i0"+
k),b.style.bold&&(l+="\\b",k="\\b0"+k),b.style.underline&&(l+="\\ul",k="\\ulnone"+k),b.style.overline&&(l+="\\ol",k="\\olnone"+k),"text"===b.nodeType?(b.value=b.value.replace(/\\{/g,"{").replace(/\\}/g,"}").replace(/{/g,"\\{").replace(/}/g,"\\}"),b=""!==l?l+" "+b.value+k:""!==g&&"}"!==g.charAt(g.length-1)?" "+b.value:b.value,g+=b):"formula"===b.nodeType?g+="{\\*\\mjaformula"+b.formulaToRTF(e,f,h,a,c)+"}":"componentSpace"===b.nodeType?g+="{\\*\\component\\Space "+b.value+"}":"componentNumCtrl"===b.nodeType&&
(g+="{\\*\\component\\NumCtrl "+b.value+"}");return g};k.prototype.formulaToRTF=function(a,c,d,e,f){for(var b,h="",g,l,k,p,r=0,v=this.children.length;r<v;r++)g=l="",b=this.children[r],k=this.addToFontTable(b.style.family,e),p=this.addToColorTable(b.style.color,f),null===p&&0<f.length&&(p=this.addToColorTable(q,f)),k!==a&&(g+="\\f"+k,a=k),p!==d&&(g+="\\cf"+p,"text"!==b.nodeType||"text"===b.nodeType&&""!==b.value)&&(d=p),b.style.italic&&(g+="\\i",l="\\i0"+l),b.style.bold&&(g+="\\b",l="\\b0"+l),b.style.underline&&
(g+="\\ul",l="\\ulnone"+l),b.style.overline&&(g+="\\ol",l="\\olnone"+l),"text"===b.nodeType&&""!==b.value?(b.value=b.value.replace(/\\{/g,"{").replace(/\\}/g,"}").replace(/{/g,"\\{").replace(/}/g,"\\}"),tmpRTF=""!==g?g+" "+b.value+l:"}"!==h.charAt(h.length-1)?" "+b.value:b.value,h+=tmpRTF):"dynamicText"===b.nodeType?(b.value=""===b.value?" ":b.value,h+=g+"{\\expr "+b.value+"\\decimals "+(b.decimals||2)+"\\fixed"+(b.fixed?1:0)+"}"+l):"fraction"===b.nodeType||"radical"===b.nodeType||"index"===b.nodeType||
"radicand"===b.nodeType||"sum"===b.nodeType||"integral"===b.nodeType||"prod"===b.nodeType||"limit"===b.nodeType||"from"===b.nodeType||"to"===b.nodeType||"what"===b.nodeType||"element"===b.nodeType?h+="{\\"+b.nodeType+b.formulaToRTF(a,c,d,e,f)+"}":"numerator"===b.nodeType?h+="{\\num"+b.formulaToRTF(a,c,d,e,f)+"}":"denominator"===b.nodeType?h+="{\\den"+b.formulaToRTF(a,c,d,e,f)+"}":"superIndex"===b.nodeType?h+="{\\supix"+b.formulaToRTF(a,c,d,e,f)+"}":"subIndex"===b.nodeType?h+="{\\subix"+b.formulaToRTF(a,
c,d,e,f)+"}":"matrix"===b.nodeType?h+="{\\matrix\\rows "+(b.rows||2)+"\\columns "+(b.columns||2)+b.formulaToRTF(a,c,d,e,f)+"}":"defparts"===b.nodeType&&(h+="{\\defparts\\parts "+(b.parts||2)+b.formulaToRTF(a,c,d,e,f)+"}");return h};k.prototype.addToFontTable=function(a,c){var b;a.match(/times/i)?b="Times New Roman":a.match(/courier/i)?b="Courier New":a.match(/arial/i)&&(b="Arial");a=c.indexOf(b);-1===a&&(a=c.length,c.push(b));return a};k.prototype.addToColorTable=function(a,c){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 b=c.indexOf(a);-1===b&&(b=c.length,c.push(a));return b}return null};k.prototype.mergeTextNodes=function(){for(var a=[],c=null,d=0,e=this.children.length;d<e;d++)"text"===this.children[d].nodeType?null!==c&&"text"===c.nodeType&&c.style.equals(this.children[d].style)&&(this.children[d].value=c.value+this.children[d].value,a.push(c)):this.children[d].mergeTextNodes(),c=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=k;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=String.fromCharCode,e,f,q,p,c,k,l,b,h,d,v,r=function(){};r.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=[];f="";p=q=0;k=a.charAt(0);l=!1;for(b="text";q<a.length;)c=k,k=a.charAt(q+1),l?"\\"===k||"{"===k||"}"===
k||" "===k||";"===k?(l=!1,f+=c," "===k?(q++,k=a.charAt(q+1),v=!0):v=!1,(h=f.match(/^'([0-9a-f]{2})/))?(d="","text"===b&&(d=e.pop().value),f=d+=g(parseInt(h[1],16))+f.substring(3)):(h=f.match(/^u[0-9]+/))?(d="","text"===b&&(d=e.pop().value),f=d+=g(h[0].substring(1))):("{"===f||"}"===f||"\\"==c?(e.push({type:"text",value:f+(v?" ":"")}),b="text"):(e.push({type:"controlWord",value:f}),b="controlWord"),f="")):"{"==c||"}"==c||"\\"==c?(l=!1,e.push({type:"text",value:c}),b="text"):f+=c:"\\"===c?(l=!0,""!==
f&&(e.push({type:"text",value:f}),b="text",f="")):"{"===c?(p++,""!==f&&(e.push({type:"text",value:f}),f=""),e.push({type:"openBlock",value:p}),b="openBlock"):"}"===c?(""!==f&&(e.push({type:"text",value:f}),f=""),e.push({type:"closeBlock",value:p}),b="closeBlock",p--):f+=c,q++;""!==f&&e.push({type:"text",value:f});return e};a.RTFTokenizer=r;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.max,e,f,q,p,c,k,l,b,h,d,v,r,u,A,n,m,w,x,y,z,G,J,E,F,D,B,L,I,M,O,H,P=function(b){this.evaluator=b;this.tokenizer=new a.RTFTokenizer};P.prototype.parse=function(C){e=this.tokenizer.tokenize(C);f={};p=2;if("openBlock"===e[0].type&&"fonttbl"===e[1].value){for(q=e[0].value;"closeBlock"!==e[p].type&&e[p].value!==q;)f[e[p].value]=e[p+2].value.substring(0,e[p+2].value.length-1),p+=3;p++}c={};k=0;if("openBlock"===e[p].type&&"colortbl"===e[p+1].value){q=
e[p++].value;for(p++;"closeBlock"!==e[p].type&&e[p].value!==q;)l=parseInt(e[p++].value.substring(3)).toString(16),b=parseInt(e[p++].value.substring(5)).toString(16),h=parseInt(e[p++].value.substring(4)).toString(16),";"===e[p].value&&p++,c[k++]="#"+(2>l.length?"0"+l:l)+(2>b.length?"0"+b:b)+(2>h.length?"0"+h:h);p++}A=u=r=null;M=I=L=G=z=y=x=w=m=n=!1;J=[new a.TextStyle];E=J[0];D=F=-1;B=[];d=O=new a.TextNode("","textBlock",E,this.evaluator);v=new a.TextNode("","textLineBlock",E,this.evaluator);d.addChild(v);
O.stableWidth=!0;O.hasFormula=!1;C=p;for(var N=e.length;C<N;C++){if("controlWord"==e[C].type)if(f[e[C].value])E.set({family:f[e[C].value]});else if(e[C].value.match(/^fs(\d+)/))E.set({size:parseInt(e[C].value.match(/^fs(\d+)/)[1]/2)});else if("b"==e[C].value)E.set({bold:!0}),0<B.length&&B[B.length-1].style.set({bold:!0});else if("b0"==e[C].value)E.set({bold:!1}),0<B.length&&B[B.length-1].style.set({bold:!1});else if("i"==e[C].value)E.set({italic:!0}),0<B.length&&B[B.length-1].style.set({italic:!0});
else if("i0"==e[C].value)E.set({italic:!1}),0<B.length&&B[B.length-1].style.set({italic:!1});else if("ul"==e[C].value)E.set({underline:!0}),0<B.length&&B[B.length-1].style.set({underline:!0});else if("ulnone"==e[C].value)E.set({underline:!1}),0<B.length&&B[B.length-1].style.set({underline:!1});else if("ol"==e[C].value)E.set({overline:!0}),0<B.length&&B[B.length-1].style.set({overline:!0});else if("olnone"==e[C].value)E.set({overline:!1}),0<B.length&&B[B.length-1].style.set({overline:!1});else if(e[C].value.match(/^cf(\d+)/))E.set({color:c[parseInt(e[C].value.substring(2))]}),
0<B.length&&(B[B.length-1].style.color=E.color);else if("par"==e[C].value){d=new a.TextNode("","textLineBlock",E.clone(),this.evaluator);if("textBlock"!=v.nodeType)for(v=v.parent;"textBlock"!=v.nodeType;)v=v.parent;v.addChild(d);v=d}else if("mjaformula"==e[C].value)O.hasFormula=!0,D=F,n=!0,d=new a.TextNode("","formula",E.clone(),this.evaluator),v.addChild(d),v=d,B[B.length-1]=d;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 K=B[B.length-2].style.clone();d=new a.TextNode("",e[C].value,K,this.evaluator);B[B.length-2].addChild(d);B[B.length-1]=d}else"index"==e[C].value?(K=B[B.length-2].style.clone(),K.size=g(parseInt(K.size-.5*K.size),8),d=new a.TextNode("",e[C].value,K,this.evaluator),B[B.length-2].addChild(d),B[B.length-1]=d):"to"==e[C].value||"from"==e[C].value?(K=B[B.length-2].style.clone(),K.size=g(parseInt(K.size-.2*K.size),8),d=new a.TextNode("",e[C].value,K,this.evaluator),B[B.length-
2].addChild(d),B[B.length-1]=d):"num"==e[C].value||"den"==e[C].value?(K=B[B.length-2].style.clone(),K.size=g(Math.round(K.size-.1*K.size),8),"num"==e[C].value?d=new a.TextNode("","numerator",K,this.evaluator):"den"==e[C].value&&(d=new a.TextNode("","denominator",K,this.evaluator)),B[B.length-2].addChild(d),B[B.length-1]=d):"subix"==e[C].value||"supix"==e[C].value?(K=B[B.length-2].style.clone(),K.size=g(Math.floor(K.size-.33*K.size),8),"subix"==e[C].value?d=new a.TextNode("","subIndex",K,this.evaluator):
"supix"==e[C].value&&(d=new a.TextNode("","superIndex",K,this.evaluator)),d.originalStyle=B[B.length-2].style.clone(),B[B.length-2].addChild(d),B[B.length-1]=d):"defparts"==e[C].value||"matrix"==e[C].value||"element"==e[C].value?(K=B[B.length-2].style.clone(),d=new a.TextNode("",e[C].value,K,this.evaluator),B[B.length-2].addChild(d),B[B.length-1]=d,"defparts"==e[C].value?A=d:"matrix"==e[C].value&&(u=d,u.matrix_type=0)):"parts"==e[C].value?G=!0:"type"==e[C].value?x=!0:"rows"==e[C].value?y=!0:"columns"==
e[C].value?z=!0:"expr"==e[C].value?(O.stableWidth=!1,m=!0):"decimals"==e[C].value?w=!0:"fixed1"==e[C].value?r.fixed=!0:"fixed0"==e[C].value?r.fixed=!1:"component"!=e[C].value&&("NumCtrl"==e[C].value?L=!0:"Space"==e[C].value?I=!0:"hyperlink"==e[C].value&&(M=!0));if("text"==e[C].type)if(G)A.parts=parseInt(e[C].value),G=!1;else if(x)u.matrix_type=parseInt(e[C].value),x=!1;else if(y)u.rows=parseInt(e[C].value),y=!1;else if(z)u.columns=parseInt(e[C].value),z=!1;else if(w)r.decimals=this.evaluator.parser.parse(e[C].value+
""),w=!1;else if(M){H=e[C].value.split("|")[0];K=E.clone();d=new a.TextNode(H,"hyperlink",K,this.evaluator);d.URL=e[C].value.split("|")[1];if("textLineBlock"!=v.nodeType)for(v=v.parent;"textLineBlock"!=v.nodeType;)v=v.parent;v.addChild(d);M=!1}else if(L)d=new a.TextNode(e[C].value,"componentNumCtrl",E.clone(),this.evaluator),v.addChild(d),L=!1;else if(I)d=new a.TextNode(e[C].value,"componentSpace",E.clone(),this.evaluator),v.addChild(d),I=!1;else if(m)K=B[B.length-2].style.clone(),H=this.evaluator.parser.parse(e[C].value),
d=new a.TextNode(H,"dynamicText",K,this.evaluator),B[B.length-2].addChild(d),r=B[B.length-1]=d,m=!1;else if(m||n)!m&&n&&(H=e[C].value,d=new a.TextNode(H,"text",B[B.length-1].style.clone(),this.evaluator),B[B.length-1].addChild(d));else{H=e[C].value;d=new a.TextNode(H,"text",E.clone(),this.evaluator);if("textLineBlock"!=v.nodeType)for(v=v.parent;"textLineBlock"!=v.nodeType;)v=v.parent;v.addChild(d)}else if("openBlock"==e[C].type)F=e[C].value,E=E.clone(),J.push(E),B.push(null);else if("closeBlock"==
e[C].type)e[C].value==D&&(D=-1,n=!1,v=v.parent),J.pop(),E=J[J.length-1],B.pop();else if("("==e[C].type||")"==e[C].type)K=B[B.length-1].style.clone(),K.italic="",d=new a.TextNode(e[C].type,"mathSymbol",K,this.evaluator),B[B.length-1].addChild(d);else if("+"==e[C].type||"-"==e[C].type||"*"==e[C].type||"="==e[C].type)d=new a.TextNode(e[C].type,"mathSymbol",B[B.length-1].style.clone(),this.evaluator),B[B.length-1].addChild(d)}return O.normalize()};a.RTFParser=P;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,e,f,q,p,c,k,l,b,h,d,v=function(b,c){this.parent=b;e=this.evaluator=this.parent.evaluator;f=e.parser;this.id="";this.type="2D";this.xExpr=f.parse("0");this.yExpr=f.parse("0");this.w=parseInt(b.container.width);this.h=parseInt(b.container.height);this.drawif=f.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;g=a.parent;e=a.evaluator;q=a.id;a.resizable||(a.displaceRegionNorth=g.displaceRegionNorth||0,a.displaceRegionSouth=g.displaceRegionSouth||0,a.displaceRegionEast=g.displaceRegionEast||0,a.displaceRegionWest=g.displaceRegionWest||0,l=parseInt(g.container.width),k=parseInt(g.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(k-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(k-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?(p=k-a.y,a.h>p&&(a.h=p)):(p=a.h+a.y,a.h=p>=k?k:p),0<=a.x?(c=l-a.x,a.w>c&&(a.w=c)):(c=a.w+a.x,a.w=c>=l?l:c));""==a.imageSrc&&/vacio.gif$/i.test(a.imageSrc.trim())||(a.image=g.getImage(a.imageSrc));a.OxExpr&&(h=a.OxExpr,"%"===h[h.length-1]?a.Ox=a.w*parseFloat(h)/100:(b=parseFloat(h),b!=h&&(b=0),a.Ox=b));a.OyExpr&&(d=a.OyExpr,"%"===d[d.length-1]?a.Oy=a.h*parseFloat(d)/100:(b=parseFloat(d),b!=d&&(b=0),a.Oy=b));""!==a.id&&2!==g.version?
(e.setVariable(q+"._w",a.w),e.setVariable(q+"._h",a.h),e.setVariable(q+".escala",a.scale),e.setVariable(q+".Ox",a.Ox),e.setVariable(q+".Oy",a.Oy),e.setVariable(q+".mouse_x",0),e.setVariable(q+".mouse_y",0),e.setVariable(q+".mouse_pressed",0),e.setVariable(q+".mouse_clicked",0),e.setVariable(q+".clic_izquierdo",0)):(b=e.getVariable("_w"),void 0===b&&(b=a.w),e.setVariable("_w",b),b=e.getVariable("_h"),void 0===b&&(b=a.h),e.setVariable("_h",b),b=e.getVariable("escala"),void 0===b&&(b=a.scale),e.setVariable("escala",
b),b=e.getVariable("Ox"),void 0===b&&(b=a.Ox),e.setVariable("Ox",b),b=e.getVariable("Oy"),void 0===b&&(b=a.Oy),e.setVariable("Oy",b),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==g.version&&""===a.x_axis&&""===a.y_axis&&(a.axes=""));a.w_2=a.w/2;a.h_2=a.h/2;e.setFunction(q+".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 g,e=function(e){g=this;g.parent=e;g.width=228;g.vSpace=25;g.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:"+(g.width+27)+"px;height:460px;"});g.movable=a.newHTML("div",{style:"position:absolute;left:0;top:0;width:"+(g.width+27)+"px;height:"+g.vSpace+
"px;line-height:"+g.vSpace+"px;background-color:#ddd;cursor:move;padding-left:75px;font-family:"+a.sansserif_font+";font-size:18px;"});g.movable.innerHTML="Descartes";g.container.appendChild(g.movable);g.ctrs=[]};e.prototype.init=function(){function e(c){g.newPos=a.getCursorPosition(c,document.body);g.container.style.left=g.initialPosition.x+(g.newPos.x-g.oldPos.x)*a.cssScale+"px";g.container.style.top=g.initialPosition.y+(g.newPos.y-g.oldPos.y)*a.cssScale+"px"}function q(a){a.preventDefault();document.body.removeEventListener("mousemove",
e);document.body.removeEventListener("mouseup",q)}g=this;document.body.appendChild(this.container);for(var p=g.parent.evaluator.parser,c=0,k=g.ctrs.length;c<k;c++)g.ctrs[c].expresion=p.parse("(0,"+(g.vSpace+23+35*c)+","+g.width+",35)"),g.ctrs[c].update();g.numCtr=k;c=new a.Button(g.parent,{region:"external",name:"english"==g.language?"about":"cr\u00e9ditos",font_size:p.parse("15"),expresion:p.parse("(0,"+g.vSpace+","+g.width/2+",25)")});c.actionExec={execute:a.showAbout};c.update();(new a.Button(g.parent,
{region:"external",name:"config",font_size:p.parse("15"),action:"config",expresion:p.parse("("+g.width/2+","+g.vSpace+","+g.width/2+",25)")})).update();(new a.Button(g.parent,{region:"external",name:"english"==g.language?"init":"inicio",font_size:p.parse("15"),action:"init",expresion:p.parse("(0,"+(g.vSpace+23+35*k)+","+g.width/2+",25)")})).update();(new a.Button(g.parent,{region:"external",name:"english"==g.language?"clear":"limpiar",font_size:p.parse("15"),action:"clear",expresion:p.parse("("+g.width/
2+","+(g.vSpace+23+35*k)+","+g.width/2+",25)")})).update();p=new a.Button(g.parent,{region:"external",name:"english"==g.language?"close":"cerrar",font_size:p.parse("15"),expresion:p.parse("("+g.width/4+","+(g.vSpace+46+35*k)+","+g.width/2+",25)")});p.update();p.btn.addEventListener("click",function(a){g.hide()});g.setPositionAndSize();g.movable.addEventListener("mousedown",function(c){c.preventDefault();g.oldPos=a.getCursorPosition(c,document.body);g.initialPosition={x:g.container.offsetLeft,y:g.container.offsetTop};
document.body.addEventListener("mousemove",e);document.body.addEventListener("mouseup",q)});g.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(){g=this;var a=g.vSpace+46+35*g.numCtr+25+10;g.container.style.left=Math.max(parseInt(window.innerWidth-g.width)/2,0)+"px";g.container.style.top="5px";g.container.style.height=
window.innerHeight<g.vSpace+75?g.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 g=Math.floor,e=Math.round,f=2*Math.PI,q=a.convertFont("Serif,BOLD+ITALIC,16"),p=a.convertFont("Monospaced,PLAIN,12"),c,k,l,b,h,d,v,r,u,A,n,m,w,x,y,z,G,J,E,F,D,B,L,I,M,O,H,P,C,N,K,Q,R=function(b,d){c=d=a.Space.call(this,b,d)||this;c.ratio=b.ratio;c.canvas=a.newHTML("canvas",{id:c.id+"_canvas",class:"DescartesSpace2DCanvas",width:c.w*c.ratio});c.backCanvas=a.newHTML("canvas",{id:c.id+"_background",width:c.w*c.ratio});c.canvas.style=c.backCanvas.style=
(0<c.border_width?"border:"+c.border_width+"px solid "+c.border_color.getColor()+";":"")+(c.border_radius?"border-radius:"+c.border_radius+"px;":"");c.canvas.style.zIndex=c.zIndex;c.canvas.style.width=c.backCanvas.style.width=c.w+"px";c.canvas.style.height=c.backCanvas.style.height=c.h+"px";c.ctx=c.canvas.getContext("2d");c.backCtx=c.backCanvas.getContext("2d");c.ctx.imageSmoothingEnabled=c.backCtx.imageSmoothingEnabled=!1;c.graphicControlContainer=a.newHTML("div",{id:c.id+"_graphicControls",style:"position:absolute;left:0;top:0;z-index:"+
c.zIndex+";"});c.numericalControlContainer=a.newHTML("div",{id:c.id+"_numericalControls",style:"position:absolute;left:0;top:0;z-index:"+c.zIndex+";"});c.container=a.newHTML("div",{id:c.id,class:"DescartesSpace2DContainer",style:"z-index:"+c.zIndex+";"});c.parent.arquimedes&&"#f0f8fa"===c.background.getColor()&&(c.container.style.boxShadow="0 0 5px 0 #b8c4c8");c.container.appendChild(c.backCanvas);c.container.appendChild(c.canvas);c.container.appendChild(c.graphicControlContainer);c.container.appendChild(c.numericalControlContainer);
b.container.insertBefore(c.container,b.loader);var e=c.id+".image";c.parent.images[e]=c.canvas;c.parent.images[e].ready=1;c.parent.images[e].complete=c.parent.images[e].canvas=!0;c.evaluator.setVariable(e,e);e=c.id+".back";c.parent.images[e]=c.backCanvas;c.parent.images[e].ready=1;c.parent.images[e].complete=c.parent.images[e].canvas=!0;c.evaluator.setVariable(e,e);e=""!==c.id&&2!==b.version?c.id+".":"";c.OxStr=e+"Ox";c.OyStr=e+"Oy";c.scaleStr=e+"escala";c.wStr=e+"_w";c.hStr=e+"_h";c.mxStr=e+"mouse_x";
c.myStr=e+"mouse_y";c.mpressedStr=e+"mouse_pressed";c.mclickedStr=e+"mouse_clicked";c.mclickIzqStr=e+"clic_izquierdo";c.click=0;c.resizable&&(c.wModExpr=b.evaluator.parser.parse(c.wModExpr),c.hModExpr=b.evaluator.parser.parse(c.hModExpr));"descartesJS_stage"!==c.id?c.addEvents():c.canvas.oncontextmenu=function(a){return!1};return d};$jscomp.inherits(R,a.Space);R.prototype.init=function(){c=this;this.initSpace();c.canvas&&(c.old_w=c.w,c.old_h=c.h,c.canvas.width=c.backCanvas.width=c.w*c.ratio,c.canvas.height=
c.backCanvas.height=c.h*c.ratio,c.canvas.style.width=c.backCanvas.style.width=c.w+"px",c.canvas.style.height=c.backCanvas.style.height=c.h+"px")};R.prototype.update=function(a){c=this;k=c.evaluator;l=c.parent;if(c.resizable){if(C=c.evaluator.eval(c.wModExpr),N=c.evaluator.eval(c.hModExpr),c.old_w!=C||c.old_h!=N)c.w=C,c.h=N,c.w_2=c.w/2,c.h_2=c.h/2,k.setVariable(c.wStr,c.w),k.setVariable(c.hStr,c.h),c.old_w=c.w,c.old_h=c.h,c.canvas.width=c.backCanvas.width=c.w*c.ratio,c.canvas.height=c.backCanvas.height=
c.h*c.ratio,c.canvas.style.width=c.backCanvas.style.width=c.w+"px",c.canvas.style.height=c.backCanvas.style.height=c.h+"px",a=!0}else k.setVariable(c.wStr,c.w),k.setVariable(c.hStr,c.h);c.drawIfValue=0<k.eval(c.drawif);if(c.drawIfValue){h=c.x!==k.eval(c.xExpr)+c.displaceRegionWest;d=c.y!==k.eval(c.yExpr)+l.plecaHeight+c.displaceRegionNorth;c.spaceChange=a||h||d||c.drawBefore!==c.drawIfValue||c.Ox!==k.getVariable(c.OxStr)||c.Oy!==k.getVariable(c.OyStr)||c.scale!==k.getVariable(c.scaleStr)||c.backColor!==
c.background.getColor();c.x=h?k.eval(c.xExpr)+c.displaceRegionWest:c.x;c.y=d?k.eval(c.yExpr)+l.plecaHeight+c.displaceRegionNorth:c.y;c.Ox=k.getVariable(c.OxStr);c.Oy=k.getVariable(c.OyStr);c.scale=k.getVariable(c.scaleStr);c.drawBefore=c.drawIfValue;c.scale=Math.max(1E-6,Math.min(1E6,c.scale));k.setVariable(c.scaleStr,c.scale);if(h||d)c.container.style.left=c.x+"px",c.container.style.top=c.y+"px";c.container.style.display="block";c.drawTrace=!c.spaceChange&&(!c.fixed&&!c.click||c.fixed);c.spaceChange&&
(c.backCtx.setTransform(c.ratio,0,0,c.ratio,0,0),c.drawBackground());c.ctx.setTransform(c.ratio,0,0,c.ratio,0,0);c.draw()}else c.container.style.display="none"};R.prototype.drawBackground=function(){c=this;k=c.evaluator;b=c.backCtx;b.clearRect(0,0,c.backCanvas.width,c.backCanvas.height);b.fillStyle=c.backColor=c.background.getColor();b.fillRect(0,0,c.backCanvas.width,c.backCanvas.height);c.image&&""!=c.image.src&&c.image.ready&&c.image.complete&&("topleft"===c.bg_display?b.drawImage(c.image,0,0):
"stretch"===c.bg_display?b.drawImage(c.image,0,0,c.w,c.h):"patch"===c.bg_display?(b.fillStyle=b.createPattern(c.image,"repeat"),b.fillRect(0,0,c.w,c.h)):"imgcenter"===c.bg_display&&b.drawImage(c.image,(c.w-c.image.width)/2,(c.h-c.image.height)/2));r=c.scale;u=0;for(A=0>c.w+c.h?0:c.w+c.h;r>A;)r/=10,u++;for(;r<A/10;)r*=10;b.lineWidth=1;""!==c.net&&(b.strokeStyle=c.net.getColor(),c.drawMarks(b,r/10,-1));if(2!==c.parent.version&&""!==c.net10||2===c.parent.version&&""!==c.net&&""!==c.net10)b.strokeStyle=
c.net10.getColor(),c.drawMarks(b,r,-1);if(""!==c.axes){var a="";"no"==c.x_axis&&(a+="x");"no"==c.y_axis&&(a+="y");b.strokeStyle=c.axes.getColor();b.beginPath();"no"==c.x_axis||""===c.x_axis&&2===c.parent.version||(b.moveTo(0,g(c.h/2+c.Oy)+.5),b.lineTo(c.w,g(c.h/2+c.Oy)+.5));"no"==c.y_axis||""===c.y_axis&&2===c.parent.version||(b.moveTo(g(c.w/2+c.Ox)+.5,0),b.lineTo(g(c.w/2+c.Ox)+.5,c.h));b.lineWidth=1.2;b.stroke();b.lineWidth=1;c.drawMarks(b,r,4,a);c.drawMarks(b,r/2,2,a);c.drawMarks(b,r/10,1,a)}if(""!==
c.x_axis||""!==c.y_axis)b.fillStyle=""!==c.axes?c.axes.getColor():"#000",b.font=q,b.textAlign="right",b.textBaseline="alphabetic","no"!=c.x_axis&&b.fillText(c.x_axis,g(c.w)-2,g(c.h/2+c.Oy)+12),"no"!=c.y_axis&&b.fillText(c.y_axis,g(c.w/2+c.Ox)-2,12);c.numbers&&""!=c.axes&&(b.fillStyle=c.axes.getColor(),b.font=q,b.textAlign="start",b.textBaseline="bottom",r>(c.w+c.h)/2?c.drawNumbers(b,r/5,r<=c.scale?u+1:u):r>(c.w+c.h)/4?c.drawNumbers(b,r/2,r<=c.scale?u+1:u):c.drawNumbers(b,r,u));a=0;for(var d=this.backGraphics.length;a<
d;a++)this.backGraphics[a].draw()};R.prototype.draw=function(){c=this;b=c.ctx;b.clearRect(0,0,c.canvas.width,c.canvas.height);for(var a=0,d=c.graphics.length;a<d;a++)v=c.graphics[a],""!==v.trace&&c.drawTrace&&v.drawTrace(),v.draw();a=0;for(d=c.graphicsCtr.length;a<d;a++)c.graphicsCtr[a].draw();""!=c.text&&c.click&&"L"===c.whichBtn&&(b.save(),b.strokeStyle=b.fillStyle=c.text.getColor(),b.lineWidth=1,b.font=p,b.textAlign="center",b.textBaseline="alphabetic",D=1>=c.scale?c.mouse_x.toFixed(0):c.mouse_x.toFixed(parseInt(c.scale).toString().length+
1),B=1>=c.scale?c.mouse_y.toFixed(0):c.mouse_y.toFixed(parseInt(c.scale).toString().length+1),L="("+D+","+B+")",I=g(b.measureText(L).width/2),M=c.getAbsoluteX(c.mouse_x),O=c.getAbsoluteY(c.mouse_y),H=g(M),P=g(O-10),H+I>c.w?H=c.w-I:0>H-I&&(H=I),P+1>c.h?P=c.h:0>P-14&&(P=15),b.fillText(L,H,P),b.beginPath(),b.arc(M,O,2.5,0,f,!0),b.stroke(),b.restore())};R.prototype.drawMarks=function(a,b,c,d){n=this.w;m=this.h;E=G=0;J=n;F=m;y=g(n/2+this.Ox);z=g(m/2+this.Oy);0<=c&&(G=y-c,J=y+c,E=z-c,F=z+c);a.beginPath();
if(!d||d&&!d.match("x"))for(c=-e(y/b);(w=y+e(c*b))<n;c++)a.moveTo(w+.5,E+.5),a.lineTo(w+.5,F+.5);if(!d||d&&!d.match("y"))for(c=-e(z/b);(x=z+e(c*b))<m;c++)a.moveTo(G+.5,x+.5),a.lineTo(J+.5,x+.5);a.stroke()};R.prototype.drawNumbers=function(a,b,c){n=this.w;m=this.h;y=g(n/2+this.Ox);z=g(m/2+this.Oy);for(c=-e(y/b);(w=y+e(c*b))<n;c++)a.fillText(parseFloat((c*b/this.scale).toFixed(4)),w+1,z-2);for(c=-e(z/b);(x=z+e(c*b))<m;c++)0!==parseFloat(-c*b/this.scale)&&a.fillText(parseFloat((-c*b/this.scale).toFixed(4)),
y+5,x+5)};R.prototype.addEvents=function(){function b(a){window.focus();document.activeElement.blur();if(h.evaluator.variables[h.id+".DESCARTESJS_no_fixed"]||!h.fixed||h.sensitive_to_mouse_movements)h.click=0,h.evaluator.setVariable(h.mpressedStr,0),h.evaluator.setVariable(h.mclickedStr,1),h.evaluator.setVariable(h.mclickIzqStr,1),window.removeEventListener("touchmove",f),window.removeEventListener("touchend",b),a.stopPropagation(),a.preventDefault(),h.parent.update()}function c(b){document.activeElement.blur();
window.focus();b.stopPropagation();b.preventDefault();h.click=0;h.evaluator.setVariable(h.mpressedStr,0);h.evaluator.setVariable(h.mclickedStr,1);h.evaluator.setVariable(h.mclickIzqStr,1);"R"===h.whichBtn&&(window.removeEventListener("mousemove",e),h.posZoom==h.posZoomNew&&a.showConfig&&(h.parent.externalSpace.show(),h.posZoom=!1,h.posZoomNew=!0));window.removeEventListener("mousemove",f);window.removeEventListener("mouseup",c);h.parent.deactivateGraphicControls();h.parent.update()}function d(b){h.posAnte=
a.getCursorPosition(b,h.container);h.mouse_x=h.getRelativeX(h.posAnte.x);h.mouse_y=h.getRelativeY(h.posAnte.y);h.evaluator.setVariable(h.mxStr,h.mouse_x);h.evaluator.setVariable(h.myStr,h.mouse_y);h.evaluator.setVariable(h.mclickedStr,0);h.evaluator.setVariable(h.mclickIzqStr,0);h.parent.update()}function e(b){b.preventDefault();h.posZoomNew=a.getCursorPosition(b,h.container).y;h.evaluator.setVariable(h.scaleStr,h.tempScale+h.tempScale/45*((h.posZoom-h.posZoomNew)/10));h.parent.update()}function f(b){b.preventDefault();
b.stopPropagation();h.fixed||(h.posNext=a.getCursorPosition(b,h.container),K=h.posAnte.x-h.posNext.x,Q=h.posAnte.y-h.posNext.y,h.evaluator.setVariable(h.OxStr,h.Ox-K),h.evaluator.setVariable(h.OyStr,h.Oy-Q));d(b)}var h=this;h.posZoom=h.posZoomNew=null;h.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(h.evaluator.variables[h.id+
".DESCARTESJS_no_fixed"]||!h.fixed||h.sensitive_to_mouse_movements)h.parent.clearClick(),h.click=1,h.evaluator.setVariable(h.mpressedStr,1),h.evaluator.setVariable(h.mclickedStr,0),h.evaluator.setVariable(h.mclickIzqStr,0),h.parent.deactivateGraphicControls(),d(a),window.addEventListener("touchmove",f),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();h.parent.clearClick();h.click=1;h.parent.deactivateGraphicControls();h.whichBtn=a.whichBtn(b);"R"===h.whichBtn?(window.addEventListener("mouseup",c),h.posZoom=a.getCursorPosition(b,h.container).y,h.posZoomNew=h.posZoom,h.fixed||(h.tempScale=h.scale,window.addEventListener("mousemove",e))):"L"===h.whichBtn&&(h.evaluator.setVariable(h.mpressedStr,1),h.evaluator.setVariable(h.mclickedStr,0),h.evaluator.setVariable(h.mclickIzqStr,
0),d(b),window.addEventListener("mousemove",f),window.addEventListener("mouseup",c))});document.addEventListener("visibilitychange",function(a){c(a)});document.addEventListener("mouseleave",function(a){h.click=0;h.evaluator.setVariable(h.mpressedStr,0);h.evaluator.setVariable(h.mclickedStr,1);h.evaluator.setVariable(h.mclickIzqStr,1);window.removeEventListener("mousemove",f);window.removeEventListener("mouseup",c)})};a.Space2D=R;return a}(descartesJS||{});
descartesJS=function(a){var g,e,f;function q(b,c){H=a.subtract3D(b,a.scalarProduct3D(c,a.dotProduct3D(b,c)));P=a.add3D(b,a.scalarProduct3D(H,-2));C=a.norm3D(P);return 0!==C?a.scalarProduct3D(P,1/C):a.scalarProduct3D(b,-1)}if(a.loadLib)return a;var p=Math.floor,c=Math.max,k=Math.cos,l=Math.sin,b,h,d,v,r,u,A,n,m,w,x,y,z,G,J,E,F=[],D,B,L,I,M,O,H,P,C,N,K,Q=function(b,c){d=c=a.Space.call(this,b,c)||this;d.backCanvas=a.newHTML("canvas",{id:d.id+"_background",width:d.w+"px",height:d.h+"px"});d.canvas=a.newHTML("canvas",
{id:d.id+"_canvas",width:d.w+"px",height:d.h+"px",class:"DescartesSpace3DCanvas",style:"z-index: "+d.zIndex+";"});d.ctx=d.canvas.getContext("2d");d.ctx.imageSmoothingEnabled=!1;d.canvas.style=d.backCanvas.style=(0<d.border_width?"border:"+d.border_width+"px solid "+d.border_color.getColor()+";":"")+(d.border_radius?"border-radius:"+d.border_radius+"px;":"");var e=d.id+".image";d.parent.images[e]=d.canvas;d.parent.images[e].ready=1;d.parent.images[e].complete=!0;d.parent.images[e].canvas=!0;d.evaluator.setVariable(e,
e);d.graphicControlContainer=a.newHTML("div",{id:d.id+"_graphicControls",style:"position:absolute;left:0px;top:0px;z-index:"+d.zIndex+";"});d.numericalControlContainer=a.newHTML("div",{id:d.id+"_numericalControls",style:"position:absolute;left:0px;top:0px;z-index:"+d.zIndex+";"});d.container=a.newHTML("div",{id:d.id,class:"DescartesSpace3DContainer",style:"z-index:"+d.zIndex+";"});d.container.appendChild(d.backCanvas);d.container.appendChild(d.canvas);d.container.appendChild(d.graphicControlContainer);
d.container.appendChild(d.numericalControlContainer);b.container.insertBefore(d.container,b.loader);d.eye={x:0,y:0,z:0};d.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}];e=0;for(var h=d.lights.length;e<h;e++)d.lights[e]=a.normalize3D(d.lights[e]);d.light3={x:0,y:0,z:0};d.intensity=[.4,.5,.3,0];d.userIntensity=0;d.dim=1;d.tmpIntensity=[];d.OxStr=d.id+".Ox";d.OyStr=d.id+".Oy";d.scaleStr=d.id+".escala";d.wStr=d.id+"._w";d.hStr=d.id+"._h";d.obsStr=d.id+".observador";d.ojoXStr=
d.id+".Ojo.x";d.ojoYStr=d.id+".Ojo.y";d.ojoZStr=d.id+".Ojo.z";d.rotZStr=d.id+".rot.z";d.rotYStr=d.id+".rot.y";d.userIDimStr=d.id+".userIlum.dim";d.userIIStr=d.id+".userIlum.I";d.userIxStr=d.id+".userIlum.x";d.userIyStr=d.id+".userIlum.y";d.userIzStr=d.id+".userIlum.z";d.evaluator.setVariable(d.rotZStr,0);d.evaluator.setVariable(d.rotYStr,0);d.evaluator.setVariable(d.userIDimStr,d.dim);d.evaluator.setVariable(d.userIIStr,d.userIntensity);d.evaluator.setVariable(d.userIxStr,0);d.evaluator.setVariable(d.userIyStr,
0);d.evaluator.setVariable(d.userIzStr,0);K=new a.Primitive3D({vertices:[new a.Vector4D(0,0,0,1)],type:"vertex"},d);d.evaluator.setFunction(d.id+"._X3D2D_",function(a,b,c){K.vertices[0].x=a;K.vertices[0].y=b;K.vertices[0].z=c;K.computeDepth(d);return K.projVert[0].x});d.evaluator.setFunction(d.id+"._Y3D2D_",function(a,b,c){K.vertices[0].x=a;K.vertices[0].y=b;K.vertices[0].z=c;K.computeDepth(d);return K.projVert[0].y});d.resizable&&(d.wModExpr=b.evaluator.parser.parse(d.wModExpr),d.hModExpr=b.evaluator.parser.parse(d.hModExpr));
d.ratio=1;d.addEvents();return c};$jscomp.inherits(Q,a.Space);Q.prototype.init=function(a){d=this;d.initSpace();d.canvas&&(d.canvas.width=d.backCanvas.width=d.w,d.canvas.height=d.backCanvas.height=d.h,d.canvas.style.width=d.backCanvas.style.width=d.w+"px",d.canvas.style.height=d.backCanvas.style.height=d.h+"px");d.w_2=d.w/2;d.h_2=d.h/2;d.w_plus_h=d.w+d.h;d.oldMouse={x:0,y:0};d.S={x:d.h/1080*-20.6*(40/d.scale),y:0,z:0};d.Ojo={x:3*d.w_2,y:0,z:0};d.evaluator.setVariable(d.ojoXStr,d.Ojo.x);d.evaluator.setVariable(d.ojoYStr,
d.Ojo.y);d.evaluator.setVariable(d.ojoZStr,d.Ojo.z)};Q.prototype.update=function(a){d=this;b=d.evaluator;h=d.parent;b.setVariable(d.wStr,d.w);b.setVariable(d.hStr,d.h);d.drawIfValue=0<b.eval(d.drawif);if(d.drawIfValue){d.resizable&&(wModExpr=d.evaluator.eval(d.wModExpr),hModExpr=d.evaluator.eval(d.hModExpr),d.old_w!=wModExpr||d.old_h!=hModExpr)&&(d.w=wModExpr,d.h=hModExpr,d.w_2=d.w/2,d.h_2=d.h/2,b.setVariable(d.wStr,d.w),b.setVariable(d.hStr,d.h),d.old_w=d.w,d.old_h=d.h,d.canvas.width=d.backCanvas.width=
d.w*d.ratio,d.canvas.height=d.backCanvas.height=d.h*d.ratio,d.canvas.style.width=d.backCanvas.style.width=d.w+"px",d.canvas.style.height=d.backCanvas.style.height=d.h+"px",a=!0,d.S={x:d.h/1080*-20.6*(40/d.scale),y:0,z:0},d.Ojo={x:3*d.w_2,y:0,z:0},d.evaluator.setVariable(d.ojoXStr,d.Ojo.x),d.evaluator.setVariable(d.ojoYStr,d.Ojo.y),d.evaluator.setVariable(d.ojoZStr,d.Ojo.z));u=d.x!==b.eval(d.xExpr)+d.displaceRegionWest;A=d.y!==b.eval(d.yExpr)+h.plecaHeight+d.displaceRegionNorth;d.spaceChange=a||u||
A||d.drawBefore!==d.drawIfValue||d.Ox!==b.getVariable(d.OxStr)||d.Oy!==b.getVariable(d.OyStr)||d.Ojo.x!==b.getVariable(d.ojoXStr)||d.Ojo.y!==b.getVariable(d.ojoYStr)||d.Ojo.z!==b.getVariable(d.ojoZStr)||d.scale!==b.getVariable(d.scaleStr);d.x=u?b.eval(d.xExpr)+d.displaceRegionWest:d.x;d.y=A?b.eval(d.yExpr)+h.plecaHeight+d.displaceRegionNorth:d.y;d.Ojo.x=b.getVariable(d.ojoXStr);d.Ojo.y=b.getVariable(d.ojoYStr);d.Ojo.z=b.getVariable(d.ojoZStr);d.Ox=b.getVariable(d.OxStr);d.Oy=b.getVariable(d.OyStr);
d.scale=b.getVariable(d.scaleStr);d.drawBefore=d.drawIfValue;if(a||void 0==d.observer){a=0;for(var e=d.parent.controls.length;a<e;a++)d.parent.controls[a].id===d.obsStr&&(N=!0);d.observer=N?b.getVariable(d.obsStr)||2.5*d.w_plus_h:2.5*d.w_plus_h;d.observer=c(d.observer,.25*d.w_plus_h);b.setVariable(d.obsStr,d.observer)}1E-6>d.scale?(d.scale=1E-6,b.setVariable(d.scaleStr,1E-6)):1E6<d.scale&&(d.scale=1E6,b.setVariable(d.scaleStr,1E6));if(u||A)d.container.style.left=d.x+"px",d.container.style.top=d.y+
"px";d.container.style.display="block";d.dim=b.getVariable(d.userIDimStr);d.userIntensity=b.getVariable(d.userIIStr);d.light3={x:parseInt(b.getVariable(d.userIxStr)),y:parseInt(b.getVariable(d.userIyStr)),z:parseInt(b.getVariable(d.userIzStr))};d.updateCamera();d.draw()}else d.container.style.display="none"};Q.prototype.updateCamera=function(){this.eye=a.scalarProduct3D(this.Ojo,1/this.scale)};Q.prototype.rotateVertex=function(b){w=a.degToRad(d.evaluator.getVariable(d.rotZStr));x=k(w);y=l(w);g=b.x*
x-b.y*y;e=b.x*y+b.y*x;f=b.z;w=a.degToRad(d.evaluator.getVariable(d.rotYStr));x=k(w);y=l(w);return{x:f*y+g*x,y:e,z:f*x-g*y}};Q.prototype.project=function(a){d=this;this.evaluator.getVariable("URL.oldProj");var b=d.eye.x/(a.x-d.eye.x);return{x:d.getAbsoluteX(b*(d.eye.y-a.y)),y:d.getAbsoluteY(b*(d.eye.z-a.z)),z:d.eye.x-a.x}};Q.prototype.computeColor=function(b,c,d){b.match("rgba")?b=a.RGBAToHexColor(b):b.match("#")&&(b=new a.Color(b.substring(1)));I=a.subtract3D(this.eye,c.average);M=a.norm3D(I);O=a.scalarProduct3D(I,
1/M);this.lights[3]=a.subtract3D(this.light3,c.average);E=a.norm3D(this.lights[3]);for(var e=0,h=this.intensity.length-1;e<h;e++)F[e]=this.intensity[e]*this.dim;F[3]=this.userIntensity*this.userIntensity/E||0;D=d?this.dim/2:this.dim/4;B=0;L=0>c.direction?c.normal:a.scalarProduct3D(c.normal,-1);e=0;for(h=this.lights.length;e<h;e++)d?(B=Math.max(0,a.dotProduct3D(q(this.lights[e],L),O)),B*=B*B):B=Math.max(0,a.dotProduct3D(this.lights[e],L)),D+=F[e]*B;D=Math.min(D,1);z=p(b.r*D);G=p(b.g*D);J=p(b.b*D);
return"rgba("+z+","+G+","+J+","+b.a+")"};Q.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++)r=this.graphics[c],v.splitFace(r),r.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++)r=this.graphics[c],r.split&&v.splitFace(r);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()};Q.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=[],h=0,f=a.length,g=.001,l,k;;){l=f;for(c=0;c<b;c++)if(!a[c].drawn){k=!0;for(var m=0;m<b;m++)if(m!=c&&!a[m].drawn&&a[c].inFrontOf(d,a[m],g)){k=!1;break}k&&(f--,e[h++]=a[c],a[c].drawn=!0)}if(0==f)break;else if(f==l){if(g*=10,.1<g){for(c=0;c<b;c++)a[c].drawn||(e[h++]=a[c],a[c].drawn=!0);break}}else g=.001}for(c=0;c<b;c++)e[c].draw(this.ctx,this)};
Q.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}};Q.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",h,!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",h,!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 h(b){if(!f.fixed&&f.click){n=(f.getAbsoluteX(f.oldMouse.x)-f.getAbsoluteX(f.mouse_x))/4;m=(-f.getAbsoluteY(f.oldMouse.y)+f.getAbsoluteY(f.mouse_y))/
4;if(n!==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)-n,f.beta=a.radToDeg(f.beta)-m,f.evaluator.setVariable(f.rotZStr,f.alpha),f.evaluator.setVariable(f.rotYStr,-f.beta),f.disp.x=n,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.deactivateGraphicControls();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",h);window.addEventListener("touchend",b);c.preventDefault()});this.canvas.addEventListener("mousedown",function(b){document.body.focus();f.click=1;f.parent.deactivateGraphicControls();
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",h),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=Q;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,e,f,q,p,c,k=function(c,b){var e=a.Space.call(this,c,b)||this;g=e.parent.evaluator;void 0!=e._w_&&(c=g.parser.parse(e._w_),e._w_="number"!=c.type?c:void 0);void 0!=e._h_&&(c=g.parser.parse(e._h_),e._h_="number"!=c.type?c:void 0);e.isFirefox=/firefox/i.test(window.navigator.userAgent);e.file=e.file?e.file.trim():"";e.file.match(/^\[/)&&e.file.match(/\]$/)?e.file=g.parser.parse(e.file.substring(1,e.file.length-1)):e.file.match(/^'/)&&e.file.match(/'$/)?
e.file=g.parser.parse(e.file):e.file=g.parser.parse("'"+e.file+"'");e.oldFile=g.eval(e.file);e.MyIFrame=a.newHTML("iframe",{marginheight:0,marginwidth:0,frameborder:0,scrolling:"auto",style:"position:absolute;left:0;top:0;"});0!=e.oldFile&&e.MyIFrame.setAttribute("src",e.oldFile);e.container=a.newHTML("div",{id:e.id,style:(a.isIOS?"overflow:scroll;-webkit-overflow-scrolling:touch;overflow-scrolling:touch;":"")+"position:absolute;width:"+e.w+"px;height:"+e.h+"px;left:"+e.x+"px;top:"+e.y+"px;z-index:"+
e.zIndex+";background-repeat:no-repeat;background-position:center;"});e.container.appendChild(e.MyIFrame);e.imageSrc&&(e.container.style.backgroundImage="url("+e.imageSrc+")");e.parent.container.insertBefore(e.container,e.parent.loader);e.MyIFrame.onload=function(b){var c=this;e.evaluator.setFunction(e.id+".set",function(a,b){c.contentWindow.postMessage({type:"set",name:a,value:b},"*");return 0});e.evaluator.setFunction(e.id+".update",function(){c.contentWindow.postMessage({type:"update"},"*");return 0});
e.evaluator.setFunction(e.id+".exec",function(a,b){c.contentWindow.postMessage({type:"exec",name:a,value:b},"*");return 0});e.evaluator.setFunction(e.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.openExternalFile(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});e.ImReady=!e.isFirefox;e.isFirefox||(e.container.style.visibility="visible",e.container.style.opacity="1",e.container.style.zIndex=e.zIndex,e.container.style.display=e.drawIfValue?"block":"none");e.MyIFrame.style.visibility="visible";e.container.style.backgroundImage=""};e.update=e.iframeUpdate;e.evaluator.setVariable(e.id+"._scroll",0);return e};$jscomp.inherits(k,a.Space);k.prototype.init=function(){p=this;p.initSpace();p.MyIFrame&&Object.assign(p.MyIFrame.style,{width:p.w+"px",
height:p.h+"px"})};k.prototype.iframeUpdate=function(a){g=this.evaluator;this.drawIfValue=0<g.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!==g.eval(this.xExpr)+this.displaceRegionWest;f=this.y!==g.eval(this.yExpr)+
this.parent.plecaHeight+this.displaceRegionNorth;this.x=e?g.eval(this.xExpr)+this.displaceRegionWest:this.x;this.y=f?g.eval(this.yExpr)+this.parent.plecaHeight+this.displaceRegionNorth:this.y;void 0!=this._w_&&(a=g.eval(this._w_),this.w!==a&&(this.container.style.width=this.MyIFrame.style.width=a+"px",this.w=a));void 0!=this._h_&&(a=g.eval(this._h_),this.h!==a&&(this.container.style.height=this.MyIFrame.style.height=a+"px",this.h=a));if(e||f)this.container.style.left=this.x+"px",this.container.style.top=
this.y+"px";q=g.eval(this.file);q!==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=q,this.MyIFrame.contentWindow.location.replace(q));c=g.getVariable(this.id+
"._scroll");1==c?(this.MyIFrame.setAttribute("scrolling","yes"),this.MyIFrame.style.overflow=""):-1==c?(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=k;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=1,e=function(e){this.children=e.children;this.lessonParser=e.lessonParser;this.images=e.images;this.images.length=e.images.length;this.audios=e.audios;this.audios.length=e.audios.length;this.descartesApp=e;this.imgLoader=a.newHTML("div",{class:"DescartesLoaderImage"});this.progress=a.newHTML("progress",{class:"PBL",value:0,max:100});e.imgLoader?(e.loader.style.backgroundColor="rgba(0,0,0,0)",this.imgLoader.setAttribute("style","background-image:url("+
e.imgLoader+");background-size:contain;")):(g=e.width<e.height?e.width/1144:e.height/1092,g=2.5<g?2.5:g,this.imgLoader.setAttribute("style","background-image:url("+a.loaderImg.src+");background-position:50% 33.5%;background-size:"+880*g+"px;"),this.progress.setAttribute("style","visibility:visible; left:"+(e.width-726*g)/2+"px; top:"+(33.5*e.height/100+940*g/2)+"px; width:"+726*g+"px; height:"+14*g+"px;"));e.loader.appendChild(this.imgLoader);e.loader.appendChild(this.progress);e.firstRun=!1;this.initPreloader()};
e.prototype.initPreloader=function(){var e=this,g=e.children,p=e.images,c=e.audios,k=/[\w\.\-//]*(\.png|\.jpg|\.gif|\.svg|\.webp)/gi,l=/[\w\.\-//]*(\.ogg|\.oga|\.mp3|\.wav)/gi;p["lib/DescartesCCLicense.png"]=a.getCCLImg();p["lib/DescartesCCLicense.png"].ready=1;var b,h;var d=0;for(b=g.length;d<b;d++)if("rtf"!==g[d].name){if(g[d].value.match(/'macro'|'makro'/g)){var v="";var r=e.lessonParser.split(g[d].value);var u=0;for(h=r.length;u<h;u++)"expresion"===babel[r[u][0]]&&(v=r[u][1]);if(v)var A=(A=document.getElementById(v))&&
"descartes/macro"==A.type?A.text:a.openExternalFile(v);if(A&&(r=A.match(k)))for(v=0,h=r.length;v<h;v++)u=r[v],u.toLowerCase().match(/vacio.gif$/)||""==u.substring(0,u.length-4)||(p[u]=new Image,p[u].addEventListener("load",function(){this.ready=1}),p[u].addEventListener("error",function(){this.errorload=1}),p[u].src=u)}if(r=g[d].value.match(k))for(v=0,h=r.length;v<h;v++)u=r[v],u.toLowerCase().match(/vacio.gif$/)||""==u.substring(0,u.length-4)||(p[u]=new Image,p[u].addEventListener("load",function(){this.ready=
1}),p[u].addEventListener("error",function(){this.errorload=1}),p[u].src=u);if(r=g[d].value.match(l))for(v=0,u=r.length;v<u;v++)e.initAudio(r[v])}for(var n in p)p.hasOwnProperty(n)&&e.images.length++;for(n in c)c.hasOwnProperty(n)&&e.audios.length++;var m=e.images.length+e.audios.length;0<m&&e.progress.setAttribute("max",m);var w,x=function(){w=0;for(var b in p)p.hasOwnProperty(b)&&(p[b].ready||p[b].errorload)&&w++;for(b in c)c.hasOwnProperty(b)&&(c[b].ready||c[b].errorload)&&w++;e.progress.setAttribute("value",
w);w!=m?e.timer=a.setTimeout(x,1):e.descartesApp.initBuildApp()};x()};e.prototype.initAudio=function(e){var f=this.audios;f[e]=new Audio(e);f[e].filename=e;var g=function(){this.ready=1},c=function(){this.canPlayType("audio/"+this.filename.substring(this.filename.length-3))||"mp3"!=this.filename.substring(this.filename.length-3)?(console.warn("El archivo '"+e+"' no puede ser reproducido"),this.errorload=1):(f[e]=new Audio(this.filename.replace("mp3","ogg")),f[e].filename=this.filename.replace("mp3",
"ogg"),f[e].addEventListener("canplaythrough",g),f[e].addEventListener("load",g),f[e].addEventListener("error",c),f[e].load())};f[e].addEventListener("canplaythrough",g);f[e].addEventListener("load",g);f[e].addEventListener("error",c);a.hasTouchSupport?(f[e].load(),f[e].play(),a.setTimeout(function(){f[e].pause()},20),f[e].ready=1):f[e].load()};a.DescartesLoader=e;return a}(descartesJS||{});
descartesJS=function(a){function g(a){for(var b="[",c=0,d=a.length;c<d;c++)Array.isArray(a[c])?b+=g(a[c]):(f=a[c]||0,"string"==typeof f&&(f="'"+f+"'"),b+=f),c<d-1&&(b+=",");return b+"]"}function e(){q=window.innerWidth/this.width;p=window.innerHeight/this.height;a.cssScale=c=Math.min(q,p);this.container.style.transformOrigin="0 0";q<p?(this.container.style.left="0",this.container.style.transform="translate3d(0px, 0px, 0px) scale("+c+")"):(this.container.style.left="50%",this.container.style.transform=
"translate3d(0px, 0px, 0px) scale("+c+") translate(-50%, 0)")}if(a.loadLib)return a;var f,q,p,c,k=function(c){this.animation={playing:!1,play:function(){},stop:function(){},reinit:function(){}};this.ratio=a._ratio;this.applet=c;this.parentC=c.parentNode;this.width=parseFloat(c.getAttribute("width"));this.height=parseFloat(c.getAttribute("height"));this.decimal_symbol=".";this.decimal_symbol_regexp=/\./g;this.language="espa\u00f1ol";this.children=c.getElementsByTagName("param");a.ccLicense=!0;for(var b=
0,e=this.children.length;b<e;b++)"CreativeCommonsLicense"===this.children[b].name&&(a.ccLicense="no"!==this.children[b].value);this.code=c.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()};k.prototype.init=function(){this.stop();this.evaluator=new a.Evaluator(this);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 Creditos|http://arquimedes.matem.unam.mx/Descartes5/creditos/conCCL.html}\\par }":
"";for(var c=this.children,b,f=0,d=0,g=a.ccLicense?90:0,k=0,p=c.length;k<p;k++)b=c[k],"rtf_height"==b.name&&(f=parseInt(b.value)+120||this.height),"Buttons"==babel[b.name]&&(this.buttonsConfig=this.lessonParser.parseButtonsConfig(b.value),d=this.buttonsConfig.height),"image_loader"==b.name&&(this.imgLoader=b.value),"expand"==b.name&&(this.expand=b.value),"docBase"==b.name&&(this.docBase=b.value,b=a.newHTML("base",{id:"descartesJS_base",href:this.docBase}),document.head.appendChild(b));this.arquimedes&&
(this.ratio=1,f&&(this.height=f+d+g));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.container.parentNode.style.width="100vw",this.container.parentNode.style.height="100vh",this.scaleToFit=e,this.scaleToFit());"cover"==this.expand&&(this.scaleToFit=function(){this.width=window.innerWidth;this.height=window.innerHeight;this.container.width=this.width;this.container.height=
this.height;this.container.setAttribute("style","width:"+this.width+"px;height:"+this.height+"px;");if(this.spaces)for(var a=0,b=this.spaces.length;a<b;a++)this.spaces[a].initSpace(),this.spaces[a].init(),this.spaces[a].update(!0)},this.scaleToFit());this.spaces=[];this.firstRun?(this.loader.style.display="block",new a.DescartesLoader(this)):this.initBuildApp()};k.prototype.initBuildApp=function(){a.showConfig=!0;for(var c=this.children,b,e=this.lessonParser,d=[],f=[],g=[],k=[],p=[],n=[],m=0,q=c.length;m<
q;m++)if(b=c[m],"editable"==babel[b.name])a.showConfig="false"==babel[b.value]?!1:!0;else if("language"==babel[b.name])this.language=b.value;else if("pleca"==b.name)b=e.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=e.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 x=(this.width-780)/2,y=parseInt(this.height)-this.plecaHeight-this.buttonsConfig.height-45;k.push("space='descartesJS_stage' type='text' abs_coord='yes' expresion='[10,20]' background='yes' text='"+b.value.replace(/'/g,"&squot;")+"'");k.push("space='descartesJS_stage' type='text' abs_coord='yes' expresion='["+x+","+(y-25)+"]' background='yes' text='"+
this.licenseA+"'");a.ccLicense&&k.push("space='descartesJS_stage' type='image' expresion='["+(x+15)+","+y+"]' background='yes' abs_coord='yes' file='lib/DescartesCCLicense.png'")}else"E"==b.name.charAt(0)?(b.value.match(/'HTMLIFrame'/)&&this.nIframes++,d.push(b.value)):/^C_/.test(b.name)?f.push(b.value):/^A_/.test(b.name)?g.push(b.value):/^G_/.test(b.name)?(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),k.push(b.value)):/^S_/.test(b.name)?p.push(b.value):"Animation"==babel[b.name]&&n.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));m=0;for(q=d.length;m<q;m++)c=e.parseSpace(d[m]),this.arquimedes&&this.stage.container.appendChild(c.container),this.spaces.push(c),this.zIndex++;m=0;for(q=k.length;m<q;m++)if(a.DEBUG.elemIndex=m,d=e.parseGraphic(k[m]))this.editableRegionVisible=this.editableRegionVisible||d.visible,d.space.addGraph(d);m=0;for(q=p.length;m<q;m++)(d=e.parse3DGraphic(p[m]))&&d.space.addGraph(d,!0);m=0;for(q=f.length;m<q;m++)this.controls.push(e.parseControl(f[m]));
m=0;for(q=g.length;m<q;m++)e.parseAuxiliar(g[m]);m=0;for(q=n.length;m<q;m++)this.animation=e.parseAnimation(n[m]);this.configRegions();this.updateAuxiliaries();this.updateAuxiliaries();m=0;for(q=this.controls.length;m<q;m++)this.controls[m].init();this.updateControls();this.updateSpaces(!0);var z=this;this.nIframes?a.setTimeout(function(){z.finishInit()},200*this.nIframes):this.finishInit()};k.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 c=new CustomEvent("descartesReady",{detail:this});window.dispatchEvent(c)}catch(h){console.warn("CustomEvents not supported in this browser")}var b=this;this.evaluator.setFunction("openKB",function(a,c,e,f,g,l,k,m,p,q,y){b.keyboard.show(null,a,c,e,f,{x:g,y:l,w:k,h:m,fs:p+"px",value:q+"",type:"custom"},y)});this.readyApp=!0};k.prototype.adjustSize=function(){document.body.style.margin=document.body.style.padding=this.parentC.style.margin=this.parentC.style.padding=
"0px";var c=parseInt(this.width)+30,b=parseInt(this.height)+90;window.moveTo((parseInt(screen.width)-c)/2,(parseInt(screen.height)-b)/2);window.resizeTo(c,b);a.onResize()};k.prototype.configRegions=function(){var c=this.evaluator.parser,b=this.buttonsConfig||{},e=this.container,d="15",f=100,g=100,k=100,p=100;2==this.version&&(d="14",f=63,g=50,k=44,p=53);var n=0,m=0,q=0,x=0,y=0,z=this.northSpace.controls,G=this.southSpace.controls,J=this.eastSpace.controls,E=this.westSpace.controls;if(0<b.rowsNorth||
0<z.length||b.about||b.config){0>=b.rowsNorth?(n=b.height,b.rowsNorth=1):n=b.height*b.rowsNorth;var F=this.northSpace.container;F.id="descartesJS_north";F.setAttribute("style","width:"+e.width+"px;height:"+n+"px;left:0;top:"+this.plecaHeight+"px;");e.insertBefore(F,this.loader);F=e.width;var D=0;b.about?(D=f,F-=D):f=0;b.config&&(F-=g);var B=Math.ceil(z.length/b.rowsNorth),L=F/B;var I=0;for(var M=z.length;I<M;I++)z[I].expresion=c.parse("("+(D+I%B*L)+","+b.height*Math.floor(I/B)+","+L+","+b.height+
")"),z[I].drawif=c.parse("1"),z[I].init();b.about&&(I=new a.Button(this,{region:"north",name:"english"==this.language?"about":"cr\u00e9ditos",font_size:c.parse(d),expresion:c.parse("(0, 0, "+f+", "+n+")")}),I.actionExec={execute:a.showAbout},I.update());b.config&&(new a.Button(this,{region:"north",name:"config",font_size:c.parse(d),action:"config",expresion:c.parse("("+(F+f)+", 0, "+g+", "+n+")")})).update()}if(0<b.rowsSouth||0<G.length||b.init||b.clear){0>=b.rowsSouth?(m=b.height,b.rowsSouth=1):
m=b.height*b.rowsSouth;f=e.width;D=0;b.init?(D=k,f-=D):k=0;b.clear&&(f-=p);F=this.southSpace.container;F.id="descartesJS_south";F.setAttribute("style","width:"+e.width+"px;height:"+m+"px;left:0;bottom:0;");e.insertBefore(F,this.loader);B=Math.ceil(G.length/b.rowsSouth);L=f/B;I=0;for(M=G.length;I<M;I++)G[I].expresion=c.parse("("+(D+I%B*L)+","+b.height*Math.floor(I/B)+","+L+","+b.height+")"),G[I].drawif=c.parse("1"),G[I].init();b.init&&(new a.Button(this,{region:"south",name:"english"==this.language?
"init":"inicio",font_size:c.parse(d),action:"init",expresion:c.parse("(0, 0, "+k+", "+m+")")})).update();b.clear&&(new a.Button(this,{region:"south",name:"english"==this.language?"clear":"limpiar",font_size:c.parse(d),action:"clear",expresion:c.parse("("+(f+k)+", 0, "+p+", "+m+")")})).update()}if(0<J.length)for(I=e.height-n-m,x=b.widthEast,F=this.eastSpace.container,F.id="descartesJS_east",F.setAttribute("style","width:"+x+"px;height:"+I+"px;right:0;top:"+n+"px;"),e.insertBefore(F,this.loader),I=
0,M=J.length;I<M;I++)J[I].expresion=c.parse("(0,"+b.height*I+","+x+","+b.height+")"),J[I].drawif=c.parse("1"),J[I].init();if(0<E.length)for(I=e.height-n-m,y=b.widthWest,F=this.westSpace.container,F.id="descartesJS_west",F.setAttribute("style","width: "+y+"px;height:"+I+"px;left:0;top:"+n+"px;"),e.insertBefore(F,this.loader),I=0,M=E.length;I<M;I++)E[I].expresion=c.parse("(0,"+b.height*I+","+y+","+b.height+")"),E[I].drawif=c.parse("1"),E[I].init();if(this.editableRegionVisible)for(q=b.height,F=this.editableRegion.container,
F.id="descartesJS_editableRegion",F.setAttribute("style","position:absolute;width:"+e.width+"px;height:"+q+"px;left:0;top:"+(e.height-m-b.height)+"px;"),e.insertBefore(F,this.loader),c=this.editableRegion.textFields,e=e.width/c.length,b=a.getFieldFontSize(q),I=0,M=c.length;I<M;I++)"div"==c[I].type?(F.appendChild(c[I].container),c[I].container.setAttribute("style","font-family:"+a.sansserif_font+";width:"+(e-4)+"px;height:"+q+"px;position:absolute;left:"+I*e+"px;top:0;"),E=c[I].container.firstChild,
E.setAttribute("style","font-family:"+a.sansserif_font+";font-size:"+b+"px;padding-top:0;background-color:#e0e4e8;position:absolute;left:0;top:0;height:"+q+"px;text-align:center;line-height:"+q+"px;"),J=E.offsetWidth,E.style.width=J+"px",E.firstChild.textContent=E.firstChild.textContent.substring(3,E.firstChild.textContent.length-3),c[I].container.lastChild.setAttribute("style","font-family:"+a.monospace_font+";font-size:"+b+"px;width:"+(e-J)+"px;height:"+q+"px;position:absolute;left:"+J+"px;top:0;border:2px groove white;")):
(F.appendChild(c[I]),c[I].setAttribute("style","font-family:"+a.monospace_font+";font-size:"+b+"px;width:"+e+"px;height:"+q+"px;position:absolute;left:"+I*e+"px;top:0;border:2px groove white;"));this.displaceRegionNorth=n;this.displaceRegionSouth=m+(q||0);this.displaceRegionEast=x;this.displaceRegionWest=y;I=0;for(M=this.spaces.length;I<M;I++)this.spaces[I].init()};k.prototype.update=function(){this.updateAuxiliaries();this.updateControls();this.updateEvents();this.updateControls();this.updateSpaces()};
k.prototype.clearClick=function(){for(var a=0,b=this.spaces.length;a<b;a++)this.spaces[a].clearClick()};k.prototype.removeButtonClick=function(){a.newBlobContent=null;for(var c=0,b=this.controls.length;c<b;c++)this.controls[c].buttonClick=!1};k.prototype.deactivateGraphicControls=function(){for(var a,b=0,c=this.controls.length;b<c;b++)a=this.controls[b],"GraphicControl"==a.type&&a.deactivate()};k.prototype.updateAuxiliaries=function(){for(var a=0,b=this.auxiliaries.length;a<b;a++)this.auxiliaries[a].update()};
k.prototype.updateEvents=function(){for(var a=0,b=this.events.length;a<b;a++)this.events[a].update()};k.prototype.updateControls=function(){for(var a=0,b=this.controls.length;a<b;a++)this.controls[a].update()};k.prototype.updateSpaces=function(a){for(var b=0,c=this.spaces.length;b<c;b++)this.spaces[b].update(a)};k.prototype.clear=function(){for(var a=0,b=this.spaces.length;a<b;a++)this.spaces[a].spaceChange=!0,this.spaces[a].drawBackground&&this.spaces[a].drawBackground()};k.prototype.play=function(){this.animation.play()};
k.prototype.stop=function(){this.animation.stop()};k.prototype.reinitAnimation=function(){this.animation.reinit()};k.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)};k.prototype.getImage=function(a){var b=this.images;return a?(b[a]||(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),b[a]):new Image};k.prototype.getAudio=function(c){var b=this.audios;if(c){if(!b[c]){c.lastIndexOf(".");b[c]=new Audio(c);var e=function(a){this.ready=1};b[c].addEventListener("canplaythrough",e);var d=function(a){this.canPlayType("audio/"+c.substring(c.length-3))||"mp3"!=c.substring(c.length-3)?(console.warn("El archivo '"+c+"' no puede ser reproducido"),this.errorload=1):(b[c]=new Audio(c.replace("mp3","ogg")),b[c].addEventListener("canplaythrough",e),b[c].addEventListener("load",
e),b[c].addEventListener("error",d),b[c].load())};b[c].addEventListener("error",d);b[c].play();a.setTimeout(function(){b[c].pause()},15)}return b[c]}return new Audio};k.prototype.getControlByCId=function(a){return this.getControlById(a,!0)};k.prototype.getControlById=function(a,b){b=b?"cID":"id";for(var c,d=0,e=this.controls.length;d<e;d++)if(c=this.controls[d],c[b]==a)return c;return{update:function(){},w:0,h:0}};k.prototype.getSpaceByCId=function(a){return this.getSpaceById(a,!0)};k.prototype.getSpaceById=
function(a,b){b=b?"cID":"id";for(var c,d=0,e=this.spaces.length;d<e;d++)if(c=this.spaces[d],c[b]==a)return c;return{update:function(){},w:0,h:0}};k.prototype.getURLParameters=function(){var a=window.location.href,b=a.indexOf("?");if(-1!=b){a=decodeURIComponent(a.substring(b+1)).split("&");for(var c=0,d=a.length;c<d;c++)b=a[c].split("="),2==b.length&&(+b[1]==+b[1]&&(b[1]=parseFloat(b[1])),this.evaluator.setVariable("URL."+b[0],b[1]))}};k.prototype.getState=function(){var a="",b=this.evaluator.variables,
c;for(c in b)if(b.hasOwnProperty(c)){var d=b[c];"string"==typeof d&&(d="'"+d+"'");void 0!=d&&"rnd"!=c&&"\u03c0"!=c&&"pi"!=c&&"e"!=c&&"Infinity"!=c&&"-Infinity"!=c&&"object"!=typeof d&&(a=""!=a?a+"\n"+c+"="+d:c+"="+d)}d=this.evaluator.vectors;for(var e in d)d.hasOwnProperty(e)&&(a+="\n"+e+"="+g(d[e]));e=this.evaluator.matrices;for(var f in e)e.hasOwnProperty(f)&&(a+="\n"+f+"="+g(e[f]));return a};k.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()};k.prototype.getEvaluation=function(){for(var a=correct=0,b="",c=0,d=this.controls.length;c<d;c++)"textfield"==this.controls[c].gui&&this.controls[c].evaluate&&(a++,correct+=
this.controls[c].ok,this.controls[c].value=""==this.controls[c].value?"''":this.controls[c].value,b+=" \\n "+this.controls[c].id+"="+this.controls[c].value+"|"+this.controls[c].ok);return"questions="+a+" \\n correct="+correct+" \\n wrong="+(a-correct)+b};k.prototype.showSolution=function(){for(var a=this.controls,b=0,c=a.length;b<c;b++)"textfield"==a[b].gui&&a[b].evaluate&&a[b].changeValue(a[b].getFirstAnswer());this.update()};k.prototype.showAnswer=function(){for(var a=0,b=this.saveState.length;a<
b;a++)this.evaluator.eval(this.saveState[a]);this.update()};k.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=k;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(g,e){g="Error: "+g+" en\u300a "+e+" \u300b";var f="";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])f=" en la l\u00ednea "+(a.DEBUG.lineCount+1);g+=e+"\u300c"+a.DEBUG.idName+"\u300d, en el param\u00e9tro \u300c"+a.DEBUG.paramName+"\u300d"+f+".";break;case "Graphic":g+="En el gr\u00e1fico #"+(a.DEBUG.elemIndex+1)+" de tipo \u300c"+a.DEBUG.idName+"\u300d, en el param\u00e9tro \u300c"+a.DEBUG.paramName+"\u300d."}console.info(g)}};return a}(descartesJS||{});
descartesJS=function(a){function g(){e().forEach(function(c){a.apps.push(new a.DescartesApp(c));c.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 f(){document.querySelectorAll(".DescartesAppContainer").forEach(function(a){a.remove()})}function q(c){c=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>'});c.innerHTML=e+"</div>";document.body.appendChild(c);a.getFeatures();a.hasCanvas?(window.scrollTo(0,10),f(),g(),window.addEventListener("resize",a.onResize),
window.scrollTo(0,0)):document.getElementById("StyleDescartesApps").innerHTML="applet.DescartesJS,applet,ajs.DescartesJS,ajs{display:block;}";c.remove()}if(a.loadLib)return a;a.apps=[];a.getDescartesApps=function(){return a.apps};(function(){var c=document.getElementById("StyleDescartesApps");c&&c.remove();c=a.newHTML("style",{id:"StyleDescartesApps",type:"text/css",rel:"stylesheet"});c.innerHTML="applet.DescartesJS,applet,ajs.DescartesJS,ajs{display:none;}";document.head.appendChild(c)})();a.onResize=
function(c){0<a.apps.length&&a.apps[0].scaleToFit()};var p=Object.create(null);a.onMessage=function(c){if(0<a.apps.length){var e=c.data;if(e)if("set"===e.type)"string"==typeof e.value||"number"==typeof e.value?a.apps[0].evaluator.setVariable(e.name,e.value):e.value&&void 0!=e.value.rows?a.apps[0].evaluator.matrices[e.name]=e.value:a.apps[0].evaluator.vectors[e.name]=e.value;else if("update"===e.type)a.apps[0].update();else if("exec"===e.type)(c=a.apps[0].evaluator.getFunction(e.name))&&c.apply(a.apps[0].evaluator,
e.value.toString().split(","));else if("isResizeNeeded"===e.type)c.source.postMessage({type:"doResize"},"*");else if("doResize"===e.type)0<a.apps.length&&a.apps[0].adjustSize();else if("change_config"===e.type){p[e.filename]?c=p[e.filename]:(c=a.newHTML("div"),c.innerHTML=e.content,c=c.getElementsByTagName("param"),p[e.filename]=c);var f=document.querySelector("base");f||(f=a.newHTML("base"),document.body.appendChild(f));f.setAttribute("href",e.filename);a.apps[0].children=c;a.apps[0].init()}}};void 0==
a.loadLib&&(a.loadLib=!0,window.addEventListener("load",q),window.addEventListener("message",a.onMessage),["webkitTransitionEnd","transitionend","oTransitionEnd","MSTransitionEnd"].forEach(function(c){window.addEventListener(c,function(c){a.onResize(c)})}),document.fonts.ready.then(function(){setTimeout(function(){a.apps.forEach(function(a){a.updateControls();a.updateSpaces(!0)})},500)}));return a}(descartesJS||{});
