/*
 Joel Espinosa Longi
 j.longi@gmail.com
 https://github.com/jlongi/DescartesJS
 LGPL - http://www.gnu.org/licenses/lgpl.html
 2014-06-30
*/
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,f){return f.charAt(0).toUpperCase()+f.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(e,f){return a["LANG_"+
(f||"espa\u00f1ol")][e]||e};return a}(babel||{}),descartesJS=function(a){function e(){var a,b,c,g,d,e,h,k,f;Number.prototype.originalToFixed=Number.prototype.toFixed;Number.prototype.toFixed=function(r){try{return this.originalToFixed(r)}catch(m){r=r?r:0;r=0>r?0:parseInt(r);a=this.toString();d=a.indexOf("e");if(-1!==d)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 l=k+"0.",p;p=Math.abs(b+f);p=Array(p+1).join("0");a=l+p+h.replace(".","")}else h=h.replace(".",""),a=k+h+Array(f-h.length+2).join("0");b=a.indexOf(".");c="";if(-1===b)0<r&&(c="."),c+=Array(r+1).join("0"),a+=c;else if(g=a.length-b-1,g>=r)11>=r&&(a=parseFloat(a).originalToFixed(r)),a=0<r?a.substring(0,b+1+r):a.substring(0,b);else{l=0;for(r-=g;l<r;l++)c+="0";a+=c}return a}}}function f(a,b,c){a.fillStyle="#c0c0c0";a.fillRect(b.offsetLeft,b.offsetTop,b.offsetWidth,b.offsetHeight);d(a,b,c.controls)}
function d(a,b,c){for(var g,d=c.length-1;0<=d;d--)g=c[d],a.drawImage(g.getScreenshot(),b.offsetLeft+g.x,b.offsetTop+g.y)}if(a.loadLib)return a;var b=2*Math.PI,c=360/b,h=b/360,g=Math.floor,r,k,p,n,q,s,t,m,u,l;a.rangeOK=1;a.extend=function(a,b){if(a.prototype.__proto__)a.prototype.__proto__=b.prototype;else for(var c in b.prototype)b.prototype.hasOwnProperty(c)&&(a.prototype[c]=b.prototype[c]);a.prototype.uber=b.prototype};a.radToDeg=function(a){return a*c};a.degToRad=function(a){return a*h};a.convertFont=
function(a){if(""==a)return a;r=a.split(",");k="";"bold"==r[1].toLowerCase()?k+="Bold ":"italic"==r[1].toLowerCase()||"italics"==r[1].toLowerCase()?k+="Italic ":"bold+italic"==r[1].toLowerCase()&&(k+="Italic Bold ");p=r[0].split(" ")[0].toLowerCase();k+=r[2]+"px ";return k="serif"===p||"times new roman"===p||"timesroman"===p||"times"===p?k+"liberation_serifregular, 'Times New Roman', Times, serif":"sansserif"===p||"arial"===p||"helvetica"===p?k+"liberation_sansregular, Arial, Helvetica, Sans-serif":
k+"liberation_monoregular, 'Courier New', Courier, Monospace"};a.drawLine=function(a,b,c,d,e,h,k){a.lineWidth=k||1;a.strokeStyle=h||"black";h=a.lineWidth%2?0.5:0;a.beginPath();a.moveTo(g(b)+h,g(c)+h);a.lineTo(g(d)+h,g(e)+h);a.stroke()};a.getColor=function(a,b){if("string"==typeof b)return b;n=a.evalExpression(b);q=g(255*n[0][0]);s=g(255*n[0][1]);t=g(255*n[0][2]);m=1-n[0][3];return"rgba("+q+","+s+","+t+","+m+")"};a.getFeatures=function(){a.hasJavaSupport=navigator.javaEnabled();var b=navigator.appVersion.toLowerCase();
a.hasTouchSupport=window.hasOwnProperty&&window.hasOwnProperty("ontouchstart")||b.match("android")&&!0;a.hasTouchSupport=navigator.userAgent.toLowerCase().match("qt")?!1:a.hasTouchSupport;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"));e()};a.removeNeedlessDecimals=function(a){var b,c;if("string"==
typeof a&&(b=a.indexOf("."),-1!=b)){c=a.substring(b);if(0==parseFloat(c))return a.substring(0,b);for(var g=c.length;0<g;g--)if(0!=c.charAt(g))return a.substring(0,b+g+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?(a=a.touches[0],u=a.pageX,l=a.pageY):void 0!=a.pageX&&void 0!=a.pageY?(u=a.pageX,
l=a.pageY):(u=a.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,l=a.clientY+document.body.scrollTop+document.documentElement.scrollTop);return{x:u,y:l}};a.getTextWidth=function(b,c){a.ctx.font=c;return Math.round(a.ctx.measureText(b).width)};var v=document.createElement("span");v.appendChild(document.createTextNode("\u00c1p"));var w=document.createElement("div");w.setAttribute("style","display: inline-block; w: 1px; h: 0px; margin: 0; padding: 0;");var y=document.createElement("div");
y.setAttribute("style","margin: 0; padding: 0;");y.appendChild(v);y.appendChild(w);var C={};a.getFontMetrics=function(a){if(C[a])return C[a];v.setAttribute("style","font: "+a+"; margin: 0px; padding: 0px;");document.body.appendChild(y);var b={ascent:0,descent:0,h:0,baseline:0};y.getBoundingClientRect?(w.style.verticalAlign="baseline",b.ascent=w.offsetTop-v.offsetTop,b.h=v.getBoundingClientRect().height||0):(w.style.verticalAlign="baseline",b.ascent=w.offsetTop-v.offsetTop,w.style.verticalAlign="bottom",
b.h=w.offsetTop-v.offsetTop);b.descent=b.h-b.ascent;b.baseline=b.ascent;b.ascent=parseInt(b.ascent);b.descent=parseInt(b.descent);b.h=parseInt(b.h);b.baseline=parseInt(b.baseline);document.body.removeChild(y);return C[a]=b};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};a.getScreenshot=function(){var b=a.apps[0],c,g=document.createElement("canvas"),e=new Image;if(b){g.setAttribute("width",b.width);g.setAttribute("height",b.height);
for(var h=g.getContext("2d"),k=0,r=b.spaces.length;k<r;k++)c=b.spaces[k],"R2"===c.type&&(h.drawImage(c.backgroundCanvas,c.x,c.y),h.drawImage(c.canvas,c.x,c.y),d(h,c.container,c.ctrs));0<b.northSpace.controls.length&&f(h,b.northSpace.container,b.northSpace);0<b.southSpace.controls.length&&f(h,b.southSpace.container,b.southSpace);0<b.eastSpace.controls.length&&f(h,b.eastSpace.container,b.eastSpace);0<b.westSpace.controls.length&&f(h,b.westSpace.container,b.westSpace);e.src=g.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/2.5/es/'><nobr>Creative Commons</nobr></a>\n<br>\n<a href='http://creativecommons.org/licenses/by-nc-sa/2.5/es/'><img src='http://i.creativecommons.org/l/by-nc-sa/3.0/es/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 c=window.open("","creditos","width=700,height=500,titlebar=0,toolbar=0,location=0,menubar=0,resizable=0,scrollbars=0,status=0");c.document.write(b);c.document.close()};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var e,f;a._externalFilesContent={};a.openExternalFile=function(d){if(a._externalFilesContent[d])return a._externalFilesContent[d];e=null;var b=!1;if(window.XMLHttpRequest)try{b=new XMLHttpRequest}catch(c){b=!1}else if(window.ActiveXObject)try{b=new ActiveXObject("Msxml2.XMLHTTP")}catch(h){try{b=
new ActiveXObject("Microsoft.XMLHTTP")}catch(g){b=!1}}f=b;f.open("GET",d,!1);try{f.send(null),e=f.responseText,e.match(String.fromCharCode(65533))&&(f.open("GET",d,!1),f.overrideMimeType("text/plain; charset=ISO-8859-1"),f.send(null),e=f.responseText)}catch(r){console.log("Error to load the file :",d),e=null}return e};a.addExternalFileContent=function(d,b){a._externalFilesContent[d]=b};return a}(descartesJS||{}),descartesJS=function(a){function e(a){l=a.indexOf("--radial--");-1!=l&&(a=a.substring(0,
l));c=a.trim();a={ignoreAcents:!1,ignoreCaps:!1,regExp:null};c[0]==c[c.length-1]&&"'"==c[0]&&(a.ignoreCaps=!0,c=c.substring(1,c.length-1),"`"==c[0]&&"\u00b4"==c[c.length-1]&&(a.ignoreAcents=!0,c=c.substring(1,c.length-1)));"`"==c[0]&&"\u00b4"==c[c.length-1]&&(a.ignoreAcents=!0,c=c.substring(1,c.length-1),c[0]==c[c.length-1]&&"'"==c[0]&&(a.ignoreCaps=!0,c=c.substring(1,c.length-1)));"*"===c.charAt(0)&&"*"!==c.charAt(c.length-1)?c=c.substring(1)+"$":"*"!==c.charAt(0)&&"*"===c.charAt(c.length-1)?c="^"+
c.substring(0,c.length-1):"*"!==c.charAt(0)&&"*"!==c.charAt(c.length-1)?c="^"+c+"$":"*"===c.charAt(0)&&"*"===c.charAt(c.length-1)&&(c=c.substring(1,c.length-1));c=c.replace(/\?/g,"[\\S\\s]{1}");a.regExp=c;return a}function f(a,b){c=(a||"").trim();a={ignoreAcents:!1,ignoreCaps:!1,regExp:null};a.expr=c.split(",");a.expr[0]=a.expr[0].trim();a.expr[0]={type:a.expr[0].charAt(0),expr:b.parser.parse(a.expr[0].substring(1))};a.expr[1]=a.expr[1].trim();a.expr[1]={type:a.expr[1].charAt(a.expr[1].length-1),
expr:b.parser.parse(a.expr[1].substring(0,a.expr[1].length-1))};return a}function d(a,b,c){b=parseFloat(b);k=a.expr[0];p=a.expr[1];n=c.evalExpression(k.expr);q=c.evalExpression(p.expr);s="("==k.type;t="["==k.type;m=")"==p.type;u="]"==p.type;return(s&&b>n||t&&b>=n)&&(m&&b<q||u&&b<=q)?1:0}function b(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 c,h,g,r,k,p,n,q,s,t,m,u,l;a.buildRegularExpresionsPatterns=function(a,b){a=a||"";"("===a.charAt(0)&&")"===a.charAt(a.length-1)&&-1===a.indexOf(",")&&(a=a.substring(1,a.length-1));a=a.replace(/&squot;/g,"'").replace(/&amp;/g,"&").split("|");for(var d=0,k=a.length;d<k;d++){h=a[d].split("&");g=[];for(var r=0,m=h.length;r<m;r++)c=h[r],-1===c.indexOf(",")||"("!==c.charAt(0)&&"["!==
c.charAt(0)||")"!==c.charAt(c.length-1)&&"]"!==c.charAt(c.length-1)?g.push(e(c)):g.push(f(c,b));a[d]=g}return a};a.escorrecto=function(c,g,e,k){e=e||a.externalEvaluator;k=k||a.buildRegularExpresionsPatterns(c,e);g=b(g);c=0;for(var f=k.length;c<f;c++){h=k[c];r=!0;for(var m=0,l=h.length;m<l;m++)r=h[m].regExp?r&&!!g.match(RegExp(b(h[m].regExp),"i")):r&&d(h[m],g,e);if(r)return 1}return 0};a.esCorrecto=function(g,e,k,f){k=k||a.externalEvaluator;f=f||a.buildRegularExpresionsPatterns(g,k);g=0;for(var m=
f.length;g<m;g++){h=f[g];r=!0;for(var l=0,p=h.length;l<p;l++)(c=h[l].regExp)?(h[l].ignoreAcents&&(e=b(e),c=b(c)),h[l].ignoreCaps&&(e=e.toLowerCase(),c=b(c).toLowerCase()),r=r&&!!e.match(c)):r=r=r&&d(h[l],e,k);if(r)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 e=Math.floor,f,d,b,c,h,g,r,k,p,n,q,s,t;a.Color=function(a,g){this.b=this.g=this.r=0;this.a=1;this.evaluator=g;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]){d=[];b=this.splitComa(a.substring(1,a.length-1));for(var e=0,h=b.length;e<h;e++)c=
parseInt(b[e],16),b[e]!=c.toString(16)&&b[e]!=="0"+c.toString(16)?("["===b[e].charAt(0)&&"]"===b[e].charAt(b[e].length-1)&&(b[e]=b[e].substring(1,b[e].length-1)),d.push(this.evaluator.parser.parse(b[e]))):d.push(this.evaluator.parser.parse((c/255).toString()));this.rExpr=d[0];this.gExpr=d[1];this.bExpr=d[2];this.aExpr=d[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){h=
[];for(var b=k=r=g=0,c=a.length;b<c;b++)p=a.charAt(b),"("===p?g++:")"===p?g--:"["===p?r++:"]"===p?r--:","===p&&0===g&&0===r&&(h.push(a.substring(k,b)),k=b+1);h.push(a.substring(k));return h};a.Color.prototype.getColorString=function(){return this.colorStr};a.Color.prototype.getColorExpression=function(){f=this.evaluator;this.r=e(255*f.evalExpression(this.rExpr));this.g=e(255*f.evalExpression(this.gExpr));this.b=e(255*f.evalExpression(this.bExpr));this.a=1-f.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(",");n=parseInt(b[0]).toString(16);q=parseInt(b[1]).toString(16);s=parseInt(b[2]).toString(16);t=(255-parseInt(255*parseFloat(b[3]))).toString(16);n=1==n.length?"0"+n:n;q=1==q.length?"0"+q:q;s=1==s.length?"0"+s:s;t=1==t.length?"0"+t:t;return new a.Color(t+n+q+s)};return a}(descartesJS||{}),descartesJS=
function(a){if(a.loadLib)return a;var e=document.head,f=document.createElement("meta");f.setAttribute("http-equiv","X-UA-Compatible");f.setAttribute("content","IE=edge,chrome=1");e.appendChild(f);f=document.createElement("meta");f.setAttribute("name","viewport");f.setAttribute("content","width=device-width, initial-scale=1.0, user-scalable=yes");e.appendChild(f);f=document.createElement("meta");f.setAttribute("name","apple-mobile-web-app-capable");f.setAttribute("content","yes");e.appendChild(f);
f=document.createElement("meta");f.setAttribute("name","apple-mobile-web-app-status-bar-style");f.setAttribute("content","black-translucent");e.appendChild(f);(e=document.getElementById("StyleDescartesApps2"))&&e.parentNode.removeChild(e);e=document.createElement("style");e.type="text/css";e.id="StyleDescartesApps2";e.setAttribute("rel","stylesheet");document.head.appendChild(e);e.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 :#efefef; position:absolute; overflow:hidden; -box-shadow:0px 0px 0px #888; background-image:linear-gradient(bottom, #bbb 0%, #efefef 50%, #bbb 100%); background-image:-o-linear-gradient(bottom, #bbb 0%, #efefef 50%, #bbb 100%); background-image:-moz-linear-gradient(bottom, #bbb 0%, #efefef 50%, #bbb 100%); background-image:-webkit-linear-gradient(bottom, #bbb 0%, #efefef 50%, #bbb 100%); background-image:-ms-linear-gradient(bottom, #bbb 0%, #efefef 50%, #bbb 100%); 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{ 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; }\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:Arial,Helvetica,'Droid Sans',Sans-serif; padding:0px; border:solid #666 1px; position:absolute; top:0px; }\nlabel.DescartesSpinnerLabel, label.DescartesMenuLabel, label.DescartesScrollbarLabel, label.DescartesTextFieldLabel{ font-family:Arial,Helvetica,'Droid Sans',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{ border-style:none; position:absolute; }\ndiv.DescartesTextAreaContainer{ position:absolute; overflow:hidden; background:#c0d0d8; }\nselect.DescartesMenuSelect{ font-family:Arial,Helvetica,'Droid Sans',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{ background:#eee; overflow:hidden; position:absolute; }\ndiv.DescartesEditorContainer{ font-family:Arial,Helvetica,'Droid Sans',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 e=Math.sin,f=Math.floor,d=Math.random,b=Math.round,c=Math.abs,h=String.fromCharCode,g,r,k,p,n,q,s,t,m,u;a.Krypto=function(a){this.key=(a||0).toString()};a.Krypto.prototype.getKey=function(a){g=[];for(var b=0;256>b;b++)g[b]=h(this.alfanum(f(c(7.5*(e(1*b-a)+e(1.4*b+a)+e(0.6*b-a)+e(2.2*b+a))))));return g.join("")};a.Krypto.prototype.encode=function(a){r=f(31*d());this.key=this.getKey(r);p=h(this.alfanum(r));return p+this.encripta(a)};
a.Krypto.prototype.decode=function(a){r=this.numalfa(a.charCodeAt(0));this.key=this.getKey(r);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;q=Array(3*a.length);for(var c=0,g=a.length;c<g;c++)m=256*f(a[c]+128)+b(255*d())+65536*b(255*d()),u=f((m<<this.shift(c))/256),q[3*c]=this.alfanum(u%32),q[3*c+1]=this.alfanum(u/32%
32),q[3*c+2]=this.alfanum(u/1024%32);return q};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,c=s.length;b<c;b++)u=this.numalfa(a[3*b])+32*this.numalfa(a[3*b+1])+1024*this.numalfa(a[3*b+2]),m=f(256*u>>this.shift(b)),t=f(m/256)%256-128,0>t&&(t+=256),s[b]=t;return s};a.Krypto.prototype.alfanum=function(a){a=f(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){p=Array(a.length);for(var b=0,c=a.length;b<c;b++)p[b]=a.charCodeAt(b);return p};a.Krypto.prototype.bytesToString=function(a){for(var b=0,c=a.length;b<c;b++)a[b]=h(a[b]);return a.join("")};a.Krypto.prototype.shift=function(a){k=this.key.charCodeAt(a%this.key.length);p=this.numalfa(k);n=f(p/2%8);0==n&&(n=4);return n};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;window.requestAnimationFrame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame;window.cancelAnimationFrame=window.cancelAnimationFrame||window.mozCancelAnimationFrame;a.Animation=function(e,f){this.parent=e;var d=e.evaluator,b=d.parser,c=new a.Auxiliary(e);this.start=null;this.delay=f.delay?b.parse(f.delay):b.parse("60");this.loop=
f.loop?f.loop:!1;this.auto=void 0==f.auto?!0:f.auto;this.controls=f.controls;this.init=c.splitInstructions(b,f.init);this.doExpr=c.splitInstructions(b,f.doExpr);f.whileExpr&&(this.whileExpr=b.parse(f.whileExpr));var h=this,g,r,k=h.doExpr.length;this.animationExec=function(){for(r=0;r<k;r++)d.evalExpression(h.doExpr[r]);h.parent.update();h.playing&&(0<d.evalExpression(h.whileExpr)||h.loop)?(g=d.evalExpression(h.delay),window.requestAnimationFrame||(h.timer=setTimeout(h.animationExec,10>g?10:g))):(h.stop(),
h.parent.update())};this.playing=!1;this.auto&&this.play()};a.Animation.prototype.play=function(){var a=this;this.playing?this.stop():(this.reinit(),this.playing=!0,delay=this.parent.evaluator.evalExpression(this.delay),this.timer=window.requestAnimationFrame?requestAnimationFrame(function(f){a.step(f)}):setTimeout(this.animationExec,10>delay?10:delay))};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,f=this.init.length;a<f;a++)this.parent.evaluator.evalExpression(this.init[a])};a.Animation.prototype.step=function(a){var f=this;null===f.start&&(f.start=a);delay=f.parent.evaluator.evalExpression(f.delay);delay=10>delay?10:delay;a-f.start>delay&&(f.animationExec(),f.start=null);f.playing&&(f.timer=requestAnimationFrame(function(a){f.step(a)}))};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;a.Action=function(a,f){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(e,f){a.Action.call(this,e,f);this.parameter=(f||"").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(e,f){a.Action.call(this,e,f);var d=this.evaluator,
b=d.parser;f=(f||"").replace(/&squot;/g,"'");f=f.replace(/;/g,"\\n");f=f.split("\\n")||[""];for(var c=[],h,g=0,r=f.length;g<r;g++)(h=b.parse(f[g],!0))&&c.push(h);r=c.length;this.execute=function(){for(g=0;g<r;g++)d.evalExpression(c[g])}};a.extend(a.Calculate,a.Action);return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;a.OpenURL=function(e,f){a.Action.call(this,e,f);this.parameter=f;this.target="_blank";var d=this.parameter.indexOf("target");-1!=d&&(this.target=this.parameter.substring(d),
this.target=this.target.substring(this.target.indexOf("=")+1),this.parameter=this.parameter.substring(0,d-1));"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)})};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(e,f){a.Action.call(this,e,f);this.parameter=f;this.target="_blank";var d=this.parameter.indexOf("target");-1!=d&&(this.target=this.parameter.substring(d),this.target=this.target.substring(this.target.indexOf("=")+1),this.parameter=this.parameter.substring(0,d-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(e,f){a.Action.call(this,e,f);f||(this.urlAbout=window.location.href.substring(0,window.location.href.lastIndexOf("/")+
1)+f)};a.extend(a.About,a.Action);a.About.prototype.execute=function(){console.log("about");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(e,f){a.Action.call(this,e,f)};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(e,f){a.Action.call(this,e,f)};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(e,f){a.Action.call(this,e,f)};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(e,f){a.Action.call(this,e,f)};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(e,f){a.Action.call(this,e,f)};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 e=/[\w\.\-//]*(\.ogg|\.oga|\.mp3|\.wav|\.OGG|\.OGA\.MP3|\.WAV)/g;
a.PlayAudio=function(f,d){a.Action.call(this,f,d);d&&d.match(e)?this.filenameExpr=this.evaluator.parser.parse("'"+d.match(e)+"'"):this.filenameExpr=this.evaluator.parser.parse(d)};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,b){this.parent=
a;this.evaluator=this.parent.evaluator;this.expresion=this.id="";this.evaluate="onlyOnce";this.local="";for(var c in b)b.hasOwnProperty(c)&&(this[c]=b[c])};a.Auxiliary.prototype.firstRun=function(){};a.Auxiliary.prototype.update=function(){};var e,f;a.Auxiliary.prototype.splitInstructions=function(a,b){f=[];b=b?b.split(";"):[""];for(var c=0,h=b.length;c<h;c++)(e=a.parse(b[c],!0))&&f.push(e);return f};a.Auxiliary.prototype.getPrivateVariables=function(a,b){f=[];b=b?b.split(/;|,/):[""];for(var c=0,
h=b.length;c<h;c++)(e=a.parse(b[c],!0))&&f.push(e);c=0;for(h=f.length;c<h;c++)f[c]="asign"===f[c].type?f[c].childs[0].value:"identifier"===f[c].type?f[c].value:"";return f};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(e,
f){a.Auxiliary.call(this,e,f);var d=this.evaluator.parser;this.expresionString=this.expresion;(this.expresion=d.parse(this.expresionString))&&d.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"),f=document.createElement("label");f.appendChild(document.createTextNode("___"+this.id+"=___"));var d=document.createElement("input");
d.value=this.expresionString;d.disabled=!this.editable;a.appendChild(f);a.appendChild(d);var b=this,c=b.evaluator.parser;d.onkeydown=function(a){13==a.keyCode&&(b.expresion=c.parse(this.value),c.setVariable(b.id,b.expresion),b.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(e,f){a.Auxiliary.call(this,e,f);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 e,f,d;a.Vector=function(b,c){e=b.evaluator;f=e.parser;this.size=f.parse("3");a.Auxiliary.call(this,b,c);this.expresion=this.expresion.split(";");this.parseFile=f.parse(this.file);this.update()};a.extend(a.Vector,a.Auxiliary);a.Vector.prototype.update=function(){var b=this.expresion;
e=this.evaluator;f=e.parser;this.oldFile=this.file;if(d=e.evalExpression(this.parseFile))this.file=d;var c;if(this.file){c=(vectorElement=document.getElementById(this.file))&&"descartes/vectorFile"==vectorElement.type?vectorElement.text:a.openExternalFile(this.file);if(null!=c){c=c.replace(/\r/g,"").split("\n");for(var h=[],g=0,r=c.length;g<r;g++)""!=c[g]&&h.push(c[g]);c=h}null==c||1==c.length&&""==c[0]?this.size=0:(b=c,this.size=null);null===this.size&&(this.size=f.parse(b.length+""))}c=[];g=0;for(r=
b.length;g<r;g++)(h=f.parse(b[g],!0))&&"asign"!=h.type&&(h=f.parse(this.id+"["+g+"]="+b[g],!0)),c.push(h);b=[];g=0;for(r=e.evalExpression(this.size);g<r;g++)b.push(0);e.vectors[this.id]=b;e.setVariable(this.id+".long",e.evalExpression(this.size));g=0;for(r=c.length;g<r;g++)e.evalExpression(c[g])};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;a.Matrix=function(e,f){var d=e.evaluator,b=d.parser;this.rows=b.parse("3");this.columns=b.parse("3");a.Auxiliary.call(this,e,f);this.expresion=
this.splitInstructions(b,this.expresion);var b=d.evalExpression(this.rows),c=d.evalExpression(this.columns),h=[];h.type="matrix";for(var g,r=0;r<c;r++){g=[];for(var k=0,p=b;k<p;k++)g.push(0);h[r]=g}d.matrices[this.id]=h;this.update()};a.extend(a.Matrix,a.Auxiliary);a.Matrix.prototype.update=function(){var a=this.evaluator,f=a.evalExpression(this.rows),d=a.evalExpression(this.columns);a.setVariable(this.id+".filas",f);a.setVariable(this.id+".columnas",d);var b=a.matrices[this.id];b.rows=f;b.cols=d;
f=0;for(d=this.expresion.length;f<d;f++)a.evalExpression(this.expresion[f])};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;a.Function=function(e,f){a.Auxiliary.call(this,e,f);var d=this.evaluator,b=d.parser,c=this.id.indexOf("(");this.name=this.id.substring(0,c);this.params=this.id.substring(c+1,this.id.indexOf(")"));this.domain=this.range?b.parse(this.range):b.parse("1");this.params=""==this.params?[]:this.params.split(",");this.numberOfParams=this.params.length;this.algorithm||
(this.whileExpr=this.doExpr=this.init="");this.parseExpressions(b);this.expresion=b.parse(this.expresion);var h=this;this.functionExec=function(){this.iterations=0;if(h.numberOfParams<=arguments.length){for(var b=[],c=0,e=h.privateVars.length;c<e;c++)b.push(d.getVariable(h.privateVars[c])),d.setVariable(h.privateVars[c],0);for(var f=[],c=0,e=h.params.length;c<e;c++)f[c]=d.getVariable(h.params[c])||0,d.setVariable(h.params[c],arguments[c]);c=0;for(e=h.init.length;c<e;c++)d.evalExpression(h.init[c]);
do{c=0;for(e=h.doExpr.length;c<e;c++)d.evalExpression(h.doExpr[c]);if(1E5<++this.iterations)return console.log("se ha excedido el l\u00edmite de 100000 repeticiones en la funci\u00f3n",this.id),0}while(0<d.evalExpression(h.whileExpr));var n=d.evalExpression(h.expresion);a.rangeOK=d.evalExpression(h.domain);c=0;for(e=h.params.length;c<e;c++)d.setVariable(h.params[c],f[c]);c=0;for(e=h.privateVars.length;c<e;c++)d.setVariable(h.privateVars[c],b[c]);return n}return 0};d.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(e,f){a.Auxiliary.call(this,e,f);var d=this.evaluator;this.parseExpressions(d.parser);this.algorithmExec=function(){for(var a=this.iterations=0,c=this.init.length;a<c;a++)d.evalExpression(this.init[a]);do{a=0;for(c=this.doExpr.length;a<c;a++)d.evalExpression(this.doExpr[a]);if(1E5<++this.iterations)return console.log("se ha excedido el l\u00edmite de 100000 repeticiones en el algoritmo",
this.id),0}while(0<d.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(e,f){a.Auxiliary.call(this,e,f);var d=this.evaluator;this.condition=d.parser.parse(this.condition);this.lastEvaluation=!1;this.action=this.parent.lessonParser.parseAction(this);"onlyOnce"==this.execution&&
(this.eventExec=function(){0<d.evalExpression(this.condition)&&!this.lastEvaluation&&(this.lastEvaluation=!0,this.action.execute())});"alternate"==this.execution&&(this.eventExec=function(){var a=0<d.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<
d.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;a.GenericDefinition=function(a,f){this.parent=a;this.evaluator=this.parent.evaluator;this.id="_";for(var d in f)f.hasOwnProperty(d)&&(this[d]=f[d])};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var e=Math.round;a.Rectangle=function(e,d){this.fill="";a.GenericDefinition.call(this,
e,d);this.evaluator.setDefinition(this.id,this)};a.extend(a.Rectangle,a.GenericDefinition);a.Rectangle.prototype.update=function(){};a.Rectangle.prototype.draw=function(a,d,b,c){var h=c.space,g=this.evaluator,r=_y=_w=_h=0;c.abs_coord?(r=e(g.evalExpression(this.x)),_y=e(g.evalExpression(this.y)),_w=e(g.evalExpression(this.width)),_h=e(g.evalExpression(this.height))):(r=e(h.getAbsoluteX(g.evalExpression(this.x))),_y=e(h.getAbsoluteY(g.evalExpression(this.y))),_w=g.evalExpression(this.width)*h.scale,
_h=g.evalExpression(this.height)*h.scale);h=e(g.evalExpression(c.width));a.lineWidth=0<h?h:1E-6;h=0==a.lineWidth%2?0:0.5;a.strokeStyle=b.getColor();a.lineCap="round";a.lineJoin="round";a.beginPath();a.moveTo(r+h,_y+h);a.lineTo(r+h+_w,_y+h);a.lineTo(r+h+_w,_y+h+_h);a.lineTo(r+h,_y+h+_h);a.closePath();c.fill&&(a.fillStyle=d.getColor(),a.fill());a.stroke()};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var e,f,d,b,c;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,c=0,d=a.length;c<d;c++)if(b=a[c],b.id==this.spaceID)return b;return a[0]};a.Graphic.prototype.getFamilyValues=function(){e=this.evaluator;f=e.evalExpression(this.family_interval);this.familyInf=f[0][0];this.familySup=f[0][1];this.fSteps=Math.round(e.evalExpression(this.family_steps));this.family_sep=0<this.fSteps?(this.familySup-this.familyInf)/this.fSteps:0};a.Graphic.prototype.drawFamilyAux=function(a,b,c){e=this.evaluator;this.getFamilyValues();d=e.getVariable(this.family);if(0<=this.fSteps)for(var k=
0,f=this.fSteps;k<=f;k++)e.setVariable(this.family,this.familyInf+k*this.family_sep),0<e.evalExpression(this.drawif)&&(this.update(),this.drawAux(a,b,c));e.setVariable("_Text_H_",0);e.setVariable(this.family,d)};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,g,d,k,f,n,q,s,t,m,u){if("rtfNode"===g.type)a.fillStyle=f.getColor(),a.strokeStyle=f.getColor(),a.textBaseline="alphabetic",g.draw(a,d,k,t,m,q,u,f.getColor());else for("simpleText"===g.type&&(g=g.toString(t,m).split("\\n")),d+=n.match("Arial")?-2:n.match("Times")?-2:0,e=this.evaluator,a.fillStyle=f.getColor(),a.font=n,a.textAlign=q,a.textBaseline=s,this.border&&(a.strokeStyle=this.border.getColor(),a.lineWidth=
3),c=1.2*this.fontSize||0,f=0,n=g.length;f<n;f++)b=g[f],this.border&&(a.lineJoin="round",a.strokeText(b,d,k+c*f)),a.fillText(b,d,k+c*f)};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;a.SimpleText=function(a,b){this.text=b=b.replace("&#x2013","\u2013").replace(/\&squot;/g,"'");this.textElements=[];this.textElementsMacros=[];this.parent=a;this.evaluator=a.evaluator;this.type="simpleText";for(var c="'",e=0,g=0,f=-1,k,p;e<b.length;)k=b.charAt(e),p=b.charAt(e-1),"["===k&&"\\"===
p?(this.textElements.push(b.substring(g,e-1)+"["),this.textElementsMacros.push("'"+b.substring(g,e-1)+"['"),g=e+1):"]"===k&&"\\"===p?(this.textElements.push(b.substring(g,e-1)+"]"),this.textElementsMacros.push("'"+b.substring(g,e-1)+"]'"),g=e+1):"["===k&&-1===f?(this.textElements.push(b.substring(g,e)),this.textElementsMacros.push("'"+b.substring(g,e)+"'"),g=e,f++):"["===k?f++:"]"===k&&0===f?(this.textElements.push(this.evaluator.parser.parse(b.substring(g,e+1))),this.textElementsMacros.push("["+
b.substring(g,e+1)+"]"),g=e+1,f--):("]"==b.charAt(e)&&(f=0>f?f:f-1),c+=b.charAt(e)),e++;this.textElements.push(b.substring(g,e));this.textElementsMacros.push("'"+b.substring(g,e)+"'")};var e,f;a.SimpleText.prototype.toString=function(d,b){e="";for(var c=0,h=this.textElements.length;c<h;c++)"string"===typeof this.textElements[c]?e+=this.textElements[c]:(f=this.evaluator.evalExpression(this.textElements[c])[0][0],""!==f&&("string"===typeof f?e+=f:(f=parseFloat(f),f=b?f.toFixed(d):a.removeNeedlessDecimals(f.toFixed(d)),
e+=f.toString().replace(".",this.parent.decimal_symbol))));return e};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var e,f,d,b,c,h,g,r,k,p,n,q,s,t,m,u,l,v,w,y,C,B,D,E,z,A,H;a._debug_vez=0;a.Equation=function(b,c){this.width=b.evaluator.parser.parse("1");this.fillM=this.fillP="";a.Graphic.call(this,b,c);this.parseExpression();(this.visible=2===this.parent.version&&void 0==this.visible?!0:this.visible)&&this.registerTextField();q=new a.R2;s=new a.R2;t=new a.R2;l=new a.R2;
m=new a.R2};a.extend(a.Equation,a.Graphic);a.Equation.prototype.parseExpression=function(){if("compOperator"===this.expresion.type){var b=this.expresion.childs[0],c=this.expresion.childs[1];"identifier"!=b.type||"y"!=b.value||c.contains("y")?"identifier"!=c.type||"y"!=c.value||b.contains("y")?"identifier"!=b.type||"x"!=b.value||c.contains("x")?"identifier"!=c.type||"x"!=c.value||b.contains("x")||(this.of_y=!0,this.funExpr=c,this.drawAux=this.drawAuxFun):(this.funExpr=c,this.of_y=!0,this.drawAux=this.drawAuxFun):
(this.funExpr=b,this.of_y=!1,this.drawAux=this.drawAuxFun):(this.funExpr=c,this.of_y=!1,this.drawAux=this.drawAuxFun)}this.newt=new a.R2Newton(this.evaluator,this.expresion)};a.Equation.prototype.update=function(){};a.Equation.prototype.draw=function(){""!=this.family?this.drawFamilyAux(this.ctx,this.fill,this.color):(this.update(),this.drawAux(this.ctx,this.fill,this.color))};a.Equation.prototype.drawFamilyAux=function(a,b,c){f=this.evaluator;this.getFamilyValues();tempParam=f.getVariable(this.family);
if(0<=this.fSteps)for(var g=0,d=this.fSteps;g<=d;g++)f.setVariable(this.family,this.familyInf+g*this.family_sep),this.update(),this.drawAux(a,b,c);f.setVariable(this.family,tempParam)};a.Equation.prototype.drawTrace=function(){this.uber.drawTrace.call(this,this.fill,this.trace)};a.Equation.prototype.drawAux=function(G,K,L){if(!(0>=this.evaluator.evalExpression(this.drawif))){var x,J,F;f=this.evaluator;d=f.parser;b=this.space;c=f.evalExpression(this.width);G.strokeStyle=this.color.getColor();G.lineWidth=
c;h=d.getVariable("x");g=d.getVariable("y");r=b.w;k=b.h;p=r/9;3>p&&(p=3);n=k/7;3>n&&(n=3);e=[];q.set(0,0);s.set(0,0);t.set(0,0);var P=0.25,M=8;this.abs_coord||(P/=b.scale,M/=b.scale);G.beginPath();for(H=parseInt(n/2);H<k;H+=n)for(A=parseInt(p/2);A<r;A+=p){if(this.abs_coord){l.set(A,H);u=this.newt.findZero(l,P);if(null==u)continue;f.setVariable("x",u.x);f.setVariable("y",u.y);m.set(u.x,u.y)}else{l.set(b.getRelativeX(A),b.getRelativeY(H));u=this.newt.findZero(l,P);if(null==u)continue;f.setVariable("x",
u.x);f.setVariable("y",u.y);m.set(b.getAbsoluteX(u.x),b.getAbsoluteY(u.y))}v=m.ix();w=m.iy();if(0<=v&&v<r&&0<=w&&w<k){if(e[v+w*b.w])continue;e[v+w*b.w]=!0}a.rangeOK&&(G.moveTo(v,w),G.lineTo(v,w));q.x=u.x;q.y=u.y;s.x=u.x;s.y=u.y;y=this.newt.getUnitNormal();if(0!=y.x||0!=y.y)for(y.rotL90(),t.x=y.x,t.y=y.y,B=C=0,D=!1;2>B;)if(D&&(t.x=-y.x,t.y=-y.y,u.x=q.x,u.y=q.y,s.x=u.x,s.y=u.y,this.abs_coord?m.set(u.x,u.y):m.set(b.getAbsoluteX(u.x),b.getAbsoluteY(u.y)),v=m.ix(),w=m.iy(),D=!1,C=0),u.x+=M*t.x,u.y+=M*
t.y,u=this.newt.findZero(u,P),null!=u){f.setVariable("x",u.x);f.setVariable("y",u.y);t.x=u.x-s.x;t.y=u.y-s.y;t.normalize();if(0==t.x&&0==t.y)break;s.x=u.x;s.y=u.y;this.abs_coord?m.set(u.x,u.y):m.set(b.getAbsoluteX(u.x),b.getAbsoluteY(u.y));E=parseInt(m.ix());z=parseInt(m.iy());if(E!=v||z!=w)if(K=v,L=w,v=E,w=z,0<=v&&v<r&&0<=w&&w<k){C=0;x=e[v+w*b.w];e[v+w*b.w]=!0;for(var I=1;8>I;I++)J=K+Math.round((v-K)*I/8),F=L+Math.round((w-L)*I/8),0<=J&&J<r&&0<=F&&F<k&&(e[J+F*b.w]=!0);a.rangeOK&&(G.moveTo(K,L),G.lineTo(v,
w));if(x)break}else D=!0,B++;else 4<++C&&(D=!0,B++)}}G.stroke()}};a.Equation.prototype.X=function(a,b,c){c||(b=this.space.w/2+this.space.Ox+this.space.scale*b);b<-a&&(b=-a);b>this.space.w+a&&(b=this.space.w+a);return b};a.Equation.prototype.Y=function(a,b,c){c||(b=this.space.h/2+this.space.Oy-this.space.scale*b);b<-a&&(b=-a);b>this.space.h+a&&(b=this.space.h+a);return b};a.Equation.prototype.XX=function(a,b,c){return Math.round(this.X(a,b,c))};a.Equation.prototype.YY=function(a,b,c){return Math.round(this.Y(a,
b,c))};a.Equation.prototype.extrapolate=function(b,c,g,d,e,k){for(var f=this.evaluator.getVariable(c),h=k/2,r=0;1E-12<Math.abs(h);){var m=this.evaluator.getVariable(c),n=this.evaluator.getVariable(c)+h;this.evaluator.setVariable(c,n);var p=!0,l=e;e=this.evaluator.evalExpression(this.funExpr);this.evaluator.setVariable(g,e);if(0<this.evaluator.evalExpression(b)){var q=new a.R2(Math.min(l,e),Math.max(l,e)),s=0,s=0<k?this.Singularity(Math.abs(h),c,d,m,l,n,e,q):this.Singularity(Math.abs(h),c,d,n,e,m,
l,q);0<s&&(p=!1)}else p=!1;p?r+=h:this.evaluator.setVariable(c,m);h/=2}this.evaluator.setVariable(c,f);return new a.R2(r/Math.abs(k),e)};a.Equation.prototype.extrapolateOnSingularity=function(b,c,g,d,e,k){d=this.evaluator.getVariable(c);for(var f=k/2,h=0,r=e;1E-12<Math.abs(f);){this.evaluator.setVariable(this.evaluator.getVariable(c)+f);var m=!0;0<this.evaluator.evalExpression(b)?(r=this.evaluator.evalExpression(this.funExpr),this.evaluator.setVariable(g,r),0>=this.evaluator.evalExpression(b)&&(m=
!1)):m=!1;m?h+=f:this.evaluator.setVariable(this.evaluator.getVariable(c)-f);f/=2}if(0==h)for(f=k/2,h=k,r=e;1E-12<Math.abs(f);)this.evaluator.setVariable(this.evaluator.getVariable(c)-f),m=!0,0<this.evaluator.evalExpression(b)?r=this.evaluator.evalExpression(this.funExpr):m=!1,m?h+=-f:this.evaluator.setVariable(this.evaluator.getVariable(c)+f),f/=2;this.evaluator.setVariable(d);return new a.R2(h/Math.abs(k),r)};a.Equation.prototype.Singularity=function(a,b,c,g,d,e,f,k){if(g>=e)return 2;var h=this.evaluator.getVariable(b),
r=0;if(1E-12>Math.abs(e-g)||1E-8>Math.abs(e-g)&&Math.abs(f-d)>Math.abs(a))return this.evaluator.setVariable(b,h),1;var m=(g+e)/2;this.evaluator.setVariable(b,m);var n=this.evaluator.evalExpression(this.funExpr);if(Math.abs(f-d)>a){this.evaluator.setVariable(b,g-1E-6);var p=this.evaluator.evalExpression(this.funExpr),p=(d-p)/1E-6;this.evaluator.setVariable(b,e+1E-6);var l=(this.evaluator.evalExpression(this.funExpr)-f)/1E-6,q=(f-d)/(e-g);if((10>Math.abs(l)||10>Math.abs(p))&&(0<=l&&0<=p||0>=l&&0>=p)&&
8*Math.abs(l)<Math.abs(q))return this.evaluator.setVariable(b,h),2}k.x<=n&&n<=k.y||(this.evaluator.setVariable(b,m),k.x=Math.min(d,n),k.y=Math.max(d,n),g=this.Singularity(a/2,b,c,g,d,m,n,k),this.evaluator.setVariable(b,e),k.x=Math.min(f,n),k.y=Math.max(f,n),a=this.Singularity(a/2,b,c,m,n,e,f,k),r=Math.max(g,a));this.evaluator.setVariable(b,h);return r};a.Equation.prototype.drawAuxFun=function(b,c,d){h=this.evaluator.parser.getVariable("x");g=this.evaluator.parser.getVariable("y");a.rangeOK=1;c="x";
d="y";this.of_y&&(c="y",d="x");var e=this.drawif,f=this.evaluator.evalExpression(this.width),k=!1,r=new a.R2(this.space.w/2+this.space.Ox,this.space.h/2+this.space.Oy),r=this.of_y?r.ix():r.iy(),m=0,n=0,p=0,l=1/this.space.scale,q=l*(this.of_y?-this.space.h+(this.space.h/2+this.space.Oy):-(this.space.w/2+this.space.Ox)),m=0;this.abs_coord&&(q=0,l=1);for(var s=this.of_y?this.space.h:this.space.w;n<s;){var u=!0,v=0;this.evaluator.setVariable(c,q);var t=this.evaluator.evalExpression(this.funExpr);if(isNaN(t))u=
!1;else{this.evaluator.setVariable(d,t);if(0<this.evaluator.evalExpression(this.drawif)&&a.rangeOK){if(k){var v=Math.min(m,t),w=Math.max(m,t),w=new a.R2(v,w),v=this.Singularity(l,c,0,q-l,m,q,t,w);0===v?(m<=t?(m=w.x,t=w.y):(t=w.x,m=w.y),v=this.of_y?this.XX(f,m,this.abs_coord):this.YY(f,m,this.abs_coord),m=this.abs_coord?Math.round(t):this.of_y?this.XX(f,t,this.abs_coord):this.YY(f,t,this.abs_coord),this.fillM&&m>r&&(b.lineWidth=1,b.strokeStyle=this.fillM.getColor(),b.beginPath(),this.of_y?(b.moveTo(r+
1,this.space.h-n+0.5),b.lineTo(m,this.space.h-n+0.5)):(b.moveTo(n+0.5,r+1),b.lineTo(n+0.5,m)),b.stroke()),this.fillP&&m<r&&(b.lineWidth=1,b.strokeStyle=this.fillP.getColor(),b.beginPath(),this.of_y?(b.moveTo(r-1,this.space.h-n+0.5),b.lineTo(m,this.space.h-n+0.5)):(b.moveTo(n+0.5,r-1),b.lineTo(n+0.5,m)),b.stroke()),b.lineWidth=f,b.strokeStyle=this.color.getColor(),b.beginPath(),this.of_y?(b.moveTo(v+0.5,this.space.h-p),b.lineTo(m+0.5,this.space.h-n)):(b.moveTo(p+0.5,v),b.lineTo(n+0.5,m)),b.stroke()):
(1===v&&(this.evaluator.setVariable(c,q-l),p=this.extrapolate(e,c,d,0,m,l),this.YY(f,p.y,this.abs_coord),this.evaluator.setVariable(c,q),p=this.extrapolate(e,c,d,0,t,-l),this.YY(f,p.y,this.abs_coord)),this.YY(f,t,this.abs_coord))}else p=this.extrapolateOnSingularity(e,c,d,0,t,-l),this.YY(f,p.y,this.abs_coord),this.YY(f,t,this.abs_coord);m=t}else u=!1;k&&!u&&(this.evaluator.setVariable(c,q-l),this.evaluator.setVariable(d,m),p=this.extrapolate(e,c,d,0,m,l),this.YY(f,p.y,this.abs_coord),this.evaluator.setVariable(c,
q))}k=u;q+=l;p=n++}this.evaluator.parser.setVariable("x",h);this.evaluator.parser.setVariable("y",g)};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 e=Math.round;a.Curve=function(b,c){this.parameter="t";this.parameter_interval=b.evaluator.parser.parse("[0,1]");this.parameter_steps=b.evaluator.parser.parse("8");this.width=b.evaluator.parser.parse("1");this.fill="";a.Graphic.call(this,b,c);(this.visible=2==this.parent.version&&void 0==this.visible?!0:!1)&&this.registerTextField()};a.extend(a.Curve,a.Graphic);var f,d,b,c,h,g,r,k,p,n,q;a.Curve.prototype.update=function(){f=this.evaluator;d=f.evalExpression(this.parameter_interval);this.paraInf=
d[0][0];this.paraSup=d[0][1];this.pSteps=f.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(d,t,m){f=this.evaluator;b=this.space;c=e(f.evalExpression(this.width));d.lineWidth=0<c?c:1E-6;d.lineCap="round";d.lineJoin="round";d.strokeStyle=
m.getColor();h=f.getVariable(this.parameter);d.beginPath();f.setVariable(this.parameter,this.paraInf);g=f.evalExpression(this.expresion);this.exprX=this.abs_coord?e(g[0][0]):e(b.getAbsoluteX(g[0][0]));this.exprY=this.abs_coord?e(g[0][1]):e(b.getAbsoluteY(g[0][1]));this.rotateExp&&(r=a.degToRad(f.evalExpression(this.rotateExp)),k=Math.cos(r),p=Math.sin(r),n=this.exprX*k-this.exprY*p,q=this.exprX*p+this.exprY*k,this.exprX=n,this.exprY=q);d.moveTo(this.exprX+0.5,this.exprY+0.5);for(m=1;m<=this.pSteps;m++)f.setVariable(this.parameter,
this.paraInf+m*this.paraSep),g=f.evalExpression(this.expresion),this.exprX=this.abs_coord?e(g[0][0]):e(b.getAbsoluteX(g[0][0])),this.exprY=this.abs_coord?e(g[0][1]):e(b.getAbsoluteY(g[0][1])),this.rotateExp&&(n=this.exprX*k-this.exprY*p,q=this.exprX*p+this.exprY*k,this.exprX=n,this.exprY=q),d.lineTo(this.exprX+0.5,this.exprY+0.5);this.fill&&(d.fillStyle=t.getColor(),d.fill());d.stroke();f.setVariable(this.parameter,h)};a.Curve.prototype.registerTextField=function(){var a=document.createElement("input");
a.value=this.expresionString;a.disabled=!this.editable;var b=this;a.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 e=2*Math.PI,f=Math.round,d,b,c,h,g,r,k,p,n,q,s,t,m,u;a.Sequence=function(b,c){this.size=b.evaluator.parser.parse("2");this.range=b.evaluator.parser.parse("[1, 100]");a.Graphic.call(this,b,c)};a.extend(a.Sequence,
a.Graphic);a.Sequence.prototype.update=function(){d=this.evaluator;c=d.evalExpression(this.expresion);this.exprX=c[0][0];this.exprY=c[0][1];this.rotateExp&&(h=a.degToRad(d.evalExpression(this.rotateExp)),g=Math.cos(h),r=Math.sin(h),k=this.exprX*g-this.exprY*r,p=this.exprX*r+this.exprY*g,this.exprX=k,this.exprY=p);s=d.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,g){d=this.evaluator;b=this.space;m=t=Math.ceil(d.evalExpression(this.size)-0.4);a.fillStyle=g.getColor();a.beginPath();this.rangeInf>this.rangeMax&&(u=this.rangeInf,this.rangeInf=this.rangeMax,this.rangeMax=u);for(var k=d.getVariable("n"),h=this.rangeInf,r=this.rangeMax;h<=r;h++)d.setVariable("n",h),c=d.evalExpression(this.expresion),this.exprX=c[0][0],this.exprY=c[0][1],n=this.abs_coord?f(this.exprX):
f(b.getAbsoluteX(this.exprX)),q=this.abs_coord?f(this.exprY):f(b.getAbsoluteY(this.exprY)),a.beginPath(),a.arc(n,q,t,0,e,!0),a.fill();a.fill();this.text!=[""]&&this.uber.drawText.call(this,a,this.text,n+m,q-m,this.color,this.font,"start","alphabetic",d.evalExpression(this.decimals),this.fixed,!0);d.setVariable("n",k)};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var e=2*Math.PI,f=Math.round,d,b,c,h,g,r,k,p,n,q,s,t;a.Point=function(b,c){this.size=b.evaluator.parser.parse("2");
a.Graphic.call(this,b,c)};a.extend(a.Point,a.Graphic);a.Point.prototype.update=function(){d=this.evaluator;c=d.evalExpression(this.expresion);this.exprX=c[0][0];this.exprY=c[0][1];this.rotateExp&&(h=a.degToRad(d.evalExpression(this.rotateExp)),g=Math.cos(h),r=Math.sin(h),k=this.exprX*g-this.exprY*r,p=this.exprX*r+this.exprY*g,this.exprX=k,this.exprY=p)};a.Point.prototype.draw=function(){this.uber.draw.call(this,this.color,this.color)};a.Point.prototype.drawTrace=function(){this.uber.drawTrace.call(this,
this.trace,this.trace)};a.Point.prototype.drawAux=function(a,c){d=this.evaluator;b=this.space;s=f(d.evalExpression(this.size));t=s+1;a.fillStyle=c.getColor();n=this.abs_coord?f(this.exprX):f(b.getAbsoluteX(this.exprX));q=this.abs_coord?f(this.exprY):f(b.getAbsoluteY(this.exprY));a.beginPath();a.arc(n,q,s,0,e,!0);a.fill();this.text!=[""]&&this.uber.drawText.call(this,a,this.text,n+t+1,q-t,this.color,this.font,"start","alphabetic",d.evalExpression(this.decimals),this.fixed,!0)};return a}(descartesJS||
{}),descartesJS=function(a){if(a.loadLib)return a;var e=Math.round,f=2*Math.PI,d,b,c,h,g,r,k,p,n,q,s,t,m,u,l,v,w,y;a.Segment=function(b,c){this.width=b.evaluator.parser.parse("1");this.size=b.evaluator.parser.parse("2");a.Graphic.call(this,b,c)};a.extend(a.Segment,a.Graphic);a.Segment.prototype.update=function(){d=this.evaluator;c=d.evalExpression(this.expresion);this.endPoints=[];for(var b=0,e=c.length;b<e;b++)this.endPoints[b]={x:c[b][0],y:c[b][1]};if(this.rotateExp)for(h=a.degToRad(d.evalExpression(this.rotateExp)),
g=Math.cos(h),r=Math.sin(h),b=0,e=this.endPoints.length;b<e;b++)k=this.endPoints[b].x*g-this.endPoints[b].y*r,p=this.endPoints[b].x*r+this.endPoints[b].y*g,this.endPoints[b].x=k,this.endPoints[b].y=p};a.Segment.prototype.draw=function(){this.uber.draw.call(this,this.color,this.color)};a.Segment.prototype.drawTrace=function(){this.uber.drawTrace.call(this,this.trace,this.trace)};a.Segment.prototype.drawAux=function(a,c,g){d=this.evaluator;b=this.space;n=e(d.evalExpression(this.width));a.lineWidth=
0<n?n:1E-6;m=d.evalExpression(this.size);0>m&&(m=0);a.fillStyle=c.getColor();a.strokeStyle=g.getColor();a.lineCap="round";q=10+a.lineWidth;u=0==a.lineWidth%2?0:0.5;this.abs_coord?(l=e(this.endPoints[0].x),v=e(this.endPoints[0].y),w=e(this.endPoints[1].x),y=e(this.endPoints[1].y)):(l=e(b.getAbsoluteX(this.endPoints[0].x)),v=e(b.getAbsoluteY(this.endPoints[0].y)),w=e(b.getAbsoluteX(this.endPoints[1].x)),y=e(b.getAbsoluteY(this.endPoints[1].y)));a.beginPath();a.moveTo(l+u,v+u);a.lineTo(w+u,y+u);a.stroke();
a.beginPath();a.arc(l,v,m,0,f,!0);a.arc(w,y,m,0,f,!0);a.fill();this.text!=[""]&&(s=parseInt((l+w)/2)-3,t=parseInt((v+y)/2)+3,this.uber.drawText.call(this,a,this.text,s+q,t-q,this.color,this.font,"start","alphabetic",d.evalExpression(this.decimals),this.fixed,!0))};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var e=Math.floor,f=Math.round,d,b,c,h,g,r,k,p,n,q,s,t,m,u,l,v,w,y;a.Arrow=function(b,c){this.width=b.evaluator.parser.parse("5");this.size=b.evaluator.parser.parse("2");
this.spear=b.evaluator.parser.parse("8");this.arrow=new a.Color("ee0022");a.Graphic.call(this,b,c)};a.extend(a.Arrow,a.Graphic);a.Arrow.prototype.update=function(){d=this.evaluator;b=d.evalExpression(this.expresion);this.endPoints=[];for(var e=0,f=b.length;e<f;e++)this.endPoints[e]={x:b[e][0],y:b[e][1]};if(this.rotateExp)for(c=a.degToRad(d.evalExpression(this.rotateExp)),h=Math.cos(c),g=Math.sin(c),e=0,f=this.endPoints.length;e<f;e++)r=this.endPoints[e].x*h-this.endPoints[e].y*g,k=this.endPoints[e].x*
g+this.endPoints[e].y*h,this.endPoints[e].x=r,this.endPoints[e].y=k};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,c,g){d=this.evaluator;p=this.space;d.evalExpression(this.size);s=d.evalExpression(this.width);0>s&&(s=0);t=Math.ceil(s/2);m=p.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=c.getColor();b.strokeStyle=g.getColor();b.lineWidth=2;this.abs_coord?(l=f(this.endPoints[0].x),v=f(this.endPoints[0].y),w=f(this.endPoints[1].x),y=f(this.endPoints[1].y)):(l=f(p.getAbsoluteX(this.endPoints[0].x)),v=f(p.getAbsoluteY(this.endPoints[0].y)),w=f(p.getAbsoluteX(this.endPoints[1].x)),y=f(p.getAbsoluteY(this.endPoints[1].y)));c=d.evalExpression(this.spear);0>c&&(c=0);b.save();b.translate(l,
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*=m,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(-t,e(-t));b.lineTo(e(u-c-s),e(-t));b.lineTo(e(u-2*c),e(-c-t));b.lineTo(e(u),0);b.lineTo(e(u-2*c),e(c+t));b.lineTo(e(u-c-s),e(t));b.lineTo(-t,e(t));b.closePath();b.stroke();b.fill();b.restore();this.text!=[""]&&(n=parseInt((l+w)/2)-3,q=parseInt((v+
y)/2)+3,this.uber.drawText.call(this,b,this.text,n,q,g,this.font,"start","alphabetic",d.evalExpression(this.decimals),this.fixed,!0))};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var e=Math.round,f,d,b,c,h,g,r,k,p,n,q,s;a.Polygon=function(b,c){this.width=b.evaluator.parser.parse("1");this.fill="";a.Graphic.call(this,b,c);this.endPoints=[]};a.extend(a.Polygon,a.Graphic);a.Polygon.prototype.update=function(){f=this.evaluator;b=f.evalExpression(this.expresion);for(var d=
0,e=b.length;d<e;d++)this.endPoints[d]={x:b[d][0],y:b[d][1]};if(this.rotateExp)for(c=a.degToRad(f.evalExpression(this.rotateExp)),h=Math.cos(c),g=Math.sin(c),d=0,e=this.endPoints.length;d<e;d++)r=this.endPoints[d].x*h-this.endPoints[d].y*g,k=this.endPoints[d].x*g+this.endPoints[d].y*h,this.endPoints[d].x=r,this.endPoints[d].y=k};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,c){f=this.evaluator;d=this.space;p=e(f.evalExpression(this.width));a.lineWidth=0<p?p:1E-6;a.strokeStyle=c.getColor();a.lineCap="round";a.lineJoin="round";n=0<p?0.5:0;q=this.abs_coord?e(this.endPoints[0].x):e(d.getAbsoluteX(this.endPoints[0].x));s=this.abs_coord?e(this.endPoints[0].y):e(d.getAbsoluteY(this.endPoints[0].y));a.beginPath();a.moveTo(q+n,s+n);c=1;for(var g=this.endPoints.length;c<g;c++)q=this.abs_coord?e(this.endPoints[c].x):e(d.getAbsoluteX(this.endPoints[c].x)),
s=this.abs_coord?e(this.endPoints[c].y):e(d.getAbsoluteY(this.endPoints[c].y)),a.lineTo(q+n,s+n);this.fill&&(a.fillStyle=b.getColor(),a.fill());a.stroke()};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var e=Math.round,f,d,b,c,h,g,r,k,p,n,q,s,t,m,u,l,v,w,y,C,B;a.Arc=function(b,c){this.width=b.evaluator.parser.parse("1");this.fill="";this.center=b.evaluator.parser.parse("(0,0)");this.radius=b.evaluator.parser.parse("1");this.init="0";this.end="90";a.Graphic.call(this,b,c);
this.init.match(/^_\(/)&&(this.initFlag=!0,this.init=this.init.substring(1));this.end.match(/^_\(/)&&(this.endFlag=!0,this.end=this.end.substring(1));this.initExpr=b.evaluator.parser.parse(this.init);this.endExpr=b.evaluator.parser.parse(this.end)};a.extend(a.Arc,a.Graphic);a.Arc.prototype.update=function(){f=this.evaluator;d=f.evalExpression(this.center);this.exprX=d[0][0];this.exprY=d[0][1];b=0;this.rotateExp&&(b=a.degToRad(f.evalExpression(this.rotateExp)),c=Math.cos(b),h=Math.sin(b),g=this.exprX*
c-this.exprY*h,r=this.exprX*h+this.exprY*c,this.exprX=g,this.exprY=r);var e=f.evalExpression(this.initExpr),l=f.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?(k=e[0][0],p=e[0][1],n=l[0][0],q=l[0][1],this.vectors?this.abs_coord&&(p=-p,q=-q):this.abs_coord?(k-=this.exprX,p=-p+this.exprY,
n-=this.exprX,q=-q+this.exprY):(k-=this.exprX,p-=this.exprY,n-=this.exprX,q-=this.exprY),s=0==k?0>p?-Math.PI/2:Math.PI/2:Math.acos(1*k/Math.sqrt(k*k+p*p)),t=0==n?0>q?-Math.PI/2:Math.PI/2:Math.acos(1*n/Math.sqrt(n*n+q*q)),s+=b,t+=b,0<k&&0<p&&this.abs_coord&&(s=2*Math.PI-s),0<k&&0>p&&!this.abs_coord&&(s=2*Math.PI-s),0>k&&0>p&&!this.abs_coord&&(s=2*Math.PI-s),0>k&&0<p&&this.abs_coord&&(s=2*Math.PI-s),0<n&&0<q&&this.abs_coord&&(t=2*Math.PI-t),0<n&&0>q&&!this.abs_coord&&(t=2*Math.PI-t),0>n&&0>q&&!this.abs_coord&&
(t=2*Math.PI-t),0>n&&0<q&&this.abs_coord&&(t=2*Math.PI-t),m=Math.min(s,t),u=Math.max(s,t),s=m,t=u,t-s>Math.PI&&this.abs_coord&&(s=u,t=m),t-s<=Math.PI&&!this.abs_coord&&(s=u,t=m),this.iniAng=s,this.endAng=t,this.drawPoints=!0):(this.iniAng=a.degToRad(e)+b,this.endAng=a.degToRad(l)+b,this.drawAngle=!0)};a.Arc.prototype.draw=function(){this.uber.draw.call(this,this.fill,this.color)};a.Arc.prototype.drawTrace=function(){this.uber.drawTrace.call(this,this.fill,this.trace)};a.Arc.prototype.drawAux=function(a,
b,c){f=this.evaluator;l=this.space;y=f.evalExpression(this.radius);0>y&&(y=0);B=e(f.evalExpression(this.width));a.lineWidth=0<B?B:1E-6;a.lineCap="round";a.strokeStyle=c.getColor();this.drawAngle?(this.abs_coord?(v=e(this.exprX),w=e(this.exprY)):(v=e(l.getAbsoluteX(this.exprX)),w=e(l.getAbsoluteY(this.exprY)),y*=l.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=e(this.exprX),
w=e(this.exprY)):(v=e(l.getAbsoluteX(this.exprX)),w=e(l.getAbsoluteY(this.exprY)),y*=l.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,y,this.iniAng,this.endAng,void 0),a.fill());a.beginPath();a.arc(v,w,y,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",f.evalExpression(this.decimals),this.fixed,!0)};return a}(descartesJS||
{}),descartesJS=function(a){if(a.loadLib)return a;var e,f,d,b,c,h,g,r,k,p,n,q,s,t,m,u,l,v;a.Text=function(b,c){this.width=b.evaluator.parser.parse("0");a.Graphic.call(this,b,c);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(){e=this.evaluator;f=e.evalExpression(this.expresion);this.exprX=f[0][0];this.exprY=f[0][1];this.rotateExp&&(d=a.degToRad(e.evalExpression(this.rotateExp)),
b=Math.cos(d),c=Math.sin(d),h=this.exprX*b-this.exprY*c,g=this.exprX*c+this.exprY*b,this.exprX=h,this.exprY=g)};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?(n=this.text,this.ascent=0):n=this.splitText(this.text.toString(v,this.fixed).split("\\n"));this.text!=[""]&&this.uber.drawText.call(this,
a,n,parseInt(this.exprX)+5,parseInt(this.exprY)+this.ascent,b,this.font,this.align,"alphabetic",v,this.fixed)};a.Text.prototype.splitText=function(a){e=this.evaluator;r=e.evalExpression(this.width);n=[];this.ctx.font=this.font;if(20<=r&&"undefined"!=a.type){for(var b=0,c=a.length;b<c;b++)k=a[b],p=this.ctx.measureText(k).width,p>r?n=n.concat(this.splitWords(k,r)):n.push(k);q=Math.floor(1.2*this.fontSize)*n.length;e.setVariable("_Text_H_",q);return n}e.setVariable("_Text_H_",0);e.setVariable("_Text_W_",
1E3);return a};a.Text.prototype.splitWords=function(a,b){s=a;t=[];m="";l=0;for(var c,g=0,d=a.length;g<d;g++)u=s.charAt(g)," "===u&&(lastIndexOfWhite=g),m+=u,Math.round(this.ctx.measureText(m).width)>b&&(c=a.substring(l,g+1)," "!==u&&(-1===c.indexOf(" ")?(lastIndexOfWhite=g,g--):g=lastIndexOfWhite),t.push(a.substring(l,lastIndexOfWhite)),m="",l=g+1);t.push(a.substring(l));return t};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var e=Math.round,f,d,b,c,h,g,r,k,p,n,q,s,t,m;
a.Image=function(b,c){this.file="";this.inirot=b.evaluator.parser.parse("0");a.Graphic.call(this,b,c);this.img=new Image;this.scaleY=this.scaleX=1;this.update()};a.extend(a.Image,a.Graphic);a.Image.prototype.update=function(){f=this.evaluator;d=f.evalExpression(this.expresion);this.exprX=d[0][0];this.exprY=d[0][1];this.rotateExp&&(b=a.degToRad(f.evalExpression(this.rotateExp)),c=Math.cos(b),h=Math.sin(b),g=this.exprX*c-this.exprY*h,r=this.exprX*h+this.exprY*c,this.exprX=g,this.exprY=r);4==d[0].length&&
(this.centered=!0,this.scaleX=d[0][2],0==this.scaleX&&(this.scaleX=1E-5),this.scaleY=d[0][3],0==this.scaleY&&(this.scaleY=1E-5));d[1]&&2==d[1].length&&(this.centered=!0,this.scaleX=d[1][0],0==this.scaleX&&(this.scaleX=1E-5),this.scaleY=d[1][1],0==this.scaleY&&(this.scaleY=1E-5));if((k=f.evalExpression(this.file))||""==k)this.img=this.parent.getImage(k)};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){f=this.evaluator;p=this.space;this.img&&this.img.ready&&this.img.complete&&(n=this.centered?0:this.img.width/2,q=this.centered?0:this.img.height/2,s=this.abs_coord?e(this.exprX):e(p.getAbsoluteX(this.exprX)),t=this.abs_coord?e(this.exprY):e(p.getAbsoluteY(this.exprY)),m=a.degToRad(-f.evalExpression(this.inirot)),b.translate(s+n,t+q),b.rotate(m),b.scale(this.scaleX,this.scaleY),this.opacity&&(b.globalAlpha=f.evalExpression(this.opacity)),b.drawImage(this.img,-this.img.width/2,-this.img.height/
2),b.setTransform(1,0,0,1,0,0),b.globalAlpha=1)};return a}(descartesJS||{}),descartesJS=function(a){function e(a,b,c){r=4*(b+c*a.width);return{r:a.data[r],g:a.data[r+1],b:a.data[r+2],a:a.data[r+3]}}if(a.loadLib)return a;var f,d,b,c,h,g,r;a.Fill=function(b,c){a.Graphic.call(this,b,c)};a.extend(a.Fill,a.Graphic);a.Fill.prototype.update=function(){f=this.evaluator.evalExpression(this.expresion);this.exprX=f[0][0];this.exprY=f[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,f){f.getColor();imageData=this.ctx.getImageData(0,0,this.space.w,this.space.h);this.abs_coord?(d=parseInt(this.exprX),b=parseInt(this.exprY)):(d=parseInt(this.space.getAbsoluteX(this.exprX)),b=parseInt(this.space.getAbsoluteY(this.exprY)));if(!(0>d||0>b||d>=this.space.w||b>=this.space.h)){c=[{x:d,y:b}];for(g=e(imageData,d,b);0<c.length;){h=c.pop();d=h.x;b=h.y;var n=e(imageData,d,b);if(g.r===n.r&&g.g===n.g&&g.b===
n.b&&g.a===n.a){var n=imageData,q=f;r=4*(d+b*n.width);n.data[r+0]=q.r;n.data[r+1]=q.g;n.data[r+2]=q.b;n.data[r+3]=255-q.a;0<d&&c.push({x:d-1,y:b});d<imageData.width-1&&c.push({x:d+1,y:b});c.push({x:d,y:b-1});c.push({x:d,y:b+1})}}this.ctx.putImageData(imageData,0,0)}};return a}(descartesJS||{}),descartesJS=function(a,e){if(a.loadLib)return a;var f=/[\w\.\-//]*(\.png|\.jpg|\.gif|\.svg)/gi,d;a.Macro=function(b,c){this.hasExpresion=!1;this.inirot=b.evaluator.parser.parse("0");this.inipos=b.evaluator.parser.parse("(0,0)");
a.Graphic.call(this,b,c);for(var d in c)"expresion"==d&&(this.hasExpresion=!0),c.hasOwnProperty(d)&&(this[d]=c[d]);this.graphics=[];d=b.lessonParser;var g=new a.Tokenizer;if(this.hasExpresion){"'"!==this.expresion.charAt(0)&&(this.expresion="'"+this.expresion+"'");this.expresion=this.evaluator.parser.parse(this.expresion);var r=this.evaluator.evalExpression(this.expresion),k;r&&((k=document.getElementById(r))&&"descartes/macro"==k.type?k=k.text:(k=a.openExternalFile(r))&&!k.match(/tipo_de_macro/g)&&
(k=null));var p,n;if(k){n=k.replace(/&aacute;/g,"\u00e1").replace(/&eacute;/g,"\u00e9").replace(/&iacute;/g,"\u00ed").replace(/&oacute;/g,"\u00f3").replace(/&uacute;/g,"\u00fa").replace(/&Aacute;/g,"\u00c1").replace(/&Eacute;/g,"\u00c9").replace(/&Iacute;/g,"\u00cd").replace(/&Oacute;/g,"\u00d3").replace(/&Uacute;/g,"\u00da").replace(/&ntilde;/g,"\u00f1").replace(/&Ntilde;/g,"\u00d1").replace(/\&gt;/g,">").replace(/\&lt;/g,"<").replace(/\&amp;/g,"&").replace(/\r/g,"").split("\n");k=[];for(var r=0,
q=n.length;r<q;r++)if(p=n[r].indexOf("="),-1!==p){p=d.split(n[r]);for(var s=0,t=p.length;s<t;s++)p[s]&&1<p.length&&("id"!==e[p[s][0]]&&"type"!==e[p[s][0]]||k.push(p))}for(var m,u,r=0,q=k.length;r<q;r++)for(t=(s=k[r]||[])&&s[0]&&"id"===s[0][0],n=0,p=s.length;n<p;n++)if(m=s[n][0].indexOf("."),-1===m||t?m=e[s[n][0]]:(m=e[s[n][0].substring(m+1)],s[n][0]=this.name+"."+s[n][0]),!("font"===m||("fill"===m||"color"===m||"arrow"===m)&&"("!==s[n][1].charAt(0)||"file"===m&&s[n][1].match(f)||"id"!==m&&void 0!==
e[s[n][1]]))if("text"==m)if(s[n][1].match(/\{\\rtf1/)){m=s[n][1];var l=this;u=function(a,b){for(var c=g.tokenize(b.replace(/\&squot;/g,"'")),d=0,e=c.length;d<e;d++)"identifier"!=c[d].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("-"+
c[d].value+"-")||(c[d].value=l.name+"."+c[d].value);return(a.match(/^\\expr/)?"\\expr ":"\\decimals ")+g.flatTokens(c)};m=m.replace(/\\expr ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,u);m=m.replace(/\\decimals ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,u);s[n][1]=m}else{u=d.parseText(s[n][1]).textElementsMacros;for(var v=0,w=u.length;v<w;v++){m=g.tokenize(u[v].replace(/\&squot;/g,"'"));for(var y=0,C=m.length;y<C;y++)"identifier"!==m[y].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("-"+
m[y].value+"-")||(m[y].value=this.name+"."+m[y].value);m=g.flatTokens(m).replace(/&squot;/g,"'").replace(/'\+\(/g,"[").replace(/\)\+'/g,"]");u[v]=m.substring(1,m.length-1)}s[n][1]=u.join("")}else{u=s[n][1].replace(/\&squot;/g,"'").split(";");v=0;for(w=u.length;v<w;v++){m=g.tokenize(u[v]);y=0;for(C=m.length;y<C;y++)"identifier"!==m[y].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("-"+
m[y].value+"-")||(m[y].value=this.name+"."+m[y].value);u[v]=g.flatTokens(m)}s[n][1]=u.join(";")}r=0;for(q=k.length;r<q;r++)if(k[r][0]){s="";t=!1;n=0;for(p=k[r].length;n<p;n++)"type"===e[k[r][n][0]]&&(s="espacio='"+this.spaceID+"' ",t=!0),s=s+k[r][n][0]+"='"+k[r][n][1]+"' ";k[r]=s;t?this.graphics.push(d.parseGraphic(k[r],this.abs_coord,this.background,this.inirot)):d.parseAuxiliar(k[r])}}}};a.extend(a.Macro,a.Graphic);a.Macro.prototype.update=function(){d=this.evaluator.evalExpression(this.inipos);
this.iniPosX=d[0][0];this.iniPosY=d[0][1]};a.Macro.prototype.drawAux=function(a){for(var c=0,d=this.graphics.length;c<d;c++)this.graphics[c]&&(this.graphics[c].abs_coord?a.translate(this.iniPosX,this.iniPosY):a.translate(this.iniPosX*this.space.scale,-this.iniPosY*this.space.scale),this.graphics[c].draw(),a.setTransform(1,0,0,1,0,0))};return a}(descartesJS||{},babel),descartesJS=function(a){if(a.loadLib)return a;a.Generic=function(e,f){this.width=e.evaluator.parser.parse("1");a.Graphic.call(this,
e,f)};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,f,d){var b=this.evaluator.getDefinition(this.expresionString);b&&b.draw(a,f,d,this)};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var e=Math.sqrt,f=Math.sin,d=Math.cos,b,c,h,g,r,k,
p,n,q,s,t,m,u,l,v;a.norm3D=function(a){return e(a.x*a.x+a.y*a.y+a.z*a.z)};a.normalize3D=function(c){b=a.norm3D(c);if(0===b)return{x:0,y:0,z:0};if(1===b)return{x:c.x,y:c.y,z:c.z};b=1/b;return{x:c.x*b,y:c.y*b,z:c.z*b}};a.dotProduct3D=function(a,b){return a.x*b.x+a.y*b.y+a.z*b.z};a.crossProduct3D=function(a,b){return{x:a.y*b.z-a.z*b.y,y:a.z*b.x-a.x*b.z,z:a.x*b.y-a.y*b.x}};a.scalarProduct3D=function(a,b){return{x:a.x*b,y:a.y*b,z:a.z*b}};a.subtract3D=function(a,b){return{x:a.x-b.x,y:a.y-b.y,z:a.z-b.z}};
a.add3D=function(a,b){return{x:a.x+b.x,y:a.y+b.y,z:a.z+b.z}};a.equals3DEpsilon=function(a,b,c){return Math.abs(a.x-b.x)<=c&&Math.abs(a.y-b.y)<=c&&Math.abs(a.z-b.z)<=c};a.Vector4D=function(a,b,c,g){this.x=a||0;this.y=b||0;this.z=c||0;this.w=g||0};a.Matrix4x4=function(a,b,c,g,d,e,f,k,h,r,m,n,p,l,q,s){this.a00=a||0;this.a01=b||0;this.a02=c||0;this.a03=g||0;this.a10=d||0;this.a11=e||0;this.a12=f||0;this.a13=k||0;this.a20=h||0;this.a21=r||0;this.a22=m||0;this.a23=n||0;this.a30=p||0;this.a31=l||0;this.a32=
q||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(b){c=f(b);h=d(b);n=this.a10;q=this.a11;s=this.a12;t=this.a13;m=this.a20;u=this.a21;
l=this.a22;v=this.a23;return new a.Matrix4x4(this.a00,this.a01,this.a02,this.a03,n*h+m*c,q*h+u*c,s*h+l*c,t*h+v*c,n*-c+m*h,q*-c+u*h,s*-c+l*h,t*-c+v*h,this.a30,this.a31,this.a32,this.a33)};a.Matrix4x4.prototype.rotateY=function(b){c=f(b);h=d(b);g=this.a00;r=this.a01;k=this.a02;p=this.a03;m=this.a20;u=this.a21;l=this.a22;v=this.a23;return new a.Matrix4x4(g*h+m*-c,r*h+u*-c,k*h+l*-c,p*h+v*-c,this.a10,this.a11,this.a12,this.a13,g*c+m*h,r*c+u*h,k*c+l*h,p*c+v*h,this.a30,this.a31,this.a32,this.a33)};a.Matrix4x4.prototype.rotateZ=
function(b){c=f(b);h=d(b);g=this.a00;r=this.a01;k=this.a02;p=this.a03;n=this.a10;q=this.a11;s=this.a12;t=this.a13;return new a.Matrix4x4(g*h+n*c,r*h+q*c,k*h+s*c,p*h+t*c,g*-c+n*h,r*-c+q*h,k*-c+s*h,p*-c+t*h,this.a20,this.a21,this.a22,this.a23,this.a30,this.a31,this.a32,this.a33)};return a}(descartesJS||{}),descartesJS=function(a){function e(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+
0.5,0,h),a.fill(),a.stroke())}function f(a,b){a.lineCap=g;a.lineJoin=r;a.beginPath();a.moveTo(this.newV[0].x,this.newV[0].y);for(var c=1,d=this.newV.length;c<d;c++)a.lineTo(this.newV[c].x,this.newV[c].y);a.closePath();"color"===this.model?(a.fillStyle=0<=this.direction?this.backColor:this.frontColor,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.fill()):
"wire"===this.model&&(a.lineWidth=1.25,a.strokeStyle=this.frontColor,a.stroke());this.edges&&"wire"!==this.model&&(a.lineWidth=1,a.strokeStyle="#808080",a.stroke())}function d(a){t=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,t)}function b(a){a.lineCap=g;a.lineJoin=
r;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 c(b,c,g){k=a.subtract3D(b,c);p=a.subtract3D(b,g);return a.normalize3D(a.crossProduct3D(k,p))}if(a.loadLib)return a;var h=2*Math.PI,g="round",r="round",k,p,n,q,s,t;a.Primitive3D=function(a,g){this.space=g;for(var k in a)a.hasOwnProperty(k)&&(this[k]=a[k]);this.newV=[];this.spaceVertices=[];"vertex"===this.type?this.draw=e:"face"===
this.type?(this.normal=c(this.vertices[0],this.vertices[1],this.vertices[2]),this.draw=f):"text"===this.type?(this.fontSize=(this.fontSize=this.font.match(/(\d+)px/))?parseInt(this.fontSize[1]):10,this.draw=d):"edge"===this.type&&(this.draw=b);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(b){this.average={x:0,y:0,z:0};this.removeDoubles();this.normal={x:0,y:1,z:0};this.direction=
{x:1,y:0,z:0};for(var g=0,d=this.vertices.length;g<d;g++)this.newV[g]=b.rotateVertex(this.vertices[g]),this.spaceVertices[g]=b.rotateVertex(this.vertices[g]),this.average.x+=this.newV[g].x,this.average.y+=this.newV[g].y,this.average.z+=this.newV[g].z;this.average=a.scalarProduct3D(this.average,1/d);this.averageP=b.project(this.average);this.depth=this.averageP.z;2<this.vertices.length&&(this.normal=c(this.newV[0],this.newV[1],this.newV[2]),this.direction=a.dotProduct3D(this.normal,a.normalize3D(b.eye)));
g=0;for(d=this.vertices.length;g<d;g++)this.newV[g]=b.project(this.newV[g])};var m;a.Primitive3D.prototype.removeDoubles=function(){if("edge"!==this.type){m=[];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||m.push(this.vertices[a]);0===m.length&&m.push(this.vertices[0]);this.vertices=m}};a.Primitive3D.prototype.drawText=
function(b,c,g,d,e,f,k,h,r,m,p){if("rtfNode"==c.type)b.fillStyle=e,b.strokeStyle=e,b.textBaseline="alphabetic",c.draw(b,g,d,r,m,k,p);else for("simpleText"===c.type&&(c=c.toString(r,m).split("\\n")),g+=f.match("Arial")?-2:f.match("Times")?-2:0,n=this.evaluator,b.fillStyle=a.getColor(n,e),b.font=f,b.textAlign=k,b.textBaseline=h,q=1.2*this.fontSize||0,e=0,f=c.length;e<f;e++)s=c[e],this.border&&b.strokeText(s,g,d+q*e),b.fillText(s,g,d+q*e)};a.Primitive3D.prototype.splitFace=function(b){if(this.intersects(b)){for(var c=
null,g=null,d=0,e=0,f=0,k=b.vertices.length;f<k;f++){var h=this.intersection(b.vertices[f],b.vertices[(f+1)%k]);if(null!==h)if(null===c){if(c=h,d=f,2===b.vertices.length){g=c;break}}else if(!a.equals3DEpsilon(h,c,1E-8)){g=h;e=f;break}}if(null!==c&&null!==g){var f=this.isInterior(c)||this.isInterior(g),r=null,m=null;if(!f&&3<=b.vertices.length)for(var k=0,n=this.vertices.length;k<n;k++)if(h=b.intersection(this.vertices[k],this.vertices[(k+1)%n]),null!==h)if(null===r)r=h;else if(!a.equals3DEpsilon(h,
r,1E-8)){m=h;break}if(f||null!==r&&null!==m&&b.isInterior(r)&&b.isInterior(m)){m=!0;n=b.vertices;r=h=null;if(2===n.length)a.equals(c,n[0],1E-8)||a.equals(c,n[1],1E-8)?m=!1:(h=[],h[0]=n[0],h[1]=c,r=[],r[0]=c,r[1]=n[1]);else for(var h=[],r=[],p=0,f=k=0;f<n.length;f++)f<d?h[p++]=n[f]:f==d?(h[p++]=n[f],h[p++]=c,r[k++]=c):f<e?r[k++]=n[f]:f==e?(r[k++]=n[f],r[k++]=g,h[p++]=g):h[p++]=n[f];if(m)return c=[],c[0]=new a.Primitive3D({vertices:h,type:"face",frontColor:b.frontColor,backColor:b.backColor,edges:b.edges,
model:b.model},this.space),c[0].normal=b.normal,c[1]=new a.Primitive3D({vertices:r,type:"face",frontColor:b.frontColor,backColor:b.backColor,edges:b.edges,model:b.model},this.space),c[1].normal=b.normal,c}}}return[b]};a.Primitive3D.prototype.intersects=function(a){return this.intersectsPlane(a)&&a.intersectsPlane(this)};a.Primitive3D.prototype.intersectsPlane=function(b){var c=a.dotProduct3D(b.vertices[0],b.normal),g=a.dotProduct3D(this.vertices[0],b.normal);if(1E-8>Math.abs(c-g))return!0;for(var d=
1,e=this.vertices.length;d<e;d++){var f=a.dotProduct3D(this.vertices[d],b.normal);if(1E-8>Math.abs(c-f)||f>c&&g<c||f<c&&g>c)return!0}return!1};a.Primitive3D.prototype.intersection=function(b,c){if(0<this.vertices.length){var g=a.subtract3D(c,b),d=a.dotProduct3D(g,this.normal);if(0!==d&&(d=a.dotProduct3D(a.subtract3D(this.vertices[0],b),this.normal)/d,-1E-8<d&&1.00000001>d))return a.add3D(b,a.scalarProduct3D(g,d))}return null};a.Primitive3D.prototype.isInterior=function(b){if(0<this.vertices.length)for(var c=
0,g=a.subtract3D(this.vertices[0],b),d=0,e=this.vertices.length;d<e;d++){var f=a.subtract3D(this.vertices[(d+1)%e],b),k=a.dotProduct3D(a.crossProduct3D(g,f),this.normal);if(1E-8>Math.abs(k)){if(0>a.dotProduct3D(g,f))break}else{if(0>c&&0<k||0<c&&0>k)return!1;g=f;c=k}}return!0};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var e={x:0,y:0,z:0},f,d,b,c,h,g,r,k;a.Graphic3D=function(b,c){this.parent=b;this.evaluator=b.evaluator;var g=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=g.parse("1");this.abs_coord=!1;this.family="";this.family_interval=g.parse("[0,1]");this.family_steps=g.parse("8");this.font="Monospaced,PLAIN,12";this.fixed=!0;this.text="";this.decimals=g.parse("2");this.inirot="(0,0,0)";this.inirotEuler=!1;this.inipos=g.parse("(0,0,0)");this.endrot="(0,0,0)";this.endrotEuler=!1;this.endpos=
g.parse("(0,0,0)");this.model="color";for(var d in c)c.hasOwnProperty(d)&&(this[d]=c[d]);void 0==this.expresion&&"macro"!=this.type&&(this.expresion=g.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=g.parse(this.inirot);this.endrot=g.parse(this.endrot);this.inirotM=new a.Matrix4x4;this.inirotM_X=new a.Matrix4x4;this.inirotM_Y=new a.Matrix4x4;this.inirotM_Z=new a.Matrix4x4;this.iniposM=new a.Matrix4x4;this.endrotM=new a.Matrix4x4;this.endrotM_X=new a.Matrix4x4;this.endrotM_Y=new a.Matrix4x4;this.endrotM_Z=new a.Matrix4x4;this.endposM=new a.Matrix4x4};a.Graphic3D.prototype.getSpace=
function(){for(var a=this.parent.spaces,b,c=0,g=a.length;c<g;c++)if(b=a[c],b.id==this.spaceID)return b;return a[0]};a.Graphic3D.prototype.getFamilyValues=function(){f=this.evaluator;d=f.evalExpression(this.family_interval);this.familyInf=d[0][0];this.familySup=d[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.Graphic3D.prototype.buildFamilyPrimitives=function(){f=this.evaluator;this.getFamilyValues();
b=f.getVariable(this.family);if(0<=this.fSteps)for(var a=0,c=this.fSteps;a<=c;a++)f.setVariable(this.family,this.familyInf+a*this.family_sep),this.familyValue=this.familyInf+a*this.family_sep,f.evalExpression(this.drawif)&&this.buildPrimitives();f.setVariable(this.family,b)};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(){h=
this.evaluator.evalExpression(this.inirot);this.inirotEuler?(this.inirotM=this.inirotM.setIdentity(),this.inirotM=this.inirotM.rotateZ(a.degToRad(h[0][0])),this.inirotM=this.inirotM.rotateX(a.degToRad(h[0][1])),this.inirotM=this.inirotM.rotateZ(a.degToRad(h[0][2]))):(this.inirotM_X=this.inirotM_X.setIdentity().rotateX(a.degToRad(h[0][0])),this.inirotM_Y=this.inirotM_Y.setIdentity().rotateY(a.degToRad(h[0][1])),this.inirotM_Z=this.inirotM_Z.setIdentity().rotateZ(a.degToRad(h[0][2])));h=this.evaluator.evalExpression(this.inipos);
e={x:h[0][0],y:h[0][1],z:h[0][2]};this.iniposM=this.iniposM.setIdentity().translate(e);h=this.evaluator.evalExpression(this.endrot);this.endrotEuler?(this.endrotM=this.endrotM.setIdentity(),this.endrotM=this.endrotM.rotateZ(a.degToRad(h[0][0])),this.endrotM=this.endrotM.rotateX(a.degToRad(h[0][1])),this.endrotM=this.endrotM.rotateZ(a.degToRad(h[0][2]))):(this.endrotM_X=this.endrotM_X.setIdentity().rotateX(a.degToRad(h[0][0])),this.endrotM_Y=this.endrotM_Y.setIdentity().rotateY(a.degToRad(h[0][1])),
this.endrotM_Z=this.endrotM_Z.setIdentity().rotateZ(a.degToRad(h[0][2])));h=this.evaluator.evalExpression(this.endpos);e={x:h[0][0],y:h[0][1],z:h[0][2]};this.endposM=this.endposM.setIdentity().translate(e)};a.Graphic3D.prototype.transformVertex=function(a){this.macroChildren&&(a=this.applyMacroTransform(a));this.inirotEuler?c=this.inirotM.multiplyVector4(a):(c=this.inirotM_X.multiplyVector4(a),c=this.inirotM_Y.multiplyVector4(c),c=this.inirotM_Z.multiplyVector4(c));c=this.iniposM.multiplyVector4(c);
this.endrotEuler?c=this.endrotM.multiplyVector4(c):(c=this.endrotM_X.multiplyVector4(c),c=this.endrotM_Y.multiplyVector4(c),c=this.endrotM_Z.multiplyVector4(c));return c=this.endposM.multiplyVector4(c)};a.Graphic3D.prototype.applyMacroTransform=function(a){this.macro_inirotEuler?c=this.macro_inirotM.multiplyVector4(a):(c=this.macro_inirotM_X.multiplyVector4(a),c=this.macro_inirotM_Y.multiplyVector4(c),c=this.macro_inirotM_Z.multiplyVector4(c));c=this.macro_iniposM.multiplyVector4(c);this.macro_endrotEuler?
c=this.macro_endrotM.multiplyVector4(c):(c=this.macro_endrotM_X.multiplyVector4(c),c=this.macro_endrotM_Y.multiplyVector4(c),c=this.macro_endrotM_Z.multiplyVector4(c));return c=this.macro_endposM.multiplyVector4(c)};a.Graphic3D.prototype.parseExpression=function(){h=this.expresion.split("=");g=h[0];r=[];for(var a=1;a<h.length;a++)g+="=",k=h[a].lastIndexOf(" "),g+=-1!==k?h[a].substring(0,k):h[a],r.push(this.evaluator.parser.parse(g,!0)),g=h[a].substring(k+1);return r};var p;a.Graphic3D.prototype.splitFace=
function(a){for(var b=0,c=this.primitives.length;b<c;b++)if(p=[],"face"===this.primitives[b].type){for(var g=0,d=a.primitives.length;g<d;g++)"face"===a.primitives[g].type?p=p.concat(this.primitives[b].splitFace(a.primitives[g])):p.push(a.primitives[g]);a.primitives=p}};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var e,f,d,b,c;a.Point3D=function(b,c){a.Graphic3D.call(this,b,c)};a.extend(a.Point3D,a.Graphic3D);a.Point3D.prototype.buildPrimitives=function(){e=this.evaluator;
this.updateMVMatrix();f=e.evalExpression(this.expresion);d=f[0][0];b=f[0][1];c=f[0][2];this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(d,b,c,1))],type:"vertex",backColor:this.backcolor.getColor(),frontColor:this.color.getColor(),size:e.evalExpression(this.width)}));""!==this.text&&this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(d,b,c,1))],type:"text",frontColor:this.color.getColor(),font:this.font,decimals:e.evalExpression(this.decimals),
fixed:this.fixed,displace:this.fontSize,evaluator:e,text:this.text,family:this.family,familyValue:this.familyValue},this.space))};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var e,f,d,b,c,h,g;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();g=evaluator.getVariable("u");evaluator.setVariable("u",
this.Nu);expr=evaluator.evalExpression(this.expresion);e=expr[0][0];f=expr[0][1];d=expr[0][2];b=expr[1][0];c=expr[1][1];h=expr[1][2];this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(e,f,d,1)),this.transformVertex(new a.Vector4D(b,c,h,1))],type:"edge",frontColor:this.color.getColor(),lineWidth:evaluator.evalExpression(this.width)},this.space));evaluator.setVariable("u",g)};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var e,f,d,b,c,h,
g;a.Surface3D=function(b,c){this.parameter="t";this.parameter_interval=b.evaluator.parser.parse("[0,1]");this.parameter_steps=b.evaluator.parser.parse("8");a.Graphic3D.call(this,b,c);this.expresion=this.parseExpression()};a.extend(a.Surface3D,a.Graphic3D);a.Surface3D.prototype.buildPrimitives=function(){e=this.evaluator;this.updateMVMatrix();d=e.getVariable("x");d=e.getVariable("y");d=e.getVariable("z");f=e.getVariable("u");d=e.getVariable("v");e.setVariable("u",0);e.setVariable("v",0);b=e.evalExpression(this.Nu);
c=e.evalExpression(this.Nv);h=[];for(var r=0;r<=b;r++){e.setVariable("u",r/b);for(var k=0;k<=c;k++){e.setVariable("v",k/c);for(var p=0,n=this.expresion.length;p<n;p++)e.evalExpression(this.expresion[p]);h.push(this.transformVertex(new a.Vector4D(e.getVariable("x"),e.getVariable("y"),e.getVariable("z"),1)))}}for(r=0;r<b;r++)for(k=0;k<c;k++)g=[],g.push(h[k+r*c+r]),g.push(h[k+1+r*c+r]),g.push(h[k+2+(r+1)*c+r]),g.push(h[k+1+(r+1)*c+r]),this.primitives.push(new a.Primitive3D({vertices:g,type:"face",frontColor:this.color.getColor(),
backColor:this.backcolor.getColor(),edges:this.edges,model:this.model},this.space));e.setVariable("x",void 0);e.setVariable("y",void 0);e.setVariable("z",void 0);e.setVariable("u",f);e.setVariable("v",d)};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var e,f,d,b,c,h;a.Polygon3D=function(b,c){this.width=b.evaluator.parser.parse("1");a.Graphic3D.call(this,b,c)};a.extend(a.Polygon3D,a.Graphic3D);a.Polygon3D.prototype.buildPrimitives=function(){evaluator=this.evaluator;this.updateMVMatrix();
expr=evaluator.evalExpression(this.expresion);for(var g=0,r=expr.length-1;g<r;g++)e=expr[g][0],f=expr[g][1],d=expr[g][2],b=expr[g+1][0],c=expr[g+1][1],h=expr[g+1][2],this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(e,f,d,1)),this.transformVertex(new a.Vector4D(b,c,h,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 e,f,d,b,
c,h;a.Curve3D=function(b,c){this.width=b.evaluator.parser.parse("1");a.Graphic3D.call(this,b,c);this.expresion=this.parseExpression()};a.extend(a.Curve3D,a.Graphic3D);a.Curve3D.prototype.buildPrimitives=function(){evaluator=this.evaluator;this.updateMVMatrix();b=evaluator.getVariable("x");c=evaluator.getVariable("y");h=evaluator.getVariable("z");d=evaluator.getVariable("u");evaluator.setVariable("u",0);f=evaluator.evalExpression(this.Nu);e=[];for(var g=0;g<=f;g++){evaluator.setVariable("u",g/f);for(var r=
0,k=this.expresion.length;r<k;r++)evaluator.evalExpression(this.expresion[r]);e.push(this.transformVertex(new a.Vector4D(evaluator.getVariable("x"),evaluator.getVariable("y"),evaluator.getVariable("z"),1)))}g=0;for(r=e.length-1;g<r;g++)this.primitives.push(new a.Primitive3D({vertices:[e[g],e[g+1]],type:"edge",frontColor:this.color.getColor(),lineWidth:evaluator.evalExpression(this.width)},this.space));evaluator.setVariable("x",b);evaluator.setVariable("y",h);evaluator.setVariable("z",c);evaluator.setVariable("u",
d)};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var e,f,d,b,c,h,g,r,k;a.Triangle3D=function(b,c){a.Graphic3D.call(this,b,c)};a.extend(a.Triangle3D,a.Graphic3D);a.Triangle3D.prototype.buildPrimitives=function(){evaluator=this.evaluator;this.updateMVMatrix();expr=evaluator.evalExpression(this.expresion);e=expr[0][0];f=expr[0][1];d=expr[0][2];b=expr[1][0];c=expr[1][1];h=expr[1][2];g=expr[2][0];r=expr[2][1];k=expr[2][2];this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(e,
f,d,1)),this.transformVertex(new a.Vector4D(g,r,k,1)),this.transformVertex(new a.Vector4D(b,c,h,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 e;a.Face3D=function(e,d){a.Graphic3D.call(this,e,d)};a.extend(a.Face3D,a.Graphic3D);a.Face3D.prototype.buildPrimitives=function(){evaluator=this.evaluator;this.updateMVMatrix();expr=evaluator.evalExpression(this.expresion);
e=[];for(var f=expr.length-1;0<=f;f--)e.push(this.transformVertex(new a.Vector4D(expr[f][0],expr[f][1],expr[f][2],1)));this.primitives.push(new a.Primitive3D({vertices:e,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 e,f,d,b,c;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();e=evaluator.evalExpression(this.Nu);f=[this.transformVertex(new a.Vector4D(0,0,0,1))];d=evaluator.evalExpression(this.width)/2;b=evaluator.evalExpression(this.length)/2;c=2*Math.PI/e;for(var h=0;h<e;h++)f.push(this.transformVertex(new a.Vector4D(d*Math.cos(c*h),b*Math.sin(c*h),0,1)));for(h=0;h<e;h++)this.primitives.push(new a.Primitive3D({vertices:[f[0],h+2<=e?f[h+
2]:f[1],f[h+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 e,f,d,b;a.Text3D=function(b,d){a.Graphic3D.call(this,b,d)};a.extend(a.Text3D,a.Graphic3D);a.Text3D.prototype.buildPrimitives=function(){e=this.evaluator;f=e.evalExpression(this.expresion);d=f[0][0];b=f[0][1];this.primitives.push(new a.Primitive3D({vertices:[new a.Vector4D(d,b,0,
1)],type:"text",frontColor:this.color.getColor(),font:this.font,decimals:e.evalExpression(this.decimals),fixed:this.fixed,displace:0,isText:!0,evaluator:e,text:this.text,family:this.family,familyValue:this.familyValue,joel:"hola"},this.space))};return a}(descartesJS||{}),descartesJS=function(a,e){if(a.loadLib)return a;var f=/[\w\.\-//]*(\.png|\.jpg|\.gif|\.svg)/gi,d,b;a.Macro3D=function(b,d){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,d);for(var g in d)d.hasOwnProperty(g)&&(this[g]=d[g]);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=[];g=b.lessonParser;var r=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 k=this.evaluator.evalExpression(this.expresion),
p;k&&((p=document.getElementById(k))&&"descartes/macro"==p.type?p=p.text:(p=a.openExternalFile(k))&&!p.match(/tipo_de_macro/g)&&(p=null));var n,q;if(p){q=p.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");p=[];for(var k=0,s=q.length;k<s;k++)n=q[k].indexOf("="),-1!==n&&(n=q[k].substring(0,n),"id"!==e[n]&&"type"!==e[n]||p.push(g.split(q[k])));for(var t,m,u,l,k=0,s=p.length;k<s;k++)for(l=(t=p[k]||[])&&t[0]&&"id"===t[0][0],q=0,n=t.length;q<n;q++)if(m=t[q][0].indexOf("."),-1===m||l?m=e[t[q][0]]:(m=e[t[q][0].substring(m+1)],t[q][0]=this.name+"."+t[q][0]),!("font"===m||("fill"===m||"color"===m||"backcolor"===
m||"arrow"===m)&&"("!==t[q][1].charAt(0)||"file"===m&&t[q][1].match(f)||"id"!==m&&void 0!==e[t[q][1]])||"width"===m||"height"===m||"length"===m)if("text"==m)if(t[q][1].match(/\{\\rtf1/)){m=t[q][1];var v=this;u=function(a,b){for(var c=r.tokenize(b.replace(/\&squot;/g,"'")),g=0,d=c.length;g<d;g++)"identifier"!=c[g].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[g].value+"-")||
(c[g].value=v.name+"."+c[g].value);return(a.match(/^\\expr/)?"\\expr ":"\\decimals ")+r.flatTokens(c)};m=m.replace(/\\expr ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.']*)/gi,u);m=m.replace(/\\decimals ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.']*)/gi,u);t[q][1]=m}else{u=g.parseText(t[q][1]).textElementsMacro3Ds;for(var w=0,y=u.length;w<y;w++){m=r.tokenize(u[w].replace(/\&squot;/g,"'"));for(var C=0,B=m.length;C<B;C++)"identifier"!==m[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("-"+
m[C].value+"-")||(m[C].value=this.name+"."+m[C].value);m=r.flatTokens(m).replace(/&squot;/g,"'").replace(/'\+\(/g,"[").replace(/\)\+'/g,"]");u[w]=m.substring(1,m.length-1)}t[q][1]=u.join("")}else{m=r.tokenize(t[q][1]);u=0;for(w=m.length;u<w;u++)"identifier"!==m[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("-"+m[u].value+"-")||(m[u].value=this.name+"."+m[u].value);t[q][1]=r.flatTokens(m)}k=
0;for(s=p.length;k<s;k++)if(p[k][0]){t="";l=!1;q=0;for(n=p[k].length;q<n;q++)"type"===e[p[k][q][0]]&&(t="espacio='"+this.spaceID+"' ",l=!0),t=t+p[k][q][0]+"='"+p[k][q][1]+"' ";p[k]=t;l?this.graphics.push(g.parse3DGraphic(p[k],this.abs_coord,this.background,this.inirot)):g.parseAuxiliar(p[k])}}k=0;for(s=this.graphics.length;k<s;k++)this.graphics[k].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,e=this.graphics.length;a<e;a++)d=this.graphics[a],d.macro_inirotEuler=this.inirotEuler,d.macro_inirotM=this.inirotM,d.macro_inirotM_X=this.inirotM_X,d.macro_inirotM_Y=this.inirotM_Y,d.macro_inirotM_Z=this.inirotM_Z,d.macro_iniposM=this.iniposM,d.macro_endrotEuler=this.endrotEuler,d.macro_endrotM=this.endrotM,d.macro_endrotM_X=this.endrotM_X,d.macro_endrotM_Y=this.endrotM_Y,d.macro_endrotM_Z=this.endrotM_Z,d.macro_endposM=this.endposM,
d.update();a=0;for(e=this.graphics.length;a<e;a++){d=this.graphics[a];if(d.split||this.split)for(var g=a+1;g<e;g++)b=this.graphics[g],(b.split||this.split)&&d.splitFace(b);this.primitives=this.primitives.concat(d.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 e(a,b,c,g,d){f.call(this,a/1.8,a/1.8,a/1.8,g,d)}function f(a,b,c,g,d){a/=2;b/=2;c/=2;this.changeGeometry(a,b,c,g,d)||(this.vertices=[new m(a,c,b,1),new m(a,-c,b,1),new m(a,c,-b,1),new m(a,-c,-b,1),new m(-a,c,b,1),new m(-a,-c,b,1),new m(-a,c,-b,1),new m(-a,-c,-b,1)],this.faces=
[[2,3,1,0],[1,5,4,0],[5,7,6,4],[6,7,3,2],[4,6,2,0],[3,7,5,1]],this.updateValues(a,b,c,g,d))}function d(a,b,c,g,d){a/=2;this.changeGeometry(a,b,c,g,d)||(this.vertices=[new m(0,0,a,1),new m(-0.49*a,-0.86*a,-0.32*a,1),new m(-0.49*a,0.86*a,-0.32*a,1),new m(1*a,0,-0.32*a,1)],this.faces=[[3,2,1],[1,2,0],[2,3,0],[3,1,0]],this.updateValues(a,b,c,g,d))}function b(a,b,c,g,d){a/=2;this.changeGeometry(a,b,c,g,d)||(this.vertices=[new m(0,0,a,1),new m(a,0,0,1),new m(-a,0,0,1),new m(0,a,0,1),new m(0,-a,0,1),new m(0,
0,-a,1)],this.faces=[[3,1,0],[2,3,0],[1,4,0],[4,2,0],[1,3,5],[3,2,5],[4,1,5],[2,4,5]],this.updateValues(a,b,c,g,d))}function c(b,c,g,d,e){b/=3.4;if(!this.changeGeometry(b,c,g,d,e)){E=b/D;z=b*D;this.vertices=[new m(b,b,b,1),new m(b,b,-b,1),new m(b,-b,b,1),new m(b,-b,-b,1),new m(-b,b,b,1),new m(-b,b,-b,1),new m(-b,-b,b,1),new m(-b,-b,-b,1),new m(0,E,z,1),new m(0,E,-z,1),new m(0,-E,z,1),new m(0,-E,-z,1),new m(E,z,0,1),new m(E,-z,0,1),new m(-E,z,0,1),new m(-E,-z,0,1),new m(z,0,E,1),new m(z,0,-E,1),new m(-z,
0,E,1),new m(-z,0,-E,1)];A=(new a.Matrix4x4).setIdentity().rotateY(-s/6);for(var f=0,k=this.vertices.length;f<k;f++)this.vertices[f]=A.multiplyVector4(this.vertices[f]);this.faces=[[0,16,2,10,8],[12,1,17,16,0],[8,4,14,12,0],[2,16,17,3,13],[13,15,6,10,2],[6,18,4,8,10],[3,17,1,9,11],[13,3,11,7,15],[1,12,14,5,9],[11,9,5,19,7],[5,14,4,18,19],[6,15,7,19,18]];this.updateValues(b,c,g,d,e)}}function h(b,c,g,d,e){b/=4;if(!this.changeGeometry(b,c,g,d,e)){z=b*D;this.vertices=[new m(0,b,z,1),new m(0,b,-z,1),
new m(0,-b,z,1),new m(0,-b,-z,1),new m(b,z,0,1),new m(b,-z,0,1),new m(-b,z,0,1),new m(-b,-z,0,1),new m(z,0,b,1),new m(z,0,-b,1),new m(-z,0,b,1),new m(-z,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]];A=(new a.Matrix4x4).setIdentity().rotateY(-1.029);for(var f=0,k=this.vertices.length;f<k;f++)this.vertices[f]=A.multiplyVector4(this.vertices[f]);this.updateValues(b,
c,g,d,e)}}function g(a,b,c,g,d){a/=2;this.isSphere?c=b=a:(b/=2,c/=2);if(!this.changeGeometry(a,b,c,g,d)){this.vertices=[new m(0,0,b,1)];for(var e=1;e<g;e++){B=e*s/g;for(var f=0;f<d;f++)C=f*t/d,v=a*n(B)*q(C),w=c*n(B)*n(C),y=b*q(B),this.vertices.push(new m(v,w,y,1))}this.vertices.push(new m(0,0,-b,1));this.faces=[];for(e=0;e<d;e++)this.faces.push([0,(e+1)%d+1,e%d+1]);for(e=1;e<g-1;e++)for(f=0;f<d;f++)this.faces.push([f+1+(e-1)*d,(f+1)%d+1+(e-1)*d,(f+1)%d+1+e*d,f+1+e*d]);for(e=0;e<d;e++)this.faces.push([this.vertices.length-
1,this.vertices.length-1-d+e,this.vertices.length-1-d+(e+1)%d]);this.updateValues(a,b,c,g,d)}}function r(a,b,c,g,d){a/=2;b/=2;c/=2;if(!this.changeGeometry(a,b,c,g,d)){this.vertices=[];for(var e=0;e<d;e++)for(var f=0;f<g;f++)v=a*(d-e)/d*q(f*t/g),w=c*(d-e)/d*n(f*t/g),y=b-2*e*b/d,this.vertices.push(new m(v,w,y,1));this.vertices.push(new m(0,0,-b,1));this.faces=[];for(e=0;e<d-1;e++)for(f=0;f<g;f++)this.faces.push([f+e*g,(f+1)%g+e*g,(f+1)%g+(e+1)*g,f+(e+1)*g]);for(e=0;e<g;e++)this.faces.push([this.vertices.length-
1,this.vertices.length-1-g+e,this.vertices.length-1-g+(e+1)%g]);this.updateValues(a,b,c,g,d)}}function k(a,b,c,g,d){a/=2;b/=2;c/=2;if(!this.changeGeometry(a,b,c,g,d)){this.vertices=[];for(var e=0;e<d+1;e++)for(var f=0;f<g;f++)v=a*q(f*t/g),w=c*n(f*t/g),y=b-2*e*b/d,this.vertices.push(new m(v,w,y,1));this.faces=[];for(e=0;e<d;e++)for(f=0;f<g;f++)this.faces.push([f+e*g,(f+1)%g+e*g,(f+1)%g+(e+1)*g,f+(e+1)*g]);this.updateValues(a,b,c,g,d)}}function p(){function a(b){return parseInt(b)}function b(a){return parseFloat(a)}
this.vertices=[];this.faces=[];for(var c=0,g=this.fileData.length;c<g;c++)H=this.fileData[c],H.match(/^V\(/)?(G=H.substring(2,H.length-1).split(",").map(b),this.vertices.push(new m(G[0]||0,G[1]||0,G[2]||0,1))):H.match(/^F\(/)&&(G=H.substring(2,H.length-1).split(",").map(a),this.faces.push(G.reverse()))}if(a.loadLib)return a;var n=Math.sin,q=Math.cos,s=Math.PI,t=2*s,m,u,l,v,w,y,C,B,D=1.6180339887,E,z,A,H,G;a.OtherGeometry=function(n,q){this.width=n.evaluator.parser.parse("2");this.height=n.evaluator.parser.parse("2");
this.length=n.evaluator.parser.parse("2");m=a.Vector4D;a.Graphic3D.call(this,n,q);switch(this.type){case "cube":this.buildGeometry=e;break;case "box":this.buildGeometry=f;break;case "tetrahedron":this.buildGeometry=d;break;case "octahedron":this.buildGeometry=b;break;case "sphere":this.isSphere=!0;case "ellipsoid":this.buildGeometry=g;break;case "dodecahedron":this.buildGeometry=c;break;case "icosahedron":this.buildGeometry=h;break;case "cone":this.buildGeometry=r;break;case "cylinder":this.buildGeometry=
k;break;case "mesh":this.fileData=a.openExternalFile(this.evaluator.evalExpression(this.file)).split(/\r/),this.buildGeometry=p}};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));for(var b=0,c=this.faces.length;b<c;b++){l=[];for(var g=0,d=this.faces[b].length;g<
d;g++)l.push(this.transformVertex(this.vertices[this.faces[b][g]]));this.primitives.push(new a.Primitive3D({vertices:l,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,c,g,d){return this.oldWidth===a&&this.oldHeight===b&&this.oldLength===c&&this.oldNu===g&&this.oldNv===d};a.OtherGeometry.prototype.updateValues=function(a,b,c,g,d){this.oldWidth=a;this.oldHeight=b;
this.oldLength=c;this.oldNv=d;this.oldNu=g};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var e=Math.max,f=Math.min,d=Math.PI,b=Math.cos,c=Math.sin,h=Math.abs,g=Math.round,r,k,p,n,q,s,t,m,u,l,v,w,y,C,B,D,E,z;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 g(e(f(this.x,32E3),-32E3))};a.R2.prototype.iy=function(){return g(e(f(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){k=this.copy();k.sub(a);return k.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(){r=this.norm();0!=r&&this.div(r)};a.R2.prototype.rotR90=function(){r=this.x;this.x=this.y;this.y=-r};a.R2.prototype.rotL90=function(){r=this.x;this.x=-this.y;this.y=r};a.R2.prototype.rot=function(a){p=this.copy();s=b(a);t=c(a);this.x=p.x*s-p.y*t;this.y=p.x*t+p.y*s};a.R2.prototype.rot=function(a){this.rot(a*d/180)};a.R2.prototype.intersection=
function(b,c,g,d){m=c.x-b.x;u=g.x-d.x;l=g.x-b.x;v=c.y-b.y;w=g.y-d.y;y=g.y-b.y;z=m*w-u*v;return 1E-6<h(z)?(n=(l*w-y*u)/z,q=(-l*v+y*m)/z,0<=n&&1>=n&&0<=q&&1>=q?new a.R2(b.x+m*n,b.y+v*n):null):(c.x-g.x)*y!=(c.y-g.y)*l?null:b.x!=c.x?(C=f(b.x,c.x),B=e(b.x,c.x),C<=g.x&&g.x<=B?g:C<=d.x&&d.x<=B?d:null):g.x!=d.x?(D=f(g.x,d.x),E=e(g.x,d.x),D<=b.x&&b.x<=E?b:D<=c.x&&c.x<=E?c:null):b.y!=c.y?(C=f(b.y,c.y),B=e(b.y,c.y),C<=g.y&&g.y<=B?g:C<=d.y&&d.y<=B?d:null):g.y!=d.y?(D=f(g.y,d.y),E=e(g.y,d.y),D<=b.y&&b.y<=E?b:
D<=c.y&&c.y<=E?c:null):b.x==g.x&&b.y==g.y?b:null};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var e,f,d,b,c,h,g,r,k;a.R2Newton=function(b,g){this.evaluator=b;this.constraint=g;if("=="==this.constraint.value||"<"==this.constraint.value||"<="==this.constraint.value||">"==this.constraint.value||">="==this.constraint.value)this.sign="<"==this.constraint.value||"<="==this.constraint.value?"menor":">"==this.constraint.value||">="==this.constraint.value?"mayor":"igual",this.constraint=
this.constraint.equalToMinus(),this.constraint=this.constraint.childs[0];h=new a.R2(0,0);c=new a.R2(0,0);k=new a.R2(0,0)};a.R2Newton.prototype.getUnitNormal=function(){this.normal.normalize();return k.set(this.normal.x,this.normal.y)};a.R2Newton.prototype.gradient=function(a){e=this.evaluator;h.x=0;h.y=0;g=e.getVariable("x");r=e.getVariable("y");e.setVariable("x",a.x);e.setVariable("y",a.y);this.f0=e.evalExpression(this.constraint);e.setVariable("x",e.getVariable("x")+1E-6);f=e.evalExpression(this.constraint);
h.x=(f-this.f0)/1E-6;h.x=isNaN(h.x)?Infinity:h.x;e.setVariable("x",e.getVariable("x")-1E-6);e.setVariable("y",e.getVariable("y")+1E-6);f=e.evalExpression(this.constraint);h.y=(f-this.f0)/1E-6;h.y=isNaN(h.y)?Infinity:h.y;e.setVariable("x",g);e.setVariable("y",r);return h};a.R2Newton.prototype.findZero=function(a,f,k){e=this.evaluator;c.x=a.x;c.y=a.y;g=e.getVariable("x");r=e.getVariable("y");e.setVariable("x",a.x);e.setVariable("y",a.y);this.f0=e.evalExpression(this.constraint);if("menor"===this.sign&&
0>=this.f0||"mayor"===this.sign&&0<=this.f0)return c;e.setVariable("x",g);e.setVariable("y",r);for(var h=0;16>h;h++)if(d=c.x,b=c.y,this.normal=this.gradient(c),0!=this.normal.norm2()&&this.normal.mul(-this.f0/this.normal.norm2()),c.x=d+this.normal.x,c.y=b+this.normal.y,this.normal.norm()<f)return 0===this.normal.x&&0===this.normal.y&&(this.normal.x=c.x-a.x,this.normal.y=c.y-a.y),c;return k?c:null};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;a.Vector2D=function(a,f){this.x=
a;this.y=f};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 e=Math.floor,f=Math.round,d,b,c,h,g,r,k,
p,n,q,s,t,m,u,l,v,w,y,C,B;a.Control=function(b,c){this.parent=b;this.evaluator=b.evaluator;var g=this.parser=b.evaluator.parser;this.id="graphic"!==c.type?"C":"G";this.gui=this.type="";this.region="south";this.y=this.x=0;this.w="video"!==c.type?100:350;this.h="video"!==c.type?23:120;"graphic"!==c.type&&"audio"!==c.type&&"video"!==c.type?"text"!==c.type?this.expresion=g.parse("(0,0,100,23)"):(this.expresion=g.parse("(0,0,300,200)"),this.w=300,this.h=200):this.expresion=g.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"!==c.type?new a.Color("f0f8ff"):new a.Color("cc0022");this.underlined=this.italics=this.bold="";this.font_size=4>this.parent.version?-1:g.parse("12");this.parameter=this.action="";this.parameterFont="Monospace 12px";this.drawif=g.parse("1");this.activeif=g.parse("1");this.tooltip="";this.tooltipFont="Monospace 12px";this.Explanation="";this.ExplanationFont=
"Monospace 12px";this.cID=this.msg_pos="";this.valueExpr=g.parse("0");this.decimals=g.parse("2");this.min=g.parse("-Infinity");this.max=g.parse("Infinity");this.incr=g.parse("0.1");this.exponentialif=this.discrete=!1;this.zIndex=-1;for(var d in c)c.hasOwnProperty(d)&&(this[d]=c[d]);"video"!==this.type&&"audio"!==this.type||"interior"===this.region||(this.region="interior");void 0==this.name&&(this.name=2==this.parent.version?this.id:"_nada_");this.name="_._"==this.name||"_nada_"==this.name||"_void_"==
this.name?"":this.name;g=this.evaluator.evalExpression(this.expresion);this.x=f(g[0][0]);this.y=f(g[0][1]);4==g[0].length&&(this.w=f(g[0][2]),this.h=f(g[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 c=0,g=a.length;c<g;c++){if(b=a[c],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(){c=h=g=r=!1;k=this.evaluator.evalExpression(this.expresion);p=f(k[0][0]);c=f(this.x)!==p;this.x=p;p=f(k[0][1]);h=f(this.y)!==
p;this.y=p;4===k[0].length&&(p=f(k[0][2]),g=f(this.w)!==p,this.w=p,p=f(k[0][3]),r=f(this.h)!==p,this.h=p);if(g||r||c||h)this.init(!0),this.draw()};a.Control.prototype.formatOutputValue=function(a){m=this.parent;n=a+"";q=this.evaluator.evalExpression(this.decimals);s=n.indexOf(".");-1!=s&&(t=n.substring(s+1),t.length>q&&(n=parseFloat(n).toFixed(q)));this.fixed&&(2!==m.version||2===m.version&&!this.exponentialif)&&(n=parseFloat(a).toFixed(q));this.exponentialif&&0!=parseFloat(n)&&(n=this.fixed&&2!==
m.version?parseFloat(n).toExponential(q):parseFloat(n).toExponential(),n=n.toUpperCase(),n=n.replace("+",""));return n=n.replace(".",m.decimal_symbol)};a.Control.prototype.updateAndExecAction=function(){this.parent.updateControls();"init"===this.action&&(this.click=!1);this.actionExec.execute();"animate"!==this.action&&this.parent.update()};a.Control.prototype.createGradient=function(a,c){this.linearGradient=this.ctx.createLinearGradient(0,0,0,c);d=c*c;for(var g=0;g<c;g++)b=e(g-35*c/100),this.linearGradient.addColorStop(g/
c,"rgba(0,0,0,"+b*b*192/d/255+")")};a.Control.prototype.getScreenshot=function(){v=this;u=document.createElement("canvas");u.setAttribute("width",v.w);u.setAttribute("height",v.h);l=u.getContext("2d");l.font=v.fieldFontSize+"px Arial, Helvetica, 'Droid Sans', Sans-serif";v.canvas&&(w=v.canvas.offsetLeft,y=v.canvas.offsetTop,l.drawImage(v.canvas,w,y));v.label&&(w=v.label.offsetLeft,y=v.label.offsetTop,C=v.label.offsetWidth,B=v.label.offsetHeight,l.fillStyle="#e0e4e8",l.fillRect(w,y,C,B),l.fillStyle=
"black",l.textAlign="center",l.textBaseline="middle",l.fillText(v.name,w+C/2,y+B/2));v.field&&(w=v.field.offsetLeft,y=v.field.offsetTop,C=v.field.offsetWidth,B=v.field.offsetHeight,l.fillStyle="white",l.strokeStyle="#666666",l.lineWidth=1,l.fillRect(w,0,C,B),l.strokeRect(w+0.5,0.5,C-1,B-1),l.fillStyle="black",l.textAlign="center",l.textAlign="left",l.fillText(v.field.value,w+2,B/2));v.select&&(w=v.select.offsetLeft,y=v.select.offsetTop,C=v.select.offsetWidth,B=v.select.offsetHeight,l.fillStyle="#e0e4e8",
l.strokeStyle="#666666",l.lineWidth=1,l.fillRect(w,0,C,B),l.strokeRect(w+0.5,0.5,C,B-1),l.fillStyle="black",l.textAlign="center",l.textAlign="left",l.fillText(v.select.value,w+2,B/2),l.fillStyle="#c0c0c0",l.fillRect(w+C-15+0.5,0.5,15,B-1),l.strokeRect(w+C-15+0.5,0.5,15,B-1),l.fillStyle="black",l.beginPath(),l.moveTo(w+C-15+4.5,B/2-2.5),l.lineTo(w+C-15+8,B/2+2.5),l.lineTo(w+C-15+11.5,B/2-2.5),l.closePath(),l.fill());return u};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;
var e=Math.floor,f,d,b,c,h,g,r,k,p,n,q,s,t=2E3,m,u,l=/[\w\.\-//]*(\.gif)/gi;a.Button=function(b,c){this.imageSrc="";this.image=new Image;this.imageOver=new Image;this.imageDown=new Image;a.Control.call(this,b,c);-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 g;this.imageSrc.match("_COLORES_")&&(g=this.imageSrc.split("_"),
this.colorInt=new a.Color(g[2]),this.color=new a.Color(g[3]),this.font_size=this.parser.parse(g[5]),this.imageSrc="");this.imageSrc=this.parser.parse("'"+this.imageSrc+"'");g=this.evaluator.evalExpression(this.imageSrc).trim();if(""!=g){var d=g.substr(0,g.lastIndexOf(".")),e=g.substr(g.lastIndexOf("."));g.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(g),this.imageOver=this.parent.getImage(d+"_over"+e),this.imageDown=this.parent.getImage(d+"_down"+e))}this.canvas=document.createElement("canvas");this.canvas.setAttribute("class","DescartesButton");this.canvas.setAttribute("id",this.id);this.canvas.setAttribute("width",this.w+"px");this.canvas.setAttribute("height",this.h+"px");this.canvas.setAttribute("style","left: "+this.x+"px; top: "+this.y+"px; z-index: "+this.zIndex+";");this.ctx=this.canvas.getContext("2d");
this.ctx.imageSmoothingEnabled=!1;this.ctx.mozImageSmoothingEnabled=!1;this.ctx.webkitImageSmoothingEnabled=!1;this.addControlContainer(this.canvas);this.registerMouseAndTouchEvents();this.init()};a.extend(a.Button,a.Control);a.Button.prototype.init=function(){f=this.evaluator;d=this.canvas;c=f.evalExpression(this.expresion);this.x=c[0][0];this.y=c[0][1];4==c[0].length&&(this.w=parseInt(c[0][2]),this.h=parseInt(c[0][3]));d.setAttribute("width",this.w+"px");d.setAttribute("height",this.h+"px");d.setAttribute("style",
"left: "+this.x+"px; top: "+this.y+"px; z-index: "+this.zIndex+"; display: block; background-repeat: no-repeat;");this.fontSizeNotSet&&(this.font_size=f.parser.parse(a.getFieldFontSize(this.h)+""));this.createGradient(this.w,this.h);d.style.display=0<f.evalExpression(this.drawif)?"block":"none"};a.Button.prototype.update=function(){f=this.evaluator;d=this.canvas;this.activeIfValue=0<f.evalExpression(this.activeif);(this.drawIfValue=0<f.evalExpression(this.drawif))?(d.style.display="block",this.draw()):
d.style.display="none";d.style.cursor=this.activeIfValue?"pointer":"not-allowed";this.updatePositionAndSize()};a.Button.prototype.draw=function(){f=this.evaluator;b=this.ctx;h=f.evalExpression(this.font_size);g=f.evalExpression(this.name);r=f.evalExpression(this.imageSrc);k="vacio.gif"===r?this.emptyImage:this.parent.getImage(r);b.clearRect(0,0,this.w,this.h);n=p=0;this.buttonClick&&(n=p=1);var c=e(this.w/2+p)+0.5,d=e(this.h/2+n)+0.5;if(k){var s=k.height||1E8,t=a.getFontMetrics(this.italics+" "+this.bold+
" "+h+"px Arial").h,s=""!=g?0<=this.h-s-t-2?!0:!1:!1;m=parseInt((this.w-k.width)/2)+p;u=s?0:parseInt((this.h-k.height)/2)+n;d=s?k.height+parseInt(t/2):d;s&&(b.fillStyle=this.colorInt.getColor(),b.fillRect(0,0,this.w,this.h))}k&&k.ready?k!==this.emptyImage&&k.complete&&(this.image.src.match(l)?(this.canvas.style.backgroundImage="url("+this.image.src+")",this.canvas.style.backgroundPosition=m+"px "+u+"px"):b.drawImage(k,m,u)):(b.fillStyle=this.colorInt.getColor(),b.fillRect(0,0,this.w,this.h),this.buttonClick||
(a.drawLine(b,this.w-1,0,this.w-1,this.h,"rgba(0,0,0,"+128/255+")"),a.drawLine(b,0,0,0,this.h,"rgba(0,0,0,"+24/255+")"),a.drawLine(b,1,0,1,this.h,"rgba(0,0,0,"+8/255+")")),b.fillStyle=this.linearGradient,b.fillRect(0,0,this.w,this.h));this.activeIfValue&&""!=this.imageOver.src&&this.imageOver.ready&&this.over&&(this.image.src.match(l)?(this.canvas.style.backgroundImage="url("+this.imageOver.src+")",this.canvas.style.backgroundPosition=m+"px "+u+"px"):b.drawImage(this.imageOver,m,u));this.activeIfValue&&
""!=this.imageDown.src&&this.imageDown.ready&&this.buttonClick?this.image.src.match(l)?(this.canvas.style.backgroundImage="url("+this.imageDown.src+")",this.canvas.style.backgroundPosition=m+"px "+u+"px"):b.drawImage(this.imageDown,m,u):this.buttonClick&&!k&&(a.drawLine(b,0,0,0,this.h-2,"gray"),a.drawLine(b,0,0,this.w-1,0,"gray"),b.fillStyle="rgba(0, 0, 0,"+24/255+")",b.fillRect(0,0,this.w,this.h));b.fillStyle=this.color.getColor();b.font=this.italics+" "+this.bold+" "+h+"px Arial";b.textAlign="center";
b.textBaseline="middle";this.colorInt.getColor()!=this.color.getColor()&&(b.lineJoin="round",b.lineWidth=parseInt(h/6),b.strokeStyle=this.colorInt.getColor(),b.strokeText(g,c,d));b.fillText(g,c,d);this.underlined&&(q=b.measureText(g).width,b.strokeStyle=this.color.getColor(),b.lineWidth=e(h/10)||2,b.lineCap="round",b.beginPath(),b.moveTo(parseInt((this.w-q)/2)+p,d+e(h/2)+e(h/5)-1.5),b.lineTo(parseInt((this.w+q)/2)+p,d+e(h/2)+e(h/5)-1.5),b.stroke());this.activeIfValue||(b.fillStyle="rgba(240,240,240,"+
160/255+")",b.fillRect(0,0,this.w,this.h))};a.Button.prototype.buttonPressed=function(){this.updateAndExecAction()};a.Button.prototype.registerMouseAndTouchEvents=function(){function b(a,c,g){clearInterval(k);f.buttonClick&&f.drawIfValue&&f.activeIfValue&&(c.call(f),a=g?a:100,k=setTimeout(function(){b(a,c)},a))}function c(d){document.body.focus();d.preventDefault();d.stopPropagation();document.activeElement!=document.body&&document.activeElement.blur();f.whichButton=a.whichButton(d);"L"==f.whichButton&&
f.activeIfValue&&(f.buttonClick=!0,f.draw(),f.evaluator.setVariable(f.id,f.evaluator.evalExpression(f.valueExpr)),"calculate"==f.action&&b(t,f.buttonPressed,!0),s?(f.canvas.removeEventListener("touchend",g),f.canvas.addEventListener("touchend",g)):(f.canvas.removeEventListener("mouseup",g),f.canvas.addEventListener("mouseup",g)))}function g(a){document.body.focus();if(f.activeIfValue||f.buttonClick)f.buttonClick=!1,f.draw(),"calculate"!=f.action&&f.buttonPressed(),a.preventDefault(),a.stopPropagation(),
s?f.canvas.removeEventListener("touchend",g):f.canvas.removeEventListener("mouseup",g)}function d(a){f.over=!0;f.draw()}function e(a){f.over=!1;f.buttonClick=!1;f.draw()}s=a.hasTouchSupport;var f=this,k;f.canvas.oncontextmenu=function(){return!1};this.over=this.buttonClick=!1;s?this.canvas.addEventListener("touchstart",c):(this.canvas.addEventListener("mousedown",c),this.canvas.addEventListener("mouseover",d),this.canvas.addEventListener("mouseout",e))};a.Button.prototype.getScreenshot=function(){return this.canvas};
return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var e,f,d,b,c,h,g,r,k,p,n,q,s,t,m,u,l,v;a.Spinner=function(b,c){a.Control.call(this,b,c);this.tabindex=++this.parent.tabindex;"_._"==this.name&&(this.name="");"["===this.name.charAt(0)&&"]"===this.name.charAt(this.name.length-1)?this.name=this.parser.parse(this.name.substring(1,this.name.length-1)):this.name=this.parser.parse("'"+this.name+"'");this.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 g=this.evaluator.evalExpression(this.incr);0<g?this.originalIncr=this.incr=this.evaluator.parser.parse(parseInt(g).toString()):this.incr=v}this.registerMouseAndTouchEvents();this.init()};a.extend(a.Spinner,a.Control);a.Spinner.prototype.init=function(){e=this.evaluator;var b=e.evalExpression(this.name).toString();this.label.innerHTML=b;this.value=this.validateValue(e.evalExpression(this.valueExpr));
var c=this.formatOutputValue(this.value);this.fieldFontSize=2!==this.parent.version?a.getFieldFontSize(this.h):10;var g=2!==this.parent.version?"":"_____",d=a.getTextWidth(c+"_",this.fieldFontSize+"px Arial"),f=2+parseInt(this.h/2),k=parseInt(this.w/2-f/2),g=a.getTextWidth(b+g,this.fieldFontSize+"px Arial");this.visible||(k=this.w-f,d=0);k<g&&(k=g);""==b&&(k=0);this.w-k-f<d&&(k=this.w-f-d);0>k&&(k=0);b=this.w-(k+f);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",f+"px");this.canvas.setAttribute("height",this.h+"px");this.canvas.setAttribute("style","position: absolute; left: "+k+"px; top: 0px;");this.ctx=this.canvas.getContext("2d");this.divUp.setAttribute("style","background-color: rgba(255, 255, 255, 0); cursor: pointer; position: absolute; width : "+f+"px; height : "+
this.h/2+"px; left: "+k+"px; top: 0px;");this.divDown.setAttribute("style","background-color: rgba(255, 255, 255, 0); cursor: pointer; position: absolute; width : "+f+"px; height : "+this.h/2+"px; left: "+k+"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: "+(f+k)+"px;");this.field.setAttribute("tabindex",this.tabindex);this.field.value=c;this.visible||(this.field.style.display="none");this.label.setAttribute("class","DescartesSpinnerLabel");this.label.setAttribute("style","font-size:"+this.fieldFontSize+"px; width: "+k+"px; height: "+this.h+"px; line-height: "+this.h+"px;");e.setVariable(this.id,this.value);this.createGradient(this.h/2,this.h)};a.Spinner.prototype.update=function(){e=this.evaluator;this.label.innerHTML=e.evalExpression(this.name).toString();
0>=e.evalExpression(this.decimals)?(f=e.evalExpression(this.incr),0<f?this.originalIncr=this.incr=e.parser.parse(parseInt(f).toString()):this.incr=v):this.incr=0!=e.evalExpression(this.originalIncr)?this.originalIncr:v;this.activeIfValue=0<e.evalExpression(this.activeif);this.drawIfValue=0<e.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||(d=this.field.value,b=this.value,this.value=this.validateValue(e.getVariable(this.id)),this.field.value=this.formatOutputValue(this.value),this.value==b&&this.field.value!=d&&(this.value=this.validateValue(d),this.field.value=this.formatOutputValue(this.value)),e.setVariable(this.id,this.value))};a.Spinner.prototype.draw=function(){c=this.ctx;h=this.canvas.width;g=this.canvas.height;c.fillStyle="#f0f8ff";c.fillRect(0,0,h,g);c.fillStyle=
this.linearGradient;c.fillRect(0,0,h,g);this.up?(r="gray",k="#f0f8ff"):(r="#f0f8ff",k="gray");a.drawLine(c,0,0,h,0,r);a.drawLine(c,0,0,0,g/2,r);a.drawLine(c,0,g/2,h,g/2,k);this.down?(r="gray",k="#f0f8ff"):(r="#f0f8ff",k="gray");a.drawLine(c,0,g/2+1,h,g/2+1,r);a.drawLine(c,0,g/2+1,0,g,r);a.drawLine(c,0,g-1,h,g-1,k);p=[parseInt(h/2+1),parseInt(h/5+1),parseInt(h-h/5+1)];n=[parseInt(g/8+1),parseInt(g/8+1+g/4),parseInt(g/8+1+g/4)];c.fillStyle=this.activeIfValue?"#2244cc":"#8888aa";c.beginPath();c.moveTo(p[0],
n[0]);c.lineTo(p[1],n[1]);c.lineTo(p[2],n[2]);c.fill();n=[parseInt(g-g/8),parseInt(g-g/8-g/4),parseInt(g-g/8-g/4)];c.fillStyle=this.activeIfValue?"#d00018":"#aa8888";c.beginPath();c.moveTo(p[0],n[0]);c.lineTo(p[1],n[1]);c.lineTo(p[2],n[2]);c.fill();c.fillStyle="rgba(0,0,0,"+24/255+")";this.up&&c.fillRect(0,0,h,g/2);this.down&&c.fillRect(0,g/2,h,g)};a.Spinner.prototype.validateValue=function(a){e=this.evaluator;isNaN(parseFloat(a))||a.toString().match("e")&&(a=parseFloat(a).toFixed(20));a=a.toString();
a=a.replace(this.parent.decimal_symbol,".");q=a==parseFloat(a)?parseFloat(a):parseFloat(e.evalExpression(e.parser.parse(a)));isNaN(q)&&(q=0);m=e.evalExpression(this.min);u=e.evalExpression(this.max);""===m&&(m=-Infinity);""===u&&(u=Infinity);q<m&&(q=m);q>u&&(q=u);this.discrete&&(s=e.evalExpression(this.incr),q=0==s?0:s*Math.round(q/s));t=e.evalExpression(this.decimals);0>=t&&(t=0);return q=parseFloat(parseFloat(q).toFixed(t))};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,c,g){clearInterval(m);if(h.up||h.down)c.call(h),
a=g?a:30,m=setTimeout(function(){b(a,c)},a)}function c(g){g.preventDefault();h.whichButton=a.whichButton(g);"L"==h.whichButton&&h.activeIfValue&&(h.up=!0,b(r,h.increase,!0),h.draw())}function g(c){c.preventDefault();h.whichButton=a.whichButton(c);"L"==h.whichButton&&h.activeIfValue&&(h.down=!0,b(r,h.decrease,!0),h.draw())}function d(a){h.up=!1;clearInterval(m);h.draw();a.preventDefault()}function e(a){h.down=!1;clearInterval(m);h.draw();a.preventDefault()}function f(a){h.up=!1;clearInterval(m);h.draw();
a.preventDefault()}function k(a){h.down=!1;clearInterval(m);h.draw();a.preventDefault()}l=a.hasTouchSupport;var h=this,r=l?500:200,m;h.divUp.oncontextmenu=h.divDown.oncontextmenu=h.field.oncontextmenu=h.label.oncontextmenu=function(){return!1};l?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&&h.changeValue(h.field.value)});
l?this.divUp.addEventListener("touchstart",c):this.divUp.addEventListener("mousedown",c);l?this.divDown.addEventListener("touchstart",g):this.divDown.addEventListener("mousedown",g);l||this.divUp.addEventListener("mouseout",d);l||this.divDown.addEventListener("mouseout",e);l?(this.divUp.addEventListener("touchend",f),window.addEventListener("touchend",f)):(this.divUp.addEventListener("mouseup",f),window.addEventListener("mouseup",f));l?(this.divDown.addEventListener("touchend",k),window.addEventListener("touchend",
k)):(this.divDown.addEventListener("mouseup",k),window.addEventListener("mouseup",k));h.field.addEventListener("click",function(a){this.select();this.focus()})};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var e,f,d,b,c,h,g;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+"'");void 0===this.valueExprString&&
(this.valueExprString=this.onlyText?"0":"");this.emptyString=!1;this.ok=0;this.tabindex=++this.parent.tabindex;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 g=this.answerPattern.indexOf("|");this.firstAnswer=-1==g?this.answerPattern:this.answerPattern.substring(0,g)}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){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(){e=this.evaluator;var b=e.evalExpression(this.name).toString();this.label.innerHTML=b;this.value=this.validateValue(e.evalExpression(this.valueExpr));var c=this.formatOutputValue(this.value);this.fieldFontSize=a.getFieldFontSize(this.h);var g=a.getTextWidth(c+
"_",this.fieldFontSize+"px Arial"),d=parseInt(this.w/2),f=a.getTextWidth(b,this.fieldFontSize+"px Arial");this.visible||(d=this.w,g=0);d<f&&(d=f);""==b&&(d=0);this.w-d<g&&(d=this.w-g);0>d&&(d=0);b=this.w-d;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: "+d+"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: "+d+"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(){e=this.evaluator;this.label.innerHTML=e.evalExpression(this.name).toString();this.activeIfValue=0<e.evalExpression(this.activeif);this.drawIfValue=0<e.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||(f=this.field.value,d=this.value,this.value=this.validateValue(e.getVariable(this.id)),this.field.value=this.formatOutputValue(this.value),this.value===d&&this.field.value!=f&&(this.value=this.validateValue(f),this.field.value=this.formatOutputValue(this.value)),e.setVariable(this.id,this.value))};a.TextField.prototype.validateValue=function(a){if(""===a||"''"==a)return"";e=this.evaluator;a=a.toString().replace(this.parent.decimal_symbol,".");b=a==parseFloat(a)?
parseFloat(a):parseFloat(e.evalExpression(e.parser.parse(a)));isNaN(b)&&(b=0);c=e.evalExpression(this.min);""==c&&(c=-Infinity);h=e.evalExpression(this.max);""==h&&(h=Infinity);this.discrete&&(a=e.evalExpression(this.incr),b=0==a?0:a*Math.round(b/a));return b=parseFloat(parseFloat(b).toFixed(e.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(){g=a.hasTouchSupport;var b=this;b.field.oncontextmenu=b.label.oncontextmenu=function(){return!1};g?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.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 e=Math.abs,f,d,b,c,h,g,r,k,p,n,q;a.Menu=function(b,c){this.options="";a.Control.call(this,b,c);f=this.parser;d=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 g,e=0,k=this.options.length;e<k;e++)g=this.customSplit(this.options[e]),1==g.length?(this.menuOptions.push(g[0]),this.strValue.push(e.toString())):2==g.length&&(this.menuOptions.push(g[0]),""==g[1]?this.strValue.push(e.toString()):
this.strValue.push(g[1]));e=0;for(k=this.menuOptions.length;e<k;e++)this.menuOptions[e].match(/^\[/)&&this.menuOptions[e].match(/\]$/)?this.menuOptions[e]=f.parse(this.menuOptions[e].substring(1,this.menuOptions[e].length-1)):this.menuOptions[e]=f.parse("'"+this.menuOptions[e]+"'");e=0;for(k=this.strValue.length;e<k;e++)this.strValue[e].match(/^\[/)&&this.strValue[e].match(/\]$/)?this.strValue[e]=f.parse(this.strValue[e].substring(1,this.strValue[e].length-1)):this.strValue[e]=f.parse(this.strValue[e]);
this.containerControl=document.createElement("div");this.label=document.createElement("label");this.select=document.createElement("select");e=0;for(k=this.menuOptions.length;e<k;e++)g=document.createElement("option"),g.innerHTML=d.evalExpression(this.menuOptions[e]),this.select.appendChild(g);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){d=this.evaluator;var c=d.evalExpression(this.name).toString();this.label.innerHTML=c;this.fieldFontSize=2!=this.parent.version?a.getFieldFontSize(this.h):10;var g=0,e=0,f=0;this.value=b?this.value:d.evalExpression(this.valueExpr);this.indexValue=this.getIndex(this.value);b=0;for(var k=this.menuOptions.length;b<k;b++)f=a.getTextWidth(d.evalExpression(this.menuOptions[b]).toString(),this.fieldFontSize+
"px Arial"),f>g&&(g=f,e=b);g+=25;f=a.getTextWidth(this.formatOutputValue(d.evalExpression(this.strValue[e])),this.fieldFontSize+"px Arial")+7;e=a.getTextWidth(c,this.fieldFontSize+"px Arial")+10;""==c&&(e=0);this.visible||(f=0);for(c=this.w-f-e;c<g&&0<e;)e--,c++;for(;c<g&&0<f;)f--,c++;for(;e+c+f+1<this.w;)c++,f++;g=e;b=g+c;f=this.w-b;k=this.formatOutputValue(d.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: "+e+"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=k;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; line-height: "+this.h+"px; width : "+c+"px; height : "+this.h+"px; left: "+g+"px; border-color: #7a8a99; border-width: 1.5px; border-style: solid; background-color: #eeeeee;");
this.select.setAttribute("tabindex",this.tabindex);this.select.selectedIndex=this.indexValue;d.setVariable(this.id,parseFloat(k.replace(this.parent.decimal_symbol,".")));this.update()};a.Menu.prototype.update=function(){d=this.evaluator;this.activeIfValue=0<d.evalExpression(this.activeif);this.drawIfValue=0<d.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");this.updatePositionAndSize();if(!this.parent.animation.playing||document.activeElement!=this.select){this.label.innerHTML=d.evalExpression(this.name).toString();for(var a=0,b=this.menuOptions.length;a<b;a++)this.select.options[a].innerHTML=d.evalExpression(this.menuOptions[a]);this.value=d.getVariable(this.id);isNaN(this.value)&&(this.value=0);this.field.value=this.formatOutputValue(this.value);d.setVariable(this.id,parseFloat(this.value));this.select.selectedIndex=
parseFloat(this.getIndex(this.value))}this.ok=this.value==this.answer?1:0;this.evaluator.setVariable(this.id+".ok",this.ok)};a.Menu.prototype.customSplit=function(a){r=!1;k="";p=0;for(n=-1;p<a.length;){q=a.charAt(p);a.charAt(p-1);if("["===q&&-1===n){if(r||""!=k)k+="\u00a6";n++}else"["===q?n++:"]"===q&&0===n?(r=!0,n--):"]"==a.charAt(p)&&(n=0>n?n:n-1);k+=a.charAt(p);p++}return k.split("\u00a6")};a.Menu.prototype.getIndex=function(a){a=parseFloat(a.toString().replace(this.parent.decimal_symbol,"."));
b=-1;c=Infinity;for(var g=0,d=this.strValue.length;g<d;g++)h=e(a-parseFloat(this.evaluator.evalExpression(this.strValue[g]))),h<=c&&(c=h,b=g);return b};a.Menu.prototype.changeValue=function(){this.activeIfValue&&(this.evaluator.setVariable(this.id,this.value),this.updateAndExecAction())};a.Menu.prototype.registerMouseAndTouchEvents=function(){g=a.hasTouchSupport;var b=this;b.select.oncontextmenu=b.label.oncontextmenu=b.field.oncontextmenu=function(){return!1};g?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.select();this.focus()});b.select.addEventListener("mouse",function(a){this.focus()})};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var e=Math.floor,f="h",d,b,c,h,g,r,k,p,n,q,s,t,m,u,l,v,w,y,C,B,D;a.Scrollbar=function(b,c){a.Control.call(this,b,c);"["===this.name.charAt(0)&&"]"===this.name.charAt(this.name.length-1)?this.name=
this.parser.parse(this.name.substring(1,this.name.length-1)):this.name=this.parser.parse("'"+this.name+"'");this.orientation=this.w>=this.h?f:"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(){d=this.evaluator;this.findOffset();0==d.evalExpression(this.decimals)?this.incr=1:this.incr=
(d.evalExpression(this.max)-d.evalExpression(this.min))/100;this.value=this.validateValue(d.evalExpression(this.valueExpr));c=this.formatOutputValue(this.value);h=this.evaluator.evalExpression(this.expresion);this.x=h[0][0];this.y=h[0][1];4==h[0].length&&(this.w=h[0][2],this.h=h[0][3]);this.orientation=this.w>=this.h?f:"v";this.initScroll(c);this.changeScrollPositionFromValue();this.prePos=this.pos;d.setVariable(this.id,this.value)};a.Scrollbar.prototype.initScroll=function(c){b=this;d=b.evaluator;
var g=d.evalExpression(b.name).toString();b.label.innerHTML=g;var e="v"===b.orientation?parseInt(19+5*(b.h-100)/100):b.h;b.fieldFontSize="v"===b.orientation?e-parseInt(b.h/20)-1:2!==b.parent.version?a.getFieldFontSize(e):10;var f=a.getTextWidth(c+"_",b.fieldFontSize+"px Arial"),k=b.parent.getSpaceById(b.spaceID).h;b.labelHeight=""==g?0:e;b.fieldHeight=""==b.visible?0:e;if("v"===b.orientation)b.canvasWidth=b.w,b.canvasHeight=b.h-b.labelHeight-b.fieldHeight,18<=b.canvasHeight+b.y-k&&(b.canvasHeight=
k),g=0,g=b.fieldHeight,f=g+b.canvasHeight,b.canvasX=0,b.canvasY=b.fieldHeight,b.labelWidth=b.w,b.labelY=f,b.upWidth=b.downW=b.w,b.upHeight=b.downH=15,b.upX=0,b.upY=b.fieldHeight,b.downX=0,b.downY=f-b.downH,b.fieldWidth=b.w,b.fieldX=0,b.scrollManipulatorW=b.w,b.scrollManipulatorH=parseInt((b.canvasHeight-b.upHeight-b.downH-b.labelHeight-b.fieldHeight)/10),b.scrollManipulatorH=15>b.scrollManipulatorH?15:b.scrollManipulatorH,b.scrollManipulatorLimInf=f-b.downH-b.scrollManipulatorH,b.scrollManipulatorLimSup=
g+b.downH;else{e=a.getTextWidth(g,b.fieldFontSize+"px Arial")+10;b.labelWidth=e;b.fieldWidth=f;""==g&&(b.labelWidth=0);b.visible||(b.fieldWidth=0);for(f=b.w-b.fieldWidth-b.labelWidth;58>f&&0<b.labelWidth;)b.labelWidth--,f++;for(;58>f&&0<b.fieldWidth;)b.fieldWidth--,f++;g=b.labelWidth;e=g+f;b.fieldWidth=b.w-e;b.canvasWidth=f;b.canvasHeight=b.h;b.canvasX=b.labelWidth;b.canvasY=0;b.fieldX=b.canvasWidth+b.labelWidth;b.labelHeight=b.h;b.labelY=0;b.upWidth=b.downW=15;b.upHeight=b.downH=b.h;b.upX=e-b.downW;
b.upY=0;b.downX=b.labelWidth;b.downY=0;b.scrollManipulatorW=parseInt((b.canvasWidth-b.upWidth-b.downW)/10);b.scrollManipulatorW=15>b.scrollManipulatorW?15:b.scrollManipulatorW;b.scrollManipulatorH=b.h;b.scrollManipulatorLimInf=g+b.downW;b.scrollManipulatorLimSup=g+b.canvasWidth-b.downW-b.scrollManipulatorW}b.containerControl.setAttribute("class","DescartesScrollbarContainer");b.containerControl.setAttribute("style","width: "+b.w+"px; height: "+b.h+"px; left: "+b.x+"px; top: "+b.y+"px; z-index: "+
b.zIndex+";");b.canvas.setAttribute("width",b.w+"px");b.canvas.setAttribute("height",b.h+"px");b.canvas.setAttribute("style","position: absolute; left: 0px; top: 0px;");b.ctx=b.canvas.getContext("2d");b.divUp.setAttribute("class","DescartesCatcher");b.divUp.setAttribute("style","width : "+b.upWidth+"px; height : "+b.upHeight+"px; left: "+b.upX+"px; top: "+b.upY+"px;");b.divDown.setAttribute("class","DescartesCatcher");b.divDown.setAttribute("style","width : "+b.downW+"px; height : "+b.downH+"px; left: "+
b.downX+"px; top: "+b.downY+"px;");b.scrollManipulator.setAttribute("class","DescartesCatcher");b.scrollManipulator.setAttribute("style","width : "+b.scrollManipulatorW+"px; height : "+b.scrollManipulatorH+"px;");b.scrollManipulator.style.top=("v"===b.orientation?b.scrollManipulatorLimInf:0)+"px";b.scrollManipulator.style.left=("v"===b.orientation?0:b.scrollManipulatorLimInf)+"px";b.field.setAttribute("type","text");b.field.setAttribute("id",b.id+"scrollbar");b.field.setAttribute("class","DescartesScrollbarField");
b.field.setAttribute("style","font-size: "+b.fieldFontSize+"px; width : "+b.fieldWidth+"px; height : "+b.fieldHeight+"px; left: "+b.fieldX+"px; top: 0px;");b.field.value=c;0===b.fieldHeight&&(b.field.style.display="none");b.label.setAttribute("class","DescartesScrollbarLabel");b.label.setAttribute("style","font-size:"+b.fieldFontSize+"px; width: "+b.labelWidth+"px; height: "+b.labelHeight+"px; line-height: "+b.labelHeight+"px; left: 0px; top:"+b.labelY+"px;")};a.Scrollbar.prototype.update=function(){d=
this.evaluator;this.label.innerHTML=d.evalExpression(this.name).toString();0==d.evalExpression(this.decimals)?this.incr=1:this.incr=(d.evalExpression(this.max)-d.evalExpression(this.min))/100;this.activeIfValue=0<d.evalExpression(this.activeif);this.drawIfValue=0<d.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(d.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);d.setVariable(this.id,this.value)};a.Scrollbar.prototype.draw=function(){b=this;g=b.ctx;k=e(this.w);r=e(this.h);g.fillStyle="#e0e4e8";g.fillRect(0,0,k,r);g.strokeStyle="#7a8a99";b.down&&(g.fillStyle="#ccdcec",g.fillRect(b.downX+0.5,b.downY+0.5,b.downW,b.downH-1));g.strokeRect(b.downX+0.5,b.downY+
0.5,b.downW,b.downH-1);b.up&&(g.fillStyle="#ccdcec",g.fillRect(b.upX+0.5,b.upY-0.5,b.upWidth,b.upHeight+1));g.strokeRect(b.upX+0.5,b.upY-0.5,b.upWidth,b.upHeight+1);p=4;g.fillStyle="black";g.beginPath();b.orientation===f?(g.moveTo(b.downX+p,b.downH/2),g.lineTo(b.downX+b.downW-p,p),g.lineTo(b.downX+b.downW-p,b.downH-p),g.moveTo(b.upX+b.upWidth-p,b.downH/2),g.lineTo(b.upX+p,p),g.lineTo(b.upX+p,b.downH-p),g.fill(),b.activeIfValue&&(n=e(b.pos),g.fillStyle="#ccdcec",g.fillRect(n+0.5,0,e(b.scrollManipulatorW),
r),g.strokeStyle="#6382bf",g.strokeRect(n+0.5,0,e(b.scrollManipulatorW),r),q=e(b.scrollManipulatorW/2),g.beginPath(),g.moveTo(n+q+0.5-2,3),g.lineTo(n+q+0.5-2,r-3),g.moveTo(n+q+0.5,3),g.lineTo(n+q+0.5,r-3),g.moveTo(n+q+0.5+2,3),g.lineTo(n+q+0.5+2,r-3),g.stroke())):(g.moveTo(b.downX+b.downW/2,b.downY+b.downH-p),g.lineTo(b.downX+p,b.downY+p),g.lineTo(b.downX+b.downW-p,b.downY+p),g.moveTo(b.upX+b.upWidth/2,b.upY+p),g.lineTo(b.upX+p,b.upY+b.upHeight-p),g.lineTo(b.upX+b.upWidth-p,b.upY+b.upHeight-p),g.fill(),
b.activeIfValue&&(n=e(b.pos),g.fillStyle="#ccdcec",g.fillRect(0,n+0.5,k,e(b.scrollManipulatorH)),g.strokeStyle="#6382bf",g.strokeRect(0,n+0.5,k,e(b.scrollManipulatorH)),q=e(b.scrollManipulatorH/2),g.beginPath(),g.moveTo(3,n+q+0.5-2),g.lineTo(k-3,n+q+0.5-2),g.moveTo(3,n+q+0.5),g.lineTo(k-3,n+q+0.5),g.moveTo(3,n+q+0.5+2),g.lineTo(k-3,n+q+0.5+2),g.stroke()));g.strokeRect(0.5,0.5,k-1,r-1);b.activeIfValue||(g.fillStyle="rgba(240,240,240,"+160/255+")",g.fillRect(0,0,k,r.h))};a.Scrollbar.prototype.validateValue=
function(a){d=this.evaluator;s=a.toString();s=parseFloat(s.replace(this.parent.decimal_symbol,"."));isNaN(s)&&(s=0);this.minimo=d.evalExpression(this.min);s<this.minimo&&(this.value=null,s=this.minimo);this.maximo=d.evalExpression(this.max);s>this.maximo&&(this.value=null,s=this.maximo);t=this.incr;s=0!=t?s*t/t:0;this.fixed&&(s=parseFloat(parseFloat(s).toFixed(d.evalExpression(this.decimals))));return s};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(){p=(this.evaluator.evalExpression(this.max)-this.evaluator.evalExpression(this.min))/10;this.orientation==f?this.clickPos.x>this.prePos&&this.changeValue(parseFloat(this.value)+p):this.clickPos.y<this.prePos&&this.changeValue(parseFloat(this.value)+p)};a.Scrollbar.prototype.decrease10=function(){p=(this.evaluator.evalExpression(this.max)-this.evaluator.evalExpression(this.min))/
10;this.orientation==f?this.clickPos.x<this.prePos&&this.changeValue(parseFloat(this.value)-p):this.clickPos.y>this.prePos&&this.changeValue(parseFloat(this.value)-p)};a.Scrollbar.prototype.changeValue=function(a){this.activeIfValue&&(m=this.validateValue(a),m!=this.value&&(this.value=m,this.field.value=this.formatOutputValue(m),this.changeScrollPositionFromValue(),this.prePos=this.pos,this.evaluator.setVariable(this.id,this.value),this.updateAndExecAction()))};a.Scrollbar.prototype.changeValueForScrollMovement=
function(){d=this.evaluator;u=this.scrollManipulatorLimInf;l=this.scrollManipulatorLimSup;v=d.evalExpression(this.min);w=d.evalExpression(this.max);t=this.incr;m=e((this.pos-u)*(w-v)/(l-u)/t)*t+v;m!=this.value&&(this.value=m,this.field.value=this.formatOutputValue(m),d.setVariable(this.id,this.value),this.parent.updateControls(),this.actionExec.execute(),this.parent.update())};a.Scrollbar.prototype.changeScrollPositionFromValue=function(){d=this.evaluator;u=this.scrollManipulatorLimInf;l=this.scrollManipulatorLimSup;
v=d.evalExpression(this.min);w=d.evalExpression(this.max);t=this.incr;this.pos=(this.value-v)*(l-u)/(w-v)+u;this.orientation==f?this.scrollManipulator.style.left=this.pos+"px":this.scrollManipulator.style.top=this.pos+"px"};a.Scrollbar.prototype.registerMouseAndTouchEvents=function(){function b(a,c,g,d){clearInterval(w);(t.up||t.down||t.canvasClick)&&1E-7<Math.abs(t.value-d)&&(c.call(t),a=g?a:30,w=setTimeout(function(){b(a,c,!1,d)},a))}function c(g){g.preventDefault();t.whichButton=a.whichButton(g);
"L"==t.whichButton&&t.activeIfValue&&(t.clickPos=t.getCursorPosition(g),t.canvasClick=!0,t.orientation==f?t.clickPos.x<t.prePos?b(u,t.decrease10,!0,t.minimo):b(u,t.increase10,!0,t.maximo):t.clickPos.y<t.prePos?b(u,t.increase10,!0,t.maximo):b(u,t.decrease10,!0,t.minimo))}function g(a){t.canvasClick=!1;clearInterval(w);a.preventDefault()}function d(a){!0==t.canvasClick&&(t.clickPos=t.getCursorPosition(a),a.preventDefault())}function e(a){t.activeIfValue&&(t.scrollClick=!0,t.initPos=t.getCursorPosition(a),
window.addEventListener("mouseup",h),window.addEventListener("mousemove",m),a.preventDefault())}function k(a){t.activeIfValue&&(t.scrollClick=!0,t.initPos=t.getCursorPosition(a),window.addEventListener("touchend",r),window.addEventListener("touchmove",onToucheMove_scrollManipulator),a.preventDefault())}function h(a){t.scrollClick=!1;t.prePos=t.pos;window.removeEventListener("mouseup",h,!1);window.removeEventListener("mousemove",m,!1);a.preventDefault()}function r(a){t.scrollClick=!1;t.prePos=t.pos;
window.removeEventListener("touchend",r,!1);window.removeEventListener("touchmove",m,!1);a.preventDefault()}function m(a){var b=t.getCursorPosition(a);t.orientation==f?(t.pos=t.prePos-(t.initPos.x-b.x),t.pos<t.scrollManipulatorLimInf&&(t.pos=t.scrollManipulatorLimInf),t.pos>t.scrollManipulatorLimSup&&(t.pos=t.scrollManipulatorLimSup),t.scrollManipulator.setAttribute("style","background-color: rgba(255, 255, 255, 0); cursor: pointer; position: absolute; width : "+t.scrollManipulatorW+"px; height : "+
t.h+"px; left: "+t.pos+"px; top: 0px;")):(t.pos=t.prePos-(t.initPos.y-b.y),t.pos>t.scrollManipulatorLimInf&&(t.pos=t.scrollManipulatorLimInf),t.pos<t.scrollManipulatorLimSup&&(t.pos=t.scrollManipulatorLimSup),t.scrollManipulator.setAttribute("style","background-color: rgba(255, 255, 255, 0); cursor: pointer; position: absolute; width : "+t.w+"px; height : "+t.scrollManipulatorH+"px; left: 0px; top: "+t.pos+"px;"));t.changeValueForScrollMovement();a.preventDefault()}function p(c){c.preventDefault();
t.whichButton=a.whichButton(c);"L"==t.whichButton&&t.activeIfValue&&(t.up=!0,b(u,t.increase,!0,t.maximo))}function n(c){c.preventDefault();t.whichButton=a.whichButton(c);"L"==t.whichButton&&t.activeIfValue&&(t.down=!0,b(u,t.decrease,!0,t.minimo))}function q(a){t.up=!1;clearInterval(w);a.preventDefault()}function l(a){t.down=!1;clearInterval(w);a.preventDefault()}function s(a){t.up=!1;clearInterval(w);a.preventDefault();t.draw()}function v(a){t.down=!1;clearInterval(w);a.preventDefault();t.draw()}
y=a.hasTouchSupport;var t=this,u=y?500:200,w;t.canvas.oncontextmenu=t.divUp.oncontextmenu=t.divDown.oncontextmenu=t.label.oncontextmenu=t.field.oncontextmenu=t.scrollManipulator.oncontextmenu=function(){return!1};this.field.addEventListener("keydown",function(a){13==a.keyCode&&t.changeValue(t.field.value)});y?this.canvas.addEventListener("touchstart",c):this.canvas.addEventListener("mousedown",c);y||this.divDown.addEventListener("mouseout",l);y?window.addEventListener("touchend",g):window.addEventListener("mouseup",
g);y?this.canvas.addEventListener("touchmove",d):this.canvas.addEventListener("mousemove",d);y?this.scrollManipulator.addEventListener("touchstart",k):this.scrollManipulator.addEventListener("mousedown",e);y?this.divUp.addEventListener("touchstart",p):this.divUp.addEventListener("mousedown",p);y?this.divDown.addEventListener("touchstart",n):this.divDown.addEventListener("mousedown",n);y||this.divUp.addEventListener("mouseout",q);y||this.divDown.addEventListener("mouseout",l);y?window.addEventListener("touchend",
s):window.addEventListener("mouseup",s);y?window.addEventListener("touchend",v):window.addEventListener("mouseup",v)};a.Scrollbar.prototype.findOffset=function(){C=this.containerControl;this.offsetTop=this.offsetLeft=0;B=this.containerControl.style.display;for(this.containerControl.style.display="block";C;)this.offsetLeft+=C.offsetLeft||0,this.offsetTop+=C.offsetTop||0,C=C.parentNode;this.containerControl.style.display=B};a.Scrollbar.prototype.getCursorPosition=function(b){D=a.getCursorPosition(b);
return{x:D.x-this.offsetLeft,y:D.y-this.offsetTop}};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var e;a.Audio=function(d,b){this.controls=!0;this.file="";this.oldDrawIf=0;a.Control.call(this,d,b);var c=this,e=c.evaluator.evalExpression(c.expresion);4==e[0].length?(c.w=e[0][2],c.h=e[0][3]):(c.w=200,c.h=28);c.audio=c.parent.getAudio(c.file);c.autoplay&&(c.audio.setAttribute("autoplay","autoplay"),c.audio.play());c.loop&&c.audio.setAttribute("loop","loop");c.controls&&c.audio.setAttribute("controls",
"controls");c.audio.setAttribute("style","position: absolute; width: "+c.w+"px; left: "+c.x+"px; top: "+c.y+"px; z-index: "+c.zIndex+";");c.addControlContainer(c.audio);c.evaluator.setFunction(c.id+".play",function(){c.audio.play();return 0});c.evaluator.setFunction(c.id+".pause",function(){c.audio.pause();return 0});c.evaluator.setFunction(c.id+".stop",function(){c.audio.pause();return c.audio.currentTime=0});c.audio.addEventListener("timeupdate",function(a){c.evaluator.setVariable(c.id+".currentTime",
c.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 f;a.Audio.prototype.update=function(){e=this.evaluator;(f=0<e.evalExpression(this.drawif))?this.audio.style.display="block":(this.audio.style.display="none",f!==this.oldDrawIf&&this.audio.pause());this.oldDrawIf=f;this.updatePositionAndSize()};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var e;a.Video=
function(d,b){this.controls=!0;this.file="";this.oldDrawIf=0;a.Control.call(this,d,b);var c=this;e=c.evaluator;var f=c.evaluator.evalExpression(c.expresion);4==f[0].length?(c.w=f[0][2],c.h=f[0][3]):(c.w=null,c.h=null);c.video=document.createElement("video");c.autoplay&&c.video.setAttribute("autoplay","autoplay");c.loop&&c.video.setAttribute("loop","loop");c.controls&&c.video.setAttribute("controls","controls");c.poster&&c.video.setAttribute("poster",c.poster);c.w&&(c.video.setAttribute("width",c.w),
c.video.setAttribute("height",c.h));c.video.setAttribute("style","position: absolute; overflow: hidden; left: "+c.x+"px; top: "+c.y+"px;");var f=c.file,g=f.lastIndexOf(".");-1!=g&&(f=c.file.substring(0,g));c.video.canPlayType("video/mp4")&&(g=document.createElement("source"),g.setAttribute("src",f+".mp4"),g.setAttribute("type","video/mp4"),c.video.appendChild(g));c.video.canPlayType("video/ogg")&&(g=document.createElement("source"),g.setAttribute("src",f+".ogg"),g.setAttribute("type","video/ogg"),
c.video.appendChild(g),g=document.createElement("source"),g.setAttribute("src",f+".ogv"),g.setAttribute("type","video/ogg"),c.video.appendChild(g));c.video.canPlayType("video/webm")&&(g=document.createElement("source"),g.setAttribute("src",f+".webm"),g.setAttribute("type","video/webm"),c.video.appendChild(g));c.addControlContainer(c.video);c.evaluator.setFunction(c.id+".play",function(){c.video.play();return 0});c.evaluator.setFunction(c.id+".pause",function(){c.video.pause();return 0});c.evaluator.setFunction(c.id+
".stop",function(){c.video.pause();return c.video.currentTime=0});c.video.addEventListener("timeupdate",function(a){c.evaluator.setVariable(c.id+".currentTime",c.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 f;a.Video.prototype.update=function(){e=this.evaluator;f=0<e.evalExpression(this.drawif);0<e.evalExpression(this.drawif)?this.video.style.display="block":(this.video.style.display=
"none",f!==this.oldDrawIf&&this.video.pause());this.oldDrawIf=f;this.updatePositionAndSize()};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var e,f;a.TextArea=function(d,b){this.font="Monospaced,PLAIN,12";a.Control.call(this,d,b);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 c=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();c&&"simpleText"!=c.type&&(this.answer=this.text.hasFormula?"":c.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(){f=this.answer?28:8;e=this.evaluator;var d;d=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<e.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-f)+"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;' >"+d+"</span>";this.textAreaAnswer.setAttribute("class","DescartesTextAreaContainer");this.textAreaAnswer.setAttribute("style","width: "+(this.w-8)+"px; height: "+(this.h-f)+"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 d=document.createElement("canvas");d.setAttribute("width",20);d.setAttribute("height",16);var b=d.getContext("2d");this.canvas=d;this.ctx=b;this.createGradient(20,16);b.lineWidth=1;b.fillStyle="white";b.fillRect(0,0,20,16);b.fillStyle=this.linearGradient;b.fillRect(0,0,20,16);a.drawLine(b,19,0,19,
16,"rgba(0,0,0,"+128/255+")");a.drawLine(b,0,0,0,16,"rgba(0,0,0,"+24/255+")");a.drawLine(b,1,0,1,16,"rgba(0,0,0,"+8/255+")");this.imageUnPush=d.toDataURL();b.fillStyle="white";b.fillRect(0,0,20,16);b.fillStyle=this.linearGradient;b.fillRect(0,0,20,16);a.drawLine(b,0,0,0,14,"gray");a.drawLine(b,0,0,19,0,"gray");b.fillStyle="rgba(0, 0, 0,"+24/255+")";b.fillRect(0,0,this.w,this.h);this.imagePush=d.toDataURL()};a.TextArea.prototype.update=function(){e=this.evaluator;this.activeIfValue=0<e.evalExpression(this.activeif);
this.drawIfValue=0<e.evalExpression(this.drawif);var a;a=this.text.match(/<span/)?this.rawText:this.text;e.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(c){c.preventDefault();b.showButton.style.backgroundImage="url("+b.imageUnPush+")"}var b=this;this.showButton.addEventListener("mousedown",
function(a){a.preventDefault();b.showAnswer=!b.showAnswer;b.textAreaAnswer.style.display=b.showAnswer?"block":"none";b.showButton.childNodes[0].childNodes[0].textContent=b.showAnswer?"T":"S";b.showButton.style.backgroundImage="url("+b.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 b=a.getContext("2d");
b.fillStyle="white";b.strokeStyle="black";b.lineWidth=1;b.fillRect(0,0,this.w,this.h);b.strokeRect(0,0,this.w,this.h);return a};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var e=2*Math.PI,f,d,b,c,h,g,r,k,p;a.GraphicControl=function(b,c){d=b.evaluator.parser;this.text=this.spaceID="";this.size=d.parse("4");this.font="Monospaced,PLAIN,12";this.image=new Image;this.image.onload=function(){this.ready=1};this.imageSrc="";a.Control.call(this,b,c);this.touchId=null;this.font=
a.convertFont(this.font);if(this.constraintExpr){this.constraint=d.parse(this.constraintExpr);"(expr)"==this.constraint.type&&(this.constraint=d.parse(this.constraintExpr.substring(1,this.constraintExpr.length-1)));if("compOperator"==this.constraint.type){var g=this.constraint.childs[0],e=this.constraint.childs[1];"identifier"!=g.type||"y"!=g.value||e.contains("y")?"identifier"!=g.type||"x"!=g.value||e.contains("x")?this.newt=new a.R2Newton(this.evaluator,this.constraint):(this.evalConstraint=this.evalConstraintY,
this.constraint=e):(this.evalConstraint=this.evalConstraintX,this.constraint=e)}else this.constraint=null;k=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(){f=this.evaluator;p=a.hasTouchSupport;var b=f.evalExpression(this.expresion);this.x=b[0][0];this.y=b[0][1];f.setVariable(this.xString,this.x);f.setVariable(this.yString,this.y);""==this.imageSrc||this.imageSrc.toLowerCase().match(/vacio.gif$/)?(this.width=2*f.evalExpression(this.size),this.height=2*f.evalExpression(this.size)):(this.image=this.parent.getImage(this.imageSrc),this.width=this.image.width,this.height=this.image.height);this._w=p&&70>this.width?70:this.width;this._h=p&&70>this.height?
70:this.height;this.mouseCacher.setAttribute("style","cursor: pointer; background-color: rgba(255, 255, 255, 0); width: "+this._w+"px; height: "+this._h+"px; z-index: "+this.zIndex+";");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";f.setVariable(this.activoString,0);f.setVariable(this.activeString,0);this.setImage=!1;this.update()};a.GraphicControl.prototype.update=function(){f=
this.evaluator;this.activeIfValue=0<f.evalExpression(this.activeif);this.drawIfValue=0<f.evalExpression(this.drawif);this.x=f.getVariable(this.xString);this.y=f.getVariable(this.yString);b=this.space.getAbsoluteX(this.x);c=this.space.getAbsoluteY(this.y);this.mouseCacher.style.display=this.activeIfValue?"block":"none";this.mouseCacher.style.left=parseInt(b-this._w/2)+"px";this.mouseCacher.style.top=parseInt(c-this._h/2)+"px";this.constraint&&this.evalConstraint();this.draw()};a.GraphicControl.prototype.draw=
function(){f=this.evaluator;this.drawIfValue&&(g=this.ctx,r=this.space.backgroundCtx,b=parseInt(this.space.getAbsoluteX(this.x))+0.5,c=parseInt(this.space.getAbsoluteY(this.y))+0.5,""!=this.text&&this.drawText(b,c),this.image.ready?(this.image.complete&&!this.setImage&&g.drawImage(this.image,parseInt(b-this.image.width/2),parseInt(c-this.image.height/2)),this.trace&&(r.save(),r.translate(b,c),r.scale(parseInt(this.image.width/2),parseInt(this.image.height/2)),r.beginPath(),r.arc(0,0,1,0,e,!1),r.restore(),
r.lineWidth=1,r.strokeStyle=this.trace.getColor(),r.stroke())):(g.beginPath(),g.arc(b,c,parseInt(this.width/2),0,e,!1),g.fillStyle=this.colorInt.getColor(),g.fill(),g.lineWidth=1,g.strokeStyle=this.color.getColor(),g.stroke(),this.active&&(g.beginPath(),g.arc(b,c,parseInt(this.width/2)-2,0,e,!1),g.strokeStyle=this.colorInt.borderColor(),g.stroke()),this.trace&&(r.lineWidth=1,r.strokeStyle=this.trace.getColor(),r.beginPath(),r.arc(b,c,parseInt(this.width/2),0,e,!1),r.stroke())))};a.GraphicControl.prototype.evalConstraint=
function(){k.set(this.x,this.y);h=this.newt.findZero(k,1/this.space.scale,!0);this.x=h.x;this.y=h.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){g=this.ctx;f=this.evaluator;g.fillStyle=this.color.getColor();g.font=this.font;g.textBaseline="alphabetic";g.fillText(f.evalExpression(this.text[0],
f.evalExpression(this.decimals),this.fixed),parseInt(a+1+this.width/2),parseInt(b-1-this.height/2))};a.GraphicControl.prototype.getContainer=function(){for(var a=this.parent.spaces,b,c=0,g=a.length;c<g;c++)if(b=a[c],b.id==this.spaceID)return b.addCtr(this),this.zIndex=b.zIndex,this.space=b,b.graphicControlContainer;a[0].addCtr(this);this.zIndex=a[0].zIndex;this.space=a[0];return a[0].graphicControlContainer};a.GraphicControl.prototype.deactivate=function(){this.active=!1;this.evaluator.setVariable(this.activoString,
0);this.evaluator.setVariable(this.activeString,0)};a.GraphicControl.prototype.registerMouseAndTouchEvents=function(){function b(c){document.body.focus();c.preventDefault();h.whichButton=a.whichButton(c);"L"==h.whichButton&&h.activeIfValue&&h.over&&(h.parent.deactivateGraphiControls(),h.click=!0,h.active=!0,h.evaluator.setVariable(h.activoString,1),h.evaluator.setVariable(h.activeString,1),h.evaluator.setVariable(h.mclickedString,0),h.evaluator.setVariable(h.mclicizquierdoString,0),h.posAnte=h.getCursorPosition(c),
h.prePos={x:h.space.getAbsoluteX(h.x),y:h.space.getAbsoluteY(h.y)},h.evaluator.setVariable(h.mxString,h.space.getRelativeX(h.posAnte.x)),h.evaluator.setVariable(h.myString,h.space.getRelativeY(h.posAnte.y)),h.parent.update(),window.addEventListener("mouseup",g),window.addEventListener("mousemove",d))}function c(a){document.body.focus();a.preventDefault();h.activeIfValue&&(h.parent.deactivateGraphiControls(),h.click=!0,h.active=!0,h.evaluator.setVariable(h.activoString,1),h.evaluator.setVariable(h.activeString,
1),h.evaluator.setVariable(h.mclickedString,0),h.evaluator.setVariable(h.mclicizquierdoString,0),h.posAnte=h.getCursorPosition(a),h.prePos={x:h.space.getAbsoluteX(h.x),y:h.space.getAbsoluteY(h.y)},h.evaluator.setVariable(h.mxString,h.space.getRelativeX(h.posAnte.x)),h.evaluator.setVariable(h.myString,h.space.getRelativeY(h.posAnte.y)),h.parent.update(),window.addEventListener("touchmove",d),window.addEventListener("touchend",g))}function g(b){document.body.focus();b.preventDefault();h.touchId=null;
h.evaluator.setVariable(h.mclickedString,1);h.evaluator.setVariable(h.mclicizquierdoString,1);if(h.activeIfValue||h.active)h.click=!1,a.hasTouchSupport?(window.removeEventListener("touchmove",d,!1),window.removeEventListener("touchend",g,!1)):(window.removeEventListener("mouseup",g,!1),window.removeEventListener("mousemove",d,!1)),h.evaluator.setVariable(h.mxString,h.space.getRelativeX(h.posAnte.x)+h.x),h.evaluator.setVariable(h.myString,h.space.getRelativeY(h.posAnte.y)+h.y),h.parent.update(),h.mouseCacher.style.left=
h.space.getAbsoluteX(h.x)-h._w/2+"px",h.mouseCacher.style.top=h.space.getAbsoluteY(h.y)-h._h/2+"px"}function d(a){a.preventDefault();a.touchId=h.touchId;h.evaluator.setVariable(h.mclickedString,0);h.evaluator.setVariable(h.mclicizquierdoString,0);r=h.getCursorPosition(a);h.posX=h.prePos.x-(h.posAnte.x-r.x);h.posY=h.prePos.y-(h.posAnte.y-r.y);h.evaluator.setVariable(h.xString,h.space.getRelativeX(h.posX));h.evaluator.setVariable(h.yString,h.space.getRelativeY(h.posY));h.evaluator.setVariable(h.mxString,
h.space.getRelativeX(h.posAnte.x)+h.space.getRelativeX(h.posX));h.evaluator.setVariable(h.myString,h.space.getRelativeY(h.posAnte.y)+h.space.getRelativeY(h.posY));10<Date.now()-k&&(h.parent.updateControls(),h.parent.update(),k=Date.now())}function e(a){h.over=!0}function f(a){h.over=!1;h.click=!1}var k=0,h=this;this.active=this.over=this.click=!1;this.mouseCacher.oncontextmenu=function(){return!1};a.hasTouchSupport?this.mouseCacher.addEventListener("touchstart",c):(this.mouseCacher.addEventListener("mousedown",
b),this.mouseCacher.addEventListener("mouseover",e),this.mouseCacher.addEventListener("mouseout",f));var r};a.GraphicControl.prototype.getCursorPosition=function(a){if(a.touches){var b;if(a.touchId)for(c=0,g=a.touches.length;c<g;c++){if(a.touches[c].identifier==a.touchId){b=a.touches[c];break}}else for(var c=0,g=a.touches.length;c<g;c++)if(a.target==a.touches[c].target){b=a.touches[c];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.container.offsetLeft+this.space.container.parentNode.offsetLeft),y:mouseY-(this.space.container.offsetTop+this.space.container.parentNode.offsetTop)}};return a}(descartesJS||{}),descartesJS=function(a,e){var f,d,b,c,h,g,r,k,p,n;if(a.loadLib)return a;var q,s,t,m,u,l,v,w,y=/[\w-//]*(\.png|\.jpg|\.gif|\.svg)/gi,
C,B,D,E,z,A,H,G,K,L,x,J,F,P,M,I,R,S,O,Q,N;a.LessonParser=function(b){this.parent=b;this.parser=b.evaluator.parser;this.RTFparser=new a.RTFParser(b.evaluator)};a.LessonParser.prototype.parseButtonsConfig=function(a){var b={rowsNorth:0,rowsSouth:0,widthEast:125,widthWest:125,height:23};a=this.split(a);for(var c=0,g=a.length;c<g;c++)switch(t=a[c][0],m=a[c][1],s=e[t],s){case "rowsNorth":case "rowsSouth":case "widthEast":case "widthWest":case "height":b[s]=parseInt(m);break;case "about":case "config":case "init":case "clear":b[s]=
"true"===e[m];break;default:console.log("----- attributo de space no identificado: <"+t+"> valor: <"+m+"> -----")}return b};a.LessonParser.prototype.parseSpace=function(b){u={};b=this.split(b);for(var c=0,g=b.length;c<g;c++)switch(t=b[c][0],m=b[c][1],s=e[t],s){case "type":case "id":case "cID":case "file":u[s]=m;break;case "fixed":case "numbers":case "sensitive_to_mouse_movements":case "R3":case "split":u[s]="true"===e[m];break;case "bg_display":case "render":u[s]=e[m];break;case "net":case "net10":case "axes":case "text":u[s]=
""!=m?"false"===e[m]?"":new a.Color(m,this.parent.evaluator):"";break;case "x_axis":case "y_axis":u[s]="false"===e[m]?"":m;break;case "O.x":u.OxExpr=m;break;case "O.y":u.OyExpr=m;break;case "image":u.imageSrc=m;break;case "x":q=m;q="%"===q[q.length-1]?(this.parent.container.width*parseFloat(q)/100).toString():m;u.xExpr=this.parser.parse(q);break;case "y":q=m;q="%"===q[q.length-1]?(this.parent.container.height*parseFloat(q)/100).toString():m;u.yExpr=this.parser.parse(q);break;case "width":q=m;"%"===
q[q.length-1]?(u.wExpr=q,q=this.parent.container.width*parseFloat(q)/100):(q=parseFloat(m),q!=m&&(q=this.parent.container.width));u.w=q;break;case "height":q=m;"%"===q[q.length-1]?(u.hExpr=q,q=this.parent.container.height*parseFloat(q)/100):(q=parseFloat(m),q!=m&&(q=this.parent.container.height));u.h=q;break;case "drawif":""!=m&&(u.drawif=this.parser.parse(m));break;case "scale":q=parseFloat(m);isNaN(q)&&(q=48);u.scale=q;break;case "background":u.background=new a.Color(m,this.parent.evaluator);break;
default:console.log("----- attributo de space no identificado: <"+t+"> valor: <"+m+"> -----")}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){l={type:"numeric"};b=this.split(b);for(var c=0,g=b.length;c<g;c++)switch(t=b[c][0],m=b[c][1],s=
e[t],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":l[s]=m;break;case "gui":case "region":case "action":case "msg_pos":case "poster":l[s]=e[m];break;case "fixed":case "visible":case "discrete":case "onlyText":case "evaluate":case "autoplay":case "loop":case "controls":l[s]="true"===e[m];break;case "color":case "colorInt":case "trace":l[s]=new a.Color(m,this.parent.evaluator);
break;case "font_size":case "drawif":case "activeif":case "decimals":case "min":case "max":case "size":""!=m&&(l[s]=this.parser.parse(m));break;case "constraint":l.constraintExpr=m;break;case "image":l.imageSrc=m;break;case "space":l.spaceID=m;break;case "type":l.type=e[m.trim()];break;case "expresion":l.expresion=this.parser.parse(m.replace(")(",","));break;case "bold":"false"!=e[m]&&(l.bold="bold");break;case "italics":"false"!=e[m]&&(l.italics="italic");break;case "underlined":"false"!=e[m]&&(l.underlined=
!0);break;case "value":var d=m.replace(/&squot;/g,"'");d.match(/^\|/)&&(d="'"+d.substring(1),d.match(/\|$/)&&(d=d.substring(0,d.length-1)+"'"));l.valueExpr=this.parser.parse(d);l.valueExprString=d;break;case "incr":0!=m&&(l.incr=this.parser.parse(m));break;case "exponentialif":l.exponentialif=parseFloat(m);break;case "text":l.rawText=m;for(var d=this.parseText(m),f=0,h=d.length;f<h;f++)d[f]=this.parser.parse(d[f],!1);l.text=d;break;default:f=t.indexOf(".");d=e[t.substring(0,f)];f=e[t.substring(f+
1)];if("parameter"===d&&"font"===f){l.parameterFont=m;break}else if("Explanation"===d&&"font"===f){l.ExplanationFont=m;break}else if("tooltip"===d&&"font"===f){l.tooltipFont=m;break}console.log("----- attributo de control no identificado: <"+t+"> valor: <"+m+"> -----")}if("numeric"===l.type)switch(l.gui){case "spinner":return new a.Spinner(this.parent,l);case "button":return new a.Button(this.parent,l);case "textfield":return new a.TextField(this.parent,l);case "menu":return new a.Menu(this.parent,
l);case "scrollbar":return new a.Scrollbar(this.parent,l);default:return new a.Spinner(this.parent,l)}else{if("video"===l.type)return new a.Video(this.parent,l);if("audio"===l.type)return new a.Audio(this.parent,l);if("graphic"===l.type)return new a.GraphicControl(this.parent,l);if("text"===l.type)return new a.TextArea(this.parent,l)}};a.LessonParser.prototype.parseGraphic=function(b,c,g,d){v={rotateExp:d,parameter:"t"};b=this.split(b);d=0;for(var f=b.length;d<f;d++)if(t=b[d][0],m=b[d][1],s=e[t],
""!=m)switch(s){case "type":case "align":v[s]=e[m];break;case "background":case "abs_coord":case "visible":case "editable":case "fixed":case "vectors":v[s]="true"===e[m];break;case "color":case "fill":case "fillP":case "fillM":case "arrow":case "trace":v[s]="false"===e[m]?"":new a.Color(m,this.parent.evaluator);break;case "family":case "parameter":case "info":case "font":case "name":case "init":case "end":v[s]=m;break;case "drawif":case "width":case "decimals":case "size":case "spear":case "center":case "radius":case "opacity":case "inirot":case "inipos":case "range":""!=
m&&(v[s]=this.parser.parse(m));break;case "space":v.spaceID=m;break;case "expresion":""!=m&&("macro"!=v.type?(v.expresion=this.parser.parse(m),v.expresionString=m):v.expresion=m);break;case "text":v.text=this.parseText(m);break;case "file":var h=m.replace(/&squot;/g,"'");"["===h.charAt(0)&&"]"===h.charAt(h.length-1)&&(h=h.substring(1,h.length-1));h.match(y)&&(h="'"+h+"'");v.file=this.parser.parse(h);break;case "border":""!=m&&"false"!=e[m]&&(v.border=new a.Color(m,this.parent.evaluator));break;default:if(void 0!=
v.family&&t.substring(0,v.family.length+1)===v.family+"."){switch(e[t.substring(v.family.length+1)]){case "interval":""!=m&&(v.family_interval=this.parser.parse(m));break;case "steps":""!=m&&(v.family_steps=this.parser.parse(m))}break}if(void 0!=v.parameter&&t.match(v.parameter+".")){v.parameter!==t.substring(0,t.indexOf(v.parameter)+v.parameter.length)&&(v.parameter=t.substring(0,t.indexOf(v.parameter)+v.parameter.length));switch(e[t.substring(v.parameter.length+1)]){case "interval":""!=m&&(v.parameter_interval=
this.parser.parse(m));break;case "steps":""!=m&&(v.parameter_steps=this.parser.parse(m))}break}console.log("----- attributo del graphic no identificado: <"+t+"> valor: <"+m+"> -----")}c&&(v.abs_coord=c);g&&(v.background=g);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,c,g,d){v={rotateExp:d,parameter:"t"};b=this.split(b);c=0;for(g=b.length;c<g;c++)switch(t=b[c][0],m=b[c][1],
s=e[t],s){case "type":case "model":v[s]=e[m];break;case "background":case "fixed":case "edges":v[s]="true"===e[m];break;case "color":case "backcolor":v[s]=new a.Color(m,this.parent.evaluator);break;case "type":case "model":v[s]=e[m];break;case "background":case "fixed":case "edges":case "split":v[s]="true"===e[m];break;case "color":case "backcolor":v[s]=new a.Color(m,this.parent.evaluator);break;case "drawif":case "width":case "length":case "height":case "decimals":case "Nu":case "Nv":case "inipos":case "endpos":""!=
m&&(v[s]=this.parser.parse(m));break;case "family":case "parameter":case "font":case "name":case "inirot":case "endrot":v[s]=m;break;case "space":v.spaceID=m;break;case "expresion":"macro"!=v.type&&"curve"!=v.type&&"surface"!=v.type?(v.expresion=this.parser.parse(m),v.expresionString=m):v.expresion=m.replace(/\\n/g," ").replace(/;/g," ");break;case "text":d=this.parseText(m);for(var f=0,h=d.length;f<h;f++)d[f]=this.parser.parse(d[f],!1);v.text=d;break;case "file":d=m.replace(/&squot;/g,"'");"["===
d.charAt(0)&&"]"===d.charAt(d.length-1)&&(d=d.substring(1,d.length-1));d.match(/./)&&(d="'"+d+"'");v.file=this.parser.parse(d);break;case "drawif":case "width":case "length":case "decimals":case "Nu":case "Nv":case "inirot":case "endrot":case "inipos":case "endpos":""!=m&&(v[s]=this.parser.parse(m));break;case "family":case "parameter":case "font":case "name":v[s]=m;break;case "space":v.spaceID=m;break;case "expresion":"macro"!=v.type&&"curve"!=v.type&&"surface"!=v.type?(v.expresion=this.parser.parse(m),
v.expresionString=m):v.expresion=m;break;case "text":d=this.parseText(m);f=0;for(h=d.length;f<h;f++)d[f]=this.parser.parse(d[f],!1);v.text=d;break;case "file":d=m.replace(/&squot;/g,"'");"["===d.charAt(0)&&"]"===d.charAt(d.length-1)&&(d=d.substring(1,d.length-1));d.match(/./)&&(d="'"+d+"'");v.file=this.parser.parse(d);break;default:if(void 0!==v.family&&t.substring(0,v.family.length+1)===v.family+"."){"interval"===e[t.substring(v.family.length+1)]?""!=m&&(v.family_interval=this.parser.parse(m)):""!=
m&&(v.family_steps=this.parser.parse(m));break}console.log("----- attributo del graphic3D no identificado: <"+t+"> valor: <"+m+"> -----")}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);default:console.log(v.type)}};a.LessonParser.prototype.parseAuxiliar=function(b){w={};b=this.split(b);for(var c=0,g=b.length;c<g;c++)b[c][1]=
b[c][1].replace(/&squot;/g,"'");c=0;for(g=b.length;c<g;c++)switch(t=b[c][0],m=b[c][1],s=e[t],s){case "id":case "file":case "init":case "doExpr":case "whileExpr":case "range":case "local":case "expresion":case "condition":case "parameter":w[s]=m.replace(/&squot;/g,"'");break;case "editable":case "constant":case "array":case "matrix":case "algorithm":case "event":case "sequence":w[s]="true"===e[m];break;case "size":case "rows":case "columns":w[s]=this.parser.parse(m);break;case "evaluate":case "execution":case "msg_pos":case "action":w[s]=
e[m];break;case "type":w[s]=e[m];break;case "x":case "y":case "width":case "height":w[s]=this.parser.parse(m);break;default:var d=t.indexOf("."),f=e[t.substring(0,d)],d=e[t.substring(d+1)];if("parameter"===f&&"font"===d){w.parameterFont=m;break}console.log("----- attributo de auxiliar no identificado: <"+t+"> valor: <"+m+"> -----")}w.type&&"rectangle"==w.type?this.parent.auxiliaries.push(new a.Rectangle(this.parent,w)):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;B=b.parent;D=b.parameter;if(C)switch(C){case "message":return new a.Message(B,D);case "calculate":return new a.Calculate(B,D);case "openURL":return new a.OpenURL(B,D);case "openScene":return new a.OpenScene(B,D);case "about":return new a.About(B,D);case "config":return new a.Config(B,D);case "init":return new a.Init(B,D);case "clear":return new a.Clear(B,
D);case "animate":return new a.Animate(B,D);case "initAnimation":return new a.InitAnimation(B,D);case "playAudio":return new a.PlayAudio(B,D);default:console.log("----- Accion no soportada aun: <"+C+"> -----")}else return{execute:function(){}}};a.LessonParser.prototype.parseAnimation=function(b){var c={};b=this.split(b);for(var g=0,d=b.length;g<d;g++)switch(t=b[g][0],m=b[g][1],s=e[t],s){case "id":case "delay":case "init":case "doExpr":case "whileExpr":c[s]=m.replace(/&squot;/g,"'");break;case "controls":case "auto":case "loop":case "algorithm":case "evaluate":c[s]=
"true"===e[m];break;default:console.log("----- attributo de la animacion no identificado: <"+t+">  <"+m+"> -----")}return new a.Animation(this.parent,c)};a.LessonParser.prototype.parsePleca=function(e,q){e=this.split(e);d=f="";b=0;c="#536891";h="white";g="left";r="";k="SansSerif,BOLD,20";p="SansSerif,PLAIN,18";n=void 0;for(var l=0,s=e.length;l<s;l++)switch(t=e[l][0],m=e[l][1],t){case "title":f=m;break;case "subtitle":d=m;break;case "subtitlines":b=m;break;case "bgcolor":""!=m&&(c=(new a.Color(m,this.parent.evaluator)).getColor());
break;case "fgcolor":""!=m&&(h=(new a.Color(m,this.parent.evaluator)).getColor());break;case "align":""!=m&&(g=m);break;case "titleimage":r=m;break;case "titlefont":k=""!=m?a.convertFont(m):a.convertFont(k);break;case "subtitlefont":p=""!=m?a.convertFont(m):a.convertFont(p);break;default:console.log("----- attributo de la pleca no identificado: <"+t+">  <"+m+"> -----")}if(""===f&&""===d)return document.createElement("div");L=p.substring(0,p.indexOf("px"));L=L.substring(L.lastIndexOf(" "));""!=r&&
(x=this.parent.getImage(r),J=x.height);n=document.createElement("div");n.setAttribute("id","descartesPleca");J?(n.setAttribute("style","position: absolute; left: 0px; top: 0px; text-align: "+g+"; width: "+(q-30)+"px; height: "+(J-16)+"px; background: "+c+"; color: "+h+"; 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%"),
n.appendChild(x)):n.setAttribute("style","position: absolute; left: 0px; top: 0px; text-align: "+g+"; width: "+(q-30)+"px; background: "+c+"; color: "+h+"; padding-top: 8px; padding-bottom: 8px; padding-left: 15px; padding-right: 15px; margin: 0px; z-index: 100;");F=document.createElement("div");F.setAttribute("style","padding: 0px; margin: 0px; font: "+k+"; overflow: hidden; white-space: nowrap;");F.innerHTML=f;P=document.createElement("div");if(1===parseInt(b)){O=0;M=document.createElement("div");
M.innerHTML=d;document.body.appendChild(M);R=L;do R-=O,M.setAttribute("style","padding: 0px; margin: 0px; font: "+p+"; font-size: "+R+"px; width: "+(q-30)+"px; line-height: "+R+"px;"),I=M.offsetHeight,S=I/R,O=1;while(1<S&&8<R);document.body.removeChild(M);P.setAttribute("style","padding: 0px; margin: 0px; font: "+p+"; font-size: "+R+"px; line-height: 110%; overflow: hidden; white-space: nowrap;")}else P.setAttribute("style","padding: 0px; margin: 0px; font: "+p+"; line-height: 110%;");P.innerHTML=
d;n.appendChild(F);n.appendChild(P);n.imageHeight=J;return n};a.LessonParser.prototype.split=function(a){if("string"!=typeof a)return[];a=(a||"").replace(/\\'/g,"\u2019");E=[];A=z=0;H=!1;G=0;for(K=!1;z<a.length;)" "!==a.charAt(z)||H||z++," "===a.charAt(z)||H||(H=!0,G=z),"="!==a.charAt(z)||"'"!==a.charAt(z+1)||K||(K=!0,E[A]=[a.substring(G,z)],G=z+2,z+=2),K&&"'"===a.charAt(z)&&(H=K=!1,E[A].push(a.substring(G,z)),A++),"="!==a.charAt(z)||"'"===a.charAt(z+1)||K||(E[A]=[a.substring(G,z)],G=z+1,z++,Q=a.substring(z).indexOf("="),
-1===Q?N=Q=a.length:(Q+=z,N=a.substring(z,Q).lastIndexOf(" "),N=-1===N?a.length:N+z),E[A].push(a.substring(G,N)),A++,H=!1,z=N),z++;return E};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 e(a,b){t=[];t.type="matrix";t.rows=a;t.cols=b;var c;u=0;for(l=b;u<l;u++){c=[];m=0;for(v=a;m<v;m++)c.push(0);t[u]=c}return t}function f(a,b){q=
a.rows;s=a.cols;t=e(q,s);var c;for(u=0;u<q;u++)for(m=0;m<s;m++){for(l=c=0;l<s;l++)c+=a[l][u]*b[m][l];t[m][u]=c}return t}function d(a,b,c){for(var g=e(c.length-1,c.length-1),d=0,f=g.length;d<f;d++)for(var h=0;h<f;h++)g[d][h]=d<a?h<b?c[d][h]:c[d][h+1]:d<b?c[d+1][h]:c[d+1][h+1];return g}function b(a){if(1<a.cols){for(var c=0,g=1,e=0,f=a.cols;e<f;e++)c+=g*a[0][e]*b(d(0,e,a)),g=-g;return c}return a[0][0]}if(a.loadLib)return a;var c,h={},g=Math.floor,r,k,p,n;a.fullDecimals=!1;a.Node=function(a,b){this.sep=
"";this.type=a;this.value=b;this.parent=null;this.childs=[]};a.Node.prototype.getRoot=function(){return null===this.parent?this:this.parent.getRoot()};a.Node.prototype.addChild=function(a){a.parent=this;this.childs.push(a)};a.Node.prototype.replaceLastChild=function(a){r=this.childs.length-1;lastChild=this.childs[r];lastChild.parent=null;this.childs[r]=a;a.parent=this;return a};a.Node.prototype.contains=function(a){if(this.value===a)return!0;for(var b=0,c=this.childs.length;b<c;b++)if(this.childs[b].contains(a))return!0;
return!1};a.Node.prototype.equalToMinus=function(){return"compOperator"===this.type?(this.type="operator",this.value="-",p=new a.Node("compOperator","=="),n=new a.Node("number","0"),p.addChild(this),p.addChild(n),k=this.getRoot(),k.setAllEvaluateFunction(),k):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,c){a=b.variables[this.value];if("object"===typeof a)return a.evaluate(b);void 0==a&&(c||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 k,r;this.evaluate=function(a){k=this.childs[0].childs[0].evaluate(a);try{return r=a.vectors[this.value][0>k?0:g(k)],void 0!==r?r:0}catch(b){return 0}}}else if("identifier"===this.type&&"square_bracket"===this.childs[0].type&&1<this.childs[0].childs.length){var p,n;this.evaluate=function(a){p=this.childs[0].childs[0].evaluate(a);n=this.childs[0].childs[1].evaluate(a);try{return r=a.matrices[this.value][0>p?0:g(p)][0>
n?0:g(n)],void 0!==r?r:0}catch(b){return 0}}}else if("identifier"===this.type&&"parentheses"===this.childs[0].type){var l;this.evaluate=function(a){l=[];for(var b=0,g=this.childs[0].childs.length;b<g;b++)l[b]=this.childs[0].childs[b].evaluate(a);return"_Eval_"===this.value?(l[0]=0<l.length?l[0].toString():"",c=l[0].replace(a.parent.decimal_symbol_regexp,"."),void 0==h[c]&&(h[c]=a.parser.parse(c)),a.evalExpression(h[c])):a.functions[this.value].apply(a,l)}}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;q=b.rows;s=b.cols;t=e(q,s);for(u=0;u<q;u++)for(m=0;m<s;m++)t[m][u]=b[m][u]+a[m][u];return t}:"-"===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;q=b.rows;s=b.cols;t=e(q,s);for(u=0;u<q;u++)for(m=0;m<s;m++)t[m][u]=b[m][u]-a[m][u];return t}:"*"===this.value?
this.evaluate=function(a){var b=this.childs[0].evaluate(a,!0);a=this.childs[1].evaluate(a,!0);return"matrix"!==b.type||"matrix"!==a.type?b*a:f(b,a)}:"/"===this.value?this.evaluate=function(a){var c=this.childs[0].evaluate(a,!0);a=this.childs[1].evaluate(a,!0);if("matrix"!==c.type||"matrix"!==a.type)return c/a;var g=e(a.length,a.length),h=b(a);if(0===h)a=0;else{var h=1/h,k;if(1<a.length)for(var r=0,m=a.length;r<m;r++){k=h;for(var p=0;p<m;p++)g[p][r]=k*b(d(r,p,a)),k=-k;h=-h}else g[0][0]=h;a=g}c=0===
a?e(c.rows,c.cols):f(c,a);return c}:"%"===this.value?this.evaluate=function(a){var b=this.childs[0].evaluate(a);a=this.childs[1].evaluate(a);return b-g(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,c=[],g;if(1===b&&1===this.childs[0].childs.length&&"(expr)"===this.type)c=this.childs[0].childs[0].evaluate(a);else for(var d=0;d<b;d++){g=[];for(var e=0,f=this.childs[d].childs.length;e<f;e++)g.push(this.childs[d].childs[e].evaluate(a));c[d]=g}return c};
else if("asign"===this.type){var v,A,H,G,K,L;this.evaluate=function(a){v=this.childs[0];A=this.childs[1];1===v.childs.length&&"square_bracket"===v.childs[0].type?(k=v.childs[0].childs,1===k.length?(H=k[0].evaluate(a),H=0>H?0:g(H),a.vectors[v.value][H]=A.evaluate(a)):2===k.length&&(G=k[0].evaluate(a),K=k[1].evaluate(a),G=0>G?0:g(G),K=0>K?0:g(K),a.matrices[v.value][G]||(a.matrices[v.value][G]=[]),a.matrices[v.value][G][K]=A.evaluate(a))):(L=A.evaluate(a),L.type?a.matrices[v.value]=L:"object"!==typeof a.variables[v.value]&&
(a.variables[v.value]=L))}}};var q,s,t,m,u,l,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,c=this.childs.length;b<c;b++)a+=this.sep+this.childs[b].toString();return a};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var e,f,d,b,c,h,g,r,k,p=/^\s+/,n=/^[a-zA-Z_\u00C0-\u021B]+[a-zA-Z_0-9\u00C0-\u021B]*([.]*[0-9a-zA-Z_\u00C0-\u021B]+[0-9]*)*/,q=/^[0-9]+[.][0-9]+|^[.][0-9]+|^[0-9]+/,
s=/^==|^!=|^<=|^<|^>=|^>|^#/,t=/^\!|^\~|^\&\&|^\&|^\|\||^\|/,m=/^=/,u=/^[\?\:]/,l=/^[\+\-\*\/\%\^]/,v=/^\[|^\]/,w=/^\(|^\)/,y=/^,/,C=/^;/,B=/\|/g,D=/\|\*/g,E=/\*\|/g;a.Tokenizer=function(){};a.Tokenizer.prototype.tokenize=function(a){function A(a,c,g){f.push({type:a,value:c});h=h.slice(g);b+=g;r++;k=a}if(e=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(E,
"'"));a.match(/\=\|/g)&&(a=a.replace(B,"'"));var z=a.trim();"|"==z.charAt(0)&&"|"==z.charAt(z.length-1)&&(a=z.replace(B,"'"))}f=[];d=!1;b=0;h=a;r=0;for(k="";a&&b<a.length;)if(d=b,"'"==h[0]){for(g=1;"'"!=h[g];)if(g<h.length)g++;else{console.log(">Error, unknown symbol: ["+h+"], in the string <<"+e+">>");return}c=h.substring(1,g);A("string",c,c.length+2)}else if(c=h.match(p))h=h.slice(c[0].length),b+=c[0].length,r++;else if(c=h.match(n))"number"===k&&f.push({type:"operator",value:"*"}),A("identifier",
c[0],c[0].length);else if(c=h.match(q))A("number",c[0],c[0].length);else if(c=h.match(s))z=c[0],"#"==z&&(z="!="),A("compOperator",z,c[0].length);else if(c=h.match(t))z=c[0],"||"==z?z="|":"&&"==z?z="&":"~"==z&&(z="!"),A("boolOperator",z,c[0].length);else if((c=h.match(m))&&!h.match(/^==/))A("asign",c[0],c[0].length);else if(c=h.match(u))A("conditional",c[0],c[0].length);else if(c=h.match(l))A("operator",c[0],c[0].length);else if(c=h.match(v))A("square_bracket",c[0],c[0].length);else if(c=h.match(w))"("==
c&&"number"===k&&f.push({type:"operator",value:"*"}),A("parentheses",c[0],c[0].length);else if(c=h.match(y))A("separator",c[0],c[0].length);else if(178===h.charCodeAt(0))f.push({type:"operator",value:"^"}),A("number",2,1);else if(179===h.charCodeAt(0))f.push({type:"operator",value:"^"}),A("number",3,1);else if(c=h.match(C))A("final_of_expresion",c[0],c[0].length);else if(d==b){console.log("Error, simbolo no conocido: ["+h+"], en la cadena <<"+e+">>");return}return f};var z,A=/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||"";z="";for(var c=0,g=a.length;c<g;c++)z="string"==a[c].type?z+"&squot;"+a[c].value+"&squot;":"identifier"!=a[c].type||a[c].value.match(A)?z+a[c].value:z+b+a[c].value;return z};return a}(descartesJS||{}),descartesJS=function(a){function e(a){return isNaN(parseFloat(a))?a.replace(/^\s|\s$/g,"").replace(/^'|'$/g,""):parseFloat(a)}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){return this.variables[a]};a.Parser.prototype.setVector=function(a,b,c){this.vectors[a][b]=c};a.Parser.prototype.getVector=function(a){this.vectors.hasOwnProperty(a)||
(this.vectors[a]=[0,0,0]);return this.vectors[a]};a.Parser.prototype.setMatrix=function(a,b,c,g){this.matrices[a][b][c]=g};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 f,d,b,c,h,g,r,k,p,n,
q,s;a.Parser.prototype.parse=function(e,m){(b=this.tokenizer.tokenize(e))||(b=[]);c=null;m=!m||!1;f=k=r=g=0;for(d=b.length;f<d;f++)if(p=b[f],n=p.value,q=p.type,"identifier"===q&&(f+1<d&&"parentheses"===b[f+1].type&&"("===b[f+1].value?this.getFunction(n):f+1<d&&"square_bracket"===b[f+1].type&&"["===b[f+1].value?b[f+3]&&"square_bracket"===b[f+3].type&&"]"===b[f+3].value?this.getVector(n):this.getMatrix(n):this.getVariable(n)),"asign"===q&&m&&(q="compOperator",n="=="),"asign"===q)if(h=new a.Node(q,n),
null!=c)if("identifier"===c.type)c.parent&&c.parent.replaceLastChild(h),h.addChild(c),c=h,m=!0;else if("square_bracket"===c.type)h.addChild(c.parent),c=h,m=!0;else{h.type="compOperator";h.value="==";for(m=!0;c.parent&&this.getPrecedence(c.parent.value)>=this.getPrecedence(h.value);)c=c.parent;c.parent&&c.parent.replaceLastChild(h);h.addChild(c);c=h}else{console.log("Error1: en la expresion <<"+e+">>, en el token {valor: "+n+", tipo: "+q+"}");break}else if("parentheses"===q&&"("===n||"square_bracket"===
q&&"["===n)if(h=new a.Node(q,n),"("===n&&g++,"["===n&&r++,null===c)"("===n&&(new a.Node("(expr)","(expr)")).addChild(h),"["===n&&(new a.Node("[expr]","[expr]")).addChild(h),c=h;else if("operator"===c.type||"boolOperator"===c.type||"compOperator"===c.type||"conditional"===c.type||"asign"===c.type)c.addChild(h),c=h;else if("sign"===c.type)c.addChild(h),c=h;else if("parentheses"===c.type&&"("===c.value)c.addChild(h),c=h;else if("square_bracket"===c.type&&"["===c.value)c.addChild(h),c=h;else if("parentheses"===
c.type&&"()"===c.value)c.parent.addChild(h),c=h;else if("square_bracket"===c.type&&"[]"===c.value)c.parent.addChild(h),c=h;else if("identifier"===c.type)c.addChild(h),c=h;else{console.log("Error2: en la expresion <<"+e+">>, en el token ["+f+"] {valor: "+n+", tipo: "+q+"}");break}else if("parentheses"===q&&")"===n)if(g--,null===c)console.log("Error3: en la expresion <<"+e+">>, en el token (valor:"+n+", tipo:"+q);else{for(;c&&c.parent&&"("!=c.value;)c=c.parent;if(c&&"("===c.value)c.value="()";else{console.log("Error4: en la expresion <<"+
e+">>, en el token {valor: "+n+", tipo: "+q+"}");break}}else if("square_bracket"===q&&"]"===n)if(r--,null===c)console.log("Error5: en la expresion <<"+e+">>, en el token (valor:"+n+", tipo:"+q);else{for(;c&&c.parent&&"["!=c.value;)c=c.parent;if(c&&"["===c.value)c.value="[]";else{console.log("Error6: en la expresion <<"+e+">>, en el token {valor: "+n+", tipo: "+q+"}");break}}else if("number"===q||"string"===q||"identifier"===q)if(h=new a.Node(q,n),null===c)c=h;else if("operator"===c.type||"compOperator"===
c.type||"boolOperator"===c.type||"parentheses"===c.type&&"("===c.value||"square_bracket"===c.type&&"["===c.value||"sign"===c.type||"conditional"===c.type||"asign"===c.type)c.addChild(h),c=h;else{console.log("Error7: en la expresion <<"+e+">>, en el token {valor: "+n+", tipo: "+q+"}");break}else if("operator"===q||"compOperator"===q||"boolOperator"===q)if(h=new a.Node(q,n),null===c)if("-"===n||"+"===n)h.type="sign",h.value="sign"+n,c=h;else if("!"===n)c=h;else{console.log("Error8: en la expresion <<"+
e+">>, en el token {valor: "+n+", tipo: "+q+"}");break}else if("operator"===c.type||"compOperator"===c.type||"boolOperator"===c.type||"asign"===c.type||"conditional"===c.type||"square_bracket"===c.type&&"["===c.value&&("-"===n||"+"===n||"!"===n)||"parentheses"===c.type&&"("===c.value&&("-"===n||"+"===n||"!"===n)){if("-"===n||"+"===n)h.type="sign",h.value="sign"+n;c.addChild(h);c=h}else if("number"===c.type||"parentheses"===c.type&&"()"===c.value||"square_bracket"===c.type&&"[]"===c.value||"string"===
c.type||"identifier"===c.type||"conditional"===c.type||"asign"===c.type){for(;c.parent&&this.getPrecedence(c.parent.value)>=this.getPrecedence(h.value);)c=c.parent;c.parent&&c.parent.replaceLastChild(h);h.addChild(c);c=h}else{console.log("Error9: en la expresion <<"+e+">>, en el token {valor: "+n+", tipo: "+q+"}");break}else if("conditional"===q)if(h=new a.Node(q,n),null!=c)if("?"===h.value){for(k++;c.parent&&this.getPrecedence(c.parent.value)>this.getPrecedence(h.value);)c=c.parent;c.parent&&c.parent.replaceLastChild(h);
h.addChild(c);c=h}else{for(k--;c&&c.parent&&"?"!=c.value;)c=c.parent;if(c&&"?"===c.value)c.value="?:";else{console.log("Error10: en la expresion <<"+e+">>, en el token {valor: "+n+", tipo: "+q+"}");break}}else{console.log("Error11: en la expresion <<"+e+">>, en el token {valor: "+n+", tipo: "+q+"}");break}else if("separator"===q)if(null!=c)for(;c.parent&&"("!=c.value&&"["!=c.value;)c=c.parent;else{console.log("Error12: en la expresion <<"+e+">>, en el token {valor: "+n+", tipo: "+q+"}");break}else{console.log("Error13: en la expresion <<"+
e+">>, en el token {valor: "+n+", tipo: "+q+"}");break}0<g&&alert("Error, faltan parentesis por cerrar: "+e);0>g&&alert("Error, faltan parentesis por abrir: "+e);0<r&&alert("Error, faltan square bracketss por cerrar: "+e);0>r&&alert("Error, faltan square bracketss por abrir: "+e);0!=k&&alert("Error, condicional incompleta: "+e);(s=c?c.getRoot():null)&&s.setAllEvaluateFunction();return s};a.Parser.prototype.getPrecedence=function(a){switch(a){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,c){for(var g in c)c.hasOwnProperty(g)&&(a[g]=c[g])}this.variables.rnd=
Math.random;this.variables.pi=a.returnValue(Math.PI);this.variables.e=a.returnValue(Math.E);this.variables.Infinity=Infinity;this.variables["-Infinity"]=-Infinity;this.functions.sqr=function(a){return a*a};this.functions.sqrt=this.functions["ra\u00edz"]=Math.sqrt;this.functions.exp=Math.exp;this.functions.log=Math.log;this.functions.log10=function(a){return Math.log(a)/Math.log(10)};this.functions.abs=Math.abs;this.functions.ent=Math.floor;this.functions.sgn=function(a){return 0<a?1:0>a?-1:0};this.functions.ind=
function(a){return a?1:0};this.functions.sin=this.functions.sen=Math.sin;this.functions.cos=Math.cos;this.functions.tan=Math.tan;this.functions.cot=function(a){return 1/Math.tan(a)};this.functions.sec=function(a){return 1/Math.cos(a)};this.functions.csc=function(a){return 1/Math.sin(a)};this.functions.sinh=this.functions.senh=function(a){return(Math.exp(a)-Math.exp(-a))/2};this.functions.cosh=function(a){return(Math.exp(a)+Math.exp(-a))/2};this.functions.tanh=function(a){return(Math.exp(a)-Math.exp(-a))/
(Math.exp(a)+Math.exp(-a))};this.functions.coth=function(a){return 1/this.functions.tanh(a)};this.functions.sech=function(a){return 1/this.functions.cosh(a)};this.functions.csch=function(a){return 1/this.functions.sinh(a)};this.functions.asin=this.functions.asen=Math.asin;this.functions.acos=Math.acos;this.functions.atan=Math.atan;this.functions.min=Math.min;this.functions.max=Math.max;this.functions._Num_=function(a){return"number"==typeof a?"NaN":parseFloat(a)==a?parseFloat(a):"NaN"};var c=this;
this.functions._Trace_=function(a){console.log(a)};this.functions._Stop_Audios_=function(){c.evaluator.parent.stopAudios()};this.functions.esCorrecto=function(b,g,d){return a.esCorrecto(b,g,c.evaluator,d)};this.functions.escorrecto=function(b,g,d){return a.escorrecto(b,g,c.evaluator,d)};window.parent!==window&&(this.functions["parent.set"]=function(a,b){window.parent.postMessage({type:"set",name:a,value:b},"*");return 0},this.functions["parent.update"]=function(){window.parent.postMessage({type:"update"},
"*");return 0},this.functions["parent.exec"]=function(a,b){window.parent.postMessage({type:"exec",name:a,value:b},"*");return 0});this.functions._GetValues_=function(b,g){var d;if(b){d=(d=document.getElementById(b))&&"descartes/archivo"==d.type?d.text.replace(/&brvbar;/g,String.fromCharCode("166")):a.openExternalFile(b);var e=[],f=!1;if(d){d=d.replace(/\r/g,"").split("\n");for(var h=0,k=d.length;h<k;h++)d[h].match("<"+g+">")?(f=d[h].trim().split("<"+g+">"),2==f.length&&""!=f[1]&&(e=e.concat(f[1].split(String.fromCharCode("166")))),
f=!0):d[h].match("</"+g+">")?(f=d[h].trim().split("</"+g+">"),2==f.length&&""!=f[0]&&(e=e.concat(f[0].split(String.fromCharCode("166")))),f=!1):f&&(e=e.concat(d[h].split(String.fromCharCode("166"))));h=0;for(k=e.length;h<k;h++)f=e[h].split("="),f[0]=f[0].trim(),2==f.length&&""!=f[0]&&(isNaN(parseFloat(f[1]))?c.setVariable(f[0],f[1].replace(/^\s|\s$/g,"").replace(/^'|'$/g,"")):c.setVariable(f[0],parseFloat(f[1])))}return 0}};this.functions._GetMatrix_=function(b,g){var d;if(b){d=(d=document.getElementById(b))&&
"descartes/archivo"==d.type?d.text.replace(/&brvbar;/g,String.fromCharCode("166")):a.openExternalFile(b);var f=[],h=!1;f.type="matrix";if(d){d=d.replace(/\r/g,"").split("\n");for(var k=0,r=d.length;k<r;k++)d[k].match("<"+g+">")?(h=d[k].trim().split("<"+g+">"),2==h.length&&""!=h[1]&&f.push(h[1].split(String.fromCharCode("166")).map(e)),h=!0):d[k].match("</"+g+">")?(h=d[k].trim().split("</"+g+">"),2==h.length&&""!=h[0]&&f.push(h[0].split(String.fromCharCode("166")).map(e)),h=!1):h&&f.push(d[k].split(String.fromCharCode("166")).map(e));
c.matrices[g]=f;c.setVariable(g+".filas",f[0].length);c.setVariable(g+".columnas",f.length)}return 0}};var g=document.createElement("a"),d;this.functions._Save_=function(a,b){document.body.appendChild(g);d=new Blob([b.replace(/\\n/g,"\n").replace(/\\q/g,"'")],{type:"text/plain"});g.setAttribute("download",a);g.setAttribute("href",window.URL.createObjectURL(d));g.click();document.body.removeChild(g);return 0};var f,h,k,r,p=document.createElement("input");p.setAttribute("type","file");onHandleFileSelect=
function(b){f=b.target.files;h=new FileReader;h.onload=function(b){a.addExternalFileContent(f[0].name,b.target.result);c.setVariable(k,f[0].name);c.getFunction(r)&&(c.getFunction(r).apply(c.evaluator,[]),c.evaluator.parent.update())};0<f.length&&h.readAsText(f[0])};p.addEventListener("change",onHandleFileSelect);this.functions._Open_=function(a,b){k=a;r=b;p.click();return 0};this.functions._SaveState_=function(){this.functions._Save_("state.txt",JSON.stringify({variables:this.variables,vectors:this.vectors,
matrices:this.matrices}));return 0};var n,q,s=document.createElement("input");s.setAttribute("type","file");onHandleFileSelect2=function(a){a.stopPropagation();a.preventDefault();n=a.target.files;q=new FileReader;q.onload=function(a){var g={};try{g=JSON.parse(a.target.result)}catch(d){}g.variables&&b(c.variables,g.variables);g.vectors&&b(c.vectors,g.vectors);g.matrices&&b(c.matrices,g.matrices);c.evaluator.parent.update()};0<n.length&&q.readAsText(n[0])};s.removeEventListener("change",onHandleFileSelect2);
s.addEventListener("change",onHandleFileSelect2);this.functions._OpenState_=function(){s.click();return 0};this.functions._Rojo_=function(b){return(new a.Color(b)).r/255};this.functions._Verde_=function(b){return(new a.Color(b)).g/255};this.functions._Azul_=function(b){return(new a.Color(b)).b/255};this.functions._AnchoDeCadena_=function(b,c,g,d){return a.getTextWidth(b,a.convertFont(c+","+g+","+d))};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._MatrixToStr_=function(a){var b=this.matrices[a];if(b){strM="<"+a+">\\n";for(var c=0,g=b.rows;c<g;c++){for(var d=0,e=b.cols;d<e;d++)strM+=b[c][d]+(d<e-1?" "+String.fromCharCode("166")+" ":"");strM+="\\n"}return strM+=
"</"+a+">"}return""}};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var e=Math.floor;a.Evaluator=function(e){this.parent=e;this.parser=new a.Parser(this);this.variables=this.parser.variables;this.functions=this.parser.functions;this.vectors=this.parser.vectors;this.matrices=this.parser.matrices;this.definitions=this.parser.definitions};a.Evaluator.prototype.setDefinition=function(a,d){this.definitions[a]=d};a.Evaluator.prototype.getDefinition=function(a){return this.definitions[a]};
a.Evaluator.prototype.setVariable=function(a,d){this.variables[a]=d};a.Evaluator.prototype.getVariable=function(a){return this.variables[a]};a.Evaluator.prototype.setVector=function(a,d,b){d=0>d?0:e(d);this.vectors[a][d]=b};a.Evaluator.prototype.getVector=function(a,d){d=0>d?0:e(d);return this.vectors[a][d]};a.Evaluator.prototype.setMatrix=function(a,d,b,c){d=0>d?0:e(d);b=0>b?0:e(b);this.matrices[a][d][b]=c};a.Evaluator.prototype.getMatrix=function(a,d,b){d=0>d?0:e(d);b=0>b?0:e(b);return this.matrices[a][d][b]};
a.Evaluator.prototype.setFunction=function(a,d){this.functions[a]=d};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){if(a.loadLib)return a;var e=2,f=!1,d;a.RTFNode=function(a,b,c,d){this.evaluator=a;this.type="rtfNode";this.value=b;this.nodeType=c;this.style=d;this.styleString=d.toString();this.color=d.textColor;
this.underline=d.textUnderline;this.overline=d.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,c=0,h=0;a.RTFNode.prototype.getTextMetrics=function(){if("textBlock"==
this.nodeType){this.spaceWidth=a.getTextWidth(" ",this.styleString);for(var g=0,d=this.children.length;g<d;g++)this.children[g].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 k=a.getFontMetrics(this.styleString);this.baseline=k.baseline;this.descent=k.descent;this.ascent=k.ascent;this.w=0;this.h=k.h}else if("text"==this.nodeType||
"dynamicText"==this.nodeType){this.spaceWidth=a.getTextWidth(" ",this.styleString);k=a.getFontMetrics(this.styleString);this.baseline=k.baseline;this.descent=k.descent;this.ascent=k.ascent;var g=this.value,p;"string"!=typeof this.value&&(d=void 0==this.decimals?e:this.evaluator.evalExpression(this.decimals),p=void 0==this.fixed?f:this.fixed,g=this.evaluator.evalExpression(this.value,d,p),parseFloat(g).toString()===g.toString()&&(g=p?parseFloat(g).toFixed(d):a.removeNeedlessDecimals(parseFloat(g).toFixed(d)),
g=(""+g).replace(".",this.decimal_symbol)),g+=" ");this.w=a.getTextWidth(g,this.styleString);this.h=k.h}else if("formula"==this.nodeType)this.spaceWidth=a.getTextWidth(" ",this.styleString),this.getBlockMetric();else if("hyperlink"===this.nodeType){g=a.getFontMetrics(this.styleString);this.baseline=g.baseline;this.descent=g.descent;this.ascent=g.ascent;this.w=a.getTextWidth(this.value,this.styleString);this.h=g.h;this.clickCacher=document.createElement("div");this.clickCacher.setAttribute("style",
"position: absolute; width: "+this.w+"px; height: "+this.h+"px; cursor: pointer;");var n=this;this.clickCacher.addEventListener("click",function(a){n.click=!0;window.open(n.URL,n.URL)})}else if("superIndex"==this.nodeType)this.spaceWidth=a.getTextWidth(" ",this.styleString),d=b,k=c,p=h,g=a.getFontMetrics(this.styleString),this.getBlockMetric(),0>this.h&&(this.ascent=g.ascent,this.descent=g.descent,this.h=this.ascent+this.descent,this.w=1.5*this.spaceWidth),g=p/2-k+this.h,this.superIndexPos=g-this.ascent,
this.ascent=g,this.descent=k,this.baseline=this.ascent,this.h=this.ascent+this.descent;else if("subIndex"==this.nodeType)this.spaceWidth=a.getTextWidth(" ",this.styleString),d=b,k=c,p=h,g=a.getFontMetrics(this.styleString),this.getBlockMetric(),0>this.h&&(this.ascent=g.ascent,this.descent=g.descent,this.h=this.ascent+this.descent,this.w=1.5*this.spaceWidth),this.subIndexPos=k+1,this.ascent=d,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 q=this.children[0],s=this.children[1],g=a.getFontMetrics(q.styleString);q.getBlockMetric();s.getBlockMetric();d=b;k=c;p=h;0>q.h&&(q.h=g.h,q.w=this.spaceWidth);0>s.h&&(s.h=g.h,s.w=this.spaceWidth);this.h=q.h+s.h-1;this.ascent=q.h+Math.round(p/2)-k;this.descent=this.h-this.ascent;this.baseline=this.ascent;this.w=Math.max(q.w,s.w)+this.spaceWidth+8}else if("radical"==this.nodeType){this.spaceWidth=a.getTextWidth(" ",this.styleString);
k=this.children[0].style.clone();if(1===this.children.length)this.children[1]=new a.RTFNode(this.evaluator," ","radicand",k),this.children[1].addChild(this.children[0]),this.children[0]=new a.RTFNode(this.evaluator," ","index",k);else if("index"!==this.children[0].nodeType||"radicand"!==this.children[1].nodeType){p=new a.RTFNode(this.evaluator,"","radicand",k);g=0;for(d=this.children.length;g<d;g++)p.addChild(this.children[g]);this.children=[];this.children[0]=new a.RTFNode(this.evaluator,"","index",
k);this.children[1]=p}g=this.children[0];d=this.children[1];0>=g.children.length&&(k=this.style.clone(),k.fontSize=parseInt(k.fontSize-0.2*k.fontSize),g.addChild(new a.RTFNode(this.evaluator," ","text",k)));0>=d.children.length&&d.addChild(new a.RTFNode(this.evaluator," ","text",this.style.clone()));g.getBlockMetric();d.getBlockMetric();this.ascent=d.h/2<g.h?d.h/2+g.h+2-d.descent:d.ascent+4;this.descent=d.descent;this.baseline=this.ascent;this.h=this.ascent+this.descent;this.w=g.w+d.w+4*this.spaceWidth}else if("sum"==
this.nodeType)this.spaceWidth=a.getTextWidth(" ",this.styleString),d=b,k=c,p=h,k=this.children[0],d=this.children[1],p=this.children[2],k.getBlockMetric(),d.getBlockMetric(),p.getBlockMetric(),-1==k.ascent&&(q=a.getFontMetrics(k.styleString),k.ascent=q.ascent,k.descent=q.descent,k.h=q.h),-1==d.ascent&&(q=a.getFontMetrics(d.styleString),d.ascent=q.ascent,d.descent=q.descent,d.h=q.h),g=a.getFontMetrics(this.styleString),this.ascent=g.h+d.h>p.ascent?g.h-g.descent+d.h:p.ascent,this.descent=k.h>p.descent?
k.h+g.descent:p.descent,this.baseline=this.ascent,this.h=this.ascent+this.descent,g=this.style.clone(),g.fontType="Times New Roman",g.Bold="bold",g=g.toString(),g=a.getTextWidth(String.fromCharCode(8721),g),this.w=Math.max(k.w,d.w,g)+Math.max(p.w,this.spaceWidth)+this.spaceWidth;else if("integral"==this.nodeType)this.spaceWidth=a.getTextWidth(" ",this.styleString),d=b,k=c,p=h,k=this.children[0],d=this.children[1],p=this.children[2],k.getBlockMetric(),d.getBlockMetric(),p.getBlockMetric(),-1==k.ascent&&
(q=a.getFontMetrics(k.styleString),k.ascent=q.ascent,k.descent=q.descent,k.h=q.h),-1==d.ascent&&(q=a.getFontMetrics(d.styleString),d.ascent=q.ascent,d.descent=q.descent,d.h=q.h),g=a.getFontMetrics(this.styleString),this.ascent=g.h+d.h>p.ascent?g.h-g.descent+d.h:p.ascent,this.descent=k.h>p.descent?k.h+g.descent:p.descent,this.baseline=this.ascent,this.h=this.ascent+this.descent,g=this.style.clone(),g.fontSize*=1.5,g.fontType="Times New Roman",g.Bold="bold",g=g.toString(),g=a.getTextWidth(String.fromCharCode(8747),
g),this.w=Math.max(k.w,d.w,g)+Math.max(p.w,this.spaceWidth)+2*this.spaceWidth;else if("limit"==this.nodeType)this.spaceWidth=a.getTextWidth(" ",this.styleString),d=b,k=c,p=h,k=this.children[0],d=this.children[1],p=this.children[2],g=a.getFontMetrics(this.styleString),k.getBlockMetric(),d.getBlockMetric(),p.getBlockMetric(),-1==k.ascent&&(q=a.getFontMetrics(k.styleString),k.ascent=q.ascent,k.descent=q.descent,k.h=q.h),-1==d.ascent&&(q=a.getFontMetrics(d.styleString),d.ascent=q.ascent,d.descent=q.descent,
d.h=q.h),-1==p.ascent&&(q=a.getFontMetrics(p.styleString),p.ascent=q.ascent,p.descent=q.descent,p.h=q.h),this.ascent=p.ascent,this.descent=Math.max(g.h,p.descent),this.baseline=this.ascent,this.h=this.ascent+this.descent,g=a.getTextWidth(" "+String.fromCharCode(8594),this.styleString),0==k.w&&(k.w=this.spaceWidth),0==d.w&&(d.w=this.spaceWidth),0==p.w&&(p.w=this.spaceWidth),this.w=d.w+k.w+p.w+g+this.spaceWidth;else if("matrix"==this.nodeType){this.spaceWidth=a.getTextWidth(" ",this.styleString);g=
a.getFontMetrics(this.styleString);d=b;k=c;p=h;p=g.ascent;for(var q=g.descent,s=g.h,t=this.spaceWidth,m,u,g=0,d=this.children.length;g<d;g++)this.children[g].getBlockMetric(),m=this.children[g].h,u=this.children[g].w,s<m&&(s=m,p=this.children[g].ascent,q=this.children[g].descent),t<u&&(t=u);this.childWidth=t+2*this.spaceWidth;this.childh=s;this.childAscent=p;this.childDescent=q;this.h=this.rows*s;this.ascent=this.h/2+k;this.descent=this.h-this.ascent;this.w=this.columns*this.childWidth+this.spaceWidth}else if("defparts"==
this.nodeType){this.spaceWidth=a.getTextWidth(" ",this.styleString);g=a.getFontMetrics(this.styleString);d=b;k=c;p=h;p=g.ascent;q=g.descent;s=g.h;t=this.spaceWidth;g=0;for(d=this.children.length;g<d;g++)this.children[g].getBlockMetric(),m=this.children[g].h,u=this.children[g].w,s<m&&(s=m,p=this.children[g].ascent,q=this.children[g].descent),t<u&&(t=u);this.childWidth=t+2*this.spaceWidth;this.childh=s;this.childAscent=p;this.childDescent=q;this.h=this.parts*s;this.ascent=this.h/2+k;this.descent=this.h-
this.ascent;this.w=t+this.spaceWidth/2}else"mathSymbol"==this.nodeType?(this.spaceWidth=a.getTextWidth(" ",this.styleString),k=a.getFontMetrics(this.styleString),this.baseline=k.baseline,this.descent=k.descent,this.ascent=k.ascent,this.w=a.getTextWidth(this.value,this.styleString)+this.spaceWidth,this.h=k.h):"componentNumCtrl"==this.nodeType?(this.spaceWidth=a.getTextWidth(" ",this.styleString),this.componentNumCtrl=this.evaluator.parent.getControlByCId(this.value),k=this.componentNumCtrl.h||0,this.baseline=
Math.round(3*k/5),this.descent=Math.round(2*k/5),this.ascent=this.baseline,this.h=k,this.w=this.componentNumCtrl.w):"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,d=-1,e,f=0,n=this.children.length;f<n;f++){e=
this.children[f];e.getTextMetrics();childAscent=e.ascent;childDescent=e.descent;this.w+=e.w;var q=childDescent;e=e.h;b=childAscent;c=q;h=e;d<childAscent&&(d=childAscent);a<childDescent&&(a=childDescent)}this.ascent=d;this.descent=a;this.baseline=this.ascent;this.h=this.ascent+this.descent};a.RTFNode.prototype.drawTextBlock=function(a,b,c,h,n,q,s,t){d=t;this.stableWidth||(e=h,f=n,this.getTextMetrics());s=s?-this.children[0].ascent:0;n=h=0;for(q=this.children.length;n<q;n++)0<n&&(h+=this.children[n-
1].h),this.children[n].draw(a,b+0,c+s+h)};a.RTFNode.prototype.drawTextLineBlock=function(a,b,c){for(var e=0,f=0,h=this.children.length;f<h;f++)a.strokeStyle=d,a.fillStyle=d,0<f&&(e+=this.children[f-1].w,"formula"==this.children[f-1].nodeType&&(e+=2*this.children[f-1].spaceWidth)),this.children[f].draw(a,b+e,c+this.baseline)};a.RTFNode.prototype.drawFormula=function(a,b,c){for(var d=0,e=0,f=this.children.length;e<f;e++)0<e&&(d+=this.children[e-1].w),this.children[e].draw(a,b+this.spaceWidth+d,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 d="bold"==this.style.textBold,e=d?1:0.5;a.lineWidth=d?2:1;null!=this.color&&(a.strokeStyle=this.color);a.beginPath();a.moveTo(b-1,parseInt(c+this.descent/2)+e);a.lineTo(b-1+this.w,parseInt(c+this.descent/2)+e);a.stroke()}this.overline&&(e=(d="bold"==this.style.textBold)?2:1.5,a.lineWidth=
d?2:1,null!=this.color&&(a.strokeStyle=this.color),a.beginPath(),a.moveTo(b-1,parseInt(c-this.ascent)+e),a.lineTo(b-1+this.w,parseInt(c-this.ascent)+e),a.stroke())};a.RTFNode.prototype.drawDynamicText=function(b,c,d){var h=Math.floor(0.5*this.spaceWidth),n=void 0==this.decimals?e:this.evaluator.evalExpression(this.decimals),q=void 0==this.fixed?f:this.fixed,s=this.evaluator.evalExpression(this.value);parseFloat(s).toString()===s.toString()&&(s=q?parseFloat(s).toFixed(n):a.removeNeedlessDecimals(parseFloat(s).toFixed(n)),
s=(""+s).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(s,this.styleString);b.fillText(s,h+c,d);this.underline&&(q=(n="bold"==this.style.textBold)?1:0.5,b.lineWidth=n?2:1,null!=this.color&&(b.strokeStyle=this.color),b.beginPath(),b.moveTo(h+c-1,parseInt(d+this.descent/2)+q),b.lineTo(h+c-1+this.w,parseInt(d+this.descent/2)+q),b.stroke());this.overline&&(q=(n="bold"==this.style.textBold)?
2:1.5,b.lineWidth=n?2:1,null!=this.color&&(b.strokeStyle=this.color),b.beginPath(),b.moveTo(h+c-1,parseInt(d-this.ascent)+q),b.lineTo(h+c-1+this.w,parseInt(d-this.ascent)+q),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 d="bold"==this.style.textBold,e=d?1:0.5;a.lineWidth=d?2:1;a.beginPath();a.moveTo(b-1,Math.ceil(c+this.descent/2)+e-2);a.lineTo(b-1+this.w,Math.ceil(c+this.descent/2)+e-2);a.stroke();a.restore()};a.RTFNode.prototype.drawRadical=function(a,b,c){var d=
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*d+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+0.5*d,c+this.children[1].descent);a.lineTo(b+
this.children[0].w+1*d,c-this.children[1].ascent);a.lineTo(b+this.children[0].w+2*d+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 d=Math.floor(0.5*this.spaceWidth);a.lineWidth=1;null!=this.color&&(a.strokeStyle=this.color);a.beginPath();a.moveTo(b+d,parseInt(c-this.ascent+
this.children[0].h)-0.5);a.lineTo(b-d+this.w-1,parseInt(c-this.ascent+this.children[0].h)-0.5);a.stroke()};a.RTFNode.prototype.drawNumDen=function(a,b,c){for(var d=0,e=0,f=this.children.length;e<f;e++)0<e&&(d+=this.children[e-1].w),this.children[e].draw(a,b+d,c+this.baseline)};a.RTFNode.prototype.drawSubIndex=function(a,b,c){for(var d=0,e=0,f=this.children.length;e<f;e++)0<e&&(d+=this.children[e-1].w),this.children[e].draw(a,b+d,c+this.subIndexPos)};a.RTFNode.prototype.drawSuperIndex=function(a,b,
c){for(var d=0,e=0,f=this.children.length;e<f;e++)0<e&&(d+=this.children[e-1].w),this.children[e].draw(a,b+d,c-this.superIndexPos)};a.RTFNode.prototype.drawLimit=function(b,c,d){var e=a.getFontMetrics(this.styleString),f=" "+String.fromCharCode(8594),h=a.getTextWidth(f,this.styleString);this.children[0].draw(b,c,d+e.descent+this.children[0].ascent);this.children[1].draw(b,c+this.children[0].w+h,d+e.descent+this.children[1].ascent);this.children[2].draw(b,c+h+this.children[0].w+this.children[1].w,
d);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,d);b.fillText(f,c+this.children[0].w,d+e.descent+this.children[0].ascent)};a.RTFNode.prototype.drawIntegral=function(b,c,d){var e=this.style.clone();e.fontSize*=1.5;e.fontType="Times New Roman";e.Bold="bold";var e=e.toString(),f=a.getTextWidth(String.fromCharCode(8747),e),h=a.getFontMetrics(e),s=Math.max(this.children[0].w,this.children[1].w,
Math.floor(1.5*f));this.children[0].draw(b,c+f,d+h.descent+this.children[0].ascent);this.children[1].draw(b,c+f+this.spaceWidth/2,d-this.ascent+this.children[1].ascent);this.children[2].draw(b,c+s+f,d);null!=this.color&&(b.fillStyle=this.color);b.font=e;b.textAlign="start";b.textBaseline="alphabetic";b.fillText(String.fromCharCode(8747),c,d+h.descent/2)};a.RTFNode.prototype.drawSum=function(b,c,d){var e=this.style.clone();e.fontType="Times New Roman";e.Bold="bold";var e=e.toString(),f=a.getTextWidth(String.fromCharCode(8721),
e),h=a.getFontMetrics(this.styleString),s=Math.max(this.children[0].w,this.children[1].w,f);this.children[0].draw(b,c+(s-this.children[0].w)/2,d+h.descent+this.children[0].ascent);this.children[1].draw(b,c+(s-this.children[1].w)/2,d-h.ascent-this.children[1].descent);this.children[2].draw(b,c+s,d);null!=this.color&&(b.fillStyle=this.color);b.font=e;b.textAlign="start";b.textBaseline="alphabetic";b.fillText(String.fromCharCode(8721),c+Math.floor((s-f)/2),d-5)};a.RTFNode.prototype.drawMatrix=function(a,
b,c){for(var d,e,f=0,h=this.children.length;f<h;f++)d=f%this.columns,e=Math.floor(f/this.columns),this.children[f].draw(a,2*this.spaceWidth+b+d*this.childWidth,c-this.ascent+this.childAscent+e*this.childh);a.lineWidth=1;null!=this.color&&(a.strokeStyle=this.color);a.beginPath();a.moveTo(Math.floor(b+this.spaceWidth)+0.5,c-this.ascent+0.5);a.lineTo(Math.floor(b+this.spaceWidth/2)+0.5,c-this.ascent+0.5);a.lineTo(Math.floor(b+this.spaceWidth/2)+0.5,c+this.descent+0.5);a.lineTo(Math.floor(b+this.spaceWidth)+
0.5,c+this.descent+0.5);a.moveTo(Math.floor(b+this.w-this.spaceWidth)-0.5,c-this.ascent+0.5);a.lineTo(Math.floor(b+this.w-this.spaceWidth/2)-0.5,c-this.ascent+0.5);a.lineTo(Math.floor(b+this.w-this.spaceWidth/2)-0.5,c+this.descent+0.5);a.lineTo(Math.floor(b+this.w-this.spaceWidth)-0.5,c+this.descent+0.5);a.stroke()};a.RTFNode.prototype.drawDefparts=function(a,b,c){for(var d=0,e=this.children.length;d<e;d++)this.children[d].draw(a,b+3*this.spaceWidth,c-this.ascent+this.childAscent+d%this.parts*this.childh);
a.lineWidth=1;null!=this.color&&(a.strokeStyle=this.color);a.beginPath();a.moveTo(parseInt(b+2*this.spaceWidth)+0.5,c-this.ascent+0.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-0.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)+0.5,c+this.descent+
0.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 d=0,e=0,f=this.children.length;e<f;e++)0<e&&(d+=this.children[e-1].w),this.children[e].draw(a,b+d,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(){var a="";if("textLineBlock"===this.nodeType||"textBlock"===this.nodeType)for(var b=0,c=this.children.length;b<c;b++)a+=this.children[b].toHTML();else"text"===this.nodeType?a="<span "+this.style.toCSS()+">"+this.value+"</span>":"newLine"===this.nodeType&&
(a="<span "+this.style.toCSS()+">"+this.value+"<br /></span>");return a};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var e=String.fromCharCode,f,d,b,c,h,g,r,k,p,n,q;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[];f=[];d=a.length;f=[];b="";h=c=0;r=a.charAt(0);k=!1;for(p="text";c<d;)g=r,r=a.charAt(c+1),k?"\\"===r||"{"===r||"}"===r||" "===r||";"===r?(k=!1,b+=g," "===r&&(c++,r=a.charAt(c+1)),(n=b.match(/^\'([0-9a-f]{2})/))?(q="","text"===p&&(q=f.pop().value),b=q+=e(parseInt(n[1],16))+b.substring(3)):(n=b.match(/^u[0-9]+/))?(q="","text"===p&&(q=f.pop().value),b=q+=e(n[0].substring(1))):("{"===b||"}"===b?(f.push({type:"text",value:b}),p="text"):(f.push({type:"controlWord",value:b}),p="controlWord"),
b="")):b+=g:"\\"===g?(k=!0,""!==b&&(f.push({type:"text",value:b}),p="text"),b=""):"{"===g?(h++,""!==b&&f.push({type:"text",value:b}),b="",f.push({type:"openBlock",value:h}),p="openBlock"):"}"===g?(""!==b&&f.push({type:"text",value:b}),b="",f.push({type:"closeBlock",value:h}),p="closeBlock",h--):b+=g,c++;""!==b&&f.push({type:"text",value:b});return f};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var e,f,d,b,c,h,g,r,k,p,n,q,s,t,m,u,l,v,w,y,C,B,D,E,z,A,H,G,K,L;a.RTFParser=
function(b){this.evaluator=b;this.tokenizer=new a.RTFTokenizer};a.RTFParser.prototype.parse=function(x){x=e=this.tokenizer.tokenize(x);for(var J=[],F=!1,P=!1,M=[],I=0,R=x.length;I<R;I++)if("openBlock"==x[I].type&&M.push(x[I].value),"closeBlock"==x[I].type&&(M.pop(),0>=M.length&&(F=!1)),"controlWord"!=x[I].type||"expr"!=x[I].value&&"decimals"!=x[I].value||(P=!0),"controlWord"==x[I].type&&"mjaformula"==x[I].value&&(F=!0),"text"==x[I].type&&F&&!P){for(var S=0,O=x[I].value,Q="",N=0,V=O.length;N<V;N++)if("("==
O.charAt(N)||")"==O.charAt(N)||"+"==O.charAt(N)||"-"==O.charAt(N)||"*"==O.charAt(N)||"="==O.charAt(N))Q=O.substring(S,N),""!=Q&&J.push({type:"text",value:Q}),J.push({type:O.charAt(N),value:O.charAt(N)}),S=N+1;Q=O.substring(S,N);""!=Q&&J.push({type:"text",value:Q})}else J.push(x[I]),"text"==x[I].type&&P&&(P=!1);e=J;f={};b=2;if("openBlock"==e[0].type&&"fonttbl"==e[1].value){for(d=e[0].value;"closeBlock"!=e[b].type&&e[b].value!=d;)f[e[b].value]=e[b+2].value.substring(0,e[b+2].value.length-1),b+=3;b++}c=
{};h=0;if("openBlock"==e[b].type&&"colortbl"==e[b+1].value){d=e[b++].value;for(b++;"closeBlock"!=e[b].type&&e[b].value!=d;)g=parseInt(e[b++].value.substring(3)).toString(16),r=parseInt(e[b++].value.substring(5)).toString(16),k=parseInt(e[b++].value.substring(4)).toString(16),";"===e[b].value&&b++,c[h++]="#"+(2>g.length?"0"+g:g)+(2>r.length?"0"+r:r)+(2>k.length?"0"+k:k);b++}p=new a.RTFNode(this.evaluator,"","textBlock","",!1,"");n=new a.RTFNode(this.evaluator,"","textLineBlock","",!1,"");p.addChild(n);
t=s=q=null;y=w=v=l=u=m=!1;C=[new a.FontStyle(20,"Arial","","",!1,!1,null)];B=C[0];D=!0;z=E=-1;A=[];L=K=G=H=!1;x=b;for(J=e.length;x<J;x++)if("controlWord"==e[x].type&&f[e[x].value])B.fontType=f[e[x].value];else if("controlWord"==e[x].type&&e[x].value.match(/^fs(\d+)/))B.fontSize=parseInt(e[x].value.match(/^fs(\d+)/)[1]/2);else if("controlWord"==e[x].type&&"b"==e[x].value)B.textBold="bold";else if("controlWord"==e[x].type&&"b0"==e[x].value)B.textBold="";else if("controlWord"==e[x].type&&"i"==e[x].value)B.textItalic=
"italic";else if("controlWord"==e[x].type&&"i0"==e[x].value)B.textItalic="";else if("controlWord"==e[x].type&&"ul"==e[x].value)B.textUnderline=!0;else if("controlWord"==e[x].type&&"ulnone"==e[x].value)B.textUnderline=!1;else if("controlWord"==e[x].type&&"ol"==e[x].value)B.textOverline=!0;else if("controlWord"==e[x].type&&"olnone"==e[x].value)B.textOverline=!1;else if("controlWord"==e[x].type&&e[x].value.match(/^cf(\d+)/))B.textColor=c[parseInt(e[x].value.substring(2))],0<A.length&&(A[A.length-1].style.textColor=
B.textColor);else if("openBlock"==e[x].type)E=e[x].value,B=B.clone(),C.push(B),A.push(null);else if("closeBlock"==e[x].type)e[x].value==z&&(z=-1,m=!1,n=n.parent),C.pop(),B=C[C.length-1],A.pop();else if("controlWord"==e[x].type&&"par"==e[x].value){n.addChild(new a.RTFNode(this.evaluator,"","newLine",B.clone()));p=new a.RTFNode(this.evaluator,"","textLineBlock",B.clone());if("textBlock"!=n.nodeType)for(n=n.parent;"textBlock"!=n.nodeType;)n=n.parent;n.addChild(p);n=p}else if("controlWord"==e[x].type&&
"mjaformula"==e[x].value)H=!0,z=E,m=!0,p=new a.RTFNode(this.evaluator,"","formula",B.clone()),n.addChild(p),n=p,A[A.length-1]=p;else if("controlWord"==e[x].type&&("fraction"==e[x].value||"radicand"==e[x].value||"radical"==e[x].value||"what"==e[x].value||"sum"==e[x].value||"integral"==e[x].value||"limit"==e[x].value))F=A[A.length-2].style.clone(),p=new a.RTFNode(this.evaluator,"",e[x].value,F),A[A.length-2].addChild(p),A[A.length-1]=p;else if("controlWord"==e[x].type&&"index"==e[x].value||"to"==e[x].value||
"from"==e[x].value)F=A[A.length-2].style.clone(),F.fontSize=parseInt(F.fontSize-0.2*F.fontSize),8>F.fontSize&&(F.fontSize=8),p=new a.RTFNode(this.evaluator,"",e[x].value,F),A[A.length-2].addChild(p),A[A.length-1]=p;else if("controlWord"==e[x].type&&("num"==e[x].value||"den"==e[x].value))F=A[A.length-2].style.clone(),F.fontSize=Math.round(F.fontSize-0.1*F.fontSize),8>F.fontSize&&(F.fontSize=8),"num"==e[x].value?p=new a.RTFNode(this.evaluator,"","numerator",F):"den"==e[x].value&&(p=new a.RTFNode(this.evaluator,
"","denominator",F)),A[A.length-2].addChild(p),A[A.length-1]=p;else if("controlWord"==e[x].type&&("subix"==e[x].value||"supix"==e[x].value))F=A[A.length-2].style.clone(),F.fontSize=Math.floor(F.fontSize-F.fontSize/3),8>F.fontSize&&(F.fontSize=8),"subix"==e[x].value?p=new a.RTFNode(this.evaluator,"","subIndex",F):"supix"==e[x].value&&(p=new a.RTFNode(this.evaluator,"","superIndex",F)),p.originalStyle=A[A.length-2].style.clone(),A[A.length-2].addChild(p),A[A.length-1]=p;else if("controlWord"==e[x].type&&
("defparts"==e[x].value||"matrix"==e[x].value||"element"==e[x].value))F=A[A.length-2].style.clone(),p=new a.RTFNode(this.evaluator,"",e[x].value,F),A[A.length-2].addChild(p),A[A.length-1]=p,"defparts"==e[x].value?t=p:"matrix"==e[x].value&&(s=p);else if("controlWord"==e[x].type&&"parts"==e[x].value)y=!0;else if("text"==e[x].type&&y)t.parts=parseInt(e[x].value),y=!1;else if("controlWord"==e[x].type&&"rows"==e[x].value)v=!0;else if("text"==e[x].type&&v)s.rows=parseInt(e[x].value),v=!1;else if("controlWord"==
e[x].type&&"columns"==e[x].value)w=!0;else if("text"==e[x].type&&w)s.columns=parseInt(e[x].value),w=!1;else if("controlWord"==e[x].type&&"expr"==e[x].value)D=!1,u=!0;else if("controlWord"==e[x].type&&"decimals"==e[x].value)l=!0;else if("text"==e[x].type&&l)q.decimals=this.evaluator.parser.parse(e[x].value+""),l=!1;else if("controlWord"==e[x].type&&"fixed1"==e[x].value)q.fixed=!0;else if("controlWord"==e[x].type&&"fixed0"==e[x].value)q.fixed=!1;else if("controlWord"!=e[x].type||"component"!=e[x].value)if("controlWord"==
e[x].type&&"NumCtrl"==e[x].value)G=!0;else if("controlWord"==e[x].type&&"Space"==e[x].value)K=!0;else if("controlWord"==e[x].type&&"hyperlink"==e[x].value)L=!0;else if("text"==e[x].type&&L){textContent=e[x].value.split("|")[0];F=B.clone();p=new a.RTFNode(this.evaluator,textContent,"hyperlink",F);p.URL=e[x].value.split("|")[1];if("textLineBlock"!=n.nodeType)for(n=n.parent;"textLineBlock"!=n.nodeType;)n=n.parent;n.addChild(p);L=!1}else if("text"==e[x].type&&G)p=new a.RTFNode(this.evaluator,e[x].value,
"componentNumCtrl",B.clone()),n.addChild(p),G=!1;else if("text"==e[x].type&&K)p=new a.RTFNode(this.evaluator,e[x].value,"componentSpace",B.clone()),n.addChild(p),K=!1;else if("text"==e[x].type&&u)F=A[A.length-2].style.clone(),textContent=this.evaluator.parser.parse(e[x].value),p=new a.RTFNode(this.evaluator,textContent,"dynamicText",F),A[A.length-2].addChild(p),q=A[A.length-1]=p,u=!1;else if("text"==e[x].type&&!u&&!m){textContent=e[x].value;p=new a.RTFNode(this.evaluator,textContent,"text",B.clone());
if("textLineBlock"!=n.nodeType)for(n=n.parent;"textLineBlock"!=n.nodeType;)n=n.parent;n.addChild(p)}else if("text"==e[x].type&&!u&&m)textContent=e[x].value,p=new a.RTFNode(this.evaluator,textContent,"text",A[A.length-1].style.clone()),A[A.length-1].addChild(p);else if("("==e[x].type||")"==e[x].type)F=A[A.length-1].style.clone(),F.textItalic="",p=new a.RTFNode(this.evaluator,e[x].type,"mathSymbol",F),A[A.length-1].addChild(p);else if("+"==e[x].type||"-"==e[x].type||"*"==e[x].type||"="==e[x].type)p=
new a.RTFNode(this.evaluator,e[x].type,"mathSymbol",A[A.length-1].style.clone()),A[A.length-1].addChild(p);if(null!=n){var U=n.getRoot();U.stableWidth=D;U.getTextMetrics();U.hasFormula=H}return U};a.FontStyle=function(a,b,c,d,e,g,f){this.fontSize=a;this.fontType=b;this.textItalic=c;this.textBold=d;this.textUnderline=e;this.textOverline=g;this.textColor=f};a.FontStyle.prototype.toString=function(){return(this.textBold+" "+this.textItalic+" "+this.fontSize+"px "+this.fontType).trim()};a.FontStyle.prototype.toCSS=
function(){var a="style='font: "+this.fontSize+"px "+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 e,f,d,b,c,h,g,r,k,p,n,q,s,t;a.Space=function(b,c){this.parent=
b;f=this.evaluator=this.parent.evaluator;d=f.parser;this.id="";this.values=c;this.type="R2";this.xExpr=d.parse("0");this.yExpr=d.parse("0");this.w=parseInt(b.container.width);this.h=parseInt(b.container.height);this.drawif=d.parse("1");this.fixed=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 c)c.hasOwnProperty(e)&&(this[e]=c[e]);this.init()};a.Space.prototype.init=function(){e=this.parent;f=this.evaluator;b=this.id;this.displaceRegionNorth=e.displaceRegionNorth||0;this.displaceRegionWest=e.displaceRegionWest||0;void 0!=this.wExpr&&(this.w=(parseInt(e.container.width)-this.displaceRegionWest)*parseFloat(this.wExpr)/100);void 0!=this.hExpr&&(this.h=(parseInt(e.container.height)-this.displaceRegionNorth)*
parseFloat(this.hExpr)/100);g=parseInt(e.container.height);r=parseInt(e.container.width);this.x=f.evalExpression(this.xExpr)+this.displaceRegionWest;this.y=f.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?(c=g-this.y,this.h>c&&(this.h=c)):(c=this.h+this.y,this.h=c>=g?g:c);0<=this.x?(h=r-this.x,this.w>h&&(this.w=h)):(h=this.w+this.x,this.w=h>=r?r:h);""==this.imageSrc&&this.imageSrc.trim().toLowerCase().match(/vacio.gif$/)||
(this.image=e.getImage(this.imageSrc));this.OxExpr&&(p=this.OxExpr,"%"===p[p.length-1]?this.Ox=this.w*parseFloat(p)/100:(k=parseFloat(p),k!=p&&(k=0),this.Ox=k));this.OyExpr&&(n=this.OyExpr,"%"===n[n.length-1]?this.Oy=this.h*parseFloat(n)/100:(k=parseFloat(n),k!=n&&(k=0),this.Oy=k));""!==this.id&&2!==e.version?(f.setVariable(b+"._w",this.w),f.setVariable(b+"._h",this.h),f.setVariable(b+".escala",this.scale),f.setVariable(b+".Ox",this.Ox),f.setVariable(b+".Oy",this.Oy),f.setVariable(b+".mouse_x",0),
f.setVariable(b+".mouse_y",0),f.setVariable(b+".mouse_pressed",0),f.setVariable(b+".mouse_clicked",0),f.setVariable(b+".clic_izquierdo",0)):(k=f.getVariable("_w"),void 0===k&&(k=this.w),f.setVariable("_w",k),k=f.getVariable("_h"),void 0===k&&(k=this.h),f.setVariable("_h",k),k=f.getVariable("escala"),void 0===k&&(k=this.scale),f.setVariable("escala",k),k=f.getVariable("Ox"),void 0===k&&(k=this.Ox),f.setVariable("Ox",k),k=f.getVariable("Oy"),void 0===k&&(k=this.Oy),f.setVariable("Oy",k),f.setVariable("mouse_x",
0),f.setVariable("mouse_y",0),f.setVariable("mouse_pressed",0),f.setVariable("mouse_clicked",0),f.setVariable("clic_izquierdo",0),""===this.x_axis&&""===this.y_axis&&2==e.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(){q=this.container;this.offsetTop=this.offsetLeft=0;this.container&&this.container.style&&(s=this.container.style.display);this.container.style.display="block";if(q.getBoundingClientRect){var a=q.getBoundingClientRect();this.offsetLeft=a.left;this.offsetTop=a.top}else for(;q;)q.tagName&&"html"!==q.tagName.toLowerCase()?(this.offsetLeft+=q.offsetLeft||0,this.offsetTop+=q.offsetTop||0,q=q.parentNode):q=null;this.container&&this.container.style&&(this.container.style.display=s)};a.Space.prototype.getCursorPosition=
function(b){t=a.getCursorPosition(b);return{x:t.x-this.offsetLeft,y:t.y-this.offsetTop}};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var e;a.SpaceExternal=function(a){e=this;e.parent=a;e.width=228;e.vSpace=25;e.container=document.createElement("div");e.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: "+
(e.width+27)+"px; height: 460px; background-color: #63b4fb");e.moveManipulator=document.createElement("div");e.moveManipulator.setAttribute("style"," position: absolute; left: 0px; top: 0px; width: "+(e.width+27)+"px; height: "+e.vSpace+"px; line-height: "+e.vSpace+"px; background-color: ddd; cursor: move; padding-left: 75px; font-family: Sans-Serif; font-size: 18px;");e.moveManipulator.innerHTML="Descartes";e.container.appendChild(e.moveManipulator);e.ctrs=[]};a.SpaceExternal.prototype.init=function(){function e(c){b.newPosition=
a.getCursorPosition(c);b.container.style.left=b.initialPosition.x+(b.newPosition.x-b.oldPosition.x)+"px";b.container.style.top=b.initialPosition.y+(b.newPosition.y-b.oldPosition.y)+"px"}function d(a){a.preventDefault();b.findOffset();document.body.removeEventListener("mousemove",e);document.body.removeEventListener("mouseup",d)}document.body.appendChild(this.container);var b=this,c=b.parent.evaluator.parser,h;h=0;for(var g=b.ctrs.length;h<g;h++)b.ctrs[h].expresion=c.parse("(0,"+(b.vSpace+23+35*h)+
","+b.width+",35)"),b.ctrs[h].update();b.numCtr=g;h="espa\u00f1ol"==b.language?"cr\u00e9ditos":"english"==b.language?"about":"cr\u00e9ditos";h=new a.Button(b.parent,{region:"external",name:h,font_size:c.parse("15"),expresion:c.parse("(0,"+b.vSpace+","+b.width/2+",25)")});h.actionExec={execute:a.showAbout};h.update();(new a.Button(b.parent,{region:"external",name:"config",font_size:c.parse("15"),action:"config",expresion:c.parse("("+b.width/2+","+b.vSpace+","+b.width/2+",25)")})).update();h="espa\u00f1ol"==
b.language?"inicio":"english"==b.language?"init":"inicio";(new a.Button(b.parent,{region:"external",name:h,font_size:c.parse("15"),action:"init",expresion:c.parse("(0,"+(b.vSpace+23+35*g)+","+b.width/2+",25)")})).update();h="espa\u00f1ol"==b.language?"limpiar":"english"==b.language?"clear":"limpiar";(new a.Button(b.parent,{region:"external",name:h,font_size:c.parse("15"),action:"clear",expresion:c.parse("("+b.width/2+","+(b.vSpace+23+35*g)+","+b.width/2+",25)")})).update();h="espa\u00f1ol"==b.language?
"cerrar":"close";c=new a.Button(b.parent,{region:"external",name:h,font_size:c.parse("15"),expresion:c.parse("("+b.width/4+","+(b.vSpace+46+35*g)+","+b.width/2+",25)")});c.update();c.canvas.addEventListener("click",function(a){b.hide()});b.setPositionAndSize();b.moveManipulator.addEventListener("mousedown",function(c){c.preventDefault();b.oldPosition=a.getCursorPosition(c);b.initialPosition={x:b.container.offsetLeft,y:b.container.offsetTop};document.body.addEventListener("mousemove",e);document.body.addEventListener("mouseup",
d)});b.findOffset();b.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,d=this.ctrs.length;a<d;a++)this.ctrs[a].findOffset&&this.ctrs[a].findOffset()};return a}(descartesJS||{}),descartesJS=function(a){var e,f;if(a.loadLib)return a;var d=Math.floor,b=Math.round,c=2*Math.PI,h=a.convertFont("SansSerif,PLAIN,12"),
g=a.convertFont("Monospaced,PLAIN,12"),r=10,k,p,n,q,s,t,m,u,l,v,w,y,C,B,D,E,z,A,H,G,K,L,x,J,F,P,M,I,R;a.Space2D=function(b,c){a.Space.call(this,b,c);k=this;k.backgroundCanvas=document.createElement("canvas");k.backgroundCanvas.setAttribute("id",k.id+"_background");k.backgroundCanvas.setAttribute("width",k.w+"px");k.backgroundCanvas.setAttribute("height",k.h+"px");k.backgroundCtx=k.backgroundCanvas.getContext("2d");k.backgroundCtx.imageSmoothingEnabled=!1;k.backgroundCtx.mozImageSmoothingEnabled=!1;
k.backgroundCtx.webkitImageSmoothingEnabled=!1;k.canvas=document.createElement("canvas");k.canvas.setAttribute("id",k.id+"_canvas");k.canvas.setAttribute("width",k.w+"px");k.canvas.setAttribute("height",k.h+"px");k.canvas.setAttribute("class","DescartesSpace2DCanvas");k.canvas.setAttribute("style","z-index: "+k.zIndex+";");k.ctx=k.canvas.getContext("2d");k.ctx.imageSmoothingEnabled=!1;k.ctx.mozImageSmoothingEnabled=!1;k.ctx.webkitImageSmoothingEnabled=!1;k.graphicControlContainer=document.createElement("div");
k.graphicControlContainer.setAttribute("id",k.id+"_graphicControls");k.graphicControlContainer.setAttribute("style","position: absolute; left: 0px; top: 0px; z-index: "+k.zIndex+";");k.numericalControlContainer=document.createElement("div");k.numericalControlContainer.setAttribute("id",k.id+"_numericalControls");k.numericalControlContainer.setAttribute("style","position: absolute; left: 0px; top: 0px; z-index: "+k.zIndex+";");k.container=document.createElement("div");k.container.setAttribute("id",
k.id);k.container.setAttribute("class","DescartesSpace2DContainer");k.container.setAttribute("style","left: "+k.x+"px; top: "+k.y+"px; z-index: "+k.zIndex+";");k.parent.arquimedes&&"#f0f8fa"===k.background.getColor()&&(k.container.style.border="1px solid #b8c4c8");k.container.appendChild(k.backgroundCanvas);k.container.appendChild(k.canvas);k.container.appendChild(k.graphicControlContainer);k.container.appendChild(k.numericalControlContainer);b.container.insertBefore(k.container,b.loader);k.parent.images[k.id+
".image"]=k.canvas;k.parent.images[k.id+".image"].ready=1;k.parent.images[k.id+".image"].complete=!0;k.evaluator.setVariable(k.id+".image",k.id+".image");k.parent.images[k.id+".back"]=k.backgroundCanvas;k.parent.images[k.id+".back"].ready=1;k.parent.images[k.id+".back"].complete=!0;k.evaluator.setVariable(k.id+".back",k.id+".back");""!==k.id&&2!==b.version?(k.OxString=k.id+".Ox",k.OyString=k.id+".Oy",k.scaleString=k.id+".escala",k.wString=k.id+"._w",k.hString=k.id+"._h",k.mxString=k.id+".mouse_x",
k.myString=k.id+".mouse_y",k.mpressedString=k.id+".mouse_pressed",k.mclickedString=k.id+".mouse_clicked",k.mclicizquierdoString=k.id+".clic_izquierdo"):(k.OxString="Ox",k.OyString="Oy",k.scaleString="escala",k.wString="_w",k.hString="_h",k.mxString="mouse_x",k.myString="mouse_y",k.mpressedString="mouse_pressed",k.mclickedString="mouse_clicked",k.mclicizquierdoString="clic_izquierdo");k.click=0;k.registerMouseAndTouchEvents()};a.extend(a.Space2D,a.Space);a.Space2D.prototype.init=function(){k=this;
k.uber.init.call(k);k.canvas&&(k.backgroundCanvas.setAttribute("width",k.w+"px"),k.backgroundCanvas.setAttribute("height",k.h+"px"),k.canvas.setAttribute("width",k.w+"px"),k.canvas.setAttribute("height",k.h+"px"));k.container&&k.findOffset()};a.Space2D.prototype.update=function(a){k=this;p=k.evaluator;n=k.parent;p.setVariable(k.wString,k.w);p.setVariable(k.hString,k.h);k.drawIfValue=0<p.evalExpression(k.drawif);if(k.drawIfValue){s=k.x!==p.evalExpression(k.xExpr)+k.displaceRegionWest;t=k.y!==p.evalExpression(k.yExpr)+
n.plecaHeight+k.displaceRegionNorth;k.spaceChange=a||s||t||k.drawBefore!==k.drawIfValue||k.Ox!==p.getVariable(k.OxString)||k.Oy!==p.getVariable(k.OyString)||k.scale!==p.getVariable(k.scaleString);k.x=s?p.evalExpression(k.xExpr)+k.displaceRegionWest:k.x;k.y=t?p.evalExpression(k.yExpr)+n.plecaHeight+k.displaceRegionNorth:k.y;k.Ox=p.getVariable(k.OxString);k.Oy=p.getVariable(k.OyString);k.scale=p.getVariable(k.scaleString);k.drawBefore=k.drawIfValue;1E-6>k.scale?(k.scale=1E-6,p.setVariable(k.scaleString,
1E-6)):1E6<k.scale&&(k.scale=1E6,p.setVariable(k.scaleString,1E6));if(s||t)k.container.style.left=k.x+"px",k.container.style.top=k.y+"px",k.findOffset();k.container.style.display="block";k.drawTrace=!k.spaceChange&&(!k.fixed&&!k.click||k.fixed);k.spaceChange&&k.drawBackground();k.draw()}else k.container.style.display="none"};a.Space2D.prototype.drawBackground=function(){p=this.evaluator;q=this.backgroundCtx;q.clearRect(0,0,this.backgroundCanvas.width,this.backgroundCanvas.height);q.fillStyle=this.background.getColor();
q.fillRect(0,0,this.backgroundCanvas.width,this.backgroundCanvas.height);this.image&&""!=this.image.src&&this.image.ready&&this.image.complete&&("topleft"===this.bg_display?q.drawImage(this.image,0,0):"stretch"===this.bg_display?q.drawImage(this.image,0,0,this.w,this.h):"patch"===this.bg_display?(q.fillStyle=q.createPattern(this.image,"repeat"),q.fillRect(0,0,this.canvas.width,this.canvas.height)):"imgcenter"===this.bg_display&&q.drawImage(this.image,(this.w-this.image.width)/2,(this.h-this.image.height)/
2));u=this.scale;l=0;for(v=0>this.w+this.h?0:this.w+this.h;u>v;)u/=10,l++;for(;u<v/10;)u*=10;q.lineWidth=1;""!==this.net&&(q.strokeStyle=this.net.getColor(),this.drawMarks(q,u/10,-1));if(2!==this.parent.version&&""!==this.net10||2===this.parent.version&&""!==this.net&&""!==this.net10)q.strokeStyle=this.net10.getColor(),this.drawMarks(q,u,-1);if(""!==this.axes){q.strokeStyle=this.axes.getColor();q.beginPath();if(""!==this.x_axis||2!==this.parent.version)q.moveTo(0,d(this.h/2+this.Oy)+0.5),q.lineTo(this.w,
d(this.h/2+this.Oy)+0.5);if(""!==this.y_axis||2!==this.parent.version)q.moveTo(d(this.w/2+this.Ox)+0.5,0),q.lineTo(d(this.w/2+this.Ox)+0.5,this.h);q.stroke();this.drawMarks(q,u,4);this.drawMarks(q,u/2,2);this.drawMarks(q,u/10,1)}if(""!==this.x_axis||""!==this.y_axis)q.fillStyle=""!==this.axes?this.axes.getColor():"black",q.font=h,q.textAlign="right",q.textBaseline="alphabetic",q.fillText(this.x_axis,d(this.w)-2,d(this.h/2+this.Oy)+12),q.fillText(this.y_axis,d(this.w/2+this.Ox)-2,12);this.numbers&&
""!=this.axes&&(q.fillStyle=this.axes.getColor(),q.font=h,q.textAlign="start",q.textBaseline="bottom",u>(this.w+this.h)/2?this.drawNumbers(q,u/5,u<=this.scale?l+1:l):u>(this.w+this.h)/4?this.drawNumbers(q,u/2,u<=this.scale?l+1:l):this.drawNumbers(q,u,l));for(var a=0,b=this.backgroundGraphics.length;a<b;a++)this.backgroundGraphics[a].draw()};a.Space2D.prototype.draw=function(){q=this.ctx;q.clearRect(0,0,this.canvas.width,this.canvas.height);for(var a=0,b=this.graphics.length;a<b;a++)m=this.graphics[a],
""!==m.trace&&this.drawTrace&&m.drawTrace(),m.draw();a=0;for(b=this.graphicsCtr.length;a<b;a++)this.graphicsCtr[a].draw();""!=this.text&&this.click&&"L"===this.whichButton&&(q.fillStyle=this.text.getColor(),q.strokeStyle=q.fillStyle,q.lineWidth=1,q.font=g,q.textAlign="center",q.textBaseline="alphabetic",K=1>=this.scale?this.mouse_x.toFixed(0):this.mouse_x.toFixed(this.scale.toString().length),L=1>=this.scale?this.mouse_y.toFixed(0):this.mouse_y.toFixed(this.scale.toString().length),x="("+K+","+L+
")",J=d(q.measureText(x).width/2),F=this.getAbsoluteX(this.mouse_x),P=this.getAbsoluteY(this.mouse_y),M=d(F),I=d(P-10),M+J>this.w?M=this.w-J:0>M-J&&(M=J),I+1>this.h?I=this.h:0>I-14&&(I=15),q.fillText(x,M,I),q.beginPath(),q.arc(F,P,2.5,0,c,!0),q.stroke())};a.Space2D.prototype.drawMarks=function(a,c,e){w=this.w;y=this.h;z=0;A=w;H=0;G=y;D=d(w/2+this.Ox);E=d(y/2+this.Oy);0<=e&&(z=D-e,A=D+e,H=E-e,G=E+e);a.beginPath();for(e=-b(D/c);(C=D+b(e*c))<w;e++)a.moveTo(C+0.5,H+0.5),a.lineTo(C+0.5,G+0.5);for(e=-b(E/
c);(B=E+b(e*c))<y;e++)a.moveTo(z+0.5,B+0.5),a.lineTo(A+0.5,B+0.5);a.stroke()};a.Space2D.prototype.drawNumbers=function(a,c,e){w=this.w;y=this.h;D=d(w/2+this.Ox);E=d(y/2+this.Oy);for(e=-b(D/c);(C=D+b(e*c))<w;e++)a.fillText(parseFloat((e*c/this.scale).toFixed(4)),C+1,E-2);for(e=-b(E/c);(B=E+b(e*c))<y;e++)0!==parseFloat(-e*c/this.scale)&&a.fillText(parseFloat((-e*c/this.scale).toFixed(4)),D+5,B+5)};a.Space2D.prototype.registerMouseAndTouchEvents=function(){function b(a){document.body.focus();l.parent.clearClick();
l.click=1;l.evaluator.setVariable(l.mpressedString,1);l.evaluator.setVariable(l.mclickedString,0);l.evaluator.setVariable(l.mclicizquierdoString,0);l.parent.deactivateGraphiControls();k(a);window.addEventListener("touchmove",p);window.addEventListener("touchend",c);a.stopPropagation();a.preventDefault()}function c(a){document.body.focus();l.click=0;l.evaluator.setVariable(l.mpressedString,0);l.evaluator.setVariable(l.mclickedString,1);l.evaluator.setVariable(l.mclicizquierdoString,1);window.removeEventListener("touchmove",
p);window.removeEventListener("touchend",c);a.preventDefault();l.parent.update()}function g(b){document.body.focus();b.stopPropagation();b.preventDefault();l.parent.clearClick();l.click=1;l.parent.deactivateGraphiControls();l.whichButton=a.whichButton(b);"R"===l.whichButton?(window.addEventListener("mouseup",h),l.clickPosForZoom=l.getCursorPosition(b).y,l.clickPosForZoomNew=l.clickPosForZoom,l.fixed||(l.tempScale=l.scale,window.addEventListener("mousemove",m))):"L"===l.whichButton&&(l.evaluator.setVariable(l.mpressedString,
1),l.evaluator.setVariable(l.mclickedString,0),l.evaluator.setVariable(l.mclicizquierdoString,0),k(b),window.addEventListener("mousemove",p),window.addEventListener("mouseup",h))}function h(a){document.body.focus();a.stopPropagation();a.preventDefault();l.click=0;l.evaluator.setVariable(l.mpressedString,0);l.evaluator.setVariable(l.mclickedString,1);l.evaluator.setVariable(l.mclicizquierdoString,1);"R"===l.whichButton&&(window.removeEventListener("mousemove",m),l.clickPosForZoom==l.clickPosForZoomNew&&
l.parent.externalSpace.show());window.removeEventListener("mousemove",p);window.removeEventListener("mouseup",h);l.parent.update()}function k(a){Date.now()-n>r&&(l.posAnte=l.getCursorPosition(a),l.mouse_x=l.getRelativeX(l.posAnte.x),l.mouse_y=l.getRelativeY(l.posAnte.y),l.evaluator.setVariable(l.mxString,l.mouse_x),l.evaluator.setVariable(l.myString,l.mouse_y),l.evaluator.setVariable(l.mclickedString,0),l.evaluator.setVariable(l.mclicizquierdoString,0),l.parent.update(),n=Date.now())}function m(a){a.preventDefault();
l.clickPosForZoomNew=l.getCursorPosition(a).y;l.evaluator.setVariable(l.scaleString,l.tempScale+l.tempScale/45*((l.clickPosForZoom-l.clickPosForZoomNew)/10));l.parent.update()}function p(a){a.preventDefault();a.stopPropagation();!l.fixed&&Date.now()-n>r&&(l.posNext=l.getCursorPosition(a),e=d(l.posAnte.x-l.posNext.x),f=d(l.posAnte.y-l.posNext.y),l.evaluator.setVariable(l.OxString,l.Ox-e),l.evaluator.setVariable(l.OyString,l.Oy-f),l.posAnte.x-=e,l.posAnte.y-=f);k(a)}var n=0,l=this;R=a.hasTouchSupport;
l.clickPosForZoom=null;l.clickPosForZoomNew=null;l.canvas.oncontextmenu=function(a){return!1};R&&(this.sensitive_to_mouse_movements&&this.canvas.addEventListener("touchmove",k),this.canvas.addEventListener("touchstart",b));R||(this.sensitive_to_mouse_movements&&this.canvas.addEventListener("mousemove",k),this.canvas.addEventListener("mousedown",g))};return a}(descartesJS||{}),descartesJS=function(a){var e,f,d;function b(a,b){return b.depth-a.depth}function c(b,c){Z=a.subtract3D(b,a.scalarProduct3D(c,
a.dotProduct3D(b,c)));W=a.add3D(b,a.scalarProduct3D(Z,-2));X=a.norm3D(W);return 0!==X?a.scalarProduct3D(W,1/X):a.scalarProduct3D(b,-1)}if(a.loadLib)return a;var h=Math.floor,g=Math.round,r=Math.max,k=Math.cos,p=Math.sin,n=Math.sqrt,q=15*Math.PI/180,s=Math.cos(q),t=Math.sin(q),m,u,l,v,w,y,C,B,D,E,z,A,H,G,K,L,x,J,F,P,M,I,R,S=[],O,Q,N,V,U,Y,Z,W,X;a.Space3D=function(b,c){a.Space.call(this,b,c);l=this;l.backgroundCanvas=document.createElement("canvas");l.backgroundCanvas.setAttribute("id",l.id+"_background");
l.backgroundCanvas.setAttribute("width",l.w+"px");l.backgroundCanvas.setAttribute("height",l.h+"px");l.canvas=document.createElement("canvas");l.canvas.setAttribute("id",l.id+"_canvas");l.canvas.setAttribute("width",l.w+"px");l.canvas.setAttribute("height",l.h+"px");l.canvas.setAttribute("class","DescartesSpace3DCanvas");l.canvas.setAttribute("style","z-index: "+l.zIndex+";");l.ctx=l.canvas.getContext("2d");l.ctx.imageSmoothingEnabled=!1;l.ctx.mozImageSmoothingEnabled=!1;l.ctx.webkitImageSmoothingEnabled=
!1;l.graphicControlContainer=document.createElement("div");l.graphicControlContainer.setAttribute("id",l.id+"_graphicControls");l.graphicControlContainer.setAttribute("style","position: absolute; left: 0px; top: 0px; z-index: "+l.zIndex+";");l.numericalControlContainer=document.createElement("div");l.numericalControlContainer.setAttribute("id",l.id+"_numericalControls");l.numericalControlContainer.setAttribute("style","position: absolute; left: 0px; top: 0px; z-index: "+l.zIndex+";");l.container=
document.createElement("div");l.container.setAttribute("id",l.id);l.container.setAttribute("class","DescartesSpace3DContainer");l.container.setAttribute("style","left: "+l.x+"px; top: "+l.y+"px; z-index: "+l.zIndex+";");l.container.appendChild(l.backgroundCanvas);l.container.appendChild(l.canvas);l.container.appendChild(l.graphicControlContainer);l.container.appendChild(l.numericalControlContainer);b.container.insertBefore(l.container,b.loader);l.eye={x:0,y:0,z:0};l.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=l.lights.length;d<e;d++)l.lights[d]=a.normalize3D(l.lights[d]);l.light3={x:0,y:0,z:0};l.intensity=[0.4,0.5,0.3,0];l.userIntensity=0;l.dim=1;l.tmpIntensity=[];l.OxStr=l.id+".Ox";l.OyStr=l.id+".Oy";l.scaleStr=l.id+".escala";l.wStr=l.id+"._w";l.hStr=l.id+"._h";l.obsStr=l.id+".observador";l.rotZStr=l.id+".rot.z";l.rotYStr=l.id+".rot.y";l.userI_Dim_Str=l.id+".userIlum.dim";l.userI_I_Str=l.id+".userIlum.I";l.userI_x_Str=l.id+".userIlum.x";l.userI_y_Str=
l.id+".userIlum.y";l.userI_z_Str=l.id+".userIlum.z";l.evaluator.setVariable(l.rotZStr,0);l.evaluator.setVariable(l.rotYStr,0);l.evaluator.setVariable(l.userI_Dim_Str,l.dim);l.evaluator.setVariable(l.userI_I_Str,l.userIntensity);l.evaluator.setVariable(l.userI_x_Str,0);l.evaluator.setVariable(l.userI_y_Str,0);l.evaluator.setVariable(l.userI_z_Str,0);l.registerMouseAndTouchEvents()};a.extend(a.Space3D,a.Space);a.Space3D.prototype.init=function(a){l=this;l.uber.init.call(l);l.canvas&&(l.canvas.setAttribute("width",
l.w+"px"),l.canvas.setAttribute("height",l.h+"px"));l.container&&l.findOffset();l.w_2=l.w/2;l.h_2=l.h/2;l.oldMouse={x:0,y:0}};a.Space3D.prototype.update=function(a){l=this;m=l.evaluator;u=l.parent;m.setVariable(l.wStr,l.w);m.setVariable(l.hStr,l.h);l.drawIfValue=0<m.evalExpression(l.drawif);if(l.drawIfValue){D=l.x!==m.evalExpression(l.xExpr)+l.displaceRegionWest;E=l.y!==m.evalExpression(l.yExpr)+u.plecaHeight+l.displaceRegionNorth;l.spaceChange=a||D||E||l.drawBefore!==l.drawIfValue||l.Ox!==m.getVariable(l.OxStr)||
l.Oy!==m.getVariable(l.OyStr)||l.scale!==m.getVariable(l.scaleStr);l.x=D?m.evalExpression(l.xExpr)+l.displaceRegionWest:l.x;l.y=E?m.evalExpression(l.yExpr)+u.plecaHeight+l.displaceRegionNorth:l.y;l.Ox=m.getVariable(l.OxStr);l.Oy=m.getVariable(l.OyStr);l.scale=m.getVariable(l.scaleStr);l.drawBefore=l.drawIfValue;if(a||void 0==l.observer){var b;a=0;for(var c=l.parent.controls.length;a<c;a++)l.parent.controls[a].id===l.obsStr&&(b=!0);l.observer=b?m.getVariable(l.obsStr)||0.5*(l.w+l.h):2.5*(l.w+l.h);
l.observer=r(l.observer,0.1*(l.w+l.h));m.setVariable(l.obsStr,l.observer);l.eye={x:l.observer/l.scale*s,y:0,z:l.observer/l.scale*t};l.D=l.scale*l.eye.x/s;l.XE=g(l.scale*l.eye.y+0.5);l.YE=g(l.scale*l.eye.z+0.5)}l.observer=r(m.getVariable(l.obsStr),0.1*(l.w+l.h));m.setVariable(l.obsStr,l.observer);1E-6>l.scale?(l.scale=1E-6,m.setVariable(l.scaleStr,1E-6)):1E6<l.scale&&(l.scale=1E6,m.setVariable(l.scaleStr,1E6));if(D||E)l.container.style.left=l.x+"px",l.container.style.top=l.y+"px",l.findOffset();l.container.style.display=
"block";l.dim=m.getVariable(l.userI_Dim_Str);l.userIntensity=m.getVariable(l.userI_I_Str);l.light3={x:parseInt(m.getVariable(l.userI_x_Str)),y:parseInt(m.getVariable(l.userI_y_Str)),z:parseInt(m.getVariable(l.userI_z_Str))};l.updateCamera();l.draw()}else l.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,c=this.graphics.length;a<c;a++)this.graphics[a].update();
this.primitives=[];a=0;for(c=this.graphics.length;a<c;a++){v=this.graphics[a];if(v.split||this.split)for(var d=a+1;d<c;d++)w=this.graphics[d],(w.split||this.split)&&v.splitFace(w);this.primitives=this.primitives.concat(v.primitives||[])}y=this.primitives;C=y.length;for(a=0;a<C;a++)y[a].computeDepth(this);if("painter"===this.render)this.drawPainter(y);else for(y=y.sort(b),a=0;a<C;a++)y[a].draw(this.ctx,this);a=0;for(c=this.graphicsCtr.length;a<c;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 g=0,f=b.length;g<f;g++){c=null;for(var h=0,k=b[g].spaceVertices.length;h<k;h++)whereIs=2<T.spaceVertices.length?this.inPlane2(T.spaceVertices[0],T.normal,b[g].spaceVertices[h]):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[g]);else if("front"===c)e.push(b[g]);else if(null==c)d.push(b[g]);else{c=null;h=0;for(k=T.spaceVertices.length;h<k;h++)whereIs=2<b[g].spaceVertices.length?this.inPlane2(b[g].spaceVertices[0],b[g].normal,T.spaceVertices[h]):-1,whereIs=0<b[g].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[g]):e.push(b[g])}}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].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(){l=this;l.D=l.observer;l.eye.x=l.D/l.scale;l.eye.y=l.XE/l.scale;l.eye.z=l.YE/l.scale};a.Space3D.prototype.rotateVertex=function(b){x=a.degToRad(l.evaluator.getVariable(l.rotZStr));J=k(x);F=p(x);e=b.x*J-b.y*F;f=b.x*F+b.y*J;d=b.z;x=a.degToRad(l.evaluator.getVariable(l.rotYStr));
J=k(x);F=p(x);return{x:d*F+e*J,y:f,z:d*J-e*F}};a.Space3D.prototype.project=function(a){l=this;H=l.eye.x-a.x;G=l.eye.y-a.y;K=l.eye.z-a.z;var b=n(H*H+G*G+K*K);L=-a.x/b||0;H=this.w_2+this.Ox+l.scale*(a.y+L*(l.eye.y-a.y));G=this.h_2+this.Oy-l.scale*(a.z+L*(l.eye.z-a.z));return{x:H,y:G,z:b}};a.Space3D.prototype.computeColor=function(b,d,e){b.match("rgba")?b=a.RGBAToHexColor(b):b.match("#")&&(b=new a.Color(b.substring(1)));V=a.subtract3D(this.eye,d.average);U=a.norm3D(V);Y=a.scalarProduct3D(V,1/U);this.lights[3]=
a.subtract3D(this.light3,d.average);R=a.norm3D(this.lights[3]);for(var g=0,f=this.intensity.length-1;g<f;g++)S[g]=this.intensity[g]*this.dim;S[3]=this.userIntensity*this.userIntensity/R||0;O=e?this.dim/2:this.dim/4;Q=0;N=0<=d.direction?d.normal:a.scalarProduct3D(d.normal,-1);g=0;for(f=this.lights.length;g<f;g++)e?(Q=Math.max(0,a.dotProduct3D(c(this.lights[g],N),Y)),Q*=Q*Q):Q=Math.max(0,a.dotProduct3D(this.lights[g],N)),O+=S[g]*Q;O=Math.min(O,1);P=h(b.r*O);M=h(b.g*O);I=h(b.b*O);return"rgba("+P+","+
M+","+I+","+b.a+")"};a.Space3D.prototype.registerMouseAndTouchEvents=function(){function b(a){document.body.focus();l.click=1;l.evaluator.setVariable(l.id+".mouse_pressed",1);l.parent.deactivateGraphiControls();l.posAnte=l.getCursorPosition(a);l.oldMouse.x=l.getRelativeX(l.posAnte.x);l.oldMouse.y=l.getRelativeY(l.posAnte.y);f(a);window.addEventListener("touchmove",k);window.addEventListener("touchend",c);a.preventDefault()}function c(a){document.body.focus();l.click=0;l.evaluator.setVariable(l.id+
".mouse_pressed",0);window.removeEventListener("touchmove",k,!1);window.removeEventListener("touchend",c,!1);a.preventDefault()}function d(b){document.body.focus();l.click=1;l.parent.deactivateGraphiControls();l.whichButton=a.whichButton(b);"R"===l.whichButton?(window.addEventListener("mouseup",e),l.clickPosForZoom=l.getCursorPosition(b).y,l.clickPosForZoomNew=l.clickPosForZoom,l.fixed||(l.tempScale=l.scale,window.addEventListener("mousemove",h))):"L"==l.whichButton&&(l.evaluator.setVariable(l.id+
".mouse_pressed",1),l.posAnte=l.getCursorPosition(b),l.oldMouse.x=l.getRelativeX(l.posAnte.x),l.oldMouse.y=l.getRelativeY(l.posAnte.y),f(b),window.addEventListener("mousemove",k),window.addEventListener("mouseup",e));b.preventDefault()}function e(a){document.body.focus();l.click=0;l.evaluator.setVariable(l.id+".mouse_pressed",0);a.preventDefault();"R"===l.whichButton&&(window.removeEventListener("mousemove",h,!1),l.clickPosForZoom==l.clickPosForZoomNew&&l.parent.externalSpace.show());window.removeEventListener("mousemove",
k,!1);window.removeEventListener("mouseup",e,!1)}function f(a){l.posAnte=l.getCursorPosition(a);l.mouse_x=l.getRelativeX(l.posAnte.x);l.mouse_y=l.getRelativeY(l.posAnte.y);l.evaluator.setVariable(l.id+".mouse_x",l.mouse_x);l.evaluator.setVariable(l.id+".mouse_y",l.mouse_y);70<Date.now()-m&&(l.parent.update(),m=Date.now())}function h(a){a.preventDefault();l.clickPosForZoomNew=l.getCursorPosition(a).y;l.evaluator.setVariable(l.scaleStr,l.tempScale+l.tempScale/45*((l.clickPosForZoom-l.clickPosForZoomNew)/
10));l.parent.update()}function k(b){if(!l.fixed&&l.click){z=parseInt(50*(l.oldMouse.x-l.mouse_x));A=parseInt(50*(l.oldMouse.y-l.mouse_y));if(z!==l.disp.x||A!==l.disp.y)l.alpha=a.degToRad(l.evaluator.getVariable(l.rotZStr)),l.beta=a.degToRad(-l.evaluator.getVariable(l.rotYStr)),l.alpha=g(a.radToDeg(l.alpha)-z),l.beta=g(a.radToDeg(l.beta)-A),l.evaluator.setVariable(l.rotZStr,l.alpha),l.evaluator.setVariable(l.rotYStr,-l.beta),l.disp.x=z,l.disp.y=A,l.oldMouse.x=l.getRelativeX(l.posAnte.x),l.oldMouse.y=
l.getRelativeY(l.posAnte.y);f(b);b.preventDefault()}}var l=this,m=0;B=a.hasTouchSupport;this.canvas.oncontextmenu=function(){return!1};B&&this.canvas.addEventListener("touchstart",b);B||this.canvas.addEventListener("mousedown",d);this.disp={x:0,y:0}};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var e;a.SpaceAP=function(f,d){a.Space.call(this,f,d);this.exportarVars=this.importarVars=null;e=f.evaluator;this.file.match(/^\[/)&&this.file.match(/\]$/)?this.file=e.parser.parse(this.file.substring(1,
this.file.length-1)):this.file.match(/^\'/)&&this.file.match(/\'$/)?this.file=e.parser.parse(this.file):this.file=e.parser.parse("'"+this.file+"'");this.oldFile=e.evalExpression(this.file);this.initFile()};a.extend(a.SpaceAP,a.Space);a.SpaceAP.prototype.initFile=function(){this.firstUpdate=!0;var e;if(this.oldFile){var d=document.getElementById(this.oldFile);e=d&&"descartes/spaceApFile"==d.type?d.text:a.openExternalFile(this.oldFile);null!=e&&(e=e.split("\n"))}if(e&&e.toString().match(/<applet/gi)){for(var d=
"",b=!1,c=0,h=e.length;c<h&&(e[c].match("<applet")&&(b=!0),b&&(d+=e[c]),!e[c].match("</applet"));c++);c=document.createElement("div");c.innerHTML=d;c.firstChild.setAttribute("width",this.w);c.firstChild.setAttribute("height",this.h);d=this.descApp?this.descApp.container:null;this.descApp=new a.DescartesApp(c.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+";");d?this.parent.container.replaceChild(this.descApp.container,d):this.parent.container.insertBefore(this.descApp.container,this.parent.loader);d=this.descApp.spaces;c=0;for(h=d.length;c<h;c++)d[c].findOffset();this.descApp.container.style.display=0<this.evaluator.evalExpression(this.drawif)?"block":"none";var g=this;this.descApp.update=function(){this.updateAuxiliaries();this.updateEvents();
this.updateControls();this.updateSpaces();g.exportar()}}else d=this.descApp?this.descApp.container:null,this.descApp={},this.descApp.container=document.createElement("div"),this.descApp.container.setAttribute("class","DescartesAppContainer"),c="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?c+="background-image: url("+this.imageSrc+
"); background-repeat:no-repeat;":"stretch"==this.bg_display?c+="background-image: url("+this.imageSrc+"); background-repeat:no-repeat; background-size: 100% 100%;":"patch"==this.bg_display?c+="background-image: url("+this.imageSrc+");":"imgcenter"==this.bg_display&&(c+="background-image: url("+this.imageSrc+"); background-repeat:no-repeat; background-position: center center;")),this.descApp.container.setAttribute("style",c),d?this.parent.container.replaceChild(this.descApp.container,d):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),d=this.y!=this.evaluator.evalExpression(this.yExpr)+this.plecaHeight;this.x=a?this.evaluator.evalExpression(this.xExpr):this.x;this.y=d?this.evaluator.evalExpression(this.yExpr)+this.plecaHeight:
this.y;a&&(this.descApp.container.style.left=this.x+"px");d&&(this.descApp.container.style.top=this.y+"px");if(a||d)for(var a=this.descApp.spaces,d=0,b=a.length;d<b;d++)a[d].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 c in this.evaluator.variables)this.evaluator.variables.hasOwnProperty(c)&&c.match(/^public./)&&this.importarVars.push({varName:c,
value:this.evaluator.getVariable(c)})}this.importar()}};a.SpaceAP.prototype.importar=function(){for(var a,d=!1,b=0,c=this.importarVars.length;b<c;b++)a=this.evaluator.getVariable(this.importarVars[b].varName),a!=this.importarVars[b].value&&(this.importarVars[b].value=a,this.descApp.evaluator.setVariable(this.importarVars[b].varName,this.importarVars[b].value),d=!0);d&&this.descApp.update()};a.SpaceAP.prototype.exportar=function(){};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;
var e,f,d,b;a.SpaceHTML_IFrame=function(b,d){a.Space.call(this,b,d);var e=this.parent.evaluator;window.navigator.userAgent.toLowerCase().match(/firefox/);this.file=this.file?this.file.trim():"";this.file.match(/^\[/)&&this.file.match(/\]$/)?this.file=e.parser.parse(this.file.substring(1,this.file.length-1)):this.file.match(/^\'/)&&this.file.match(/\'$/)?this.file=e.parser.parse(this.file):this.file=e.parser.parse("'"+this.file+"'");this.oldFile=e.evalExpression(this.file);this.MyIFrame=document.createElement("iframe");
0!=this.oldFile&&this.MyIFrame.setAttribute("src",this.oldFile);this.MyIFrame.setAttribute("id",this.id);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");a.isIOS?this.container.setAttribute("style","overflow: scroll; -webkit-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+";"):this.container.setAttribute("style","position: absolute; width: "+this.w+"px; height: "+this.h+"px; left: "+this.x+"px; top: "+this.y+"px; z-index: "+this.zIndex+";");this.container.appendChild(this.MyIFrame);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})};this.update=this.iframeUpdate;this.evaluator.setVariable(this.id+"._scroll",0)};a.extend(a.SpaceHTML_IFrame,a.Space);a.SpaceHTML_IFrame.prototype.init=function(){self=this;self.uber.init.call(self);self.MyIFrame&&(self.MyIFrame.style.width=
self.w+"px",self.MyIFrame.style.height=self.h+"px",self.MyIFrame.style.left=self.x+"px",self.MyIFrame.style.top=self.y+"px")};a.SpaceHTML_IFrame.prototype.iframeUpdate=function(a){e=this.evaluator;this.drawIfValue=0<e.evalExpression(this.drawif);this.container.style.display=this.drawIfValue?"block":"none";if(this.drawIfValue){a&&(this.y=this.x=Infinity);f=this.x!==e.evalExpression(this.xExpr)+this.displaceRegionWest;d=this.y!==e.evalExpression(this.yExpr)+this.parent.plecaHeight+this.displaceRegionNorth;
this.x=f?e.evalExpression(this.xExpr)+this.displaceRegionWest:this.x;this.y=d?e.evalExpression(this.yExpr)+this.parent.plecaHeight+this.displaceRegionNorth:this.y;if(f||d)this.container.style.left=this.x+"px",this.container.style.top=this.y+"px";b=e.evalExpression(this.file);b!==this.oldFile&&(this.oldFile=b,this.MyIFrame.setAttribute("src",b));this.scrollVar=e.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){function e(a){var d=document.createElement("label");d.setAttribute("style","text-align:right; padding:5px; -webkit-touch-callout:none; -webkit-user-select:none; -khtml-user-select:none; -moz-user-select:none; -ms-user-select:none; user-select:none;");d.innerHTML=babel.translate(b,a);
return d}function f(a,b){var d=document.createElement("input");d.value=a;b&&d.setAttribute("type",b);return d}function d(a){a=this.querySelector("input")||this.querySelector("select");var b=a.value;"checkbox"==a.getAttribute("type")&&(b=a.checked.toString());this.obj.value=b}if(a.loadLib)return a;var b;a.EditorGenericPanel=function(a){this.editor=a;this.parent=a.parent;b=this.parent.language};a.EditorGenericPanel.prototype.findObjectByName=function(a,b){for(var d=0,e=a.length;d<e;d++)if(a[d].name==
b)return a[d];return null};a.EditorGenericPanel.prototype.newLabelAndInput=function(a,b){var g=document.createElement("div");g.setAttribute("class","DescartesLabelAndElementContainer");g.obj=a;var r=e(a.name),k=f(a.value);g.appendChild(r);g.appendChild(k);b.appendChild(g);g.addEventListener("change",d);return g};a.EditorGenericPanel.prototype.newLabelAndMenu=function(a,b,g){var f=document.createElement("div");f.setAttribute("class","DescartesLabelAndElementContainer");f.obj=a;for(var k=e(a.name),
p=document.createElement("select"),n=0,q=g.length;n<q;n++)p.innerHTML+="<option value='"+g[n]+"'> "+g[n]+"</option>\n";p.value=a.value;f.appendChild(k);f.appendChild(p);b.appendChild(f);f.addEventListener("change",d);return f};a.EditorGenericPanel.prototype.newLabelAndCheckbox=function(a,b){var g=document.createElement("div");g.setAttribute("class","DescartesLabelAndElementContainer");g.obj=a;var r=e(a.name),k=f(a.value,"checkbox");k.checked="true"==a.value?!0:!1;g.appendChild(r);g.appendChild(k);
b.appendChild(g);g.addEventListener("change",d);return g};a.EditorGenericPanel.prototype.newFieldSet=function(a,b){var d=document.createElement("fieldset"),e=document.createElement("legend");e.innerHTML=b;d.appendChild(e);a.appendChild(d);return d};a.EditorGenericPanel.prototype.setValue=function(a,b){a.obj=b;var d=a.querySelector("input")||a.querySelector("select");d&&("checkbox"==d.getAttribute("type")?d.checked="true"==b.value?!0:!1:d.value=b.value)};a.EditorGenericPanel.prototype.fillAttributes=
function(a){for(var b,d=0,e=a.length;d<e;d++)(b=this.attributes[a[d].name])&&this.setValue(b,a[d])};a.EditorGenericPanel.prototype.hideAllAttributes=function(){for(var b in this.attributes)a.hideHTML(this.attributes[b])};a.EditorGenericPanel.prototype.showAttributes=function(b){for(var d=0,e=b.length;d<e;d++)this.attributes[b[d].name]&&a.showHTML(this.attributes[b[d].name])};a.EditorGenericPanel.prototype.toNameValueArray=function(a){var b=[],d;for(d in a)b.push({name:d,value:a[d]});return b};a.EditorGenericPanel.prototype.createPanel2=
function(a){var b=this.useDisplaceIndex?this.editor.definitionPanel.params.length:0;if(!a){a=0;for(var d=this.params.length;a<d;a++)this.buildobj(this.params[a]);this.ulContainer=document.createElement("ul");this.editor.listContainer.appendChild(this.ulContainer)}var e,f,p,n,q;this.ulContainer.style.display=0==this.params.length?"none":null;a=0;for(d=this.params.length;a<d;a++){e=document.createElement("li");e.setAttribute("data-index",a);q=this.params[a].obj;f=document.createElement("span");f.innerHTML=
'<div class="Descartes_param_name">&lt;param name="'+this.prefix+(10>a+b+1?"0":"")+(a+b+1)+'" value="<br></div>';e.appendChild(f);for(var s=0,t=q.length;s<t;s++)n=q[s],n.value=n.value.replace(/</g,"&lt;"),"family_interval"==n.name||"family_steps"==n.name?(p=this.params[a].paramObj.family,f=document.createElement("span"),f.setAttribute("class","family"),f.innerHTML=p+(""!=p?".":"")+("family_interval"==n.name?babel.toLanguage("interval"):babel.toLanguage("steps"))+"='",e.appendChild(f),p=document.createElement("span"),
p.setAttribute("class","DescartesSpanValue"),p.setAttribute("contenteditable","true"),p.setAttribute("autocapitalize","off"),p.innerHTML=babel.toLanguage(n.value),e.appendChild(p),f=document.createElement("span"),f.innerHTML="'"+(s<t-1?" ":""),e.appendChild(f)):"parameter_interval"==n.name||"parameter_steps"==n.name?(parameter=this.params[a].paramObj.parameter,f=document.createElement("span"),f.setAttribute("class","parameter"),f.innerHTML=parameter+(""!=parameter?".":"")+("parameter_interval"==n.name?
babel.toLanguage("interval"):babel.toLanguage("steps"))+"='",e.appendChild(f),p=document.createElement("span"),p.setAttribute("class","DescartesSpanValue"),p.setAttribute("contenteditable","true"),p.setAttribute("autocapitalize","off"),p.innerHTML=babel.toLanguage(n.value),e.appendChild(p),f=document.createElement("span"),f.innerHTML="'"+(s<t-1?" ":""),e.appendChild(f)):this.dontShowList[n.name]||(f=document.createElement("span"),f.innerHTML=babel.toLanguage(n.name)+"='",e.appendChild(f),p=document.createElement("span"),
p.setAttribute("class","DescartesSpanValue"),p.setAttribute("contenteditable","true"),p.setAttribute("autocapitalize","off"),p.innerHTML=babel.toLanguage(n.value),e.appendChild(p),f=document.createElement("span"),f.innerHTML="'"+(s<t-1?" ":""),e.appendChild(f)),"family"==n.name&&p.addEventListener("input",function(a){a=this.parentNode.querySelectorAll(".family");for(var b,c=0,d=a.length;c<d;c++)b=a[c].innerHTML,b.match("intervalo")?a[c].innerHTML=this.textContent+(""!=this.textContent?".":"")+"intervalo='":
a[c].innerHTML=this.textContent+(""!=this.textContent?".":"")+"pasos='"}),"parameter"==n.name&&p.addEventListener("input",function(a){a=this.parentNode.querySelectorAll(".parameter");for(var b,c=0,d=a.length;c<d;c++)b=a[c].innerHTML,b.match("intervalo")?a[c].innerHTML=this.textContent+(""!=this.textContent?".":"")+"intervalo='":a[c].innerHTML=this.textContent+(""!=this.textContent?".":"")+"pasos='"});f=document.createElement("span");f.innerHTML='<br>"&gt;';e.appendChild(f);this.ulContainer.appendChild(e)}};
a.EditorGenericPanel.prototype.add=function(a){var b={name:"_"};b.paramObj=this.newParamObject(a);b.obj=this.toNameValueArray(b.paramObj);this.params.push(b);this.ulContainer.innerHTML="";this.createPanel2(!0);this.notifyProgram&&this.editor.programPanel.renumerate();a=this.ulContainer.querySelectorAll("li");a[this.params.length-1].className+=" DescartesElementSelected";return a[this.params.length-1]};a.EditorGenericPanel.prototype.remove=function(a){this.params.splice(a,1);this.ulContainer.innerHTML=
"";this.createPanel2(!0);this.notifyProgram&&this.editor.programPanel.renumerate()};a.EditorGenericPanel.prototype.clone=function(a){a=this.params[a];var b={name:"_",paramObj:{}},d;for(d in a.paramObj)b.paramObj[d]=a.paramObj[d];b.obj=this.toNameValueArray(b.paramObj);this.params.push(b);this.ulContainer.innerHTML="";this.createPanel2(!0);this.notifyProgram&&this.editor.programPanel.renumerate();d=this.ulContainer.querySelectorAll("li");d[this.params.length-1].className+=" DescartesElementSelected";
return d[this.params.length-1]};a.EditorGenericPanel.prototype.moveUp=function(a){if(0<a){var b=this.params[a-1];this.params[a-1]=this.params[a];this.params[a]=b;this.ulContainer.innerHTML="";this.createPanel2(!0);b=this.ulContainer.querySelectorAll("li");b[a-1].className+=" DescartesElementSelected";return b[a-1]}};a.EditorGenericPanel.prototype.moveDown=function(a){if(a<this.params.length-1){var b=this.params[a+1];this.params[a+1]=this.params[a];this.params[a]=b;this.ulContainer.innerHTML="";this.createPanel2(!0);
b=this.ulContainer.querySelectorAll("li");b[a+1].className+=" DescartesElementSelected";return b[a+1]}};a.EditorGenericPanel.prototype.renumerate=function(){for(var a=this.editor.definitionPanel.params.length,b=this.ulContainer.querySelectorAll("li"),d=0,e=b.length;d<e;d++)b[d].firstChild.innerHTML='&lt;param name="'+this.prefix+(d+a+1)+'" value="'};a.EditorGenericPanel.prototype.getContent=function(){for(var a="",b=this.ulContainer.querySelectorAll("li"),d,e=0,f=b.length;e<f;e++){d=b[e].querySelectorAll("span");
for(var p=0,n=d.length;p<n;p++)a="DescartesSpanValue"==d[p].className?a+d[p].textContent.replace(/'/g,"&squot;"):a+d[p].textContent;a+="\n"}return a.replace(/intervalo=''/g,"").replace(/pasos=''/g,"")};a.hideHTML=function(a){a&&a.style&&(a.style.display="none")};a.showHTML=function(a){a&&a.style&&(a.style.display="")};a.hideMultipleHTML=function(b){for(var d=0,e=b.length;d<e;d++)a.hideHTML(b[d])};a.showMultipleHTML=function(b){for(var d=0,e=b.length;d<e;d++)a.showHTML(b[d])};return a}(descartesJS||
{}),descartesJS=function(a){if(a.loadLib)return a;a.EditorConfigPanel=function(e){a.EditorGenericPanel.call(this,e);this.params=e.sceneParams;this.config=e.configAttributes;this.createPanel2()};a.extend(a.EditorConfigPanel,a.EditorGenericPanel);a.EditorConfigPanel.prototype.createPanel=function(){var a;a=document.getElementById("tab_1");var f=document.createElement("div");f.setAttribute("class","DescartesConfigPanel");a.appendChild(f);this.parameters=[];a=this.findObjectByName(this.params,"docBase");
a.value==window.location.href&&(a.value="_default_");this.parameters.push(this.newLabelAndInput(this.findObjectByName(this.params,"docBase"),f));this.parameters.push(this.newLabelAndMenu(this.findObjectByName(this.params,"decimal_symbol"),f,[".",","]));this.parameters.push(this.newLabelAndCheckbox(this.findObjectByName(this.params,"antialias"),f));this.parameters.push(this.newLabelAndMenu(this.findObjectByName(this.params,"language"),f,"english espa\u00f1ol catal\u00e0 euskera fran\u00e7ais galego portugu\u00eas valenci\u00e0".split(" ")));
var d=this.parent.lessonParser.split(this.findObjectByName(this.params,"Buttons").value);a=[];for(var b=0,c=d.length;b<c;b++)a.push({name:babel[d[b][0]]||d[b][0],value:babel[d[b][1]]||d[b][1]});d=this.newFieldSet(f,"buttons");this.parameters.push(this.newLabelAndCheckbox(this.findObjectByName(a,"about"),d));this.parameters.push(this.newLabelAndCheckbox(this.findObjectByName(a,"config"),d));this.parameters.push(this.newLabelAndCheckbox(this.findObjectByName(a,"init"),d));this.parameters.push(this.newLabelAndCheckbox(this.findObjectByName(a,
"clear"),d));this.parameters.push(this.newLabelAndInput(this.findObjectByName(a,"widthEast"),f));this.parameters.push(this.newLabelAndInput(this.findObjectByName(a,"widthWest"),f));this.parameters.push(this.newLabelAndInput(this.findObjectByName(a,"height"),f))};a.EditorConfigPanel.prototype.createPanel2=function(){this.ulContainer=document.createElement("ul");this.editor.listContainer.appendChild(this.ulContainer);var a=this.parent.lessonParser,f,d,b,c,h=_tmpH=null;f=document.createElement("li");
d=document.createElement("span");d.innerHTML="&lt;ajs ";f.appendChild(d);for(var g=0,r=this.config.length;g<r;g++)b=this.config[g].name,c=this.config[g].value,"width"==b&&(h=c),"height"==b&&(_tmpH=c),d=document.createElement("span"),d.innerHTML=b+'="',f.appendChild(d),d=document.createElement("span"),d.setAttribute("class","DescartesSpanValue"),d.setAttribute("contenteditable","true"),d.setAttribute("autocapitalize","off"),d.innerHTML=c,f.appendChild(d),d=document.createElement("span"),d.innerHTML=
'" ',f.appendChild(d);d=document.createElement("span");d.innerHTML="&gt;";f.appendChild(d);this.ulContainer.appendChild(f);g=0;for(r=this.params.length;g<r;g++){f=document.createElement("li");b=this.params[g].name;c=this.params[g].value;"size"==b&&null!=h&&null!=_tmpH&&(c=h+"x"+_tmpH);if("Buttons"!=babel[this.params[g].name])d=document.createElement("span"),d.innerHTML='&lt;param name="'+babel.toLanguage(b)+'" value="',f.appendChild(d),d=document.createElement("span"),d.setAttribute("class","DescartesSpanValue"),
d.setAttribute("contenteditable","true"),d.setAttribute("autocapitalize","off"),d.innerHTML=babel.toLanguage(c),f.appendChild(d),d=document.createElement("span"),d.innerHTML='"&gt;';else{d=document.createElement("span");d.innerHTML='&lt;param name="'+babel.toLanguage(b)+'" value="';f.appendChild(d);for(var k=a.split(c),p=0,n=k.length;p<n;p++)b=babel[k[p][0]]||k[p][0],c=babel[k[p][1]]||k[p][1],d=document.createElement("span"),d.innerHTML=babel.toLanguage(b)+"='",f.appendChild(d),d=document.createElement("span"),
d.setAttribute("class","DescartesSpanValue"),d.setAttribute("contenteditable","true"),d.setAttribute("autocapitalize","off"),d.innerHTML=babel.toLanguage(c),f.appendChild(d),d=document.createElement("span"),d.innerHTML="'"+(p<n-1?" ":""),f.appendChild(d);d=document.createElement("span");d.innerHTML='">'}f.appendChild(d);this.ulContainer.appendChild(f)}};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;a.EditorSpacePanel=function(e){a.EditorGenericPanel.call(this,e);this.params=
e.spaceParams;this.prefix="E_";this.dontShowList={};this.createPanel2()};a.extend(a.EditorSpacePanel,a.EditorGenericPanel);a.EditorSpacePanel.prototype.createPanel=function(){var a=document.getElementById("tab_2"),f=document.createElement("div");f.setAttribute("class","DescartesConfigPanel");a.appendChild(f);this.leftPanel=document.createElement("div");this.leftPanel.setAttribute("class","DescartesLeftPanelClass");a=document.createElement("div");this.leftPanel.appendChild(a);f.appendChild(this.leftPanel);
this.rightPanel=document.createElement("div");this.rightPanel.setAttribute("class","DescartesRightPanelClass");f.appendChild(this.rightPanel);for(var f=0,d=this.params.length;f<d;f++)this.buildobj(this.params[f]);this.configLeftPanel(a);this.configRightPanel(this.rightPanel)};a.EditorSpacePanel.prototype.buildobj=function(a){var f=a.value,d,b,c;b="R2";for(var h=0,g=f.length;h<g;h++)if(d=f[h],"type"==babel[d[0]]){b=d[1];break}b=this.newParamObject(b);h=0;for(g=f.length;h<g;h++)d=f[h],c=babel[d[1]]||
d[1],"#"==c.charAt(0)&&7==c.length&&(c=c.substring(1)),b[babel[d[0]]]=c;a.paramObj=b;a.obj=this.toNameValueArray(b)};a.EditorSpacePanel.prototype.configLeftPanel=function(e){function f(b){b=this.obj;d.hideAllAttributes();d.showAttributes(b);d.fillAttributes(b);a.showHTML(d.configRightSubPanel)}for(var d=this,b=document.createElement("ul"),c,h=0,g=this.params.length;h<g;h++)c=document.createElement("li"),c.innerHTML=this.params[h].paramObj.id+"  (space"+this.params[h].paramObj.type+")",c.obj=this.params[h].obj,
c.paramObj=this.params[h].paramObj,c.addEventListener("click",f),b.appendChild(c);e.appendChild(b)};a.EditorSpacePanel.prototype.configRightPanel=function(e){this.configRightSubPanel=document.createElement("div");e.appendChild(this.configRightSubPanel);this.attributes={};this.attributes.id=this.newLabelAndInput({name:"id",value:""},this.configRightSubPanel);this.attributes.x=this.newLabelAndInput({name:"x",value:""},this.configRightSubPanel);this.attributes.y=this.newLabelAndInput({name:"y",value:""},
this.configRightSubPanel);this.attributes.width=this.newLabelAndInput({name:"width",value:""},this.configRightSubPanel);this.attributes.height=this.newLabelAndInput({name:"height",value:""},this.configRightSubPanel);this.attributes.drawif=this.newLabelAndInput({name:"drawif",value:""},this.configRightSubPanel);this.attributes.fixed=this.newLabelAndCheckbox({name:"fixed",value:"false"},this.configRightSubPanel);this.attributes.scale=this.newLabelAndInput({name:"scale",value:""},this.configRightSubPanel);
this.attributes["O.x"]=this.newLabelAndInput({name:"O.x",value:""},this.configRightSubPanel);this.attributes["O.y"]=this.newLabelAndInput({name:"O.y",value:""},this.configRightSubPanel);this.attributes.image=this.newLabelAndInput({name:"image",value:""},this.configRightSubPanel);this.attributes.bg_display=this.newLabelAndMenu({name:"bg_display",value:"topleft"},this.configRightSubPanel,["topleft","stretch","patch","center"]);this.attributes.background=this.newLabelAndInput({name:"background",value:""},
this.configRightSubPanel);this.attributes.file=this.newLabelAndInput({name:"file",value:""},this.configRightSubPanel);this.attributes.net=this.newLabelAndInput({name:"net",value:""},this.configRightSubPanel);this.attributes.net10=this.newLabelAndInput({name:"net10",value:""},this.configRightSubPanel);this.attributes.axes=this.newLabelAndInput({name:"axes",value:""},this.configRightSubPanel);this.attributes.text=this.newLabelAndInput({name:"text",value:""},this.configRightSubPanel);this.attributes.numbers=
this.newLabelAndCheckbox({name:"numbers",value:"false"},this.configRightSubPanel);this.attributes.x_axis=this.newLabelAndInput({name:"x_axis",value:""},this.configRightSubPanel);this.attributes.y_axis=this.newLabelAndInput({name:"y_axis",value:""},this.configRightSubPanel);this.attributes.render=this.newLabelAndMenu({name:"render",value:"sort"},this.configRightSubPanel,["sort","painter"]);this.attributes.split=this.newLabelAndCheckbox({name:"split",value:"false"},this.configRightSubPanel);this.attributes.sensitive_to_mouse_movements=
this.newLabelAndCheckbox({name:"sensitive_to_mouse_movements",value:"false"},this.configRightSubPanel);a.hideHTML(this.configRightSubPanel)};a.EditorSpacePanel.prototype.newParamObject=function(a){return"R2"==a?{type:"R2",id:"E0",x:"0",y:"0",width:"100%",height:"100%",drawif:"1",fixed:"false",scale:"48","O.x":"0","O.y":"0",image:"",bg_display:"topleft",background:"f0f8fa",net:"b8c4c8",net10:"889498",axes:"405860",text:"405860",numbers:"false",x_axis:"",y_axis:"",sensitive_to_mouse_movements:"false"}:
"R3"==a?{type:"R3",id:"E0",x:"0",y:"0",width:"100%",height:"100%",drawif:"1",fixed:"false",scale:"48","O.x":"0","O.y":"0",image:"",bg_display:"topleft",background:"000000",render:"order",split:"false",sensitive_to_mouse_movements:"false"}:{type:"HTMLIFrame",id:"E0",x:"0",y:"0",width:"100%",height:"100%",drawif:"1",image:"",bg_display:"topleft",background:"f0f8fa",file:""}};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;a.EditorControlPanel=function(e){a.EditorGenericPanel.call(this,
e);this.params=e.ctrsParams;this.prefix="C_";this.dontShowList={};this.createPanel2()};a.extend(a.EditorControlPanel,a.EditorGenericPanel);a.EditorControlPanel.prototype.createPanel=function(){var a=document.getElementById("tab_3"),f=document.createElement("div");f.setAttribute("class","DescartesConfigPanel");a.appendChild(f);this.leftPanel=document.createElement("div");this.leftPanel.setAttribute("class","DescartesLeftPanelClass");a=document.createElement("div");this.leftPanel.appendChild(a);f.appendChild(this.leftPanel);
this.rightPanel=document.createElement("div");this.rightPanel.setAttribute("class","DescartesRightPanelClass");f.appendChild(this.rightPanel);for(var f=0,d=this.params.length;f<d;f++)this.buildobj(this.params[f]);this.configLeftPanel(a);this.configRightPanel(this.rightPanel)};a.EditorControlPanel.prototype.buildobj=function(a){var f=a.value,d,b,c;b="spinner";for(var h=0,g=f.length;h<g;h++)if(d=f[h],"type"==babel[d[0]]){b=babel[d[1]];break}if("numeric"==b)for(b="spinner",h=0,g=f.length;h<g;h++)if(d=
f[h],"gui"==babel[d[0]]){b=babel[d[1]];break}b=this.newParamObject(b);h=0;for(g=f.length;h<g;h++)d=f[h],c=babel[d[1]]||d[1],"#"==c.charAt(0)&&7==c.length&&(c=c.substring(1)),b[babel[d[0]]]=c;a.paramObj=b;a.obj=this.toNameValueArray(b)};a.EditorControlPanel.prototype.configLeftPanel=function(e){function f(b){b=this.obj;d.hideAllAttributes();d.showAttributes(b);d.fillAttributes(b);a.showHTML(d.configRightSubPanel)}for(var d=this,b=document.createElement("ul"),c,h=0,g=this.params.length;h<g;h++)c=document.createElement("li"),
c.innerHTML=this.params[h].paramObj.id+"  ("+this.params[h].paramObj.type+")",c.obj=this.params[h].obj,c.paramObj=this.params[h].paramObj,c.addEventListener("click",f),b.appendChild(c);e.appendChild(b)};a.EditorControlPanel.prototype.configRightPanel=function(e){this.configRightSubPanel=document.createElement("div");e.appendChild(this.configRightSubPanel);this.attributes={};this.attributes.id=this.newLabelAndInput({name:"id",value:""},this.configRightSubPanel);this.attributes.gui=this.newLabelAndMenu({name:"gui",
value:"spinner"},this.configRightSubPanel,["spinner","textfield","menu","scrollbar","button"]);this.attributes.region=this.newLabelAndMenu({name:"region",value:"south"},this.configRightSubPanel,"south north east west external interior scenario".split(" "));this.attributes.params=this.newLabelAndInput({name:"params",value:""},this.configRightSubPanel);this.attributes.name=this.newLabelAndInput({name:"name",value:""},this.configRightSubPanel);this.attributes.expresion=this.newLabelAndInput({name:"expresion",
value:""},this.configRightSubPanel);this.attributes.value=this.newLabelAndInput({name:"value",value:""},this.configRightSubPanel);this.attributes.incr=this.newLabelAndInput({name:"incr",value:""},this.configRightSubPanel);this.attributes.min=this.newLabelAndInput({name:"min",value:""},this.configRightSubPanel);this.attributes.max=this.newLabelAndInput({name:"max",value:""},this.configRightSubPanel);this.attributes.discrete=this.newLabelAndCheckbox({name:"discrete",value:"false"},this.configRightSubPanel);
this.attributes.decimals=this.newLabelAndInput({name:"decimals",value:""},this.configRightSubPanel);this.attributes.fixed=this.newLabelAndCheckbox({name:"fixed",value:"false"},this.configRightSubPanel);this.attributes.exponentialif=this.newLabelAndInput({name:"exponentialif",value:""},this.configRightSubPanel);this.attributes.visible=this.newLabelAndInput({name:"visible",value:""},this.configRightSubPanel);this.attributes.action=this.newLabelAndMenu({name:"action",value:""},this.configRightSubPanel,
" calculate init clear animate openURL openScene playAudio".split(" "));this.attributes.parameter=this.newLabelAndInput({name:"parameter",value:""},this.configRightSubPanel);this.attributes.drawif=this.newLabelAndInput({name:"drawif",value:""},this.configRightSubPanel);this.attributes.activeif=this.newLabelAndInput({name:"activeif",value:""},this.configRightSubPanel);this.attributes.onlyText=this.newLabelAndCheckbox({name:"onlyText",value:"false"},this.configRightSubPanel);this.attributes.options=
this.newLabelAndInput({name:"options",value:""},this.configRightSubPanel);this.attributes.color=this.newLabelAndInput({name:"color",value:""},this.configRightSubPanel);this.attributes.activeif=this.newLabelAndInput({name:"colorInt",value:""},this.configRightSubPanel);this.attributes.bold=this.newLabelAndCheckbox({name:"bold",value:"false"},this.configRightSubPanel);this.attributes.italics=this.newLabelAndCheckbox({name:"italics",value:"false"},this.configRightSubPanel);this.attributes.underlined=
this.newLabelAndCheckbox({name:"underlined",value:"false"},this.configRightSubPanel);this.attributes.font_size=this.newLabelAndInput({name:"font_size",value:""},this.configRightSubPanel);this.attributes.image=this.newLabelAndInput({name:"image",value:""},this.configRightSubPanel);this.attributes.size=this.newLabelAndInput({name:"size",value:""},this.configRightSubPanel);this.attributes.constraint=this.newLabelAndInput({name:"constraint",value:""},this.configRightSubPanel);this.attributes.text=this.newLabelAndInput({name:"text",
value:""},this.configRightSubPanel);this.attributes.file=this.newLabelAndInput({name:"file",value:""},this.configRightSubPanel);a.hideHTML(this.configRightSubPanel)};a.EditorControlPanel.prototype.newParamObject=function(a){return"spinner"==a?{id:"n1",type:"numeric",gui:"spinner",region:"south",space:"E0",name:"",expresion:"(0,0,100,23)",value:"0",incr:"0.1",min:"",max:"",discrete:"false",decimals:"2",fixed:"true",exponentialif:"",visible:"true",action:"",parameter:"",drawif:"",activeif:""}:"textfield"==
a?{id:"n1",type:"numeric",gui:"textfield",onlyText:"false",region:"south",space:"E0",name:"",expresion:"(0,0,100,23)",value:"0",incr:"0.1",min:"",max:"",discrete:"false",decimals:"2",fixed:"true",exponentialif:"",visible:"true",action:"",parameter:"",drawif:"",activeif:"",evaluate:"false",answer:""}:"menu"==a?{id:"n1",type:"numeric",gui:"menu",region:"south",space:"E0",name:"",expresion:"(0,0,100,23)",value:"0",decimals:"2",fixed:"true",exponentialif:"",visible:"true",options:"",action:"",parameter:"",
drawif:"",activeif:""}:"scrollbar"==a?{id:"n1",type:"numeric",gui:"scrollbar",region:"south",space:"E0",name:"",expresion:"(0,0,100,23)",value:"0",incr:"0.1",min:"0",max:"100",discrete:"false",decimals:"2",fixed:"true",exponentialif:"",visible:"true",action:"",parameter:"",drawif:"",activeif:""}:"button"==a?{id:"n1",gui:"button",type:"numeric",region:"south",space:"E0",name:"",expresion:"(0,0,100,23)",value:"0",visible:"true",color:"222222",colorInt:"f0f8ff",bold:"false",italics:"false",underlined:"false",
font_size:"12",image:"",action:"",parameter:"",drawif:"",activeif:""}:"graphic"==a?{id:"g1",type:"graphic",space:"E0",color:"222222",colorInt:"f0f8ff",size:"4",expresion:"(0,0)",constraint:"",image:"",drawif:"",activeif:""}:"text"==a?{id:"t1",type:"text",space:"E0",expresion:"(0,0)",text:"",answer:"",drawif:"",activeif:""}:"audio"==a?{id:"a1",type:"audio",space:"E0",expresion:"(0,0)",drawif:"",file:""}:{id:"v1",type:"video",space:"E0",expresion:"(0,0)",drawif:"",file:""}};return a}(descartesJS||{}),
descartesJS=function(a){if(a.loadLib)return a;a.EditorDefinitionPanel=function(e){a.EditorGenericPanel.call(this,e);this.params=e.defParams;this.prefix="A_";this.dontShowList={type:!0};this.notifyProgram=!0;this.createPanel2()};a.extend(a.EditorDefinitionPanel,a.EditorGenericPanel);a.EditorDefinitionPanel.prototype.createPanel=function(){var a=document.getElementById("tab_4"),f=document.createElement("div");f.setAttribute("class","DescartesConfigPanel");a.appendChild(f);this.leftPanel=document.createElement("div");
this.leftPanel.setAttribute("class","DescartesLeftPanelClass");a=document.createElement("div");this.leftPanel.appendChild(a);f.appendChild(this.leftPanel);this.rightPanel=document.createElement("div");this.rightPanel.setAttribute("class","DescartesRightPanelClass");f.appendChild(this.rightPanel);for(var f=0,d=this.params.length;f<d;f++)this.buildobj(this.params[f]);this.configLeftPanel(a);this.configRightPanel(this.rightPanel)};a.EditorDefinitionPanel.prototype.buildobj=function(a){for(var f=a.value,
d,b,c,h=c=b=!1,g=0,r=f.length;g<r;g++)d=f[g],"array"==babel[d[0]]&&(b=!0),"matrix"==babel[d[0]]&&(c=!0),d[1].match(/\)$/)&&(h=!0);b=this.newParamObject(c?"matrix":b?"array":h?"function":"variable");g=0;for(r=f.length;g<r;g++)d=f[g],c=babel[d[1]]||d[1],"#"==c.charAt(0)&&7==c.length&&(c=c.substring(1)),b[babel[d[0]]]=c;a.paramObj=b;a.obj=this.toNameValueArray(b)};a.EditorDefinitionPanel.prototype.configLeftPanel=function(e){function f(b){b=this.obj;d.hideAllAttributes();d.showAttributes(b);d.fillAttributes(b);
a.showHTML(d.configRightSubPanel)}for(var d=this,b=document.createElement("ul"),c,h=0,g=this.params.length;h<g;h++)c=document.createElement("li"),c.innerHTML=this.params[h].paramObj.id+"  ("+this.params[h].paramObj.type+")",c.obj=this.params[h].obj,c.paramObj=this.params[h].paramObj,c.addEventListener("click",f),b.appendChild(c);e.appendChild(b)};a.EditorDefinitionPanel.prototype.configRightPanel=function(e){this.configRightSubPanel=document.createElement("div");e.appendChild(this.configRightSubPanel);
this.attributes={};this.attributes.id=this.newLabelAndInput({name:"id",value:""},this.configRightSubPanel);this.attributes.expresion=this.newLabelAndInput({name:"expresion",value:""},this.configRightSubPanel);this.attributes.algorithm=this.newLabelAndCheckbox({name:"algorithm",value:"false"},this.configRightSubPanel);this.attributes.range=this.newLabelAndInput({name:"range",value:""},this.configRightSubPanel);this.attributes.local=this.newLabelAndInput({name:"local",value:""},this.configRightSubPanel);
this.attributes.init=this.newLabelAndInput({name:"init",value:""},this.configRightSubPanel);this.attributes.doExpr=this.newLabelAndInput({name:"doExpr",value:""},this.configRightSubPanel);this.attributes.whileExpr=this.newLabelAndInput({name:"whileExpr",value:""},this.configRightSubPanel);this.attributes.evaluate=this.newLabelAndMenu({name:"evaluate",value:"onlyOnce"},this.configRightSubPanel,["onlyOnce","always"]);this.attributes.file=this.newLabelAndInput({name:"file",value:""},this.configRightSubPanel);
this.attributes.columns=this.newLabelAndInput({name:"columns",value:""},this.configRightSubPanel);this.attributes.rows=this.newLabelAndInput({name:"rows",value:""},this.configRightSubPanel);a.hideHTML(this.configRightSubPanel)};a.EditorDefinitionPanel.prototype.newParamObject=function(a){return"variable"==a?{id:"v1",expresion:"0",type:"variable"}:"function"==a?{id:"f(x)",algorithm:"false",expresion:"x",range:"",local:"",init:"",doExpr:"",whileExpr:"",type:"function"}:"array"==a?{id:"V1",array:"true",
evaluate:"onlyOnce",size:"3",expresion:"V3[0]=0;V3[1]=0;V3[2]=0",file:"",type:"array"}:{id:"M1",matrix:"true",evaluate:"onlyOnce",columns:"3",rows:"3",expresion:"M4[0,0]=0;M4[1,0]=0;M4[2,0]=0;M4[0,1]=0;M4[1,1]=0;M4[2,1]=0;M4[0,2]=0;M4[1,2]=0;M4[2,2]=0;",type:"matrix"}};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;a.EditorProgramPanel=function(e){a.EditorGenericPanel.call(this,e);this.params=e.progParams;this.prefix="A_";this.dontShowList={type:!0};this.useDisplaceIndex=
!0;this.createPanel2()};a.extend(a.EditorProgramPanel,a.EditorGenericPanel);a.EditorProgramPanel.prototype.createPanel=function(){var a=document.getElementById("tab_5"),f=document.createElement("div");f.setAttribute("class","DescartesConfigPanel");a.appendChild(f);this.leftPanel=document.createElement("div");this.leftPanel.setAttribute("class","DescartesLeftPanelClass");a=document.createElement("div");this.leftPanel.appendChild(a);f.appendChild(this.leftPanel);this.rightPanel=document.createElement("div");
this.rightPanel.setAttribute("class","DescartesRightPanelClass");f.appendChild(this.rightPanel);for(var f=0,d=this.params.length;f<d;f++)this.buildobj(this.params[f]);this.configLeftPanel(a);this.configRightPanel(this.rightPanel)};a.EditorProgramPanel.prototype.buildobj=function(a){var f=a.value,d,b,c;b="constant";for(var h=0,g=f.length;h<g;h++)d=f[h],"constant"==babel[d[0]]&&(b="constant"),"event"==babel[d[0]]&&(b="event"),"algorithm"==babel[d[0]]&&(b="algorithm");b=this.newParamObject(b);h=0;for(g=
f.length;h<g;h++)d=f[h],c=babel[d[1]]||d[1],"#"==c.charAt(0)&&7==c.length&&(c=c.substring(1)),b[babel[d[0]]]=c;a.paramObj=b;a.obj=this.toNameValueArray(b)};a.EditorProgramPanel.prototype.configLeftPanel=function(e){function f(b){b=this.obj;d.hideAllAttributes();d.showAttributes(b);d.fillAttributes(b);a.showHTML(d.configRightSubPanel)}for(var d=this,b=document.createElement("ul"),c,h=0,g=this.params.length;h<g;h++)c=document.createElement("li"),c.innerHTML=this.params[h].paramObj.id+"  ("+this.params[h].paramObj.type+
")",c.obj=this.params[h].obj,c.paramObj=this.params[h].paramObj,c.addEventListener("click",f),b.appendChild(c);e.appendChild(b)};a.EditorProgramPanel.prototype.configRightPanel=function(e){this.configRightSubPanel=document.createElement("div");e.appendChild(this.configRightSubPanel);this.attributes={};this.attributes.id=this.newLabelAndInput({name:"id",value:""},this.configRightSubPanel);this.attributes.expresion=this.newLabelAndInput({name:"expresion",value:""},this.configRightSubPanel);this.attributes.condition=
this.newLabelAndInput({name:"condition",value:""},this.configRightSubPanel);this.attributes.action=this.newLabelAndMenu({name:"action",value:""},this.configRightSubPanel," calculate init clear animate openURL openScene playAudio".split(" "));this.attributes.parameter=this.newLabelAndInput({name:"parameter",value:""},this.configRightSubPanel);this.attributes.execution=this.newLabelAndMenu({name:"execution",value:"onlyOnce"},this.configRightSubPanel,["onlyOnce","alternate","always"]);this.attributes.algorithm=
this.newLabelAndCheckbox({name:"algorithm",value:"false"},this.configRightSubPanel);this.attributes.evaluate=this.newLabelAndMenu({name:"evaluate",value:"onlyOnce"},this.configRightSubPanel,["onlyOnce","always"]);this.attributes.init=this.newLabelAndInput({name:"init",value:""},this.configRightSubPanel);this.attributes.doExpr=this.newLabelAndInput({name:"doExpr",value:""},this.configRightSubPanel);this.attributes.whileExpr=this.newLabelAndInput({name:"whileExpr",value:""},this.configRightSubPanel);
a.hideHTML(this.configRightSubPanel)};a.EditorProgramPanel.prototype.newParamObject=function(a){return"constant"==a?{id:"c1",expresion:"0",evaluate:"onlyOnce",constant:"true",type:"constant"}:"event"==a?{id:"e1",event:"true",condition:"",action:"",parameter:"",execution:"",type:"event"}:{id:"A1",algorithm:"true",evaluate:"onlyOnce",init:"",doExpr:"",whileExpr:"",type:"algorithm"}};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;a.EditorGraphicPanel=function(e){a.EditorGenericPanel.call(this,
e);this.params=e.graphParams;this.prefix="G_";this.dontShowList={useFamily:!0};this.createPanel2()};a.extend(a.EditorGraphicPanel,a.EditorGenericPanel);a.EditorGraphicPanel.prototype.createPanel=function(){var a=document.getElementById("tab_6"),f=document.createElement("div");f.setAttribute("class","DescartesConfigPanel");a.appendChild(f);this.leftPanel=document.createElement("div");this.leftPanel.setAttribute("class","DescartesLeftPanelClass");a=document.createElement("div");this.leftPanel.appendChild(a);
f.appendChild(this.leftPanel);this.rightPanel=document.createElement("div");this.rightPanel.setAttribute("class","DescartesRightPanelClass");f.appendChild(this.rightPanel);for(var f=0,d=this.params.length;f<d;f++)this.buildobj(this.params[f]);this.configLeftPanel(a);this.configRightPanel(this.rightPanel)};a.EditorGraphicPanel.prototype.buildobj=function(a){var f=a.value,d,b,c;b="equation";for(var h=0,g=f.length;h<g;h++)if(d=f[h],"type"==babel[d[0]]){b=babel[d[1]];break}b=this.newParamObject(b);for(var r=
"",k="t",h=0,g=f.length;h<g;h++)d=f[h],c=d[1],"family"==babel[d[0]]&&(r=c),"parameter"==babel[d[0]]&&(k=c);h=0;for(g=f.length;h<g;h++){d=f[h];c=babel[d[1]]||d[1]||"";"#"==c.charAt(0)&&7==c.length&&(c=c.substring(1));"family"==babel[d[0]]&&(b.useFamily="true");if(""!=r&&babel[d[0].substring(r.length+1)]&&d[0].substring(0,r.length)==r){if("interval"==babel[d[0].substring(r.length+1)]){b.family_interval=c;continue}if("steps"==babel[d[0].substring(r.length+1)]){b.family_steps=c;continue}}if(""!=k&&babel[d[0].substring(k.length+
1)]&&d[0].substring(0,k.length)==k){if("interval"==babel[d[0].substring(k.length+1)]){b.parameter_interval=c;continue}if("steps"==babel[d[0].substring(k.length+1)]){b.parameter_steps=c;continue}}b[babel[d[0]]]=c}a.paramObj=b;a.obj=this.toNameValueArray(b)};a.EditorGraphicPanel.prototype.configLeftPanel=function(e){function f(b){b=this.obj;d.hideAllAttributes();d.showAttributes(b);d.fillAttributes(b);a.showHTML(d.configRightSubPanel)}for(var d=this,b=document.createElement("ul"),c,h=0,g=this.params.length;h<
g;h++)c=document.createElement("li"),c.innerHTML=this.params[h].paramObj.id+"  ("+this.params[h].paramObj.type+")",c.obj=this.params[h].obj,c.paramObj=this.params[h].paramObj,c.addEventListener("click",f),b.appendChild(c);e.appendChild(b)};a.EditorGraphicPanel.prototype.configRightPanel=function(e){this.configRightSubPanel=document.createElement("div");e.appendChild(this.configRightSubPanel);this.attributes={};this.attributes.space=this.newLabelAndInput({name:"space",value:""},this.configRightSubPanel);
this.attributes.background=this.newLabelAndCheckbox({name:"background",value:"false"},this.configRightSubPanel);this.attributes.color=this.newLabelAndInput({name:"color",value:""},this.configRightSubPanel);this.attributes.drawif=this.newLabelAndInput({name:"drawif",value:""},this.configRightSubPanel);this.attributes.abs_coord=this.newLabelAndCheckbox({name:"abs_coord",value:"false"},this.configRightSubPanel);this.attributes.expresion=this.newLabelAndInput({name:"expresion",value:""},this.configRightSubPanel);
this.attributes.trace=this.newLabelAndCheckbox({name:"trace",value:"false"},this.configRightSubPanel);this.attributes.parameter=this.newLabelAndInput({name:"parameter",value:""},this.configRightSubPanel);this.attributes.parameter_interval=this.newLabelAndInput({name:"parameter_interval",value:""},this.configRightSubPanel);this.attributes.parameter_steps=this.newLabelAndInput({name:"parameter_steps",value:""},this.configRightSubPanel);this.attributes.useFamily=this.newLabelAndCheckbox({name:"useFamily",
value:"false"},this.configRightSubPanel);this.attributes.family=this.newLabelAndInput({name:"family",value:""},this.configRightSubPanel);this.attributes.family_interval=this.newLabelAndInput({name:"family_interval",value:""},this.configRightSubPanel);this.attributes.family_steps=this.newLabelAndInput({name:"family_steps",value:""},this.configRightSubPanel);this.attributes.fillP=this.newLabelAndInput({name:"fillP",value:""},this.configRightSubPanel);this.attributes.fillM=this.newLabelAndInput({name:"fillM",
value:""},this.configRightSubPanel);this.attributes.width=this.newLabelAndInput({name:"width",value:""},this.configRightSubPanel);this.attributes.visible=this.newLabelAndCheckbox({name:"visible",value:"false"},this.configRightSubPanel);this.attributes.editable=this.newLabelAndCheckbox({name:"editable",value:"false"},this.configRightSubPanel);this.attributes.fill=this.newLabelAndInput({name:"fill",value:""},this.configRightSubPanel);this.attributes.size=this.newLabelAndInput({name:"size",value:""},
this.configRightSubPanel);this.attributes.range=this.newLabelAndInput({name:"range",value:""},this.configRightSubPanel);this.attributes.text=this.newLabelAndInput({name:"text",value:""},this.configRightSubPanel);this.attributes.decimals=this.newLabelAndInput({name:"decimals",value:""},this.configRightSubPanel);this.attributes.fixed=this.newLabelAndCheckbox({name:"fixed",value:"false"},this.configRightSubPanel);this.attributes.spear=this.newLabelAndInput({name:"spear",value:""},this.configRightSubPanel);
this.attributes.arrow=this.newLabelAndInput({name:"arrow",value:""},this.configRightSubPanel);this.attributes.center=this.newLabelAndInput({name:"center",value:""},this.configRightSubPanel);this.attributes.radius=this.newLabelAndInput({name:"radius",value:""},this.configRightSubPanel);this.attributes.init=this.newLabelAndInput({name:"init",value:""},this.configRightSubPanel);this.attributes.end=this.newLabelAndInput({name:"end",value:""},this.configRightSubPanel);this.attributes.vectors=this.newLabelAndCheckbox({name:"vectors",
value:"false"},this.configRightSubPanel);this.attributes.border=this.newLabelAndInput({name:"border",value:""},this.configRightSubPanel);this.attributes.file=this.newLabelAndInput({name:"file",value:""},this.configRightSubPanel);this.attributes.opacity=this.newLabelAndInput({name:"opacity",value:""},this.configRightSubPanel);this.attributes.inirot=this.newLabelAndInput({name:"inirot",value:""},this.configRightSubPanel);this.attributes.inipos=this.newLabelAndInput({name:"inipos",value:""},this.configRightSubPanel);
this.attributes.name=this.newLabelAndInput({name:"name",value:""},this.configRightSubPanel);this.attributes.info=this.newLabelAndInput({name:"info",value:""},this.configRightSubPanel);a.hideHTML(this.configRightSubPanel)};a.EditorGraphicPanel.prototype.newParamObject=function(a){return"equation"==a?{space:"E0",type:"equation",background:"false",color:"20303a",drawif:"",abs_coord:"false",expresion:"y=x",trace:"false",useFamily:"false",family:"",family_interval:"",family_steps:"",fillP:"",fillM:"",
width:"1",visible:"false",editable:"false",info:""}:"curve"==a?{space:"E0",type:"curve",background:"false",color:"20303a",drawif:"",abs_coord:"false",expresion:"(t,t)",trace:"false",useFamily:"false",family:"",family_interval:"",family_steps:"",parameter:"t",parameter_interval:"[0,1]",parameter_steps:"8",fill:"",width:"1",visible:"false",editable:"false",info:""}:"sequence"==a?{space:"E0",type:"sequence",background:"false",color:"20303a",drawif:"",abs_coord:"false",expresion:"(n,1/n)",trace:"false",
useFamily:"false",family:"",family_interval:"",family_steps:"",size:"2",visible:"false",editable:"false",range:"[1,100]",info:""}:"point"==a?{space:"E0",type:"point",background:"false",color:"20303a",drawif:"",abs_coord:"false",expresion:"(0,0)",trace:"false",useFamily:"false",family:"",family_interval:"",family_steps:"",text:"",decimals:"2",fixed:"true",size:"2",font:"Monospaced,PLAIN,15",info:""}:"segment"==a?{space:"E0",type:"segment",background:"false",color:"20303a",drawif:"",abs_coord:"false",
expresion:"(0,0)(1,1)",trace:"false",useFamily:"false",family:"",family_interval:"",family_steps:"",text:"",decimals:"2",fixed:"true",size:"2",width:"1",font:"Monospaced,PLAIN,15",info:""}:"arrow"==a?{space:"E0",type:"arrow",background:"false",color:"20303a",drawif:"",abs_coord:"false",expresion:"(0,0)(1,1)",trace:"false",useFamily:"false",family:"",family_interval:"",family_steps:"",text:"",decimals:"2",fixed:"true",width:"5",size:"",spear:"8",arrow:"ee0022",font:"Monospaced,PLAIN,15",info:""}:"polygon"==
a?{space:"E0",type:"polygon",background:"false",color:"20303a",drawif:"",abs_coord:"false",expresion:"(0,0)(1,1)(2,-1)",trace:"false",useFamily:"false",family:"",family_interval:"",family_steps:"",fill:"",width:"1",info:""}:"arc"==a?{space:"E0",type:"arc",background:"false",color:"20303a",drawif:"",abs_coord:"false",center:"(0,0)",radius:"1",init:"0",end:"90",vectors:"false",trace:"false",useFamily:"false",family:"",family_interval:"",family_steps:"",text:"",decimals:"2",fixed:"true",fill:"",width:"1",
font:"Monospaced,PLAIN,15",info:""}:"fill"==a?{space:"E0",type:"fill",background:"false",color:"20303a",drawif:"",abs_coord:"false",expresion:"(0,0)",trace:"false",useFamily:"false",family:"",family_interval:"",family_steps:"",info:""}:"text"==a?{space:"E0",type:"text",background:"false",color:"20303a",drawif:"",expresion:"[20,20]",trace:"false",useFamily:"false",family:"",family_interval:"",family_steps:"",text:"",decimals:"2",fixed:"true",width:"1",border:"",font:"Monospaced,PLAIN,15",info:""}:
"image"==a?{space:"E0",type:"image",background:"false",drawif:"",abs_coord:"false",expresion:"(0,0)",trace:"false",useFamily:"false",family:"",family_interval:"",family_steps:"",file:"",inirot:"0",opacity:"0",info:""}:{space:"E0",type:"macro",background:"false",drawif:"",abs_coord:"false",name:"mac1",expresion:"",useFamily:"false",family:"",family_interval:"",family_steps:"",inirot:"0",inipos:"[0,0]",info:""}};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;a.EditorGraphic3DPanel=
function(e){a.EditorGenericPanel.call(this,e);this.params=e.graph3DParams;this.prefix="S_";this.dontShowList={useFamily:!0};this.createPanel2()};a.extend(a.EditorGraphic3DPanel,a.EditorGenericPanel);a.EditorGraphic3DPanel.prototype.createPanel=function(){var a=document.getElementById("tab_7"),f=document.createElement("div");f.setAttribute("class","DescartesConfigPanel");a.appendChild(f);this.leftPanel=document.createElement("div");this.leftPanel.setAttribute("class","DescartesLeftPanelClass");a=document.createElement("div");
this.leftPanel.appendChild(a);f.appendChild(this.leftPanel);this.rightPanel=document.createElement("div");this.rightPanel.setAttribute("class","DescartesRightPanelClass");f.appendChild(this.rightPanel);for(var f=0,d=this.params.length;f<d;f++)this.buildobj(this.params[f]);this.configLeftPanel(a);this.configRightPanel(this.rightPanel)};a.EditorGraphic3DPanel.prototype.buildobj=function(a){var f=a.value,d,b,c;b="point";for(var h=0,g=f.length;h<g;h++)if(d=f[h],"type"==babel[d[0]]){b=babel[d[1]];break}b=
this.newParamObject(b);for(var r="",h=0,g=f.length;h<g;h++)d=f[h],c=d[1],"family"==babel[d[0]]&&(r=c);h=0;for(g=f.length;h<g;h++){d=f[h];c=babel[d[1]]||d[1]||"";"#"==c.charAt(0)&&7==c.length&&(c=c.substring(1));"family"==babel[d[0]]&&(b.useFamily="true");if(""!=r&&babel[d[0].substring(r.length+1)]&&d[0].substring(0,r.length)==r){if("interval"==babel[d[0].substring(r.length+1)]){b.family_interval=c;continue}if("steps"==babel[d[0].substring(r.length+1)]){b.family_steps=c;continue}}b[babel[d[0]]]=c}a.paramObj=
b;a.obj=this.toNameValueArray(b)};a.EditorGraphic3DPanel.prototype.configLeftPanel=function(e){function f(b){b=this.obj;d.hideAllAttributes();d.showAttributes(b);d.fillAttributes(b);a.showHTML(d.configRightSubPanel)}for(var d=this,b=document.createElement("ul"),c,h=0,g=this.params.length;h<g;h++)c=document.createElement("li"),c.innerHTML=this.params[h].paramObj.name+"  ("+this.params[h].paramObj.type+")",c.obj=this.params[h].obj,c.paramObj=this.params[h].paramObj,c.addEventListener("click",f),b.appendChild(c);
e.appendChild(b)};a.EditorGraphic3DPanel.prototype.configRightPanel=function(e){this.configRightSubPanel=document.createElement("div");e.appendChild(this.configRightSubPanel);this.attributes={};this.attributes.name=this.newLabelAndInput({name:"name",value:""},this.configRightSubPanel);this.attributes.space=this.newLabelAndInput({name:"space",value:""},this.configRightSubPanel);this.attributes.background=this.newLabelAndCheckbox({name:"background",value:"false"},this.configRightSubPanel);this.attributes.color=
this.newLabelAndInput({name:"color",value:""},this.configRightSubPanel);this.attributes.backcolor=this.newLabelAndInput({name:"backcolor",value:""},this.configRightSubPanel);this.attributes.drawif=this.newLabelAndInput({name:"drawif",value:""},this.configRightSubPanel);this.attributes.expresion=this.newLabelAndInput({name:"expresion",value:""},this.configRightSubPanel);this.attributes.useFamily=this.newLabelAndCheckbox({name:"useFamily",value:"false"},this.configRightSubPanel);this.attributes.family=
this.newLabelAndInput({name:"family",value:""},this.configRightSubPanel);this.attributes.family_interval=this.newLabelAndInput({name:"family_interval",value:""},this.configRightSubPanel);this.attributes.family_steps=this.newLabelAndInput({name:"family_steps",value:""},this.configRightSubPanel);this.attributes.inirot=this.newLabelAndInput({name:"inirot",value:""},this.configRightSubPanel);this.attributes.inipos=this.newLabelAndInput({name:"inipos",value:""},this.configRightSubPanel);this.attributes.endrot=
this.newLabelAndInput({name:"endrot",value:""},this.configRightSubPanel);this.attributes.endpos=this.newLabelAndInput({name:"endpos",value:""},this.configRightSubPanel);this.attributes.split=this.newLabelAndCheckbox({name:"split",value:"false"},this.configRightSubPanel);this.attributes.edges=this.newLabelAndCheckbox({name:"edges",value:"false"},this.configRightSubPanel);this.attributes.model=this.newLabelAndMenu({name:"model",value:"metal"},this.configRightSubPanel,["color","light","metal","wire"]);
this.attributes.text=this.newLabelAndInput({name:"text",value:""},this.configRightSubPanel);this.attributes.decimals=this.newLabelAndInput({name:"decimals",value:""},this.configRightSubPanel);this.attributes.fixed=this.newLabelAndCheckbox({name:"fixed",value:"false"},this.configRightSubPanel);this.attributes.width=this.newLabelAndInput({name:"width",value:""},this.configRightSubPanel);this.attributes.length=this.newLabelAndInput({name:"length",value:""},this.configRightSubPanel);this.attributes.height=
this.newLabelAndInput({name:"height",value:""},this.configRightSubPanel);this.attributes.Nu=this.newLabelAndInput({name:"Nu",value:""},this.configRightSubPanel);this.attributes.Nv=this.newLabelAndInput({name:"Nv",value:""},this.configRightSubPanel);a.hideHTML(this.configRightSubPanel)};a.EditorGraphic3DPanel.prototype.newParamObject=function(a){var f;"point"==a?f={name:"",space:"E0",type:"point",background:"false",color:"eeffaa",backcolor:"6090a0",drawif:"",expresion:"(0,0,0)",useFamily:"false",family:"",
family_interval:"",family_steps:"",inirot:"(0,0,0)",inipos:"(0,0,0)",endrot:"(0,0,0)",endpos:"(0,0,0)",split:"false",text:"",decimals:"2",fixed:"true",width:"1"}:"segment"==a||"polygon"==a||"curve"==a?(f={name:"",space:"E0",type:a,background:"false",color:"eeffaa",drawif:"",expresion:"",useFamily:"false",family:"",family_interval:"",family_steps:"",inirot:"(0,0,0)",inipos:"(0,0,0)",endrot:"(0,0,0)",endpos:"(0,0,0)",split:"false",width:"1",Nu:"7"},f.expresion="segment"==a?"(0,0,0)(1,1,1)":"polygon"==
a?"(0,0,0)(1,0,0)(1,1,0)(1,1,1)":"x=cos(4*pi*u) y=sen(4*pi*u) z=2*u-1"):"triangle"==a||"face"==a?(f={name:"",space:"E0",type:a,background:"false",color:"eeffaa",backcolor:"6090a0",drawif:"",expresion:"",useFamily:"false",family:"",family_interval:"",family_steps:"",inirot:"(0,0,0)",inipos:"(0,0,0)",endrot:"(0,0,0)",endpos:"(0,0,0)",split:"false",edges:"false",model:"metal"},f.expresion="triangle"==a?"(1,0,0)(0,1,0)(0,0,1)":"(0,0)(0,1)(1,1)"):"polireg"==a?f={name:"",space:"E0",type:"polireg",background:"false",
color:"eeffaa",backcolor:"6090a0",drawif:"",expresion:"Polireg",useFamily:"false",family:"",family_interval:"",family_steps:"",inirot:"(0,0,0)",inipos:"(0,0,0)",endrot:"(0,0,0)",endpos:"(0,0,0)",split:"false",edges:"false",model:"metal",width:"2",length:"2",Nu:"7"}:"surface"==a?f={name:"",space:"E0",type:"surface",background:"false",color:"eeffaa",backcolor:"6090a0",drawif:"",expresion:"x=2*u-1 y=2*v-1 z=x^2-y^2",useFamily:"false",family:"",family_interval:"",family_steps:"",inirot:"(0,0,0)",inipos:"(0,0,0)",
endrot:"(0,0,0)",endpos:"(0,0,0)",split:"false",edges:"false",model:"metal",Nu:"7",Nv:"7"}:"text"==a?f={name:"",space:"E0",type:"face",background:"false",color:"eeffaa",drawif:"",expresion:"[20,20]",useFamily:"false",family:"",family_interval:"",family_steps:"",inirot:"(0,0,0)",inipos:"(0,0,0)",text:"",decimals:"2",fixed:"true"}:"box"==a?f={name:"",space:"E0",type:"box",background:"false",color:"eeffaa",backcolor:"6090a0",drawif:"",expresion:"Paralelep\u00edpedo",useFamily:"false",family:"",family_interval:"",
family_steps:"",inirot:"(0,0,0)",inipos:"(0,0,0)",endrot:"(0,0,0)",endpos:"(0,0,0)",split:"false",edges:"false",model:"metal",width:"2",length:"2",height:"2"}:"cube"==a||"tetrahedron"==a||"octahedron"==a||"dodecahedron"==a||"icosahedron"==a?(f={name:"",space:"E0",type:a,background:"false",color:"eeffaa",backcolor:"6090a0",drawif:"",expresion:"",useFamily:"false",family:"",family_interval:"",family_steps:"",inirot:"(0,0,0)",inipos:"(0,0,0)",endrot:"(0,0,0)",endpos:"(0,0,0)",split:"false",edges:"false",
model:"metal",width:"2"},f.expresion="cube"==a?"Cubo":"tetrahedron"==a?"Tetraedro":"octahedron"==a?"Octaedro":"dodecahedron"==a?"Dodecaedro":"Icosaedro"):"sphere"==a?f={name:"",space:"E0",type:"sphere",background:"false",color:"eeffaa",backcolor:"6090a0",drawif:"",expresion:"Esfera",useFamily:"false",family:"",family_interval:"",family_steps:"",inirot:"(0,0,0)",inipos:"(0,0,0)",endrot:"(0,0,0)",endpos:"(0,0,0)",split:"false",edges:"false",model:"metal",width:"2",Nu:"7",Nv:"7"}:"ellipsoid"==a||"cone"==
a||"cylinder"==a?(f={name:"",space:"E0",type:a,background:"false",color:"eeffaa",backcolor:"6090a0",drawif:"",expresion:"",useFamily:"false",family:"",family_interval:"",family_steps:"",inirot:"(0,0,0)",inipos:"(0,0,0)",endrot:"(0,0,0)",endpos:"(0,0,0)",split:"false",edges:"false",model:"metal",width:"2",length:"2",height:"2",Nu:"7",Nv:"7"},f.expresion="ellipsoid"==a?"Elipsoide":"cone"==a?"Cono":"Cilindro"):f={name:"",space:"E0",type:"macro",background:"false",drawif:"",expresion:"mi_macro",useFamily:"false",
family:"",family_interval:"",family_steps:"",inirot:"(0,0,0)",inipos:"(0,0,0)",endrot:"(0,0,0)",endpos:"(0,0,0)"};return f};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;a.EditorAnimationPanel=function(e){a.EditorGenericPanel.call(this,e);if(0>=e.animParams.length)this.hasAnimation=!1,this.params=[{name:"Animation",value:"false"},{name:"delay",value:"1000"},{name:"controls",value:"false"},{name:"auto",value:"false"},{name:"loop",value:"false"},{name:"init",value:""},{name:"doExpr",
value:""},{name:"whileExpr",value:""}];else{this.hasAnimation=!0;e=e.animParams[0].value;for(var f=[{name:"Animation",value:"true"}],d=0,b=e.length;d<b;d++)f.push({name:babel[e[d][0]]||e[d][0],value:babel[e[d][1]]||e[d][1]});this.params=f}this.createPanel2()};a.extend(a.EditorAnimationPanel,a.EditorGenericPanel);a.EditorAnimationPanel.prototype.createPanel=function(){var a=document.getElementById("tab_8"),f=document.createElement("div");f.setAttribute("class","DescartesConfigPanel");a.appendChild(f);
this.parameters=[];this.parameters.push(this.newLabelAndCheckbox(this.findObjectByName(this.params,"Animation"),f));this.parameters.push(this.newLabelAndInput(this.findObjectByName(this.params,"delay"),f));this.parameters.push(this.newLabelAndCheckbox(this.findObjectByName(this.params,"controls"),f));this.parameters.push(this.newLabelAndCheckbox(this.findObjectByName(this.params,"auto"),f));this.parameters.push(this.newLabelAndCheckbox(this.findObjectByName(this.params,"loop"),f));this.parameters.push(this.newLabelAndInput(this.findObjectByName(this.params,
"init"),f));this.parameters.push(this.newLabelAndInput(this.findObjectByName(this.params,"doExpr"),f));this.parameters.push(this.newLabelAndInput(this.findObjectByName(this.params,"whileExpr"),f))};a.EditorAnimationPanel.prototype.createPanel2=function(a){a||(this.ulContainer=document.createElement("ul"),this.editor.listContainer.appendChild(this.ulContainer));var f,d;if(this.hasAnimation){this.ulContainer.style.display=null;a=document.createElement("li");f=document.createElement("span");f.innerHTML=
'&lt;param name="'+babel.toLanguage("Animation")+'" value="';a.appendChild(f);for(var b=0,c=this.params.length;b<c;b++)d=babel[this.params[b].name]||this.params[b].name,value=babel[this.params[b].value]||this.params[b].value,value=value.replace(/</g,"&lt;"),"Animation"!=d&&(f=document.createElement("span"),f.innerHTML=babel.toLanguage(d)+"='",a.appendChild(f),f=document.createElement("span"),f.setAttribute("class","DescartesSpanValue"),f.setAttribute("contenteditable","true"),f.innerHTML=babel.toLanguage(value),
a.appendChild(f),f=document.createElement("span"),f.innerHTML="'"+(b<c-1?" ":""),a.appendChild(f));f=document.createElement("span");f.innerHTML='"&gt;';a.appendChild(f);this.ulContainer.appendChild(a)}else this.ulContainer.style.display="none"};a.EditorAnimationPanel.prototype.add=function(){this.hasAnimation||(this.hasAnimation=!0,this.ulContainer.innerHTML="",this.createPanel2(!0))};a.EditorAnimationPanel.prototype.remove=function(){this.hasAnimation=!1;this.ulContainer.innerHTML="";this.createPanel2(!0)};
a.EditorAnimationPanel.prototype.getContent=function(){return this.hasAnimation?this.ulContainer.textContent:""};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var e="Espacio 2D;Espacio 3D;Espacio HTMLIFrame;Pulsador;Campo de texto;Men\u00fa;Barra;Bot\u00f3n;Control gr\u00e1fico;Control de texto;Audio;Video;Variable;Funci\u00f3n;Vector;Matriz;Constante;Evento;Algoritmo;Ecuaci\u00f3n;Curva;Sucesi\u00f3n;Punto;Segmento;Flecha;Pol\u00edgono;Arco;Relleno;Texto;Image;Macro 2D;Punto 3D;Segmento 3D;Pol\u00edgono 3D;Curva 3D;Tri\u00e1ngulo;Cara;Pol\u00edgono regular 3D;Superficie;Texto 3D;Cubo;Paralelep\u00edpedo;Tetraedro;Octaedro;Dodecaedro;Icosaedro;Esfera;Elipsoide;Cono;Cilindro;Macro 3D;Animaci\u00f3n".split(";"),
f="R2 R3 HTMLIFrame spinner textfield menu scrollbar button graphic text audio video variable function array matrix constant event algorithm equation curve sequence point segment arrow polygon arc fill text image macro point segment polygon curve triangle face polireg surface text cube box tetrahedron octahedron dodecahedron icosahedron sphere ellipsoid cone cylinder macro animation".split(" ");a.Editor=function(a){this.parent=a;this.container=document.createElement("div");this.container.setAttribute("class",
"DescartesEditorContainer");document.body.appendChild(this.container);this.readConfiguration();this.hide();this.configDescartesParamList()};a.Editor.prototype.show=function(){this.container.style.display="block"};a.Editor.prototype.hide=function(){this.container.style.display="none"};a.Editor.prototype.readConfiguration=function(){this.documentClone=document.createElement("document");this.documentClone.innerHTML=document.documentElement.innerHTML;for(var a=this.documentClone.querySelectorAll("meta,#StyleDescartesApps,#StyleDescartesApps2,base,.DescartesEditorContainer"),
b=0,c=a.length;b<c;b++)a[b].parentNode.removeChild(a[b]);for(var a=document.querySelectorAll("applet,ajs"),e,b=0,c=a.length;b<c;b++)if(a[b]==this.parent.applet){e=b;break}a=this.documentClone.querySelectorAll("applet,ajs");this.appletClone=a[e];a[e].parentNode.replaceChild(document.createElement("DescartesPlaceholder"),a[e]);b=this.appletClone.querySelector("param");b.parentNode.removeChild(b);(this.script_docBase=this.appletClone.querySelector("script"))&&this.script_docBase.parentNode.removeChild(this.script_docBase);
a=this.parent.lessonParser;e=this.parent.applet.attributes;this.configAttributes=[];b=0;for(c=e.length;b<c;b++)this.configAttributes.push({name:e[b].name,value:e[b].value});var g=this.parent.children;this.sceneParams=[];this.spaceParams=[];this.ctrsParams=[];this.auxParams=[];this.defParams=[];this.progParams=[];this.graphParams=[];this.graph3DParams=[];this.animParams=[];var f="";e="";b=0;for(c=g.length;b<c;b++)f=g[b].getAttribute("name"),e=a.split(g[b].getAttribute("value")),f&&(f.match("E_")?this.spaceParams.push({name:f,
value:e}):f.match("C_")?this.ctrsParams.push({name:f,value:e}):f.match("A_")?this.auxParams.push({name:f,value:e}):f.match("G_")?this.graphParams.push({name:f,value:e}):f.match("S_")?this.graph3DParams.push({name:f,value:e}):"Animation"==babel[f]?this.animParams.push({name:f,value:e}):this.sceneParams.push({name:babel[f]||f,value:babel[g[b].getAttribute("value")]||g[b].getAttribute("value")}));for(var k,p,b=0,c=this.auxParams.length;b<c;b++){for(var a=this.auxParams[b].value,g=f=k=p=!1,n=0,q=a.length;n<
q;n++)e=babel[a[n][0]],"id"==e&&a[n][1].match(/\)$/)&&(f=!0),"algorithm"==e&&(g=!0),"event"==e&&(p=!0),"constant"==e&&(k=!0);g&&!f||k||p?this.progParams.push(this.auxParams[b]):this.defParams.push(this.auxParams[b])}};a.Editor.prototype.configDescartesTabs=function(){function d(){var a=this.parentNode.getAttribute("data-current");document.getElementById("tabHeader_"+a).removeAttribute("class");document.getElementById("tab_"+a).style.display="none";a=this.id.split("_")[1];this.setAttribute("class",
"tabActiveHeader");document.getElementById("tab_"+a).style.display="block";this.parentNode.setAttribute("data-current",a)}this.DescartesTabsContainer=document.createElement("div");this.DescartesTabsContainer.setAttribute("class","DescartesEditorTabContainer");this.DescartesTabsContainer.innerHTML="<div class='DescartesTabs'>\n<ul>\n<li id='tabHeader_1'>Configuraci&oacute;n</li>\n<li id='tabHeader_2'>Espacios</li>\n<li id='tabHeader_3'>Controles</li>\n<li id='tabHeader_4'>Definiciones</li>\n<li id='tabHeader_5'>Programa</li>\n<li id='tabHeader_6'>Gr&aacute;ficos</li>\n<li id='tabHeader_7'>Gr&aacute;ficos 3D</li>\n<li id='tabHeader_8'>Animaci&oacute;n</li>\n</ul>\n</div>\n<div class='DescartesTabscontent'>\n<div class='DescartesTabPage' id='tab_1'></div>\n<div class='DescartesTabPage' id='tab_2'></div>\n<div class='DescartesTabPage' id='tab_3'></div>\n<div class='DescartesTabPage' id='tab_4'></div>\n<div class='DescartesTabPage' id='tab_5'></div>\n<div class='DescartesTabPage' id='tab_6'></div>\n<div class='DescartesTabPage' id='tab_7'></div>\n<div class='DescartesTabPage' id='tab_8'></div>\n</div>\n<div class='DescartesButtonsPlace'>\n<input id='Descartes_OKButton' class='DescartesEditorButton' type='submit' value='Aceptar' />\n<input id='Descartes_CancelButton' class='DescartesEditorButton' type='submit' value='Cancelar' />\n</div>\n";
var b=this.DescartesTabsContainer.querySelector(".DescartesTabs ul li"),c=b.id.split("_")[1];b.parentNode.setAttribute("data-current",c);b.setAttribute("class","tabActiveHeader");c=this.DescartesTabsContainer.querySelectorAll(".DescartesTabPage");for(b=1;b<c.length;b++)c[b].style.display="none";c=this.DescartesTabsContainer.querySelectorAll(".DescartesTabs ul li");for(b=0;b<c.length;b++)c[b].addEventListener("click",d);this.container.appendChild(this.DescartesTabsContainer);this.configPanel=new a.EditorConfigPanel(this);
this.spacePanel=new a.EditorSpacePanel(this);this.controlPanel=new a.EditorControlPanel(this);this.definitionPanel=new a.EditorDefinitionPanel(this);this.programPanel=new a.EditorProgramPanel(this);this.graphicPanel=new a.EditorGraphicPanel(this);this.graphic3DPanel=new a.EditorGraphic3DPanel(this);this.animationPanel=new a.EditorAnimationPanel(this);var e=this;document.getElementById("Descartes_OKButton").addEventListener("click",function(a){a.preventDefault();this.blur();e.hide();console.log("ok")});
document.getElementById("Descartes_CancelButton").addEventListener("click",function(a){a.preventDefault();this.blur();e.hide();console.log("cancel")})};a.Editor.prototype.configDescartesParamList=function(){this.configToolbar();this.configListContainer();this.configFooter();this.configAddPanel()};a.Editor.prototype.configToolbar=function(){function d(a){f.showAddPanel()}function b(a){f.removeAttribute()}function c(a){f.cloneAttribute()}function e(a){f.moveUpAttribute()}function g(a){f.moveDownAttribute()}
var f=this,k=document.createElement("div");k.setAttribute("class","DescartesToolbarPlace");var p=this.newButton("Agregar"),n=this.newButton("Remover"),q=this.newButton("Duplicar"),s=this.newButton("Subir"),t=this.newButton("Bajar");k.appendChild(p);k.appendChild(n);k.appendChild(q);k.appendChild(s);k.appendChild(t);this.container.appendChild(k);a.hasTouchSupport?(p.addEventListener("touchend",d),n.addEventListener("touchend",b),q.addEventListener("touchend",c),s.addEventListener("touchend",e),t.addEventListener("touchend",
g)):(p.addEventListener("click",d),n.addEventListener("click",b),q.addEventListener("click",c),s.addEventListener("click",e),t.addEventListener("click",g))};a.Editor.prototype.configListContainer=function(){function d(a){var c=null;"li"==a.target.tagName.toLowerCase()?c=a.target:"li"==a.target.parentNode.tagName.toLowerCase()&&(c=a.target.parentNode);c&&(b.wichParamSelected&&(b.wichParamSelected.className=b.wichParamSelected.className.replace(/(?:^|\s)DescartesElementSelected(?!\S)/g,"")),b.wichParamSelected=
c,c.className+=" DescartesElementSelected")}var b=this;this.listContainer=document.createElement("div");this.listContainer.setAttribute("class","DescarteslistContainer");this.container.appendChild(this.listContainer);var c=document.createElement("div");c.setAttribute("class","DescartesExtraInfo");c.innerHTML="&lt;script type='text/javascript' src='http://arquimedes.matem.unam.mx/Descartes5/lib/descartes-min.js'&gt;&lt;/script&gt;";this.listContainer.appendChild(c);this.configPanel=new a.EditorConfigPanel(this);
this.spacePanel=new a.EditorSpacePanel(this);this.controlPanel=new a.EditorControlPanel(this);this.definitionPanel=new a.EditorDefinitionPanel(this);this.programPanel=new a.EditorProgramPanel(this);this.graphicPanel=new a.EditorGraphicPanel(this);this.graphic3DPanel=new a.EditorGraphic3DPanel(this);this.animationPanel=new a.EditorAnimationPanel(this);c=document.createElement("div");c.setAttribute("class","DescartesExtraInfo");c.innerHTML="&lt;/ajs&gt;";this.listContainer.appendChild(c);this.wichParamSelected=
null;a.hasTouchSupport?this.listContainer.addEventListener("touchend",d):this.listContainer.addEventListener("click",d)};a.Editor.prototype.configFooter=function(){function d(a){a.preventDefault();this.blur();var b=c.configPanel.getContent()+c.spacePanel.getContent()+c.controlPanel.getContent()+c.definitionPanel.getContent()+c.programPanel.getContent()+c.graphicPanel.getContent()+c.graphic3DPanel.getContent()+c.animationPanel.getContent();a=document.createElement("ajs");b=b.split("\n");a.innerHTML=
b[0];a=a.firstChild;b[0]="";a.innerHTML=b.join("\n");c.parent.applet.parentNode.replaceChild(a,c.parent.applet);c.parent.applet=a;c.parent.children=a.getElementsByTagName("param");c.parent.width=parseFloat(a.getAttribute("width"));c.parent.height=parseFloat(a.getAttribute("height"));c.hide();c.parent.init()}function b(a){a.preventDefault();this.blur();c.hide()}var c=this,e=document.createElement("div");e.setAttribute("class","DescartesButtonsPlace");var g=this.newButton("Aceptar"),f=this.newButton("Cancelar");
e.appendChild(g);e.appendChild(f);this.container.appendChild(e);a.hasTouchSupport?(f.addEventListener("touchend",b),g.addEventListener("touchend",d)):(f.addEventListener("click",b),g.addEventListener("click",d))};a.Editor.prototype.configAddPanel=function(){function d(a){f.previousAddSelected&&(f.previousAddSelected.className=f.previousAddSelected.className.replace(/(?:^|\s)DescartesElementSelected(?!\S)/g,""));f.previousAddSelected=a.target;a.target.className+=" DescartesElementSelected";f.addOptionValue=
a.target.getAttribute("data-index")}function b(a){a.preventDefault();this.blur();f.hideAddPanel();f.addAttribute()}function c(a){a.preventDefault();this.blur();f.hideAddPanel()}var f=this;this.addPanelContainer=document.createElement("div");this.addPanelContainer.setAttribute("class","DescartesEditorContainer");this.addPanelContainer.style.background="rgba(20,20,20,.75)";this.container.appendChild(this.addPanelContainer);var g=document.createElement("div");g.setAttribute("class","DescarteslistContainer DescartesAddPanel");
this.addPanelContainer.appendChild(g);var r=document.createElement("ul");g.appendChild(r);for(var k=0,p=e.length;k<p;k++)g=document.createElement("li"),g.setAttribute("style","-webkit-user-select:none; -moz-user-select:none; user-select:none; cursor:pointer;"),g.setAttribute("data-index",k),g.innerHTML=e[k],r.appendChild(g);this.addOptionValue=-1;this.previousAddSelected=null;a.hasTouchSupport?r.addEventListener("touchend",d):r.addEventListener("click",d);r=document.createElement("div");r.setAttribute("class",
"DescartesButtonsPlace");g=this.newButton("Aceptar");k=this.newButton("Cancelar");r.appendChild(g);r.appendChild(k);this.addPanelContainer.appendChild(r);a.hasTouchSupport?(g.addEventListener("touchend",b),k.addEventListener("touchend",c)):(g.addEventListener("click",b),k.addEventListener("click",c));this.hideAddPanel()};a.Editor.prototype.addAttribute=function(){var a=parseInt(this.addOptionValue);0<=a&&(this.wichParamSelected&&(this.wichParamSelected.className=this.wichParamSelected.className.replace(/(?:^|\s)DescartesElementSelected(?!\S)/g,
"")),0<=a&&3>a?this.wichParamSelected=this.spacePanel.add(f[a]):3<=a&&12>a?this.wichParamSelected=this.controlPanel.add(f[a]):12<=a&&16>a?this.wichParamSelected=this.definitionPanel.add(f[a]):16<=a&&19>a?this.wichParamSelected=this.programPanel.add(f[a]):19<=a&&31>a?this.wichParamSelected=this.graphicPanel.add(f[a]):31<=a&&a<f.length-1?this.wichParamSelected=this.graphic3DPanel.add(f[a]):this.animationPanel.add());this.wichParamSelected&&(this.listContainer.scrollTop=this.wichParamSelected.offsetTop);
this.addOptionValue=-1;this.previousAddSelected&&(this.previousAddSelected.className=this.previousAddSelected.className.replace(/(?:^|\s)DescartesElementSelected(?!\S)/g,""))};a.Editor.prototype.removeAttribute=function(){var a;this.wichParamSelected&&(a=this.wichParamSelected.parentNode,a!=this.configPanel.ulContainer&&(a==this.spacePanel.ulContainer?this.spacePanel.remove(parseInt(this.wichParamSelected.getAttribute("data-index"))):a==this.controlPanel.ulContainer?this.controlPanel.remove(parseInt(this.wichParamSelected.getAttribute("data-index"))):
a==this.definitionPanel.ulContainer?this.definitionPanel.remove(parseInt(this.wichParamSelected.getAttribute("data-index"))):a==this.programPanel.ulContainer?this.programPanel.remove(parseInt(this.wichParamSelected.getAttribute("data-index"))):a==this.graphicPanel.ulContainer?this.graphicPanel.remove(parseInt(this.wichParamSelected.getAttribute("data-index"))):a==this.graphic3DPanel.ulContainer?this.graphic3DPanel.remove(parseInt(this.wichParamSelected.getAttribute("data-index"))):this.animationPanel.remove()))};
a.Editor.prototype.cloneAttribute=function(){var a;this.wichParamSelected&&(a=this.wichParamSelected.parentNode,a==this.spacePanel.ulContainer?this.wichParamSelected=this.spacePanel.clone(parseInt(this.wichParamSelected.getAttribute("data-index"))):a==this.controlPanel.ulContainer?this.wichParamSelected=this.controlPanel.clone(parseInt(this.wichParamSelected.getAttribute("data-index"))):a==this.definitionPanel.ulContainer?this.wichParamSelected=this.definitionPanel.clone(parseInt(this.wichParamSelected.getAttribute("data-index"))):
a==this.programPanel.ulContainer?this.wichParamSelected=this.programPanel.clone(parseInt(this.wichParamSelected.getAttribute("data-index"))):a==this.graphicPanel.ulContainer?this.wichParamSelected=this.graphicPanel.clone(parseInt(this.wichParamSelected.getAttribute("data-index"))):a==this.graphic3DPanel.ulContainer&&(this.wichParamSelected=this.graphic3DPanel.clone(parseInt(this.wichParamSelected.getAttribute("data-index")))))};a.Editor.prototype.moveUpAttribute=function(){var a;this.wichParamSelected&&
(a=this.wichParamSelected.parentNode,a==this.spacePanel.ulContainer?this.wichParamSelected=this.spacePanel.moveUp(parseInt(this.wichParamSelected.getAttribute("data-index")))||this.wichParamSelected:a==this.controlPanel.ulContainer?this.wichParamSelected=this.controlPanel.moveUp(parseInt(this.wichParamSelected.getAttribute("data-index")))||this.wichParamSelected:a==this.definitionPanel.ulContainer?this.wichParamSelected=this.definitionPanel.moveUp(parseInt(this.wichParamSelected.getAttribute("data-index")))||
this.wichParamSelected:a==this.programPanel.ulContainer?this.wichParamSelected=this.programPanel.moveUp(parseInt(this.wichParamSelected.getAttribute("data-index")))||this.wichParamSelected:a==this.graphicPanel.ulContainer?this.wichParamSelected=this.graphicPanel.moveUp(parseInt(this.wichParamSelected.getAttribute("data-index")))||this.wichParamSelected:a==this.graphic3DPanel.ulContainer&&(this.wichParamSelected=this.graphic3DPanel.moveUp(parseInt(this.wichParamSelected.getAttribute("data-index")))||
this.wichParamSelected))};a.Editor.prototype.moveDownAttribute=function(){var a;this.wichParamSelected&&(a=this.wichParamSelected.parentNode,a==this.spacePanel.ulContainer?this.wichParamSelected=this.spacePanel.moveDown(parseInt(this.wichParamSelected.getAttribute("data-index")))||this.wichParamSelected:a==this.controlPanel.ulContainer?this.wichParamSelected=this.controlPanel.moveDown(parseInt(this.wichParamSelected.getAttribute("data-index")))||this.wichParamSelected:a==this.definitionPanel.ulContainer?
this.wichParamSelected=this.definitionPanel.moveDown(parseInt(this.wichParamSelected.getAttribute("data-index")))||this.wichParamSelected:a==this.programPanel.ulContainer?this.wichParamSelected=this.programPanel.moveDown(parseInt(this.wichParamSelected.getAttribute("data-index")))||this.wichParamSelected:a==this.graphicPanel.ulContainer?this.wichParamSelected=this.graphicPanel.moveDown(parseInt(this.wichParamSelected.getAttribute("data-index")))||this.wichParamSelected:a==this.graphic3DPanel.ulContainer&&
(this.wichParamSelected=this.graphic3DPanel.moveDown(parseInt(this.wichParamSelected.getAttribute("data-index")))||this.wichParamSelected))};a.Editor.prototype.newButton=function(a){var b=document.createElement("input");b.setAttribute("class","DescartesEditorButton");b.setAttribute("type","submit");b.setAttribute("value",a);return b};a.Editor.prototype.showAddPanel=function(){this.addPanelContainer.style.display="block";this.addPanelContainer.firstChild.style.left=(parseInt(window.innerWidth)-350)/
2+"px"};a.Editor.prototype.hideAddPanel=function(){this.addPanelContainer.style.display="none"};return a}(descartesJS||{}),descartesJS=function(a){if(a.loadLib)return a;var e;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 b=a.image_loader?a.image_loader:h(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("+b+"); 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=Math.floor(80);this.barHeight=Math.floor(a.loader.height/70);var c=this;this.timer=setInterval(function(){c.drawLoaderBar(c.loaderBar.ctx,a.width,a.height)},10);a.firstRun=!1;this.initPreloader()};a.DescartesLoader.prototype.initPreloader=function(){var b=this.children,c=this.images,d=this.audios,e=/[\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 h,s,t,m,u,l;t=0;for(u=b.length;t<u;t++)if("rtf"!==b[t].name){if(b[t].value.match(/'macro'|'makro'/g)){h="";var v;s=this.lessonParser.split(b[t].value);l=0;for(var w=s.length;l<w;l++)"expresion"===babel[s[l][0]]&&(h=s[l][1]);h&&((v=document.getElementById(h))&&
"descartes/macro"==v.type?v=v.text:(v=a.openExternalFile(h))&&!v.match(/tipo_de_macro/g)&&(v=null));if(v&&(h=v.match(e)))for(l=h.length;m<l;m++)s=h[m],s.toLowerCase().match(/vacio.gif$/)||""==s.substring(0,s.length-4)||(c[s]=new Image,c[s].addEventListener("load",function(){this.ready=1}),c[s].addEventListener("error",function(){this.errorload=1}),c[s].src=s)}if(h=b[t].value.match(e))for(m=0,l=h.length;m<l;m++)s=h[m],s.toLowerCase().match(/vacio.gif$/)||""==s.substring(0,s.length-4)||(c[s]=new Image,
c[s].addEventListener("load",function(){this.ready=1}),c[s].addEventListener("error",function(){this.errorload=1}),c[s].src=s);if(h=b[t].value.match(f))for(m=0,s=h.length;m<s;m++)this.initAudio(h[m])}for(var y in c)c.hasOwnProperty(y)&&this.images.length++;for(y in d)d.hasOwnProperty(y)&&this.audios.length++;var C=this,B=this.images.length+this.audios.length,D=function(){C.readys=0;for(var a in c)c.hasOwnProperty(a)&&(c[a].ready||c[a].errorload)&&C.readys++;for(a in C.audios)d.hasOwnProperty(a)&&
(d[a].ready||d[a].errorload)&&C.readys++;C.readys!=B?setTimeout(D,30):(clearTimeout(C.timer),C.descartesApp.initBuildApp())};D()};a.DescartesLoader.prototype.initAudio=function(b){var c=this.audios;c[b]=new Audio(b);c[b].filename=b;var d=function(){this.ready=1},e=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",d),c[b].addEventListener("load",d),c[b].addEventListener("error",e),c[b].load())};c[b].addEventListener("canplaythrough",d);c[b].addEventListener("load",d);c[b].addEventListener("error",e);a.hasTouchSupport?(c[b].load(),c[b].play(),setTimeout(function(){console.log("detenido");c[b].pause()},10),c[b].ready=1):c[b].load()};var f,d,b,c;a.DescartesLoader.prototype.drawLoaderBar=function(a,h,k){f=this.barWidth;
d=this.barHeight;b=this.images.length+this.audios.length;c=2*(f-2)/b;a.translate(h/2,(k-65*e)/2+90*e);a.scale(e,e);a.strokeRect(-f,-d,2*f,d);a.fillStyle="gray";a.fillRect(-f+2,-d+2,2*(f-2),d-4);a.fillStyle="#1f375d";a.fillRect(-f+2,-d+2,this.readys*c,d-4);a.setTransform(1,0,0,1,0,0)};var h=function(a,b){var c=document.createElement("canvas");c.width=a;c.height=b;var d=c.getContext("2d");d.save();d.strokeStyle="#1f375d";d.fillStyle="#1f375d";d.lineCap="round";d.lineWidth=2;d.beginPath();e=a<b?a/360:
b/195;e=2.5<e?2.5:e;d.translate((a-120*e)/2,(b-65*e)/2);d.scale(e,e);d.moveTo(3,25);d.lineTo(3,1);d.lineTo(21,1);d.bezierCurveTo(33,1,41,15,41,25);d.stroke();d.beginPath();d.moveTo(1,63);d.lineTo(1,64);d.moveTo(5,62);d.lineTo(5,64);d.moveTo(9,61);d.lineTo(9,64);d.moveTo(13,60);d.lineTo(13,64);d.moveTo(17,58);d.lineTo(17,64);d.moveTo(21,56);d.lineTo(21,64);d.moveTo(25,53);d.lineTo(25,64);d.moveTo(29,50);d.lineTo(29,64);d.moveTo(33,46);d.lineTo(33,64);d.moveTo(37,41);d.lineTo(37,64);d.moveTo(41,32);
d.lineTo(41,64);d.stroke();d.font="20px Arial, Helvetica, 'Droid Sans', Sans-serif";d.fillText("escartes",45,33);d.fillText("JS",98,64);d.restore();return c.toDataURL()};return a}(descartesJS||{}),descartesJS=function(a){function e(a){for(var b="[",c=0,h=a.length;c<h;c++)a[c]instanceof Array?b+=e(a[c]):(f=a[c],"undefined"!=typeof f&&f||(f=0),"string"==typeof f&&(f="'"+f+"'"),b+=f),c<h-1&&(b+=",");return b+"]"}if(a.loadLib)return a;a.DescartesApp=function(d){this.animation={playing:!1,stop:function(){}};
this.applet=d;this.parentContainer=d.parentNode;this.width=parseFloat(d.getAttribute("width"));this.height=parseFloat(d.getAttribute("height"));this.decimal_symbol=".";this.decimal_symbol_regexp=RegExp("\\"+this.decimal_symbol,"g");this.language="espa\u00f1ol";this.children=d.getElementsByTagName("param");a.creativeCommonsLicense=!0;for(var b=0,c=this.children.length;b<c;b++)"CreativeCommonsLicense"==this.children[b].name&&(a.creativeCommonsLicense="no"==this.children[b].value?!1:!0);this.code=d.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/2.5/es/}, si no se indica lo contrario.\\par                                        La unidad did\u00e1ctica fue creada con Arqu\u00edmedes, que es un producto de c\u00f3digo abierto, {\\*\\hyperlink Creditos|http://arquimedes.matem.unam.mx/Descartes5/creditos/conCCL.html}\\par }":
"";for(var d=this.children,b,c=0,e=0,f=a.creativeCommonsLicense?90:0,r=0,k=d.length;r<k;r++)b=d[r],"rtf_height"==b.name&&(c=parseInt(b.value)),"Buttons"==babel[b.name]&&(this.buttonsConfig=this.lessonParser.parseButtonsConfig(b.value),e=this.buttonsConfig.height),"image_loader"==b.name&&(this.image_loader=b.value),"docBase"==b.name&&(this.docBase=b.value,b=document.createElement("base"),b.setAttribute("id","descartesJS_base"),b.setAttribute("href",this.docBase),document.head.appendChild(b));this.arquimedes&&
c&&(this.height=c+e+f);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.firstRun?this.descartesLoader=new a.DescartesLoader(this):this.initBuildApp()};a.DescartesApp.prototype.initBuildApp=function(){for(var d=
this.children,b=this.lessonParser,c=[],e=[],f=[],r=[],k=[],p=[],n,q=0,s=d.length;q<s;q++)if(n=d[q],"language"==babel[n.name]&&(this.language=n.value),"pleca"==n.name)n=b.parsePleca(n.value,this.width),this.container.insertBefore(n,this.loader),this.plecaHeight=n.imageHeight?n.imageHeight:n.offsetHeight;else if("Buttons"==babel[n.name])this.buttonsConfig=b.parseButtonsConfig(n.value);else if("decimal_symbol"==babel[n.name])this.decimal_symbol=n.value,this.decimal_symbol_regexp=RegExp("\\"+this.decimal_symbol,
"g");else if("version"==babel[n.name])this.version=parseInt(n.value);else if("language"==babel[n.name])this.language=n.value;else if("rtf"==n.name){var t=(this.width-780)/2,m=parseInt(this.height)-this.plecaHeight-this.buttonsConfig.height-45;r.push("space='descartesJS_scenario' type='text' expresion='[10,20]' background='yes' text='"+n.value.replace(/'/g,"&squot;")+"'");r.push("space='descartesJS_scenario' type='text' expresion='["+t+","+(m-25)+"]' background='yes' text='"+this.licenseA+"'");a.creativeCommonsLicense&&
r.push("space='descartesJS_scenario' type='image' expresion='["+(t+15)+","+m+"]' background='yes' abs_coord='yes' file='lib/DescartesCCLicense.png'")}else"E"==n.name.charAt(0)?(n.value.match(/'HTMLIFrame'/)&&this.numberOfIframes++,c.push(n.value)):"C"==n.name.charAt(0)&&"_"==n.name.charAt(1)?e.push(n.value):"A"==n.name.charAt(0)&&"_"==n.name.charAt(1)?f.push(n.value):"G"==n.name.charAt(0)?r.push(n.value):"S"==n.name.charAt(0)?k.push(n.value):"Animation"==babel[n.name]&&p.push(n.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));q=0;for(s=c.length;q<s;q++)d=b.parseSpace(c[q]),this.arquimedes&&this.scenarioRegion.container.appendChild(d.container),this.spaces.push(d),this.zIndex++;q=0;for(s=r.length;q<s;q++)if(c=b.parseGraphic(r[q]))c.visible&&(this.editableRegionVisible=!0),c.space.addGraph(c);q=0;for(s=k.length;q<s;q++)(c=b.parse3DGraphic(k[q]))&&c.space.addGraph(c,!0);q=0;for(s=e.length;q<s;q++)this.controls.push(b.parseControl(e[q]));q=0;for(s=f.length;q<s;q++)b.parseAuxiliar(f[q]);
q=0;for(s=p.length;q<s;q++)this.animation=b.parseAnimation(p[q]);this.configRegions();this.updateAuxiliaries();this.updateAuxiliaries();q=0;for(s=this.controls.length;q<s;q++)this.controls[q].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.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"},"*"),a.onResize());window.opener&&window.opener.postMessage({type:"isResizeNeeded",href:window.location.href},"*");this.externalSpace.init()};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 d=parseInt(this.width)+30,b=parseInt(this.height)+90;window.moveTo((parseInt(screen.width)-d)/2,(parseInt(screen.height)-b)/2);window.resizeTo(d,b);a.onResize()};a.DescartesApp.prototype.adjustDimensions=function(){console.log("jiodjsaoidjaosi");var a,b,c;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);b=parseInt(this.parentContainer.offsetWidth);a=this.init_w;c=b/a;a>b?(this.parentContainer!=
document.body&&(this.parentContainer.style.height=this.init_h*c+"px"),this.percent=c,this.container.style.webkitTransform=this.container.style.MozTransform="scale("+c+")",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 d=this.evaluator.parser,b=this.buttonsConfig,c=this.container;if(2!=this.version)var e="15",f=100,r=100,k=100,p=100;else e="14",f=63,r=50,k=44,p=53;var n=0,q=0,s=0,t=s=0,m=0,u=0,l=0,v=0,u=this.northSpace.controls,w=this.southSpace.controls,y=this.eastSpace.controls,C=this.westSpace.controls;if(0<b.rowsNorth||0<u.length||b.about||b.config){0>=b.rowsNorth?(n=b.height,b.rowsNorth=1):n=b.height*b.rowsNorth;m=this.northSpace.container;m.setAttribute("id",
"descartesJS_northRegion");m.setAttribute("style","width:"+c.width+"px; height:"+n+"px; background:#c0c0c0; position:absolute; left:0px; top: "+this.plecaHeight+"px; z-index:100;");c.insertBefore(m,this.loader);var m=c.width,B=0;b.about?(B=f,m-=B):f=0;b.config&&(m-=r);for(var D=Math.ceil(u.length/b.rowsNorth),E=m/D,s=0,z=u.length;s<z;s++)u[s].expresion=d.parse("("+(B+s%D*E)+","+b.height*Math.floor(s/D)+","+E+","+b.height+")"),u[s].drawif=d.parse("1"),u[s].init();b.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:d.parse(e),expresion:d.parse("(0, 0, "+f+", "+n+")")}),s.actionExec={execute:a.showAbout},s.update());b.config&&(new a.Button(this,{region:"north",name:"config",font_size:d.parse(e),action:"config",expresion:d.parse("("+(m+f)+", 0, "+r+", "+n+")")})).update()}if(0<b.rowsSouth||0<w.length||b.init||b.clear){0>=b.rowsSouth?(q=b.height,b.rowsSouth=1):q=b.height*b.rowsSouth;u=c.width;B=
0;b.init?(B=k,u-=B):k=0;b.clear&&(u-=p);m=this.southSpace.container;m.setAttribute("id","descartesJS_southRegion");m.setAttribute("style","width:"+c.width+"px; height:"+q+"px; background:#c0c0c0; position:absolute; left: 0px; top:"+(c.height-q)+"px; z-index:100;");c.insertBefore(m,this.loader);D=Math.ceil(w.length/b.rowsSouth);E=u/D;s=0;for(z=w.length;s<z;s++)w[s].expresion=d.parse("("+(B+s%D*E)+","+b.height*Math.floor(s/D)+","+E+","+b.height+")"),w[s].drawif=d.parse("1"),w[s].init();b.init&&(s="espa\u00f1ol"==
this.language?"inicio":"english"==this.language?"init":"inicio",(new a.Button(this,{region:"south",name:s,font_size:d.parse(e),action:"init",expresion:d.parse("(0, 0, "+k+", "+q+")")})).update());b.clear&&(s="espa\u00f1ol"==this.language?"limpiar":"english"==this.language?"clear":"limpiar",(new a.Button(this,{region:"south",name:s,font_size:d.parse(e),action:"clear",expresion:d.parse("("+(u+k)+", 0, "+p+", "+q+")")})).update())}if(0<y.length)for(s=c.height-n-q,l=b.widthEast,m=this.eastSpace.container,
m.setAttribute("id","descartesJS_eastRegion"),m.setAttribute("style","width:"+l+"px; height:"+s+"px; background:#c0c0c0; position:absolute; left:"+(c.width-l)+"px; top:"+n+"px; z-index:100;"),c.insertBefore(m,this.loader),s=0,z=y.length;s<z;s++)y[s].expresion=d.parse("(0,"+b.height*s+","+l+","+b.height+")"),y[s].drawif=d.parse("1"),y[s].init();if(0<C.length)for(s=c.height-n-q,v=b.widthWest,m=this.westSpace.container,m.setAttribute("id","descartesJS_westRegion"),m.setAttribute("style","width: "+v+
"px; height: "+s+"px; background: #c0c0c0; position: absolute; left: 0px; top: "+n+"px; z-index: 100;"),c.insertBefore(m,this.loader),s=0,z=C.length;s<z;s++)C[s].expresion=d.parse("(0,"+b.height*s+","+v+","+b.height+")"),C[s].drawif=d.parse("1"),C[s].init();if(this.editableRegionVisible)for(t=b.height,m=this.editableRegion.container,m.setAttribute("id","descartesJS_editableRegion"),m.setAttribute("style","width:"+c.width+"px; height:"+t+"px; position:absolute; left:0px; top:"+(c.height-q-b.height)+
"px; z-index:100; background:#c0c0c0; overflow:hidden;"),c.insertBefore(m,this.loader),d=this.editableRegion.textFields,b=c.width/d.length,e=a.getFieldFontSize(t),s=0,z=d.length;s<z;s++)"div"==d[s].type?(m.appendChild(d[s].container),d[s].container.setAttribute("style","font-family: Arial, Helvetica, 'Droid Sans', Sans-serif; width: "+(b-4)+"px; height: "+t+"px; position: absolute; left: "+s*b+"px; top: 0px;"),f=d[s].container.firstChild,f.setAttribute("style","font-family: Arial, Helvetica, 'Droid Sans', Sans-serif; font-size: "+
e+"px; padding-top: 0%; background-color: #e0e4e8; position: absolute; left: 0px; top: 0px; height:"+t+"px; text-align: center; line-height: "+t+"px;"),r=f.offsetWidth,f.style.width=r+"px",f.firstChild.textContent=f.firstChild.textContent.substring(3,f.firstChild.textContent.length-3),d[s].container.lastChild.setAttribute("style","font-family:'Courier New', Courier, 'Droid Sans Mono', Monospace; font-size: "+e+"px; width:"+(b-r)+"px; height:"+t+"px; position:absolute; left:"+r+"px; top:0px; border:2px groove white;")):
(m.appendChild(d[s]),d[s].setAttribute("style","font-family:'Courier New', Courier, 'Droid Sans Mono', Monospace; font-size: "+e+"px; width:"+b+"px; height:"+t+"px; position:absolute; left:"+s*b+"px; top:0px; border:2px groove white;"));this.displaceRegionNorth=n;this.displaceRegionWest=v;c.width-=l;c.height=c.height-q-t;s=0;for(z=this.spaces.length;s<z;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,b=this.spaces.length;a<b;a++)this.spaces[a].clearClick()};a.DescartesApp.prototype.deactivateGraphiControls=function(){for(var a,b=0,c=this.controls.length;b<c;b++)a=this.controls[b],"graphic"==a.type&&a.deactivate()};a.DescartesApp.prototype.updateAuxiliaries=function(){for(var a=0,b=this.auxiliaries.length;a<b;a++)this.auxiliaries[a].update()};a.DescartesApp.prototype.updateEvents=function(){for(var a=0,b=this.events.length;a<
b;a++)this.events[a].update()};a.DescartesApp.prototype.updateControls=function(){for(var a=0,b=this.controls.length;a<b;a++)this.controls[a].update()};a.DescartesApp.prototype.updateSpaces=function(a){for(var b=0,c=this.spaces.length;b<c;b++)this.spaces[b].update(a)};a.DescartesApp.prototype.clear=function(){for(var a=0,b=this.spaces.length;a<b;a++)this.spaces[a].spaceChange=!0,this.spaces[a].drawBackground&&this.spaces[a].drawBackground()};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.play()};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 b=this.images;if(a)return b[a]||(b[a]=new Image,b[a].addEventListener("load",
function(){this.ready=1}),b[a].addEventListener("error",function(){this.errorload=1}),b[a].src=a),b[a]};a.DescartesApp.prototype.getAudio=function(a){var b=this.audios;if(a){if(!b[a]){var c=a.lastIndexOf("."),c=-1===c?a.lenght:c;a.substring(0,c);b[a]=new Audio(a);var e=function(a){this.ready=1};b[a].addEventListener("canplaythrough",e);var f=function(c){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):(b[a]=new Audio(a.replace("mp3","ogg")),b[a].addEventListener("canplaythrough",e),b[a].addEventListener("load",e),b[a].addEventListener("error",f),b[a].load())};b[a].addEventListener("error",f);b[a].play();setTimeout(function(){b[a].pause()},15)}return b[a]}return new Audio};a.DescartesApp.prototype.getControlByCId=function(a){for(var b,c=0,e=this.controls.length;c<e;c++)if(b=this.controls[c],b.cID==a)return b;return{update:function(){},w:0}};a.DescartesApp.prototype.getControlById=function(a){for(var b,
c=0,e=this.controls.length;c<e;c++)if(b=this.controls[c],b.id==a)return b;return{update:function(){}}};a.DescartesApp.prototype.getSpaceByCId=function(a){for(var b,c=0,e=this.spaces.length;c<e;c++)if(b=this.spaces[c],b.cID==a)return b;return{update:function(){},w:0}};a.DescartesApp.prototype.getSpaceById=function(a){for(var b,c=0,e=this.spaces.length;c<e;c++)if(b=this.spaces[c],b.id==a)return b;return{update:function(){},w:0}};var f;a.DescartesApp.prototype.getState=function(){var a,b="",c=this.evaluator.variables,
f;for(f in c)c.hasOwnProperty(f)&&(a=c[f],"string"==typeof a&&(a="'"+a+"'"),void 0!=a&&"rnd"!=f&&"pi"!=f&&"e"!=f&&"Infinity"!=f&&"-Infinity"!=f&&"object"!=typeof a&&(b=""!=b?b+"\n"+f+"="+a:f+"="+a));var c=this.evaluator.vectors,g;for(g in c)c.hasOwnProperty(g)&&(a=c[g],b=b+"\n"+g+"="+e(a));g=this.evaluator.matrices;for(var r in g)g.hasOwnProperty(r)&&(a=g[r],b=b+"\n"+r+"="+e(a));return b};a.DescartesApp.prototype.setState=function(a,b){for(var c=a.split("\n"),e,f,r=0,k=c.length;r<k;r++)e=c[r].split("="),
2<=e.length&&(f=eval(e[1]),-1!=e[1].indexOf("[[")?(this.evaluator.matrices[e[0]]=f,this.evaluator.matrices[e[0]].rows=f.length,this.evaluator.matrices[e[0]].cols=f[0].length):-1!=e[1].indexOf("[")?(this.evaluator.vectors[e[0]]=f,this.evaluator.variables[e[0]+".long"]=f.length):this.evaluator.variables[e[0]]=f);b||this.update()};a.DescartesApp.prototype.getEvaluation=function(){for(var a=0,b=0,c="",e=0,f=this.controls.length;e<f;e++)"textfield"==this.controls[e].gui&&this.controls[e].evaluate&&(a++,
b+=this.controls[e].ok,this.controls[e].value=""==this.controls[e].value?"''":this.controls[e].value,c+=" \\n "+this.controls[e].id+"="+this.controls[e].value+"|"+this.controls[e].ok);return"questions="+a+" \\n correct="+b+" \\n wrong="+(a-b)+c};a.DescartesApp.prototype.showSolution=function(){for(var a=this.controls,b=0,c=a.length;b<c;b++)"textfield"==a[b].gui&&a[b].evaluate&&a[b].changeValue(a[b].getFirstAnswer());this.update()};a.DescartesApp.prototype.showAnswer=function(){for(var a=0,b=this.saveState.length;a<
b;a++)this.evaluator.evalExpression(this.saveState[a]);this.update()};return a}(descartesJS||{}),descartesJS=function(a){function e(){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 f(d){a.getFeatures();
if(a.hasCanvasSupport){window.scrollTo(0,10);d=document.getElementsByTagName("*");for(var b=[],c=0,e=d.length;c<e;c++)"DescartesAppContainer"==d[c].className&&b.push(d[c]);c=0;for(e=b.length;c<e;c++)b[c].parentNode.removeChild(b[c]);b=document.getElementsByTagName("applet");c=document.getElementsByTagName("ajs");d=[];for(var f=0,r=b.length;f<r;f++)e=b[f],(e.getAttribute("code").match("DescartesJS")||e.getAttribute("code").match("descinst.DescartesWeb2_0.class")||e.getAttribute("code").match("Descartes")||
e.getAttribute("code").match("Arquimedes")||e.getAttribute("code").match("Discurso"))&&d.push(e);f=0;for(r=c.length;f<r;f++)e=c[f],(e.getAttribute("code").match("DescartesJS")||e.getAttribute("code").match("descinst.DescartesWeb2_0.class")||e.getAttribute("code").match("Descartes")||e.getAttribute("code").match("Arquimedes")||e.getAttribute("code").match("Discurso"))&&d.push(e);b=0;for(c=d.length;b<c;b++)a.apps.push(new a.DescartesApp(d[b])),d[b].className="DescartesJS";window.addEventListener("resize",
a.onResize);window.scrollTo(0,2);document.body.setAttribute("tabIndex",1E6)}else document.getElementById("StyleDescartesApps").innerHTML="applet.DescartesJS {display:block;} applet {display:block;} ajs.DescartesJS {display:block;} ajs {display:block;}"}if(a.loadLib)return a;a.apps=[];a.getDescartesApps=function(){return a.apps};window.hasOwnProperty("debugDescartesJS")&&debugDescartesJS||e();a.onResize=function(d){for(var b=0,c=a.apps.length;b<c;b++){d=a.apps[b].spaces;for(var e=0,f=d.length;e<f;e++)d[e].findOffset()}};
a.receiveMessage=function(d){if(0<a.apps.length){var b=d.data;if(b)if("set"===b.type)"string"==typeof b.value||"number"==typeof b.value?a.apps[0].evaluator.setVariable(b.name,b.value):b.value&&void 0!=b.value.rows?a.apps[0].evaluator.matrices[b.name]=b.value:a.apps[0].evaluator.vectors[b.name]=b.value;else if("update"===b.type)a.apps[0].update();else if("exec"===b.type){d=a.apps[0].evaluator.getFunction(b.name);var c=[];""!==b.value&&(c=b.value.toString().split(","));d&&d.apply(a.apps[0].evaluator,
c)}else"isResizeNeeded"===b.type?d.source.postMessage({type:"doResize"},"*"):"doResize"===b.type&&0<a.apps.length&&a.apps[0].adjustSize()}};void 0==a.loadLib&&(a.loadLib=!0,window.addEventListener("load",f),window.addEventListener("message",a.receiveMessage));return a}(descartesJS||{});
