/*
 Joel Espinosa Longi
 j.longi@gmail.com
 https://github.com/jlongi/DescartesJS
 LGPL - http://www.gnu.org/licenses/lgpl.html
 2015-09-07
*/
var babel=function(a){if(a.loadLib)return a;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.center=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.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.malla=a.mesh="mesh";a.local=a.Local="local";a.rectangle=a["rect\u00e1ngulo"]="rectangle";a.generic=a.generico="generic";a.loadLib=!0;a["GUI_espa\u00f1ol"]={decimal_symbol:"Simbolo decimal",language:"Lenguaje",about:"Cr\u00e9ditos",config:"Configuraci\u00f3n",init:"Inicio",clear:"Limpiar"};a.GUI_english={};a["GUI_catal\u00e0"]={};
a.GUI_euskera={};a["GUI_fran\u00e7ais"]={};a.GUI_galego={};a["GUI_portugu\u00eas"]={};a["GUI_valenci\u00e0"]={};a.translate=function(a,g){return g.charAt(0).toUpperCase()+g.substring(1)};a["LANG_espa\u00f1ol"]={"true":"s\u00ed","false":"no",decimal_symbol:"signo decimal",version:"Versi\u00f3n",language:"Idioma",Buttons:"Botones",about:"cr\u00e9ditos",init:"inicio",clear:"limpiar",widthEast:"ancho_este",widthWest:"ancho_oeste",type:"tipo",width:"ancho",height:"alto",drawif:"dibujar-si",exponentialif:"exponencial-si",
activeif:"activo-si",fixed:"fijo",scale:"escala",image:"imagen",bg_display:"despl_imagen",background:"fondo",file:"archivo",topleft:"arr-izq",stretch:"expand.",patch:"mosaico",imgcenter:"centrada",center:"centro",net:"red",net10:"red10",axes:"ejes",text:"texto",numbers:"n\u00fameros",x_axis:"eje-x",y_axis:"eje-y",sensitive_to_mouse_movements:"sensible_a_los_movimientos_del_rat\u00f3n",render:"despliegue",sort:"orden",painter:"pintor",split:"cortar",raytrace:"trazado de rayos",numeric:"num\u00e9rico",
region:"regi\u00f3n",north:"norte",south:"sur",east:"este",west:"oeste",external:"exterior",expresion:"expresi\u00f3n",space:"espacio",name:"nombre",value:"valor",incr:"incremento",gui:"interfaz",spinner:"pulsador",textfield:"campo de texto",menu:"men\u00fa",scrollbar:"barra",options:"opciones",button:"bot\u00f3n",graphic:"gr\u00e1fico",discrete:"discreto",decimals:"decimales",visible:"visible",action:"acci\u00f3n",playAudio:"reproducir",parameter:"par\u00e1metro",interior:"interior",condition:"condici\u00f3n",
action:"acci\u00f3n",event:"evento",openURL:"abrir URL",openScene:"abrir Escena",message:"mensaje",alternate:"alternar",execution:"ejecuci\u00f3n",calculate:"calcular",onlyText:"solo_texto",msg_pos:"pos_mensajes",color:"color",colorInt:"color-int",bold:"negrita",italics:"cursiva",underlined:"subrayada",font_size:"fuente puntos",size:"tama\u00f1o",constraint:"constricci\u00f3n",answer:"respuesta",weight:"peso","function":"funci\u00f3n",algorithm:"algoritmo",array:"vector",doExpr:"hacer",whileExpr:"mientras",
evaluate:"evaluar",range:"dominio",onlyOnce:"una-sola-vez",always:"siempre",matrix:"matriz",rows:"filas",columns:"columnas",constant:"constante",equation:"ecuaci\u00f3n",curve:"curva",sequence:"sucesi\u00f3n",text:"texto",point:"punto",segment:"segmento",arc:"arco",polygon:"pol\u00edgono",image:"imagen",abs_coord:"coord_abs",trace:"rastro",family:"familia",interval:"intervalo",steps:"pasos",fillP:"relleno+",fillM:"relleno-",fill:"relleno",spear:"punta",arrow:"flecha",radius:"radio",end:"fin",vectors:"vectores",
opacity:"opacidad",backcolor:"color_reverso",triangle:"tri\u00e1ngulo",face:"cara",surface:"superficie",cube:"cubo",box:"paralelep\u00edpedo",cone:"cono",cylinder:"cilindro",sphere:"esfera",tetrahedron:"tetraedro",octahedron:"octaedro",dodecahedron:"dodecaedro",icosahedron:"icosaedro",ellipsoid:"elipsoide",model:"modelo",light:"luz",metal:"metal",wire:"alambre",edges:"aristas",length:"largo",Animation:"Animaci\u00f3n",delay:"pausa",controls:"controles",loop:"repetir"};a.toLanguage=function(f,g){return a["LANG_"+
(g||"espa\u00f1ol")][f]||f};return a}(babel||{}),descartesJS=function(a){if(a.loadLib)return a;a.convertFont=function(a){if(""==a)return a;fontTokens=a.split(",");fontCanvas="";"bold"==fontTokens[1].toLowerCase()?fontCanvas+="Bold ":"italic"==fontTokens[1].toLowerCase()||"italics"==fontTokens[1].toLowerCase()?fontCanvas+="Italic ":"bold+italic"==fontTokens[1].toLowerCase()&&(fontCanvas+="Italic Bold ");fontName=fontTokens[0].split(" ")[0].toLowerCase();fontCanvas+=fontTokens[2]+"px ";return fontCanvas=
"serif"===fontName||"times new roman"===fontName||"timesroman"===fontName||"times"===fontName?fontCanvas+"descartesJS_serif,Times,'Times New Roman', serif":"sansserif"===fontName||"arial"===fontName||"helvetica"===fontName?fontCanvas+"descartesJS_sansserif,Arial,Helvetica,Sans-serif":fontCanvas+"descartesJS_monospace,Courier,'Courier New',Monospace"};a.getTextWidth=function(c,b){a.ctx.font=b;return Math.round(a.ctx.measureText(c).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};var f={ss_5:{a:5,d:3},ss_6:{a:5,d:3},ss_7:{a:6,d:3},ss_8:{a:7,d:3},ss_9:{a:9,d:4},ss_10:{a:10,d:4},ss_11:{a:11,d:4},ss_12:{a:12,d:4},ss_13:{a:13,d:4},ss_14:{a:13,d:4},ss_15:{a:14,d:4},ss_16:{a:15,d:4},ss_17:{a:15,d:5},ss_18:{a:16,d:5},ss_19:{a:18,d:5},ss_20:{a:19,d:5},ss_21:{a:19,d:6},ss_22:{a:20,d:6},ss_23:{a:21,d:6},ss_24:{a:21,d:7},ss_25:{a:23,d:6},ss_26:{a:25,d:7},ss_27:{a:26,d:7},ss_28:{a:26,d:7},ss_29:{a:27,d:7},ss_30:{a:28,d:8},ss_31:{a:28,
d:8},ss_32:{a:29,d:8},ss_33:{a:31,d:8},ss_34:{a:32,d:8},ss_35:{a:32,d:9},ss_36:{a:33,d:9},ss_37:{a:34,d:10},ss_38:{a:34,d:10},ss_39:{a:35,d:10},ss_40:{a:36,d:10},ss_41:{a:38,d:11},ss_42:{a:38,d:11},ss_43:{a:39,d:11},ss_44:{a:40,d:11},ss_45:{a:40,d:11},ss_46:{a:42,d:11},ss_47:{a:43,d:11},ss_48:{a:45,d:11},ss_49:{a:45,d:13},ss_50:{a:46,d:13},ss_51:{a:47,d:13},ss_52:{a:48,d:13},ss_53:{a:48,d:14},ss_54:{a:49,d:14},ss_55:{a:51,d:14},ss_56:{a:52,d:14},ss_57:{a:52,d:14},ss_58:{a:53,d:14},ss_59:{a:53,d:14},
ss_60:{a:54,d:14},ss_61:{a:55,d:15},ss_62:{a:56,d:15},ss_63:{a:57,d:15},ss_64:{a:58,d:15},ss_65:{a:59,d:16},ss_66:{a:60,d:16},ss_67:{a:60,d:16},ss_68:{a:61,d:16},ss_69:{a:62,d:17},ss_70:{a:63,d:17},ss_71:{a:64,d:17},ss_72:{a:65,d:17},ss_73:{a:66,d:17},ss_74:{a:66,d:17},ss_75:{a:67,d:17},ss_76:{a:68,d:17},ss_77:{a:70,d:18},ss_78:{a:70,d:18},ss_79:{a:71,d:18},ss_80:{a:72,d:18},ss_81:{a:73,d:20},ss_82:{a:73,d:20},ss_83:{a:74,d:20},ss_84:{a:75,d:20},ss_85:{a:77,d:20},ss_86:{a:77,d:20},ss_87:{a:78,d:20},
ss_88:{a:79,d:20},ss_89:{a:80,d:20},ss_90:{a:80,d:20},ss_91:{a:81,d:20},ss_92:{a:83,d:20},ss_93:{a:84,d:20},ss_94:{a:84,d:20},ss_95:{a:85,d:20},ss_96:{a:86,d:20},ss_97:{a:87,d:20},ss_98:{a:87,d:20},ss_99:{a:89,d:20},s_5:{a:4,d:4},s_6:{a:5,d:4},s_7:{a:6,d:4},s_8:{a:7,d:4},s_9:{a:9,d:4},s_10:{a:10,d:3},s_11:{a:11,d:4},s_12:{a:12,d:4},s_13:{a:12,d:4},s_14:{a:13,d:4},s_15:{a:13,d:5},s_16:{a:15,d:5},s_17:{a:15,d:5},s_18:{a:16,d:5},s_19:{a:16,d:6},s_20:{a:17,d:6},s_21:{a:18,d:6},s_22:{a:20,d:6},s_23:{a:20,
d:7},s_24:{a:21,d:7},s_25:{a:23,d:7},s_26:{a:23,d:7},s_27:{a:24,d:8},s_28:{a:26,d:8},s_29:{a:26,d:8},s_30:{a:27,d:8},s_31:{a:28,d:9},s_32:{a:28,d:9},s_33:{a:29,d:9},s_34:{a:31,d:9},s_35:{a:32,d:10},s_36:{a:32,d:10},s_37:{a:33,d:10},s_38:{a:34,d:10},s_39:{a:34,d:12},s_40:{a:35,d:12},s_41:{a:37,d:12},s_42:{a:38,d:12},s_43:{a:39,d:12},s_44:{a:40,d:12},s_45:{a:41,d:13},s_46:{a:41,d:13},s_47:{a:42,d:13},s_48:{a:43,d:13},s_49:{a:44,d:15},s_50:{a:45,d:15},s_51:{a:45,d:15},s_52:{a:46,d:15},s_53:{a:48,d:15},
s_54:{a:48,d:15},s_55:{a:49,d:15},s_56:{a:50,d:15},s_57:{a:51,d:15},s_58:{a:52,d:15},s_59:{a:53,d:15},s_60:{a:54,d:15},s_61:{a:54,d:17},s_62:{a:55,d:17},s_63:{a:56,d:17},s_64:{a:57,d:17},s_65:{a:58,d:17},s_66:{a:59,d:17},s_67:{a:60,d:17},s_68:{a:61,d:17},s_69:{a:61,d:18},s_70:{a:62,d:18},s_71:{a:63,d:18},s_72:{a:64,d:18},s_73:{a:65,d:19},s_74:{a:66,d:19},s_75:{a:67,d:19},s_76:{a:67,d:19},s_77:{a:68,d:20},s_78:{a:70,d:20},s_79:{a:71,d:20},s_80:{a:71,d:20},s_81:{a:72,d:21},s_82:{a:73,d:21},s_83:{a:73,
d:21},s_84:{a:75,d:21},s_85:{a:76,d:21},s_86:{a:77,d:21},s_87:{a:77,d:21},s_88:{a:78,d:21},s_89:{a:79,d:21},s_90:{a:81,d:21},s_91:{a:81,d:21},s_92:{a:82,d:21},s_93:{a:83,d:21},s_94:{a:83,d:21},s_95:{a:84,d:21},s_96:{a:86,d:21},s_97:{a:87,d:21},s_98:{a:87,d:21},s_99:{a:88,d:21},m_5:{a:4,d:3},m_6:{a:5,d:3},m_7:{a:6,d:3},m_8:{a:6,d:3},m_9:{a:9,d:4},m_10:{a:9,d:4},m_11:{a:10,d:5},m_12:{a:11,d:5},m_13:{a:11,d:6},m_14:{a:11,d:7},m_15:{a:12,d:6},m_16:{a:13,d:6},m_17:{a:14,d:7},m_18:{a:14,d:7},m_19:{a:15,
d:7},m_20:{a:16,d:7},m_21:{a:16,d:8},m_22:{a:17,d:8},m_23:{a:17,d:9},m_24:{a:19,d:9},m_25:{a:21,d:9},m_26:{a:21,d:9},m_27:{a:22,d:9},m_28:{a:22,d:10},m_29:{a:23,d:10},m_30:{a:24,d:10},m_31:{a:25,d:11},m_32:{a:26,d:11},m_33:{a:26,d:11},m_34:{a:27,d:11},m_35:{a:28,d:11},m_36:{a:28,d:12},m_37:{a:28,d:11},m_38:{a:30,d:11},m_39:{a:31,d:12},m_40:{a:31,d:12},m_41:{a:32,d:14},m_42:{a:32,d:14},m_43:{a:33,d:14},m_44:{a:34,d:14},m_45:{a:35,d:14},m_46:{a:36,d:14},m_47:{a:37,d:14},m_48:{a:37,d:14},m_49:{a:38,
d:17},m_50:{a:38,d:17},m_51:{a:39,d:17},m_52:{a:41,d:17},m_53:{a:41,d:18},m_54:{a:42,d:18},m_55:{a:43,d:18},m_56:{a:43,d:18},m_57:{a:44,d:19},m_58:{a:46,d:19},m_59:{a:46,d:19},m_60:{a:47,d:19},m_61:{a:47,d:21},m_62:{a:48,d:21},m_63:{a:49,d:21},m_64:{a:49,d:22},m_65:{a:51,d:21},m_66:{a:52,d:21},m_67:{a:52,d:21},m_68:{a:53,d:21},m_69:{a:53,d:22},m_70:{a:54,d:22},m_71:{a:55,d:22},m_72:{a:56,d:22},m_73:{a:57,d:23},m_74:{a:58,d:23},m_75:{a:58,d:23},m_76:{a:59,d:23},m_77:{a:59,d:24},m_78:{a:60,d:24},m_79:{a:62,
d:24},m_80:{a:62,d:24},m_81:{a:63,d:25},m_82:{a:64,d:25},m_83:{a:64,d:25},m_84:{a:65,d:25},m_85:{a:65,d:25},m_86:{a:67,d:25},m_87:{a:68,d:25},m_88:{a:68,d:25},m_89:{a:69,d:25},m_90:{a:70,d:25},m_91:{a:70,d:25},m_92:{a:71,d:25},m_93:{a:72,d:25},m_94:{a:73,d:25},m_95:{a:74,d:25},m_96:{a:74,d:25},m_97:{a:75,d:25},m_98:{a:76,d:25},m_99:{a:77,d:25}},g={};document.createElement("canvas");var c;a.getFontMetrics=function(a){if(g[a])return g[a];c=parseInt(a.match(/(\d+\.*)+px/)[0]);var b;a.match("sansserif")?
b="ss_":a.match("serif")?b="s_":a.match("monospace")&&(b="m_");b=f[b+c];b={ascent:b.a,descent:b.d,h:b.a+b.d,baseline:b.a};return g[a]=b};return a}(descartesJS||{}),descartesJS=function(a){function f(){var a,b,d,c,l,e,h,k,f;Number.prototype.originalToFixed=Number.prototype.toFixed;Number.prototype.toFixed=function(m){try{return this.originalToFixed(m)}catch(q){m=m?m:0;m=0>m?0:parseInt(m);a=this.toString();l=a.indexOf("e");if(-1!==l)if(e=a.split("e"),k="-"===e[0][0]?"-":"",h="-"===k?parseFloat(e[0].substring(1)).originalToFixed(11):
parseFloat(e[0]).originalToFixed(11),f=parseInt(e[1]),b=h.indexOf("."),0>b+f){b=0>b?1:b;var g=k+"0.",p;p=Math.abs(b+f);p=Array(p+1).join("0");a=g+p+h.replace(".","")}else h=h.replace(".",""),a=k+h+Array(f-h.length+2).join("0");b=a.indexOf(".");d="";if(-1===b)0<m&&(d="."),d+=Array(m+1).join("0"),a+=d;else if(c=a.length-b-1,c>=m)11>=m&&(a=parseFloat(a).originalToFixed(m)),a=0<m?a.substring(0,b+1+m):a.substring(0,b);else{g=0;for(m-=c;g<m;g++)d+="0";a+=d}return a}}}function g(a,b,d){a.fillStyle="#c0c0c0";
a.fillRect(b.offsetLeft,b.offsetTop,b.offsetWidth,b.offsetHeight);c(a,b,d.controls)}function c(a,b,d){for(var c,l=d.length-1;0<=l;l--)c=d[l],c.drawIfValue&&a.drawImage(c.getScreenshot(),b.offsetLeft+c.x,b.offsetTop+c.y)}if(a.loadLib)return a;var e=2*Math.PI,b=360/e,k=e/360,t=Math.floor,d,m,q,h,r,s,p,l,u;a.rangeOK=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 d in b.prototype)b.prototype.hasOwnProperty(d)&&
(a.prototype[d]=b.prototype[d]);a.prototype.uber=b.prototype};a.radToDeg=function(a){return a*b};a.degToRad=function(a){return a*k};a.drawLine=function(a,b,d,c,l,e,h){a.lineWidth=h||1;a.strokeStyle=e||"black";u=a.lineWidth%2?.5:0;a.beginPath();a.moveTo(t(b)+u,t(d)+u);a.lineTo(t(c)+u,t(l)+u);a.stroke()};a.getColor=function(a,b){if("string"==typeof b)return b;d=a.evalExpression(b);m=t(255*d[0][0]);q=t(255*d[0][1]);h=t(255*d[0][2]);r=1-d[0][3];return"rgba("+m+","+q+","+h+","+r+")"};a.getFeatures=function(){a.hasJavaSupport=
navigator.javaEnabled();var b=navigator.appVersion.toLowerCase();a.hasTouchSupport=window.hasOwnProperty&&window.hasOwnProperty("ontouchstart")||"ontouchstart"in window||b.match("android")&&!0;a.isIOS=!(!navigator.userAgent.match(/iPad/i)&&!navigator.userAgent.match(/iPhone/i));b=document.createElement("canvas");a.hasCanvasSupport=b.getContext&&b.getContext("2d");a.hasCanvasSupport&&(a.ctx=document.createElement("canvas").getContext("2d"),a._ratio=a.devicePixelRatio=a.backingStoreRatio=1);f()};a.removeNeedlessDecimals=
function(a){var b,d;if("string"==typeof a&&(b=a.indexOf("."),-1!=b)){d=a.substring(b);if(0==parseFloat(d))return a.substring(0,b);for(var c=d.length;0<c;c--)if(0!=d.charAt(c))return a.substring(0,b+c+1)}return a};a.returnValue=function(a){return"number"===typeof a?parseFloat(a.toFixed(11)):a};a.whichButton=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(a){a.touches?(s=a.touches[0],p=s.pageX,l=s.pageY):(p=a.clientX,
l=a.clientY);return{x:p,y:l}};a.getScreenshot=function(){var b=a.apps[0],d,l=document.createElement("canvas"),e=new Image;if(b){l.setAttribute("width",b.width);l.setAttribute("height",b.height);for(var h=l.getContext("2d"),k=0,f=b.spaces.length;k<f;k++)d=b.spaces[k],d.drawIfValue&&"R2"===d.type&&(h.drawImage(d.backgroundCanvas,d.x,d.y),h.drawImage(d.canvas,d.x,d.y),c(h,d.container,d.ctrs));0<b.northSpace.controls.length&&g(h,b.northSpace.container,b.northSpace);0<b.southSpace.controls.length&&g(h,
b.southSpace.container,b.southSpace);0<b.eastSpace.controls.length&&g(h,b.eastSpace.container,b.eastSpace);0<b.westSpace.controls.length&&g(h,b.westSpace.container,b.westSpace);e.src=l.toDataURL("image/png")}return e};a.showAbout=function(){var b;b=a.creativeCommonsLicense?"<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>\n</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>\n<p>\nEste objeto, creado con Descartes, est&aacute; licenciado\npor sus autores como\n<a href='http://creativecommons.org/licenses/by-nc-sa/4.0/'><nobr>Creative Commons</nobr></a>\n<br>\n<a href='http://creativecommons.org/licenses/by-nc-sa/4.0/'><img src='https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png'></a>\n</p></body> </html>":
"<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>\n</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>\n</body> </html>";
var d=window.open("","creditos","width=700,height=500,titlebar=0,toolbar=0,location=0,menubar=0,resizable=0,scrollbars=0,status=0");d.document.write(b);d.document.close()};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var f,g;a._externalFilesContent={};a.openExternalFile=function(c){if(a._externalFilesContent[c])return a._externalFilesContent[c];f=null;var e=!1;if(window.XMLHttpRequest)try{e=new XMLHttpRequest}catch(b){e=!1}else if(window.ActiveXObject)try{e=new ActiveXObject("Msxml2.XMLHTTP")}catch(k){try{e=
new ActiveXObject("Microsoft.XMLHTTP")}catch(t){e=!1}}g=e;g.open("GET",c,!1);try{g.send(null),f=g.responseText,f.match(String.fromCharCode(65533))&&(g.open("GET",c,!1),g.overrideMimeType("text/plain; charset=ISO-8859-1"),g.send(null),f=g.responseText)}catch(d){console.log("Error to load the file :",c),f=null}return f};a.addExternalFileContent=function(c,e){a._externalFilesContent[c]=e};return a}(descartesJS||{}),descartesJS=function(a){function f(a){n=a.indexOf("--radial--");-1!=n&&(a=a.substring(0,
n));b=a.trim();a={ignoreAcents:!1,ignoreCaps:!1,regExp:null};b[0]==b[b.length-1]&&"'"==b[0]&&(a.ignoreCaps=!0,b=b.substring(1,b.length-1),"`"==b[0]&&"\u00b4"==b[b.length-1]&&(a.ignoreAcents=!0,b=b.substring(1,b.length-1)));"`"==b[0]&&"\u00b4"==b[b.length-1]&&(a.ignoreAcents=!0,b=b.substring(1,b.length-1),b[0]==b[b.length-1]&&"'"==b[0]&&(a.ignoreCaps=!0,b=b.substring(1,b.length-1)));"*"===b.charAt(0)&&"*"!==b.charAt(b.length-1)?b=b.substring(1)+"$":"*"!==b.charAt(0)&&"*"===b.charAt(b.length-1)?b="^"+
b.substring(0,b.length-1):"*"!==b.charAt(0)&&"*"!==b.charAt(b.length-1)?b="^"+b+"$":"*"===b.charAt(0)&&"*"===b.charAt(b.length-1)&&(b=b.substring(1,b.length-1));b=b.replace(/\?/g,"[\\S\\s]{1}");a.regExp=b;return a}function g(a,d){b=(a||"").trim();a={ignoreAcents:!1,ignoreCaps:!1,regExp:null};a.expr=b.split(",");a.expr[0]=a.expr[0].trim();a.expr[0]={type:a.expr[0].charAt(0),expr:d.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:d.parser.parse(a.expr[1].substring(0,a.expr[1].length-1))};return a}function c(a,b,d){b=parseFloat(b);m=a.expr[0];q=a.expr[1];h=d.evalExpression(m.expr);r=d.evalExpression(q.expr);s="("==m.type;p="["==m.type;l=")"==q.type;u="]"==q.type;return(s&&b>h||p&&b>=h)&&(l&&b<r||u&&b<=r)?1:0}function e(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 b,k,t,d,m,q,h,r,s,p,l,u,n;a.buildRegularExpresionsPatterns=function(a,d){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++){k=a[c].split("&");t=[];for(var h=0,e=k.length;h<e;h++)b=k[h],-1===b.indexOf(",")||"("!==b.charAt(0)&&"["!==
b.charAt(0)||")"!==b.charAt(b.length-1)&&"]"!==b.charAt(b.length-1)?t.push(f(b)):t.push(g(b,d));a[c]=t}return a};a.escorrecto=function(b,l,h,f){h=h||a.externalEvaluator;f=f||a.buildRegularExpresionsPatterns(b,h);l=e(l);b=0;for(var m=f.length;b<m;b++){k=f[b];d=!0;for(var n=0,q=k.length;n<q;n++)d=k[n].regExp?d&&!!l.match(new RegExp(e(k[n].regExp),"i")):d&&c(k[n],l,h);if(d)return 1}return 0};a.esCorrecto=function(l,h,f,m){f=f||a.externalEvaluator;m=m||a.buildRegularExpresionsPatterns(l,f);l=0;for(var n=
m.length;l<n;l++){k=m[l];d=!0;for(var q=0,g=k.length;q<g;q++)(b=k[q].regExp)?(k[q].ignoreAcents&&(h=e(h),b=e(b)),k[q].ignoreCaps&&(h=h.toLowerCase(),b=e(b).toLowerCase()),d=d&&!!h.match(b)):d=d=d&&c(k[q],h,f);if(d)return 1}return 0};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;a.getCreativeCommonsLicenseImage=function(){var a=new Image;a.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFgAAAAfCAYAAABjyArgAAAABHNCSVQICAgIfAhkiAAACpVJREFUaIHtWm1sU9cZfu61iUYnPP/bJgdhhDbFkVYcCrR0tLHXrVNL01wvgUJDh820tivrkpQQtpEvA4HGhDoe/dCmNfbaVa1WKszX2oUO3xC0OHESm9Hi/FhloyQq1aY5OGgq8ce7H9f3xI7txKFsdKyPdHSPz8dzz33Oe77eY46IVBzHXcUXuOkgIo4DQABwuucUeJ4Hz/NQKBTgeQUUPA9ekXryPDiOB89x4DgO4DiZBQQCJQlJSiKZlEIikZCeyQQSiSSSyQTLS1KSlSciuTEsfjtgY+UmAAAHgGRxFQqFFHjFTFyhkPJ4RUpkDhzHp+ubEiclbFISM5FIhfR4IlPkZDLJhE0X+nbBxspNUALIFFehhDLjKYWTx0/B4/FgcHAQU9GpDKIlqiVYu3YtjN8xouLRR5BIKsDzcalDEjw4cJD6cgaUJGkkANIY4iRxR3x+uN9xIxgMZpTX6XQQqgSsWlNW0Md9Xng4APSns+9BqVQyUZVKpRQUSvSK52B73oaJiYmCGqTRaND4i0aUl9+PeCKBRCKOeDwVEnHE4wlm4emW/PHExzjS9SJGg6MAAIPBAL1eDwAIBAIQRREAUKIrwY7aHfja17+a8/1XPv4ELzle+lzwbKzcJAn8fu8ZKBXKGWGVi7BIqURrcxvcx9ysglqthiAI0Gq1KC8vBwD09vYiHA7D7XZjcnKSlRVMAhoad2LxHYsRj8cRi8cRj8cQj8czpwxK4mrkKn769LOIRqMQBAF2ux1arTajseFwGPX19XC73VCpVGi3tWd91LXoNdTuqPvc8MjzMJ3tO0t9/eeo39dPQwEfXfggQIJJIEiDl9RqNbW1tVEkEqG54HQ6Sa1Ws3oluhI6399HQ4Eh8g71U1//OfL0naUzYg+99+d36XTPKTrx7nHS6XQEgMxmcwafzDP7HTL328f/kBFKdCU5eRx2Oz3+2ObPxDM2Nkbe/n7y9vfT2NhYQTwAiAcARWoOVioUUCoyLVev18Pv96O1tRVqtTprGKTDbDYjFAqxoTQaHEWn7XDGXM6zHYm0G/F5fQgGgxAEAY27ds3JL79DEASMBkcx4vOz9BGfH6PBUawqK8O996xj6b/q6sLzNhtOnj6N3Q27MD4+XhBPent+/9prMKy/DzWbt6Bm8xYY1t+HMz09c/Kkg/q8feQd8tLIhWFyHHEwy9Hr9fNabS5EIhHS6/WMx/Gig0b+OkIDw1467+0jz3nJit99/4+kK5WsNxQKFcwfCoUIAOl0OmYt8igo+cY3acUyLZV/ez09/eMnCQC1tbXRwQMHCQAdffvtgnjk9nj7+yW+u9fRj7ZZqHFnA61YpqUVy7TksNvz8uSwYMmKbc/bAEjzrdPpnNdqc0GtVsPj8bC6toO21F46ZcFcak/N8wheCsJgMGTNcRaLhVm5xWLJyNNqtTAYDBkrezAo8VRUVGDjpk0YHx/HmZ4erFimxb+mrmHrE1tx6cMPUVVdXRCPVqtFNBpF0H8RAFAp/AC/dXWjo/MQ9rQ0AwBc3c68PDJ4AKlhK23F5N1CXV0dG+o3ArVaDbvdDgCYmJjAyROn2IFFEplj27Rc73G5XDnjMnLV0ev1sB3uxEFbB954601UVVfjo8th2A53YunSpXB1OxG8dKkgHhntL0gG95vfvcrSvvfggwCAaDSKT65cycsDpASWrcnj8QCQxKmtrWWFRFGEyWSC0WiE0WiE1WrNm9fV1cXyzGYzs2LPWU+a9XLg+BmB/xO4+5570NF5CGNjY2jc2YCyb92Jd44eRcXDG1CzeQubQ+eCSqWCw+HAHaoleOWVV3KW+fTT63NySAcNjgPPcRgcHAQACILAhBFFEUajMaOSKIoQRRG1tbUwmUxZeRcuXIDT6WRcLpcLg4OD0gkwJawkriRwIBDIapjZbGaWazabs/Jz1ZmdFo1GcaanBx2dh2C+ZEHFwxsAAANeLwa8XhQXF4NbpJyTZ5FSicaGBtyxeDFLG/B6WXyZdlne9gDMgqUPlk9oK1euZAXq6+sBSPNMKBSCx+OBVqvFtm3bmCXr9XqEQiEcO3YsY48MgMWnolPSe8ClPYHS0lKIoohwOJzRMLmDZscBaQ8qiiJ0Oh1L0+l0WTw/efIptO/dh1V3rkTN5i346HIYVdXV6Og8hJqtWwviGR8fR1tLKx5/bDPa9+5D+959aGlqAgDs2r07b3syBAaHjOGaPp/IPWM2m9lkHgqFYDabWZ58+BAEgeXJSF+8JKPNPDZvfExadOSOLARyWaFKYGlyPJ2no/MQLNu348o//o6/hUJw2O3Y09KMqupqWPfvQ9ma1fPyWLZvh2X7dgCAs7sbzu5uXP/0OjZUPIItNY/nbY+M7PHxX8a69eugK9XB7XbDYrFkWetsyKenEl1Jhh9g1ZoylOhKMniKi4uxp6UZX1q8GCPDw/hZXd0N8expacb3H3oIly+HAUijTldaOiePDMmCKdOLlT6fyNbscrkwOTmJQCCA5cuXw2q1sjz5mJyeJyN9yEpnM3l7PIPmtmaoVCq4XC6YTCZWh9K8bOFwGCaTCV1dXVCpVNhRuyPrY3b/sjEnz85dDXjjrTc/E8/qNatRVV2Nqupq6EpLC+IBUs4e38ggioqKsP7e+zAVnYLZbGaW5Ha7sxYyQJoyKisr8+bJ9evr69HV1YUlqiU4/5c+TE9PYzo2jVg8hlgsLjmDEnFE/jmJA9YDbC+p1+uh1+uhVqshiiLr9PmcNNei19BxwMacNLeShzl7BoYHUFRUBGuLFe5jbqjVakQiEVZQFEU4HA7mzDEYDGhtbWUd4HA4WNn0PABYvnw5wuEwHvjuAzhs78T16WnEZgks+42TiSR8Az4cO3rr3Yw3g4cJ7B3qx6JFRTh/7jxqn5X2v3a7HXVpc9aNwOVysVPY/gP78fCGhzAdm8Z0LIZ4LIZYfJbAORzw/8vYWLlJmoPlKx2DsRwajQYAYLVas7ZOC8Hk5CRbXTUaTcoRn7rFSCaRTM3FlLpyul3BA0CSkkgkpHu0fe17AUgCmUymDB9voZicnITRaGR1G3/emHKwJ2ZETrsyYovsrMX2dgEBoKbWJvKNDFLgop+e+OETGR41v9+/IE9XuidNMAkUuOgn38gg7W3fy9L/j8LMj7rnamnI76PADTjcI5EItbW1ZTjc16xdQxc+CNBQwEdNrU23+kNvSWDX9jKaW5tQaRKgVCpx2HYYr7/2Ostb6JWRdV8b4vE4BgYG8cxTz2A+pE8P8smSiDJOmbN/5+PJV0d+R6GOpnxtWhDH7NDc2iRZ8kU/dbteJY1GU3CPaTQachxxUOCin4YCPnr51y8XXJeI5oynp83HM1/9QrhylVkoR5YFy6h7rhY1W2vYVY/o6cWJ4yfmvLZ/VHgUBkM5u9A8fvwE9lv3F9DHEnJZS3reQqyO47i8z4VgtrXOXoTn48srMACsuqsMza0tKF6qSbuNSHc3ImPfKv/xZGJ8HC902nGu99yCP+azTA35eABkCbxQsXN1UiEccwos4/7y+7GhYgPuWn0XvqJSpf46Jb9ZetHVaBTDQ8M4ffL0goVN/wjWsJtgwbl+L2T+nG9NuGkCf4EbB09EX77VjbhdQUTcvwFtwhQyXNo3TwAAAABJRU5ErkJggg==";
return a};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var f=Math.floor,g,c,e,b,k,t,d,m,q,h,r,s,p;a.Color=function(a,d){this.b=this.g=this.r=0;this.a=1;this.evaluator=d;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,this.getColor=this.getColorString),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,this.getColor=this.getColorString),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+")",this.getColor=this.getColorString),"("===a[0]){c=[];e=this.splitComa(a.substring(1,a.length-1));for(var h=0,f=e.length;h<f;h++)b=
parseInt(e[h],16),e[h]!=b.toString(16)&&e[h]!=="0"+b.toString(16)?("["===e[h].charAt(0)&&"]"===e[h].charAt(e[h].length-1)&&(e[h]=e[h].substring(1,e[h].length-1)),c.push(this.evaluator.parser.parse(e[h]))):c.push(this.evaluator.parser.parse((b/255).toString()));this.rExpr=c[0];this.gExpr=c[1];this.bExpr=c[2];this.aExpr=c[3];this.getColor=this.getColorExpression}}else this.colorStr="rgba("+this.r+","+this.g+","+this.b+","+this.a+")",this.getColor=this.getColorString};a.Color.prototype.splitComa=function(a){k=
[];for(var b=m=d=t=0,c=a.length;b<c;b++)q=a.charAt(b),"("===q?t++:")"===q?t--:"["===q?d++:"]"===q?d--:","===q&&0===t&&0===d&&(k.push(a.substring(m,b)),m=b+1);k.push(a.substring(m));return k};a.Color.prototype.getColorString=function(){return this.colorStr};a.Color.prototype.getColorExpression=function(){g=this.evaluator;this.r=f(255*g.evalExpression(this.rExpr));this.g=f(255*g.evalExpression(this.gExpr));this.b=f(255*g.evalExpression(this.bExpr));this.a=1-g.evalExpression(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(",");h=parseInt(b[0]).toString(16);r=parseInt(b[1]).toString(16);s=parseInt(b[2]).toString(16);p=(255-parseInt(255*parseFloat(b[3]))).toString(16);h=1==h.length?"0"+h:h;r=1==r.length?"0"+r:r;s=1==s.length?"0"+s:s;p=1==p.length?"0"+p:p;return new a.Color(p+h+r+s)};return a}(descartesJS||{}),descartesJS=
function(a){if(a.loadLib)return a;var f=document.head,g=document.createElement("meta");g.setAttribute("http-equiv","X-UA-Compatible");g.setAttribute("content","IE=edge,chrome=1");f.appendChild(g);g=document.createElement("meta");g.setAttribute("name","viewport");g.setAttribute("content","width=device-width, initial-scale=1.0, user-scalable=yes");document.querySelector("meta[name=viewport]")||f.appendChild(g);g=document.createElement("meta");g.setAttribute("name","apple-mobile-web-app-capable");g.setAttribute("content",
"yes");f.appendChild(g);g=document.createElement("meta");g.setAttribute("name","apple-mobile-web-app-status-bar-style");g.setAttribute("content","black");f.appendChild(g);(f=document.getElementById("StyleDescartesApps2"))&&f.parentNode.removeChild(f);f=document.createElement("style");f.type="text/css";f.id="StyleDescartesApps2";f.setAttribute("rel","stylesheet");document.head.appendChild(f);f.innerHTML="div.DescartesCatcher{ background-color:rgba(255, 255, 255, 0); cursor:pointer; position:absolute; }\ndiv.DescartesAppContainer{ border:0px solid black; position:relative; overflow:hidden; top:0px; left:0px; }\ndiv.DescartesLoader{ background-color :#CACACA; position:absolute; overflow:hidden; top:0px; left:0px; }\ndiv.DescartesLoaderImage{ background-repeat:no-repeat; background-position:center; position:absolute; overflow:hidden; top:0px; left:0px; }\ncanvas.DescartesLoaderBar{ position:absolute; overflow:hidden; top:0px; left:0px; }\ncanvas.DescartesSpace2DCanvas, canvas.DescartesSpace3DCanvas, div.blocker{ touch-action:none; position:absolute; overflow:hidden; left:0px; top:0px; }\ndiv.DescartesSpace2DContainer, div.DescartesSpace3DContainer{ position:absolute; overflow:hidden; line-height:0px; }\ncanvas.DescartesButton{ position:absolute; cursor:pointer; }\ndiv.DescartesButtonContainer{ position:absolute; background-repeat:no-repeat; }\ndiv.DescartesSpinnerContainer, div.DescartesTextFieldContainer, div.DescartesMenuContainer{ background:lightgray; position:absolute; overflow:hidden; }\ninput.DescartesSpinnerField, input.DescartesTextFieldField, input.DescartesMenuField, input.DescartesScrollbarField{ -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; font-family:descartesJS_sansserif,Arial,Helvetica,Sans-serif; padding:0px; border:solid #666 1px; position:absolute; top:0px; }\nlabel.DescartesSpinnerLabel, label.DescartesMenuLabel, label.DescartesScrollbarLabel, label.DescartesTextFieldLabel{ font-family:descartesJS_sansserif,Arial,Helvetica,Sans-serif; font-weight:normal; text-align:center; text-overflow:ellipsis; white-space:nowrap; overflow:hidden; background-color:#e0e4e8; position:absolute; left:0px; top:0px; }\ndiv.DescartesGraphicControl{ touch-action:none; border-style:none; position:absolute; }\ndiv.DescartesTextAreaContainer{ position:absolute; overflow:hidden; background:#c0d0d8; }\nselect.DescartesMenuSelect{ font-family:descartesJS_sansserif,Arial,Helvetica,Sans-serif; padding-top:0px; text-align:center; text-overflow:ellipsis; white-space:nowrap; overflow:hidden; background-color:white; position:absolute; left:0px; top:0px; }\ndiv.DescartesScrollbarContainer{ touch-action:none; background:#eee; overflow:hidden; position:absolute; }\ndiv.DescartesEditorContainer{ font-family:descartesJS_sansserif,Arial,Helvetica,Sans-serif; position:fixed; left:0px; top:0px; width:100%; height:100%; background-color:#2e2e2e; z-index:10001; }\ndiv.DescartesEditorTabContainer{ width:100%; height:100%; position:absolute; padding:0px;  }\n.DescartesTabs{ height: 37px; }\n.DescartesTabs > ul{ font-size:18px; list-style:none; padding:0 1px 1px; margin-left:4px; text-align:center; }\n.DescartesTabs > ul > li{ margin-right:1px; padding:8px 8px; float:left; color:#fff; -webkit-user-select:none; -moz-user-select:none; user-select:none; border-radius:7px 7px 0px 0px; background:#0C91EC; background:-moz-linear-gradient(top, #0C91EC 0%, #257AB6 100%); background:-webkit-gradient(linear, left top, left bottom, color-stop(0%,#0C91EC), color-stop(100%,#257AB6)); }\n.DescartesTabs > ul > li:hover{ background:#fff; background:-moz-linear-gradient(top, #FFFFFF 0%, #F3F3F3 10%, #F3F3F3 50%, #FFFFFF 100%); background:-webkit-gradient(linear, left top, left bottom, color-stop(0%,#FFFFFF), color-stop(10%,#F3F3F3), color-stop(50%,#F3F3F3), color-stop(100%,#FFFFFF)); cursor:pointer; color:#000; }\n.DescartesTabs > ul > li.tabActiveHeader{ background:#fff; background:-moz-linear-gradient(top, #FFFFFF 0%, #F3F3F3 10%, #F3F3F3 50%, #FFFFFF 100%); background:-webkit-gradient(linear, left top, left bottom, color-stop(0%,#FFFFFF), color-stop(10%,#F3F3F3), color-stop(50%,#F3F3F3), color-stop(100%,#FFFFFF)); cursor:pointer; color:#000; }\n.DescartesTabscontent{ position:absolute; left:5px; right:5px; top:55px; bottom:45px; overflow:y-scroll; padding:10px 10px 25px; background:#000; background:-moz-linear-gradient(top, #FFFFFF 0%, #FFFFFF 90%, #e4e9ed 100%); background:-webkit-gradient(linear, left top, left bottom, color-stop(0%,#FFFFFF), color-stop(90%,#FFFFFF), color-stop(100%,#e4e9ed)); margin:0px; color:#000; background-color:#000; }\ndiv.DescartesConfigPanel{ position:absolute; left:10px; right:10px; top:10px; bottom:10px; overflow:y-scroll; border:solid 1px #000; border-radius:5px; font-size:18px; padding:10px; line-height:1.5em; overflow:auto; }\ndiv.DescartesLeftPanelClass{ position:absolute; left:10px; top:10px; bottom:10px; width:200px; background-color:; border:1px solid black; overflow:auto; }\ndiv.DescartesLeftPanelClass li:nth-child(odd){ background-color:#6495ED; }\ndiv.DescartesLeftPanelClass li:nth-child(even){ background-color:#ED6495; }\ndiv.DescartesLeftPanelClass > div > ul{ list-style:none; background:#bbb; padding:5px; }\ndiv.DescartesLeftPanelClass > div > ul > li{ padding:5px; -webkit-user-select:none; -moz-user-select:none; user-select:none; cursor:pointer; white-space: nowrap; overflow: hidden; }\ndiv.DescartesRightPanelClass{ position:absolute; left:220px; right: 10px; top:10px; bottom:10px; background-color:; border:1px solid black; overflow:auto; }\ndiv.DescartesLabelAndElementContainer{ padding:4px 8px; margin:4px; display:inline-block; background-color:lightgray; border-radius:3px; }\ndiv.DescartesLabelAndElementContainer > select{ font-family:Monospace; font-size:18px; }\ndiv.DescartesLabelAndElementContainer > input{ font-family:Monospace; font-size:18px; }\ndiv.DescarteslistContainer{ font-family:Arial,Helvetica,Sans-serif; font-size:20px; position:absolute; left:5px; right:5px; top:45px; bottom:45px; border-radius:5px; background-color:#DDD; overflow:auto; }\ndiv.DescarteslistContainer > ul{ margin:5px; padding:5px; padding-bottom:15px; list-style:none; }\ndiv.DescarteslistContainer > ul > li{ padding:7px; margin:1px; }\ndiv.DescarteslistContainer li:nth-child(odd){ background-color:#BBB; }\ndiv.DescarteslistContainer li:nth-child(even){ background-color:#999; }\ndiv.DescartesExtraInfo{ padding: 12px; }\nspan.DescartesSpanName{ background-color:lightblue; margin:5px; }\nspan.DescartesSpanValue{ background-color:#333; color:white; margin:0px; padding:5px; border-radius:3px; line-height:1.75em; }\nspan.DescartesSpanValue br{ display: none; }\nspan.DescartesSpanValue * { display: inline }\ndiv.Descartes_param_name{ background-color:#669; color:#ee5; margin-bottom:10px; }\n.DescartesToolbarPlace{ -webkit-box-sizing:border-box; -moz-box-sizing:border-box; box-sizing:border-box; text-align:center; border-radius:4px 4px 4px 4px;  position:absolute; left:5px; right:5px; top:0px; height:40px; min-width:290px; background: #ccc; padding:4px; }\n.DescartesButtonsPlace{ -webkit-box-sizing:border-box; -moz-box-sizing:border-box; box-sizing:border-box; text-align:center; border-radius:4px 4px 4px 4px;  position:absolute; left:5px; right:5px; bottom:0px; height:40px; min-width:290px; background: #ccc; padding:4px; }\ndiv.DescartesAddPanel{ position:absolute; top:10px; left:10px; width:350px; background-color:white; }\ndiv.DescarteslistContainer li.DescartesElementSelected{ border:1px solid black; background-color:#D66; }\ninput.DescartesEditorButton{ cursor:pointer; width:110px; height:30px; padding:5px 25px; margin:0px 2px; background:#257AB6; border:1px solid #fff; border-radius:7px; box-shadow: inset 0px 1px 0px #3e9cbf, 0px 2px 0px 0px #205c73, 0px 4px 5px #999; color:#fff; font-size:1em; }\ninput.DescartesEditorButton:hover, input.DescartesEditorButton:focus{ background-color:#0C91EC; box-shadow:0 0 1px rgba(0,0,0, .75); }\n";
return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var f=Math.sin,g=Math.floor,c=Math.random,e=Math.round,b=Math.abs,k=String.fromCharCode,t,d,m,q,h,r,s,p,l,u;a.Krypto=function(a){this.key=(a||0).toString()};a.Krypto.prototype.getKey=function(a){t=[];for(var d=0;256>d;d++)t[d]=k(this.alfanum(g(b(7.5*(f(1*d-a)+f(1.4*d+a)+f(.6*d-a)+f(2.2*d+a))))));return t.join("")};a.Krypto.prototype.encode=function(a){d=g(31*c());this.key=this.getKey(d);q=k(this.alfanum(d));return q+this.encripta(a)};
a.Krypto.prototype.decode=function(a){d=this.numalfa(a.charCodeAt(0));this.key=this.getKey(d);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;r=Array(3*a.length);for(var b=0,d=a.length;b<d;b++)l=256*g(a[b]+128)+e(255*c())+65536*e(255*c()),u=g((l<<this.shift(b))/256),r[3*b]=this.alfanum(u%32),r[3*b+1]=this.alfanum(u/32%
32),r[3*b+2]=this.alfanum(u/1024%32);return r};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;s=Array(a.length/3);for(var b=0,d=s.length;b<d;b++)u=this.numalfa(a[3*b])+32*this.numalfa(a[3*b+1])+1024*this.numalfa(a[3*b+2]),l=g(256*u>>this.shift(b)),p=g(l/256)%256-128,0>p&&(p+=256),s[b]=p;return s};a.Krypto.prototype.alfanum=function(a){a=g(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){q=Array(a.length);for(var b=0,d=a.length;b<d;b++)q[b]=a.charCodeAt(b);return q};a.Krypto.prototype.bytesToString=function(a){for(var b=0,d=a.length;b<d;b++)a[b]=k(a[b]);return a.join("")};a.Krypto.prototype.shift=function(a){m=this.key.charCodeAt(a%this.key.length);q=this.numalfa(m);h=g(q/2%8);0==h&&(h=4);return h};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 f=Math.max;window.requestAnimationFrame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame;window.cancelAnimationFrame=window.cancelAnimationFrame||window.mozCancelAnimationFrame;a.Animation=function(g,c){this.parent=g;var e=g.evaluator,b=e.parser,k=new a.Auxiliary(g);this.start=null;this.delay=c.delay?b.parse(c.delay):b.parse("60");
this.loop=c.loop?c.loop:!1;this.auto=void 0==c.auto?!0:c.auto;this.controls=c.controls;this.pause=!1;this.init=k.splitInstructions(b,c.init);this.doExpr=k.splitInstructions(b,c.doExpr);c.whileExpr&&(this.whileExpr=b.parse(c.whileExpr));var t=this,d,m,q=t.doExpr.length;this.animationExec=function(){for(m=0;m<q;m++)e.evalExpression(t.doExpr[m]);t.parent.update();t.playing&&(0<e.evalExpression(t.whileExpr)||t.loop)?(d=e.evalExpression(t.delay),window.requestAnimationFrame||(t.timer=setTimeout(t.animationExec,
f(d,10)))):(t.stop(),t.pause=!1,t.parent.update())};this.playing=!1;this.auto&&this.play()};a.Animation.prototype.play=function(){var a=this;this.playing?(this.pause=!0,this.stop()):(this.pause||this.reinit(),this.playing=!0,this.pause=!1,delay=this.parent.evaluator.evalExpression(this.delay),this.timer=window.requestAnimationFrame?requestAnimationFrame(function(c){a.step(c)}):setTimeout(this.animationExec,f(delay,10)))};a.Animation.prototype.stop=function(){this.playing=!1;window.requestAnimationFrame?
window.cancelAnimationFrame(this.timer):clearInterval(this.timer)};a.Animation.prototype.reinit=function(){for(var a=0,c=this.init.length;a<c;a++)this.parent.evaluator.evalExpression(this.init[a])};a.Animation.prototype.step=function(a){var c=this;null===c.start&&(c.start=a);delay=f(c.parent.evaluator.evalExpression(c.delay),10);a-c.start>delay&&(c.animationExec(),c.start=null);c.playing&&(c.timer=requestAnimationFrame(function(a){c.step(a)}))};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;
a.Action=function(a,g){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(f,g){a.Action.call(this,f,g);this.parameter=(g||"").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(f,g){a.Action.call(this,
f,g);var c=this.evaluator,e=c.parser;g=(g||"").replace(/&squot;/g,"'");g=g.replace(/;/g,"\\n");g=g.split("\\n")||[""];for(var b=[],k,t=0,d=g.length;t<d;t++)(k=e.parse(g[t],!0))&&b.push(k);d=b.length;this.execute=function(){for(t=0;t<d;t++)c.evalExpression(b[t])}};a.extend(a.Calculate,a.Action);return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;a.OpenURL=function(f,g){a.Action.call(this,f,g);this.parameter=g;this.target="_blank";var c=this.parameter.indexOf("target");-1!=c&&(this.target=
this.parameter.substring(c),this.target=this.target.substring(this.target.indexOf("=")+1),this.parameter=this.parameter.substring(0,c-1));if("javascript"==this.parameter.substring(0,10)){this.parameter=new a.SimpleText(f,this.parameter.substring(11).replace(/&squot;/g,"'"));var e=this;this.actionExec=function(){eval(e.parameter.toString())}}else"http://"!=this.parameter.substring(0,7)&&(this.parameter=window.location.href.substring(0,window.location.href.lastIndexOf("/")+1)+this.parameter),this.actionExec=
function(){window.open(this.parameter,this.target)}};a.extend(a.OpenURL,a.Action);a.OpenURL.prototype.execute=function(){this.actionExec()};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;a.OpenScene=function(f,g){a.Action.call(this,f,g);this.parameter=g;this.target="_blank";var c=this.parameter.indexOf("target");-1!=c&&(this.target=this.parameter.substring(c),this.target=this.target.substring(this.target.indexOf("=")+1),this.parameter=this.parameter.substring(0,c-1));"_blank"!==
this.target&&"_parent"!==this.target&&"_self"!==this.target&&"_top"!==this.target?this.actionExec=function(){window.parent.postMessage({type:"changeTarget",name:this.target,value:this.parameter},"*")}:"javascript"==this.parameter.substring(0,10)?(this.parameter=this.parameter.substring(11).replace(/&squot;/g,"'"),this.actionExec=function(){eval(this.parameter)}):("http://"!=this.parameter.substring(0,7)&&(this.parameter=window.location.href.substring(0,window.location.href.lastIndexOf("/")+1)+this.parameter),
this.actionExec=function(){window.open(this.parameter,this.target,"width="+this.parent.width+",height="+this.parent.height+",left="+(window.screen.width-this.parent.width)/2+", top="+(window.screen.height-this.parent.height)/2+"location=0,menubar=0,scrollbars=0,status=0,titlebar=0,toolbar=0")})};a.extend(a.OpenScene,a.Action);a.OpenScene.prototype.execute=function(){this.actionExec()};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;a.About=function(f,g){a.Action.call(this,
f,g);g||(this.urlAbout=window.location.href.substring(0,window.location.href.lastIndexOf("/")+1)+g)};a.extend(a.About,a.Action);a.About.prototype.execute=function(){if(this.urlAbout)var a=window.open(this.urlAbout,"_blank","width=800px,height=600px,location=no,menubar=no,scrollbars=yes");else a=window.open("about:blank","_blank","width=800px,height=600px,location=no,menubar=no,scrollbars=yes"),a.document.write("<hmtl><head><title>Cr\u00e9ditos</title></head><body><h1>Aqu\u00ed van los cr\u00e9ditos</h1></body></html>")};
return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;a.Config=function(f,g){a.Action.call(this,f,g)};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(f,g){a.Action.call(this,f,g)};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(f,g){a.Action.call(this,f,g)};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(f,g){a.Action.call(this,f,g)};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(f,g){a.Action.call(this,f,g)};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 f=/[\w\.\-//]*(\.ogg|\.oga|\.mp3|\.wav|\.OGG|\.OGA\.MP3|\.WAV)/g;a.PlayAudio=function(g,c){a.Action.call(this,g,c);c&&c.match(f)?this.filenameExpr=this.evaluator.parser.parse("'"+c.match(f)+"'"):this.filenameExpr=this.evaluator.parser.parse(c)};a.extend(a.PlayAudio,a.Action);a.PlayAudio.prototype.execute=function(){var a=this.theAudio=this.parent.getAudio(this.evaluator.evalExpression(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,e){this.parent=a;this.evaluator=this.parent.evaluator;this.expresion=this.id="";this.evaluate="onlyOnce";this.local="";for(var b in e)e.hasOwnProperty(b)&&(this[b]=e[b])};a.Auxiliary.prototype.firstRun=function(){};a.Auxiliary.prototype.update=function(){};var f,g;a.Auxiliary.prototype.splitInstructions=function(a,e){g=[];e=e?e.split(";"):[""];for(var b=0,k=e.length;b<k;b++)(f=a.parse(e[b],!0))&&g.push(f);return g};a.Auxiliary.prototype.getPrivateVariables=function(a,e){g=[];
e=e?e.split(/;|,/):[""];for(var b=0,k=e.length;b<k;b++)(f=a.parse(e[b],!0))&&g.push(f);b=0;for(k=g.length;b<k;b++)g[b]="asign"===g[b].type?g[b].childs[0].value:"identifier"===g[b].type?g[b].value:"";return g};a.Auxiliary.prototype.parseExpressions=function(a){this.init=this.splitInstructions(a,this.init);this.privateVars=this.getPrivateVariables(a,this.local);this.doExpr=this.splitInstructions(a,this.doExpr);this.whileExpr=a.parse(this.whileExpr)};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;
a.Variable=function(f,g){a.Auxiliary.call(this,f,g);var c=this.evaluator.parser;this.expresionString=this.expresion;(this.expresion=c.parse(this.expresionString))&&c.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"),g=document.createElement("label");g.appendChild(document.createTextNode("___"+this.id+"=___"));var c=
document.createElement("input");c.value=this.expresionString;c.disabled=!this.editable;a.appendChild(g);a.appendChild(c);var e=this,b=e.evaluator.parser;c.onkeydown=function(a){13==a.keyCode&&(e.expresion=b.parse(this.value),b.setVariable(e.id,e.expresion),e.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(f,g){a.Auxiliary.call(this,f,g);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.evalExpression(this.expresion))};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var f,g,c;a.Vector=function(c,b){f=c.evaluator;g=f.parser;this.size=g.parse("3");a.Auxiliary.call(this,c,b);this.expresion=this.expresion.split(";");this.parseFile=g.parse(this.file);this.update()};a.extend(a.Vector,a.Auxiliary);a.Vector.prototype.update=function(){var e=
this.expresion;f=this.evaluator;g=f.parser;this.oldFile=this.file;if(c=f.evalExpression(this.parseFile))this.file=c;var b;if(this.file){b=(vectorElement=document.getElementById(this.file))&&"descartes/vectorFile"==vectorElement.type?vectorElement.text:a.openExternalFile(this.file);if(null!=b){b=b.replace(/\r/g,"").split("\n");for(var k=[],t=0,d=b.length;t<d;t++)""!=b[t]&&k.push(b[t]);b=k}null==b||1==b.length&&""==b[0]?this.size=g.parse("0"):(e=b,this.size=null);null===this.size&&(this.size=g.parse(e.length+
""))}b=[];t=0;for(d=e.length;t<d;t++)(k=g.parse(e[t],!0))&&"asign"!=k.type&&(k=g.parse(this.id+"["+t+"]="+e[t],!0)),b.push(k);e=[];e._size_=f.evalExpression(this.size);t=0;for(d=this._size_;t<d;t++)e.push(0);f.vectors[this.id]=e;f.setVariable(this.id+".long",e._size_);t=0;for(d=b.length;t<d;t++)f.evalExpression(b[t])};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;a.Matrix=function(f,g){var c=f.evaluator,e=c.parser;this.rows=e.parse("3");this.columns=e.parse("3");a.Auxiliary.call(this,
f,g);this.expresion=this.splitInstructions(e,this.expresion);var e=c.evalExpression(this.rows),b=c.evalExpression(this.columns),k=[];k.type="matrix";for(var t,d=0;d<b;d++){t=[];for(var m=0,q=e;m<q;m++)t.push(0);k[d]=t}c.matrices[this.id]=k;this.update()};a.extend(a.Matrix,a.Auxiliary);a.Matrix.prototype.update=function(){var a=this.evaluator,g=a.evalExpression(this.rows),c=a.evalExpression(this.columns);a.setVariable(this.id+".filas",g);a.setVariable(this.id+".columnas",c);var e=a.matrices[this.id];
e.rows=g;e.cols=c;g=0;for(c=this.expresion.length;g<c;g++)a.evalExpression(this.expresion[g])};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;a.Function=function(f,g){a.Auxiliary.call(this,f,g);var c=this.evaluator,e=c.parser,b=this.id.indexOf("(");this.name=this.id.substring(0,b);this.params=this.id.substring(b+1,this.id.indexOf(")"));this.domain=this.range?e.parse(this.range):e.parse("1");this.params=""==this.params?[]:this.params.split(",");this.numberOfParams=this.params.length;
this.algorithm||(this.whileExpr=this.doExpr=this.init="");this.parseExpressions(e);this.expresion=e.parse(this.expresion);var k=this;this.functionExec=function(){this.iterations=0;if(k.numberOfParams<=arguments.length){for(var b=[],d=0,e=k.privateVars.length;d<e;d++)b.push(c.getVariable(k.privateVars[d])),c.setVariable(k.privateVars[d],0);for(var f=[],d=0,e=k.params.length;d<e;d++)f[d]=c.getVariable(k.params[d])||0,c.setVariable(k.params[d],arguments[d]);d=0;for(e=k.init.length;d<e;d++)c.evalExpression(k.init[d]);
do{d=0;for(e=k.doExpr.length;d<e;d++)c.evalExpression(k.doExpr[d]);if(1E5<++this.iterations)return console.log("se ha excedido el l\u00edmite de 100000 repeticiones en la funci\u00f3n << "+k.name+" >>"),0}while(0<c.evalExpression(k.whileExpr));var h=c.evalExpression(k.expresion);a.rangeOK=c.evalExpression(k.domain);d=0;for(e=k.params.length;d<e;d++)c.setVariable(k.params[d],f[d]);d=0;for(e=k.privateVars.length;d<e;d++)c.setVariable(k.privateVars[d],b[d]);return h}return 0};c.setFunction(this.name,
this.functionExec)};a.extend(a.Function,a.Auxiliary);return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;a.Algorithm=function(f,g){a.Auxiliary.call(this,f,g);var c=this.evaluator;this.parseExpressions(c.parser);this.algorithmExec=function(){for(var a=this.iterations=0,b=this.init.length;a<b;a++)c.evalExpression(this.init[a]);do{a=0;for(b=this.doExpr.length;a<b;a++)c.evalExpression(this.doExpr[a]);if(1E5<++this.iterations)return console.log("se ha excedido el l\u00edmite de 100000 repeticiones en el algoritmo << "+
self.name+" >>"),0}while(0<c.evalExpression(this.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(f,g){a.Auxiliary.call(this,f,g);var c=this.evaluator;delete this.evaluate;this.condition=c.parser.parse(this.condition);this.lastEvaluation=!1;this.action=this.parent.lessonParser.parseAction(this);
"onlyOnce"==this.execution&&(this.eventExec=function(){0<this.evaluator.evalExpression(this.condition)&&!this.lastEvaluation&&(this.lastEvaluation=!0,this.action.execute())});"alternate"==this.execution&&(this.eventExec=function(){var a=0<this.evaluator.evalExpression(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.evalExpression(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;var f,g,c,e,b;a.Graphic=function(b,c){this.parent=b;this.evaluator=b.evaluator;var d=this.evaluator.parser;this.spaceID="";this.background=!1;this.type="";this.drawif=d.parse("1");this.abs_coord=!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=d.parse("(0,0)");this.family="";this.family_interval=d.parse("[0,1]");this.family_steps=d.parse("8");this.editable=!1;this.font=5<=this.parent.version?"Monospaced,PLAIN,15":"Monospaced,PLAIN,12";this.fixed=!0;this.text="";this.decimals=d.parse("2");for(var e in c)c.hasOwnProperty(e)&&(this[e]=c[e]);this.space=this.getSpace();this.canvas=this.background?
this.space.backgroundCanvas:this.space.canvas;this.ctx=this.canvas.getContext("2d");this.trace&&(this.traceCtx=this.space.backgroundCanvas.getContext("2d"));this.font=a.convertFont(this.font);this.fontSize=(this.fontSize=this.font.match(/([\d\.]+)px/))?parseFloat(this.fontSize[1]):10};a.Graphic.prototype.getSpace=function(){for(var a=this.parent.spaces,b,d=0,c=a.length;d<c;d++)if(b=a[d],b.id==this.spaceID)return b;return a[0]};a.Graphic.prototype.getFamilyValues=function(){f=this.evaluator;g=f.evalExpression(this.family_interval);
this.familyInf=g[0][0];this.familySup=g[0][1];this.fSteps=Math.round(f.evalExpression(this.family_steps));this.family_sep=0<this.fSteps?(this.familySup-this.familyInf)/this.fSteps:0};a.Graphic.prototype.drawFamilyAux=function(a,b,d){f=this.evaluator;this.getFamilyValues();c=f.getVariable(this.family);if(0<=this.fSteps)for(var e=0,q=this.fSteps;e<=q;e++)f.setVariable(this.family,this.familyInf+e*this.family_sep),0<f.evalExpression(this.drawif)&&(this.update(),this.drawAux(a,b,d));f.setVariable("_Text_H_",
0);f.setVariable(this.family,c)};a.Graphic.prototype.draw=function(a,b){""!=this.family?this.drawFamilyAux(this.ctx,a,b):0<this.evaluator.evalExpression(this.drawif)&&(this.update(),this.drawAux(this.ctx,a,b))};a.Graphic.prototype.drawTrace=function(a,b){""!=this.family?this.drawFamilyAux(this.traceCtx,a,b):0<this.evaluator.evalExpression(this.drawif)&&(this.update(),this.drawAux(this.traceCtx,a,b))};a.Graphic.prototype.drawText=function(a,c,d,m,q,h,g,s,p,l,u){if("rtfNode"===c.type)a.fillStyle=q.getColor(),
a.strokeStyle=q.getColor(),a.textBaseline="alphabetic",c.draw(a,d,m+1,p,l,g,u,q.getColor());else for("simpleText"===c.type&&(c=c.toString(p,l).split("\\n")),d+=h.match("Arial")?-2:h.match("Times")?-2:0,f=this.evaluator,a.fillStyle=q.getColor(),a.font=h,a.textAlign=g,a.textBaseline=s,this.border&&(a.strokeStyle=this.border.getColor(),a.lineWidth=4),b=1.2*this.fontSize||0,q=0,h=c.length;q<h;q++)e=c[q],this.border&&(a.lineJoin="round",a.miterLimit=2,a.strokeText(e,d,m+b*q)),a.fillText(e,d,m+b*q)};return a}(descartesJS||
{}),descartesJS=function(a){if(a.loadLib)return a;a.SimpleText=function(a,e){this.text=e=e.replace("&#x2013","\u2013").replace(/\&squot;/g,"'");this.textElements=[];this.textElementsMacros=[];this.parent=a;this.evaluator=a.evaluator;this.type="simpleText";for(var b="'",f=0,g=0,d=-1,m,q;f<e.length;)m=e.charAt(f),q=e.charAt(f-1),"["===m&&"\\"===q?(this.textElements.push(e.substring(g,f-1)+"["),this.textElementsMacros.push("'"+e.substring(g,f-1)+"['"),g=f+1):"]"===m&&"\\"===q?(this.textElements.push(e.substring(g,
f-1)+"]"),this.textElementsMacros.push("'"+e.substring(g,f-1)+"]'"),g=f+1):"["===m&&-1===d?(this.textElements.push(e.substring(g,f)),this.textElementsMacros.push("'"+e.substring(g,f)+"'"),g=f,d++):"["===m?d++:"]"===m&&0===d?(this.textElements.push(this.evaluator.parser.parse(e.substring(g,f+1))),this.textElementsMacros.push("["+e.substring(g,f+1)+"]"),g=f+1,d--):("]"==e.charAt(f)&&(d=0>d?d:d-1),b+=e.charAt(f)),f++;this.textElements.push(e.substring(g,f));this.textElementsMacros.push("'"+e.substring(g,
f)+"'")};var f,g;a.SimpleText.prototype.toString=function(c,e){f="";for(var b=0,k=this.textElements.length;b<k;b++)"string"===typeof this.textElements[b]?f+=this.textElements[b]:(g=this.evaluator.evalExpression(this.textElements[b])[0][0],""!==g&&("string"===typeof g?f+=g:(g=parseFloat(g),g=e?g.toFixed(c):a.removeNeedlessDecimals(g.toFixed(c)),f+=g.toString().replace(".",this.parent.decimal_symbol))));return f};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var f,g,c,e,b,
k,t,d,m,q,h,r,s,p,l,u,n,v,w,z,C,A,D,G,E,B,J;a._debug_vez=0;a.Equation=function(b,d){this.width=b.evaluator.parser.parse("1");this.fillM=this.fillP="";a.Graphic.call(this,b,d);this.parseExpression();(this.visible=2===this.parent.version&&void 0==this.visible?!0:this.visible)&&this.registerTextField();r=new a.R2;s=new a.R2;p=new a.R2;n=new a.R2;l=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],
d=this.expresion.childs[1];"identifier"!=b.type||"y"!=b.value||d.contains("y")?"identifier"!=d.type||"y"!=d.value||b.contains("y")?"identifier"!=b.type||"x"!=b.value||d.contains("x")?"identifier"!=d.type||"x"!=d.value||b.contains("x")||(this.of_y=!0,this.funExpr=d,this.drawAux=this.drawAuxFun):(this.funExpr=d,this.of_y=!0,this.drawAux=this.drawAuxFun):(this.funExpr=b,this.of_y=!1,this.drawAux=this.drawAuxFun):(this.funExpr=d,this.of_y=!1,this.drawAux=this.drawAuxFun)}this.newt=new a.R2Newton(this.evaluator,
this.expresion)};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,d){g=this.evaluator;this.getFamilyValues();tempParam=g.getVariable(this.family);if(0<=this.fSteps)for(var c=0,l=this.fSteps;c<=l;c++)g.setVariable(this.family,this.familyInf+c*this.family_sep),this.update(),this.drawAux(a,b,d);g.setVariable(this.family,
tempParam)};a.Equation.prototype.drawTrace=function(){this.uber.drawTrace.call(this,this.fill,this.trace)};var y,I,F,x,K,H,M;a.Equation.prototype.drawAux=function(L,N,R){if(!(0>=this.evaluator.evalExpression(this.drawif))){g=this.evaluator;c=g.parser;e=this.space;b=g.evalExpression(this.width);L.strokeStyle=this.color.getColor();L.lineWidth=b;k=c.getVariable("x");t=c.getVariable("y");d=e.w+24;m=e.h+24;q=d/9;3>q&&(q=3);h=m/7;3>h&&(h=3);0==this.cInd?(f=[],this.cInd++):this.cInd=(this.cInd+1)%1E5;r.set(0,
0);s.set(0,0);p.set(0,0);H=.25;M=8;this.abs_coord||(H/=e.scale,M/=e.scale);L.beginPath();for(J=parseInt(h/2);J<m;J+=h)for(B=parseInt(q/2);B<d;B+=q){if(this.abs_coord){n.set(B,J);u=this.newt.findZero(n,H);if(null==u)continue;g.setVariable("x",u.x);g.setVariable("y",u.y);l.set(u.x,u.y)}else{n.set(e.getRelativeX(B),e.getRelativeY(J));u=this.newt.findZero(n,H);if(null==u)continue;g.setVariable("x",u.x);g.setVariable("y",u.y);l.set(e.getAbsoluteX(u.x),e.getAbsoluteY(u.y))}v=l.ix();w=l.iy();if(-12<=v&&
v<d+24&&-12<=w&&w<m+24){if(f[v+12+(w+12)*e.w]===this.cInd)continue;f[v+12+(w+12)*e.w]=this.cInd}a.rangeOK&&(L.moveTo(v,w),L.lineTo(v,w));r.x=u.x;r.y=u.y;s.x=u.x;s.y=u.y;z=this.newt.getUnitNormal();if(0!=z.x||0!=z.y)for(z.rotL90(),p.x=z.x,p.y=z.y,A=C=0,D=!1;2>A;)if(D&&(p.x=-z.x,p.y=-z.y,u.x=r.x,u.y=r.y,s.x=u.x,s.y=u.y,this.abs_coord?l.set(u.x,u.y):l.set(e.getAbsoluteX(u.x),e.getAbsoluteY(u.y)),v=l.ix(),w=l.iy(),D=!1,C=0),u.x+=M*p.x,u.y+=M*p.y,u=this.newt.findZero(u,H),null!=u){g.setVariable("x",u.x);
g.setVariable("y",u.y);p.x=u.x-s.x;p.y=u.y-s.y;p.normalize();if(0==p.x&&0==p.y)break;s.x=u.x;s.y=u.y;this.abs_coord?l.set(u.x,u.y):l.set(e.getAbsoluteX(u.x),e.getAbsoluteY(u.y));G=parseInt(l.ix());E=parseInt(l.iy());if(G!=v||E!=w)if(y=v,I=w,v=G,w=E,-12<=v&&v<d+24&&-12<=w&&w<m+24){C=0;F=f[v+12+(w+12)*e.w];f[v+12+(w+12)*e.w]=this.cInd;for(N=1;8>N;N++)x=y+Math.round((v-y)*N/8),K=I+Math.round((w-I)*N/8),0<=x&&x<d&&0<=K&&K<m&&(f[x+12+(K+12)*e.w]=this.cInd);a.rangeOK&&(L.moveTo(y,I),L.lineTo(v,w));if(F===
this.cInd)break}else D=!0,A++;else 4<++C&&(D=!0,A++)}}L.stroke()}};a.Equation.prototype.X=function(a,b,d){d||(b=this.space.w/2+this.space.Ox+this.space.scale*b);b<-a&&(b=-a);b>this.space.w+a&&(b=this.space.w+a);return b};a.Equation.prototype.Y=function(a,b,d){d||(b=this.space.h/2+this.space.Oy-this.space.scale*b);b<-a&&(b=-a);b>this.space.h+a&&(b=this.space.h+a);return b};a.Equation.prototype.XX=function(a,b,d){return Math.round(this.X(a,b,d))};a.Equation.prototype.YY=function(a,b,d){return Math.round(this.Y(a,
b,d))};a.Equation.prototype.extrapolate=function(b,d,c,l,h,e){for(var f=this.evaluator.getVariable(d),m=e/2,k=0,q,g,p,n,s,r;1E-15<Math.abs(m);){q=this.evaluator.getVariable(d);g=this.evaluator.getVariable(d)+m;this.evaluator.setVariable(d,g);p=!0;try{n=h,h=this.evaluator.evalExpression(this.funExpr),this.evaluator.setVariable(c,h),0<this.evaluator.evalExpression(b)?(s=new a.R2(Math.min(n,h),Math.max(n,h)),r=0,r=0<e?this.Singularity(Math.abs(m),d,l,q,n,g,h,s):this.Singularity(Math.abs(m),d,l,g,h,q,
n,s),0<r&&(p=!1)):p=!1}catch(t){p=!1}p?k+=m:this.evaluator.setVariable(d,q);m/=2}this.evaluator.setVariable(d,f);return new a.R2(k/Math.abs(e),h)};a.Equation.prototype.extrapolateOnSingularity=function(b,d,c,l,h,e){l=this.evaluator.getVariable(d);for(var f=e/2,m=0,k=h,q;1E-15<Math.abs(f);){this.evaluator.setVariable(d,this.evaluator.getVariable(d)+f);q=!0;if(0<this.evaluator.evalExpression(b))try{k=this.evaluator.evalExpression(this.funExpr),this.evaluator.setVariable(c,k),0>=this.evaluator.evalExpression(b)&&
(q=!1)}catch(g){q=!1}else q=!1;q?m+=f:this.evaluator.setVariable(d,this.evaluator.getVariable(d)-f);f/=2}if(0==m)for(f=e/2,m=e,k=h;1E-15<Math.abs(f);){this.evaluator.setVariable(d,this.evaluator.getVariable(d)-f);q=!0;if(0<this.evaluator.evalExpression(b))try{k=this.evaluator.evalExpression(this.funExpr)}catch(p){q=!1}else q=!1;q?m+=-f:this.evaluator.setVariable(d,this.evaluator.getVariable(d)+f);f/=2}this.evaluator.setVariable(d,l);return new a.R2(m/Math.abs(e),k)};a.Equation.prototype.Singularity=
function(a,b,d,c,l,h,e,f){if(isNaN(e)||isNaN(l)||isNaN(f.y)||isNaN(f.x)||c>=h)return 2;var m=this.evaluator.getVariable(b),k=0;try{if(1E-15>Math.abs(h-c)||1E-12>Math.abs(h-c)&&Math.abs(e-l)>Math.abs(a))return this.evaluator.setVariable(b,m),1;var q=(c+h)/2;this.evaluator.setVariable(b,q);var g=NaN;try{g=this.evaluator.evalExpression(this.funExpr)}catch(p){return 2}if(isNaN(g))return 2;if(Math.abs(e-l)>a){this.evaluator.setVariable(b,c-1E-12);var n=this.evaluator.evalExpression(this.funExpr),n=(l-
n)/1E-12;this.evaluator.setVariable(b,h+1E-12);var s=(this.evaluator.evalExpression(this.funExpr)-e)/1E-12,r=(e-l)/(h-c);if((10>Math.abs(s)||10>Math.abs(n))&&(0<=s&&0<=n||0>=s&&0>=n)&&4*Math.abs(s)<Math.abs(r))return this.evaluator.setVariable(b,m),2}if(isNaN(f.x)||isNaN(f.y)||isNaN(g))return 2;if(!(f.x<=g&&g<=f.y)){this.evaluator.setVariable(b,q);f.x=Math.min(l,g);f.y=Math.max(l,g);var t=this.Singularity(a/2,b,d,c,l,q,g,f);this.evaluator.setVariable(b,h);f.x=Math.min(e,g);f.y=Math.max(e,g);var v=
this.Singularity(a/2,b,d,q,g,h,e,f),k=Math.max(t,v)}}catch(u){k=1}this.evaluator.setVariable(b,m);return k};a.Equation.prototype.drawAuxFun=function(b,d,c){k=this.evaluator.parser.getVariable("x");t=this.evaluator.parser.getVariable("y");a.rangeOK=1;d="x";c="y";this.of_y&&(d="y",c="x");var l=this.drawif,h=this.evaluator.evalExpression(this.width),e=!1,f=new a.R2(this.space.w/2+this.space.Ox,this.space.h/2+this.space.Oy),f=this.of_y?f.ix():f.iy(),m=0,q=0,g=0,p=0,n=1/this.space.scale,s=n*(this.of_y?
Math.ceil(-this.space.h+(this.space.h/2+this.space.Oy)):-Math.ceil(this.space.w/2+this.space.Ox)),r=0;this.abs_coord&&(s=0,n=1);for(var v,u,w,H,J,C,y,x,z,B=this.of_y?this.space.h+4:this.space.w+4;g<=B;){v=!0;u=0;this.evaluator.setVariable(d,s);try{w=this.evaluator.evalExpression(this.funExpr),isNaN(w)||(this.evaluator.setVariable(c,w),0<this.evaluator.evalExpression(this.drawif)&&a.rangeOK?(e?(H=Math.min(r,w),J=Math.max(r,w),C=new a.R2(H,J),u=this.Singularity(n,d,0,s-n,r,s,w,C),0===u?(r<=w?(r=C.x,
w=C.y):(w=C.x,r=C.y),y=parseInt(this.of_y?this.XX(h,r,this.abs_coord):this.YY(h,r,this.abs_coord)),m=this.abs_coord?Math.round(w):parseInt(this.of_y?this.XX(h,w,this.abs_coord):this.YY(h,w,this.abs_coord)),this.fillM&&m>f&&(b.lineWidth=1,b.strokeStyle=this.fillM.getColor(),b.beginPath(),this.of_y?(b.moveTo(f+1,this.space.h-g+.5),b.lineTo(m,this.space.h-g+.5)):(b.moveTo(g+.5,f+1),b.lineTo(g+.5,m)),b.stroke()),this.fillP&&m<f&&(b.lineWidth=1,b.strokeStyle=this.fillP.getColor(),b.beginPath(),this.of_y?
(b.moveTo(f-1,this.space.h-g+.5),b.lineTo(m,this.space.h-g+.5)):(b.moveTo(g+.5,f-1),b.lineTo(g+.5,m)),b.stroke()),b.lineWidth=h,b.strokeStyle=this.color.getColor(),b.beginPath(),this.of_y?(b.moveTo(y+.5,this.space.h-p),b.lineTo(m+.5,this.space.h-g)):(b.moveTo(p+.5,y),b.lineTo(g+.5,m))):1===u?(this.evaluator.setVariable(d,s-n),x=this.extrapolate(l,d,c,0,r,n),m=parseInt(this.of_y?this.XX(h,x.y,this.abs_coord):this.YY(h,x.y,this.abs_coord)),b.lineWidth=h,b.strokeStyle=this.color.getColor(),b.beginPath(),
this.of_y?(b.moveTo(q+.5,this.space.h-p),b.lineTo(m+.5,this.space.h-p+Math.round(x.x))):(b.moveTo(p+.5,q),b.lineTo(p+Math.round(x.x)+.5,m)),this.evaluator.setVariable(d,s),z=this.extrapolate(l,d,c,0,w,-n),q=this.YY(h,z.y,this.abs_coord),m=this.YY(h,w,this.abs_coord),b.lineWidth=h,b.strokeStyle=this.color.getColor(),b.beginPath(),this.of_y?(b.moveTo(q+.5,this.space.h-g),b.lineTo(m+.5,this.space.h-g)):(b.moveTo(g+.5,q),b.lineTo(g+.5,m))):(m=parseInt(this.of_y?this.XX(h,w,this.abs_coord):this.YY(h,w,
this.abs_coord)),b.lineWidth=h,b.strokeStyle=this.color.getColor(),b.beginPath(),this.of_y?(b.moveTo(m+.5,this.space.h-g),b.lineTo(m+.5,this.space.h-g)):(b.moveTo(g+.5,m),b.lineTo(g+.5,m)))):(z=this.extrapolateOnSingularity(l,d,c,0,w,-n),q=this.of_y?this.XX(h,z.y,this.abs_coord):this.YY(h,z.y,this.abs_coord),m=parseInt(this.of_y?this.XX(h,w,this.abs_coord):this.YY(h,w,this.abs_coord)),b.lineWidth=h,b.strokeStyle=this.color.getColor(),b.beginPath(),this.of_y?(b.moveTo(q,this.space.h-(g+Math.round(z.x))+
.5),b.lineTo(m,this.space.h-g+.5)):(b.moveTo(g+Math.round(z.x),q),b.lineTo(g,m))),b.stroke(),r=w):v=!1)}catch(D){v=!1}e&&!v&&(this.evaluator.setVariable(d,s-n),this.evaluator.setVariable(c,r),x=this.extrapolate(l,d,c,0,r,n),m=parseInt(this.of_y?this.XX(h,x.y,this.abs_coord):this.YY(h,x.y,this.abs_coord)),b.lineWidth=h,b.strokeStyle=this.color.getColor(),b.beginPath(),this.of_y?(b.moveTo(q,this.space.h-(p+Math.round(x.x))+.5),b.lineTo(m,this.space.h-(p+Math.round(x.x))+.5)):(b.moveTo(p+Math.round(x.x)+
.5,q),b.lineTo(p+Math.round(x.x)+.5,m)),b.stroke(),this.evaluator.setVariable(d,s));e=v;s+=n;q=m;p=g++}this.evaluator.parser.setVariable("x",k);this.evaluator.parser.setVariable("y",t)};a.Equation.prototype.registerTextField=function(){var a=document.createElement("input");a.value=this.expresionString;a.disabled=!this.editable;var b=this;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 f=Math.round;a.Curve=function(b,d){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,d);(this.visible=2==this.parent.version&&void 0==this.visible?!0:!1)&&this.registerTextField()};a.extend(a.Curve,a.Graphic);var g,c,e,b,k,t,d,m,q,h,r;a.Curve.prototype.update=function(){g=
this.evaluator;c=g.evalExpression(this.parameter_interval);this.paraInf=c[0][0];this.paraSup=c[0][1];this.pSteps=g.evalExpression(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(c,p,l){g=this.evaluator;e=this.space;b=f(g.evalExpression(this.width));
c.lineWidth=0<b?b:1E-6;c.lineCap="round";c.lineJoin="round";c.strokeStyle=l.getColor();k=g.getVariable(this.parameter);c.beginPath();g.setVariable(this.parameter,this.paraInf);t=g.evalExpression(this.expresion);this.exprX=this.abs_coord?f(t[0][0]):f(e.getAbsoluteX(t[0][0]));this.exprY=this.abs_coord?f(t[0][1]):f(e.getAbsoluteY(t[0][1]));this.rotateExp&&(d=a.degToRad(g.evalExpression(this.rotateExp)),m=Math.cos(d),q=Math.sin(d),h=this.exprX*m-this.exprY*q,r=this.exprX*q+this.exprY*m,this.exprX=h,this.exprY=
r);c.moveTo(this.exprX+.5,this.exprY+.5);for(l=1;l<=this.pSteps;l++)g.setVariable(this.parameter,this.paraInf+l*this.paraSep),t=g.evalExpression(this.expresion),this.exprX=this.abs_coord?f(t[0][0]):f(e.getAbsoluteX(t[0][0])),this.exprY=this.abs_coord?f(t[0][1]):f(e.getAbsoluteY(t[0][1])),this.rotateExp&&(h=this.exprX*m-this.exprY*q,r=this.exprX*q+this.exprY*m,this.exprX=h,this.exprY=r),c.lineTo(this.exprX+.5,this.exprY+.5);this.fill&&(c.fillStyle=p.getColor(),c.fill("evenodd"));c.stroke();g.setVariable(this.parameter,
k)};a.Curve.prototype.registerTextField=function(){var a=document.createElement("input");a.value=this.expresionString;a.disabled=!this.editable;var b=this;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 f=2*Math.PI,g=Math.round,c,e,b,k,t,d,m,q,h,r,s,p,l,u;a.Sequence=function(b,d){this.size=b.evaluator.parser.parse("2");
this.range=b.evaluator.parser.parse("[1, 100]");a.Graphic.call(this,b,d)};a.extend(a.Sequence,a.Graphic);a.Sequence.prototype.update=function(){c=this.evaluator;b=c.evalExpression(this.expresion);this.exprX=b[0][0];this.exprY=b[0][1];this.rotateExp&&(k=a.degToRad(c.evalExpression(this.rotateExp)),t=Math.cos(k),d=Math.sin(k),m=this.exprX*t-this.exprY*d,q=this.exprX*d+this.exprY*t,this.exprX=m,this.exprY=q);s=c.evalExpression(this.range);this.rangeInf=s[0][0];this.rangeMax=s[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,d){c=this.evaluator;e=this.space;l=p=Math.ceil(c.evalExpression(this.size)-.4);a.fillStyle=d.getColor();a.beginPath();this.rangeInf>this.rangeMax&&(u=this.rangeInf,this.rangeInf=this.rangeMax,this.rangeMax=u);for(var m=c.getVariable("n"),k=this.rangeInf,q=this.rangeMax;k<=q;k++)c.setVariable("n",k),b=c.evalExpression(this.expresion),
this.exprX=b[0][0],this.exprY=b[0][1],h=this.abs_coord?g(this.exprX):g(e.getAbsoluteX(this.exprX)),r=this.abs_coord?g(this.exprY):g(e.getAbsoluteY(this.exprY)),a.beginPath(),a.arc(h,r,p,0,f,!0),a.fill();a.fill();this.text!=[""]&&this.uber.drawText.call(this,a,this.text,h+l,r-l,this.color,this.font,"start","alphabetic",c.evalExpression(this.decimals),this.fixed,!0);c.setVariable("n",m)};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var f=2*Math.PI,g=Math.round,c,e,b,k,t,
d,m,q,h,r,s,p;a.Point=function(b,d){this.size=b.evaluator.parser.parse("2");a.Graphic.call(this,b,d)};a.extend(a.Point,a.Graphic);a.Point.prototype.update=function(){c=this.evaluator;b=c.evalExpression(this.expresion);this.exprX=b[0][0];this.exprY=b[0][1];this.rotateExp&&(k=a.degToRad(c.evalExpression(this.rotateExp)),t=Math.cos(k),d=Math.sin(k),m=this.exprX*t-this.exprY*d,q=this.exprX*d+this.exprY*t,this.exprX=m,this.exprY=q)};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,b){c=this.evaluator;e=this.space;s=g(c.evalExpression(this.size));p=s+1;a.fillStyle=b.getColor();h=this.abs_coord?g(this.exprX):g(e.getAbsoluteX(this.exprX));r=this.abs_coord?g(this.exprY):g(e.getAbsoluteY(this.exprY));a.beginPath();a.arc(h,r,s,0,f,!0);a.fill();this.text!=[""]&&this.uber.drawText.call(this,a,this.text,h+p+1,r-p,this.color,this.font,"start",
"alphabetic",c.evalExpression(this.decimals),this.fixed,!0)};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var f=Math.round,g=2*Math.PI,c,e,b,k,t,d,m,q,h,r,s,p,l,u,n,v,w,z;a.Segment=function(b,d){this.width=b.evaluator.parser.parse("1");this.size=b.evaluator.parser.parse("2");a.Graphic.call(this,b,d)};a.extend(a.Segment,a.Graphic);a.Segment.prototype.update=function(){c=this.evaluator;b=c.evalExpression(this.expresion);this.endPoints=[];for(var l=0,h=b.length;l<h;l++)this.endPoints[l]=
{x:b[l][0],y:b[l][1]};if(this.rotateExp)for(k=a.degToRad(c.evalExpression(this.rotateExp)),t=Math.cos(k),d=Math.sin(k),l=0,h=this.endPoints.length;l<h;l++)m=this.endPoints[l].x*t-this.endPoints[l].y*d,q=this.endPoints[l].x*d+this.endPoints[l].y*t,this.endPoints[l].x=m,this.endPoints[l].y=q};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,
b,d){c=this.evaluator;e=this.space;h=f(c.evalExpression(this.width));a.lineWidth=0<h?h:1E-6;l=c.evalExpression(this.size);0>l&&(l=0);a.fillStyle=b.getColor();a.strokeStyle=d.getColor();a.lineCap="round";r=10+a.lineWidth;u=0==a.lineWidth%2?0:.5;this.abs_coord?(n=f(this.endPoints[0].x),v=f(this.endPoints[0].y),w=f(this.endPoints[1].x),z=f(this.endPoints[1].y)):(n=f(e.getAbsoluteX(this.endPoints[0].x)),v=f(e.getAbsoluteY(this.endPoints[0].y)),w=f(e.getAbsoluteX(this.endPoints[1].x)),z=f(e.getAbsoluteY(this.endPoints[1].y)));
a.beginPath();a.moveTo(n+u,v+u);a.lineTo(w+u,z+u);a.stroke();a.beginPath();a.arc(n,v,l,0,g,!0);a.arc(w,z,l,0,g,!0);a.fill();this.text!=[""]&&(s=parseInt((n+w)/2)-3,p=parseInt((v+z)/2)+3,this.uber.drawText.call(this,a,this.text,s+r,p-r,this.color,this.font,"start","alphabetic",c.evalExpression(this.decimals),this.fixed,!0))};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var f=Math.floor,g=Math.round,c,e,b,k,t,d,m,q,h,r,s,p,l,u,n,v,w,z;a.Arrow=function(b,d){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,d)};a.extend(a.Arrow,a.Graphic);a.Arrow.prototype.update=function(){c=this.evaluator;e=c.evalExpression(this.expresion);this.endPoints=[];for(var l=0,h=e.length;l<h;l++)this.endPoints[l]={x:e[l][0],y:e[l][1]};if(this.rotateExp)for(b=a.degToRad(c.evalExpression(this.rotateExp)),k=Math.cos(b),t=Math.sin(b),l=0,h=this.endPoints.length;l<h;l++)d=this.endPoints[l].x*k-
this.endPoints[l].y*t,m=this.endPoints[l].x*t+this.endPoints[l].y*k,this.endPoints[l].x=d,this.endPoints[l].y=m};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(b,d,e){c=this.evaluator;q=this.space;c.evalExpression(this.size);s=c.evalExpression(this.width);0>s&&(s=0);p=Math.ceil(s/2);l=q.scale;this.vect=new a.Vector2D(this.endPoints[1].x-
this.endPoints[0].x,this.endPoints[1].y-this.endPoints[0].y);u=this.vect.vectorLength();this.angle=this.vect.angleBetweenVectors(a.Vector2D.AXIS_X);b.fillStyle=d.getColor();b.strokeStyle=e.getColor();b.lineWidth=2;this.abs_coord?(n=g(this.endPoints[0].x),v=g(this.endPoints[0].y),w=g(this.endPoints[1].x),z=g(this.endPoints[1].y)):(n=g(q.getAbsoluteX(this.endPoints[0].x)),v=g(q.getAbsoluteY(this.endPoints[0].y)),w=g(q.getAbsoluteX(this.endPoints[1].x)),z=g(q.getAbsoluteY(this.endPoints[1].y)));d=c.evalExpression(this.spear);
0>d&&(d=0);b.save();b.translate(n,v,u);this.abs_coord?0<=this.vect.x&&0<=this.vect.y||0>=this.vect.x&&0<=this.vect.y?b.rotate(this.angle):b.rotate(-this.angle):(u*=l,0<=this.vect.x&&0<=this.vect.y||0>=this.vect.x&&0<=this.vect.y?b.rotate(-this.angle):b.rotate(this.angle));b.beginPath();b.moveTo(-p,f(-p));b.lineTo(f(u-d-s),f(-p));b.lineTo(f(u-2*d),f(-d-p));b.lineTo(f(u),0);b.lineTo(f(u-2*d),f(d+p));b.lineTo(f(u-d-s),f(p));b.lineTo(-p,f(p));b.closePath();b.stroke();b.fill();b.restore();this.text!=[""]&&
(h=parseInt((n+w)/2)-3,r=parseInt((v+z)/2)+3,this.uber.drawText.call(this,b,this.text,h,r,e,this.font,"start","alphabetic",c.evalExpression(this.decimals),this.fixed,!0))};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var f=Math.round,g,c,e,b,k,t,d,m,q,h,r,s;a.Polygon=function(b,d){this.width=b.evaluator.parser.parse("1");this.fill="";a.Graphic.call(this,b,d);this.endPoints=[]};a.extend(a.Polygon,a.Graphic);a.Polygon.prototype.update=function(){g=this.evaluator;e=g.evalExpression(this.expresion);
for(var c=0,l=e.length;c<l;c++)this.endPoints[c]={x:e[c][0],y:e[c][1]};if(this.rotateExp)for(b=a.degToRad(g.evalExpression(this.rotateExp)),k=Math.cos(b),t=Math.sin(b),c=0,l=this.endPoints.length;c<l;c++)d=this.endPoints[c].x*k-this.endPoints[c].y*t,m=this.endPoints[c].x*t+this.endPoints[c].y*k,this.endPoints[c].x=d,this.endPoints[c].y=m};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,b,d){g=this.evaluator;c=this.space;q=f(g.evalExpression(this.width));a.lineWidth=0<q?q:1E-6;a.strokeStyle=d.getColor();a.lineCap="round";a.lineJoin="round";h=0<q?.5:0;r=this.abs_coord?f(this.endPoints[0].x):f(c.getAbsoluteX(this.endPoints[0].x));s=this.abs_coord?f(this.endPoints[0].y):f(c.getAbsoluteY(this.endPoints[0].y));a.beginPath();a.moveTo(r+h,s+h);d=1;for(var e=this.endPoints.length;d<e;d++)r=this.abs_coord?f(this.endPoints[d].x):f(c.getAbsoluteX(this.endPoints[d].x)),
s=this.abs_coord?f(this.endPoints[d].y):f(c.getAbsoluteY(this.endPoints[d].y)),a.lineTo(r+h,s+h);this.fill&&(a.fillStyle=b.getColor(),a.fill());a.stroke()};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var f=Math.round,g,c,e,b,k,t,d,m,q,h,r,s,p,l,u,n,v,w,z,C,A;a.Arc=function(b,d){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,d);
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)};a.extend(a.Arc,a.Graphic);a.Arc.prototype.update=function(){g=this.evaluator;c=g.evalExpression(this.center);this.exprX=c[0][0];this.exprY=c[0][1];e=0;this.rotateExp&&(e=a.degToRad(g.evalExpression(this.rotateExp)),b=Math.cos(e),k=Math.sin(e),t=this.exprX*
b-this.exprY*k,d=this.exprX*k+this.exprY*b,this.exprX=t,this.exprY=d);var f=g.evalExpression(this.initExpr),n=g.evalExpression(this.endExpr);"(expr)"==this.initExpr.type&&"(expr)"==this.endExpr.type||"[expr]"==this.initExpr.type&&"[expr]"==this.endExpr.type||"(expr)"==this.initExpr.type&&"[expr]"==this.endExpr.type||"[expr]"==this.initExpr.type&&"(expr)"==this.endExpr.type?(m=f[0][0],q=f[0][1],h=n[0][0],r=n[0][1],this.vectors?this.abs_coord&&(q=-q,r=-r):this.abs_coord?(m-=this.exprX,q=-q+this.exprY,
h-=this.exprX,r=-r+this.exprY):(m-=this.exprX,q-=this.exprY,h-=this.exprX,r-=this.exprY),s=0==m?0>q?-Math.PI/2:Math.PI/2:Math.acos(1*m/Math.sqrt(m*m+q*q)),p=0==h?0>r?-Math.PI/2:Math.PI/2:Math.acos(1*h/Math.sqrt(h*h+r*r)),s+=e,p+=e,0<m&&0<q&&this.abs_coord&&(s=2*Math.PI-s),0<m&&0>q&&!this.abs_coord&&(s=2*Math.PI-s),0>m&&0>q&&!this.abs_coord&&(s=2*Math.PI-s),0>m&&0<q&&this.abs_coord&&(s=2*Math.PI-s),0<h&&0<r&&this.abs_coord&&(p=2*Math.PI-p),0<h&&0>r&&!this.abs_coord&&(p=2*Math.PI-p),0>h&&0>r&&!this.abs_coord&&
(p=2*Math.PI-p),0>h&&0<r&&this.abs_coord&&(p=2*Math.PI-p),this.initFlag?(l=s,s=p,p=l):(l=Math.min(s,p),u=Math.max(s,p),s=l,p=u,p-s>Math.PI&&this.abs_coord&&(s=u,p=l),p-s<=Math.PI&&!this.abs_coord&&(s=u,p=l)),this.iniAng=s,this.endAng=p,this.drawPoints=!0):(this.iniAng=a.degToRad(f)+e,this.endAng=a.degToRad(n)+e,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,d){g=this.evaluator;n=this.space;z=g.evalExpression(this.radius);0>z&&(z=0);A=f(g.evalExpression(this.width));a.lineWidth=0<A?A:1E-6;a.lineCap="round";a.strokeStyle=d.getColor();this.drawAngle?(this.abs_coord?(v=f(this.exprX),w=f(this.exprY)):(v=f(n.getAbsoluteX(this.exprX)),w=f(n.getAbsoluteY(this.exprY)),z*=n.scale,this.iniAng=-this.iniAng,this.endAng=-this.endAng),this.iniAng>this.endAng&&(C=this.iniAng,this.iniAng=this.endAng,this.endAng=C)):this.drawPoints&&
(this.abs_coord?(v=f(this.exprX),w=f(this.exprY)):(v=f(n.getAbsoluteX(this.exprX)),w=f(n.getAbsoluteY(this.exprY)),z*=n.scale,this.iniAng=-this.iniAng,this.endAng=-this.endAng));this.fill&&(a.fillStyle=b.getColor(),a.beginPath(),a.moveTo(v,w),a.arc(v,w,z,this.iniAng,this.endAng,void 0),a.fill());a.beginPath();a.arc(v,w,z,this.iniAng,this.endAng,void 0);a.stroke();this.text!=[""]&&this.uber.drawText.call(this,a,this.text,v+4,w-2,this.color,this.font,"start","alphabetic",g.evalExpression(this.decimals),
this.fixed,!0)};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var f,g,c,e,b,k,t,d,m,q,h,r,s,p,l,u,n,v;a.Text=function(b,d){this.width=b.evaluator.parser.parse("0");a.Graphic.call(this,b,d);this.align||(this.align="start");this.ascent=this.fontSize-Math.ceil(this.fontSize/7)-(this.font.match("Courier")?3:0);this.abs_coord=!0};a.extend(a.Text,a.Graphic);a.Text.prototype.update=function(){f=this.evaluator;g=f.evalExpression(this.expresion);this.exprX=g[0][0];this.exprY=g[0][1];
this.rotateExp&&(c=a.degToRad(f.evalExpression(this.rotateExp)),e=Math.cos(c),b=Math.sin(c),k=this.exprX*e-this.exprY*b,t=this.exprX*b+this.exprY*e,this.exprX=k,this.exprY=t)};a.Text.prototype.draw=function(){this.uber.draw.call(this,this.color)};a.Text.prototype.drawTrace=function(){this.uber.drawTrace.call(this,this.color)};a.Text.prototype.drawAux=function(a,b){v=this.evaluator.evalExpression(this.decimals);"rtfNode"===this.text.type?(h=this.text,this.ascent=0):h=this.splitText(this.text.toString(v,
this.fixed).split("\\n"));this.text!=[""]&&this.uber.drawText.call(this,a,h,parseInt(this.exprX)+5,parseInt(this.exprY)+this.ascent,b,this.font,this.align,"alphabetic",v,this.fixed)};a.Text.prototype.splitText=function(a){f=this.evaluator;d=f.evalExpression(this.width);h=[];this.ctx.font=this.font;if(20<=d&&"undefined"!=a.type){for(var b=0,c=a.length;b<c;b++)m=a[b],q=this.ctx.measureText(m).width,q>d?h=h.concat(this.splitWords(m,d)):h.push(m);r=Math.floor(1.2*this.fontSize)*h.length;f.setVariable("_Text_H_",
r);return h}f.setVariable("_Text_H_",0);f.setVariable("_Text_W_",1E3);return a};a.Text.prototype.splitWords=function(a,b){s=a;p=[];l="";n=0;for(var d,c=0,h=a.length;c<h;c++)u=s.charAt(c)," "===u&&(lastIndexOfWhite=c),l+=u,Math.round(this.ctx.measureText(l).width)>b&&(d=a.substring(n,c+1)," "!==u&&(-1===d.indexOf(" ")?(lastIndexOfWhite=c,c--):c=lastIndexOfWhite),p.push(a.substring(n,lastIndexOfWhite)),l="",n=c+1);p.push(a.substring(n));return p};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;
var f=Math.round,g,c,e,b,k,t,d,m,q,h,r,s,p,l;a.Image=function(b,d){this.file="";this.inirot=b.evaluator.parser.parse("0");this.pattern=!1;a.Graphic.call(this,b,d);this.img=new Image;this.scaleY=this.scaleX=1;this.update()};a.extend(a.Image,a.Graphic);a.Image.prototype.update=function(){g=this.evaluator;c=g.evalExpression(this.expresion);this.exprX=c[0][0];this.exprY=c[0][1];this.rotateExp&&(e=a.degToRad(g.evalExpression(this.rotateExp)),b=Math.cos(e),k=Math.sin(e),t=this.exprX*b-this.exprY*k,d=this.exprX*
k+this.exprY*b,this.exprX=t,this.exprY=d);4<=c[0].length&&(this.centered=!0,this.scaleX=c[0][2],0==this.scaleX&&(this.scaleX=1E-5),this.scaleY=c[0][3],0==this.scaleY&&(this.scaleY=1E-5),c[0][4]&&(this.pattern=1==c[0][4]?!0:!1));c[1]&&2==c[1].length&&(this.centered=!0,this.scaleX=c[1][0],0==this.scaleX&&(this.scaleX=1E-5),this.scaleY=c[1][1],0==this.scaleY&&(this.scaleY=1E-5));if((m=g.evalExpression(this.file))||""==m)this.img=this.parent.getImage(m)};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(b){g=this.evaluator;q=this.space;this.img&&this.img.ready&&this.img.complete&&(h=this.centered?0:f(this.img.width/2),r=this.centered?0:f(this.img.height/2),s=this.abs_coord?f(this.exprX):f(q.getAbsoluteX(this.exprX)),p=this.abs_coord?f(this.exprY):f(q.getAbsoluteY(this.exprY)),l=a.degToRad(-g.evalExpression(this.inirot)),b.save(),b.translate(s+h,p+r),b.rotate(l),this.opacity&&(b.globalAlpha=g.evalExpression(this.opacity)),
this.pattern?(b.fillStyle=b.createPattern(this.img,"repeat"),b.drawImage(this.img,-this.img.width/2*this.scaleX,-this.img.height/2*this.scaleY),b.fillRect(0,0,this.img.width*this.scaleX,this.img.height*this.scaleY)):(b.scale(this.scaleX,this.scaleY),b.drawImage(this.img,-this.img.width/2,-this.img.height/2)),b.restore())};return a}(descartesJS||{}),descartesJS=function(a){function f(a,b,c){d=4*(b+c*a.width);return{r:a.data[d],g:a.data[d+1],b:a.data[d+2],a:a.data[d+3]}}if(a.loadLib)return a;var g,
c,e,b,k,t,d;a.Fill=function(b,d){a.Graphic.call(this,b,d)};a.extend(a.Fill,a.Graphic);a.Fill.prototype.update=function(){g=this.evaluator.evalExpression(this.expresion);this.exprX=g[0][0];this.exprY=g[0][1]};a.Fill.prototype.draw=function(){this.uber.draw.call(this,this.color,this.color)};a.Fill.prototype.drawTrace=function(){};a.Fill.prototype.drawAux=function(a,q){q.getColor();imageData=this.ctx.getImageData(0,0,this.space.w,this.space.h);this.abs_coord?(c=parseInt(this.exprX),e=parseInt(this.exprY)):
(c=parseInt(this.space.getAbsoluteX(this.exprX)),e=parseInt(this.space.getAbsoluteY(this.exprY)));if(!(0>c||0>e||c>=this.space.w||e>=this.space.h)){b=[{x:c,y:e}];for(t=f(imageData,c,e);0<b.length;){k=b.pop();c=k.x;e=k.y;var h=f(imageData,c,e);if(t.r===h.r&&t.g===h.g&&t.b===h.b&&t.a===h.a){var h=imageData,g=q;d=4*(c+e*h.width);h.data[d+0]=g.r;h.data[d+1]=g.g;h.data[d+2]=g.b;h.data[d+3]=255*g.a;0<c&&b.push({x:c-1,y:e});c<imageData.width-1&&b.push({x:c+1,y:e});b.push({x:c,y:e-1});b.push({x:c,y:e+1})}}this.ctx.putImageData(imageData,
0,0)}};return a}(descartesJS||{}),descartesJS=function(a,f){if(a.loadLib)return a;var g=/[\w\.\-//]*(\.png|\.jpg|\.gif|\.svg)/gi,c;a.Macro=function(c,b){this.hasExpresion=!1;this.inirot=c.evaluator.parser.parse("0");this.inipos=c.evaluator.parser.parse("(0,0)");a.Graphic.call(this,c,b);for(var k in b)"expresion"==k&&(this.hasExpresion=!0),b.hasOwnProperty(k)&&(this[k]=b[k]);this.graphics=[];k=c.lessonParser;var t=new a.Tokenizer;if(this.hasExpresion){"'"!==this.expresion.charAt(0)&&(this.expresion=
"'"+this.expresion+"'");this.expresion=this.evaluator.parser.parse(this.expresion);var d=this.evaluator.evalExpression(this.expresion),m;d&&((m=document.getElementById(d))&&"descartes/macro"==m.type?m=m.text:(m=a.openExternalFile(d))&&!m.match(/tipo_de_macro/g)&&(m=null));var q,h;if(m){h=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=[];for(var d=0,r=h.length;d<r;d++)if(q=h[d].indexOf("="),-1!==q){q=k.split(h[d]);for(var s=0,p=q.length;s<p;s++)q[s]&&1<q.length&&("id"!==f[q[s][0]]&&"type"!==f[q[s][0]]||m.push(q))}for(var l,u,d=0,r=m.length;d<r;d++)for(p=(s=m[d]||[],s[0])&&"id"===s[0][0],h=0,q=s.length;h<
q;h++)if(l=s[h][0].indexOf("."),-1===l||p?l=f[s[h][0]]:(l=f[s[h][0].substring(l+1)],s[h][0]=this.name+"."+s[h][0]),!("font"===l||("fill"===l||"color"===l||"border"===l||"arrow"===l)&&"("!==s[h][1].charAt(0)||"file"===l&&s[h][1].match(g)||"id"!==l&&void 0!==f[s[h][1]]))if("text"==l)if(s[h][1].match(/\{\\rtf1/)){l=s[h][1];var n=this;u=function(a,b){for(var d=t.tokenize(b.replace(/\&squot;/g,"'")),c=0,l=d.length;c<l;c++)"identifier"!=d[c].type||"-_-rnd-pi-e-sqr-ra\u00edz-sqrt-exp-log-log10-abs-ent-sgn-ind-sen-sin-cos-tan-cot-sec-csc-senh-sinh-cosh-tanh-coth-sech-csch-asen-asin-acos-atan-min-max-_Num_-_Trace_-_Stop_Audios_-esCorrecto-escorrecto-_GetValues_-_GetMatrix_-_Save_-_Open_-_SaveState_-_OpenState_-_AnchoDeCadena_-_Rojo_-_Verde_-_Azul_-".match("-"+
d[c].value+"-")||(d[c].value=n.name+"."+d[c].value);return(a.match(/^\\expr/)?"\\expr ":"\\decimals ")+t.flatTokens(d)};l=l.replace(/\\expr ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,u);l=l.replace(/\\decimals ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,u);s[h][1]=l}else{u=k.parseText(s[h][1]).textElementsMacros;for(var v=0,w=u.length;v<w;v++){l=t.tokenize(u[v].replace(/\&squot;/g,"'"));for(var z=0,C=l.length;z<C;z++)"identifier"!==l[z].type||"-_-rnd-pi-e-sqr-ra\u00edz-sqrt-exp-log-log10-abs-ent-sgn-ind-sen-sin-cos-tan-cot-sec-csc-senh-sinh-cosh-tanh-coth-sech-csch-asen-asin-acos-atan-min-max-_Num_-_Trace_-_Stop_Audios_-esCorrecto-escorrecto-_GetValues_-_GetMatrix_-_Save_-_Open_-_SaveState_-_OpenState_-_AnchoDeCadena_-_Rojo_-_Verde_-_Azul_-".match("-"+
l[z].value+"-")||(l[z].value=this.name+"."+l[z].value);l=t.flatTokens(l).replace(/&squot;/g,"'").replace(/'\+\(/g,"[").replace(/\)\+'/g,"]");u[v]=l.substring(1,l.length-1)}s[h][1]=u.join("")}else{u=s[h][1].replace(/\&squot;/g,"'").split(";");v=0;for(w=u.length;v<w;v++){l=t.tokenize(u[v].replace(/\\n/g,";"));z=0;for(C=l.length;z<C;z++)"identifier"!==l[z].type||"-_-rnd-pi-e-sqr-ra\u00edz-sqrt-exp-log-log10-abs-ent-sgn-ind-sen-sin-cos-tan-cot-sec-csc-senh-sinh-cosh-tanh-coth-sech-csch-asen-asin-acos-atan-min-max-_Num_-_Trace_-_Stop_Audios_-esCorrecto-escorrecto-_GetValues_-_GetMatrix_-_Save_-_Open_-_SaveState_-_OpenState_-_AnchoDeCadena_-_Rojo_-_Verde_-_Azul_-".match("-"+
l[z].value+"-")||(l[z].value=this.name+"."+l[z].value);u[v]=t.flatTokens(l)}s[h][1]=u.join(";")}d=0;for(r=m.length;d<r;d++)if(m[d][0]){s="";p=!1;h=0;for(q=m[d].length;h<q;h++)"type"===f[m[d][h][0]]&&(s="espacio='"+this.spaceID+"' ",p=!0),s=s+m[d][h][0]+"='"+m[d][h][1]+"' ";m[d]=s;p?this.graphics.push(k.parseGraphic(m[d],this.abs_coord,this.background,this.inirot)):k.parseAuxiliar(m[d])}}}};a.extend(a.Macro,a.Graphic);a.Macro.prototype.update=function(){c=this.evaluator.evalExpression(this.inipos);
this.iniPosX=c[0][0];this.iniPosY=c[0][1]};a.Macro.prototype.drawAux=function(a){for(var b=0,c=this.graphics.length;b<c;b++)this.graphics[b]&&(a.save(),this.graphics[b].abs_coord?a.translate(this.iniPosX,this.iniPosY):a.translate(this.iniPosX*this.space.scale,-this.iniPosY*this.space.scale),this.graphics[b].draw(),a.restore())};return a}(descartesJS||{},babel),descartesJS=function(a){if(a.loadLib)return a;a.Generic=function(f,g){this.width=f.evaluator.parser.parse("1");a.Graphic.call(this,f,g)};a.extend(a.Generic,
a.Graphic);a.Generic.prototype.update=function(){};a.Generic.prototype.draw=function(){this.uber.draw.call(this,this.fill,this.color)};a.Generic.prototype.drawTrace=function(){this.uber.drawTrace.call(this,this.trace,this.trace)};a.Generic.prototype.drawAux=function(a,g,c){var e=this.evaluator.getDefinition(this.expresionString);e&&e.draw(a,g,c,this)};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var f=Math.sqrt,g=Math.sin,c=Math.cos,e,b,k,t,d,m,q,h,r,s,p,l,u,n,v;a.norm3D=
function(a){return f(a.x*a.x+a.y*a.y+a.z*a.z)};a.normalize3D=function(b){e=a.norm3D(b);if(0===e)return{x:0,y:0,z:0};if(1===e)return{x:b.x,y:b.y,z:b.z};e=1/e;return{x:b.x*e,y:b.y*e,z:b.z*e}};a.dotProduct3D=function(a,b){return a.x*b.x+a.y*b.y+a.z*b.z};a.crossProduct3D=function(a,b){return{x:a.y*b.z-a.z*b.y,y:a.z*b.x-a.x*b.z,z:a.x*b.y-a.y*b.x}};a.scalarProduct3D=function(a,b){return{x:a.x*b,y:a.y*b,z:a.z*b}};a.subtract3D=function(a,b){return{x:a.x-b.x,y:a.y-b.y,z:a.z-b.z}};a.add3D=function(a,b){return{x:a.x+
b.x,y:a.y+b.y,z:a.z+b.z}};a.equals3DEpsilon=function(a,b,d){return Math.abs(a.x-b.x)<=d&&Math.abs(a.y-b.y)<=d&&Math.abs(a.z-b.z)<=d};a.Vector4D=function(a,b,d,c){this.x=a||0;this.y=b||0;this.z=d||0;this.w=c||0};a.Matrix4x4=function(a,b,d,c,l,h,f,e,m,k,q,g,n,p,r,s){this.a00=a||0;this.a01=b||0;this.a02=d||0;this.a03=c||0;this.a10=l||0;this.a11=h||0;this.a12=f||0;this.a13=e||0;this.a20=m||0;this.a21=k||0;this.a22=q||0;this.a23=g||0;this.a30=n||0;this.a31=p||0;this.a32=r||0;this.a33=s||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(d){b=g(d);k=c(d);h=this.a10;r=this.a11;s=this.a12;p=this.a13;l=this.a20;u=this.a21;n=this.a22;v=this.a23;return new a.Matrix4x4(this.a00,this.a01,this.a02,this.a03,h*k+l*
b,r*k+u*b,s*k+n*b,p*k+v*b,h*-b+l*k,r*-b+u*k,s*-b+n*k,p*-b+v*k,this.a30,this.a31,this.a32,this.a33)};a.Matrix4x4.prototype.rotateY=function(h){b=g(h);k=c(h);t=this.a00;d=this.a01;m=this.a02;q=this.a03;l=this.a20;u=this.a21;n=this.a22;v=this.a23;return new a.Matrix4x4(t*k+l*-b,d*k+u*-b,m*k+n*-b,q*k+v*-b,this.a10,this.a11,this.a12,this.a13,t*b+l*k,d*b+u*k,m*b+n*k,q*b+v*k,this.a30,this.a31,this.a32,this.a33)};a.Matrix4x4.prototype.rotateZ=function(l){b=g(l);k=c(l);t=this.a00;d=this.a01;m=this.a02;q=this.a03;
h=this.a10;r=this.a11;s=this.a12;p=this.a13;return new a.Matrix4x4(t*k+h*b,d*k+r*b,m*k+s*b,q*k+p*b,t*-b+h*k,d*-b+r*k,m*-b+s*k,q*-b+p*k,this.a20,this.a21,this.a22,this.a23,this.a30,this.a31,this.a32,this.a33)};return a}(descartesJS||{}),descartesJS=function(a){function f(a){0!==parseInt(this.size)&&(a.lineWidth=1,a.fillStyle=this.backColor,a.strokeStyle=this.frontColor,a.beginPath(),a.arc(this.newV[0].x,this.newV[0].y,this.size+.5,0,k),a.fill(),a.stroke())}function g(a,b){a.lineCap="round";a.lineJoin=
"round";a.lineWidth="#"==this.backColor.charAt(0)||"#"==this.frontColor.charAt(0)?1:.1;a.beginPath();a.moveTo(this.newV[0].x,this.newV[0].y);for(var d=1,c=this.newV.length;d<c;d++)a.lineTo(this.newV[d].x,this.newV[d].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=0<=this.direction?b.computeColor(this.backColor,this,"metal"===this.model):b.computeColor(this.frontColor,
this,"metal"===this.model),a.strokeStyle=a.fillStyle,a.stroke(),a.fill()):"wire"===this.model&&(a.lineWidth=1.5,a.strokeStyle=this.frontColor,a.stroke());this.edges&&"wire"!==this.model&&(a.lineWidth=1,a.strokeStyle="#808080",a.stroke())}function c(a){r=this.evaluator.getVariable(this.family);this.evaluator.setVariable(this.family,this.familyValue);this.drawText(a,this.text,this.newV[0].x,this.newV[0].y+this.displace,this.frontColor,this.font,"left","alphabetic",this.decimals,this.fixed,!0);this.evaluator.setVariable(this.family,
r)}function e(a){a.lineCap="round";a.lineJoin="round";a.lineWidth=this.lineWidth;a.strokeStyle=this.frontColor;a.beginPath();a.moveTo(this.newV[0].x,this.newV[0].y);a.lineTo(this.newV[1].x,this.newV[1].y);a.stroke()}function b(b,c,h){t=a.subtract3D(b,c);d=a.subtract3D(b,h);return a.normalize3D(a.crossProduct3D(t,d))}if(a.loadLib)return a;var k=2*Math.PI,t,d,m,q,h,r;a.Primitive3D=function(a,d){this.space=d;for(var h in a)a.hasOwnProperty(h)&&(this[h]=a[h]);this.newV=[];this.spaceVertices=[];"vertex"===
this.type?this.draw=f:"face"===this.type?(this.normal=b(this.vertices[0],this.vertices[1],this.vertices[2]),this.draw=g):"text"===this.type?(this.fontSize=(this.fontSize=this.font.match(/(\d+)px/))?parseInt(this.fontSize[1]):10,this.draw=c):"edge"===this.type&&(this.draw=e);this.isText&&(this.computeDepth=function(){this.newV=this.vertices;this.depth=this.vertices[0].z;this.average=this.vertices[0]})};a.Primitive3D.prototype.computeDepth=function(d){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};for(var c=0,h=this.vertices.length;c<h;c++)this.newV[c]=d.rotateVertex(this.vertices[c]),this.spaceVertices[c]=d.rotateVertex(this.vertices[c]),this.average.x+=this.newV[c].x,this.average.y+=this.newV[c].y,this.average.z+=this.newV[c].z;this.average=a.scalarProduct3D(this.average,1/h);this.averageP=d.project(this.average);this.depth=this.averageP.z;2<this.vertices.length&&(this.normal=b(this.newV[0],this.newV[1],this.newV[2]),this.direction=a.dotProduct3D(this.normal,
a.normalize3D(d.eye)));this.passDraw=1;c=0;for(h=this.vertices.length;c<h;c++)this.newV[c]=d.project(this.newV[c]),this.passDraw=this.passDraw&&0<this.newV[c].z;d.new3D||(this.passDraw=1)};var s;a.Primitive3D.prototype.removeDoubles=function(){if("edge"!==this.type){s=[];for(var a=0,b=this.vertices.length;a<b;a++)this.vertices[a].x===this.vertices[(a+1)%b].x&&this.vertices[a].y===this.vertices[(a+1)%b].y&&this.vertices[a].z===this.vertices[(a+1)%b].z&&this.vertices[a].w===this.vertices[(a+1)%b].w||
s.push(this.vertices[a]);0===s.length&&s.push(this.vertices[0]);this.vertices=s}};a.Primitive3D.prototype.drawText=function(b,d,c,f,e,k,g,r,s,t,G){if("rtfNode"==d.type)b.fillStyle=e,b.strokeStyle=e,b.textBaseline="alphabetic",d.draw(b,c,f,s,t,g,G);else for("simpleText"===d.type&&(d=d.toString(s,t).split("\\n")),c+=k.match("Arial")?-2:k.match("Times")?-2:0,m=this.evaluator,b.fillStyle=a.getColor(m,e),b.font=k,b.textAlign=g,b.textBaseline=r,q=1.2*this.fontSize||0,e=0,k=d.length;e<k;e++)h=d[e],this.border&&
b.strokeText(h,c,f+q*e),b.fillText(h,c,f+q*e)};a.Primitive3D.prototype.splitFace=function(b){if(this.intersects(b)){for(var d=null,c=null,h=0,f=0,e=0,m=b.vertices.length;e<m;e++){var k=this.intersection(b.vertices[e],b.vertices[(e+1)%m]);if(null!==k)if(null===d){if(d=k,h=e,2===b.vertices.length){c=d;break}}else if(!a.equals3DEpsilon(k,d,1E-8)){c=k;f=e;break}}if(null!==d&&null!==c){var e=this.isInterior(d)||this.isInterior(c),q=null,g=null;if(!e&&3<=b.vertices.length)for(var m=0,r=this.vertices.length;m<
r;m++)if(k=b.intersection(this.vertices[m],this.vertices[(m+1)%r]),null!==k)if(null===q)q=k;else if(!a.equals3DEpsilon(k,q,1E-8)){g=k;break}if(e||null!==q&&null!==g&&b.isInterior(q)&&b.isInterior(g)){g=!0;r=b.vertices;q=k=null;if(2===r.length)a.equals(d,r[0],1E-8)||a.equals(d,r[1],1E-8)?g=!1:(k=[],k[0]=r[0],k[1]=d,q=[],q[0]=d,q[1]=r[1]);else for(var k=[],q=[],s=0,e=m=0;e<r.length;e++)e<h?k[s++]=r[e]:e==h?(k[s++]=r[e],k[s++]=d,q[m++]=d):e<f?q[m++]=r[e]:e==f?(q[m++]=r[e],q[m++]=c,k[s++]=c):k[s++]=r[e];
if(g)return d=[],d[0]=new a.Primitive3D({vertices:k,type:"face",frontColor:b.frontColor,backColor:b.backColor,edges:b.edges,model:b.model},this.space),d[0].normal=b.normal,d[1]=new a.Primitive3D({vertices:q,type:"face",frontColor:b.frontColor,backColor:b.backColor,edges:b.edges,model:b.model},this.space),d[1].normal=b.normal,d}}}return[b]};a.Primitive3D.prototype.intersects=function(a){return this.intersectsPlane(a)&&a.intersectsPlane(this)};a.Primitive3D.prototype.intersectsPlane=function(b){var d=
a.dotProduct3D(b.vertices[0],b.normal),c=a.dotProduct3D(this.vertices[0],b.normal);if(1E-8>Math.abs(d-c))return!0;for(var h=1,e=this.vertices.length;h<e;h++){var f=a.dotProduct3D(this.vertices[h],b.normal);if(1E-8>Math.abs(d-f)||f>d&&c<d||f<d&&c>d)return!0}return!1};a.Primitive3D.prototype.intersection=function(b,d){if(0<this.vertices.length){var c=a.subtract3D(d,b),h=a.dotProduct3D(c,this.normal);if(0!==h&&(h=a.dotProduct3D(a.subtract3D(this.vertices[0],b),this.normal)/h,-1E-8<h&&1.00000001>h))return a.add3D(b,
a.scalarProduct3D(c,h))}return null};a.Primitive3D.prototype.isInterior=function(b){if(0<this.vertices.length)for(var d=0,c=a.subtract3D(this.vertices[0],b),h=0,e=this.vertices.length;h<e;h++){var f=a.subtract3D(this.vertices[(h+1)%e],b),m=a.dotProduct3D(a.crossProduct3D(c,f),this.normal);if(1E-8>Math.abs(m)){if(0>a.dotProduct3D(c,f))break}else{if(0>d&&0<m||0<d&&0>m)return!1;c=f;d=m}}return!0};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var f={x:0,y:0,z:0},g,c,e,b,k,t;
a.Graphic3D=function(b,d){this.parent=b;this.evaluator=b.evaluator;var c=b.evaluator.parser;this.spaceID="E0";this.background=!1;this.type="";this.color=new a.Color("eeffaa");this.backcolor=new a.Color("6090a0");this.Nu=this.evaluator.parser.parse("7");this.Nv=this.evaluator.parser.parse("7");this.drawif=c.parse("1");this.abs_coord=!1;this.family="";this.family_interval=c.parse("[0,1]");this.family_steps=c.parse("8");this.font="Monospaced,PLAIN,12";this.fixed=!0;this.text="";this.decimals=c.parse("2");
this.inirot="(0,0,0)";this.inirotEuler=!1;this.inipos=c.parse("(0,0,0)");this.endrot="(0,0,0)";this.endrotEuler=!1;this.endpos=c.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=c.parse("(0,0)"));this.space=this.getSpace();this.canvas=this.background?this.space.backgroundCanvas:this.space.canvas;this.ctx=this.canvas.getContext("2d");this.font=a.convertFont(this.font);this.fontSize=(this.fontSize=this.font.match(/(\d+)px/))?
parseInt(this.fontSize[1]):10;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=c.parse(this.inirot);this.endrot=c.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,b,d=0,c=a.length;d<c;d++)if(b=a[d],b.id==this.spaceID)return b;return a[0]};a.Graphic3D.prototype.getFamilyValues=function(){g=this.evaluator;c=g.evalExpression(this.family_interval);this.familyInf=c[0][0];this.familySup=c[0][1];this.fSteps=Math.round(g.evalExpression(this.family_steps));this.family_sep=0<this.fSteps?(this.familySup-this.familyInf)/this.fSteps:
0};a.Graphic3D.prototype.buildFamilyPrimitives=function(){g=this.evaluator;this.getFamilyValues();e=g.getVariable(this.family);if(0<=this.fSteps)for(var a=0,b=this.fSteps;a<=b;a++)g.setVariable(this.family,this.familyInf+a*this.family_sep),this.familyValue=this.familyInf+a*this.family_sep,g.evalExpression(this.drawif)&&this.buildPrimitives();g.setVariable(this.family,e)};a.Graphic3D.prototype.update=function(){this.primitives=[];this.evaluator.evalExpression(this.drawif)&&(this.family||this.buildPrimitives());
this.family&&this.buildFamilyPrimitives()};a.Graphic3D.prototype.updateMVMatrix=function(){k=this.evaluator.evalExpression(this.inirot);this.inirotEuler?(this.inirotM=this.inirotM.setIdentity(),this.inirotM=this.inirotM.rotateZ(a.degToRad(k[0][0])),this.inirotM=this.inirotM.rotateX(a.degToRad(k[0][1])),this.inirotM=this.inirotM.rotateZ(a.degToRad(k[0][2]))):(this.inirotM_X=this.inirotM_X.setIdentity().rotateX(a.degToRad(k[0][0])),this.inirotM_Y=this.inirotM_Y.setIdentity().rotateY(a.degToRad(k[0][1])),
this.inirotM_Z=this.inirotM_Z.setIdentity().rotateZ(a.degToRad(k[0][2])));k=this.evaluator.evalExpression(this.inipos);f={x:k[0][0],y:k[0][1],z:k[0][2]};this.iniposM=this.iniposM.setIdentity().translate(f);k=this.evaluator.evalExpression(this.endrot);this.endrotEuler?(this.endrotM=this.endrotM.setIdentity(),this.endrotM=this.endrotM.rotateZ(a.degToRad(k[0][0])),this.endrotM=this.endrotM.rotateX(a.degToRad(k[0][1])),this.endrotM=this.endrotM.rotateZ(a.degToRad(k[0][2]))):(this.endrotM_X=this.endrotM_X.setIdentity().rotateX(a.degToRad(k[0][0])),
this.endrotM_Y=this.endrotM_Y.setIdentity().rotateY(a.degToRad(k[0][1])),this.endrotM_Z=this.endrotM_Z.setIdentity().rotateZ(a.degToRad(k[0][2])));k=this.evaluator.evalExpression(this.endpos);f={x:k[0][0],y:k[0][1],z:k[0][2]};this.endposM=this.endposM.setIdentity().translate(f)};a.Graphic3D.prototype.transformVertex=function(a){this.inirotEuler?b=this.inirotM.multiplyVector4(a):(b=this.inirotM_X.multiplyVector4(a),b=this.inirotM_Y.multiplyVector4(b),b=this.inirotM_Z.multiplyVector4(b));b=this.iniposM.multiplyVector4(b);
this.endrotEuler?b=this.endrotM.multiplyVector4(b):(b=this.endrotM_X.multiplyVector4(b),b=this.endrotM_Y.multiplyVector4(b),b=this.endrotM_Z.multiplyVector4(b));b=this.endposM.multiplyVector4(b);this.macroChildren&&(b=this.applyMacroTransform(b));return b};a.Graphic3D.prototype.applyMacroTransform=function(a){this.macro_inirotEuler?b=this.macro_inirotM.multiplyVector4(a):(b=this.macro_inirotM_X.multiplyVector4(a),b=this.macro_inirotM_Y.multiplyVector4(b),b=this.macro_inirotM_Z.multiplyVector4(b));
b=this.macro_iniposM.multiplyVector4(b);this.macro_endrotEuler?b=this.macro_endrotM.multiplyVector4(b):(b=this.macro_endrotM_X.multiplyVector4(b),b=this.macro_endrotM_Y.multiplyVector4(b),b=this.macro_endrotM_Z.multiplyVector4(b));return b=this.macro_endposM.multiplyVector4(b)};a.Graphic3D.prototype.parseExpression=function(){t=[];for(var a=this.expresion.replace(/\n/g," ").replace(/ ( )+/g," ").trim(),b=[],d=0,c,e=a.length,f=a.length-1;-1<f;f--)c=a.charAt(f),0==d?"="==c&&(d=1):1==d?" "!=c&&(d="<"==
c||">"==c?0:2):2==d&&" "==c&&(b.unshift(a.substring(f+1,e)),e=f,d=0);b.unshift(a.substring(0,e));f=0;for(a=b.length;f<a;f++)t.push(this.evaluator.parser.parse(b[f],!0));return t};var d;a.Graphic3D.prototype.splitFace=function(a){for(var b=0,c=this.primitives.length;b<c;b++)if(d=[],"face"===this.primitives[b].type){for(var e=0,f=a.primitives.length;e<f;e++)"face"===a.primitives[e].type?d=d.concat(this.primitives[b].splitFace(a.primitives[e])):d.push(a.primitives[e]);a.primitives=d}};return a}(descartesJS||
{}),descartesJS=function(a){if(a.loadLib)return a;var f,g,c,e,b;a.Point3D=function(b,c){a.Graphic3D.call(this,b,c)};a.extend(a.Point3D,a.Graphic3D);a.Point3D.prototype.buildPrimitives=function(){f=this.evaluator;this.updateMVMatrix();g=f.evalExpression(this.expresion);c=g[0][0];e=g[0][1];b=g[0][2];this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(c,e,b,1))],type:"vertex",backColor:this.backcolor.getColor(),frontColor:this.color.getColor(),size:f.evalExpression(this.width)}));
""!==this.text&&this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(c,e,b,1))],type:"text",frontColor:this.color.getColor(),font:this.font,decimals:f.evalExpression(this.decimals),fixed:this.fixed,displace:this.fontSize,evaluator:f,text:this.text,family:this.family,familyValue:this.familyValue},this.space))};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var f,g,c,e,b,k,t;a.Segment3D=function(b,c){this.width=b.evaluator.parser.parse("1");
a.Graphic3D.call(this,b,c)};a.extend(a.Segment3D,a.Graphic3D);a.Segment3D.prototype.buildPrimitives=function(){evaluator=this.evaluator;this.updateMVMatrix();t=evaluator.getVariable("u");evaluator.setVariable("u",this.Nu);expr=evaluator.evalExpression(this.expresion);f=expr[0][0];g=expr[0][1];c=expr[0][2];e=expr[1][0];b=expr[1][1];k=expr[1][2];this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(f,g,c,1)),this.transformVertex(new a.Vector4D(e,b,k,1))],type:"edge",
frontColor:this.color.getColor(),lineWidth:evaluator.evalExpression(this.width)},this.space));evaluator.setVariable("u",t)};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var f,g,c,e,b,k,t,d,m,q,h,r,s,p;a.Surface3D=function(b,d){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,d);this.expresion=this.parseExpression()};a.extend(a.Surface3D,a.Graphic3D);a.Surface3D.prototype.buildPrimitives=
function(){f=this.evaluator;this.updateMVMatrix();e=f.getVariable("x");b=f.getVariable("y");k=f.getVariable("z");g=f.getVariable("u");c=f.getVariable("v");f.setVariable("u",0);f.setVariable("v",0);t=f.evalExpression(this.Nu);d=f.evalExpression(this.Nv);m=[];for(h=0;h<=t;h++)for(f.setVariable("u",h/t),r=0;r<=d;r++){f.setVariable("v",r/d);s=0;for(p=this.expresion.length;s<p;s++)f.evalExpression(this.expresion[s]);m.push(this.transformVertex(new a.Vector4D(f.getVariable("x"),f.getVariable("y"),f.getVariable("z"),
1)))}for(h=0;h<t;h++)for(r=0;r<d;r++)q=[],q.push(m[r+h*d+h]),q.push(m[r+1+h*d+h]),q.push(m[r+2+(h+1)*d+h]),q.push(m[r+1+(h+1)*d+h]),this.primitives.push(new a.Primitive3D({vertices:q,type:"face",frontColor:this.color.getColor(),backColor:this.backcolor.getColor(),edges:this.edges,model:this.model},this.space));f.setVariable("x",e);f.setVariable("y",b);f.setVariable("z",k);f.setVariable("u",g);f.setVariable("v",c)};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var f,g,c,
e,b,k;a.Polygon3D=function(b,d){this.width=b.evaluator.parser.parse("1");a.Graphic3D.call(this,b,d)};a.extend(a.Polygon3D,a.Graphic3D);a.Polygon3D.prototype.buildPrimitives=function(){evaluator=this.evaluator;this.updateMVMatrix();expr=evaluator.evalExpression(this.expresion);for(var t=0,d=expr.length-1;t<d;t++)f=expr[t][0],g=expr[t][1],c=expr[t][2],e=expr[t+1][0],b=expr[t+1][1],k=expr[t+1][2],this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(f,g,c,1)),this.transformVertex(new a.Vector4D(e,
b,k,1))],type:"edge",frontColor:this.color.getColor(),lineWidth:evaluator.evalExpression(this.width)},this.space))};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var f,g,c,e,b,k;a.Curve3D=function(b,d){this.width=b.evaluator.parser.parse("1");a.Graphic3D.call(this,b,d);this.expresion=this.parseExpression()};a.extend(a.Curve3D,a.Graphic3D);a.Curve3D.prototype.buildPrimitives=function(){evaluator=this.evaluator;this.updateMVMatrix();e=evaluator.getVariable("x");b=evaluator.getVariable("y");
k=evaluator.getVariable("z");c=evaluator.getVariable("u");evaluator.setVariable("u",0);g=evaluator.evalExpression(this.Nu);f=[];for(var t=0;t<=g;t++){evaluator.setVariable("u",t/g);for(var d=0,m=this.expresion.length;d<m;d++)evaluator.evalExpression(this.expresion[d]);f.push(this.transformVertex(new a.Vector4D(evaluator.getVariable("x"),evaluator.getVariable("y"),evaluator.getVariable("z"),1)))}t=0;for(d=f.length-1;t<d;t++)this.primitives.push(new a.Primitive3D({vertices:[f[t],f[t+1]],type:"edge",
frontColor:this.color.getColor(),lineWidth:evaluator.evalExpression(this.width)},this.space));evaluator.setVariable("x",e);evaluator.setVariable("y",k);evaluator.setVariable("z",b);evaluator.setVariable("u",c)};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var f,g,c,e,b,k,t,d,m;a.Triangle3D=function(b,d){a.Graphic3D.call(this,b,d)};a.extend(a.Triangle3D,a.Graphic3D);a.Triangle3D.prototype.buildPrimitives=function(){evaluator=this.evaluator;this.updateMVMatrix();expr=evaluator.evalExpression(this.expresion);
f=expr[0][0];g=expr[0][1];c=expr[0][2];e=expr[1][0];b=expr[1][1];k=expr[1][2];t=expr[2][0];d=expr[2][1];m=expr[2][2];this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(f,g,c,1)),this.transformVertex(new a.Vector4D(t,d,m,1)),this.transformVertex(new a.Vector4D(e,b,k,1))],type:"face",frontColor:this.color.getColor(),backColor:this.backcolor.getColor(),edges:this.edges,model:this.model},this.space))};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;
var f;a.Face3D=function(f,c){a.Graphic3D.call(this,f,c)};a.extend(a.Face3D,a.Graphic3D);a.Face3D.prototype.buildPrimitives=function(){evaluator=this.evaluator;this.updateMVMatrix();expr=evaluator.evalExpression(this.expresion);f=[];for(var g=expr.length-1;0<=g;g--)f.push(this.transformVertex(new a.Vector4D(expr[g][0],expr[g][1],expr[g][2],1)));this.primitives.push(new a.Primitive3D({vertices:f,type:"face",frontColor:this.color.getColor(),backColor:this.backcolor.getColor(),edges:this.edges,model:this.model},
this.space))};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var f,g,c,e,b;a.Polireg3D=function(b,c){this.width=b.evaluator.parser.parse("2");this.length=b.evaluator.parser.parse("2");a.Graphic3D.call(this,b,c)};a.extend(a.Polireg3D,a.Graphic3D);a.Polireg3D.prototype.buildPrimitives=function(){evaluator=this.evaluator;this.updateMVMatrix();f=evaluator.evalExpression(this.Nu);g=[this.transformVertex(new a.Vector4D(0,0,0,1))];c=evaluator.evalExpression(this.width)/2;e=evaluator.evalExpression(this.length)/
2;b=2*Math.PI/f;for(var k=0;k<f;k++)g.push(this.transformVertex(new a.Vector4D(c*Math.cos(b*k),e*Math.sin(b*k),0,1)));for(k=0;k<f;k++)this.primitives.push(new a.Primitive3D({vertices:[g[0],k+2<=f?g[k+2]:g[1],g[k+1]],type:"face",frontColor:this.color.getColor(),backColor:this.backcolor.getColor(),edges:this.edges,model:this.model},this.space))};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var f,g,c,e;a.Text3D=function(b,c){a.Graphic3D.call(this,b,c)};a.extend(a.Text3D,a.Graphic3D);
a.Text3D.prototype.buildPrimitives=function(){f=this.evaluator;g=f.evalExpression(this.expresion);c=g[0][0];e=g[0][1];this.primitives.push(new a.Primitive3D({vertices:[new a.Vector4D(c,e,0,1)],type:"text",frontColor:this.color.getColor(),font:this.font,decimals:f.evalExpression(this.decimals),fixed:this.fixed,displace:0,isText:!0,evaluator:f,text:this.text,family:this.family,familyValue:this.familyValue,joel:"hola"},this.space))};return a}(descartesJS||{}),descartesJS=function(a,f){if(a.loadLib)return a;
var g=/[\w\.\-//]*(\.png|\.jpg|\.gif|\.svg)/gi,c,e;a.Macro3D=function(b,c){this.expresion=void 0;this.inirot="(0,0,0)";this.inirotEuler=!1;this.inipos=b.evaluator.parser.parse("(0,0,0)");this.endrot="(0,0,0)";this.endrotEuler=!1;this.endpos=b.evaluator.parser.parse("(0,0,0)");a.Graphic.call(this,b,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=[];e=b.lessonParser;var d=new a.Tokenizer;if(void 0!=this.expresion){"'"!==
this.expresion.charAt(0)&&(this.expresion="'"+this.expresion+"'");this.expresion=this.evaluator.parser.parse(this.expresion);var m=this.evaluator.evalExpression(this.expresion),q;m&&((q=document.getElementById(m))&&"descartes/macro"==q.type?q=q.text:(q=a.openExternalFile(m))&&!q.match(/tipo_de_macro/g)&&(q=null));var h,r;if(q){r=q.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");q=[];for(var m=0,s=r.length;m<s;m++)h=r[m].indexOf("="),-1!==h&&(h=r[m].substring(0,h),"id"!==f[h]&&"type"!==f[h]||q.push(e.split(r[m])));for(var p,l,u,n,m=0,s=q.length;m<s;m++)for(n=(p=q[m]||[],p[0])&&"id"===p[0][0],
r=0,h=p.length;r<h;r++)if(l=p[r][0].indexOf("."),-1===l||n?l=f[p[r][0]]:(l=f[p[r][0].substring(l+1)],p[r][0]=this.name+"."+p[r][0]),!("font"===l||("fill"===l||"color"===l||"backcolor"===l||"arrow"===l)&&"("!==p[r][1].charAt(0)||"file"===l&&p[r][1].match(g)||"id"!==l&&void 0!==f[p[r][1]])||"width"===l||"height"===l||"length"===l)if("text"==l)if(p[r][1].match(/\{\\rtf1/)){l=p[r][1];var v=this;u=function(a,b){for(var c=d.tokenize(b.replace(/\&squot;/g,"'")),h=0,e=c.length;h<e;h++)"identifier"!=c[h].type||
"-rnd-pi-e-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-".match("-"+c[h].value+"-")||(c[h].value=v.name+"."+c[h].value);return(a.match(/^\\expr/)?"\\expr ":"\\decimals ")+d.flatTokens(c)};l=l.replace(/\\expr ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.']*)/gi,u);l=l.replace(/\\decimals ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.']*)/gi,u);p[r][1]=l}else{u=e.parseText(p[r][1]).textElementsMacro3Ds;for(var w=0,
z=u.length;w<z;w++){l=d.tokenize(u[w].replace(/\&squot;/g,"'"));for(var C=0,A=l.length;C<A;C++)"identifier"!==l[C].type||"-rnd-pi-e-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-".match("-"+l[C].value+"-")||(l[C].value=this.name+"."+l[C].value);l=d.flatTokens(l).replace(/&squot;/g,"'").replace(/'\+\(/g,"[").replace(/\)\+'/g,"]");u[w]=l.substring(1,l.length-1)}p[r][1]=u.join("")}else{l=d.tokenize(p[r][1]);
u=0;for(w=l.length;u<w;u++)"identifier"!==l[u].type||"-rnd-pi-e-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-".match("-"+l[u].value+"-")||(l[u].value=this.name+"."+l[u].value);p[r][1]=d.flatTokens(l)}m=0;for(s=q.length;m<s;m++)if(q[m][0]){p="";n=!1;r=0;for(h=q[m].length;r<h;r++)"type"===f[q[m][r][0]]&&(p="espacio='"+this.spaceID+"' ",n=!0),p=p+q[m][r][0]+"='"+q[m][r][1]+"' ";q[m]=p;n?this.graphics.push(e.parse3DGraphic(q[m],
this.abs_coord,this.background,this.inirot)):e.parseAuxiliar(q[m])}}m=0;for(s=this.graphics.length;m<s;m++)this.graphics[m].macroChildren=!0}};a.extend(a.Macro3D,a.Graphic);a.Macro3D.prototype.update=function(){this.updateTransformation();if(this.inipos){var a=this.evaluator.evalExpression(this.inipos);this.iniPosX=a[0][0];this.iniPosY=a[0][1]}this.primitives=[];for(var a=0,f=this.graphics.length;a<f;a++)c=this.graphics[a],c.macro_inirotEuler=this.inirotEuler,c.macro_inirotM=this.inirotM,c.macro_inirotM_X=
this.inirotM_X,c.macro_inirotM_Y=this.inirotM_Y,c.macro_inirotM_Z=this.inirotM_Z,c.macro_iniposM=this.iniposM,c.macro_endrotEuler=this.endrotEuler,c.macro_endrotM=this.endrotM,c.macro_endrotM_X=this.endrotM_X,c.macro_endrotM_Y=this.endrotM_Y,c.macro_endrotM_Z=this.endrotM_Z,c.macro_endposM=this.endposM,c.update();a=0;for(f=this.graphics.length;a<f;a++){c=this.graphics[a];if(c.split||this.split)for(var g=a+1;g<f;g++)e=this.graphics[g],(e.split||this.split)&&c.splitFace(e);this.primitives=this.primitives.concat(c.primitives||
[])}};a.Macro3D.prototype.updateTransformation=function(){tmpExpr=this.evaluator.evalExpression(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.evalExpression(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.evalExpression(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.evalExpression(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 f(a,
b,d,c,h){g.call(this,a/1.8,a/1.8,a/1.8,c,h)}function g(a,b,d,c,h){a/=2;b/=2;d/=2;this.changeGeometry(a,b,d,c,h)||(this.vertices=[new l(a,d,b,1),new l(a,-d,b,1),new l(a,d,-b,1),new l(a,-d,-b,1),new l(-a,d,b,1),new l(-a,-d,b,1),new l(-a,d,-b,1),new l(-a,-d,-b,1)],this.faces=[[2,3,1,0],[1,5,4,0],[5,7,6,4],[6,7,3,2],[4,6,2,0],[3,7,5,1]],this.updateValues(a,b,d,c,h))}function c(a,b,d,c,h){a/=2;this.changeGeometry(a,b,d,c,h)||(this.vertices=[new l(0,0,a,1),new l(-.49*a,-.86*a,-.32*a,1),new l(-.49*a,.86*
a,-.32*a,1),new l(1*a,0,-.32*a,1)],this.faces=[[3,2,1],[1,2,0],[2,3,0],[3,1,0]],this.updateValues(a,b,d,c,h))}function e(a,b,d,c,h){a/=2;this.changeGeometry(a,b,d,c,h)||(this.vertices=[new l(0,0,a,1),new l(a,0,0,1),new l(-a,0,0,1),new l(0,a,0,1),new l(0,-a,0,1),new l(0,0,-a,1)],this.faces=[[3,1,0],[2,3,0],[1,4,0],[4,2,0],[1,3,5],[3,2,5],[4,1,5],[2,4,5]],this.updateValues(a,b,d,c,h))}function b(b,d,c,h,e){b/=3.4;if(!this.changeGeometry(b,d,c,h,e)){D=b/1.6180339887;G=1.6180339887*b;this.vertices=[new l(b,
b,b,1),new l(b,b,-b,1),new l(b,-b,b,1),new l(b,-b,-b,1),new l(-b,b,b,1),new l(-b,b,-b,1),new l(-b,-b,b,1),new l(-b,-b,-b,1),new l(0,D,G,1),new l(0,D,-G,1),new l(0,-D,G,1),new l(0,-D,-G,1),new l(D,G,0,1),new l(D,-G,0,1),new l(-D,G,0,1),new l(-D,-G,0,1),new l(G,0,D,1),new l(G,0,-D,1),new l(-G,0,D,1),new l(-G,0,-D,1)];E=(new a.Matrix4x4).setIdentity().rotateY(-s/6);y=0;for(I=this.vertices.length;y<I;y++)this.vertices[y]=E.multiplyVector4(this.vertices[y]);this.faces=[[0,16,2,10,8],[12,1,17,16,0],[8,
4,14,12,0],[2,16,17,3,13],[13,15,6,10,2],[6,18,4,8,10],[3,17,1,9,11],[13,3,11,7,15],[1,12,14,5,9],[11,9,5,19,7],[5,14,4,18,19],[6,15,7,19,18]];this.updateValues(b,d,c,h,e)}}function k(b,d,c,h,e){b/=4;if(!this.changeGeometry(b,d,c,h,e)){G=1.6180339887*b;this.vertices=[new l(0,b,G,1),new l(0,b,-G,1),new l(0,-b,G,1),new l(0,-b,-G,1),new l(b,G,0,1),new l(b,-G,0,1),new l(-b,G,0,1),new l(-b,-G,0,1),new l(G,0,b,1),new l(G,0,-b,1),new l(-G,0,b,1),new l(-G,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]];E=(new a.Matrix4x4).setIdentity().rotateY(-1.029);y=0;for(I=this.vertices.length;y<I;y++)this.vertices[y]=E.multiplyVector4(this.vertices[y]);this.updateValues(b,d,c,h,e)}}function t(a,b,d,c,e){a/=2;this.isSphere?d=b=a:(b/=2,d/=2);if(!this.changeGeometry(a,b,d,c,e)){this.vertices=[new l(0,0,b,1)];for(y=1;y<c;y++)for(A=y*s/c,F=0;F<e;F++)C=F*p/e,v=a*h(A)*r(C),
w=d*h(A)*h(C),z=b*r(A),this.vertices.push(new l(v,w,z,1));this.vertices.push(new l(0,0,-b,1));this.faces=[];for(y=0;y<e;y++)this.faces.push([0,(y+1)%e+1,y%e+1]);for(y=1;y<c-1;y++)for(F=0;F<e;F++)this.faces.push([F+1+(y-1)*e,(F+1)%e+1+(y-1)*e,(F+1)%e+1+y*e,F+1+y*e]);for(y=0;y<e;y++)this.faces.push([this.vertices.length-1,this.vertices.length-1-e+y,this.vertices.length-1-e+(y+1)%e]);this.updateValues(a,b,d,c,e)}}function d(a,b,d,c,e){a/=2;b/=2;d/=2;if(!this.changeGeometry(a,b,d,c,e)){this.vertices=
[];for(y=0;y<e;y++)for(F=0;F<c;F++)v=a*(e-y)/e*r(F*p/c),w=d*(e-y)/e*h(F*p/c),z=b-2*y*b/e,this.vertices.push(new l(v,w,z,1));this.vertices.push(new l(0,0,-b,1));this.faces=[];for(y=0;y<e-1;y++)for(F=0;F<c;F++)this.faces.push([F+y*c,(F+1)%c+y*c,(F+1)%c+(y+1)*c,F+(y+1)*c]);for(y=0;y<c;y++)this.faces.push([this.vertices.length-1,this.vertices.length-1-c+y,this.vertices.length-1-c+(y+1)%c]);this.updateValues(a,b,d,c,e)}}function m(a,b,d,c,e){a/=2;b/=2;d/=2;if(!this.changeGeometry(a,b,d,c,e)){this.vertices=
[];for(y=0;y<e+1;y++)for(F=0;F<c;F++)v=a*r(F*p/c),w=d*h(F*p/c),z=b-2*y*b/e,this.vertices.push(new l(v,w,z,1));this.faces=[];for(y=0;y<e;y++)for(F=0;F<c;F++)this.faces.push([F+y*c,(F+1)%c+y*c,(F+1)%c+(y+1)*c,F+(y+1)*c]);this.updateValues(a,b,d,c,e)}}function q(){function a(b){return parseInt(b)}function b(a){return parseFloat(a)}this.vertices=[];this.faces=[];y=0;for(I=this.fileData.length;y<I;y++)B=this.fileData[y],B.match(/^V\(/)?(J=B.substring(2,B.length-1).split(",").map(b),this.vertices.push(new l(J[0]||
0,J[1]||0,J[2]||0,1))):B.match(/^F\(/)&&(J=B.substring(2,B.length-1).split(",").map(a),this.faces.push(J.reverse()))}if(a.loadLib)return a;var h=Math.sin,r=Math.cos,s=Math.PI,p=2*s,l,u,n,v,w,z,C,A,D,G,E,B,J,y,I,F,x;a.OtherGeometry=function(h,n){this.width=h.evaluator.parser.parse("2");this.height=h.evaluator.parser.parse("2");this.length=h.evaluator.parser.parse("2");l=a.Vector4D;a.Graphic3D.call(this,h,n);switch(this.type){case "cube":this.buildGeometry=f;break;case "box":this.buildGeometry=g;break;
case "tetrahedron":this.buildGeometry=c;break;case "octahedron":this.buildGeometry=e;break;case "sphere":this.isSphere=!0;case "ellipsoid":this.buildGeometry=t;break;case "dodecahedron":this.buildGeometry=b;break;case "icosahedron":this.buildGeometry=k;break;case "cone":this.buildGeometry=d;break;case "cylinder":this.buildGeometry=m;break;case "mesh":this.fileData=a.openExternalFile(this.evaluator.evalExpression(this.file)).split(/\r/),this.buildGeometry=q}};a.extend(a.OtherGeometry,a.Graphic3D);
a.OtherGeometry.prototype.buildPrimitives=function(){u=this.evaluator;this.updateMVMatrix();this.buildGeometry(u.evalExpression(this.width),u.evalExpression(this.height),u.evalExpression(this.length),u.evalExpression(this.Nu),u.evalExpression(this.Nv));y=0;for(I=this.faces.length;y<I;y++){n=[];F=0;for(x=this.faces[y].length;F<x;F++)n.push(this.transformVertex(this.vertices[this.faces[y][F]]));this.primitives.push(new a.Primitive3D({vertices:n,type:"face",frontColor:this.color.getColor(),backColor:this.backcolor.getColor(),
edges:this.edges,model:this.model},this.space))}};a.OtherGeometry.prototype.changeGeometry=function(a,b,d,c,e){return this.oldWidth===a&&this.oldHeight===b&&this.oldLength===d&&this.oldNu===c&&this.oldNv===e};a.OtherGeometry.prototype.updateValues=function(a,b,d,c,e){this.oldWidth=a;this.oldHeight=b;this.oldLength=d;this.oldNv=e;this.oldNu=c};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var f=Math.max,g=Math.min,c=Math.PI,e=Math.cos,b=Math.sin,k=Math.abs,t=Math.round,d,
m,q,h,r,s,p,l,u,n,v,w,z,C,A,D,G,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 t(f(g(this.x,32E3),-32E3))};a.R2.prototype.iy=function(){return t(f(g(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){m=this.copy();m.sub(a);return m.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(){d=this.norm();0!=d&&this.div(d)};a.R2.prototype.rotR90=
function(){d=this.x;this.x=this.y;this.y=-d};a.R2.prototype.rotL90=function(){d=this.x;this.x=-this.y;this.y=d};a.R2.prototype.rot=function(a){q=this.copy();s=e(a);p=b(a);this.x=q.x*s-q.y*p;this.y=q.x*p+q.y*s};a.R2.prototype.rot=function(a){this.rot(a*c/180)};a.R2.prototype.intersection=function(b,d,c,e){l=d.x-b.x;u=c.x-e.x;n=c.x-b.x;v=d.y-b.y;w=c.y-e.y;z=c.y-b.y;E=l*w-u*v;return 1E-6<k(E)?(h=(n*w-z*u)/E,r=(-n*v+z*l)/E,0<=h&&1>=h&&0<=r&&1>=r?new a.R2(b.x+l*h,b.y+v*h):null):(d.x-c.x)*z!=(d.y-c.y)*
n?null:b.x!=d.x?(C=g(b.x,d.x),A=f(b.x,d.x),C<=c.x&&c.x<=A?c:C<=e.x&&e.x<=A?e:null):c.x!=e.x?(D=g(c.x,e.x),G=f(c.x,e.x),D<=b.x&&b.x<=G?b:D<=d.x&&d.x<=G?d:null):b.y!=d.y?(C=g(b.y,d.y),A=f(b.y,d.y),C<=c.y&&c.y<=A?c:C<=e.y&&e.y<=A?e:null):c.y!=e.y?(D=g(c.y,e.y),G=f(c.y,e.y),D<=b.y&&b.y<=G?b:D<=d.y&&d.y<=G?d:null):b.x==c.x&&b.y==c.y?b:null};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var f,g,c,e,b,k,t,d,m;a.R2Newton=function(d,c){this.evaluator=d;this.constraint=c;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];k=new a.R2(0,0);b=new a.R2(0,0);m=new a.R2(0,0)};a.R2Newton.prototype.getUnitNormal=function(){this.normal.normalize();return m.set(this.normal.x,
this.normal.y)};a.R2Newton.prototype.gradient=function(a){f=this.evaluator;k.x=0;k.y=0;t=f.getVariable("x");d=f.getVariable("y");f.setVariable("x",a.x);f.setVariable("y",a.y);this.f0=f.evalExpression(this.constraint);f.setVariable("x",f.getVariable("x")+1E-6);g=f.evalExpression(this.constraint);k.x=(g-this.f0)/1E-6;k.x=isNaN(k.x)?Infinity:k.x;f.setVariable("x",f.getVariable("x")-1E-6);f.setVariable("y",f.getVariable("y")+1E-6);g=f.evalExpression(this.constraint);k.y=(g-this.f0)/1E-6;k.y=isNaN(k.y)?
Infinity:k.y;f.setVariable("x",t);f.setVariable("y",d);return k};a.R2Newton.prototype.findZero=function(a,h,m){f=this.evaluator;b.x=a.x;b.y=a.y;t=f.getVariable("x");d=f.getVariable("y");f.setVariable("x",a.x);f.setVariable("y",a.y);this.f0=f.evalExpression(this.constraint);if("menor"===this.sign&&0>=this.f0||"mayor"===this.sign&&0<=this.f0)return b;f.setVariable("x",t);f.setVariable("y",d);for(var k=0;16>k;k++)if(c=b.x,e=b.y,this.normal=this.gradient(b),0!=this.normal.norm2()&&this.normal.mul(-this.f0/
this.normal.norm2()),b.x=c+this.normal.x,b.y=e+this.normal.y,this.normal.norm()<h)return 0===this.normal.x&&0===this.normal.y&&(this.normal.x=b.x-a.x,this.normal.y=b.y-a.y),b;return m?b:null};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;a.Vector2D=function(a,g){this.x=a;this.y=g};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 f=Math.floor,g=Math.round,c,e,b,k,t,d,m,q,h,r,s,p,l,u,n,v,w,z,C,A;a.Control=function(b,d){this.parent=b;this.evaluator=b.evaluator;var c=this.parser=b.evaluator.parser;this.id="graphic"!==d.type?"C":"G";this.gui=this.type="";this.region="south";this.y=
this.x=0;this.w="video"!==d.type?100:350;this.h="video"!==d.type?23:120;"graphic"!==d.type&&"audio"!==d.type&&"video"!==d.type?"text"!==d.type?this.expresion=c.parse("(0,0,100,23)"):(this.expresion=c.parse("(0,0,300,200)"),this.w=300,this.h=200):this.expresion=c.parse("(0,0)");this.fixed=2!=this.parent.version?!1:!0;this.visible=!0;this.color=4>this.parent.version?new a.Color("000000"):new a.Color("222222");this.colorInt="graphic"!==d.type?new a.Color("f0f8ff"):new a.Color("cc0022");this.underlined=
this.italics=this.bold="";this.font_size=4>this.parent.version?-1:c.parse("12");this.parameter=this.action="";this.parameterFont="Monospace 12px";this.drawif=c.parse("1");this.activeif=c.parse("1");this.tooltip="";this.tooltipFont="Monospace 12px";this.Explanation="";this.ExplanationFont="Monospace 12px";this.cID=this.msg_pos="";this.valueExpr=c.parse("0");this.decimals=c.parse("2");this.min=c.parse("-Infinity");this.max=c.parse("Infinity");this.incr=c.parse("0.1");this.exponentialif=this.discrete=
!1;this.zIndex=-1;for(var e in d)d.hasOwnProperty(e)&&(this[e]=d[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.evalExpression(this.expresion);this.x=g(c[0][0]);this.y=g(c[0][1]);4==c[0].length&&(this.w=g(c[0][2]),this.h=g(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,b;if("interior"===this.region)for(var d=0,c=a.length;d<c;d++){if(b=a[d],b.id===this.spaceID)return b.addCtr(this),this.zIndex=b.zIndex,b.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.scenarioRegion.scenarioSpace.addCtr(this),this.zIndex=this.parent.scenarioRegion.scenarioSpace.zIndex,this.parent.scenarioRegion.scenarioSpace.numericalControlContainer):this.parent.externalSpace.container;if("north"===this.region)return this.parent.northSpace.controls.push(this),this.parent.northSpace.container;if("south"===this.region)return this.parent.southSpace.controls.push(this),this.parent.southSpace.container;
if("east"===this.region)return this.parent.eastSpace.controls.push(this),this.parent.eastSpace.container;if("west"===this.region)return this.parent.westSpace.controls.push(this),this.parent.westSpace.container;if("special"===this.region)return this.parent.specialSpace.controls.push(this),this.parent.specialSpace.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);b.childNodes[0]?b.insertBefore(a,b.childNodes[0]):b.appendChild(a)};a.Control.prototype.updatePositionAndSize=function(){b=k=t=d=!1;m=this.evaluator.evalExpression(this.expresion);q=g(m[0][0]);b=g(this.x)!==q;this.x=q;q=g(m[0][1]);k=g(this.y)!==q;this.y=q;4===m[0].length&&(q=g(m[0][2]),t=g(this.w)!==q,this.w=q,q=g(m[0][3]),d=g(this.h)!==q,this.h=q);if(t||d||b||k)this.init(!0),this.draw()};a.Control.prototype.formatOutputValue=function(a){l=this.parent;h=a+"";r=this.evaluator.evalExpression(this.decimals);
s=h.indexOf(".");-1!=s&&(p=h.substring(s+1),p.length>r&&(h=parseFloat(h).toFixed(r)));this.fixed&&(2!==l.version||2===l.version&&!this.exponentialif)&&(h=parseFloat(a).toFixed(r));this.exponentialif&&0!=parseFloat(h)&&(h=this.fixed&&2!==l.version?parseFloat(h).toExponential(r):parseFloat(h).toExponential(),h=h.toUpperCase(),h=h.replace("+",""));return h=h.replace(".",l.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()};a.Control.prototype.createGradient=function(a,b){this.linearGradient=this.ctx.createLinearGradient(0,0,0,b);c=b*b;for(var d=0;d<b;d++)e=f(d-35*b/100),this.linearGradient.addColorStop(d/b,"rgba(0,0,0,"+e*e*192/c/255+")")};a.Control.prototype.getScreenshot=function(){v=this;u=document.createElement("canvas");u.setAttribute("width",v.w);u.setAttribute("height",v.h);n=u.getContext("2d");n.font=v.fieldFontSize+
"px Arial, Helvetica, 'Droid Sans', Sans-serif";v.canvas&&(w=v.canvas.offsetLeft,z=v.canvas.offsetTop,n.drawImage(v.canvas,w,z));v.label&&(w=v.label.offsetLeft,z=v.label.offsetTop,C=v.label.offsetWidth,A=v.label.offsetHeight,n.fillStyle="#e0e4e8",n.fillRect(w,z,C,A),n.fillStyle="black",n.textAlign="center",n.textBaseline="middle",n.fillText(v.name,w+C/2,z+A/2));v.field&&(w=v.field.offsetLeft,z=v.field.offsetTop,C=v.field.offsetWidth,A=v.field.offsetHeight,n.fillStyle="white",n.strokeStyle="#666666",
n.lineWidth=1,n.fillRect(w,0,C,A),n.strokeRect(w+.5,.5,C-1,A-1),n.fillStyle="black",n.textAlign="center",n.textAlign="left",n.fillText(v.field.value,w+2,A/2));v.select&&(w=v.select.offsetLeft,z=v.select.offsetTop,C=v.select.offsetWidth,A=v.select.offsetHeight,n.fillStyle="#e0e4e8",n.strokeStyle="#666666",n.lineWidth=1,n.fillRect(w,0,C,A),n.strokeRect(w+.5,.5,C,A-1),n.fillStyle="black",n.textAlign="center",n.textAlign="left",n.fillText(v.select.value,w+2,A/2),n.fillStyle="#c0c0c0",n.fillRect(w+C-15+
.5,.5,15,A-1),n.strokeRect(w+C-15+.5,.5,15,A-1),n.fillStyle="black",n.beginPath(),n.moveTo(w+C-15+4.5,A/2-2.5),n.lineTo(w+C-15+8,A/2+2.5),n.lineTo(w+C-15+11.5,A/2-2.5),n.closePath(),n.fill());return u};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var f=Math.floor,g=Math.abs,c,e,b,k,t,d,m,q,h,r,s,p,l,u,n,v,w,z,C,A=/[\w\.\-//]*(\.gif)/gi,D,G,E,B,J,y,I,F,x,K,H,M,L;a.Button=function(b,d){this.imageSrc="";this.image=new Image;this.imageOver=new Image;this.imageDown=new Image;
a.Control.call(this,b,d);a.button_ratio=(window.devicePixelRatio||1)/(a.ctx.webkitBackingStorePixelRatio||a.ctx.mozBackingStorePixelRatio||a.ctx.msBackingStorePixelRatio||a.ctx.oBackingStorePixelRatio||a.ctx.backingStorePixelRatio||1);-1===this.font_size&&(this.fontSizeNotSet=!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 c;if(this.imageSrc.trim().match("^_STYLE_")){this.customStyle=
!0;this.canvasStyle=[];this.containerStyle=[];c=this.imageSrc.trim().substring(8).split("|");for(var e,h=0,f=c.length;h<f;h++)e=c[h],e.match("border=")&&(this.canvasStyle.push({type:"border-style",value:"solid"}),this.canvasStyle.push({type:"border-width",value:e.substring(7).trim()+"px"})),e.match("borderRadius=")&&(this.canvasStyle.push({type:"border-radius",value:e.substring(13).trim()+"px"}),this.containerStyle.push({type:"border-radius",value:e.substring(13).trim()+"px"})),e.match("borderColor=")&&
this.canvasStyle.push({type:"border-color",value:"#"+e.substring(12).trim()}),e.match("overColor=")&&(this.containerStyle.overColor="#"+e.substring(10).trim()),e.match("downColor=")&&(this.containerStyle.downColor="#"+e.substring(10).trim()),e.match("font=")&&(this.containerStyle.font=e.substring(5).trim().toLowerCase()),e.match("inactiveColor=")&&(this.containerStyle.inactiveColor="#"+e.substring(14).trim()),e.match("inactiveColorBorder=")&&(this.containerStyle.inactiveColorBorder="#"+e.substring(20).trim()),
e.match("shadowTextBlur=")&&(this.containerStyle.shadowTextBlur=parseFloat(e.substring(15).trim())),e.match("shadowTextOffsetX=")&&(this.containerStyle.shadowTextOffsetX=parseFloat(e.substring(18).trim())),e.match("shadowTextOffsetY=")&&(this.containerStyle.shadowTextOffsetY=parseFloat(e.substring(18).trim())),e.match("shadowTextColor=")&&(this.containerStyle.shadowTextColor="#"+e.substring(16).trim()),e.match("shadowBoxBlur=")&&(this.containerStyle.shadowBoxBlur=parseFloat(e.substring(14).trim())),
e.match("shadowBoxOffsetX=")&&(this.containerStyle.shadowBoxOffsetX=parseFloat(e.substring(17).trim())),e.match("shadowBoxOffsetY=")&&(this.containerStyle.shadowBoxOffsetY=parseFloat(e.substring(17).trim())),e.match("shadowBoxColor=")&&(this.containerStyle.shadowBoxColor="#"+e.substring(15).trim()),e.match("shadowInsetBoxBlur=")&&(this.containerStyle.shadowInsetBoxBlur=parseFloat(e.substring(19).trim())),e.match("shadowInsetBoxOffsetX=")&&(this.containerStyle.shadowInsetBoxOffsetX=parseFloat(e.substring(22).trim())),
e.match("shadowInsetBoxOffsetY=")&&(this.containerStyle.shadowInsetBoxOffsetY=parseFloat(e.substring(22).trim())),e.match("shadowInsetBoxColor=")&&(this.containerStyle.shadowInsetBoxColor="#"+e.substring(20).trim());this.imageSrc="vacio.gif"}this.imageSrc.match("_COLORES_")&&(c=this.imageSrc.split("_"),this.colorInt=new a.Color(c[2]),this.color=new a.Color(c[3]),this.font_size=this.parser.parse(c[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+"'");c=this.evaluator.evalExpression(this.imageSrc).toString().trim();""!=c&&(e=c.substr(0,c.lastIndexOf(".")),h=c.substr(c.lastIndexOf(".")),c.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(c),e&&(this.imageOver=this.parent.getImage(e+
"_over"+h),this.imageDown=this.parent.getImage(e+"_down"+h))));this.container=document.createElement("div");this.container.setAttribute("class","DescartesButtonContainer");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.canvas=document.createElement("canvas");this.canvas.width=this.w*a.button_ratio;this.canvas.height=this.h*a.button_ratio;this.canvas.setAttribute("style",
"position:absolute; left:0px; top:0px; 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.canvas.getContext("2d");this.ctx.imageSmoothingEnabled=!1;this.ctx.mozImageSmoothingEnabled=!1;this.ctx.webkitImageSmoothingEnabled=!1;this.container.appendChild(this.canvas);this.addControlContainer(this.container);this.registerMouseAndTouchEvents();this.init()};a.extend(a.Button,a.Control);a.Button.prototype.init=function(d){c=
this.evaluator;D=this.container;e=this.canvas;b=this.ctx;k=c.evalExpression(this.expresion);this.x=k[0][0];this.y=k[0][1];4==k[0].length&&(this.w=parseInt(k[0][2]),this.h=parseInt(k[0][3]));e.width=this.w*a.button_ratio;e.height=this.h*a.button_ratio;e.setAttribute("style","position:absolute; left:0px; top:0px; width:"+this.w+"px; height:"+this.h+"px; -webkit-box-sizing:border-box; -moz-box-sizing:border-box; box-sizing:border-box;");D.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.canvasStyle)for(var h=0,f=this.canvasStyle.length;h<f;h++)e.style[this.canvasStyle[h].type]=this.canvasStyle[h].value;if(this.containerStyle){h=0;for(f=this.containerStyle.length;h<f;h++)D.style[this.containerStyle[h].type]=this.containerStyle[h].value;if(this.containerStyle.shadowBoxColor){var h=this.containerStyle.shadowBoxOffsetX||0,f=this.containerStyle.shadowBoxOffsetY||2,l=this.containerStyle.shadowBoxBlur||2;D.style.boxShadow=
h+"px "+f+"px "+l+"px 1px "+this.containerStyle.shadowBoxColor}this.containerStyle.shadowInsetBoxColor&&(h=this.containerStyle.shadowInsetBoxOffsetX||0,f=this.containerStyle.shadowInsetBoxOffsetY||-2,l=this.containerStyle.shadowInsetBoxBlur||1,e.style.boxShadow=h+"px "+f+"px "+l+"px 1px "+this.containerStyle.shadowInsetBoxColor+" inset");this.containerStyle.shadowTextColor&&(b.shadowBlur=this.containerStyle.shadowTextBlur||1,b.shadowOffsetX=this.containerStyle.shadowTextOffsetX||0,b.shadowOffsetY=
this.containerStyle.shadowTextOffsetY||2,b.shadowColor=this.containerStyle.shadowTextColor)}this.fontSizeNotSet&&(this.font_size=c.parser.parse(a.getFieldFontSize(this.h)+""));this.fs_evaluated=c.evalExpression(this.font_size);this.createGradient(this.w,this.h);D.style.display=0<c.evalExpression(this.drawif)?"block":"none";b.textAlign="center";b.textBaseline="middle";b.lineJoin="round";b.font=this.italics+" "+this.bold+" "+this.fs_evaluated+"px descartesJS_sansserif,Arial,Helvetica,Sans-serif";this.customStyle&&
("serif"==this.containerStyle.font?b.font=this.italics+" "+this.bold+" "+this.fs_evaluated+"px descartesJS_serif,Times,'Times New Roman', serif":"monospace"==this.containerStyle.font?b.font=this.italics+" "+this.bold+" "+this.fs_evaluated+"px descartesJS_monospace,Courier,'Courier New',Monospace":"icons"==this.containerStyle.font&&(b.font=this.italics+" "+this.bold+" "+this.fs_evaluated+"px descartesJS_icons,Arial,Helvetica,Sans-serif"));this.draw(d)};a.Button.prototype.update=function(){c=this.evaluator;
D=this.container;e=this.canvas;this.activeIfValue=0<c.evalExpression(this.activeif);(this.drawIfValue=0<c.evalExpression(this.drawif))?(D.style.display="block",this.draw()):(D.style.display="none",this.buttonClick=!1);D.style.cursor=this.activeIfValue?"pointer":"not-allowed";e.style.cursor=this.activeIfValue?"pointer":"not-allowed";this.updatePositionAndSize()};a.Button.prototype.draw=function(k){D=this.container;c=this.evaluator;e=this.canvas;b=this.ctx;d=c.evalExpression(this.name);m=c.evalExpression(this.imageSrc)+
"";if(!k&&(G=this.over===this.oldOver,E=this.buttonClick===this.oldButtonClick,B=this.activeIfValue===this.oldActiveIfValue,J=this.drawIfValue===this.oldDrawIfValue,y=d===this.oldName,I=m===this.oldImageSrc,this.oldOver=this.over,this.oldButtonClick=this.buttonClick,this.oldActiveIfValue=this.activeIfValue,this.oldDrawIfValue=this.drawIfValue,this.oldName=d,this.oldImageSrc=m,G&&E&&B&&J&&y&&I))return;b.save();b.setTransform(a.button_ratio,0,0,a.button_ratio,0,0);t=this.fs_evaluated;q="vacio.gif"===
m?this.emptyImage:this.parent.getImage(m);F=m.substr(0,m.lastIndexOf("."));x=m.substr(m.lastIndexOf("."));K=F+"_over"+x;H=F+"_down"+x;M="vacio.gif"===m?this.emptyImage:this.parent.getImage(K);L="vacio.gif"===m?this.emptyImage:this.parent.getImage(H);b.clearRect(0,0,this.w,this.h);r=h=0;this.buttonClick&&(r=h=1);n=f(this.w/2+h)-.5;v=f(this.h/2+r)-.5;q&&(w=q.height||1E8,z=a.getFontMetrics(this.italics+" "+this.bold+" "+t+"px descartesJS_sansserif, Arial, Helvetica, Sans-serif").h,C=""!=d?0<=this.h-
w-z-2?!0:!1:!1,l=parseInt((this.w-q.width)/2)+h,u=C?parseInt((this.h-z-q.height+2)/2):parseInt((this.h-q.height)/2)+r,C&&(v=parseInt(this.h-z/2-2),D.style.backgroundColor=this.colorInt.getColor(),b.strokeStyle=this.color.getColor(),b.lineWidth=1,b.beginPath(),b.moveTo(.5,.5),b.lineTo(this.w-.5,.5),b.lineTo(this.w-.5,this.h-.5),b.lineTo(.5,this.h-.5),b.closePath(),b.stroke()));q&&q.ready?q!==this.emptyImage&&q.complete?m.match(A)?(this.canvas.style.backgroundImage="url('"+m+"')",this.canvas.style.backgroundPosition=
l+"px "+u+"px"):b.drawImage(q,l,u):this.emptyImage&&this.customStyle&&(D.style.backgroundColor=this.colorInt.getColor()):(D.style.backgroundColor=this.colorInt.getColor(),this.buttonClick||(a.drawLine(b,this.w-1,0,this.w-1,this.h,"rgba(0,0,0,0.5)"),a.drawLine(b,0,0,0,this.h,"rgba(0,0,0,0.09)"),a.drawLine(b,1,0,1,this.h,"rgba(0,0,0,0.03)")),b.fillStyle=this.linearGradient,b.fillRect(0,0,this.w,this.h));this.activeIfValue&&(M!==this.emptyImage&&this.over&&M.ready&&M.complete?K.match(A)?(this.canvas.style.backgroundImage=
"url('"+K+"')",this.canvas.style.backgroundPosition=l+"px "+u+"px"):b.drawImage(M,l,u):this.customStyle&&this.containerStyle.overColor&&this.over&&(D.style.backgroundColor=this.containerStyle.overColor));this.activeIfValue?L!==this.emptyImage&&this.buttonClick&&L.ready&&L.complete?H.match(A)?(this.canvas.style.backgroundImage="url('"+H+"')",this.canvas.style.backgroundPosition=l+"px "+u+"px"):b.drawImage(L,l,u):this.customStyle&&this.containerStyle.downColor&&this.buttonClick&&(D.style.backgroundColor=
this.containerStyle.downColor):this.buttonClick&&!q&&(b.fillStyle="rgba(0,0,0,0.09)",b.fillRect(0,0,this.w,this.h));b.fillStyle=this.color.getColor();this.customStyle&&this.containerStyle.shadowTextColor&&(b.lineWidth=3,b.strokeStyle=this.containerStyle.shadowTextColor,b.strokeText(d,n,v));C||this.containerStyle||!this.drawTextBorder()||(b.lineWidth=parseInt(t/6),b.strokeStyle=this.colorInt.getColor(),b.strokeText(d,n,v));b.fillText(d,n,v);this.underlined&&(s=b.measureText(d).width,b.strokeStyle=
this.color.getColor(),b.lineWidth=f(t/10)||2,b.lineCap="round",b.beginPath(),b.moveTo(parseInt((this.w-s)/2)+h,v+f(t/2)+f(t/5)-1.5),b.lineTo(parseInt((this.w+s)/2)+h,v+f(t/2)+f(t/5)-1.5),b.stroke());this.activeIfValue||(this.customStyle&&this.containerStyle.inactiveColor?D.style.backgroundColor=this.containerStyle.inactiveColor:(b.fillStyle="rgba(240,240,240,0.6)",b.fillRect(0,0,this.w,this.h)));b.restore();this._image_pos_x=l;this._image_pos_y=u};a.Button.prototype.drawTextBorder=function(){this.colorInt.getColor();
this.color.getColor();return!(.5>(g(this.colorInt.r-this.color.r)+g(this.colorInt.g-this.color.g)+g(this.colorInt.b-this.color.b))/255)};a.Button.prototype.buttonPressed=function(){this.updateAndExecAction()};a.Button.prototype.registerMouseAndTouchEvents=function(){function b(a,d,c){clearInterval(l);f.buttonClick&&f.drawIfValue&&f.activeIfValue&&(d.call(f),a=c?a:100,l=setTimeout(function(){b(a,d,!1)},a))}function d(e){this.focus();e.preventDefault();e.stopPropagation();document.activeElement!=document.body&&
document.activeElement.blur();f.whichButton=a.whichButton(e);"L"==f.whichButton&&f.activeIfValue&&(f.buttonClick=!0,f.draw(),"calculate"==f.action&&(f.evaluator.setVariable(f.id,f.evaluator.evalExpression(f.valueExpr)),b(2E3,f.buttonPressed,!0)),p?(f.canvas.removeEventListener("touchend",c),f.canvas.addEventListener("touchend",c)):(f.canvas.removeEventListener("mouseup",c),f.canvas.addEventListener("mouseup",c)))}function c(a){this.focus();a.preventDefault();a.stopPropagation();if(f.activeIfValue||
f.buttonClick)f.buttonClick=!1,f.draw(),"calculate"!=f.action&&(f.evaluator.setVariable(f.id,f.evaluator.evalExpression(f.valueExpr)),f.buttonPressed()),p?f.canvas.removeEventListener("touchend",c):f.canvas.removeEventListener("mouseup",c);f.parent.update()}function e(a){a.preventDefault();a.stopPropagation();f.over=!0;f.draw()}function h(a){a.preventDefault();a.stopPropagation();f.over=!1;f.buttonClick=!1;f.draw()}p=a.hasTouchSupport;var f=this,l;f.canvas.oncontextmenu=function(){return!1};this.over=
this.buttonClick=!1;p?this.canvas.addEventListener("touchstart",d):(this.canvas.addEventListener("mousedown",d),this.canvas.addEventListener("mouseover",e),this.canvas.addEventListener("mouseout",h));document.addEventListener("visibilitychange",function(a){f.buttonClick=!1})};a.Button.prototype.getScreenshot=function(){var a=document.createElement("canvas");a.width=this.w;a.height=this.h;b=a.getContext("2d");m=c.evalExpression(this.imageSrc);(q="vacio.gif"===m?this.emptyImage:this.parent.getImage(m))&&
q.ready?b.drawImage(q,this._image_pos_x,this._image_pos_y):(b.fillStyle=this.colorInt.getColor(),b.fillRect(0,0,this.w,this.h));b.drawImage(this.canvas,0,0);return a};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var f,g,c,e,b,k,t,d,m,q,h,r,s,p,l,u,n,v;a.Spinner=function(b,d){a.Control.call(this,b,d);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.containerControl=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.containerControl.appendChild(this.label);this.containerControl.appendChild(this.field);this.containerControl.appendChild(this.canvas);this.containerControl.appendChild(this.divUp);
this.containerControl.appendChild(this.divDown);this.addControlContainer(this.containerControl);v=this.evaluator.parser.parse("1");this.originalIncr=this.incr;if(0>=this.evaluator.evalExpression(this.decimals)||0==this.evaluator.evalExpression(this.incr)){var c=this.evaluator.evalExpression(this.incr);0<c?this.originalIncr=this.incr=this.evaluator.parser.parse(parseInt(c).toString()):this.incr=v}this.registerMouseAndTouchEvents();this.init()};a.extend(a.Spinner,a.Control);a.Spinner.prototype.init=
function(){f=this.evaluator;var b=f.evalExpression(this.name).toString();this.label.innerHTML=b;this.value=this.validateValue(f.evalExpression(this.valueExpr));var d=this.formatOutputValue(this.value);this.fieldFontSize=2!==this.parent.version?a.getFieldFontSize(this.h):10;var c=2!==this.parent.version?"__":"_____",e=a.getTextWidth(d+"_",this.fieldFontSize+"px Arial"),h=2+parseInt(this.h/2),l=parseInt(this.w/2-h/2),c=a.getTextWidth(b+c,this.fieldFontSize+"px Arial");this.visible||(l=this.w-h,e=0);
l<c&&(l=c);""==b&&(l=0);this.w-l-h<e&&(l=this.w-h-e);0>l&&(l=0);b=this.w-(l+h);this.containerControl.setAttribute("class","DescartesSpinnerContainer");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.setAttribute("id",this.id);this.canvas.setAttribute("width",h+"px");this.canvas.setAttribute("height",this.h+"px");this.canvas.setAttribute("style","position: absolute; left: "+
l+"px; top: 0px;");this.ctx=this.canvas.getContext("2d");this.divUp.setAttribute("class","up");this.divUp.setAttribute("style","background-color: rgba(255, 255, 255, 0); cursor: pointer; position: absolute; width : "+h+"px; height : "+this.h/2+"px; left: "+l+"px; top: 0px;");this.divDown.setAttribute("class","down");this.divDown.setAttribute("style","background-color: rgba(255, 255, 255, 0); cursor: pointer; position: absolute; width : "+h+"px; height : "+this.h/2+"px; left: "+l+"px; 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: Arial; font-size: "+this.fieldFontSize+"px; width : "+b+"px; height : "+this.h+"px; left: "+(h+l)+"px;");this.field.setAttribute("tabindex",this.tabindex);this.field.value=d;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;");f.setVariable(this.id,this.value);this.createGradient(this.h/2,this.h)};a.Spinner.prototype.update=function(){f=this.evaluator;this.label.innerHTML=f.evalExpression(this.name).toString();0>=f.evalExpression(this.decimals)?(g=f.evalExpression(this.incr),0<g?this.originalIncr=this.incr=f.parser.parse(parseInt(g).toString()):this.incr=v):this.incr=0!=f.evalExpression(this.originalIncr)?this.originalIncr:
v;this.activeIfValue=0<f.evalExpression(this.activeif);this.drawIfValue=0<f.evalExpression(this.drawif);this.field.disabled=!this.activeIfValue;this.drawIfValue?(this.containerControl.style.display="block",this.draw()):(this.click=!1,this.containerControl.style.display="none");this.updatePositionAndSize();this.parent.animation.playing&&document.activeElement==this.field||(c=this.field.value,e=this.value,this.value=this.validateValue(f.getVariable(this.id)),this.field.value=this.formatOutputValue(this.value),
this.value==e&&this.field.value!=c&&(this.value=this.validateValue(c),this.field.value=this.formatOutputValue(this.value)),f.setVariable(this.id,this.value))};a.Spinner.prototype.draw=function(){b=this.ctx;k=this.canvas.width;t=this.canvas.height;b.fillStyle="#f0f8ff";b.fillRect(0,0,k,t);b.fillStyle=this.linearGradient;b.fillRect(0,0,k,t);this.up?(d="gray",m="#f0f8ff"):(d="#f0f8ff",m="gray");a.drawLine(b,0,0,k,0,d);a.drawLine(b,0,0,0,t/2,d);a.drawLine(b,0,t/2,k,t/2,m);this.down?(d="gray",m="#f0f8ff"):
(d="#f0f8ff",m="gray");a.drawLine(b,0,t/2+1,k,t/2+1,d);a.drawLine(b,0,t/2+1,0,t,d);a.drawLine(b,0,t-1,k,t-1,m);q=[parseInt(k/2+1),parseInt(k/5+1),parseInt(k-k/5+1)];h=[parseInt(t/8+1),parseInt(t/8+1+t/4),parseInt(t/8+1+t/4)];b.fillStyle=this.activeIfValue?"#2244cc":"#8888aa";b.beginPath();b.moveTo(q[0],h[0]);b.lineTo(q[1],h[1]);b.lineTo(q[2],h[2]);b.fill();h=[parseInt(t-t/8),parseInt(t-t/8-t/4),parseInt(t-t/8-t/4)];b.fillStyle=this.activeIfValue?"#d00018":"#aa8888";b.beginPath();b.moveTo(q[0],h[0]);
b.lineTo(q[1],h[1]);b.lineTo(q[2],h[2]);b.fill();b.fillStyle="rgba(0,0,0,"+24/255+")";this.up&&b.fillRect(0,0,k,t/2);this.down&&b.fillRect(0,t/2,k,t)};a.Spinner.prototype.validateValue=function(a){f=this.evaluator;isNaN(parseFloat(a))||a.toString().match("e")&&(a=parseFloat(a).toFixed(20));a=void 0!=a?a.toString():"0";a=a.replace(this.parent.decimal_symbol,".");r=a==parseFloat(a)?parseFloat(a):parseFloat(f.evalExpression(f.parser.parse(a)));isNaN(r)&&(r=0);l=f.evalExpression(this.min);u=f.evalExpression(this.max);
""===l&&(l=-Infinity);""===u&&(u=Infinity);r<l&&(r=l);r>u&&(r=u);this.discrete&&(s=f.evalExpression(this.incr),r=0==s?0:s*Math.round(r/s));p=f.evalExpression(this.decimals);0>=p&&(p=0);return r=parseFloat(parseFloat(r).toFixed(p))};a.Spinner.prototype.increase=function(){this.changeValue(parseFloat(this.value)+this.evaluator.evalExpression(this.incr))};a.Spinner.prototype.decrease=function(){this.changeValue(parseFloat(this.value)-this.evaluator.evalExpression(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.registerMouseAndTouchEvents=function(){function b(a,d,c){clearInterval(g);if(m.up||m.down)d.call(m),a=c?a:30,g=setTimeout(function(){b(a,d)},a)}function d(c){c.preventDefault();m.whichButton=a.whichButton(c);"L"==m.whichButton&&m.activeIfValue&&(m.up=!0,b(k,m.increase,!0),m.draw())}function c(d){d.preventDefault();
m.whichButton=a.whichButton(d);"L"==m.whichButton&&m.activeIfValue&&(m.down=!0,b(k,m.decrease,!0),m.draw())}function e(a){m.up=!1;clearInterval(g);m.draw();a.preventDefault()}function h(a){m.down=!1;clearInterval(g);m.draw();a.preventDefault()}function f(a){m.up=!1;clearInterval(g);m.draw()}function l(a){m.down=!1;clearInterval(g);m.draw()}n=a.hasTouchSupport;var m=this,k=n?500:200,g;m.divUp.oncontextmenu=m.divDown.oncontextmenu=m.field.oncontextmenu=m.label.oncontextmenu=function(){return!1};n?this.label.addEventListener("touchstart",
function(a){a.preventDefault();return!1}):this.label.addEventListener("mousedown",function(a){a.preventDefault();return!1});this.field.addEventListener("keydown",function(a){13==a.keyCode&&m.changeValue(m.field.value)});n?this.divUp.addEventListener("touchstart",d):this.divUp.addEventListener("mousedown",d);n?this.divDown.addEventListener("touchstart",c):this.divDown.addEventListener("mousedown",c);n||this.divUp.addEventListener("mouseout",e);n||this.divDown.addEventListener("mouseout",h);n?(this.divUp.addEventListener("touchend",
f),window.addEventListener("touchend",f)):(this.divUp.addEventListener("mouseup",f),window.addEventListener("mouseup",f));n?(this.divDown.addEventListener("touchend",l),window.addEventListener("touchend",l)):(this.divDown.addEventListener("mouseup",l),window.addEventListener("mouseup",l));document.addEventListener("visibilitychange",function(a){m.up=!1;m.down=!1;clearInterval(g);m.draw()});m.field.addEventListener("click",function(a){this.select();this.focus()})};return a}(descartesJS||{}),descartesJS=
function(a){if(a.loadLib)return a;var f,g,c,e,b,k,t;a.TextField=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.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");if(this.answer)if(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){var e=this.answerPattern.indexOf("|");this.firstAnswer=-1==e?this.answerPattern:this.answerPattern.substring(0,e)}else 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.registerMouseAndTouchEvents();this.init()};a.extend(a.TextField,a.Control);a.TextField.prototype.init=function(){f=this.evaluator;var b=f.evalExpression(this.name).toString();this.label.innerHTML=b;this.value=this.validateValue(f.evalExpression(this.valueExpr));var c=this.formatOutputValue(this.value);this.fieldFontSize=a.getFieldFontSize(this.h);var e=a.getTextWidth(c+"_",this.fieldFontSize+"px Arial"),
h=parseInt(this.w/2),k=a.getTextWidth(b,this.fieldFontSize+"px Arial");this.visible||(h=this.w,e=0);h<k&&(h=k);""==b&&(h=0);this.w-h<e&&(h=this.w-e);0>h&&(h=0);b=this.w-h;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 : "+b+"px; height : "+this.h+"px; left: "+h+"px;");this.field.setAttribute("tabindex",this.tabindex);this.field.value=c;this.label.setAttribute("class","DescartesTextFieldLabel");this.label.setAttribute("style","font-size:"+this.fieldFontSize+"px; width: "+h+"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(){f=this.evaluator;this.label.innerHTML=f.evalExpression(this.name).toString();this.activeIfValue=0<f.evalExpression(this.activeif);this.drawIfValue=0<f.evalExpression(this.drawif);this.field.disabled=!this.activeIfValue;this.containerControl.style.display=this.drawIfValue?"block":"none";this.updatePositionAndSize();this.parent.animation.playing&&document.activeElement==
this.field||(g=this.field.value,c=this.value,this.value=this.validateValue(f.getVariable(this.id)),this.field.value=this.formatOutputValue(this.value),this.value===c&&this.field.value!=g&&(this.value=this.validateValue(g),this.field.value=this.formatOutputValue(this.value)),f.setVariable(this.id,this.value))};a.TextField.prototype.validateValue=function(a){if(""===a||"''"==a)return"";f=this.evaluator;a=a.toString().replace(this.regExpDecimalSymbol,".","g");e=a==parseFloat(a)?parseFloat(a):parseFloat(f.evalExpression(f.parser.parse(a)));
isNaN(e)&&(e=0);b=f.evalExpression(this.min);""==b&&(b=-Infinity);k=f.evalExpression(this.max);""==k&&(k=Infinity);this.discrete&&(a=f.evalExpression(this.incr),e=0==a?0:a*Math.round(e/a));return e=parseFloat(parseFloat(e).toFixed(f.evalExpression(this.decimals)))};a.TextField.prototype.formatOutputValue=function(a){return""===a?"":this.uber.formatOutputValue.call(this,a)};a.TextField.prototype.changeValue=function(a,b){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.evalExpression(this.firstAnswer):""};a.TextField.prototype.registerMouseAndTouchEvents=function(){t=
a.hasTouchSupport;var b=this;b.field.oncontextmenu=b.label.oncontextmenu=function(){return!1};t?b.label.addEventListener("touchstart",function(a){a.preventDefault();return!1}):b.label.addEventListener("mousedown",function(a){a.preventDefault();return!1});this.field.addEventListener("blur",function(a){b.evaluator.evalExpression(b.drawIf)&&b.changeValue(b.field.value,!0)});this.field.addEventListener("keydown",function(a){b.activeIfValue&&13==a.keyCode&&b.changeValue(b.field.value,!0)});b.field.addEventListener("click",
function(a){this.select();this.focus()})};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var f=Math.abs,g,c,e,b,k,t,d,m,q,h,r;a.Menu=function(b,d){this.options="";a.Control.call(this,b,d);g=this.parser;c=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+"'");this.options=this.options.split(",");this.menuOptions=[];this.strValue=[];for(var e,h=0,f=this.options.length;h<f;h++)e=this.customSplit(this.options[h]),1==e.length?(this.menuOptions.push(e[0]),this.strValue.push(h.toString())):2==e.length&&(this.menuOptions.push(e[0]),""==e[1]?this.strValue.push(h.toString()):this.strValue.push(e[1]));h=0;for(f=this.menuOptions.length;h<f;h++)this.menuOptions[h].match(/^\[/)&&
this.menuOptions[h].match(/\]$/)?this.menuOptions[h]=g.parse(this.menuOptions[h].substring(1,this.menuOptions[h].length-1)):this.menuOptions[h]=g.parse("'"+this.menuOptions[h]+"'");h=0;for(f=this.strValue.length;h<f;h++)this.strValue[h].match(/^\[/)&&this.strValue[h].match(/\]$/)?this.strValue[h]=g.parse(this.strValue[h].substring(1,this.strValue[h].length-1)):this.strValue[h]=g.parse(this.strValue[h]);this.containerControl=document.createElement("div");this.label=document.createElement("label");
this.select=document.createElement("select");h=0;for(f=this.menuOptions.length;h<f;h++)e=document.createElement("option"),e.innerHTML=c.evalExpression(this.menuOptions[h]),this.select.appendChild(e);this.field=document.createElement("input");this.containerControl.appendChild(this.label);this.containerControl.appendChild(this.select);this.visible&&this.containerControl.appendChild(this.field);this.addControlContainer(this.containerControl);this.registerMouseAndTouchEvents();this.init()};a.extend(a.Menu,
a.Control);a.Menu.prototype.init=function(b){c=this.evaluator;var d=c.evalExpression(this.name).toString();this.label.innerHTML=d;this.fieldFontSize=2!=this.parent.version?a.getFieldFontSize(this.h):10;var e=0,h=0,f=0;this.value=b?this.value:c.evalExpression(this.valueExpr);this.indexValue=this.getIndex(this.value);b=0;for(var m=this.menuOptions.length;b<m;b++)f=a.getTextWidth(c.evalExpression(this.menuOptions[b]).toString(),this.fieldFontSize+"px Arial"),f>e&&(e=f,h=b);e+=25;f=a.getTextWidth(this.formatOutputValue(c.evalExpression(this.strValue[h])),
this.fieldFontSize+"px Arial")+7;h=a.getTextWidth(d,this.fieldFontSize+"px Arial")+10;""==d&&(h=0);this.visible||(f=0);for(d=this.w-f-h;d<e&&0<h;)h--,d++;for(;d<e&&0<f;)f--,d++;for(;h+d+f+1<this.w;)d++,f++;e=h;b=e+d;f=this.w-b;m=this.formatOutputValue(c.evalExpression(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:"+h+"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=m;this.field.setAttribute("class","DescartesMenuField");this.field.setAttribute("style","font-size: "+this.fieldFontSize+"px; width: "+f+"px; height: "+this.h+"px; left:"+b+"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: "+d+"px; height: "+this.h+"px; left: "+e+"px; border: 1.5px solid #7a8a99; background-color: #eeeeee;");this.select.setAttribute("tabindex",this.tabindex);this.select.selectedIndex=this.indexValue;c.setVariable(this.id,parseFloat(m.replace(this.parent.decimal_symbol,".")));this.update()};
a.Menu.prototype.update=function(){c=this.evaluator;this.activeIfValue=0<c.evalExpression(this.activeif);this.drawIfValue=0<c.evalExpression(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=c.evalExpression(this.name).toString();for(var a=
0,b=this.menuOptions.length;a<b;a++)this.select.options[a].innerHTML=c.evalExpression(this.menuOptions[a]);this.value=c.getVariable(this.id);isNaN(this.value)&&(this.value=0);this.field.value=this.formatOutputValue(this.value);c.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;m=
"";q=0;for(h=-1;q<a.length;){r=a.charAt(q);a.charAt(q-1);if("["===r&&-1===h){if(d||""!=m)m+="\u00a6";h++}else"["===r?h++:"]"===r&&0===h?(d=!0,h--):"]"==a.charAt(q)&&(h=0>h?h:h-1);m+=a.charAt(q);q++}return m.split("\u00a6")};a.Menu.prototype.getIndex=function(a){a=parseFloat(a.toString().replace(this.parent.decimal_symbol,"."));e=-1;b=Infinity;for(var d=0,c=this.strValue.length;d<c;d++)k=f(a-parseFloat(this.evaluator.evalExpression(this.strValue[d]))),k<=b&&(b=k,e=d);return e};a.Menu.prototype.changeValue=
function(){this.activeIfValue&&(this.evaluator.setVariable(this.id,this.value),this.updateAndExecAction())};a.Menu.prototype.registerMouseAndTouchEvents=function(){t=a.hasTouchSupport;var b=this;b.select.oncontextmenu=b.label.oncontextmenu=b.field.oncontextmenu=function(){return!1};t?b.label.addEventListener("touchstart",function(a){a.preventDefault();return!1}):b.label.addEventListener("mousedown",function(a){a.preventDefault();return!1});this.select.addEventListener("change",function(a){b.value=
b.evaluator.evalExpression(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.evalExpression(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 f=Math.floor,g,c,e,b,k,t,d,m,q,h,r,s,p,l,u,n,v,w,z,C,A;a.Scrollbar=function(b,d){a.Control.call(this,b,d);"["===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.containerControl=document.createElement("div");this.canvas=document.createElement("canvas");
this.divUp=document.createElement("div");this.divDown=document.createElement("div");this.field=document.createElement("input");this.scrollManipulator=document.createElement("div");this.label=document.createElement("label");this.containerControl.appendChild(this.canvas);this.containerControl.appendChild(this.label);this.containerControl.appendChild(this.divUp);this.containerControl.appendChild(this.divDown);this.containerControl.appendChild(this.field);this.containerControl.appendChild(this.scrollManipulator);
this.addControlContainer(this.containerControl);this.registerMouseAndTouchEvents();this.init()};a.extend(a.Scrollbar,a.Control);a.Scrollbar.prototype.init=function(){g=this.evaluator;this.findOffset();0==g.evalExpression(this.decimals)?this.incr=1:this.incr=(g.evalExpression(this.max)-g.evalExpression(this.min))/100;this.value=this.validateValue(g.evalExpression(this.valueExpr));e=this.formatOutputValue(this.value);b=this.evaluator.evalExpression(this.expresion);this.x=b[0][0];this.y=b[0][1];4==b[0].length&&
(this.w=b[0][2],this.h=b[0][3]);this.orientation=this.w>=this.h?"h":"v";this.initScroll(e);this.changeScrollPositionFromValue();this.prePos=this.pos;g.setVariable(this.id,this.value)};a.Scrollbar.prototype.initScroll=function(b){c=this;g=c.evaluator;var d=g.evalExpression(c.name).toString();c.label.innerHTML=d;var e="v"===c.orientation?parseInt(19+5*(c.h-100)/100):c.h;c.fieldFontSize="v"===c.orientation?e-parseInt(c.h/20)-1:2!==c.parent.version?a.getFieldFontSize(e):10;var h=a.getTextWidth(b+"_",
c.fieldFontSize+"px Arial"),f=c.parent.getSpaceById(c.spaceID).h;c.labelHeight=""==d?0:e;c.fieldHeight=""==c.visible?0:e;if("v"===c.orientation)c.canvasWidth=c.w,c.canvasHeight=c.h-c.labelHeight-c.fieldHeight,18<=c.canvasHeight+c.y-f&&(c.canvasHeight=f),d=0,d=c.fieldHeight,h=d+c.canvasHeight,c.canvasX=0,c.canvasY=c.fieldHeight,c.labelWidth=c.w,c.labelY=h,c.upWidth=c.downW=c.w,c.upHeight=c.downH=15,c.upX=0,c.upY=c.fieldHeight,c.downX=0,c.downY=h-c.downH,c.fieldWidth=c.w,c.fieldX=0,c.scrollManipulatorW=
c.w,c.scrollManipulatorH=parseInt((c.canvasHeight-c.upHeight-c.downH-c.labelHeight-c.fieldHeight)/10),c.scrollManipulatorH=15>c.scrollManipulatorH?15:c.scrollManipulatorH,c.scrollManipulatorLimInf=h-c.downH-c.scrollManipulatorH,c.scrollManipulatorLimSup=d+c.downH;else{e=a.getTextWidth(d,c.fieldFontSize+"px Arial")+10;c.labelWidth=e;c.fieldWidth=h;""==d&&(c.labelWidth=0);c.visible||(c.fieldWidth=0);for(h=c.w-c.fieldWidth-c.labelWidth;58>h&&0<c.labelWidth;)c.labelWidth--,h++;for(;58>h&&0<c.fieldWidth;)c.fieldWidth--,
h++;d=c.labelWidth;e=d+h;c.fieldWidth=c.w-e;c.canvasWidth=h;c.canvasHeight=c.h;c.canvasX=c.labelWidth;c.canvasY=0;c.fieldX=c.canvasWidth+c.labelWidth;c.labelHeight=c.h;c.labelY=0;c.upWidth=c.downW=15;c.upHeight=c.downH=c.h;c.upX=e-c.downW;c.upY=0;c.downX=c.labelWidth;c.downY=0;c.scrollManipulatorW=parseInt((c.canvasWidth-c.upWidth-c.downW)/10);c.scrollManipulatorW=15>c.scrollManipulatorW?15:c.scrollManipulatorW;c.scrollManipulatorH=c.h;c.scrollManipulatorLimInf=d+c.downW;c.scrollManipulatorLimSup=
d+c.canvasWidth-c.downW-c.scrollManipulatorW}c.containerControl.setAttribute("class","DescartesScrollbarContainer");c.containerControl.setAttribute("id",c.id);c.containerControl.setAttribute("style","width: "+c.w+"px; height: "+c.h+"px; left: "+c.x+"px; top: "+c.y+"px; z-index: "+c.zIndex+";");c.canvas.setAttribute("width",c.w+"px");c.canvas.setAttribute("height",c.h+"px");c.canvas.setAttribute("style","position: absolute; left: 0px; top: 0px;");c.ctx=c.canvas.getContext("2d");c.divUp.setAttribute("class",
"DescartesCatcher up");c.divUp.setAttribute("style","width : "+c.upWidth+"px; height : "+c.upHeight+"px; left: "+c.upX+"px; top: "+c.upY+"px;");c.divDown.setAttribute("class","DescartesCatcher down");c.divDown.setAttribute("style","width : "+c.downW+"px; height : "+c.downH+"px; left: "+c.downX+"px; top: "+c.downY+"px;");c.scrollManipulator.setAttribute("class","DescartesCatcher manipulator");c.scrollManipulator.setAttribute("style","width : "+c.scrollManipulatorW+"px; height : "+c.scrollManipulatorH+
"px;");c.scrollManipulator.style.top=("v"===c.orientation?c.scrollManipulatorLimInf:0)+"px";c.scrollManipulator.style.left=("v"===c.orientation?0:c.scrollManipulatorLimInf)+"px";c.field.setAttribute("type","text");c.field.setAttribute("id",c.id+"scrollbar");c.field.setAttribute("class","DescartesScrollbarField");c.field.setAttribute("style","font-size: "+c.fieldFontSize+"px; width : "+c.fieldWidth+"px; height : "+c.fieldHeight+"px; left: "+c.fieldX+"px; top: 0px;");c.field.value=b;0===c.fieldHeight&&
(c.field.style.display="none");c.label.setAttribute("class","DescartesScrollbarLabel");c.label.setAttribute("style","font-size:"+c.fieldFontSize+"px; width: "+c.labelWidth+"px; height: "+c.labelHeight+"px; line-height: "+c.labelHeight+"px; left: 0px; top:"+c.labelY+"px;")};a.Scrollbar.prototype.update=function(){g=this.evaluator;this.label.innerHTML=g.evalExpression(this.name).toString();0==g.evalExpression(this.decimals)?this.incr=1:this.incr=(g.evalExpression(this.max)-g.evalExpression(this.min))/
100;this.activeIfValue=0<g.evalExpression(this.activeif);this.drawIfValue=0<g.evalExpression(this.drawif);this.field.disabled=!this.activeIfValue;this.drawIfValue?(this.containerControl.style.display="block",this.draw()):this.containerControl.style.display="none";this.updatePositionAndSize();var a=this.validateValue(g.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);g.setVariable(this.id,this.value)};a.Scrollbar.prototype.draw=function(){c=this;k=c.ctx;d=f(this.w);t=f(this.h);k.fillStyle="#e0e4e8";k.fillRect(0,0,d,t);k.strokeStyle="#7a8a99";c.down&&(k.fillStyle="#ccdcec",k.fillRect(c.downX+.5,c.downY+.5,c.downW,c.downH-1));k.strokeRect(c.downX+.5,c.downY+.5,c.downW,c.downH-1);c.up&&(k.fillStyle="#ccdcec",k.fillRect(c.upX+.5,c.upY-.5,c.upWidth,c.upHeight+1));k.strokeRect(c.upX+.5,c.upY-.5,c.upWidth,c.upHeight+1);m=4;k.fillStyle=
"black";k.beginPath();"h"===c.orientation?(k.moveTo(c.downX+m,c.downH/2),k.lineTo(c.downX+c.downW-m,m),k.lineTo(c.downX+c.downW-m,c.downH-m),k.moveTo(c.upX+c.upWidth-m,c.downH/2),k.lineTo(c.upX+m,m),k.lineTo(c.upX+m,c.downH-m),k.fill(),c.activeIfValue&&(q=f(c.pos),k.fillStyle="#ccdcec",k.fillRect(q+.5,0,f(c.scrollManipulatorW),t),k.strokeStyle="#6382bf",k.strokeRect(q+.5,0,f(c.scrollManipulatorW),t),h=f(c.scrollManipulatorW/2),k.beginPath(),k.moveTo(q+h+.5-2,3),k.lineTo(q+h+.5-2,t-3),k.moveTo(q+h+
.5,3),k.lineTo(q+h+.5,t-3),k.moveTo(q+h+.5+2,3),k.lineTo(q+h+.5+2,t-3),k.stroke())):(k.moveTo(c.downX+c.downW/2,c.downY+c.downH-m),k.lineTo(c.downX+m,c.downY+m),k.lineTo(c.downX+c.downW-m,c.downY+m),k.moveTo(c.upX+c.upWidth/2,c.upY+m),k.lineTo(c.upX+m,c.upY+c.upHeight-m),k.lineTo(c.upX+c.upWidth-m,c.upY+c.upHeight-m),k.fill(),c.activeIfValue&&(q=f(c.pos),k.fillStyle="#ccdcec",k.fillRect(0,q+.5,d,f(c.scrollManipulatorH)),k.strokeStyle="#6382bf",k.strokeRect(0,q+.5,d,f(c.scrollManipulatorH)),h=f(c.scrollManipulatorH/
2),k.beginPath(),k.moveTo(3,q+h+.5-2),k.lineTo(d-3,q+h+.5-2),k.moveTo(3,q+h+.5),k.lineTo(d-3,q+h+.5),k.moveTo(3,q+h+.5+2),k.lineTo(d-3,q+h+.5+2),k.stroke()));k.strokeRect(.5,.5,d-1,t-1);c.activeIfValue||(k.fillStyle="rgba(240,240,240,"+160/255+")",k.fillRect(0,0,d,t.h))};a.Scrollbar.prototype.validateValue=function(a){g=this.evaluator;r=a.toString();r=parseFloat(r.replace(this.parent.decimal_symbol,"."));isNaN(r)&&(r=0);this.minimo=g.evalExpression(this.min);r<this.minimo&&(this.value=null,r=this.minimo);
this.maximo=g.evalExpression(this.max);r>this.maximo&&(this.value=null,r=this.maximo);s=this.incr;r=0!=s?r*s/s:0;this.fixed&&(r=parseFloat(parseFloat(r).toFixed(g.evalExpression(this.decimals))));return r};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(){m=(this.evaluator.evalExpression(this.max)-this.evaluator.evalExpression(this.min))/
10;"h"==this.orientation?this.clickPos.x>this.prePos&&this.changeValue(parseFloat(this.value)+m):this.clickPos.y<this.prePos&&this.changeValue(parseFloat(this.value)+m)};a.Scrollbar.prototype.decrease10=function(){m=(this.evaluator.evalExpression(this.max)-this.evaluator.evalExpression(this.min))/10;"h"==this.orientation?this.clickPos.x<this.prePos&&this.changeValue(parseFloat(this.value)-m):this.clickPos.y>this.prePos&&this.changeValue(parseFloat(this.value)-m)};a.Scrollbar.prototype.changeValue=
function(a){this.activeIfValue&&(p=this.validateValue(a),p!=this.value&&(this.value=p,this.field.value=this.formatOutputValue(p),this.changeScrollPositionFromValue(),this.prePos=this.pos,this.evaluator.setVariable(this.id,this.value),this.updateAndExecAction()))};a.Scrollbar.prototype.changeValueForScrollMovement=function(){g=this.evaluator;l=this.scrollManipulatorLimInf;u=this.scrollManipulatorLimSup;n=g.evalExpression(this.min);v=g.evalExpression(this.max);s=this.incr;p=f((this.pos-l)*(v-n)/(u-
l)/s)*s+n;p!=this.value&&(this.value=p,this.field.value=this.formatOutputValue(p),g.setVariable(this.id,this.value),this.parent.updateControls(),this.actionExec.execute(),this.parent.update())};a.Scrollbar.prototype.changeScrollPositionFromValue=function(){g=this.evaluator;l=this.scrollManipulatorLimInf;u=this.scrollManipulatorLimSup;n=g.evalExpression(this.min);v=g.evalExpression(this.max);s=this.incr;this.pos=(this.value-n)*(u-l)/(v-n)+l;"h"==this.orientation?this.scrollManipulator.style.left=this.pos+
"px":this.scrollManipulator.style.top=this.pos+"px"};a.Scrollbar.prototype.registerMouseAndTouchEvents=function(){function b(a,d,c,e){clearInterval(u);(p.up||p.down||p.canvasClick)&&1E-7<Math.abs(p.value-e)&&(d.call(p),a=c?a:30,u=setTimeout(function(){b(a,d,!1,e)},a))}function d(c){c.preventDefault();p.whichButton=a.whichButton(c);"L"==p.whichButton&&p.activeIfValue&&(p.clickPos=p.getCursorPosition(c),p.canvasClick=!0,"h"==p.orientation?p.clickPos.x<p.prePos?b(v,p.decrease10,!0,p.minimo):b(v,p.increase10,
!0,p.maximo):p.clickPos.y<p.prePos?b(v,p.increase10,!0,p.maximo):b(v,p.decrease10,!0,p.minimo))}function c(a){p.canvasClick=!1;clearInterval(u)}function e(a){!0==p.canvasClick&&(p.clickPos=p.getCursorPosition(a),a.preventDefault())}function h(a){p.activeIfValue&&(p.scrollClick=!0,p.initPos=p.getCursorPosition(a),window.addEventListener("mouseup",l),window.addEventListener("mousemove",k),a.preventDefault())}function f(a){p.activeIfValue&&(p.scrollClick=!0,p.initPos=p.getCursorPosition(a),window.addEventListener("touchend",
m),window.addEventListener("touchmove",k),a.preventDefault())}function l(a){p.scrollClick=!1;p.prePos=p.pos;window.removeEventListener("mouseup",l,!1);window.removeEventListener("mousemove",k,!1);a.preventDefault()}function m(a){p.scrollClick=!1;p.prePos=p.pos;window.removeEventListener("touchend",m,!1);window.removeEventListener("touchmove",k,!1);a.preventDefault()}function k(a){var b=p.getCursorPosition(a);"h"==p.orientation?(p.pos=p.prePos-(p.initPos.x-b.x),p.pos<p.scrollManipulatorLimInf&&(p.pos=
p.scrollManipulatorLimInf),p.pos>p.scrollManipulatorLimSup&&(p.pos=p.scrollManipulatorLimSup),p.scrollManipulator.setAttribute("style","background-color: rgba(255, 255, 255, 0); cursor: pointer; position: absolute; width : "+p.scrollManipulatorW+"px; height : "+p.h+"px; left: "+p.pos+"px; top: 0px;")):(p.pos=p.prePos-(p.initPos.y-b.y),p.pos>p.scrollManipulatorLimInf&&(p.pos=p.scrollManipulatorLimInf),p.pos<p.scrollManipulatorLimSup&&(p.pos=p.scrollManipulatorLimSup),p.scrollManipulator.setAttribute("style",
"background-color: rgba(255, 255, 255, 0); cursor: pointer; position: absolute; width : "+p.w+"px; height : "+p.scrollManipulatorH+"px; left: 0px; top: "+p.pos+"px;"));p.changeValueForScrollMovement();a.preventDefault()}function g(d){d.preventDefault();p.whichButton=a.whichButton(d);"L"==p.whichButton&&p.activeIfValue&&(p.up=!0,b(v,p.increase,!0,p.maximo))}function q(d){d.preventDefault();p.whichButton=a.whichButton(d);"L"==p.whichButton&&p.activeIfValue&&(p.down=!0,b(v,p.decrease,!0,p.minimo))}function n(a){p.up=
!1;clearInterval(u);a.preventDefault()}function r(a){p.down=!1;clearInterval(u);a.preventDefault()}function t(a){p.up=!1;clearInterval(u);p.draw()}function s(a){p.down=!1;clearInterval(u);p.draw()}w=a.hasTouchSupport;var p=this,v=w?500:200,u;p.canvas.oncontextmenu=p.divUp.oncontextmenu=p.divDown.oncontextmenu=p.label.oncontextmenu=p.field.oncontextmenu=p.scrollManipulator.oncontextmenu=function(){return!1};this.field.addEventListener("keydown",function(a){13==a.keyCode&&p.changeValue(p.field.value)});
w?this.canvas.addEventListener("touchstart",d):this.canvas.addEventListener("mousedown",d);w||this.divDown.addEventListener("mouseout",r);w?window.addEventListener("touchend",c):window.addEventListener("mouseup",c);w?this.canvas.addEventListener("touchmove",e):this.canvas.addEventListener("mousemove",e);w?this.scrollManipulator.addEventListener("touchstart",f):this.scrollManipulator.addEventListener("mousedown",h);w?this.divUp.addEventListener("touchstart",g):this.divUp.addEventListener("mousedown",
g);w?this.divDown.addEventListener("touchstart",q):this.divDown.addEventListener("mousedown",q);w||this.divUp.addEventListener("mouseout",n);w||this.divDown.addEventListener("mouseout",r);w?window.addEventListener("touchend",t):window.addEventListener("mouseup",t);w?window.addEventListener("touchend",s):window.addEventListener("mouseup",s)};a.Scrollbar.prototype.findOffset=function(){z=this.containerControl;this.offsetTop=this.offsetLeft=0;C=this.containerControl.style.display;for(this.containerControl.style.display=
"block";z;)this.offsetLeft+=z.offsetLeft||0,this.offsetTop+=z.offsetTop||0,z=z.parentNode;this.containerControl.style.display=C};a.Scrollbar.prototype.getCursorPosition=function(b){A=a.getCursorPosition(b);return{x:A.x-this.offsetLeft,y:A.y-this.offsetTop}};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var f;a.Audio=function(c,e){this.controls=!0;this.file="";this.oldDrawIf=0;a.Control.call(this,c,e);var b=this,f=b.evaluator.evalExpression(b.expresion);4==f[0].length?(b.w=
f[0][2],b.h=f[0][3]):(b.w=200,b.h=28);b.audio=b.parent.getAudio(b.file);b.autoplay&&(b.audio.setAttribute("autoplay","autoplay"),b.audio.play());b.loop&&b.audio.setAttribute("loop","loop");b.controls&&b.audio.setAttribute("controls","controls");b.audio.setAttribute("style","position: absolute; width: "+b.w+"px; left: "+b.x+"px; top: "+b.y+"px; z-index: "+b.zIndex+";");b.addControlContainer(b.audio);b.evaluator.setFunction(b.id+".play",function(){b.audio.play();return 0});b.evaluator.setFunction(b.id+
".pause",function(){b.audio.pause();return 0});b.evaluator.setFunction(b.id+".stop",function(){b.audio.pause();return b.audio.currentTime=0});b.evaluator.setFunction(b.id+".currentTime",function(a){b.audio.currentTime=parseFloat(a);return 0});b.audio.addEventListener("timeupdate",function(a){b.evaluator.setVariable(b.id+".currentTime",b.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 g;a.Audio.prototype.update=function(){f=this.evaluator;(g=0<f.evalExpression(this.drawif))?this.audio.style.display="block":(this.audio.style.display="none",g!==this.oldDrawIf&&this.audio.pause());this.oldDrawIf=g;this.updatePositionAndSize()};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var f;a.Video=function(c,e){this.controls=!0;this.file="";this.oldDrawIf=0;a.Control.call(this,c,e);var b=this;f=b.evaluator;var k=b.evaluator.evalExpression(b.expresion);4==k[0].length?
(b.w=k[0][2],b.h=k[0][3]):(b.w=null,b.h=null);b.video=document.createElement("video");b.autoplay&&b.video.setAttribute("autoplay","autoplay");b.loop&&b.video.setAttribute("loop","loop");b.controls&&b.video.setAttribute("controls","controls");b.poster&&b.video.setAttribute("poster",b.poster);b.w&&(b.video.setAttribute("width",b.w),b.video.setAttribute("height",b.h));b.video.setAttribute("style","position: absolute; overflow: hidden; left: "+b.x+"px; top: "+b.y+"px;");var k=b.file,g=k.lastIndexOf(".");
-1!=g&&(k=b.file.substring(0,g));b.video.canPlayType("video/mp4")&&(g=document.createElement("source"),g.setAttribute("src",k+".mp4"),g.setAttribute("type","video/mp4"),b.video.appendChild(g));b.video.canPlayType("video/ogg")&&(g=document.createElement("source"),g.setAttribute("src",k+".ogg"),g.setAttribute("type","video/ogg"),b.video.appendChild(g),g=document.createElement("source"),g.setAttribute("src",k+".ogv"),g.setAttribute("type","video/ogg"),b.video.appendChild(g));b.video.canPlayType("video/webm")&&
(g=document.createElement("source"),g.setAttribute("src",k+".webm"),g.setAttribute("type","video/webm"),b.video.appendChild(g));b.addControlContainer(b.video);b.evaluator.setFunction(b.id+".play",function(){b.video.play();return 0});b.evaluator.setFunction(b.id+".pause",function(){b.video.pause();return 0});b.evaluator.setFunction(b.id+".stop",function(){b.video.pause();return b.video.currentTime=0});b.evaluator.setFunction(b.id+".currentTime",function(a){b.video.currentTime=parseFloat(a);return 0});
b.video.addEventListener("timeupdate",function(a){b.evaluator.setVariable(b.id+".currentTime",b.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 g;a.Video.prototype.update=function(){f=this.evaluator;g=0<f.evalExpression(this.drawif);0<f.evalExpression(this.drawif)?this.video.style.display="block":(this.video.style.display="none",g!==this.oldDrawIf&&this.video.pause());this.oldDrawIf=
g;this.updatePositionAndSize()};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var f,g;a.TextArea=function(c,e){this.font="Monospaced,PLAIN,12";a.Control.call(this,c,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 b=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();b&&"simpleText"!=b.type&&(this.answer=this.text.hasFormula?"":b.toHTML());this.evaluator.setVariable(this.id,this.text);this.drawButton();this.registerMouseAndTouchEvents();this.init()};a.extend(a.TextArea,a.Control);a.TextArea.prototype.init=function(){g=this.answer?28:8;f=this.evaluator;var c;c=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<f.evalExpression(this.drawif)?"block":"none";this.containerControl.setAttribute("spellcheck","false");this.textArea.setAttribute("class","DescartesTextAreaContainer");this.textArea.setAttribute("style","width: "+(this.w-8)+"px; height: "+(this.h-g)+"px; left: 4px; top: 4px; background-color: white; text-align: left; font: "+a.convertFont(this.font)+";");
this.textArea.setAttribute("contenteditable","true");this.textArea.innerHTML="<span style='position: relative; top: 10px; left: 10px; white-space: nowrap;' >"+c+"</span>";this.textAreaAnswer.setAttribute("class","DescartesTextAreaContainer");this.textAreaAnswer.setAttribute("style","width: "+(this.w-8)+"px; height: "+(this.h-g)+"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 c=document.createElement("canvas");c.setAttribute("width",20);c.setAttribute("height",16);var e=c.getContext("2d");this.canvas=c;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=c.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=c.toDataURL()};a.TextArea.prototype.update=function(){f=this.evaluator;this.activeIfValue=0<f.evalExpression(this.activeif);
this.drawIfValue=0<f.evalExpression(this.drawif);var a;a=this.text.match(/<span/)?this.rawText:this.text;f.setVariable(this.id,a);this.activeCover.style.display=this.activeIfValue?"none":"block";this.containerControl.style.display=this.drawIfValue?"block":"none";this.updatePositionAndSize()};a.TextArea.prototype.registerMouseAndTouchEvents=function(){function a(b){b.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)};a.TextArea.prototype.getScreenshot=function(){var a=document.createElement("canvas");a.setAttribute("width",this.w);a.setAttribute("height",this.h);var e=a.getContext("2d");
e.fillStyle="white";e.strokeStyle="black";e.lineWidth=1;e.fillRect(0,0,this.w,this.h);e.strokeRect(0,0,this.w,this.h);return a};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var f=2*Math.PI,g,c,e,b,k,t,d,m,q;a.GraphicControl=function(b,d){c=b.evaluator.parser;this.text=this.spaceID="";this.size=c.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,d);this.touchId=null;this.font=
a.convertFont(this.font);if(this.constraintExpr){this.constraint=c.parse(this.constraintExpr);"(expr)"==this.constraint.type&&(this.constraint=c.parse(this.constraintExpr.substring(1,this.constraintExpr.length-1)));if("compOperator"==this.constraint.type){var e=this.constraint.childs[0],f=this.constraint.childs[1];"identifier"!=e.type||"y"!=e.value||f.contains("y")?"identifier"!=e.type||"x"!=e.value||f.contains("x")?this.newt=new a.R2Newton(this.evaluator,this.constraint):(this.evalConstraint=this.evalConstraintY,
this.constraint=f):(this.evalConstraint=this.evalConstraintX,this.constraint=f)}else this.constraint=null;m=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.registerMouseAndTouchEvents();
this.xString=this.id+".x";this.yString=this.id+".y";this.activoString=this.id+".activo";this.activeString=this.id+".active";""!==this.space.id&&2!==b.version?(this.mxString=this.space.id+".mouse_x",this.myString=this.space.id+".mouse_y",this.mclickedString=this.space.id+".mouse_clicked",this.mclicizquierdoString=this.space.id+".clic_izquierdo"):(this.mxString="mouse_x",this.myString="mouse_y",this.mclickedString="mouse_clicked",this.mclicizquierdoString="clic_izquierdo");this.init()};a.GraphicControl.prototype.init=
function(){g=this.evaluator;q=a.hasTouchSupport;var b=g.evalExpression(this.expresion);this.x=b[0][0];this.y=b[0][1];g.setVariable(this.xString,this.x);g.setVariable(this.yString,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*g.evalExpression(this.size),this.height=2*g.evalExpression(this.size),this._w=q&&48>this.width?48:this.width,
this._h=q&&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";g.setVariable(this.activoString,0);g.setVariable(this.activeString,0);this.setImage=!1;this.update()};a.GraphicControl.prototype.update=function(){g=this.evaluator;this.activeIfValue=0<g.evalExpression(this.activeif);this.drawIfValue=0<g.evalExpression(this.drawif);this.x=g.getVariable(this.xString);this.y=g.getVariable(this.yString);e=this.space.getAbsoluteX(this.x);b=this.space.getAbsoluteY(this.y);this.mouseCacher.style.display=this.activeIfValue?"block":"none";this.mouseCacher.style.left=
parseInt(e-this._w/2)+"px";this.mouseCacher.style.top=parseInt(b-this._h/2)+"px";this.constraint&&this.evalConstraint();this.draw()};a.GraphicControl.prototype.draw=function(){g=this.evaluator;this.drawIfValue&&(t=this.ctx,d=this.space.backgroundCtx,e=parseInt(this.space.getAbsoluteX(this.x))+.5,b=parseInt(this.space.getAbsoluteY(this.y))+.5,""!=this.text&&this.drawText(e,b),this.image.ready?(this.image.complete&&!this.setImage&&t.drawImage(this.image,parseInt(e-this.image.width/2),parseInt(b-this.image.height/
2)),this.trace&&(d.save(),d.translate(e,b),d.scale(parseInt(this.image.width/2),parseInt(this.image.height/2)),d.beginPath(),d.arc(0,0,1,0,f,!1),d.restore(),d.lineWidth=1,d.strokeStyle=this.trace.getColor(),d.stroke())):(t.beginPath(),t.arc(e,b,parseInt(this.width/2),0,f,!1),t.fillStyle=this.colorInt.getColor(),t.fill(),t.lineWidth=1,t.strokeStyle=this.color.getColor(),t.stroke(),this.active&&(t.beginPath(),t.arc(e,b,parseInt(this.width/2)-2,0,f,!1),t.strokeStyle=this.colorInt.borderColor(),t.stroke()),
this.trace&&(d.lineWidth=1,d.strokeStyle=this.trace.getColor(),d.beginPath(),d.arc(e,b,parseInt(this.width/2),0,f,!1),d.stroke())))};a.GraphicControl.prototype.evalConstraint=function(){m.set(this.x,this.y);k=this.newt.findZero(m,1/this.space.scale,!0);this.x=k.x;this.y=k.y;this.evaluator.setVariable(this.xString,this.x);this.evaluator.setVariable(this.yString,this.y)};a.GraphicControl.prototype.evalConstraintX=function(){var a=this.evaluator.getVariable("x");this.evaluator.setVariable("x",this.x);
this.y=this.evaluator.evalExpression(this.constraint);this.evaluator.setVariable(this.xString,this.x);this.evaluator.setVariable(this.yString,this.y);this.evaluator.setVariable("x",a)};a.GraphicControl.prototype.evalConstraintY=function(){var a=this.evaluator.getVariable("y");this.evaluator.setVariable("y",this.y);this.x=this.evaluator.evalExpression(this.constraint);this.evaluator.setVariable(this.xString,this.x);this.evaluator.setVariable(this.yString,this.y);this.evaluator.setVariable("y",a)};
a.GraphicControl.prototype.drawText=function(a,b){t=this.ctx;g=this.evaluator;"simpleText"==this.text.type?(t.fillStyle=this.color.getColor(),t.font=this.font,t.textBaseline="alphabetic",t.fillText(this.text.toString(g.evalExpression(this.decimals),this.fixed),parseInt(a+1+this.width/2),parseInt(b-1-this.height/2))):(t.fillStyle=this.color.getColor(),t.strokeStyle=this.color.getColor(),t.textBaseline="alphabetic",this.text.draw(t,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,d=0,c=a.length;d<c;d++)if(b=a[d],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.activoString,0);this.evaluator.setVariable(this.activeString,
0);this.evaluator.setVariable(this.mclicizquierdoString,0)};a.GraphicControl.prototype.registerMouseAndTouchEvents=function(){function b(d){document.body.focus();d.preventDefault();g.whichButton=a.whichButton(d);"L"==g.whichButton&&g.activeIfValue&&g.over&&(g.parent.deactivateGraphiControls(),g.click=!0,g.active=!0,g.evaluator.setVariable(g.activoString,1),g.evaluator.setVariable(g.activeString,1),g.evaluator.setVariable(g.mclickedString,0),g.evaluator.setVariable(g.mclicizquierdoString,0),g.posAnte=
g.getCursorPosition(d),g.prePos={x:g.space.getAbsoluteX(g.x),y:g.space.getAbsoluteY(g.y)},g.evaluator.setVariable(g.mxString,g.space.getRelativeX(g.posAnte.x)),g.evaluator.setVariable(g.myString,g.space.getRelativeY(g.posAnte.y)),g.parent.update(),window.addEventListener("mouseup",c),window.addEventListener("mousemove",e))}function d(a){document.body.focus();a.preventDefault();g.activeIfValue&&(g.parent.deactivateGraphiControls(),g.click=!0,g.active=!0,g.evaluator.setVariable(g.activoString,1),g.evaluator.setVariable(g.activeString,
1),g.evaluator.setVariable(g.mclickedString,0),g.evaluator.setVariable(g.mclicizquierdoString,0),g.posAnte=g.getCursorPosition(a),g.prePos={x:g.space.getAbsoluteX(g.x),y:g.space.getAbsoluteY(g.y)},g.evaluator.setVariable(g.mxString,g.space.getRelativeX(g.posAnte.x)),g.evaluator.setVariable(g.myString,g.space.getRelativeY(g.posAnte.y)),g.parent.update(),window.addEventListener("touchmove",e),window.addEventListener("touchend",c))}function c(b){document.body.focus();b.preventDefault();b.stopPropagation();
g.touchId=null;g.evaluator.setVariable(g.mclickedString,1);g.evaluator.setVariable(g.mclicizquierdoString,1);if(g.activeIfValue||g.active)g.click=!1,a.hasTouchSupport?(window.removeEventListener("touchmove",e,!1),window.removeEventListener("touchend",c,!1)):(window.removeEventListener("mouseup",c,!1),window.removeEventListener("mousemove",e,!1)),q=g.getCursorPosition(b),g.posX=g.prePos.x-(g.posAnte.x-q.x),g.posY=g.prePos.y-(g.posAnte.y-q.y),g.evaluator.setVariable(g.xString,g.space.getRelativeX(g.posX)),
g.evaluator.setVariable(g.yString,g.space.getRelativeY(g.posY)),g.evaluator.setVariable(g.mxString,g.space.getRelativeX(q.x)),g.evaluator.setVariable(g.myString,g.space.getRelativeY(q.y)),g.parent.update(),g.mouseCacher.style.left=g.space.getAbsoluteX(g.x)-g._w/2+"px",g.mouseCacher.style.top=g.space.getAbsoluteY(g.y)-g._h/2+"px";g.parent.deactivateGraphiControls()}function e(a){a.preventDefault();a.touchId=g.touchId;g.evaluator.setVariable(g.mclickedString,0);g.evaluator.setVariable(g.mclicizquierdoString,
0);q=g.getCursorPosition(a);g.posX=g.prePos.x-(g.posAnte.x-q.x);g.posY=g.prePos.y-(g.posAnte.y-q.y);g.evaluator.setVariable(g.xString,g.space.getRelativeX(g.posX));g.evaluator.setVariable(g.yString,g.space.getRelativeY(g.posY));g.evaluator.setVariable(g.mxString,g.space.getRelativeX(q.x));g.evaluator.setVariable(g.myString,g.space.getRelativeY(q.y));10<Date.now()-k&&(g.parent.updateControls(),g.parent.update(),k=Date.now())}function f(a){g.over=!0}function m(a){g.over=!1;g.click=!1}var k=0,g=this;
this.active=this.over=this.click=!1;this.mouseCacher.oncontextmenu=function(){return!1};a.hasTouchSupport?this.mouseCacher.addEventListener("touchstart",d):(this.mouseCacher.addEventListener("mousedown",b),this.mouseCacher.addEventListener("mouseover",f),this.mouseCacher.addEventListener("mouseout",m));var q};a.GraphicControl.prototype.getCursorPosition=function(a){if(a.touches){var b;if(a.touchId)for(d=0,c=a.touches.length;d<c;d++){if(a.touches[d].identifier==a.touchId){b=a.touches[d];break}}else for(var d=
0,c=a.touches.length;d<c;d++)if(a.target==a.touches[d].target){b=a.touches[d];this.touchId=b.identifier;break}mouseX=b.pageX;mouseY=b.pageY}else void 0!=a.pageX&&void 0!=a.pageY?(mouseX=a.pageX,mouseY=a.pageY):(mouseX=a.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,mouseY=a.clientY+document.body.scrollTop+document.documentElement.scrollTop);return{x:mouseX-(this.space.offsetLeft+document.body.scrollLeft),y:mouseY-(this.space.offsetTop+document.body.scrollTop)}};return a}(descartesJS||
{}),descartesJS=function(a,f){var g,c,e,b,k,t,d,m,q,h;if(a.loadLib)return a;var r,s,p,l,u,n,v,w,z=/[\w-//]*(\.png|\.jpg|\.gif|\.svg)/gi,C,A,D,G,E,B,J,y,I,F,x,K,H,M,L,N,R,S,P,Q,O;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 d=0,c=a.length;d<c;d++)switch(p=a[d][0],l=a[d][1],s=f[p],
s){case "rowsNorth":case "rowsSouth":case "widthEast":case "widthWest":case "height":b[s]=parseInt(l);break;case "about":case "config":case "init":case "clear":b[s]="true"===f[l];break;default:console.log("----- attributo de space no identificado: <"+p+"> valor: <"+l+"> -----")}return b};a.LessonParser.prototype.parseSpace=function(b){u={};b=this.split(b);for(var d=0,c=b.length;d<c;d++)switch(p=b[d][0],l=b[d][1],s=f[p],s){case "type":case "id":case "cID":case "file":u[s]=l;break;case "fixed":case "numbers":case "sensitive_to_mouse_movements":case "R3":case "split":u[s]=
"true"===f[l];break;case "bg_display":case "render":u[s]=f[l];break;case "net":case "net10":case "axes":case "text":u[s]=""!=l?"false"===f[l]?"":new a.Color(l,this.parent.evaluator):"";break;case "x_axis":case "y_axis":u[s]="false"===f[l]?"":l;break;case "O.x":u.OxExpr=l;break;case "O.y":u.OyExpr=l;break;case "image":u.imageSrc=l;break;case "x":r=l;r="%"===r[r.length-1]?(this.parent.container.width*parseFloat(r)/100).toString():l;u.xExpr=this.parser.parse(r);break;case "y":r=l;r="%"===r[r.length-
1]?(this.parent.container.height*parseFloat(r)/100).toString():l;u.yExpr=this.parser.parse(r);break;case "width":r=l.trim();"%"===r[r.length-1]?(u.wExpr=r,r=this.parent.container.width*parseFloat(r)/100):(r=parseFloat(l),r!=l&&(r=this.parent.container.width,u._w_=l.trim()));u.w=r;break;case "height":r=l.trim();"%"===r[r.length-1]?(u.hExpr=r,r=this.parent.container.height*parseFloat(r)/100):(r=parseFloat(l),r!=l&&(r=this.parent.container.height,u._h_=l.trim()));u.h=r;break;case "drawif":""!=l&&(u.drawif=
this.parser.parse(l));break;case "scale":r=parseFloat(l);isNaN(r)&&(r=48);u.scale=r;break;case "background":u.background=new a.Color(l,this.parent.evaluator);break;default:console.log("----- attributo de space no identificado: <"+p+"> valor: <"+l+"> -----")}switch(u.type){case "R2":return new a.Space2D(this.parent,u);case "R3":return new a.Space3D(this.parent,u);case "AP":return new a.SpaceAP(this.parent,u);case "HTMLIFrame":return new a.SpaceHTML_IFrame(this.parent,u);default:return new a.Space2D(this.parent,
u)}};a.LessonParser.prototype.parseControl=function(b){n={type:"numeric"};b=this.split(b);for(var d=0,c=b.length;d<c;d++)switch(p=b[d][0],l=b[d][1],s=f[p],s){case "id":case "name":case "parameter":case "tooltip":case "tooltipFont":case "Explanation":case "ExplanationFont":case "cID":case "options":case "font":case "file":case "answer":n[s]=l;break;case "gui":case "region":case "action":case "msg_pos":case "poster":n[s]=f[l];break;case "fixed":case "visible":case "discrete":case "onlyText":case "evaluate":case "autoplay":case "loop":case "controls":n[s]=
"true"===f[l];break;case "color":case "colorInt":case "trace":n[s]=new a.Color(l,this.parent.evaluator);break;case "font_size":case "drawif":case "activeif":case "decimals":case "min":case "max":case "size":""!=l&&(n[s]=this.parser.parse(l));break;case "constraint":n.constraintExpr=l;break;case "image":n.imageSrc=l;break;case "space":n.spaceID=l;break;case "type":n.type=f[l.trim()];break;case "expresion":n.expresion=this.parser.parse(l.replace(")(",","));break;case "bold":"false"!=f[l]&&(n.bold="bold");
break;case "italics":"false"!=f[l]&&(n.italics="italic");break;case "underlined":"false"!=f[l]&&(n.underlined=!0);break;case "value":var e=l.replace(/&squot;/g,"'");e.match(/^\|/)&&(e="'"+e.substring(1),e.match(/\|$/)&&(e=e.substring(0,e.length-1)+"'"));n.valueExpr=this.parser.parse(e);n.valueExprString=e;break;case "incr":0!=l&&(n.incr=this.parser.parse(l));break;case "exponentialif":n.exponentialif=parseFloat(l);break;case "text":n.rawText=l;for(var e=this.parseText(l),h=0,g=e.length;h<g;h++)e[h]=
this.parser.parse(e[h],!1);n.text=e;break;default:h=p.indexOf(".");e=f[p.substring(0,h)];h=f[p.substring(h+1)];if("parameter"===e&&"font"===h){n.parameterFont=l;break}else if("Explanation"===e&&"font"===h){n.ExplanationFont=l;break}else if("tooltip"===e&&"font"===h){n.tooltipFont=l;break}console.log("----- attributo de control no identificado: <"+p+"> valor: <"+l+"> -----")}if("numeric"===n.type)switch(n.gui){case "spinner":return new a.Spinner(this.parent,n);case "button":return new a.Button(this.parent,
n);case "textfield":return new a.TextField(this.parent,n);case "menu":return new a.Menu(this.parent,n);case "scrollbar":return new a.Scrollbar(this.parent,n);default:return new a.Spinner(this.parent,n)}else{if("video"===n.type)return new a.Video(this.parent,n);if("audio"===n.type)return new a.Audio(this.parent,n);if("graphic"===n.type)return new a.GraphicControl(this.parent,n);if("text"===n.type)return new a.TextArea(this.parent,n)}};a.LessonParser.prototype.parseGraphic=function(b,d,c,e){v={rotateExp:e,
parameter:"t"};b=this.split(b);e=0;for(var h=b.length;e<h;e++)if(p=b[e][0],l=b[e][1],s=f[p],""!=l)switch(s){case "type":case "align":v[s]=f[l];break;case "background":case "abs_coord":case "visible":case "editable":case "fixed":case "vectors":v[s]="true"===f[l];break;case "color":case "fill":case "fillP":case "fillM":case "arrow":case "trace":v[s]="false"===f[l]?"":new a.Color(l,this.parent.evaluator);break;case "family":case "parameter":case "info":case "font":case "name":case "init":case "end":v[s]=
l;break;case "drawif":case "width":case "decimals":case "size":case "spear":case "center":case "radius":case "opacity":case "inirot":case "inipos":case "range":""!=l&&(v[s]=this.parser.parse(l));break;case "space":v.spaceID=l;break;case "expresion":""!=l&&("macro"!=v.type?(v.expresion=this.parser.parse(l),v.expresionString=l):v.expresion=l);break;case "text":v.text=this.parseText(l);break;case "file":var g=l.replace(/&squot;/g,"'");"["===g.charAt(0)&&"]"===g.charAt(g.length-1)&&(g=g.substring(1,g.length-
1));g.match(z)&&(g="'"+g+"'");v.file=this.parser.parse(g);break;case "border":""!=l&&"false"!=f[l]&&(v.border=new a.Color(l,this.parent.evaluator));break;default:if(void 0!=v.family&&p.substring(0,v.family.length+1)===v.family+"."){switch(f[p.substring(v.family.length+1)]){case "interval":""!=l&&(v.family_interval=this.parser.parse(l));break;case "steps":""!=l&&(v.family_steps=this.parser.parse(l))}break}if(void 0!=v.parameter&&p.match(v.parameter+".")){v.parameter!==p.substring(0,p.indexOf(v.parameter)+
v.parameter.length)&&(v.parameter=p.substring(0,p.indexOf(v.parameter)+v.parameter.length));switch(f[p.substring(v.parameter.length+1)]){case "interval":""!=l&&(v.parameter_interval=this.parser.parse(l));break;case "steps":""!=l&&(v.parameter_steps=this.parser.parse(l))}break}console.log("----- attributo del graphic no identificado: <"+p+"> valor: <"+l+"> -----")}d&&(v.abs_coord=d);c&&(v.background=c);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 "fill":return new a.Fill(this.parent,v);case "generic":return new a.Generic(this.parent,
v)}};a.LessonParser.prototype.parse3DGraphic=function(b,d,c,e){v={rotateExp:e,parameter:"t"};b=this.split(b);d=0;for(c=b.length;d<c;d++)switch(p=b[d][0],l=b[d][1],s=f[p],s){case "type":case "model":v[s]=f[l];break;case "background":case "fixed":case "edges":v[s]="true"===f[l];break;case "color":case "backcolor":v[s]=new a.Color(l,this.parent.evaluator);break;case "type":case "model":v[s]=f[l];break;case "background":case "fixed":case "edges":case "split":v[s]="true"===f[l];break;case "color":case "backcolor":v[s]=
new a.Color(l,this.parent.evaluator);break;case "drawif":case "width":case "length":case "height":case "decimals":case "Nu":case "Nv":case "inipos":case "endpos":""!=l&&(v[s]=this.parser.parse(l));break;case "family":case "parameter":case "font":case "name":case "inirot":case "endrot":v[s]=l;break;case "space":v.spaceID=l;break;case "expresion":"macro"!=v.type&&"curve"!=v.type&&"surface"!=v.type?(v.expresion=this.parser.parse(l),v.expresionString=l):v.expresion=l.replace(/\\n/g," ").replace(/;/g,
" ");break;case "text":e=this.parseText(l);for(var h=0,g=e.length;h<g;h++)e[h]=this.parser.parse(e[h],!1);v.text=e;break;case "file":e=l.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;case "drawif":case "width":case "length":case "decimals":case "Nu":case "Nv":case "inirot":case "endrot":case "inipos":case "endpos":""!=l&&(v[s]=this.parser.parse(l));break;case "family":case "parameter":case "font":case "name":v[s]=
l;break;case "space":v.spaceID=l;break;case "expresion":"macro"!=v.type&&"curve"!=v.type&&"surface"!=v.type?(v.expresion=this.parser.parse(l),v.expresionString=l):v.expresion=l;break;case "text":e=this.parseText(l);h=0;for(g=e.length;h<g;h++)e[h]=this.parser.parse(e[h],!1);v.text=e;break;case "file":e=l.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:if(void 0!==v.family&&p.substring(0,
v.family.length+1)===v.family+"."){"interval"===f[p.substring(v.family.length+1)]?""!=l&&(v.family_interval=this.parser.parse(l)):""!=l&&(v.family_steps=this.parser.parse(l));break}console.log("----- attributo del graphic3D no identificado: <"+p+"> valor: <"+l+"> -----")}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 "mesh":return new a.OtherGeometry(this.parent,v);case "macro":return new a.Macro3D(this.parent,v)}};a.LessonParser.prototype.parseAuxiliar=
function(b){w={};b=this.split(b);for(var d=0,c=b.length;d<c;d++)b[d][1]=b[d][1].replace(/&squot;/g,"'");d=0;for(c=b.length;d<c;d++)switch(p=b[d][0],l=b[d][1],s=f[p],s){case "id":case "file":case "init":case "doExpr":case "whileExpr":case "range":case "local":case "expresion":case "condition":case "parameter":w[s]=l.replace(/&squot;/g,"'");break;case "editable":case "constant":case "array":case "matrix":case "algorithm":case "event":case "sequence":w[s]="true"===f[l];break;case "size":case "rows":case "columns":w[s]=
this.parser.parse(l);break;case "evaluate":case "execution":case "msg_pos":case "action":w[s]=f[l];break;case "type":w[s]=f[l];break;case "x":case "y":case "width":case "height":w[s]=this.parser.parse(l);break;default:var e=p.indexOf("."),h=f[p.substring(0,e)],e=f[p.substring(e+1)];if("parameter"===h&&"font"===e){w.parameterFont=l;break}console.log("----- attributo de auxiliar no identificado: <"+p+"> valor: <"+l+"> -----")}w.sequence?new a.Function(this.parent,w):w.constant?(b=new a.Constant(this.parent,
w),w.evaluate&&"always"===w.evaluate&&this.parent.auxiliaries.push(b)):w.algorithm&&w.evaluate?(b=new a.Algorithm(this.parent,w),this.parent.auxiliaries.push(b)):w.array&&!w.matrix&&")"!=w.id.charAt(w.id.length-1)?(b=new a.Vector(this.parent,w),w.evaluate&&"always"===w.evaluate&&this.parent.auxiliaries.push(b)):w.matrix&&")"!=w.id.charAt(w.id.length-1)?(b=new a.Matrix(this.parent,w),w.evaluate&&"always"===w.evaluate&&this.parent.auxiliaries.push(b)):w.event&&")"!=w.id.charAt(w.id.length-1)?this.parent.events.push(new a.Event(this.parent,
w)):")"===w.id.charAt(w.id.length-1)?new a.Function(this.parent,w):new a.Variable(this.parent,w)};a.LessonParser.prototype.parseAction=function(b){C=b.action;A=b.parent;D=b.parameter;if(C)switch(C){case "message":return new a.Message(A,D);case "calculate":return new a.Calculate(A,D);case "openURL":return new a.OpenURL(A,D);case "openScene":return new a.OpenScene(A,D);case "about":return new a.About(A,D);case "config":return new a.Config(A,D);case "init":return new a.Init(A,D);case "clear":return new a.Clear(A,
D);case "animate":return new a.Animate(A,D);case "initAnimation":return new a.InitAnimation(A,D);case "playAudio":return new a.PlayAudio(A,D);default:console.log("----- Accion no soportada aun: <"+C+"> -----")}else return{execute:function(){}}};a.LessonParser.prototype.parseAnimation=function(b){var d={};b=this.split(b);for(var c=0,e=b.length;c<e;c++)switch(p=b[c][0],l=b[c][1],s=f[p],s){case "id":case "delay":case "init":case "doExpr":case "whileExpr":d[s]=l.replace(/&squot;/g,"'");break;case "controls":case "auto":case "loop":case "algorithm":case "evaluate":d[s]=
"true"===f[l];break;default:console.log("----- attributo de la animacion no identificado: <"+p+">  <"+l+"> -----")}return new a.Animation(this.parent,d)};a.LessonParser.prototype.parsePleca=function(f,n){f=this.split(f);c=g="";e=0;b="#536891";k="white";t="left";d="";m="SansSerif,BOLD,20";q="SansSerif,PLAIN,18";h=void 0;for(var r=0,s=f.length;r<s;r++)switch(p=f[r][0],l=f[r][1],p){case "title":g=l;break;case "subtitle":c=l;break;case "subtitlines":e=l;break;case "bgcolor":""!=l&&(b=(new a.Color(l,this.parent.evaluator)).getColor());
break;case "fgcolor":""!=l&&(k=(new a.Color(l,this.parent.evaluator)).getColor());break;case "align":""!=l&&(t=l);break;case "titleimage":d=l;break;case "titlefont":m=""!=l?a.convertFont(l):a.convertFont(m);break;case "subtitlefont":q=""!=l?a.convertFont(l):a.convertFont(q);break;default:console.log("----- attributo de la pleca no identificado: <"+p+">  <"+l+"> -----")}if(""===g&&""===c)return document.createElement("div");F=q.substring(0,q.indexOf("px"));F=F.substring(F.lastIndexOf(" "));""!=d&&
(x=this.parent.getImage(d),K=x.height);h=document.createElement("div");h.setAttribute("id","descartesPleca");K?(h.setAttribute("style","position: absolute; left: 0px; top: 0px; text-align: "+t+"; width: "+(n-30)+"px; height: "+(K-16)+"px; background: "+b+"; color: "+k+"; padding-top: 8px; padding-bottom: 8px; padding-left: 15px; padding-right: 15px; margin: 0px; overflow: hidden; z-index: 100;"),x.setAttribute("style","position: absolute; left: 0px; top: 0px; z-index: -1; width: 100%; height: 100%"),
h.appendChild(x)):h.setAttribute("style","position: absolute; left: 0px; top: 0px; text-align: "+t+"; width: "+(n-30)+"px; background: "+b+"; color: "+k+"; padding-top: 12px; padding-bottom: 12px; padding-left: 15px; padding-right: 15px; margin: 0px; z-index: 100;");H=document.createElement("div");H.setAttribute("style","padding: 0px; margin: 0px; font: "+m+"; overflow: hidden; white-space: nowrap;");H.innerHTML=g;M=document.createElement("div");if(1===parseInt(e)){P=0;L=document.createElement("div");
L.innerHTML=c;document.body.appendChild(L);R=F;do R-=P,L.setAttribute("style","padding: 0px; margin: 0px; font: "+q+"; font-size: "+R+"px; width: "+(n-30)+"px; line-height: "+R+"px;"),N=L.offsetHeight,S=N/R,P=1;while(1<S&&8<R);document.body.removeChild(L);M.setAttribute("style","padding: 0px; margin: 0px; font: "+q+"; font-size: "+R+"px; line-height: 110%; overflow: hidden; white-space: nowrap;")}else M.setAttribute("style","padding: 0px; margin: 0px; font: "+q+"; line-height: 110%;");M.innerHTML=
c;h.appendChild(H);h.appendChild(M);h.imageHeight=K;return h};a.LessonParser.prototype.split=function(a){if("string"!=typeof a)return[];a=(a||"").replace(/\\'/g,"\u2019");G=[];B=E=0;J=!1;y=0;for(I=!1;E<a.length;)" "!==a.charAt(E)||J||E++," "===a.charAt(E)||J||(J=!0,y=E),"="!==a.charAt(E)||"'"!==a.charAt(E+1)||I||(I=!0,G[B]=[a.substring(y,E)],y=E+2,E+=2),I&&"'"===a.charAt(E)&&(J=I=!1,G[B].push(a.substring(y,E)),B++),"="!==a.charAt(E)||"'"===a.charAt(E+1)||I||(G[B]=[a.substring(y,E)],y=E+1,E++,Q=a.substring(E).indexOf("="),
-1===Q?O=Q=a.length:(Q+=E,O=a.substring(E,Q).lastIndexOf(" "),O=-1===O?a.length:O+E),G[B].push(a.substring(y,O)),B++,J=!1,E=O),E++;return G};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 f(a,b){p=[];p.type="matrix";p.rows=a;p.cols=b;var d;u=0;for(n=b;u<n;u++){d=[];l=0;for(v=a;l<v;l++)d.push(0);p[u]=d}return p}function g(a,b){r=
a.rows;s=a.cols;p=f(r,s);var d;for(u=0;u<r;u++)for(l=0;l<s;l++){for(n=d=0;n<s;n++)d+=a[n][u]*b[l][n];p[l][u]=d}return p}function c(a,b,d){for(var c=f(d.length-1,d.length-1),e=0,h=c.length;e<h;e++)for(var g=0;g<h;g++)c[e][g]=e<a?g<b?d[e][g]:d[e][g+1]:e<b?d[e+1][g]:d[e+1][g+1];return c}function e(a){if(1<a.cols){for(var b=0,d=1,h=0,f=a.cols;h<f;h++)b+=d*a[0][h]*e(c(0,h,a)),d=-d;return b}return a[0][0]}if(a.loadLib)return a;var b,k={},t=Math.floor,d,m,q,h;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){d=this.childs.length-1;lastChild=this.childs[d];lastChild.parent=null;this.childs[d]=a;a.parent=this;return a};a.Node.prototype.contains=function(a){if(this.value===a)return!0;for(var b=0,d=this.childs.length;b<d;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="-",q=new a.Node("compOperator","=="),h=new a.Node("number","0"),q.addChild(this),q.addChild(h),m=this.getRoot(),m.setAllEvaluateFunction(),m):this};a.Node.prototype.setAllEvaluateFunction=function(){this.setEvaluateFunction();for(var a=0,b=this.childs.length;a<b;a++)this.childs[a].setAllEvaluateFunction()};a.Node.prototype.setEvaluateFunction=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};else if("identifier"===this.type&&0===this.childs.length)if("rnd"==this.value)this.evaluate=function(a){return Math.random()};else{var a;this.evaluate=function(b,d){a=b.variables[this.value];if("object"===typeof a&&void 0==a.length)return a.evaluate(b);void 0==a&&(d||b.matrices[this.value]?a=b.matrices[this.value]:b.vectors[this.value]&&(a=b.vectors[this.value]));return void 0!==a?
a:0}}else if("identifier"===this.type&&"square_bracket"===this.childs[0].type&&1===this.childs[0].childs.length){var d,h;this.evaluate=function(a){d=this.childs[0].childs[0].evaluate(a);try{return h=a.vectors[this.value][0>d?0:t(d)],void 0!==h?h:0}catch(b){return 0}}}else if("identifier"===this.type&&"square_bracket"===this.childs[0].type&&1<this.childs[0].childs.length){var m,q;this.evaluate=function(a){m=this.childs[0].childs[0].evaluate(a);q=this.childs[0].childs[1].evaluate(a);try{return h=a.matrices[this.value][0>
m?0:t(m)][0>q?0:t(q)],void 0!==h?h:0}catch(b){return 0}}}else if("identifier"===this.type&&"parentheses"===this.childs[0].type){var n,v,B;this.evaluate=function(a){n=[];for(var d=0,c=this.childs[0].childs.length;d<c;d++)n[d]=this.childs[0].childs[d].evaluate(a);if("_Eval_"===this.value){b=0<n.length?n[0]:0;if("number"==typeof b)return"NaN";void 0==k[b]&&(v=b.match(/:=/g)?!0:!1,k[b]=a.parser.parse(b,v));B=a.evalExpression(k[b]);return void 0!=B?B:NaN}return a.functions[this.value].apply(a,n)}}else if("operator"===
this.type)"+"===this.value?this.evaluate=function(a){var b=this.childs[0].evaluate(a,!0);a=this.childs[1].evaluate(a,!0);if("matrix"!==b.type||"matrix"!==a.type)return b+a;r=b.rows;s=b.cols;p=f(r,s);for(u=0;u<r;u++)for(l=0;l<s;l++)p[l][u]=b[l][u]+a[l][u];return p}:"-"===this.value?this.evaluate=function(a){var b=this.childs[0].evaluate(a,!0);a=this.childs[1].evaluate(a,!0);if("matrix"!==b.type||"matrix"!==a.type)return b-a;r=b.rows;s=b.cols;p=f(r,s);for(u=0;u<r;u++)for(l=0;l<s;l++)p[l][u]=b[l][u]-
a[l][u];return p}:"*"===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:g(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 d=f(a.length,a.length),h=e(a);if(0===h)a=0;else{var h=1/h,l;if(1<a.length)for(var m=0,k=a.length;m<k;m++){l=h;for(var q=0;q<k;q++)d[q][m]=l*e(c(m,q,a)),
l=-l;h=-h}else d[0][0]=h;a=d}b=0===a?f(b.rows,b.cols):g(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-t(b/a)*a}:"^"===this.value&&(this.evaluate=function(a){return Math.pow(this.childs[0].evaluate(a),this.childs[1].evaluate(a))});else if("compOperator"===this.type)"<"===this.value?this.evaluate=function(a){return(this.childs[0].evaluate(a)<this.childs[1].evaluate(a))+0}:"<="===this.value?this.evaluate=function(a){return(this.childs[0].evaluate(a)<=
this.childs[1].evaluate(a))+0}:">"===this.value?this.evaluate=function(a){return(this.childs[0].evaluate(a)>this.childs[1].evaluate(a))+0}:">="===this.value?this.evaluate=function(a){return(this.childs[0].evaluate(a)>=this.childs[1].evaluate(a))+0}:"=="===this.value?this.evaluate=function(a){return(this.childs[0].evaluate(a)===this.childs[1].evaluate(a))+0}:"!="===this.value&&(this.evaluate=function(a){return(this.childs[0].evaluate(a)!==this.childs[1].evaluate(a))+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});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,d=[],c;if(1===b&&1===this.childs[0].childs.length&&"(expr)"===this.type)d=this.childs[0].childs[0].evaluate(a);else for(var e=0;e<b;e++){c=[];for(var h=0,f=this.childs[e].childs.length;h<f;h++)c.push(this.childs[e].childs[h].evaluate(a));
d[e]=c}return d};else if("asign"===this.type){var J,y,I,F,x,K;this.evaluate=function(a){J=this.childs[0];y=this.childs[1];1===J.childs.length&&"square_bracket"===J.childs[0].type?(d=J.childs[0].childs,1===d.length?(I=d[0].evaluate(a),I=0>I?0:t(I),a.vectors[J.value][I]=y.evaluate(a)):2===d.length&&(F=d[0].evaluate(a),x=d[1].evaluate(a),F=0>F?0:t(F),x=0>x?0:t(x),a.matrices[J.value][F]||(a.matrices[J.value][F]=[]),a.matrices[J.value][F][x]=y.evaluate(a))):(K=y.evaluate(a),K.type?a.matrices[J.value]=
K:"object"!==typeof a.variables[J.value]&&(a.variables[J.value]=K))}}};var r,s,p,l,u,n,v;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,d=this.childs.length;b<d;b++)a+=this.sep+this.childs[b].toString();return a};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var f,g,c,e,b,k,t,d,m,q=/^\s+/,h=/^[a-zA-Z_\u00C0-\u021B\u0391-\u03C9]+[a-zA-Z_0-9\u00C0-\u021B\u0391-\u03C9]*([.]*[0-9a-zA-Z_\u00C0-\u021B\u0391-\u03C9]+[0-9]*)*/,
r=/^[0-9]+[.][0-9]+|^[.][0-9]+|^[0-9]+/,s=/^==|^!=|^<=|^<|^>=|^>|^#/,p=/^\!|^\~|^\&\&|^\&|^\|\||^\|/,l=/^=|^:=/,u=/^[\?\:]/,n=/^[\+\-\*\/\%\^\u2212\u00b7\u00D7\u00F7]/,v=/^\[|^\]/,w=/^\(|^\)/,z=/^,/,C=/^;/,A=/\|/g,D=/\|\*/g,G=/\*\|/g;a.Tokenizer=function(){};a.Tokenizer.prototype.tokenize=function(a){function y(a,b,c){g.push({type:a,value:b});k=k.slice(c);e+=c;d++;m=a}if(f=a){a=a.replace(/\\u(\S+) /g,function(a,b){return String.fromCharCode(parseInt(b,16))});a=a.replace(/\&sup(.+);/g,"^ $1 ");a=a.replace(/&squot;/g,
"'");a.match(/\=\|\*/g)&&(a=a.replace(D,"'").replace(G,"'"));a.match(/\=\|/g)&&(a=a.replace(A,"'"));var I=a.trim();"|"==I.charAt(0)&&"|"==I.charAt(I.length-1)&&(a=I.replace(A,"'"))}g=[];c=!1;e=0;k=a;d=0;for(m="";a&&e<a.length;)if(c=e,"'"==k[0]){for(t=1;"'"!=k[t];)if(t<k.length)t++;else{console.log(">Error, unknown symbol: ["+k+"], in the string <<"+f+">>");return}b=k.substring(1,t);y("string",b,b.length+2)}else if(b=k.match(q))k=k.slice(b[0].length),e+=b[0].length,d++;else if(b=k.match(n))b[0]=b[0].replace(/\u00F7/g,
"/").replace(/\u2212/g,"-").replace(/\u00b7/g,"*").replace(/\u00D7/g,"*"),y("operator",b[0],b[0].length);else if(b=k.match(h))"number"===m&&g.push({type:"operator",value:"*"}),y("identifier",b[0],b[0].length);else if(b=k.match(r))y("number",b[0],b[0].length);else if(b=k.match(s))I=b[0],"#"==I&&(I="!="),y("compOperator",I,b[0].length);else if(b=k.match(p))I=b[0],"||"==I?I="|":"&&"==I?I="&":"~"==I&&(I="!"),y("boolOperator",I,b[0].length);else if((b=k.match(l))&&!k.match(/^==/))y("asign",b[0],b[0].length);
else if(b=k.match(u))y("conditional",b[0],b[0].length);else if(b=k.match(v))y("square_bracket",b[0],b[0].length);else if(b=k.match(w))"("==b&&"number"===m&&g.push({type:"operator",value:"*"}),y("parentheses",b[0],b[0].length);else if(b=k.match(z))y("separator",b[0],b[0].length);else if(178===k.charCodeAt(0))g.push({type:"operator",value:"^"}),y("number",2,1);else if(179===k.charCodeAt(0))g.push({type:"operator",value:"^"}),y("number",3,1);else if(b=k.match(C))y("final_of_expresion",b[0],b[0].length);
else if(c==e){console.log("Error, simbolo no conocido: ["+k+"], en la cadena <<"+f+">>");return}return g};var E,B=/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 d=0,c=a.length;d<c;d++)E="string"==a[d].type?E+"&squot;"+a[d].value+"&squot;":"identifier"!=a[d].type||a[d].value.match(B)?E+a[d].value:E+b+a[d].value;
return E};return a}(descartesJS||{}),descartesJS=function(a){function f(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.Parser=function(b){this.evaluator=b;this.tokenizer=new a.Tokenizer;this.vectors={};this.matrices={};this.variables={};this.functions={};this.definitions={};this.registerDefaultValues()};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,d){this.vectors[a][b]=d};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,d,c){this.matrices[a][b][d]=c};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 g,c,e,b,k,t,d,m,q,h,r,s;a.Parser.prototype.parse=function(f,l){(e=this.tokenizer.tokenize(f))||(e=[]);
b=null;l=!l||!1;g=m=d=t=0;for(c=e.length;g<c;g++){q=e[g];h=q.value;r=q.type;if("identifier"===r)if(g+1<c&&"parentheses"===e[g+1].type&&"("===e[g+1].value)this.getFunction(h);else if(g+1<c&&"square_bracket"===e[g+1].type&&"["===e[g+1].value)e[g+3]&&"square_bracket"===e[g+3].type&&"]"===e[g+3].value?this.getVector(h):this.getMatrix(h);else{var u=h.match(/(\w*)\.mouse_x/)||h.match(/(\w*)\.mouse_y/)||h.match(/(\w*)\.mouse_pressed/)||h.match(/(\w*)\.mouse_clicked/)||h.match(/(\w*)\.clic_izquierdo/);u&&
(this.variables[u[1]+".DESCARTESJS_no_fixed"]=1);this.getVariable(h,!0)}"asign"===r&&l&&(r="compOperator",h="==");if("asign"===r)if(k=new a.Node(r,h),null!=b)if("identifier"===b.type)b.parent&&b.parent.replaceLastChild(k),k.addChild(b),b=k,l=!0;else if("square_bracket"===b.type)k.addChild(b.parent),b=k,l=!0;else{k.type="compOperator";k.value="==";for(l=!0;b.parent&&this.getPrecedence(b.parent.value)>=this.getPrecedence(k.value);)b=b.parent;b.parent&&b.parent.replaceLastChild(k);k.addChild(b);b=k}else{console.log("Error1: en la expresion <<"+
f+">>, en el token {valor: "+h+", tipo: "+r+"}");break}else if("parentheses"===r&&"("===h||"square_bracket"===r&&"["===h)if(k=new a.Node(r,h),"("===h&&t++,"["===h&&d++,null===b)"("===h&&(new a.Node("(expr)","(expr)")).addChild(k),"["===h&&(new a.Node("[expr]","[expr]")).addChild(k),b=k;else if("operator"===b.type||"boolOperator"===b.type||"compOperator"===b.type||"conditional"===b.type||"asign"===b.type)b.addChild(k),b=k;else if("sign"===b.type)b.addChild(k),b=k;else if("parentheses"===b.type&&"("===
b.value)b.addChild(k),b=k;else if("square_bracket"===b.type&&"["===b.value)b.addChild(k),b=k;else if("parentheses"===b.type&&"()"===b.value)b.parent.addChild(k),b=k;else if("square_bracket"===b.type&&"[]"===b.value)b.parent.addChild(k),b=k;else if("identifier"===b.type)b.addChild(k),b=k;else{console.log("Error2: en la expresion <<"+f+">>, en el token ["+g+"] {valor: "+h+", tipo: "+r+"}");break}else if("parentheses"===r&&")"===h)if(t--,null===b)console.log("Error3: en la expresion <<"+f+">>, en el token (valor:"+
h+", tipo:"+r);else{for(;b&&b.parent&&("("!=b.value||"("==b.value&&"parentheses"!=b.type);)b=b.parent;if(b&&"("===b.value)b.value="()";else{console.log("Error4: en la expresion <<"+f+">>, en el token {valor: "+h+", tipo: "+r+"}");break}}else if("square_bracket"===r&&"]"===h)if(d--,null===b)console.log("Error5: en la expresion <<"+f+">>, en el token (valor:"+h+", tipo:"+r);else{for(;b&&b.parent&&("["!=b.value||"["==b.value&&"square_bracket"!=b.type);)b=b.parent;if(b&&"["===b.value)b.value="[]";else{console.log("Error6: en la expresion <<"+
f+">>, en el token {valor: "+h+", tipo: "+r+"}");break}}else if("number"===r||"string"===r||"identifier"===r)if(k=new a.Node(r,h),null===b)b=k;else if("operator"===b.type||"compOperator"===b.type||"boolOperator"===b.type||"parentheses"===b.type&&"("===b.value||"square_bracket"===b.type&&"["===b.value||"sign"===b.type||"conditional"===b.type||"asign"===b.type)b.addChild(k),b=k;else{console.log("Error7: en la expresion <<"+f+">>, en el token {valor: "+h+", tipo: "+r+"}");break}else if("operator"===
r||"compOperator"===r||"boolOperator"===r)if(k=new a.Node(r,h),null===b)if("-"===h||"+"===h)k.type="sign",k.value="sign"+h,b=k;else if("!"===h)b=k;else{console.log("Error8: en la expresion <<"+f+">>, en el token {valor: "+h+", tipo: "+r+"}");break}else if("operator"===b.type||"compOperator"===b.type||"boolOperator"===b.type||"asign"===b.type||"conditional"===b.type||"square_bracket"===b.type&&"["===b.value&&("-"===h||"+"===h||"!"===h)||"parentheses"===b.type&&"("===b.value&&("-"===h||"+"===h||"!"===
h)){if("-"===h||"+"===h)k.type="sign",k.value="sign"+h;b.addChild(k);b=k}else if("number"===b.type||"parentheses"===b.type&&"()"===b.value||"square_bracket"===b.type&&"[]"===b.value||"string"===b.type||"identifier"===b.type||"conditional"===b.type||"asign"===b.type){for(;b.parent&&this.getPrecedence(b.parent.value)>=this.getPrecedence(k.value);)b=b.parent;b.parent&&b.parent.replaceLastChild(k);k.addChild(b);b=k}else{console.log("Error9: en la expresion <<"+f+">>, en el token {valor: "+h+", tipo: "+
r+"}");break}else if("conditional"===r)if(k=new a.Node(r,h),null!=b)if("?"===k.value){for(m++;b.parent&&this.getPrecedence(b.parent.value)>this.getPrecedence(k.value);)b=b.parent;b.parent&&b.parent.replaceLastChild(k);k.addChild(b);b=k}else{for(m--;b&&b.parent&&("?"!=b.value||"?"==b.value&&"conditional"!=b.type);)b=b.parent;if(b&&"?"===b.value)b.value="?:";else{console.log("Error10: en la expresion <<"+f+">>, en el token {valor: "+h+", tipo: "+r+"}");break}}else{console.log("Error11: en la expresion <<"+
f+">>, en el token {valor: "+h+", tipo: "+r+"}");break}else if("separator"===r)if(null!=b)for(;b.parent&&"("!=b.value&&"["!=b.value;)b=b.parent;else{console.log("Error12: en la expresion <<"+f+">>, en el token {valor: "+h+", tipo: "+r+"}");break}else{console.log("Error13: en la expresion <<"+f+">>, en el token {valor: "+h+", tipo: "+r+"}");break}}0<t&&alert("Error, faltan parentesis por cerrar: "+f);0>t&&alert("Error, faltan parentesis por abrir: "+f);0<d&&alert("Error, faltan square bracketss por cerrar: "+
f);0>d&&alert("Error, faltan square bracketss por abrir: "+f);0!=m&&alert("Error, condicional incompleta: "+f);(s=b?b.getRoot():null)&&s.setAllEvaluateFunction();return s};a.Parser.prototype.getPrecedence=function(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}};a.Parser.prototype.registerDefaultValues=function(){function b(a,d){for(var c in d)d.hasOwnProperty(c)&&(a[c]=d[c])}var d=this;d.variables.rnd=Math.random;d.variables.pi=d.variables["\u03c0"]=a.returnValue(Math.PI);d.variables.e=a.returnValue(Math.E);d.variables.Infinity=Infinity;d.variables["-Infinity"]=-Infinity;
d.variables.isTouch=d.variables["esT\u00e1ctil"]=a.hasTouchSupport?1:0;d.functions.sqr=function(a){return a*a};d.functions.sqrt=d.functions["ra\u00edz"]=Math.sqrt;d.functions.exp=Math.exp;d.functions.log=Math.log;d.functions.log10=function(a){return Math.log(a)/Math.log(10)};d.functions.abs=Math.abs;d.functions.ent=Math.floor;d.functions.sgn=function(a){return 0<a?1:0>a?-1:0};d.functions.ind=function(a){return a?1:0};d.functions.sin=d.functions.sen=Math.sin;d.functions.cos=Math.cos;d.functions.tan=
Math.tan;d.functions.cot=function(a){return 1/Math.tan(a)};d.functions.sec=function(a){return 1/Math.cos(a)};d.functions.csc=function(a){return 1/Math.sin(a)};d.functions.sinh=d.functions.senh=function(a){return(Math.exp(a)-Math.exp(-a))/2};d.functions.cosh=function(a){return(Math.exp(a)+Math.exp(-a))/2};d.functions.tanh=function(a){return(Math.exp(a)-Math.exp(-a))/(Math.exp(a)+Math.exp(-a))};d.functions.coth=function(a){return 1/d.functions.tanh(a)};d.functions.sech=function(a){return 1/d.functions.cosh(a)};
d.functions.csch=function(a){return 1/d.functions.sinh(a)};d.functions.asin=d.functions.asen=Math.asin;d.functions.acos=Math.acos;d.functions.atan=Math.atan;d.functions.min=Math.min;d.functions.max=Math.max;d.functions._Num_=function(a){return"number"==typeof a?"NaN":parseFloat(a)==a?parseFloat(a):"NaN"};d.functions._Trace_=d.functions._Print_=function(){console.log.apply(console,arguments);return 0};d.functions._Stop_Audios_=function(){d.evaluator.parent.stopAudios()};d.functions.esCorrecto=function(b,
c,e){return a.esCorrecto(b,c,d.evaluator,e)};d.functions.escorrecto=function(b,c,e){return a.escorrecto(b,c,d.evaluator,e)};window.parent!==window&&(d.functions["parent.set"]=function(a,b){window.parent.postMessage({type:"set",name:a,value:b},"*");return 0},d.functions["parent.update"]=function(){window.parent.postMessage({type:"update"},"*");return 0},d.functions["parent.exec"]=function(a,b){window.parent.postMessage({type:"exec",name:a,value:b},"*");return 0});d.functions._NumToStr_=d.functions._NumACadena_=
function(a,b){a=isNaN(parseFloat(a))?0:parseFloat(a);return a.toFixed(parseInt(b||0))};d.functions._charAt_=d.functions._letraEn_=function(a,b){a=(a||"").toString();b=isNaN(parseInt(b))?0:parseInt(b);return a.charAt(b)};d.functions._substring_=d.functions._subcadena_=function(a,b,d){a=(a||"").toString();b=isNaN(parseInt(b))?0:parseInt(b);d=isNaN(parseInt(d))?0:parseInt(d);return 0<=b&&0<=d?a.substring(b,d):0>b&&0<=d?a.substring(d):0>d&&0<=b?a.substring(b):""};d.functions._length_=d.functions._longitud_=
function(a){a=(a||"").toString();return a.length};d.functions._indexOf_=d.functions["_\u00edndiceDe_"]=function(a,b){a=(a||"").toString();b=(b||"").toString();return a.indexOf(b)};this.functions._Load_=function(b){var d="";b&&(d=(d=document.getElementById(b))&&"descartes/archivo"==d.type?d.text:a.openExternalFile(b));return d||""};this.functions._GetValues_=function(a,b){var d=this.functions._Load_(a).replace(/&brvbar;/g,String.fromCharCode("166"));return this.functions._ExecBlock_(d,b)};this.functions._GetMatrix_=
function(a,b){var d=this.functions._Load_(a).replace(/&brvbar;/g,String.fromCharCode("166"));return this.functions._StrToMatrix_(d,b)};this.functions._MatrixToStr_=function(a){var b=this.matrices[a];if(b){for(var d="<"+a+">\\n",c=this.getVariable(a+".columnas_usadas")||b.rows||0,e=this.getVariable(a+".filas_usadas")||b.cols||0,h,f=0;f<c;f++){for(var g=0;g<e;g++)h=b[f][g],void 0!==h&&("string"==typeof h&&(h="'"+h+"'"),d+=h+(g<e-1?" \u00a6 ":""));d=d.replace(/(\u00A6 )$/g,"")+"\\n"}return d+("</"+a+
">")}return""};this.functions._StrToMatrix_=function(a,b){var c=[],e=!1;c.type="matrix";if(a){a=a.replace(/\r|\\r/g,"").split(/\n|\\n/);for(var h=0,g=a.length;h<g;h++)a[h].match("<"+b+">")?(e=a[h].trim().split("<"+b+">"),2==e.length&&""!=e[1]&&c.push(e[1].split(String.fromCharCode("166")).map(f)),e=!0):a[h].match("</"+b+">")?(e=a[h].trim().split("</"+b+">"),2==e.length&&""!=e[0]&&c.push(e[0].split(String.fromCharCode("166")).map(f)),e=!1):e&&c.push(a[h].split(String.fromCharCode("166")).map(f));d.matrices[b]=
c;d.setVariable(b+".filas",c[0].length);d.setVariable(b+".columnas",c.length)}return"OK"};this.functions._GetVector_=function(a,b){var d=this.functions._Load_(a);return this.functions._StrToVector_(d,b)};this.functions._VectorToStr_=function(a){var b=this.vectors[a];if(b){for(var d="<"+a+">\\n",c=this.getVariable(a+".long_usada")||b._size_||0,e,h=0;h<c;h++)e=b[h],void 0!==e?("number"==typeof e&&(e=parseFloat(e)),d+=e+"\\n"):d+="0\\n";return d+("</"+a+">")}return""};this.functions._StrToVector_=function(a,
b){var c=[],e=!1;c.type="vector";if(a){a=a.replace(/\r|\\r/g,"").split(/\n|\\n/);for(var h=0,g=a.length;h<g;h++)a[h].match("<"+b+">")?e=!0:a[h].match("</"+b+">")?e=!1:e&&c.push(f(a[h]));c._size_=c.length;d.vectors[b]=c;d.setVariable(b+".long",c.length);d.setVariable(b+".long_usada",c.length)}return"OK"};this.functions._ExecStr_=function(a){return this.functions._ExecBlock_(a,"")};this.functions._ExecBlock_=function(a,b){var c=[],e=""==b;if(a){a=a.replace(/\r|\\r/g,"").split(/\n|\\n/);for(var h=0,
f=a.length;h<f;h++)a[h].match("<"+b+">")?(e=a[h].trim().split("<"+b+">"),2==e.length&&""!=e[1]&&(c=c.concat(e[1].split(String.fromCharCode("166")))),e=!0):a[h].match("</"+b+">")?(e=a[h].trim().split("</"+b+">"),2==e.length&&""!=e[0]&&(c=c.concat(e[0].split(String.fromCharCode("166")))),e=!1):e&&(c=c.concat(a[h].split(String.fromCharCode("166"))));h=0;for(f=c.length;h<f;h++)e=c[h].split("="),e[0]=e[0].trim(),2==e.length&&""!=e[0]&&(isNaN(parseFloat(e[1]))?d.setVariable(e[0],e[1].replace(/^\s|\s$/g,
"").replace(/^'|'$/g,"")):d.setVariable(e[0],parseFloat(e[1])))}return 0};var c=document.createElement("a");c.setAttribute("target","_blank");var e,h=null;this.functions._Save_=function(a,b){document.body.appendChild(c);e=new Blob(["\ufeff",b.replace(/\\n/g,"\n").replace(/\\q/g,"'").replace(/\\r/g,"")],{type:"text/plain"});c.setAttribute("download",a);c.setAttribute("href",window.URL.createObjectURL(e));null==h&&(c.click(),h=!0,setTimeout(function(){h=null},1E3));document.body.removeChild(c);return 0};
var g,m,k,q,r=document.createElement("input");r.setAttribute("type","file");onHandleFileSelect=function(b){g=b.target.files;m=new FileReader;m.onload=function(b){a.addExternalFileContent(g[0].name,b.target.result);d.setVariable(k,g[0].name);d.getFunction(q)&&(d.getFunction(q).apply(d.evaluator,[]),d.evaluator.parent.update())};0<g.length&&m.readAsText(g[0])};r.addEventListener("change",onHandleFileSelect);this.functions._Open_=function(a,b){k=a;q=b;r.click();return 0};var t,s,B=document.createElement("input");
B.setAttribute("type","file");onHandleFileSelect2=function(a){a.stopPropagation();a.preventDefault();t=a.target.files;s=new FileReader;s.onload=function(a){var c={};try{c=JSON.parse(a.target.result)}catch(e){}c.variables&&b(d.variables,c.variables);c.vectors&&b(d.vectors,c.vectors);c.matrices&&b(d.matrices,c.matrices);d.evaluator.parent.update()};0<t.length&&s.readAsText(t[0])};B.removeEventListener("change",onHandleFileSelect2);B.addEventListener("change",onHandleFileSelect2);this.functions._GetDay_=
function(){return(new Date).getDate()};this.functions._GetMonth_=function(){return(new Date).getMonth()+1};this.functions._GetYear_=function(){return(new Date).getFullYear()};this.functions._GetHours_=function(){return(new Date).getHours()};this.functions._GetMinutes_=function(){return(new Date).getMinutes()};this.functions._GetSeconds_=function(){return(new Date).getSeconds()};this.functions._AnchoDeCadena_=this.functions._strWidth_=function(b,d,c,e){return a.getTextWidth(b,a.convertFont(d+","+c+
","+e))};this.functions._Rojo_=this.functions._Red_=function(b){return(new a.Color(b)).r/255};this.functions._Verde_=this.functions._Green_=function(b){return(new a.Color(b)).g/255};this.functions._Azul_=this.functions._Blue_=function(b){return(new a.Color(b)).b/255}};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var f=Math.floor;a.Evaluator=function(f){this.parent=f;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,c){this.definitions[a]=c};a.Evaluator.prototype.getDefinition=function(a){return this.definitions[a]};a.Evaluator.prototype.setVariable=function(a,c){this.variables[a]=c};a.Evaluator.prototype.getVariable=function(a){return this.variables[a]};a.Evaluator.prototype.setVector=function(a,c,e){c=0>c?0:f(c);this.vectors[a][c]=e};a.Evaluator.prototype.getVector=
function(a,c){c=0>c?0:f(c);return this.vectors[a][c]};a.Evaluator.prototype.setMatrix=function(a,c,e,b){c=0>c?0:f(c);e=0>e?0:f(e);this.matrices[a][c][e]=b};a.Evaluator.prototype.getMatrix=function(a,c,e){c=0>c?0:f(c);e=0>e?0:f(e);return this.matrices[a][c][e]};a.Evaluator.prototype.setFunction=function(a,c){this.functions[a]=c};a.Evaluator.prototype.getFunction=function(a){return this.functions[a]};a.Evaluator.prototype.evalExpression=function(a){return a?a.evaluate(this):0};a.externalEvaluator=new a.Evaluator;
return a}(descartesJS||{}),descartesJS=function(a){function f(a){for(var b="",c,e=0;e<a.children.length;e++)if(c=a.children[e],"text"===c.nodeType)b+=c.value.replace(/\[/g,"\\left[").replace(/\]/g,"\\right]").replace(/_/g,"\\_").replace(/ /g,"\\;").replace(/</g,"&lt;").replace(/>/g,"&gt;");else if("mathSymbol"===c.nodeType)b+=c.value.replace(/\(/g,"\\left(").replace(/\)/g,"\\right)");else if("superIndex"===c.nodeType)b+="^{"+f(c)+"}";else if("subIndex"===c.nodeType)b+="_{"+f(c)+"}";else if("fraction"===
c.nodeType)b+="\\frac{"+f(c.children[0])+"}{"+f(c.children[1])+"}";else if("radical"===c.nodeType)b+="\\sqrt["+f(c.children[0])+"]{"+f(c.children[1])+"}";else if("sum"===c.nodeType)b+="\\sum_{"+f(c.children[0])+"}^{"+f(c.children[1])+"}{"+f(c.children[2])+"}";else if("integral"===c.nodeType)b+="\\int_{"+f(c.children[0])+"}^{"+f(c.children[1])+"}{"+f(c.children[2])+"}";else if("limit"===c.nodeType)b+="\\lim_{"+f(c.children[0])+" \\to "+f(c.children[1])+"}{"+f(c.children[2])+"}";else if("matrix"===
c.nodeType){for(var b=b+"\\begin{bmatrix}",g=0;g<c.rows;g++){for(var k=0;k<c.columns;k++)b+=f(c.children[k+g*c.columns])+" &";b=b.substring(0,b.length-2)+"\\\\"}b+="\\end{bmatrix}"}else if("defparts"===c.nodeType){b+="\\begin{cases}";for(g=0;g<c.parts;g++)b+=f(c.children[g])+" \\\\";b+="\\end{cases}"}else console.log("<<",a.children[e].nodeType,">>");return b}if(a.loadLib)return a;var g=2,c=!1,e;a.RTFNode=function(a,b,c,e){this.evaluator=a;this.type="rtfNode";this.value=b;this.nodeType=c;this.style=
e;this.styleString=e.toString();this.color=e.textColor;this.underline=e.textUnderline;this.overline=e.textOverline;this.parent=null;this.children=[];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":this.draw=this.drawText;break;case "hyperlink":this.draw=
this.drawHyperlink;break;case "mathSymbol":this.draw=this.drawMathSymbol;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.RTFNode.prototype.getRoot=function(){return null==this.parent?this:this.parent.getRoot()};a.RTFNode.prototype.addChild=function(a){a.parent=this;this.children.push(a)};var b=0,k=0,
t=0;a.RTFNode.prototype.getTextMetrics=function(){if("textBlock"==this.nodeType){this.spaceWidth=a.getTextWidth(" ",this.styleString);for(var d=0,e=this.children.length;d<e;d++)this.children[d].getTextMetrics()}else if("textLineBlock"==this.nodeType)this.spaceWidth=a.getTextWidth(" ",this.styleString),this.getBlockMetric();else if("newLine"==this.nodeType){this.spaceWidth=a.getTextWidth(" ",this.styleString);var f=a.getFontMetrics(this.styleString);this.baseline=f.baseline;this.descent=f.descent;
this.ascent=f.ascent;this.w=0;this.h=f.h}else if("text"==this.nodeType||"dynamicText"==this.nodeType){this.spaceWidth=a.getTextWidth(" ",this.styleString);f=a.getFontMetrics(this.styleString);this.baseline=f.baseline;this.descent=f.descent;this.ascent=f.ascent;var d=this.value,h;"string"!=typeof this.value&&(e=void 0==this.decimals?g:this.evaluator.evalExpression(this.decimals),h=void 0==this.fixed?c:this.fixed,d=this.evaluator.evalExpression(this.value,e,h),parseFloat(d).toString()===d.toString()&&
(d=h?parseFloat(d).toFixed(e):a.removeNeedlessDecimals(parseFloat(d).toFixed(e)),d=(""+d).replace(".",this.decimal_symbol)),d+=" ");this.w=a.getTextWidth(d,this.styleString);this.h=f.h}else if("formula"==this.nodeType)this.spaceWidth=a.getTextWidth(" ",this.styleString),this.getBlockMetric();else if("hyperlink"===this.nodeType){d=a.getFontMetrics(this.styleString);this.baseline=d.baseline;this.descent=d.descent;this.ascent=d.ascent;this.w=a.getTextWidth(this.value,this.styleString);this.h=d.h;this.clickCacher=
document.createElement("div");this.clickCacher.setAttribute("style","position: absolute; width: "+this.w+"px; height: "+this.h+"px; cursor: pointer;");var r=new a.OpenURL(this.evaluator.parent,this.URL),s=this;this.clickCacher.addEventListener("click",function(a){s.click=!0;r.actionExec()})}else if("superIndex"==this.nodeType)this.spaceWidth=a.getTextWidth(" ",this.styleString),e=b,f=k,h=t,d=a.getFontMetrics(this.styleString),this.getBlockMetric(),0>this.h&&(this.ascent=d.ascent,this.descent=d.descent,
this.h=this.ascent+this.descent,this.w=1.5*this.spaceWidth),d=h/2-f+this.h,this.superIndexPos=d-this.ascent,this.ascent=d,this.descent=f,this.baseline=this.ascent,this.h=this.ascent+this.descent;else if("subIndex"==this.nodeType)this.spaceWidth=a.getTextWidth(" ",this.styleString),e=b,f=k,h=t,d=a.getFontMetrics(this.styleString),this.getBlockMetric(),0>this.h&&(this.ascent=d.ascent,this.descent=d.descent,this.h=this.ascent+this.descent,this.w=1.5*this.spaceWidth),this.subIndexPos=f+1,this.ascent=
e,this.descent=this.subIndexPos+this.descent,this.baseline=this.ascent,this.h=this.ascent+this.descent;else if("fraction"==this.nodeType){this.spaceWidth=a.getTextWidth(" ",this.styleString);var p=this.children[0],l=this.children[1],d=a.getFontMetrics(p.styleString);p.getBlockMetric();l.getBlockMetric();e=b;f=k;h=t;0>p.h&&(p.h=d.h,p.w=this.spaceWidth);0>l.h&&(l.h=d.h,l.w=this.spaceWidth);this.h=p.h+l.h-1;this.ascent=p.h+Math.round(h/2)-f;this.descent=this.h-this.ascent;this.baseline=this.ascent;this.w=
Math.max(p.w,l.w)+this.spaceWidth+8}else if("radical"==this.nodeType){this.spaceWidth=a.getTextWidth(" ",this.styleString);f=this.children[0].style.clone();if(1===this.children.length)this.children[1]=new a.RTFNode(this.evaluator," ","radicand",f),this.children[1].addChild(this.children[0]),this.children[0]=new a.RTFNode(this.evaluator," ","index",f);else if("index"!==this.children[0].nodeType||"radicand"!==this.children[1].nodeType){h=new a.RTFNode(this.evaluator,"","radicand",f);d=0;for(e=this.children.length;d<
e;d++)h.addChild(this.children[d]);this.children=[];this.children[0]=new a.RTFNode(this.evaluator,"","index",f);this.children[1]=h}d=this.children[0];e=this.children[1];0>=d.children.length&&(f=this.style.clone(),f.fontSize=parseInt(f.fontSize-.2*f.fontSize),d.addChild(new a.RTFNode(this.evaluator," ","text",f)));0>=e.children.length&&e.addChild(new a.RTFNode(this.evaluator," ","text",this.style.clone()));d.getBlockMetric();e.getBlockMetric();this.ascent=e.h/2<d.h?e.h/2+d.h+2-e.descent:e.ascent+4;
this.descent=e.descent;this.baseline=this.ascent;this.h=this.ascent+this.descent;this.w=d.w+e.w+4*this.spaceWidth}else if("sum"==this.nodeType)this.spaceWidth=a.getTextWidth(" ",this.styleString),e=b,f=k,h=t,f=this.children[0],e=this.children[1],h=this.children[2],f.getBlockMetric(),e.getBlockMetric(),h.getBlockMetric(),-1==f.ascent&&(p=a.getFontMetrics(f.styleString),f.ascent=p.ascent,f.descent=p.descent,f.h=p.h),-1==e.ascent&&(p=a.getFontMetrics(e.styleString),e.ascent=p.ascent,e.descent=p.descent,
e.h=p.h),d=a.getFontMetrics(this.styleString),this.ascent=d.h+e.h>h.ascent?d.h-d.descent+e.h:h.ascent,this.descent=f.h>h.descent?f.h+d.descent:h.descent,this.baseline=this.ascent,this.h=this.ascent+this.descent,d=this.style.clone(),d.fontType="Times New Roman",d.Bold="bold",d=d.toString(),d=a.getTextWidth(String.fromCharCode(8721),d),this.w=Math.max(f.w,e.w,d)+Math.max(h.w,this.spaceWidth)+this.spaceWidth;else if("integral"==this.nodeType)this.spaceWidth=a.getTextWidth(" ",this.styleString),e=b,f=
k,h=t,f=this.children[0],e=this.children[1],h=this.children[2],f.getBlockMetric(),e.getBlockMetric(),h.getBlockMetric(),-1==f.ascent&&(p=a.getFontMetrics(f.styleString),f.ascent=p.ascent,f.descent=p.descent,f.h=p.h),-1==e.ascent&&(p=a.getFontMetrics(e.styleString),e.ascent=p.ascent,e.descent=p.descent,e.h=p.h),d=a.getFontMetrics(this.styleString),this.ascent=d.h+e.h>h.ascent?d.h-d.descent+e.h:h.ascent,this.descent=f.h>h.descent?f.h+d.descent:h.descent,this.baseline=this.ascent,this.h=this.ascent+
this.descent,d=this.style.clone(),d.fontSize*=1.5,d.fontType="Times New Roman",d.Bold="bold",d=d.toString(),d=a.getTextWidth(String.fromCharCode(8747),d),this.w=Math.max(f.w,e.w,d)+Math.max(h.w,this.spaceWidth)+2*this.spaceWidth;else if("limit"==this.nodeType)this.spaceWidth=a.getTextWidth(" ",this.styleString),e=b,f=k,h=t,f=this.children[0],e=this.children[1],h=this.children[2],d=a.getFontMetrics(this.styleString),f.getBlockMetric(),e.getBlockMetric(),h.getBlockMetric(),-1==f.ascent&&(p=a.getFontMetrics(f.styleString),
f.ascent=p.ascent,f.descent=p.descent,f.h=p.h),-1==e.ascent&&(p=a.getFontMetrics(e.styleString),e.ascent=p.ascent,e.descent=p.descent,e.h=p.h),-1==h.ascent&&(p=a.getFontMetrics(h.styleString),h.ascent=p.ascent,h.descent=p.descent,h.h=p.h),this.ascent=h.ascent,this.descent=Math.max(d.h,h.descent),this.baseline=this.ascent,this.h=this.ascent+this.descent,d=a.getTextWidth(" "+String.fromCharCode(8594),this.styleString),0==f.w&&(f.w=this.spaceWidth),0==e.w&&(e.w=this.spaceWidth),0==h.w&&(h.w=this.spaceWidth),
this.w=e.w+f.w+h.w+d+this.spaceWidth;else if("matrix"==this.nodeType){this.spaceWidth=a.getTextWidth(" ",this.styleString);d=a.getFontMetrics(this.styleString);e=b;f=k;h=t;h=d.ascent;for(var p=d.descent,l=d.h,u=this.spaceWidth,n,v,d=0,e=this.children.length;d<e;d++)this.children[d].getBlockMetric(),n=this.children[d].h,v=this.children[d].w,l<n&&(l=n,h=this.children[d].ascent,p=this.children[d].descent),u<v&&(u=v);this.childWidth=u+2*this.spaceWidth;this.childHeight=l;this.childAscent=h;this.childDescent=
p;this.h=this.rows*l;this.ascent=this.h/2;this.descent=this.h/2;this.w=this.columns*this.childWidth+this.spaceWidth}else if("defparts"==this.nodeType){this.spaceWidth=a.getTextWidth(" ",this.styleString);d=a.getFontMetrics(this.styleString);e=b;f=k;h=t;h=d.ascent;p=d.descent;l=d.h;u=this.spaceWidth;d=0;for(e=this.children.length;d<e;d++)this.children[d].getBlockMetric(),n=this.children[d].h,v=this.children[d].w,l<n&&(l=n,h=this.children[d].ascent,p=this.children[d].descent),u<v&&(u=v);this.childWidth=
u+2*this.spaceWidth;this.childHeight=l;this.childAscent=h;this.childDescent=p;this.h=this.parts*l;this.ascent=this.h/2+f;this.descent=this.h-this.ascent;this.w=u+this.spaceWidth/2}else"mathSymbol"==this.nodeType?(this.spaceWidth=a.getTextWidth(" ",this.styleString),f=a.getFontMetrics(this.styleString),this.baseline=f.baseline,this.descent=f.descent,this.ascent=f.ascent,this.w=a.getTextWidth(this.value,this.styleString)+this.spaceWidth,this.h=f.h):"componentNumCtrl"==this.nodeType?(this.spaceWidth=
a.getTextWidth(" ",this.styleString),f=a.getFontMetrics(this.styleString),this.componentNumCtrl=this.evaluator.parent.getControlByCId(this.value),this.baseline=f.baseline-2,this.descent=f.descent-2,this.ascent=f.ascent+2,this.h=this.componentNumCtrl.h||1,this.w=this.componentNumCtrl.w||1):"componentSpace"==this.nodeType?(this.spaceWidth=a.getTextWidth(" ",this.styleString),this.componentSpace=this.evaluator.parent.getSpaceByCId(this.value),this.h=this.ascent=this.descent=this.baseline=0,this.w=this.componentSpace.w):
console.log("Element i=unknown",this.nodeType)};a.RTFNode.prototype.getBlockMetric=function(){this.w=0;for(var a=-1,c=-1,e,f=0,g=this.children.length;f<g;f++){e=this.children[f];e.getTextMetrics();childAscent=e.ascent;childDescent=e.descent;this.w+=e.w;var s=childDescent;e=e.h;b=childAscent;k=s;t=e;c<childAscent&&(c=childAscent);a<childDescent&&(a=childDescent)}this.ascent=c;this.descent=a;this.baseline=this.ascent;this.h=this.ascent+this.descent};a.RTFNode.prototype.drawTextBlock=function(a,b,f,
h,k,t,p,l){e=l;this.stableWidth||(g=h,c=k,this.getTextMetrics());p=p?-this.children[0].ascent:0;k=h=0;for(t=this.children.length;k<t;k++)0<k&&(h+=this.children[k-1].h),this.children[k].draw(a,b+0,f+p+h)};a.RTFNode.prototype.drawTextLineBlock=function(a,b,c){for(var f=0,g=0,k=this.children.length;g<k;g++)a.strokeStyle=e,a.fillStyle=e,0<g&&(f+=this.children[g-1].w,"formula"==this.children[g-1].nodeType&&(f+=2*this.children[g-1].spaceWidth)),this.children[g].draw(a,b+f,c+this.baseline)};a.RTFNode.prototype.drawFormula=
function(a,b,c){for(var e=0,f=0,g=this.children.length;f<g;f++)0<f&&(e+=this.children[f-1].w),this.children[f].draw(a,b+this.spaceWidth+e,c)};a.RTFNode.prototype.drawText=function(a,b,c){null!=this.color&&(a.fillStyle=this.color);a.font=this.styleString;a.textAlign="start";a.textBaseline="alphabetic";a.fillText(this.value,b-1,c);if(this.underline){var e="bold"==this.style.textBold,f=e?1:.5;a.lineWidth=e?2:1;null!=this.color&&(a.strokeStyle=this.color);a.beginPath();a.moveTo(b-1,parseInt(c+this.descent/
2)+f);a.lineTo(b-1+this.w,parseInt(c+this.descent/2)+f);a.stroke()}this.overline&&(f=(e="bold"==this.style.textBold)?2:1.5,a.lineWidth=e?2:1,null!=this.color&&(a.strokeStyle=this.color),a.beginPath(),a.moveTo(b-1,parseInt(c-this.ascent)+f),a.lineTo(b-1+this.w,parseInt(c-this.ascent)+f),a.stroke())};a.RTFNode.prototype.drawDynamicText=function(b,e,f){var h=Math.floor(.5*this.spaceWidth),k=void 0==this.decimals?g:this.evaluator.evalExpression(this.decimals),t=void 0==this.fixed?c:this.fixed,p=this.evaluator.evalExpression(this.value);
parseFloat(p).toString()===p.toString()&&(p=t?parseFloat(p).toFixed(k):a.removeNeedlessDecimals(parseFloat(p).toFixed(k)),p=(""+p).replace(".",this.decimal_symbol));null!=this.color&&(b.fillStyle=this.color);b.font=this.styleString;b.textAlign="start";b.textBaseline="alphabetic";this.w=a.getTextWidth(p,this.styleString);b.fillText(p,h+e,f);this.underline&&(t=(k="bold"==this.style.textBold)?1:.5,b.lineWidth=k?2:1,null!=this.color&&(b.strokeStyle=this.color),b.beginPath(),b.moveTo(h+e-1,parseInt(f+
this.descent/2)+t),b.lineTo(h+e-1+this.w,parseInt(f+this.descent/2)+t),b.stroke());this.overline&&(t=(k="bold"==this.style.textBold)?2:1.5,b.lineWidth=k?2:1,null!=this.color&&(b.strokeStyle=this.color),b.beginPath(),b.moveTo(h+e-1,parseInt(f-this.ascent)+t),b.lineTo(h+e-1+this.w,parseInt(f-this.ascent)+t),b.stroke());this.w+=2*h};a.RTFNode.prototype.drawHyperlink=function(a,b,c){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-2+"px",this.clickCacher.style.top=c-this.ascent-2+"px");a.save();this.click?(a.fillStyle="red",a.strokeStyle="red"):(a.fillStyle="blue",a.strokeStyle="blue");a.font=this.styleStr;a.textAlign="start";a.textBaseline="alphabetic";a.fillText(this.value,b-1,c);var e="bold"==this.style.textBold,f=e?1:.5;a.lineWidth=e?2:1;a.beginPath();a.moveTo(b-1,Math.ceil(c+this.descent/2)+f-2);a.lineTo(b-1+this.w,Math.ceil(c+
this.descent/2)+f-2);a.stroke();a.restore()};a.RTFNode.prototype.drawRadical=function(a,b,c){var e=Math.floor(this.spaceWidth);this.children[0].draw(a,b,Math.floor(c+this.children[1].descent-this.children[1].h/2-this.children[0].descent));this.children[1].draw(a,b+1.5*e+this.children[0].w,c);a.lineWidth=1;null!=this.color&&(a.strokeStyle=this.color);a.beginPath();a.moveTo(b,Math.floor(c+this.children[1].descent-this.children[1].h/2));a.lineTo(b+this.children[0].w,Math.floor(c+this.children[1].descent-
this.children[1].h/2));a.lineTo(b+this.children[0].w+.5*e,c+this.children[1].descent);a.lineTo(b+this.children[0].w+1*e,c-this.children[1].ascent);a.lineTo(b+this.children[0].w+2*e+this.children[1].w,c-this.children[1].ascent);a.stroke()};a.RTFNode.prototype.drawFraction=function(a,b,c){this.children[0].draw(a,b+(this.w-this.children[0].w)/2,c-this.ascent);this.children[1].draw(a,b+(this.w-this.children[1].w)/2,c-this.ascent+this.children[0].h-1);var e=Math.floor(.5*this.spaceWidth);a.lineWidth=1;
null!=this.color&&(a.strokeStyle=this.color);a.beginPath();a.moveTo(b+e,parseInt(c-this.ascent+this.children[0].h)-.5);a.lineTo(b-e+this.w-1,parseInt(c-this.ascent+this.children[0].h)-.5);a.stroke()};a.RTFNode.prototype.drawNumDen=function(a,b,c){for(var e=0,f=0,g=this.children.length;f<g;f++)0<f&&(e+=this.children[f-1].w),this.children[f].draw(a,b+e,c+this.baseline)};a.RTFNode.prototype.drawSubIndex=function(a,b,c){for(var e=0,f=0,g=this.children.length;f<g;f++)0<f&&(e+=this.children[f-1].w),this.children[f].draw(a,
b+e,c+this.subIndexPos)};a.RTFNode.prototype.drawSuperIndex=function(a,b,c){for(var e=0,f=0,g=this.children.length;f<g;f++)0<f&&(e+=this.children[f-1].w),this.children[f].draw(a,b+e,c-this.superIndexPos)};a.RTFNode.prototype.drawLimit=function(b,c,e){var f=a.getFontMetrics(this.styleString),g=" "+String.fromCharCode(8594),k=a.getTextWidth(g,this.styleString);this.children[0].draw(b,c,e+f.descent+this.children[0].ascent);this.children[1].draw(b,c+this.children[0].w+k,e+f.descent+this.children[1].ascent);
this.children[2].draw(b,c+k+this.children[0].w+this.children[1].w,e);null!=this.color&&(b.fillStyle=this.color);b.font=this.styleString;b.textAlign="start";b.textBaseline="alphabetic";b.fillText("l\u00edm",c+this.children[0].w,e);b.fillText(g,c+this.children[0].w,e+f.descent+this.children[0].ascent)};a.RTFNode.prototype.drawIntegral=function(b,c,e){var f=this.style.clone();f.fontSize*=1.5;f.fontType="Times New Roman";f.Bold="bold";var f=f.toString(),g=a.getTextWidth(String.fromCharCode(8747),f),k=
a.getFontMetrics(f),t=Math.max(this.children[0].w,this.children[1].w,Math.floor(1.5*g));this.children[0].draw(b,c+g,e+k.descent+this.children[0].ascent);this.children[1].draw(b,c+g+this.spaceWidth/2,e-this.ascent+this.children[1].ascent);this.children[2].draw(b,c+t+g,e);null!=this.color&&(b.fillStyle=this.color);b.font=f;b.textAlign="start";b.textBaseline="alphabetic";b.fillText(String.fromCharCode(8747),c,e+k.descent/2)};a.RTFNode.prototype.drawSum=function(b,c,e){var f=this.style.clone();f.fontType=
"Times New Roman";f.Bold="bold";var f=f.toString(),g=a.getTextWidth(String.fromCharCode(8721),f),k=a.getFontMetrics(this.styleString),t=Math.max(this.children[0].w,this.children[1].w,g);this.children[0].draw(b,c+(t-this.children[0].w)/2,e+k.descent+this.children[0].ascent);this.children[1].draw(b,c+(t-this.children[1].w)/2,e-k.ascent-this.children[1].descent);this.children[2].draw(b,c+t,e);null!=this.color&&(b.fillStyle=this.color);b.font=f;b.textAlign="start";b.textBaseline="alphabetic";b.fillText(String.fromCharCode(8721),
c+Math.floor((t-g)/2),e-5)};a.RTFNode.prototype.drawMatrix=function(a,b,c){for(var e,f,g=0,k=this.children.length;g<k;g++)e=g%this.columns,f=Math.floor(g/this.columns),this.children[g].draw(a,2*this.spaceWidth+b+e*this.childWidth,c-this.ascent+this.childAscent+f*this.childHeight);a.lineWidth=1;null!=this.color&&(a.strokeStyle=this.color);a.beginPath();a.moveTo(Math.floor(b+this.spaceWidth)+.5,c-this.ascent+.5);a.lineTo(Math.floor(b+this.spaceWidth/2)+.5,c-this.ascent+.5);a.lineTo(Math.floor(b+this.spaceWidth/
2)+.5,c+this.descent+.5);a.lineTo(Math.floor(b+this.spaceWidth)+.5,c+this.descent+.5);a.moveTo(Math.floor(b+this.w-this.spaceWidth)-.5,c-this.ascent+.5);a.lineTo(Math.floor(b+this.w-this.spaceWidth/2)-.5,c-this.ascent+.5);a.lineTo(Math.floor(b+this.w-this.spaceWidth/2)-.5,c+this.descent+.5);a.lineTo(Math.floor(b+this.w-this.spaceWidth)-.5,c+this.descent+.5);a.stroke()};a.RTFNode.prototype.drawDefparts=function(a,b,c){for(var e=0,f=this.children.length;e<f;e++)this.children[e].draw(a,b+3*this.spaceWidth,
c-this.ascent+this.childAscent+e%this.parts*this.childHeight);a.lineWidth=1;null!=this.color&&(a.strokeStyle=this.color);a.beginPath();a.moveTo(parseInt(b+2*this.spaceWidth)+.5,c-this.ascent+.5);a.lineTo(parseInt(b+2*this.spaceWidth)-4.5,c-this.ascent+4.5);a.lineTo(parseInt(b+2*this.spaceWidth)-4.5,c+this.descent-this.h/2-4.5);a.lineTo(b-.5,c+this.descent-this.h/2);a.lineTo(parseInt(b+2*this.spaceWidth)-4.5,c+this.descent-this.h/2+4.5);a.lineTo(parseInt(b+2*this.spaceWidth)-4.5,c+this.descent-4.5);
a.lineTo(parseInt(b+2*this.spaceWidth)+.5,c+this.descent+.5);a.stroke()};a.RTFNode.prototype.drawMathSymbol=function(a,b,c){a.lineWidth=1;null!=this.color&&(a.strokeStyle=this.color,a.fillStyle=this.color);a.beginPath();"("==this.value?(a.font=this.styleString,a.textAlign="start",a.textBaseline="alphabetic",a.fillText("(",b,c)):")"==this.value?(a.font=this.styleString,a.textAlign="start",a.textBaseline="alphabetic",a.fillText(")",b+this.spaceWidth,c)):(a.font=this.styleString,a.textAlign="center",
a.textBaseline="alphabetic",a.fillText(this.value,b+this.w/2,c))};a.RTFNode.prototype.drawGenericBlock=function(a,b,c){for(var e=0,f=0,g=this.children.length;f<g;f++)0<f&&(e+=this.children[f-1].w),this.children[f].draw(a,b+e,c)};a.RTFNode.prototype.drawComponentNumCtrl=function(a,b,c){this.parent.getTextMetrics();this.componentNumCtrl.expresion=this.evaluator.parser.parse("("+b+","+(c-this.ascent)+","+this.componentNumCtrl.w+","+this.componentNumCtrl.h+")")};a.RTFNode.prototype.drawComponentSpace=
function(a,b,c){this.getTextMetrics();this.componentSpace.xExpr=this.evaluator.parser.parse(b+"");this.componentSpace.yExpr=this.evaluator.parser.parse(c-this.parent.ascent+"")};a.RTFNode.prototype.draw=function(a,b,c){console.log(">>> Dibujo desconocido ",this.nodeType)};a.RTFNode.prototype.toHTML=function(a){var b="";if("textLineBlock"===this.nodeType||"textBlock"===this.nodeType)for(var c=0,e=this.children.length;c<e;c++)b+=this.children[c].toHTML(a);else"text"===this.nodeType?b="<span "+this.style.toCSS()+
">"+this.value.replace(/ {2}/g,"&nbsp;&nbsp;").replace(/&nbsp; /g,"&nbsp;")+"</span>":"newLine"===this.nodeType?b="<span "+this.style.toCSS()+">"+this.value+"<br /></span>":"hyperlink"===this.nodeType?b="<span "+this.style.toCSS()+"> <a target='_blank' href='"+this.URL+"'>"+this.value+"</a></span>":"formula"===this.nodeType?b="<span "+this.style.toCSS()+"> \\( \\displaystyle "+f(this)+"\\) </span>":"componentSpace"===this.nodeType?(a.spaces.push({cID:"cID_"+this.value,value:this.componentSpace}),
b="<div style='display:inline-block; vertical-align:top; width:"+this.componentSpace.w+"px; height:0px;' id='cID_"+this.value+"'></div>"):"componentNumCtrl"===this.nodeType?(a.ctrs.push({cID:"cID_"+this.value,value:this.componentNumCtrl}),b="<div style='display:inline-block; vertical-align:middle; width:"+this.componentNumCtrl.w+"px; height:"+this.componentNumCtrl.h+"px;' id='cID_"+this.value+"'></div>"):console.log(">>>",this,"<<<");return b};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;
var f=String.fromCharCode,g,c,e,b,k,t,d,m,q,h,r,s;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[];g=[];c=a.length;g=[];e="";k=b=0;d=a.charAt(0);m=!1;for(q="text";b<c;)t=d,d=a.charAt(b+1),m?"\\"===d||"{"===d||"}"===d||
" "===d||";"===d?(m=!1,e+=t," "===d?(b++,d=a.charAt(b+1),s=!0):s=!1,(h=e.match(/^\'([0-9a-f]{2})/))?(r="","text"===q&&(r=g.pop().value),e=r+=f(parseInt(h[1],16))+e.substring(3)):(h=e.match(/^u[0-9]+/))?(r="","text"===q&&(r=g.pop().value),e=r+=f(h[0].substring(1))):("{"===e||"}"===e||"\\"==t?(g.push({type:"text",value:e+(s?" ":"")}),q="text"):(g.push({type:"controlWord",value:e}),q="controlWord"),e="")):"{"==t||"}"==t||"\\"==t?(m=!1,g.push({type:"text",value:t}),q="text"):e+=t:"\\"===t?(m=!0,""!==
e&&(g.push({type:"text",value:e}),q="text"),e=""):"{"===t?(k++,""!==e&&g.push({type:"text",value:e}),e="",g.push({type:"openBlock",value:k}),q="openBlock"):"}"===t?(""!==e&&g.push({type:"text",value:e}),e="",g.push({type:"closeBlock",value:k}),q="closeBlock",k--):e+=t,b++;""!==e&&g.push({type:"text",value:e});return g};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var f,g,c,e,b,k,t,d,m,q,h,r,s,p,l,u,n,v,w,z,C,A,D,G,E,B,J,y,I,F;a.RTFParser=function(b){this.evaluator=b;this.tokenizer=
new a.RTFTokenizer};a.RTFParser.prototype.parse=function(x){x=f=this.tokenizer.tokenize(x);for(var K=[],H=!1,M=!1,L=[],N=0,R=x.length;N<R;N++)if("openBlock"==x[N].type&&L.push(x[N].value),"closeBlock"==x[N].type&&(L.pop(),0>=L.length&&(H=!1)),"controlWord"!=x[N].type||"expr"!=x[N].value&&"decimals"!=x[N].value||(M=!0),"controlWord"==x[N].type&&"mjaformula"==x[N].value&&(H=!0),"text"==x[N].type&&H&&!M){for(var S=0,P=x[N].value,Q="",O=0,$=P.length;O<$;O++)if("("==P.charAt(O)||")"==P.charAt(O)||"+"==
P.charAt(O)||"-"==P.charAt(O)||"*"==P.charAt(O)||"="==P.charAt(O))Q=P.substring(S,O),""!=Q&&K.push({type:"text",value:Q}),K.push({type:P.charAt(O),value:P.charAt(O)}),S=O+1;Q=P.substring(S,O);""!=Q&&K.push({type:"text",value:Q})}else K.push(x[N]),"text"==x[N].type&&M&&(M=!1);f=K;g={};e=2;if("openBlock"==f[0].type&&"fonttbl"==f[1].value){for(c=f[0].value;"closeBlock"!=f[e].type&&f[e].value!=c;)g[f[e].value]=f[e+2].value.substring(0,f[e+2].value.length-1),e+=3;e++}b={};k=0;if("openBlock"==f[e].type&&
"colortbl"==f[e+1].value){c=f[e++].value;for(e++;"closeBlock"!=f[e].type&&f[e].value!=c;)t=parseInt(f[e++].value.substring(3)).toString(16),d=parseInt(f[e++].value.substring(5)).toString(16),m=parseInt(f[e++].value.substring(4)).toString(16),";"===f[e].value&&e++,b[k++]="#"+(2>t.length?"0"+t:t)+(2>d.length?"0"+d:d)+(2>m.length?"0"+m:m);e++}q=new a.RTFNode(this.evaluator,"","textBlock","",!1,"");h=new a.RTFNode(this.evaluator,"","textLineBlock","",!1,"");q.addChild(h);p=s=r=null;z=w=v=n=u=l=!1;C=[new a.FontStyle(20,
"Arial","","",!1,!1,null)];A=C[0];D=!0;E=G=-1;B=[];F=I=y=J=!1;x=e;for(K=f.length;x<K;x++)if("controlWord"==f[x].type&&g[f[x].value])A.fontType=g[f[x].value];else if("controlWord"==f[x].type&&f[x].value.match(/^fs(\d+)/))A.fontSize=parseInt(f[x].value.match(/^fs(\d+)/)[1]/2);else if("controlWord"==f[x].type&&"b"==f[x].value)A.textBold="bold";else if("controlWord"==f[x].type&&"b0"==f[x].value)A.textBold="";else if("controlWord"==f[x].type&&"i"==f[x].value)A.textItalic="oblique";else if("controlWord"==
f[x].type&&"i0"==f[x].value)A.textItalic="";else if("controlWord"==f[x].type&&"ul"==f[x].value)A.textUnderline=!0;else if("controlWord"==f[x].type&&"ulnone"==f[x].value)A.textUnderline=!1;else if("controlWord"==f[x].type&&"ol"==f[x].value)A.textOverline=!0;else if("controlWord"==f[x].type&&"olnone"==f[x].value)A.textOverline=!1;else if("controlWord"==f[x].type&&f[x].value.match(/^cf(\d+)/))A.textColor=b[parseInt(f[x].value.substring(2))],0<B.length&&(B[B.length-1].style.textColor=A.textColor);else if("openBlock"==
f[x].type)G=f[x].value,A=A.clone(),C.push(A),B.push(null);else if("closeBlock"==f[x].type)f[x].value==E&&(E=-1,l=!1,h=h.parent),C.pop(),A=C[C.length-1],B.pop();else if("controlWord"==f[x].type&&"par"==f[x].value){h.addChild(new a.RTFNode(this.evaluator,"","newLine",A.clone()));q=new a.RTFNode(this.evaluator,"","textLineBlock",A.clone());if("textBlock"!=h.nodeType)for(h=h.parent;"textBlock"!=h.nodeType;)h=h.parent;h.addChild(q);h=q}else if("controlWord"==f[x].type&&"mjaformula"==f[x].value)J=!0,E=
G,l=!0,q=new a.RTFNode(this.evaluator,"","formula",A.clone()),h.addChild(q),h=q,B[B.length-1]=q;else if("controlWord"==f[x].type&&("fraction"==f[x].value||"radicand"==f[x].value||"radical"==f[x].value||"what"==f[x].value||"sum"==f[x].value||"integral"==f[x].value||"limit"==f[x].value))H=B[B.length-2].style.clone(),q=new a.RTFNode(this.evaluator,"",f[x].value,H),B[B.length-2].addChild(q),B[B.length-1]=q;else if("controlWord"==f[x].type&&"index"==f[x].value||"to"==f[x].value||"from"==f[x].value)H=B[B.length-
2].style.clone(),H.fontSize=parseInt(H.fontSize-.2*H.fontSize),8>H.fontSize&&(H.fontSize=8),q=new a.RTFNode(this.evaluator,"",f[x].value,H),B[B.length-2].addChild(q),B[B.length-1]=q;else if("controlWord"==f[x].type&&("num"==f[x].value||"den"==f[x].value))H=B[B.length-2].style.clone(),H.fontSize=Math.round(H.fontSize-.1*H.fontSize),8>H.fontSize&&(H.fontSize=8),"num"==f[x].value?q=new a.RTFNode(this.evaluator,"","numerator",H):"den"==f[x].value&&(q=new a.RTFNode(this.evaluator,"","denominator",H)),
B[B.length-2].addChild(q),B[B.length-1]=q;else if("controlWord"==f[x].type&&("subix"==f[x].value||"supix"==f[x].value))H=B[B.length-2].style.clone(),H.fontSize=Math.floor(H.fontSize-H.fontSize/3),8>H.fontSize&&(H.fontSize=8),"subix"==f[x].value?q=new a.RTFNode(this.evaluator,"","subIndex",H):"supix"==f[x].value&&(q=new a.RTFNode(this.evaluator,"","superIndex",H)),q.originalStyle=B[B.length-2].style.clone(),B[B.length-2].addChild(q),B[B.length-1]=q;else if("controlWord"==f[x].type&&("defparts"==f[x].value||
"matrix"==f[x].value||"element"==f[x].value))H=B[B.length-2].style.clone(),q=new a.RTFNode(this.evaluator,"",f[x].value,H),B[B.length-2].addChild(q),B[B.length-1]=q,"defparts"==f[x].value?p=q:"matrix"==f[x].value&&(s=q);else if("controlWord"==f[x].type&&"parts"==f[x].value)z=!0;else if("text"==f[x].type&&z)p.parts=parseInt(f[x].value),z=!1;else if("controlWord"==f[x].type&&"rows"==f[x].value)v=!0;else if("text"==f[x].type&&v)s.rows=parseInt(f[x].value),v=!1;else if("controlWord"==f[x].type&&"columns"==
f[x].value)w=!0;else if("text"==f[x].type&&w)s.columns=parseInt(f[x].value),w=!1;else if("controlWord"==f[x].type&&"expr"==f[x].value)D=!1,u=!0;else if("controlWord"==f[x].type&&"decimals"==f[x].value)n=!0;else if("text"==f[x].type&&n)r.decimals=this.evaluator.parser.parse(f[x].value+""),n=!1;else if("controlWord"==f[x].type&&"fixed1"==f[x].value)r.fixed=!0;else if("controlWord"==f[x].type&&"fixed0"==f[x].value)r.fixed=!1;else if("controlWord"!=f[x].type||"component"!=f[x].value)if("controlWord"==
f[x].type&&"NumCtrl"==f[x].value)y=!0;else if("controlWord"==f[x].type&&"Space"==f[x].value)I=!0;else if("controlWord"==f[x].type&&"hyperlink"==f[x].value)F=!0;else if("text"==f[x].type&&F){textContent=f[x].value.split("|")[0];H=A.clone();q=new a.RTFNode(this.evaluator,textContent,"hyperlink",H);q.URL=f[x].value.split("|")[1];if("textLineBlock"!=h.nodeType)for(h=h.parent;"textLineBlock"!=h.nodeType;)h=h.parent;h.addChild(q);F=!1}else if("text"==f[x].type&&y)q=new a.RTFNode(this.evaluator,f[x].value,
"componentNumCtrl",A.clone()),h.addChild(q),y=!1;else if("text"==f[x].type&&I)q=new a.RTFNode(this.evaluator,f[x].value,"componentSpace",A.clone()),h.addChild(q),I=!1;else if("text"==f[x].type&&u)H=B[B.length-2].style.clone(),textContent=this.evaluator.parser.parse(f[x].value),q=new a.RTFNode(this.evaluator,textContent,"dynamicText",H),B[B.length-2].addChild(q),r=B[B.length-1]=q,u=!1;else if("text"==f[x].type&&!u&&!l){textContent=f[x].value;q=new a.RTFNode(this.evaluator,textContent,"text",A.clone());
if("textLineBlock"!=h.nodeType)for(h=h.parent;"textLineBlock"!=h.nodeType;)h=h.parent;h.addChild(q)}else if("text"==f[x].type&&!u&&l)textContent=f[x].value,q=new a.RTFNode(this.evaluator,textContent,"text",B[B.length-1].style.clone()),B[B.length-1].addChild(q);else if("("==f[x].type||")"==f[x].type)H=B[B.length-1].style.clone(),H.textItalic="",q=new a.RTFNode(this.evaluator,f[x].type,"mathSymbol",H),B[B.length-1].addChild(q);else if("+"==f[x].type||"-"==f[x].type||"*"==f[x].type||"="==f[x].type)q=
new a.RTFNode(this.evaluator,f[x].type,"mathSymbol",B[B.length-1].style.clone()),B[B.length-1].addChild(q);if(null!=h){var U=h.getRoot();U.stableWidth=D;U.getTextMetrics();U.hasFormula=J}return U};a.FontStyle=function(a,b,c,d,e,f,h){this.fontSize=a;this.fontType=b;this.textItalic=c;this.textBold=d;this.textUnderline=e;this.textOverline=f;this.textColor=h};a.FontStyle.prototype.toString=function(){"arial"==this.fontType.toLowerCase()?this.fontType="descartesJS_sansserif,Arial,Helvetica,Sans-serif":
this.fontType.toLowerCase().match("times")?this.fontType="descartesJS_serif,'Times New Roman',Times,serif":this.fontType.toLowerCase().match("courier")&&(this.fontType="descartesJS_monospace,'Courier New',Courier,Monospace");return(this.textBold+" "+this.textItalic+" "+this.fontSize+"px "+this.fontType).trim()};a.FontStyle.prototype.toCSS=function(){var a='style="font-size:'+this.fontSize+"px; font-family:"+this.fontType+"; ";this.textUnderline&&!this.textOverline&&(a+="text-decoration: underline; ");
!this.textUnderline&&this.textOverline&&(a+="text-decoration: overline; ");this.textUnderline&&this.textOverline&&(a+="text-decoration: underline overline; ");this.textBold&&!this.textItalic&&(a+="font-style: normal; font-weight: bold; ");!this.textBold&&this.textItalic&&(a+="font-style: italic; font-weight: normal; ");this.textBold&&this.textItalic&&(a+="font-style: italic; font-weight: bold; ");this.textBold||this.textItalic||(a+="font-style: normal; font-weight: normal; ");this.textColor&&(a+=
"color: "+this.textColor+"; ");return a+'"'};a.FontStyle.prototype.clone=function(){return new a.FontStyle(this.fontSize,this.fontType,this.textItalic,this.textBold,this.textUnderline,this.textOverline,this.textColor)};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var f,g,c,e,b,k,t,d,m,q,h,r,s,p;a.Space=function(b,d){this.parent=b;g=this.evaluator=this.parent.evaluator;c=g.parser;this.id="";this.values=d;this.type="R2";this.xExpr=c.parse("0");this.yExpr=c.parse("0");this.w=
parseInt(b.container.width);this.h=parseInt(b.container.height);this.drawif=c.parse("1");this.fixed=2!=b.version?!1:!0;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="descinst.com.mja.descartes.DescartesJS.class"===b.code||b.arquimedes?new a.Color("f0f8fa"):new a.Color("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.x_axis=2!=b.version?"":" ";this.y_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.backgroundGraphics=[];this.zIndex=b.zIndex;this.plecaHeight=b.plecaHeight||0;this.displaceRegionNorth=b.displaceRegionNorth||0;this.displaceRegionWest=b.displaceRegionWest||0;for(var e in d)d.hasOwnProperty(e)&&(this[e]=d[e]);this.init()};
a.Space.prototype.init=function(){f=this.parent;g=this.evaluator;e=this.id;this.displaceRegionNorth=f.displaceRegionNorth||0;this.displaceRegionWest=f.displaceRegionWest||0;void 0!=this.wExpr&&(this.w=(parseInt(f.container.width)-this.displaceRegionWest)*parseFloat(this.wExpr)/100);void 0!=this.hExpr&&(this.h=(parseInt(f.container.height)-this.displaceRegionNorth)*parseFloat(this.hExpr)/100);t=parseInt(f.container.height);d=parseInt(f.container.width);this.x=g.evalExpression(this.xExpr)+this.displaceRegionWest;
this.y=g.evalExpression(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?(b=t-this.y,this.h>b&&(this.h=b)):(b=this.h+this.y,this.h=b>=t?t:b);0<=this.x?(k=d-this.x,this.w>k&&(this.w=k)):(k=this.w+this.x,this.w=k>=d?d:k);""==this.imageSrc&&this.imageSrc.trim().toLowerCase().match(/vacio.gif$/)||(this.image=f.getImage(this.imageSrc));this.OxExpr&&(q=this.OxExpr,"%"===q[q.length-1]?this.Ox=this.w*
parseFloat(q)/100:(m=parseFloat(q),m!=q&&(m=0),this.Ox=m));this.OyExpr&&(h=this.OyExpr,"%"===h[h.length-1]?this.Oy=this.h*parseFloat(h)/100:(m=parseFloat(h),m!=h&&(m=0),this.Oy=m));""!==this.id&&2!==f.version?(g.setVariable(e+"._w",this.w),g.setVariable(e+"._h",this.h),g.setVariable(e+".escala",this.scale),g.setVariable(e+".Ox",this.Ox),g.setVariable(e+".Oy",this.Oy),g.setVariable(e+".mouse_x",0),g.setVariable(e+".mouse_y",0),g.setVariable(e+".mouse_pressed",0),g.setVariable(e+".mouse_clicked",0),
g.setVariable(e+".clic_izquierdo",0)):(m=g.getVariable("_w"),void 0===m&&(m=this.w),g.setVariable("_w",m),m=g.getVariable("_h"),void 0===m&&(m=this.h),g.setVariable("_h",m),m=g.getVariable("escala"),void 0===m&&(m=this.scale),g.setVariable("escala",m),m=g.getVariable("Ox"),void 0===m&&(m=this.Ox),g.setVariable("Ox",m),m=g.getVariable("Oy"),void 0===m&&(m=this.Oy),g.setVariable("Oy",m),g.setVariable("mouse_x",0),g.setVariable("mouse_y",0),g.setVariable("mouse_pressed",0),g.setVariable("mouse_clicked",
0),g.setVariable("clic_izquierdo",0),""===this.x_axis&&""===this.y_axis&&2==f.version&&(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.backgroundGraphics.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(parseInt(a)-this.w_2-this.Ox)/this.scale};a.Space.prototype.getRelativeY=function(a){return(-parseInt(a)+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};a.Space.prototype.findOffset=function(){r=this.container;this.offsetTop=this.offsetLeft=0;this.container&&this.container.style&&(s=this.container.style.display);
this.container.style.display="block";if(r.getBoundingClientRect){var a=r.getBoundingClientRect();this.offsetLeft=a.left;this.offsetTop=a.top}else for(;r;)r.tagName&&"html"!==r.tagName.toLowerCase()?(this.offsetLeft+=r.offsetLeft||0,this.offsetTop+=r.offsetTop||0,r=r.parentNode):r=null;this.container&&this.container.style&&(this.container.style.display=s)};a.Space.prototype.getCursorPosition=function(b){this.findOffset();p=a.getCursorPosition(b);return{x:p.x-((document.documentElement&&document.documentElement.scrollLeft||
document.body.scrollLeft)+this.offsetLeft),y:p.y-((document.documentElement&&document.documentElement.scrollTop||document.body.scrollTop)+this.offsetTop)}};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var f;a.SpaceExternal=function(a){f=this;f.parent=a;f.width=228;f.vSpace=25;f.container=document.createElement("div");f.container.setAttribute("style","-webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; border-style: ridge; border-width: 5px; border-color: gray; box-shadow: #000 0px 0px 25px 5px; overflow-y: scroll; overflow-x: hidden; position: fixed; left: 0px; top: 0px; z-index: 10000; width: "+
(f.width+27)+"px; height: 460px; background-color: #63b4fb");f.moveManipulator=document.createElement("div");f.moveManipulator.setAttribute("style"," position: absolute; left: 0px; top: 0px; width: "+(f.width+27)+"px; height: "+f.vSpace+"px; line-height: "+f.vSpace+"px; background-color: ddd; cursor: move; padding-left: 75px; font-family: Sans-Serif; font-size: 18px;");f.moveManipulator.innerHTML="Descartes";f.container.appendChild(f.moveManipulator);f.ctrs=[]};a.SpaceExternal.prototype.init=function(){function f(b){e.newPosition=
a.getCursorPosition(b);e.container.style.left=e.initialPosition.x+(e.newPosition.x-e.oldPosition.x)+"px";e.container.style.top=e.initialPosition.y+(e.newPosition.y-e.oldPosition.y)+"px"}function c(a){a.preventDefault();e.findOffset();document.body.removeEventListener("mousemove",f);document.body.removeEventListener("mouseup",c)}document.body.appendChild(this.container);var e=this,b=e.parent.evaluator.parser,k;k=0;for(var t=e.ctrs.length;k<t;k++)e.ctrs[k].expresion=b.parse("(0,"+(e.vSpace+23+35*k)+
","+e.width+",35)"),e.ctrs[k].update();e.numCtr=t;k="espa\u00f1ol"==e.language?"cr\u00e9ditos":"english"==e.language?"about":"cr\u00e9ditos";k=new a.Button(e.parent,{region:"external",name:k,font_size:b.parse("15"),expresion:b.parse("(0,"+e.vSpace+","+e.width/2+",25)")});k.actionExec={execute:a.showAbout};k.update();(new a.Button(e.parent,{region:"external",name:"config",font_size:b.parse("15"),action:"config",expresion:b.parse("("+e.width/2+","+e.vSpace+","+e.width/2+",25)")})).update();k="espa\u00f1ol"==
e.language?"inicio":"english"==e.language?"init":"inicio";(new a.Button(e.parent,{region:"external",name:k,font_size:b.parse("15"),action:"init",expresion:b.parse("(0,"+(e.vSpace+23+35*t)+","+e.width/2+",25)")})).update();k="espa\u00f1ol"==e.language?"limpiar":"english"==e.language?"clear":"limpiar";(new a.Button(e.parent,{region:"external",name:k,font_size:b.parse("15"),action:"clear",expresion:b.parse("("+e.width/2+","+(e.vSpace+23+35*t)+","+e.width/2+",25)")})).update();k="espa\u00f1ol"==e.language?
"cerrar":"close";b=new a.Button(e.parent,{region:"external",name:k,font_size:b.parse("15"),expresion:b.parse("("+e.width/4+","+(e.vSpace+46+35*t)+","+e.width/2+",25)")});b.update();b.canvas.addEventListener("click",function(a){e.hide()});e.setPositionAndSize();e.moveManipulator.addEventListener("mousedown",function(b){b.preventDefault();e.oldPosition=a.getCursorPosition(b);e.initialPosition={x:e.container.offsetLeft,y:e.container.offsetTop};document.body.addEventListener("mousemove",f);document.body.addEventListener("mouseup",
c)});e.findOffset();e.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(){var a=this.vSpace+46+35*this.numCtr+25+10;this.container.style.left=Math.max(parseInt(window.innerWidth-this.width)/2,0)+"px";this.container.style.top="5px";this.container.style.height=
window.innerHeight<this.vSpace+75?this.vSpace+75+"px":a>window.innerHeight-10?window.innerHeight-10:a+"px"};a.SpaceExternal.prototype.findOffset=function(){tmpContainer=this.container;this.offsetTop=this.offsetLeft=0;this.container&&this.container.style&&(tmpDisplay=this.container.style.display);this.container.style.display="block";if(tmpContainer.getBoundingClientRect){var a=tmpContainer.getBoundingClientRect();this.offsetLeft=a.left;this.offsetTop=a.top}else for(;tmpContainer;)tmpContainer.tagName&&
"html"!==tmpContainer.tagName.toLowerCase()?(this.offsetLeft+=tmpContainer.offsetLeft||0,this.offsetTop+=tmpContainer.offsetTop||0,tmpContainer=tmpContainer.parentNode):tmpContainer=null;this.container&&this.container.style&&(this.container.style.display=tmpDisplay);for(var a=0,c=this.ctrs.length;a<c;a++)this.ctrs[a].findOffset&&this.ctrs[a].findOffset()};return a}(descartesJS||{}),descartesJS=function(a){var f,g;if(a.loadLib)return a;var c=Math.floor,e=Math.round,b=2*Math.PI,k=a.convertFont("SansSerif,PLAIN,12"),
t=a.convertFont("Monospaced,PLAIN,12"),d,m,q,h,r,s,p,l,u,n,v,w,z,C,A,D,G,E,B,J,y,I,F,x,K,H,M,L,N;a.Space2D=function(b,c){a.Space.call(this,b,c);d=this;d._ratio=5E6<d.w*a._ratio*d.h*a._ratio?1:a._ratio;d.backgroundCanvas=document.createElement("canvas");d.backgroundCanvas.setAttribute("id",d.id+"_background");d.backgroundCanvas.width=d.w*d._ratio;d.backgroundCanvas.height=d.h*d._ratio;d.backgroundCanvas.style.width=d.w+"px";d.backgroundCanvas.style.height=d.h+"px";d.backgroundCtx=d.backgroundCanvas.getContext("2d");
d.canvas=document.createElement("canvas");d.canvas.setAttribute("id",d.id+"_canvas");d.canvas.width=d.w*d._ratio;d.canvas.height=d.h*d._ratio;d.canvas.setAttribute("class","DescartesSpace2DCanvas");d.canvas.setAttribute("style","z-index: "+d.zIndex+"; width:"+d.w+"px; height:"+d.h+"px;");d.ctx=d.canvas.getContext("2d");d.graphicControlContainer=document.createElement("div");d.graphicControlContainer.setAttribute("id",d.id+"_graphicControls");d.graphicControlContainer.setAttribute("style","position: absolute; left: 0px; top: 0px; z-index: "+
d.zIndex+";");d.numericalControlContainer=document.createElement("div");d.numericalControlContainer.setAttribute("id",d.id+"_numericalControls");d.numericalControlContainer.setAttribute("style","position: absolute; left: 0px; top: 0px; z-index: "+d.zIndex+";");d.container=document.createElement("div");d.container.setAttribute("id",d.id);d.container.setAttribute("class","DescartesSpace2DContainer");d.container.setAttribute("style","left: "+d.x+"px; top: "+d.y+"px; z-index: "+d.zIndex+";");d.parent.arquimedes&&
"#f0f8fa"===d.background.getColor()&&(d.container.style.border="1px solid #b8c4c8");d.container.appendChild(d.backgroundCanvas);d.container.appendChild(d.canvas);d.container.appendChild(d.graphicControlContainer);d.container.appendChild(d.numericalControlContainer);b.container.insertBefore(d.container,b.loader);d.parent.images[d.id+".image"]=d.canvas;d.parent.images[d.id+".image"].ready=1;d.parent.images[d.id+".image"].complete=!0;d.evaluator.setVariable(d.id+".image",d.id+".image");d.parent.images[d.id+
".back"]=d.backgroundCanvas;d.parent.images[d.id+".back"].ready=1;d.parent.images[d.id+".back"].complete=!0;d.evaluator.setVariable(d.id+".back",d.id+".back");""!==d.id&&2!==b.version?(d.OxString=d.id+".Ox",d.OyString=d.id+".Oy",d.scaleString=d.id+".escala",d.wString=d.id+"._w",d.hString=d.id+"._h",d.mxString=d.id+".mouse_x",d.myString=d.id+".mouse_y",d.mpressedString=d.id+".mouse_pressed",d.mclickedString=d.id+".mouse_clicked",d.mclicizquierdoString=d.id+".clic_izquierdo",d.kpressedString=d.id+".key_pressed",
d.kvalueString=d.id+".key_value"):(d.OxString="Ox",d.OyString="Oy",d.scaleString="escala",d.wString="_w",d.hString="_h",d.mxString="mouse_x",d.myString="mouse_y",d.mpressedString="mouse_pressed",d.mclickedString="mouse_clicked",d.mclicizquierdoString="clic_izquierdo",d.kpressedString="key_pressed",d.kvalueString="key_value");d.click=0;"descartesJS_scenario"!==d.id?d.registerMouseAndTouchEvents():d.canvas.oncontextmenu=function(a){return!1}};a.extend(a.Space2D,a.Space);a.Space2D.prototype.init=function(){d=
this;d.uber.init.call(d);d.canvas&&(d.backgroundCanvas.width=d.w*d._ratio,d.backgroundCanvas.height=d.h*d._ratio,d.backgroundCanvas.style.width=d.w+"px",d.backgroundCanvas.style.height=d.h+"px",d.canvas.width=d.w*d._ratio,d.canvas.height=d.h*d._ratio,d.canvas.style.width=d.w+"px",d.canvas.style.height=d.h+"px");d.container&&d.findOffset()};a.Space2D.prototype.update=function(a){d=this;m=d.evaluator;q=d.parent;m.setVariable(d.wString,d.w);m.setVariable(d.hString,d.h);d.drawIfValue=0<m.evalExpression(d.drawif);
if(d.drawIfValue){r=d.x!==m.evalExpression(d.xExpr)+d.displaceRegionWest;s=d.y!==m.evalExpression(d.yExpr)+q.plecaHeight+d.displaceRegionNorth;d.spaceChange=a||r||s||d.drawBefore!==d.drawIfValue||d.Ox!==m.getVariable(d.OxString)||d.Oy!==m.getVariable(d.OyString)||d.scale!==m.getVariable(d.scaleString)||d.backColor!==d.background.getColor();d.x=r?m.evalExpression(d.xExpr)+d.displaceRegionWest:d.x;d.y=s?m.evalExpression(d.yExpr)+q.plecaHeight+d.displaceRegionNorth:d.y;d.Ox=m.getVariable(d.OxString);
d.Oy=m.getVariable(d.OyString);d.scale=m.getVariable(d.scaleString);d.drawBefore=d.drawIfValue;1E-6>d.scale?(d.scale=1E-6,m.setVariable(d.scaleString,1E-6)):1E6<d.scale&&(d.scale=1E6,m.setVariable(d.scaleString,1E6));if(r||s)d.container.style.left=d.x+"px",d.container.style.top=d.y+"px",d.findOffset();d.container.style.display="block";d.drawTrace=!d.spaceChange&&(!d.fixed&&!d.click||d.fixed);d.spaceChange&&(d.backgroundCtx.setTransform(d._ratio,0,0,d._ratio,0,0),d.drawBackground(),d.backgroundCtx.setTransform(1,
0,0,1,0,0));d.ctx.setTransform(d._ratio,0,0,d._ratio,0,0);d.draw();d.ctx.setTransform(1,0,0,1,0,0)}else d.container.style.display="none"};a.Space2D.prototype.drawBackground=function(){m=this.evaluator;h=this.backgroundCtx;h.clearRect(0,0,this.backgroundCanvas.width,this.backgroundCanvas.height);this.backColor=this.background.getColor();h.fillStyle=this.backColor;h.fillRect(0,0,this.backgroundCanvas.width,this.backgroundCanvas.height);this.image&&""!=this.image.src&&this.image.ready&&this.image.complete&&
("topleft"===this.bg_display?h.drawImage(this.image,0,0):"stretch"===this.bg_display?h.drawImage(this.image,0,0,this.w,this.h):"patch"===this.bg_display?(h.fillStyle=h.createPattern(this.image,"repeat"),h.fillRect(0,0,this.canvas.width,this.canvas.height)):"imgcenter"===this.bg_display&&h.drawImage(this.image,(this.w-this.image.width)/2,(this.h-this.image.height)/2));l=this.scale;u=0;for(n=0>this.w+this.h?0:this.w+this.h;l>n;)l/=10,u++;for(;l<n/10;)l*=10;h.lineWidth=1;""!==this.net&&(h.strokeStyle=
this.net.getColor(),this.drawMarks(h,l/10,-1));if(2!==this.parent.version&&""!==this.net10||2===this.parent.version&&""!==this.net&&""!==this.net10)h.strokeStyle=this.net10.getColor(),this.drawMarks(h,l,-1);if(""!==this.axes){h.strokeStyle=this.axes.getColor();h.beginPath();if(""!==this.x_axis||2!==this.parent.version)h.moveTo(0,c(this.h/2+this.Oy)+.5),h.lineTo(this.w,c(this.h/2+this.Oy)+.5);if(""!==this.y_axis||2!==this.parent.version)h.moveTo(c(this.w/2+this.Ox)+.5,0),h.lineTo(c(this.w/2+this.Ox)+
.5,this.h);h.stroke();this.drawMarks(h,l,4);this.drawMarks(h,l/2,2);this.drawMarks(h,l/10,1)}if(""!==this.x_axis||""!==this.y_axis)h.fillStyle=""!==this.axes?this.axes.getColor():"black",h.font=k,h.textAlign="right",h.textBaseline="alphabetic",h.fillText(this.x_axis,c(this.w)-2,c(this.h/2+this.Oy)+12),h.fillText(this.y_axis,c(this.w/2+this.Ox)-2,12);this.numbers&&""!=this.axes&&(h.fillStyle=this.axes.getColor(),h.font=k,h.textAlign="start",h.textBaseline="bottom",l>(this.w+this.h)/2?this.drawNumbers(h,
l/5,l<=this.scale?u+1:u):l>(this.w+this.h)/4?this.drawNumbers(h,l/2,l<=this.scale?u+1:u):this.drawNumbers(h,l,u));for(var a=0,b=this.backgroundGraphics.length;a<b;a++)this.backgroundGraphics[a].draw()};a.Space2D.prototype.draw=function(){h=this.ctx;h.clearRect(0,0,this.canvas.width,this.canvas.height);for(var a=0,d=this.graphics.length;a<d;a++)p=this.graphics[a],""!==p.trace&&this.drawTrace&&p.drawTrace(),p.draw();a=0;for(d=this.graphicsCtr.length;a<d;a++)this.graphicsCtr[a].draw();""!=this.text&&
this.click&&"L"===this.whichButton&&(h.fillStyle=this.text.getColor(),h.strokeStyle=h.fillStyle,h.lineWidth=1,h.font=t,h.textAlign="center",h.textBaseline="alphabetic",y=1>=this.scale?this.mouse_x.toFixed(0):this.mouse_x.toFixed(this.scale.toString().length),I=1>=this.scale?this.mouse_y.toFixed(0):this.mouse_y.toFixed(this.scale.toString().length),F="("+y+","+I+")",x=c(h.measureText(F).width/2),K=this.getAbsoluteX(this.mouse_x),H=this.getAbsoluteY(this.mouse_y),M=c(K),L=c(H-10),M+x>this.w?M=this.w-
x:0>M-x&&(M=x),L+1>this.h?L=this.h:0>L-14&&(L=15),h.fillText(F,M,L),h.beginPath(),h.arc(K,H,2.5,0,b,!0),h.stroke())};a.Space2D.prototype.drawMarks=function(a,b,d){v=this.w;w=this.h;G=0;E=v;B=0;J=w;A=c(v/2+this.Ox);D=c(w/2+this.Oy);0<=d&&(G=A-d,E=A+d,B=D-d,J=D+d);a.beginPath();for(d=-e(A/b);(z=A+e(d*b))<v;d++)a.moveTo(z+.5,B+.5),a.lineTo(z+.5,J+.5);for(d=-e(D/b);(C=D+e(d*b))<w;d++)a.moveTo(G+.5,C+.5),a.lineTo(E+.5,C+.5);a.stroke()};a.Space2D.prototype.drawNumbers=function(a,b,d){v=this.w;w=this.h;
A=c(v/2+this.Ox);D=c(w/2+this.Oy);for(d=-e(A/b);(z=A+e(d*b))<v;d++)a.fillText(parseFloat((d*b/this.scale).toFixed(4)),z+1,D-2);for(d=-e(D/b);(C=D+e(d*b))<w;d++)0!==parseFloat(-d*b/this.scale)&&a.fillText(parseFloat((-d*b/this.scale).toFixed(4)),A+5,C+5)};a.Space2D.prototype.registerMouseAndTouchEvents=function(){function b(a){document.body.focus();if(m.evaluator.variables[m.id+".DESCARTESJS_no_fixed"]||!m.fixed||m.sensitive_to_mouse_movements)m.parent.clearClick(),m.click=1,m.evaluator.setVariable(m.mpressedString,
1),m.evaluator.setVariable(m.mclickedString,0),m.evaluator.setVariable(m.mclicizquierdoString,0),m.parent.deactivateGraphiControls(),k(a),window.addEventListener("touchmove",n),window.addEventListener("touchend",d),a.stopPropagation(),a.preventDefault()}function d(a){document.body.focus();if(m.evaluator.variables[m.id+".DESCARTESJS_no_fixed"]||!m.fixed||m.sensitive_to_mouse_movements)m.click=0,m.evaluator.setVariable(m.mpressedString,0),m.evaluator.setVariable(m.mclickedString,1),m.evaluator.setVariable(m.mclicizquierdoString,
1),window.removeEventListener("touchmove",n),window.removeEventListener("touchend",d),a.stopPropagation(),a.preventDefault(),m.parent.update()}function e(b){document.body.focus();b.stopPropagation();b.preventDefault();m.parent.clearClick();m.click=1;m.parent.deactivateGraphiControls();m.whichButton=a.whichButton(b);"R"===m.whichButton?(window.addEventListener("mouseup",h),m.clickPosForZoom=m.getCursorPosition(b).y,m.clickPosForZoomNew=m.clickPosForZoom,m.fixed||(m.tempScale=m.scale,window.addEventListener("mousemove",
l))):"L"===m.whichButton&&(m.evaluator.setVariable(m.mpressedString,1),m.evaluator.setVariable(m.mclickedString,0),m.evaluator.setVariable(m.mclicizquierdoString,0),k(b),window.addEventListener("mousemove",n),window.addEventListener("mouseup",h))}function h(b){document.body.focus();b.stopPropagation();b.preventDefault();m.click=0;m.evaluator.setVariable(m.mpressedString,0);m.evaluator.setVariable(m.mclickedString,1);m.evaluator.setVariable(m.mclicizquierdoString,1);"R"===m.whichButton&&(window.removeEventListener("mousemove",
l),m.clickPosForZoom==m.clickPosForZoomNew&&a.showConfig&&(m.parent.externalSpace.show(),m.clickPosForZoom=!1,m.clickPosForZoomNew=!0));window.removeEventListener("mousemove",n);window.removeEventListener("mouseup",h);m.parent.deactivateGraphiControls();m.parent.update()}function k(a){m.posAnte=m.getCursorPosition(a);m.mouse_x=m.getRelativeX(m.posAnte.x);m.mouse_y=m.getRelativeY(m.posAnte.y);m.evaluator.setVariable(m.mxString,m.mouse_x);m.evaluator.setVariable(m.myString,m.mouse_y);m.evaluator.setVariable(m.mclickedString,
0);m.evaluator.setVariable(m.mclicizquierdoString,0);m.parent.update()}function l(a){a.preventDefault();m.clickPosForZoomNew=m.getCursorPosition(a).y;m.evaluator.setVariable(m.scaleString,m.tempScale+m.tempScale/45*((m.clickPosForZoom-m.clickPosForZoomNew)/10));m.parent.update()}function n(a){a.preventDefault();a.stopPropagation();m.fixed||(m.posNext=m.getCursorPosition(a),f=c(m.posAnte.x-m.posNext.x),g=c(m.posAnte.y-m.posNext.y),m.evaluator.setVariable(m.OxString,m.Ox-f),m.evaluator.setVariable(m.OyString,
m.Oy-g),m.posAnte.x-=f,m.posAnte.y-=g);k(a)}var m=this;N=a.hasTouchSupport;m.clickPosForZoom=null;m.clickPosForZoomNew=null;m.canvas.oncontextmenu=function(a){return!1};N&&(this.sensitive_to_mouse_movements&&this.canvas.addEventListener("touchmove",k),this.canvas.addEventListener("touchstart",b));N||(this.sensitive_to_mouse_movements&&this.canvas.addEventListener("mousemove",k),this.canvas.addEventListener("mousedown",e));window.addEventListener("blur",function(a){h(a)});document.addEventListener("visibilitychange",
function(a){h(a)})};return a}(descartesJS||{}),descartesJS=function(a){var f,g,c;function e(a,b){return b.depth-a.depth}function b(b,c){ma=a.subtract3D(b,a.scalarProduct3D(c,a.dotProduct3D(b,c)));fa=a.add3D(b,a.scalarProduct3D(ma,-2));ga=a.norm3D(fa);return 0!==ga?a.scalarProduct3D(fa,1/ga):a.scalarProduct3D(b,-1)}if(a.loadLib)return a;var k=Math.floor,t=Math.round,d=Math.max,m=Math.cos,q=Math.sin,h=Math.sqrt,r=15*Math.PI/180,s=Math.cos(r),p=Math.sin(r),l,u,n,v,w,z,C,A,D,G,E,B,J,y,I,F,x,K,H,M,L,N,
R,S=[],P,Q,O,$,U,la,ma,fa,ga;a.Space3D=function(b,c){a.Space.call(this,b,c);n=this;n.backgroundCanvas=document.createElement("canvas");n.backgroundCanvas.setAttribute("id",n.id+"_background");n.backgroundCanvas.setAttribute("width",n.w+"px");n.backgroundCanvas.setAttribute("height",n.h+"px");n.canvas=document.createElement("canvas");n.canvas.setAttribute("id",n.id+"_canvas");n.canvas.setAttribute("width",n.w+"px");n.canvas.setAttribute("height",n.h+"px");n.canvas.setAttribute("class","DescartesSpace3DCanvas");
n.canvas.setAttribute("style","z-index: "+n.zIndex+";");n.ctx=n.canvas.getContext("2d");n.graphicControlContainer=document.createElement("div");n.graphicControlContainer.setAttribute("id",n.id+"_graphicControls");n.graphicControlContainer.setAttribute("style","position: absolute; left: 0px; top: 0px; z-index: "+n.zIndex+";");n.numericalControlContainer=document.createElement("div");n.numericalControlContainer.setAttribute("id",n.id+"_numericalControls");n.numericalControlContainer.setAttribute("style",
"position: absolute; left: 0px; top: 0px; z-index: "+n.zIndex+";");n.container=document.createElement("div");n.container.setAttribute("id",n.id);n.container.setAttribute("class","DescartesSpace3DContainer");n.container.setAttribute("style","left: "+n.x+"px; top: "+n.y+"px; z-index: "+n.zIndex+";");n.container.appendChild(n.backgroundCanvas);n.container.appendChild(n.canvas);n.container.appendChild(n.graphicControlContainer);n.container.appendChild(n.numericalControlContainer);b.container.insertBefore(n.container,
b.loader);n.eye={x:0,y:0,z:0};n.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}];for(var d=0,e=n.lights.length;d<e;d++)n.lights[d]=a.normalize3D(n.lights[d]);n.light3={x:0,y:0,z:0};n.intensity=[.4,.5,.3,0];n.userIntensity=0;n.dim=1;n.tmpIntensity=[];n.OxStr=n.id+".Ox";n.OyStr=n.id+".Oy";n.scaleStr=n.id+".escala";n.wStr=n.id+"._w";n.hStr=n.id+"._h";n.obsStr=n.id+".observador";n.rotZStr=n.id+".rot.z";n.rotYStr=n.id+".rot.y";n.userI_Dim_Str=n.id+".userIlum.dim";n.userI_I_Str=
n.id+".userIlum.I";n.userI_x_Str=n.id+".userIlum.x";n.userI_y_Str=n.id+".userIlum.y";n.userI_z_Str=n.id+".userIlum.z";n.new3D_Str=n.id+"._3Dnew_";n.xO_Str=n.id+".xO";n.yO_Str=n.id+".yO";n.zO_Str=n.id+".zO";n.AO_Str=n.id+".AO";n.BO_Str=n.id+".BO";n.CO_Str=n.id+".CO";n.zoom_Str=n.id+".zoom";n.evaluator.setVariable(n.rotZStr,0);n.evaluator.setVariable(n.rotYStr,0);n.evaluator.setVariable(n.userI_Dim_Str,n.dim);n.evaluator.setVariable(n.userI_I_Str,n.userIntensity);n.evaluator.setVariable(n.userI_x_Str,
0);n.evaluator.setVariable(n.userI_y_Str,0);n.evaluator.setVariable(n.userI_z_Str,0);n.registerMouseAndTouchEvents()};a.extend(a.Space3D,a.Space);a.Space3D.prototype.init=function(a){n=this;n.uber.init.call(n);n.canvas&&(n.canvas.setAttribute("width",n.w+"px"),n.canvas.setAttribute("height",n.h+"px"));n.container&&n.findOffset();n.w_2=n.w/2;n.h_2=n.h/2;n.w_plus_h=n.w+n.h;n.oldMouse={x:0,y:0}};a.Space3D.prototype.update=function(a){n=this;l=n.evaluator;u=n.parent;n.new3D=0<l.getVariable(n.new3D_Str);
l.setVariable(n.wStr,n.w);l.setVariable(n.hStr,n.h);n.drawIfValue=0<l.evalExpression(n.drawif);if(n.drawIfValue){D=n.x!==l.evalExpression(n.xExpr)+n.displaceRegionWest;G=n.y!==l.evalExpression(n.yExpr)+u.plecaHeight+n.displaceRegionNorth;n.spaceChange=a||D||G||n.drawBefore!==n.drawIfValue||n.Ox!==l.getVariable(n.OxStr)||n.Oy!==l.getVariable(n.OyStr)||n.scale!==l.getVariable(n.scaleStr);n.x=D?l.evalExpression(n.xExpr)+n.displaceRegionWest:n.x;n.y=G?l.evalExpression(n.yExpr)+u.plecaHeight+n.displaceRegionNorth:
n.y;n.Ox=l.getVariable(n.OxStr);n.Oy=l.getVariable(n.OyStr);n.scale=l.getVariable(n.scaleStr);n.drawBefore=n.drawIfValue;if(a||void 0==n.observer){var b;a=0;for(var c=n.parent.controls.length;a<c;a++)n.parent.controls[a].id===n.obsStr&&(b=!0);n.observer=b?l.getVariable(n.obsStr)||2.5*n.w_plus_h:2.5*n.w_plus_h;n.observer=d(n.observer,.25*n.w_plus_h);l.setVariable(n.obsStr,n.observer)}n.new3D?(void 0==l.getVariable(n.xO_Str)&&l.setVariable(n.xO_Str,n.observer/n.scale*s),void 0==l.getVariable(n.yO_Str)&&
l.setVariable(n.yO_Str,0),void 0==l.getVariable(n.zO_Str)&&l.setVariable(n.zO_Str,n.observer/n.scale*p),void 0==l.getVariable(n.AO_Str)&&l.setVariable(n.AO_Str,0),void 0==l.getVariable(n.BO_Str)&&l.setVariable(n.BO_Str,345),void 0==l.getVariable(n.CO_Str)&&l.setVariable(n.CO_Str,0),n.xO=l.getVariable(n.xO_Str),n.yO=l.getVariable(n.yO_Str),n.zO=l.getVariable(n.zO_Str),n.AO=l.getVariable(n.AO_Str),n.BO=l.getVariable(n.BO_Str),n.CO=l.getVariable(n.CO_Str),n.zoom=l.getVariable(n.zoom_Str),n.eye={x:parseFloat(l.getVariable(n.xO_Str)),
y:parseFloat(l.getVariable(n.yO_Str)),z:parseFloat(l.getVariable(n.zO_Str))}):(n.eye={x:n.observer/n.scale*s,y:0,z:n.observer/n.scale*p},n.D=n.scale*n.eye.x/s,n.XE=t(n.scale*n.eye.y+.5),n.YE=t(n.scale*n.eye.z+.5),n.observer=d(l.getVariable(n.obsStr),.25*n.w_plus_h),n.observer!=l.getVariable(n.obsStr)&&(l.setVariable(n.obsStr,n.observer),n.parent.updateControls()));1E-6>n.scale?(n.scale=1E-6,l.setVariable(n.scaleStr,1E-6)):1E6<n.scale&&(n.scale=1E6,l.setVariable(n.scaleStr,1E6));if(D||G)n.container.style.left=
n.x+"px",n.container.style.top=n.y+"px",n.findOffset();n.container.style.display="block";n.dim=l.getVariable(n.userI_Dim_Str);n.userIntensity=l.getVariable(n.userI_I_Str);n.light3={x:parseInt(l.getVariable(n.userI_x_Str)),y:parseInt(l.getVariable(n.userI_y_Str)),z:parseInt(l.getVariable(n.userI_z_Str))};n.updateCamera();n.draw()}else n.container.style.display="none"};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));for(var a=0,b=this.graphics.length;a<b;a++)this.graphics[a].update();this.primitives=[];a=0;for(b=this.graphics.length;a<b;a++){v=this.graphics[a];if(v.split||this.split)for(var c=a+1;c<b;c++)w=this.graphics[c],(w.split||this.split)&&v.splitFace(w);this.primitives=this.primitives.concat(v.primitives||[])}z=this.primitives;C=z.length;for(a=0;a<C;a++)z[a].computeDepth(this);if("painter"===this.render)this.drawPainter(z);else for(z=z.sort(e),a=0;a<C;a++)z[a].passDraw&&
z[a].draw(this.ctx,this);a=0;for(b=this.graphicsCtr.length;a<b;a++)this.graphicsCtr[a].draw()};var T;a.renderNode=function(a){this.value=a;this.front=this.back=null};a.renderNode.prototype.inOrder=function(){var a=[];this.back&&(a=a.concat(this.back.inOrder()));a.push(this.value);this.front&&(a=a.concat(this.front.inOrder()));return a};a.Space3D.prototype.buildTree=function(b){if(0===b.length)return null;var c,d=[],e=[];T=b.shift();for(var f=0,h=b.length;f<h;f++){c=null;for(var g=0,k=b[f].spaceVertices.length;g<
k;g++)whereIs=2<T.spaceVertices.length?this.inPlane2(T.spaceVertices[0],T.normal,b[f].spaceVertices[g]):0,whereIs=0<T.direction?-whereIs:whereIs,null===c?0>whereIs?c="front":0<whereIs&&(c="back"):0>whereIs?"back"===c&&(c="cross"):0<whereIs&&"front"===c&&(c="cross");if("back"===c)d.push(b[f]);else if("front"===c)e.push(b[f]);else if(null==c)d.push(b[f]);else{c=null;g=0;for(k=T.spaceVertices.length;g<k;g++)whereIs=2<b[f].spaceVertices.length?this.inPlane2(b[f].spaceVertices[0],b[f].normal,T.spaceVertices[g]):
-1,whereIs=0<b[f].direction?-whereIs:whereIs,null===c?0>whereIs?c="front":0<whereIs&&(c="back"):0>whereIs?"back"===c&&(c="cross"):0<whereIs&&"front"===c&&(c="cross");"front"===c?d.push(b[f]):e.push(b[f])}}b=new a.renderNode(T);b.back=this.buildTree(d);b.front=this.buildTree(e);return b};a.Space3D.prototype.drawPainter=function(a){if(a=this.buildTree(a)){a=a.inOrder();for(var b=0;b<a.length;b++)a[b].passDraw&&a[b].draw(this.ctx,this)}};a.Space3D.prototype.inPlane=function(a,b,c,d){return parseFloat(((d.x-
a.x)*(b.y-a.y)*(c.z-a.z)+(d.y-a.y)*(b.z-a.z)*(c.x-a.x)+(d.z-a.z)*(b.x-a.x)*(c.y-a.y)-(d.z-a.z)*(b.y-a.y)*(c.x-a.x)-(d.y-a.y)*(b.x-a.x)*(c.z-a.z)-(d.x-a.x)*(b.z-a.z)*(c.y-a.y)).toFixed(8))};a.Space3D.prototype.inPlane2=function(a,b,c){return parseFloat((b.x*(c.x-a.x)+b.y*(c.y-a.y)+b.z*(c.z-a.z)).originalToFixed(8))};a.Space3D.prototype.updateCamera=function(){n=this;n.new3D?(n.D=n.scale*n.eye.x/s,n.XE=t(n.scale*n.eye.y+.5),n.YE=t(n.scale*n.eye.z+.5)):(n.D=n.observer,n.eye.x=n.D/n.scale,n.eye.y=n.XE/
n.scale,n.eye.z=n.YE/n.scale)};a.Space3D.prototype.rotateVertex=function(b){x=a.degToRad(n.evaluator.getVariable(n.rotZStr));K=m(x);H=q(x);f=b.x*K-b.y*H;g=b.x*H+b.y*K;c=b.z;x=a.degToRad(n.evaluator.getVariable(n.rotYStr));K=m(x);H=q(x);return{x:c*H+f*K,y:g,z:c*K-f*H}};var na,ha,V,W,oa,ia,aa,X,pa,ja,Y,Z,qa,ra,sa,ta,ua,va,wa,xa,ya,ba,ca,da,ea,za,Aa,ka;a.Space3D.prototype.project=function(a){n=this;if(n.new3D){J=n.eye.x-a.x;y=n.eye.y-a.y;I=n.eye.z-a.z;var b=h(J*J+y*y+I*I);F=-a.x/b||0;na=n.AO%360;ha=
na*Math.PI/180;V=Math.cos(ha);W=Math.sin(ha);oa=n.BO%360;ia=oa*Math.PI/180;aa=Math.cos(ia);X=Math.sin(ia);pa=n.CO%360;ja=pa*Math.PI/180;Y=Math.cos(ja);Z=Math.sin(ja);qa=aa*V;ra=-Y*aa*W-Z*X;sa=-Z*aa*W+Y*X;ta=W;ua=Y*V;va=Z*V;wa=-X*V;xa=Y*X*W-Z*V;ya=Z*X*W+Y*V;ba=-n.eye.x+a.x;ca=-n.eye.y+a.y;da=-n.eye.z+a.z;ea=qa*ba+ta*ca+wa*da;za=ra*ba+ua*ca+xa*da;Aa=sa*ba+va*ca+ya*da;ka=parseFloat(n.evaluator.getVariable(n.zoom_Str));return{x:this.getAbsoluteX(-ka*za/ea),y:this.getAbsoluteY(-ka*Aa/ea),z:0<ea?-b:b}}J=
n.eye.x-a.x;y=n.eye.y-a.y;I=n.eye.z-a.z;b=h(J*J+y*y+I*I);F=-a.x/b||0;J=this.w_2+this.Ox+n.scale*(a.y+F*(n.eye.y-a.y));y=this.h_2+this.Oy-n.scale*(a.z+F*(n.eye.z-a.z));return{x:J,y:y,z:b}};a.Space3D.prototype.computeColor=function(c,d,e){c.match("rgba")?c=a.RGBAToHexColor(c):c.match("#")&&(c=new a.Color(c.substring(1)));$=a.subtract3D(this.eye,d.average);U=a.norm3D($);la=a.scalarProduct3D($,1/U);this.lights[3]=a.subtract3D(this.light3,d.average);R=a.norm3D(this.lights[3]);for(var f=0,h=this.intensity.length-
1;f<h;f++)S[f]=this.intensity[f]*this.dim;S[3]=this.userIntensity*this.userIntensity/R||0;P=e?this.dim/2:this.dim/4;Q=0;O=0<=d.direction?d.normal:a.scalarProduct3D(d.normal,-1);f=0;for(h=this.lights.length;f<h;f++)e?(Q=Math.max(0,a.dotProduct3D(b(this.lights[f],O),la)),Q*=Q*Q):Q=Math.max(0,a.dotProduct3D(this.lights[f],O)),P+=S[f]*Q;P=Math.min(P,1);M=k(c.r*P);L=k(c.g*P);N=k(c.b*P);return"rgba("+M+","+L+","+N+","+c.a+")"};a.Space3D.prototype.registerMouseAndTouchEvents=function(){function b(a){document.body.focus();
k.click=1;k.evaluator.setVariable(k.id+".mouse_pressed",1);k.parent.deactivateGraphiControls();k.posAnte=k.getCursorPosition(a);k.oldMouse.x=k.getRelativeX(k.posAnte.x);k.oldMouse.y=k.getRelativeY(k.posAnte.y);f(a);window.addEventListener("touchmove",g);window.addEventListener("touchend",c);a.preventDefault()}function c(a){document.body.focus();k.click=0;k.evaluator.setVariable(k.id+".mouse_pressed",0);window.removeEventListener("touchmove",g,!1);window.removeEventListener("touchend",c,!1);a.preventDefault()}
function d(b){document.body.focus();k.click=1;k.parent.deactivateGraphiControls();k.whichButton=a.whichButton(b);"R"===k.whichButton?(window.addEventListener("mouseup",e),k.clickPosForObserver=k.getCursorPosition(b).x,k.clickPosForObserverNew=k.clickPosForObserver,k.clickPosForZoom=k.getCursorPosition(b).y,k.clickPosForZoomNew=k.clickPosForZoom,k.fixed||(k.tempScale=k.scale,k.tempObserver=k.observer,window.addEventListener("mousemove",h))):"L"==k.whichButton&&(k.evaluator.setVariable(k.id+".mouse_pressed",
1),k.posAnte=k.getCursorPosition(b),k.oldMouse.x=k.getRelativeX(k.posAnte.x),k.oldMouse.y=k.getRelativeY(k.posAnte.y),f(b),window.addEventListener("mousemove",g),window.addEventListener("mouseup",e));b.preventDefault()}function e(b){document.body.focus();k.click=0;k.evaluator.setVariable(k.id+".mouse_pressed",0);b.preventDefault();"R"===k.whichButton&&(window.removeEventListener("mousemove",h,!1),k.clickPosForZoom==k.clickPosForZoomNew&&a.showConfig&&k.parent.externalSpace.show());window.removeEventListener("mousemove",
g,!1);window.removeEventListener("mouseup",e,!1)}function f(a){k.posAnte=k.getCursorPosition(a);k.mouse_x=k.getRelativeX(k.posAnte.x);k.mouse_y=k.getRelativeY(k.posAnte.y);k.evaluator.setVariable(k.id+".mouse_x",k.mouse_x);k.evaluator.setVariable(k.id+".mouse_y",k.mouse_y);70<Date.now()-l&&(k.parent.update(),l=Date.now())}function h(a){a.preventDefault();k.clickPosForZoomNew=k.getCursorPosition(a).y;k.evaluator.setVariable(k.scaleStr,k.tempScale+k.tempScale/45*((k.clickPosForZoom-k.clickPosForZoomNew)/
10));k.clickPosForObserverNew=k.getCursorPosition(a).x;k.evaluator.setVariable(k.obsStr,k.tempObserver-2.5*(k.clickPosForObserver-k.clickPosForObserverNew));k.parent.update()}function g(b){if(!k.fixed&&k.click){E=parseInt(50*(k.oldMouse.x-k.mouse_x));B=parseInt(50*(k.oldMouse.y-k.mouse_y));if(E!==k.disp.x||B!==k.disp.y)k.alpha=a.degToRad(k.evaluator.getVariable(k.rotZStr)),k.beta=a.degToRad(-k.evaluator.getVariable(k.rotYStr)),k.alpha=t(a.radToDeg(k.alpha)-E),k.beta=t(a.radToDeg(k.beta)-B),k.evaluator.setVariable(k.rotZStr,
k.alpha),k.evaluator.setVariable(k.rotYStr,-k.beta),k.disp.x=E,k.disp.y=B,k.oldMouse.x=k.getRelativeX(k.posAnte.x),k.oldMouse.y=k.getRelativeY(k.posAnte.y);f(b);b.preventDefault()}}var k=this,l=0;A=a.hasTouchSupport;this.canvas.oncontextmenu=function(){return!1};A&&this.canvas.addEventListener("touchstart",b);A||this.canvas.addEventListener("mousedown",d);this.disp={x:0,y:0}};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var f;a.SpaceAP=function(g,c){a.Space.call(this,g,
c);this.exportarVars=this.importarVars=null;f=g.evaluator;this.file.match(/^\[/)&&this.file.match(/\]$/)?this.file=f.parser.parse(this.file.substring(1,this.file.length-1)):this.file.match(/^\'/)&&this.file.match(/\'$/)?this.file=f.parser.parse(this.file):this.file=f.parser.parse("'"+this.file+"'");this.oldFile=f.evalExpression(this.file);this.initFile()};a.extend(a.SpaceAP,a.Space);a.SpaceAP.prototype.initFile=function(){this.firstUpdate=!0;var f;if(this.oldFile){var c=document.getElementById(this.oldFile);
f=c&&"descartes/spaceApFile"==c.type?c.text:a.openExternalFile(this.oldFile);null!=f&&(f=f.split("\n"))}if(f&&f.toString().match(/<applet/gi)){for(var c="",e=!1,b=0,k=f.length;b<k&&(f[b].match("<applet")&&(e=!0),e&&(c+=f[b]),!f[b].match("</applet"));b++);b=document.createElement("div");b.innerHTML=c;b.firstChild.setAttribute("width",this.w);b.firstChild.setAttribute("height",this.h);c=this.descApp?this.descApp.container:null;this.descApp=new a.DescartesApp(b.firstChild);this.descApp.container.setAttribute("class",
"DescartesAppContainer");this.descApp.container.setAttribute("style","position: absolute; overflow: hidden; background-color: "+this.background+"; width: "+this.w+"px; height: "+this.h+"px; left: "+this.x+"px; top: "+this.y+"px; z-index: "+this.zIndex+";");c?this.parent.container.replaceChild(this.descApp.container,c):this.parent.container.insertBefore(this.descApp.container,this.parent.loader);c=this.descApp.spaces;b=0;for(k=c.length;b<k;b++)c[b].findOffset();this.descApp.container.style.display=
0<this.evaluator.evalExpression(this.drawif)?"block":"none";var t=this;this.descApp.update=function(){this.updateAuxiliaries();this.updateEvents();this.updateControls();this.updateSpaces();t.exportar()}}else c=this.descApp?this.descApp.container:null,this.descApp={},this.descApp.container=document.createElement("div"),this.descApp.container.setAttribute("class","DescartesAppContainer"),b="position: absolute; overflow: hidden; background-color: "+this.background+"; width: "+this.w+"px; height: "+this.h+
"px; left: "+this.x+"px; top: "+this.y+"px; z-index: "+this.zIndex+";",this.image&&("topleft"==this.bg_display?b+="background-image: url("+this.imageSrc+"); background-repeat:no-repeat;":"stretch"==this.bg_display?b+="background-image: url("+this.imageSrc+"); background-repeat:no-repeat; background-size: 100% 100%;":"patch"==this.bg_display?b+="background-image: url("+this.imageSrc+");":"imgcenter"==this.bg_display&&(b+="background-image: url("+this.imageSrc+"); background-repeat:no-repeat; background-position: center center;")),
this.descApp.container.setAttribute("style",b),c?this.parent.container.replaceChild(this.descApp.container,c):this.parent.container.insertBefore(this.descApp.container,this.parent.loader),this.descApp.container.style.display=0<this.evaluator.evalExpression(this.drawif)?"block":"none"};a.SpaceAP.prototype.update=function(){var a=this.evaluator.evalExpression(this.file);if(this.oldFile!=a)this.oldFile=a,this.initFile();else{var a=this.x!=this.evaluator.evalExpression(this.xExpr),c=this.y!=this.evaluator.evalExpression(this.yExpr)+
this.plecaHeight;this.x=a?this.evaluator.evalExpression(this.xExpr):this.x;this.y=c?this.evaluator.evalExpression(this.yExpr)+this.plecaHeight:this.y;a&&(this.descApp.container.style.left=this.x+"px");c&&(this.descApp.container.style.top=this.y+"px");if(a||c)for(var a=this.descApp.spaces,c=0,e=a.length;c<e;c++)a[c].findOffset();this.descApp.container.style.display=0<this.evaluator.evalExpression(this.drawif)?"block":"none";if(this.firstUpdate&&(this.firstUpdate=!1,null==this.importarVars)){this.importarVars=
[];for(var b in this.evaluator.variables)this.evaluator.variables.hasOwnProperty(b)&&b.match(/^public./)&&this.importarVars.push({varName:b,value:this.evaluator.getVariable(b)})}this.importar()}};a.SpaceAP.prototype.importar=function(){for(var a,c=!1,e=0,b=this.importarVars.length;e<b;e++)a=this.evaluator.getVariable(this.importarVars[e].varName),a!=this.importarVars[e].value&&(this.importarVars[e].value=a,this.descApp.evaluator.setVariable(this.importarVars[e].varName,this.importarVars[e].value),
c=!0);c&&this.descApp.update()};a.SpaceAP.prototype.exportar=function(){};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var f,g,c,e,b;a.SpaceHTML_IFrame=function(b,c){a.Space.call(this,b,c);var d=this.parent.evaluator;if(void 0!=this._w_){var e=d.parser.parse(this._w_);this._w_="number"!=e.type?e:void 0}void 0!=this._h_&&(e=d.parser.parse(this._h_),this._h_="number"!=e.type?e:void 0);this.isFirefox=window.navigator.userAgent.toLowerCase().match(/firefox/);this.file=this.file?
this.file.trim():"";this.file.match(/^\[/)&&this.file.match(/\]$/)?this.file=d.parser.parse(this.file.substring(1,this.file.length-1)):this.file.match(/^\'/)&&this.file.match(/\'$/)?this.file=d.parser.parse(this.file):this.file=d.parser.parse("'"+this.file+"'");this.oldFile=d.evalExpression(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: 0px; top: 0px;");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 f=this;this.MyIFrame.onload=function(a){var b=this;f.evaluator.setFunction(f.id+".set",function(a,c){b.contentWindow.postMessage({type:"set",name:a,value:c},"*");return 0});f.evaluator.setFunction(f.id+".update",function(){b.contentWindow.postMessage({type:"update"},
"*");return 0});f.evaluator.setFunction(f.id+".exec",function(a,c){b.contentWindow.postMessage({type:"exec",name:a,value:c},"*");return 0});f.ImReady=!f.isFirefox;f.isFirefox||(f.container.style.visibility="visible",f.container.style.opacity="1",f.container.style.zIndex=f.zIndex,f.container.style.display=f.drawIfValue?"block":"none");f.MyIFrame.style.visibility="visible";f.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(){b=this;b.uber.init.call(b);b.MyIFrame&&(b.MyIFrame.style.width=b.w+"px",b.MyIFrame.style.height=b.h+"px",b.MyIFrame.style.left=b.x+"px",b.MyIFrame.style.top=b.y+"px")};a.SpaceHTML_IFrame.prototype.iframeUpdate=function(a){f=this.evaluator;this.drawIfValue=0<f.evalExpression(this.drawif);this.ImReady?this.container.style.display=this.drawIfValue?"block":"none":(this.container.style.visibility=this.drawIfValue?"visible":"hidden",this.container.style.opacity=
this.drawIfValue?"1":"0",this.container.style.zIndex=this.drawIfValue?this.zIndex:-1E3);if(this.drawIfValue){a&&(this.y=this.x=Infinity);g=this.x!==f.evalExpression(this.xExpr)+this.displaceRegionWest;c=this.y!==f.evalExpression(this.yExpr)+this.parent.plecaHeight+this.displaceRegionNorth;this.x=g?f.evalExpression(this.xExpr)+this.displaceRegionWest:this.x;this.y=c?f.evalExpression(this.yExpr)+this.parent.plecaHeight+this.displaceRegionNorth:this.y;void 0!=this._w_&&(a=f.evalExpression(this._w_),
this.w!==a&&(this.container.style.width=a+"px",this.MyIFrame.style.width=a+"px",this.w=a));void 0!=this._h_&&(a=f.evalExpression(this._h_),this.h!==a&&(this.container.style.height=a+"px",this.MyIFrame.style.height=a+"px",this.h=a));if(g||c)this.container.style.left=this.x+"px",this.container.style.top=this.y+"px";e=f.evalExpression(this.file);e!==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=e,this.MyIFrame.setAttribute("src",e));this.scrollVar=f.getVariable(this.id+"._scroll");1==this.scrollVar?(this.MyIFrame.setAttribute("scrolling","yes"),this.MyIFrame.style.overflow=""):-1==this.scrollVar?(this.MyIFrame.setAttribute("scrolling","no"),this.MyIFrame.style.overflow=
"hidden"):(this.MyIFrame.setAttribute("scrolling","auto"),this.MyIFrame.style.overflow="")}};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var f,g,c;a.DescartesLoader=function(a){this.children=a.children;this.lessonParser=a.lessonParser;this.images=a.images;this.images.length=a.images.length;this.audios=a.audios;this.audios.length=a.audios.length;this.arquimedes=a.arquimedes;this.descartesApp=a;var c=a.image_loader?a.image_loader:e(a.loader.width,a.loader.height);this.imageLoader=
document.createElement("div");this.imageLoader.width=a.width;this.imageLoader.height=a.height;this.imageLoader.setAttribute("class","DescartesLoaderImage");this.imageLoader.setAttribute("style","background-image: url("+c+"); background-size:cover; width: "+a.width+"px; height: "+a.height+"px;");a.loader.appendChild(this.imageLoader);this.loaderBar=document.createElement("canvas");this.loaderBar.width=a.width;this.loaderBar.height=a.height;this.loaderBar.setAttribute("class","DescartesLoaderBar");
this.loaderBar.setAttribute("style","width: "+a.width+"px; height:"+a.height+"px;");this.loaderBar.ctx=this.loaderBar.getContext("2d");a.loader.appendChild(this.loaderBar);this.barWidth=80;this.barHeight=Math.floor(a.loader.height/70);var f=this;this.timer=setInterval(function(){f.drawLoaderBar(f.loaderBar.ctx,a.width,a.height)},10);a.firstRun=!1;this.initPreloader()};a.DescartesLoader.prototype.initPreloader=function(){var b=this.children,c=this.images,e=this.audios,d=/[\w\.\-//]*(\.png|\.jpg|\.gif|\.svg)/gi,
f=/[\w\.\-//]*(\.ogg|\.oga|\.mp3|\.wav)/gi;this.arquimedes&&(c["lib/DescartesCCLicense.png"]=a.getCreativeCommonsLicenseImage(),c["lib/DescartesCCLicense.png"].addEventListener("load",function(){this.ready=1}),c["lib/DescartesCCLicense.png"].addEventListener("error",function(){this.errorload=1}));var g,h,r,s,p,l;r=0;for(p=b.length;r<p;r++)if("rtf"!==b[r].name){if(b[r].value.match(/'macro'|'makro'/g)){s="";var u;g=this.lessonParser.split(b[r].value);h=0;for(l=g.length;h<l;h++)"expresion"===babel[g[h][0]]&&
(s=g[h][1]);s&&((u=document.getElementById(s))&&"descartes/macro"==u.type?u=u.text:(u=a.openExternalFile(s))&&!u.match(/tipo_de_macro/g)&&(u=null));if(u&&(g=u.match(d)))for(s=0,l=g.length;s<l;s++)h=g[s],h.toLowerCase().match(/vacio.gif$/)||""==h.substring(0,h.length-4)||(c[h]=new Image,c[h].addEventListener("load",function(){this.ready=1}),c[h].addEventListener("error",function(){this.errorload=1}),c[h].src=h)}if(g=b[r].value.match(d))for(s=0,l=g.length;s<l;s++)h=g[s],h.toLowerCase().match(/vacio.gif$/)||
""==h.substring(0,h.length-4)||(c[h]=new Image,c[h].addEventListener("load",function(){this.ready=1}),c[h].addEventListener("error",function(){this.errorload=1}),c[h].src=h);if(g=b[r].value.match(f))for(s=0,h=g.length;s<h;s++)this.initAudio(g[s])}for(var n in c)c.hasOwnProperty(n)&&this.images.length++;for(n in e)e.hasOwnProperty(n)&&this.audios.length++;var v=this,w=this.images.length+this.audios.length;this.sep=2*(this.barWidth-2)/w;var z=function(){v.readys=0;for(var a in c)c.hasOwnProperty(a)&&
(c[a].ready||c[a].errorload)&&v.readys++;for(a in v.audios)e.hasOwnProperty(a)&&(e[a].ready||e[a].errorload)&&v.readys++;v.readys!=w?setTimeout(z,30):(clearTimeout(v.timer),v.descartesApp.initBuildApp())};z()};a.DescartesLoader.prototype.initAudio=function(b){var c=this.audios;c[b]=new Audio(b);c[b].filename=b;var e=function(){this.ready=1},d=function(){this.canPlayType("audio/"+this.filename.substring(this.filename.length-3))||"mp3"!=this.filename.substring(this.filename.length-3)?(console.log("El archivo '"+
b+"' no puede ser reproducido"),this.errorload=1):(c[b]=new Audio(this.filename.replace("mp3","ogg")),c[b].filename=this.filename.replace("mp3","ogg"),c[b].addEventListener("canplaythrough",e),c[b].addEventListener("load",e),c[b].addEventListener("error",d),c[b].load())};c[b].addEventListener("canplaythrough",e);c[b].addEventListener("load",e);c[b].addEventListener("error",d);a.hasTouchSupport?(c[b].load(),c[b].play(),setTimeout(function(){c[b].pause()},20),c[b].ready=1):c[b].load()};a.DescartesLoader.prototype.drawLoaderBar=
function(a,e,t){g=this.barWidth;c=this.barHeight;a.translate(e/2,(t-65*f)/2+90*f);a.scale(f,f);a.strokeRect(-g,-c,2*g,c);a.fillStyle="#888";a.fillRect(-g+2,-c+2,2*(g-2),c-4);a.fillStyle="#1f358d";a.fillRect(-g+2,-c+2,this.readys*this.sep,c-4);a.setTransform(1,0,0,1,0,0)};var e=function(b,c){var e=document.createElement("canvas"),d=5E6<b*a._ratio*c*a._ratio?1:a._ratio;e.width=b*d;e.height=c*d;e.style.width=b+"px";e.style.height=c+"px";var g=e.getContext("2d");g.save();g.setTransform(d,0,0,d,0,0);g.strokeStyle=
g.fillStyle="#1f358d";g.lineCap="round";g.lineWidth=2;g.beginPath();f=b<c?b/360:c/195;f=2.5<f?2.5:f;g.translate((b-120*f)/2,(c-65*f)/2);g.scale(f,f);g.moveTo(3,25);g.lineTo(3,1);g.lineTo(21,1);g.bezierCurveTo(33,1,41,15,41,25);g.stroke();g.beginPath();g.moveTo(1,63);g.lineTo(1,64);g.moveTo(5,62);g.lineTo(5,64);g.moveTo(9,61);g.lineTo(9,64);g.moveTo(13,60);g.lineTo(13,64);g.moveTo(17,58);g.lineTo(17,64);g.moveTo(21,56);g.lineTo(21,64);g.moveTo(25,53);g.lineTo(25,64);g.moveTo(29,50);g.lineTo(29,64);
g.moveTo(33,46);g.lineTo(33,64);g.moveTo(37,41);g.lineTo(37,64);g.moveTo(41,32);g.lineTo(41,64);g.stroke();g.font="20px descartesJS_sansserif, Arial, Helvetica, Sans-serif";g.fillText("escartes",45,33);g.fillText("JS",98,64);g.restore();return e.toDataURL()};return a}(descartesJS||{}),descartesJS=function(a){function f(a){for(var e="[",b=0,k=a.length;b<k;b++)a[b]instanceof Array?e+=f(a[b]):(g=a[b],"undefined"!=typeof g&&g||(g=0),"string"==typeof g&&(g="'"+g+"'"),e+=g),b<k-1&&(e+=",");return e+"]"}
if(a.loadLib)return a;a.DescartesApp=function(c){this.animation={playing:!1,stop:function(){}};this.applet=c;this.parentContainer=c.parentNode;this.width=parseFloat(c.getAttribute("width"));this.height=parseFloat(c.getAttribute("height"));this.decimal_symbol=".";this.decimal_symbol_regexp=new RegExp("\\"+this.decimal_symbol,"g");this.language="espa\u00f1ol";this.children=c.getElementsByTagName("param");a.creativeCommonsLicense=!0;for(var e=0,b=this.children.length;e<b;e++)"CreativeCommonsLicense"===
this.children[e].name&&(a.creativeCommonsLicense="no"===this.children[e].value?!1:!0);this.code=c.getAttribute("code");this.saveState=[];this.images={};this.images.length=-1;this.audios={};this.audios.length=-1;this.firstRun=!0;this.init()};a.DescartesApp.prototype.init=function(){this.stop();this.evaluator=new a.Evaluator(this);this.lessonParser=new a.LessonParser(this);this.arquimedes=!!this.code.match(/descinst.DescartesWeb2_0.class/i)||!!this.code.match(/Arquimedes/i)||!!this.code.match(/Discurso/i);
this.licenseA=a.creativeCommonsLicense?"{\\rtf1\\uc0{\\fonttbl\\f0\\fcharset0 Arial;\\f1\\fcharset0 Arial;\\f2\\fcharset0 Arial;\\f3\\fcharset0 Arial;\\f4\\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 c=this.children,e,b=0,f=0,g=a.creativeCommonsLicense?90:0,d=0,m=c.length;d<m;d++)e=c[d],"rtf_height"==e.name&&(b=parseInt(e.value)||this.height),"Buttons"==babel[e.name]&&(this.buttonsConfig=this.lessonParser.parseButtonsConfig(e.value),f=this.buttonsConfig.height),"image_loader"==e.name&&(this.image_loader=e.value),"expand"==e.name&&(this.expand=e.value),"docBase"==e.name&&(this.docBase=e.value,e=document.createElement("base"),e.setAttribute("id","descartesJS_base"),e.setAttribute("href",
this.docBase),document.head.appendChild(e));this.expand&&"cover"==this.expand&&(this.width=window.innerWidth,this.height=window.innerHeight);this.arquimedes&&b&&(this.height=b+f+g);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.cacheVars={};this.getVarsNames={};this.numberOfIframes=this.plecaHeight=this.tabindex=this.zIndex=0;void 0!=this.container&&this.parentContainer.removeChild(this.container);this.container=document.createElement("div");this.loader=document.createElement("div");
this.parentContainer.appendChild(this.container);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.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.image_loader&&(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 c=this.children,e=this.lessonParser,b=[],f=[],g=[],d=[],m=[],q=[],h,r=0,s=c.length;r<s;r++)if(h=c[r],"editable"==babel[h.name]&&(a.showConfig="false"==babel[h.value]?!1:!0),"language"==babel[h.name]&&(this.language=h.value),"pleca"==h.name)h=e.parsePleca(h.value,this.width),
this.container.insertBefore(h,this.loader),this.plecaHeight=h.imageHeight?h.imageHeight:h.offsetHeight;else if("Buttons"==babel[h.name])this.buttonsConfig=e.parseButtonsConfig(h.value);else if("decimal_symbol"==babel[h.name])this.decimal_symbol=h.value,this.decimal_symbol_regexp=new RegExp("\\"+this.decimal_symbol,"g");else if("version"==babel[h.name])this.version=parseInt(h.value);else if("language"==babel[h.name])this.language=h.value;else if("rtf"==h.name){var p=(this.width-780)/2,l=parseInt(this.height)-
this.plecaHeight-this.buttonsConfig.height-45;d.push("space='descartesJS_scenario' type='text' expresion='[10,20]' background='yes' text='"+h.value.replace(/'/g,"&squot;")+"'");d.push("space='descartesJS_scenario' type='text' expresion='["+p+","+(l-25)+"]' background='yes' text='"+this.licenseA+"'");a.creativeCommonsLicense&&d.push("space='descartesJS_scenario' type='image' expresion='["+(p+15)+","+l+"]' background='yes' abs_coord='yes' file='lib/DescartesCCLicense.png'")}else"E"==h.name.charAt(0)?
(h.value.match(/'HTMLIFrame'/)&&this.numberOfIframes++,b.push(h.value)):"C"==h.name.charAt(0)&&"_"==h.name.charAt(1)?f.push(h.value):"A"==h.name.charAt(0)&&"_"==h.name.charAt(1)?g.push(h.value):"G"==h.name.charAt(0)?d.push(h.value):"S"==h.name.charAt(0)?m.push(h.value):"Animation"==babel[h.name]&&q.push(h.value);this.scenarioRegion={container:document.createElement("div"),scroll:0};this.scenarioRegion.container.setAttribute("id","descartesJS_Scenario_Region");this.scenarioRegion.scenarioSpace=this.lessonParser.parseSpace("tipo='R2' id='descartesJS_scenario' fondo='blanco' x='0' y='0' fijo='yes' red='no' red10='no' ejes='no' text='no' ancho='"+
this.width+"' alto='"+this.height+"'");this.scenarioRegion.container.appendChild(this.scenarioRegion.scenarioSpace.container);this.arquimedes&&(this.container.appendChild(this.scenarioRegion.container),this.spaces.push(this.scenarioRegion.scenarioSpace));r=0;for(s=b.length;r<s;r++)c=e.parseSpace(b[r]),this.arquimedes&&this.scenarioRegion.container.appendChild(c.container),this.spaces.push(c),this.zIndex++;r=0;for(s=d.length;r<s;r++)if(b=e.parseGraphic(d[r]))b.visible&&(this.editableRegionVisible=
!0),b.space.addGraph(b);r=0;for(s=m.length;r<s;r++)(b=e.parse3DGraphic(m[r]))&&b.space.addGraph(b,!0);r=0;for(s=f.length;r<s;r++)this.controls.push(e.parseControl(f[r]));r=0;for(s=g.length;r<s;r++)e.parseAuxiliar(g[r]);r=0;for(s=q.length;r<s;r++)this.animation=e.parseAnimation(q[r]);this.configRegions();this.updateAuxiliaries();this.updateAuxiliaries();r=0;for(s=this.controls.length;r<s;r++)this.controls[r].init();this.updateControls();this.updateSpaces(!0);var u=this;this.numberOfIframes?setTimeout(function(){u.finishInit()},
300*this.numberOfIframes):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.parentContainer.style.margin="0px",this.parentContainer.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();if(this.arquimedes&&MathJax){var c=this.scenarioRegion.scenarioSpace.container.style.left,e=this.scenarioRegion.scenarioSpace.container.style.top,b=document.createElement("div");b.setAttribute("style","position:relative; left:"+c+"; top:"+e+"; text-align:left; margin:0; padding:18px 0 0 18px;");c={ctrs:[],spaces:[]};b.innerHTML=this.scenarioRegion.scenarioSpace.backgroundGraphics[0].text.toHTML(c);
this.scenarioRegion.scenarioSpace.container.style.visibility="hidden";this.scenarioRegion.scenarioSpace.container.style.display="none";this.scenarioRegion.container.replaceChild(b,this.scenarioRegion.scenarioSpace.container);this.scenarioRegion.container.style.background="#fff";this.container.style.height="100%";this.scenarioRegion.container.style.height="100%";this.container.style.overflow="visible";e=document.createElement("div");e.setAttribute("style","padding-bottom:25px;");e.innerHTML="<br/> <hr style='border-width:2px;'>";
var f=document.createElement("a");f.setAttribute("href","https://creativecommons.org/licenses/by-nc-sa/4.0/");f.setAttribute("target","_blank");e.appendChild(f);var g=a.getCreativeCommonsLicenseImage();g.setAttribute("style","position:absolute; left:30px; padding-top:4px;");f.appendChild(g);f=document.createElement("div");f.setAttribute("style","display:inline-block; width:100%; text-align:left;");f.innerHTML=this.scenarioRegion.scenarioSpace.backgroundGraphics[1].text.toHTML();f.removeChild(f.firstChild);
f.removeChild(f.firstChild);e.appendChild(f);b.appendChild(e);for(e=0;e<c.spaces.length;e++)f=c.spaces[e],f.value.container&&(b=document.getElementById(f.cID),g=f.value.container.style.border,g=""!=g?"border:"+g+";":"",f.value.container.setAttribute("style",g),b.appendChild(f.value.container));for(e=0;e<c.ctrs.length;e++)if(f=c.ctrs[e],g=f.value.containerControl||f.value.container)b=document.getElementById(f.cID),g.setAttribute("style","width:"+f.value.w+"px; height:"+f.value.h+"px;"),b.appendChild(g);
MathJax.Hub.Queue(["Typeset",MathJax.Hub])}};a.DescartesApp.prototype.adjustSize=function(){document.body.style.margin="0px";document.body.style.padding="0px";this.parentContainer.style.margin="0px";this.parentContainer.style.padding="0px";var c=parseInt(this.width)+30,e=parseInt(this.height)+90;window.moveTo((parseInt(screen.width)-c)/2,(parseInt(screen.height)-e)/2);window.resizeTo(c,e);a.onResize()};a.DescartesApp.prototype.adjustDimensions=function(){var a,e,b;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);e=parseInt(this.parentContainer.offsetWidth);a=this.init_w;b=e/a;a>e?(this.parentContainer!=document.body&&(this.parentContainer.style.height=this.init_h*b+"px"),this.percent=b,this.container.style.webkitTransform=this.container.style.MozTransform="scale("+b+")",this.container.style.webkitTransformOrigin=this.container.style.MozTransformOrigin="top left"):(this.parentContainer!=document.body&&
(this.parentContainer.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 c=this.evaluator.parser,e=this.buttonsConfig,b=this.container;if(2!=this.version)var f="15",g=100,d=100,m=100,q=100;else f="14",g=63,d=50,m=44,q=53;var h=0,r=0,s=0,p=s=0,l=0,u=0,n=0,v=0,u=this.northSpace.controls,w=this.southSpace.controls,
z=this.eastSpace.controls,C=this.westSpace.controls;if(0<e.rowsNorth||0<u.length||e.about||e.config){0>=e.rowsNorth?(h=e.height,e.rowsNorth=1):h=e.height*e.rowsNorth;l=this.northSpace.container;l.setAttribute("id","descartesJS_northRegion");l.setAttribute("style","width:"+b.width+"px; height:"+h+"px; background:#c0c0c0; position:absolute; left:0px; top: "+this.plecaHeight+"px; z-index:100;");b.insertBefore(l,this.loader);var l=b.width,A=0;e.about?(A=g,l-=A):g=0;e.config&&(l-=d);for(var D=Math.ceil(u.length/
e.rowsNorth),G=l/D,s=0,E=u.length;s<E;s++)u[s].expresion=c.parse("("+(A+s%D*G)+","+e.height*Math.floor(s/D)+","+G+","+e.height+")"),u[s].drawif=c.parse("1"),u[s].init();e.about&&(s="espa\u00f1ol"==this.language?"cr\u00e9ditos":"english"==this.language?"about":"cr\u00e9ditos",s=new a.Button(this,{region:"north",name:s,font_size:c.parse(f),expresion:c.parse("(0, 0, "+g+", "+h+")")}),s.actionExec={execute:a.showAbout},s.update());e.config&&(new a.Button(this,{region:"north",name:"config",font_size:c.parse(f),
action:"config",expresion:c.parse("("+(l+g)+", 0, "+d+", "+h+")")})).update()}if(0<e.rowsSouth||0<w.length||e.init||e.clear){0>=e.rowsSouth?(r=e.height,e.rowsSouth=1):r=e.height*e.rowsSouth;u=b.width;A=0;e.init?(A=m,u-=A):m=0;e.clear&&(u-=q);l=this.southSpace.container;l.setAttribute("id","descartesJS_southRegion");l.setAttribute("style","width:"+b.width+"px; height:"+r+"px; background:#c0c0c0; position:absolute; left: 0px; top:"+(b.height-r)+"px; z-index:100;");b.insertBefore(l,this.loader);D=Math.ceil(w.length/
e.rowsSouth);G=u/D;s=0;for(E=w.length;s<E;s++)w[s].expresion=c.parse("("+(A+s%D*G)+","+e.height*Math.floor(s/D)+","+G+","+e.height+")"),w[s].drawif=c.parse("1"),w[s].init();e.init&&(s="espa\u00f1ol"==this.language?"inicio":"english"==this.language?"init":"inicio",(new a.Button(this,{region:"south",name:s,font_size:c.parse(f),action:"init",expresion:c.parse("(0, 0, "+m+", "+r+")")})).update());e.clear&&(s="espa\u00f1ol"==this.language?"limpiar":"english"==this.language?"clear":"limpiar",(new a.Button(this,
{region:"south",name:s,font_size:c.parse(f),action:"clear",expresion:c.parse("("+(u+m)+", 0, "+q+", "+r+")")})).update())}if(0<z.length)for(s=b.height-h-r,n=e.widthEast,l=this.eastSpace.container,l.setAttribute("id","descartesJS_eastRegion"),l.setAttribute("style","width:"+n+"px; height:"+s+"px; background:#c0c0c0; position:absolute; left:"+(b.width-n)+"px; top:"+h+"px; z-index:100;"),b.insertBefore(l,this.loader),s=0,E=z.length;s<E;s++)z[s].expresion=c.parse("(0,"+e.height*s+","+n+","+e.height+")"),
z[s].drawif=c.parse("1"),z[s].init();if(0<C.length)for(s=b.height-h-r,v=e.widthWest,l=this.westSpace.container,l.setAttribute("id","descartesJS_westRegion"),l.setAttribute("style","width: "+v+"px; height: "+s+"px; background: #c0c0c0; position: absolute; left: 0px; top: "+h+"px; z-index: 100;"),b.insertBefore(l,this.loader),s=0,E=C.length;s<E;s++)C[s].expresion=c.parse("(0,"+e.height*s+","+v+","+e.height+")"),C[s].drawif=c.parse("1"),C[s].init();if(this.editableRegionVisible)for(p=e.height,l=this.editableRegion.container,
l.setAttribute("id","descartesJS_editableRegion"),l.setAttribute("style","width:"+b.width+"px; height:"+p+"px; position:absolute; left:0px; top:"+(b.height-r-e.height)+"px; z-index:100; background:#c0c0c0; overflow:hidden;"),b.insertBefore(l,this.loader),c=this.editableRegion.textFields,e=b.width/c.length,f=a.getFieldFontSize(p),s=0,E=c.length;s<E;s++)"div"==c[s].type?(l.appendChild(c[s].container),c[s].container.setAttribute("style","font-family: Arial, Helvetica, 'Droid Sans', Sans-serif; width: "+
(e-4)+"px; height: "+p+"px; position: absolute; left: "+s*e+"px; top: 0px;"),g=c[s].container.firstChild,g.setAttribute("style","font-family: Arial, Helvetica, 'Droid Sans', Sans-serif; font-size: "+f+"px; padding-top: 0%; background-color: #e0e4e8; position: absolute; left: 0px; top: 0px; height:"+p+"px; text-align: center; line-height: "+p+"px;"),d=g.offsetWidth,g.style.width=d+"px",g.firstChild.textContent=g.firstChild.textContent.substring(3,g.firstChild.textContent.length-3),c[s].container.lastChild.setAttribute("style",
"font-family:'Courier New', Courier, 'Droid Sans Mono', Monospace; font-size: "+f+"px; width:"+(e-d)+"px; height:"+p+"px; position:absolute; left:"+d+"px; top:0px; border:2px groove white;")):(l.appendChild(c[s]),c[s].setAttribute("style","font-family:'Courier New', Courier, 'Droid Sans Mono', Monospace; font-size: "+f+"px; width:"+e+"px; height:"+p+"px; position:absolute; left:"+s*e+"px; top:0px; border:2px groove white;"));this.displaceRegionNorth=h;this.displaceRegionWest=v;b.width-=n;b.height=
b.height-r-p;s=0;for(E=this.spaces.length;s<E;s++)this.spaces[s].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,e=this.spaces.length;a<e;a++)this.spaces[a].clearClick()};a.DescartesApp.prototype.deactivateGraphiControls=function(){for(var a,e=0,b=this.controls.length;e<b;e++)a=this.controls[e],"graphic"==a.type&&a.deactivate()};
a.DescartesApp.prototype.updateAuxiliaries=function(){for(var a=0,e=this.auxiliaries.length;a<e;a++)this.auxiliaries[a].update()};a.DescartesApp.prototype.updateEvents=function(){for(var a=0,e=this.events.length;a<e;a++)this.events[a].update()};a.DescartesApp.prototype.updateControls=function(){for(var a=0,e=this.controls.length;a<e;a++)this.controls[a].update()};a.DescartesApp.prototype.updateSpaces=function(a){for(var e=0,b=this.spaces.length;e<b;e++)this.spaces[e].update(a)};a.DescartesApp.prototype.clear=
function(){for(var a=0,e=this.spaces.length;a<e;a++)this.spaces[a].spaceChange=!0,this.spaces[a].drawBackground&&this.spaces[a].drawBackground()};a.DescartesApp.prototype.play=function(){this.animation&&this.animation.play()};a.DescartesApp.prototype.stop=function(){this.animation&&this.animation.stop()};a.DescartesApp.prototype.reinitAnimation=function(){this.animation&&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 e=this.images;if(a)return e[a]||(e[a]=new Image,e[a].addEventListener("load",function(){this.ready=1}),e[a].addEventListener("error",function(){this.ready=0;this.errorload=1}),e[a].src=a),e[a]};a.DescartesApp.prototype.getAudio=function(a){var e=this.audios;if(a){if(!e[a]){var b=a.lastIndexOf("."),b=-1===b?a.lenght:b;a.substring(0,b);e[a]=new Audio(a);var f=function(a){this.ready=
1};e[a].addEventListener("canplaythrough",f);var g=function(b){this.canPlayType("audio/"+a.substring(a.length-3))||"mp3"!=a.substring(a.length-3)?(console.log("El archivo '"+a+"' no puede ser reproducido"),this.errorload=1):(e[a]=new Audio(a.replace("mp3","ogg")),e[a].addEventListener("canplaythrough",f),e[a].addEventListener("load",f),e[a].addEventListener("error",g),e[a].load())};e[a].addEventListener("error",g);e[a].play();setTimeout(function(){e[a].pause()},15)}return e[a]}return new Audio};a.DescartesApp.prototype.getControlByCId=
function(a){for(var e,b=0,f=this.controls.length;b<f;b++)if(e=this.controls[b],e.cID==a)return e;return{update:function(){},w:0}};a.DescartesApp.prototype.getControlById=function(a){for(var e,b=0,f=this.controls.length;b<f;b++)if(e=this.controls[b],e.id==a)return e;return{update:function(){}}};a.DescartesApp.prototype.getSpaceByCId=function(a){for(var e,b=0,f=this.spaces.length;b<f;b++)if(e=this.spaces[b],e.cID==a)return e;return{update:function(){},w:0}};a.DescartesApp.prototype.getSpaceById=function(a){for(var e,
b=0,f=this.spaces.length;b<f;b++)if(e=this.spaces[b],e.id==a)return e;return{update:function(){},w:0}};var g;a.DescartesApp.prototype.getState=function(){var a,e="",b=this.evaluator.variables,g;for(g in b)b.hasOwnProperty(g)&&(a=b[g],"string"==typeof a&&(a="'"+a+"'"),void 0!=a&&"rnd"!=g&&"pi"!=g&&"e"!=g&&"Infinity"!=g&&"-Infinity"!=g&&"object"!=typeof a&&(e=""!=e?e+"\n"+g+"="+a:g+"="+a));var b=this.evaluator.vectors,t;for(t in b)b.hasOwnProperty(t)&&(a=b[t],e=e+"\n"+t+"="+f(a));t=this.evaluator.matrices;
for(var d in t)t.hasOwnProperty(d)&&(a=t[d],e=e+"\n"+d+"="+f(a));return e};a.DescartesApp.prototype.setState=function(a,e){for(var b=a.split("\n"),f,g,d=0,m=b.length;d<m;d++)f=b[d].split("="),2<=f.length&&(g=eval(f[1]),-1!=f[1].indexOf("[[")?(this.evaluator.matrices[f[0]]=g,this.evaluator.matrices[f[0]].rows=g.length,this.evaluator.matrices[f[0]].cols=g[0].length):-1!=f[1].indexOf("[")?(this.evaluator.vectors[f[0]]=g,this.evaluator.variables[f[0]+".long"]=g.length):this.evaluator.variables[f[0]]=
g);e||this.update()};a.DescartesApp.prototype.getEvaluation=function(){for(var a=0,e=0,b="",f=0,g=this.controls.length;f<g;f++)"textfield"==this.controls[f].gui&&this.controls[f].evaluate&&(a++,e+=this.controls[f].ok,this.controls[f].value=""==this.controls[f].value?"''":this.controls[f].value,b+=" \\n "+this.controls[f].id+"="+this.controls[f].value+"|"+this.controls[f].ok);return"questions="+a+" \\n correct="+e+" \\n wrong="+(a-e)+b};a.DescartesApp.prototype.showSolution=function(){for(var a=this.controls,
e=0,b=a.length;e<b;e++)"textfield"==a[e].gui&&a[e].evaluate&&a[e].changeValue(a[e].getFirstAnswer());this.update()};a.DescartesApp.prototype.showAnswer=function(){for(var a=0,e=this.saveState.length;a<e;a++)this.evaluator.evalExpression(this.saveState[a]);this.update()};return a}(descartesJS||{}),descartesJS=function(a){function f(){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 {display:none;} applet {display:none;} ajs.DescartesJS {display:none;} ajs {display:none;}";document.head.appendChild(a)}function g(b){b=document.createElement("div");b.innerHTML='<span style="font:12px descartesJS_serif;visibility:hidden;">_</span><span style="font:12px descartesJS_sansserif;visibility:hidden;">_</span><span style="font:12px descartesJS_monospace;visibility:hidden;">_</span><span style="font:12px descartesJS_extra;visibility:hidden;">_</span>';
document.body.appendChild(b);a.getFeatures();if(a.hasCanvasSupport){window.scrollTo(0,10);for(var c=document.getElementsByTagName("*"),d=[],e=0,f=c.length;e<f;e++)"DescartesAppContainer"==c[e].className&&d.push(c[e]);e=0;for(f=d.length;e<f;e++)d[e].parentNode.removeChild(d[e]);for(var d=document.getElementsByTagName("applet"),e=document.getElementsByTagName("ajs"),c=[],g=0,r=d.length;g<r;g++)f=d[g],(f.getAttribute("code").match("DescartesJS")||f.getAttribute("code").match("descinst.DescartesWeb2_0.class")||
f.getAttribute("code").match("Descartes")||f.getAttribute("code").match("Arquimedes")||f.getAttribute("code").match("Discurso"))&&c.push(f);g=0;for(r=e.length;g<r;g++)f=e[g],(f.getAttribute("code").match("DescartesJS")||f.getAttribute("code").match("descinst.DescartesWeb2_0.class")||f.getAttribute("code").match("Descartes")||f.getAttribute("code").match("Arquimedes")||f.getAttribute("code").match("Discurso"))&&c.push(f);d=0;for(e=c.length;d<e;d++)a.apps.push(new a.DescartesApp(c[d])),c[d].className=
"DescartesJS";window.addEventListener("resize",a.onResize);window.scrollTo(0,0)}else document.getElementById("StyleDescartesApps").innerHTML="applet.DescartesJS {display:block;} applet {display:block;} ajs.DescartesJS {display:block;} ajs {display:block;}";document.body.removeChild(b)}if(a.loadLib)return a;a.apps=[];a.getDescartesApps=function(){return a.apps};window.hasOwnProperty("debugDescartesJS")&&debugDescartesJS||f();a.onResize=function(b){for(var c=0,d=a.apps.length;c<d;c++){b=a.apps[c].spaces;
for(var e=0,f=b.length;e<f;e++)b[e].findOffset()}};a.receiveMessage=function(b){if(0<a.apps.length){var c=b.data;c&&("set"===c.type?"string"==typeof c.value||"number"==typeof c.value?a.apps[0].evaluator.setVariable(c.name,c.value):c.value&&void 0!=c.value.rows?a.apps[0].evaluator.matrices[c.name]=c.value:a.apps[0].evaluator.vectors[c.name]=c.value:"update"===c.type?a.apps[0].update():"exec"===c.type?(b=a.apps[0].evaluator.getFunction(c.name),c=c.value.toString().split(","),b&&b.apply(a.apps[0].evaluator,
c)):"isResizeNeeded"===c.type?b.source.postMessage({type:"doResize"},"*"):"doResize"===c.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.receiveMessage);for(var c=["webkitTransitionEnd","transitionend","oTransitionEnd","MSTransitionEnd"],e=0,b=c.length;e<b;e++)window.addEventListener(c[e],function(b){a.onResize(b)})}return a}(descartesJS||{});
