/*
 Joel Espinosa Longi
 jlongi@im.unam.mx
 https://github.com/jlongi/DescartesJS
 LGPL - http://www.gnu.org/licenses/lgpl.html
 2019-01-17
*/
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.SIMPLE_FROUND_POLYFILL=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(a,g,k){a!=Array.prototype&&a!=Object.prototype&&(a[g]=k.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,k,f){if(g){k=$jscomp.global;a=a.split(".");for(f=0;f<a.length-1;f++){var m=a[f];m in k||(k[m]={});k=k[m]}a=a[a.length-1];f=k[a];g=g(f);g!=f&&null!=g&&$jscomp.defineProperty(k,a,{configurable:!0,writable:!0,value:g})}};$jscomp.polyfill("Array.prototype.fill",function(a){return a?a:function(a,k,f){var g=this.length||0;0>k&&(k=Math.max(0,g+k));if(null==f||f>g)f=g;f=Number(f);0>f&&(f=Math.max(0,g+f));for(k=Number(k||0);k<f;k++)this[k]=a;return this}},"es6","es3");
var babel=function(a){if(a.loadLib)return a;a.loadLib=!0;a.falso=a["false"]=a.fals=a.gezurra=a.faux=a.fals="false";a.verdadero=a["true"]=a.veritable=a.egia=a.vrai=a.verdadeiro=a.veritable="true";a.no=a.ez=a.non=a["n\u00e3o"]="false";a["s\u00ed"]=a.yes=a.bai=a.oui=a.si=a["sim "]="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.texto=
a.text=a.testua=a.texte="text";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.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.ancho=a.width=a.ample=a.zabalera=a.large=a.largura="width";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="text";a.punto=a.point=a.punt=a.puntu=a.ponto="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="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.inicio=a.init=a.inici=a.hasiera=a.commencement=a["in\u00edcio"]="init";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.alto=a.height=a.alt=a.altu=a.haut=a.altura="height";a.x=a.left="x";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.ancho=a.depth=a.amplada=a.zabalera=a.largeur=a.ancho=a.profundidade=a.amplada=a.width="width";a.largo=a.length=a.llargada=a.luzera=a.longueur=a.longo=a.comprimento=a.llargada="length";
a.alto=a.height=a["al\u00e7ada"]=a.altu=a.hauteur=a.alto=a.altura=a["al\u00e7ada"]="height";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.imagen=a.bg_image=a.imatge=a.irudia=a.imaxe=a.imagem_de_fundo=a.image="image";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="imgcenter";a.archivo=a.file=a.fitxer=a.artxibo=a.fichier=a.arquivo="file";a.tipo_de_macro=a.macro_type=a.tipus_de_macro=a.makro_mota=a.type_de_macro=a.tipo_de_macro=a.tipo_de_macro=a.tipus_de_macro="macro_type";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.imagen=a.image=a.imatge=a.irundia=a.imaxe=a.imagem="image";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.tipo=a.type=a.tipus=a.mota="type";a.R2="R2";a.R3="R3";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["ecuaci\u00f3n"]=a.equation=a["equaci\u00f3"]=a.ekuazio=a["\u00e9quation"]=a["equa\u00e7\u00e3o"]="equation";a.punto=a.dot=a.punt=a.puntu=a.point=a.ponto="point";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.loop="loop";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.cssClass="cssClass";a.doc="doc";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="expand";a.fit=a.escalar="fit";a.code="code";a.jsfun="jsfun";return a}(babel||{}),descartesJS=function(a){if(a.loadLib)return a;var g,k,f,m;a.serif_font="descartesJS_serif,DJS_symbola,DJS_extra,DJS_serif,Times,'Times New Roman','Liberation Serif','Nimbus Roman No9 L Regular',serif";a.sansserif_font="descartesJS_sansserif,DJS_symbola,DJS_sansserif,Helvetica,Arial,'Liberation Sans','Nimbus Sans L',sans-serif";
a.monospace_font="descartesJS_monospace,DJS_symbola,DJS_monospace,'Courier New',Courier,'Liberation Mono','Nimbus Mono L',monospace";a.convertFont=function(e){if(""==e)return"";g=e.split(",");k="";k+=a.getFontStyle(g[1]);k+=g[2]+"px ";return k+=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){m="";a=a.toLowerCase();"bold"==a?m+="Bold ":"italic"==a||"italics"==a?m+="Italic ":"bold+italic"==a&&(m+="Italic Bold ");return m};a.getTextWidth=function(e,d){a.ctx.font=d;return Math.round(a.ctx.measureText(e).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};document.createElement("canvas");var e;a.getFontMetrics=function(a){var d={};e=parseInt(a.match(/(\d+\.*)+px/)[0]);a.match("sansserif")?(d.ascent=
-3.140767846E-4*(e^2)+.921017849*e+.7767317469,d.descent=-5.851175551E-4*(e^2)+.2674451709*e+1.0887015962,d.h=d.ascent+d.descent,d.baseline=d.ascent):a.match("serif")?(d.ascent=-3.647238191E-5*(e^2)+.8914890964*e+.668615541,d.descent=-9.807742367E-4*(e^2)+.3184618868*e+.8663797537,d.h=d.ascent+d.descent,d.baseline=d.ascent):a.match("monospace")&&(d.ascent=1.192160435E-4*(e^2)+.7541188887*e+1.4106492466,d.descent=-.001256260588*(e^2)+.3926891751*e+.57969422598,d.h=d.ascent+d.descent,d.baseline=d.ascent);
return d};return a}(descartesJS||{});
descartesJS=function(a){function g(){var a,b,c,d,e,l,n;Number.prototype.oToFixed=Number.prototype.toFixed;Number.prototype.toFixed=function(f){f=f||0;f=0>f?0:f>>0;a=this.toString();-1!==a.indexOf("e")&&(d=a.split("e"),l="-"===d[0][0]?"-":"",e="-"===l?parseFloat(d[0].substring(1)).oToFixed(11):parseFloat(d[0]).oToFixed(11),n=d[1]>>0,b=e.indexOf("."),0>b+n?(b=0>b?1:b,a=l+"0."+Array(Math.abs(b+n)+1).join("0")+e.replace(".","")):(e=e.replace(".",""),a=l+e+Array(n-e.length+2).join("0")));b=a.indexOf(".");
extraZero="";-1===b?(0<f&&(a+="."),a+=Array(f+1).join("0")):(c=a.length-b-1,a=c>=f?11>=f?parseFloat(a).oToFixed(f):0<f?a.substring(0,b+f+1):a.substring(0,b):a+Array(f-c+1).join("0"));return a}}if(a.loadLib)return a;var k=2*Math.PI,f=360/k,m=k/360,e=Math.floor,h,d,c,u,l,b,n,y,q,r;a.rangeOK=1;a.cssScale=1;a.extend=function(a,b){if("function"==typeof Object.create)a.prototype=Object.create(b.prototype);else if(a.prototype.__proto__)a.prototype.__proto__=b.prototype;else for(var c in b.prototype)b.prototype.hasOwnProperty(c)&&
(a.prototype[c]=b.prototype[c]);a.prototype.uber=b.prototype};a.radToDeg=function(a){return a*f};a.degToRad=function(a){return a*m};a.drawLine=function(a,b,c,d,l,n,f){a.lineWidth=f||1;a.strokeStyle=n||"black";r=a.lineWidth%2?.5:0;a.beginPath();a.moveTo(e(b)+r,e(c)+r);a.lineTo(e(d)+r,e(l)+r);a.stroke()};a.getColor=function(a,b){if("string"==typeof b)return b;h=a.eval(b);d=e(255*h[0][0]);c=e(255*h[0][1]);u=e(255*h[0][2]);l=1-h[0][3];return"rgba("+d+","+c+","+u+","+l+")"};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/.test(navigator.userAgent);b=document.createElement("canvas");a.hasCanvas=b.getContext&&b.getContext("2d");a.hasCanvas&&(a.ctx=document.createElement("canvas").getContext("2d"),a._ratio=1.5);g()};var w,p;a.removeNeedlessDecimals=function(a){if("string"==typeof a&&(w=a.indexOf("."),
-1!=w)){p=a.substring(w);if(0==parseFloat(p))return a.substring(0,w);for(var b=p.length;0<b;b--)if(0!=p.charAt(b))return a.substring(0,w+b+1)}return a};a.returnValue=function(a){return"number"===typeof a?parseFloat(a.toFixed(11)):a};a.whichBtn=function(a){return null!==a.which?2>a.which?"L":2===a.which?"M":"R":2>a.button?"L":4===a.button?"M":"R"};a.getCursorPosition=function(c,d){c.touches?(b=c.touches[0],n=b.pageX,y=b.pageY):(n=c.pageX,y=c.pageY);q=d.getBoundingClientRect();return{x:(n-window.pageXOffset-
q.left)/a.cssScale,y:(y-window.pageYOffset-q.top)/a.cssScale}};window.requestAnimationFrame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame;window.cancelAnimationFrame=window.cancelAnimationFrame||window.mozCancelAnimationFrame;a.setInterval=function(a,b){function c(){(new Date).getTime()-d>=b&&(a.call(),d=(new Date).getTime());e.value=requestAnimationFrame(c)}if(!requestAnimationFrame)return setInterval(a,b);var d=
(new Date).getTime(),e={};e.value=requestAnimationFrame(c);return e};a.clearInterval=function(a){a&&(cancelAnimationFrame?cancelAnimationFrame(a.value):clearInterval(a))};a.setTimeout=function(a,b){function c(){(new Date).getTime()-d>=b?a.call():e.value=requestAnimationFrame(c)}if(!requestAnimationFrame)return setTimeout(a,b);var d=(new Date).getTime(),e={};e.value=requestAnimationFrame(c);return e};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&ntilde;o funcional:</dt>\n<dd>\n<nobr>Jos&eacute; Luis Abreu Leon,</nobr>\n<nobr>Jos&eacute; R. Galo Sanchez,</nobr>\n<nobr>Juan Madrigal Muga</nobr>\n</dd>\n<dt>Autores del software:</dt>\n<dd>\n<nobr>Jos&eacute; Luis Abreu Leon,</nobr>\n<nobr>Marta Oliver&oacute; Serrat,</nobr>\n<nobr>Oscar Escamilla Gonz&aacute;lez,</nobr>\n<nobr>Joel Espinosa Longi</nobr>\n</dd></dl>\n<p>\nEl software en Java est&aacute; 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&aacute; bajo licencia\n<a href='http://www.gnu.org/licenses/lgpl.html'>LGPL</a>\n</p>\n<p>\nLa documentaci&oacute;n y el c&oacute;digo fuente se encuentran en :\n<br>\n<a href='http://arquimedes.matem.unam.mx/Descartes5/'>http://arquimedes.matem.unam.mx/Descartes5/</a>\n</p>";
a.ccLicense&&(b+="<p>\nEste objeto, creado con Descartes, est&aacute; 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 c=window.open("","creditos","width=700,height=500,titlebar=0,toolbar=0,location=0,menubar=0,resizable=0,scrollbars=0,status=0");
c.document.write(b);c.document.close()};a.splitSeparator=function(a){a=a.replace(/\\n/g,"\n");for(var b=!1,c,d=[],e=0,l=0,n=a.length;l<n;l++)c=a.charAt(l),"'"===c&&(b=!b),b||";"!==c&&"\n"!==c||(d.push(a.substring(e,l).replace(/\n/g,"\\n")),e=l+1);d.push(a.substring(e).replace(/\n/g,"\\n"));return d};a.preventDefault=function(a){a.preventDefault();return!1};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,k;a.cacheFiles={};a.openExternalFile=function(f){if(a.cacheFiles[f])return a.cacheFiles[f];g=null;var m=!1;if(window.XMLHttpRequest)try{m=new XMLHttpRequest}catch(e){m=!1}else if(window.ActiveXObject)try{m=new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{m=new ActiveXObject("Microsoft.XMLHTTP")}catch(h){m=!1}}k=m;k.open("GET",f,!1);try{k.send(null),g=200===k.status||304===k.status?k.responseText:k.responseText||"",g=404===k.status?"":g,g.match(String.fromCharCode(65533))&&
(k.open("GET",f,!1),k.overrideMimeType("text/plain; charset=ISO-8859-1"),k.send(null),g=k.responseText)}catch(e){console.log("Error to load the file :",f),g=null}return g};a.addExternalFileContent=function(f,g){a.cacheFiles[f]=g};return a}(descartesJS||{});
descartesJS=function(a){function g(a){r=a.indexOf("--radial--");-1!=r&&(a=a.substring(0,r));e=a.trim();a={ignoreAcents:!1,ignoreCaps:!1,regExp:null};e[0]==e[e.length-1]&&"'"==e[0]&&(a.ignoreCaps=!0,e=e.substring(1,e.length-1),"`"==e[0]&&"\u00b4"==e[e.length-1]&&(a.ignoreAcents=!0,e=e.substring(1,e.length-1)));"`"==e[0]&&"\u00b4"==e[e.length-1]&&(a.ignoreAcents=!0,e=e.substring(1,e.length-1),e[0]==e[e.length-1]&&"'"==e[0]&&(a.ignoreCaps=!0,e=e.substring(1,e.length-1)));"*"===e.charAt(0)&&"*"!==e.charAt(e.length-
1)?e=e.substring(1)+"$":"*"!==e.charAt(0)&&"*"===e.charAt(e.length-1)?e="^"+e.substring(0,e.length-1):"*"!==e.charAt(0)&&"*"!==e.charAt(e.length-1)?e="^"+e+"$":"*"===e.charAt(0)&&"*"===e.charAt(e.length-1)&&(e=e.substring(1,e.length-1));a.regExp=e.replace(/\?/g,"[\\S\\s]{1}");return a}function k(a,b){e=(a||"").trim();a={ignoreAcents:!1,ignoreCaps:!1,regExp:null};a.expr=e.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,d){c=parseFloat(c);u=a.expr[0];l=a.expr[1];b=d.eval(u.expr);n=d.eval(l.expr);y="("==u.type||"["==u.type;q=")"==l.type||"]"==l.type;return y&&c>b&&q&&c<=n?1:0}function m(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 e,h,d,c,u,l,b,n,y,q,r;a.buildRegularExpresionsPatterns=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 c=0,l=a.length;c<l;c++){h=a[c].split("&");d=[];for(var n=0,f=h.length;n<f;n++)e=h[n],-1===e.indexOf(",")||"("!==
e.charAt(0)&&"["!==e.charAt(0)||")"!==e.charAt(e.length-1)&&"]"!==e.charAt(e.length-1)?d.push(g(e)):d.push(k(e,b));a[c]=d}return a};a.escorrecto=function(b,d,e,l){e=e||a.externalEvaluator;l=l||a.buildRegularExpresionsPatterns(b,e);d=m(d);b=0;for(var n=l.length;b<n;b++){h=l[b];c=!0;for(var g=0,k=h.length;g<k;g++)c=h[g].regExp?c&&!!d.match(new RegExp(m(h[g].regExp),"i")):c&&f(h[g],d,e);if(c)return 1}return 0};a.esCorrecto=function(b,d,l,n){l=l||a.externalEvaluator;n=n||a.buildRegularExpresionsPatterns(b,
l);b=0;for(var g=n.length;b<g;b++){h=n[b];c=!0;for(var k=0,q=h.length;k<q;k++)(e=h[k].regExp)?(h[k].ignoreAcents&&(d=m(d),e=m(e)),h[k].ignoreCaps&&(d=d.toLowerCase(),e=m(e).toLowerCase()),c=c&&!!d.match(e)):c=c=c&&f(h[k],d,l);if(c)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, ";a.getCCLImg=
function(){var a=new Image;a.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFgAAAAfCAMAAABUFvrSAAABC1BMVEUAAAC1urSEhYRDREMNDg2EhoR5fHkpKSmRk5EbGxuRlJGVmZQoKShAQEBwcHCTmJNQUVAQEBBgYGCAgIC/v78ODg5QUFDf39/////v7++fn5+Rj49aV1jj4+PIx8cwMDB9f3zW1dUyMTGamJkZGRkNDA12c3SjoaEjHyC6ubkpKikoJSY/OzxoZWaHhoesq6s/NzljX2HPz891cnN4dXbx8fGflpqOh4uenZ0xLS4kJCQoKCjo5+ePj4+1tbUtLS3g3+Cvr6/JyMggICAqKip+e3wfGxyEgYIqJyeYlpd/gX5ubGyMiovLyst6fXmeoJ18f3xdXl2ChYJwcm81NjWWmZYyMzE+Pz6JjIk4KLQtAAACcklEQVR4AbyVhXbjMBREx2UIGWq/MCcqMy2Wu8z0/1+yz5ElKyrjlG99bpQR4eniPEmeRTwyOgbO2Oi4Y2ViEpzJiTuQVDw1DZ3pGVM7mwGyuVwWyOQlyd9MtLgAwPX8IPA9F0DBEM8hjIgThZjL35YAUF7XL5JMidUZ7Z2ExwyI/yFxZkDKFYtUa7WqJgASbz0inWI9HXMDYVOJKcQEt4lWm72dbq+qCT/TF5x5SZR4ir1quNqc9LyAKOURJuO3sCiWluGvYFWTiGpibb0nRFmSRDwNd4OGUnQxLcXIEscDPOJkEZPNLSFEr9pMCW3viF2iPbEviRSPAD5ZKQFy1SFHHEB2kYMktR6AXjMl2y/ES65ZiFdMlHgULhcRhNmsL3+8JiIXo9eI2dHbF6Iyr8mbt8FAfGCIx+CxEHGyh+DEf3sYu7wKSbb3qCk4S4rM94+IVoUwqwB4iHUcR8FxqY56dHhcGnQxEJ/IyQOMyWNSEfv76K2enimyJ8T5+Tvx3pw8ICBKetZ1B4n4A0KylxuT6nmnW942ybngfNyW5EYxZyHdIDlzg3yqWOTz6mpTEruK4saxz1XEP2QVD9zScvKSWdOTl8NYuqlR93J1dcBwMjcRKS7AJb3cDrODH3SMUUflyz2PzSnu4tIN8oDoLR1dvqUfKP562SE09VAxvjnOdzYbx1Akj80feGB+Dh/0Rd8FfjnONzw4jXjM9tX0Gypyf0B+cfQfzK2H6KL5q3mZTpleUPJJKZF/Wy+lgNWGM6Wu/xlnuAd1bBok+TCijhNY+eMM5S+M2EVIQvYALaDz95+y/jO1l49Yy+15IPzfkAUAdrZiwIT3fTYAAAAASUVORK5CYII=";
return a};a.getSvgMenu=function(){return"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCI+PHBhdGggZD0iTTYuNjQgOEwxMiAxMi45NjIgMTcuMzYgOCAxOSA5LjUxOSAxMiAxNiA1IDkuNTE5eiIvPjwvc3ZnPg=="};a.getSvgCheckbox=function(){return"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0NSIgaGVpZ2h0PSI0NSI+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzcuMDk1IDYuMjg0TDE1LjQ3MyAyNy45MDVsLTcuNTY4LTcuNTY3TDIuNSAyNS43NDNsMTIuOTczIDEyLjk3M0w0Mi41IDExLjY5eiIgY29sb3I9IiMwMDAiIHNvbGlkLWNvbG9yPSIjMDAwMDAwIiBzdHlsZT0iYmxvY2stcHJvZ3Jlc3Npb246dGI7aXNvbGF0aW9uOmF1dG87bWl4LWJsZW5kLW1vZGU6bm9ybWFsO3RleHQtZGVjb3JhdGlvbi1jb2xvcjojMDAwO3RleHQtZGVjb3JhdGlvbi1saW5lOm5vbmU7dGV4dC1kZWNvcmF0aW9uLXN0eWxlOnNvbGlkO3RleHQtaW5kZW50OjA7dGV4dC10cmFuc2Zvcm06bm9uZSIgd2hpdGUtc3BhY2U9Im5vcm1hbCIvPjwvc3ZnPg=="};
a.symbolFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.extraBFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.extraBIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.extraIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.extraRFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
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, "};
return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.floor,k=Math.min,f,m,e,h,d,c,u,l,b,n,y,q,r,w;a.Color=function(a,b){this.b=this.g=this.r=0;this.a=1;this.evaluator=b;this.getColor=this.getColorStr;if(a){if(babel[a]&&("net"===babel[a]&&(a="rojo"),a=babel[a],this.r=parseInt("0x"+a.substring(1,3),16),this.g=parseInt("0x"+a.substring(3,5),16),this.b=parseInt("0x"+a.substring(5,7),16),this.colorStr=a),6===a.length&&(this.r=parseInt("0x"+a.substring(0,2),16),this.g=parseInt("0x"+a.substring(2,4),
16),this.b=parseInt("0x"+a.substring(4,6),16),this.colorStr="#"+a),8===a.length&&(this.r=parseInt("0x"+a.substring(2,4),16),this.g=parseInt("0x"+a.substring(4,6),16),this.b=parseInt("0x"+a.substring(6,8),16),this.a=1-parseInt("0x"+a.substring(0,2),16)/255,this.colorStr="rgba("+this.r+","+this.g+","+this.b+","+this.a+")"),"("===a[0]){m=[];e=this.splitComa(a.substring(1,a.length-1));a=0;for(b=e.length;a<b;a++)c=e[a],h=parseInt(c,16),c!==h.toString(16)&&c!=="0"+h.toString(16)?("["===c.charAt(0)&&"]"===
c.charAt(c.length-1)&&(c=c.substring(1,c.length-1)),m.push(this.evaluator.parser.parse(c))):m.push(this.evaluator.parser.parse((h/255).toString()));this.rExpr=m[0];this.gExpr=m[1];this.bExpr=m[2];this.aExpr=m[3];this.getColor=this.getColorExp}}else this.colorStr="rgba("+this.r+","+this.g+","+this.b+","+this.a+")"};a.Color.prototype.splitComa=function(a){d=[];for(var c=b=l=u=0,e=a.length;c<e;c++)n=a.charAt(c),"("===n?u++:")"===n?u--:"["===n?l++:"]"===n?l--:","===n&&0===u&&0===l&&(d.push(a.substring(b,
c)),b=c+1);d.push(a.substring(b));return d};a.Color.prototype.getColorStr=function(){return this.colorStr};a.Color.prototype.getColorExp=function(){f=this.evaluator;this.r=k(255,g(255*f.eval(this.rExpr)));this.g=k(255,g(255*f.eval(this.gExpr)));this.b=k(255,g(255*f.eval(this.bExpr)));this.a=1-f.eval(this.aExpr);return"rgba("+this.r+","+this.g+","+this.b+","+this.a+")"};a.Color.prototype.borderColor=function(){return 380>this.r+this.g+this.b?"#ffffff":"#000000"};a.RGBAToHexColor=function(b){b=b.substring(5,
b.length-1).split(",");y=(b[0]>>0).toString(16);q=(b[1]>>0).toString(16);r=(b[2]>>0).toString(16);w=(255-(255*parseFloat(b[3])>>0)).toString(16);1===y.length&&(y="0"+y);1===q.length&&(q="0"+q);1===r.length&&(r="0"+r);1===w.length&&(w="0"+w);return new a.Color(w+y+q+r)};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=document.head,k=document.createElement("meta");k.setAttribute("http-equiv","X-UA-Compatible");k.setAttribute("content","IE=edge,chrome=1");g.appendChild(k);k=document.createElement("meta");k.setAttribute("name","viewport");k.setAttribute("content","width=device-width,initial-scale=1.0,user-scalable=yes");document.querySelector("meta[name=viewport]")||g.appendChild(k);k=document.createElement("meta");k.setAttribute("name","apple-mobile-web-app-capable");
k.setAttribute("content","yes");g.appendChild(k);k=document.createElement("meta");k.setAttribute("name","apple-mobile-web-app-status-bar-style");k.setAttribute("content","black");g.appendChild(k);k=document.createElement("meta");k.setAttribute("name","DescartesJS_author");k.setAttribute("content","Joel Espinosa Longi");g.appendChild(k);(g=document.getElementById("StyleDescartesApps2"))&&g.parentNode.removeChild(g);g=document.createElement("style");g.type="text/css";g.id="StyleDescartesApps2";g.setAttribute("rel",
"stylesheet");document.head.insertBefore(g,document.head.firstChild);g.innerHTML="@font-face{font-family:'DJS_symbola';src:url('"+a.symbolFont()+"') format('woff2');font-style:normal;font-weight:bold;}\n@font-face{font-family:'DJS_symbola';src:url('"+a.symbolFont()+"') format('woff2');font-style:italic;font-weight:bold;}\n@font-face{font-family:'DJS_symbola';src:url('"+a.symbolFont()+"') format('woff2');font-style:italic;font-weight:normal;}\n@font-face{font-family:'DJS_symbola';src:url('"+a.symbolFont()+
"') format('woff2');font-style:normal;font-weight:normal;}\n@font-face{font-family:'DJS_extra';src:url('"+a.extraBFont()+"') format('woff2');font-style:normal;font-weight:bold;}\n@font-face{font-family:'DJS_extra';src:url('"+a.extraBIFont()+"') format('woff2');font-style:italic;font-weight:bold;}\n@font-face{font-family:'DJS_extra';src:url('"+a.extraIFont()+"') format('woff2');font-style:italic;font-weight:normal;}\n@font-face{font-family:'DJS_extra';src:url('"+a.extraRFont()+"') format('woff2');font-style:normal;font-weight:normal;}\n@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;}\ncanvas{transform:translate3d(0,0,0);}\ndiv.DescartesAppContainer html,div.DescartesAppContainer *,div.DescartesAppContainer *:before,div.DescartesAppContainer *:after{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;}\ndiv.DescartesCatcher{background-color:rgba(255,255,255,0);cursor:pointer;position:absolute;}\ndiv.DescartesAppContainer{border:0 solid #000;overflow:hidden;position:relative;top:0;left:0;}\ndiv.DescartesLoader{background-color:#fff;overflow:hidden;position:absolute;top:0;left:0;}\ndiv.DescartesLoaderImage{position:absolute;background-repeat:no-repeat;background-position:center;overflow:hidden;top:0;left:0;}\ncanvas.DescartesLoaderBar{position:absolute;overflow:hidden;top:0;left:0;}\ncanvas.DescartesSpace2DCanvas,canvas.DescartesSpace3DCanvas,div.blocker{touch-action:none;position:absolute;overflow:hidden;left:0;top:0;}\ndiv.DescartesSpace2DContainer,div.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,.DescartesCheckboxContainer input[type=radio]+label::after{position:absolute;left:0px;content:'';padding:0;margin:0;width:100%;height:100%;background:white;border: 1px solid gray;}\n.DescartesCheckboxContainer input[type=checkbox]:checked+label::after,.DescartesCheckboxContainer input[type=radio]:checked+label::after{content:'';background:url("+
a.getSvgCheckbox()+") center center no-repeat;background-size:contain;background-color:white;}\ncanvas.DescartesButton{position:absolute;cursor:pointer;}\ndiv.DescartesButtonContainer{position:absolute;overflow:hidden;}\ndiv.DescartesButtonContainer div{display:inline-flex;justify-content:center;align-items:center;width:100%;height:100%;}\ndiv.DescartesButtonContainer[data-active='false']::after{content:' ';position:absolute;left:0;top:0;width:100%;height:100%;background:rgba(240,240,240,0.6);pointer-events:none;}\ndiv.DescartesSpinnerContainer,div.DescartesCheckboxContainer,div.DescartesTextFieldContainer,div.DescartesMenuContainer{background:lightgray;position:absolute;overflow:hidden;}\ndiv.DescartesSpinnerContainer input,div.DescartesCheckboxContainer,div.DescartesTextFieldContainer input,div.DescartesMenuContainer select{border-radius:0;}\n.DescartesCheckbox{position:absolute;}\ninput.DescartesSpinnerField,input.DescartesTextFieldField,input.DescartesMenuField,input.DescartesScrollbarField{font-family:"+
a.sansserif_font+";padding:0 2px;border:solid #666 1px;position:absolute;top:0;}\nlabel.DescartesSpinnerLabel,label.DescartesCheckboxLabel,label.DescartesMenuLabel,label.DescartesScrollbarLabel,label.DescartesTextFieldLabel{font-family:"+a.sansserif_font+";font-weight:normal;text-align:center;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;background-color:#e0e4e8;position:absolute;left:0;top:0;}\ndiv.DescartesGraphicControl{touch-action:none;border-style:none;position:absolute;}\ndiv.DescartesTextAreaContainer{position:absolute;overflow:hidden;background:#F7F7F7;}\nselect.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;}\nselect.DescartesMenuSelect::-ms-expand{display:none;}\ndiv.DescartesScrollbarContainer{touch-action:none;background:#eee;overflow:hidden;position:absolute;}\n";return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.sin,k=Math.floor,f=Math.random,m=Math.round,e=Math.abs,h=String.fromCharCode,d,c,u,l,b,n,y,q,r,w;a.Krypto=function(a){this.key=(a||0).toString()};a.Krypto.prototype.getKey=function(a){d=[];for(var b=0;256>b;b++)d[b]=h(this.alfanum(k(e(7.5*(g(1*b-a)+g(1.4*b+a)+g(.6*b-a)+g(2.2*b+a))))));return d.join("")};a.Krypto.prototype.encode=function(a){c=k(31*f());this.key=this.getKey(c);return h(this.alfanum(c))+this.encripta(a)};a.Krypto.prototype.decode=
function(a){c=this.numalfa(a.charCodeAt(0));this.key=this.getKey(c);return this.desencripta(a.substring(1))};a.Krypto.prototype.encripta=function(a){return this.bytesToString(this.encriptaAux(this.stringToBytes(a)))};a.Krypto.prototype.encriptaAux=function(a){if(null==a||null==this.key)return null;n=Array(3*a.length);for(var b=0,c=a.length;b<c;b++)r=256*k(a[b]+128)+m(255*f())+65536*m(255*f()),w=k((r<<this.shift(b))/256),n[3*b]=this.alfanum(w%32),n[3*b+1]=this.alfanum(w/32%32),n[3*b+2]=this.alfanum(w/
1024%32);return n};a.Krypto.prototype.desencripta=function(a){return this.bytesToString(this.desencriptaAux(this.stringToBytes(a)))};a.Krypto.prototype.desencriptaAux=function(a){if(null==a||null==this.key)return null;y=Array(a.length/3);for(var b=0,c=y.length;b<c;b++)w=this.numalfa(a[3*b])+32*this.numalfa(a[3*b+1])+1024*this.numalfa(a[3*b+2]),r=k(256*w>>this.shift(b)),q=k(r/256)%256-128,0>q&&(q+=256),y[b]=q;return y};a.Krypto.prototype.alfanum=function(a){a=k(a);return 10>a?48+a:87+a};a.Krypto.prototype.numalfa=
function(a){return 58>a?a-48:a-87};a.Krypto.prototype.stringToBytes=function(a){l=Array(a.length);for(var b=0,c=a.length;b<c;b++)l[b]=a.charCodeAt(b);return l};a.Krypto.prototype.bytesToString=function(a){for(var b=0,c=a.length;b<c;b++)a[b]=h(a[b]);return a.join("")};a.Krypto.prototype.shift=function(a){u=this.key.charCodeAt(a%this.key.length);l=this.numalfa(u);b=k(l/2%8);0==b&&(b=4);return b};a.Krypto.prototype.parseByte=function(a){a=parseInt(a);a=0>a?0:a;return 255<a?255:a};return a}(descartesJS||
{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.max;a.Animation=function(g,f){this.parent=g;var k=g.evaluator,e=k.parser;g=new a.Auxiliary(g);var h=this;h.delay=f.delay?e.parse(f.delay):e.parse("60");h.loop=f.loop?f.loop:!1;h.auto=void 0==f.auto?!0:f.auto;h.controls=f.controls;h.init=g.splitInstructions(e,f.init);h.doExpr=g.splitInstructions(e,f.doExpr);f.whileExpr&&(h.whileExpr=e.parse(f.whileExpr));var d,c=h.doExpr.length;h.animExec=function(){for(d=0;d<c;d++)k.eval(h.doExpr[d]);h.parent.update();h.playing&&
(0<k.eval(h.whileExpr)||h.loop)?h.timer=a.setTimeout(h.animExec,k.eval(h.delay)):(h.stop(),h.pause=!1,h.parent.update())};h.playing=!1;h.auto&&h.play()};a.Animation.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,g(10,this.parent.evaluator.eval(this.delay))))};a.Animation.prototype.stop=function(){this.playing=!1;a.clearTimeout(this.timer)};a.Animation.prototype.reinit=function(){for(var a=
0,f=this.init.length;a<f;a++)this.parent.evaluator.eval(this.init[a])};return a}(descartesJS||{});descartesJS=function(a){if(a.loadLib)return a;a.Action=function(a,k){this.parent=a;this.evaluator=this.parent.evaluator};a.Action.prototype.execute=function(){};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.Message=function(g,k){a.Action.call(this,g,k);this.parameter=(k||"").replace(/\\n/g,"\n").replace(/&squot;/g,"'")};a.extend(a.Message,a.Action);a.Message.prototype.execute=function(){alert(this.parameter)};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.Calculate=function(g,k){a.Action.call(this,g,k);var f=this.evaluator;g=f.parser;k=(k||"").replace(/&squot;/g,"'");k=a.splitSeparator(k);for(var m=[],e,h=0,d=k.length;h<d;h++)(e=g.parse(k[h],!0))&&m.push(e);d=m.length;this.execute=function(){for(h=0;h<d;h++)f.eval(m[h])}};a.extend(a.Calculate,a.Action);return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.OpenURL=function(g,k){a.Action.call(this,g,k);this.parser=g.evaluator.parser;this.evaluator=g.evaluator;this.parameter=k;this.target="_blank"};a.extend(a.OpenURL,a.Action);a.OpenURL.prototype.execute=function(){var g=this.parameter;"["===g.charAt(0)&&"]"===g.charAt(g.length-1)&&(g=this.evaluator.eval(this.parser.parse(g.substring(1,g.length-1))));var k=g.indexOf("target");-1!=k&&(this.target=g.substring(k),this.target=this.target.substring(this.target.indexOf("=")+
1),g=g.substring(0,k-1));if("javascript"==g.substring(0,10)){g=new a.SimpleText(parent,g.substring(11).replace(/&squot;/g,"'"));try{eval(g.toString())}catch(f){}}else"http"!=g.substring(0,4)&&(k=window.__dirname||window.location.href,g=k.substring(0,k.lastIndexOf("/")+1)+g),window.open(g,this.target)};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.OpenScene=function(g,k){a.Action.call(this,g,k);this.parser=g.evaluator.parser;this.evaluator=g.evaluator;this.parameter=k.trim();this.target="_blank"};a.extend(a.OpenScene,a.Action);a.OpenScene.prototype.execute=function(){var a=this.parameter;"["===a.charAt(0)&&"]"===a.charAt(a.length-1)&&(a=this.evaluator.eval(this.parser.parse(a.substring(1,a.length-1))));var k=a.indexOf("target");-1!=k&&(this.target=a.substring(k),this.target=this.target.substring(this.target.indexOf("=")+
1),a=a.substring(0,k-1));if("javascript"==a.substring(0,10)){a=a.substring(11).replace(/&squot;/g,"'");try{eval(a.toString())}catch(f){}}else"http"!=a.substring(0,4)&&(k=window.__dirname||window.location.href,a=k.substring(0,k.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")};
return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.Config=function(g,k){a.Action.call(this,g,k)};a.extend(a.Config,a.Action);a.Config.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>\n"+this.parent.applet.outerHTML.replace(/<applet/g,
"<ajs").replace(/<\/applet/g,"</ajs")+"</xmp>")};return a}(descartesJS||{});descartesJS=function(a){if(a.loadLib)return a;a.Init=function(g,k){a.Action.call(this,g,k)};a.extend(a.Init,a.Action);a.Init.prototype.execute=function(){this.parent.init()};return a}(descartesJS||{});descartesJS=function(a){if(a.loadLib)return a;a.Clear=function(g,k){a.Action.call(this,g,k)};a.extend(a.Clear,a.Action);a.Clear.prototype.execute=function(){this.parent.clear()};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.Animate=function(g,k){a.Action.call(this,g,k)};a.extend(a.Animate,a.Action);a.Animate.prototype.execute=function(){this.parent.play()};return a}(descartesJS||{});descartesJS=function(a){if(a.loadLib)return a;a.InitAnimation=function(g,k){a.Action.call(this,g,k)};a.extend(a.InitAnimation,a.Action);a.InitAnimation.prototype.execute=function(){this.parent.reinitAnimation()};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=/[\w\.\-//]*(\.ogg|\.oga|\.mp3|\.wav)/gi;a.PlayAudio=function(k,f){a.Action.call(this,k,f);f=f||"";f.match(g)?this.filenameExpr=this.evaluator.parser.parse("'"+f.match(g)+"'"):(""!==f&&"["===f.charAt(0)&&"]"===f.charAt(f.length-1)&&(f=f.substring(1,f.length-1)),this.filenameExpr=this.evaluator.parser.parse(f))};a.extend(a.PlayAudio,a.Action);a.PlayAudio.prototype.execute=function(){var a=this.theAudio=this.parent.getAudio(this.evaluator.eval(this.filenameExpr));
a.paused?a.play():(a.pause(),a.currentTime=0)};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.Auxiliary=function(a,g){this.parent=a;this.evaluator=this.parent.evaluator;this.expresion=this.id="";this.evaluate="onlyOnce";this.local="";for(var e in g)g.hasOwnProperty(e)&&(this[e]=g[e])};a.Auxiliary.prototype.firstRun=function(){};a.Auxiliary.prototype.update=function(){};var g,k;a.Auxiliary.prototype.splitInstructions=function(f,m){k=[];m=m?a.splitSeparator(m):[""];for(var e=0,h=m.length;e<h;e++)a.DEBUG.lineCount=e,(g=f.parse(m[e],!0))&&k.push(g);
return k};a.Auxiliary.prototype.getPrivateVariables=function(a,m){k=[];m=m?m.split(/;|,/):[""];for(var e=0,f=m.length;e<f;e++)(g=a.parse(m[e],!0))&&k.push(g);e=0;for(f=k.length;e<f;e++)k[e]="asign"===k[e].type?k[e].childs[0].value:"identifier"===k[e].type?k[e].value:"";return k};a.Auxiliary.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)};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.Variable=function(g,k){a.Auxiliary.call(this,g,k);g=this.evaluator.parser;this.expresionString=this.expresion;(this.expresion=g.parse(this.expresionString))&&g.setVariable(this.id,this.expresion);this.editable&&(this.registerTextField(),this.parent.editableRegionVisible=!0)};a.extend(a.Variable,a.Auxiliary);a.Variable.prototype.registerTextField=function(){var a=document.createElement("div"),k=document.createElement("label");k.appendChild(document.createTextNode("___"+
this.id+"=___"));var f=document.createElement("input");f.value=this.expresionString;f.disabled=!this.editable;a.appendChild(k);a.appendChild(f);var m=this,e=m.evaluator.parser;f.onkeydown=function(a){13==a.keyCode&&(m.expresion=e.parse(this.value),e.setVariable(m.id,m.expresion),m.parent.update())};this.parent.editableRegion.textFields.push({container:a,type:"div"})};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.Constant=function(g,k){a.Auxiliary.call(this,g,k);this.expresion=this.evaluator.parser.parse(this.expresion);this.update()};a.extend(a.Constant,a.Auxiliary);a.Constant.prototype.update=function(){this.evaluator.setVariable(this.id,this.evaluator.eval(this.expresion))};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,k,f;a.Vector=function(f,e){g=f.evaluator;k=g.parser;this.size=k.parse("3");a.Auxiliary.call(this,f,e);this.expresion=this.expresion.split(";");this.parseFile=k.parse(this.file);this.update()};a.extend(a.Vector,a.Auxiliary);a.Vector.prototype.update=function(){var m=this.expresion;g=this.evaluator;k=g.parser;this.oldFile=this.file;if(f=g.eval(this.parseFile))this.file=f;if(this.file){var e=(vectorElement=document.getElementById(this.file))&&"descartes/vectorFile"==
vectorElement.type?vectorElement.text:a.openExternalFile(this.file);if(null!=e){e=e.replace(/\r/g,"").split("\n");for(var h=[],d=0,c=e.length;d<c;d++)""!=e[d]&&h.push(e[d]);e=h}null==e||1==e.length&&""==e[0]?this.size=k.parse("0"):(m=e,this.size=null);null===this.size&&(this.size=k.parse(m.length+""))}e=[];d=0;for(c=m.length;d<c;d++)(h=k.parse(m[d],!0))&&"asign"!=h.type&&(h=k.parse(this.id+"["+d+"]="+m[d],!0)),e.push(h);m=[];m._size_=g.eval(this.size);d=0;for(c=this._size_;d<c;d++)m.push(0);g.vectors[this.id]=
m;g.setVariable(this.id+".long",m._size_);d=0;for(c=e.length;d<c;d++)g.eval(e[d])};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.Matrix=function(g,k){var f=g.evaluator,m=f.parser;this.rows=m.parse("3");this.columns=m.parse("3");a.Auxiliary.call(this,g,k);this.expresion=this.splitInstructions(m,this.expresion);g=f.eval(this.rows);k=f.eval(this.columns);m=[];m.type="matrix";for(var e,h=0;h<k;h++){e=[];for(var d=0,c=g;d<c;d++)e.push(0);m[h]=e}f.matrices[this.id]=m;this.update()};a.extend(a.Matrix,a.Auxiliary);a.Matrix.prototype.update=function(){var a=this.evaluator,k=a.eval(this.rows),
f=a.eval(this.columns);a.setVariable(this.id+".filas",k);a.setVariable(this.id+".columnas",f);var m=a.matrices[this.id];m.rows=k;m.cols=f;k=0;for(f=this.expresion.length;k<f;k++)a.eval(this.expresion[k])};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.Function=function(g,k){a.Auxiliary.call(this,g,k);var f=this.evaluator;g=f.parser;k=this.id.indexOf("(");this.name=this.id.substring(0,k);this.params=this.id.substring(k+1,this.id.indexOf(")"));this.domain=this.range?g.parse(this.range):g.parse("1");this.params=""==this.params?[]:this.params.split(",");this.numberOfParams=this.params.length;this.algorithm||(this.whileExpr=this.doExpr=this.init="");this.parseExpressions(g);this.expresion=g.parse(this.expresion);
var m=this;this.functionExec=function(){m.iterations=0;if(m.numberOfParams<=arguments.length){for(var e=[],g=0,d=m.privateVars.length;g<d;g++)e.push(f.getVariable(m.privateVars[g])),f.setVariable(m.privateVars[g],0);var c=[];g=0;for(d=m.params.length;g<d;g++)c[g]=f.getVariable(m.params[g]),f.setVariable(m.params[g],arguments[g]);g=0;for(d=m.init.length;g<d;g++)f.eval(m.init[g]);do{g=0;for(d=m.doExpr.length;g<d;g++)f.eval(m.doExpr[g]);if(1E5<++m.iterations)return console.log("se ha excedido el l\u00edmite de 100000 repeticiones en la funci\u00f3n << "+
m.name+" >>"),0}while(0<f.eval(m.whileExpr));var k=f.eval(m.expresion);a.rangeOK=f.eval(m.domain);g=0;for(d=m.params.length;g<d;g++)f.setVariable(m.params[g],c[g]);g=0;for(d=m.privateVars.length;g<d;g++)f.setVariable(m.privateVars[g],e[g]);return k}return 0};f.setFunction(this.name,this.functionExec)};a.extend(a.Function,a.Auxiliary);return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.JsFunction=function(g,k){this.code="";a.Auxiliary.call(this,g,k);g=this.evaluator;k=this.id.indexOf("(");this.name=this.id.substring(0,k);this.params=this.id.substring(k+1,this.id.indexOf(")"));this.params=""===this.params?[]:this.params.split(",");this.functionCode=this.code.replace(/\\;/g,";")+";\nreturn "+(this.expresion||0)+";";this.functionExec=new Function(this.params,this.functionCode);g.setFunction(this.name,this.functionExec)};a.extend(a.JsFunction,
a.Auxiliary);return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.Algorithm=function(g,k){a.Auxiliary.call(this,g,k);var f=this.evaluator;this.parseExpressions(f.parser);var m=this;this.algorithmExec=function(){for(var a=m.iterations=0,g=m.init.length;a<g;a++)f.eval(m.init[a]);do{a=0;for(g=m.doExpr.length;a<g;a++)f.eval(m.doExpr[a]);if(1E5<++m.iterations)return console.log("se ha excedido el l\u00edmite de 100000 repeticiones en el algoritmo << "+m.name+" >>"),0}while(0<f.eval(m.whileExpr))}};a.extend(a.Algorithm,
a.Auxiliary);a.Algorithm.prototype.update=function(){this.algorithmExec();"onlyOnce"===this.evaluate&&(this.update=function(){})};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.Event=function(g,k){a.Auxiliary.call(this,g,k);g=this.evaluator;delete this.evaluate;this.condition=g.parser.parse(this.condition);this.lastEvaluation=!1;this.action=this.parent.lessonParser.parseAction(this);"onlyOnce"==this.execution&&(this.eventExec=function(){0<this.evaluator.eval(this.condition)&&!this.lastEvaluation&&(this.lastEvaluation=!0,this.action.execute())});"alternate"==this.execution&&(this.eventExec=function(){var a=0<this.evaluator.eval(this.condition);
3==this.parent.version?a!=this.lastEvaluation&&(this.action.execute(),this.lastEvaluation=a?!0:!1):a&&!this.lastEvaluation?(this.action.execute(),this.lastEvaluation=!0):!a&&this.lastEvaluation&&(this.lastEvaluation=!1)});"always"==this.execution&&(this.eventExec=function(){0<this.evaluator.eval(this.condition)&&this.action.execute()})};a.extend(a.Event,a.Auxiliary);a.Event.prototype.update=function(){this.eventExec()};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.Library=function(g,k){a.Auxiliary.call(this,g,k);if(k=k.file){var f=document.getElementById(k);response=f&&"descartes/library"==f.type?f.text:a.openExternalFile(k)}if(response)for(response=response.replace(/&aacute;/g,"\u00e1").replace(/&eacute;/g,"\u00e9").replace(/&iacute;/g,"\u00ed").replace(/&oacute;/g,"\u00f3").replace(/&uacute;/g,"\u00fa").replace(/&Aacute;/g,"\u00c1").replace(/&Eacute;/g,"\u00c9").replace(/&Iacute;/g,"\u00cd").replace(/&Oacute;/g,
"\u00d3").replace(/&Uacute;/g,"\u00da").replace(/&ntilde;/g,"\u00f1").replace(/&Ntilde;/g,"\u00d1").replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&amp;/g,"&").replace(/\r/g,"").split("\n"),k=0,f=response.length;k<f;k++)""!==response[k].trim()&&g.lessonParser.parseAuxiliar(response[k])};a.extend(a.Library,a.Auxiliary);return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,k,f,m,e,h;a.Graphic=function(d,c){this.parent=d;this.evaluator=d.evaluator;var e=this.evaluator.parser;this.spaceID="";this.background=!1;this.type="";this.drawif=e.parse("1");this.abs_coord=c.type&&"text"===c.type?!0:!1;this.color=new a.Color("blue");2!==this.parent.version&&(this.color=new a.Color("20303a"),this.parent.arquimedes&&(this.color=new a.Color("black")));this.trace="";this.expresion=e.parse("(0,0)");this.family="";this.family_interval=
e.parse("[0,1]");this.family_steps=e.parse("8");this.editable=this.visible=!1;this.font="SansSerif,PLAIN,"+(5<=this.parent.version?"18":"12");this.fixed=!0;this.text="";this.decimals=e.parse("2");for(var l in c)c.hasOwnProperty(l)&&(this[l]=c[l]);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=d.evaluator.parser.parse(this.fontSize.toString()))};a.Graphic.prototype.getSpace=function(){for(var a=this.parent.spaces,c,e=0,l=a.length;e<l;e++)if(c=a[e],c.id==this.spaceID)return c;return a[0]};a.Graphic.prototype.getFamilyValues=function(){g=this.evaluator;k=g.eval(this.family_interval);this.familyInf=k[0][0];this.familySup=k[0][1];this.fSteps=Math.round(g.eval(this.family_steps));this.family_sep=0<this.fSteps?(this.familySup-this.familyInf)/
this.fSteps:0};a.Graphic.prototype.drawFamilyAux=function(a,c,e){g=this.evaluator;this.getFamilyValues();f=g.getVariable(this.family);if(0<=this.fSteps)for(var d=0,b=this.fSteps;d<=b;d++)g.setVariable(this.family,this.familyInf+d*this.family_sep),0<g.eval(this.drawif)&&(this.update(),a.oldTextNode=null,this.drawAux(a,c,e));g.setVariable("_Text_H_",0);g.setVariable(this.family,f)};a.Graphic.prototype.draw=function(a,c){""!=this.family?this.drawFamilyAux(this.ctx,a,c):0<this.evaluator.eval(this.drawif)&&
(this.update(),this.drawAux(this.ctx,a,c))};a.Graphic.prototype.drawTrace=function(a,c){""!=this.family?this.drawFamilyAux(this.traceCtx,a,c):0<this.evaluator.eval(this.drawif)&&(this.update(),this.drawAux(this.traceCtx,a,c))};a.Graphic.prototype.dashStyle=function(){h=this.ctx;"dot"===this.lineDash?(h.lineCap="butt",h.setLineDash([h.lineWidth,h.lineWidth])):"dash"===this.lineDash?(h.lineCap="butt",h.setLineDash([4*h.lineWidth,3*h.lineWidth])):"dash_dot"===this.lineDash?(h.lineCap="butt",h.setLineDash([4*
h.lineWidth,2*h.lineWidth,h.lineWidth,2*h.lineWidth])):h.setLineDash([])};a.Graphic.prototype.drawText=function(a,c,f,l,b,n,k,q,r,h,p){a.textNode=c;if("rtfNode"===c.type)a.fillStyle=b.getColor(),a.strokeStyle=b.getColor(),a.textBaseline="alphabetic",a.textNode.pos={x:f,y:l},c.update(a,f,l,r,h,k,p,b.getColor());else for("simpleText"===c.type&&(c=c.toString(r,h).split("\\n")),g=this.evaluator,a.fillStyle=b.getColor(),a.font=n,a.textAlign=k,a.textBaseline=q,e=1.2*this.fontSize||0,b=0,n=c.length;b<n;b++)m=
c[b],this.border&&(a.strokeStyle=this.border.getColor(),a.lineWidth=4,a.lineJoin="round",a.miterLimit=2,a.strokeText(m,f,l+e*b)),a.fillText(m,f,l+e*b)};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.SimpleText=function(a,g){this.text=g=g.replace("&#x2013","\u2013").replace(/&squot;/g,"'");this.textElements=[];this.textElementsMacros=[];this.parent=a;this.evaluator=a.evaluator;this.type="simpleText";a="'";for(var e=0,f=0,d=-1,c,k;e<g.length;)c=g.charAt(e),k=g.charAt(e-1),"["===c&&"\\"===k?(this.textElements.push(g.substring(f,e-1)+"["),this.textElementsMacros.push("'"+g.substring(f,e-1)+"['"),f=e+1):"]"===c&&"\\"===k?(this.textElements.push(g.substring(f,
e-1)+"]"),this.textElementsMacros.push("'"+g.substring(f,e-1)+"]'"),f=e+1):"["===c&&-1===d?(this.textElements.push(g.substring(f,e)),this.textElementsMacros.push("'"+g.substring(f,e)+"'"),f=e,d++):"["===c?d++:"]"===c&&0===d?(this.textElements.push(this.evaluator.parser.parse(g.substring(f,e+1))),this.textElementsMacros.push("["+g.substring(f,e+1)+"]"),f=e+1,d--):("]"==g.charAt(e)&&(d=0>d?d:d-1),a+=g.charAt(e)),e++;this.textElements.push(g.substring(f,e));this.textElementsMacros.push("'"+g.substring(f,
e)+"'")};var g,k;a.SimpleText.prototype.toString=function(f,m){g="";for(var e=0,h=this.textElements.length;e<h;e++)"string"===typeof this.textElements[e]?g+=this.textElements[e]:(k=this.evaluator.eval(this.textElements[e])[0][0],""!==k&&("string"===typeof k?g+=k:Infinity==k?g+="Infinity":-Infinity==k?g+="-Infinity":isNaN(k)||"NaN"==k?g+="NaN":(k=parseFloat(k),k=m?k.toFixed(f):a.removeNeedlessDecimals(k.toFixed(f)),g+=k.toString().replace(".",this.parent.decimal_symbol))));return g};return a}(descartesJS||
{});
descartesJS=function(a){if(a.loadLib)return a;var g,k,f,m,e,h,d,c,u,l,b,n,y,q,r,w,p,v,x,A,C,F,H,K,E,z,G;a._debug_vez=0;a.Equation=function(b,c){this.width=b.evaluator.parser.parse("1");this.fillM=this.fillP="";a.Graphic.call(this,b,c);this.parseExpression();(this.visible=2===this.parent.version&&void 0==this.visible?!0:this.visible)&&this.registerTextField();n=new a.R2;y=new a.R2;q=new a.R2;p=new a.R2;r=new a.R2;this.cInd=0};a.extend(a.Equation,a.Graphic);a.Equation.prototype.parseExpression=function(){if("compOperator"===
this.expresion.type){var b=this.expresion.childs[0],c=this.expresion.childs[1];"identifier"!=b.type||"y"!=b.value||c.contains("y")?"identifier"!=c.type||"y"!=c.value||b.contains("y")?"identifier"!=b.type||"x"!=b.value||c.contains("x")?"identifier"!=c.type||"x"!=c.value||b.contains("x")||(this.funExpr=c,this.of_y=!0,this.drawAux=this.drawAuxFun):(this.funExpr=c,this.of_y=!0,this.drawAux=this.drawAuxFun):(this.funExpr=b,this.of_y=!1,this.drawAux=this.drawAuxFun):(this.funExpr=c,this.of_y=!1,this.drawAux=
this.drawAuxFun)}this.newt=new a.R2Newton(this.evaluator,this.expresion)};a.Equation.prototype.update=function(){};a.Equation.prototype.draw=function(){""!=this.family?this.drawFamilyAux(this.ctx,this.fill,this.color):(this.update(),this.drawAux(this.ctx,this.fill,this.color))};a.Equation.prototype.drawFamilyAux=function(a,b,c){k=this.evaluator;this.getFamilyValues();tempParam=k.getVariable(this.family);if(0<=this.fSteps)for(var d=0,e=this.fSteps;d<=e;d++)k.setVariable(this.family,this.familyInf+
d*this.family_sep),this.update(),this.drawAux(a,b,c);k.setVariable(this.family,tempParam)};a.Equation.prototype.drawTrace=function(){this.uber.drawTrace.call(this,this.fill,this.trace)};var L,N,M,B,D,J,I;a.Equation.prototype.drawAux=function(O,P,Q){if(!(0>=this.evaluator.eval(this.drawif))){this.cInd=0;k=this.evaluator;f=k.parser;m=this.space;e=k.eval(this.width);O.strokeStyle=this.color.getColor();O.lineWidth=e;h=f.getVariable("x");d=f.getVariable("y");c=m.w+24;u=m.h+24;l=c/9;3>l&&(l=3);b=u/7;3>
b&&(b=3);0==this.cInd?(g=[],this.cInd++):this.cInd=(this.cInd+1)%1E7;n.set(0,0);y.set(0,0);q.set(0,0);J=.25;I=8;this.abs_coord||(J/=m.scale,I/=m.scale);O.beginPath();for(G=parseInt(b/2);G<u;G+=b)for(z=parseInt(l/2);z<c;z+=l){if(this.abs_coord){p.set(z,G);w=this.newt.findZero(p,J);if(null==w)continue;k.setVariable("x",w.x);k.setVariable("y",w.y);r.set(w.x,w.y)}else{p.set(m.getRelativeX(z),m.getRelativeY(G));w=this.newt.findZero(p,J);if(null==w)continue;k.setVariable("x",w.x);k.setVariable("y",w.y);
r.set(m.getAbsoluteX(w.x),m.getAbsoluteY(w.y))}v=r.ix();x=r.iy();if(-12<=v&&v<c+24&&-12<=x&&x<u+24){if(g[v+12+(x+12)*m.w]===this.cInd)continue;g[v+12+(x+12)*m.w]=this.cInd}a.rangeOK&&(O.moveTo(v,x),O.lineTo(v,x));n.x=w.x;n.y=w.y;y.x=w.x;y.y=w.y;A=this.newt.getUnitNormal();if(0!=A.x||0!=A.y)for(A.rotL90(),q.x=A.x,q.y=A.y,F=C=0,H=!1;2>F;)if(H&&(q.x=-A.x,q.y=-A.y,w.x=n.x,w.y=n.y,y.x=w.x,y.y=w.y,this.abs_coord?r.set(w.x,w.y):r.set(m.getAbsoluteX(w.x),m.getAbsoluteY(w.y)),v=r.ix(),x=r.iy(),H=!1,C=0),w.x+=
I*q.x,w.y+=I*q.y,w=this.newt.findZero(w,J),null!=w){k.setVariable("x",w.x);k.setVariable("y",w.y);q.x=w.x-y.x;q.y=w.y-y.y;q.normalize();if(0==q.x&&0==q.y)break;y.x=w.x;y.y=w.y;this.abs_coord?r.set(w.x,w.y):r.set(m.getAbsoluteX(w.x),m.getAbsoluteY(w.y));K=parseInt(r.ix());E=parseInt(r.iy());if(K!=v||E!=x)if(L=v,N=x,v=K,x=E,-12<=v&&v<c+24&&-12<=x&&x<u+24){C=0;M=g[v+12+(x+12)*m.w];g[v+12+(x+12)*m.w]=this.cInd;for(P=1;8>P;P++)B=L+Math.round((v-L)*P/8),D=N+Math.round((x-N)*P/8),0<=B&&B<c&&0<=D&&D<u&&(g[B+
12+(D+12)*m.w]=this.cInd);a.rangeOK&&(O.moveTo(L,N),O.lineTo(v,x));if(M===this.cInd)break}else H=!0,F++;else 4<++C&&(H=!0,F++)}}O.stroke()}};a.Equation.prototype.X=function(a,b,c){c||(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};a.Equation.prototype.Y=function(a,b,c){c||(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};a.Equation.prototype.XX=function(a,b,c){return Math.round(this.X(a,
b,c))};a.Equation.prototype.YY=function(a,b,c){return Math.round(this.Y(a,b,c))};a.Equation.prototype.extrapolate=function(b,c,d,e,l,n){for(var f=this.evaluator.getVariable(c),g=n/2,k=0,q,r,h,w,m,p;1E-15<Math.abs(g);){q=this.evaluator.getVariable(c);r=this.evaluator.getVariable(c)+g;this.evaluator.setVariable(c,r);h=!0;try{w=l,l=this.evaluator.eval(this.funExpr),this.evaluator.setVariable(d,l),0<this.evaluator.eval(b)?(m=new a.R2(Math.min(w,l),Math.max(w,l)),p=0,p=0<n?this.Singularity(Math.abs(g),
c,e,q,w,r,l,m):this.Singularity(Math.abs(g),c,e,r,l,q,w,m),0<p&&(h=!1)):h=!1}catch(X){h=!1}h?k+=g:this.evaluator.setVariable(c,q);g/=2}this.evaluator.setVariable(c,f);return new a.R2(k/Math.abs(n),l)};a.Equation.prototype.extrapolateOnSingularity=function(b,c,d,e,l,n){e=this.evaluator.getVariable(c);for(var f=n/2,g=0,k=l,q;1E-15<Math.abs(f);){this.evaluator.setVariable(c,this.evaluator.getVariable(c)+f);q=!0;if(0<this.evaluator.eval(b))try{k=this.evaluator.eval(this.funExpr),this.evaluator.setVariable(d,
k),0>=this.evaluator.eval(b)&&(q=!1)}catch(V){q=!1}else q=!1;q?g+=f:this.evaluator.setVariable(c,this.evaluator.getVariable(c)-f);f/=2}if(0==g)for(f=n/2,g=n,k=l;1E-15<Math.abs(f);){this.evaluator.setVariable(c,this.evaluator.getVariable(c)-f);q=!0;if(0<this.evaluator.eval(b))try{k=this.evaluator.eval(this.funExpr)}catch(V){q=!1}else q=!1;q?g+=-f:this.evaluator.setVariable(c,this.evaluator.getVariable(c)+f);f/=2}this.evaluator.setVariable(c,e);return new a.R2(g/Math.abs(n),k)};a.Equation.prototype.Singularity=
function(a,b,c,d,e,l,n,f){if(isNaN(n)||isNaN(e)||isNaN(f.y)||isNaN(f.x)||d>=l)return 2;var g=this.evaluator.getVariable(b),k=0;try{if(1E-15>Math.abs(l-d)||1E-12>Math.abs(l-d)&&Math.abs(n-e)>Math.abs(a))return this.evaluator.setVariable(b,g),1;var q=(d+l)/2;this.evaluator.setVariable(b,q);var r=NaN;try{r=this.evaluator.eval(this.funExpr)}catch(W){return 2}if(isNaN(r))return 5;if(Math.abs(n-e)>a){this.evaluator.setVariable(b,d-1E-12);var h=this.evaluator.eval(this.funExpr);h=(e-h)/1E-12;this.evaluator.setVariable(b,
l+1E-12);var w=(this.evaluator.eval(this.funExpr)-n)/1E-12;if((10>Math.abs(w)||10>Math.abs(h))&&(0<=w&&0<=h||0>=w&&0>=h)&&4*Math.abs(w)<Math.abs((n-e)/(l-d)))return this.evaluator.setVariable(b,g),2}if(isNaN(f.x)||isNaN(f.y)||isNaN(r))return 2;if(!(f.x<=r&&r<=f.y)){this.evaluator.setVariable(b,q);f.x=Math.min(e,r);f.y=Math.max(e,r);var m=this.Singularity(a/2,b,c,d,e,q,r,f);this.evaluator.setVariable(b,l);f.x=Math.min(n,r);f.y=Math.max(n,r);var p=this.Singularity(a/2,b,c,q,r,l,n,f);k=Math.max(m,p)}}catch(W){k=
1}this.evaluator.setVariable(b,g);return k};a.Equation.prototype.drawAuxFun=function(b,c,e){h=this.evaluator.parser.getVariable("x");d=this.evaluator.parser.getVariable("y");a.rangeOK=1;c="x";var l="y";this.of_y&&(c="y",l="x");var n=this.drawif,f=this.evaluator.eval(this.width),g=!1,k=new a.R2(this.space.w/2+this.space.Ox,this.space.h/2+this.space.Oy),q=this.of_y?k.ix():k.iy(),r=0,w=0,m=0,p=0,u=1/this.space.scale;k=u*(this.of_y?-this.space.h+k.y:-k.x);var A=0;this.abs_coord&&(k=0,u=1);for(var y,x,
v,H,C,z,K,I,F,P=this.of_y?this.space.h+2:this.space.w+2;m<=P;){y=!0;x=0;this.evaluator.setVariable(c,k);try{v=this.evaluator.eval(this.funExpr),isNaN(v)||(this.evaluator.setVariable(l,v),0<this.evaluator.eval(this.drawif)&&a.rangeOK?(g?(H=Math.min(A,v),C=Math.max(A,v),z=new a.R2(H,C),x=this.Singularity(u,c,0,k-u,A,k,v,z),0===x?(A<=v?(A=z.x,v=z.y):(v=z.x,A=z.y),K=parseInt(this.of_y?this.XX(f,A,this.abs_coord):this.YY(f,A,this.abs_coord)),r=this.abs_coord?Math.round(v):parseInt(this.of_y?this.XX(f,
v,this.abs_coord):this.YY(f,v,this.abs_coord)),this.fillM&&r>q&&(b.lineWidth=1,b.strokeStyle=this.fillM.getColor(),b.beginPath(),this.of_y?(b.moveTo(q+1,this.space.h-m+.5),b.lineTo(r,this.space.h-m+.5)):(b.moveTo(m+.5,q+1),b.lineTo(m+.5,r)),b.stroke()),this.fillP&&r<q&&(b.lineWidth=1,b.strokeStyle=this.fillP.getColor(),b.beginPath(),this.of_y?(b.moveTo(q-1,this.space.h-m+.5),b.lineTo(r,this.space.h-m+.5)):(b.moveTo(m+.5,q-1),b.lineTo(m+.5,r)),b.stroke()),b.lineWidth=f,b.strokeStyle=e.getColor(),b.beginPath(),
this.of_y?(b.moveTo(K+.5,this.space.h-p),b.lineTo(r+.5,this.space.h-m)):(b.moveTo(p+.5,K),b.lineTo(m+.5,r)),b.stroke()):1===x?(this.evaluator.setVariable(c,k-u),I=this.extrapolate(n,c,l,0,A,u),r=this.of_y?this.XX(f,I.y,this.abs_coord):this.YY(f,I.y,this.abs_coord),b.lineWidth=f,b.strokeStyle=e.getColor(),b.beginPath(),this.of_y?(b.moveTo(w+.5,this.space.h-p),b.lineTo(r+.5,this.space.h-p+Math.round(I.x))):(b.moveTo(p+.5,w),b.lineTo(p+Math.round(I.x)+.5,r)),this.evaluator.setVariable(c,k),F=this.extrapolate(n,
c,l,0,v,-u),w=this.of_y?this.XX(f,F.y,this.abs_coord):this.YY(f,F.y,this.abs_coord),r=this.of_y?this.XX(f,v,this.abs_coord):this.YY(f,v,this.abs_coord),b.lineWidth=f,b.strokeStyle=e.getColor(),b.beginPath(),this.of_y?(b.moveTo(w+.5,this.space.h-m),b.lineTo(r+.5,this.space.h-m)):(b.moveTo(m+.5,w),b.lineTo(m+.5,r)),b.stroke()):2===x&&(r=this.of_y?this.XX(f,v,this.abs_coord):this.YY(f,v,this.abs_coord),b.lineWidth=f,b.strokeStyle=e.getColor(),b.beginPath(),this.of_y?(b.moveTo(w+.5,this.space.h-m),b.lineTo(r+
.5,this.space.h-m)):(b.moveTo(m+.5,w),b.lineTo(m+.5,r)),b.stroke())):(F=this.extrapolateOnSingularity(n,c,l,0,v,-u),w=this.of_y?this.XX(f,F.y,this.abs_coord):this.YY(f,F.y,this.abs_coord),r=this.of_y?this.XX(f,v,this.abs_coord):this.YY(f,v,this.abs_coord),b.lineWidth=f,b.strokeStyle=e.getColor(),b.beginPath(),this.of_y?(b.moveTo(w,this.space.h-(m+Math.round(F.x))+.5),b.lineTo(r,this.space.h-m+.5)):(b.moveTo(m+Math.round(F.x),w),b.lineTo(m,r)),b.stroke()),A=v):y=!1)}catch(Y){y=!1}g&&!y&&(this.evaluator.setVariable(c,
k-u),this.evaluator.setVariable(l,A),I=this.extrapolate(n,c,l,0,A,u),r=parseInt(this.of_y?this.XX(f,I.y,this.abs_coord):this.YY(f,I.y,this.abs_coord)),0<this.evaluator.eval(this.drawif)&&a.rangeOK&&(b.lineWidth=f,b.strokeStyle=e.getColor(),b.beginPath(),this.of_y?(b.moveTo(w,this.space.h-(p+Math.round(I.x))+.5),b.lineTo(r,this.space.h-(p+Math.round(I.x))+.5)):(b.moveTo(p+Math.round(I.x)+.5,w),b.lineTo(p+Math.round(I.x)+.5,r)),b.stroke()),this.evaluator.setVariable(c,k));g=y;k+=u;w=r;p=m++}this.evaluator.parser.setVariable("x",
h);this.evaluator.parser.setVariable("y",d)};a.Equation.prototype.registerTextField=function(){var a=document.createElement("input");a.value=this.expresionString;a.disabled=!this.editable;var b=this;oncontextmenu=function(a){return!1};a.onkeydown=function(a){13==a.keyCode&&(b.expresion=b.evaluator.parser.parse(this.value),b.parseExpression(),b.parent.update())};this.parent.editableRegion.textFields.push(a)};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.round,k,f,m,e,h,d,c,u,l,b,n;a.Curve=function(b,c){this.parameter="t";this.parameter_interval=b.evaluator.parser.parse("[0,1]");this.parameter_steps=b.evaluator.parser.parse("8");this.width=b.evaluator.parser.parse("1");this.fill="";a.Graphic.call(this,b,c);(this.visible=2===this.parent.version&&void 0==this.visible?!0:this.visible)&&this.registerTextField()};a.extend(a.Curve,a.Graphic);a.Curve.prototype.update=function(){k=this.evaluator;f=
k.eval(this.parameter_interval);this.paraInf=f[0][0];this.paraSup=f[0][1];this.pSteps=k.eval(this.parameter_steps);this.paraSep=0<this.pSteps?Math.abs(this.paraSup-this.paraInf)/this.pSteps:0};a.Curve.prototype.draw=function(){this.uber.draw.call(this,this.fill,this.color)};a.Curve.prototype.drawTrace=function(){this.uber.drawTrace.call(this,this.fill,this.trace)};a.Curve.prototype.drawAux=function(f,q,r){k=this.evaluator;m=this.space;e=g(k.eval(this.width));f.lineWidth=0<e?e:1E-6;f.lineCap="round";
f.lineJoin="round";f.strokeStyle=r.getColor();h=k.getVariable(this.parameter);f.beginPath();k.setVariable(this.parameter,this.paraInf);d=k.eval(this.expresion);this.exprX=g(this.abs_coord?d[0][0]:m.getAbsoluteX(d[0][0]));this.exprY=g(this.abs_coord?d[0][1]:m.getAbsoluteY(d[0][1]));this.rotateExp&&(c=a.degToRad(k.eval(this.rotateExp)),u=Math.cos(c),l=Math.sin(c),b=this.exprX*u-this.exprY*l,n=this.exprX*l+this.exprY*u,this.exprX=b,this.exprY=n);f.moveTo(this.exprX+.5,this.exprY+.5);for(r=1;r<=this.pSteps;r++)k.setVariable(this.parameter,
this.paraInf+r*this.paraSep),d=k.eval(this.expresion),this.exprX=this.abs_coord?g(d[0][0]):g(m.getAbsoluteX(d[0][0])),this.exprY=this.abs_coord?g(d[0][1]):g(m.getAbsoluteY(d[0][1])),this.rotateExp&&(b=this.exprX*u-this.exprY*l,n=this.exprX*l+this.exprY*u,this.exprX=b,this.exprY=n),!isNaN(this.exprX)&&!isNaN(this.exprY)&&-1E6<this.exprX&&1E6>this.exprX&&-1E6<this.exprY&&1E6>this.exprY&&f.lineTo(this.exprX+.5,this.exprY+.5);this.fill&&(f.fillStyle=q.getColor(),f.fill("evenodd"));this.dashStyle();f.stroke();
f.setLineDash([]);k.setVariable(this.parameter,h)};a.Curve.prototype.registerTextField=function(){var a=document.createElement("input");a.value=this.expresionString;a.disabled=!this.editable;var b=this;a.oncontextmenu=function(a){return!1};a.onkeydown=function(a){13==a.keyCode&&(b.expresion=b.evaluator.parser.parse(this.value),b.parent.update())};this.parent.editableRegion.textFields.push(a)};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=2*Math.PI,k=Math.round,f,m,e,h,d,c,u,l,b,n,y,q,r,w;a.Sequence=function(b,c){this.size=b.evaluator.parser.parse("2");this.range=b.evaluator.parser.parse("[1, 100]");a.Graphic.call(this,b,c);(this.visible=2===this.parent.version&&void 0==this.visible?!0:this.visible)&&this.registerTextField()};a.extend(a.Sequence,a.Graphic);a.Sequence.prototype.update=function(){f=this.evaluator;e=f.eval(this.expresion);this.exprX=e[0][0];this.exprY=e[0][1];this.rotateExp&&
(h=a.degToRad(f.eval(this.rotateExp)),d=Math.cos(h),c=Math.sin(h),u=this.exprX*d-this.exprY*c,l=this.exprX*c+this.exprY*d,this.exprX=u,this.exprY=l);y=f.eval(this.range);this.rangeInf=y[0][0];this.rangeMax=y[0][1]};a.Sequence.prototype.draw=function(){this.uber.draw.call(this,this.color,this.color)};a.Sequence.prototype.drawTrace=function(){this.uber.drawTrace.call(this,this.trace,this.trace)};a.Sequence.prototype.drawAux=function(a,c){f=this.evaluator;m=this.space;r=q=Math.ceil(f.eval(this.size)-
.4);a.fillStyle=c.getColor();a.beginPath();this.rangeInf>this.rangeMax&&(w=this.rangeInf,this.rangeInf=this.rangeMax,this.rangeMax=w);c=f.getVariable("n");for(var d=this.rangeInf,l=this.rangeMax;d<=l;d++)f.setVariable("n",d),e=f.eval(this.expresion),this.exprX=e[0][0],this.exprY=e[0][1],b=k(this.abs_coord?this.exprX:m.getAbsoluteX(this.exprX)),n=k(this.abs_coord?this.exprY:m.getAbsoluteY(this.exprY)),a.beginPath(),a.arc(b,n,q,0,g,!0),a.fill();a.fill();this.text!=[""]&&(this.fontSize=Math.max(5,f.eval(this.font_size)),
this.font=this.font_style+" "+this.fontSize+"px "+this.font_family,this.uber.drawText.call(this,a,this.text,b+r,n-r,this.color,this.font,"start","alphabetic",f.eval(this.decimals),this.fixed,!0));f.setVariable("n",c)};a.Sequence.prototype.registerTextField=function(){var a=document.createElement("input");a.value=this.expresionString;a.disabled=!this.editable;var b=this;oncontextmenu=function(a){return!1};a.onkeydown=function(a){13==a.keyCode&&(b.expresion=b.evaluator.parser.parse(this.value),b.parent.update())};
this.parent.editableRegion.textFields.push(a)};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=2*Math.PI,k=Math.round,f,m,e,h,d,c,u,l,b,n,y;a.Point=function(b,c){this.size=b.evaluator.parser.parse("2");a.Graphic.call(this,b,c);this.text=new a.TextObject(this,this.text)};a.extend(a.Point,a.Graphic);a.Point.prototype.update=function(){f=this.evaluator;e=f.eval(this.expresion);this.exprX=e[0][0];this.exprY=e[0][1];this.rotateExp&&(h=a.degToRad(f.eval(this.rotateExp)),d=Math.cos(h),c=Math.sin(h),u=this.exprX*d-this.exprY*c,l=this.exprX*c+this.exprY*
d,this.exprX=u,this.exprY=l)};a.Point.prototype.draw=function(){this.uber.draw.call(this,this.color,this.color)};a.Point.prototype.drawTrace=function(){this.uber.drawTrace.call(this,this.trace,this.trace)};a.Point.prototype.drawAux=function(a,c){f=this.evaluator;m=this.space;y=k(f.eval(this.size));a.fillStyle=c.getColor();b=k(this.abs_coord?this.exprX:m.getAbsoluteX(this.exprX));n=k(this.abs_coord?this.exprY:m.getAbsoluteY(this.exprY));a.beginPath();a.arc(b,n,y,0,g,!0);a.fill();this.text.hasContent&&
this.text.draw(a,c,b,n)};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.round,k=2*Math.PI,f,m,e,h,d,c,u,l,b,n,y,q,r,w,p,v,x;a.Segment=function(b,c){this.width=b.evaluator.parser.parse("1");this.size=b.evaluator.parser.parse("2");a.Graphic.call(this,b,c);this.text=new a.TextObject(this,this.text)};a.extend(a.Segment,a.Graphic);a.Segment.prototype.update=function(){f=this.evaluator;e=f.eval(this.expresion);this.endPoints=[];for(var b=0,n=e.length;b<n;b++)this.endPoints[b]={x:e[b][0],y:e[b][1]};if(this.rotateExp)for(h=
a.degToRad(f.eval(this.rotateExp)),d=Math.cos(h),c=Math.sin(h),b=0,n=this.endPoints.length;b<n;b++)u=this.endPoints[b].x*d-this.endPoints[b].y*c,l=this.endPoints[b].x*c+this.endPoints[b].y*d,this.endPoints[b].x=u,this.endPoints[b].y=l};a.Segment.prototype.draw=function(){this.uber.draw.call(this,this.color,this.color)};a.Segment.prototype.drawTrace=function(){this.uber.drawTrace.call(this,this.trace,this.trace)};a.Segment.prototype.drawAux=function(a,c,d){f=this.evaluator;m=this.space;b=g(f.eval(this.width));
a.lineWidth=0<b?b:1E-6;q=f.eval(this.size);0>q&&(q=0);a.fillStyle=c.getColor();a.strokeStyle=d.getColor();a.lineCap="round";r=0==a.lineWidth%2?0:.5;this.abs_coord?(w=g(this.endPoints[0].x),p=g(this.endPoints[0].y),v=g(this.endPoints[1].x),x=g(this.endPoints[1].y)):(w=g(m.getAbsoluteX(this.endPoints[0].x)),p=g(m.getAbsoluteY(this.endPoints[0].y)),v=g(m.getAbsoluteX(this.endPoints[1].x)),x=g(m.getAbsoluteY(this.endPoints[1].y)));a.beginPath();a.moveTo(w+r,p+r);a.lineTo(v+r,x+r);this.dashStyle();a.stroke();
0<q&&(a.beginPath(),a.arc(w,p,q,0,k,!0),a.arc(v,x,q,0,k,!0),a.fill());a.setLineDash([]);this.text.hasContent&&(n=parseInt((w+v)/2)-3,y=parseInt((p+x)/2)+3,this.text.draw(a,d,n,y))};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.floor,k=Math.round,f,m,e,h,d,c,u,l,b,n,y,q,r,w,p,v,x,A;a.Arrow=function(b,c){this.width=b.evaluator.parser.parse("5");this.size=b.evaluator.parser.parse("2");this.spear=b.evaluator.parser.parse("8");this.arrow=new a.Color("ee0022");a.Graphic.call(this,b,c);this.text=new a.TextObject(this,this.text)};a.extend(a.Arrow,a.Graphic);a.Arrow.prototype.update=function(){f=this.evaluator;m=f.eval(this.expresion);this.endPoints=[];for(var b=0,l=m.length;b<
l;b++)this.endPoints[b]={x:m[b][0],y:m[b][1]};if(this.rotateExp)for(e=a.degToRad(f.eval(this.rotateExp)),h=Math.cos(e),d=Math.sin(e),b=0,l=this.endPoints.length;b<l;b++)c=this.endPoints[b].x*h-this.endPoints[b].y*d,u=this.endPoints[b].x*d+this.endPoints[b].y*h,this.endPoints[b].x=c,this.endPoints[b].y=u};a.Arrow.prototype.draw=function(){this.uber.draw.call(this,this.arrow,this.color)};a.Arrow.prototype.drawTrace=function(){this.uber.drawTrace.call(this,this.arrow,this.trace)};a.Arrow.prototype.drawAux=
function(c,d,e){f=this.evaluator;l=this.space;f.eval(this.size);y=f.eval(this.width);0>y&&(y=0);q=Math.ceil(y/2);r=l.scale;this.vect=new a.Vector2D(this.endPoints[1].x-this.endPoints[0].x,this.endPoints[1].y-this.endPoints[0].y);w=this.vect.vectorLength();this.angle=this.vect.angleBetweenVectors(a.Vector2D.AXIS_X);c.fillStyle=d.getColor();c.strokeStyle=e.getColor();c.lineWidth=2;this.abs_coord?(p=k(this.endPoints[0].x),v=k(this.endPoints[0].y),x=k(this.endPoints[1].x),A=k(this.endPoints[1].y)):(p=
k(l.getAbsoluteX(this.endPoints[0].x)),v=k(l.getAbsoluteY(this.endPoints[0].y)),x=k(l.getAbsoluteX(this.endPoints[1].x)),A=k(l.getAbsoluteY(this.endPoints[1].y)));d=f.eval(this.spear);0>d&&(d=0);c.save();c.translate(p,v,w);this.abs_coord?0<=this.vect.x&&0<=this.vect.y||0>=this.vect.x&&0<=this.vect.y?c.rotate(this.angle):c.rotate(-this.angle):(w*=r,0<=this.vect.x&&0<=this.vect.y||0>=this.vect.x&&0<=this.vect.y?c.rotate(-this.angle):c.rotate(this.angle));c.beginPath();c.moveTo(-q,g(-q));c.lineTo(g(w-
d-y),g(-q));c.lineTo(g(w-2*d),g(-d-q));c.lineTo(g(w),0);c.lineTo(g(w-2*d),g(d+q));c.lineTo(g(w-d-y),g(q));c.lineTo(-q,g(q));c.closePath();c.stroke();c.fill();c.restore();this.text.hasContent&&(b=parseInt((p+x)/2)-3,n=parseInt((v+A)/2)+3,this.text.draw(c,e,b,n))};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.round,k,f,m,e,h,d,c,u,l,b,n,y;a.Polygon=function(b,c){this.width=b.evaluator.parser.parse("1");this.fill="";a.Graphic.call(this,b,c);this.endPoints=[]};a.extend(a.Polygon,a.Graphic);a.Polygon.prototype.update=function(){k=this.evaluator;m=k.eval(this.expresion);for(var b=0,f=m.length;b<f;b++)this.endPoints[b]={x:m[b][0],y:m[b][1]};if(this.rotateExp)for(e=a.degToRad(k.eval(this.rotateExp)),h=Math.cos(e),d=Math.sin(e),b=0,f=this.endPoints.length;b<
f;b++)c=this.endPoints[b].x*h-this.endPoints[b].y*d,u=this.endPoints[b].x*d+this.endPoints[b].y*h,this.endPoints[b].x=c,this.endPoints[b].y=u};a.Polygon.prototype.draw=function(){this.uber.draw.call(this,this.fill,this.color)};a.Polygon.prototype.drawTrace=function(){this.uber.drawTrace.call(this,this.trace,this.trace)};a.Polygon.prototype.drawAux=function(a,c,d){k=this.evaluator;f=this.space;l=g(k.eval(this.width));a.lineWidth=0<l?l:1E-6;a.strokeStyle=d.getColor();a.lineCap="round";a.lineJoin="round";
b=0<l?.5:0;n=g(this.abs_coord?this.endPoints[0].x:f.getAbsoluteX(this.endPoints[0].x));y=g(this.abs_coord?this.endPoints[0].y:f.getAbsoluteY(this.endPoints[0].y));a.beginPath();a.moveTo(n+b,y+b);d=1;for(var e=this.endPoints.length;d<e;d++)n=g(this.abs_coord?this.endPoints[d].x:f.getAbsoluteX(this.endPoints[d].x)),y=g(this.abs_coord?this.endPoints[d].y:f.getAbsoluteY(this.endPoints[d].y)),a.lineTo(n+b,y+b);this.fill&&(a.fillStyle=c.getColor(),a.fill());this.dashStyle();a.stroke();a.setLineDash([])};
return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.round,k=Math.min,f=Math.max,m=Math.abs,e,h,d,c,u,l,b,n,y,q,r,w,p,v,x;a.Rectangle=function(b,c){this.width=b.evaluator.parser.parse("1");this.fill="";this.border_radius=b.evaluator.parser.parse("0");a.Graphic.call(this,b,c);this.endPoints=[]};a.extend(a.Rectangle,a.Graphic);a.Rectangle.prototype.update=function(){e=this.evaluator;expr=e.eval(this.expresion);this.exprX=expr[0][0];this.exprY=expr[0][1];this.w=150;this.h=100;this.rotateExp&&(d=
a.degToRad(e.eval(this.rotateExp)),c=Math.cos(d),u=Math.sin(d),l=this.exprX*c-this.exprY*u,b=this.exprX*u+this.exprY*c,this.exprX=l,this.exprY=b);4<=expr[0].length&&(this.w=expr[0][2],this.h=expr[0][3]);expr[1]&&2==expr[1].length&&(this.w=expr[1][0],this.h=expr[1][1]);this.w=f(0,this.w);this.h=f(0,this.h)};a.Rectangle.prototype.draw=function(){this.uber.draw.call(this,this.fill,this.color)};a.Rectangle.prototype.drawTrace=function(){this.uber.drawTrace.call(this,this.fill,this.trace,"trace")};a.Rectangle.prototype.drawAux=
function(a,b,c,d){e=this.evaluator;h=this.space;n=g(e.eval(this.width));a.lineWidth=0<n?n:1E-6;a.strokeStyle=c.getColor();a.lineCap="round";a.lineJoin="miter";y=0<n?.5:0;q=g(this.abs_coord?this.exprX:h.getAbsoluteX(this.exprX))+y;r=g(this.abs_coord?this.exprY:h.getAbsoluteY(this.exprY))+y;w=this.abs_coord?this.w:this.w*h.scale;p=this.abs_coord?this.h:-this.h*h.scale;v=k(f(0,e.eval(this.border_radius)),.5*m(w),.5*m(p));x=this.abs_coord?1:-1;a.beginPath();0!==v?(a.moveTo(q+v,r),a.lineTo(q+w-v,r),a.quadraticCurveTo(q+
w,r,q+w,r+x*v),a.lineTo(q+w,r+p-x*v),a.quadraticCurveTo(q+w,r+p,q+w-v,r+p),a.lineTo(q+v,r+p),a.quadraticCurveTo(q,r+p,q,r+p-x*v),a.lineTo(q,r+x*v),a.quadraticCurveTo(q,r,q+v,r),a.closePath()):(a.moveTo(q,r),a.lineTo(q+w,r),a.lineTo(q+w,r+p),a.lineTo(q,r+p));a.closePath();this.fill&&(a.fillStyle=b.getColor(),a.fill());this.dashStyle();a.stroke();a.setLineDash([])};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.round,k=Math.min,f=Math.max,m=Math.acos,e=Math.sqrt,h=Math.PI,d=h/2,c=2*h,u,l,b,n,y,q,r,w,p,v,x,A,C,F,H,K,E,z,G,L,N;a.Arc=function(b,c){this.width=b.evaluator.parser.parse("1");this.fill="";this.center=b.evaluator.parser.parse("(0,0)");this.radius=b.evaluator.parser.parse("1");this.init="0";this.end="90";a.Graphic.call(this,b,c);this.init.match(/^_\(/)&&(this.initFlag=!0,this.init=this.init.substring(1));this.end.match(/^_\(/)&&(this.endFlag=
!0,this.end=this.end.substring(1));this.initExpr=b.evaluator.parser.parse(this.init);this.endExpr=b.evaluator.parser.parse(this.end);this.text=new a.TextObject(this,this.text)};a.extend(a.Arc,a.Graphic);a.Arc.prototype.update=function(){u=this.evaluator;l=u.eval(this.center);this.exprX=l[0][0];this.exprY=l[0][1];b=0;this.rotateExp&&(b=a.degToRad(u.eval(this.rotateExp)),n=Math.cos(b),y=Math.sin(b),q=this.exprX*n-this.exprY*y,r=this.exprX*y+this.exprY*n,this.exprX=q,this.exprY=r);var g=u.eval(this.initExpr),
z=u.eval(this.endExpr);/^(\(|\[)expr(\)|\])$/i.test(this.initExpr.type)&&/^(\(|\[)expr(\)|\])$/i.test(this.endExpr.type)?(w=g[0][0],p=g[0][1],v=z[0][0],x=z[0][1],this.vectors?this.abs_coord&&(p=-p,x=-x):this.abs_coord?(w-=this.exprX,p=-p+this.exprY,v-=this.exprX,x=-x+this.exprY):(w-=this.exprX,p-=this.exprY,v-=this.exprX,x-=this.exprY),A=0==w?0>p?3*d:d:m(1*w/e(w*w+p*p)),C=0==v?0>x?3*d:d:m(1*v/e(v*v+x*x)),A+=b,C+=b,0<w&&0<p&&this.abs_coord&&(A=c-A),0<w&&0>p&&!this.abs_coord&&(A=c-A),0>w&&0>p&&!this.abs_coord&&
(A=c-A),0>w&&0<p&&this.abs_coord&&(A=c-A),0<v&&0<x&&this.abs_coord&&(C=c-C),0<v&&0>x&&!this.abs_coord&&(C=c-C),0>v&&0>x&&!this.abs_coord&&(C=c-C),0>v&&0<x&&this.abs_coord&&(C=c-C),this.initFlag?(F=A,A=C,C=F):(F=k(A,C),H=f(A,C),A=F,C=H,C-A>h&&this.abs_coord&&(A=H,C=F),C-A<=h&&!this.abs_coord&&(A=H,C=F)),this.iniAng=A,this.endAng=C,this.drawPoints=!0):(this.iniAng=a.degToRad(g)+b,this.endAng=a.degToRad(z)+b,this.drawAngle=!0)};a.Arc.prototype.draw=function(){this.uber.draw.call(this,this.fill,this.color)};
a.Arc.prototype.drawTrace=function(){this.uber.drawTrace.call(this,this.fill,this.trace)};a.Arc.prototype.drawAux=function(a,b,c){u=this.evaluator;K=this.space;G=u.eval(this.radius);0>G&&(G=0);N=g(u.eval(this.width));a.lineWidth=0<N?N:1E-6;a.lineCap="round";a.strokeStyle=c.getColor();this.drawAngle?(this.abs_coord?(E=g(this.exprX),z=g(this.exprY)):(E=g(K.getAbsoluteX(this.exprX)),z=g(K.getAbsoluteY(this.exprY)),G*=K.scale,this.iniAng=-this.iniAng,this.endAng=-this.endAng),this.iniAng>this.endAng&&
(L=this.iniAng,this.iniAng=this.endAng,this.endAng=L)):this.drawPoints&&(this.abs_coord?(E=g(this.exprX),z=g(this.exprY)):(E=g(K.getAbsoluteX(this.exprX)),z=g(K.getAbsoluteY(this.exprY)),G*=K.scale,this.iniAng=-this.iniAng,this.endAng=-this.endAng));this.fill&&(a.fillStyle=b.getColor(),a.beginPath(),a.moveTo(E,z),a.arc(E,z,G,this.iniAng,this.endAng,void 0),a.fill());a.beginPath();a.arc(E,z,G,this.iniAng,this.endAng,void 0);this.dashStyle();a.stroke();this.text.hasContent&&this.text.draw(a,this.color,
E,z)};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,k,f,m,e,h,d,c,u;a.Text=function(c,b){this.width=c.evaluator.parser.parse("0");a.Graphic.call(this,c,b);this.align||(this.align="left");this.anchor||(this.anchor="top_left");this.text=new a.TextObject(this,this.text)};a.extend(a.Text,a.Graphic);a.Text.prototype.update=function(){g=this.evaluator;k=g.eval(this.expresion);this.exprX=k[0][0];this.exprY=k[0][1];this.rotateExp&&(f=a.degToRad(g.eval(this.rotateExp)),m=Math.cos(f),e=Math.sin(f),h=this.exprX*
m-this.exprY*e,d=this.exprX*e+this.exprY*m,this.exprX=h,this.exprY=d)};a.Text.prototype.draw=function(){this.uber.draw.call(this,this.color)};a.Text.prototype.drawTrace=function(){this.uber.drawTrace.call(this,this.trace)};a.Text.prototype.drawAux=function(a,b){this.abs_coord?(c=parseInt(this.exprX),u=parseInt(this.exprY)):(c=parseInt(this.space.getAbsoluteX(this.exprX)),u=parseInt(this.space.getAbsoluteY(this.exprY)));this.text.draw(a,b,c,u)};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.round,k,f,m,e,h,d,c,u,l,b,n,y,q,r,w,p;a.Image=function(b,c){this.file="";this.inirot=b.evaluator.parser.parse("0");a.Graphic.call(this,b,c);this.img=new Image;this.scaleY=this.scaleX=1;this.ratio=b.ratio;this.update()};a.extend(a.Image,a.Graphic);a.Image.prototype.update=function(){k=this.evaluator;f=k.eval(this.expresion);this.exprX=f[0][0];this.exprY=f[0][1];this.rotateExp&&(m=a.degToRad(k.eval(this.rotateExp)),e=Math.cos(m),h=Math.sin(m),
d=this.exprX*e-this.exprY*h,c=this.exprX*h+this.exprY*e,this.exprX=d,this.exprY=c);4<=f[0].length&&(this.centered=!0,this.scaleX=f[0][2],this.scaleY=f[0][3]);f[1]&&2==f[1].length&&(this.centered=!0,this.scaleX=f[1][0],this.scaleY=f[1][1]);0==this.scaleX&&(this.scaleX=1E-5);0==this.scaleY&&(this.scaleY=1E-5);var b=this;if((u=k.eval(this.file))||""==u)this.img=this.parent.getImage(u),this.img.addEventListener("load",function(a){b.space.update(!0)})};a.Image.prototype.draw=function(){this.uber.draw.call(this)};
a.Image.prototype.drawTrace=function(){this.uber.drawTrace.call(this)};a.Image.prototype.drawAux=function(c){k=this.evaluator;l=this.space;this.img&&this.img.ready&&this.img.complete&&(w=this.img.width,p=this.img.height,this.img.canvas&&(w=g(w/this.ratio),p=g(p/this.ratio)),b=this.centered?0:g(w/2),n=this.centered?0:g(p/2),y=g(this.abs_coord?this.exprX:l.getAbsoluteX(this.exprX)),q=g(this.abs_coord?this.exprY:l.getAbsoluteY(this.exprY)),r=a.degToRad(-k.eval(this.inirot)),c.save(),c.translate(y+b,
q+n),c.rotate(r),this.opacity&&(c.globalAlpha=k.eval(this.opacity)),c.scale(this.scaleX,this.scaleY),c.drawImage(this.img,-w/2,-p/2,w,p),c.restore())};return a}(descartesJS||{});
descartesJS=function(a){function g(a,b,d){c=4*(b+d*a.width);return{r:a.data[c],g:a.data[c+1],b:a.data[c+2],a:a.data[c+3]}}if(a.loadLib)return a;var k,f,m,e,h,d,c,u;a.Fill=function(c,b){a.Graphic.call(this,c,b)};a.extend(a.Fill,a.Graphic);a.Fill.prototype.update=function(){k=this.evaluator.eval(this.expresion);this.exprX=k[0][0];this.exprY=k[0][1]};a.Fill.prototype.draw=function(){this.uber.draw.call(this,this.color,this.color)};a.Fill.prototype.drawTrace=function(){this.uber.drawTrace.call(this,this.trace,
this.trace)};a.Fill.prototype.drawAux=function(a,b){b.getColor();imageData=a.getImageData(0,0,this.space.w,this.space.h);this.abs_coord?(f=parseInt(this.exprX),m=parseInt(this.exprY)):(f=parseInt(this.space.getAbsoluteX(this.exprX)),m=parseInt(this.space.getAbsoluteY(this.exprY)));if(!(0>f||0>m||f>=this.space.w||m>=this.space.h)){e=[[f,m]];d=g(imageData,f,m);for(u=0;0<e.length;){u++;h=e.pop();f=h[0];m=h[1];var l=g(imageData,f,m);if(d.r===l.r&&d.g===l.g&&d.b===l.b&&d.a===l.a){l=imageData;var k=b;c=
4*(f+m*l.width);l.data[c+0]=k.r;l.data[c+1]=k.g;l.data[c+2]=k.b;l.data[c+3]=255*k.a;0<f&&e.push([f-1,m]);f<imageData.width-1&&e.push([f+1,m]);e.push([f,m-1]);e.push([f,m+1])}if(u>=this.space.w*this.space.h*3)break}a.putImageData(imageData,0,0)}};return a}(descartesJS||{});
descartesJS=function(a,g){if(a.loadLib)return a;var k=new String("-text-image-point-polygon-arc-segment-arrow-macro-curve-equation-sequence-rectangle-fill-"),f=/[\w\.\-//]*(\.png|\.jpg|\.gif|\.svg)/gi,m;a.Macro=function(e,h){this.hasExpresion=!1;this.inirot=e.evaluator.parser.parse("0");this.inipos=e.evaluator.parser.parse("(0,0)");a.Graphic.call(this,e,h);for(var d in h)"expresion"==d&&(this.hasExpresion=!0),h.hasOwnProperty(d)&&(this[d]=h[d]);this.graphics=[];e=e.lessonParser;var c=new a.Tokenizer;
if(this.hasExpresion){"'"!==this.expresion.charAt(0)&&(this.expresion="'"+this.expresion+"'");this.expresion=this.evaluator.parser.parse(this.expresion);h=this.evaluator.eval(this.expresion);if(h)var m=(m=document.getElementById(h))&&"descartes/macro"==m.type?m.text:a.openExternalFile(h);if(m){var l=m.replace(/&aacute;/g,"\u00e1").replace(/&eacute;/g,"\u00e9").replace(/&iacute;/g,"\u00ed").replace(/&oacute;/g,"\u00f3").replace(/&uacute;/g,"\u00fa").replace(/&Aacute;/g,"\u00c1").replace(/&Eacute;/g,
"\u00c9").replace(/&Iacute;/g,"\u00cd").replace(/&Oacute;/g,"\u00d3").replace(/&Uacute;/g,"\u00da").replace(/&ntilde;/g,"\u00f1").replace(/&Ntilde;/g,"\u00d1").replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&amp;/g,"&").replace(/\r/g,"").split("\n");m=[];h=0;for(d=l.length;h<d;h++)if(l[h].trim()){var b=l[h].indexOf("=");if(-1!==b){b=e.split(l[h]);for(var n=0,y=b.length;n<y;n++)if(b[n]&&1<b.length&&("id"===g[b[n][0]]||"type"===g[b[n][0]])){m.push(b);break}}}h=0;for(d=m.length;h<d;h++)for(y=(n=
m[h]||[],n[0])&&"id"===n[0][0],l=0,b=n.length;l<b;l++){var q=n[l][0].indexOf(".");-1===q||y?q=g[n[l][0]]:(q=g[n[l][0].substring(q+1)],n[l][0]=this.name+"."+n[l][0]);if(!("font"===q||"font_family"===q||("fill"===q||"color"===q||"border"===q||"arrow"===q)&&"("!==n[l][1].charAt(0)||"file"===q&&n[l][1].match(f)||"id"!==q&&void 0!==g[n[l][1]]))if("text"==q)if(n[l][1].match(/\{\\rtf1/)){q=n[l][1];var r=this;var w=function(b,d){d=c.tokenize(d.replace(/&squot;/g,"'"));for(var e=0,f=d.length;e<f;e++)"identifier"!=
d[e].type||a.reservedIds.match("-"+d[e].value+"-")||(d[e].value=r.name+"."+d[e].value);return(b.match(/^\\expr/)?"\\expr ":"\\decimals ")+c.flatTokens(d)};q=q.replace(/\\expr ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,w);q=q.replace(/\\decimals ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,w);n[l][1]=q}else{w=e.parseText(n[l][1]).textElementsMacros;for(var p=0,v=w.length;p<v;p++){q=c.tokenize(w[p].replace(/&squot;/g,"'"));for(var x=0,A=q.length;x<A;x++)"identifier"!==q[x].type||a.reservedIds.match("-"+
q[x].value+"-")||(q[x].value=this.name+"."+q[x].value);q=c.flatTokens(q).replace(/&squot;/g,"'").replace(/'\+\(/g,"[").replace(/\)\+'/g,"]");w[p]=q.substring(1,q.length-1)}n[l][1]=w.join("")}else{w=n[l][1].replace(/&squot;/g,"'").split(";");p=0;for(v=w.length;p<v;p++){q=c.tokenize(w[p].replace(/\\n/g,";"));x=0;for(A=q.length;x<A;x++)"identifier"!==q[x].type||a.reservedIds.match("-"+q[x].value+"-")||(q[x].value=this.name+"."+q[x].value);w[p]=c.flatTokens(q)}n[l][1]=w.join(";")}}h=0;for(d=m.length;h<
d;h++)if(m[h][0]){n="";y=!1;l=0;for(b=m[h].length;l<b;l++)"type"===g[m[h][l][0]]&&k.match("-"+g[m[h][l][1]]+"-")&&(y=!0),n=n+m[h][l][0]+"='"+m[h][l][1]+"' ";m[h]=n+(y?" space='"+this.spaceID+"'":"");y?this.graphics.push(e.parseGraphic(m[h],this.abs_coord,this.background,this.inirot)):e.parseAuxiliar(m[h])}}}};a.extend(a.Macro,a.Graphic);a.Macro.prototype.update=function(){m=this.evaluator.eval(this.inipos);this.iniPosX=m[0][0];this.iniPosY=m[0][1]};a.Macro.prototype.drawAux=function(a){for(var e=
0,d=this.graphics.length;e<d;e++)this.graphics[e]&&(a.save(),this.graphics[e].abs_coord?a.translate(this.iniPosX,this.iniPosY):a.translate(this.iniPosX*this.space.scale,-this.iniPosY*this.space.scale),this.graphics[e].draw(),a.restore())};return a}(descartesJS||{},babel);
descartesJS=function(a){if(a.loadLib)return a;var g=Math.sqrt,k=Math.sin,f=Math.cos,m,e,h,d,c,u,l,b,n,y,q,r,w,p,v;a.norm3D=function(a){return g(a.x*a.x+a.y*a.y+a.z*a.z)};a.normalize3D=function(b){m=a.norm3D(b);if(0===m)return{x:0,y:0,z:0};if(1===m)return{x:b.x,y:b.y,z:b.z};m=1/m;return{x:b.x*m,y:b.y*m,z:b.z*m}};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,c){return Math.abs(a.x-b.x)<=c&&Math.abs(a.y-b.y)<=c&&Math.abs(a.z-b.z)<=c};a.Vector4D=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d||0;this.adjustDec()};a.Vector4D.prototype.adjustDec=function(){this.x=parseInt(1E9*this.x)/1E9;this.y=parseInt(1E9*this.y)/1E9;this.z=parseInt(1E9*this.z)/1E9};a.Matrix4x4=function(a,
b,c,d,e,f,l,n,g,k,q,r,m,h,w,p){this.a00=a||0;this.a01=b||0;this.a02=c||0;this.a03=d||0;this.a10=e||0;this.a11=f||0;this.a12=l||0;this.a13=n||0;this.a20=g||0;this.a21=k||0;this.a22=q||0;this.a23=r||0;this.a30=m||0;this.a31=h||0;this.a32=w||0;this.a33=p||0};a.Matrix4x4.prototype.setIdentity=function(){this.a00=1;this.a10=this.a03=this.a02=this.a01=0;this.a11=1;this.a21=this.a20=this.a13=this.a12=0;this.a22=1;this.a32=this.a31=this.a30=this.a23=0;this.a33=1;return this};a.Matrix4x4.prototype.multiplyVector4=
function(b){return new a.Vector4D(b.x*this.a00+b.y*this.a10+b.z*this.a20+b.w*this.a30,b.x*this.a01+b.y*this.a11+b.z*this.a21+b.w*this.a31,b.x*this.a02+b.y*this.a12+b.z*this.a22+b.w*this.a32,b.x*this.a03+b.y*this.a13+b.z*this.a23+b.w*this.a33)};a.Matrix4x4.prototype.translate=function(b){return new a.Matrix4x4(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*b.x+this.a10*b.y+this.a20*b.z+this.a30,this.a01*b.x+this.a11*b.y+this.a21*
b.z+this.a31,this.a02*b.x+this.a12*b.y+this.a22*b.z+this.a32,this.a03*b.x+this.a13*b.y+this.a23*b.z+this.a33)};a.Matrix4x4.prototype.rotateX=function(c){e=k(c);h=f(c);b=this.a10;n=this.a11;y=this.a12;q=this.a13;r=this.a20;w=this.a21;p=this.a22;v=this.a23;return new a.Matrix4x4(this.a00,this.a01,this.a02,this.a03,b*h+r*e,n*h+w*e,y*h+p*e,q*h+v*e,b*-e+r*h,n*-e+w*h,y*-e+p*h,q*-e+v*h,this.a30,this.a31,this.a32,this.a33)};a.Matrix4x4.prototype.rotateY=function(b){e=k(b);h=f(b);d=this.a00;c=this.a01;u=this.a02;
l=this.a03;r=this.a20;w=this.a21;p=this.a22;v=this.a23;return new a.Matrix4x4(d*h+r*-e,c*h+w*-e,u*h+p*-e,l*h+v*-e,this.a10,this.a11,this.a12,this.a13,d*e+r*h,c*e+w*h,u*e+p*h,l*e+v*h,this.a30,this.a31,this.a32,this.a33)};a.Matrix4x4.prototype.rotateZ=function(g){e=k(g);h=f(g);d=this.a00;c=this.a01;u=this.a02;l=this.a03;b=this.a10;n=this.a11;y=this.a12;q=this.a13;return new a.Matrix4x4(d*h+b*e,c*h+n*e,u*h+y*e,l*h+q*e,d*-e+b*h,c*-e+n*h,u*-e+y*h,l*-e+q*h,this.a20,this.a21,this.a22,this.a23,this.a30,this.a31,
this.a32,this.a33)};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,h),a.fill(),a.stroke())}function k(a,c){a.textNode=null;a.lineCap="round";a.lineJoin="round";a.lineWidth=.4;a.beginPath();a.moveTo(this.projVert[0].x,this.projVert[0].y);b=1;for(n=this.projVert.length;b<n;b++)a.lineTo(this.projVert[b].x,this.projVert[b].y);a.closePath();"color"===
this.model?(a.fillStyle=0>this.direction?this.backColor:this.frontColor,a.strokeStyle=a.fillStyle,a.stroke(),a.fill()):"light"===this.model||"metal"===this.model?(a.fillStyle=c.computeColor(0>this.direction?this.backColor:this.frontColor,this,"metal"===this.model),a.strokeStyle=a.fillStyle,a.stroke(),a.fill()):"wire"===this.model&&(a.lineWidth=1.25,a.strokeStyle=this.frontColor,a.stroke());this.edges&&"wire"!==this.model&&(a.lineWidth=1,a.strokeStyle=this.edges,a.stroke())}function f(a){a.textNode=
null;a.oldTextNode="_a1b2c3_";l=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,l)}function m(a){a.textNode=null;a.lineCap="round";a.lineJoin="round";
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 e(b,c,d){return a.normalize3D(a.crossProduct3D(a.subtract3D(b,
c),a.subtract3D(b,d)))}if(a.loadLib)return a;var h=2*Math.PI,d,c,u,l,b,n,y,q;a.Primitive3D=function(a,b){this.space=b;for(var c in a)a.hasOwnProperty(c)&&(this[c]=a[c]);this.projVert=[];this.spaceVertices=[];this.newProjVert=[];this.newSpaceVert=[];"vertex"===this.type?this.draw=g:"face"===this.type?(this.normal=e(this.vertices[0],this.vertices[1],this.vertices[2]),this.draw=k):"text"===this.type?this.draw=f:"edge"===this.type&&(this.draw=m);this.isText&&(this.computeDepth=function(){this.normal=
{x:0,y:0,z:0};this.projVert=this.vertices;this.depth=this.vertices[0].z;this.average=this.vertices[0]})};a.Primitive3D.prototype.computeDepth=function(c){this.space=c;this.average={x:0,y:0,z:0};this.removeDoubles();this.normal={x:0,y:1,z:0};this.direction={x:1,y:0,z:0};b=0;for(n=this.vertices.length;b<n;b++)this.spaceVertices[b]=c.rotateVertex(this.vertices[b]),this.average.x+=this.spaceVertices[b].x,this.average.y+=this.spaceVertices[b].y,this.average.z+=this.spaceVertices[b].z;this.average=a.scalarProduct3D(this.average,
1/n);this.average_proy=c.project(this.average);this.depth=a.norm3D(a.subtract3D(c.eye,this.average));2<this.vertices.length&&(this.normal=e(this.spaceVertices[0],this.spaceVertices[1],this.spaceVertices[2]));b=0;for(n=this.vertices.length;b<n;b++)this.newSpaceVert[b]=this.spaceVertices[b],this.projVert[b]=this.newProjVert[b]=c.project(this.spaceVertices[b]);2<this.vertices.length&&(this.direction=e(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;b=0;for(n=this.vertices.length;b<n;b++)y=a.norm3D(a.subtract3D(this.spaceVertices[b],c.eye)),this.minDistanceToEye=Math.min(this.minDistanceToEye,y),this.maxDistanceToEye=Math.max(this.maxDistanceToEye,y);b=0;for(n=this.vertices.length;b<n;b++)this.minx>this.projVert[b].x&&(this.minx=this.projVert[b].x),this.maxx<this.projVert[b].x&&(this.maxx=this.projVert[b].x),this.miny>this.projVert[b].y&&(this.miny=this.projVert[b].y),
this.maxy<this.projVert[b].y&&(this.maxy=this.projVert[b].y)};a.Primitive3D.prototype.removeDoubles=function(){if("edge"!==this.type){q=[];b=0;for(n=this.vertices.length;b<n;b++)(1E-8<Math.abs(this.vertices[b].x-this.vertices[(b+1)%n].x)||1E-8<Math.abs(this.vertices[b].y-this.vertices[(b+1)%n].y)||1E-8<Math.abs(this.vertices[b].z-this.vertices[(b+1)%n].z)||1E-8<Math.abs(this.vertices[b].w-this.vertices[(b+1)%n].w))&&q.push(this.vertices[b]);0===q.length&&q.push(this.vertices[0]);this.vertices=q}};
a.Primitive3D.prototype.drawText=function(b,e,f,l,n,g,k,q,r,m,h){d=this.evaluator;b.textNode=e;g=d.eval(this.offset_dist);k=-a.degToRad(d.eval(this.offset_angle));f+=g*Math.cos(k);l+=g*Math.sin(k);b.textNode.pos={x:f,y:l};e.hasContent&&(e.draw(b,n,f,l,!0),u=this.fromPoint?e.textNodes.metrics.w/2:0,c=this.fromPoint?e.textNodes.metrics.h/2:0,e.draw(b,n,f-u,l-c))};a.Primitive3D.prototype.splitFace=function(b){if(this.intersects(b)){var c=i2=null,d=ix2=0,e,f;var l=this.vertices;var n=b.vertices;var g=
0;for(f=n.length;g<f;g++){var k=this.intersection(n[g],n[(g+1)%f]);if(null!==k)if(null===c){if(c=k,d=g,2===n.length){i2=c;break}}else if(!a.equals3DEpsilon(k,c,1E-8)){i2=k;ix2=g;break}}if(null!==c&&null!==i2){g=this.isInterior(c)||this.isInterior(i2);var q=e=null;if(!g&&3<=n.length)for(f=0,l=l.length;f<l;f++)if(k=b.intersection(this.vertices[f],this.vertices[(f+1)%l]),null!==k)if(null===e)e=k;else if(!a.equals3DEpsilon(k,e,1E-8)){q=k;break}if(g||null!==e&&null!==q&&b.isInterior(e)&&b.isInterior(q)){q=
!0;l=k=null;if(2===n.length)a.equals3DEpsilon(c,n[0],1E-8)||a.equals3DEpsilon(c,n[1],1E-8)?q=!1:(k=[],k[0]=n[0],k[1]=c,l=[],l[0]=c,l[1]=n[1]);else for(k=[],l=[],g=f=e=0;g<n.length;g++)g<d?k[e++]=n[g]:g==d?(k[e++]=n[g],k[e++]=c,l[f++]=c):g<ix2?l[f++]=n[g]:g==ix2?(l[f++]=n[g],l[f++]=i2,k[e++]=i2):k[e++]=n[g];if(q){c=[];c[0]=new a.Primitive3D({vertices:k,type:"face",frontColor:b.frontColor,backColor:b.backColor,edges:b.edges,model:b.model},this.space);c[0].removeDoubles();c[0].normal=b.normal;c[1]=new a.Primitive3D({vertices:l,
type:"face",frontColor:b.frontColor,backColor:b.backColor,edges:b.edges,model:b.model},this.space);c[1].removeDoubles();c[1].normal=b.normal;if(2<c[0].vertices.length)return 2<c[1].vertices.length?c:[c[0]];if(2<c[1].vertices.length)return[c[1]]}}}}return[b]};a.Primitive3D.prototype.intersects=function(a){return this.intersectsPlane(a)&&a.intersectsPlane(this)};a.Primitive3D.prototype.intersectsPlane=function(b){var c=this.vertices;var d=b.vertices;if(0<c.length){var e=a.dotProduct3D(d[0],b.normal);
var f=a.dotProduct3D(c[0],b.normal);if(1E-8>Math.abs(e-f))return!0;for(var l=1,n=c.length;l<n;l++)if(d=a.dotProduct3D(c[l],b.normal),1E-8>Math.abs(e-d)||d>e&&f<e||d<e&&f>e)return!0}return!1};a.Primitive3D.prototype.intersection=function(b,c){var d=this.vertices;if(0<d.length){c=a.subtract3D(c,b);var e=a.dotProduct3D(c,this.normal);if(0!==e&&(d=a.dotProduct3D(a.subtract3D(d[0],b),this.normal)/e,-1E-8<d&&1.00000001>d))return a.add3D(b,a.scalarProduct3D(c,d))}return null};a.Primitive3D.prototype.isInterior=
function(b){var c=this.vertices;if(0<c.length)for(var d=0,e=a.subtract3D(c[0],b),f=0,l=c.length;f<l;f++){var n=a.subtract3D(c[(f+1)%l],b),g=a.dotProduct3D(a.crossProduct3D(e,n),this.normal);if(1E-8>Math.abs(g)){if(0>a.dotProduct3D(e,n))break}else{if(0>d&&0<g||0<d&&0>g)return!1;e=n;d=g}}return!0};var r,w,p,v,x;a.Primitive3D.prototype.inFrontOf=function(a,c,d){if(this.minDistanceToEye>=c.maxDistanceToEye||this.maxx<=c.minx||this.minx>=c.maxx||this.maxy<=c.miny||this.miny>=c.maxy)return!1;for(v=0;3>
v;v++)if(r=null,r=0===v?this.intersections(c):1===v?c.verticesContainedIn(this):this.verticesContainedIn(c),null!=r&&0<r.length){for(x=0;x<r.length;x++)a.push(r[x]);b=0;for(n=r.length;b<n;b++){w=r[b];p=this.space.rayFromEye(w.x,w.y);try{t=this.distanceToEyeAlong(p)-c.distanceToEyeAlong(p);if(t<=-d)return!0;if(t>=d)return!1}catch(H){}}}return!1};a.Primitive3D.prototype.intersections=function(b){for(var c=[],d,e,f,l=new a.R2,n=this.newSpaceVert,g=b.newSpaceVert,k=this.newProjVert,q=b.newProjVert,r=
0,m=n.length;r<m;r++){b=n[r];d=n[(r+1)%m];for(var h=0,w=g.length;h<w;h++)e=g[h],f=g[(h+1)%w],b!=e&&b!=f&&d!=e&&d!=f&&(e=l.intersection(k[r],k[(r+1)%m],q[h],q[(h+1)%w]),null!=e&&c.push(e))}return c};a.Primitive3D.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");};a.Primitive3D.prototype.verticesContainedIn=function(a){for(var b=[],c=this.newSpaceVert,
d=this.newProjVert,e=0,f=c.length;e<f;e++)!a.isVertex(c[e])&&a.appearsToContain(d[e])&&b.push(d[e]);return b};a.Primitive3D.prototype.appearsToContain=function(a){for(var b=0,c,d=this.newProjVert,e=0,f=this.newSpaceVert.length;e<f;e++){c=(d[e].x-a.x)*(d[(e+1)%f].y-a.y)-(d[(e+1)%f].x-a.x)*(d[e].y-a.y);if(0!=b)if(1E-8>Math.abs(c)){if(1E-8<Math.abs(d[e].x-d[(e+1)%f].x))return Math.min(d[e].x,d[(e+1)%f].x)<=a.x+1E-8&&a.x<=Math.max(d[e].x,d[(e+1)%f].x)+1E-8;if(1E-8<Math.abs(d[e].y-d[(e+1)%f].y))return Math.min(d[e].y,
d[(e+1)%f].y)<=a.y+1E-8&&a.y<=Math.max(d[e].y,d[(e+1)%f].y)+1E-8}else if(0<b&&0>c||0>b&&0<c)return!1;b=c}return!0};a.Primitive3D.prototype.isVertex=function(b){for(var c=this.newSpaceVert,d=0,e=c.length;d<e;d++)if(a.equals3DEpsilon(b,c[d],1E-8))return!0;return!1};return a}(descartesJS||{});
descartesJS=function(a){function g(a){for(var c=[],b=0,d,e=a.length,f=a.length-1;-1<f;f--)d=a.charAt(f),0==b?"="==d&&(b=1):1==b?" "!=d&&(b="<"===d||">"===d?0:2):2==b&&" "==d&&(c.unshift(a.substring(f+1,e)),e=f,b=0);c.unshift(a.substring(0,e));return c}if(a.loadLib)return a;var k={x:0,y:0,z:0},f,m,e,h,d=a.degToRad;a.Graphic3D=function(c,d){this.parent=c;this.evaluator=c.evaluator;var b=c.evaluator.parser;this.spaceID="E0";this.background=!1;this.type="";this.color=new a.Color("eeffaa");this.backcolor=
new a.Color("6090a0");this.Nu=this.evaluator.parser.parse("7");this.Nv=this.evaluator.parser.parse("7");this.drawif=b.parse("1");this.abs_coord=!1;this.family="";this.family_interval=b.parse("[0,1]");this.family_steps=b.parse("8");this.font="Monospaced,PLAIN,12";this.fixed=!0;this.text="";this.decimals=b.parse("2");this.inirot="(0,0,0)";this.inirotEuler=!1;this.inipos=b.parse("(0,0,0)");this.endrot="(0,0,0)";this.endrotEuler=!1;this.endpos=b.parse("(0,0,0)");this.model="color";for(var e in d)d.hasOwnProperty(e)&&
(this[e]=d[e]);void 0==this.expresion&&"macro"!=this.type&&(this.expresion=b.parse("(0,0)"));this.space=this.getSpace();this.canvas=this.background?this.space.backCanvas:this.space.canvas;this.ctx=this.canvas.getContext("2d");this.font_str=this.font;this.font=a.convertFont(this.font);this.fontSize=(this.fontSize=this.font.match(/([\d\.]+)px/))?parseFloat(this.fontSize[1]):10;this.font_style=a.getFontStyle(this.font_str.split(",")[1]);if("boolean"===typeof this.bold||"boolean"===typeof this.italics)this.bold&&
!this.italics?this.font_style="Bold ":!this.bold&&this.italics?this.font_style="Italic ":this.bold&&this.italics?this.font_style="Italic Bold ":this.bold||this.italics||(this.font_style=" ");this.font_family||(this.font_family=this.font_str.split(",")[0]);this.font_family=a.getFontName(this.font_family);"undefined"===typeof this.font_size&&(this.font_size=c.evaluator.parser.parse(this.fontSize.toString()));this.inirot.match("Euler")&&(this.inirot=this.inirot.replace("Euler",""),this.inirotEuler=!0);
this.endrot.match("Euler")&&(this.endrot=this.endrot.replace("Euler",""),this.endrotEuler=!0);this.inirot=b.parse(this.inirot);this.endrot=b.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};a.Graphic3D.prototype.getSpace=function(){for(var a=
this.parent.spaces,c,b=0,d=a.length;b<d;b++)if(c=a[b],c.id==this.spaceID)return c;return a[0]};a.Graphic3D.prototype.getFamilyValues=function(){f=this.evaluator;m=f.eval(this.family_interval);this.familyInf=m[0][0];this.familySup=m[0][1];this.fSteps=Math.round(f.eval(this.family_steps));this.family_sep=0<this.fSteps?(this.familySup-this.familyInf)/this.fSteps:0};a.Graphic3D.prototype.buildFamilyPrimitives=function(){f=this.evaluator;this.getFamilyValues();e=f.getVariable(this.family);if(0<=this.fSteps)for(var a=
0,c=this.fSteps;a<=c;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,e)};a.Graphic3D.prototype.update=function(){this.primitives=[];this.evaluator.eval(this.drawif)&&(this.family||this.buildPrimitives());this.family&&this.buildFamilyPrimitives()};a.Graphic3D.prototype.updateMVMatrix=function(){tmpExpr=this.evaluator.eval(this.inirot);this.inirotEuler?(this.inirotM=
this.inirotM.setIdentity(),this.inirotM=this.inirotM.rotateZ(d(tmpExpr[0][0])),this.inirotM=this.inirotM.rotateX(d(tmpExpr[0][1])),this.inirotM=this.inirotM.rotateZ(d(tmpExpr[0][2]))):(this.inirotM_X=this.inirotM_X.setIdentity().rotateX(d(tmpExpr[0][0])),this.inirotM_Y=this.inirotM_Y.setIdentity().rotateY(d(tmpExpr[0][1])),this.inirotM_Z=this.inirotM_Z.setIdentity().rotateZ(d(tmpExpr[0][2])));tmpExpr=this.evaluator.eval(this.inipos);k={x:tmpExpr[0][0],y:tmpExpr[0][1],z:tmpExpr[0][2]};this.iniposM=
this.iniposM.setIdentity().translate(k);tmpExpr=this.evaluator.eval(this.endrot);this.endrotEuler?(this.endrotM=this.endrotM.setIdentity(),this.endrotM=this.endrotM.rotateZ(d(tmpExpr[0][0])),this.endrotM=this.endrotM.rotateX(d(tmpExpr[0][1])),this.endrotM=this.endrotM.rotateZ(d(tmpExpr[0][2]))):(this.endrotM_X=this.endrotM_X.setIdentity().rotateX(d(tmpExpr[0][0])),this.endrotM_Y=this.endrotM_Y.setIdentity().rotateY(d(tmpExpr[0][1])),this.endrotM_Z=this.endrotM_Z.setIdentity().rotateZ(d(tmpExpr[0][2])));
tmpExpr=this.evaluator.eval(this.endpos);k={x:tmpExpr[0][0],y:tmpExpr[0][1],z:tmpExpr[0][2]};this.endposM=this.endposM.setIdentity().translate(k)};a.Graphic3D.prototype.transformVertex=function(a){this.inirotEuler?h=this.inirotM.multiplyVector4(a):(h=this.inirotM_X.multiplyVector4(a),h=this.inirotM_Y.multiplyVector4(h),h=this.inirotM_Z.multiplyVector4(h));h=this.iniposM.multiplyVector4(h);this.endrotEuler?h=this.endrotM.multiplyVector4(h):(h=this.endrotM_X.multiplyVector4(h),h=this.endrotM_Y.multiplyVector4(h),
h=this.endrotM_Z.multiplyVector4(h));h=this.endposM.multiplyVector4(h);this.macroChildren&&(h=this.applyMacroTransform(h));h.adjustDec();return h};a.Graphic3D.prototype.applyMacroTransform=function(a){this.macro_inirotEuler?h=this.macro_inirotM.multiplyVector4(a):(h=this.macro_inirotM_X.multiplyVector4(a),h=this.macro_inirotM_Y.multiplyVector4(h),h=this.macro_inirotM_Z.multiplyVector4(h));h=this.macro_iniposM.multiplyVector4(h);this.macro_endrotEuler?h=this.macro_endrotM.multiplyVector4(h):(h=this.macro_endrotM_X.multiplyVector4(h),
h=this.macro_endrotM_Y.multiplyVector4(h),h=this.macro_endrotM_Z.multiplyVector4(h));return h=this.macro_endposM.multiplyVector4(h)};a.Graphic3D.prototype.parseExpression=function(){for(var a=this.expresion.split(";"),c=[],b=0,d=a.length;b<d;b++)""!==a[b].trim()&&(c=c.concat(g(a[b])));b=0;for(d=c.length;b<d;b++)c[b]=this.evaluator.parser.parse(c[b],!0);return c};var c;a.Graphic3D.prototype.splitFace=function(a){for(var d=0,b=this.primitives.length;d<b;d++)if(c=[],"face"===this.primitives[d].type){for(var e=
0,f=a.primitives.length;e<f;e++)"face"===a.primitives[e].type?c=c.concat(this.primitives[d].splitFace(a.primitives[e])):c.push(a.primitives[e]);a.primitives=c}};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,k,f,m,e;a.Point3D=function(e,d){a.Graphic3D.call(this,e,d)};a.extend(a.Point3D,a.Graphic3D);a.Point3D.prototype.buildPrimitives=function(){g=this.evaluator;this.updateMVMatrix();k=g.eval(this.expresion);f=k[0][0];m=k[0][1];e=k[0][2];this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(f,m,e,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,m,e,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)))};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,k,f,m,e,h,d;a.Segment3D=function(c,d){this.width=c.evaluator.parser.parse("1");a.Graphic3D.call(this,c,d)};a.extend(a.Segment3D,a.Graphic3D);a.Segment3D.prototype.buildPrimitives=function(){evaluator=this.evaluator;this.updateMVMatrix();d=evaluator.getVariable("u");evaluator.setVariable("u",this.Nu);expr=evaluator.eval(this.expresion);g=expr[0][0];k=expr[0][1];f=expr[0][2];m=expr[1][0];e=expr[1][1];h=expr[1][2];this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(g,
k,f,1)),this.transformVertex(new a.Vector4D(m,e,h,1))],type:"edge",lineDash:this.lineDash,frontColor:this.color.getColor(),lineWidth:evaluator.eval(this.width)},this.space));evaluator.setVariable("u",d)};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,k,f,m,e,h,d,c,u,l,b,n,y,q;a.Surface3D=function(b,c){this.parameter="t";this.parameter_interval=b.evaluator.parser.parse("[0,1]");this.parameter_steps=b.evaluator.parser.parse("8");a.Graphic3D.call(this,b,c);this.expresion=this.parseExpression()};a.extend(a.Surface3D,a.Graphic3D);a.Surface3D.prototype.buildPrimitives=function(){g=this.evaluator;this.updateMVMatrix();m=g.getVariable("x");e=g.getVariable("y");h=g.getVariable("z");k=g.getVariable("u");
f=g.getVariable("v");g.setVariable("u",0);g.setVariable("v",0);d=parseInt(g.eval(this.Nu));c=parseInt(g.eval(this.Nv));u=[];for(b=0;b<=d;b++)for(g.setVariable("u",b/d),n=0;n<=c;n++){g.setVariable("v",n/c);y=0;for(q=this.expresion.length;y<q;y++)g.eval(this.expresion[y]);u.push(this.transformVertex(new a.Vector4D(g.getVariable("x"),g.getVariable("y"),g.getVariable("z"),1)))}var r=this.color.getColor(),w=this.backcolor.getColor(),p=this.edges?this.edges.getColor():"";for(b=0;b<d;b++)for(n=0;n<c;n++)l=
[],l.push(u[n+b*c+b]),l.push(u[n+1+b*c+b]),l.push(u[n+2+(b+1)*c+b]),l.push(u[n+1+(b+1)*c+b]),this.primitives.push(new a.Primitive3D({vertices:l,type:"face",frontColor:r,backColor:w,edges:p,model:this.model},this.space));g.setVariable("x",m);g.setVariable("y",e);g.setVariable("z",h);g.setVariable("u",k);g.setVariable("v",f)};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,k,f,m,e,h;a.Polygon3D=function(d,c){this.width=d.evaluator.parser.parse("1");a.Graphic3D.call(this,d,c)};a.extend(a.Polygon3D,a.Graphic3D);a.Polygon3D.prototype.buildPrimitives=function(){evaluator=this.evaluator;this.updateMVMatrix();expr=evaluator.eval(this.expresion);for(var d=this.color.getColor(),c=0,u=expr.length-1;c<u;c++)g=expr[c][0],k=expr[c][1],f=expr[c][2],m=expr[c+1][0],e=expr[c+1][1],h=expr[c+1][2],this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(g,
k,f,1)),this.transformVertex(new a.Vector4D(m,e,h,1))],type:"edge",frontColor:d,lineWidth:evaluator.eval(this.width)},this.space))};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,k,f,m,e,h;a.Curve3D=function(d,c){this.width=d.evaluator.parser.parse("1");a.Graphic3D.call(this,d,c);this.expresion=this.parseExpression()};a.extend(a.Curve3D,a.Graphic3D);a.Curve3D.prototype.buildPrimitives=function(){evaluator=this.evaluator;this.updateMVMatrix();m=evaluator.getVariable("x");e=evaluator.getVariable("y");h=evaluator.getVariable("z");f=evaluator.getVariable("u");evaluator.setVariable("u",0);k=evaluator.eval(this.Nu);g=[];for(var d=
0;d<=k;d++){evaluator.setVariable("u",d/k);for(var c=0,u=this.expresion.length;c<u;c++)evaluator.eval(this.expresion[c]);g.push(this.transformVertex(new a.Vector4D(evaluator.getVariable("x"),evaluator.getVariable("y"),evaluator.getVariable("z"),1)))}d=0;for(c=g.length-1;d<c;d++)this.primitives.push(new a.Primitive3D({vertices:[g[d],g[d+1]],type:"edge",frontColor:this.color.getColor(),lineWidth:evaluator.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));evaluator.setVariable("x",m);evaluator.setVariable("y",h);evaluator.setVariable("z",e);evaluator.setVariable("u",f)};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,k,f,m,e,h,d,c,u;a.Triangle3D=function(c,b){a.Graphic3D.call(this,c,b)};a.extend(a.Triangle3D,a.Graphic3D);a.Triangle3D.prototype.buildPrimitives=function(){evaluator=this.evaluator;this.updateMVMatrix();expr=evaluator.eval(this.expresion);g=expr[0][0];k=expr[0][1];f=expr[0][2];m=expr[1][0];e=expr[1][1];h=expr[1][2];d=expr[2][0];c=expr[2][1];u=expr[2][2];var l=this.edges?this.edges.getColor():"";this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(g,
k,f,1)),this.transformVertex(new a.Vector4D(d,c,u,1)),this.transformVertex(new a.Vector4D(m,e,h,1))],type:"face",frontColor:this.color.getColor(),backColor:this.backcolor.getColor(),edges:l,model:this.model},this.space))};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g;a.Face3D=function(g,f){a.Graphic3D.call(this,g,f)};a.extend(a.Face3D,a.Graphic3D);a.Face3D.prototype.buildPrimitives=function(){evaluator=this.evaluator;this.updateMVMatrix();expr=evaluator.eval(this.expresion);g=[];for(var k=expr.length-1;0<=k;k--)g.push(this.transformVertex(new a.Vector4D(expr[k][0],expr[k][1],expr[k][2],1)));k=this.edges?this.edges.getColor():"";this.primitives.push(new a.Primitive3D({vertices:g,type:"face",frontColor:this.color.getColor(),
backColor:this.backcolor.getColor(),edges:k,model:this.model},this.space))};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,k,f,m,e;a.Polireg3D=function(e,d){this.width=e.evaluator.parser.parse("2");this.length=e.evaluator.parser.parse("2");a.Graphic3D.call(this,e,d)};a.extend(a.Polireg3D,a.Graphic3D);a.Polireg3D.prototype.buildPrimitives=function(){evaluator=this.evaluator;this.updateMVMatrix();g=evaluator.eval(this.Nu);k=[this.transformVertex(new a.Vector4D(0,0,0,1))];f=evaluator.eval(this.width)/2;m=evaluator.eval(this.length)/2;e=2*Math.PI/g;for(var h=0;h<g;h++)k.push(this.transformVertex(new a.Vector4D(f*
Math.cos(e*h),m*Math.sin(e*h),0,1)));var d=this.color.getColor(),c=this.backcolor.getColor(),u=this.edges?this.edges.getColor():"";for(h=0;h<g;h++)this.primitives.push(new a.Primitive3D({vertices:[k[0],h+2<=g?k[h+2]:k[1],k[h+1]],type:"face",frontColor:d,backColor:c,edges:u,model:this.model},this.space))};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,k,f,m;a.Text3D=function(e,f){a.Graphic3D.call(this,e,f)};a.extend(a.Text3D,a.Graphic3D);a.Text3D.prototype.buildPrimitives=function(){g=this.evaluator;k=g.eval(this.expresion);f=k[0][0];m=k[0][1];this.primitives.push(new a.Primitive3D({vertices:[new a.Vector4D(f,m,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))};return a}(descartesJS||{});
descartesJS=function(a,g){if(a.loadLib)return a;var k=new String("-point-segment-polygon-curve-triangle-face-polireg-surface-text-cube-box-tetrahedron-octahedron-sphere-dodecahedron-icosahedron-ellipsoid-cone-cylinder-torus-mesh-macro-");new String("-x-y-z-u-v-w-");var f=/[\w\.\-//]*(\.png|\.jpg|\.gif|\.svg)/gi,m,e,h=0;a.Macro3D=function(d,c){this.expresion=void 0;this.inirot="(0,0,0)";this.inirotEuler=!1;this.inipos=d.evaluator.parser.parse("(0,0,0)");this.endrot="(0,0,0)";this.endrotEuler=!1;this.endpos=
d.evaluator.parser.parse("(0,0,0)");this.name="_descartes_empty_name_"+h++;a.Graphic.call(this,d,c);for(var e in c)c.hasOwnProperty(e)&&(this[e]=c[e]);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=this.evaluator.parser.parse(this.inirot);this.endrot=this.evaluator.parser.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;this.graphics=[];d=d.lessonParser;var l=new a.Tokenizer;if(void 0!=this.expresion){"'"!==this.expresion.charAt(0)&&(this.expresion="'"+this.expresion+"'");this.expresion=this.evaluator.parser.parse(this.expresion);c=this.evaluator.eval(this.expresion);if(c)var b=
(b=document.getElementById(c))&&"descartes/macro"==b.type?b.text:a.openExternalFile(c);if(b){var n=b.replace(/&aacute;/g,"\u00e1").replace(/&eacute;/g,"\u00e9").replace(/&iacute;/g,"\u00ed").replace(/&oacute;/g,"\u00f3").replace(/&uacute;/g,"\u00fa").replace(/&Aacute;/g,"\u00c1").replace(/&Eacute;/g,"\u00c9").replace(/&Iacute;/g,"\u00cd").replace(/&Oacute;/g,"\u00d3").replace(/&Uacute;/g,"\u00da").replace(/&ntilde;/g,"\u00f1").replace(/&Ntilde;/g,"\u00d1").replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&amp;/g,
"&").replace(/\r/g,"").split("\n");b=[];c=0;for(e=n.length;c<e;c++){var m=n[c].indexOf("=");if(-1!==m){m=d.split(n[c]);for(var q=0,r=m.length;q<r;q++)if(m[q]&&1<m.length&&("id"===g[m[q][0]]||"type"===g[m[q][0]])){b.push(m);break}}}c=0;for(e=b.length;c<e;c++){r=(q=b[c]||[],q[0])&&"id"===q[0][0];var w=!1;n=0;for(m=q.length;n<m;n++){var p=q[n][0].indexOf(".");-1===p||r?p=g[q[n][0]]:(p=g[q[n][0].substring(p+1)],q[n][0]=this.name+"."+q[n][0]);"type"===p&&"surface"===g[q[n][1]]&&(w=!0);if(!("font"===p||
"font_family"===p||("fill"===p||"color"===p||"backcolor"===p||"arrow"===p)&&"("!==q[n][1].charAt(0)||"file"===p&&q[n][1].match(f)||"id"!==p&&void 0!==g[q[n][1]]||w&&"expresion"===p)||"width"===p||"height"===p||"length"===p)if("text"==p)if(q[n][1].match(/\{\\rtf1/)){p=q[n][1];var v=this;var x=function(b,c){c=l.tokenize(c.replace(/&squot;/g,"'"));for(var d=0,e=c.length;d<e;d++)"identifier"!=c[d].type||a.reservedIds.match("-"+c[d].value+"-")||(c[d].value=v.name+"."+c[d].value);return(b.match(/^\\expr/)?
"\\expr ":"\\decimals ")+l.flatTokens(c)};p=p.replace(/\\expr ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,x);p=p.replace(/\\decimals ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,x);q[n][1]=p}else{x=d.parseText(q[n][1]).textElementsMacros;for(var A=0,C=x.length;A<C;A++){p=l.tokenize(x[A].replace(/&squot;/g,"'"));for(var F=0,H=p.length;F<H;F++)"identifier"!==p[F].type||a.reservedIds.match("-"+p[F].value+"-")||(p[F].value=this.name+"."+p[F].value);p=l.flatTokens(p).replace(/&squot;/g,
"'").replace(/'\+\(/g,"[").replace(/\)\+'/g,"]");x[A]=p.substring(1,p.length-1)}q[n][1]=x.join("")}else{x=q[n][1].replace(/&squot;/g,"'").split(";");A=0;for(C=x.length;A<C;A++){p=l.tokenize(x[A].replace(/\\n/g,";"));F=0;for(H=p.length;F<H;F++)"identifier"!==p[F].type||a.reservedIds.match("-"+p[F].value+"-")||(p[F].value=this.name+"."+p[F].value);x[A]=l.flatTokens(p)}q[n][1]=x.join(";")}}}c=0;for(e=b.length;c<e;c++)if(b[c][0]){q="";r=!1;n=0;for(m=b[c].length;n<m;n++)"type"===g[b[c][n][0]]&&k.match("-"+
g[b[c][n][1]]+"-")&&(r=!0),q=q+b[c][n][0]+"='"+b[c][n][1]+"' ";b[c]=q+(r?" space='"+this.spaceID+"'":"");r?this.graphics.push(d.parse3DGraphic(b[c],this.abs_coord,this.background,this.inirot)):d.parseAuxiliar(b[c])}}c=0;for(e=this.graphics.length;c<e;c++)this.graphics[c].macroChildren=!0}};a.extend(a.Macro3D,a.Graphic);a.Macro3D.prototype.buildFamilyPrimitives=function(){evaluator=this.evaluator;this.getFamilyValues();var a=evaluator.getVariable(this.family);if(0<=this.fSteps)for(var c=0,e=this.fSteps;c<=
e;c++)evaluator.setVariable(this.family,this.familyInf+c*this.family_sep),this.familyValue=this.familyInf+c*this.family_sep,evaluator.eval(this.drawif)&&this.updateMacro();evaluator.setVariable(this.family,a)};a.Macro3D.prototype.update=function(){this.primitives=[];this.evaluator.eval(this.drawif)&&(this.family||this.updateMacro());this.family&&this.buildFamilyPrimitives()};a.Macro3D.prototype.updateMacro=function(){this.updateTransformation();if(this.inipos){var a=this.evaluator.eval(this.inipos);
this.iniPosX=a[0][0];this.iniPosY=a[0][1]}a=0;for(var c=this.graphics.length;a<c;a++)m=this.graphics[a],m.macro_inirotEuler=this.inirotEuler,m.macro_inirotM=this.inirotM,m.macro_inirotM_X=this.inirotM_X,m.macro_inirotM_Y=this.inirotM_Y,m.macro_inirotM_Z=this.inirotM_Z,m.macro_iniposM=this.iniposM,m.macro_endrotEuler=this.endrotEuler,m.macro_endrotM=this.endrotM,m.macro_endrotM_X=this.endrotM_X,m.macro_endrotM_Y=this.endrotM_Y,m.macro_endrotM_Z=this.endrotM_Z,m.macro_endposM=this.endposM,m.update();
a=0;for(c=this.graphics.length;a<c;a++){m=this.graphics[a];if(m.split||this.split)for(var f=a+1;f<c;f++)e=this.graphics[f],(e.split||this.split)&&m.splitFace(e);this.primitives=this.primitives.concat(m.primitives||[])}};a.Macro3D.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)};a.Macro3D.prototype.drawAux=function(a){};return a}(descartesJS||{},babel);
descartesJS=function(a){function g(a,b,c,e,d){k.call(this,a/w,a/w,a/w,e,d)}function k(a,b,c,e,d){a/=2;b/=2;c/=2;this.changeGeometry(a,b,c,e,d)||(this.vertices=[new p(a,c,b,1),new p(a,-c,b,1),new p(a,c,-b,1),new p(a,-c,-b,1),new p(-a,c,b,1),new p(-a,-c,b,1),new p(-a,c,-b,1),new p(-a,-c,-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,c,e,d))}function f(a,b,c,e,d){a/=2;if(!this.changeGeometry(a,b,c,e,d)){var f=2*Math.PI/3,l=2*a*Math.sqrt(2)/3,g=-a/
3,n=l*Math.cos(f)+0*Math.sin(f);f=-l*Math.sin(f)+0*Math.cos(f);this.vertices=[new p(0,0,a,1),new p(n,f,g,1),new p(n,-f,g,1),new p(l,0,g,1)];this.faces=[[1,3,2],[0,1,2],[0,2,3],[0,3,1]];this.updateValues(a,b,c,e,d)}}function m(a,b,c,e,d){a/=2;this.changeGeometry(a,b,c,e,d)||(this.vertices=[new p(0,0,a,1),new p(a,0,0,1),new p(-a,0,0,1),new p(0,a,0,1),new p(0,-a,0,1),new p(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,c,e,d))}function e(b,
c,e,d,f){b/=Math.PI;if(!this.changeGeometry(b,c,e,d,f)){G=b/1.6180339887;L=1.6180339887*b;this.vertices=[new p(b,b,b,1),new p(b,b,-b,1),new p(b,-b,b,1),new p(b,-b,-b,1),new p(-b,b,b,1),new p(-b,b,-b,1),new p(-b,-b,b,1),new p(-b,-b,-b,1),new p(0,G,L,1),new p(0,G,-L,1),new p(0,-G,L,1),new p(0,-G,-L,1),new p(G,L,0,1),new p(G,-L,0,1),new p(-G,L,0,1),new p(-G,-L,0,1),new p(L,0,G,1),new p(L,0,-G,1),new p(-L,0,G,1),new p(-L,0,-G,1)];N=(new a.Matrix4x4).setIdentity().rotateY(-q/6);D=0;for(J=this.vertices.length;D<
J;D++)this.vertices[D]=N.multiplyVector4(this.vertices[D]);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,c,e,d,f)}}function h(b,c,e,d,f){b/=3.8;if(!this.changeGeometry(b,c,e,d,f)){L=1.6180339887*b;this.vertices=[new p(0,b,L,1),new p(0,b,-L,1),new p(0,-b,L,1),new p(0,-b,-L,1),new p(b,L,0,1),new p(b,-L,0,1),new p(-b,L,0,1),new p(-b,-L,0,1),
new p(L,0,b,1),new p(L,0,-b,1),new p(-L,0,b,1),new p(-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]];N=(new a.Matrix4x4).setIdentity().rotateY(-1.0285);D=0;for(J=this.vertices.length;D<J;D++)this.vertices[D]=N.multiplyVector4(this.vertices[D]);this.updateValues(b,c,e,d,f)}}function d(a,b,c,e,d){a/=2;this.isSphere?c=b=a:(b/=2,c/=2);if(!this.changeGeometry(a,
b,c,e,d)){this.vertices=[new p(0,0,b,1)];for(D=1;D<e;D++)for(K=D*q/e,I=0;I<d;I++)H=I*r/d,A=a*n(K)*y(H),C=c*n(K)*n(H),F=b*y(K),this.vertices.push(new p(A,C,F,1));this.vertices.push(new p(0,0,-b,1));this.faces=[];for(D=0;D<d;D++)this.faces.push([0,(D+1)%d+1,D%d+1]);for(D=1;D<e-1;D++)for(I=0;I<d;I++)this.faces.push([I+1+(D-1)*d,(I+1)%d+1+(D-1)*d,(I+1)%d+1+D*d,I+1+D*d]);for(D=0;D<d;D++)this.faces.push([this.vertices.length-1,this.vertices.length-1-d+D,this.vertices.length-1-d+(D+1)%d]);this.updateValues(a,
b,c,e,d)}}function c(a,b,c,d,e){a/=2;b/=2;c/=2;if(!this.changeGeometry(a,b,c,d,e)){this.vertices=[];for(D=0;D<e;D++)for(I=0;I<d;I++)A=a*(e-D)/e*y(I*r/d),C=c*(e-D)/e*n(I*r/d),F=b-2*D*b/e,this.vertices.push(new p(A,C,F,1));this.vertices.push(new p(0,0,-b,1));this.faces=[];for(D=0;D<e-1;D++)for(I=0;I<d;I++)this.faces.push([I+D*d,(I+1)%d+D*d,(I+1)%d+(D+1)*d,I+(D+1)*d]);for(D=0;D<d;D++)this.faces.push([this.vertices.length-1,this.vertices.length-1-d+D,this.vertices.length-1-d+(D+1)%d]);this.updateValues(a,
b,c,d,e)}}function u(a,b,c,d,e){a/=2;b/=2;c/=2;if(!this.changeGeometry(a,b,c,d,e)){this.vertices=[];for(D=0;D<e+1;D++)for(I=0;I<d;I++)A=a*y(I*r/d),C=c*n(I*r/d),F=b-2*D*b/e,this.vertices.push(new p(A,C,F,1));this.faces=[];for(D=0;D<e;D++)for(I=0;I<d;I++)this.faces.push([I+D*d,(I+1)%d+D*d,(I+1)%d+(D+1)*d,I+(D+1)*d]);this.updateValues(a,b,c,d,e)}}function l(a,b,c,d,e){a/=2;b/=2;c/=2;E=v.eval(this.R);z=v.eval(this.r);if(!this.changeGeometry(a,b,c,d,e)){this.vertices=[];for(D=0;D<e+1;D++)for(I=0;I<d;I++)A=
-(E+z*n(r*I/d))*n(r*D/e),C=(E+z*n(r*I/d))*y(r*D/e),F=z*y(r*I/d),this.vertices.push(new p(A,C,F,1));this.faces=[];for(D=0;D<e;D++)for(I=0;I<d;I++)this.faces.push([I+D*d,I+(D+1)*d,(I+1)%d+(D+1)*d,(I+1)%d+D*d]);this.updateValues(a,b,c,d,e)}}function b(){function a(a){return parseInt(a)}function b(a){return parseFloat(a)}this.vertices=[];this.faces=[];D=0;for(J=this.fileData.length;D<J;D++)M=this.fileData[D],M.match(/^V\(/)?(B=M.substring(2,M.length-1).split(",").map(b),this.vertices.push(new p(B[0]||
0,B[1]||0,B[2]||0,1))):M.match(/^F\(/)&&(B=M.substring(2,M.length-1).split(",").map(a),this.faces.push(B.reverse()))}if(a.loadLib)return a;var n=Math.sin,y=Math.cos,q=Math.PI,r=2*q,w=Math.sqrt(3),p,v,x,A,C,F,H,K,E,z,G,L,N,M,B,D,J,I,O;a.OtherGeometry=function(n,q){this.width=n.evaluator.parser.parse("2");this.height=n.evaluator.parser.parse("2");this.length=n.evaluator.parser.parse("2");this.R=n.evaluator.parser.parse("2");this.r=n.evaluator.parser.parse("1");p=a.Vector4D;a.Graphic3D.call(this,n,q);
switch(this.type){case "cube":this.buildGeometry=g;break;case "box":this.buildGeometry=k;break;case "tetrahedron":this.buildGeometry=f;break;case "octahedron":this.buildGeometry=m;break;case "sphere":this.isSphere=!0;case "ellipsoid":this.buildGeometry=d;break;case "dodecahedron":this.buildGeometry=e;break;case "icosahedron":this.buildGeometry=h;break;case "cone":this.buildGeometry=c;break;case "cylinder":this.buildGeometry=u;break;case "torus":this.buildGeometry=l;break;case "mesh":this.fileData=
a.openExternalFile(this.evaluator.eval(this.file)).split(/\r/),this.buildGeometry=b}};a.extend(a.OtherGeometry,a.Graphic3D);a.OtherGeometry.prototype.buildPrimitives=function(){v=this.evaluator;this.updateMVMatrix();this.buildGeometry(v.eval(this.width),v.eval(this.height),v.eval(this.length),v.eval(this.Nu),v.eval(this.Nv));var b=this.color.getColor(),c=this.backcolor.getColor(),d=this.edges?this.edges.getColor():"";D=0;for(J=this.faces.length;D<J;D++){x=[];I=0;for(O=this.faces[D].length;I<O;I++)x.push(this.transformVertex(this.vertices[this.faces[D][I]]));
this.primitives.push(new a.Primitive3D({vertices:x,type:"face",frontColor:b,backColor:c,edges:d,model:this.model},this.space))}};a.OtherGeometry.prototype.changeGeometry=function(a,b,c,d,e){return this.oldWidth===a&&this.oldHeight===b&&this.oldLength===c&&this.oldNu===d&&this.oldNv===e};a.OtherGeometry.prototype.updateValues=function(a,b,c,d,e){this.oldWidth=a;this.oldHeight=b;this.oldLength=c;this.oldNv=e;this.oldNu=d};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.max,k=Math.min,f=Math.PI,m=Math.cos,e=Math.sin,h=Math.abs,d=Math.round,c,u,l,b,n,y,q,r,w,p,v,x,A,C,F,H,K,E;a.R2=function(a,b){this.x=a||0;this.y=b||0};a.R2.prototype.set=function(a,b){this.x=a||0;this.y=b||0;return this};a.R2.prototype.copy=function(){return new a.R2(this.x,this.y)};a.R2.prototype.ix=function(){return d(g(k(this.x,32E3),-32E3))};a.R2.prototype.iy=function(){return d(g(k(this.y,32E3),-32E3))};a.R2.prototype.equals=function(a){return this.x===
a.x&&this.y===a.y};a.R2.prototype.norm2=function(){return this.x*this.x+this.y*this.y};a.R2.prototype.norm=function(){return Math.sqrt(this.norm2())};a.R2.prototype.distance=function(a){u=this.copy();u.sub(a);return u.norm()};a.R2.prototype.dot=function(a){return this.x*a.x+this.y*a.y};a.R2.prototype.det=function(a){return this.x*a.y-this.y*a.x};a.R2.prototype.mul=function(a){this.x*=a;this.y*=a};a.R2.prototype.div=function(a){this.x/=a;this.y/=a};a.R2.prototype.add=function(a){this.x+=a.x;this.y+=
a.y};a.R2.prototype.sub=function(a){this.x-=a.x;this.y-=a.y};a.R2.prototype.normalize=function(){c=this.norm();0!=c&&this.div(c)};a.R2.prototype.rotR90=function(){c=this.x;this.x=this.y;this.y=-c};a.R2.prototype.rotL90=function(){c=this.x;this.x=-this.y;this.y=c};a.R2.prototype.rot=function(a){l=this.copy();y=m(a);q=e(a);this.x=l.x*y-l.y*q;this.y=l.x*q+l.y*y};a.R2.prototype.rot=function(a){this.rot(a*f/180)};a.R2.prototype.intersection=function(c,d,e,f){r=d.x-c.x;w=e.x-f.x;p=e.x-c.x;v=d.y-c.y;x=e.y-
f.y;A=e.y-c.y;E=r*x-w*v;return 1E-6<h(E)?(b=(p*x-A*w)/E,n=(-p*v+A*r)/E,0<=b&&1>=b&&0<=n&&1>=n?new a.R2(c.x+r*b,c.y+v*b):null):(d.x-e.x)*A!=(d.y-e.y)*p?null:c.x!=d.x?(C=k(c.x,d.x),F=g(c.x,d.x),C<=e.x&&e.x<=F?e:C<=f.x&&f.x<=F?f:null):e.x!=f.x?(H=k(e.x,f.x),K=g(e.x,f.x),H<=c.x&&c.x<=K?c:H<=d.x&&d.x<=K?d:null):c.y!=d.y?(C=k(c.y,d.y),F=g(c.y,d.y),C<=e.y&&e.y<=F?e:C<=f.y&&f.y<=F?f:null):e.y!=f.y?(H=k(e.y,f.y),K=g(e.y,f.y),H<=c.y&&c.y<=K?c:H<=d.y&&d.y<=K?d:null):c.x==e.x&&c.y==e.y?c:null};return a}(descartesJS||
{});
descartesJS=function(a){if(a.loadLib)return a;var g,k,f,m,e,h,d,c,u;a.R2Newton=function(c,b){this.evaluator=c;this.constraint=b;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];h=
new a.R2(0,0);e=new a.R2(0,0);u=new a.R2(0,0)};a.R2Newton.prototype.getUnitNormal=function(){this.normal.normalize();return u.set(this.normal.x,this.normal.y)};a.R2Newton.prototype.gradient=function(a){g=this.evaluator;h.x=0;h.y=0;d=g.getVariable("x");c=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);k=g.eval(this.constraint);h.x=(k-this.f0)/1E-6;h.x=isNaN(h.x)?Infinity:h.x;g.setVariable("x",g.getVariable("x")-
1E-6);g.setVariable("y",g.getVariable("y")+1E-6);k=g.eval(this.constraint);h.y=(k-this.f0)/1E-6;h.y=isNaN(h.y)?Infinity:h.y;g.setVariable("x",d);g.setVariable("y",c);return h};a.R2Newton.prototype.findZero=function(a,b,n){g=this.evaluator;e.x=a.x;e.y=a.y;d=g.getVariable("x");c=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 e;g.setVariable("x",d);g.setVariable("y",c);for(var l=
0;16>l;l++)if(f=e.x,m=e.y,this.normal=this.gradient(e),0!=this.normal.norm2()&&this.normal.mul(-this.f0/this.normal.norm2()),e.x=f+this.normal.x,e.y=m+this.normal.y,this.normal.norm()<b)return 0===this.normal.x&&0===this.normal.y&&(this.normal.x=e.x-a.x,this.normal.y=e.y-a.y),e;return n?e:null};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.Vector2D=function(a,k){this.x=a;this.y=k};a.Vector2D.AXIS_X=new a.Vector2D(1,0);a.Vector2D.AXIS_Y=new a.Vector2D(0,1);a.Vector2D.prototype.vectorLength=function(){return Math.sqrt(this.x*this.x+this.y*this.y)};a.Vector2D.prototype.dotProduct=function(a){return this.x*a.x+this.y*a.y};a.Vector2D.prototype.angleBetweenVectors=function(a){return Math.acos(this.dotProduct(a)/(this.vectorLength()*a.vectorLength()))};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.floor,k=Math.round,f,m,e,h,d,c,u,l,b,n,y,q,r;a.Control=function(b,c){this.parent=b;this.evaluator=b.evaluator;var d=this.parser=b.evaluator.parser;this.id="graphic"!==c.type?"C":"G";this.gui=this.type="";this.region="south";this.y=this.x=0;this.w="video"!==c.type?100:350;this.h="video"!==c.type?23:120;"graphic"!==c.type&&"audio"!==c.type&&"video"!==c.type?"text"!==c.type?this.expresion=d.parse("(0,0,100,23)"):(this.expresion=d.parse("(0,0,300,200)"),
this.w=300,this.h=200):this.expresion=d.parse("(0,0)");this.fixed=2!=this.parent.version?!1:!0;this.visible=!0;this.color=new a.Color(4>this.parent.version?"000000":"222222");this.colorInt=new a.Color("graphic"!==c.type?"f0f8ff":"cc0022");this.underlined=this.italics=this.bold="";this.font_size=4>this.parent.version?-1:d.parse("12");this.parameter=this.action="";this.parameterFont="Monospace 12px";this.drawif=d.parse("1");this.activeif=d.parse("1");this.tooltip="";this.tooltipFont="Monospace 12px";
this.Explanation="";this.ExplanationFont="Monospace 12px";this.cID=this.msg_pos="";this.valueExpr=d.parse("0");this.decimals=d.parse("2");this.min=d.parse("-Infinity");this.max=d.parse("Infinity");this.incr=d.parse("0.1");this.exponentialif=this.discrete=!1;this.zIndex=-1;for(var e in c)c.hasOwnProperty(e)&&(this[e]=c[e]);"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;c=this.evaluator.eval(this.expresion);this.x=k(c[0][0]);this.y=k(c[0][1]);4==c[0].length&&(this.w=k(c[0][2]),this.h=k(c[0][3]));this.actionExec=b.lessonParser.parseAction(this)};a.Control.prototype.init=function(){};a.Control.prototype.update=function(){};a.Control.prototype.draw=function(){};a.Control.prototype.getContainer=function(){var a=this.parent.spaces;if("interior"===this.region)for(var b=0,c=a.length;b<c;b++){var d=a[b];if(d.id===
this.spaceID)return d.addCtr(this),this.zIndex=d.zIndex,this.space=d,d.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};a.Control.prototype.addControlContainer=function(a){var b=this.getContainer();b.childNodes[0]?b.insertBefore(a,b.childNodes[0]):b.appendChild(a)};a.Control.prototype.updatePositionAndSize=function(){e=h=d=c=!1;u=this.evaluator.eval(this.expresion);l=k(u[0][0]);e=k(this.x)!==
l;this.x=l;l=k(u[0][1]);h=k(this.y)!==l;this.y=l;4===u[0].length&&(l=k(u[0][2]),d=k(this.w)!==l,this.w=l,l=k(u[0][3]),c=k(this.h)!==l,this.h=l);if(d||c||e||h)this.init(!0),this.draw()};a.Control.prototype.formatOutputValue=function(a){r=this.parent;b=a+"";n=this.evaluator.eval(this.decimals);y=b.indexOf(".");-1!=y&&(q=b.substring(y+1),q.length>n&&(b=parseFloat(b).toFixed(n)));this.fixed&&(2!==r.version||2===r.version&&!this.exponentialif)&&(b=parseFloat(a).toFixed(n));this.exponentialif&&0!=parseFloat(b)&&
(b=this.fixed&&2!==r.version?parseFloat(b).toExponential(n):parseFloat(b).toExponential(),b=b.toUpperCase().replace("+",""));return b.replace(".",r.decimal_symbol)};a.Control.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()};a.Control.prototype.createGradient=function(a,b){this.linearGradient=this.ctx.createLinearGradient(0,
0,0,b);f=b*b;for(a=0;a<b;a++)m=g(a-35*b/100),this.linearGradient.addColorStop(a/b,"rgba(0,0,0,"+m*m*192/f/255+")")};a.Control.prototype.createCSSGradient=function(a){var b="linear-gradient(";f=a*a;for(var c=0;c<a;c++)m=g(c-35*a/100),b+="rgba(0,0,0,"+m*m*200/f/255+") "+100*c/(a-1)+"%,";b=b.substring(0,b.length-1);return b+")"};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.floor,k=Math.abs,f,m,e,h,d,c,u,l,b,n,y,q,r,w,p,v=/[\w\.\-//]*(\.gif)/gi,x,A,C,F,H,K,E,z,G,L,N,M,B,D,J,I;a.Button=function(b,c){this.imageSrc="";this.image=new Image;this.imageOver=new Image;this.imageDown=new Image;this.borderColor=this.flat=!1;this.image_align=this.text_align="center_center";this.font_family="arial";a.Control.call(this,b,c);this.font_family=a.getFontName(this.font_family);this.ratio=b.ratio;-1===this.font_size&&(this.fontSizeNotSet=
!0);this.borderColor&&(this.borderColor=new a.Color(this.borderColor));this.text_align=this.text_align.split("_");this.image_align=this.image_align.split("_");"["===this.name.charAt(0)&&"]"===this.name.charAt(this.name.length-1)?this.name=this.parser.parse(this.name.substring(1,this.name.length-1)):this.name=this.parser.parse("'"+this.name+"'");this.classContainer=this.cssClass?" "+this.cssClass+" ":"";if(this.imageSrc.trim().match("^_STYLE_")){this.customStyle=!0;this.btnStyle=[];this.conStyle=[];
this.conStyle.textBorder=3;b=this.imageSrc.trim().substring(8).split("|");for(var d,e=0,f=b.length;e<f;e++)c=b[e],d=c.match(/rgb/g),c.match("class=")?this.classContainer=" "+c.substring(6):c.match("border=")?(this.btnStyle.push({type:"border-style",value:"solid"}),this.btnStyle.push({type:"border-width",value:c.substring(7).trim()+"px"})):c.match("borderRadius=")?(this.btnStyle.push({type:"border-radius",value:c.substring(13).trim()+"px"}),this.conStyle.push({type:"border-radius",value:c.substring(13).trim()+
"px"})):c.match("borderColor=")?this.btnStyle.push({type:"border-color",value:(d?"":"#")+c.substring(12).trim()}):c.match("overColor=")?this.conStyle.overColor=(d?"":"#")+c.substring(10).trim():c.match("downColor=")?this.conStyle.downColor=(d?"":"#")+c.substring(10).trim():c.match("font=")?this.conStyle.font=c.substring(5).trim().toLowerCase():c.match("inactiveColor=")?this.conStyle.inactiveColor=(d?"":"#")+c.substring(14).trim():c.match("inactiveColorBorder=")?this.conStyle.inactiveColorBorder=(d?
"":"#")+c.substring(20).trim():c.match("shadowTextBlur=")?this.conStyle.shadowTextBlur=parseFloat(c.substring(15).trim()):c.match("shadowTextOffsetX=")?this.conStyle.shadowTextOffsetX=parseFloat(c.substring(18).trim()):c.match("shadowTextOffsetY=")?this.conStyle.shadowTextOffsetY=parseFloat(c.substring(18).trim()):c.match("shadowTextColor=")?this.conStyle.shadowTextColor=(d?"":"#")+c.substring(16).trim():c.match("shadowBoxBlur=")?this.conStyle.shadowBoxBlur=parseFloat(c.substring(14).trim()):c.match("shadowBoxOffsetX=")?
this.conStyle.shadowBoxOffsetX=parseFloat(c.substring(17).trim()):c.match("shadowBoxOffsetY=")?this.conStyle.shadowBoxOffsetY=parseFloat(c.substring(17).trim()):c.match("shadowBoxColor=")?this.conStyle.shadowBoxColor=(d?"":"#")+c.substring(15).trim():c.match("shadowInsetBoxBlur=")?this.conStyle.shadowInsetBoxBlur=parseFloat(c.substring(19).trim()):c.match("shadowInsetBoxOffsetX=")?this.conStyle.shadowInsetBoxOffsetX=parseFloat(c.substring(22).trim()):c.match("shadowInsetBoxOffsetY=")?this.conStyle.shadowInsetBoxOffsetY=
parseFloat(c.substring(22).trim()):c.match("shadowInsetBoxColor=")?this.conStyle.shadowInsetBoxColor=(d?"":"#")+c.substring(20).trim():c.match("textBorder=")&&(this.conStyle.textBorder=parseFloat(c.substring(11).trim()));this.imageSrc="vacio.gif"}this.imageSrc.match("_COLORES_")&&(b=this.imageSrc.split("_"),this.colorInt=new a.Color(b[2]),this.color=new a.Color(b[3]),this.font_size=this.parser.parse(b[5]),this.imageSrc="");"["==this.imageSrc.charAt(0)?this.imageSrc=this.parser.parse(this.imageSrc.substring(1,
this.imageSrc.length-1)):this.imageSrc=this.parser.parse("'"+this.imageSrc+"'");b=this.evaluator.eval(this.imageSrc).toString().trim();""!=b&&(c=b.substr(0,b.lastIndexOf(".")),d=b.substr(b.lastIndexOf(".")),b.toLowerCase().match(/vacio.gif$/)?(this.imageSrc=this.parser.parse("'vacio.gif'"),this.image.ready=1,3===this.parent.version&&(this.name=this.parser.parse("")),this.emptyImage={ready:!0},this.parser.parse("'vacio.gif'")):(this.image=this.parent.getImage(b),c&&(this.imageOver=this.parent.getImage(c+
"_over"+d),this.imageDown=this.parent.getImage(c+"_down"+d))));this.container=document.createElement("div");this.container.setAttribute("class","DescartesButtonContainer"+this.classContainer);this.container.setAttribute("id",this.id);this.container.setAttribute("style","width:"+this.w+"px; height:"+this.h+"px; left:"+this.x+"px; top:"+this.y+"px; z-index:"+this.zIndex+";");this.btn=document.createElement("canvas");this.btn.width=this.w*this.ratio;this.btn.height=this.h*this.ratio;this.btn.setAttribute("style",
"position:absolute; left:0; top:0; width:"+this.w+"px; height:"+this.h+"px; -webkit-box-sizing:border-box; -moz-box-sizing:border-box; box-sizing:border-box;");this.ctx=this.btn.getContext("2d");this.ctx.imageSmoothingEnabled=!1;this.container.appendChild(this.btn);this.addControlContainer(this.container);this.addEvents();this.init()};a.extend(a.Button,a.Control);a.Button.prototype.init=function(b){f=this.evaluator;x=this.container;m=this.btn;e=this.ctx;h=f.eval(this.expresion);this.x=h[0][0];this.y=
h[0][1];4==h[0].length&&(this.w=parseInt(h[0][2]),this.h=parseInt(h[0][3]));m.width=this.w*this.ratio;m.height=this.h*this.ratio;m.setAttribute("style","position:absolute; left:0; top:0; width:"+this.w+"px; height:"+this.h+"px; -webkit-box-sizing:border-box; -moz-box-sizing:border-box; box-sizing:border-box;");x.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 c=0,d=this.btnStyle.length;c<
d;c++)m.style[this.btnStyle[c].type]=this.btnStyle[c].value;if(this.conStyle){c=0;for(d=this.conStyle.length;c<d;c++)x.style[this.conStyle[c].type]=this.conStyle[c].value;if(this.conStyle.shadowBoxColor){c=this.conStyle.shadowBoxOffsetX||0;d=this.conStyle.shadowBoxOffsetY||2;var l=this.conStyle.shadowBoxBlur||2;x.style.boxShadow=c+"px "+d+"px "+l+"px 1px "+this.conStyle.shadowBoxColor}this.conStyle.shadowInsetBoxColor&&(c=this.conStyle.shadowInsetBoxOffsetX||0,d=this.conStyle.shadowInsetBoxOffsetY||
-2,l=this.conStyle.shadowInsetBoxBlur||1,m.style.boxShadow=c+"px "+d+"px "+l+"px 1px "+this.conStyle.shadowInsetBoxColor+" inset");this.conStyle.shadowTextColor&&(e.shadowBlur=this.conStyle.shadowTextBlur||1,e.shadowOffsetX=this.conStyle.shadowTextOffsetX||0,e.shadowOffsetY=this.conStyle.shadowTextOffsetY||2,e.shadowColor=this.conStyle.shadowTextColor)}this.fontSizeNotSet&&(this.font_size=f.parser.parse(a.getFieldFontSize(this.h)+""));this.fs_evaluated=f.eval(this.font_size);this.createGradient(this.w,
this.h);x.style.display=0<f.eval(this.drawif)?"block":"none";e.textAlign="center";e.textBaseline="middle";e.lineJoin="round";e.font=this.italics+" "+this.bold+" "+this.fs_evaluated+"px "+this.font_family;this.customStyle&&("serif"==this.conStyle.font?e.font=this.italics+" "+this.bold+" "+this.fs_evaluated+"px "+this.font_family:"monospace"==this.conStyle.font&&(e.font=this.italics+" "+this.bold+" "+this.fs_evaluated+"px "+a.monospace_font));this.draw(b)};a.Button.prototype.update=function(){f=this.evaluator;
x=this.container;m=this.btn;this.activeIfValue=0<f.eval(this.activeif);this.drawIfValue=0<f.eval(this.drawif);(this.space?this.space.drawIfValue:1)&&this.drawIfValue?(x.style.display="block",this.draw(),x.style.cursor=m.style.cursor=this.activeIfValue?"pointer":"not-allowed",this.updatePositionAndSize()):(x.style.display="none",this.buttonClick=!1)};a.Button.prototype.draw=function(k){x=this.container;f=this.evaluator;m=this.btn;e=this.ctx;c=f.eval(this.name);u=this.evaluator.eval(this.imageSrc).toString().trim();
if(!k&&(A=this.over===this.oldOver,C=this.buttonClick===this.oldButtonClick,F=this.activeIfValue===this.oldActiveIfValue,H=this.drawIfValue===this.oldDrawIfValue,K=c===this.oldName,E=u===this.oldImageSrc,z=this.colorInt.getColor()===this.oldBackColor,G=this.color.getColor()===this.oldTextColor,L=this.image.ready===this.oldImageReady,this.oldOver=this.over,this.oldButtonClick=this.buttonClick,this.oldActiveIfValue=this.activeIfValue,this.oldDrawIfValue=this.drawIfValue,this.oldName=c,this.oldImageSrc=
u,this.oldBackColor=this.colorInt.getColor(),this.oldTextColor=this.color.getColor(),this.oldImageReady=this.image.ready,A&&C&&F&&H&&K&&E&&z&&G&&L))return;e.save();e.setTransform(this.ratio,0,0,this.ratio,0,0);d=this.fs_evaluated;x.setAttribute("data-name",c);u?(l="vacio.gif"===u?this.emptyImage:this.parent.getImage(u),N=u.substr(0,u.lastIndexOf(".")),M=u.substr(u.lastIndexOf(".")),B=N+"_over"+M,D=N+"_down"+M,J="vacio.gif"===u?this.emptyImage:this.parent.getImage(B),I="vacio.gif"===u?this.emptyImage:
this.parent.getImage(D)):I=J=l=this.emptyImage;e.clearRect(0,0,this.w,this.h);b=n=0;this.buttonClick&&(b=n=1);"center"==this.text_align[1]?w=g(this.w/2+b)-.5:"left"==this.text_align[1]?(y=e.measureText(c).width,w=y/2+5+b):"right"==this.text_align[1]&&(y=e.measureText(c).width,w=this.w-y/2+b-5);"center"==this.text_align[0]?p=g(this.h/2+n)-.5:"top"==this.text_align[0]?p=d/2+n+4:"bottom"==this.text_align[0]&&(p=this.h-d/2+n-3);l&&("center"==this.image_align[1]?q=parseInt((this.w-l.width)/2)+b:"left"==
this.image_align[1]?q=b:"right"==this.image_align[1]&&(q=this.w-l.width+b),"center"==this.image_align[0]?r=parseInt((this.h-l.height)/2)+n:"top"==this.image_align[0]?r=n:"bottom"==this.image_align[0]&&(r=this.h-l.height+n));if(l&&l.ready)if(l!==this.emptyImage&&l.complete)if(u.match(v))this.btn.style.backgroundRepeat="no-repeat",this.btn.style.backgroundImage="url('"+u+"')",this.btn.style.backgroundPosition=q+"px "+r+"px";else{if("center"!=this.image_align[0]||"center"!=this.image_align[1])x.style.backgroundColor=
this.colorInt.getColor();e.drawImage(l,q,r)}else this.emptyImage&&this.customStyle&&(x.style.backgroundColor=this.colorInt.getColor());else x.style.backgroundColor=this.colorInt.getColor(),this.flat||(this.buttonClick||(a.drawLine(e,this.w-1,0,this.w-1,this.h,"rgba(0,0,0,0.5)"),a.drawLine(e,0,0,0,this.h,"rgba(0,0,0,0.09)"),a.drawLine(e,1,0,1,this.h,"rgba(0,0,0,0.03)")),e.fillStyle=this.linearGradient,e.fillRect(0,0,this.w,this.h));this.activeIfValue&&(J!==this.emptyImage&&this.over&&J.ready&&J.complete?
B.match(v)?(this.btn.style.backgroundImage="url('"+B+"')",this.btn.style.backgroundPosition=q+"px "+r+"px"):e.drawImage(J,q,r):this.customStyle&&this.conStyle.overColor&&this.over&&(x.style.backgroundColor=this.conStyle.overColor));this.activeIfValue?I!==this.emptyImage&&this.buttonClick&&I.ready&&I.complete?D.match(v)?(this.btn.style.backgroundImage="url('"+D+"')",this.btn.style.backgroundPosition=q+"px "+r+"px"):e.drawImage(I,q,r):this.customStyle&&this.conStyle.downColor&&this.buttonClick&&(x.style.backgroundColor=
this.conStyle.downColor):this.buttonClick&&!l&&(e.fillStyle="rgba(0,0,0,0.09)",e.fillRect(0,0,this.w,this.h));e.fillStyle=this.color.getColor();this.customStyle&&this.conStyle.shadowTextColor&&0<this.conStyle.textBorder&&(e.lineWidth=this.conStyle.textBorder,e.strokeStyle=this.conStyle.shadowTextColor,e.strokeText(c,w,p));this.borderColor&&(e.lineWidth=parseInt(d/7),e.strokeStyle=this.borderColor.getColor(),e.strokeText(c,w,p));e.fillText(c,w,p);this.underlined&&(y=e.measureText(c).width,e.strokeStyle=
this.color.getColor(),e.lineWidth=g(d/10)||2,e.lineCap="round",e.beginPath(),e.moveTo(w-y/2+b,p+g(d/2)+g(d/5)-1.5),e.lineTo(w+y/2+b,p+g(d/2)+g(d/5)-1.5),e.stroke());this.activeIfValue||(this.customStyle&&this.conStyle.inactiveColor?x.style.backgroundColor=this.conStyle.inactiveColor:(e.fillStyle="rgba(240,240,240,0.6)",e.fillRect(0,0,this.w,this.h)));e.restore();this._image_pos_x=q;this._image_pos_y=r};a.Button.prototype.drawTextBorder=function(){this.colorInt.getColor();this.color.getColor();return!(.5>
(k(this.colorInt.r-this.color.r)+k(this.colorInt.g-this.color.g)+k(this.colorInt.b-this.color.b))/255)};a.Button.prototype.buttonPressed=function(){this.updateAndExecAction()};a.Button.prototype.addEvents=function(){function b(c,d,l){a.clearTimeout(f);e.buttonClick&&e.drawIfValue&&e.activeIfValue&&(d.call(e),c=l?c:100,f=a.setTimeout(function(){b(c,d,!1)},c))}function c(c){this.focus();c.preventDefault();c.stopPropagation();document.activeElement!=document.body&&document.activeElement.blur();e.whichBtn=
a.whichBtn(c);"L"==e.whichBtn&&e.activeIfValue&&(e.buttonClick=!0,e.draw(),"calculate"==e.action&&(e.evaluator.setVariable(e.id,e.evaluator.eval(e.valueExpr)),b(1E3,e.buttonPressed,!0)),e.btn.removeEventListener("touchend",d),e.btn.addEventListener("touchend",d),e.btn.removeEventListener("mouseup",d),e.btn.addEventListener("mouseup",d))}function d(b){a.newBlobContent=null;this.focus();b.preventDefault();b.stopPropagation();if(e.activeIfValue||e.buttonClick)e.buttonClick=!1,e.draw(),"calculate"!=e.action&&
(e.evaluator.setVariable(e.id,e.evaluator.eval(e.valueExpr)),e.buttonPressed()),e.btn.removeEventListener("touchend",d),e.btn.removeEventListener("mouseup",d);e.parent.update()}var e=this,f;e.btn.oncontextmenu=function(){return!1};this.over=this.buttonClick=!1;this.btn.addEventListener("touchstart",c);this.btn.addEventListener("mousedown",c);this.btn.addEventListener("mouseover",function(a){a.preventDefault();a.stopPropagation();e.over=!0;e.draw()});this.btn.addEventListener("mouseout",function(b){a.newBlobContent=
null;b.preventDefault();b.stopPropagation();e.over=!1;e.buttonClick=!1;e.draw()});document.addEventListener("visibilitychange",function(b){a.newBlobContent=null;e.buttonClick=!1})};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,k,f,m,e,h,d,c,u,l,b,n,y,q,r,w,p,v;a.Spinner=function(b,c){a.Control.call(this,b,c);this.tabindex=++this.parent.tabindex;"_._"==this.name&&(this.name="");"["===this.name.charAt(0)&&"]"===this.name.charAt(this.name.length-1)?this.name=this.parser.parse(this.name.substring(1,this.name.length-1)):this.name=this.parser.parse("'"+this.name+"'");this.container=document.createElement("div");this.canvas=document.createElement("canvas");this.divUp=document.createElement("div");
this.divDown=document.createElement("div");this.field=document.createElement("input");this.label=document.createElement("label");this.container.appendChild(this.label);this.container.appendChild(this.field);this.container.appendChild(this.canvas);this.container.appendChild(this.divUp);this.container.appendChild(this.divDown);this.addControlContainer(this.container);v=this.evaluator.parser.parse("1");this.originalIncr=this.incr;if(0>this.evaluator.eval(this.decimals)||0==this.evaluator.eval(this.incr))b=
this.evaluator.eval(this.incr),0<b?this.originalIncr=this.incr=this.evaluator.parser.parse(parseInt(b).toString()):this.incr=v;this.addEvents();this.init()};a.extend(a.Spinner,a.Control);a.Spinner.prototype.init=function(){g=this.evaluator;var b=g.eval(this.name).toString();this.label.innerHTML=b;this.value=this.validateValue(g.eval(this.valueExpr));var c=this.formatOutputValue(this.value);this.fieldFontSize=2!==this.parent.version?a.getFieldFontSize(this.h):10;var d=2!==this.parent.version?"__":
"_____",e=a.getTextWidth(c+"_",this.fieldFontSize+"px "+a.sansserif_font),f=2+parseInt(this.h/2),l=parseInt(this.w/2-f/2);d=a.getTextWidth(b+d,this.fieldFontSize+"px "+a.sansserif_font);this.visible||(l=this.w-f,e=0);l<d&&(l=d);""==b&&(l=0);this.w-l-f<e&&(l=this.w-f-e);0>l&&(l=0);b=this.w-(l+f);this.container.setAttribute("class","DescartesSpinnerContainer");this.container.setAttribute("style","width:"+this.w+"px;height:"+this.h+"px;left:"+this.x+"px;top:"+this.y+"px;z-index:"+this.zIndex+";");this.container.setAttribute("id",
this.id);this.canvas.setAttribute("width",f+"px");this.canvas.setAttribute("height",this.h+"px");this.canvas.setAttribute("style","position:absolute;left:"+l+"px;top:0;");this.ctx=this.canvas.getContext("2d");this.ctx.imageSmoothingEnabled=!1;d="opacity:0;cursor:pointer;position:absolute;width:"+f+"px;height:"+this.h/2+"px;left:"+l+"px;";this.divUp.setAttribute("class","up");this.divUp.setAttribute("style",d+"top:0;");this.divDown.setAttribute("class","down");this.divDown.setAttribute("style",d+"top:"+
this.h/2+"px;");this.field.setAttribute("type","text");this.field.setAttribute("id",this.id+"_spinner");this.field.setAttribute("class","DescartesSpinnerField");this.field.setAttribute("style","font-family:"+a.sansserif_font+";font-size:"+this.fieldFontSize+"px;width:"+b+"px;height:"+this.h+"px;left:"+(f+l)+"px;");this.field.setAttribute("tabindex",this.tabindex);this.field.value=c;this.visible||(this.field.style.display="none");this.label.setAttribute("class","DescartesSpinnerLabel");this.label.setAttribute("style",
"font-size:"+this.fieldFontSize+"px;width:"+l+"px;height:"+this.h+"px;line-height:"+this.h+"px;");g.setVariable(this.id,this.value);this.createGradient(this.h/2,this.h)};a.Spinner.prototype.update=function(){g=this.evaluator;this.label.innerHTML=g.eval(this.name).toString();0>g.eval(this.decimals)?(k=g.eval(this.incr),0<k?this.originalIncr=this.incr=g.parser.parse(parseInt(k).toString()):this.incr=v):this.incr=0!==g.eval(this.originalIncr)?this.originalIncr:v;this.activeIfValue=0<g.eval(this.activeif);
this.drawIfValue=0<g.eval(this.drawif);this.field.disabled=!this.activeIfValue;this.drawIfValue?(this.container.style.display="block",this.draw()):(this.click=!1,this.container.style.display="none");this.updatePositionAndSize();this.parent.animation.playing&&document.activeElement==this.field||(f=this.field.value,m=this.value,this.value=this.validateValue(g.getVariable(this.id)),this.field.value=this.formatOutputValue(this.value),this.value==m&&this.field.value!=f&&(this.value=this.validateValue(f),
this.field.value=this.formatOutputValue(this.value)),g.setVariable(this.id,this.value))};a.Spinner.prototype.draw=function(){e=this.ctx;h=this.canvas.width;d=this.canvas.height;e.fillStyle="#f0f8ff";e.fillRect(0,0,h,d);e.fillStyle=this.linearGradient;e.fillRect(0,0,h,d);this.up?(c="gray",u="#f0f8ff"):(c="#f0f8ff",u="gray");a.drawLine(e,0,0,h,0,c);a.drawLine(e,0,0,0,d/2,c);a.drawLine(e,0,d/2,h,d/2,u);this.down?(c="gray",u="#f0f8ff"):(c="#f0f8ff",u="gray");a.drawLine(e,0,d/2+1,h,d/2+1,c);a.drawLine(e,
0,d/2+1,0,d,c);a.drawLine(e,0,d-1,h,d-1,u);l=[parseInt(h/2+1),parseInt(h/5+1),parseInt(h-h/5+1)];b=[parseInt(d/8+1),parseInt(d/8+1+d/4),parseInt(d/8+1+d/4)];e.fillStyle=this.activeIfValue?"#2244cc":"#8888aa";e.beginPath();e.moveTo(l[0],b[0]);e.lineTo(l[1],b[1]);e.lineTo(l[2],b[2]);e.fill();b=[parseInt(d-d/8),parseInt(d-d/8-d/4),parseInt(d-d/8-d/4)];e.fillStyle=this.activeIfValue?"#d00018":"#aa8888";e.beginPath();e.moveTo(l[0],b[0]);e.lineTo(l[1],b[1]);e.lineTo(l[2],b[2]);e.fill();e.fillStyle="rgba(0,0,0,"+
24/255+")";this.up&&e.fillRect(0,0,h,d/2);this.down&&e.fillRect(0,d/2,h,d)};a.Spinner.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,".");n=a==parseFloat(a)?parseFloat(a):parseFloat(g.eval(g.parser.parse(a)));isNaN(n)&&(n=0);r=g.eval(this.min);w=g.eval(this.max);""===r&&(r=-Infinity);""===w&&(w=Infinity);n=Math.min(Math.max(n,r),w);this.discrete&&(y=
g.eval(this.incr),n=0==y?0:y*Math.round(n/y));q=g.eval(this.decimals);0>=q&&(q=0);return n=parseFloat(parseFloat(n).toFixed(q))};a.Spinner.prototype.increase=function(){this.changeValue(parseFloat(this.value)+this.evaluator.eval(this.incr))};a.Spinner.prototype.decrease=function(){this.changeValue(parseFloat(this.value)-this.evaluator.eval(this.incr))};a.Spinner.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())};a.Spinner.prototype.addEvents=function(){function b(c,d,e){a.clearTimeout(g);if(l.up||l.down)d.call(l),c=e?c:10,g=a.setTimeout(function(){b(c,d)},c)}function c(c){c.preventDefault();l.whichBtn=a.whichBtn(c);"L"==l.whichBtn&&l.activeIfValue&&(l.up=!0,b(n,l.increase,!0),l.draw())}function d(c){c.preventDefault();l.whichBtn=a.whichBtn(c);"L"==l.whichBtn&&l.activeIfValue&&(l.down=!0,b(n,l.decrease,!0),l.draw())}function e(b){l.up=
!1;a.clearTimeout(g);l.draw()}function f(b){l.down=!1;a.clearTimeout(g);l.draw()}p=a.hasTouchSupport;var l=this,n=p?500:200,g;l.divUp.oncontextmenu=l.divDown.oncontextmenu=l.field.oncontextmenu=l.label.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&&l.changeValue(l.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){l.up=!1;a.clearTimeout(g);l.draw();b.preventDefault()});this.divDown.addEventListener("mouseout",function(b){l.down=!1;a.clearTimeout(g);l.draw();b.preventDefault()});this.divUp.addEventListener("touchend",e);window.addEventListener("touchend",e);this.divUp.addEventListener("mouseup",e);window.addEventListener("mouseup",e);this.divDown.addEventListener("touchend",
f);window.addEventListener("touchend",f);this.divDown.addEventListener("mouseup",f);window.addEventListener("mouseup",f);document.addEventListener("visibilitychange",function(b){l.up=!1;l.down=!1;a.clearTimeout(g);l.draw()});l.field.addEventListener("click",function(a){this.select();this.focus()})};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,k=function(){function f(f,e){this.radio_group="";this.typeCtr="checkbox";this.pressed=!1;a.Control.call(this,f,e);this.radio_group=this.radio_group.trim();""!==this.radio_group&&(this.typeCtr="radio");"["===this.name.charAt(0)&&"]"===this.name.charAt(this.name.length-1)?this.name=this.parser.parse(this.name.substring(1,this.name.length-1)):this.name=this.parser.parse("'"+this.name.trim()+"'");this.tabindex=++this.parent.tabindex;this.containerControl=
document.createElement("div");this.checkbox=document.createElement("input");this.checkbox.setAttribute("type",this.typeCtr);""!==this.radio_group&&this.checkbox.setAttribute("name",this.radio_group);this.checkbox.internalID=this.id;this.label=document.createElement("label");this.dummyLabel=document.createElement("label");this.value=this.evaluator.eval(this.valueExpr);this.containerControl.appendChild(this.label);this.containerControl.appendChild(this.checkbox);this.containerControl.appendChild(this.dummyLabel);
this.addControlContainer(this.containerControl);this.addEvents();this.init()}a.extend(f,a.Control);f.prototype.init=function(f){g=this.evaluator;this.label.innerHTML=g.eval(this.name).toString();this.labelFontSize=a.getFieldFontSize(this.h);f=Math.max(this.w-this.h,0);this.containerControl.setAttribute("class","DescartesCheckboxContainer");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.dummyLabel.setAttribute("style",
"position:absolute; width : "+this.h+"px; height : "+this.h+"px; left: "+f+"px;");this.dummyLabel.setAttribute("for",this.id+this.typeCtr);this.checkbox.setAttribute("type",this.typeCtr);this.checkbox.setAttribute("id",this.id+this.typeCtr);this.checkbox.setAttribute("class","DescartesCheckbox");this.checkbox.setAttribute("style","width : "+this.h+"px; height : "+this.h+"px; left: "+f+"px;");this.checkbox.setAttribute("tabindex",this.tabindex);this.checkbox.checked=0!=this.value;this.label.setAttribute("class",
"DescartesCheckboxLabel");this.label.setAttribute("style","font-size:"+this.labelFontSize+"px; width: "+f+"px; height: "+this.h+"px; line-height: "+this.h+"px;");this.evaluator.setVariable(this.id,this.value);this.update()};f.prototype.update=function(){g=this.evaluator;this.label.innerHTML=g.eval(this.name).toString();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;""===this.radio_group?this.pressed?(this.value=this.checkbox.checked?1:0,this.pressed=!1):(this.value=a,this.checkbox.checked=0!==this.value):(this.value=this.checkbox.checked?1:0,this.pressed&&(g.setVariable(this.radio_group,this.id),this.pressed=!1));g.setVariable(this.id,this.value)}this.updatePositionAndSize()};f.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("touchstart",a.preventDefault);f.dummyLabel.addEventListener("mousedown",a.preventDefault);f.checkbox.addEventListener("click",function(a){f.pressed=!0;f.updateAndExecAction()})};return f}();a.Checkbox=k;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,k,f,m,e,h;a.TextField=function(d,c){a.Control.call(this,d,c);"["===this.name.charAt(0)&&"]"===this.name.charAt(this.name.length-1)?this.name=this.parser.parse(this.name.substring(1,this.name.length-1)):this.name=this.parser.parse("'"+this.name.trim()+"'");void 0===this.valueExprString&&(this.valueExprString=this.onlyText?"0":"");this.emptyString=!1;this.ok=0;this.tabindex=++this.parent.tabindex;this.regExpDecimalSymbol=new RegExp("\\"+this.parent.decimal_symbol,
"g");this.answer&&(this.answer.match("krypto_")&&(this.answer=(new a.Krypto).decode(this.answer.substring(7))),this.answerPattern=this.answer,this.answer=a.buildRegularExpresionsPatterns(this.answer,this.evaluator),this.onlyText?(d=this.answerPattern.indexOf("|"),this.firstAnswer=-1==d?this.answerPattern:this.answerPattern.substring(0,d)):this.firstAnswer=this.parser.parse(this.answerPattern.substring(1,this.answerPattern.indexOf(","))));this.onlyText&&(this.valueExprString.match(/^'/)&&this.valueExprString.match(/'$/)||
(this.valueExpr=this.evaluator.parser.parse("'"+this.valueExprString+"'")),this.validateValue=function(a){a=a.toString();return"''"==a||"'"==a?"":a&&a.match(/^'/)&&a.match(/'$/)?a.substring(1,a.length-1):a},this.formatOutputValue=function(a){return a.toString()});""==name.trim()&&(name="");this.containerControl=document.createElement("div");this.field=document.createElement("input");this.label=document.createElement("label");this.containerControl.appendChild(this.label);this.containerControl.appendChild(this.field);
this.addControlContainer(this.containerControl);this.addEvents();this.init()};a.extend(a.TextField,a.Control);a.TextField.prototype.init=function(d){g=this.evaluator;var c=g.eval(this.name).toString();this.label.innerHTML=c;d||(this.value=this.validateValue(g.eval(this.valueExpr)));d=this.formatOutputValue(this.value);this.fieldFontSize=a.getFieldFontSize(this.h);var e=a.getTextWidth(d+"_",this.fieldFontSize+"px "+a.sansserif_font),f=parseInt(this.w/2),b=a.getTextWidth(c,this.fieldFontSize+"px "+
a.sansserif_font);this.visible||(f=this.w,e=0);f<b&&(f=b);""==c&&(f=0);this.w-f<e&&(f=this.w-e);0>f&&(f=0);c=this.w-f;this.containerControl.setAttribute("class","DescartesTextFieldContainer");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("type","text");this.field.setAttribute("id",this.id+"TextField");this.field.setAttribute("class","DescartesTextFieldField");this.field.setAttribute("style",
"font-size: "+this.fieldFontSize+"px; width : "+c+"px; height : "+this.h+"px; left: "+f+"px;");this.field.setAttribute("tabindex",this.tabindex);this.field.value=d;this.label.setAttribute("class","DescartesTextFieldLabel");this.label.setAttribute("style","font-size:"+this.fieldFontSize+"px; width: "+f+"px; height: "+this.h+"px; line-height: "+this.h+"px;");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()};a.TextField.prototype.update=function(){g=this.evaluator;this.label.innerHTML=g.eval(this.name).toString();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||(k=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!=k&&(this.value=this.validateValue(k),this.field.value=this.formatOutputValue(this.value)),g.setVariable(this.id,this.value));this.updatePositionAndSize()};a.TextField.prototype.validateValue=function(a){if(""===a||"''"==a)return"";g=this.evaluator;a=a.toString().replace(this.regExpDecimalSymbol,".","g");m=a==parseFloat(a)?parseFloat(a):parseFloat(g.eval(g.parser.parse(a)));isNaN(m)&&(m=0);e=g.eval(this.min);h=g.eval(this.max);""===
e&&(e=-Infinity);h=g.eval(this.max);""===h&&(h=Infinity);m<e&&(m=e);m>h&&(m=h);this.discrete&&(a=g.eval(this.incr),m=0===a?0:a*Math.round(m/a));return m=parseFloat(parseFloat(m).toFixed(g.eval(this.decimals)))};a.TextField.prototype.formatOutputValue=function(a){return""===a?"":this.uber.formatOutputValue.call(this,a)};a.TextField.prototype.changeValue=function(a,c){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())};a.TextField.prototype.evaluateAnswer=function(){return a.esCorrecto(this.answer,this.value,this.evaluator,this.answer)};a.TextField.prototype.getFirstAnswer=function(){return this.answer?this.onlyText?this.firstAnswer:this.evaluator.eval(this.firstAnswer):""};a.TextField.prototype.addEvents=function(){var d=this;d.field.oncontextmenu=d.label.oncontextmenu=function(){return!1};
d.label.addEventListener("touchstart",a.preventDefault);d.label.addEventListener("mousedown",a.preventDefault);this.field.addEventListener("blur",function(a){d.evaluator.eval(d.drawIf)&&d.changeValue(d.field.value,!0)});this.field.addEventListener("keydown",function(a){d.activeIfValue&&13==a.keyCode&&d.changeValue(d.field.value,!0)});d.field.addEventListener("click",function(a){this.select();this.focus()})};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.abs,k,f,m,e,h,d,c,u,l,b;a.Menu=function(b,c){function d(a){e.options=a.split(",");e.menuOptions=[];e.strValue=[];a=0;for(var b=e.options.length;a<b;a++){var c=e.customSplit(e.options[a]);1==c.length?(e.menuOptions.push(c[0]),e.strValue.push(a.toString())):2==c.length&&(e.menuOptions.push(c[0]),""==c[1]?e.strValue.push(a.toString()):e.strValue.push(c[1]))}a=0;for(b=e.menuOptions.length;a<b;a++)e.menuOptions[a].match(/^\[/)&&e.menuOptions[a].match(/\]$/)?
e.menuOptions[a]=k.parse(e.menuOptions[a].substring(1,e.menuOptions[a].length-1)):e.menuOptions[a]=k.parse("'"+e.menuOptions[a]+"'");a=0;for(b=e.strValue.length;a<b;a++)e.strValue[a].match(/^\[/)&&e.strValue[a].match(/\]$/)?e.strValue[a]=k.parse(e.strValue[a].substring(1,e.strValue[a].length-1)):e.strValue[a]=k.parse(e.strValue[a]);for(;e.select.firstChild;)e.select.removeChild(e.select.firstChild);a=0;for(b=e.menuOptions.length;a<b;a++)c=document.createElement("option"),c.innerHTML=f.eval(e.menuOptions[a]),
e.select.appendChild(c);return 0}this.options="";a.Control.call(this,b,c);k=this.parser;f=this.evaluator;this.ok=0;this.tabindex=++this.parent.tabindex;this.answer&&(this.answer.match("krypto_")&&(this.answer=(new a.Krypto).decode(this.answer.substring(7))),this.answer=parseInt(this.answer.split(",")[0].replace("[",""))||0);"["===this.name.charAt(0)&&"]"===this.name.charAt(this.name.length-1)?this.name=this.parser.parse(this.name.substring(1,this.name.length-1)):this.name=this.parser.parse("'"+this.name+
"'");var e=this;this.evaluator.setFunction(this.id+".setOptions",d);this.containerControl=document.createElement("div");this.label=document.createElement("label");this.select=document.createElement("select");this.field=document.createElement("input");d(this.options);this.containerControl.appendChild(this.label);this.containerControl.appendChild(this.select);this.visible&&this.containerControl.appendChild(this.field);this.addControlContainer(this.containerControl);this.addEvents();this.init()};a.extend(a.Menu,
a.Control);a.Menu.prototype.init=function(b){f=this.evaluator;var c=f.eval(this.name).toString();this.label.innerHTML=c;this.fieldFontSize=2!=this.parent.version?a.getFieldFontSize(this.h):10;var e=0,d=0;this.value=b?this.value:f.eval(this.valueExpr);this.indexValue=this.getIndex(this.value);for(var l=0,g=this.menuOptions.length;l<g;l++)b=a.getTextWidth(f.eval(this.menuOptions[l]).toString(),this.fieldFontSize+"px "+a.sansserif_font),b>e&&(e=b,d=l);e+=25;b=a.getTextWidth(this.formatOutputValue(f.eval(this.strValue[d])),
this.fieldFontSize+"px "+a.sansserif_font)+7;d=a.getTextWidth(c,this.fieldFontSize+"px "+a.sansserif_font)+10;""==c&&(d=0);this.visible||(b=0);for(c=this.w-b-d;c<e&&0<d;)d--,c++;for(;c<e&&0<b;)b--,c++;for(;d+c+b+1<this.w;)c++,b++;e=d;l=e+c;b=this.w-l;g=this.formatOutputValue(f.eval(this.strValue[this.indexValue]));this.containerControl.setAttribute("class","DescartesMenuContainer");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("class","DescartesMenuLabel");this.label.setAttribute("style","font-size:"+this.fieldFontSize+"px; width:"+d+"px; height:"+this.h+"px; line-height:"+this.h+"px;");this.field.setAttribute("type","text");this.field.setAttribute("id",this.id+"_menuField");this.field.value=g;this.field.setAttribute("class","DescartesMenuField");this.field.setAttribute("style","font-size: "+this.fieldFontSize+"px; width: "+b+"px; height: "+this.h+"px; left:"+l+"px;");
this.field.setAttribute("tabindex",this.tabindex);this.select.setAttribute("id",this.id+"_menuSelect");this.select.setAttribute("class","DescartesMenuSelect");this.select.setAttribute("style","text-align:left; font-size:"+this.fieldFontSize+"px; width: "+c+"px; height: "+this.h+"px; left: "+e+"px;");this.select.setAttribute("tabindex",this.tabindex);this.select.selectedIndex=this.indexValue;f.setVariable(this.id,parseFloat(g.replace(this.parent.decimal_symbol,".")));this.update()};a.Menu.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){this.label.innerHTML=f.eval(this.name).toString();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()};a.Menu.prototype.customSplit=function(a){d=!1;c="";u=0;for(l=-1;u<a.length;){b=a.charAt(u);a.charAt(u-1);if("["===b&&-1===l){if(d||
""!=c)c+="\u00a6";l++}else"["===b?l++:"]"===b&&0===l?(d=!0,l--):"]"==a.charAt(u)&&(l=0>l?l:l-1);c+=a.charAt(u);u++}return c.split("\u00a6")};a.Menu.prototype.getIndex=function(a){a=parseFloat(a.toString().replace(this.parent.decimal_symbol,"."));m=-1;e=Infinity;for(var b=0,c=this.strValue.length;b<c;b++)h=g(a-parseFloat(this.evaluator.eval(this.strValue[b]))),h<=e&&(e=h,m=b);return m};a.Menu.prototype.changeValue=function(){this.activeIfValue&&(this.evaluator.setVariable(this.id,this.value),this.updateAndExecAction())};
a.Menu.prototype.addEvents=function(){var b=this;b.select.oncontextmenu=b.label.oncontextmenu=b.field.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())});b.field.addEventListener("click",function(a){this.focus()})};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.floor,k,f,m,e,h,d,c,u,l,b,n,y,q,r,w,p,v,x;a.Scrollbar=function(b,c){a.Control.call(this,b,c);"["===this.name.charAt(0)&&"]"===this.name.charAt(this.name.length-1)?this.name=this.parser.parse(this.name.substring(1,this.name.length-1)):this.name=this.parser.parse("'"+this.name+"'");this.orientation=this.w>=this.h?"h":"v";this.container=document.createElement("div");this.canvas=document.createElement("canvas");this.divUp=document.createElement("div");
this.divDown=document.createElement("div");this.field=document.createElement("input");this.scrollHandler=document.createElement("div");this.label=document.createElement("label");this.container.appendChild(this.canvas);this.container.appendChild(this.label);this.container.appendChild(this.divUp);this.container.appendChild(this.divDown);this.container.appendChild(this.field);this.container.appendChild(this.scrollHandler);this.addControlContainer(this.container);this.addEvents();this.init()};a.extend(a.Scrollbar,
a.Control);a.Scrollbar.prototype.init=function(){k=this.evaluator;0==k.eval(this.decimals)?this.incr=1:this.incr=(k.eval(this.max)-k.eval(this.min))/100;this.value=this.validateValue(k.eval(this.valueExpr));m=this.formatOutputValue(this.value);e=this.evaluator.eval(this.expresion);this.x=e[0][0];this.y=e[0][1];4==e[0].length&&(this.w=e[0][2],this.h=e[0][3]);this.orientation=this.w>=this.h?"h":"v";this.initScroll(m);this.changeScrollPositionFromValue();this.prePos=this.pos;k.setVariable(this.id,this.value)};
a.Scrollbar.prototype.initScroll=function(b){f=this;k=f.evaluator;x=k.eval(f.name).toString();f.label.innerHTML=x;var c="v"===f.orientation?parseInt(19+5*(f.h-100)/100):f.h;f.fieldFontSize="v"===f.orientation?c-parseInt(f.h/20)-1:2!==f.parent.version?a.getFieldFontSize(c):10;var e=a.getTextWidth(b+"_",f.fieldFontSize+"px "+a.sansserif_font),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),e=f.fieldHeight,c=e+f.canvasHeight,f.canvasX=0,f.canvasY=f.fieldHeight,f.labelWidth=f.w,f.labelY=c,f.upWidth=f.downW=f.w,f.upHeight=f.downH=15,f.upX=0,f.upY=f.fieldHeight,f.downX=0,f.downY=c-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=c-f.downH-f.scrollHandlerH,f.limSup=
e+f.downH;else{c=a.getTextWidth(x,f.fieldFontSize+"px "+a.sansserif_font)+10;f.labelWidth=c;f.fieldWidth=e;""==x&&(f.labelWidth=0);f.visible||(f.fieldWidth=0);for(c=f.w-f.fieldWidth-f.labelWidth;58>c&&0<f.labelWidth;)f.labelWidth--,c++;for(;58>c&&0<f.fieldWidth;)f.fieldWidth--,c++;e=f.labelWidth;d=e+c;f.fieldWidth=f.w-d;f.canvasWidth=c;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=e+f.downW;f.limSup=e+f.canvasWidth-f.downW-f.scrollHandlerW}f.container.setAttribute("class","DescartesScrollbarContainer");f.container.setAttribute("id",f.id);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: 0px; top: 0px;");f.ctx=f.canvas.getContext("2d");f.ctx.imageSmoothingEnabled=!1;f.divUp.setAttribute("class","DescartesCatcher up");f.divUp.setAttribute("style","width : "+f.upWidth+"px; height : "+f.upHeight+"px; left: "+f.upX+"px; top: "+f.upY+"px;");f.divDown.setAttribute("class","DescartesCatcher down");f.divDown.setAttribute("style","width : "+f.downW+"px; height : "+f.downH+"px; left: "+
f.downX+"px; top: "+f.downY+"px;");f.scrollHandler.setAttribute("class","DescartesCatcher manipulator");f.scrollHandler.setAttribute("style","width : "+f.scrollHandlerW+"px; height : "+f.scrollHandlerH+"px;");f.scrollHandler.style.top=("v"===f.orientation?f.limInf:0)+"px";f.scrollHandler.style.left=("v"===f.orientation?0:f.limInf)+"px";f.field.setAttribute("type","text");f.field.setAttribute("id",f.id+"scrollbar");f.field.setAttribute("class","DescartesScrollbarField");f.field.setAttribute("style",
"font-size: "+f.fieldFontSize+"px; width : "+f.fieldWidth+"px; height : "+f.fieldHeight+"px; left: "+f.fieldX+"px; top: 0px;");f.field.value=b;0===f.fieldHeight&&(f.field.style.display="none");f.label.setAttribute("class","DescartesScrollbarLabel");f.label.setAttribute("style","font-size:"+f.fieldFontSize+"px; width: "+f.labelWidth+"px; height: "+f.labelHeight+"px; line-height: "+f.labelHeight+"px; left: 0px; top:"+f.labelY+"px;")};a.Scrollbar.prototype.update=function(){k=this.evaluator;this.label.innerHTML=
k.eval(this.name).toString();0==k.eval(this.decimals)?this.incr=1:this.incr=(k.eval(this.max)-k.eval(this.min))/100;this.activeIfValue=0<k.eval(this.activeif);this.drawIfValue=0<k.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(k.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);k.setVariable(this.id,this.value)};a.Scrollbar.prototype.draw=function(){f=this;h=f.ctx;c=g(this.w);d=g(this.h);h.fillStyle="#e0e4e8";h.fillRect(0,0,c,d);h.strokeStyle="#7a8a99";f.down&&(h.fillStyle="#ccdcec",h.fillRect(f.downX+.5,f.downY+.5,f.downW,f.downH-1));h.strokeRect(f.downX+.5,f.downY+.5,f.downW,f.downH-1);f.up&&(h.fillStyle="#ccdcec",h.fillRect(f.upX+.5,f.upY-.5,f.upWidth,
f.upHeight+1));h.strokeRect(f.upX+.5,f.upY-.5,f.upWidth,f.upHeight+1);u=4;h.fillStyle="black";h.beginPath();"h"===f.orientation?(h.moveTo(f.downX+u,f.downH/2),h.lineTo(f.downX+f.downW-u,u),h.lineTo(f.downX+f.downW-u,f.downH-u),h.moveTo(f.upX+f.upWidth-u,f.downH/2),h.lineTo(f.upX+u,u),h.lineTo(f.upX+u,f.downH-u),h.fill(),f.activeIfValue&&(l=g(f.pos),h.fillStyle="#ccdcec",h.fillRect(l+.5,0,g(f.scrollHandlerW),d),h.strokeStyle="#6382bf",h.strokeRect(l+.5,0,g(f.scrollHandlerW),d),b=g(f.scrollHandlerW/
2),h.beginPath(),h.moveTo(l+b+.5-2,3),h.lineTo(l+b+.5-2,d-3),h.moveTo(l+b+.5,3),h.lineTo(l+b+.5,d-3),h.moveTo(l+b+.5+2,3),h.lineTo(l+b+.5+2,d-3),h.stroke())):(h.moveTo(f.downX+f.downW/2,f.downY+f.downH-u),h.lineTo(f.downX+u,f.downY+u),h.lineTo(f.downX+f.downW-u,f.downY+u),h.moveTo(f.upX+f.upWidth/2,f.upY+u),h.lineTo(f.upX+u,f.upY+f.upHeight-u),h.lineTo(f.upX+f.upWidth-u,f.upY+f.upHeight-u),h.fill(),f.activeIfValue&&(l=g(f.pos),h.fillStyle="#ccdcec",h.fillRect(0,l+.5,c,g(f.scrollHandlerH)),h.strokeStyle=
"#6382bf",h.strokeRect(0,l+.5,c,g(f.scrollHandlerH)),b=g(f.scrollHandlerH/2),h.beginPath(),h.moveTo(3,l+b+.5-2),h.lineTo(c-3,l+b+.5-2),h.moveTo(3,l+b+.5),h.lineTo(c-3,l+b+.5),h.moveTo(3,l+b+.5+2),h.lineTo(c-3,l+b+.5+2),h.stroke()));h.strokeRect(.5,.5,c-1,d-1);f.activeIfValue||(h.fillStyle="rgba(240,240,240,"+160/255+")",h.fillRect(0,0,c,d.h))};a.Scrollbar.prototype.validateValue=function(a){k=this.evaluator;n=a.toString();n=parseFloat(n.replace(this.parent.decimal_symbol,"."));isNaN(n)&&(n=0);this.minimo=
k.eval(this.min);n<this.minimo&&(this.value=null,n=this.minimo);this.maximo=k.eval(this.max);n>this.maximo&&(this.value=null,n=this.maximo);y=this.incr;n=0!=y?n*y/y:0;this.fixed&&(n=parseFloat(parseFloat(n).toFixed(k.eval(this.decimals))));return n};a.Scrollbar.prototype.increase=function(){this.changeValue(parseFloat(this.value)+this.incr)};a.Scrollbar.prototype.decrease=function(){this.changeValue(parseFloat(this.value)-this.incr)};a.Scrollbar.prototype.increase10=function(){u=(this.evaluator.eval(this.max)-
this.evaluator.eval(this.min))/10;"h"==this.orientation?this.clickPos.x>this.prePos&&this.changeValue(parseFloat(this.value)+u):this.clickPos.y<this.prePos&&this.changeValue(parseFloat(this.value)+u)};a.Scrollbar.prototype.decrease10=function(){u=(this.evaluator.eval(this.max)-this.evaluator.eval(this.min))/10;"h"==this.orientation?this.clickPos.x<this.prePos&&this.changeValue(parseFloat(this.value)-u):this.clickPos.y>this.prePos&&this.changeValue(parseFloat(this.value)-u)};a.Scrollbar.prototype.changeValue=
function(a){this.activeIfValue&&(q=this.validateValue(a),q!=this.value&&(this.value=q,this.field.value=this.formatOutputValue(q),this.changeScrollPositionFromValue(),this.prePos=this.pos,this.evaluator.setVariable(this.id,this.value),this.updateAndExecAction()))};a.Scrollbar.prototype.changeValueForScrollMovement=function(){k=this.evaluator;r=this.limInf;w=this.limSup;p=k.eval(this.min);v=k.eval(this.max);y=this.incr;q=g((this.pos-r)*(v-p)/(w-r)/y)*y+p;q!=this.value&&(this.value=q,this.field.value=
this.formatOutputValue(q),k.setVariable(this.id,this.value),this.parent.updateControls(),this.actionExec.execute(),this.parent.update())};a.Scrollbar.prototype.changeScrollPositionFromValue=function(){k=this.evaluator;r=this.limInf;w=this.limSup;p=k.eval(this.min);v=k.eval(this.max);y=this.incr;this.pos=(this.value-p)*(w-r)/(v-p)+r;"h"==this.orientation?this.scrollHandler.style.left=this.pos+"px":this.scrollHandler.style.top=this.pos+"px"};a.Scrollbar.prototype.addEvents=function(){function b(c,e,
d,f){a.clearTimeout(w);(h.up||h.down||h.canvasClick)&&1E-7<Math.abs(h.value-f)&&(e.call(h),c=d?c:30,w=a.setTimeout(function(){b(c,e,!1,f)},c))}function c(c){c.preventDefault();h.whichBtn=a.whichBtn(c);"L"==h.whichBtn&&h.activeIfValue&&(h.clickPos=a.getCursorPosition(c,h.container),h.canvasClick=!0,"h"==h.orientation?h.clickPos.x<h.prePos?b(350,h.decrease10,!0,h.minimo):b(350,h.increase10,!0,h.maximo):h.clickPos.y<h.prePos?b(350,h.increase10,!0,h.maximo):b(350,h.decrease10,!0,h.minimo))}function e(b){h.canvasClick=
!1;a.clearTimeout(w)}function d(b){1==h.canvasClick&&(h.clickPos=a.getCursorPosition(b,h.container),b.preventDefault())}function f(a){h.scrollClick=!1;h.prePos=h.pos;window.removeEventListener("mouseup",f,!1);window.removeEventListener("mousemove",g,!1);a.preventDefault()}function l(a){h.scrollClick=!1;h.prePos=h.pos;window.removeEventListener("touchend",l,!1);window.removeEventListener("touchmove",g,!1);a.preventDefault()}function g(b){var c=a.getCursorPosition(b,h.container);"h"==h.orientation?
(h.pos=h.prePos-(h.initPos.x-c.x),h.pos<h.limInf&&(h.pos=h.limInf),h.pos>h.limSup&&(h.pos=h.limSup),h.scrollHandler.setAttribute("style","background-color: rgba(255, 255, 255, 0); cursor: pointer; position: absolute; width : "+h.scrollHandlerW+"px; height : "+h.h+"px; left: "+h.pos+"px; top: 0px;")):(h.pos=h.prePos-(h.initPos.y-c.y),h.pos>h.limInf&&(h.pos=h.limInf),h.pos<h.limSup&&(h.pos=h.limSup),h.scrollHandler.setAttribute("style","background-color: rgba(255, 255, 255, 0); cursor: pointer; position: absolute; width : "+
h.w+"px; height : "+h.scrollHandlerH+"px; left: 0px; top: "+h.pos+"px;"));h.changeValueForScrollMovement();b.preventDefault()}function n(c){c.preventDefault();h.whichBtn=a.whichBtn(c);"L"==h.whichBtn&&h.activeIfValue&&(h.up=!0,b(350,h.increase,!0,h.maximo))}function k(c){c.preventDefault();h.whichBtn=a.whichBtn(c);"L"==h.whichBtn&&h.activeIfValue&&(h.down=!0,b(350,h.decrease,!0,h.minimo))}function q(b){h.down=!1;a.clearTimeout(w);b.preventDefault()}function r(b){h.up=!1;a.clearTimeout(w);h.draw()}
function m(b){h.down=!1;a.clearTimeout(w);h.draw()}var h=this,w;h.canvas.oncontextmenu=h.divUp.oncontextmenu=h.divDown.oncontextmenu=h.label.oncontextmenu=h.field.oncontextmenu=h.scrollHandler.oncontextmenu=function(){return!1};this.field.addEventListener("keydown",function(a){13==a.keyCode&&h.changeValue(h.field.value)});this.canvas.addEventListener("touchstart",c);this.canvas.addEventListener("mousedown",c);this.divDown.addEventListener("mouseout",q);window.addEventListener("touchend",e);window.addEventListener("mouseup",
e);this.canvas.addEventListener("touchmove",d);this.canvas.addEventListener("mousemove",d);this.scrollHandler.addEventListener("touchstart",function(b){h.activeIfValue&&(h.scrollClick=!0,h.initPos=a.getCursorPosition(b,h.container),window.addEventListener("touchend",l),window.addEventListener("touchmove",g),b.preventDefault())});this.scrollHandler.addEventListener("mousedown",function(b){h.activeIfValue&&(h.scrollClick=!0,h.initPos=a.getCursorPosition(b,h.container),window.addEventListener("mouseup",
f),window.addEventListener("mousemove",g),b.preventDefault())});this.divUp.addEventListener("touchstart",n);this.divUp.addEventListener("mousedown",n);this.divDown.addEventListener("touchstart",k);this.divDown.addEventListener("mousedown",k);this.divUp.addEventListener("mouseout",function(b){h.up=!1;a.clearTimeout(w);b.preventDefault()});this.divDown.addEventListener("mouseout",q);window.addEventListener("touchend",r);window.addEventListener("mouseup",r);window.addEventListener("touchend",m);window.addEventListener("mouseup",
m)};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g;a.Audio=function(f,g){this.controls=!0;this.file="";this.oldDrawIf=0;a.Control.call(this,f,g);var e=this;f=e.evaluator.eval(e.expresion);4==f[0].length?(e.w=f[0][2],e.h=f[0][3]):(e.w=200,e.h=28);e.audio=e.parent.getAudio(e.file);e.oldFile=e.file;"]"===e.file.charAt(e.file.length-1)&&(e.file=e.evaluator.parser.parse(e.file.substring(1,e.file.length-1)));e.autoplay&&(e.audio.setAttribute("autoplay","autoplay"),e.audio.play());e.loop&&e.audio.setAttribute("loop",
"loop");e.controls&&e.audio.setAttribute("controls","controls");e.audio.setAttribute("style","position: absolute; width: "+e.w+"px; left: "+e.x+"px; top: "+e.y+"px; z-index: "+e.zIndex+";");e.addControlContainer(e.audio);e.evaluator.setFunction(e.id+".play",function(){try{e.audio.play()}catch(h){}return 0});e.evaluator.setFunction(e.id+".pause",function(){try{e.audio.pause()}catch(h){}return 0});e.evaluator.setFunction(e.id+".stop",function(){try{e.audio.pause(),e.audio.currentTime=0}catch(h){}return 0});
e.evaluator.setFunction(e.id+".currentTime",function(a){try{e.audio.currentTime=parseFloat(a)}catch(d){}return 0});e.audio.addEventListener("timeupdate",function(a){e.evaluator.setVariable(e.id+".currentTime",e.audio.currentTime)})};a.extend(a.Audio,a.Control);a.Audio.prototype.init=function(){this.audio.style.left=this.x+"px";this.audio.style.top=this.y+"px";this.update()};var k;a.Audio.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));(k=0<g.eval(this.drawif))?this.audio.style.display="block":(this.audio.style.display="none",k!==this.oldDrawIf&&this.audio.pause());this.oldDrawIf=k;this.updatePositionAndSize()};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g;a.Video=function(f,k){this.controls=!0;this.file="";this.oldDrawIf=0;a.Control.call(this,f,k);var e=this;g=e.evaluator;f=e.evaluator.eval(e.expresion);4==f[0].length?(e.w=f[0][2],e.h=f[0][3]):(e.w=null,e.h=null);f=e.file;k=f.lastIndexOf(".");-1!=k&&(f=e.file.substring(0,k));e.video=document.createElement("video");e.autoplay&&e.video.setAttribute("autoplay","autoplay");e.loop&&e.video.setAttribute("loop","loop");e.controls&&e.video.setAttribute("controls",
"controls");e.video.setAttribute("poster",f+".png");e.w&&(e.video.setAttribute("width",e.w),e.video.setAttribute("height",e.h));e.video.setAttribute("style","position:absolute; overflow:hidden; left:"+e.x+"px; top:"+e.y+"px; outline:none; background:rgba(0,0,0,0);");e.video.canPlayType("video/mp4")&&(k=document.createElement("source"),k.setAttribute("src",f+".mp4"),e.video.appendChild(k));e.video.canPlayType("video/ogg")&&(k=document.createElement("source"),k.setAttribute("src",f+".ogg"),k.setAttribute("type",
"video/ogg"),e.video.appendChild(k),k=document.createElement("source"),k.setAttribute("src",f+".ogv"),k.setAttribute("type","video/ogg"),e.video.appendChild(k));e.video.canPlayType("video/webm")&&(k=document.createElement("source"),k.setAttribute("src",f+".webm"),k.setAttribute("type","video/webm"),e.video.appendChild(k));e.addControlContainer(e.video);e.evaluator.setFunction(e.id+".play",function(){try{e.video.play()}catch(h){}return 0});e.evaluator.setFunction(e.id+".pause",function(){try{e.video.pause()}catch(h){}return 0});
e.evaluator.setFunction(e.id+".stop",function(){try{e.video.pause(),e.video.currentTime=0}catch(h){}return 0});e.evaluator.setFunction(e.id+".currentTime",function(a){try{e.video.currentTime=parseFloat(a)}catch(d){}return 0});e.video.addEventListener("timeupdate",function(a){e.evaluator.setVariable(e.id+".currentTime",e.video.currentTime)})};a.extend(a.Video,a.Control);a.Video.prototype.init=function(){this.video.style.left=this.x+"px";this.video.style.top=this.y+"px";this.update()};var k;a.Video.prototype.update=
function(){g=this.evaluator;(k=0<g.eval(this.drawif))?this.video.style.display="block":(this.video.style.display="none",k!==this.oldDrawIf&&this.video.pause());this.oldDrawIf=k;this.updatePositionAndSize()};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,k,f;a.TextArea=function(f,e){this.font="Monospaced,PLAIN,12";a.Control.call(this,f,e);this.region="interior";this.tabindex=++this.parent.tabindex;if(this.answer){this.answer.match("krypto_")&&(this.answer=(new a.Krypto).decode(this.answer.substring(7)));var g=this.parent.lessonParser.parseText(this.answer)}this.containerControl=document.createElement("div");this.textArea=document.createElement("div");this.textAreaAnswer=document.createElement("div");
this.showButton=document.createElement("div");this.activeCover=document.createElement("div");this.containerControl.appendChild(this.textArea);this.containerControl.appendChild(this.textAreaAnswer);this.containerControl.appendChild(this.showButton);this.containerControl.appendChild(this.activeCover);this.addControlContainer(this.containerControl);this.showAnswer=!1;this.text=void 0==this.text||"simpleText"==this.text.type?this.rawText||"":this.text.hasFormula?this.rawText:this.text.toHTML();g&&"simpleText"!==
g.type&&(this.answer=this.text.hasFormula?"":g.toHTML());this.evaluator.setVariable(this.id,this.text);this.drawButton();var d=this,c,k,l;this.evaluator.setFunction(this.id+".insertAtCursor",function(a){(c=window.getSelection())&&c.getRangeAt&&c.rangeCount&&(l=document.createTextNode(a),k=c.getRangeAt(0),k.deleteContents(),k.insertNode(l),k.setStart(l,l.length),k.setEnd(l,l.length),c.removeAllRanges(),c.addRange(k),d.textArea.focus());return 0});this.evaluator.setFunction(this.id+".update",function(){d.update()});
this.addEvents();this.init()};a.extend(a.TextArea,a.Control);a.TextArea.prototype.init=function(){k=this.answer?28:4;g=this.evaluator;var f=this.text.match(/<span/)?this.text:this.text.replace(/\\n/g,"<br/>");this.containerControl.setAttribute("class","DescartesTextAreaContainer");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.containerControl.style.display=0<g.eval(this.drawif)?"block":
"none";this.containerControl.setAttribute("spellcheck","false");this.textArea.setAttribute("class","DescartesTextAreaContainer");this.textArea.setAttribute("style","padding: 5px; width: "+(this.w-4)+"px; height: "+(this.h-k)+"px; left: 2px; top: 2px; background-color: white; text-align: left; font: "+a.convertFont(this.font)+";");this.textArea.setAttribute("contenteditable","true");this.textArea.innerHTML=f;this.textAreaAnswer.setAttribute("class","DescartesTextAreaContainer");this.textAreaAnswer.setAttribute("style",
"width: "+(this.w-8)+"px; height: "+(this.h-k)+"px; left: 4px; top: 4px; background-color: white; text-align: left; font: "+a.convertFont(this.font)+";");this.textAreaAnswer.style.display=this.showAnswer?"block":"none";this.textAreaAnswer.innerHTML="<span style='position: relative; top: 10px; left: 10px; white-space: nowrap;'>"+this.answer+"</span>";this.showButton.setAttribute("style","width: 20px; height: 16px; position: absolute; bottom: 4px; right: 4px; cursor: pointer;");this.showButton.style.backgroundImage=
"url("+this.imageUnPush+")";this.showButton.style.display=this.answer?"block":"none";this.showButton.innerHTML="<span style='position: relative; top: 2px; text-align: center; font: 9px Arial'> 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()};a.TextArea.prototype.drawButton=function(){var f=document.createElement("canvas");f.setAttribute("width",20);f.setAttribute("height",16);var e=
f.getContext("2d");e.imageSmoothingEnabled=!1;this.canvas=f;this.ctx=e;this.createGradient(20,16);e.lineWidth=1;e.fillStyle="white";e.fillRect(0,0,20,16);e.fillStyle=this.linearGradient;e.fillRect(0,0,20,16);a.drawLine(e,19,0,19,16,"rgba(0,0,0,"+128/255+")");a.drawLine(e,0,0,0,16,"rgba(0,0,0,"+24/255+")");a.drawLine(e,1,0,1,16,"rgba(0,0,0,"+8/255+")");this.imageUnPush=f.toDataURL();e.fillStyle="white";e.fillRect(0,0,20,16);e.fillStyle=this.linearGradient;e.fillRect(0,0,20,16);a.drawLine(e,0,0,0,14,
"gray");a.drawLine(e,0,0,19,0,"gray");e.fillStyle="rgba(0, 0, 0,"+24/255+")";e.fillRect(0,0,this.w,this.h);this.imagePush=f.toDataURL()};a.TextArea.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()};a.TextArea.prototype.addEvents=function(){function a(a){a.preventDefault();e.showButton.style.backgroundImage="url("+e.imageUnPush+")"}var e=this;this.showButton.addEventListener("mousedown",function(a){a.preventDefault();e.showAnswer=!e.showAnswer;e.textAreaAnswer.style.display=
e.showAnswer?"block":"none";e.showButton.childNodes[0].childNodes[0].textContent=e.showAnswer?"T":"S";e.showButton.style.backgroundImage="url("+e.imagePush+")"});this.showButton.addEventListener("mouseup",a);this.showButton.addEventListener("mouseout",a);this.textArea.addEventListener("blur",function(){var a=window.getSelection();e.cursorInd=a.focusOffset})};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=2*Math.PI,k,f,m,e,h,d,c,u,l,b;a.GraphicControl=function(b,c){f=b.evaluator.parser;this.text=this.spaceID="";this.size=f.parse("4");this.font="Monospaced,PLAIN,12";this.image=new Image;this.image.onload=function(){this.ready=1};this.imageSrc="";a.Control.call(this,b,c);this.font=a.convertFont(this.font);if(this.constraintExpr){this.constraint=f.parse(this.constraintExpr);"(expr)"==this.constraint.type&&(this.constraint=f.parse(this.constraintExpr.substring(1,
this.constraintExpr.length-1)));if("compOperator"==this.constraint.type){c=this.constraint.childs[0];var e=this.constraint.childs[1];"identifier"!=c.type||"y"!=c.value||e.contains("y")?"identifier"!=c.type||"x"!=c.value||e.contains("x")?this.newt=new a.R2Newton(this.evaluator,this.constraint):(this.constVar="y",this.noConstVar="x",this.evalConst=this.evalConstXoY,this.constraint=e):(this.constVar="x",this.noConstVar="y",this.evalConst=this.evalConstXoY,this.constraint=e)}else this.constraint=null;
u=new a.R2(0,0)}this.container=this.getContainer();this.mouseCacher=document.createElement("div");this.mouseCacher.setAttribute("class","DescartesGraphicControl");this.mouseCacher.setAttribute("id",this.id);this.mouseCacher.setAttribute("dragged",!0);this.mouseCacher.setAttribute("tabindex","-1");this.ctx=this.space.ctx;this.container.appendChild(this.mouseCacher);this.addEvents();this.xStr=this.id+".x";this.yStr=this.id+".y";this.activoStr=this.id+".activo";this.activeStr=this.id+".active";""!==
this.space.id&&2!==b.version?(this.mxStr=this.space.id+".mouse_x",this.myStr=this.space.id+".mouse_y",this.mclickedStr=this.space.id+".mouse_clicked",this.mclicizquierdoStr=this.space.id+".clic_izquierdo"):(this.mxStr="mouse_x",this.myStr="mouse_y",this.mclickedStr="mouse_clicked",this.mclicizquierdoStr="clic_izquierdo");this.init()};a.GraphicControl.prototype.init=function(){k=this.evaluator;l=a.hasTouchSupport;var b=k.eval(this.expresion);this.x=b[0][0];this.y=b[0][1];k.setVariable(this.xStr,this.x);
k.setVariable(this.yStr,this.y);this.mouseCacher.setAttribute("style","cursor:pointer;background-color:rgba(255, 255, 255, 0);z-index:"+this.zIndex+";");""==this.imageSrc||this.imageSrc.toLowerCase().match(/vacio.gif$/)?(this.width=2*k.eval(this.size),this.height=2*k.eval(this.size),this._w=l&&48>this.width?48:this.width,this._h=l&&48>this.height?48:this.height,this.mouseCacher.style.borderRadius=parseInt(Math.min(this._w,this._h)/2)+"px"):(this.image=this.parent.getImage(this.imageSrc),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.mouseCacher.style.width=this._w+"px";this.mouseCacher.style.height=this._h+"px";this.mouseCacher.style.left=parseInt(this.space.getAbsoluteX(this.x)-this._w/2)+"px";this.mouseCacher.style.top=parseInt(this.space.getAbsoluteY(this.y)-this._h/2)+"px";k.setVariable(this.activoStr,0);k.setVariable(this.activeStr,0);this.setImage=!1;this.update()};a.GraphicControl.prototype.update=function(){k=
this.evaluator;this.activeIfValue=0<k.eval(this.activeif);this.drawIfValue=0<k.eval(this.drawif);this.x=k.getVariable(this.xStr);this.y=k.getVariable(this.yStr);m=this.space.getAbsoluteX(this.x);e=this.space.getAbsoluteY(this.y);this.mouseCacher.style.display=this.activeIfValue?"block":"none";this.mouseCacher.style.left=parseInt(m-this._w/2)+"px";this.mouseCacher.style.top=parseInt(e-this._h/2)+"px";this.constraint&&this.evalConst();this.draw()};a.GraphicControl.prototype.draw=function(){k=this.evaluator;
this.drawIfValue&&(d=this.ctx,c=this.space.backgroundCtx,m=parseInt(this.space.getAbsoluteX(this.x))+.5,e=parseInt(this.space.getAbsoluteY(this.y))+.5,""!=this.text&&this.drawText(m,e),this.image.ready?(this.image.complete&&!this.setImage&&d.drawImage(this.image,parseInt(m-this.image.width/2),parseInt(e-this.image.height/2)),this.trace&&(c.save(),c.translate(m,e),c.scale(parseInt(this.image.width/2),parseInt(this.image.height/2)),c.beginPath(),c.arc(0,0,1,0,g,!1),c.restore(),c.lineWidth=1,c.strokeStyle=
this.trace.getColor(),c.stroke())):(d.beginPath(),d.arc(m,e,parseInt(this.width/2),0,g,!1),d.fillStyle=this.colorInt.getColor(),d.fill(),d.lineWidth=1,d.strokeStyle=this.color.getColor(),d.stroke(),this.active&&(d.strokeStyle=this.colorInt.borderColor(),d.beginPath(),d.arc(m,e,parseInt(this.width/2)-2,0,g,!1),d.stroke()),this.trace&&(c.strokeStyle=this.trace.getColor(),c.beginPath(),c.arc(m,e,parseInt(this.width/2),0,g,!1),c.stroke())))};a.GraphicControl.prototype.evalConst=function(){u.set(this.x,
this.y);h=this.newt.findZero(u,1/this.space.scale,!0);this.x=h.x;this.y=h.y;this.evaluator.setVariable(this.xStr,this.x);this.evaluator.setVariable(this.yStr,this.y)};a.GraphicControl.prototype.evalConstXoY=function(){k=this.evaluator;b=k.getVariable(this.constVar);k.setVariable(this.constVar,this[this.constVar]);this[this.noConstVar]=k.eval(this.constraint);k.setVariable(this.xStr,this.x);k.setVariable(this.yStr,this.y);k.setVariable(this.constVar,b)};a.GraphicControl.prototype.drawText=function(a,
b){d=this.ctx;k=this.evaluator;"simpleText"==this.text.type?(d.fillStyle=this.color.getColor(),d.font=this.font,d.textBaseline="alphabetic",d.fillText(this.text.toString(k.eval(this.decimals),this.fixed),parseInt(a+1+this.width/2),parseInt(b-1-this.height/2))):(d.fillStyle=this.color.getColor(),d.strokeStyle=this.color.getColor(),d.textBaseline="alphabetic",this.text.draw(d,parseInt(a+1+this.width/2),parseInt(b-1-this.height/2),this.decimals,this.fixed,"start",!0,this.color.getColor()))};a.GraphicControl.prototype.getContainer=
function(){for(var a=this.parent.spaces,b,c=0,e=a.length;c<e;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};a.GraphicControl.prototype.deactivate=function(){this.active=!1;this.evaluator.setVariable(this.activoStr,0);this.evaluator.setVariable(this.activeStr,0);this.evaluator.setVariable(this.mclicizquierdoStr,0)};a.GraphicControl.prototype.addEvents=
function(){function b(e){document.body.focus();e.preventDefault();e.stopPropagation();d.evaluator.setVariable(d.mclickedStr,1);d.evaluator.setVariable(d.mclicizquierdoStr,1);if(d.activeIfValue||d.active)d.click=!1,window.removeEventListener("mouseup",b,!1),window.removeEventListener("mousemove",c,!1),window.removeEventListener("touchend",b,!1),window.removeEventListener("touchmove",c,!1),f=a.getCursorPosition(e,d.container),d.posX=d.prePos.x-(d.posAnte.x-f.x),d.posY=d.prePos.y-(d.posAnte.y-f.y),d.evaluator.setVariable(d.xStr,
d.space.getRelativeX(d.posX)),d.evaluator.setVariable(d.yStr,d.space.getRelativeY(d.posY)),d.evaluator.setVariable(d.mxStr,d.space.getRelativeX(f.x)),d.evaluator.setVariable(d.myStr,d.space.getRelativeY(f.y)),d.parent.updateControls(),d.parent.update(),d.mouseCacher.style.left=d.space.getAbsoluteX(d.x)-d._w/2+"px",d.mouseCacher.style.top=d.space.getAbsoluteY(d.y)-d._h/2+"px";d.parent.deactivateGraphiControls()}function c(b){b.preventDefault();d.evaluator.setVariable(d.mclickedStr,0);d.evaluator.setVariable(d.mclicizquierdoStr,
0);f=a.getCursorPosition(b,d.container);d.posX=d.prePos.x-(d.posAnte.x-f.x);d.posY=d.prePos.y-(d.posAnte.y-f.y);d.evaluator.setVariable(d.xStr,d.space.getRelativeX(d.posX));d.evaluator.setVariable(d.yStr,d.space.getRelativeY(d.posY));d.evaluator.setVariable(d.mxStr,d.space.getRelativeX(f.x));d.evaluator.setVariable(d.myStr,d.space.getRelativeY(f.y));20<Date.now()-e&&(d.parent.updateControls(),d.parent.update(),e=Date.now())}var e=0,d=this;this.active=this.over=this.click=!1;this.mouseCacher.oncontextmenu=
function(){return!1};this.mouseCacher.addEventListener("touchstart",function(e){document.body.focus();e.preventDefault();d.activeIfValue&&(d.parent.deactivateGraphiControls(),d.click=d.active=!0,d.evaluator.setVariable(d.activoStr,1),d.evaluator.setVariable(d.activeStr,1),d.evaluator.setVariable(d.mclickedStr,0),d.evaluator.setVariable(d.mclicizquierdoStr,0),d.posAnte=a.getCursorPosition(e,d.container),d.prePos={x:d.space.getAbsoluteX(d.x),y:d.space.getAbsoluteY(d.y)},d.evaluator.setVariable(d.mxStr,
d.space.getRelativeX(d.posAnte.x)),d.evaluator.setVariable(d.myStr,d.space.getRelativeY(d.posAnte.y)),d.parent.update(),window.addEventListener("touchend",b),window.addEventListener("touchmove",c))});this.mouseCacher.addEventListener("mousedown",function(e){document.body.focus();e.preventDefault();d.whichBtn=a.whichBtn(e);"L"==d.whichBtn&&d.activeIfValue&&d.over&&(d.parent.deactivateGraphiControls(),d.click=d.active=!0,d.evaluator.setVariable(d.activoStr,1),d.evaluator.setVariable(d.activeStr,1),
d.evaluator.setVariable(d.mclickedStr,0),d.evaluator.setVariable(d.mclicizquierdoStr,0),d.posAnte=a.getCursorPosition(e,d.container),d.prePos={x:d.space.getAbsoluteX(d.x),y:d.space.getAbsoluteY(d.y)},d.evaluator.setVariable(d.mxStr,d.space.getRelativeX(d.posAnte.x)),d.evaluator.setVariable(d.myStr,d.space.getRelativeY(d.posAnte.y)),d.parent.update(),window.addEventListener("mouseup",b),window.addEventListener("mousemove",c))});this.mouseCacher.addEventListener("mouseover",function(a){d.over=!0});
this.mouseCacher.addEventListener("mouseout",function(a){d.over=!1;d.click=!1});var f};return a}(descartesJS||{});
descartesJS=function(a,g){var k,f,m,e,h,d,c,u,l,b;if(a.loadLib)return a;var n,y,q,r,w,p,v,x,A=/[\w-//]*(\.png|\.jpg|\.gif|\.svg)/gi,C,F,H,K,E,z,G,L,N,M,B,D,J,I,O,P,Q,U,T,S,R;a.LessonParser=function(b){this.parent=b;this.parser=b.evaluator.parser;this.RTFparser=new a.RTFParser(b.evaluator)};a.LessonParser.prototype.parseButtonsConfig=function(a){var b={rowsNorth:0,rowsSouth:0,widthEast:125,widthWest:125,height:23};a=this.split(a);for(var c=0,d=a.length;c<d;c++)switch(q=a[c][0],r=a[c][1],y=g[q],y){case "rowsNorth":case "rowsSouth":case "widthEast":case "widthWest":case "height":b[y]=
parseInt(r);break;case "about":case "config":case "init":case "clear":b[y]="true"===g[r];break;default:console.log("Propiedad de botones no identificada: <"+q+"> valor: <"+r+">")}return b};a.LessonParser.prototype.parseSpace=function(b){w={};b=this.split(b);for(var c=0,d=b.length;c<d;c++)switch(q=b[c][0],r=b[c][1],y=g[q],a.DEBUG.paramName=q,a.DEBUG.objectName="Space",y){case "id":a.DEBUG.idName=r;case "x_axis":case "y_axis":case "type":case "cID":case "file":case "info":w[y]=r;break;case "fixed":case "numbers":case "sensitive_to_mouse_movements":case "R3":case "split":case "resizable":w[y]=
"true"===g[r];break;case "bg_display":case "render":w[y]=g[r];break;case "net":case "net10":case "axes":case "text":w[y]=""!=r?"false"===g[r]?"":new a.Color(r,this.parent.evaluator):"";break;case "O.x":w.OxExpr=r;break;case "O.y":w.OyExpr=r;break;case "image":w.imageSrc=r;break;case "x":n=r;"%"===n[n.length-1]?(w.xPercentExpr=n.trim(),n=(this.parent.container.width*parseFloat(n)/100).toString()):n=r;w.xExpr=this.parser.parse(n);break;case "y":n=r;"%"===n[n.length-1]?(w.yPercentExpr=n.trim(),n=(this.parent.container.height*
parseFloat(n)/100).toString()):n=r;w.yExpr=this.parser.parse(n);break;case "width":n=r.trim();w.wModExpr=n;"%"===n[n.length-1]?(w.wExpr=n,n=this.parent.container.width*parseFloat(n)/100):(n=parseFloat(r),n!=r&&(n=this.parent.container.width,w._w_=r.trim()));w.w=n;break;case "height":n=r.trim();w.hModExpr=n;"%"===n[n.length-1]?(w.hExpr=n,n=this.parent.container.height*parseFloat(n)/100):(n=parseFloat(r),n!=r&&(n=this.parent.container.height,w._h_=r.trim()));w.h=n;break;case "drawif":""!=r&&(w.drawif=
this.parser.parse(r));break;case "scale":n=parseFloat(r);isNaN(n)&&(n=48);w.scale=n;break;case "background":w.background=new a.Color(r,this.parent.evaluator);break;default:console.log("Propiedad del espacio no identificada: <"+q+"> valor: <"+r+">")}switch(w.type){case "R2":return new a.Space2D(this.parent,w);case "R3":return new a.Space3D(this.parent,w);case "AP":return new a.SpaceAP(this.parent,w);case "HTMLIFrame":return new a.SpaceHTML_IFrame(this.parent,w);default:return new a.Space2D(this.parent,
w)}};a.LessonParser.prototype.parseControl=function(b){p={type:"numeric"};b=this.split(b);for(var c=0,d=b.length;c<d;c++)switch(q=b[c][0],r=b[c][1],y=g[q],a.DEBUG.paramName=q,a.DEBUG.objectName="Control",y){case "id":a.DEBUG.idName=r;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 "info":p[y]=r;break;case "gui":case "region":case "action":case "msg_pos":case "poster":case "text_align":case "image_align":p[y]=
g[r];break;case "fixed":case "visible":case "discrete":case "onlyText":case "evaluate":case "autoplay":case "loop":case "controls":case "flat":p[y]="true"===g[r];break;case "color":case "colorInt":case "trace":p[y]=new a.Color(r,this.parent.evaluator);break;case "font_size":case "drawif":case "activeif":case "decimals":case "min":case "max":case "size":""!==r&&(p[y]=this.parser.parse(r));break;case "constraint":p.constraintExpr=r;break;case "image":p.imageSrc=r;break;case "space":p.spaceID=r;break;
case "type":p.type=g[r.trim()];break;case "expresion":p.expresion=this.parser.parse(r.replace(")(",","));break;case "borderColor":p[y]="false"===g[r]?"":r;break;case "bold":"false"!=g[r]&&(p.bold="bold");break;case "italics":"false"!=g[r]&&(p.italics="italic");break;case "underlined":"false"!=g[r]&&(p.underlined=!0);break;case "value":var e=r.replace(/&squot;/g,"'");e.match(/^\|/)&&(e="'"+e.substring(1),e.match(/\|$/)&&(e=e.substring(0,e.length-1)+"'"));p.valueExpr=this.parser.parse(e);p.valueExprString=
e;break;case "incr":0!=r&&(p.incr=this.parser.parse(r));break;case "exponentialif":p.exponentialif=parseFloat(r);break;case "text":p.rawText=r;e=this.parseText(r);for(var f=0,l=e.length;f<l;f++)e[f]=this.parser.parse(e[f],!1);p.text=e;break;default:f=q.indexOf("."),e=g[q.substring(0,f)],f=g[q.substring(f+1)],"parameter"===e&&"font"===f?p.parameterFont=r:"Explanation"===e&&"font"===f?p.ExplanationFont=r:"tooltip"===e&&"font"===f?p.tooltipFont=r:console.log("Propiedad de control no identificada: <"+
q+"> valor: <"+r+">")}if("numeric"===p.type)switch(p.gui){case "spinner":return new a.Spinner(this.parent,p);case "button":return new a.Button(this.parent,p);case "textfield":return new a.TextField(this.parent,p);case "menu":return new a.Menu(this.parent,p);case "scrollbar":return new a.Scrollbar(this.parent,p);default:return new a.Spinner(this.parent,p)}else{if("video"===p.type)return new a.Video(this.parent,p);if("audio"===p.type)return new a.Audio(this.parent,p);if("graphic"===p.type)return new a.GraphicControl(this.parent,
p);if("text"===p.type)return new a.TextArea(this.parent,p);if("checkbox"===p.type)return new a.Checkbox(this.parent,p)}};a.LessonParser.prototype.parseGraphic=function(b,c,d,e){v={rotateExp:e,parameter:"t"};b=this.split(b);e=0;for(var f=b.length;e<f;e++)if(q=b[e][0],r=b[e][1],y=g[q],a.DEBUG.paramName=q,a.DEBUG.objectName="Graphic",""!=r)switch(y){case "type":a.DEBUG.idName=r;case "align":case "anchor":case "lineDash":v[y]=g[r];break;case "background":case "abs_coord":case "visible":case "editable":case "fixed":case "vectors":case "bold":case "italics":case "underlined":v[y]=
"true"===g[r];break;case "color":case "fill":case "fillP":case "fillM":case "arrow":case "trace":v[y]="false"===g[r]?"":new a.Color(r,this.parent.evaluator);break;case "family":case "parameter":case "info":case "font":case "font_family":case "name":case "init":case "end":v[y]=r;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 "font_size":""!=r&&(v[y]=this.parser.parse(r));
break;case "space":v.spaceID=r;break;case "expresion":""!=r&&("macro"!=v.type?(v.expresion=this.parser.parse(r),v.expresionString=r):v.expresion=r);break;case "text":v.text=r;break;case "file":var l=r.replace(/&squot;/g,"'");"["===l.charAt(0)&&"]"===l.charAt(l.length-1)&&(l=l.substring(1,l.length-1));l.match(A)&&(l="'"+l+"'");v.file=this.parser.parse(l);break;case "border":""!=r&&"false"!=g[r]&&(v.border=new a.Color(r,this.parent.evaluator));break;default:if(void 0!=v.family&&q.substring(0,v.family.length+
1)===v.family+".")switch(g[q.substring(v.family.length+1)]){case "interval":""!=r&&(v.family_interval=this.parser.parse(r));break;case "steps":""!=r&&(v.family_steps=this.parser.parse(r))}else if(void 0!=v.parameter&&q.match(v.parameter+"."))switch(v.parameter!==q.substring(0,q.indexOf(v.parameter)+v.parameter.length)&&(v.parameter=q.substring(0,q.indexOf(v.parameter)+v.parameter.length)),g[q.substring(v.parameter.length+1)]){case "interval":""!=r&&(v.parameter_interval=this.parser.parse(r));break;
case "steps":""!=r&&(v.parameter_steps=this.parser.parse(r))}else console.log("Propiedad del grafico no identificada: <"+q+"> valor: <"+r+">")}c&&(v.abs_coord=c);d&&(v.background=d);switch(v.type){case "text":return new a.Text(this.parent,v);case "image":return new a.Image(this.parent,v);case "point":return new a.Point(this.parent,v);case "polygon":return new a.Polygon(this.parent,v);case "arc":return new a.Arc(this.parent,v);case "segment":return new a.Segment(this.parent,v);case "arrow":return new a.Arrow(this.parent,
v);case "macro":return new a.Macro(this.parent,v);case "curve":return new a.Curve(this.parent,v);case "equation":return new a.Equation(this.parent,v);case "sequence":return new a.Sequence(this.parent,v);case "rectangle":return new a.Rectangle(this.parent,v);case "fill":return new a.Fill(this.parent,v)}};a.LessonParser.prototype.parse3DGraphic=function(b,c,d,e){v={rotateExp:e,parameter:"t"};b=this.split(b);c=0;for(d=b.length;c<d;c++)switch(q=b[c][0],r=b[c][1],y=g[q],a.DEBUG.paramName=q,a.DEBUG.objectName=
"Graphic3D",y){case "type":a.DEBUG.idName=r;case "model":case "lineDash":v[y]=g[r];break;case "fill":v[y]="false"===g[r]?"":new a.Color(r,this.parent.evaluator);break;case "background":case "fixed":case "split":case "bold":case "italics":case "underlined":v[y]="true"===g[r];break;case "edges":"false"===g[r]?v[y]="":("true"===g[r]&&(r="808080"),v[y]=new a.Color(r,this.parent.evaluator));break;case "color":case "backcolor":v[y]=new a.Color(r,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":""!=
r&&(v[y]=this.parser.parse(r));break;case "family":case "parameter":case "font":case "font_family":case "name":case "inirot":case "endrot":case "info":v[y]=r;break;case "space":v.spaceID=r;break;case "expresion":"macro"!=v.type&&"curve"!=v.type&&"surface"!=v.type?(v.expresion=this.parser.parse(r),v.expresionString=r):v.expresion=r.replace(/\\n/g,";");break;case "text":v.text=r;break;case "file":e=r.replace(/&squot;/g,"'");"["===e.charAt(0)&&"]"===e.charAt(e.length-1)&&(e=e.substring(1,e.length-1));
e.match(/./)&&(e="'"+e+"'");v.file=this.parser.parse(e);break;default:void 0!==v.family&&q.substring(0,v.family.length+1)===v.family+"."?"interval"===g[q.substring(v.family.length+1)]?""!=r&&(v.family_interval=this.parser.parse(r)):""!=r&&(v.family_steps=this.parser.parse(r)):console.log("Propiedad del grafico 3D no identificada: <"+q+"> valor: <"+r+">")}switch(v.type){case "point":return new a.Point3D(this.parent,v);case "segment":return new a.Segment3D(this.parent,v);case "polygon":return new a.Polygon3D(this.parent,
v);case "curve":return new a.Curve3D(this.parent,v);case "triangle":return new a.Triangle3D(this.parent,v);case "face":return new a.Face3D(this.parent,v);case "polireg":return new a.Polireg3D(this.parent,v);case "surface":return new a.Surface3D(this.parent,v);case "text":return new a.Text3D(this.parent,v);case "cube":case "box":case "tetrahedron":case "octahedron":case "sphere":case "dodecahedron":case "icosahedron":case "ellipsoid":case "cone":case "cylinder":case "torus":case "mesh":return new a.OtherGeometry(this.parent,
v);case "macro":return new a.Macro3D(this.parent,v)}};a.LessonParser.prototype.parseAuxiliar=function(b){x={};b=this.split(b);for(var c=0,d=b.length;c<d;c++)b[c][1]=b[c][1].replace(/&squot;/g,"'");c=0;for(d=b.length;c<d;c++)switch(q=b[c][0],r=b[c][1],y=g[q],a.DEBUG.paramName=q,a.DEBUG.objectName="Auxiliar",y){case "info":case "code":x[y]=r;break;case "id":a.DEBUG.idName=r;case "file":case "init":case "doExpr":case "whileExpr":case "range":case "local":case "expresion":case "condition":case "parameter":x[y]=
r.replace(/&squot;/g,"'");break;case "editable":case "constant":case "array":case "matrix":case "algorithm":case "event":case "sequence":x[y]="true"===g[r];break;case "size":case "rows":case "columns":case "x":case "y":case "width":case "height":x[y]=this.parser.parse(r);break;case "evaluate":case "execution":case "msg_pos":case "action":case "type":x[y]=g[r];break;case "doc":break;default:var e=q.indexOf("."),f=g[q.substring(0,e)];e=g[q.substring(e+1)];"parameter"===f&&"font"===e?x.parameterFont=
r:console.log("Propiedad del auxiliar no identificada: <"+q+"> valor: <"+r+">")}x.sequence?x.type="sequence":x.constant?x.type="constant":x.algorithm&&x.evaluate?x.type="algorithm":x.array&&!x.matrix&&")"!=x.id.charAt(x.id.length-1)?x.type="vector":x.matrix&&")"!=x.id.charAt(x.id.length-1)?x.type="matrix":x.event&&")"!=x.id.charAt(x.id.length-1)?x.type="event":"library"===x.type?x.type="library":"jsfun"===x.type?x.type="jsfun":")"===x.id.charAt(x.id.length-1)?x.type="function":x.type="variable";a.DEBUG.typeName=
x.type;switch(x.type){case "sequence":new a.Function(this.parent,x);break;case "constant":b=new a.Constant(this.parent,x);x.evaluate&&"always"===x.evaluate&&this.parent.auxiliaries.push(b);break;case "algorithm":this.parent.auxiliaries.push(new a.Algorithm(this.parent,x));break;case "vector":b=new a.Vector(this.parent,x);x.evaluate&&"always"===x.evaluate&&this.parent.auxiliaries.push(b);break;case "matrix":b=new a.Matrix(this.parent,x);x.evaluate&&"always"===x.evaluate&&this.parent.auxiliaries.push(b);
break;case "event":this.parent.events.push(new a.Event(this.parent,x));break;case "library":new a.Library(this.parent,x);break;case "function":new a.Function(this.parent,x);break;case "variable":new a.Variable(this.parent,x);break;case "jsfun":new a.JsFunction(this.parent,x)}};a.LessonParser.prototype.parseAction=function(b){C=b.action;F=b.parent;H=b.parameter;if(C)switch(C){case "message":return new a.Message(F,H);case "calculate":return new a.Calculate(F,H);case "openURL":return new a.OpenURL(F,
H);case "openScene":return new a.OpenScene(F,H);case "about":return new a.About(F,H);case "config":return new a.Config(F,H);case "init":return new a.Init(F,H);case "clear":return new a.Clear(F,H);case "animate":return new a.Animate(F,H);case "initAnimation":return new a.InitAnimation(F,H);case "playAudio":return new a.PlayAudio(F,H);default:console.log("Accion no soportada: <"+C+">")}else return{execute:function(){}}};a.LessonParser.prototype.parseAnimation=function(b){var c={};b=this.split(b);for(var d=
0,e=b.length;d<e;d++)switch(q=b[d][0],r=b[d][1],y=g[q],y){case "id":case "delay":case "init":case "doExpr":case "whileExpr":c[y]=r.replace(/&squot;/g,"'");break;case "controls":case "auto":case "loop":case "algorithm":case "evaluate":c[y]="true"===g[r];break;default:console.log("Propiedad de la animacion no identificada: <"+q+">  <"+r+">")}return new a.Animation(this.parent,c)};a.LessonParser.prototype.parsePleca=function(g,n){g=this.split(g);f=k="";m=0;e="#536891";h="white";d="left";c="";u="SansSerif,BOLD,20";
l="SansSerif,PLAIN,18";b=void 0;for(var w=0,p=g.length;w<p;w++)switch(q=g[w][0],r=g[w][1],q){case "title":k=r;break;case "subtitle":f=r;break;case "subtitlines":m=r;break;case "bgcolor":""!=r&&(e=(new a.Color(r,this.parent.evaluator)).getColor());break;case "fgcolor":""!=r&&(h=(new a.Color(r,this.parent.evaluator)).getColor());break;case "align":""!=r&&(d=r);break;case "titleimage":c=r;break;case "titlefont":u=""!=r?a.convertFont(r):a.convertFont(u);break;case "subtitlefont":l=""!=r?a.convertFont(r):
a.convertFont(l);break;default:console.log("Propiedad de la pleca no identificada: <"+q+">  <"+r+">")}if(""===k&&""===f)return document.createElement("div");M=l.substring(0,l.indexOf("px"));M=M.substring(M.lastIndexOf(" "));""!=c&&(B=this.parent.getImage(c),D=B.height);b=document.createElement("div");b.setAttribute("id","descartesPleca");D?(b.setAttribute("style","position:absolute;left:0;top:0;text-align:"+d+";width:"+(n-30)+"px;height:"+(D-16)+"px;background:"+e+";color:"+h+";padding-top:8px;padding-bottom:8px;padding-left:15px;padding-right:15px;margin:0;overflow:hidden;z-index:100;"),
B.setAttribute("style","position: absolute;left:0;top:0;z-index:-1;width:100%;height:100%;"),b.appendChild(B)):b.setAttribute("style","position:absolute;left:0;top:0;text-align:"+d+";width:"+n+"px;background:"+e+";color:"+h+";padding-top:12px;padding-bottom:12px;padding-left:15px;padding-right:15px;margin:0;z-index:100;");J=document.createElement("div");J.setAttribute("style","padding:0;margin:0;font:"+u+";overflow:hidden;white-space:nowrap;");J.innerHTML=k;I=document.createElement("div");if(1===
parseInt(m)){T=0;O=document.createElement("div");O.innerHTML=f;document.body.appendChild(O);Q=M;do Q-=T,O.setAttribute("style","padding:0;margin:0;font:"+l+";font-size:"+Q+"px;width:"+(n-30)+"px;line-height:"+Q+"px;"),P=O.offsetHeight,U=P/Q,T=1;while(1<U&&8<Q);document.body.removeChild(O);I.setAttribute("style","padding:0;margin:0;font:"+l+";font-size:"+Q+"px;line-height: 110%;overflow:hidden;white-space:nowrap;")}else I.setAttribute("style","padding:0;margin:0;font:"+l+";line-height:110%;");I.innerHTML=
f;b.appendChild(J);b.appendChild(I);b.imageHeight=D;return b};a.LessonParser.prototype.split=function(a){if("string"!=typeof a)return[];a=(a||"").replace(/\\'/g,"\u2019");K=[];E=z=L=0;for(G=N=!1;E<a.length;)" "!==a.charAt(E)||G||E++," "===a.charAt(E)||G||(G=!0,L=E),"="!==a.charAt(E)||"'"!==a.charAt(E+1)||N||(N=!0,K[z]=[a.substring(L,E)],L=E+2,E+=2),N&&"'"===a.charAt(E)&&(G=N=!1,K[z].push(a.substring(L,E)),z++),"="!==a.charAt(E)||"'"===a.charAt(E+1)||N||(K[z]=[a.substring(L,E)],L=E+1,E++,S=a.substring(E).indexOf("="),
-1===S?R=S=a.length:(S+=E,R=a.substring(E,S).lastIndexOf(" "),R=-1===R?a.length:R+E),K[z].push(a.substring(L,R)),z++,G=!1,E=R),E++;return K};a.LessonParser.prototype.parseText=function(b){b=b||"";return b.match(/^\{\\rtf1/)?this.RTFparser.parse(b.substring(10)):new a.SimpleText(this.parent,b)};return a}(descartesJS||{},babel);
descartesJS=function(a){function g(a,b){if(0==b)return 1;if(0>b)return NaN;if(0<=a||Math.floor(b)===b)return Math.pow(a,b);if(0>a){var c=1/b,d=Math.floor(c);if(d===c&&1===d%2)return-Math.pow(-a,b)}return NaN}function k(a,b){r=[];r.type="matrix";r.rows=a;r.cols=b;p=0;for(v=b;p<v;p++){b=[];w=0;for(x=a;w<x;w++)b.push(0);r[p]=b}return r}function f(a,b){y=a.rows;q=a.cols;r=k(y,q);var c;for(p=0;p<y;p++)for(w=0;w<q;w++){for(v=c=0;v<q;v++)c+=a[v][p]*b[w][v];r[w][p]=c}return r}function m(a,b,c){for(var d=
k(c.length-1,c.length-1),e=0,f=d.length;e<f;e++)for(var l=0;l<f;l++)d[e][l]=e<a?l<b?c[e][l]:c[e][l+1]:e<b?c[e+1][l]:c[e+1][l+1];return d}function e(a){if(1<a.cols){for(var b=0,c=1,d=0,f=a.cols;d<f;d++)b+=c*a[0][d]*e(m(0,d,a)),c=-c;return b}return a[0][0]}if(a.loadLib)return a;var h,d={},c=Math.floor,u,l,b,n;a.fullDecimals=!1;a.Node=function(a,b){this.sep="";this.type=a;this.value=b;this.parent=null;this.childs=[]};a.Node.prototype.getRoot=function(){return null===this.parent?this:this.parent.getRoot()};
a.Node.prototype.addChild=function(a){a.parent=this;this.childs.push(a)};a.Node.prototype.replaceLastChild=function(a){u=this.childs.length-1;lastChild=this.childs[u];lastChild.parent=null;this.childs[u]=a;a.parent=this;return a};a.Node.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};a.Node.prototype.equalToMinus=function(){return"compOperator"===this.type?(this.type="operator",this.value="-",b=new a.Node("compOperator",
"=="),n=new a.Node("number","0"),b.addChild(this),b.addChild(n),l=this.getRoot(),l.setAllEvalFun(),l):this};a.Node.prototype.setAllEvalFun=function(){this.setEvalFun();for(var a=0,b=this.childs.length;a<b;a++)this.childs[a].setAllEvalFun()};a.Node.prototype.setEvalFun=function(){if("number"===this.type)this.evaluate=function(a){return parseFloat(this.value)};else if("string"===this.type)this.evaluate=function(a){return this.value.replace(/\\u0027/g,"'")};else if("identifier"===this.type&&0===this.childs.length)if("rnd"==
this.value)this.evaluate=function(a){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 l;this.evaluate=function(a){J=this.childs[0].childs[0].evaluate(a);
try{return l=a.vectors[this.value][0>J?0:c(J)],void 0!==l?l:0}catch(O){return 0}}}else if("identifier"===this.type&&"square_bracket"===this.childs[0].type&&1<this.childs[0].childs.length){var n,u;this.evaluate=function(a){n=this.childs[0].childs[0].evaluate(a);u=this.childs[0].childs[1].evaluate(a);try{return l=a.matrices[this.value][0>n?0:c(n)][0>u?0:c(u)],void 0!==l?l:0}catch(O){return 0}}}else if("identifier"===this.type&&"parentheses"===this.childs[0].type){var v,x,z;this.evaluate=function(a){v=
[];for(var b=0,c=this.childs[0].childs.length;b<c;b++)v[b]=this.childs[0].childs[b].evaluate(a);if("_Eval_"===this.value){h=0<v.length?v[0]:0;if("number"==typeof h)return"NaN";h.match(",")&&parseFloat(h.replace(",","."))==h.replace(",",".")&&(h=h.replace(",","."));if(void 0==d[h]){x=h.match(/:=/g)?!0:!1;if(h.match(";")){var e=!1,f=[],l=0;b=0;for(c=h.length;b<c;b++){var g=h.charAt(b);"'"===g&&(e=!e);e||";"!==g||(f.push(h.substring(l,b)),l=b+1)}f.push(h.substring(l));h="("+f.join(")(")+")"}d[h]=a.parser.parse(h,
x)}z=a.eval(d[h]);return void 0!=z?z:NaN}return a.functions[this.value].apply(a,v)}}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;y=c.rows;q=c.cols;r=k(y,q);for(p=0;p<y;p++)for(w=0;w<q;w++)r[w][p]=
c[w][p]+b[w][p];return r}:"-"===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;y=b.rows;q=b.cols;r=k(y,q);for(p=0;p<y;p++)for(w=0;w<q;w++)r[w][p]=b[w][p]-a[w][p];return r}:"*"===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=k(a.length,a.length),d=e(a);if(0===d)a=0;else{d=1/d;if(1<a.length)for(var l=0,g=a.length;l<g;l++){var n=d;for(var h=0;h<g;h++)c[h][l]=n*e(m(l,h,a)),n=-n;d=-d}else c[0][0]=d;a=c}b=0===a?k(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-c(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)?1:0}:"<="===this.value?this.evaluate=function(a){return this.childs[0].evaluate(a)<=this.childs[1].evaluate(a)?1:0}:">"===this.value?this.evaluate=function(a){return this.childs[0].evaluate(a)>this.childs[1].evaluate(a)?1:0}:">="===this.value?this.evaluate=function(a){return this.childs[0].evaluate(a)>=
this.childs[1].evaluate(a)?1:0}:"=="===this.value?this.evaluate=function(a){return this.childs[0].evaluate(a)===this.childs[1].evaluate(a)?1:0}:"!="===this.value&&(this.evaluate=function(a){return this.childs[0].evaluate(a)!==this.childs[1].evaluate(a)?1:0});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)?0:1});else if("conditional"===this.type)this.evaluate=function(a){return 0<this.childs[0].evaluate(a)?this.childs[1].evaluate(a):this.childs[2].evaluate(a)};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 e=[];for(var f=0,l=this.childs[d].childs.length;f<l;f++)e.push(this.childs[d].childs[f].evaluate(a));c[d]=e}return c};else if("asign"===this.type){var G,L,N,M,B=this.childs[0],D=this.childs[1];var J=B.childs[0]?B.childs[0].childs:null;this.evaluate=1===B.childs.length&&"square_bracket"===
B.childs[0].type&&1===J.length?function(a){G=J[0].evaluate(a);G=0>G?0:c(G);M=D.evaluate(a);return a.vectors[B.value][G]=M}:1===B.childs.length&&"square_bracket"===B.childs[0].type&&2===J.length?function(a){L=J[0].evaluate(a);N=J[1].evaluate(a);L=0>L?0:c(L);N=0>N?0:c(N);a.matrices[B.value][L]||(a.matrices[B.value][L]=[]);M=D.evaluate(a);return a.matrices[B.value][L][N]=M}:function(a){M=D.evaluate(a);return M.type?a.matrices[B.value]=M:"object"!==typeof a.variables[B.value]?a.variables[B.value]=M:0}}};
var y,q,r,w,p,v,x;a.Node.prototype.toString=function(){var a="tipo: "+this.type+", valor: "+this.value+"\n";this.sep="   "+(this.parent?this.parent.sep:"");for(var b=0,c=this.childs.length;b<c;b++)a+=this.sep+this.childs[b].toString();return a};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,k,f,m,e,h,d,c,u,l=/^\s+/,b=/^[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]*)*/,n=/^[0-9]+[.][0-9]+|^[.][0-9]+|^[0-9]+/,y=/^==|^!=|^<=|^<|^>=|^>|^#/,q=/^!|^~|^&&|^&|^\|\||^\|/,r=/^=|^:=/,w=/^[\?:]/,p=/^[\+\-\*\/%\^\u2212\u00b7\u00D7\u00F7]/,v=/^\[|^\]/,x=/^\(|^\)/,A=/^,/,C=/^;/,F=/\|/g,H=/\|\*/g,K=/\*\|/g;a.Tokenizer=function(){};a.Tokenizer.prototype.tokenize=function(z){function E(a,
b,d){k.push({type:a,value:b});h=h.slice(d);m+=d;c++;u=a}if(g=z){var G=z.indexOf("//");0<=G&&":"!==z[G-1]&&(z=z.substring(0,G));z=z.replace(/\\u(\S+) /g,function(a,b){return 39!==parseInt(b,16)?String.fromCharCode(parseInt(b,16)):a});z=z.replace(/&sup(.+);/g,"^ $1 ");z=z.replace(/&squot;/g,"'");z.match(/=\|\*/g)&&(z=z.replace(H,"'").replace(K,"'"));z.match(/=\|/g)&&(z=z.replace(F,"'"));G=z.trim();"|"==G.charAt(0)&&"|"==G.charAt(G.length-1)&&(z=G.replace(F,"'"))}k=[];f=!1;m=0;h=z;c=0;for(u="";z&&m<
z.length;)if(f=m,"'"==h[0]){for(d=1;"'"!=h[d];)if(d<h.length)d++;else{console.info(">Error, unknown symbol: ["+h+"], in the string \u300a"+g+"\u300b");return}e=h.substring(1,d);E("string",e,e.length+2)}else if(e=h.match(l))h=h.slice(e[0].length),m+=e[0].length,c++;else if(e=h.match(p))e[0]=e[0].replace(/\u00F7/g,"/").replace(/\u2212/g,"-").replace(/\u00b7/g,"*").replace(/\u00D7/g,"*"),E("operator",e[0],e[0].length);else if(e=h.match(b))"number"===u&&k.push({type:"operator",value:"*"}),E("identifier",
e[0],e[0].length);else if(e=h.match(n))E("number",e[0],e[0].length);else if(e=h.match(y))G=e[0],"#"==G&&(G="!="),E("compOperator",G,e[0].length);else if(e=h.match(q))G=e[0],"||"==G?G="|":"&&"==G?G="&":"~"==G&&(G="!"),E("boolOperator",G,e[0].length);else if((e=h.match(r))&&!h.match(/^==/))E("asign",e[0],e[0].length);else if(e=h.match(w))E("conditional",e[0],e[0].length);else if(e=h.match(v))E("square_bracket",e[0],e[0].length);else if(e=h.match(x))"("==e&&"number"===u&&k.push({type:"operator",value:"*"}),
E("parentheses",e[0],e[0].length);else if(e=h.match(A))E("separator",e[0],e[0].length);else if(178===h.charCodeAt(0))k.push({type:"operator",value:"^"}),E("number",2,1);else if(179===h.charCodeAt(0))k.push({type:"operator",value:"^"}),E("number",3,1);else if(e=h.match(C))E("final_of_expresion",e[0],e[0].length);else if(f==m){a.DEBUG.setError(a.DEBUG.EXPRESSION,g);return}return k};var E,z=/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/;
a.Tokenizer.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(z)?E+a[c].value:E+b+a[c].value;return E};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 k(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-_Load_-_GetValues_-_GetMatrix_-_MatrixToStr_-_StrToMatrix_-_GetVector_-_VectorToStr_-_StrToVector_-_ExecStr_-_ExecBlock_-_Save_-_Open_-_SaveState_-_OpenState_-_AnchoDeCadena_-_strWidth_-_Rojo_-_Red_-_Verde_-_Green_-_Azul_-_Blue_-DJS.typeof-");
var f=Date.now();a.Parser=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()};a.Parser.prototype.setDefinition=function(a,b){this.definitions[a]=b};a.Parser.prototype.getDefinition=function(a){return this.definitions[a]};a.Parser.prototype.setVariable=function(a,b){this.variables[a]=b};a.Parser.prototype.getVariable=
function(a,b){b&&(this.variables[a]=void 0!==this.variables[a]?this.variables[a]:void 0);return this.variables[a]};a.Parser.prototype.setVector=function(a,b,c){this.vectors[a][b]=c};a.Parser.prototype.getVector=function(a){this.vectors.hasOwnProperty(a)||(this.vectors[a]=[0,0,0]);return this.vectors[a]};a.Parser.prototype.setMatrix=function(a,b,c,d){this.matrices[a][b][c]=d};a.Parser.prototype.getMatrix=function(a){this.matrices.hasOwnProperty(a)||(this.matrices[a]=[[0,0,0],[0,0,0],[0,0,0]]);return this.matrices[a]};
a.Parser.prototype.setFunction=function(a,b){this.functions[a]=b};a.Parser.prototype.getFunction=function(a){this.functions.hasOwnProperty(a)||(this.functions[a]=function(){return 0});return this.functions[a]};var m,e,h,d,c,u,l,b,n,y,q,r;a.Parser.prototype.parse=function(f,k){(h=this.tokenizer.tokenize(f))||(h=[]);d=null;k=!k||!1;m=b=l=u=0;for(e=h.length;m<e;m++){n=h[m];y=n.value;q=n.type;if("identifier"===q)if(m+1<e&&"parentheses"===h[m+1].type&&"("===h[m+1].value)this.getFunction(y);else if(m+1<
e&&"square_bracket"===h[m+1].type&&"["===h[m+1].value)h[m+3]&&"square_bracket"===h[m+3].type&&"]"===h[m+3].value?this.getVector(y):this.getMatrix(y);else{var w=y.match(/(\w*)\.mouse_x|(\w*)\.mouse_y|(\w*)\.mouse_pressed|(\w*)\.mouse_clicked|(\w*)\.clic_izquierdo/);w&&(this.variables[(w[1]||w[2]||w[3]||w[4]||w[5])+".DESCARTESJS_no_fixed"]=1);this.getVariable(y,!0)}"asign"===q&&k&&":="!=y&&(q="compOperator",y="==");if("asign"===q)if(c=new a.Node(q,y),null!=d)if("identifier"===d.type)d.parent&&d.parent.replaceLastChild(c),
c.addChild(d),d=c,k=!0;else if("square_bracket"===d.type)c.addChild(d.parent),d=c,k=!0;else{c.type="compOperator";c.value="==";for(k=!0;d.parent&&g(d.parent.value)>=g(c.value);)d=d.parent;d.parent&&d.parent.replaceLastChild(c);c.addChild(d);d=c}else{console.info("Error1: en la expresion \u300a "+f+" \u300b, en el token {valor: "+y+", tipo: "+q+"}");break}else if("parentheses"===q&&"("===y||"square_bracket"===q&&"["===y)if(c=new a.Node(q,y),"("===y&&u++,"["===y&&l++,null===d)"("===y&&(new a.Node("(expr)",
"(expr)")).addChild(c),"["===y&&(new a.Node("[expr]","[expr]")).addChild(c),d=c;else if("operator"===d.type||"boolOperator"===d.type||"compOperator"===d.type||"conditional"===d.type||"asign"===d.type)d.addChild(c),d=c;else if("sign"===d.type)d.addChild(c),d=c;else if("parentheses"===d.type&&"("===d.value)d.addChild(c),d=c;else if("square_bracket"===d.type&&"["===d.value)d.addChild(c),d=c;else if("parentheses"===d.type&&"()"===d.value)d.parent.addChild(c),d=c;else if("square_bracket"===d.type&&"[]"===
d.value)d.parent.addChild(c),d=c;else if("identifier"===d.type)d.addChild(c),d=c;else{console.info("Error2: en la expresion \u300a "+f+" \u300b, en el token ["+m+"] {valor: "+y+", tipo: "+q+"}");break}else if("parentheses"===q&&")"===y)if(u--,null===d)console.info("Error3: en la expresion \u300a "+f+" \u300b, en el token (valor:"+y+", tipo:"+q);else{for(;d&&d.parent&&("("!=d.value||"("==d.value&&"parentheses"!=d.type);)d=d.parent;if(d&&"("===d.value)d.value="()";else break}else if("square_bracket"===
q&&"]"===y)if(l--,null===d)console.info("Error5: en la expresion \u300a "+f+" \u300b, en el token (valor:"+y+", tipo:"+q);else{for(;d&&d.parent&&("["!=d.value||"["==d.value&&"square_bracket"!=d.type);)d=d.parent;if(d&&"["===d.value)d.value="[]";else{console.info("Error6: en la expresion \u300a "+f+" \u300b, en el token {valor: "+y+", tipo: "+q+"}");break}}else if("number"===q||"string"===q||"identifier"===q)if(c=new a.Node(q,y),null===d)d=c;else if("operator"===d.type||"compOperator"===d.type||"boolOperator"===
d.type||"parentheses"===d.type&&"("===d.value||"square_bracket"===d.type&&"["===d.value||"sign"===d.type||"conditional"===d.type||"asign"===d.type)d.addChild(c),d=c;else{a.DEBUG.setError(a.DEBUG.EXPRESSION,f);break}else if("operator"===q||"compOperator"===q||"boolOperator"===q)if(c=new a.Node(q,y),null===d)if("-"===y||"+"===y)c.type="sign",c.value="sign"+y,d=c;else if("!"===y)d=c;else{console.info("Error8: en la expresion \u300a "+f+" \u300b, en el token {valor: "+y+", tipo: "+q+"}");break}else if("operator"===
d.type||"compOperator"===d.type||"boolOperator"===d.type||"asign"===d.type||"conditional"===d.type||"square_bracket"===d.type&&"["===d.value&&("-"===y||"+"===y||"!"===y)||"parentheses"===d.type&&"("===d.value&&("-"===y||"+"===y||"!"===y)){if("-"===y||"+"===y)c.type="sign",c.value="sign"+y;d.addChild(c);d=c}else if("number"===d.type||"parentheses"===d.type&&"()"===d.value||"square_bracket"===d.type&&"[]"===d.value||"string"===d.type||"identifier"===d.type||"conditional"===d.type||"asign"===d.type){for(;d.parent&&
g(d.parent.value)>=g(c.value);)d=d.parent;d.parent&&d.parent.replaceLastChild(c);c.addChild(d);d=c}else{console.info("Error9: en la expresion \u300a "+f+" \u300b, en el token {valor: "+y+", tipo: "+q+"}");break}else if("conditional"===q)if(c=new a.Node(q,y),null!=d)if("?"===c.value){for(b++;d.parent&&g(d.parent.value)>g(c.value);)d=d.parent;d.parent&&d.parent.replaceLastChild(c);c.addChild(d);d=c}else{for(b--;d&&d.parent&&("?"!=d.value||"?"==d.value&&"conditional"!=d.type);)d=d.parent;if(d&&"?"===
d.value)d.value="?:";else{console.info("Error10: en la expresion \u300a "+f+" \u300b, en el token {valor: "+y+", tipo: "+q+"}");break}}else{console.info("Error11: en la expresion \u300a "+f+" \u300b, en el token {valor: "+y+", tipo: "+q+"}");break}else if("separator"===q)if(null!=d)for(;d.parent&&"("!=d.value&&"["!=d.value;)d=d.parent;else{console.info("Error12: en la expresion \u300a "+f+" \u300b, en el token {valor: "+y+", tipo: "+q+"}");break}else{console.info("Error13: en la expresion \u300a "+
f+" \u300b, en el token {valor: "+y+", tipo: "+q+"}");break}}0<u&&a.DEBUG.setError(a.DEBUG.PARENTHESIS_CLOSING,f);0>u&&a.DEBUG.setError(a.DEBUG.PARENTHESIS_OPENING,f);0<l&&a.DEBUG.setError(a.DEBUG.BRACKET_CLOSING,f);0>l&&a.DEBUG.setError(a.DEBUG.BRACKET_OPENING,f);0!=b&&a.DEBUG.setError(a.DEBUG.INCOMPLETE_IF,f);(r=d?d.getRoot():null)&&r.setAllEvalFun();return r};a.Parser.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;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,e){return a.esCorrecto(c,d,b.evaluator,e)};b.functions.escorrecto=function(c,d,e){return a.escorrecto(c,d,b.evaluator,e)};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);return a};b.functions.toLowerCase=function(a){return(a||"").toString().toLowerCase()};b.functions.toUpperCase=function(a){return(a||"").toString().toUpperCase()};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 e="<"+c+">\\n",f=b.getVariable(c+".columnas_usadas")||d.cols||0,l=b.getVariable(c+".filas_usadas")||d.rows||0,g,n=0;n<f;n++){for(var k=0;k<l;k++)g=d[n][k],void 0!==g&&("string"==typeof g?g="'"+g+"'":"number"==typeof g&&(g=a.removeNeedlessDecimals(g.toFixed(6))),
e+=g+(k<l-1?" \u00a6 ":""));e=e.replace(/(\u00A6 )$/g,"")+"\\n"}return e+"</"+c+">"}return""};b.functions._StrToMatrix_=function(a,c){var d=[],e=!1,f=!1;d.type="matrix";if(a){a=a.replace(/\r|\\r/g,"").split(/\n|\\n/);for(var l=0,g=a.length;l<g;l++)a[l].match("<"+c+">")?(f=!0,e=a[l].trim().split("<"+c+">"),2==e.length&&""!=e[1]&&d.push(e[1].split(String.fromCharCode("166")).map(k)),e=!0):(a[l].match("</"+c+">")&&(e=a[l].trim().split("</"+c+">"),2==e.length&&""!=e[0]&&d.push(e[0].split(String.fromCharCode("166")).map(k)),
e=!1,l=a.length),e&&d.push(a[l].split(String.fromCharCode("166")).map(k)));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",e=b.getVariable(a+
".long_usada")||c._size_||0,f,l=0;l<e;l++)f=c[l],void 0!==f?("number"==typeof f&&(f=parseFloat(f)),d+=f+"\\n"):d+="0\\n";return d+"</"+a+">"}return""};b.functions._StrToVector_=function(a,c){var d=[],e=!1,f=!1;d.type="vector";if(a){a=a.replace(/\r|\\r/g,"").split(/\n|\\n/);for(var l=0,g=a.length;l<g;l++)a[l].match("<"+c+">")?e=f=!0:(a[l].match("</"+c+">")&&(e=!1,l=a.length),e&&d.push(k(a[l])));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=[],e=""==c;if(a){a=a.replace(/\r|\\r/g,"").split(/\n|\\n/);for(var f=0,l=a.length;f<l;f++)a[f].match("<"+c+">")?(e=a[f].trim().split("<"+c+">"),2==e.length&&""!=e[1]&&(d=d.concat(e[1].split(String.fromCharCode("166")))),e=!0):a[f].match("</"+c+">")?(e=a[f].trim().split("</"+c+">"),2==e.length&&""!=e[0]&&(d=d.concat(e[0].split(String.fromCharCode("166")))),e=!1):e&&(d=d.concat(a[f].split(String.fromCharCode("166"))));
f=0;for(l=d.length;f<l;f++)e=d[f].split("="),e[0]=e[0].trim(),2==e.length&&""!=e[0]&&(isNaN(parseFloat(e[1]))?b.setVariable(e[0],e[1].replace(/^\s|\s$/g,"").replace(/^'|'$/g,"")):b.setVariable(e[0],parseFloat(e[1])))}return 0};var c=document.createElement("a");c.setAttribute("target","_blank");var d,e=null;a.newBlobContent=null;b.functions._Save_=function(l,g){b.evaluator.parent.removeButtonClick();1500<Date.now()-f&&(f=Date.now(),document.body.appendChild(c),e=g.replace(/\\r/g,"").replace(/\\n/g,
"\r\n").replace(/\\q/g,"'").replace(/\\_/g,"\\"),d=new Blob(["\ufeff",e],{type:"text/plain;charset=utf-8"}),c.setAttribute("href",window.URL.createObjectURL(d)),c.setAttribute("download",l),e!=a.newBlobContent&&(c.click(),a.newBlobContent=e),document.body.removeChild(c));return 0};var l,g,n=document.createElement("input");n.setAttribute("type","file");n.addEventListener("change",function(c){l=c.target.files;g=new FileReader;g.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());n.value=""};0<l.length&&g.readAsText(l[0])});b.functions._Open_=function(a){b.evaluator.parent.removeButtonClick();1500<Date.now()-f&&(b._callback=a,n.click(),f=Date.now());return 0};b.functions._AnchoDeCadena_=b.functions._strWidth_=function(b,c,d,e){return a.getTextWidth(b,a.convertFont(c+","+d+","+e))};
b.functions._Rojo_=b.functions._Red_=function(b){return(new a.Color(b)).r/255};b.functions._Verde_=b.functions._Green_=function(b){return(new a.Color(b)).g/255};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}};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.floor;a.Evaluator=function(g){this.parent=g;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};a.Evaluator.prototype.setDefinition=function(a,f){this.definitions[a]=f};a.Evaluator.prototype.getDefinition=function(a){return this.definitions[a]};a.Evaluator.prototype.setVariable=function(a,
f){this.variables[a]=f};a.Evaluator.prototype.getVariable=function(a){return this.variables[a]};a.Evaluator.prototype.setVector=function(a,f,m){f=0>f?0:g(f);this.vectors[a][f]=m};a.Evaluator.prototype.getVector=function(a,f){f=0>f?0:g(f);return this.vectors[a][f]};a.Evaluator.prototype.setMatrix=function(a,f,m,e){f=0>f?0:g(f);m=0>m?0:g(m);this.matrices[a][f][m]=e};a.Evaluator.prototype.getMatrix=function(a,f,m){f=0>f?0:g(f);m=0>m?0:g(m);return this.matrices[a][f][m]};a.Evaluator.prototype.setFunction=
function(a,f){this.functions[a]=f};a.Evaluator.prototype.getFunction=function(a){return this.functions[a]};a.Evaluator.prototype.eval=function(a){return a?a.evaluate(this):0};a.externalEvaluator=new a.Evaluator;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.TextObject=function(g,k){this.parent=g;this.evaluator=g.evaluator;this.decimals=g.decimals;this.fixed=g.fixed;this.align=g.align||"left";this.anchor=g.anchor||"a_top_left";this.decimal_symbol=g.parent.decimal_symbol;this.h=this.w=100;this.hasContent=""!==k;this.textStr=(k||"").replace(/\\{/g,"\\curlyBracketOpen ").replace(/\\}/g,"\\curlyBracketClose ").replace(/\\\[/g,"\\squareBracketOpen ").replace(/\\\]/g,"\\squareBracketClose ");this.oldPoxY=this.oldPosX=
this.oldColor=this.oldSize=this.oldWidth=this.oldTextStr=null;k.match(/^\{\\rtf1/)?(this.type="rtfNode",this.text=k,this.textNodes=(new a.RTFParser(g.evaluator)).parse(k.substring(10))):(this.descarTeXParser=new a.DescarTeXParser,this.text=this.parseSimpleText(this.textStr),this.textNodes=new a.TextNode("","textLineBlock",null,null))};a.TextObject.prototype.draw=function(a,k,f,m,e){"rtfNode"===this.type?this.drawRTF(a,k,f,m,e):this.drawText(a,k,f,m,e)};a.TextObject.prototype.drawText=function(g,k,
f,m,e){var h=this.evaluator.eval(this.decimals),d=this.evaluator.eval(this.parent.width),c=this.evaluator.eval(this.parent.font_size);k=k.getColor?k.getColor():k;var u=this.textToString(this.text,h,this.fixed).replace(/\\{/g,"\\curlyBracketOpen ").replace(/\\}/g,"\\curlyBracketClose ").replace(/\\\[/g,"\\squareBracketOpen ").replace(/\\\]/g,"\\squareBracketClose ");0<=u.indexOf("[")&&(u=this.textToString(this.parseSimpleText(u),h,this.fixed));if(this.oldTextStr!==u||this.oldWidth!==d||this.oldSize!==
c||this.oldColor!==k||this.oldPosX!==f||this.oldPoxY!==m){var l=new a.TextStyle({size:c,family:this.parent.font_family||"arial",italic:this.parent.italics||!1,bold:this.parent.bold||!1,color:k,align:this.align,border:this.parent.border});this.textNodes=this.descarTeXParser.parse(u,this.evaluator,l);this.textNodes.update(f,m,h,this.fixed,this.align,this.anchor,k,d)}e||this.textNodes.draw(g);this.oldTextStr=u;this.oldWidth=d;this.oldSize=c;this.oldColor=k;this.oldPosX=f;this.oldPoxY=m};a.TextObject.prototype.drawRTF=
function(a,k,f,m,e){k=k.getColor?k.getColor():k;a.fillStyle=k;a.strokeStyle=k;a.textBaseline="alphabetic";this.textNodes.style.align!==this.align&&this.textNodes.propagateStyle("align",this.align);this.textNodes.update(f,m,this.evaluator.eval(this.decimals),this.fixed,this.align,this.anchor,k,this.evaluator.eval(this.parent.width));e||this.textNodes.draw(a)};a.TextObject.prototype.parseSimpleText=function(a){a=a.replace("&#x2013","\u2013").replace(/&squot;/g,"'");for(var g=[],f="'",m=0,e=0,h=-1,d,
c,u=a.length;m<u;)d=a.charAt(m),c=a.charAt(m-1),"["===d&&"\\"===c?(g.push(a.substring(e,m-1)+"["),e=m+1):"]"===d&&"\\"===c?(g.push(a.substring(e,m-1)+"]"),e=m+1):"["===d&&-1===h?(g.push(a.substring(e,m)),e=m,h++):"["===d?h++:"]"===d&&0===h?(g.push(this.evaluator.parser.parse(a.substring(e,m+1))),e=m+1,h--):("]"==a.charAt(m)&&(h=0>h?h:h-1),f+=a.charAt(m)),m++;g.push(a.substring(e,m));return g};a.TextObject.prototype.textToString=function(g,k,f){var m="";if("rtfNode"!==g.type)for(var e,h=0,d=g.length;h<
d;h++)"string"===typeof g[h]?m+=g[h]:(e=this.evaluator.eval(g[h])[0][0],""!==e&&("string"===typeof e?m+=e:Infinity===e?m+="Infinity":-Infinity===e?m+="-Infinity":isNaN(e)||"NaN"===e?m+="NaN":(e=parseFloat(e),e=f?e.toFixed(k):a.removeNeedlessDecimals(e.toFixed(k)),m+=e.toString().replace(".",this.decimal_symbol))));return m};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.DescarTeXTokenizer=function(){};a.DescarTeXTokenizer.prototype.tokenize=function(a){a=a.replace(/\\n/g,"\\newline ");var g=[],f=null,m=0,e=a.length;a.charAt(0);var h=!1,d=!1,c=0;newInput="";for(var u=0;u<e;u++){var l=a.charAt(u);var b=a.charAt(u+1);"\\"===l&&"$"===b&&(d=!0);"{"===l?c++:"}"===l&&(c--,d&&0===c&&(d=!1));d?"_"===l?"{"===b?newInput+="\\subindex":(newInput+="\\subindex{"+b+"}",u++):"^"===l?"{"===b?newInput+="\\superindex":(newInput+="\\superindex{"+
b+"}",u++):newInput+=l:newInput+=l}a=newInput;b=a.charAt(0);for(e=a.length;m<e;)l=b,b=a.charAt(m+1),h&&("{"===l||"["===l||"\\"===l||" "===l?(h=!1," "===l&&(f={type:"ignore"},g.push(f))):f.value+=l),h||"\\"!==l?h||"{"!==l&&"["!==l?h||"}"!==l&&"]"!==l?h||(f&&"text"===f.type?f.value+=l:f&&"ignore"===f.type?(g.pop(),f=g[g.length-1]):(f={type:"text",value:l},g.push(f))):(f={type:"close",value:l},g.push(f)):(f={type:"open",value:l},g.push(f)):(h=!0,f={type:"command",value:""},g.push(f)),m++;return g};return a}(descartesJS||
{});
descartesJS=function(a){if(a.loadLib)return a;a.DescarTeXParser=function(){this.tokenizer=new a.DescarTeXTokenizer};a.DescarTeXParser.prototype.parse=function(g,k,f){g=this.tokenizer.tokenize(g);var m=new a.TextNode("","textBlock",f,null),e=new a.TextNode("","textLineBlock",f.clone(),null);m.addChild(e);for(var h=[],d=null,c=f,u=[f],l,b,n,y=!1,q=0,r=g.length;q<r;q++)if("text"===g[q].type)if("textLineBlock"===e.nodeType)if("color_parameter"===d)b=new a.Color(g[q].value,k);else{l=g[q].value.split(" ");for(var w=
0,p=l.length;w<p;w++)""!==l[w]&&e.addChild(new a.TextNode(l[w],"text",c.clone(),null)),w+1<p&&e.addChild(new a.TextNode(" ","space",c.clone(),null))}else e.addChild(new a.TextNode(g[q].value,"text",c.clone(),null));else if("command"===g[q].type&&"curlyBracketOpen"===g[q].value)e.addChild(new a.TextNode("{","text",c.clone(),null));else if("command"===g[q].type&&"curlyBracketClose"===g[q].value)e.addChild(new a.TextNode("}","text",c.clone(),null));else if("command"===g[q].type&&"squareBracketOpen"===
g[q].value)e.addChild(new a.TextNode("[","text",c.clone(),null));else if("command"===g[q].type&&"squareBracketClose"===g[q].value)e.addChild(new a.TextNode("]","text",c.clone(),null));else if("command"===g[q].type&&"newline"===g[q].value)0===e.children.length&&e.addChild(new a.TextNode("","text",c.clone(),null)),e=new a.TextNode("","textLineBlock",f.clone(),null),m.addChild(e);else if("command"===g[q].type&&"b"===g[q].value)d="bold",h.push(d);else if("command"===g[q].type&&"i"===g[q].value)d="italic",
h.push(d);else if("command"===g[q].type&&"color"===g[q].value)d="color",h.push(d);else if("command"===g[q].type&&"c"===g[q].value)d="center",h.push(d);else if("command"===g[q].type&&"l"===g[q].value)d="left",h.push(d);else if("command"===g[q].type&&"r"===g[q].value)d="right",h.push(d);else if("command"===g[q].type&&"j"===g[q].value)d="justify",h.push(d);else if("command"===g[q].type&&"$"===g[q].value)d="formula",h.push(d),y=!0;else if("command"===g[q].type&&"sum"===g[q].value)d="sum",h.push(d);else if("command"===
g[q].type&&"int"===g[q].value)d="integral",h.push(d);else if("command"===g[q].type&&"lim"===g[q].value)d="limit",h.push(d);else if("command"===g[q].type&&"sqrt"===g[q].value)d="radical",h.push(d);else if("command"===g[q].type&&"subindex"===g[q].value)d="subIndex",h.push(d);else if("command"===g[q].type&&"superindex"===g[q].value)d="superIndex",h.push(d);else if("command"===g[q].type&&"frac"===g[q].value)d="numerator",h.push(d);else if("open"===g[q].type&&"{"===g[q].value&&null!==d)"bold"===d||"italic"===
d?(newStyle=c.clone(),newStyle[d]=!0,u.push(newStyle),c=newStyle):"color"===d?d="color_parameter":"color_text"===d?(newStyle=c.clone(),newStyle.color=b,u.push(newStyle),c=newStyle):"center"===d||"left"===d||"right"===d||"justify"===d?(newStyle=c.clone(),newStyle.align=d,u.push(newStyle),c=newStyle,e=new a.TextNode("","textLineBlock",c.clone(),null),m.addChild(e)):"formula"===d?(newStyle=c.clone(),newStyle.italic=!0,u.push(newStyle),c=newStyle,n=new a.TextNode("","formula",c.clone(),null),e.addChild(n),
e=n):"subIndex"===d||"superIndex"===d?y?(newStyle=c.clone(),u.push(newStyle),c=newStyle,n=new a.TextNode("",d,c.clone(),null),e.addChild(n),e=n):e.addChild(new a.TextNode("subIndex"===d?"_":"^","text",c.clone(),null)):"radical"===d?y&&(n=new a.TextNode("","radical",c.clone(),null),e.addChild(n),e=n,newStyle=c.clone(),u.push(newStyle),c=newStyle,n=new a.TextNode("","index",c.clone(),null),e.addChild(n),e=n,d="index"):"index"===d?y&&(u.pop(),c=u[u.length-1],n=new a.TextNode("","radicand",c.clone(),
null),e.addChild(n),e=n,d="radicand"):"sum"===d||"integral"===d||"limit"===d?y&&(n=new a.TextNode("",d,c.clone(),null),e.addChild(n),e=n,newStyle=c.clone(),u.push(newStyle),c=newStyle,n=new a.TextNode("","from",c.clone(),null),e.addChild(n),e=n,d="from"):"from"===d?y&&(n=new a.TextNode("","to",c.clone(),null),e.addChild(n),e=n,d="to"):"to"===d?y&&(u.pop(),c=u[u.length-1],n=new a.TextNode("","what",c.clone(),null),e.addChild(n),e=n,d="what"):"numerator"===d?y&&(n=new a.TextNode("","fraction",c.clone(),
null),e.addChild(n),e=n,newStyle=c.clone(),u.push(newStyle),c=newStyle,n=new a.TextNode("","numerator",c.clone(),null),e.addChild(n),e=n,d="numerator"):"denominator"===d&&(n=new a.TextNode("",d,c.clone(),null),e.addChild(n),e=n);else if("close"===g[q].type&&"}"===g[q].value&&null!==d){if("bold"===d||"italic"===d||"color_text"===d||"color"===d)u.pop(),c=u[u.length-1],h.pop(),d=h[h.length-1];else if("color_parameter"===d)d="color_text";else if("center"===d||"left"===d||"right"===d||"justify"===d)u.pop(),
c=u[u.length-1],h.pop(),d=h[h.length-1],g[q+1]&&"command"===g[q+1].type&&"newline"===g[q+1].value?e=m:(e=new a.TextNode("","textLineBlock",c.clone(),null),m.addChild(e));"formula"===e.nodeType?(y=!1,u.pop(),c=u[u.length-1],h.pop(),d=h[h.length-1],e=e.parent):"subIndex"===e.nodeType||"superIndex"===e.nodeType?y&&(u.pop(),c=u[u.length-1],h.pop(),d=h[h.length-1],e=e.parent):"index"===e.nodeType?e=e.parent:"radicand"===e.nodeType?(h.pop(),d=h[h.length-1],e=e.parent.parent):"from"===e.nodeType?e=e.parent:
"to"===e.nodeType?e=e.parent:"what"===e.nodeType?(h.pop(),d=h[h.length-1],e=e.parent.parent):"numerator"===e.nodeType?(d="denominator",e=e.parent):"denominator"===e.nodeType&&(u.pop(),c=u[u.length-1],h.pop(),d=h[h.length-1],e=e.parent.parent)}else"open"===g[q].type&&"{"===g[q].value&&null===d?e.addChild(new a.TextNode("{","text",c.clone(),null)):"close"===g[q].type&&"}"===g[q].value&&null===d&&e.addChild(new a.TextNode("}","text",c.clone(),null));var v,x,A=null,C=[];m.children.forEach(function(a){for(var b=
0,c=a.children.length;b<c-1;b++)v=a.children[b],x=a.children[b+1],"text"===v.nodeType&&"text"===x.nodeType?(null===A&&(A=v,n=v.clone(),A.changeNodeType("word"),A.value="___"+n.value,A.addChild(n)),n=x.clone(),A.addChild(n),C.push(x),A.value+=n.value):A=null});C.forEach(function(a){a.parent.removeChild(a)});m.adjustFontSize();return m.normalize()};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,k=[a.sansserif_font,a.serif_font,a.monospace_font];a.TextStyle=function(a){this.size=20;this.family="Arimo";this.overline=this.underline=this.bold=this.italic=!1;this.color=null;this.align="left";this.border=null;a=a||{};this.set(a)};a.TextStyle.prototype.clone=function(){var f={},g;for(g in this)this.hasOwnProperty(g)&&(f[g]=this[g]);return new a.TextStyle(f)};a.TextStyle.prototype.set=function(a){for(var f in a)a.hasOwnProperty(f)&&(this[f]=a[f])};
a.TextStyle.prototype.equals=function(a){var f=!0,e;for(e in this)this.hasOwnProperty(e)&&(f=f&&this[e]===a[e]);return f};a.TextStyle.prototype.toString=function(){/arial|sansserif/i.test(this.family)?g=k[0]:/times|serif/i.test(this.family)?g=k[1]:/courier|monospaced/i.test(this.family)&&(g=k[2]);return((this.bold?"bold":"")+" "+(this.italic?"italic":"")+" "+this.size+"px "+g).trim()};return a}(descartesJS||{});
descartesJS=function(a){function g(a,b){for(var c=0,d=0;d<b;d++)c+=a[d];return c}function k(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((u[a].ascent+25)*c/u[a].unitsPerEm);b.descent=Math.ceil(Math.abs((u[a].descent-25)*c/u[a].unitsPerEm));b.h=b.ascent+b.descent;return b}if(a.loadLib)return a;
a.auxCtx=document.createElement("canvas").getContext("2d");var f="#000000",m=2,e=!1,h=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");h.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";var d=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");
d.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";var c=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");c.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";
a.TextNode=function(a,b,c,d){this.type="rtfNode";this.evaluator=d;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=a;this.style=c;this.changeNodeType(b);this.drawBorder=function(){}};a.TextNode.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 "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}};a.TextNode.prototype.clone=function(){for(var c=new a.TextNode(this.value,this.nodeType,this.style.clone()),b=0,d=this.children.length;b<d;b++)c.addChild(this.children[b].clone());return c};a.TextNode.prototype.toStr=function(){for(var a=this.value,b=0,c=this.children.length;b<c;b++)a+=" "+this.children[b].toStr();return a};a.TextNode.prototype.stringify=function(){var a="{"+('"NT":"'+this.nodeType+'",');a+=
'"V":"'+(this.value||"")+'",';a+='"C":[';for(var b=0,c=this.children.length;b<c;b++)a+=this.children[b].stringify()+(b==c-1?"":",");a=a+"],"+('"S":'+JSON.stringify(this.style));return a+"}"};a.TextNode.prototype.addChild=function(a,b){b&&null!==a.parent&&a.parent.removeChild(a);a.parent=this;this.children.push(a)};a.TextNode.prototype.removeChild=function(a){var b=this.children.indexOf(a);-1!==b&&(a.parent=null,this.children.splice(b,1))};a.TextNode.prototype.getFirstTextNode=function(){for(var a=
this;0<a.children.length;)a=a.children[0];return a};a.TextNode.prototype.getLastTextNode=function(){for(var a=this;0<a.children.length;)a=a.children[a.children.length-1];return a};a.TextNode.prototype.nextSibling=function(){if(this.parent)for(var a=null,b=0,c=this.parent.children.length;b<c;b++){if(a)return this.parent.children[b];this.parent.children[b]===this&&(a=!0)}return null};a.TextNode.prototype.prevSibling=function(){if(this.parent)for(var a=0,b=this.parent.children.length-1;a<b;a++)if(this.parent.children[a+
1]===this)return this.parent.children[a];return null};a.TextNode.prototype.querySelectorAll=function(a){for(var b=[],c=0,d=this.children.length;c<d;c++)b=b.concat(this.children[c].querySelectorAll(a));this.nodeType===a&&b.push(this);return b};a.TextNode.prototype.insertBefore=function(a,b){a=this.children.indexOf(a);-1!==a&&(b.parent=this,this.children.splice(a,0,b))};a.TextNode.prototype.insertAfter=function(a,b){a=this.children.indexOf(a);-1!==a&&(b.parent=this,this.children.splice(a+1,0,b))};a.TextNode.prototype.normalize=
function(){for(var c=this.querySelectorAll("textLineBlock").concat(this.querySelectorAll("formula")).concat(this.querySelectorAll("numerator")).concat(this.querySelectorAll("denominator")).concat(this.querySelectorAll("superIndex")).concat(this.querySelectorAll("subIndex")).concat(this.querySelectorAll("index")).concat(this.querySelectorAll("subIndex")).concat(this.querySelectorAll("radicand")).concat(this.querySelectorAll("from")).concat(this.querySelectorAll("to")).concat(this.querySelectorAll("what")).concat(this.querySelectorAll("element")),
b=0,d=c.length;b<d;b++)0===c[b].children.length&&c[b].addChild(new a.TextNode("","text",c[b].style));c=this.querySelectorAll("formula").concat(this.querySelectorAll("fraction")).concat(this.querySelectorAll("superIndex")).concat(this.querySelectorAll("subIndex")).concat(this.querySelectorAll("radical")).concat(this.querySelectorAll("sum")).concat(this.querySelectorAll("integral")).concat(this.querySelectorAll("limit")).concat(this.querySelectorAll("matrix")).concat(this.querySelectorAll("defparts")).concat(this.querySelectorAll("dynamicText")).concat(this.querySelectorAll("componentNumCtrl")).concat(this.querySelectorAll("componentSpace"));
b=0;for(d=c.length;b<d;b++)(null===c[b].prevSibling()||null!==c[b].prevSibling()&&"text"!==c[b].prevSibling().nodeType)&&c[b].parent.insertBefore(c[b],new a.TextNode("","text",c[b].parent.style)),(null===c[b].nextSibling()||null!==c[b].nextSibling()&&"text"!==c[b].nextSibling().nodeType)&&c[b].parent.insertAfter(c[b],new a.TextNode("","text",c[b].parent.style));return this};a.TextNode.prototype.removeEmptyText=function(){for(var a=this.querySelectorAll("text"),b=0,c=a.length;b<c;b++)""===a[b].value&&
a[b].parent&&a[b].parent.removeChild(a[b])};a.TextNode.prototype.adjustFontSize=function(a){var b=this.style.size;"formula"===this.nodeType&&(a=!0);for(var c=0,d=this.children.length;c<d;c++)"text"===this.children[c].nodeType&&a?(this.children[c].style.size=b,this.children[c].styleString=this.children[c].style.toString()):"index"===this.children[c].nodeType?(this.children[c].style.size=Math.max(parseInt(b-.5*b),8),this.children[c].styleString=this.children[c].style.toString(),this.children[c].adjustFontSize(!0)):
"to"===this.children[c].nodeType||"from"===this.children[c].nodeType?(this.children[c].style.size=Math.max(parseInt(b-.2*b),8),this.children[c].styleString=this.children[c].style.toString(),this.children[c].adjustFontSize(!0)):"numerator"===this.children[c].nodeType||"denominator"===this.children[c].nodeType?(this.children[c].style.size=Math.max(parseInt(b-.1*b),8),this.children[c].styleString=this.children[c].style.toString(),this.children[c].adjustFontSize(!0)):"subIndex"===this.children[c].nodeType||
"superIndex"===this.children[c].nodeType?(this.children[c].style.size=Math.max(parseInt(b-.33*b),8),this.children[c].styleString=this.children[c].style.toString(),this.children[c].adjustFontSize(!0)):(a&&(this.children[c].style.fontSize=b,this.children[c].styleString=this.children[c].style.toString()),this.children[c].adjustFontSize(a))};a.TextNode.prototype.propagateStyle=function(a,b){this.style[a]=b;this.styleString=this.style.toString();for(var c=0,d=this.children.length;c<d;c++)this.children[c].propagateStyle(a,
b)};a.TextNode.prototype.update=function(a,b,c,d,g,k,h,u){m=c;e=d;f=h;this.metrics.w=this.metrics.h=0;h=b;if(20<=u)for(c=0;c<this.children.length;c++)this.children[c].breakLines(u);c=0;for(g=this.children.length;c<g;c++){var l=this.children[c];l.updateLine();l.metrics.offsetX=a;l.metrics.y=b;b+=parseInt(l.metrics.ascent+.5);l.metrics.offsetY=b;d=parseInt(l.metrics.descent+.5)+parseInt(1.5+.05*l.style.size);b+=d;this.metrics.h+=l.metrics.h;this.metrics.w=Math.max(this.metrics.w,l.metrics.w)}b=h;k=
k||"";k.match("right")?a-=this.metrics.w:k.match("_center")&&(a-=this.metrics.w/2);k.match("bottom")?b-=this.metrics.h:k.match("center_")&&(b-=this.metrics.h/2);k=this.children;c=0;for(g=k.length;c<g;c++)"left"===k[c].style.align?k[c].metrics.offsetX=a:"right"===k[c].style.align?k[c].metrics.offsetX=a+this.metrics.w-k[c].metrics.w:"center"===k[c].style.align?k[c].metrics.offsetX=a+(this.metrics.w-k[c].metrics.w)/2:"justify"===k[c].style.align&&20<=u&&(lineValue=c<g-1?k[c+1].value:null,k[c].metrics.offsetX=
a,"wrap"===lineValue&&k[c].justifyAux(u)),k[c].metrics.y=b,b+=parseInt(k[c].metrics.ascent+.5),k[c].metrics.offsetY=b,d=parseInt(k[c].metrics.descent+.5)+parseInt(1.5+.05*k[c].style.size),b+=d};a.TextNode.prototype.breakLines=function(c){for(var b,d=0,e=!1,f=[],g=0,l=this.children.length;g<l;g++)b=this.children[g],e?f.push(b):("text"===b.nodeType||"space"===b.nodeType?(a.auxCtx.font=b.style.toString(),b.metrics.w=a.auxCtx.measureText(b.value).width):"word"===b.nodeType?b.updateLine():"formula"===
b.nodeType&&b.updateFormula(),d+=b.metrics.w,d>c&&"space"!==b.nodeType&&0<g&&(e=!0,f.push(b)));if(0<f.length)for(c=new a.TextNode("wrap","textLineBlock",this.style.clone(),null),this.parent.insertAfter(this,c),g=0,l=f.length;g<l;g++)f[g].parent&&f[g].parent.removeChild(f[g]),c.addChild(f[g])};a.TextNode.prototype.updateLine=function(c){var b=this;if("textLineBlock"===this.nodeType||"word"===this.nodeType){this.metrics.w=0;this.metrics.ascent=0;for(var d=this.metrics.descent=0,e=this.children,f,g=
0,l=e.length;g<l;g++){f=e[g];if("text"===f.nodeType){a.auxCtx.font=f.style.toString();var h=""!==f.value?f.value:"\u200a";f.metrics=k(a.auxCtx.font);f.metrics.w=a.auxCtx.measureText(h).width;f.metrics.offsetX=d;Object.defineProperties(f.metrics,{x:{get:function(){return b.metrics.offsetX+this.offsetX}},y:{get:function(){return b.metrics.offsetY+this.offsetY}}})}"space"===f.nodeType?(a.auxCtx.font=f.style.toString(),f.metrics=k(a.auxCtx.font),f.metrics.w=g===l-1?0:c?c:a.auxCtx.measureText(" ").width,
f.metrics.offsetX=d,Object.defineProperties(f.metrics,{x:{get:function(){return b.metrics.offsetX+this.offsetX}},y:{get:function(){return b.metrics.offsetY+this.offsetY}}})):"word"===f.nodeType&&(f.updateLine(),f.metrics.offsetX_aux=d,Object.defineProperties(f.metrics,{offsetX:{get:function(){return b.metrics.offsetX+this.offsetX_aux}},offsetY:{get:function(){return b.metrics.offsetY}}}));"hyperlink"===f.nodeType&&(a.auxCtx.font=f.styleString,h=""!==f.value?f.value:"\u200a",f.metrics=k(a.auxCtx.font),
f.metrics.w=a.auxCtx.measureText(h).width,f.metrics.offsetX=d,Object.defineProperties(f.metrics,{x:{get:function(){return b.metrics.offsetX+this.offsetX}},y:{get:function(){return b.metrics.offsetY}}}),f.clickCacher||(f.clickCacher=document.createElement("div"),f.clickCacher.setAttribute("style","position:absolute;width:"+f.metrics.w+"px;height:"+f.metrics.h+"px;cursor:pointer;"),f.clickCacher.rtfNode=f,f.clickCacher.action=new a.OpenURL(this.evaluator.parent,f.URL),f.clickCacher.addEventListener("click",
function(a){this.rtfNode.click=!0;this.action.execute();this.rtfNode.draw(this.rtfNode.ctx)})));"componentNumCtrl"===f.nodeType&&(f.componentNumCtrl=this.evaluator.parent.getControlByCId(f.value),a.auxCtx.font=f.styleString,f.metrics=k(a.auxCtx.font),f.metrics.w=f.componentNumCtrl.w,f.metrics.h=f.componentNumCtrl.h,f.metrics.offsetX=d,Object.defineProperties(f.metrics,{x:{get:function(){return b.metrics.offsetX+this.offsetX}},y:{get:function(){return b.metrics.offsetY}}}));"componentSpace"===f.nodeType?
(f.componentSpace=this.evaluator.parent.getSpaceByCId(f.value),a.auxCtx.font=f.styleString,f.metrics=k(a.auxCtx.font),f.metrics.w=f.componentSpace.w,f.metrics.h=f.componentSpace.h,f.metrics.offsetX=d,Object.defineProperties(f.metrics,{x:{get:function(){return b.metrics.offsetX+this.offsetX}},y:{get:function(){return b.metrics.offsetY}}})):"formula"===f.nodeType&&(f.updateFormula(),f.metrics.offsetX_aux=d,Object.defineProperties(f.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},
offsetX:{get:function(){return b.metrics.offsetX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return b.metrics.offsetY}}}),f.metrics.w+=2*f.metrics.paddingX,f.metrics.ascent+=f.metrics.paddingY,f.metrics.descent+=f.metrics.paddingY,f.metrics.h+=2*f.metrics.paddingY,d+=2*f.metrics.marginX);this.metrics.w+=f.metrics.w+2*f.metrics.marginX;this.metrics.ascent=Math.max(this.metrics.ascent,f.metrics.ascent);this.metrics.descent=Math.max(this.metrics.descent,f.metrics.descent);d+=f.metrics.w}this.metrics.h=
this.metrics.ascent+this.metrics.descent}};a.TextNode.prototype.updateFormula=function(){var c=this;this.metrics={ascent:0,descent:0,h:0,w:0,x:0,y:0,offsetX:0,offsetY:0,marginX:0,marginY:0,paddingX:0,paddingY:0};for(var b=this.children,d,f=0,h={metrics:{ascent:0,descent:0,h:0,w:0,x:0,y:0,offsetX:0,offsetY:0,marginX:0,marginY:0,paddingX:0,paddingY:0}},r=0,u=b.length;r<u;r++){d=b[r];if("text"===d.nodeType){a.auxCtx.font=d.style.toString();var p=""!==d.value?d.value:"\u200a";d.metrics=k(a.auxCtx.font);
d.metrics.w=a.auxCtx.measureText(p).width;d.metrics.offsetX=f;Object.defineProperties(d.metrics,{x:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.offsetX}},y:{get:function(){return c.metrics.offsetY}}});f+=c.metrics.marginX}else if("dynamicText"===d.nodeType){p=void 0===d.decimals?m:d.evaluator.eval(d.decimals);var v=void 0===d.fixed?e:d.fixed,x=d.evaluator.eval(d.value);parseFloat(x).toString()===x.toString()&&(x=v?parseFloat(x).toFixed(p):a.removeNeedlessDecimals(parseFloat(x).toFixed(p)),
x=(""+x).replace(".",d.decimal_symbol));d.evalValue=x;a.auxCtx.font=d.style.toString();d.metrics=k(a.auxCtx.font);d.metrics.marginX=parseInt(1.5+.075*this.style.size);d.metrics.paddingX=parseInt(1.5+.075*this.style.size);d.metrics.w=a.auxCtx.measureText(x).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 c.metrics.offsetX+c.metrics.paddingX+this.offsetX_aux+
this.marginX}},offsetY:{get:function(){return c.metrics.offsetY}}});f+=2*d.metrics.marginX}if("superIndex"===d.nodeType)p=d,p.updateFormula(),p.metrics.marginX=0*parseInt(1.5+.075*this.style.size),p.metrics.paddingX=0*parseInt(1.5+.075*this.style.size),p.metrics.paddingY=parseInt(1.5+.05*this.style.size),p.metrics.offsetX_aux=f,p.metrics.prevChild=h,Object.defineProperties(p.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+
c.metrics.paddingX+this.offsetX_aux+this.marginX}},offsetY:{get:function(){return c.metrics.offsetY-this.descent+this.prevChild.metrics.descent-parseInt(2*this.prevChild.metrics.h/7)}}}),p.metrics.w+=2*p.metrics.paddingX,p.metrics.ascent+=p.metrics.paddingY,p.metrics.descent+=p.metrics.paddingY,p.metrics.h+=2*p.metrics.paddingY,this.metrics.ascent=p.metrics.descent-p.metrics.prevChild.metrics.descent+parseInt(2*p.metrics.prevChild.metrics.h/7)+p.metrics.ascent,f+=2*p.metrics.marginX;else if("subIndex"===
d.nodeType){var A=d;A.updateFormula();A.metrics.marginX=parseInt(1.5+.09375*this.style.size);A.metrics.paddingX=0*parseInt(1.5+.01875*this.style.size);A.metrics.paddingY=parseInt(1.5+.05*this.style.size);A.metrics.offsetX_aux=f;A.metrics.prevChild=h;Object.defineProperties(A.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.offsetX_aux+0*this.marginX}},offsetY:{get:function(){return c.metrics.offsetY+
this.ascent+A.metrics.prevChild.metrics.descent-parseInt(4*A.metrics.prevChild.metrics.h/7)}}});A.metrics.w+=A.metrics.paddingX;A.metrics.ascent+=A.metrics.paddingY;A.metrics.descent+=A.metrics.paddingY;A.metrics.h+=2*A.metrics.paddingY;this.metrics.descent=A.metrics.ascent+A.metrics.prevChild.metrics.descent-parseInt(4*A.metrics.prevChild.metrics.h/7)+A.metrics.descent;f+=A.metrics.marginX}else if("fraction"===d.nodeType){v=d;v.updateFormula();p=v.children;x=p[0];p=p[1];v.metrics.marginX=parseInt(1.5+
.075*this.style.size);v.metrics.paddingX=0*parseInt(1.5+.075*this.style.size);v.metrics.paddingY=0*parseInt(1.5+.05*this.style.size);var C=Math.max(x.metrics.w,p.metrics.w)+2*v.metrics.paddingX;v.metrics.prevChild=h;v.metrics.offsetX_aux=f;var F=parseInt(-h.metrics.descent+4*h.metrics.h/9);Object.defineProperties(v.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY+F}},offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.marginX+this.offsetX_aux}},
offsetY:{get:function(){return c.metrics.offsetY-F}}});Object.defineProperties(x.metrics,{parent:{value:v},maxWidth:{value:C},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(p.metrics,{parent:{value:v},maxWidth:{value:C},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}}});v.metrics.w=C;v.metrics.ascent=x.metrics.h+F+2*v.metrics.paddingY;v.metrics.descent=p.metrics.h-F+2*v.metrics.paddingY;v.metrics.h=x.metrics.h+p.metrics.h+4*v.metrics.paddingY;f+=2*v.metrics.marginX}else if("radical"===d.nodeType){h=d;h.updateFormula();p=h.children;
v=p[0];var H=p[1];h.metrics.marginX=parseInt(1.5+.075*this.style.size);h.metrics.paddingX=parseInt(1.5+.075*this.style.size);h.metrics.paddingY=parseInt(1.5+.05*this.style.size);h.metrics.offsetX_aux=f;Object.defineProperties(h.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY}}});p=h.style.size;h.radicalSign={w:p,
scaleX:p/722,scaleY:H.metrics.h/1E3};x=parseInt(v.metrics.w-2*h.radicalSign.w/3);Object.defineProperties(h.radicalSign,{parent:{value:h},displaceIndex:{value:x},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+Math.max(this.displaceIndex,0)}},y:{get:function(){return c.metrics.offsetY-H.metrics.ascent}}});Object.defineProperties(v.metrics,{parent:{value:h},displaceIndex:{value:x},fontSize:{value:p},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},
offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+Math.max(this.displaceIndex,0)-this.displaceIndex}},offsetY:{get:function(){return c.metrics.offsetY-this.descent-2*this.fontSize/5}}});Object.defineProperties(H.metrics,{parent:{value:h},displaceIndex:{value:x},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+this.parent.radicalSign.w+Math.max(this.displaceIndex,
0)}},offsetY:{get:function(){return c.metrics.offsetY}}});x=v.metrics.w<2*h.radicalSign.w/3?h.radicalSign.w:parseInt(v.metrics.w+h.radicalSign.w/3);h.metrics.w=x+2*h.metrics.paddingX+H.metrics.w;h.metrics.ascent=Math.max(H.metrics.ascent,v.metrics.h+2*p/5)+h.metrics.paddingY;h.metrics.descent=H.metrics.descent+h.metrics.paddingY;h.metrics.h=h.metrics.ascent+h.metrics.descent;f+=2*h.metrics.marginX}else if("sum"===d.nodeType){v=d;v.updateFormula();p=v.children;x=p[0];C=p[1];var K=p[2];v.metrics.marginX=
parseInt(1.5+.075*this.style.size);v.metrics.paddingX=parseInt(1.5+.075*this.style.size);v.metrics.paddingY=parseInt(1.5+.05*this.style.size);v.metrics.offsetX_aux=f;Object.defineProperties(v.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY}}});a.auxCtx.font=d.style.toString();var E=k(a.auxCtx.font);h=parseInt(1.2*
E.h);p=parseInt(.5+780*h/1E3);v.sigmaSign={w:p,h:h,scale:h/1E3};var z=Math.max(C.metrics.w,x.metrics.w,v.sigmaSign.w);v.sigmaSign.parent=v;Object.defineProperties(v.sigmaSign,{sumWidth:{value:z},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.sumWidth-this.w)/2)}},y:{get:function(){return c.metrics.offsetY+E.descent-(this.h+E.h)/2}}});p=E.descent-C.metrics.descent-(h+E.h)/2-v.metrics.paddingY;Object.defineProperties(C.metrics,{parent:{value:v},sumWidth:{value:z},
newBaselineTo:{value:p},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.sumWidth-this.w)/2)}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaselineTo}}});h=x.metrics.ascent+E.descent+(h-E.h)/2+v.metrics.paddingY;Object.defineProperties(x.metrics,{parent:{value:v},sumWidth:{value:z},newBaselineFrom:{value:h},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},
offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.sumWidth-this.w)/2)}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaselineFrom}}});Object.defineProperties(K.metrics,{parent:{value:v},sumWidth:{value:z},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+2*this.parent.metrics.paddingX+this.sumWidth}},offsetY:{get:function(){return c.metrics.offsetY}}});
v.metrics.w=z+K.metrics.w+3*v.metrics.paddingX;v.metrics.ascent=Math.max(K.metrics.ascent,-p+C.metrics.ascent)+v.metrics.paddingY;v.metrics.descent=Math.max(K.metrics.descent,h+x.metrics.descent)+v.metrics.paddingY;v.metrics.h=v.metrics.ascent+v.metrics.descent;f+=2*v.metrics.marginX}else if("integral"===d.nodeType){v=d;v.updateFormula();p=v.children;x=p[0];C=p[1];K=p[2];v.metrics.marginX=parseInt(1.5+.075*this.style.size);v.metrics.paddingX=parseInt(1.5+.075*this.style.size);v.metrics.paddingY=parseInt(1.5+
.05*this.style.size);v.metrics.offsetX_aux=f;Object.defineProperties(v.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY}}});a.auxCtx.font=d.style.toString();E=k(a.auxCtx.font);z=parseInt(1.2*E.h);var G=parseInt(10.5+529*z/1E3);v.sign={w:G,h:z,scale:z/1E3};v.sign.parent=v;Object.defineProperties(v.sign,{x:{get:function(){return this.parent.metrics.offsetX+
this.parent.metrics.paddingX}},y:{get:function(){return c.metrics.offsetY+E.descent-(this.h+E.h)/2}}});p=E.descent-(z+E.h)/2-C.metrics.descent+z/3;Object.defineProperties(C.metrics,{parent:{value:v},integralWidth:{value:G},newBaselineTo:{value:p},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt(4*this.integralWidth/5)}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaselineTo}}});
h=E.descent+x.metrics.ascent/2;Object.defineProperties(x.metrics,{parent:{value:v},integralWidth:{value:G},newBaselineFrom:{value:h},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt(2*this.integralWidth/5)}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaselineFrom}}});G=Math.max(parseInt(4*G/5)+C.metrics.w,parseInt(2*G/5+x.metrics.w))+v.metrics.paddingX;Object.defineProperties(K.metrics,
{parent:{value:v},whatDisplace:{value:G},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+this.whatDisplace}},offsetY:{get:function(){return c.metrics.offsetY}}});v.metrics.w=G+K.metrics.w+2*v.metrics.paddingX;v.metrics.ascent=Math.max(K.metrics.ascent,-p+C.metrics.ascent)+v.metrics.paddingY;v.metrics.descent=Math.max(K.metrics.descent,h+x.metrics.descent,z-v.metrics.ascent)+v.metrics.paddingY;
v.metrics.h=Math.max(v.metrics.ascent+v.metrics.descent,z);f+=2*v.metrics.marginX}else if("limit"===d.nodeType){h=d;h.updateFormula();p=h.children;var L=p[0];v=p[1];p=p[2];h.metrics.marginX=parseInt(1.5+.075*this.style.size);h.metrics.paddingX=parseInt(1.5+.075*this.style.size);h.metrics.paddingY=parseInt(1.5+.05*this.style.size);h.metrics.offsetX_aux=f;Object.defineProperties(h.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+
c.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY}}});a.auxCtx.font=d.style.toString();E=k(a.auxCtx.font);C=parseInt(.5+a.auxCtx.measureText("l\u00edm").width);x=parseInt(.5+a.auxCtx.measureText("\u2192").width);limitWidth=Math.max(C,L.metrics.w+x+v.metrics.w);h.limitText={parent:h};Object.defineProperties(h.limitText,{limitWidth:{value:limitWidth},limitTextWidth:{value:C},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+
(this.limitWidth-this.limitTextWidth)/2}}});C=E.descent+Math.max(L.metrics.ascent,v.metrics.ascent,2*E.ascent/3)+h.metrics.paddingY;h.limitArrow={parent:h};Object.defineProperties(h.limitArrow,{newBaseline:{value:C},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+L.metrics.w}},y:{get:function(){return c.metrics.offsetY+this.newBaseline}}});Object.defineProperties(L.metrics,{parent:{value:h},newBaseline:{value:C},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},
offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaseline}}});Object.defineProperties(v.metrics,{parent:{value:h},arrowWidth:{value:x},newBaseline:{value:C},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+L.metrics.w+this.arrowWidth}},offsetY:{get:function(){return c.metrics.offsetY+
this.newBaseline}}});Object.defineProperties(p.metrics,{parent:{value:h},limitWidth:{value:limitWidth},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+2*this.parent.metrics.paddingX+this.limitWidth}},offsetY:{get:function(){return c.metrics.offsetY}}});h.metrics.w=limitWidth+p.metrics.w+3*h.metrics.paddingX;h.metrics.ascent=Math.max(p.metrics.ascent,E.ascent)+h.metrics.paddingY;h.metrics.descent=C+Math.max(L.metrics.descent,
v.metrics.descent)+h.metrics.paddingY;h.metrics.h=h.metrics.ascent+h.metrics.descent;f+=2*h.metrics.marginX}else if("matrix"===d.nodeType){x=d;x.updateFormula();p=x.children;C=x.rows;K=x.columns;x.metrics.marginX=parseInt(1.5+.075*this.style.size);x.metrics.paddingX=parseInt(1.5+.075*this.style.size);x.metrics.paddingY=parseInt(1.5+.05*this.style.size);x.metrics.offsetX_aux=f;Object.defineProperties(x.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+
c.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY}}});a.auxCtx.font=d.style.toString();E=k(a.auxCtx.font);z=[];G=[];h=0;for(var N=C*K;h<N;h++){var M=parseInt(h/K);var B=h%K;z[M]=Math.max(z[M]||0,p[h].metrics.h);G[B]=Math.max(G[B]||0,p[h].metrics.w)}var D=(1+K)*x.metrics.paddingX;for(h=0;h<K;h++)D+=G[h];var J=(1+C)*x.metrics.paddingY;for(h=0;h<C;h++)J+=z[h];v=E.descent-E.h/2;h=0;for(N=C*K;h<N;h++)M=parseInt(h/K),B=h%K,p[h].metrics.offsetX_aux=g(G,B)+
(G[B]-p[h].metrics.w)/2+B*x.metrics.paddingX,p[h].metrics.offsetY_aux=g(z,M)+(z[M]-p[h].metrics.h)/2+(1+M)*x.metrics.paddingY,Object.defineProperties(p[h].metrics,{parent:{value:x},matrixH:{value:J},dispY:{value:v},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY-this.matrixH/2+this.ascent+this.offsetY_aux+this.dispY}}});
x.metrics.w=D;x.metrics.ascent=J/2-v;x.metrics.descent=J/2+v;x.metrics.h=x.metrics.ascent+x.metrics.descent;f+=2*x.metrics.marginX}else if("defparts"===d.nodeType){x=d;x.updateFormula();p=d.children;C=d.parts;x.metrics.marginX=parseInt(1.5+.075*this.style.size);x.metrics.paddingX=parseInt(1.5+.075*this.style.size);x.metrics.paddingY=parseInt(1.5+.05*this.style.size);x.metrics.offsetX_aux=f;Object.defineProperties(x.metrics,{parent:{value:c},x:{get:function(){return this.offsetX-2*this.marginX}},y:{get:function(){return this.offsetY}},
offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+3*this.marginX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY}}});a.auxCtx.font=d.style.toString();E=k(a.auxCtx.font);K=0;z=x.metrics.paddingY;v=E.descent-E.h/2;for(h=0;h<C;h++)p[h].metrics.offsetY_aux=z,K=Math.max(K,p[h].metrics.w),z+=p[h].metrics.h+x.metrics.paddingY,Object.defineProperties(p[h].metrics,{parent:{value:x},dispY:{value:v},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},
offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX}},offsetY:{get:function(){return c.metrics.offsetY-this.parent.metrics.defpartsH/2+this.ascent+this.offsetY_aux+this.dispY}}});x.metrics.defpartsH=z;x.metrics.w=K+4*x.metrics.paddingX;x.metrics.ascent=z/2-v;x.metrics.descent=z/2+v;x.metrics.h=x.metrics.ascent+x.metrics.descent;f+=2*x.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.w+=2*d.metrics.paddingX,d.metrics.ascent+=d.metrics.paddingY,d.metrics.descent+=d.metrics.paddingY,d.metrics.h=d.metrics.ascent+d.metrics.descent;h=d;this.metrics.ascent=Math.max(this.metrics.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}};a.TextNode.prototype.justifyAux=function(a){for(var b=0,c=0,d=0,e=this.children.length;d<e-1;d++)"space"===this.children[d].nodeType?b++:c+=this.children[d].metrics.w;this.updateLine((a-c)/b)};a.TextNode.prototype.drawTextBlock=function(a){a.fillStyle=f;for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a)};a.TextNode.prototype.drawTextLineBlock=function(a){for(var b=0,c=this.children.length;b<
c;b++)this.children[b].draw(a)};a.TextNode.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:f;a.font=this.style.toString();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 d=a.strokeStyle;a.lineWidth=1+parseInt(this.style.size/13);a.lineJoin="round";a.miterLimit=2;a.strokeStyle=this.style.border.getColor();a.strokeText(this.value,b,c);a.strokeStyle=d}a.fillText(this.value,b,c)}};a.TextNode.prototype.drawWord=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a)};a.TextNode.prototype.drawSpace=function(a){};a.TextNode.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:f;a.font=this.style.toString();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")};a.TextNode.prototype.drawHyperlink=function(a){var b=this.metrics.x,c=this.metrics.y;this.ctx=a;this.clickCacher.parentNode||(a.canvas.nextSibling.className?a.canvas.parentNode.insertBefore(this.clickCacher,a.canvas.nextSibling.nextSibling):a.canvas.parentNode.insertBefore(this.clickCacher,a.canvas.nextSibling));this.clickCacher.style.left=b+"px";this.clickCacher.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();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)};a.TextNode.prototype.drawFormula=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};a.TextNode.prototype.drawFraction=function(a){a.lineWidth=6;a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:
f;a.beginPath();var b=parseInt(1+this.style.size/20);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")};a.TextNode.prototype.drawNumDen=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};a.TextNode.prototype.drawSuperIndex=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};a.TextNode.prototype.drawSubIndex=
function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};a.TextNode.prototype.drawRadical=function(c){c.save();c.translate(this.radicalSign.x,this.radicalSign.y);c.scale(this.radicalSign.scaleX,this.radicalSign.scaleY);a.isMsEdge?this.drawRadicalSign(c):c.fill(h);c.restore();c.beginPath();c.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,d=this.children.length;b<
d;b++)this.children[b].draw(c);this.drawBorder(c,"blue")};a.TextNode.prototype.drawSum=function(c){c.save();c.translate(this.sigmaSign.x,this.sigmaSign.y);c.scale(this.sigmaSign.scale,this.sigmaSign.scale);a.isMsEdge?this.drawSigmaSign(c):c.fill(d);c.restore();for(var b=0,e=this.children.length;b<e;b++)this.children[b].draw(c);this.drawBorder(c,"blue")};a.TextNode.prototype.drawIntegral=function(d){d.save();d.translate(this.sign.x,this.sign.y);d.scale(this.sign.scale,this.sign.scale);a.isMsEdge?this.drawIntegralSign(d):
d.fill(c);d.restore();for(var b=0,e=this.children.length;b<e;b++)this.children[b].draw(d);this.drawBorder(d,"blue")};a.TextNode.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:f;a.font=this.style.toString();a.fillText("l\u00edm",this.limitText.x,this.metrics.y);a.fillText("\u2192",this.limitArrow.x,this.limitArrow.y);this.drawBorder(a,"blue")};
a.TextNode.prototype.drawMatrix=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);b=parseInt(1.5+this.style.size/25);c=b/2;a.lineWidth=b;a.strokeStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:f;a.beginPath();a.moveTo(this.metrics.x+c+1.5*this.metrics.marginX,this.metrics.y+c-this.metrics.ascent);a.lineTo(this.metrics.x+c,this.metrics.y+c-this.metrics.ascent);a.lineTo(this.metrics.x+c,this.metrics.y-c-this.metrics.ascent+
this.metrics.h);a.lineTo(this.metrics.x+c+1.5*this.metrics.marginX,this.metrics.y-c-this.metrics.ascent+this.metrics.h);a.moveTo(this.metrics.x+this.metrics.w-c-1.5*this.metrics.marginX,this.metrics.y+c-this.metrics.ascent);a.lineTo(this.metrics.x+this.metrics.w-c,this.metrics.y+c-this.metrics.ascent);a.lineTo(this.metrics.x+this.metrics.w-c,this.metrics.y+c-this.metrics.ascent+this.metrics.h);a.lineTo(this.metrics.x+this.metrics.w-c-1.5*this.metrics.marginX,this.metrics.y+c-this.metrics.ascent+this.metrics.h);
a.stroke();this.drawBorder(a,"blue")};a.TextNode.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:f;a.beginPath();c=3*this.metrics.marginX;var d=c/2;a.moveTo(this.metrics.x+b+c,this.metrics.y+b-this.metrics.ascent);a.bezierCurveTo(this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent,
this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent,this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+2*this.metrics.marginX);a.lineTo(this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2-5*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2);a.bezierCurveTo(this.metrics.x+
b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2+5*this.metrics.marginX);a.lineTo(this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h-2*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+b+d,this.metrics.y-b-this.metrics.ascent+this.metrics.h,this.metrics.x+b+d,this.metrics.y-b-this.metrics.ascent+this.metrics.h,this.metrics.x+
b+c,this.metrics.y-b-this.metrics.ascent+this.metrics.h);a.stroke();this.drawBorder(a,"blue")};a.TextNode.prototype.drawGenericBlock=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};a.TextNode.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)};a.TextNode.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)};a.TextNode.prototype.drawRadicalSign=function(a){a.strokeStyle="rgba(0,0,0,0)";
a.lineCap="butt";a.lineJoin="miter";a.miterLimit=4;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.fill();a.stroke()};a.TextNode.prototype.drawSigmaSign=function(a){a.strokeStyle="rgba(0,0,0,0)";a.lineCap="butt";a.lineJoin="miter";
a.miterLimit=4;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.fill();a.stroke()};a.TextNode.prototype.drawIntegralSign=function(a){a.strokeStyle="rgba(0,0,0,0)";a.lineCap="butt";a.lineJoin="miter";a.miterLimit=4;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.fill();a.stroke()};a.TextNode.prototype.drawBorderSpecial=function(a,b){a.beginPath();a.setLineDash([1,2]);a.strokeStyle=b;a.lineWidth=1;a.rect(parseInt(this.metrics.x)+.5,parseInt(this.metrics.y-this.metrics.ascent)+.5,this.metrics.w,this.metrics.h);a.stroke();a.setLineDash([])};a.TextNode.prototype.toRTF=function(){var a=[],b=[],c="";this.mergeTextNodes();for(var d=0,e=this.children.length;d<e;d++){var f=this.children[d];"textLineBlock"===
f.nodeType&&(c+=f.toRTFAux(a,b)+(1<e&&d<e-1?"\\par":""))}f="{\\fonttbl";d=0;for(e=a.length;d<e;d++)f+="\\f"+d+"\\fcharset0 "+a[d]+";";a="";if(0<b.length){a="{\\colortbl";d=0;for(e=b.length;d<e;d++)a+=b[d];a+="}"}return"{\\rtf1\\uc0"+(f+"}")+a+c+"}"};a.TextNode.prototype.toRTFAux=function(a,b){for(var c,d,e,g=null,h="",k,l,m,u,C,F=0,H=this.children.length;F<H;F++)k=l="",c=this.children[F],m=this.addToFontTable(c.style.family,a),u=c.style.size,C=this.addToColorTable(c.style.color,b),null===C&&0<b.length&&
(C=this.addToColorTable(f,b)),C!==g&&(k+="\\cf"+C,g=C),m!==d&&(k+="\\f"+m,d=m),u!==e&&(k+="\\fs"+2*u,e=u),c.style.italic&&(k+="\\i",l="\\i0"+l),c.style.bold&&(k+="\\b",l="\\b0"+l),c.style.underline&&(k+="\\ul",l="\\ulnone"+l),c.style.overline&&(k+="\\ol",l="\\olnone"+l),"text"===c.nodeType?(c.value=c.value.replace(/\\{/g,"{").replace(/\\}/g,"}").replace(/{/g,"\\{").replace(/}/g,"\\}"),c=""!==k?k+" "+c.value+l:""!==h&&"}"!==h.charAt(h.length-1)?" "+c.value:c.value,h+=c):"formula"===c.nodeType?h+="{\\*\\mjaformula"+
c.formulaToRTF(d,e,g,a,b)+"}":"componentSpace"===c.nodeType?h+="{\\*\\component\\Space "+c.value+"}":"componentNumCtrl"===c.nodeType&&(h+="{\\*\\component\\NumCtrl "+c.value+"}");return h};a.TextNode.prototype.formulaToRTF=function(a,b,c,d,e){for(var g,h="",k,l,m,n,u=0,q=this.children.length;u<q;u++)k=l="",g=this.children[u],m=this.addToFontTable(g.style.family,d),n=this.addToColorTable(g.style.color,e),null===n&&0<e.length&&(n=this.addToColorTable(f,e)),m!==a&&(k+="\\f"+m,a=m),n!==c&&(k+="\\cf"+
n,"text"!==g.nodeType||"text"===g.nodeType&&""!==g.value)&&(c=n),g.style.italic&&(k+="\\i",l="\\i0"+l),g.style.bold&&(k+="\\b",l="\\b0"+l),g.style.underline&&(k+="\\ul",l="\\ulnone"+l),g.style.overline&&(k+="\\ol",l="\\olnone"+l),"text"===g.nodeType&&""!==g.value?(g.value=g.value.replace(/\\{/g,"{").replace(/\\}/g,"}").replace(/{/g,"\\{").replace(/}/g,"\\}"),tmpRTF=""!==k?k+" "+g.value+l:"}"!==h.charAt(h.length-1)?" "+g.value:g.value,h+=tmpRTF):"dynamicText"===g.nodeType?(g.value=""===g.value?" ":
g.value,h+=k+"{\\expr "+g.value+"\\decimals "+(g.decimals||2)+"\\fixed"+(g.fixed?1:0)+"}"+l):"fraction"===g.nodeType||"radical"===g.nodeType||"index"===g.nodeType||"radicand"===g.nodeType||"sum"===g.nodeType||"integral"===g.nodeType||"limit"===g.nodeType||"from"===g.nodeType||"to"===g.nodeType||"what"===g.nodeType||"element"===g.nodeType?h+="{\\"+g.nodeType+g.formulaToRTF(a,b,c,d,e)+"}":"numerator"===g.nodeType?h+="{\\num"+g.formulaToRTF(a,b,c,d,e)+"}":"denominator"===g.nodeType?h+="{\\den"+g.formulaToRTF(a,
b,c,d,e)+"}":"superIndex"===g.nodeType?h+="{\\supix"+g.formulaToRTF(a,b,c,d,e)+"}":"subIndex"===g.nodeType?h+="{\\subix"+g.formulaToRTF(a,b,c,d,e)+"}":"matrix"===g.nodeType?h+="{\\matrix\\rows "+(g.rows||2)+"\\columns "+(g.columns||2)+g.formulaToRTF(a,b,c,d,e)+"}":"defparts"===g.nodeType&&(h+="{\\defparts\\parts "+(g.parts||2)+g.formulaToRTF(a,b,c,d,e)+"}");return h};a.TextNode.prototype.addToFontTable=function(a,b){var c;a.match(/times/i)?c="Times New Roman":a.match(/courier/i)?c="Courier New":a.match(/arial/i)&&
(c="Arial");a=b.indexOf(c);-1===a&&(a=b.length,b.push(c));return a};a.TextNode.prototype.addToColorTable=function(a,b){if(a){a="\\red"+parseInt(a.substring(1,3),16)+"\\green"+parseInt(a.substring(3,5),16)+"\\blue"+parseInt(a.substring(5,7),16)+";";var c=b.indexOf(a);-1===c&&(c=b.length,b.push(a));return c}return null};a.TextNode.prototype.mergeTextNodes=function(){for(var a=[],b=null,c=0,d=this.children.length;c<d;c++)"text"===this.children[c].nodeType?null!==b&&"text"===b.nodeType&&b.style.equals(this.children[c].style)&&
(this.children[c].value=b.value+this.children[c].value,a.push(b)):this.children[c].mergeTextNodes(),b=this.children[c];c=0;for(d=a.length;c<d;c++)this.removeChild(a[c])};var u={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}};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=String.fromCharCode,k,f,m,e,h,d,c,u,l,b,n,y;a.RTFTokenizer=function(){};a.RTFTokenizer.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[];k=a.length;f=[];m="";h=e=0;c=a.charAt(0);u=!1;for(l="text";e<k;)d=c,c=a.charAt(e+
1),u?"\\"===c||"{"===c||"}"===c||" "===c||";"===c?(u=!1,m+=d," "===c?(e++,c=a.charAt(e+1),y=!0):y=!1,(b=m.match(/^'([0-9a-f]{2})/))?(n="","text"===l&&(n=f.pop().value),m=n+=g(parseInt(b[1],16))+m.substring(3)):(b=m.match(/^u[0-9]+/))?(n="","text"===l&&(n=f.pop().value),m=n+=g(b[0].substring(1))):("{"===m||"}"===m||"\\"==d?(f.push({type:"text",value:m+(y?" ":"")}),l="text"):(f.push({type:"controlWord",value:m}),l="controlWord"),m="")):"{"==d||"}"==d||"\\"==d?(u=!1,f.push({type:"text",value:d}),l="text"):
m+=d:"\\"===d?(u=!0,""!==m&&(f.push({type:"text",value:m}),l="text",m="")):"{"===d?(h++,""!==m&&(f.push({type:"text",value:m}),m=""),f.push({type:"openBlock",value:h}),l="openBlock"):"}"===d?(""!==m&&(f.push({type:"text",value:m}),m=""),f.push({type:"closeBlock",value:h}),l="closeBlock",h--):m+=d,e++;""!==m&&f.push({type:"text",value:m});return f};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g=Math.max,k,f,m,e,h,d,c,u,l,b,n,y,q,r,w,p,v,x,A,C,F,H,K,E,z,G,L,N,M;a.RTFParser=function(b){this.evaluator=b;this.tokenizer=new a.RTFTokenizer};a.RTFParser.prototype.parse=function(B){k=this.tokenizer.tokenize(B);f={};e=2;if("openBlock"===k[0].type&&"fonttbl"===k[1].value){for(m=k[0].value;"closeBlock"!==k[e].type&&k[e].value!==m;)f[k[e].value]=k[e+2].value.substring(0,k[e+2].value.length-1),e+=3;e++}h={};d=0;if("openBlock"===k[e].type&&"colortbl"===
k[e+1].value){m=k[e++].value;for(e++;"closeBlock"!==k[e].type&&k[e].value!==m;)c=parseInt(k[e++].value.substring(3)).toString(16),u=parseInt(k[e++].value.substring(5)).toString(16),l=parseInt(k[e++].value.substring(4)).toString(16),";"===k[e].value&&e++,h[d++]="#"+(2>c.length?"0"+c:c)+(2>u.length?"0"+u:u)+(2>l.length?"0"+l:l);e++}r=q=y=null;C=A=x=v=p=w=!1;F=[new a.TextStyle];H=F[0];E=K=-1;z=[];N=L=G=!1;b=M=new a.TextNode("","textBlock",H,this.evaluator);n=new a.TextNode("","textLineBlock",H,this.evaluator);
b.addChild(n);M.stableWidth=!0;M.hasFormula=!1;B=e;for(var D=k.length;B<D;B++){if("controlWord"==k[B].type)if(f[k[B].value])H.set({family:f[k[B].value]});else if(k[B].value.match(/^fs(\d+)/))H.set({size:parseInt(k[B].value.match(/^fs(\d+)/)[1]/2)});else if("b"==k[B].value)H.set({bold:!0}),0<z.length&&z[z.length-1].style.set({bold:!0});else if("b0"==k[B].value)H.set({bold:!1}),0<z.length&&z[z.length-1].style.set({bold:!1});else if("i"==k[B].value)H.set({italic:!0}),0<z.length&&z[z.length-1].style.set({italic:!0});
else if("i0"==k[B].value)H.set({italic:!1}),0<z.length&&z[z.length-1].style.set({italic:!1});else if("ul"==k[B].value)H.set({underline:!0}),0<z.length&&z[z.length-1].style.set({underline:!0});else if("ulnone"==k[B].value)H.set({underline:!1}),0<z.length&&z[z.length-1].style.set({underline:!1});else if("ol"==k[B].value)H.set({overline:!0}),0<z.length&&z[z.length-1].style.set({overline:!0});else if("olnone"==k[B].value)H.set({overline:!1}),0<z.length&&z[z.length-1].style.set({overline:!1});else if(k[B].value.match(/^cf(\d+)/))H.set({color:h[parseInt(k[B].value.substring(2))]}),
0<z.length&&(z[z.length-1].style.color=H.color);else if("par"==k[B].value){b=new a.TextNode("","textLineBlock",H.clone(),this.evaluator);if("textBlock"!=n.nodeType)for(n=n.parent;"textBlock"!=n.nodeType;)n=n.parent;n.addChild(b);n=b}else if("mjaformula"==k[B].value)M.hasFormula=!0,E=K,w=!0,b=new a.TextNode("","formula",H.clone(),this.evaluator),n.addChild(b),n=b,z[z.length-1]=b;else if("fraction"==k[B].value||"radicand"==k[B].value||"radical"==k[B].value||"what"==k[B].value||"sum"==k[B].value||"integral"==
k[B].value||"limit"==k[B].value){var J=z[z.length-2].style.clone();b=new a.TextNode("",k[B].value,J,this.evaluator);z[z.length-2].addChild(b);z[z.length-1]=b}else"index"==k[B].value?(J=z[z.length-2].style.clone(),J.size=g(parseInt(J.size-.5*J.size),8),b=new a.TextNode("",k[B].value,J,this.evaluator),z[z.length-2].addChild(b),z[z.length-1]=b):"to"==k[B].value||"from"==k[B].value?(J=z[z.length-2].style.clone(),J.size=g(parseInt(J.size-.2*J.size),8),b=new a.TextNode("",k[B].value,J,this.evaluator),z[z.length-
2].addChild(b),z[z.length-1]=b):"num"==k[B].value||"den"==k[B].value?(J=z[z.length-2].style.clone(),J.size=g(Math.round(J.size-.1*J.size),8),"num"==k[B].value?b=new a.TextNode("","numerator",J,this.evaluator):"den"==k[B].value&&(b=new a.TextNode("","denominator",J,this.evaluator)),z[z.length-2].addChild(b),z[z.length-1]=b):"subix"==k[B].value||"supix"==k[B].value?(J=z[z.length-2].style.clone(),J.size=g(Math.floor(J.size-.33*J.size),8),"subix"==k[B].value?b=new a.TextNode("","subIndex",J,this.evaluator):
"supix"==k[B].value&&(b=new a.TextNode("","superIndex",J,this.evaluator)),b.originalStyle=z[z.length-2].style.clone(),z[z.length-2].addChild(b),z[z.length-1]=b):"defparts"==k[B].value||"matrix"==k[B].value||"element"==k[B].value?(J=z[z.length-2].style.clone(),b=new a.TextNode("",k[B].value,J,this.evaluator),z[z.length-2].addChild(b),z[z.length-1]=b,"defparts"==k[B].value?r=b:"matrix"==k[B].value&&(q=b)):"parts"==k[B].value?C=!0:"rows"==k[B].value?x=!0:"columns"==k[B].value?A=!0:"expr"==k[B].value?
(M.stableWidth=!1,p=!0):"decimals"==k[B].value?v=!0:"fixed1"==k[B].value?y.fixed=!0:"fixed0"==k[B].value?y.fixed=!1:"component"!=k[B].value&&("NumCtrl"==k[B].value?G=!0:"Space"==k[B].value?L=!0:"hyperlink"==k[B].value&&(N=!0));if("text"==k[B].type)if(C)r.parts=parseInt(k[B].value),C=!1;else if(x)q.rows=parseInt(k[B].value),x=!1;else if(A)q.columns=parseInt(k[B].value),A=!1;else if(v)y.decimals=this.evaluator.parser.parse(k[B].value+""),v=!1;else if(N){textContent=k[B].value.split("|")[0];J=H.clone();
b=new a.TextNode(textContent,"hyperlink",J,this.evaluator);b.URL=k[B].value.split("|")[1];if("textLineBlock"!=n.nodeType)for(n=n.parent;"textLineBlock"!=n.nodeType;)n=n.parent;n.addChild(b);N=!1}else if(G)b=new a.TextNode(k[B].value,"componentNumCtrl",H.clone(),this.evaluator),n.addChild(b),G=!1;else if(L)b=new a.TextNode(k[B].value,"componentSpace",H.clone(),this.evaluator),n.addChild(b),L=!1;else if(p)J=z[z.length-2].style.clone(),textContent=this.evaluator.parser.parse(k[B].value),b=new a.TextNode(textContent,
"dynamicText",J,this.evaluator),z[z.length-2].addChild(b),y=z[z.length-1]=b,p=!1;else if(p||w)!p&&w&&(textContent=k[B].value,b=new a.TextNode(textContent,"text",z[z.length-1].style.clone(),this.evaluator),z[z.length-1].addChild(b));else{textContent=k[B].value;b=new a.TextNode(textContent,"text",H.clone(),this.evaluator);if("textLineBlock"!=n.nodeType)for(n=n.parent;"textLineBlock"!=n.nodeType;)n=n.parent;n.addChild(b)}else if("openBlock"==k[B].type)K=k[B].value,H=H.clone(),F.push(H),z.push(null);
else if("closeBlock"==k[B].type)k[B].value==E&&(E=-1,w=!1,n=n.parent),F.pop(),H=F[F.length-1],z.pop();else if("("==k[B].type||")"==k[B].type)J=z[z.length-1].style.clone(),J.italic="",b=new a.TextNode(k[B].type,"mathSymbol",J,this.evaluator),z[z.length-1].addChild(b);else if("+"==k[B].type||"-"==k[B].type||"*"==k[B].type||"="==k[B].type)b=new a.TextNode(k[B].type,"mathSymbol",z[z.length-1].style.clone(),this.evaluator),z[z.length-1].addChild(b)}return M.normalize()};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,k,f,m,e,h,d,c,u,l,b;a.Space=function(b,c){this.parent=b;k=this.evaluator=this.parent.evaluator;f=k.parser;this.id="";this.values=c;this.type="R2";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=2===b.version;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(/DescartesJS.class/i.test(b.code)||b.arquimedes?"f0f8fa":"ffffff");this.net=2!=b.version?new a.Color("c0c0c0"):"";this.net10=2!=b.version?new a.Color("808080"):"";this.axes=2!=b.version?new a.Color("808080"):"";this.text=new a.Color("ffafaf");this.numbers=!1;this.y_axis=this.x_axis=2!=b.version?"":" ";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.plecaHeight=
b.plecaHeight||0;this.displaceRegionNorth=b.displaceRegionNorth||0;this.displaceRegionWest=b.displaceRegionWest||0;for(var d in c)c.hasOwnProperty(d)&&(this[d]=c[d]);this.initSpace()};a.Space.prototype.initSpace=function(){g=this.parent;k=this.evaluator;m=this.id;this.resizable||(this.displaceRegionNorth=g.displaceRegionNorth||0,this.displaceRegionSouth=g.displaceRegionSouth||0,this.displaceRegionEast=g.displaceRegionEast||0,this.displaceRegionWest=g.displaceRegionWest||0,c=parseInt(g.container.width),
d=parseInt(g.container.height),void 0!=this.wExpr&&(this.w=parseInt(c-this.displaceRegionWest-this.displaceRegionEast)*parseFloat(this.wExpr)/100),void 0!=this.hExpr&&(this.h=parseInt(d-this.displaceRegionNorth-this.displaceRegionSouth)*parseFloat(this.hExpr)/100),void 0!=this.xPercentExpr&&(this.xExpr=k.parser.parse((parseInt(c-this.displaceRegionWest-this.displaceRegionEast)*parseFloat(this.xPercentExpr)/100).toString())),void 0!=this.yPercentExpr&&(this.yExpr=k.parser.parse((parseInt(d-this.displaceRegionNorth-
this.displaceRegionSouth)*parseFloat(this.yPercentExpr)/100).toString())),this.x=k.eval(this.xExpr)+this.displaceRegionWest,this.y=k.eval(this.yExpr)+this.plecaHeight+this.displaceRegionNorth,this.container&&(this.container.style.left=this.x+"px",this.container.style.top=this.y+"px"),0<=this.y?(e=d-this.y,this.h>e&&(this.h=e)):(e=this.h+this.y,this.h=e>=d?d:e),0<=this.x?(h=c-this.x,this.w>h&&(this.w=h)):(h=this.w+this.x,this.w=h>=c?c:h));""==this.imageSrc&&/vacio.gif$/i.test(this.imageSrc.trim())||
(this.image=g.getImage(this.imageSrc));this.OxExpr&&(l=this.OxExpr,"%"===l[l.length-1]?this.Ox=this.w*parseFloat(l)/100:(u=parseFloat(l),u!=l&&(u=0),this.Ox=u));this.OyExpr&&(b=this.OyExpr,"%"===b[b.length-1]?this.Oy=this.h*parseFloat(b)/100:(u=parseFloat(b),u!=b&&(u=0),this.Oy=u));""!==this.id&&2!==g.version?(k.setVariable(m+"._w",this.w),k.setVariable(m+"._h",this.h),k.setVariable(m+".escala",this.scale),k.setVariable(m+".Ox",this.Ox),k.setVariable(m+".Oy",this.Oy),k.setVariable(m+".mouse_x",0),
k.setVariable(m+".mouse_y",0),k.setVariable(m+".mouse_pressed",0),k.setVariable(m+".mouse_clicked",0),k.setVariable(m+".clic_izquierdo",0)):(u=k.getVariable("_w"),void 0===u&&(u=this.w),k.setVariable("_w",u),u=k.getVariable("_h"),void 0===u&&(u=this.h),k.setVariable("_h",u),u=k.getVariable("escala"),void 0===u&&(u=this.scale),k.setVariable("escala",u),u=k.getVariable("Ox"),void 0===u&&(u=this.Ox),k.setVariable("Ox",u),u=k.getVariable("Oy"),void 0===u&&(u=this.Oy),k.setVariable("Oy",u),k.setVariable("mouse_x",
0),k.setVariable("mouse_y",0),k.setVariable("mouse_pressed",0),k.setVariable("mouse_clicked",0),k.setVariable("clic_izquierdo",0),2==g.version&&""===this.x_axis&&""===this.y_axis&&(this.axes=""));this.w_2=this.w/2;this.h_2=this.h/2};a.Space.prototype.addCtr=function(a){"graphic"===a.type?this.graphicsCtr.push(a):this.ctrs.push(a)};a.Space.prototype.addGraph=function(a,b){"R2"===this.type&&b||"R3"===this.type&&!b||(a.background&&"R3"!==this.type?this.backGraphics.push(a):this.graphics.push(a))};a.Space.prototype.clearClick=
function(){this.evaluator.setVariable(this.mclickedString,0);this.evaluator.setVariable(this.mclicizquierdoString,0)};a.Space.prototype.getRelativeX=function(a){return((a>>0)-this.w_2-this.Ox)/this.scale};a.Space.prototype.getRelativeY=function(a){return(-(a>>0)+this.h_2+this.Oy)/this.scale};a.Space.prototype.getAbsoluteX=function(a){return a*this.scale+this.w_2+this.Ox};a.Space.prototype.getAbsoluteY=function(a){return-a*this.scale+this.h_2+this.Oy};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g;a.SpaceExternal=function(a){g=this;g.parent=a;g.width=228;g.vSpace=25;g.container=document.createElement("div");g.container.setAttribute("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;width:"+(g.width+27)+"px;height:460px;background-color:#63b4fb");g.movable=document.createElement("div");g.movable.setAttribute("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:Sans-Serif;font-size:18px;");g.movable.innerHTML="Descartes";g.container.appendChild(g.movable);g.ctrs=[]};a.SpaceExternal.prototype.init=function(){function k(d){g.newPos=a.getCursorPosition(d,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 f(a){a.preventDefault();document.body.removeEventListener("mousemove",k);document.body.removeEventListener("mouseup",f)}document.body.appendChild(this.container);g=this;for(var m=g.parent.evaluator.parser,e=0,h=g.ctrs.length;e<h;e++)g.ctrs[e].expresion=m.parse("(0,"+(g.vSpace+23+35*e)+","+g.width+",35)"),g.ctrs[e].update();g.numCtr=h;e=new a.Button(g.parent,{region:"external",name:"english"==g.language?"about":"cr\u00e9ditos",font_size:m.parse("15"),
expresion:m.parse("(0,"+g.vSpace+","+g.width/2+",25)")});e.actionExec={execute:a.showAbout};e.update();(new a.Button(g.parent,{region:"external",name:"config",font_size:m.parse("15"),action:"config",expresion:m.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:m.parse("15"),action:"init",expresion:m.parse("(0,"+(g.vSpace+23+35*h)+","+g.width/2+",25)")})).update();(new a.Button(g.parent,
{region:"external",name:"english"==g.language?"clear":"limpiar",font_size:m.parse("15"),action:"clear",expresion:m.parse("("+g.width/2+","+(g.vSpace+23+35*h)+","+g.width/2+",25)")})).update();m=new a.Button(g.parent,{region:"external",name:"english"==g.language?"close":"cerrar",font_size:m.parse("15"),expresion:m.parse("("+g.width/4+","+(g.vSpace+46+35*h)+","+g.width/2+",25)")});m.update();m.btn.addEventListener("click",function(a){g.hide()});g.setPositionAndSize();g.movable.addEventListener("mousedown",
function(d){d.preventDefault();g.oldPos=a.getCursorPosition(d,document.body);g.initialPosition={x:g.container.offsetLeft,y:g.container.offsetTop};document.body.addEventListener("mousemove",k);document.body.addEventListener("mouseup",f)});g.hide()};a.SpaceExternal.prototype.addCtr=function(a){this.ctrs.push(a)};a.SpaceExternal.prototype.show=function(){this.setPositionAndSize();this.container.style.display="block"};a.SpaceExternal.prototype.hide=function(){this.container.style.display="none"};a.SpaceExternal.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"};return a}(descartesJS||{});
descartesJS=function(a){var g,k;if(a.loadLib)return a;var f=Math.floor,m=Math.round,e=2*Math.PI,h=a.convertFont("SansSerif,PLAIN,12"),d=a.convertFont("Monospaced,PLAIN,12"),c,u,l,b,n,y,q,r,w,p,v,x,A,C,F,H,K,E,z,G,L,N,M,B,D,J,I,O,P,Q;a.Space2D=function(b,d){a.Space.call(this,b,d);c=this;c.ratio=b.ratio;c.canvas=document.createElement("canvas");c.canvas.setAttribute("id",c.id+"_canvas");c.canvas.setAttribute("class","DescartesSpace2DCanvas");c.backCanvas=document.createElement("canvas");c.backCanvas.setAttribute("id",
c.id+"_background");c.canvas.style.zIndex=c.zIndex;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";c.ctx=c.canvas.getContext("2d");c.backCtx=c.backCanvas.getContext("2d");c.ctx.imageSmoothingEnabled=c.backCtx.imageSmoothingEnabled=!1;c.graphicControlContainer=document.createElement("div");c.graphicControlContainer.setAttribute("id",c.id+"_graphicControls");
c.graphicControlContainer.setAttribute("style","position:absolute;left:0;top:0;z-index:"+c.zIndex+";");c.numericalControlContainer=document.createElement("div");c.numericalControlContainer.setAttribute("id",c.id+"_numericalControls");c.numericalControlContainer.setAttribute("style","position:absolute;left:0;top:0;z-index:"+c.zIndex+";");c.container=document.createElement("div");c.container.setAttribute("id",c.id);c.container.setAttribute("class","DescartesSpace2DContainer");c.container.setAttribute("style",
"left:"+c.x+"px;top:"+c.y+"px;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);d=c.id+".image";c.parent.images[d]=c.canvas;c.parent.images[d].ready=1;c.parent.images[d].complete=c.parent.images[d].canvas=
!0;c.evaluator.setVariable(d,d);d=c.id+".back";c.parent.images[d]=c.backCanvas;c.parent.images[d].ready=1;c.parent.images[d].complete=c.parent.images[d].canvas=!0;c.evaluator.setVariable(d,d);d=""!==c.id&&2!==b.version?c.id+".":"";c.OxStr=d+"Ox";c.OyStr=d+"Oy";c.scaleStr=d+"escala";c.wStr=d+"_w";c.hStr=d+"_h";c.mxStr=d+"mouse_x";c.myStr=d+"mouse_y";c.mpressedStr=d+"mouse_pressed";c.mclickedStr=d+"mouse_clicked";c.mclickIzqStr=d+"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.stage_height=0,c.canvas.oncontextmenu=function(a){return!1})};a.extend(a.Space2D,a.Space);a.Space2D.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");if("descartesJS_stage"===
c.id&&(c.setArquimedesHeight(),a.TextController&&!c.textController)){var b=null;c.backGraphics[0]&&c.backGraphics[0].text&&c.backGraphics[0].text.textNodes&&(b=c.backGraphics[0].text.textNodes);b&&(c.textController=new a.TextController(this,c.container,c.backCanvas,b,{fontFamily:"Times New Roman",fontSize:"30px",fontStyle:"normal",fontWeight:"normal",textDecoration:"none",decimals:2,fixed:!1},"000000"))}};a.Space2D.prototype.update=function(a){c=this;u=c.evaluator;l=c.parent;c.resizable||(u.setVariable(c.wStr,
c.w),u.setVariable(c.hStr,c.h));c.drawIfValue=0<u.eval(c.drawif);if(c.drawIfValue){c.resizable&&(P=c.evaluator.eval(c.wModExpr),Q=c.evaluator.eval(c.hModExpr),c.old_w!=P||c.old_h!=Q)&&(c.w=P,c.h=Q,c.w_2=c.w/2,c.h_2=c.h/2,u.setVariable(c.wStr,c.w),u.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);n=c.x!==u.eval(c.xExpr)+c.displaceRegionWest;y=c.y!==u.eval(c.yExpr)+l.plecaHeight+c.displaceRegionNorth;c.spaceChange=a||n||y||c.drawBefore!==c.drawIfValue||c.Ox!==u.getVariable(c.OxStr)||c.Oy!==u.getVariable(c.OyStr)||c.scale!==u.getVariable(c.scaleStr)||c.backColor!==c.background.getColor();c.x=n?u.eval(c.xExpr)+c.displaceRegionWest:c.x;c.y=y?u.eval(c.yExpr)+l.plecaHeight+c.displaceRegionNorth:c.y;c.Ox=u.getVariable(c.OxStr);c.Oy=u.getVariable(c.OyStr);c.scale=u.getVariable(c.scaleStr);c.drawBefore=
c.drawIfValue;c.scale=Math.max(1E-6,Math.min(1E6,c.scale));u.setVariable(c.scaleStr,c.scale);if(n||y)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"};a.Space2D.prototype.drawBackground=function(){c=this;u=c.evaluator;b=
c.backCtx;b.clearRect(0,0,c.backCanvas.width,c.backCanvas.height);c.backColor=c.background.getColor();b.fillStyle=c.backColor;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;w=0;for(p=0>c.w+c.h?0:c.w+c.h;r>p;)r/=10,w++;for(;r<p/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,
f(c.h/2+c.Oy)+.5),b.lineTo(c.w,f(c.h/2+c.Oy)+.5));"no"==c.y_axis||""===c.y_axis&&2===c.parent.version||(b.moveTo(f(c.w/2+c.Ox)+.5,0),b.lineTo(f(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=h,b.textAlign="right",b.textBaseline="alphabetic","no"!=c.x_axis&&b.fillText(c.x_axis,f(c.w)-2,f(c.h/2+c.Oy)+12),"no"!=c.y_axis&&b.fillText(c.y_axis,
f(c.w/2+c.Ox)-2,12);c.numbers&&""!=c.axes&&(b.fillStyle=c.axes.getColor(),b.font=h,b.textAlign="start",b.textBaseline="bottom",r>(c.w+c.h)/2?c.drawNumbers(b,r/5,r<=c.scale?w+1:w):r>(c.w+c.h)/4?c.drawNumbers(b,r/2,r<=c.scale?w+1:w):c.drawNumbers(b,r,w));a=0;for(var d=this.backGraphics.length;a<d;a++)this.backGraphics[a].draw()};a.Space2D.prototype.setArquimedesHeight=function(){this.update(!0);if(0<this.backGraphics.length&&this.backGraphics[0].text.textNodes.metrics.h!==this.stage_height){this.stage_height=
this.backGraphics[0].text.textNodes.metrics.h;var a=0;1<this.backGraphics.length&&(a=this.backGraphics[1].text.textNodes.metrics.h+25);this.h=this.stage_height+a+75;1<this.backGraphics.length&&(this.backGraphics[1].expresion=this.evaluator.parser.parse("["+this.backGraphics[1].exprX+","+(this.stage_height+a)+"]"));2<this.backGraphics.length&&(this.backGraphics[2].expresion=this.evaluator.parser.parse("["+this.backGraphics[2].exprX+","+(this.stage_height+a+25)+"]"));this.canvas.width=this.backCanvas.width=
this.w*this.ratio;this.canvas.height=this.backCanvas.height=this.h*this.ratio;this.canvas.style.width=this.backCanvas.style.width=this.w+"px";this.canvas.style.height=this.backCanvas.style.height=this.h+"px";this.parent.container.style.height=this.h+this.plecaHeight+"px";this.update(!0)}};a.Space2D.prototype.draw=function(){c=this;b=c.ctx;b.clearRect(0,0,c.canvas.width,c.canvas.height);for(var a=0,g=c.graphics.length;a<g;a++)q=c.graphics[a],""!==q.trace&&c.drawTrace&&q.drawTrace(),q.draw();a=0;for(g=
c.graphicsCtr.length;a<g;a++)c.graphicsCtr[a].draw();""!=c.text&&c.click&&"L"===c.whichBtn&&(b.save(),b.fillStyle=c.text.getColor(),b.strokeStyle=b.fillStyle,b.lineWidth=1,b.font=d,b.textAlign="center",b.textBaseline="alphabetic",L=1>=c.scale?c.mouse_x.toFixed(0):c.mouse_x.toFixed(c.scale.toString().length),N=1>=c.scale?c.mouse_y.toFixed(0):c.mouse_y.toFixed(c.scale.toString().length),M="("+L+","+N+")",B=f(b.measureText(M).width/2),D=c.getAbsoluteX(c.mouse_x),J=c.getAbsoluteY(c.mouse_y),I=f(D),O=
f(J-10),I+B>c.w?I=c.w-B:0>I-B&&(I=B),O+1>c.h?O=c.h:0>O-14&&(O=15),b.fillText(M,I,O),b.beginPath(),b.arc(D,J,2.5,0,e,!0),b.stroke(),b.restore())};a.Space2D.prototype.drawMarks=function(a,b,c,d){v=this.w;x=this.h;z=K=0;E=v;G=x;F=f(v/2+this.Ox);H=f(x/2+this.Oy);0<=c&&(K=F-c,E=F+c,z=H-c,G=H+c);a.beginPath();if(!d||d&&!d.match("x"))for(c=-m(F/b);(A=F+m(c*b))<v;c++)a.moveTo(A+.5,z+.5),a.lineTo(A+.5,G+.5);if(!d||d&&!d.match("y"))for(c=-m(H/b);(C=H+m(c*b))<x;c++)a.moveTo(K+.5,C+.5),a.lineTo(E+.5,C+.5);a.stroke()};
a.Space2D.prototype.drawNumbers=function(a,b,c){v=this.w;x=this.h;F=f(v/2+this.Ox);H=f(x/2+this.Oy);for(c=-m(F/b);(A=F+m(c*b))<v;c++)a.fillText(parseFloat((c*b/this.scale).toFixed(4)),A+1,H-2);for(c=-m(H/b);(C=H+m(c*b))<x;c++)0!==parseFloat(-c*b/this.scale)&&a.fillText(parseFloat((-c*b/this.scale).toFixed(4)),F+5,C+5)};a.Space2D.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.deactivateGraphiControls();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),g=h.posAnte.x-h.posNext.x,k=h.posAnte.y-h.posNext.y,h.evaluator.setVariable(h.OxStr,h.Ox-
g),h.evaluator.setVariable(h.OyStr,h.Oy-k));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.deactivateGraphiControls(),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.deactivateGraphiControls();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))});this.canvas.addEventListener("dblclick",function(a){});document.addEventListener("visibilitychange",
function(a){c(a)})};return a}(descartesJS||{});
descartesJS=function(a){var g,k,f;function m(b,c){D=a.subtract3D(b,a.scalarProduct3D(c,a.dotProduct3D(b,c)));J=a.add3D(b,a.scalarProduct3D(D,-2));I=a.norm3D(J);return 0!==I?a.scalarProduct3D(J,1/I):a.scalarProduct3D(b,-1)}if(a.loadLib)return a;var e=Math.floor,h=Math.max,d=Math.cos,c=Math.sin,u,l,b,n,y,q,r,w,p,v,x,A,C,F,H,K,E=[],z,G,L,N,M,B,D,J,I,O,P;a.Space3D=function(c,d){a.Space.call(this,c,d);b=this;b.backCanvas=document.createElement("canvas");b.backCanvas.setAttribute("id",b.id+"_background");
b.backCanvas.setAttribute("width",b.w+"px");b.backCanvas.setAttribute("height",b.h+"px");b.canvas=document.createElement("canvas");b.canvas.setAttribute("id",b.id+"_canvas");b.canvas.setAttribute("width",b.w+"px");b.canvas.setAttribute("height",b.h+"px");b.canvas.setAttribute("class","DescartesSpace3DCanvas");b.canvas.setAttribute("style","z-index: "+b.zIndex+";");b.ctx=b.canvas.getContext("2d");b.ctx.imageSmoothingEnabled=!1;d=b.id+".image";b.parent.images[d]=b.canvas;b.parent.images[d].ready=1;
b.parent.images[d].complete=!0;b.parent.images[d].canvas=!0;b.evaluator.setVariable(d,d);b.graphicControlContainer=document.createElement("div");b.graphicControlContainer.setAttribute("id",b.id+"_graphicControls");b.graphicControlContainer.setAttribute("style","position:absolute;left:0px;top:0px;z-index:"+b.zIndex+";");b.numericalControlContainer=document.createElement("div");b.numericalControlContainer.setAttribute("id",b.id+"_numericalControls");b.numericalControlContainer.setAttribute("style",
"position:absolute;left:0px;top:0px;z-index:"+b.zIndex+";");b.container=document.createElement("div");b.container.setAttribute("id",b.id);b.container.setAttribute("class","DescartesSpace3DContainer");b.container.setAttribute("style","left:"+b.x+"px;top:"+b.y+"px;z-index:"+b.zIndex+";");b.container.appendChild(b.backCanvas);b.container.appendChild(b.canvas);b.container.appendChild(b.graphicControlContainer);b.container.appendChild(b.numericalControlContainer);c.container.insertBefore(b.container,c.loader);
b.eye={x:0,y:0,z:0};b.lights=[{x:50,y:50,z:70},{x:50,y:-50,z:30},{x:20,y:0,z:-80},{x:0,y:0,z:0}];d=0;for(var e=b.lights.length;d<e;d++)b.lights[d]=a.normalize3D(b.lights[d]);b.light3={x:0,y:0,z:0};b.intensity=[.4,.5,.3,0];b.userIntensity=0;b.dim=1;b.tmpIntensity=[];b.OxStr=b.id+".Ox";b.OyStr=b.id+".Oy";b.scaleStr=b.id+".escala";b.wStr=b.id+"._w";b.hStr=b.id+"._h";b.obsStr=b.id+".observador";b.ojoXStr=b.id+".Ojo.x";b.ojoYStr=b.id+".Ojo.y";b.ojoZStr=b.id+".Ojo.z";b.rotZStr=b.id+".rot.z";b.rotYStr=b.id+
".rot.y";b.userIDimStr=b.id+".userIlum.dim";b.userIIStr=b.id+".userIlum.I";b.userIxStr=b.id+".userIlum.x";b.userIyStr=b.id+".userIlum.y";b.userIzStr=b.id+".userIlum.z";b.evaluator.setVariable(b.rotZStr,0);b.evaluator.setVariable(b.rotYStr,0);b.evaluator.setVariable(b.userIDimStr,b.dim);b.evaluator.setVariable(b.userIIStr,b.userIntensity);b.evaluator.setVariable(b.userIxStr,0);b.evaluator.setVariable(b.userIyStr,0);b.evaluator.setVariable(b.userIzStr,0);P=new a.Primitive3D({vertices:[new a.Vector4D(0,
0,0,1)],type:"vertex"},b);b.evaluator.setFunction(b.id+"._X3D2D_",function(a,c,d){P.vertices[0].x=a;P.vertices[0].y=c;P.vertices[0].z=d;P.computeDepth(b);return P.projVert[0].x});b.evaluator.setFunction(b.id+"._Y3D2D_",function(a,c,d){P.vertices[0].x=a;P.vertices[0].y=c;P.vertices[0].z=d;P.computeDepth(b);return P.projVert[0].y});b.resizable&&(b.wModExpr=c.evaluator.parser.parse(b.wModExpr),b.hModExpr=c.evaluator.parser.parse(b.hModExpr));b.ratio=1;b.addEvents()};a.extend(a.Space3D,a.Space);a.Space3D.prototype.init=
function(a){b=this;b.initSpace();b.canvas&&(b.canvas.width=b.backCanvas.width=b.w,b.canvas.height=b.backCanvas.height=b.h,b.canvas.style.width=b.backCanvas.style.width=b.w+"px",b.canvas.style.height=b.backCanvas.style.height=b.h+"px");b.w_2=b.w/2;b.h_2=b.h/2;b.w_plus_h=b.w+b.h;b.oldMouse={x:0,y:0};b.S={x:b.h/1080*-20.6*(40/b.scale),y:0,z:0};b.Ojo={x:3*b.w_2,y:0,z:0};b.evaluator.setVariable(b.ojoXStr,b.Ojo.x);b.evaluator.setVariable(b.ojoYStr,b.Ojo.y);b.evaluator.setVariable(b.ojoZStr,b.Ojo.z)};a.Space3D.prototype.update=
function(a){b=this;u=b.evaluator;l=b.parent;u.setVariable(b.wStr,b.w);u.setVariable(b.hStr,b.h);b.drawIfValue=0<u.eval(b.drawif);if(b.drawIfValue){b.resizable&&(wModExpr=b.evaluator.eval(b.wModExpr),hModExpr=b.evaluator.eval(b.hModExpr),b.old_w!=wModExpr||b.old_h!=hModExpr)&&(b.w=wModExpr,b.h=hModExpr,b.w_2=b.w/2,b.h_2=b.h/2,u.setVariable(b.wStr,b.w),u.setVariable(b.hStr,b.h),b.old_w=b.w,b.old_h=b.h,b.canvas.width=b.backCanvas.width=b.w*b.ratio,b.canvas.height=b.backCanvas.height=b.h*b.ratio,b.canvas.style.width=
b.backCanvas.style.width=b.w+"px",b.canvas.style.height=b.backCanvas.style.height=b.h+"px",a=!0,b.S={x:b.h/1080*-20.6*(40/b.scale),y:0,z:0},b.Ojo={x:3*b.w_2,y:0,z:0},b.evaluator.setVariable(b.ojoXStr,b.Ojo.x),b.evaluator.setVariable(b.ojoYStr,b.Ojo.y),b.evaluator.setVariable(b.ojoZStr,b.Ojo.z));q=b.x!==u.eval(b.xExpr)+b.displaceRegionWest;r=b.y!==u.eval(b.yExpr)+l.plecaHeight+b.displaceRegionNorth;b.spaceChange=a||q||r||b.drawBefore!==b.drawIfValue||b.Ox!==u.getVariable(b.OxStr)||b.Oy!==u.getVariable(b.OyStr)||
b.Ojo.x!==u.getVariable(b.ojoXStr)||b.Ojo.y!==u.getVariable(b.ojoYStr)||b.Ojo.z!==u.getVariable(b.ojoZStr)||b.scale!==u.getVariable(b.scaleStr);b.x=q?u.eval(b.xExpr)+b.displaceRegionWest:b.x;b.y=r?u.eval(b.yExpr)+l.plecaHeight+b.displaceRegionNorth:b.y;b.Ojo.x=u.getVariable(b.ojoXStr);b.Ojo.y=u.getVariable(b.ojoYStr);b.Ojo.z=u.getVariable(b.ojoZStr);b.Ox=u.getVariable(b.OxStr);b.Oy=u.getVariable(b.OyStr);b.scale=u.getVariable(b.scaleStr);b.drawBefore=b.drawIfValue;if(a||void 0==b.observer){a=0;for(var c=
b.parent.controls.length;a<c;a++)b.parent.controls[a].id===b.obsStr&&(O=!0);b.observer=O?u.getVariable(b.obsStr)||2.5*b.w_plus_h:2.5*b.w_plus_h;b.observer=h(b.observer,.25*b.w_plus_h);u.setVariable(b.obsStr,b.observer)}1E-6>b.scale?(b.scale=1E-6,u.setVariable(b.scaleStr,1E-6)):1E6<b.scale&&(b.scale=1E6,u.setVariable(b.scaleStr,1E6));if(q||r)b.container.style.left=b.x+"px",b.container.style.top=b.y+"px";b.container.style.display="block";b.dim=u.getVariable(b.userIDimStr);b.userIntensity=u.getVariable(b.userIIStr);
b.light3={x:parseInt(u.getVariable(b.userIxStr)),y:parseInt(u.getVariable(b.userIyStr)),z:parseInt(u.getVariable(b.userIzStr))};b.updateCamera();b.draw()}else b.container.style.display="none"};a.Space3D.prototype.updateCamera=function(){this.eye=a.scalarProduct3D(this.Ojo,1/this.scale)};a.Space3D.prototype.rotateVertex=function(e){v=a.degToRad(b.evaluator.getVariable(b.rotZStr));x=d(v);A=c(v);g=e.x*x-e.y*A;k=e.x*A+e.y*x;f=e.z;v=a.degToRad(b.evaluator.getVariable(b.rotYStr));x=d(v);A=c(v);return{x:f*
A+g*x,y:k,z:f*x-g*A}};a.Space3D.prototype.project=function(a){b=this;this.evaluator.getVariable("URL.oldProj");var c=b.eye.x/(a.x-b.eye.x);return{x:b.getAbsoluteX(c*(b.eye.y-a.y)),y:b.getAbsoluteY(c*(b.eye.z-a.z)),z:b.eye.x-a.x}};a.Space3D.prototype.computeColor=function(b,c,d){b.match("rgba")?b=a.RGBAToHexColor(b):b.match("#")&&(b=new a.Color(b.substring(1)));N=a.subtract3D(this.eye,c.average);M=a.norm3D(N);B=a.scalarProduct3D(N,1/M);this.lights[3]=a.subtract3D(this.light3,c.average);K=a.norm3D(this.lights[3]);
for(var f=0,g=this.intensity.length-1;f<g;f++)E[f]=this.intensity[f]*this.dim;E[3]=this.userIntensity*this.userIntensity/K||0;z=d?this.dim/2:this.dim/4;G=0;L=0>c.direction?c.normal:a.scalarProduct3D(c.normal,-1);f=0;for(g=this.lights.length;f<g;f++)d?(G=Math.max(0,a.dotProduct3D(m(this.lights[f],L),B)),G*=G*G):G=Math.max(0,a.dotProduct3D(this.lights[f],L)),z+=E[f]*G;z=Math.min(z,1);C=e(b.r*z);F=e(b.g*z);H=e(b.b*z);return"rgba("+C+","+F+","+H+","+b.a+")"};a.Space3D.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++){n=this.graphics[a];for(var c=a+1;c<b;c++)y=this.graphics[c],n.splitFace(y),y.splitFace(n);this.primitives=this.primitives.concat(n.primitives||[])}else for(a=0,b=this.graphics.length;a<b;a++){n=this.graphics[a];if(n.split)for(c=
a+1;c<b;c++)y=this.graphics[c],y.split&&n.splitFace(y);this.primitives=this.primitives.concat(n.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()};a.Space3D.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=[],f=0,g=a.length,h=.001,k,l;;){k=g;for(c=0;c<b;c++)if(!a[c].drawn){l=!0;for(var m=0;m<b;m++)if(m!=c&&!a[m].drawn&&a[c].inFrontOf(d,a[m],h)){l=!1;break}l&&(g--,e[f++]=a[c],a[c].drawn=!0)}if(0==g)break;else if(g==k){if(h*=10,.1<h){for(c=0;c<b;c++)a[c].drawn||(e[f++]=a[c],a[c].drawn=!0);break}}else h=.001}for(c=0;c<b;c++)e[c].draw(this.ctx,this)};a.Space3D.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}};a.Space3D.prototype.addEvents=function(){function b(a){window.focus();document.activeElement.blur();g.click=0;g.evaluator.setVariable(g.id+".mouse_pressed",0);window.removeEventListener("touchmove",f,!1);window.removeEventListener("touchend",b,!1);a.preventDefault();g.parent.update()}function c(b){document.body.focus();g.click=0;g.evaluator.setVariable(g.id+".mouse_pressed",0);b.preventDefault();"R"===g.whichBtn&&
(window.removeEventListener("mousemove",e,!1),g.posZoom==g.posZoomNew&&a.showConfig&&g.parent.externalSpace.show());window.removeEventListener("mousemove",f,!1);window.removeEventListener("mouseup",c,!1);g.parent.update()}function d(b){g.posAnte=a.getCursorPosition(b,g.container);g.mouse_x=g.getRelativeX(g.posAnte.x);g.mouse_y=g.getRelativeY(g.posAnte.y);g.evaluator.setVariable(g.id+".mouse_x",g.mouse_x);g.evaluator.setVariable(g.id+".mouse_y",g.mouse_y);g.parent.update();Date.now()}function e(b){b.preventDefault();
g.posZoomNew=a.getCursorPosition(b,g.container).y;g.evaluator.setVariable(g.scaleStr,g.tempScale+g.tempScale/45*((g.posZoom-g.posZoomNew)/10));g.posObserverNew=a.getCursorPosition(b,g.container).x;g.evaluator.setVariable(g.obsStr,g.tempObserver-2.5*(g.posObserver-g.posObserverNew));g.parent.update()}function f(b){if(!g.fixed&&g.click){w=(g.getAbsoluteX(g.oldMouse.x)-g.getAbsoluteX(g.mouse_x))/4;p=(-g.getAbsoluteY(g.oldMouse.y)+g.getAbsoluteY(g.mouse_y))/4;if(w!==g.disp.x||p!==g.disp.y)g.alpha=a.degToRad(g.evaluator.getVariable(g.rotZStr)),
g.beta=a.degToRad(-g.evaluator.getVariable(g.rotYStr)),g.alpha=a.radToDeg(g.alpha)-w,g.beta=a.radToDeg(g.beta)-p,g.evaluator.setVariable(g.rotZStr,g.alpha),g.evaluator.setVariable(g.rotYStr,-g.beta),g.disp.x=w,g.disp.y=p,g.oldMouse.x=g.getRelativeX(g.posAnte.x),g.oldMouse.y=g.getRelativeY(g.posAnte.y);d(b);b.preventDefault()}}var g=this;this.canvas.oncontextmenu=function(){return!1};this.canvas.addEventListener("touchstart",function(c){window.focus();document.activeElement.blur();g.click=1;g.evaluator.setVariable(g.id+
".mouse_pressed",1);g.parent.deactivateGraphiControls();g.posAnte=a.getCursorPosition(c,g.container);g.oldMouse.x=g.getRelativeX(g.posAnte.x);g.oldMouse.y=g.getRelativeY(g.posAnte.y);d(c);window.addEventListener("touchmove",f);window.addEventListener("touchend",b);c.preventDefault()});this.canvas.addEventListener("mousedown",function(b){document.body.focus();g.click=1;g.parent.deactivateGraphiControls();g.whichBtn=a.whichBtn(b);"R"===g.whichBtn?(window.addEventListener("mouseup",c),g.posObserver=
a.getCursorPosition(b,g.container).x,g.posObserverNew=g.posObserver,g.posZoom=a.getCursorPosition(b,g.container).y,g.posZoomNew=g.posZoom,g.fixed||(g.tempScale=g.scale,g.tempObserver=g.observer,window.addEventListener("mousemove",e))):"L"==g.whichBtn&&(g.evaluator.setVariable(g.id+".mouse_pressed",1),g.posAnte=a.getCursorPosition(b,g.container),g.oldMouse.x=g.getRelativeX(g.posAnte.x),g.oldMouse.y=g.getRelativeY(g.posAnte.y),d(b),window.addEventListener("mousemove",f),window.addEventListener("mouseup",
c));b.preventDefault()});this.disp={x:0,y:0};this.canvas.addEventListener("dblclick",function(a){})};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g,k,f,m,e,h;a.SpaceHTML_IFrame=function(d,c){a.Space.call(this,d,c);g=this.parent.evaluator;void 0!=this._w_&&(d=g.parser.parse(this._w_),this._w_="number"!=d.type?d:void 0);void 0!=this._h_&&(d=g.parser.parse(this._h_),this._h_="number"!=d.type?d:void 0);this.isFirefox=/firefox/i.test(window.navigator.userAgent);this.file=this.file?this.file.trim():"";this.file.match(/^\[/)&&this.file.match(/\]$/)?this.file=g.parser.parse(this.file.substring(1,this.file.length-
1)):this.file.match(/^'/)&&this.file.match(/'$/)?this.file=g.parser.parse(this.file):this.file=g.parser.parse("'"+this.file+"'");this.oldFile=g.eval(this.file);this.MyIFrame=document.createElement("iframe");0!=this.oldFile&&this.MyIFrame.setAttribute("src",this.oldFile);this.MyIFrame.setAttribute("marginheight",0);this.MyIFrame.setAttribute("marginwidth",0);this.MyIFrame.setAttribute("frameborder",0);this.MyIFrame.setAttribute("scrolling","auto");this.MyIFrame.setAttribute("style","position:static;left:0;top:0;");
this.container=document.createElement("div");this.container.setAttribute("id",this.id);this.container.setAttribute("style",(a.isIOS?"overflow:scroll;-webkit-overflow-scrolling:touch;overflow-scrolling:touch;":"")+"position:absolute;width:"+this.w+"px;height:"+this.h+"px;left:"+this.x+"px;top:"+this.y+"px;z-index:"+this.zIndex+";background-repeat:no-repeat;background-position:center;");this.container.appendChild(this.MyIFrame);this.imageSrc&&(this.container.style.backgroundImage="url("+this.imageSrc+
")");this.parent.container.insertBefore(this.container,this.parent.loader);var e=this;this.MyIFrame.onload=function(a){var b=this;e.evaluator.setFunction(e.id+".set",function(a,c){b.contentWindow.postMessage({type:"set",name:a,value:c},"*");return 0});e.evaluator.setFunction(e.id+".update",function(){b.contentWindow.postMessage({type:"update"},"*");return 0});e.evaluator.setFunction(e.id+".exec",function(a,c){b.contentWindow.postMessage({type:"exec",name:a,value:c},"*");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=""};this.update=this.iframeUpdate;this.evaluator.setVariable(this.id+"._scroll",0)};a.extend(a.SpaceHTML_IFrame,a.Space);a.SpaceHTML_IFrame.prototype.init=function(){e=this;e.initSpace();e.MyIFrame&&(e.MyIFrame.style.width=e.w+"px",e.MyIFrame.style.height=
e.h+"px",e.MyIFrame.style.left=e.x+"px",e.MyIFrame.style.top=e.y+"px")};a.SpaceHTML_IFrame.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){this.MyIFrame.contentWindow.focus();a&&
(this.y=this.x=Infinity);k=this.x!==g.eval(this.xExpr)+this.displaceRegionWest;f=this.y!==g.eval(this.yExpr)+this.parent.plecaHeight+this.displaceRegionNorth;this.x=k?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(k||f)this.container.style.left=this.x+"px",this.container.style.top=this.y+"px";m=g.eval(this.file);m!==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=m,this.MyIFrame.contentWindow.location.replace(m));h=g.getVariable(this.id+"._scroll");1==h?(this.MyIFrame.setAttribute("scrolling","yes"),this.MyIFrame.style.overflow=""):-1==h?(this.MyIFrame.setAttribute("scrolling","no"),this.MyIFrame.style.overflow="hidden"):(this.MyIFrame.setAttribute("scrolling","auto"),this.MyIFrame.style.overflow="")}else this.MyIFrame.contentWindow.blur()};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var g;a.DescartesLoader=function(f){var m=this;this.children=f.children;this.lessonParser=f.lessonParser;this.images=f.images;this.images.length=f.images.length;this.audios=f.audios;this.audios.length=f.audios.length;this.descartesApp=f;var e=f.imgLoader?f.imgLoader:k(f.loader.width,f.loader.height,f.ratio);this.imageLoader=document.createElement("div");this.imageLoader.width=f.width;this.imageLoader.height=f.height;this.imageLoader.setAttribute("class",
"DescartesLoaderImage");this.imageLoader.setAttribute("style","background-image:url("+e+");background-size:cover;width:"+f.width+"px;height:"+f.height+"px;");f.loader.appendChild(this.imageLoader);this.loaderBar=document.createElement("canvas");this.loaderBar.width=f.width;this.loaderBar.height=f.height;this.loaderBar.setAttribute("class","DescartesLoaderBar");this.loaderBar.setAttribute("style","width:"+f.width+"px;height:"+f.height+"px;");this.loaderBar.ctx=this.loaderBar.getContext("2d");this.loaderBar.ctx.lineCap=
"round";this.loaderBar.ctx.lineWidth=14;this.loaderBar.ctx.translate(f.width/2,(f.height-840*g)/3+760*g);this.loaderBar.ctx.scale(g,g);f.loader.appendChild(this.loaderBar);this.timer=a.setInterval(function(){m.drawLoaderBar(m.loaderBar.ctx,356)},10);f.firstRun=!1;this.initPreloader()};a.DescartesLoader.prototype.initPreloader=function(){var f=this.children,g=this.images,e=this.audios,h=/[\w\.\-//]*(\.png|\.jpg|\.gif|\.svg)/gi,d=/[\w\.\-//]*(\.ogg|\.oga|\.mp3|\.wav)/gi;g["lib/DescartesCCLicense.png"]=
a.getCCLImg();g["lib/DescartesCCLicense.png"].addEventListener("load",function(){this.ready=1});g["lib/DescartesCCLicense.png"].addEventListener("error",function(){this.errorload=1});var c,k;var l=0;for(c=f.length;l<c;l++)if("rtf"!==f[l].name){if(f[l].value.match(/'macro'|'makro'/g)){var b="";var n;var y=this.lessonParser.split(f[l].value);var q=0;for(k=y.length;q<k;q++)"expresion"===babel[y[q][0]]&&(b=y[q][1]);b&&((n=document.getElementById(b))&&"descartes/macro"==n.type?n=n.text:(n=a.openExternalFile(b))&&
!n.match(/tipo_de_macro/g)&&(n=null));if(n&&(y=n.match(h)))for(b=0,k=y.length;b<k;b++)q=y[b],q.toLowerCase().match(/vacio.gif$/)||""==q.substring(0,q.length-4)||(g[q]=new Image,g[q].addEventListener("load",function(){this.ready=1}),g[q].addEventListener("error",function(){this.errorload=1}),g[q].src=q)}if(y=f[l].value.match(h))for(b=0,k=y.length;b<k;b++)q=y[b],q.toLowerCase().match(/vacio.gif$/)||""==q.substring(0,q.length-4)||(g[q]=new Image,g[q].addEventListener("load",function(){this.ready=1}),
g[q].addEventListener("error",function(){this.errorload=1}),g[q].src=q);if(y=f[l].value.match(d))for(b=0,q=y.length;b<q;b++)this.initAudio(y[b])}for(var r in g)g.hasOwnProperty(r)&&this.images.length++;for(r in e)e.hasOwnProperty(r)&&this.audios.length++;var w=this,p=this.images.length+this.audios.length;this.sep=712/(p-1);var v=function(){w.readys=0;for(var b in g)g.hasOwnProperty(b)&&(g[b].ready||g[b].errorload)&&w.readys++;for(b in e)e.hasOwnProperty(b)&&(e[b].ready||e[b].errorload)&&w.readys++;
w.readys!=p?a.setTimeout(v,30):(a.clearInterval(w.timer),w.descartesApp.initBuildApp())};v()};a.DescartesLoader.prototype.initAudio=function(f){var g=this.audios;g[f]=new Audio(f);g[f].filename=f;var e=function(){this.ready=1},h=function(){this.canPlayType("audio/"+this.filename.substring(this.filename.length-3))||"mp3"!=this.filename.substring(this.filename.length-3)?(console.log("El archivo '"+f+"' no puede ser reproducido"),this.errorload=1):(g[f]=new Audio(this.filename.replace("mp3","ogg")),
g[f].filename=this.filename.replace("mp3","ogg"),g[f].addEventListener("canplaythrough",e),g[f].addEventListener("load",e),g[f].addEventListener("error",h),g[f].load())};g[f].addEventListener("canplaythrough",e);g[f].addEventListener("load",e);g[f].addEventListener("error",h);a.hasTouchSupport?(g[f].load(),g[f].play(),a.setTimeout(function(){g[f].pause()},20),g[f].ready=1):g[f].load()};a.DescartesLoader.prototype.drawLoaderBar=function(a){a.beginPath();a.strokeStyle="#f2f2f2";a.moveTo(-356,0);a.lineTo(356,
0);a.stroke();a.beginPath();a.strokeStyle="#2daae4";a.moveTo(-356,0);a.lineTo(-356+this.readys*this.sep,0);a.stroke()};var k=function(f,k,e){var h=document.createElement("canvas");e=5E6<f*this.ratio*k*this.ratio?1:e;h.width=f*e;h.height=k*e;h.style.width=f+"px";h.style.height=k+"px";var d=h.getContext("2d");d.setTransform(e,0,0,e,0,0);g=f<k?f/1144:k/1092;g=2.5<g?2.5:g;d.translate((f-880*g)/2,(k-840*g)/3);d.scale(g,g);d.drawImage(a.loaderImg,0,0);return h.toDataURL()};return a}(descartesJS||{});
descartesJS=function(a){function g(a){for(var c="[",d=0,e=a.length;d<e;d++)a[d]instanceof Array?c+=g(a[d]):(f=a[d],"undefined"!=typeof f&&f||(f=0),"string"==typeof f&&(f="'"+f+"'"),c+=f),d<e-1&&(c+=",");return c+"]"}function k(){m=window.innerWidth/this.width;e=window.innerHeight/this.height;h=Math.min(m,e);a.cssScale=h;this.container.parentNode.setAttribute("align","");this.container.style.transformOrigin="0 0";m<e?(this.container.style.left="0",this.container.style.transform="translate3d(0px, 0px, 0px) scale("+
h+")"):(this.container.style.left="50%",this.container.style.transform="translate3d(0px, 0px, 0px) scale("+h+") translate(-50%, 0)")}if(a.loadLib)return a;var f,m,e,h;a.DescartesApp=function(d){this.animation={playing:!1,play:function(){},stop:function(){},reinit:function(){}};this.ratio=a._ratio;this.applet=d;this.parentC=d.parentNode;this.width=parseFloat(d.getAttribute("width"));this.height=parseFloat(d.getAttribute("height"));this.decimal_symbol=".";this.decimal_symbol_regexp=/\./g;this.language=
"espa\u00f1ol";this.children=d.getElementsByTagName("param");a.ccLicense=!0;for(var c=0,e=this.children.length;c<e;c++)"CreativeCommonsLicense"===this.children[c].name&&(a.ccLicense="no"!==this.children[c].value);this.code=d.getAttribute("code");this.saveState=[];this.images={length:-1};this.audios={length:-1};this.firstRun=!0;this.scaleToFit=function(){};this.init()};a.DescartesApp.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 {\\*\\hyperlink licencia Creative Commons|http://creativecommons.org/licenses/by-nc-sa/4.0/}, si no se indica lo contrario.\\par                                        La unidad did\u00e1ctica fue creada con Arqu\u00edmedes, que es un producto de c\u00f3digo abierto, {\\*\\hyperlink Creditos|http://arquimedes.matem.unam.mx/Descartes5/creditos/conCCL.html}\\par }":
"";for(var d=this.children,c,e=0,f=0,b=a.ccLicense?90:0,g=0,h=d.length;g<h;g++)c=d[g],"rtf_height"==c.name&&(e=parseInt(c.value)||this.height),"Buttons"==babel[c.name]&&(this.buttonsConfig=this.lessonParser.parseButtonsConfig(c.value),f=this.buttonsConfig.height),"image_loader"==c.name&&(this.imgLoader=c.value),"expand"==c.name&&("cover"==c.value?this.expand=c.value:"fit"==c.value&&(this.scaleToFit=k)),"docBase"==c.name&&(this.docBase=c.value,c=document.createElement("base"),c.setAttribute("id","descartesJS_base"),
c.setAttribute("href",this.docBase),document.head.appendChild(c));this.expand&&"cover"==this.expand&&(this.width=window.innerWidth,this.height=window.innerHeight);this.arquimedes&&(this.ratio=1,e&&(this.height=e+f+b));this.spaces=[];this.externalSpace&&document.body.removeChild(this.externalSpace.container);this.externalSpace=new a.SpaceExternal(this);this.northSpace={container:document.createElement("div"),controls:[]};this.southSpace={container:document.createElement("div"),controls:[]};this.eastSpace=
{container:document.createElement("div"),controls:[]};this.westSpace={container:document.createElement("div"),controls:[]};this.editableRegion={container:document.createElement("div"),textFields:[]};a.Editor&&(this.editor=new a.Editor(this));this.controls=[];this.auxiliaries=[];this.events=[];this.nIframes=this.plecaHeight=this.tabindex=this.zIndex=0;void 0!=this.container&&this.parentC.removeChild(this.container);this.container=document.createElement("div");this.loader=document.createElement("div");
this.parentC.insertBefore(this.container,this.parentC.firstChild);this.container.width=this.width;this.container.height=this.height;this.container.setAttribute("class","DescartesAppContainer");this.container.setAttribute("style","width:"+this.width+"px;height:"+this.height+"px;");this.scaleToFit();this.container.appendChild(this.loader);this.loader.width=this.width;this.loader.height=this.height;this.loader.setAttribute("class","DescartesLoader");this.loader.setAttribute("style","width:"+this.width+
"px;height:"+this.height+"px;z-index:1000;");this.imgLoader&&(this.loader.style.backgroundColor="rgba(0,0,0,0)");this.firstRun?this.descartesLoader=new a.DescartesLoader(this):this.initBuildApp()};a.DescartesApp.prototype.initBuildApp=function(){a.showConfig=!0;for(var d=this.children,c,e=this.lessonParser,f=[],b=[],g=[],h=[],k=[],m=[],w=0,p=d.length;w<p;w++)if(c=d[w],"editable"==babel[c.name])a.showConfig="false"==babel[c.value]?!1:!0;else if("language"==babel[c.name])this.language=c.value;else if("pleca"==
c.name)c=e.parsePleca(c.value,this.width),this.container.insertBefore(c,this.loader),this.plecaHeight=c.imageHeight?c.imageHeight:c.offsetHeight;else if("Buttons"==babel[c.name])this.buttonsConfig=e.parseButtonsConfig(c.value);else if("decimal_symbol"==babel[c.name])this.decimal_symbol=c.value,this.decimal_symbol_regexp=new RegExp("\\"+this.decimal_symbol,"g");else if("version"==babel[c.name])this.version=parseInt(c.value);else if("language"==babel[c.name])this.language=c.value;else if("rtf"==c.name){var v=
(this.width-780)/2,x=parseInt(this.height)-this.plecaHeight-this.buttonsConfig.height-45;h.push("space='descartesJS_stage' type='text' expresion='[10,20]' background='yes' text='"+c.value.replace(/'/g,"&squot;")+"'");h.push("space='descartesJS_stage' type='text' expresion='["+v+","+(x-25)+"]' background='yes' text='"+this.licenseA+"'");a.ccLicense&&h.push("space='descartesJS_stage' type='image' expresion='["+(v+15)+","+x+"]' background='yes' abs_coord='yes' file='lib/DescartesCCLicense.png'")}else"E"==
c.name.charAt(0)?(c.value.match(/'HTMLIFrame'/)&&this.nIframes++,f.push(c.value)):/^C_/.test(c.name)?b.push(c.value):/^A_/.test(c.name)?g.push(c.value):/^G_/.test(c.name)?(c.value.match(/type='fill'|tipo='relleno'|tipus='ple'|mota='betea'|type='plein'|tipo='recheo'|tipo='curva_piena'|tipo='preencher'|tipus='ple'/)&&(this.ratio=1),h.push(c.value)):/^S_/.test(c.name)?k.push(c.value):"Animation"==babel[c.name]&&m.push(c.value);this.stage={container:document.createElement("div"),scroll:0};this.stage.container.setAttribute("id",
"descartesJS_Stage");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.arquimedes&&(this.container.appendChild(this.stage.container),this.spaces.push(this.stage.stageSpace));w=0;for(p=f.length;w<p;w++)d=e.parseSpace(f[w]),this.arquimedes&&
this.stage.container.appendChild(d.container),this.spaces.push(d),this.zIndex++;w=0;for(p=h.length;w<p;w++)if(a.DEBUG.elemIndex=w,f=e.parseGraphic(h[w]))this.editableRegionVisible=this.editableRegionVisible||f.visible,f.space.addGraph(f);w=0;for(p=k.length;w<p;w++)(f=e.parse3DGraphic(k[w]))&&f.space.addGraph(f,!0);w=0;for(p=b.length;w<p;w++)this.controls.push(e.parseControl(b[w]));w=0;for(p=g.length;w<p;w++)e.parseAuxiliar(g[w]);w=0;for(p=m.length;w<p;w++)this.animation=e.parseAnimation(m[w]);this.configRegions();
this.updateAuxiliaries();this.updateAuxiliaries();w=0;for(p=this.controls.length;w<p;w++)this.controls[w].init();this.updateControls();this.updateSpaces(!0);var A=this;this.nIframes?a.setTimeout(function(){A.finishInit()},200*this.nIframes):this.finishInit()};a.DescartesApp.prototype.finishInit=function(){this.evaluator.setVariable("decimalSymbol",this.decimal_symbol);this.update();this.loader.style.display="none";window.parent!==window&&(this.parentC.style.margin="0px",this.parentC.style.padding=
"0px",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 d=new CustomEvent("descartesReady",{detail:this})}catch(c){console.warn("CustomEvents not supported in this browser")}window.dispatchEvent(d);this.readyApp=!0};a.DescartesApp.prototype.adjustSize=
function(){document.body.style.margin=document.body.style.padding=this.parentC.style.margin=this.parentC.style.padding="0px";var d=parseInt(this.width)+30,c=parseInt(this.height)+90;window.moveTo((parseInt(screen.width)-d)/2,(parseInt(screen.height)-c)/2);window.resizeTo(d,c);a.onResize()};a.DescartesApp.prototype.adjustDimensions=function(){if(void 0==this.init_w||void 0==this.init_h)this.init_w=parseInt(this.container.style.width),this.init_h=parseInt(this.container.style.height);var a=parseInt(this.parentC.offsetWidth);
var c=this.init_w;var e=a/c;c>a?(this.parentC!=document.body&&(this.parentC.style.height=this.init_h*e+"px"),this.percent=e,this.container.style.webkitTransform=this.container.style.MozTransform="scale("+e+")",this.container.style.webkitTransformOrigin=this.container.style.MozTransformOrigin="top left"):(this.parentC!=document.body&&(this.parentC.style.height="auto"),this.percent=1,this.container.style.webkitTransform=this.container.style.MozTransform="",this.container.style.webkitTransformOrigin=
this.container.style.MozTransformOrigin="")};a.DescartesApp.prototype.configRegions=function(){var d=this.evaluator.parser,c=this.buttonsConfig,e=this.container,f="15",b=configWidth=initWidth=clearWidth=100;2==this.version&&(f="14",b=63,configWidth=50,initWidth=44,clearWidth=53);var g=southRegionHeight=eastRegionHeight=westRegionHeight=editableRegionHeight=northRegionWidht=southRegionWidht=eastRegionWidth=westRegionWidth=0,h=this.northSpace.controls,k=this.southSpace.controls,m=this.eastSpace.controls,
w=this.westSpace.controls;if(0<c.rowsNorth||0<h.length||c.about||c.config){0>=c.rowsNorth?(g=c.height,c.rowsNorth=1):g=c.height*c.rowsNorth;var p=this.northSpace.container;p.setAttribute("id","descartesJS_north");p.setAttribute("style","width:"+e.width+"px;height:"+g+"px;background:#c0c0c0;position:absolute;left:0px;top:"+this.plecaHeight+"px;z-index:100;");e.insertBefore(p,this.loader);northRegionWidht=e.width;var v=0;c.about?(v=b,northRegionWidht-=v):b=0;c.config&&(northRegionWidht-=configWidth);
p=Math.ceil(h.length/c.rowsNorth);for(var x=northRegionWidht/p,A=0,C=h.length;A<C;A++)h[A].expresion=d.parse("("+(v+A%p*x)+","+c.height*Math.floor(A/p)+","+x+","+c.height+")"),h[A].drawif=d.parse("1"),h[A].init();c.about&&(A=new a.Button(this,{region:"north",name:"english"==this.language?"about":"cr\u00e9ditos",font_size:d.parse(f),expresion:d.parse("(0, 0, "+b+", "+g+")")}),A.actionExec={execute:a.showAbout},A.update());c.config&&(new a.Button(this,{region:"north",name:"config",font_size:d.parse(f),
action:"config",expresion:d.parse("("+(northRegionWidht+b)+", 0, "+configWidth+", "+g+")")})).update()}if(0<c.rowsSouth||0<k.length||c.init||c.clear){0>=c.rowsSouth?(southRegionHeight=c.height,c.rowsSouth=1):southRegionHeight=c.height*c.rowsSouth;southRegionWidht=e.width;v=0;c.init?(v=initWidth,southRegionWidht-=v):initWidth=0;c.clear&&(southRegionWidht-=clearWidth);p=this.southSpace.container;p.setAttribute("id","descartesJS_south");p.setAttribute("style","width:"+e.width+"px;height:"+southRegionHeight+
"px;background:#c0c0c0;position:absolute;left:0px;top:"+(e.height-southRegionHeight)+"px;z-index:100;");e.insertBefore(p,this.loader);p=Math.ceil(k.length/c.rowsSouth);x=southRegionWidht/p;A=0;for(C=k.length;A<C;A++)k[A].expresion=d.parse("("+(v+A%p*x)+","+c.height*Math.floor(A/p)+","+x+","+c.height+")"),k[A].drawif=d.parse("1"),k[A].init();c.init&&(new a.Button(this,{region:"south",name:"english"==this.language?"init":"inicio",font_size:d.parse(f),action:"init",expresion:d.parse("(0, 0, "+initWidth+
", "+southRegionHeight+")")})).update();c.clear&&(new a.Button(this,{region:"south",name:"english"==this.language?"clear":"limpiar",font_size:d.parse(f),action:"clear",expresion:d.parse("("+(southRegionWidht+initWidth)+", 0, "+clearWidth+", "+southRegionHeight+")")})).update()}if(0<m.length)for(eastRegionHeight=e.height-g-southRegionHeight,eastRegionWidth=c.widthEast,p=this.eastSpace.container,p.setAttribute("id","descartesJS_east"),p.setAttribute("style","width:"+eastRegionWidth+"px;height:"+eastRegionHeight+
"px;background:#c0c0c0;position:absolute;left:"+(e.width-eastRegionWidth)+"px;top:"+g+"px;z-index:100;"),e.insertBefore(p,this.loader),A=0,C=m.length;A<C;A++)m[A].expresion=d.parse("(0,"+c.height*A+","+eastRegionWidth+","+c.height+")"),m[A].drawif=d.parse("1"),m[A].init();if(0<w.length)for(westRegionHeight=e.height-g-southRegionHeight,westRegionWidth=c.widthWest,p=this.westSpace.container,p.setAttribute("id","descartesJS_west"),p.setAttribute("style","width: "+westRegionWidth+"px;height:"+westRegionHeight+
"px;background:#c0c0c0;position:absolute;left:0px;top:"+g+"px;z-index:100;"),e.insertBefore(p,this.loader),A=0,C=w.length;A<C;A++)w[A].expresion=d.parse("(0,"+c.height*A+","+westRegionWidth+","+c.height+")"),w[A].drawif=d.parse("1"),w[A].init();if(this.editableRegionVisible)for(editableRegionHeight=c.height,p=this.editableRegion.container,p.setAttribute("id","descartesJS_editableRegion"),p.setAttribute("style","width:"+e.width+"px;height:"+editableRegionHeight+"px;position:absolute;left:0px;top:"+
(e.height-southRegionHeight-c.height)+"px;z-index:100;background:#c0c0c0;overflow:hidden;"),e.insertBefore(p,this.loader),d=this.editableRegion.textFields,e=e.width/d.length,c=a.getFieldFontSize(editableRegionHeight),A=0,C=d.length;A<C;A++)"div"==d[A].type?(p.appendChild(d[A].container),d[A].container.setAttribute("style","font-family:"+a.sansserif_font+";width:"+(e-4)+"px;height:"+editableRegionHeight+"px;position:absolute;left:"+A*e+"px;top:0;"),f=d[A].container.firstChild,f.setAttribute("style",
"font-family:"+a.sansserif_font+";font-size:"+c+"px;padding-top:0px;background-color:#e0e4e8;position:absolute;left:0;top:0;height:"+editableRegionHeight+"px;text-align:center;line-height:"+editableRegionHeight+"px;"),b=f.offsetWidth,f.style.width=b+"px",f.firstChild.textContent=f.firstChild.textContent.substring(3,f.firstChild.textContent.length-3),d[A].container.lastChild.setAttribute("style","font-family:"+a.monospace_font+";font-size:"+c+"px;width:"+(e-b)+"px;height:"+editableRegionHeight+"px;position:absolute;left:"+
b+"px;top:0;border:2px groove white;")):(p.appendChild(d[A]),d[A].setAttribute("style","font-family:"+a.monospace_font+";font-size:"+c+"px;width:"+e+"px;height:"+editableRegionHeight+"px;position:absolute;left:"+A*e+"px;top:0;border:2px groove white;"));this.displaceRegionNorth=g;this.displaceRegionSouth=southRegionHeight;this.displaceRegionEast=eastRegionWidth;this.displaceRegionWest=westRegionWidth;A=0;for(C=this.spaces.length;A<C;A++)this.spaces[A].init()};a.DescartesApp.prototype.update=function(){this.updateAuxiliaries();
this.updateControls();this.updateEvents();this.updateControls();this.updateSpaces()};a.DescartesApp.prototype.clearClick=function(){for(var a=0,c=this.spaces.length;a<c;a++)this.spaces[a].clearClick()};a.DescartesApp.prototype.removeButtonClick=function(){a.newBlobContent=null;for(var d=0,c=this.controls.length;d<c;d++)this.controls[d].buttonClick=!1};a.DescartesApp.prototype.deactivateGraphiControls=function(){for(var a,c=0,e=this.controls.length;c<e;c++)a=this.controls[c],"graphic"==a.type&&a.deactivate()};
a.DescartesApp.prototype.updateAuxiliaries=function(){for(var a=0,c=this.auxiliaries.length;a<c;a++)this.auxiliaries[a].update()};a.DescartesApp.prototype.updateEvents=function(){for(var a=0,c=this.events.length;a<c;a++)this.events[a].update()};a.DescartesApp.prototype.updateControls=function(){for(var a=0,c=this.controls.length;a<c;a++)this.controls[a].update()};a.DescartesApp.prototype.updateSpaces=function(a){for(var c=0,d=this.spaces.length;c<d;c++)this.spaces[c].update(a)};a.DescartesApp.prototype.clear=
function(){for(var a=0,c=this.spaces.length;a<c;a++)this.spaces[a].spaceChange=!0,this.spaces[a].drawBackground&&this.spaces[a].drawBackground()};a.DescartesApp.prototype.play=function(){this.animation.play()};a.DescartesApp.prototype.stop=function(){this.animation.stop()};a.DescartesApp.prototype.reinitAnimation=function(){this.animation.reinit()};a.DescartesApp.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)};a.DescartesApp.prototype.getImage=function(a){var c=this.images;return a?(c[a]||(c[a]=new Image,c[a].addEventListener("load",function(){this.ready=1}),c[a].addEventListener("error",function(){this.ready=0;this.errorload=1}),c[a].src=a),c[a]):new Image};a.DescartesApp.prototype.getAudio=function(d){var c=this.audios;if(d){if(!c[d]){var e=d.lastIndexOf(".");e=-1===e?d.lenght:e;d.substring(0,e);c[d]=new Audio(d);var f=function(a){this.ready=1};c[d].addEventListener("canplaythrough",
f);var b=function(a){this.canPlayType("audio/"+d.substring(d.length-3))||"mp3"!=d.substring(d.length-3)?(console.log("El archivo '"+d+"' no puede ser reproducido"),this.errorload=1):(c[d]=new Audio(d.replace("mp3","ogg")),c[d].addEventListener("canplaythrough",f),c[d].addEventListener("load",f),c[d].addEventListener("error",b),c[d].load())};c[d].addEventListener("error",b);c[d].play();a.setTimeout(function(){c[d].pause()},15)}return c[d]}return new Audio};a.DescartesApp.prototype.getControlByCId=
function(a){return this.getControlById(a,!0)};a.DescartesApp.prototype.getControlById=function(a,c){c=c?"cID":"id";for(var d,e=0,b=this.controls.length;e<b;e++)if(d=this.controls[e],d[c]==a)return d;return{update:function(){},w:0,h:0}};a.DescartesApp.prototype.getSpaceByCId=function(a){return this.getSpaceById(a,!0)};a.DescartesApp.prototype.getSpaceById=function(a,c){c=c?"cID":"id";for(var d,e=0,b=this.spaces.length;e<b;e++)if(d=this.spaces[e],d[c]==a)return d;return{update:function(){},w:0,h:0}};
a.DescartesApp.prototype.getURLParameters=function(){var a=window.location.href,c=a.indexOf("?");if(-1!=c){a=decodeURIComponent(a.substring(c+1)).split("&");for(var e=0,f=a.length;e<f;e++)c=a[e].split("="),2==c.length&&(+c[1]==+c[1]&&(c[1]=parseFloat(c[1])),this.evaluator.setVariable("URL."+c[0],c[1]))}};a.DescartesApp.prototype.getState=function(){var a="",c=this.evaluator.variables,e;for(e in c)if(c.hasOwnProperty(e)){var f=c[e];"string"==typeof f&&(f="'"+f+"'");void 0!=f&&"rnd"!=e&&"pi"!=e&&"e"!=
e&&"Infinity"!=e&&"-Infinity"!=e&&"object"!=typeof f&&(a=""!=a?a+"\n"+e+"="+f:e+"="+f)}c=this.evaluator.vectors;for(var b in c)c.hasOwnProperty(b)&&(f=c[b],a=a+"\n"+b+"="+g(f));b=this.evaluator.matrices;for(var h in b)b.hasOwnProperty(h)&&(f=b[h],a=a+"\n"+h+"="+g(f));return a};a.DescartesApp.prototype.setState=function(a,c){a=a.split("\n");for(var d,e,b=0,f=a.length;b<f;b++)d=a[b].split("="),2<=d.length&&(e=eval(d[1]),-1!=d[1].indexOf("[[")?(this.evaluator.matrices[d[0]]=e,this.evaluator.matrices[d[0]].rows=
e.length,this.evaluator.matrices[d[0]].cols=e[0].length):-1!=d[1].indexOf("[")?(this.evaluator.vectors[d[0]]=e,this.evaluator.variables[d[0]+".long"]=e.length):this.evaluator.variables[d[0]]=e);c||this.update()};a.DescartesApp.prototype.getEvaluation=function(){for(var a=0,c=0,e="",f=0,b=this.controls.length;f<b;f++)"textfield"==this.controls[f].gui&&this.controls[f].evaluate&&(a++,c+=this.controls[f].ok,this.controls[f].value=""==this.controls[f].value?"''":this.controls[f].value,e+=" \\n "+this.controls[f].id+
"="+this.controls[f].value+"|"+this.controls[f].ok);return"questions="+a+" \\n correct="+c+" \\n wrong="+(a-c)+e};a.DescartesApp.prototype.showSolution=function(){for(var a=this.controls,c=0,e=a.length;c<e;c++)"textfield"==a[c].gui&&a[c].evaluate&&a[c].changeValue(a[c].getFirstAnswer());this.update()};a.DescartesApp.prototype.showAnswer=function(){for(var a=0,c=this.saveState.length;a<c;a++)this.evaluator.eval(this.saveState[a]);this.update()};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"};a.DEBUG.setError=function(g,k){g="Error: "+g+" en\u300a "+k+" \u300b. ";var f="";switch(a.DEBUG.objectName){case "Auxiliar":k="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+=k+"\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){e=document.createElement("div");e.innerHTML='<div style="font-size:12px;visibility:hidden;">\n<div style="font-family:descartesJS_serif;">\n<span>_</span>\n<span style="font-weight:bold;">_</span>\n<span style="font-style:italic;">_</span>\n<span style="font-weight:bold;font-style:italic;">_</span>\n</div>\n<div style="font-family:descartesJS_sansserif;">\n<span>_</span>\n<span style="font-weight:bold;">_</span>\n<span style="font-style:italic;">_</span>\n<span style="font-weight:bold;font-style:italic;">_</span>\n</div>\n<div style="font-family:descartesJS_monospace;">\n<span>_</span>\n<span style="font-weight:bold;">_</span>\n<span style="font-style:italic;">_</span>\n<span style="font-weight:bold;font-style:italic;">_</span>\n</div>\n<div style="font-family:DJS_symbola;">\n<span>_</span>\n<span style="font-weight:bold;">_</span>\n<span style="font-style:italic;">_</span>\n<span style="font-weight:bold;font-style:italic;">_</span>\n</div>\n<div style="font-family:DJS_extra;">\n<span>_</span>\n<span style="font-weight:bold;">_</span>\n<span style="font-style:italic;">_</span>\n<span style="font-weight:bold;font-style:italic;">_</span>\n</div>\n<div style="font-family:DJS_sansserif;">\n<span>_</span>\n<span style="font-weight:bold;">_</span>\n<span style="font-style:italic;">_</span>\n<span style="font-weight:bold;font-style:italic;">_</span>\n</div>\n<div style="font-family:DJS_monospace;">\n<span>_</span>\n<span style="font-weight:bold;">_</span>\n<span style="font-style:italic;">_</span>\n<span style="font-weight:bold;font-style:italic;">_</span>\n</div>\n<div style="font-family:DJS_serif;">\n<span>_</span>\n<span style="font-weight:bold;">_</span>\n<span style="font-style:italic;">_</span>\n<span style="font-weight:bold;font-style:italic;">_</span>\n</div>\n</div>';
document.body.appendChild(e);a.getFeatures();if(a.hasCanvas){window.scrollTo(0,10);for(var f=document.querySelectorAll(".DescartesAppContainer"),d=0,c=f.length;d<c;d++)f[d].parentNode.removeChild(f[d]);d=document.querySelectorAll("applet,ajs");c=/Descartes|DescartesJS|descinst.DescartesWeb2_0.class|Arquimedes|Discurso/i;f=[];for(var g=0,k=d.length;g<k;g++)c.test(d[g].getAttribute("code"))&&f.push(d[g]);d=0;for(c=f.length;d<c;d++)a.apps.push(new a.DescartesApp(f[d])),f[d].className="DescartesJS";window.addEventListener("resize",
a.onResize);window.scrollTo(0,0)}else document.getElementById("StyleDescartesApps").innerHTML="applet.DescartesJS,applet,ajs.DescartesJS,ajs{display:block;}";document.body.removeChild(e)}if(a.loadLib)return a;a.apps=[];a.getDescartesApps=function(){return a.apps};(function(){var a=document.getElementById("StyleDescartesApps");a&&a.parentNode.removeChild(a);a=document.createElement("style");a.id="StyleDescartesApps";a.type="text/css";a.setAttribute("rel","stylesheet");a.innerHTML="applet.DescartesJS,applet,ajs.DescartesJS,ajs{display:none;}";
document.head.appendChild(a)})();a.onResize=function(e){0<a.apps.length&&a.apps[0].scaleToFit()};a.onMessage=function(e){if(0<a.apps.length){var f=e.data;f&&("set"===f.type?"string"==typeof f.value||"number"==typeof f.value?a.apps[0].evaluator.setVariable(f.name,f.value):f.value&&void 0!=f.value.rows?a.apps[0].evaluator.matrices[f.name]=f.value:a.apps[0].evaluator.vectors[f.name]=f.value:"update"===f.type?a.apps[0].update():"exec"===f.type?(e=a.apps[0].evaluator.getFunction(f.name))&&e.apply(a.apps[0].evaluator,
f.value.toString().split(",")):"isResizeNeeded"===f.type?e.source.postMessage({type:"doResize"},"*"):"doResize"===f.type&&0<a.apps.length&&a.apps[0].adjustSize())}};if(void 0==a.loadLib){a.loadLib=!0;window.addEventListener("load",g);window.addEventListener("message",a.onMessage);for(var k=["webkitTransitionEnd","transitionend","oTransitionEnd","MSTransitionEnd"],f=0,m=k.length;f<m;f++)window.addEventListener(k[f],function(e){a.onResize(e)})}return a}(descartesJS||{});
