/*
 Joel Espinosa Longi
 jlongi@im.unam.mx
 https://github.com/jlongi/DescartesJS
 LGPL - http://www.gnu.org/licenses/lgpl.html
 2023-10-18
*/
var babel=function(a){if(a.loadLib)return a;a.loadLib=!0;a.no=a.ez=a.non=a["n\u00e3o"]=a.falso=a["false"]=a.fals=a.gezurra=a.faux=a.fals="false";a["s\u00ed"]=a.yes=a.bai=a.oui=a.si=a.sim=a.verdadero=a["true"]=a.veritable=a.egia=a.vrai=a.verdadeiro=a.veritable="true";a.negro=a.black=a.negre=a.beltza=a.noir=a.preto=a["#000000"]="#000000";a.maxenta=a.magenta=a["#ff00ff"]="#ff00ff";a.azul=a.blue=a.blau=a.urdina=a.bleu=a["#0000ff"]="#0000ff";a.turquesa=a.cyan=a.turkesa=a.turquoise=a["#00ffff"]="#00ffff";
a.verde=a.green=a.verd=a.berdea=a.vert=a["#00ff00"]="#00ff00";a.amarillo=a.yellow=a.groc=a.horia=a.jaune=a.amarelo=a["#ffff00"]="#ffff00";a.naranja=a.orange=a.taronja=a.laranja=a.laranxa=a["#ffc800"]="#ffc800";a.rojo=a.red=a.vermell=a.gorria=a.rouge=a.vermello=a.vermelho=a["#ff0000"]="#ff0000";a.pink=a.rosa=a.arrosa=a.rose=a["#ffafaf"]="#ffafaf";a.grisObscuro=a.darkGray=a.grisFosc=a["gris iluna"]=a.grisObscur=a.grisEscuro=a.cinzaEscuro=a["#404040"]="#404040";a.gris=a.gray=a.grisa=a.cinza=a["#808080"]=
"#808080";a.grisClaro=a.lightGray=a.grisClar=a["gris argia"]=a.grisClair=a.cinzaClaro=a["#c0c0c0"]="#c0c0c0";a.blanco=a.white=a.blanc=a.zuria=a.branco=a["#ffffff"]="#ffffff";a.escala=a.scale=a.eskala=a["\u00e9chelle"]="scale";a.nombre=a.name=a.nom=a.izena=a.nome="name";a.ikusgai=a["vis\u00edvel"]=a.visible="visible";a.rastro=a.trace=a.rastre=a.arrastoa="trace";a.fondo=a.background=a.fons=a.hondoa=a.fond=a.fundo="background";a["par\u00e1metro"]=a.parameter=a.parametroa=a["par\u00e2metro"]=a["par\u00e0metre"]=
"parameter";a["sucesi\u00f3n"]=a.sequence=a["successi\u00f3"]=a.segida=a.succession=a["seq\u00fc\u00eancia"]="sequence";a["tama\u00f1o"]=a.size=a.neurria=a.taille=a.tamanho=a["grand\u00e0ria"]="size";a.decimales=a.decimals=a.hamartarra=a["d\u00e9cimales"]=a.decimais="decimals";a.red=a.net=a.xarxa=a.sarea=a["r\u00e9seau"]=a.rede=a.malha="net";a.red10=a.net10=a.xarxa10=a.sarea10=a["r\u00e9seau10"]=a.rede10=a.malha10="net10";a.ejes=a.axes=a.eixos=a.ardatzak=a.eixes="axes";a["cr\u00e9ditos"]=a.about=
a["cr\u00e8dits"]=a.kreditoak=a["cr\u00e9dits"]=a.sobre="about";a.config=a.konfig=a["configura\u00e7\u00e3o"]="config";a.inicio=a.init=a.inici=a.hasiera=a.commencement=a["in\u00edcio"]="init";a.limpiar=a.clear=a.neteja=a.ezabatu=a.nettoye=a.limpar="clear";a.incr=a.gehi=a.incremento="incr";a.min=a.inf="min";a.max=a.sup=a["m\u00e1x"]="max";a.relleno=a.fill=a.ple=a.betea=a.plein=a.recheo=a.preencher="fill";a["relleno+"]=a["fill+"]=a["ple+"]=a["betea+"]=a["plein+"]=a["recheo+"]=a["preencher+"]=a.fillP=
"fillP";a["relleno-"]=a["fill-"]=a["ple-"]=a["betea-"]=a["plein-"]=a["recheo-"]=a["preencher-"]=a.fillM="fillM";a.flecha=a.arrow=a.fletxa=a.gezia=a["fl\u00e8che"]=a.frecha=a.seta="arrow";a.punta=a.spear=a.muturra=a.pointe=a.ponta="spear";a["regi\u00f3n"]=a.region=a["regi\u00f3"]=a.eskualde=a["r\u00e9gion"]=a["rexi\u00f3n"]=a["regi\u00e3o"]="region";a.norte=a.north=a.nord=a.ipar="north";a.sur=a.south=a.sud=a.hego=a.sul="south";a.este=a.east=a.est=a.ekialde=a.leste="east";a.oeste=a.west=a.oest=a.hegoalde=
a.ouest="west";a.exterior=a.external=a.kanpoalde=a.externo="external";a["expresi\u00f3n"]=a.expresion=a["expresi\u00f3"]=a.adierazpen=a["express\u00e3o"]="expresion";a.tipo=a.type=a.tipus=a.mota="type";a["posici\u00f3n"]=a.position=a["posici\u00f3"]=a.posizio=a["posi\u00e7\u00e3o"]="position";a["constricci\u00f3n"]=a.constraint=a["constricci\u00f3"]=a.beharte=a.constriction=a["constrici\u00f3n"]=a["restri\u00e7\u00e3o"]="constraint";a.valor=a.value=a.balio=a.valeur="value";a["ecuaci\u00f3n"]=a.equation=
a["equaci\u00f3"]=a.ekuazio=a["\u00e9quation"]=a["equa\u00e7\u00e3o"]="equation";a.curva=a.curve=a.corba=a.kurba=a.courbe="curve";a.texto=a.text=a.testu=a.texte=a.testua="text";a.punto=a.point=a.punt=a.puntu=a.ponto=a.dot="point";a.segmento=a.segment=a.zuzenki="segment";a.arco=a.arc=a.arku="arc";a["pol\u00edgono"]=a.polygon=a["pol\u00edgon"]=a.poligono=a.polygone="polygon";a.imagen=a.image=a.imatge=a.irudi=a.imaxe=a.imagem=a.bg_image=a.irudia=a.imagem_de_fundo=a.irundia="image";a["Versi\u00f3n"]=
a.Version=a["Versi\u00f3"]=a["Vers\u00e3o"]=a.version="version";a.Idioma=a.Language=a.Hizkuntza=a.Langue=a.language="language";a["O.x"]="O.x";a["O.y"]="O.y";a.Botones=a.Buttons=a.Botons=a.Botoiak=a.Boutons=a["Bot\u00f3ns"]=a["Bot\u00f5es"]=a.Botons="Buttons";a["Animaci\u00f3n"]=a.Animation=a["Animaci\u00f3"]=a.Animazio=a["Anima\u00e7\u00e3o"]="Animation";a.constante=a.constant=a.Konstante="constant";a.fuente=a.font=a.iturri=a.source=a.fonte="font";a["num\u00e9rico"]=a.numeric=a["num\u00e8ric"]=a.zenbakizko=
a["num\u00e9rique"]="numeric";a["gr\u00e1fico"]=a.graphic=a["gr\u00e0fic"]=a.grafiko=a.graphique="graphic";a.hacer=a["do"]=a.fer=a.egin=a.faire=a.facer=a.fazer=a.doExpr="doExpr";a.mientras=a["while"]=a.mentre=a.bitartean=a["tandis que"]=a.mentres=a.enquanto=a.whileExpr="whileExpr";a.evaluar=a.evaluate=a.avalua=a.ebaluatu=a["\u00e9valuer"]=a.avaliar="evaluate";a.variable=a.aldagaia=a["vari\u00e1vel"]="variable";a["funci\u00f3n"]=a["function"]=a["funci\u00f3"]=a.funtzio=a.fonction=a["fun\u00e7\u00e3o"]=
"function";a.algoritmo=a.algorithm=a.algorisme=a.algorithme="algorithm";a.vector=a.array=a.bektore=a.vecteur=a.matriz="array";a["dibujar-si"]=a["draw-if"]=a["marraztu-baldin"]=a["dessiner-si"]=a["debuxar-se"]=a["desenhar-se"]=a["dibuixa-si"]=a.drawif="drawif";a.dominio=a.range=a.domini=a["izate-eremua"]=a.domain=a["dom\u00ednio"]="range";a.pausa=a.delay=a.eten="delay";a["eje-x"]=a["x-axis"]=a["eix-x"]=a["x-ardatza"]=a["axe-x"]=a["eixe-x"]=a["eixo-x"]=a.x_axis="x_axis";a["eje-y"]=a["y-axis"]=a["eix-y"]=
a["y-ardatza"]=a["axe-y"]=a["eixe-y"]=a["eixo-y"]=a.y_axis="y_axis";a["n\u00fameros"]=a.numbers=a.nombres=a.zenbakiak="numbers";a["exponencial-si"]=a["exponential-if"]=a["esponentzial-baldin"]=a["exponentiel-si"]=a["exponencial-se"]=a.exponentialif="exponentialif";a.familia=a.family=a["fam\u00edlia"]=a.famille="family";a.intervalo=a.interval=a.tarte=a.intervalle="interval";a.pasos=a.steps=a.passos=a.pausoak=a.pas="steps";a.centro=a.center=a.centre=a.zentro="center";a.radio=a.radius=a.radi=a.erradio=
a.rayon=a.raio="radius";a.fin=a.end=a.fi=a.bukaera=a.fim="end";a["una-sola-vez"]=a["only-once"]=a["una-sola-vegada"]=a["behin-bakarrik"]=a["une-seule-fois"]=a["unha-soa-vez"]=a["apenas-uma-vez"]=a.onlyOnce="onlyOnce";a.siempre=a.always=a.sempre=a.beti=a.toujours="always";a["color-int"]=a["int-colour"]=a["barruko-kolore"]=a["couleur-int"]=a["cor-int"]=a.colorInt="colorInt";a.repetir=a.loop=a.repeteix=a.errepikatu=a["r\u00e9p\u00e9ter"]="loop";a.controles=a.controls=a.kontrolak=a["contr\u00f4les"]=
a.controis="controls";a.animar=a.animate=a.anima=a.animatu=a.animer="animate";a.auto="auto";a.y=a.top="y";a.espacio=a.space=a.espai=a.espazio=a.espace=a.espazo=a["espa\u00e7o"]="space";a.Nu="Nu";a.Nv="Nv";a.alto=a.height=a.alt=a.altu=a.haut=a.altura=a["al\u00e7ada"]=a.hauteur=a.alto="height";a.ancho=a.depth=a.amplada=a.zabalera=a.largeur=a.profundidade=a.amplada=a.width=a.ample=a.large=a.largura="width";a.largo=a.length=a.llargada=a.luzera=a.longueur=a.longo=a.comprimento=a.llargada="length";a.color_reverso=
a.backcolor=a.color_revers=a["atzealde kolorea"]=a.couleur_revers=a.cor_reverso=a.cor_de_fundo="backcolor";a.aristas=a.edges=a.arestes=a.ertzak=a["ar\u00eates"]=a.arestas="edges";a.rotini=a.inirot="inirot";a.posini=a.inipos="inipos";a["tri\u00e1ngulo"]=a.triangle=a.hirukia=a["tri\u00e2ngulo"]="triangle";a.cara=a.face=a.aurpegi="face";a.polireg=a.regpoly=a["pol\u00edgonoRegular"]="polireg";a.superficie=a.surface=a["superf\u00edcie"]=a.azalera="surface";a.cubo=a.cube=a.cub=a.kubo="cube";a["paralelep\u00edpedo"]=
a.box=a["paral\u00b7lelep\u00edpede"]=a.paralelepipedo=a["parall\u00e9l\u00e9pip\u00e8de"]="box";a.cono=a.cone=a.con=a.kono=a["c\u00f4ne"]="cone";a.cilindro=a.cylinder=a.cilindre=a.zilindro=a.cylindre="cylinder";a.esfera=a.sphere=a["sph\u00e8re"]="sphere";a.tetraedro=a.tetrahedron=a.tetraedre=a["t\u00e9tra\u00e8dre"]="tetrahedron";a.octaedro=a.octahedron=a.octaedre=a.oktaedro=a["octa\u00e8dre"]="octahedron";a.dodecaedro=a.dodecahedron=a.dodecaedre=a.dodekaedro=a["dod\u00e9ca\u00e8dre"]="dodecahedron";
a.icosaedro=a.icosahedron=a.icosaedre=a.ikosaedro=a["icosa\u00e8dre"]="icosahedron";a.elipsoide=a.ellipsoid=a["el\u00b7lipsoide"]=a["ellipso\u00efde"]=a["elips\u00f3ide"]="ellipsoid";a.macro=a.makro="macro";a.id="id";a.modelo=a.model=a.eredu=a["mod\u00e8le"]="model";a.color=a.kolore=a.couleur=a.cor=a.colour=a.kolorea="color";a.luz=a.light=a.llum=a.argia=a["lumi\u00e8re"]="light";a.metal=a.metall=a["m\u00e9tal"]="metal";a.alambre=a.wire=a.filferro=a.alanbre=a["fil de fer"]=a.arame="wire";a.cortar=
a.split=a.talla=a.moztu=a.couper=a.dividir="split";a.despliegue=a.render=a.desplegament=a.zabaltze=a["d\u00e8ploiement"]=a.despregamento=a.processar="render";a.orden=a.sort=a.ordre=a.ordena=a.orde=a.ordenar="sort";a.pintor=a.painter=a.margolari=a.peintre="painter";a["trazado de rayos"]=a["ray trace"]=a["tra\u00e7at de raigs"]=a["izpi trazadura"]=a["trace de rayons"]=a["trazado de raios"]=a["tra\u00e7ado de raios"]=a.raytrace="raytrace";a.despl_imagen=a.bg_display=a.despl_imatge=a["irudi desplazamendu"]=
a.despl_image=a.despr_imaxe=a["apresenta\u00e7\u00e3o_de_imagem"]="bg_display";a["arr-izq"]=a.topleft=a["dalt-esq"]=a["goi-ezk"]=a["au-dessus-gau"]=a["arr-esq"]=a["acima-esquerda"]="topleft";a["expand."]=a.stretch=a.hedatu=a["expandir "]="stretch";a.mosaico=a.patch=a.mosaic=a.mosaiko=a["mosa\u00efque"]="patch";a.centrada=a.zentratu=a["centr\u00e9e"]=a.centrado=a.imgcenter="imgcenter";a.archivo=a.file=a.fitxer=a.artxibo=a.fichier=a.arquivo="file";a.filas_norte=a.rows_north=a.files_nord=a["HTML kodea"]=
a.files_nord=a.filas_norte=a.linhas_norte=a.files_nord=a.rowsNorth="rowsNorth";a.filas_sur=a.rows_south=a.files_sud=a.ipar_lerro=a.files_sud=a.filas_sur=a.linhas_sul=a.files_sud=a.rowsSouth="rowsSouth";a.ancho_este=a.width_east=a.ample_est=a.hego_lerro=a.ample_est=a.ancho_leste=a.largura_leste=a.ample_est=a.widthEast="widthEast";a.ancho_oeste=a.width_west=a.ample_oest=a.ekialde_zabalera=a.ample_ouest=a.ancho_oeste=a.largura_oeste=a.ample_oest=a.widthWest="widthWest";a.fijo=a.fixed=a.fix=a.hegoalde_zabalera=
a.fixe=a.fixo="fixed";a["Reiniciar Animaci\u00f3n"]=a["Init Animation"]=a["Reinicia Animaci\u00f3"]=a.finko=a["Recommencer l'Animation"]=a["Reiniciar Anima\u00e7\u00e3o"]=a.initAnimation="initAnimation";a["Explicaci\u00f3n"]=a.Explanation=a.Azalpena=a.Explication=a["Explica\u00e7\u00e3o"]=a["Explicaci\u00f3"]="Explanation";a.tooltip=a.dica="tooltip";a.discreto=a.discrete=a.discret=a.diskretu="discrete";a.interfaz=a.gui=a["interf\u00edcie"]=a.interfaze=a["interface"]="gui";a.pulsador=a.spinner=a.polsador=
a.pultsadore=a.bouton="spinner";a["campo de texto"]=a.textfield=a["camp de text"]=a["testu esarrua"]=a["champ de texte"]="textfield";a["men\u00fa"]=a.choice=a.menu=a.escolha="menu";a.barra=a.scrollbar=a.barre="scrollbar";a.opciones=a.options=a.opcions=a.aukerak=a["opci\u00f3ns"]=a["op\u00e7\u00f5es"]="options";a.interior=a.barruko=a["int\u00e9rieur"]="interior";a["condici\u00f3n"]=a.condition=a["condici\u00f3"]=a.baldintza=a["condi\u00e7\u00e3o"]="condition";a["acci\u00f3n"]=a.action=a["acci\u00f3"]=
a.ekintza=a["a\u00e7\u00e3o"]="action";a.evento=a.event=a.esdeveniment=a.gertaera=a["\u00e9v\u00e9nement"]="event";a["abrir URL"]=a["open URL"]=a["obre URL"]=a["URL zabaldu"]=a["ouvrir URL"]=a.openURL="openURL";a["abrir Escena"]=a["open Scene"]=a["obre Escena"]=a["eszena zabaldu"]=a["ouvrir Escena"]=a["abrir Cena"]=a.openScene="openScene";a["bot\u00f3n"]=a.button=a["bot\u00f3"]=a.botoi=a.bouton=a["bot\u00e3o"]="button";a.mensaje=a.message=a.mezua=a.mensaxe=a.mensagem=a.missatge="message";a.alternar=
a.alternate=a.alterna=a.txandakatu=a.alterner="alternate";a["ejecuci\u00f3n"]=a.execution=a["execuci\u00f3"]=a.gauzatze=a["ex\u00e9cution"]=a["execuci\u00f3n"]=a["execu\u00e7\u00e3o"]="execution";a.calcular=a.calculate=a.calcula=a.kalkulatu=a.calculer="calculate";a.coord_abs=a.abs_coord=a.koor_abs="abs_coord";a.negrita=a.bold=a.negreta=a.lodi=a["caract\u00e8re gras"]=a.negra=a.negrito="bold";a.cursiva=a.italics=a.etzana=a.italique=a["it\u00e1lico"]="italics";a.subrayada=a.underlined=a.subratllat=
a.azpimarratua=a.soulignement=a["subli\u00f1ada"]=a.sublinhado="underlined";a.pos_mensajes=a.msg_pos=a.pos_missatges=a.mezuen_pos=a.pos_messages=a.pos_mensaxes="msg_pos";a.izquierda=a.left=a.esquerra=a.eskerrean=a.gauche=a.esquerda=a.esquerda=a.esquerra=a.x="x";a.derecha=a.right=a.dreta=a.eskuinan=a.droite=a.dereita=a.direita=a.dreta="right";a["sensible_a_los_movimientos_del_rat\u00f3n"]=a.sensitive_to_mouse_movements=a["sensible_als_moviments_del_ratol\u00ed"]=a["xagu mugimenduarekiko sentikorra"]=
a.sensible_aux_mouvements_du_souris=a.sensible_aos_movementos_do_rato=a["sens\u00edvel_aos_movimentos_do_mouse"]="sensitive_to_mouse_movements";a.reproducir=a.play=a.reprodueix=a.erreproduzitu=a.reproduire=a.reproduzir=a.playAudio="playAudio";a["activo-si"]=a["active-if"]=a["actiu-si"]=a["altiboa-baldin"]=a["actif-si"]=a["activo-se"]=a["ativo-se"]=a.activeif="activeif";a.rotfin=a.finrot=a.bukrot=a.endrot="endrot";a.posfin=a.finpos=a.bukpos=a.endpos="endpos";a.editable=a.editagarria=a["edit\u00e1vel"]=
"editable";a.R2="2D";a.R3="3D";a.vectores=a.bektoreak=a.vecteurs=a.vetores=a.vectors="vectors";a["fuente puntos"]=a["font size"]=a["font punts"]=a["puntu iturria"]=a["source points"]=a["fonte puntos"]=a["fonte pontos"]=a.font_size="font_size";a.escenario=a.scenario=a.escenari=a.agertoki=a["sc\u00e8ne"]=a["cen\u00e1rio"]="scenario";a.cID="cID";a.matriz=a.matrix=a.matriu=a.matrice="matrix";a.filas=a.rows=a.files="rows";a.columnas=a.columns=a.colonnes="columns";a.solo_texto=a.only_text=a.seulement_texte=
a["s\u00f3_texto"]=a.tan_sols_texte=a.onlyText="onlyText";a.respuesta=a.answer="answer";a.peso=a.weight=a.pes="weight";a.decimal_symbol=a["signo decimal"]=a["decimal symbol"]="decimal_symbol";a.info="info";a.library="library";a.color_contorn_text=a.color_text_border=a.color_borde_texto=a.muga_testuaren_kolorea=a.couleur_contour_texte=a.cor_borde_texto=a.colore_bordo_testo=a.cor_borda_texto=a.color_contorn_text=a.border="border";a.video=a["vid\u00e9o"]="video";a.audio=a["\u00e0udio"]="audio";a.autoplay=
"autoplay";a.poster="poster";a.opacidad=a.opacity=a["opacit\u00e9"]=a.opacitat=a.opacidade="opacity";a.alinear=a.align=a["ali\u00f1ar"]=a.aligner="align";a.anchor="anchor";a.a_left="left";a.a_center="center";a.a_right="right";a.a_justify="justify";a.a_top_left="top_left";a.a_top_center="top_center";a.a_top_right="top_right";a.a_center_left="center_left";a.a_center_center="center_center";a.a_center_right="center_right";a.a_bottom_left="bottom_left";a.a_bottom_center="bottom_center";a.a_bottom_right=
"bottom_right";a.malla=a.mesh="mesh";a.local=a.Local="local";a.rectangle=a["rect\u00e1ngulo"]="rectangle";a.lineDash="lineDash";a.solid="solid";a.dot="dot";a.dash="dash";a.dash_dot="dash_dot";a.offset_dist="offset_dist";a.offset_angle="offset_angle";a.flat="flat";a.borderColor="borderColor";a.text_align="text_align";a.image_align="image_align";a.checkbox="checkbox";a.torus=a.toro="torus";a.R="R";a.r="r";a.border_radius="border_radius";a.radio_group="radio_group";a.font_family="font_family";a.resizable=
"resizable";a.antialias="antialias";a.image_loader="image_loader";a.expand="expand";a.cover=a.cubrir="cover";a.fit=a.escalar="fit";a.code="code";a.doc="doc";a.image_dec="image_dec";a.image_inc="image_inc";a.btn_pos="btn_pos";a.border_width="border_width";a.border_color="border_color";a.v_left="v_left";a.v_right="v_right";a.h_left="h_left";a.h_right="h_right";a.h_left_right="h_left_right";a.label_color="label_color";a.label_text_color="label_text_color";a.shadowColor="shadowColor";a.shadowBlur="shadowBlur";
a.shadowOffsetX="shadowOffsetX";a.shadowOffsetY="shadowOffsetY";a.border_size="border_size";a.clip="clip";a.keyboard="keyboard";a.kblayout="kblayout";a.kbexp="kbexp";a.extra_style="extra_style";return a}(babel||Object.create(null)),descartesJS=function(a){if(a.loadLib)return a;a.arimoBFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.arimoBIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.arimoIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.arimoRFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.cousineBFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.cousineBIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.cousineIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.cousineRFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.tinosBFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.tinosBIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.tinosIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.tinosRFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.mathBFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.mathRFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.addFonts=function(){return"@font-face{font-family:'DJS_sansserif';src:url('"+a.arimoBFont()+"') format('woff2');font-style:normal;font-weight:bold;}\n@font-face{font-family:'DJS_sansserif';src:url('"+a.arimoBIFont()+"') format('woff2');font-style:italic;font-weight:bold;}\n@font-face{font-family:'DJS_sansserif';src:url('"+a.arimoIFont()+"') format('woff2');font-style:italic;font-weight:normal;}\n@font-face{font-family:'DJS_sansserif';src:url('"+a.arimoRFont()+"') format('woff2');font-style:normal;font-weight:normal;}\n@font-face{font-family:'DJS_monospace';src:url('"+
a.cousineBFont()+"') format('woff2');font-style:normal;font-weight:bold;}\n@font-face{font-family:'DJS_monospace';src:url('"+a.cousineBIFont()+"') format('woff2');font-style:italic;font-weight:bold;}\n@font-face{font-family:'DJS_monospace';src:url('"+a.cousineIFont()+"') format('woff2');font-style:italic;font-weight:normal;}\n@font-face{font-family:'DJS_monospace';src:url('"+a.cousineRFont()+"') format('woff2');font-style:normal;font-weight:normal;}\n@font-face{font-family:'DJS_serif';src:url('"+
a.tinosBFont()+"') format('woff2');font-style:normal;font-weight:bold;}\n@font-face{font-family:'DJS_serif';src:url('"+a.tinosBIFont()+"') format('woff2');font-style:italic;font-weight:bold;}\n@font-face{font-family:'DJS_serif';src:url('"+a.tinosIFont()+"') format('woff2');font-style:italic;font-weight:normal;}\n@font-face{font-family:'DJS_serif';src:url('"+a.tinosRFont()+"') format('woff2');font-style:normal;font-weight:normal;}\n@font-face{font-family:'DJS_math';src:url('"+a.mathBFont()+"') format('woff2');font-style:normal;font-weight:bold;}\n@font-face{font-family:'DJS_math';src:url('"+
a.mathBFont()+"') format('woff2');font-style:italic;font-weight:bold;}\n@font-face{font-family:'DJS_math';src:url('"+a.mathRFont()+"') format('woff2');font-style:italic;font-weight:normal;}\n@font-face{font-family:'DJS_math';src:url('"+a.mathRFont()+"') format('woff2');font-style:normal;font-weight:normal;}\n"};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.symbolFont=function(){return"data:font/woff2;charset=utf-8;base64, "};a.addSymbolFont=
function(){return`@font-face{font-family:'DJS_symbol';src:url('${a.symbolFont()}') format('woff2');font-style:normal;font-weight:bold;}
@font-face{font-family:'DJS_symbol';src:url('${a.symbolFont()}') format('woff2');font-style:italic;font-weight:bold;}
@font-face{font-family:'DJS_symbol';src:url('${a.symbolFont()}') format('woff2');font-style:italic;font-weight:normal;}
@font-face{font-family:'DJS_symbol';src:url('${a.symbolFont()}') format('woff2');font-style:normal;font-weight:normal;}`};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var p,k,f,v={bold:"Bold",italic:"Italic",italics:"Italic","bold+italic":"Italic Bold"};a.serif_font="descartesJS_serif,DJS_symbol,DJS_serif,Times,'Times New Roman','Liberation Serif','Nimbus Roman No9 L Regular',serif";a.sansserif_font="descartesJS_sansserif,DJS_symbol,DJS_sansserif,Helvetica,Arial,'Liberation Sans','Nimbus Sans L',sans-serif";a.monospace_font="descartesJS_monospace,DJS_symbol,DJS_monospace,'Courier New',Courier,'Liberation Mono','Nimbus Mono L',monospace";
a.math_font="descartesJS_math,DJS_symbol,DJS_math,DJS_serif,Times,'Times New Roman','Liberation Serif','Nimbus Roman No9 L Regular',serif";a.convertFont=function(q){if(""==q)return"";p=q.split(",");k="";k+=a.getFontStyle(p[1])+" ";k+=p[2]+"px ";return k+=a.getFontName(p[0].split(" ")[0])};a.getFontName=function(q){q=q.toLowerCase();f=a.monospace_font;if("serif"===q||"times new roman"===q||"timesroman"===q||"times"===q)f=a.serif_font;else if("sansserif"===q||"arial"===q||"helvetica"===q)f=a.sansserif_font;
return f};a.getFontStyle=function(q){return v[q.toLowerCase()]||""};a.getTextWidth=function(q,d){a.ctx.font=d;return Math.round(a.ctx.measureText(q).width)};a.getFieldFontSize=function(q){q=Math.min(50,q);return q=24<=q?Math.floor(q/2+2-q/16):20<=q?12:17<=q?11:15<=q?10:9};return a}(descartesJS||{});
descartesJS=function(a){function p(){var b,g,r,l,m,z,u;Number.prototype.oToFixed=Number.prototype.toFixed;Number.prototype.toFixed=function(e=0){e=Math.max(0,parseInt(e));b=this.toString();-1!==b.indexOf("e")&&(l=b.split("e"),z="-"===l[0][0]?"-":"",m="-"===z?parseFloat(l[0].substring(1)).oToFixed(11):parseFloat(l[0]).oToFixed(11),u=parseInt(l[1]),g=m.indexOf("."),m=m.replace(".",""),0>g+u?(g=0>g?1:g,b=z+"0."+"0".repeat(Math.abs(g+u))+m):b=z+m+"0".repeat(u-m.length+1));g=b.indexOf(".");-1===g?0<e&&
(b+="."+"0".repeat(e)):(r=b.length-g-1,b=r>=e?11>=e?parseFloat(b).oToFixed(e):b.substring(0,g+e+1):b+"0".repeat(e-r));return b}}if(a.loadLib)return a;const k=2*Math.PI,f=Math.floor;var v;let q;var d,n;a.rangeOK=1;a.cssScale=1;a.radToDeg=function(b){return 360/k*b};a.degToRad=function(b){return k/360*b};a.drawLine=function(b,g,r,l,m,z="black",u=1){b.lineWidth=u;b.strokeStyle=z;n=b.lineWidth%2*.5;b.beginPath();b.moveTo(f(g)+n,f(r)+n);b.lineTo(f(l)+n,f(m)+n);b.stroke()};a.getColor=function(b,g){if("string"===
typeof g)return g;v=b.eval(g);return`rgba(${f(255*v[0][0])},${f(255*v[0][1])},${f(255*v[0][2])},${1-v[0][3]})`};a.getFeatures=function(){var b=navigator.appVersion.toLowerCase();a.hasTouchSupport=window.hasOwnProperty&&window.hasOwnProperty("ontouchstart")||"ontouchstart"in window||/android/i.test(b);a.isIOS=/iPad|iPhone/i.test(navigator.userAgent);a.isMsEdge=/Edge/i.test(navigator.userAgent);b=a.newHTML("canvas");a.hasCanvas=b.getContext&&b.getContext("2d");a.hasCanvas&&(b.width=b.height=1,a.ctx=
a.hasCanvas,a._ratio=2);p()};var h,c;a.removeNeedlessDecimals=function(b){if("string"==typeof b&&(h=b.indexOf("."),-1!==h)){c=b.substring(h);if(0==parseFloat(c))return b.substring(0,h);for(var g=c.length-1;0<g;g--)if("0"!==c.charAt(g))return b.substring(0,h+g+1)}return b};a.returnValue=function(b){return"number"===typeof b?parseFloat(b.toFixed(11)):b};a.whichBtn=function(b){return b.touches?"L":0===b.button?"L":1===b.button?"M":"R"};a.createGradient=function(b=0,g=100,r=0){r=`linear-gradient(${r}deg,`;
for(var l=2*b,m=b;m<g;m++)b=f(100-m-35),r+=`rgba(0,0,0,${b*b*192/1E4/255}) ${2*m-l}%, `;return r+"rgba(0,0,0,0.1) 100%)"};a.getCursorPosition=function(b,g){q=b.touches?b.touches[0]:b;d=g.getBoundingClientRect();return q?{x:(q.pageX-window.pageXOffset-d.left)/a.cssScale,y:(q.pageY-window.pageYOffset-d.top)/a.cssScale}:null};a.splitSeparator=function(b){b=b.replace(/\\n/g,"\n");for(var g=!1,r,l=[],m=0,z=0,u=b.length;z<u;z++)r=b.charAt(z),"'"===r&&(g=!g),g||";"!==r&&"\n"!==r||(l.push(b.substring(m,z).replace(/\n/g,
"\\n")),m=z+1);l.push(b.substring(m).replace(/\n/g,"\\n"));return l};a.preventDefault=function(b){b.preventDefault();return!1};a.convertHTMLEntities=function(b){let g=a.newHTML("textarea");g.innerHTML=b;return g.value};a.newHTML=function(b,g){b=document.createElement(b);for(let r in g)b.setAttribute(r,g[r]);return b};window.requestAnimationFrame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame;window.cancelAnimationFrame=
window.cancelAnimationFrame||window.mozCancelAnimationFrame;a.setInterval=function(b,g){function r(){Date.now()-l>=g&&(b.call(),l=Date.now());m.value=requestAnimationFrame(r)}if(!requestAnimationFrame)return setInterval(b,g);var l=Date.now(),m={};m.value=requestAnimationFrame(r);return m};a.clearInterval=function(b){b&&(cancelAnimationFrame?cancelAnimationFrame(b.value):clearInterval(b))};a.setTimeout=function(b,g){function r(){Date.now()-l>=g?b.call():m.value=requestAnimationFrame(r)}if(!requestAnimationFrame)return setTimeout(b,
g);var l=Date.now(),m={};m.value=requestAnimationFrame(r);return m};a.clearTimeout=function(b){b&&(cancelAnimationFrame?cancelAnimationFrame(b.value):clearTimeout(b))};a.showAbout=function(){var b="<html>\n<head>\n<style>\nbody{text-align:center;}\niframe{width:650px;height:73px;overflow:hidden;border:1px solid black;}\ndt{font-weight:bold;margin-top:10px;}\n</style>\n</head>\n<body>\n<iframe src='https://arquimedes.matem.unam.mx/Descartes5/creditos/bannerPatrocinadores.html'></iframe>\n<h2><a href='https://proyectodescartes.org/' target='_blank'>ProyectoDescartes.org</a><br><a href='https://descartesjs.org' target='_blank'>DescartesJS.org</a></h2>\n<dl>\n<dt>Dise\u00f1o funcional:</dt>\n<dd>\n<nobr>Jos\u00e9 Luis Abreu Leon,</nobr>\n<nobr>Jos\u00e9 R. Galo Sanchez,</nobr>\n<nobr>Juan Madrigal Muga</nobr>\n</dd>\n<dt>Autores del software:</dt>\n<dd>\n<nobr>Jos\u00e9 Luis Abreu Leon,</nobr>\n<nobr>Marta Oliver\u00e1 Serrat,</nobr>\n<nobr>Oscar Escamilla Gonz\u00e1lez,</nobr>\n<nobr>Joel Espinosa Longi</nobr>\n</dd></dl>\n<p>\nEl software en Java est\u00e1 bajo la licencia\n<a href='https://joinup.ec.europa.eu/software/page/eupl/licence-eupl'>EUPL v.1.1</a>\n<br>\nEl software en JavaScript est\u00e1 bajo licencia\n<a href='https://www.gnu.org/licenses/lgpl.html'>LGPL</a>\n</p>\n<p>\nLa documentaci\u00f3n y el c\u00f3digo fuente se encuentran en :\n<br>\n<a href='https://descartes.matem.unam.mx/'>https://descartes.matem.unam.mx/</a>\n</p>";
a.ccLicense&&(b+="<p>\nEste objeto, creado con Descartes, est\u00e1 licenciado\npor sus autores como\n<a href='https://creativecommons.org/licenses/by-nc-sa/4.0/deed.es'><nobr>Creative Commons</nobr></a>\n<br>\n<a href='https://creativecommons.org/licenses/by-nc-sa/4.0/deed.es'><img src='https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png'></a>\n</p>");b+="</body> </html>";var g=window.open("","creditos","width=700,height=500,titlebar=0,toolbar=0,location=0,menubar=0,resizable=0,scrollbars=0,status=0");
g.document.write(b);g.document.close()};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.cacheFiles=Object.create(null);a.openExternalFile=function(p){if(a.cacheFiles[p])return a.cacheFiles[p];var k=null,f=new XMLHttpRequest;f.open("GET",p,!1);try{f.send(null),k=200===f.status||304===f.status?f.responseText:f.responseText||"",k=404===f.status?"":k,k.match(String.fromCharCode(65533))&&(f.open("GET",p,!1),f.overrideMimeType("text/plain;charset=ISO-8859-1"),f.send(null),k=f.responseText)}catch(v){k=null}return k};a.addExternalFileContent=function(p,
k){a.cacheFiles[p]=k};return a}(descartesJS||{});
descartesJS=function(a){function p(m,z,u){z=parseFloat(z);n=m.expr[0];h=m.expr[1];c=u.eval(n.expr);b=u.eval(h.expr);g="("==n.type||"["==n.type;r=")"==h.type||"]"==h.type;return g&&z>c&&r&&z<=b?1:0}function k(m){return m.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 f,v,q,d,n,h,c,b,g,r,l;a.buildRegularExpressionsPatterns=function(m,z){m=m||"";"("===m.charAt(0)&&")"===m.charAt(m.length-1)&&-1===m.indexOf(",")&&(m=m.substring(1,m.length-1));m=m.replace(/&squot;/g,"'").replace(/&amp;/g,"&").split("|");for(var u=0,e=m.length;u<e;u++){v=m[u].split("&");q=[];for(var w=0,B=v.length;w<B;w++)if(f=v[w],-1===f.indexOf(",")||"("!==f.charAt(0)&&"["!==f.charAt(0)||")"!==f.charAt(f.length-1)&&"]"!==f.charAt(f.length-1)){var y=q,A=y.push,x=f;l=
x.indexOf("--radial--");-1!=l&&(x=x.substring(0,l));x=x.replace(/\+/g,"\\+").replace(/\*/g,"\\*");f=x.trim();x={ignoreAccents:!1,ignoreCaps:!1,regExp:null};f[0]==f[f.length-1]&&"'"==f[0]&&(x.ignoreCaps=!0,f=f.substring(1,f.length-1),"`"==f[0]&&"\u00b4"==f[f.length-1]&&(x.ignoreAccents=!0,f=f.substring(1,f.length-1)));"`"==f[0]&&"\u00b4"==f[f.length-1]&&(x.ignoreAccents=!0,f=f.substring(1,f.length-1),f[0]==f[f.length-1]&&"'"==f[0]&&(x.ignoreCaps=!0,f=f.substring(1,f.length-1)));"*"===f.charAt(0)&&
"*"!==f.charAt(f.length-1)?f=f.substring(1)+"$":"*"!==f.charAt(0)&&"*"===f.charAt(f.length-1)?f="^"+f.substring(0,f.length-1):"*"!==f.charAt(0)&&"*"!==f.charAt(f.length-1)?f="^"+f+"$":"*"===f.charAt(0)&&"*"===f.charAt(f.length-1)&&(f=f.substring(1,f.length-1));x.regExp=f.replace(/\?/g,"[\\S\\s]{1}");A.call(y,x)}else{y=q;A=y.push;x=f;var H=z;f=(x||"").trim();x={ignoreAccents:!1,ignoreCaps:!1,regExp:null};x.expr=f.split(",");x.expr[0]=x.expr[0].trim();x.expr[0]={type:x.expr[0].charAt(0),expr:H.parser.parse(x.expr[0].substring(1))};
x.expr[1]=x.expr[1].trim();x.expr[1]={type:x.expr[1].charAt(x.expr[1].length-1),expr:H.parser.parse(x.expr[1].substring(0,x.expr[1].length-1))};A.call(y,x)}m[u]=q}return m};a.escorrecto=function(m,z,u,e){u=u||a.externalEvaluator;e=e||a.buildRegularExpressionsPatterns(m,u);z=k(z);m=0;for(var w=e.length;m<w;m++){v=e[m];d=!0;for(var B=0,y=v.length;B<y;B++)d=v[B].regExp?d&&!!z.match(new RegExp(k(v[B].regExp),"i")):d&&p(v[B],z,u);if(d)return 1}return 0};a.esCorrecto=function(m,z,u,e){u=u||a.externalEvaluator;
e=e||a.buildRegularExpressionsPatterns(m,u);z+="";m=0;for(var w=e.length;m<w;m++){v=e[m];d=!0;for(var B=0,y=v.length;B<y;B++)(f=v[B].regExp)?(v[B].ignoreAccents&&(z=k(z),f=k(f)),v[B].ignoreCaps&&(z=z.toLowerCase(),f=k(f).toLowerCase()),d=d&&!!z.match(f)):d=d=d&&p(v[B],z,u);if(d)return 1}return 0};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.loaderImg=new Image;a.loaderImg.src="data:image/svg+xml;base64,"+btoa("<svg xmlns='http://www.w3.org/2000/svg' width='880' height='840' viewBox='0 0 880 840'><path d='M440 80c-132.5 0-240 107.5-240 240s107.5 240 240 240 240-107.5 240-240S572.5 80 440 80zm-11.1 462.2c-122.7 0-224.4-99.5-224.4-222.2S306.2 97.8 428.9 97.8 651.1 197.3 651.1 320s-99.5 222.2-222.2 222.2zm-11.1-426.6c-112.9 0-208.9 91.5-208.9 204.4s96 204.4 208.9 204.4S622.2 432.9 622.2 320s-91.5-204.4-204.4-204.4zm-11.1 391.1c-103.1 0-193.3-83.6-193.3-186.7s90.2-186.7 193.3-186.7S593.3 216.9 593.3 320s-83.5 186.7-186.6 186.7zm-11.1-355.6c-93.3 0-177.8 75.6-177.8 168.9s84.5 168.9 177.8 168.9S564.4 413.3 564.4 320c0-93.3-75.6-168.9-168.8-168.9zm-11.2 320c-83.5 0-162.2-67.7-162.2-151.1S301 168.9 384.4 168.9 535.6 236.5 535.6 320s-67.7 151.1-151.2 151.1zm-11.1-284.4c-73.6 0-146.7 59.7-146.7 133.3s73 133.3 146.7 133.3S506.7 393.6 506.7 320 447 186.7 373.3 186.7zm-11.1 248.9c-63.8 0-131.1-51.7-131.1-115.6s67.3-115.6 131.1-115.6S477.8 256.2 477.8 320 426 435.6 362.2 435.6zm-11.1-213.4c-54 0-115.6 43.8-115.6 97.8s61.6 97.8 115.6 97.8c54 0 97.8-43.8 97.8-97.8s-43.8-97.8-97.8-97.8zM340 400c-44.2 0-100-35.8-100-80s55.8-80 100-80 80 35.8 80 80-35.8 80-80 80z' fill='#2daae4'/><path d='M115.8 600.7c32.5 0 48.8 24.8 48.8 49.7 0 24.9-16.2 49.6-48.8 49.6H80.2v-99.3zm0 85c23 0 34.6-17.6 34.6-35.2s-11.6-35.4-34.6-35.4H94.5v70.6zm118.2 0V700h-60.6v-99.3h60.5V615h-46v28h45v14.5h-45l-.05 28.2zm42.2.9c10.6 0 22.3-6 22.3-16.2 0-1-.1-2.1-.4-3.4-1.7-7.5-11.9-8.8-21.9-9.8-15.5-1.6-33.7-5-35.2-25.65-.6-6.65 1.1-13.25 5.4-18.85 6.7-8.7 18.6-13.2 30.1-13.2 15.3 0 31.2 8 33.8 26.1l-14.3.7c-2-8.9-11.6-12.8-20.3-12.6-6.7.1-14.1 2.4-18 7.5-2 2.6-2.7 5.8-2.4 9.2.7 10.2 11.9 11.5 22.6 12.5 13.6 1.7 30.5 5.3 34.4 21.2.4 2.1.7 4.5.7 6.5 0 19.2-19 30.2-36.9 30.2-15.3 0-33.9-9.1-35.8-26.8l-.1-2.7 14.5-.3.1 1.8c1 8.9 12.2 13.8 21.4 13.8zm58-71.7c8.7-8.9 20.9-14.8 34.4-14.8 22.7 0 40.6 14.2 46.3 36.6h-14.2c-5.3-14.9-17.5-22.4-32.1-22.4-9.5 0-18.2 4.1-24.4 10.7-6.2 6.5-10.2 15.3-10.2 25.6 0 9.9 4 18.7 10.2 25.3 6.2 6.6 14.9 10.6 24.4 10.6 15.1 0 27.8-8.7 32.9-23.7h14.1c-5.7 22.6-23.9 37.9-47 37.9-13.5 0-25.7-5.7-34.4-14.8-8.5-9.1-14.2-21.6-14.2-35.4 0-14 5.7-26.5 14.2-35.6zm144.6 55.8h-35.6c-3.8 9.1-8.8 21-11.9 29.3h-15.5l39.9-100.7h10.5L506 700h-15.3zm-30.3-13.4h24.7L461 622.2zm96.9-7.7c12.1 0 18-8.7 18-17.3 0-8.5-6-17.2-18-17.2h-22V700h-14.2v-99.4h36.2c21.6 0 32.4 15.9 32.4 31.7 0 14.1-8.7 27.4-25.7 30.4l31.4 37.3h-18.6l-36.2-43.6-.05-6.8zm64.9 50.8v-85.3h-30.1v-14.5h74.4v14.5h-30v85.3zm112.2-14.7V700H662v-99.3h60.5V615h-46v28h45v14.5h-45l-.05 28.2zm42.3.9c10.6 0 22.3-6 22.3-16.2 0-1-.1-2.1-.4-3.4-1.7-7.5-11.9-8.8-21.9-9.8-15.5-1.6-33.7-5-35.2-25.65-.6-6.65 1.1-13.25 5.4-18.85 6.7-8.7 18.6-13.2 30.1-13.2 15.3 0 31.2 8 33.8 26.1l-14.3.7c-2-8.9-11.6-12.8-20.3-12.6-6.7.1-14.1 2.4-18 7.5-2 2.6-2.7 5.8-2.4 9.2.7 10.2 11.9 11.5 22.6 12.5 13.6 1.7 30.5 5.3 34.4 21.2.4 2.1.7 4.5.7 6.5 0 19.2-19 30.2-36.9 30.2-15.3 0-33.9-9.1-35.8-26.8l-.1-2.7 14.5-.3.1 1.8c1 8.9 12.2 13.8 21.4 13.8z' fill='#868686'/></svg>");a.getCCLImg=
function(){var p=new Image;p.src="data:image/svg+xml;base64,"+btoa("<svg xmlns='http://www.w3.org/2000/svg' width='88' height='31' viewBox='0 0 120 42'><path fill='#aab2ab' stroke='#000' d='M.5.5h119v41H.5z'/><path d='M0 29.5h120V42H0z'/><circle cx='21' cy='19.5' r='18.25' fill='#aab2ab'/><path d='M49.935 33.105c.364.298.585.806.585 1.284 0 .403-.07.592-.228.833-.158.242-.377.405-.674.547.41.118.715.323.917.617.202.294.303.649.303 1.063 0 .68-.302 1.117-.721 1.465-.432.359-1.067.455-1.622.455H45.28v-6.622h3.122c.579 0 1.127.025 1.533.358zM48.8 35.24c.175-.141.307-.323.307-.6 0-.331-.126-.473-.307-.612-.188-.145-.351-.147-.697-.147H46.74v1.545h1.363c.26 0 .51-.035.697-.186zm-.5 2.996c.288 0 .553-.018.753-.181a.885.885 0 0 0 .325-.691c0-.34-.095-.552-.288-.727-.196-.177-.446-.218-.762-.218h-1.59v1.817zm2.795-5.489h1.633l1.55 2.616 1.543-2.616h1.623l-2.459 4.08v2.542h-1.46v-2.578zm21.34 6.622H71.07v-6.622h1.448l2.774 4.443.008-4.443h1.367v6.622H75.21l-2.765-4.433zm8.48-5.558c-1.07 0-1.893.887-1.893 2.224 0 1.336.91 2.263 1.893 2.263.823 0 1.503-.646 1.503-1.485h1.41c0 1.63-1.022 2.704-2.913 2.704-1.89 0-3.259-1.07-3.259-3.434 0-2.363 1.407-3.499 3.26-3.499 1.853 0 2.857.96 2.857 2.386h-1.41c0-.774-.755-1.159-1.448-1.159zm17.845 4.297c.27.228.68.283 1.023.283.485 0 .93-.072 1.157-.413.157-.235.118-.615-.043-.848-.223-.323-.713-.38-1.078-.474-.498-.129-.996-.18-1.437-.412-.411-.215-.835-.486-1.078-.881-.139-.225-.172-.506-.172-.775 0-.703.348-1.153.788-1.513.453-.371 1.11-.442 1.687-.49.698-.057 1.352.088 1.843.491.472.387.697 1.03.807 1.644h-1.414c.047-.386-.17-.615-.406-.798-.241-.188-.589-.207-.895-.204-.23.002-.486.028-.669.167-.177.135-.328.36-.328.584 0 .238.161.48.352.622.444.333 1.09.218 1.621.38.398.122.854.17 1.167.445.422.371.797.972.797 1.485 0 .672-.279 1.154-.701 1.517-.54.466-1.37.532-2.055.599-.756.021-1.449-.117-1.97-.558-.505-.427-.849-1.13-.849-1.792h1.413c0 .476.176.717.44.941zm7.886-5.361l2.477 6.622h-1.512l-.501-1.475h-2.477l-.52 1.475h-1.465l2.504-6.622zm-1.632 4.06h1.716l-.845-2.427z' fill='#fff'/><g stroke-width='2' fill='#fff' stroke='#000'><circle r='14.25' cy='19.5' cx='21' stroke-width='2.8'/><circle r='10.55' cx='52' cy='15'/><circle r='10.55' cy='15' cx='78'/><circle r='10.55' cx='104' cy='14.981'/></g><circle r='1.625' cy='9' cx='52'/><path d='M18.75 17.979c-.39-.852-.974-1.278-1.755-1.278-1.378 0-2.067.928-2.067 2.784 0 1.856.69 2.783 2.067 2.783.91 0 1.56-.452 1.951-1.357l1.91 1.017c-.91 1.618-2.277 2.428-4.098 2.428-1.406 0-2.531-.43-3.377-1.292-.846-.862-1.27-2.05-1.27-3.564 0-1.487.438-2.668 1.31-3.543.87-.875 1.958-1.312 3.259-1.312 1.926 0 3.304.759 4.14 2.275zm8.99 0c-.39-.852-.964-1.278-1.72-1.278-1.405 0-2.109.928-2.109 2.784 0 1.856.704 2.783 2.11 2.783.912 0 1.55-.452 1.915-1.357l1.953 1.017c-.91 1.618-2.274 2.428-4.092 2.428-1.404 0-2.526-.43-3.372-1.292-.843-.862-1.266-2.05-1.266-3.564 0-1.487.429-2.668 1.287-3.543.857-.875 1.947-1.312 3.273-1.312 1.923 0 3.3.759 4.13 2.275l-2.108 1.059zm27.381-5.862a.75.75 0 0 0-.75-.75h-4.743a.75.75 0 0 0-.749.75v4.742h1.324v5.617h3.594v-5.617h1.324zm13.779-.352l10.343 4.66a.867.867 0 0 1 .312.696c0 .887-.754 1.154-1.435 1.154-1.05 0-1.818-.324-2.588-1.048l-1.598 1.609c.962.84 2.22 1.374 3.52 1.389v1.789h1.332v-1.79c1.584-.115 2.895-1.108 3.191-2.58l4.471 2.048.852-2.129-10.391-4.682a.467.467 0 0 1-.106-.295c0-.723.814-.9 1.39-.9.71 0 1.42.281 1.983.68L81.7 10.8a5.005 5.005 0 0 0-2.914-1.065V7.95h-1.332v1.787c-1.417.083-2.587.83-2.987 2.059l-4.533-2.073zm29.88 1.58c.461-2.918 2.515-4.478 5.09-4.478 3.7 0 5.957 2.686 5.957 6.268 0 3.495-2.4 6.21-6.016 6.21-2.487 0-4.714-1.53-5.12-4.535h2.922c.087 1.56 1.1 2.109 2.546 2.109 1.648 0 2.718-1.53 2.718-3.87 0-2.456-.925-3.755-2.661-3.755-1.272 0-2.371.462-2.603 2.05l.85-.005-2.3 2.3-2.299-2.3.915.006z'/></svg>");
return p};a.getSvgArrowUp=function(p,k="24c"){return"data:image/svg+xml;base64,"+btoa(`<svg ${"xmlns='http://www.w3.org/2000/svg'"} width="24" height="24" viewBox="0 0 24 24"><path transform="rotate(${p?90:0},12,12)" fill="#${k}" d="m19.5 17.5-7.5-12-7.5 12z"/></svg>`)};a.getSvgArrowDown=function(p,k="d00018"){return"data:image/svg+xml;base64,"+btoa(`<svg ${"xmlns='http://www.w3.org/2000/svg'"} width="24" height="24" viewBox="0 0 24 24"><path transform="rotate(${p?90:0},12,12)" d="m19.5 5-7.5 12-7.5-12z" fill="#${k}"/></svg>`)};
a.getSvgMenu=function(){return"data:image/svg+xml;base64,"+btoa("<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'><path d='M6.64 8L12 12.962 17.36 8 19 9.519 12 16 5 9.519z'/></svg>")};a.getSvgCheckbox=function(){return"data:image/svg+xml;base64,"+btoa("<svg xmlns='http://www.w3.org/2000/svg' width='45' height='45' viewBox='0 0 45 45'><path d='M37.095 6.284L15.473 27.905l-7.568-7.567L2.5 25.743l12.973 12.973L42.5 11.69z' fill='#1e272e'/></svg>")};a.getSvgRadio=function(){return"data:image/svg+xml;base64,"+
btoa('<svg xmlns=\'http://www.w3.org/2000/svg\' width="45" height="45" viewBox="0 0 45 45"><circle cx="22.5" cy="22.5" r="15" fill="#1e272e"/></svg>')};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;const p=Math.floor;var k=/[\w-//]*(\.png|\.jpg|\.gif|\.svg|\.webp)/gi,f,v,q,d,n,h,c,b,g,r,l,m,z,u,e,w,B,y;class A{constructor(x,H){this.r=this.g=this.b=0;this.a=1;this.evaluator=H;this.getColor=this.getColorStr;if(!x)this.colorStr=`rgba(${this.r},${this.g},${this.b},${this.a})`;else if(x.match(/^GradL/)){x=this.splitComa(x.substring(6,x.length-1));this.x1=this.evaluator.parser.parse(x[0]);this.y1=this.evaluator.parser.parse(x[1]);this.x2=this.evaluator.parser.parse(x[2]);
this.y2=this.evaluator.parser.parse(x[3]);this.stops=[];for(let J=4;J<x.length;J++)""!=x[J]&&(H=x[J].split("|"),this.stops.push({percentage:this.evaluator.parser.parse(H[1]),color:"#"+H[2]}));this.getColor=this.getLinearGradient}else if(x.match(/^Pattern/))this.img_src=x.substring(8,x.length-1),this.img_src.match(k)&&(this.img_src="'"+this.img_src+"'"),this.img_src=this.evaluator.parser.parse(this.img_src),this.getColor=this.getPattern;else if(babel[x])"net"===babel[x]&&(x="rojo"),x=babel[x],this.r=
a.toHex(x.substring(1,3)),this.g=a.toHex(x.substring(3,5)),this.b=a.toHex(x.substring(5,7)),this.colorStr=x;else if(6===x.length)this.r=a.toHex(x.substring(0,2)),this.g=a.toHex(x.substring(2,4)),this.b=a.toHex(x.substring(4,6)),this.colorStr="#"+x;else if(8===x.length)this.r=a.toHex(x.substring(2,4)),this.g=a.toHex(x.substring(4,6)),this.b=a.toHex(x.substring(6,8)),this.a=1-a.toHex(x.substring(0,2))/255,this.colorStr=`rgba(${this.r},${this.g},${this.b},${this.a})`;else if("("===x[0]){v=[];q=this.splitComa(x.substring(1,
x.length-1));x=0;for(H=q.length;x<H;x++)h=q[x],d=parseInt(h,16),h!==d.toString(16)&&h!=="0"+d.toString(16)?("["===h.charAt(0)&&"]"===h.charAt(h.length-1)&&(h=h.substring(1,h.length-1)),v.push(this.evaluator.parser.parse(h))):v.push(this.evaluator.parser.parse((d/255).toString()));this.rExpr=v[0];this.gExpr=v[1];this.bExpr=v[2];this.aExpr=v[3];this.getColor=this.getColorExp}}splitComa(x){n=[];for(var H=g=b=c=0,J=x.length;H<J;H++)r=x.charAt(H),"("===r?c++:")"===r?c--:"["===r?b++:"]"===r?b--:","===r&&
0===c&&0===b&&(n.push(x.substring(g,H)),g=H+1);n.push(x.substring(g));return n}getColorStr(){return this.colorStr}getColorExp(){f=this.evaluator;this.r=p(255*f.eval(this.rExpr));this.g=p(255*f.eval(this.gExpr));this.b=p(255*f.eval(this.bExpr));this.a=1-f.eval(this.aExpr);return`rgba(${this.r},${this.g},${this.b},${this.a})`}getLinearGradient(){w=a.ctx.createLinearGradient(this.evaluator.eval(this.x1),this.evaluator.eval(this.y1),this.evaluator.eval(this.x2),this.evaluator.eval(this.y2));for(let x=
0;x<this.stops.length;x++)e=this.evaluator.eval(this.stops[x].percentage),e=0>e?0:1<e?1:e,w.addColorStop(e,this.stops[x].color);return w}getPattern(){y=this.evaluator.parent;if(B=y.getImage(this.evaluator.eval(this.img_src)))try{return a.ctx.createPattern(B,"repeat")}catch(x){}return"ff00ff"}borderColor(){return 380>this.r+this.g+this.b?"#ffffff":"#000000"}}a.toHex=function(x){return parseInt("0x"+x,16)};a.RGBAToHexColor=function(x){x=x.substring(5,x.length-1).split(",");l=parseInt(x[0]).toString(16);
m=parseInt(x[1]).toString(16);z=parseInt(x[2]).toString(16);u=(255-parseInt(255*parseFloat(x[3]))).toString(16);1===l.length&&(l="0"+l);1===m.length&&(m="0"+m);1===z.length&&(z="0"+z);1===u.length&&(u="0"+u);return new A(u+l+m+z)};a.Color=A;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;class p{constructor(k){this.parent=k;this.container=a.newHTML("div",{class:"DescartesKeyboardContainer"});this.container.oncontextmenu=function(){return!1};this.display=a.newHTML("textarea",{class:"DescartesKeyboardDisplay",spellcheck:"false",inputmode:"none"});this.container.appendChild(this.display);this.keyContainer=a.newHTML("div",{style:"position:absolute; padding-bottom:5px;",class:"DescartesKeysContainer"});this.container.appendChild(this.keyContainer);
this.additionalKeys=a.newHTML("div",{style:"position:absolute; padding: 0 5px 5px 0; display:none;",class:"DescartesKeysContainer"});this.container.appendChild(this.additionalKeys);this.newLine=a.newHTML("div",{style:"position:absolute; background-color:white; margin:0; font-family:DJS_sansserif; font-size:17px; font-weight:normal; line-height:38px",class:"new_line_btn"});this.newLine.textContent="\\n";this.newLine.addEventListener("pointerup",()=>{this.insert("\n")});this.container.appendChild(this.newLine);
this.display.addEventListener("keydown",d=>{this.keypressed=!0;if(27===d.keyCode)this.close();else if(13===d.keyCode)this.onEnter()});this.key_pressed=!1;let f;this.delete_pressed=!1;let v;this.keyContainer.addEventListener("pointerdown",d=>{if("k_op"==d.target.id||"k_dot"==d.target.id||"k_a"==d.target.id||"k_e"==d.target.id||"k_i"==d.target.id||"k_o"==d.target.id||"k_u"==d.target.id){d.target.onpointerleave=function(){clearTimeout(f)};let n=d.target.textContent.trim().toLowerCase();f=setTimeout(()=>
{this.key_pressed=!0;this.showAditionalKeys(n)},600)}else"k_delete"==d.target.id&&(d.target.onpointerleave=function(){clearTimeout(v)},v=setInterval(()=>{this.delete_pressed=!0;this.delete()},200))});this.keyContainer.addEventListener("pointerup",d=>{if(d.target!=this.keyContainer&&d.target!=this.container)if(d.preventDefault(),d.stopPropagation(),"k_left"==d.target.id)this.display.selectionStart=this.display.selectionEnd=Math.max(0,this.display.selectionStart-1);else if("k_right"==d.target.id)this.display.selectionStart=
this.display.selectionEnd=Math.min(this.display.value.length,this.display.selectionStart+1);else if("k_delete"==d.target.id)this.delete_pressed||this.delete(),clearTimeout(v),this.delete_pressed=!1;else if("k_\u221a"==d.target.id)this.insert("\u221a(");else if("k_space"==d.target.id)this.insert(" ");else if("k_esc"==d.target.id)this.close();else if("k_shift"==d.target.id){d=this.keyContainer.querySelectorAll("div");let n=this.additionalKeys.querySelectorAll("div");(this.shift=!this.shift)?(d.forEach(h=>
{1==h.textContent.trim().length&&(h.textContent=h.textContent.toUpperCase());"k_point_comma"==h.getAttribute("id")&&(h.textContent=",")}),n.forEach(h=>{h.textContent=h.textContent.toUpperCase()})):(d.forEach(h=>{1==h.textContent.trim().length&&(h.textContent=h.textContent.toLowerCase());"k_point_comma"==h.getAttribute("id")&&(h.textContent=".")}),n.forEach(h=>{h.textContent=h.textContent.toLowerCase()}))}else if("k_num_layout"==d.target.id)this["setLayout_"+this.layout_mode.replace("alfa","num")]();
else if("k_alfa_layout"==d.target.id)this["setLayout_"+this.layout_mode.replace("num","alfa")]();else if("k_clear"==d.target.id)this.display.value="";else if("k_op"==d.target.id||"k_dot"==d.target.id||"k_a"==d.target.id||"k_e"==d.target.id||"k_i"==d.target.id||"k_o"==d.target.id||"k_u"==d.target.id)clearTimeout(f),this.key_pressed||(this.insert(d.target.textContent.trim()),this.additionalKeys.style.display="none"),this.key_pressed=!1;else if("k_return"==d.target.id)this.onEnter();else d=d.target.textContent.trim(),
this.insert(d),this.additionalKeys.style.display="none";this.display.focus()});this.keyContainer.addEventListener("mouseup",d=>{d.preventDefault();d.stopPropagation()});let q=!1;this.additionalKeys.addEventListener("pointerdown",d=>{q=!0});this.additionalKeys.addEventListener("pointerup",d=>{q&&(d.target!=this.keyContainer&&d.target!=this.container&&(d.preventDefault(),d.stopPropagation(),d=d.target.textContent.trim(),this.insert(d)),this.key_pressed=!1,this.additionalKeys.style.display="none");q=
!1;this.display.focus()})}insert(k){this.display.setRangeText(k);this.display.selectionStart+=k.length;this.display.selectionStart=this.display.selectionEnd}delete(){this.display.selectionStart==this.display.selectionEnd&&(this.display.selectionStart=Math.max(0,this.display.selectionStart-1));this.display.setRangeText("")}addKey(k,f,v){return`<div ${f?"id='"+f+"'":""} ${v?"style='"+v+"'":""}>${k}</div>`}addKeys(k){let f="";k.forEach(v=>{f="object"===typeof v?f+this.addKey(v.val,v.id,v.style):f+this.addKey(v)});
return f}showAditionalKeys(k){let f=[];"."==k?f=",;:-_\u00bf?\u00a1!()".split(""):"+"==k?f=["-","\u00d7","\u00f7","^"]:"a"==k?f=["\u00e1","\u00e0","\u00e4","\u00e2"]:"e"==k?f=["\u00e9","\u00e8","\u00eb","\u00ea"]:"i"==k?f=["\u00ed","\u00ec","\u00ef","\u00ee"]:"o"==k?f=["\u00f3","\u00f2","\u00f6","\u00f4"]:"u"==k&&(f=["\u00fa","\u00f9","\u00fc","\u00fb"]);this.additionalKeys.innerHTML=this.addKeys(f);this.shift&&(this.additionalKeys.innerHTML=this.additionalKeys.innerHTML.toUpperCase());this.additionalKeys.style.display=
"flex";this.additionalKeys.style.left=this.keyContainer.style.left;this.additionalKeys.style.top=parseFloat(this.keyContainer.style.top)-50+"px"}setLayout_14x1(){this.keyContainer.innerHTML=this.addKeys([1,2,3,4,5,6,7,8,9,0,{val:this.parent.decimal_symbol},"-",{val:"\u232b",id:"k_delete"},{val:"\u21b5",id:"k_return"}]);this.keyContainer.style.width="635px"}setLayout_7x2(){this.keyContainer.innerHTML=this.addKeys([1,2,3,4,5,{val:this.parent.decimal_symbol},{val:"\u232b",id:"k_delete"},6,7,8,9,0,"-",
{val:"\u21b5",id:"k_return"}]);this.keyContainer.style.width="320px"}setLayout_10x2(){this.keyContainer.innerHTML=this.addKeys(["(",1,2,3,4,5,"\u00b2","/","\u00d7",{val:"\u232b",id:"k_delete"},")",6,7,8,9,0,{val:this.parent.decimal_symbol},"-","+",{val:"\u21b5",id:"k_return"}]);this.keyContainer.style.width="455px"}setLayout_4x4(){this.keyContainer.innerHTML=this.addKeys([7,8,9,{val:"\u232b",id:"k_delete"},4,5,6,"+",1,2,3,"-",{val:0,style:"width:85px;"},{val:this.parent.decimal_symbol},{val:"\u21b5",
id:"k_return"}]);this.keyContainer.style.width="185px"}setLayout_5x4(){this.keyContainer.innerHTML=this.addKeys([7,8,9,"\u00b2",{val:"\u232b",id:"k_delete"},4,5,6,"/","\u00d7",1,2,3,"\u2212","+",{val:0,style:"width:85px;"},".",{val:"\u21b5",id:"k_return",style:"margin-left:50px;"}]);this.keyContainer.style.width="230px"}setLayout_11x3(){this.keyContainer.innerHTML=this.addKeys(["q","w",{val:"e",id:"k_e"},"r","t","y",{val:"u",id:"k_u"},{val:"i",id:"k_i"},{val:"o",id:"k_o"},"p",{val:"\u232b",id:"k_delete"},
{val:"a",id:"k_a"},"s","d","f","g","h","j","k","l","\u00f1",{val:".",id:"k_dot"},{val:"\u21c5",id:"k_shift"},"z","x","c","v","b","n","m",{val:"",id:"k_space",style:"width:85px;"},{val:"\u21b5",id:"k_return"}]);this.keyContainer.style.width="500px";this.shift=!1}setLayout_11x4(){this.keyContainer.innerHTML=this.addKeys([1,2,3,4,5,6,7,8,9,0,{val:"\u232b",id:"k_delete"},"q","w",{val:"e",id:"k_e"},"r","t","y",{val:"u",id:"k_u"},{val:"i",id:"k_i"},{val:"o",id:"k_o"},"p",{val:"+",id:"k_op"},{val:"a",id:"k_a"},
"s","d","f","g","h","j","k","l","\u00f1",{val:".",id:"k_dot"},{val:"\u21c5",id:"k_shift"},"z","x","c","v","b","n","m",{val:"",id:"k_space",style:"width:85px;"},{val:"\u21b5",id:"k_return"}]);this.keyContainer.style.width="500px"}setLayout_10x4_alfa(){this.keyContainer.innerHTML=this.addKeys(["q","w",{val:"e",id:"k_e"},"r","t","y",{val:"u",id:"k_u"},{val:"i",id:"k_i"},{val:"o",id:"k_o"},"p",{val:"a",id:"k_a"},"s","d","f","g","h","j","k","l","\u00f1",{val:"\u21c5",id:"k_shift",style:"width:62.5px;"},
"z","x","c","v","b","n","m",{val:"\u232b",id:"k_delete",style:"width:62.5px;"},{val:"123",id:"k_num_layout",style:"width:85px;"},{val:"",id:"k_space",style:"width:220px;transform:none !important;"},{val:"/",id:"k_slash"},{val:".",id:"k_dot"},{val:"\u21b5",id:"k_return"}]);this.keyContainer.style.width="455px"}setLayout_10x4_num(){this.keyContainer.innerHTML=this.addKeys(["1","2","3","4","5","6","7","8","9","0","@",'"',"$","_","-","+","(",")","/","*","&","|","\u00ba",":",";","\u00a1","!","\u00bf",
"?",{val:"\u232b",id:"k_delete"},{val:"ABC",id:"k_alfa_layout",style:"width:85px;"},{val:"",id:"k_space",style:"width:220px;transform:none !important;"},{val:",",id:"k_slash"},{val:".",id:"k_dot"},{val:"\u21b5",id:"k_return"}]);this.keyContainer.style.width="455px"}showCustomKB(k){let f=k.querySelectorAll("div");k=parseInt(k.getAttribute("cols")||f.length);let v=[],q;var d;for(let n=0;n<f.length;n++){q={val:f[n].textContent};if(d=f[n].getAttribute("id"))q.id=d;if(d=f[n].getAttribute("size"))q.style=
`width:${40*parseInt(d)+5*(parseInt(d)-1)}px;transform:none !important;`;v.push(q)}this.keyContainer.innerHTML=this.addKeys(v);this.keyContainer.style.width=5+45*k+"px"}setLayout(k){this.layout_mode=k;let f=document.getElementById("kb_"+k);f?this.showCustomKB(f):"14x1"==k?this.setLayout_14x1():"7x2"==k?this.setLayout_7x2():"10x2"==k?this.setLayout_10x2():"4x4"==k?this.setLayout_4x4():"5x4"==k?this.setLayout_5x4():"11x3"==k?this.setLayout_11x3():"11x4"==k?this.setLayout_11x4():"10x4_alfa"==k?this.setLayout_10x4_alfa():
"10x4_num"==k?this.setLayout_10x4_num():this.setLayout_14x1()}show(k,f,v,q,d,n,h){this.ctr=k;this.var_id=d;this.onlyText=h;this.container.parentNode||this.parent.container.appendChild(this.container);this.container.style.display="block";this.setDisplay(n);this.setLayout(f);this.keyContainer.style.left=v+"px";this.keyContainer.style.top=q+"px";this.additionalKeys.style.display="none"}close(){this.container.style.display="none"}setDisplay(k){let f;let v;let q;if("custom"==k.type){f=k.x;var d=k.y;v=
k.w;var n=k.h;q=k.fs}else d=this.container.getBoundingClientRect(),n=k.getBoundingClientRect(),f=n.left/a.cssScale-d.left/a.cssScale,d=n.top/a.cssScale-d.top/a.cssScale,v=n.width/a.cssScale,n=n.height/a.cssScale,q=k.style.fontSize;"textarea"==k.tagName.toLowerCase()?(this.display.setAttribute("style",`left:${f}px;top:${d}px;width:${v}px;height:${n}px;font-size:${q};line-height:${1.2}em;padding:5px;font:${k.style.font};`),this.newLine.style.left=f+v-42+"px",this.newLine.style.top=d+n-42+"px",this.newLine.style.display=
"block"):(this.display.setAttribute("style",`left:${f}px;top:${d}px;width:${v}px;height:${n}px;font-size:${q};line-height:${n}px;white-space:nowrap;`),this.newLine.style.display="none");this.display.value=k.value||"";this.display.focus();this.display.selectionStart=this.display.selectionEnd=this.display.value.length}onEnter(){let k=this.display.value;if(!this.onlyText){var f=this.parent.evaluator.parser.parse(k.replace(/\u221a/g,"sqrt"));try{f&&(k=this.parent.evaluator.eval(f))}catch(v){k=0}}if(this.ctr)this.ctr.changeValue(k,
!0);else if(this.var_id=(this.var_id+"").trim(),f=this.var_id.indexOf("["),-1==f)this.parent.evaluator.setVariable(this.var_id,k);else{let v=this.var_id.indexOf(","),q=this.var_id.substring(0,f);-1==v?this.parent.evaluator.setVector(q,parseInt(this.var_id.substring(f+1)),k):this.parent.evaluator.setMatrix(q,parseInt(this.var_id.substring(f+1)),parseInt(this.var_id.substring(v+1)),k)}this.parent.update();this.close()}}a.Keyboard=p;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var p=document.head,k=a.newHTML("meta",{"http-equiv":"X-UA-Compatible",content:"IE=edge,chrome=1"});p.appendChild(k);k=a.newHTML("meta",{name:"viewport",content:"width=device-width,initial-scale=1.0,user-scalable=yes"});document.querySelector("meta[name=viewport]")||p.appendChild(k);k=a.newHTML("meta",{name:"mobile-web-app-capable",content:"yes"});p.appendChild(k);k=a.newHTML("meta",{name:"apple-mobile-web-app-capable",content:"yes"});p.appendChild(k);
k=a.newHTML("meta",{name:"apple-mobile-web-app-status-bar-style",content:"black"});p.appendChild(k);(p=document.getElementById("StyleDescartesApps2"))&&p.remove();p=a.newHTML("style",{rel:"stylesheet",type:"text/css",id:"StyleDescartesApps2"});document.head.insertBefore(p,document.head.firstChild);p.innerHTML="body{-webkit-font-smoothing:antialiased;}\n#descartesJS_north,#descartesJS_south,#descartesJS_east,#descartesJS_west{background:#c0c0c0;position:absolute;z-index:100;}\n.PBL{position:absolute;background-color:#f2f2f2;border:none;-webkit-appearance:none;-moz-appearance:none;appearance:none;color:#2daae4;visibility:hidden;border-radius:100vw;}\n.PBL::-moz-progress-bar{background:#2daae4;border-radius:inherit;}\n.PBL::-webkit-progress-bar{background:#f2f2f2;border-radius:100vw;}\n.PBL::-webkit-progress-value{background:#2daae4;border-radius:inherit;}\n.PBL::-ms-fill{background:#2daae4;border-radius:inherit;}\n.DescartesAppContainer *,.DescartesAppContainer *:before,.DescartesAppContainer *:after{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;transform:translate3d(0,0,0);}\n.DescartesAppContainer{border:none;overflow:hidden;position:relative;top:0;left:0;}\n.DescartesCatcher{background-color:rgba(0,0,0,0);cursor:pointer;position:absolute;}\n.DescartesLoader{background-color:#fff;overflow:hidden;position:absolute;top:0;left:0;z-index:1000;width:100%;height:100%;display:none;}\n.DescartesLoaderImage{position:absolute;background-repeat:no-repeat;background-position:center;overflow:hidden;top:0;left:0;width:100%;height:100%;}\n.DescartesSpace2DCanvas,.DescartesSpace3DCanvas,.blocker{touch-action:none;position:absolute;overflow:hidden;left:0;top:0;}\n.DescartesSpace2DContainer,.DescartesSpace3DContainer{position:absolute;overflow:hidden;line-height:0;}\n.DescartesCheckboxContainer input[type=checkbox],.DescartesCheckboxContainer input[type=radio]{display: none;}\n.DescartesCheckboxContainer input[type=checkbox]+label::after{position:absolute;left:0px;content:'';padding:0;margin:0;width:100%;height:100%;background:#fff;border:1px solid gray;}\n.DescartesCheckboxContainer input[type=checkbox]:checked+label::after{content:'';background:url("+
a.getSvgCheckbox()+") center center no-repeat;background-size:contain;background-color:#fff;}\n.DescartesCheckboxContainer input[type=radio]+label::after{position:absolute;left:0px;content:'';padding:0;margin:0;width:100%;height:100%;background:#fff;border:1px solid gray;border-radius:50%;}\n.DescartesCheckboxContainer input[type=radio]:checked+label::after{content:'';background:url("+a.getSvgRadio()+") center center no-repeat;background-size:contain;background-color:#fff;}\n.DescartesCheckbox{position:absolute;}\n.TextfieldCover{position:absolute;overflow:hidden;background-color:transparent;cursor:pointer;}\ninput[type=text]{-webkit-appearance:none;}\n.DescartesButton{position:absolute;cursor:pointer;}\n.DescartesButtonContainer,.DescartesSpinnerContainer,.DescartesCheckboxContainer,.DescartesTextFieldContainer,.DescartesMenuContainer{position:absolute;overflow:hidden;}\n.DescartesSpinnerContainer input,.DescartesCheckboxContainer,.DescartesTextFieldContainer input,.DescartesMenuContainer select{border-radius:0;}\n.DescartesSpinnerField,.DescartesTextFieldField,.DescartesMenuField,.DescartesScrollbarField{font-family:"+
a.sansserif_font+";padding:0 2px;border:solid #666 1px;position:absolute;}\ninput[type=text]:disabled,.DescartesMenuSelect:disabled{background-color:#e3e3e3;cursor:not-allowed;opacity:1;}\n.DescartesSpinnerLabel,.DescartesCheckboxLabel,.DescartesMenuLabel,.DescartesScrollbarLabel,.DescartesTextFieldLabel{font-family:"+a.sansserif_font+";font-weight:normal;text-align:center;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;position:absolute;left:0;top:0;}\n.DescartesGraphicControl{touch-action:none;border-style:none;position:absolute;}\n.DescartesTextAreaContainer{position:absolute;overflow:hidden;background:#F7F7F7;resize:none;}\n.DescartesMenuSelect{font-family:"+
a.sansserif_font+";padding-top:0;text-align:center;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;position:absolute;border:1px solid #7a8a99; background:#fff url('"+a.getSvgMenu()+"') 100%/22px no-repeat;padding:0 22px 0 5px;-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:none;}\n.DescartesMenuSelect::-ms-expand{display:none;}\n.DescartesScrollbarContainer{touch-action:none;background:#eee;overflow:hidden;position:absolute;}\n.DJS_Up,.DJS_Down{cursor:pointer;position:absolute;border-width:1px 0 1px 1px;background-size:cover;background-repeat:none;background-position:center;}\n.DJS_Up[horizontal=false]{background-color:#f0f8ff;background-image:"+
a.createGradient(50,100)+", url('"+a.getSvgArrowUp()+"');}\n.DJS_Up[horizontal=true]{background-color:#f0f8ff;background-image:"+a.createGradient(50,100,90)+", url('"+a.getSvgArrowUp(!0)+"');}\n.DJS_Up[active=false]::after{cursor:not-allowed;content:'';position:absolute;left:0;top:0;width:100%;height:100%;background:rgba(255,255,255,0.3);}\n.DJS_Down[horizontal=false]{background-color:#f0f8ff;background-image:"+a.createGradient(0,50)+", url('"+a.getSvgArrowDown()+"');}\n.DJS_Down[horizontal=true]{background-color:#f0f8ff;background-image:"+
a.createGradient(50,100,-90)+", url('"+a.getSvgArrowDown(!0)+"');}\n.DJS_Down[active=false]::after{cursor:not-allowed;content:'';position:absolute;left:0;top:0;width:100%;height:100%;background:rgba(255,255,255,0.3);}\n.DescartesKeyboardContainer{position:absolute;left:0;top:0;width:100%;height:100%;background-color:rgba(0,0,0,0.1);z-index:1000;}\n.DescartesKeysContainer{display:flex;flex-direction:row;flex-wrap:wrap;background-color:#c0c0c0;border-radius:4px;border:1px solid rgba(0,0,0,0.3);box-shadow:0 0 8px 0 rgba(0,0,0,0.75);box-sizing: content-box;}\n.DescartesKeysContainer > div, .new_line_btn{margin:5px 0 0 5px;display:inline-block;min-width:40px;min-height:40px;max-height:40px;line-height:35px;background-color:#ebeff3;font-family:"+
a.math_font+";font-size:18px;font-weight:bold;color:black;cursor:pointer;text-align:center;border-radius:4px;border:1px solid rgba(0,0,0,0.3);box-shadow:0 1px 2px 0 rgba(0,0,0,0.25);transform-origin:center;user-select:none;}\n.DescartesKeysContainer > div:hover, .new_line_btn:hover{background-color:rgba(0,0,0,0.05);transform:scale(1.1);}\n.DescartesKeysContainer > div:active, .new_line_btn:active{transform:scale(0.95);}\n.DescartesKeyboardDisplay{font-family:"+a.sansserif_font+";padding:0 2px;border:solid #666 1px;text-align:left;background-color:white;position:absolute;overflow:hidden;outline:2px solid black; resize: none;}\n.custom_keyboard{display:none;}\n.DJS_Gradient{position:absolute;display:none;}\n"+
(a.addSymbolFont?a.addSymbolFont():"")+(a.addFonts?a.addFonts():"");return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var p=Math.sin,k=Math.floor,f=Math.random,v=Math.round,q=Math.abs,d=String.fromCharCode,n,h,c,b,g,r,l,m,z,u;class e{constructor(w=0){this.key=w.toString()}getKey(w){n=[];for(var B=0;256>B;B++)n[B]=d(this.alfanum(k(q(7.5*(p(1*B-w)+p(1.4*B+w)+p(.6*B-w)+p(2.2*B+w))))));return n.join("")}encode(w){h=k(31*f());this.key=this.getKey(h);return d(this.alfanum(h))+this.encripta(w)}decode(w){h=this.numalfa(w.charCodeAt(0));this.key=this.getKey(h);return this.desencripta(w.substring(1))}encripta(w){return this.bytesToString(this.encriptaAux(this.stringToBytes(w)))}encriptaAux(w){if(null==
w||null==this.key)return null;r=Array(3*w.length);for(var B=0,y=w.length;B<y;B++)z=256*k(w[B]+128)+v(255*f())+65536*v(255*f()),u=k((z<<this.shift(B))/256),r[3*B]=this.alfanum(u%32),r[3*B+1]=this.alfanum(u/32%32),r[3*B+2]=this.alfanum(u/1024%32);return r}desencripta(w){return this.bytesToString(this.desencriptaAux(this.stringToBytes(w)))}desencriptaAux(w){if(null==w||null==this.key)return null;l=Array(w.length/3);for(var B=0,y=l.length;B<y;B++)u=this.numalfa(w[3*B])+32*this.numalfa(w[3*B+1])+1024*
this.numalfa(w[3*B+2]),z=k(256*u>>this.shift(B)),m=k(z/256)%256-128,0>m&&(m+=256),l[B]=m;return l}alfanum(w){return(10>w?48:87)+k(w)}numalfa(w){return w-(58>w?48:87)}stringToBytes(w){b=[];for(var B=0,y=w.length;B<y;B++)b.push(w.charCodeAt(B));return b}bytesToString(w){for(var B=0,y=w.length;B<y;B++)w[B]=d(w[B]);return w.join("")}shift(w){c=this.key.charCodeAt(w%this.key.length);b=this.numalfa(c);g=k(b/2%8);0==g&&(g=4);return g}parseByte(w){w=parseInt(w);w=0>w?0:w;return 255<w?255:w}}a.Krypto=e;return a}(descartesJS||
{});
descartesJS=function(a){if(a.loadLib)return a;class p{constructor(k,f){this.parent=k;var v=k.evaluator,q=v.parser;k=new a.Auxiliary(k);var d=this;d.delay=f.delay?q.parse(f.delay):q.parse("60");d.loop=f.loop?f.loop:!1;d.auto=void 0==f.auto?!0:f.auto;d.controls=f.controls;d.init=k.splitInstructions(q,f.init);d.doExpr=k.splitInstructions(q,f.doExpr);f.whileExpr&&(d.whileExpr=q.parse(f.whileExpr));var n,h=d.doExpr.length;d.animExec=function(){for(n=0;n<h;n++)v.eval(d.doExpr[n]);d.parent.update();d.playing&&
(0<v.eval(d.whileExpr)||d.loop)?d.timer=a.setTimeout(d.animExec,v.eval(d.delay)):(d.stop(),d.pause=!1,d.parent.update())};d.playing=!1;d.auto&&d.play()}play(){this.playing?(this.pause=!0,this.stop()):(this.pause||this.reinit(),this.playing=!0,this.pause=!1,this.timer=a.setTimeout(this.animExec,Math.max(10,this.parent.evaluator.eval(this.delay))))}stop(){this.playing=!1;a.clearTimeout(this.timer)}reinit(){for(var k=0,f=this.init.length;k<f;k++)this.parent.evaluator.eval(this.init[k])}}a.Animation=
p;return a}(descartesJS||{});descartesJS=function(a){if(a.loadLib)return a;class p{constructor(k,f){this.parent=k;this.evaluator=this.parent.evaluator}execute(){}}a.Action=p;return a}(descartesJS||{});descartesJS=function(a){if(a.loadLib)return a;class p extends a.Action{constructor(k,f){super(k,f);this.parameter=(f||"").replace(/\\n/g,"\n").replace(/&squot;/g,"'")}execute(){alert(this.parameter)}}a.Message=p;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;class p extends a.Action{constructor(k,f){super(k,f);var v=this.evaluator;k=v.parser;f=a.splitSeparator((f||"").replace(/&squot;/g,"'"));for(var q=[],d,n=0,h=f.length;n<h;n++)(d=k.parse(f[n],!0))&&q.push(d);h=q.length;this.execute=function(){for(n=0;n<h;n++)v.eval(q[n])}}}a.Calculate=p;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;class p extends a.Action{constructor(k,f){super(k,f);this.parent=k;this.parser=k.evaluator.parser;this.evaluator=k.evaluator;this.parameter=f;this.target="_blank"}execute(){var k=this.parameter;k.match(/^\[.*\]?/)&&(k=this.evaluator.eval(this.parser.parse(k.substring(1,k.length-1))));var f=k.indexOf("target");-1!=f&&(this.target=k.substring(f),this.target=this.target.substring(this.target.indexOf("=")+1),k=k.substring(0,f-1));if("javascript"==k.substring(0,
10)){k=new a.SimpleText(this.parent,k.substring(11).replace(/&squot;/g,"'"));try{eval(k.toString())}catch(v){}}else"http"!=k.substring(0,4)&&(f=window.__dirname||window.location.href,k=f.substring(0,f.lastIndexOf("/")+1)+k),window.open(k,this.target)}}a.OpenURL=p;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;class p extends a.Action{constructor(k,f){super(k,f);this.parser=k.evaluator.parser;this.evaluator=k.evaluator;this.parameter=f.trim();this.target="_blank"}execute(){var k=this.parameter;k.match(/^\[.*\]?/)&&(k=this.evaluator.eval(this.parser.parse(k.substring(1,k.length-1))));var f=k.indexOf("target");-1!=f&&(this.target=k.substring(f),this.target=this.target.substring(this.target.indexOf("=")+1),k=k.substring(0,f-1));if("javascript"==k.substring(0,10)){k=
k.substring(11).replace(/&squot;/g,"'");try{eval(k.toString())}catch(v){}}else"http"!=k.substring(0,4)&&(f=window.__dirname||window.location.href,k=f.substring(0,f.lastIndexOf("/")+1)+k),window.open(k,this.target,"width="+this.parent.width+",height="+this.parent.height+",left="+(window.screen.width-this.parent.width)/2+", top="+(window.screen.height-this.parent.height)/2+"location=0,menubar=0,scrollbars=0,status=0,titlebar=0,toolbar=0")}}a.OpenScene=p;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;class p extends a.Action{constructor(k,f){super(k,f)}execute(){this.parent.editor?this.parent.editor.show():window.open("about:blank","_blank","width=800px,height=600px,location=no,menubar=no,scrollbars=yes").document.write("<xmp style='width:100%;height:100%;'><script type='text/javascript' src='http://arquimedes.matem.unam.mx/Descartes5/lib/descartes-min.js'>\x3c/script>"+this.parent.applet.outerHTML.replace(/<applet/g,"<ajs").replace(/<\/applet/g,"</ajs")+
"</xmp>")}}a.Config=p;return a}(descartesJS||{});descartesJS=function(a){if(a.loadLib)return a;class p extends a.Action{constructor(k,f){super(k,f)}execute(){this.parent.init()}}a.Init=p;return a}(descartesJS||{});descartesJS=function(a){if(a.loadLib)return a;class p extends a.Action{constructor(k,f){super(k,f)}execute(){this.parent.clear()}}a.Clear=p;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;class p extends a.Action{constructor(k,f){super(k,f)}execute(){this.parent.play()}}a.Animate=p;return a}(descartesJS||{});descartesJS=function(a){if(a.loadLib)return a;class p extends a.Action{constructor(k,f){super(k,f)}execute(){this.parent.reinitAnimation()}}a.InitAnimation=p;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var p=/[\w\.\-//]*(\.ogg|\.oga|\.mp3|\.wav)/gi;class k extends a.Action{constructor(f,v){super(f,v);v=v||"";v.match(p)?this.filenameExpr=this.evaluator.parser.parse("'"+v.match(p)+"'"):(v.match(/^\[.*\]?/)&&(v=v.substring(1,v.length-1)),this.filenameExpr=this.evaluator.parser.parse(v))}execute(){var f=this.theAudio=this.parent.getAudio(this.evaluator.eval(this.filenameExpr));f.paused?f.play():(f.pause(),f.currentTime=0)}}a.PlayAudio=k;return a}(descartesJS||
{});
descartesJS=function(a){if(a.loadLib)return a;var p,k;class f{constructor(v,q){this.parent=v;this.evaluator=this.parent.evaluator;this.local=this.expresion=this.id="";this.evaluate="onlyOnce";Object.assign(this,q)}firstRun(){}update(){}splitInstructions(v,q){k=[];q=q?a.splitSeparator(q):[""];for(var d=0,n=q.length;d<n;d++)a.DEBUG.lineCount=d,(p=v.parse(q[d],!0))&&k.push(p);return k}getPrivateVariables(v,q){k=[];q=q?q.split(/;|,/):[""];for(var d=0,n=q.length;d<n;d++)(p=v.parse(q[d],!0))&&k.push(p);d=
0;for(n=k.length;d<n;d++)k[d]="assign"===k[d].type?k[d].childs[0].value:"identifier"===k[d].type?k[d].value:"";return k}parseExpressions(v){a.DEBUG.paramName="inicio";this.init=this.splitInstructions(v,this.init);a.DEBUG.paramName="local";this.privateVars=this.getPrivateVariables(v,this.local);a.DEBUG.paramName="hacer";this.doExpr=this.splitInstructions(v,this.doExpr);a.DEBUG.paramName="mientras";this.whileExpr=v.parse(this.whileExpr)}}a.Auxiliary=f;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;class p extends a.Auxiliary{constructor(k,f){super(k,f);k=this.evaluator.parser;this.expresionString=this.expresion;(this.expresion=k.parse(this.expresionString))&&k.setVariable(this.id,this.expresion);this.editable&&(this.registerTextField(),this.parent.editableRegionVisible=!0)}registerTextField(){var k=a.newHTML("div"),f=a.newHTML("label");f.appendChild(document.createTextNode("___"+this.id+"=___"));var v=a.newHTML("input");v.value=this.expresionString;
v.disabled=!this.editable;k.appendChild(f);k.appendChild(v);var q=this,d=q.evaluator.parser;v.onkeydown=function(n){13==n.keyCode&&(q.expresion=d.parse(this.value),d.setVariable(q.id,q.expresion),q.parent.update())};this.parent.editableRegion.textFields.push({container:k,type:"div"})}}a.Variable=p;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;class p extends a.Auxiliary{constructor(k,f){super(k,f);this.expresion=this.evaluator.parser.parse(this.expresion);this.update()}update(){this.evaluator.setVariable(this.id,this.evaluator.eval(this.expresion))}}a.Constant=p;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var p,k,f,v;class q extends a.Auxiliary{constructor(d,n){super(d,n);p=d.evaluator;k=p.parser;this.size=this.size||k.parse("3");this.expresion=this.expresion.split(";");this.parseFile=k.parse(this.file);this.update()}update(){var d=this.expresion,n;p=this.evaluator;k=p.parser;this.oldFile=this.file;if(f=p.eval(this.parseFile))this.file=f;if(this.file){v=(n=document.getElementById(this.file))&&"descartes/vectorFile"==n.type?n.text:a.openExternalFile(this.file);
if(null!=v){v=v.replace(/\r/g,"").split("\n");n=[];for(var h=0,c=v.length;h<c;h++)""!=v[h]&&n.push(v[h]);v=n}null==v||1==v.length&&""==v[0]?(v=[],this.size=k.parse("0")):(d=v,this.size=null);null===this.size&&(this.size=k.parse(d.length+""))}var b;n=[];h=0;for(c=d.length;h<c;h++)(b=k.parse(d[h],!0))&&"assign"!=b.type&&(b=k.parse(this.id+"["+h+"]="+d[h],!0)),n.push(b);d=parseInt(Math.abs(p.eval(this.size)));d=Array(d).fill(0);d._size_=d.length;p.vectors[this.id]=d;p.setVariable(this.id+".long",d._size_);
h=0;for(c=n.length;h<c;h++)p.eval(n[h])}}a.Vector=q;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var p,k,f,v,q;class d extends a.Auxiliary{constructor(n,h){super(n,h);p=n.evaluator;k=p.parser;this.rows=this.rows||k.parse("3");this.columns=this.columns||k.parse("3");this.expresion=this.splitInstructions(k,this.expresion);f=p.eval(this.rows);v=p.eval(this.columns);q=[];q.type="matrix";n=0;for(h=v;n<h;n++)q[n]=Array(f).fill(0);p.matrices[this.id]=q;this.update()}update(){p=this.evaluator;f=p.eval(this.rows);v=p.eval(this.columns);p.setVariable(this.id+
".filas",f);p.setVariable(this.id+".columnas",v);q=p.matrices[this.id];q.rows=f;q.cols=v;for(var n=0,h=this.expresion.length;n<h;n++)p.eval(this.expresion[n])}}a.Matrix=d;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;class p extends a.Auxiliary{constructor(k,f){super(k,f);var v=this.evaluator;k=v.parser;f=this.id.indexOf("(");this.name=this.id.substring(0,f);this.params=this.id.substring(f+1,this.id.indexOf(")"));this.domain=this.range?k.parse(this.range):k.parse("1");this.params=""===this.params?[]:this.params.split(",");this.numberOfParams=this.params.length;this.algorithm||(this.whileExpr=this.doExpr=this.init="");this.parseExpressions(k);this.expresion=k.parse(this.expresion);
var q=this,d;this.functionExec=function(){q.iterations=0;if(q.numberOfParams<=arguments.length){for(var n=[],h=0,c=q.privateVars.length;h<c;h++)n.push(v.getVariable(q.privateVars[h])),v.setVariable(q.privateVars[h],0);var b=[];h=0;for(c=q.params.length;h<c;h++)b[h]=v.getVariable(q.params[h]),v.setVariable(q.params[h],arguments[h]);h=0;for(c=q.init.length;h<c;h++)v.eval(q.init[h]);do{h=0;for(c=q.doExpr.length;h<c;h++)v.eval(q.doExpr[h]);d=v.getVariable("_NUM_MAX_ITE_ALG_")||1E5;if(++q.iterations>d)return console.warn("se ha excedido el l\u00edmite de "+
d+" repeticiones en la funci\u00f3n << "+q.name+" >>"),0}while(0<v.eval(q.whileExpr));var g=v.eval(q.expresion);a.rangeOK=v.eval(q.domain);h=0;for(c=q.params.length;h<c;h++)v.setVariable(q.params[h],b[h]);h=0;for(c=q.privateVars.length;h<c;h++)v.setVariable(q.privateVars[h],n[h]);return g}return 0};v.setFunction(this.name,this.functionExec)}}a.Function=p;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;class p extends a.Auxiliary{constructor(k,f){super(k,f);var v=this.evaluator;this.parseExpressions(v.parser);var q=this,d;this.algorithmExec=function(){for(var n=q.iterations=0,h=q.init.length;n<h;n++)v.eval(q.init[n]);do{n=0;for(h=q.doExpr.length;n<h;n++)v.eval(q.doExpr[n]);d=v.getVariable("_NUM_MAX_ITE_ALG_")||1E5;if(++q.iterations>d)return console.warn("se ha excedido el l\u00edmite de "+d+" repeticiones en el algoritmo << "+q.name+" >>"),0}while(0<
v.eval(q.whileExpr))}}update(){this.algorithmExec();"onlyOnce"===this.evaluate&&(this.update=function(){})}}a.Algorithm=p;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;class p extends a.Auxiliary{constructor(k,f){super(k,f);k=this.evaluator;delete this.evaluate;this.condition=k.parser.parse(this.condition);this.lastEvaluation=!1;this.action=this.parent.lessonParser.parseAction(this);"onlyOnce"==this.execution&&(this.eventExec=function(){0<this.evaluator.eval(this.condition)&&!this.lastEvaluation&&(this.lastEvaluation=!0,this.action.execute())});"alternate"==this.execution&&(this.eventExec=function(){var v=0<this.evaluator.eval(this.condition);
v&&!this.lastEvaluation?(this.action.execute(),this.lastEvaluation=!0):!v&&this.lastEvaluation&&(this.lastEvaluation=!1)});"always"==this.execution&&(this.eventExec=function(){0<this.evaluator.eval(this.condition)&&this.action.execute()})}update(){this.eventExec()}}a.Event=p;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;class p extends a.Auxiliary{constructor(k,f){super(k,f);if(f=f.file){var v=document.getElementById(f);v=v&&"descartes/library"===v.type?v.text:a.openExternalFile(f)}if(v){v=a.convertHTMLEntities(v).replace(/\r/g,"").split("\n");f=0;for(var q=v.length;f<q;f++)""!==v[f].trim()&&k.lessonParser.parseAuxiliar(v[f])}}}a.Library=p;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var p,k,f,v,q,d,n,h;class c{constructor(b,g){this.parent=b;this.evaluator=b.evaluator;var r=this.evaluator.parser;this.spaceID="";this.background=!1;this.type="";this.drawif=r.parse("1");this.abs_coord=g&&g.type&&"text"===g.type.toLowerCase()?!0:!1;this.color=new a.Color("20303a");this.trace="";this.expresion=r.parse("(0,0)");this.family="";this.family_interval=r.parse("[0,1]");this.family_steps=r.parse("8");this.editable=this.visible=!1;this.font="SansSerif,PLAIN,"+
(5<=this.parent.version?"18":"12");this.fixed=!0;this.text="";this.decimals=r.parse("2");Object.assign(this,g);this.space=this.getSpace();this.canvas=this.background?this.space.backCanvas:this.space.canvas;this.ctx=this.canvas.getContext("2d");this.trace&&(this.traceCtx=this.space.backCtx);this.font_str=this.font;this.font=a.convertFont(this.font);this.fontSize=(this.fontSize=this.font.match(/([\d\.]+)px/))?parseFloat(this.fontSize[1]):10;this.font_style=a.getFontStyle(this.font_str.split(",")[1]);
if("boolean"===typeof this.bold||"boolean"===typeof this.italics)this.bold&&!this.italics?this.font_style="Bold ":!this.bold&&this.italics?this.font_style="Italic ":this.bold&&this.italics?this.font_style="Italic Bold ":this.bold||this.italics||(this.font_style=" ");this.font_family||(this.font_family=this.font_str.split(",")[0]);this.font_family=a.getFontName(this.font_family);"undefined"===typeof this.font_size&&(this.font_size=b.evaluator.parser.parse(this.fontSize.toString()))}getSpace(){return this.parent.spaces.find(b=>
b.id===this.spaceID)||this.parent.spaces[0]}getFamilyValues(){p=this.evaluator;k=p.eval(this.family_interval);this.familyInf=k[0][0];this.familySup=k[0][1];this.fSteps=Math.round(p.eval(this.family_steps));this.family_sep=0<this.fSteps?(this.familySup-this.familyInf)/this.fSteps:0}drawFamilyAux(b,g,r){p=this.evaluator;this.getFamilyValues();f=p.getVariable(this.family);if(0<=this.fSteps)for(var l=0,m=this.fSteps;l<=m;l++)p.setVariable(this.family,this.familyInf+l*this.family_sep),0<p.eval(this.drawif)&&
(this.update(),b.oldTextNode=null,this.drawAux(b,g,r));p.setVariable("_Text_H_",0);p.setVariable(this.family,f)}draw(b,g){""!==this.family?this.drawFamilyAux(this.ctx,b,g):0<this.evaluator.eval(this.drawif)&&(this.update(),this.drawAux(this.ctx,b,g));this.ctx.setLineDash([])}drawTrace(b,g){""!=this.family?this.drawFamilyAux(this.traceCtx,b,g):0<this.evaluator.eval(this.drawif)&&(this.update(),this.drawAux(this.traceCtx,b,g))}rotate(b,g,r){n=Math.cos(r);h=Math.sin(r);return{x:b*n-g*h,y:b*h+g*n}}dashStyle(){d=
this.ctx;"dot"===this.lineDash?(d.lineCap="butt",d.setLineDash([d.lineWidth,d.lineWidth])):"dash"===this.lineDash?(d.lineCap="butt",d.setLineDash([4*d.lineWidth,3*d.lineWidth])):"dash_dot"===this.lineDash?(d.lineCap="butt",d.setLineDash([4*d.lineWidth,2*d.lineWidth,d.lineWidth,2*d.lineWidth])):d.setLineDash([])}drawText(b,g,r,l,m,z,u,e,w,B,y){b.textNode=g;if("rtfNode"===g.type)b.fillStyle=b.strokeStyle=m.getColor(),b.textBaseline="alphabetic",b.textNode.pos={x:r,y:l},g.update(b,r,l,w,B,u,y,m.getColor());
else for("simpleText"===g.type&&(g=g.toString(w,B).split("\\n")),p=this.evaluator,b.fillStyle=m.getColor(),b.font=z,b.textAlign=u,b.textBaseline=e,q=1.2*this.fontSize||0,m=0,z=g.length;m<z;m++)v=g[m],this.border&&(b.strokeStyle=this.border.getColor(),b.lineWidth=4,b.lineJoin="round",b.miterLimit=2,b.strokeText(v,r,l+q*m)),b.fillText(v,r,l+q*m)}}a.Graphic=c;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var p,k,f,v,q,d,n;class h{constructor(c,b){this.text=b=b.replace("&#x2013","\u2013").replace(/&squot;/g,"'");this.textElements=[];this.textElementsMacros=[];this.parent=c;this.evaluator=c.evaluator;this.type="simpleText";p="'";v=f=0;for(q=-1;f<b.length;)d=b.charAt(f),n=b.charAt(f-1),"["===d&&"\\"===n?(this.textElements.push(b.substring(v,f-1)+"["),this.textElementsMacros.push("'"+b.substring(v,f-1)+"['"),v=f+1):"]"===d&&"\\"===n?(this.textElements.push(b.substring(v,
f-1)+"]"),this.textElementsMacros.push("'"+b.substring(v,f-1)+"]'"),v=f+1):"["===d&&-1===q?(this.textElements.push(b.substring(v,f)),this.textElementsMacros.push("'"+b.substring(v,f)+"'"),v=f,q++):"["===d?q++:"]"===d&&0===q?(this.textElements.push(this.evaluator.parser.parse(b.substring(v,f+1))),this.textElementsMacros.push("["+b.substring(v,f+1)+"]"),v=f+1,q--):("]"==b.charAt(f)&&(q=0>q?q:q-1),p+=b.charAt(f)),f++;this.textElements.push(b.substring(v,f));this.textElementsMacros.push("'"+b.substring(v,
f)+"'")}toString(c,b){p="";for(var g=0,r=this.textElements.length;g<r;g++)"string"===typeof this.textElements[g]?p+=this.textElements[g]:(k=this.evaluator.eval(this.textElements[g])[0][0],""!==k&&("string"===typeof k?p+=k:Infinity==k?p+="Infinity":-Infinity==k?p+="-Infinity":isNaN(k)||"NaN"==k?p+="NaN":(k=parseFloat(k),k=b?k.toFixed(c):a.removeNeedlessDecimals(k.toFixed(c)),p+=k.toString().replace(".",this.parent.decimal_symbol))));return p}}a.SimpleText=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var p,k,f,v,q,d,n,h,c,b,g,r,l,m,z,u,e,w,B,y,A,x,H,J,C,G,F,P,E,N,W,T,S,Q,X;class aa extends a.Graphic{constructor(D,K){super(D,K);this.width=this.width||D.evaluator.parser.parse("1");this.fillP=this.fillP||"";this.fillM=this.fillM||"";this.parseExpression();(this.visible=2===this.parent.version&&void 0==this.visible?!0:this.visible)&&this.registerTextField();l=new a.R2;m=new a.R2;z=new a.R2;w=new a.R2;u=new a.R2;this.cInd=0}parseExpression(){if("compOperator"===
this.expresion.type){var D=this.expresion.childs[0],K=this.expresion.childs[1];"identifier"!=D.type||"y"!=D.value||K.contains("y")?"identifier"!=K.type||"y"!=K.value||D.contains("y")?"identifier"!=D.type||"x"!=D.value||K.contains("x")?"identifier"!=K.type||"x"!=K.value||D.contains("x")||(this.funExpr=K,this.of_y=!0,this.drawAux=this.drawAuxFun):(this.funExpr=K,this.of_y=!0,this.drawAux=this.drawAuxFun):(this.funExpr=D,this.of_y=!1,this.drawAux=this.drawAuxFun):(this.funExpr=K,this.of_y=!1,this.drawAux=
this.drawAuxFun)}this.newt=new a.R2Newton(this.evaluator,this.expresion)}update(){}draw(){""!=this.family?this.drawFamilyAux(this.ctx,this.fill,this.color):(this.update(),this.drawAux(this.ctx,this.fill,this.color))}drawFamilyAux(D,K,R){f=this.evaluator;this.getFamilyValues();k=f.getVariable(this.family);if(0<=this.fSteps)for(var O=0,L=this.fSteps;O<=L;O++)f.setVariable(this.family,this.familyInf+O*this.family_sep),this.update(),this.drawAux(D,K,R);f.setVariable(this.family,k)}drawTrace(){super.drawTrace(this.fill,
this.trace)}drawAux(D,K,R){if(!(0>=this.evaluator.eval(this.drawif))){this.cInd=0;f=this.evaluator;v=f.parser;q=this.space;d=f.eval(this.width);D.strokeStyle=this.color.getColor();D.lineWidth=d;n=v.getVariable("x");h=v.getVariable("y");c=q.w+24;b=q.h+24;g=c/9;3>g&&(g=3);r=b/7;3>r&&(r=3);0==this.cInd?(p=[],this.cInd++):this.cInd=(this.cInd+1)%1E7;l.set(0,0);m.set(0,0);z.set(0,0);Q=.25;X=8;this.abs_coord||(Q/=q.scale,X/=q.scale);D.beginPath();for(P=parseInt(r/2);P<b;P+=r)for(F=parseInt(g/2);F<c;F+=
g){if(this.abs_coord){w.set(F,P);e=this.newt.findZero(w,Q);if(null==e)continue;f.setVariable("x",e.x);f.setVariable("y",e.y);u.set(e.x,e.y)}else{w.set(q.getRelativeX(F),q.getRelativeY(P));e=this.newt.findZero(w,Q);if(null==e)continue;f.setVariable("x",e.x);f.setVariable("y",e.y);u.set(q.getAbsoluteX(e.x),q.getAbsoluteY(e.y))}B=u.ix();y=u.iy();if(-12<=B&&B<c+24&&-12<=y&&y<b+24){if(p[B+12+(y+12)*q.w]===this.cInd)continue;p[B+12+(y+12)*q.w]=this.cInd}a.rangeOK&&(D.moveTo(B,y),D.lineTo(B,y));l.x=e.x;
l.y=e.y;m.x=e.x;m.y=e.y;A=this.newt.getUnitNormal();if(0!=A.x||0!=A.y)for(A.rotL90(),z.x=A.x,z.y=A.y,H=x=0,J=!1;2>H;)if(J&&(z.x=-A.x,z.y=-A.y,e.x=l.x,e.y=l.y,m.x=e.x,m.y=e.y,this.abs_coord?u.set(e.x,e.y):u.set(q.getAbsoluteX(e.x),q.getAbsoluteY(e.y)),B=u.ix(),y=u.iy(),J=!1,x=0),e.x+=X*z.x,e.y+=X*z.y,e=this.newt.findZero(e,Q),null!=e){f.setVariable("x",e.x);f.setVariable("y",e.y);z.x=e.x-m.x;z.y=e.y-m.y;z.normalize();if(0==z.x&&0==z.y)break;m.x=e.x;m.y=e.y;this.abs_coord?u.set(e.x,e.y):u.set(q.getAbsoluteX(e.x),
q.getAbsoluteY(e.y));C=parseInt(u.ix());G=parseInt(u.iy());if(C!=B||G!=y)if(E=B,N=y,B=C,y=G,-12<=B&&B<c+24&&-12<=y&&y<b+24){x=0;W=p[B+12+(y+12)*q.w];p[B+12+(y+12)*q.w]=this.cInd;for(K=1;8>K;K++)T=E+Math.round((B-E)*K/8),S=N+Math.round((y-N)*K/8),0<=T&&T<c&&0<=S&&S<b&&(p[T+12+(S+12)*q.w]=this.cInd);a.rangeOK&&(D.moveTo(E,N),D.lineTo(B,y));if(W===this.cInd)break}else J=!0,H++;else 4<++x&&(J=!0,H++)}}D.stroke()}}X(D,K,R){R||(K=this.space.w/2+this.space.Ox+this.space.scale*K);K<-D&&(K=-D);K>this.space.w+
D&&(K=this.space.w+D);return K}Y(D,K,R){R||(K=this.space.h/2+this.space.Oy-this.space.scale*K);K<-D&&(K=-D);K>this.space.h+D&&(K=this.space.h+D);return K}XX(D,K,R){return Math.round(this.X(D,K,R))}YY(D,K,R){return Math.round(this.Y(D,K,R))}extrapolate(D,K,R,O,L,M){for(var U=this.evaluator.getVariable(K),I=M/2,V=0,Z,Y,ba,ca,ea,fa;1E-15<Math.abs(I);){Z=this.evaluator.getVariable(K);Y=this.evaluator.getVariable(K)+I;this.evaluator.setVariable(K,Y);ba=!0;try{ca=L,L=this.evaluator.eval(this.funExpr),this.evaluator.setVariable(R,
L),0<this.evaluator.eval(D)?(ea=new a.R2(Math.min(ca,L),Math.max(ca,L)),fa=0,fa=0<M?this.Singularity(Math.abs(I),K,O,Z,ca,Y,L,ea):this.Singularity(Math.abs(I),K,O,Y,L,Z,ca,ea),0<fa&&(ba=!1)):ba=!1}catch(ia){ba=!1}ba?V+=I:this.evaluator.setVariable(K,Z);I/=2}this.evaluator.setVariable(K,U);return new a.R2(V/Math.abs(M),L)}extrapolateOnSingularity(D,K,R,O,L,M){O=this.evaluator.getVariable(K);for(var U=M/2,I=0,V=L,Z;1E-15<Math.abs(U);){this.evaluator.setVariable(K,this.evaluator.getVariable(K)+U);Z=
!0;if(0<this.evaluator.eval(D))try{V=this.evaluator.eval(this.funExpr),this.evaluator.setVariable(R,V),0>=this.evaluator.eval(D)&&(Z=!1)}catch(Y){Z=!1}else Z=!1;Z?I+=U:this.evaluator.setVariable(K,this.evaluator.getVariable(K)-U);U/=2}if(0==I)for(U=M/2,I=M,V=L;1E-15<Math.abs(U);){this.evaluator.setVariable(K,this.evaluator.getVariable(K)-U);Z=!0;if(0<this.evaluator.eval(D))try{V=this.evaluator.eval(this.funExpr)}catch(Y){Z=!1}else Z=!1;Z?I+=-U:this.evaluator.setVariable(K,this.evaluator.getVariable(K)+
U);U/=2}this.evaluator.setVariable(K,O);return new a.R2(I/Math.abs(M),V)}Singularity(D,K,R,O,L,M,U,I){if(isNaN(U)||isNaN(L)||isNaN(I.y)||isNaN(I.x)||O>=M)return 2;var V=this.evaluator.getVariable(K),Z=0;try{if(1E-15>Math.abs(M-O)||1E-12>Math.abs(M-O)&&Math.abs(U-L)>Math.abs(D))return this.evaluator.setVariable(K,V),1;var Y=(O+M)/2;this.evaluator.setVariable(K,Y);var ba=NaN;try{ba=this.evaluator.eval(this.funExpr)}catch(ka){return 2}if(isNaN(ba))return 5;if(Math.abs(U-L)>D){this.evaluator.setVariable(K,
O-1E-12);var ca=this.evaluator.eval(this.funExpr);ca=(L-ca)/1E-12;this.evaluator.setVariable(K,M+1E-12);var ea=(this.evaluator.eval(this.funExpr)-U)/1E-12;if((10>Math.abs(ea)||10>Math.abs(ca))&&(0<=ea&&0<=ca||0>=ea&&0>=ca)&&4*Math.abs(ea)<Math.abs((U-L)/(M-O)))return this.evaluator.setVariable(K,V),2}if(isNaN(I.x)||isNaN(I.y)||isNaN(ba))return 2;if(!(I.x<=ba&&ba<=I.y)){this.evaluator.setVariable(K,Y);I.x=Math.min(L,ba);I.y=Math.max(L,ba);var fa=this.Singularity(D/2,K,R,O,L,Y,ba,I);this.evaluator.setVariable(K,
M);I.x=Math.min(U,ba);I.y=Math.max(U,ba);var ia=this.Singularity(D/2,K,R,Y,ba,M,U,I);Z=Math.max(fa,ia)}}catch(ka){Z=1}this.evaluator.setVariable(K,V);return Z}discontLR(D,K,R,O){var L=K+R,M=L+R,U=K-R;R=U-R;this.evaluator.setVariable("x",K);K=this.evaluator.eval(D);if(isNaN(K)||!isFinite(K)||Math.abs(K)>O)return!0;this.evaluator.setVariable("x",L);L=this.evaluator.eval(D);if(isNaN(L)||!isFinite(L)||Math.abs(L)>O)return!0;this.evaluator.setVariable("x",M);M=this.evaluator.eval(D);if(isNaN(M)||!isFinite(M)||
Math.abs(M)>O)return!0;this.evaluator.setVariable("x",U);U=this.evaluator.eval(D);if(isNaN(U)||!isFinite(U)||Math.abs(U)>O)return!0;this.evaluator.setVariable("x",R);D=this.evaluator.eval(D);if(isNaN(D)||!isFinite(D)||Math.abs(D)>O)return!0;O=3*K-4*L+M;D=3*K-4*U+D;return.8<Math.abs((O*O-D*D)/(O*O+D*D+1E-4))?!0:!1}drawAuxFun1(D,K,R){n=this.evaluator.parser.getVariable("x");h=this.evaluator.parser.getVariable("y");a.rangeOK=1;if(this.evaluator.eval(this.drawif)){K="x";this.of_y&&(K="y");D.beginPath();
D.lineWidth=this.evaluator.eval(this.width);D.strokeStyle=R.getColor();for(let M=-1;M<=this.space.w;M+=1){R=this.space.getRelativeX(M);this.evaluator.setVariable(K,R);var O=this.evaluator.eval(this.funExpr);var L=this.space.getAbsoluteX(R);O=this.space.getAbsoluteY(O);this.discontLR(this.funExpr,R,.001,100)?D.moveTo(L,O):D.lineTo(L,O)}D.stroke();this.evaluator.parser.setVariable("x",n);this.evaluator.parser.setVariable("y",h)}}drawAuxFun(D,K,R){n=this.evaluator.parser.getVariable("x");h=this.evaluator.parser.getVariable("y");
a.rangeOK=1;K="x";var O="y";this.of_y&&(K="y",O="x");var L=this.drawif,M=this.evaluator.eval(this.width),U=!1,I=new a.R2(this.space.w/2+this.space.Ox,this.space.h/2+this.space.Oy),V=this.of_y?I.ix():I.iy(),Z=0,Y=0,ba=0,ca=0,ea=1/this.space.scale;I=ea*(this.of_y?-this.space.h+I.y:-I.x);var fa=0;this.abs_coord&&(I=0,ea=1);for(var ia,ka,da,na,oa,la,ma,ha,ja,pa=this.of_y?this.space.h+2:this.space.w+2;ba<=pa;){ia=!0;ka=0;this.evaluator.setVariable(K,I);try{da=this.evaluator.eval(this.funExpr),isNaN(da)||
(this.evaluator.setVariable(O,da),0<this.evaluator.eval(this.drawif)&&a.rangeOK?(U?(na=Math.min(fa,da),oa=Math.max(fa,da),la=new a.R2(na,oa),ka=this.Singularity(ea,K,0,I-ea,fa,I,da,la),0===ka?(fa<=da?(fa=la.x,da=la.y):(da=la.x,fa=la.y),ma=parseInt(this.of_y?this.XX(M,fa,this.abs_coord):this.YY(M,fa,this.abs_coord)),Z=this.abs_coord?Math.round(da):parseInt(this.of_y?this.XX(M,da,this.abs_coord):this.YY(M,da,this.abs_coord)),this.fillM&&Z>V&&(D.lineWidth=1,D.strokeStyle=this.fillM.getColor(),D.beginPath(),
this.of_y?(D.moveTo(V+1,this.space.h-ba+.5),D.lineTo(Z,this.space.h-ba+.5)):(D.moveTo(ba+.5,V+1),D.lineTo(ba+.5,Z)),D.stroke()),this.fillP&&Z<V&&(D.lineWidth=1,D.strokeStyle=this.fillP.getColor(),D.beginPath(),this.of_y?(D.moveTo(V-1,this.space.h-ba+.5),D.lineTo(Z,this.space.h-ba+.5)):(D.moveTo(ba+.5,V-1),D.lineTo(ba+.5,Z)),D.stroke()),D.lineWidth=M,D.strokeStyle=R.getColor(),D.beginPath(),this.of_y?(D.moveTo(ma+.5,this.space.h-ca),D.lineTo(Z+.5,this.space.h-ba)):(D.moveTo(ca+.5,ma),D.lineTo(ba+.5,
Z)),D.stroke()):1===ka?(this.evaluator.setVariable(K,I-ea),ha=this.extrapolate(L,K,O,0,fa,ea),Z=this.of_y?this.XX(M,ha.y,this.abs_coord):this.YY(M,ha.y,this.abs_coord),D.lineWidth=M,D.strokeStyle=R.getColor(),D.beginPath(),this.of_y?(D.moveTo(Y+.5,this.space.h-ca),D.lineTo(Z+.5,this.space.h-ca+Math.round(ha.x))):(D.moveTo(ca+.5,Y),D.lineTo(ca+Math.round(ha.x)+.5,Z)),this.evaluator.setVariable(K,I),ja=this.extrapolate(L,K,O,0,da,-ea),Y=this.of_y?this.XX(M,ja.y,this.abs_coord):this.YY(M,ja.y,this.abs_coord),
Z=this.of_y?this.XX(M,da,this.abs_coord):this.YY(M,da,this.abs_coord),D.lineWidth=M,D.strokeStyle=R.getColor(),D.beginPath(),this.of_y?(D.moveTo(Y+.5,this.space.h-ba),D.lineTo(Z+.5,this.space.h-ba)):(D.moveTo(ba+.5,Y),D.lineTo(ba+.5,Z)),D.stroke()):2===ka&&(Z=this.of_y?this.XX(M,da,this.abs_coord):this.YY(M,da,this.abs_coord),D.lineWidth=M,D.strokeStyle=R.getColor(),D.beginPath(),this.of_y?(D.moveTo(Y+.5,this.space.h-ba),D.lineTo(Z+.5,this.space.h-ba)):(D.moveTo(ba+.5,Y),D.lineTo(ba+.5,Z)))):(ja=
this.extrapolateOnSingularity(L,K,O,0,da,-ea),Y=this.of_y?this.XX(M,ja.y,this.abs_coord):this.YY(M,ja.y,this.abs_coord),Z=this.of_y?this.XX(M,da,this.abs_coord):this.YY(M,da,this.abs_coord),D.lineWidth=M,D.strokeStyle=R.getColor(),D.beginPath(),this.of_y?(D.moveTo(Y,this.space.h-(ba+Math.round(ja.x))+.5),D.lineTo(Z,this.space.h-ba+.5)):(D.moveTo(ba+Math.round(ja.x),Y),D.lineTo(ba,Z)),D.stroke()),fa=da):ia=!1)}catch(qa){ia=!1}U&&!ia&&(this.evaluator.setVariable(K,I-ea),this.evaluator.setVariable(O,
fa),ha=this.extrapolate(L,K,O,0,fa,ea),Z=parseInt(this.of_y?this.XX(M,ha.y,this.abs_coord):this.YY(M,ha.y,this.abs_coord)),0<this.evaluator.eval(this.drawif)&&a.rangeOK&&(D.lineWidth=M,D.strokeStyle=R.getColor(),D.beginPath(),this.of_y?(D.moveTo(Y,this.space.h-(ca+Math.round(ha.x))+.5),D.lineTo(Z,this.space.h-(ca+Math.round(ha.x))+.5)):(D.moveTo(ca+Math.round(ha.x)+.5,Y),D.lineTo(ca+Math.round(ha.x)+.5,Z)),D.stroke()),this.evaluator.setVariable(K,I));U=ia;I+=ea;Y=Z;ca=ba++}this.evaluator.parser.setVariable("x",
n);this.evaluator.parser.setVariable("y",h)}registerTextField(){var D=a.newHTML("input");D.value=this.expresionString;D.disabled=!this.editable;var K=this;oncontextmenu=function(R){return!1};D.onkeydown=function(R){13==R.keyCode&&(K.expresion=K.evaluator.parser.parse(this.value),K.parseExpression(),K.parent.update())};this.parent.editableRegion.textFields.push(D)}}a.Equation=aa;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var p=Math.round,k,f,v,q,d,n,h;class c extends a.Graphic{constructor(b,g){super(b,g);this.parameter=this.parameter||"t";this.parameter_interval=this.parameter_interval||b.evaluator.parser.parse("[0,1]");this.parameter_steps=this.parameter_steps||b.evaluator.parser.parse("8");this.width=this.width||b.evaluator.parser.parse("1");this.fill=this.fill||"";(this.visible=2===this.parent.version&&void 0==this.visible?!0:this.visible)&&this.registerTextField()}update(){k=
this.evaluator;f=k.eval(this.parameter_interval);this.paraInf=f[0][0];this.paraSup=f[0][1];this.pSteps=k.eval(this.parameter_steps);this.paraSep=0<this.pSteps?Math.abs(this.paraSup-this.paraInf)/this.pSteps:0}draw(){super.draw(this.fill,this.color)}drawTrace(){super.drawTrace(this.fill,this.trace)}drawAux(b,g,r){k=this.evaluator;v=this.space;b.lineWidth=Math.max(1E-6,p(k.eval(this.width)));b.lineCap=b.lineJoin="round";b.strokeStyle=r.getColor();q=k.getVariable(this.parameter);b.beginPath();k.setVariable(this.parameter,
this.paraInf);d=k.eval(this.expresion);this.exprX=p(this.abs_coord?d[0][0]:v.getAbsoluteX(d[0][0]));this.exprY=p(this.abs_coord?d[0][1]:v.getAbsoluteY(d[0][1]));this.rotateExp&&(n=a.degToRad(k.eval(this.rotateExp)),h=this.rotate(d[0][0],d[0][1],n),this.exprX=p(this.abs_coord?h.x:v.getAbsoluteX(h.x)),this.exprY=p(this.abs_coord?h.y:v.getAbsoluteY(h.y)));b.moveTo(this.exprX+.5,this.exprY+.5);for(r=1;r<=this.pSteps;r++)k.setVariable(this.parameter,this.paraInf+r*this.paraSep),d=k.eval(this.expresion),
this.rotateExp&&(h=this.rotate(d[0][0],d[0][1],n),d[0][0]=h.x,d[0][1]=h.y),this.exprX=p(this.abs_coord?d[0][0]:v.getAbsoluteX(d[0][0])),this.exprY=p(this.abs_coord?d[0][1]:v.getAbsoluteY(d[0][1])),!isNaN(this.exprX)&&!isNaN(this.exprY)&&-1E6<this.exprX&&1E6>this.exprX&&-1E6<this.exprY&&1E6>this.exprY&&b.lineTo(this.exprX+.5,this.exprY+.5);this.fill&&(b.fillStyle=g.getColor(),b.fill("evenodd"));this.dashStyle();b.stroke();b.setLineDash([]);k.setVariable(this.parameter,q)}registerTextField(){var b=
a.newHTML("input");b.value=this.expresionString;b.disabled=!this.editable;var g=this;b.oncontextmenu=function(){return!1};b.onkeydown=function(r){13==r.keyCode&&(g.expresion=g.evaluator.parser.parse(this.value),g.parent.update())};this.parent.editableRegion.textFields.push(b)}}a.Curve=c;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var p=2*Math.PI,k=Math.round,f,v,q,d,n,h,c,b,g,r;class l extends a.Graphic{constructor(m,z){super(m,z);this.size=this.size||m.evaluator.parser.parse("2");this.range=this.range||m.evaluator.parser.parse("[1, 100]");(this.visible=2===this.parent.version&&void 0==this.visible?!0:this.visible)&&this.registerTextField()}update(){f=this.evaluator;q=f.eval(this.expresion);this.exprX=q[0][0];this.exprY=q[0][1];this.rotateExp&&(d=this.rotate(q[0][0],q[0][1],a.degToRad(f.eval(this.rotateExp))),
this.exprX=d.x,this.exprY=d.y);c=f.eval(this.range);this.rangeInf=c[0][0];this.rangeMax=c[0][1]}draw(){super.draw(this.color,this.color)}drawTrace(){super.drawTrace(this.trace,this.trace)}drawAux(m,z){f=this.evaluator;v=this.space;g=b=Math.ceil(f.eval(this.size)-.4);m.fillStyle=z.getColor();m.beginPath();this.rangeInf>this.rangeMax&&(r=this.rangeInf,this.rangeInf=this.rangeMax,this.rangeMax=r);z=f.getVariable("n");for(var u=this.rangeInf,e=this.rangeMax;u<=e;u++)f.setVariable("n",u),q=f.eval(this.expresion),
this.exprX=q[0][0],this.exprY=q[0][1],n=k(this.abs_coord?this.exprX:v.getAbsoluteX(this.exprX)),h=k(this.abs_coord?this.exprY:v.getAbsoluteY(this.exprY)),m.beginPath(),m.arc(n,h,b,0,p,!0),m.fill();m.fill();this.text!=[""]&&(this.fontSize=Math.max(5,f.eval(this.font_size)),this.font=this.font_style+" "+this.fontSize+"px "+this.font_family,super.drawText(m,this.text,n+g,h-g,this.color,this.font,"start","alphabetic",f.eval(this.decimals),this.fixed,!0));f.setVariable("n",z)}registerTextField(){var m=
a.newHTML("input");m.value=this.expresionString;m.disabled=!this.editable;var z=this;oncontextmenu=function(u){return!1};m.onkeydown=function(u){13==u.keyCode&&(z.expresion=z.evaluator.parser.parse(this.value),z.parent.update())};this.parent.editableRegion.textFields.push(m)}}a.Sequence=l;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var p=2*Math.PI,k=Math.round,f,v,q,d,n,h,c;class b extends a.Graphic{constructor(g,r){super(g,r);this.size=this.size||g.evaluator.parser.parse("2");this.text=new a.TextObject(this,this.text)}update(){f=this.evaluator;q=f.eval(this.expresion);this.exprX=q[0][0];this.exprY=q[0][1];this.rotateExp&&(d=this.rotate(q[0][0],q[0][1],a.degToRad(f.eval(this.rotateExp))),this.exprX=d.x,this.exprY=d.y)}draw(){super.draw(this.color,this.color)}drawTrace(){super.drawTrace(this.trace,
this.trace)}drawAux(g,r){v=this.space;g.fillStyle=r.getColor();n=k(this.abs_coord?this.exprX:v.getAbsoluteX(this.exprX));h=k(this.abs_coord?this.exprY:v.getAbsoluteY(this.exprY));c=k(this.evaluator.eval(this.size));0<c&&(g.beginPath(),g.arc(n,h,c,0,p),g.fill());this.text.hasContent&&this.text.draw(g,r,n,h)}}a.Point=b;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var p=Math.round,k=2*Math.PI,f,v,q,d,n,h,c,b,g,r;class l extends a.Graphic{constructor(m,z){super(m,z);this.width=this.width||m.evaluator.parser.parse("1");this.size=this.size||m.evaluator.parser.parse("2");this.text=new a.TextObject(this,this.text)}update(){f=this.evaluator;q=f.eval(this.expresion);this.endPoints=[];for(var m=0,z=q.length;m<z;m++)this.endPoints[m]={x:q[m][0],y:q[m][1]};if(this.rotateExp)for(d=a.degToRad(f.eval(this.rotateExp)),m=0,z=
this.endPoints.length;m<z;m++)this.endPoints[m]=this.rotate(this.endPoints[m].x,this.endPoints[m].y,d)}draw(){super.draw(this.color,this.color)}drawTrace(){super.drawTrace(this.trace,this.trace)}drawAux(m,z,u){f=this.evaluator;v=this.space;m.lineWidth=Math.max(1E-6,p(f.eval(this.width)));n=f.eval(this.size);m.fillStyle=z.getColor();m.strokeStyle=u.getColor();m.lineCap="round";h=0==m.lineWidth%2?0:.5;this.abs_coord?(c=p(this.endPoints[0].x),b=p(this.endPoints[0].y),g=p(this.endPoints[1].x),r=p(this.endPoints[1].y)):
(c=p(v.getAbsoluteX(this.endPoints[0].x)),b=p(v.getAbsoluteY(this.endPoints[0].y)),g=p(v.getAbsoluteX(this.endPoints[1].x)),r=p(v.getAbsoluteY(this.endPoints[1].y)));m.beginPath();m.moveTo(c+h,b+h);m.lineTo(g+h,r+h);this.dashStyle();m.stroke();0<n&&(m.beginPath(),m.arc(c,b,n,0,k),m.arc(g,r,n,0,k),m.fill());m.setLineDash([]);this.text.hasContent&&this.text.draw(m,u,parseInt((c+g)/2)-3,parseInt((b+r)/2)+3)}}a.Segment=l;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var p=Math.floor,k=Math.round,f,v,q,d,n,h,c,b,g,r,l,m,z;class u extends a.Graphic{constructor(e,w){super(e,w);this.width=this.width||e.evaluator.parser.parse("5");this.size=this.size||e.evaluator.parser.parse("2");this.spear=this.spear||e.evaluator.parser.parse("8");this.arrow=this.arrow||new a.Color("ee0022");this.text=new a.TextObject(this,this.text);this.endPoints=[];this.vect=new a.Vector2D(0,0)}update(){f=this.evaluator;v=f.eval(this.expresion);for(var e=
0,w=v.length;e<w;e++)this.endPoints[e]={x:v[e][0],y:v[e][1]};if(this.rotateExp)for(q=a.degToRad(f.eval(this.rotateExp)),e=0,w=this.endPoints.length;e<w;e++)this.endPoints[e]=this.rotate(this.endPoints[e].x,this.endPoints[e].y,q)}draw(){super.draw(this.arrow,this.color)}drawTrace(){super.drawTrace(this.arrow,this.trace)}drawAux(e,w,B){f=this.evaluator;d=this.space;n=Math.max(0,f.eval(this.width));h=Math.ceil(n/2);c=d.scale;this.vect.x=this.endPoints[1].x-this.endPoints[0].x;this.vect.y=this.endPoints[1].y-
this.endPoints[0].y;b=this.vect.vectorLength();this.angle=Math.atan2(this.vect.y,this.vect.x);e.fillStyle=w.getColor();e.strokeStyle=B.getColor();e.lineWidth=2;this.abs_coord?(g=k(this.endPoints[0].x),r=k(this.endPoints[0].y),l=k(this.endPoints[1].x),m=k(this.endPoints[1].y)):(g=k(d.getAbsoluteX(this.endPoints[0].x)),r=k(d.getAbsoluteY(this.endPoints[0].y)),l=k(d.getAbsoluteX(this.endPoints[1].x)),m=k(d.getAbsoluteY(this.endPoints[1].y)));z=Math.max(0,f.eval(this.spear));e.save();e.translate(g,r);
this.abs_coord?e.rotate(this.angle):(b*=c,e.rotate(-this.angle));e.beginPath();e.moveTo(-h,p(-h));e.lineTo(p(b-z-n),p(-h));e.lineTo(p(b-2*z),p(-z-h));e.lineTo(p(b),0);e.lineTo(p(b-2*z),p(z+h));e.lineTo(p(b-z-n),p(h));e.lineTo(-h,p(h));e.closePath();e.stroke();e.fill();e.restore();this.text.hasContent&&this.text.draw(e,B,parseInt((g+l)/2)-3,parseInt((r+m)/2)+3)}}a.Arrow=u;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var p=Math.round,k,f,v,q,d,n;class h extends a.Graphic{constructor(c,b){super(c,b);this.width=this.width||c.evaluator.parser.parse("1");this.fill=this.fill||"";this.endPoints=[]}update(){k=this.evaluator;v=k.eval(this.expresion);for(var c=0,b=v.length;c<b;c++)this.endPoints[c]={x:v[c][0],y:v[c][1]};if(this.rotateExp)for(q=a.degToRad(k.eval(this.rotateExp)),c=0,b=this.endPoints.length;c<b;c++)this.endPoints[c]=this.rotate(this.endPoints[c].x,this.endPoints[c].y,
q)}draw(){super.draw(this.fill,this.color)}drawTrace(){super.drawTrace(this.trace,this.trace)}drawAux(c,b,g){k=this.evaluator;f=this.space;c.lineWidth=Math.max(1E-6,p(k.eval(this.width)));c.strokeStyle=g.getColor();c.lineCap=c.lineJoin="round";d=p(this.abs_coord?this.endPoints[0].x:f.getAbsoluteX(this.endPoints[0].x));n=p(this.abs_coord?this.endPoints[0].y:f.getAbsoluteY(this.endPoints[0].y));c.beginPath();c.moveTo(d+0,n+0);g=1;for(var r=this.endPoints.length;g<r;g++)d=p(this.abs_coord?this.endPoints[g].x:
f.getAbsoluteX(this.endPoints[g].x)),n=p(this.abs_coord?this.endPoints[g].y:f.getAbsoluteY(this.endPoints[g].y)),c.lineTo(d+0,n+0);this.fill&&(c.fillStyle=b.getColor(),c.fill());this.dashStyle();c.stroke();c.setLineDash([])}}a.Polygon=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var p=Math.round,k=Math.min,f=Math.max,v=Math.abs,q,d,n,h,c,b,g,r,l,m;class z extends a.Graphic{constructor(u,e){super(u,e);this.width=this.width||u.evaluator.parser.parse("1");this.fill=this.fill||"";this.border_radius=this.border_radius||u.evaluator.parser.parse("0");this.endPoints=[]}update(){q=this.evaluator;h=q.eval(this.expresion);this.exprX=h[0][0];this.exprY=h[0][1];this.w=150;this.h=100;this.rotateExp&&(n=this.rotate(h[0][0],h[0][1],a.degToRad(q.eval(this.rotateExp))),
this.exprX=n.x,this.exprY=n.y);4<=h[0].length&&(this.w=h[0][2],this.h=h[0][3]);h[1]&&2==h[1].length&&(this.w=h[1][0],this.h=h[1][1]);this.w=f(0,this.w);this.h=f(0,this.h)}draw(){super.draw(this.fill,this.color)}drawTrace(){super.drawTrace(this.fill,this.trace,"trace")}drawAux(u,e,w,B){q=this.evaluator;d=this.space;u.lineWidth=Math.max(1E-6,p(q.eval(this.width)));u.strokeStyle=w.getColor();u.lineCap="round";u.lineJoin="miter";c=p(this.abs_coord?this.exprX:d.getAbsoluteX(this.exprX))+0;b=p(this.abs_coord?
this.exprY:d.getAbsoluteY(this.exprY))+0;g=this.abs_coord?this.w:this.w*d.scale;r=this.abs_coord?this.h:-this.h*d.scale;l=k(f(0,q.eval(this.border_radius)),.5*v(g),.5*v(r));m=this.abs_coord?1:-1;u.beginPath();0!==l?(u.moveTo(c+l,b),u.lineTo(c+g-l,b),u.quadraticCurveTo(c+g,b,c+g,b+m*l),u.lineTo(c+g,b+r-m*l),u.quadraticCurveTo(c+g,b+r,c+g-l,b+r),u.lineTo(c+l,b+r),u.quadraticCurveTo(c,b+r,c,b+r-m*l),u.lineTo(c,b+m*l),u.quadraticCurveTo(c,b,c+l,b),u.lineTo(c+l,b)):(u.moveTo(c,b),u.lineTo(c+g,b),u.lineTo(c+
g,b+r),u.lineTo(c,b+r),u.lineTo(c,b));this.fill&&(u.fillStyle=e.getColor(),u.fill());this.dashStyle();u.stroke();u.setLineDash([])}}a.Rectangle=z;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var p=Math.round,k=Math.min,f=Math.max,v=Math.acos,q=Math.sqrt,d=Math.PI,n=d/2,h=2*d,c,b,g,r,l,m,z,u,e,w,B,y,A,x,H,J,C,G,F,P;class E extends a.Graphic{constructor(N,W){super(N,W);this.width=this.width||N.evaluator.parser.parse("1");this.fill=this.fill||"";this.center=this.center||N.evaluator.parser.parse("(0,0)");this.radius=this.radius||N.evaluator.parser.parse("1");this.init=this.init||"0";this.end=this.end||"90";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=N.evaluator.parser.parse(this.init);this.endExpr=N.evaluator.parser.parse(this.end);this.text=new a.TextObject(this,this.text)}update(){c=this.evaluator;b=c.eval(this.center);this.exprX=b[0][0];this.exprY=b[0][1];g=0;this.rotateExp&&(g=a.degToRad(c.eval(this.rotateExp)),r=Math.cos(g),l=Math.sin(g),m=this.exprX*r-this.exprY*l,z=this.exprX*l+this.exprY*r,this.exprX=m,this.exprY=
z);var N=c.eval(this.initExpr),W=c.eval(this.endExpr);/^(\(|\[)expr(\)|\])$/i.test(this.initExpr.type)&&/^(\(|\[)expr(\)|\])$/i.test(this.endExpr.type)?(u=N[0][0],e=N[0][1],w=W[0][0],B=W[0][1],this.vectors?this.abs_coord&&(e=-e,B=-B):(u-=this.exprX,e=-e+this.exprY,w-=this.exprX,B=-B+this.exprY,this.abs_coord||(e=-e,B=-B)),y=0==u?0>e?3*n:n:v(1*u/q(u*u+e*e)),A=0==w?0>B?3*n:n:v(1*w/q(w*w+B*B)),y+=g,A+=g,0<u&&0<e&&this.abs_coord&&(y=h-y),0<u&&0>e&&!this.abs_coord&&(y=h-y),0>u&&0>e&&!this.abs_coord&&(y=
h-y),0>u&&0<e&&this.abs_coord&&(y=h-y),0<w&&0<B&&this.abs_coord&&(A=h-A),0<w&&0>B&&!this.abs_coord&&(A=h-A),0>w&&0>B&&!this.abs_coord&&(A=h-A),0>w&&0<B&&this.abs_coord&&(A=h-A),this.initFlag?(x=y,y=A,A=x):(x=k(y,A),H=f(y,A),y=x,A=H,A-y>d&&this.abs_coord&&(y=H,A=x),A-y<=d&&!this.abs_coord&&(y=H,A=x)),this.iniAng=y,this.endAng=A,this.drawPoints=!0):(this.iniAng=a.degToRad(N)+g,this.endAng=a.degToRad(W)+g,this.drawAngle=!0)}draw(){super.draw(this.fill,this.color)}drawTrace(){super.drawTrace(this.fill,
this.trace)}drawAux(N,W,T){c=this.evaluator;J=this.space;F=Math.max(0,c.eval(this.radius));N.lineWidth=Math.max(1E-6,p(c.eval(this.width)));N.lineCap="round";N.strokeStyle=T.getColor();this.abs_coord?(C=p(this.exprX),G=p(this.exprY)):(C=p(J.getAbsoluteX(this.exprX)),G=p(J.getAbsoluteY(this.exprY)),F*=J.scale,this.iniAng=-this.iniAng,this.endAng=-this.endAng);this.drawAngle&&this.iniAng>this.endAng&&(P=this.iniAng,this.iniAng=this.endAng,this.endAng=P);this.fill&&(N.fillStyle=W.getColor(),N.beginPath(),
N.moveTo(C,G),N.arc(C,G,F,this.iniAng,this.endAng,void 0),N.fill());N.beginPath();N.arc(C,G,F,this.iniAng,this.endAng,void 0);this.dashStyle();N.stroke();this.text.hasContent&&this.text.draw(N,this.color,C,G)}}a.Arc=E;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var p,k,f,v,q;class d extends a.Graphic{constructor(n,h){super(n,h);this.width=this.width||n.evaluator.parser.parse("0");this.align||(this.align="left");this.anchor||(this.anchor="top_left");this.shadowColor=this.shadowColor?this.shadowColor.getColor():"transparent";this.text=new a.TextObject(this,this.text)}update(){p=this.evaluator;k=p.eval(this.expresion);this.exprX=k[0][0];this.exprY=k[0][1];this.rotateExp&&(f=this.rotate(k[0][0],k[0][1],a.degToRad(p.eval(this.rotateExp))),
this.exprX=f.x,this.exprY=f.y)}draw(){super.draw(this.color)}drawTrace(){super.drawTrace(this.trace)}drawAux(n,h){this.abs_coord?(v=parseInt(this.exprX),q=parseInt(this.exprY)):(v=parseInt(this.space.getAbsoluteX(this.exprX)),q=parseInt(this.space.getAbsoluteY(this.exprY)));this.text.draw(n,h,v,q)}}a.Text=d;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var p=Math.round,k,f,v,q,d,n,h,c,b,g,r;class l extends a.Graphic{constructor(m,z){super(m,z);this.file=this.file||"";this.inirot=this.inirot||m.evaluator.parser.parse("0");this.img=new Image;this.scaleX=this.scaleY=1;this.ratio=m.ratio;m=this.expresion.getChildren();this.x_e=m[0];this.y_e=m[1];2<m.length&&(this.centered=!0,this.s_x_e=m[2],this.s_y_e=3<m.length?m[3]:m[2]);this.evaluator.eval(this.clip)&&(this.clip=this.clip.getChildren());this.update()}update(){k=
this.evaluator;let m=k.eval(this.x_e),z=k.eval(this.y_e);this.exprX=m;this.exprY=z;this.rotateExp&&(f=this.rotate(m,z,a.degToRad(k.eval(this.rotateExp))),this.exprX=f.x,this.exprY=f.y);this.centered&&(this.scaleX=k.eval(this.s_x_e),this.scaleY=k.eval(this.s_y_e),0==this.scaleX&&(this.scaleX=1E-5),0==this.scaleY&&(this.scaleY=1E-5));var u=this;if((v=k.eval(this.file))||""==v)this.img=this.parent.getImage(v),this.img.addEventListener("load",function(e){u.space.update(!0)})}draw(){super.draw()}drawTrace(){super.drawTrace()}drawAux(m){k=
this.evaluator;q=this.space;this.img&&this.img.ready&&this.img.complete&&(this.clip?(g=k.eval(this.clip[2]),r=k.eval(this.clip[3])):(g=this.img.width,r=this.img.height,this.img.canvas&&(g=p(g/this.ratio),r=p(r/this.ratio))),d=this.centered?0:p(g/2),n=this.centered?0:p(r/2),h=p(this.abs_coord?this.exprX:q.getAbsoluteX(this.exprX)),c=p(this.abs_coord?this.exprY:q.getAbsoluteY(this.exprY)),b=a.degToRad(-k.eval(this.inirot)),m.save(),m.translate(h+d,c+n),m.rotate(b),this.opacity&&(m.globalAlpha=k.eval(this.opacity)),
m.scale(this.scaleX,this.scaleY),this.clip?this.img.canvas?m.drawImage(this.img,k.eval(this.clip[0])*this.ratio,k.eval(this.clip[1])*this.ratio,g*this.ratio,r*this.ratio,-g/2,-r/2,g,r):m.drawImage(this.img,k.eval(this.clip[0]),k.eval(this.clip[1]),g,r,-g/2,-r/2,g,r):m.drawImage(this.img,-g/2,-r/2,g,r),m.restore())}}a.Image=l;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var p,k,f,v,q,d,n,h,c=document.createElement("canvas").getContext("2d");c.canvas.width=1;c.canvas.height=1;class b extends a.Graphic{constructor(g,r){super(g,r)}update(){p=this.evaluator.eval(this.expresion);this.exprX=p[0][0];this.exprY=p[0][1]}draw(){super.draw(this.color,this.color)}drawTrace(){super.drawTrace(this.trace,this.trace)}drawAux(g,r){r=r.getColor();c.clearRect(0,0,1,1);c.fillStyle=r;c.fillRect(0,0,1,1);r=(new Uint32Array(c.getImageData(0,
0,1,1).data.buffer))[0];n=g.getImageData(0,0,this.space.w,this.space.h);h=new Uint32Array(n.data.buffer);this.abs_coord?(k=parseInt(this.exprX),f=parseInt(this.exprY)):(k=parseInt(this.space.getAbsoluteX(this.exprX)),f=parseInt(this.space.getAbsoluteY(this.exprY)));if(!(0>k||0>f||k>=this.space.w||f>=this.space.h)){v=[k,f];var l=n.width;q=0>k||0>f||k>=l||f>=n.height?-1:h[k+f*l];for(d=0;0<v.length&&!(d++,f=v.pop(),k=v.pop(),l=n.width,q==(0>k||0>f||k>=l||f>=n.height?-1:h[k+f*l])&&(h[k+f*n.width]=r,v.push(k-
1,f),v.push(k+1,f),v.push(k,f-1),v.push(k,f+1)),d>=this.space.w*this.space.h*8););g.putImageData(n,0,0)}}}a.Fill=b;return a}(descartesJS||{});
descartesJS=function(a,p){if(a.loadLib)return a;var k=new String("-text-image-point-polygon-arc-segment-arrow-macro-curve-equation-sequence-rectangle-fill-"),f=/[\w\.\-//]*(\.png|\.jpg|\.gif|\.svg|\.webp)/gi,v;class q extends a.Graphic{constructor(d,n){super(d,n);this.hasExpresion=this.hasExpresion||!1;this.inirot=this.inirot||d.evaluator.parser.parse("0");this.inipos=this.inipos||d.evaluator.parser.parse("(0,0)");Object.assign(this,n);this.hasExpresion=void 0!==this.expresion;this.graphics=[];d=
d.lessonParser;var h=new a.Tokenizer;if(this.hasExpresion){"'"!==this.expresion.charAt(0)&&(this.expresion="'"+this.expresion+"'");this.expresion=this.evaluator.parser.parse(this.expresion);n=this.evaluator.eval(this.expresion);if(n)var c=(c=document.getElementById(n))&&"descartes/macro"==c.type?c.text:a.openExternalFile(n);if(c){var b=a.convertHTMLEntities(c).replace(/\r/g,"").split("\n");c=[];n=0;for(var g=b.length;n<g;n++)if(b[n].trim()){var r=b[n].indexOf("=");if(-1!==r){r=d.split(b[n]);for(var l=
0,m=r.length;l<m;l++)if(r[l]&&1<r.length&&("id"===p[r[l][0]]||"type"===p[r[l][0]])){c.push(r);break}}}var z=this;l=function(H,J){J=h.tokenize(J.replace(/&squot;/g,"'"));for(var C=0,G=J.length;C<G;C++)if("identifier"==J[C].type&&!a.reservedIds.match("-"+J[C].value+"-")||"R"===J[C].value||"G"===J[C].value||"B"===J[C].value)J[C].value=z.name+"."+J[C].value;return(H.match(/^\\expr/)?"\\expr ":"\\decimals ")+h.flatTokens(J)};n=0;for(g=c.length;n<g;n++){var u=(m=c[n]||[],m[0])&&"id"===m[0][0];b=0;for(r=
m.length;b<r;b++){var e=m[b][0].indexOf(".");-1===e||u?e=p[m[b][0]]:(e=p[m[b][0].substring(e+1)],m[b][0]=this.name+"."+m[b][0]);if(!("font"===e||"font_family"===e||("fill"===e||"color"===e||"border"===e||"arrow"===e)&&"("!==m[b][1].charAt(0)||"file"===e&&m[b][1].match(f)||"id"!==e&&void 0!==p[m[b][1]])||"radius"===e)if("text"==e)if(m[b][1].match(/\{\\rtf1/))e=m[b][1],e=e.replace(/\\expr ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,l),e=e.replace(/\\decimals ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,
l),m[b][1]=e;else{var w=d.parseText(m[b][1]).textElementsMacros;for(var B=0,y=w.length;B<y;B++){e=h.tokenize(w[B].replace(/&squot;/g,"'"));for(var A=0,x=e.length;A<x;A++)if("identifier"===e[A].type&&!a.reservedIds.match("-"+e[A].value+"-")||"R"===e[A].value||"G"===e[A].value||"B"===e[A].value)e[A].value=this.name+"."+e[A].value;e=h.flatTokens(e).replace(/&squot;/g,"'").replace(/'\+\(/g,"[").replace(/\)\+'/g,"]");w[B]=e.substring(1,e.length-1)}m[b][1]=w.join("")}else{w=m[b][1].replace(/&squot;/g,"'").split(";");
B=0;for(y=w.length;B<y;B++){e=h.tokenize(w[B].replace(/\\n/g,";"));A=0;for(x=e.length;A<x;A++)if("identifier"===e[A].type&&!a.reservedIds.match("-"+e[A].value+"-")||"R"===e[A].value||"G"===e[A].value||"B"===e[A].value)e[A].value=this.name+"."+e[A].value;w[B]=h.flatTokens(e)}m[b][1]=w.join(";")}}}n=0;for(g=c.length;n<g;n++)if(c[n][0]){l="";m=!1;b=0;for(r=c[n].length;b<r;b++)"type"===p[c[n][b][0]]&&k.match("-"+p[c[n][b][1]]+"-")&&(m=!0),l=l+c[n][b][0]+"='"+c[n][b][1]+"' ";c[n]=l+(m?" space='"+this.spaceID+
"'":"");m?this.graphics.push(d.parseGraphic(c[n],this.abs_coord,this.background,this.inirot)):d.parseAuxiliar(c[n])}}}}update(){v=this.evaluator.eval(this.inipos);this.iniPosX=v[0][0];this.iniPosY=v[0][1]}drawAux(d){for(var n=0,h=this.graphics.length;n<h;n++)this.graphics[n]&&(d.save(),this.graphics[n].abs_coord?d.translate(this.iniPosX,this.iniPosY):d.translate(this.iniPosX*this.space.scale,-this.iniPosY*this.space.scale),this.graphics[n].draw(),d.restore())}}a.Macro=q;return a}(descartesJS||{},
babel);
descartesJS=function(a){if(a.loadLib)return a;var p=Math.sqrt,k=Math.sin,f=Math.cos,v=Math.abs,q,d,n,h,c,b,g,r,l,m,z,u,e,w,B;class y{constructor(x,H,J,C){this.x=x||0;this.y=H||0;this.z=J||0;this.w=C||0;this.adjustDec()}adjustDec(){this.x=parseInt(1E9*this.x)/1E9;this.y=parseInt(1E9*this.y)/1E9;this.z=parseInt(1E9*this.z)/1E9}}class A{constructor(x,H,J,C,G,F,P,E,N,W,T,S,Q,X,aa,D){this.a00=x||0;this.a01=H||0;this.a02=J||0;this.a03=C||0;this.a10=G||0;this.a11=F||0;this.a12=P||0;this.a13=E||0;this.a20=
N||0;this.a21=W||0;this.a22=T||0;this.a23=S||0;this.a30=Q||0;this.a31=X||0;this.a32=aa||0;this.a33=D||0}setIdentity(){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}multiplyVector4(x){return new y(x.x*this.a00+x.y*this.a10+x.z*this.a20+x.w*this.a30,x.x*this.a01+x.y*this.a11+x.z*this.a21+x.w*this.a31,x.x*this.a02+x.y*this.a12+x.z*this.a22+x.w*this.a32,x.x*this.a03+x.y*this.a13+
x.z*this.a23+x.w*this.a33)}translate(x){return new A(this.a00,this.a01,this.a02,this.a03,this.a10,this.a11,this.a12,this.a13,this.a20,this.a21,this.a22,this.a23,this.a00*x.x+this.a10*x.y+this.a20*x.z+this.a30,this.a01*x.x+this.a11*x.y+this.a21*x.z+this.a31,this.a02*x.x+this.a12*x.y+this.a22*x.z+this.a32,this.a03*x.x+this.a13*x.y+this.a23*x.z+this.a33)}rotateX(x){d=k(x);n=f(x);r=this.a10;l=this.a11;m=this.a12;z=this.a13;u=this.a20;e=this.a21;w=this.a22;B=this.a23;return new A(this.a00,this.a01,this.a02,
this.a03,r*n+u*d,l*n+e*d,m*n+w*d,z*n+B*d,r*-d+u*n,l*-d+e*n,m*-d+w*n,z*-d+B*n,this.a30,this.a31,this.a32,this.a33)}rotateY(x){d=k(x);n=f(x);h=this.a00;c=this.a01;b=this.a02;g=this.a03;u=this.a20;e=this.a21;w=this.a22;B=this.a23;return new A(h*n+u*-d,c*n+e*-d,b*n+w*-d,g*n+B*-d,this.a10,this.a11,this.a12,this.a13,h*d+u*n,c*d+e*n,b*d+w*n,g*d+B*n,this.a30,this.a31,this.a32,this.a33)}rotateZ(x){d=k(x);n=f(x);h=this.a00;c=this.a01;b=this.a02;g=this.a03;r=this.a10;l=this.a11;m=this.a12;z=this.a13;return new A(h*
n+r*d,c*n+l*d,b*n+m*d,g*n+z*d,h*-d+r*n,c*-d+l*n,b*-d+m*n,g*-d+z*n,this.a20,this.a21,this.a22,this.a23,this.a30,this.a31,this.a32,this.a33)}}a.norm3D=function(x){return p(x.x*x.x+x.y*x.y+x.z*x.z)};a.normalize3D=function(x){q=a.norm3D(x);if(0===q)return{x:0,y:0,z:0};if(1===q)return{x:x.x,y:x.y,z:x.z};q=1/q;return{x:x.x*q,y:x.y*q,z:x.z*q}};a.dotProduct3D=function(x,H){return x.x*H.x+x.y*H.y+x.z*H.z};a.crossProduct3D=function(x,H){return{x:x.y*H.z-x.z*H.y,y:x.z*H.x-x.x*H.z,z:x.x*H.y-x.y*H.x}};a.scalarProduct3D=
function(x,H){return{x:x.x*H,y:x.y*H,z:x.z*H}};a.subtract3D=function(x,H){return{x:x.x-H.x,y:x.y-H.y,z:x.z-H.z}};a.add3D=function(x,H){return{x:x.x+H.x,y:x.y+H.y,z:x.z+H.z}};a.equals3DEpsilon=function(x,H,J){return v(x.x-H.x)<=J&&v(x.y-H.y)<=J&&v(x.z-H.z)<=J};a.Vector4D=y;a.Matrix4x4=A;return a}(descartesJS||{});
descartesJS=function(a){function p(x){x.textNode=null;0!==parseInt(this.size)&&(x.lineWidth=1,x.fillStyle=this.backColor,x.strokeStyle=this.frontColor,x.beginPath(),x.arc(this.projVert[0].x,this.projVert[0].y,this.size,0,d),x.fill(),x.stroke())}function k(x,H){x.textNode=null;x.lineCap=n;x.lineJoin=lineJoin;x.lineWidth=.4;x.beginPath();x.moveTo(this.projVert[0].x,this.projVert[0].y);l=1;for(m=this.projVert.length;l<m;l++)x.lineTo(this.projVert[l].x,this.projVert[l].y);x.closePath();"color"===this.model?
(x.fillStyle=0>this.direction?this.backColor:this.frontColor,x.strokeStyle=x.fillStyle,x.stroke(),x.fill()):"light"===this.model||"metal"===this.model?(x.fillStyle=H.computeColor(0>this.direction?this.backColor:this.frontColor,this,"metal"===this.model),x.strokeStyle=x.fillStyle,x.stroke(),x.fill()):"wire"===this.model&&(x.lineWidth=1.25,x.strokeStyle=this.frontColor,x.stroke());this.edges&&"wire"!==this.model&&(x.lineWidth=1,x.strokeStyle=this.edges,x.stroke())}function f(x){x.textNode=null;x.oldTextNode=
"_a1b2c3_";g=this.evaluator.getVariable(this.family);this.evaluator.setVariable(this.family,this.familyValue);this.fontSize=Math.max(5,this.evaluator.eval(this.font_size));this.font=this.font_style+" "+this.fontSize+"px "+this.font_family;this.drawText(x,this.text,this.projVert[0].x,this.projVert[0].y,this.frontColor,this.font,"left","alphabetic",this.decimals,this.fixed,!0);this.evaluator.setVariable(this.family,g)}function v(x){x.textNode=null;x.lineCap=n;x.lineJoin=lineJoin;x.lineWidth=this.lineWidth;
x.strokeStyle=this.frontColor;x.beginPath();x.moveTo(this.projVert[0].x,this.projVert[0].y);x.lineTo(this.projVert[1].x,this.projVert[1].y);"dot"===this.lineDash?(x.lineCap="butt",x.setLineDash([x.lineWidth,x.lineWidth])):"dash"===this.lineDash?(x.lineCap="butt",x.setLineDash([4*x.lineWidth,3*x.lineWidth])):"dash_dot"===this.lineDash?(x.lineCap="butt",x.setLineDash([4*x.lineWidth,2*x.lineWidth,x.lineWidth,2*x.lineWidth])):x.setLineDash([]);x.stroke()}function q(x,H,J){return a.normalize3D(a.crossProduct3D(a.subtract3D(x,
H),a.subtract3D(x,J)))}if(a.loadLib)return a;var d=2*Math.PI,n=lineJoin="round",h,c,b,g,r,l,m,z,u,e,w,B,y;class A{constructor(x,H){Object.assign(this,x);this.space=H;this.projVert=[];this.spaceVertices=[];this.newProjVert=[];this.newSpaceVert=[];"vertex"===this.type?this.draw=p:"face"===this.type?(this.normal=q(this.vertices[0],this.vertices[1],this.vertices[2]),this.draw=k):"text"===this.type?this.draw=f:"edge"===this.type&&(this.draw=v);this.isText&&(this.computeDepth=function(){this.normal={x:0,
y:0,z:0};this.projVert=this.vertices;this.depth=this.vertices[0].z;this.average=this.vertices[0]})}computeDepth(x){this.space=x;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};l=0;for(m=this.vertices.length;l<m;l++)this.spaceVertices[l]=x.rotateVertex(this.vertices[l]),this.average.x+=this.spaceVertices[l].x,this.average.y+=this.spaceVertices[l].y,this.average.z+=this.spaceVertices[l].z;this.average=a.scalarProduct3D(this.average,1/m);this.average_proy=
x.project(this.average);this.depth=a.norm3D(a.subtract3D(x.eye,this.average));2<this.vertices.length&&(this.normal=q(this.spaceVertices[0],this.spaceVertices[1],this.spaceVertices[2]));l=0;for(m=this.vertices.length;l<m;l++)this.newSpaceVert[l]=this.spaceVertices[l],this.projVert[l]=this.newProjVert[l]=x.project(this.spaceVertices[l]);2<this.vertices.length&&(this.direction=q(this.projVert[0],this.projVert[1],this.projVert[2]).z);this.minDistanceToEye=Infinity;this.maxDistanceToEye=-Infinity;this.minx=
Infinity;this.maxx=-Infinity;this.miny=Infinity;this.maxy=-Infinity;l=0;for(m=this.vertices.length;l<m;l++)z=a.norm3D(a.subtract3D(this.spaceVertices[l],x.eye)),this.minDistanceToEye=Math.min(this.minDistanceToEye,z),this.maxDistanceToEye=Math.max(this.maxDistanceToEye,z);l=0;for(m=this.vertices.length;l<m;l++)this.minx>this.projVert[l].x&&(this.minx=this.projVert[l].x),this.maxx<this.projVert[l].x&&(this.maxx=this.projVert[l].x),this.miny>this.projVert[l].y&&(this.miny=this.projVert[l].y),this.maxy<
this.projVert[l].y&&(this.maxy=this.projVert[l].y)}removeDoubles(){if("edge"!==this.type){r=[];l=0;for(m=this.vertices.length;l<m;l++)(1E-8<Math.abs(this.vertices[l].x-this.vertices[(l+1)%m].x)||1E-8<Math.abs(this.vertices[l].y-this.vertices[(l+1)%m].y)||1E-8<Math.abs(this.vertices[l].z-this.vertices[(l+1)%m].z)||1E-8<Math.abs(this.vertices[l].w-this.vertices[(l+1)%m].w))&&r.push(this.vertices[l]);0===r.length&&r.push(this.vertices[0]);this.vertices=r}}drawText(x,H,J,C,G,F,P,E,N,W,T){h=this.evaluator;
x.textNode=H;F=h.eval(this.offset_dist);P=-a.degToRad(h.eval(this.offset_angle));J+=F*Math.cos(P);C+=F*Math.sin(P);x.textNode.pos={x:J,y:C};H.hasContent&&(H.draw(x,G,J,C,!0),b=this.fromPoint?H.textNodes.metrics.w/2:0,c=this.fromPoint?H.textNodes.metrics.h/2:0,H.draw(x,G,J-b,C-c))}splitFace(x){if(this.intersects(x)){var H=i2=null,J=ix2=0,C,G;var F=this.vertices;var P=x.vertices;var E=0;for(G=P.length;E<G;E++){var N=this.intersection(P[E],P[(E+1)%G]);if(null!==N)if(null===H){if(H=N,J=E,2===P.length){i2=
H;break}}else if(!a.equals3DEpsilon(N,H,1E-8)){i2=N;ix2=E;break}}if(null!==H&&null!==i2){E=this.isInterior(H)||this.isInterior(i2);var W=C=null;if(!E&&3<=P.length)for(G=0,F=F.length;G<F;G++)if(N=x.intersection(this.vertices[G],this.vertices[(G+1)%F]),null!==N)if(null===C)C=N;else if(!a.equals3DEpsilon(N,C,1E-8)){W=N;break}if(E||null!==C&&null!==W&&x.isInterior(C)&&x.isInterior(W)){W=!0;F=N=null;if(2===P.length)a.equals3DEpsilon(H,P[0],1E-8)||a.equals3DEpsilon(H,P[1],1E-8)?W=!1:(N=[],N[0]=P[0],N[1]=
H,F=[],F[0]=H,F[1]=P[1]);else for(N=[],F=[],E=G=C=0;E<P.length;E++)E<J?N[C++]=P[E]:E==J?(N[C++]=P[E],N[C++]=H,F[G++]=H):E<ix2?F[G++]=P[E]:E==ix2?(F[G++]=P[E],F[G++]=i2,N[C++]=i2):N[C++]=P[E];if(W){H=[];H[0]=new A({vertices:N,type:"face",frontColor:x.frontColor,backColor:x.backColor,edges:x.edges,model:x.model},this.space);H[0].removeDoubles();H[0].normal=x.normal;H[1]=new A({vertices:F,type:"face",frontColor:x.frontColor,backColor:x.backColor,edges:x.edges,model:x.model},this.space);H[1].removeDoubles();
H[1].normal=x.normal;if(2<H[0].vertices.length)return 2<H[1].vertices.length?H:[H[0]];if(2<H[1].vertices.length)return[H[1]]}}}}return[x]}intersects(x){return this.intersectsPlane(x)&&x.intersectsPlane(this)}intersectsPlane(x){var H=this.vertices;var J=x.vertices;if(0<H.length){var C=a.dotProduct3D(J[0],x.normal);var G=a.dotProduct3D(H[0],x.normal);if(1E-8>Math.abs(C-G))return!0;for(var F=1,P=H.length;F<P;F++)if(J=a.dotProduct3D(H[F],x.normal),1E-8>Math.abs(C-J)||J>C&&G<C||J<C&&G>C)return!0}return!1}intersection(x,
H){var J=this.vertices;if(0<J.length){H=a.subtract3D(H,x);var C=a.dotProduct3D(H,this.normal);if(0!==C&&(J=a.dotProduct3D(a.subtract3D(J[0],x),this.normal)/C,-1E-8<J&&1.00000001>J))return a.add3D(x,a.scalarProduct3D(H,J))}return null}isInterior(x){var H=this.vertices;if(0<H.length)for(var J=0,C=a.subtract3D(H[0],x),G=0,F=H.length;G<F;G++){var P=a.subtract3D(H[(G+1)%F],x),E=a.dotProduct3D(a.crossProduct3D(C,P),this.normal);if(1E-8>Math.abs(E)){if(0>a.dotProduct3D(C,P))break}else{if(0>J&&0<E||0<J&&
0>E)return!1;C=P;J=E}}return!0}inFrontOf(x,H,J){if(this.minDistanceToEye>=H.maxDistanceToEye||this.maxx<=H.minx||this.minx>=H.maxx||this.maxy<=H.miny||this.miny>=H.maxy)return!1;for(B=0;3>B;B++)if(u=null,u=0===B?this.intersections(H):1===B?H.verticesContainedIn(this):this.verticesContainedIn(H),null!=u&&0<u.length){for(y=0;y<u.length;y++)x.push(u[y]);l=0;for(m=u.length;l<m;l++){e=u[l];w=this.space.rayFromEye(e.x,e.y);try{t=this.distanceToEyeAlong(w)-H.distanceToEyeAlong(w);if(t<=-J)return!0;if(t>=
J)return!1}catch(C){}}}return!1}intersections(x){for(var H=[],J,C,G,F=new a.R2,P=this.newSpaceVert,E=x.newSpaceVert,N=this.newProjVert,W=x.newProjVert,T=0,S=P.length;T<S;T++){x=P[T];J=P[(T+1)%S];for(var Q=0,X=E.length;Q<X;Q++)C=E[Q],G=E[(Q+1)%X],x!=C&&x!=G&&J!=C&&J!=G&&(C=F.intersection(N[T],N[(T+1)%S],W[Q],W[(Q+1)%X]),null!=C&&H.push(C))}return H}distanceToEyeAlong(x){x=a.dotProduct3D(this.normal,x);if(1E-6<Math.abs(x))return a.dotProduct3D(a.subtract3D(this.average,this.space.eye),this.normal)/
x;throw new Exception("Face is invisible");}verticesContainedIn(x){for(var H=[],J=this.newSpaceVert,C=this.newProjVert,G=0,F=J.length;G<F;G++)!x.isVertex(J[G])&&x.appearsToContain(C[G])&&H.push(C[G]);return H}appearsToContain(x){for(var H=0,J,C=this.newProjVert,G=0,F=this.newSpaceVert.length;G<F;G++){J=(C[G].x-x.x)*(C[(G+1)%F].y-x.y)-(C[(G+1)%F].x-x.x)*(C[G].y-x.y);if(0!=H)if(1E-8>Math.abs(J)){if(1E-8<Math.abs(C[G].x-C[(G+1)%F].x))return Math.min(C[G].x,C[(G+1)%F].x)<=x.x+1E-8&&x.x<=Math.max(C[G].x,
C[(G+1)%F].x)+1E-8;if(1E-8<Math.abs(C[G].y-C[(G+1)%F].y))return Math.min(C[G].y,C[(G+1)%F].y)<=x.y+1E-8&&x.y<=Math.max(C[G].y,C[(G+1)%F].y)+1E-8}else if(0<H&&0>J||0>H&&0<J)return!1;H=J}return!0}isVertex(x){for(var H=this.newSpaceVert,J=0,C=H.length;J<C;J++)if(a.equals3DEpsilon(x,H[J],1E-8))return!0;return!1}}a.Primitive3D=A;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var p={x:0,y:0,z:0},k,f,v,q,d,n=a.degToRad,h;class c{constructor(b,g){this.parent=b;this.evaluator=b.evaluator;var r=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=r.parse("1");this.abs_coord=!1;this.family="";this.family_interval=r.parse("[0,1]");this.family_steps=r.parse("8");
this.font="SansSerif,PLAIN,18";this.fixed=!0;this.text="";this.decimals=r.parse("2");this.inirot="(0,0,0)";this.inirotEuler=!1;this.inipos=r.parse("(0,0,0)");this.endrot="(0,0,0)";this.endrotEuler=!1;this.endpos=r.parse("(0,0,0)");this.model="color";Object.assign(this,g);void 0==this.expresion&&"macro"!=this.type&&(this.expresion=r.parse("(0,0)"));this.space=this.getSpace();this.canvas=this.background?this.space.backCanvas:this.space.canvas;this.ctx=this.canvas.getContext("2d");this.font_str=this.font;
this.font=a.convertFont(this.font);this.fontSize=(this.fontSize=this.font.match(/([\d\.]+)px/))?parseFloat(this.fontSize[1]):10;this.font_style=a.getFontStyle(this.font_str.split(",")[1]);if("boolean"===typeof this.bold||"boolean"===typeof this.italics)this.bold&&!this.italics?this.font_style="Bold ":!this.bold&&this.italics?this.font_style="Italic ":this.bold&&this.italics?this.font_style="Italic Bold ":this.bold||this.italics||(this.font_style=" ");this.font_family||(this.font_family=this.font_str.split(",")[0]);
this.font_family=a.getFontName(this.font_family);"undefined"===typeof this.font_size&&(this.font_size=b.evaluator.parser.parse(this.fontSize.toString()));this.inirot.match("Euler")&&(this.inirot=this.inirot.replace("Euler",""),this.inirotEuler=!0);this.endrot.match("Euler")&&(this.endrot=this.endrot.replace("Euler",""),this.endrotEuler=!0);this.inirot=r.parse(this.inirot);this.endrot=r.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}getSpace(){for(var b=this.parent.spaces,g,r=0,l=b.length;r<l;r++)if(g=b[r],g.id==this.spaceID)return g;return b[0]}getFamilyValues(){k=this.evaluator;f=k.eval(this.family_interval);this.familyInf=f[0][0];this.familySup=f[0][1];this.fSteps=Math.round(k.eval(this.family_steps));this.family_sep=0<this.fSteps?
(this.familySup-this.familyInf)/this.fSteps:0}buildFamilyPrimitives(){k=this.evaluator;this.getFamilyValues();v=k.getVariable(this.family);if(0<=this.fSteps)for(var b=0,g=this.fSteps;b<=g;b++)k.setVariable(this.family,this.familyInf+b*this.family_sep),this.familyValue=this.familyInf+b*this.family_sep,k.eval(this.drawif)&&this.buildPrimitives();k.setVariable(this.family,v)}update(){this.primitives=[];this.evaluator.eval(this.drawif)&&(this.family||this.buildPrimitives());this.family&&this.buildFamilyPrimitives()}updateMVMatrix(){q=
this.evaluator.eval(this.inirot);this.inirotEuler?(this.inirotM=this.inirotM.setIdentity(),this.inirotM=this.inirotM.rotateZ(n(q[0][0])),this.inirotM=this.inirotM.rotateX(n(q[0][1])),this.inirotM=this.inirotM.rotateZ(n(q[0][2]))):(this.inirotM_X=this.inirotM_X.setIdentity().rotateX(n(q[0][0])),this.inirotM_Y=this.inirotM_Y.setIdentity().rotateY(n(q[0][1])),this.inirotM_Z=this.inirotM_Z.setIdentity().rotateZ(n(q[0][2])));q=this.evaluator.eval(this.inipos);p={x:q[0][0],y:q[0][1],z:q[0][2]};this.iniposM=
this.iniposM.setIdentity().translate(p);q=this.evaluator.eval(this.endrot);this.endrotEuler?(this.endrotM=this.endrotM.setIdentity(),this.endrotM=this.endrotM.rotateZ(n(q[0][0])),this.endrotM=this.endrotM.rotateX(n(q[0][1])),this.endrotM=this.endrotM.rotateZ(n(q[0][2]))):(this.endrotM_X=this.endrotM_X.setIdentity().rotateX(n(q[0][0])),this.endrotM_Y=this.endrotM_Y.setIdentity().rotateY(n(q[0][1])),this.endrotM_Z=this.endrotM_Z.setIdentity().rotateZ(n(q[0][2])));q=this.evaluator.eval(this.endpos);
p={x:q[0][0],y:q[0][1],z:q[0][2]};this.endposM=this.endposM.setIdentity().translate(p)}transformVertex(b){this.inirotEuler?d=this.inirotM.multiplyVector4(b):(d=this.inirotM_X.multiplyVector4(b),d=this.inirotM_Y.multiplyVector4(d),d=this.inirotM_Z.multiplyVector4(d));d=this.iniposM.multiplyVector4(d);this.endrotEuler?d=this.endrotM.multiplyVector4(d):(d=this.endrotM_X.multiplyVector4(d),d=this.endrotM_Y.multiplyVector4(d),d=this.endrotM_Z.multiplyVector4(d));d=this.endposM.multiplyVector4(d);this.macroChildren&&
(d=this.applyMacroTransform(d));d.adjustDec();return d}applyMacroTransform(b){this.macro_inirotEuler?d=this.macro_inirotM.multiplyVector4(b):(d=this.macro_inirotM_X.multiplyVector4(b),d=this.macro_inirotM_Y.multiplyVector4(d),d=this.macro_inirotM_Z.multiplyVector4(d));d=this.macro_iniposM.multiplyVector4(d);this.macro_endrotEuler?d=this.macro_endrotM.multiplyVector4(d):(d=this.macro_endrotM_X.multiplyVector4(d),d=this.macro_endrotM_Y.multiplyVector4(d),d=this.macro_endrotM_Z.multiplyVector4(d));return d=
this.macro_endposM.multiplyVector4(d)}parseExpression(){for(var b=this.expresion.split(";"),g=[],r=0,l=b.length;r<l;r++)if(""!==b[r].trim()){for(var m=g.concat,z,u=b[r],e=[],w=0,B=u.length,y=u.length-1;-1<y;y--)z=u.charAt(y),0==w?"="==z&&(w=1):1==w?" "!=z&&(w="<"===z||">"===z?0:2):2==w&&" "==z&&(e.unshift(u.substring(y+1,B)),B=y,w=0);e.unshift(u.substring(0,B));g=m.call(g,e)}r=0;for(l=g.length;r<l;r++)g[r]=this.evaluator.parser.parse(g[r],!0);return g}splitFace(b){for(var g=0,r=this.primitives.length;g<
r;g++)if(h=[],"face"===this.primitives[g].type){for(var l=0,m=b.primitives.length;l<m;l++)"face"===b.primitives[l].type?h=h.concat(this.primitives[g].splitFace(b.primitives[l])):h.push(b.primitives[l]);b.primitives=h}}}a.Graphic3D=c;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var p,k,f,v,q;class d extends a.Graphic3D{constructor(n,h){super(n,h)}buildPrimitives(){p=this.evaluator;this.updateMVMatrix();k=p.eval(this.expresion);f=k[0][0];v=k[0][1];q=k[0][2];this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(f,v,q,1))],type:"vertex",backColor:this.backcolor.getColor(),frontColor:this.color.getColor(),size:p.eval(this.width)}));""!==this.text&&(this.offset_dist=this.offset_dist||p.parser.parse("10"),
this.offset_angle=this.offset_angle||p.parser.parse("270"),this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(f,v,q,1))],type:"text",fromPoint:!0,frontColor:this.color.getColor(),font_size:this.font_size,font_style:this.font_style,font_family:this.font_family,decimals:p.eval(this.decimals),fixed:this.fixed,evaluator:p,text:new a.TextObject(this,this.text),family:this.family,familyValue:this.familyValue,offset_dist:this.offset_dist,offset_angle:this.offset_angle},
this.space)))}}a.Point3D=d;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var p,k,f,v,q,d,n,h,c;class b extends a.Graphic3D{constructor(g,r){super(g,r);this.width=this.width||g.evaluator.parser.parse("1")}buildPrimitives(){h=this.evaluator;this.updateMVMatrix();n=h.getVariable("u");h.setVariable("u",this.Nu);c=h.eval(this.expresion);p=c[0][0];k=c[0][1];f=c[0][2];v=c[1][0];q=c[1][1];d=c[1][2];this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(p,k,f,1)),this.transformVertex(new a.Vector4D(v,
q,d,1))],type:"edge",lineDash:this.lineDash,frontColor:this.color.getColor(),lineWidth:h.eval(this.width)},this.space));h.setVariable("u",n)}}a.Segment3D=b;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var p,k,f,v,q,d,n,h,c,b,g,r,l,m;class z extends a.Graphic3D{constructor(u,e){super(u,e);this.parameter=this.parameter||"t";this.parameter_interval=this.parameter_interval||u.evaluator.parser.parse("[0,1]");this.parameter_steps=this.parameter_steps||u.evaluator.parser.parse("8");this.expresion=this.parseExpression()}buildPrimitives(){p=this.evaluator;this.updateMVMatrix();v=p.getVariable("x");q=p.getVariable("y");d=p.getVariable("z");k=p.getVariable("u");
f=p.getVariable("v");p.setVariable("u",0);p.setVariable("v",0);n=parseInt(p.eval(this.Nu));h=parseInt(p.eval(this.Nv));c=[];for(g=0;g<=n;g++)for(p.setVariable("u",g/n),r=0;r<=h;r++){p.setVariable("v",r/h);l=0;for(m=this.expresion.length;l<m;l++)p.eval(this.expresion[l]);c.push(this.transformVertex(new a.Vector4D(p.getVariable("x"),p.getVariable("y"),p.getVariable("z"),1)))}var u=this.color.getColor(),e=this.backcolor.getColor(),w=this.edges?this.edges.getColor():"";for(g=0;g<n;g++)for(r=0;r<h;r++)b=
[],b.push(c[r+g*h+g]),b.push(c[r+1+g*h+g]),b.push(c[r+2+(g+1)*h+g]),b.push(c[r+1+(g+1)*h+g]),this.primitives.push(new a.Primitive3D({vertices:b,type:"face",frontColor:u,backColor:e,edges:w,model:this.model},this.space));p.setVariable("x",v);p.setVariable("y",q);p.setVariable("z",d);p.setVariable("u",k);p.setVariable("v",f)}}a.Surface3D=z;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var p,k,f,v,q,d,n,h;class c extends a.Graphic3D{constructor(b,g){super(b,g);this.width=this.width||b.evaluator.parser.parse("1")}buildPrimitives(){n=this.evaluator;this.updateMVMatrix();h=n.eval(this.expresion);for(var b=this.color.getColor(),g=0,r=h.length-1;g<r;g++)p=h[g][0],k=h[g][1],f=h[g][2],v=h[g+1][0],q=h[g+1][1],d=h[g+1][2],this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(p,k,f,1)),this.transformVertex(new a.Vector4D(v,
q,d,1))],type:"edge",frontColor:b,lineWidth:n.eval(this.width)},this.space))}}a.Polygon3D=c;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var p,k,f,v,q,d,n;class h extends a.Graphic3D{constructor(c,b){super(c,b);this.width=this.width||c.evaluator.parser.parse("1");this.expresion=this.parseExpression()}buildPrimitives(){n=this.evaluator;this.updateMVMatrix();v=n.getVariable("x");q=n.getVariable("y");d=n.getVariable("z");f=n.getVariable("u");n.setVariable("u",0);k=n.eval(this.Nu);p=[];for(var c=0;c<=k;c++){n.setVariable("u",c/k);for(var b=0,g=this.expresion.length;b<g;b++)n.eval(this.expresion[b]);
p.push(this.transformVertex(new a.Vector4D(n.getVariable("x"),n.getVariable("y"),n.getVariable("z"),1)))}c=0;for(b=p.length-1;c<b;c++)this.primitives.push(new a.Primitive3D({vertices:[p[c],p[c+1]],type:"edge",frontColor:this.color.getColor(),lineWidth:n.eval(this.width)},this.space));this.fill&&2<p.length&&this.primitives.push(new a.Primitive3D({vertices:p,type:"face",frontColor:this.fill.getColor(),backColor:this.fill.getColor(),edges:"",model:this.model},this.space));n.setVariable("x",v);n.setVariable("y",
d);n.setVariable("z",q);n.setVariable("u",f)}}a.Curve3D=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var p,k,f,v,q,d,n,h,c,b,g;class r extends a.Graphic3D{constructor(l,m){super(l,m)}buildPrimitives(){b=this.evaluator;this.updateMVMatrix();g=b.eval(this.expresion);p=g[0][0];k=g[0][1];f=g[0][2];v=g[1][0];q=g[1][1];d=g[1][2];n=g[2][0];h=g[2][1];c=g[2][2];var l=this.edges?this.edges.getColor():"";this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(p,k,f,1)),this.transformVertex(new a.Vector4D(n,h,c,1)),this.transformVertex(new a.Vector4D(v,
q,d,1))],type:"face",frontColor:this.color.getColor(),backColor:this.backcolor.getColor(),edges:l,model:this.model},this.space))}}a.Triangle3D=r;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var p,k,f;class v extends a.Graphic3D{constructor(q,d){super(q,d)}buildPrimitives(){k=this.evaluator;this.updateMVMatrix();f=k.eval(this.expresion);p=[];for(var q=f.length-1;0<=q;q--)p.push(this.transformVertex(new a.Vector4D(f[q][0],f[q][1],f[q][2],1)));q=this.edges?this.edges.getColor():"";this.primitives.push(new a.Primitive3D({vertices:p,type:"face",frontColor:this.color.getColor(),backColor:this.backcolor.getColor(),edges:q,model:this.model},this.space))}}
a.Face3D=v;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var p,k,f,v,q,d;class n extends a.Graphic3D{constructor(h,c){super(h,c);this.width=this.width||h.evaluator.parser.parse("2");this.length=this.length||h.evaluator.parser.parse("2")}buildPrimitives(){d=this.evaluator;this.updateMVMatrix();p=d.eval(this.Nu);k=[this.transformVertex(new a.Vector4D(0,0,0,1))];f=d.eval(this.width)/2;v=d.eval(this.length)/2;q=2*Math.PI/p;for(var h=0;h<p;h++)k.push(this.transformVertex(new a.Vector4D(f*Math.cos(q*h),v*Math.sin(q*
h),0,1)));var c=this.color.getColor(),b=this.backcolor.getColor(),g=this.edges?this.edges.getColor():"";for(h=0;h<p;h++)this.primitives.push(new a.Primitive3D({vertices:[k[0],h+2<=p?k[h+2]:k[1],k[h+1]],type:"face",frontColor:c,backColor:b,edges:g,model:this.model},this.space))}}a.Polireg3D=n;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var p,k,f,v;class q extends a.Graphic3D{constructor(d,n){super(d,n);this.shadowColor=this.shadowColor?this.shadowColor.getColor():"transparent"}buildPrimitives(){p=this.evaluator;k=p.eval(this.expresion);f=k[0][0];v=k[0][1];this.primitives.push(new a.Primitive3D({vertices:[new a.Vector4D(f,v,0,1)],type:"text",frontColor:this.color.getColor(),font_size:this.font_size,font_style:this.font_style,font_family:this.font_family,decimals:p.eval(this.decimals),
fixed:this.fixed,displace:0,isText:!0,evaluator:p,text:new a.TextObject(this,this.text),family:this.family,familyValue:this.familyValue},this.space))}}a.Text3D=q;return a}(descartesJS||{});
descartesJS=function(a,p){if(a.loadLib)return a;var k=new String("-point-segment-polygon-curve-triangle-face-polireg-surface-text-cube-box-tetrahedron-octahedron-sphere-dodecahedron-icosahedron-ellipsoid-cone-cylinder-torus-mesh-macro-"),f=/[\w\.\-//]*(\.png|\.jpg|\.gif|\.svg|\.webp)/gi,v,q,d=0;class n extends a.Graphic{constructor(h,c){super(h,c);this.expresion=this.expresion||void 0;this.inirot=this.inirot||"(0,0,0)";this.inirotEuler=this.inirotEuler||!1;this.inipos=this.inipos||h.evaluator.parser.parse("(0,0,0)");
this.endrot=this.endrot||"(0,0,0)";this.endrotEuler=this.endrotEuler||!1;this.endpos=this.endpos||h.evaluator.parser.parse("(0,0,0)");this.name=this.name||"_descartes_empty_name_"+d++;Object.assign(this,c);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=[];h=h.lessonParser;var b=new a.Tokenizer;if(void 0!=this.expresion){"'"!==this.expresion.charAt(0)&&(this.expresion="'"+this.expresion+"'");this.expresion=this.evaluator.parser.parse(this.expresion);
c=this.evaluator.eval(this.expresion);if(c)var g=(g=document.getElementById(c))&&"descartes/macro"==g.type?g.text:a.openExternalFile(c);if(g){var r=a.convertHTMLEntities(g).replace(/\r/g,"").split("\n");g=[];c=0;for(var l=r.length;c<l;c++){var m=r[c].indexOf("=");if(-1!==m){m=h.split(r[c]);for(var z=0,u=m.length;z<u;z++)if(m[z]&&1<m.length&&("id"===p[m[z][0]]||"type"===p[m[z][0]])){g.push(m);break}}}c=0;for(l=g.length;c<l;c++){u=(z=g[c]||[],z[0])&&"id"===z[0][0];var e=!1;r=0;for(m=z.length;r<m;r++){var w=
z[r][0].indexOf(".");-1===w||u?w=p[z[r][0]]:(w=p[z[r][0].substring(w+1)],z[r][0]=this.name+"."+z[r][0]);"type"===w&&"surface"===p[z[r][1]]&&(e=!0);if(!("font"===w||"font_family"===w||("fill"===w||"color"===w||"backcolor"===w||"arrow"===w)&&"("!==z[r][1].charAt(0)||"file"===w&&z[r][1].match(f)||"id"!==w&&void 0!==p[z[r][1]])||"width"===w||"height"===w||"length"===w)if(e&&"expresion"===w){var B=z[r][1].split(" ");for(var y="",A=0,x=B.length;A<x;A++){for(var H=B[A].replace(/&squot;/g,"'").split(";"),
J=0,C=H.length;J<C;J++){w=b.tokenize(H[J].replace(/\\n/g,";"));for(var G=0,F=w.length;G<F;G++)if("identifier"===w[G].type&&!(a.reservedIds+"-x-y-z-u-v-").match("-"+w[G].value+"-")||"R"===w[G].value||"G"===w[G].value||"B"===w[G].value)w[G].value=this.name+"."+w[G].value;H[J]=b.flatTokens(w)}y+=H.join(";")+" "}z[r][1]=y}else if("text"==w)if(z[r][1].match(/\{\\rtf1/)){w=z[r][1];var P=this;B=function(E,N){N=b.tokenize(N.replace(/&squot;/g,"'"));for(var W=0,T=N.length;W<T;W++)if("identifier"==N[W].type&&
!a.reservedIds.match("-"+N[W].value+"-")||"R"===N[W].value||"G"===N[W].value||"B"===N[W].value)N[W].value=P.name+"."+N[W].value;return(E.match(/^\\expr/)?"\\expr ":"\\decimals ")+b.flatTokens(N)};w=w.replace(/\\expr ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,B);w=w.replace(/\\decimals ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,B);z[r][1]=w}else{B=h.parseText(z[r][1]).textElementsMacros;y=0;for(A=B.length;y<A;y++){w=b.tokenize(B[y].replace(/&squot;/g,"'"));x=0;for(H=w.length;x<
H;x++)if("identifier"===w[x].type&&!a.reservedIds.match("-"+w[x].value+"-")||"R"===w[x].value||"G"===w[x].value||"B"===w[x].value)w[x].value=this.name+"."+w[x].value;w=b.flatTokens(w).replace(/&squot;/g,"'").replace(/'\+\(/g,"[").replace(/\)\+'/g,"]");B[y]=w.substring(1,w.length-1)}z[r][1]=B.join("")}else{H=z[r][1].replace(/&squot;/g,"'").split(";");J=0;for(C=H.length;J<C;J++){w=b.tokenize(H[J].replace(/\\n/g,";"));G=0;for(F=w.length;G<F;G++)if("identifier"===w[G].type&&!(a.reservedIds+"-Euler-").match("-"+
w[G].value+"-")||"R"===w[G].value||"G"===w[G].value||"B"===w[G].value)w[G].value=this.name+"."+w[G].value;H[J]=b.flatTokens(w)}z[r][1]=H.join(";")}}}c=0;for(l=g.length;c<l;c++)if(g[c][0]){z="";u=!1;r=0;for(m=g[c].length;r<m;r++)"type"===p[g[c][r][0]]&&k.match("-"+p[g[c][r][1]]+"-")&&(u=!0),z=z+g[c][r][0]+"='"+g[c][r][1]+"' ";g[c]=z+(u?" space='"+this.spaceID+"'":"");u?this.graphics.push(h.parse3DGraphic(g[c],this.abs_coord,this.background,this.inirot)):h.parseAuxiliar(g[c])}}c=0;for(l=this.graphics.length;c<
l;c++)this.graphics[c].macroChildren=!0}}buildFamilyPrimitives(){evaluator=this.evaluator;this.getFamilyValues();var h=evaluator.getVariable(this.family);if(0<=this.fSteps)for(var c=0,b=this.fSteps;c<=b;c++)evaluator.setVariable(this.family,this.familyInf+c*this.family_sep),this.familyValue=this.familyInf+c*this.family_sep,evaluator.eval(this.drawif)&&this.updateMacro();evaluator.setVariable(this.family,h)}update(){this.primitives=[];this.evaluator.eval(this.drawif)&&(this.family||this.updateMacro());
this.family&&this.buildFamilyPrimitives()}updateMacro(){this.updateTransformation();if(this.inipos){var h=this.evaluator.eval(this.inipos);this.iniPosX=h[0][0];this.iniPosY=h[0][1]}h=0;for(var c=this.graphics.length;h<c;h++)v=this.graphics[h],v.macro_inirotEuler=this.inirotEuler,v.macro_inirotM=this.inirotM,v.macro_inirotM_X=this.inirotM_X,v.macro_inirotM_Y=this.inirotM_Y,v.macro_inirotM_Z=this.inirotM_Z,v.macro_iniposM=this.iniposM,v.macro_endrotEuler=this.endrotEuler,v.macro_endrotM=this.endrotM,
v.macro_endrotM_X=this.endrotM_X,v.macro_endrotM_Y=this.endrotM_Y,v.macro_endrotM_Z=this.endrotM_Z,v.macro_endposM=this.endposM,v.update();h=0;for(c=this.graphics.length;h<c;h++){v=this.graphics[h];if(v.split||this.split)for(var b=h+1;b<c;b++)q=this.graphics[b],(q.split||this.split)&&v.splitFace(q);this.primitives=this.primitives.concat(v.primitives||[])}}updateTransformation(){tmpExpr=this.evaluator.eval(this.inirot);this.inirotEuler?(this.inirotM=this.inirotM.setIdentity(),this.inirotM=this.inirotM.rotateZ(a.degToRad(tmpExpr[0][0])),
this.inirotM=this.inirotM.rotateX(a.degToRad(tmpExpr[0][1])),this.inirotM=this.inirotM.rotateZ(a.degToRad(tmpExpr[0][2]))):(this.inirotM_X=this.inirotM_X.setIdentity().rotateX(a.degToRad(tmpExpr[0][0])),this.inirotM_Y=this.inirotM_Y.setIdentity().rotateY(a.degToRad(tmpExpr[0][1])),this.inirotM_Z=this.inirotM_Z.setIdentity().rotateZ(a.degToRad(tmpExpr[0][2])));tmpExpr=this.evaluator.eval(this.inipos);translate={x:tmpExpr[0][0],y:tmpExpr[0][1],z:tmpExpr[0][2]};this.iniposM=this.iniposM.setIdentity().translate(translate);
tmpExpr=this.evaluator.eval(this.endrot);this.endrotEuler?(this.endrotM=this.endrotM.setIdentity(),this.endrotM=this.endrotM.rotateZ(a.degToRad(tmpExpr[0][0])),this.endrotM=this.endrotM.rotateX(a.degToRad(tmpExpr[0][1])),this.endrotM=this.endrotM.rotateZ(a.degToRad(tmpExpr[0][2]))):(this.endrotM_X=this.endrotM_X.setIdentity().rotateX(a.degToRad(tmpExpr[0][0])),this.endrotM_Y=this.endrotM_Y.setIdentity().rotateY(a.degToRad(tmpExpr[0][1])),this.endrotM_Z=this.endrotM_Z.setIdentity().rotateZ(a.degToRad(tmpExpr[0][2])));
tmpExpr=this.evaluator.eval(this.endpos);translate={x:tmpExpr[0][0],y:tmpExpr[0][1],z:tmpExpr[0][2]};this.endposM=this.endposM.setIdentity().translate(translate)}drawAux(h){}}a.Macro3D=n;return a}(descartesJS||{},babel);
descartesJS=function(a){function p(D,K,R,O,L){k.call(this,D/u,D/u,D/u,O,L)}function k(D,K,R,O,L){D/=2;K/=2;R/=2;this.changeGeometry(D,K,R,O,L)||(this.vertices=[new e(D,R,K,1),new e(D,-R,K,1),new e(D,R,-K,1),new e(D,-R,-K,1),new e(-D,R,K,1),new e(-D,-R,K,1),new e(-D,R,-K,1),new e(-D,-R,-K,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(D,K,R,O,L))}function f(D,K,R,O,L){D/=2;if(!this.changeGeometry(D,K,R,O,L)){var M=2*Math.PI/3,U=2*D*Math.sqrt(2)/3,I=-D/
3,V=U*Math.cos(M)+0*Math.sin(M);M=-U*Math.sin(M)+0*Math.cos(M);this.vertices=[new e(0,0,D,1),new e(V,M,I,1),new e(V,-M,I,1),new e(U,0,I,1)];this.faces=[[1,3,2],[0,1,2],[0,2,3],[0,3,1]];this.updateValues(D,K,R,O,L)}}function v(D,K,R,O,L){D/=2;this.changeGeometry(D,K,R,O,L)||(this.vertices=[new e(0,0,D,1),new e(D,0,0,1),new e(-D,0,0,1),new e(0,D,0,1),new e(0,-D,0,1),new e(0,0,-D,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(D,K,R,O,L))}function q(D,
K,R,O,L){D/=Math.PI;if(!this.changeGeometry(D,K,R,O,L)){F=D/1.6180339887;P=1.6180339887*D;this.vertices=[new e(D,D,D,1),new e(D,D,-D,1),new e(D,-D,D,1),new e(D,-D,-D,1),new e(-D,D,D,1),new e(-D,D,-D,1),new e(-D,-D,D,1),new e(-D,-D,-D,1),new e(0,F,P,1),new e(0,F,-P,1),new e(0,-F,P,1),new e(0,-F,-P,1),new e(F,P,0,1),new e(F,-P,0,1),new e(-F,P,0,1),new e(-F,-P,0,1),new e(P,0,F,1),new e(P,0,-F,1),new e(-P,0,F,1),new e(-P,0,-F,1)];E=(new a.Matrix4x4).setIdentity().rotateY(-m/6);T=0;for(S=this.vertices.length;T<
S;T++)this.vertices[T]=E.multiplyVector4(this.vertices[T]);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(D,K,R,O,L)}}function d(D,K,R,O,L){D/=3.8;if(!this.changeGeometry(D,K,R,O,L)){P=1.6180339887*D;this.vertices=[new e(0,D,P,1),new e(0,D,-P,1),new e(0,-D,P,1),new e(0,-D,-P,1),new e(D,P,0,1),new e(D,-P,0,1),new e(-D,P,0,1),new e(-D,-P,0,1),
new e(P,0,D,1),new e(P,0,-D,1),new e(-P,0,D,1),new e(-P,0,-D,1)];this.faces=[[10,0,2],[0,8,2],[8,5,2],[5,7,2],[7,10,2],[6,0,10],[11,6,10],[7,11,10],[7,3,11],[5,3,7],[9,3,5],[8,9,5],[4,9,8],[0,4,8],[6,4,0],[11,3,1],[6,11,1],[4,6,1],[9,4,1],[3,9,1]];E=(new a.Matrix4x4).setIdentity().rotateY(-1.0285);T=0;for(S=this.vertices.length;T<S;T++)this.vertices[T]=E.multiplyVector4(this.vertices[T]);this.updateValues(D,K,R,O,L)}}function n(D,K,R,O,L){D/=2;this.isSphere?R=K=D:(K/=2,R/=2);if(!this.changeGeometry(D,
K,R,O,L)){this.vertices=[new e(0,0,K,1)];for(T=1;T<O;T++)for(J=T*m/O,Q=0;Q<L;Q++)H=Q*z/L,y=D*r(J)*l(H),A=R*r(J)*r(H),x=K*l(J),this.vertices.push(new e(y,A,x,1));this.vertices.push(new e(0,0,-K,1));this.faces=[];for(T=0;T<L;T++)this.faces.push([0,(T+1)%L+1,T%L+1]);for(T=1;T<O-1;T++)for(Q=0;Q<L;Q++)this.faces.push([Q+1+(T-1)*L,(Q+1)%L+1+(T-1)*L,(Q+1)%L+1+T*L,Q+1+T*L]);for(T=0;T<L;T++)this.faces.push([this.vertices.length-1,this.vertices.length-1-L+T,this.vertices.length-1-L+(T+1)%L]);this.updateValues(D,
K,R,O,L)}}function h(D,K,R,O,L){D/=2;K/=2;R/=2;if(!this.changeGeometry(D,K,R,O,L)){this.vertices=[];for(T=0;T<L;T++)for(Q=0;Q<O;Q++)y=D*(L-T)/L*l(Q*z/O),A=R*(L-T)/L*r(Q*z/O),x=K-2*T*K/L,this.vertices.push(new e(y,A,x,1));this.vertices.push(new e(0,0,-K,1));this.faces=[];for(T=0;T<L-1;T++)for(Q=0;Q<O;Q++)this.faces.push([Q+T*O,(Q+1)%O+T*O,(Q+1)%O+(T+1)*O,Q+(T+1)*O]);for(T=0;T<O;T++)this.faces.push([this.vertices.length-1,this.vertices.length-1-O+T,this.vertices.length-1-O+(T+1)%O]);this.updateValues(D,
K,R,O,L)}}function c(D,K,R,O,L){D/=2;K/=2;R/=2;if(!this.changeGeometry(D,K,R,O,L)){this.vertices=[];for(T=0;T<L+1;T++)for(Q=0;Q<O;Q++)y=D*l(Q*z/O),A=R*r(Q*z/O),x=K-2*T*K/L,this.vertices.push(new e(y,A,x,1));this.faces=[];for(T=0;T<L;T++)for(Q=0;Q<O;Q++)this.faces.push([Q+T*O,(Q+1)%O+T*O,(Q+1)%O+(T+1)*O,Q+(T+1)*O]);this.updateValues(D,K,R,O,L)}}function b(D,K,R,O,L){D/=2;K/=2;R/=2;C=w.eval(this.R);G=w.eval(this.r);if(!this.changeGeometry(D,K,R,O,L)){this.vertices=[];for(T=0;T<L+1;T++)for(Q=0;Q<O;Q++)y=
-(C+G*r(z*Q/O))*r(z*T/L),A=(C+G*r(z*Q/O))*l(z*T/L),x=G*l(z*Q/O),this.vertices.push(new e(y,A,x,1));this.faces=[];for(T=0;T<L;T++)for(Q=0;Q<O;Q++)this.faces.push([Q+T*O,Q+(T+1)*O,(Q+1)%O+(T+1)*O,(Q+1)%O+T*O]);this.updateValues(D,K,R,O,L)}}function g(){this.vertices=[];this.faces=[];T=0;for(S=this.fileData.length;T<S;T++)N=this.fileData[T],N.match(/^V\(/)?(W=N.substring(2,N.length-1).split(",").map(parseFloats),this.vertices.push(new e(W[0]||0,W[1]||0,W[2]||0,1))):N.match(/^F\(/)&&(W=N.substring(2,
N.length-1).split(",").map(parseInt),this.faces.push(W.reverse()))}if(a.loadLib)return a;var r=Math.sin,l=Math.cos,m=Math.PI,z=2*m,u=Math.sqrt(3),e,w,B,y,A,x,H,J,C,G,F,P,E,N,W,T,S,Q,X;class aa extends a.Graphic3D{constructor(D,K){super(D,K);this.width=this.width||D.evaluator.parser.parse("2");this.height=this.height||D.evaluator.parser.parse("2");this.length=this.length||D.evaluator.parser.parse("2");this.R=this.R||D.evaluator.parser.parse("2");this.r=this.r||D.evaluator.parser.parse("1");e=a.Vector4D;
switch(this.subType){case "cube":this.buildGeometry=p;break;case "box":this.buildGeometry=k;break;case "tetrahedron":this.buildGeometry=f;break;case "octahedron":this.buildGeometry=v;break;case "sphere":this.isSphere=!0;case "ellipsoid":this.buildGeometry=n;break;case "dodecahedron":this.buildGeometry=q;break;case "icosahedron":this.buildGeometry=d;break;case "cone":this.buildGeometry=h;break;case "cylinder":this.buildGeometry=c;break;case "torus":this.buildGeometry=b;break;case "mesh":this.fileData=
a.openExternalFile(this.evaluator.eval(this.file)).split(/\r/),this.buildGeometry=g}}buildPrimitives(){w=this.evaluator;this.updateMVMatrix();this.buildGeometry(w.eval(this.width),w.eval(this.height),w.eval(this.length),w.eval(this.Nu),w.eval(this.Nv));var D=this.color.getColor(),K=this.backcolor.getColor(),R=this.edges?this.edges.getColor():"";T=0;for(S=this.faces.length;T<S;T++){B=[];Q=0;for(X=this.faces[T].length;Q<X;Q++)B.push(this.transformVertex(this.vertices[this.faces[T][Q]]));this.primitives.push(new a.Primitive3D({vertices:B,
type:"face",frontColor:D,backColor:K,edges:R,model:this.model},this.space))}}changeGeometry(D,K,R,O,L){return this.oldWidth===D&&this.oldHeight===K&&this.oldLength===R&&this.oldNu===O&&this.oldNv===L}updateValues(D,K,R,O,L){this.oldWidth=D;this.oldHeight=K;this.oldLength=R;this.oldNv=L;this.oldNu=O}}a.OtherGeometry3D=aa;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var p=Math.max,k=Math.min,f=Math.PI,v=Math.cos,q=Math.sin,d=Math.abs,n=Math.round,h,c,b,g,r,l,m,z,u,e,w,B,y,A,x,H,J,C;class G{constructor(F=0,P=0){this.x=F;this.y=P}set(F=0,P=0){this.x=F;this.y=P;return this}copy(){return new G(this.x,this.y)}ix(){return n(p(k(this.x,32E3),-32E3))}iy(){return n(p(k(this.y,32E3),-32E3))}equals(F){return this.x===F.x&&this.y===F.y}norm2(){return this.x*this.x+this.y*this.y}norm(){return Math.sqrt(this.norm2())}distance(F){c=
this.copy();c.sub(F);return c.norm()}dot(F){return this.x*F.x+this.y*F.y}det(F){return this.x*F.y-this.y*F.x}mul(F){this.x*=F;this.y*=F}div(F){this.x/=F;this.y/=F}add(F){this.x+=F.x;this.y+=F.y}sub(F){this.x-=F.x;this.y-=F.y}normalize(){h=this.norm();0!=h&&this.div(h)}rotR90(){h=this.x;this.x=this.y;this.y=-h}rotL90(){h=this.x;this.x=-this.y;this.y=h}rot(F){b=this.copy();l=v(F);m=q(F);this.x=b.x*l-b.y*m;this.y=b.x*m+b.y*l}rot2(F){this.rot(F*f/180)}intersection(F,P,E,N){z=P.x-F.x;u=E.x-N.x;e=E.x-F.x;
w=P.y-F.y;B=E.y-N.y;y=E.y-F.y;C=z*B-u*w;return 1E-6<d(C)?(g=(e*B-y*u)/C,r=(-e*w+y*z)/C,0<=g&&1>=g&&0<=r&&1>=r?new G(F.x+z*g,F.y+w*g):null):(P.x-E.x)*y!=(P.y-E.y)*e?null:F.x!=P.x?(A=k(F.x,P.x),x=p(F.x,P.x),A<=E.x&&E.x<=x?E:A<=N.x&&N.x<=x?N:null):E.x!=N.x?(H=k(E.x,N.x),J=p(E.x,N.x),H<=F.x&&F.x<=J?F:H<=P.x&&P.x<=J?P:null):F.y!=P.y?(A=k(F.y,P.y),x=p(F.y,P.y),A<=E.y&&E.y<=x?E:A<=N.y&&N.y<=x?N:null):E.y!=N.y?(H=k(E.y,N.y),J=p(E.y,N.y),H<=F.y&&F.y<=J?F:H<=P.y&&P.y<=J?P:null):F.x==E.x&&F.y==E.y?F:null}}a.R2=
G;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var p,k,f,v,q,d,n,h,c;class b{constructor(g,r){this.evaluator=g;this.constraint=r;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];
d=new a.R2(0,0);q=new a.R2(0,0);c=new a.R2(0,0)}getUnitNormal(){this.normal.normalize();return c.set(this.normal.x,this.normal.y)}gradient(g){p=this.evaluator;d.x=0;d.y=0;n=p.getVariable("x");h=p.getVariable("y");p.setVariable("x",g.x);p.setVariable("y",g.y);this.f0=p.eval(this.constraint);p.setVariable("x",p.getVariable("x")+1E-6);k=p.eval(this.constraint);d.x=(k-this.f0)/1E-6;d.x=isNaN(d.x)?Infinity:d.x;p.setVariable("x",p.getVariable("x")-1E-6);p.setVariable("y",p.getVariable("y")+1E-6);k=p.eval(this.constraint);
d.y=(k-this.f0)/1E-6;d.y=isNaN(d.y)?Infinity:d.y;p.setVariable("x",n);p.setVariable("y",h);return d}findZero(g,r,l){p=this.evaluator;q.x=g.x;q.y=g.y;n=p.getVariable("x");h=p.getVariable("y");p.setVariable("x",g.x);p.setVariable("y",g.y);this.f0=p.eval(this.constraint);if("menor"===this.sign&&0>=this.f0||"mayor"===this.sign&&0<=this.f0)return q;p.setVariable("x",n);p.setVariable("y",h);for(var m=0;16>m;m++)if(f=q.x,v=q.y,this.normal=this.gradient(q),0!=this.normal.norm2()&&this.normal.mul(-this.f0/
this.normal.norm2()),q.x=f+this.normal.x,q.y=v+this.normal.y,this.normal.norm()<r)return 0===this.normal.x&&0===this.normal.y&&(this.normal.x=q.x-g.x,this.normal.y=q.y-g.y),q;return l?q:null}}a.R2Newton=b;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;class p{constructor(k,f){this.x=k;this.y=f}vectorLength(){return Math.sqrt(this.x*this.x+this.y*this.y)}dotProduct(k){return this.x*k.x+this.y*k.y}angleBetweenVectors(k){return Math.acos(this.dotProduct(k)/(this.vectorLength()*k.vectorLength()))}}p.AXIS_X=new p(1,0);p.AXIS_Y=new p(0,1);a.Vector2D=p;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var p=Math.floor,k=Math.round,f,v,q,d,n,h,c,b,g,r,l,m,z;class u{constructor(e,w){this.parent=e;this.evaluator=e.evaluator;var B=this.parser=e.evaluator.parser;this.id="GraphicControl"!==w.type?"C":"G";this.gui=this.type="";this.region="south";this.y=this.x=0;this.w="Video"!==w.type?100:350;this.h="Video"!==w.type?23:120;this.keyboard=!1;this.kblayout="1x16";"GraphicControl"!==w.type&&"Audio"!==w.type&&"Video"!==w.type?"TextArea"!==w.type?this.expresion=
B.parse("(0,0,100,23)"):(this.expresion=B.parse("(0,0,300,200)"),this.w=300,this.h=200):this.expresion=B.parse("(0,0)");this.visible=this.fixed=!0;this.color=new a.Color("Scrollbar"==w.gui?"e0e4e8":"222222");this.colorInt="cc0022";"Scrollbar"==w.gui?this.colorInt="182C61":"GraphicControl"!==w.type&&(this.colorInt="f0f8ff");this.colorInt=new a.Color(this.colorInt);this.font_size=B.parse("0");this.cID=this.msg_pos=this.Explanation=this.tooltip=this.parameter=this.action=this.underlined=this.italics=
this.bold="";this.parameterFont=this.tooltipFont=this.ExplanationFont="Monospace 12px";this.drawif=B.parse("1");this.activeif=B.parse("1");this.valueExpr=B.parse("0");this.decimals=B.parse("2");this.min=B.parse("-Infinity");this.max=B.parse("Infinity");this.incr=B.parse("0.1");this.exponentialif=this.discrete=!1;this.zIndex=-1;Object.assign(this,w);"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;w=this.evaluator.eval(this.expresion);this.x=k(w[0][0]);this.y=k(w[0][1]);4==w[0].length&&(this.w=k(w[0][2]),this.h=k(w[0][3]));this.actionExec=e.lessonParser.parseAction(this)}init(){}update(){}draw(){}getContainer(){var e=this.parent.spaces;if("interior"===this.region)for(var w=0,B=e.length;w<B;w++){var y=e[w];if(y.id===this.spaceID)return y.addCtr(this),this.zIndex=y.zIndex,this.space=y,y.numericalControlContainer}else{if("external"===
this.region)return this.parent.externalSpace.addCtr(this),this.parent.externalSpace.container;if("scenario"===this.region)return this.cID?(this.expresion=this.evaluator.parser.parse("(0,-1000,"+this.w+","+this.h+")"),this.parent.stage.stageSpace.addCtr(this),this.zIndex=this.parent.stage.stageSpace.zIndex,this.parent.stage.stageSpace.numericalControlContainer):this.parent.externalSpace.container;if(/north|south|east|west/.test(this.region))return this.parent[this.region+"Space"].controls.push(this),
this.parent[this.region+"Space"].container}e[0].addCtr(this);this.zIndex=e[0].zIndex;return e[0].numericalControlContainer}addControlContainer(e){var w=this.getContainer();w.childNodes[0]?w.insertBefore(e,w.childNodes[0]):w.appendChild(e)}updatePositionAndSize(){q=d=n=h=!1;c=this.evaluator.eval(this.expresion);b=k(c[0][0]);q=k(this.x)!==b;this.x=b;b=k(c[0][1]);d=k(this.y)!==b;this.y=b;4===c[0].length&&(b=k(c[0][2]),n=k(this.w)!==b,this.w=b,b=k(c[0][3]),h=k(this.h)!==b,this.h=b);if(n||h||q||d)this.init(!0,
!0),this.draw()}formatOutputValue(e){z=this.parent;g=e+"";r=this.evaluator.eval(this.decimals);l=g.indexOf(".");-1!=l&&(m=g.substring(l+1),m.length>r&&(g=parseFloat(g).toFixed(r)));this.fixed&&(2!==z.version||2===z.version&&!this.exponentialif)&&(g=parseFloat(e).toFixed(r));this.exponentialif&&0!=parseFloat(g)&&(g=this.fixed&&2!==z.version?parseFloat(g).toExponential(r):parseFloat(g).toExponential(),g=g.toUpperCase().replace("+",""));return g.replace(".",z.decimal_symbol)}updateAndExecAction(){this.parent.updateControls();
"init"===this.action&&(this.click=!1);this.actionExec.execute();this.parent.updateControls();"animate"!==this.action&&this.parent.update();this.parent.updateControls()}createGradient(e,w){this.linearGradient=this.ctx.createLinearGradient(0,0,0,w);f=w*w;for(e=0;e<w;e++)v=p(e-35*w/100),this.linearGradient.addColorStop(e/w,`rgba(0,0,0,${v*v*192/f/255})`)}}a.Control=u;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var p=Math.floor,k=Math.abs,f=/[\w\.\-//]*(\.gif)/gi,v,q,d,n,h,c,b,g,r,l,m,z,u,e,w,B,y,A,x,H,J,C,G,F,P,E,N,W,T,S,Q,X,aa,D,K;class R extends a.Control{constructor(O,L){super(O,L);this.imageSrc=L.imageSrc||"";this.image=L.image||new Image;this.imageOver=L.imageOver||new Image;this.imageDown=L.imageDown||new Image;this.flat=L.flat||!1;this.borderColor=L.borderColor||!1;this.text_align=L.text_align||"center_center";this.image_align=L.image_align||"center_center";
this.font_family=a.getFontName(L.font_family||"arial");this.ratio=O.ratio;-1===this.font_size&&(this.fontSizeNotSet=!0);this.borderColor&&(this.borderColor=new a.Color(this.borderColor));this.text_align=this.text_align.split("_");this.image_align=this.image_align.split("_");this.old_name=this.name;this.name.match(/^\[.*\]?/)?this.name=this.parser.parse(this.name.substring(1,this.name.length-1)):this.name=this.parser.parse(`'${this.name}'`);this.classContainer=this.cssClass?" "+this.cssClass+" ":"";
this.extra_style=this.imageSrc.trim().match("^_STYLE_")?this.imageSrc.trim().substring(8):this.extra_style||"";this.imageSrc.trim().match("^_STYLE_")&&(this.imageSrc="vacio.gif");if(this.extra_style){this.customStyle=!0;this.btnStyle=[];this.conStyle=[];this.conStyle.textBorder=3;O=this.extra_style.split("|");for(var M,U=0,I=O.length;U<I;U++)L=O[U],M=L.match(/rgb/g),L.match("class=")?this.classContainer=" "+L.substring(6):L.match("border=")?(this.btnStyle.push({type:"border-style",value:"solid"}),
this.btnStyle.push({type:"border-width",value:L.substring(7).trim()+"px"})):L.match("borderRadius=")?(this.btnStyle.push({type:"border-radius",value:L.substring(13).trim()+"px"}),this.conStyle.push({type:"border-radius",value:L.substring(13).trim()+"px"})):L.match("borderColor=")?this.btnStyle.push({type:"border-color",value:(M?"":"#")+L.substring(12).trim()}):L.match("overColor=")?this.conStyle.overColor=(M?"":"#")+L.substring(10).trim():L.match("downColor=")?this.conStyle.downColor=(M?"":"#")+L.substring(10).trim():
L.match("font=")?this.conStyle.font=L.substring(5).trim().toLowerCase():L.match("inactiveColor=")?this.conStyle.inactiveColor=(M?"":"#")+L.substring(14).trim():L.match("inactiveColorBorder=")?this.conStyle.inactiveColorBorder=(M?"":"#")+L.substring(20).trim():L.match("shadowTextBlur=")?this.conStyle.shadowTextBlur=parseFloat(L.substring(15).trim()):L.match("shadowTextOffsetX=")?this.conStyle.shadowTextOffsetX=parseFloat(L.substring(18).trim()):L.match("shadowTextOffsetY=")?this.conStyle.shadowTextOffsetY=
parseFloat(L.substring(18).trim()):L.match("shadowTextColor=")?this.conStyle.shadowTextColor=(M?"":"#")+L.substring(16).trim():L.match("shadowBoxBlur=")?this.conStyle.shadowBoxBlur=parseFloat(L.substring(14).trim()):L.match("shadowBoxOffsetX=")?this.conStyle.shadowBoxOffsetX=parseFloat(L.substring(17).trim()):L.match("shadowBoxOffsetY=")?this.conStyle.shadowBoxOffsetY=parseFloat(L.substring(17).trim()):L.match("shadowBoxColor=")?this.conStyle.shadowBoxColor=(M?"":"#")+L.substring(15).trim():L.match("shadowInsetBoxBlur=")?
this.conStyle.shadowInsetBoxBlur=parseFloat(L.substring(19).trim()):L.match("shadowInsetBoxOffsetX=")?this.conStyle.shadowInsetBoxOffsetX=parseFloat(L.substring(22).trim()):L.match("shadowInsetBoxOffsetY=")?this.conStyle.shadowInsetBoxOffsetY=parseFloat(L.substring(22).trim()):L.match("shadowInsetBoxColor=")?this.conStyle.shadowInsetBoxColor=(M?"":"#")+L.substring(20).trim():L.match("textBorder=")?this.conStyle.textBorder=parseFloat(L.substring(11).trim()):L.match("flat=")?this.flat=1==parseInt(L.substring(5).trim()):
L.match("imgSizeW=")?this.imgSizeW=parseFloat(L.substring(9))||0:L.match("imgSizeH=")&&(this.imgSizeH=parseFloat(L.substring(9))||0)}this.imageSrc.match("_COLORES_")&&(O=this.imageSrc.split("_"),this.colorInt=new a.Color(O[2]),this.color=new a.Color(O[3]),this.font_size=this.parser.parse(O[5]),this.imageSrc="");this.imageSrc.match(/^\[.*\]?/)?this.imageSrc=this.parser.parse(this.imageSrc.substring(1,this.imageSrc.length-1)):this.imageSrc=this.parser.parse("'"+this.imageSrc+"'");O=this.evaluator.eval(this.imageSrc).toString().trim();
if(""!=O)if(L=O.substr(0,O.lastIndexOf(".")),M=O.substr(O.lastIndexOf(".")),O.match(/vacio.gif$/i))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'");else if(this.image=this.parent.getImage(O),L)try{this.imageOver=this.parent.getImage(L+"_over"+M),this.imageDown=this.parent.getImage(L+"_down"+M)}catch(V){}this.container=a.newHTML("div",{class:"DescartesButtonContainer"+
this.classContainer,id:this.id,style:`width:${this.w}px;height:${this.h}px;left:${this.x}px;top:${this.y}px;z-index:${this.zIndex};`});this.btn=a.newHTML("canvas",{width:this.w*this.ratio,height:this.h*this.ratio,style:`position:absolute;left:0;top:0;width:${this.w}px;height:${this.h}px;`});this.ctx=this.btn.getContext("2d");this.ctx.imageSmoothingEnabled=!1;this.tooltip&&(this.btn.title=this.tooltip);this.container.appendChild(this.btn);this.addControlContainer(this.container);this.addEvents();this.init()}init(O){v=
this.evaluator;x=this.container;q=this.btn;d=this.ctx;n=v.eval(this.expresion);this.x=n[0][0];this.y=n[0][1];4==n[0].length&&(this.w=parseInt(n[0][2]),this.h=parseInt(n[0][3]));q.width=this.w*this.ratio;q.height=this.h*this.ratio;q.setAttribute("style",`position:absolute;left:0;top:0;width:${this.w}px;height:${this.h}px;box-sizing:border-box;`);x.setAttribute("style",`width:${this.w}px;height:${this.h}px;left:${this.x}px;top:${this.y}px;z-index:${this.zIndex};display:block;`);if(this.btnStyle)for(var L=
0,M=this.btnStyle.length;L<M;L++)q.style[this.btnStyle[L].type]=this.btnStyle[L].value;if(this.conStyle){L=0;for(M=this.conStyle.length;L<M;L++)x.style[this.conStyle[L].type]=this.conStyle[L].value;if(this.conStyle.shadowBoxColor){L=this.conStyle.shadowBoxOffsetX||0;M=this.conStyle.shadowBoxOffsetY||2;var U=this.conStyle.shadowBoxBlur||2;x.style.boxShadow=L+"px "+M+"px "+U+"px 1px "+this.conStyle.shadowBoxColor}this.conStyle.shadowInsetBoxColor&&(L=this.conStyle.shadowInsetBoxOffsetX||0,M=this.conStyle.shadowInsetBoxOffsetY||
-2,U=this.conStyle.shadowInsetBoxBlur||1,q.style.boxShadow=L+"px "+M+"px "+U+"px 1px "+this.conStyle.shadowInsetBoxColor+" inset")}this.fontSizeNotSet&&(this.font_size=v.parser.parse(a.getFieldFontSize(this.h)+""));this.fs_evaluated=v.eval(this.font_size);this.createGradient(this.w,this.h);x.style.display=0<v.eval(this.drawif)?"block":"none";d.lineJoin="round";d.font=this.italics+" "+this.bold+" "+this.fs_evaluated+"px "+this.font_family;this.text_object=new a.TextObject({parent:{decimal_symbol:this.parent.decimal_symbol},
evaluator:this.evaluator,decimals:this.decimals,fixed:!1,align:"left",anchor:"center_center",width:this.parser.parse("0"),font_size:this.font_size,font_family:this.font_family,italics:this.italics,bold:this.bold,border:this.borderColor,border_size:this.conStyle?this.conStyle.textBorder:void 0,shadowBlur:this.conStyle&&this.conStyle.shadowTextColor?this.conStyle.shadowTextBlur||1:void 0,shadowOffsetX:this.conStyle&&this.conStyle.shadowTextColor?this.conStyle.shadowTextOffsetX||0:void 0,shadowOffsetY:this.conStyle&&
this.conStyle.shadowTextColor?this.conStyle.shadowTextOffsetY||2:void 0,shadowColor:this.conStyle&&this.conStyle.shadowTextColor?this.conStyle.shadowTextColor:void 0},this.old_name);this.draw(O)}update(){v=this.evaluator;x=this.container;q=this.btn;this.activeIfValue=0<v.eval(this.activeif);this.drawIfValue=0<v.eval(this.drawif);(this.space?this.space.drawIfValue:1)&&this.drawIfValue?(x.style.display="block",this.draw(),x.style.cursor=q.style.cursor=this.activeIfValue?"pointer":"not-allowed",x.setAttribute("active",
this.activeIfValue),this.updatePositionAndSize()):(x.style.display="none",this.buttonClick=!1)}draw(O){x=this.container;v=this.evaluator;q=this.btn;d=this.ctx;c=v.eval(this.name);this.text_object.draw(a.ctx,"#000000",0,0);c=this.text_object.textNodes.toStr();b=this.evaluator.eval(this.imageSrc).toString().trim();if(!O&&(H=this.over===this.oldOver,J=this.buttonClick===this.oldButtonClick,C=this.activeIfValue===this.oldActiveIfValue,G=this.drawIfValue===this.oldDrawIfValue,F=c===this.oldName,P=b===
this.oldImageSrc,E=this.colorInt.getColor()===this.oldBackColor,N=this.color.getColor()===this.oldTextColor,W=this.image.ready===this.oldImageReady,this.oldOver=this.over,this.oldButtonClick=this.buttonClick,this.oldActiveIfValue=this.activeIfValue,this.oldDrawIfValue=this.drawIfValue,this.oldName=c,this.oldImageSrc=b,this.oldBackColor=this.colorInt.getColor(),this.oldTextColor=this.color.getColor(),this.oldImageReady=this.image.ready,H&&J&&C&&G&&F&&P&&E&&N&&W))return;d.save();d.setTransform(this.ratio,
0,0,this.ratio,0,0);h=this.fs_evaluated;x.setAttribute("data-name",c);b?(g="vacio.gif"===b?this.emptyImage:this.parent.getImage(b),T=b.substr(0,b.lastIndexOf(".")),S=b.substr(b.lastIndexOf(".")),Q=T+"_over"+S,X=T+"_down"+S,aa="vacio.gif"===b?this.emptyImage:this.parent.getImage(Q),D="vacio.gif"===b?this.emptyImage:this.parent.getImage(X)):D=aa=g=this.emptyImage;d.clearRect(0,0,this.w,this.h);r=l=0;this.buttonClick&&(r=l=1);this.text_object.draw(d,this.color.getColor(),0,0,!0);m=this.text_object.textNodes.metrics.w;
z=this.text_object.textNodes.metrics.h;"center"==this.text_align[1]?y=p(this.w/2+r)-.5:"left"==this.text_align[1]?y=m/2+5+r:"right"==this.text_align[1]&&(y=this.w-m/2+r-5);"center"==this.text_align[0]?A=p(this.h/2+l)-.5:"top"==this.text_align[0]?A=z/2+l+4:"bottom"==this.text_align[0]&&(A=this.h-z/2+l-3);if(g){if(u=this.imgSizeW?this.imgSizeW:g.width,e=this.imgSizeH?this.imgSizeH:g.height,"center"==this.image_align[1]?w=parseInt((this.w-u)/2)+r:"left"==this.image_align[1]?w=r:"right"==this.image_align[1]&&
(w=this.w-u+r),"center"==this.image_align[0]?B=parseInt((this.h-e)/2)+l:"top"==this.image_align[0]?B=l:"bottom"==this.image_align[0]&&(B=this.h-e+l),g&&g.ready)if(g!==this.emptyImage&&g.complete)if(b.match(f))this.btn.style.backgroundRepeat="no-repeat",this.btn.style.backgroundImage="url('"+b+"')",this.btn.style.backgroundPosition=w+"px "+B+"px";else{if("center"!=this.image_align[0]||"center"!=this.image_align[1])K=this.colorInt.getColor(),!K||"CanvasGradient"!==K.constructor.name&&"CanvasPattern"!==
K.constructor.name?x.style.backgroundColor=K:(d.fillStyle=K,d.fillRect(0,0,this.w,this.h));d.drawImage(g,0,0,g.width,g.height,w,B,u,e)}else this.emptyImage&&this.customStyle&&(K=this.colorInt.getColor(),!K||"CanvasGradient"!==K.constructor.name&&"CanvasPattern"!==K.constructor.name?x.style.backgroundColor=K:(d.fillStyle=K,d.fillRect(0,0,this.w,this.h)))}else K=this.colorInt.getColor(),!K||"CanvasGradient"!==K.constructor.name&&"CanvasPattern"!==K.constructor.name?(x.style.backgroundColor=K,this.flat||
(this.buttonClick||(a.drawLine(d,this.w-1,0,this.w-1,this.h,"rgba(0,0,0,0.5)"),a.drawLine(d,0,0,0,this.h,"rgba(0,0,0,0.09)"),a.drawLine(d,1,0,1,this.h,"rgba(0,0,0,0.03)")),d.fillStyle=this.linearGradient,d.fillRect(0,0,this.w,this.h))):(d.fillStyle=K,d.fillRect(0,0,this.w,this.h));this.activeIfValue&&(aa!==this.emptyImage&&this.over&&aa.ready&&aa.complete?Q.match(f)?(this.btn.style.backgroundImage="url('"+Q+"')",this.btn.style.backgroundPosition=w+"px "+B+"px"):d.drawImage(aa,w,B):this.customStyle&&
this.conStyle.overColor&&this.over&&(x.style.backgroundColor=this.conStyle.overColor));this.activeIfValue?D!==this.emptyImage&&this.buttonClick&&D.ready&&D.complete?X.match(f)?(this.btn.style.backgroundImage="url('"+X+"')",this.btn.style.backgroundPosition=w+"px "+B+"px"):d.drawImage(D,w,B):this.customStyle&&this.conStyle.downColor&&this.buttonClick&&(x.style.backgroundColor=this.conStyle.downColor):this.buttonClick&&!g&&(d.fillStyle="rgba(0,0,0,0.09)",d.fillRect(0,0,this.w,this.h));d.fillStyle=this.color.getColor();
this.customStyle&&this.conStyle.shadowTextColor&&0<this.conStyle.textBorder&&(d.lineWidth=this.conStyle.textBorder,d.strokeStyle=this.conStyle.shadowTextColor);this.borderColor&&(d.lineWidth=parseInt(h/6),d.strokeStyle=this.borderColor.getColor());this.text_object.draw(d,this.color.getColor(),y,A);this.underlined&&(d.strokeStyle=this.color.getColor(),d.lineWidth=p(h/10)||2,d.lineCap="round",d.beginPath(),d.moveTo(y-m/2+r,A+p(h/2)+p(h/5)-1.5),d.lineTo(y+m/2+r,A+p(h/2)+p(h/5)-1.5),d.stroke());this.activeIfValue||
(this.customStyle&&this.conStyle.inactiveColor?x.style.backgroundColor=this.conStyle.inactiveColor:(d.fillStyle="rgba(240,240,240,0.6)",d.fillRect(0,0,this.w,this.h)));d.restore();this._image_pos_x=w;this._image_pos_y=B}drawTextBorder(){this.colorInt.getColor();this.color.getColor();return!(.5>(k(this.colorInt.r-this.color.r)+k(this.colorInt.g-this.color.g)+k(this.colorInt.b-this.color.b))/255)}buttonPressed(){this.updateAndExecAction()}addEvents(){function O(V,Z,Y){a.clearTimeout(I);U.buttonClick&&
U.drawIfValue&&U.activeIfValue&&(Z.call(U),V=Y?V:100,I=a.setTimeout(function(){O(V,Z,!1)},V))}function L(V){this.focus();V.preventDefault();V.stopPropagation();document.activeElement!=document.body&&document.activeElement.blur();U.whichBtn=a.whichBtn(V);"L"==U.whichBtn&&U.activeIfValue&&(U.buttonClick=!0,U.draw(),"calculate"==U.action&&(U.evaluator.setVariable(U.id,U.evaluator.eval(U.valueExpr)),O(1E3,U.buttonPressed,!0)),U.btn.removeEventListener("touchend",M),U.btn.addEventListener("touchend",M),
U.btn.removeEventListener("mouseup",M),U.btn.addEventListener("mouseup",M))}function M(V){a.newBlobContent=null;this.focus();V.preventDefault();V.stopPropagation();if(U.activeIfValue||U.buttonClick)U.buttonClick=!1,U.draw(),"calculate"!=U.action&&(U.evaluator.setVariable(U.id,U.evaluator.eval(U.valueExpr)),U.buttonPressed()),U.btn.removeEventListener("touchend",M),U.btn.removeEventListener("mouseup",M);U.parent.update()}var U=this,I;U.btn.oncontextmenu=function(){return!1};this.over=this.buttonClick=
!1;this.btn.addEventListener("touchstart",L);this.btn.addEventListener("mousedown",L);this.btn.addEventListener("mouseover",function(V){V.preventDefault();V.stopPropagation();U.over=!0;U.draw()});this.btn.addEventListener("mouseout",function(V){a.newBlobContent=null;V.preventDefault();V.stopPropagation();U.over=!1;U.buttonClick=!1;U.draw()});document.addEventListener("visibilitychange",function(V){a.newBlobContent=null;U.buttonClick=!1})}}a.Button=R;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var p,k,f,v,q,d,n,h,c,b,g,r,l,m;class z extends a.Control{constructor(u,e){super(u,e);this.flat=this.image_dec_src&&this.image_inc_src;this.btn_pos=this.btn_pos||"v_left";this.horizontal="h_left"===this.btn_pos||"h_right"===this.btn_pos||"h_left_right"===this.btn_pos;this.label_color=this.label_color||new a.Color("e0e4e8",u.evaluator);this.label_text_color=this.label_text_color||new a.Color("000000",u.evaluator);this.tabindex=++this.parent.tabindex;this.name_str=
this.name;this.initial_value=0;try{this.initial_value=this.evaluator.eval(this.parser.parse(this.valueExprString))}catch(w){console.log(w)}this.name.match(/^\[.*\]?/)?this.name=this.parser.parse(this.name.substring(1,this.name.length-1)):this.name=this.parser.parse("'"+this.name+"'");this.container=a.newHTML("div",{class:"DescartesSpinnerContainer",id:this.id});this.divUp=a.newHTML("div",{class:"DJS_Up"});this.divDown=a.newHTML("div",{class:"DJS_Down"});this.field=a.newHTML("input",{type:"text",id:this.id+
"_spinner",class:"DescartesSpinnerField",tabindex:this.tabindex});this.label=a.newHTML("canvas",{class:"DescartesSpinnerLabel"});this.label_ctx=this.label.getContext("2d");this.ratio=u.ratio;this.container.appendChild(this.label);this.container.appendChild(this.field);this.container.appendChild(this.divUp);this.container.appendChild(this.divDown);this.cover=a.newHTML("div",{class:"TextfieldCover"});this.keyboard&&this.visible&&this.container.appendChild(this.cover);this.addControlContainer(this.container);
g=this.evaluator.parser.parse("1");this.originalIncr=this.incr;if(0>this.evaluator.eval(this.decimals)||0===this.evaluator.eval(this.incr))u=this.evaluator.eval(this.incr),0<u?this.originalIncr=this.incr=this.evaluator.parser.parse(parseInt(u).toString()):this.incr=g;this.image_dec_src&&(this.image_dec_src.match(/^\[.*\]?/)?this.image_dec_src=this.parser.parse(this.image_dec_src.substring(1,this.image_dec_src.length-1)):this.image_dec_src=this.parser.parse("'"+this.image_dec_src+"'"),this.old_image_dec_src=
this.evaluator.eval(this.image_dec_src).toString().trim(),this.image_dec=this.parent.getImage(this.old_image_dec_src));this.image_inc_src&&(this.image_inc_src.match(/^\[.*\]?/)?this.image_inc_src=this.parser.parse(this.image_inc_src.substring(1,this.image_inc_src.length-1)):this.image_inc_src=this.parser.parse("'"+this.image_inc_src+"'"),this.old_image_inc_src=this.evaluator.eval(this.image_inc_src).toString().trim(),this.image_inc=this.parent.getImage(this.old_image_inc_src));this.addEvents();this.init()}init(u,
e){p=this.evaluator;this.label.innerHTML=p.eval(this.name).toString();var w=this.label.textContent;e||(this.value=this.validateValue(p.eval(this.valueExpr)));e=this.formatOutputValue(this.value);this.fieldFontSize=0<p.eval(this.font_size)?p.eval(this.font_size):a.getFieldFontSize(this.h);this.text_object=new a.TextObject({parent:{decimal_symbol:this.parent.decimal_symbol},evaluator:this.evaluator,decimals:this.decimals,fixed:!1,align:"left",anchor:"center_center",width:this.parser.parse("0"),font_size:this.parser.parse(""+
this.fieldFontSize),font_family:this.font_family,italics:this.italics,bold:this.bold},this.name_str);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0,!0);var B=2!==this.parent.version?"__":"_____",y=a.getTextWidth(e+"_",this.fieldFontSize+"px "+a.sansserif_font);if(this.horizontal){u=parseInt(this.h);var A=parseInt(this.w/2-u);B=this.text_object.textNodes.metrics.w+parseInt(this.fieldFontSize);this.visible||(A=this.w-2*u,y=0);A<B&&(A=B);""==w&&(A=0);this.w-A-u<y&&(A=this.w-
u-y);0>A&&(A=0);w=this.w-(A+2*u);this.container.setAttribute("style",`width:${this.w}px;height:${this.h}px;left:${this.x}px;top:${this.y}px;z-index:${this.zIndex};background-color:transparent;`);this.divUp.setAttribute("style",`width:${u}px;height:${u}px;${"h_left"===this.btn_pos?"left:"+(A+u):"right:0"}px;top:0;${this.flat?"border-width:0;":""}`);this.divDown.setAttribute("style",`width:${u}px;height:${u}px;left:${A+("h_right"===this.btn_pos?w:0)}px;top:0;${this.flat?"border-width:0;":""}`);this.field.setAttribute("style",
`font-family:${a.sansserif_font};font-size:${this.fieldFontSize}px;width:${w}px;height:${this.h}px;left:${u+A+("h_left"===this.btn_pos?u:"h_right"===this.btn_pos?-u:0)}px;text-align:center;`);this.cover.setAttribute("style",`width:${w}px;height:${this.h}px;left:${u+A+("h_left"===this.btn_pos?u:"h_right"===this.btn_pos?-u:0)}px;text-align:center;`)}else u=2+parseInt(this.h/2),A=parseInt(this.w/2-u/2),B=a.getTextWidth(w+B,this.fieldFontSize+"px "+a.sansserif_font),this.visible||(A=this.w-u,y=0),A<B&&
(A=B),""==w&&(A=0),this.w-A-u<y&&(A=this.w-u-y),0>A&&(A=0),w=this.w-(A+u),this.container.setAttribute("style",`width:${this.w}px;height:${this.h}px;left:${this.x}px;top:${this.y}px;z-index:${this.zIndex};background-color:transparent;`),B=`width:${u}px;left:${A+("v_right"===this.btn_pos?w:0)}px;`,this.divUp.setAttribute("style",`${B};height:${this.h/2+1}px;top:0;${this.flat?"border-width:0;":""}`),this.divDown.setAttribute("style",`${B};height:${this.h/2-1}px;top:${this.h/2+1}px;${this.flat?"border-width:0;":
""}`),this.field.setAttribute("style",`font-family:${a.sansserif_font};font-size:${this.fieldFontSize}px;width:${w}px;height:${this.h}px;left:${("v_left"===this.btn_pos?u:0)+A}px;`),this.cover.setAttribute("style",`width:${w}px;height:${this.h}px;left:${("v_left"===this.btn_pos?u:0)+A}px;`);this.field.value=e;this.visible||(this.field.style.display="none");this.label.setAttribute("style",`font-size:${this.fieldFontSize}px;width:${A}px;height:${this.h}px;line-height:${this.h}px;background-color:${this.label_color.getColor()};color:${this.label_text_color.getColor()};`);
this.label.width=A*this.ratio;this.label.height=this.h*this.ratio;this.image_dec&&this.image_dec.ready&&(this.divDown.style["background-image"]="url("+this.image_dec.src+")");this.image_inc&&this.image_inc.ready&&(this.divUp.style["background-image"]="url("+this.image_inc.src+")");this.divUp.setAttribute("horizontal",this.horizontal?!0:!1);this.divDown.setAttribute("horizontal",this.horizontal?!0:!1);p.setVariable(this.id,this.value)}update(){p=this.evaluator;0>p.eval(this.decimals)?(k=p.eval(this.incr),
0<k?this.originalIncr=this.incr=p.parser.parse(parseInt(k).toString()):this.incr=g):this.incr=0!==p.eval(this.originalIncr)?this.originalIncr:g;this.activeIfValue=0<p.eval(this.activeif);this.drawIfValue=0<p.eval(this.drawif);this.field.disabled=!this.activeIfValue;this.divUp.setAttribute("active",!this.field.disabled);this.divDown.setAttribute("active",!this.field.disabled);this.drawIfValue?(this.updateStyle(),this.container.style.display="block"):(this.click=!1,this.container.style.display="none");
this.image_dec&&(r=this.evaluator.eval(this.image_dec_src).toString().trim(),this.old_image_dec_src!==r&&(this.divDown.style["background-image"]="url("+r+")",this.old_image_dec_src=r));this.image_inc&&(l=this.evaluator.eval(this.image_inc_src).toString().trim(),this.old_image_inc_src!==l&&(this.divUp.style["background-image"]="url("+l+")",this.image_inc_src=l));this.updatePositionAndSize();this.parent.animation.playing&&document.activeElement==this.field||(f=this.field.value,v=this.value,this.value=
this.validateValue(p.getVariable(this.id)),this.field.value=this.formatOutputValue(this.value),this.value==v&&this.field.value!=f&&(this.value=this.validateValue(f),this.field.value=this.formatOutputValue(this.value)),p.setVariable(this.id,this.value));this.label_ctx.setTransform(this.ratio,0,0,this.ratio,0,0);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0);this.label_ctx.clearRect(0,0,this.label.width,this.label.height);!(m=this.label_color.getColor())||"CanvasGradient"!==
m.constructor.name&&"CanvasPattern"!==m.constructor.name||(this.label_ctx.fillStyle=m,this.label_ctx.fillRect(0,0,this.label_ctx.canvas.width,this.label_ctx.canvas.height));this.text_object.textNodes.metrics.w>this.label.width/this.ratio?(this.text_object.anchor="center_left",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),5,this.label.height/this.ratio/2)):(this.text_object.anchor="center_center",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),this.label.width/
this.ratio/2,this.label.height/this.ratio/2));this.label_ctx.setTransform(1,0,0,1,0,0)}updateStyle(){this.divUp.style.borderStyle=this.up?"inset":"outset";this.divUp.style.borderColor=this.up?"gray":"#f0f8ff";this.divUp.style.backgroundColor=this.up?"#bfbfbf":"";this.divUp.style.backgroundColor=this.flat?"transparent":this.divUp.style.backgroundColor;this.divUp.style.backgroundPosition=this.up?"calc(50% + 1px) calc(50% + 1px)":"center";this.divDown.style.borderStyle=this.down?"inset":"outset";this.divDown.style.borderColor=
this.down?"gray":"#f0f8ff";this.divDown.style.backgroundColor=this.down?"#bfbfbf":"";this.divDown.style.backgroundColor=this.flat?"transparent":this.divDown.style.backgroundColor;this.divDown.style.backgroundPosition=this.down?"calc(50% + 1px) calc(50% + 1px)":"center"}validateValue(u){p=this.evaluator;isNaN(parseFloat(u))||u.toString().match("e")&&(u=parseFloat(u).toFixed(20));u=void 0!=u?u.toString():"0";u=u.replace(this.parent.decimal_symbol,".");q=u==parseFloat(u)?parseFloat(u):parseFloat(p.eval(p.parser.parse(u)));
isNaN(q)&&(q=0);h=p.eval(this.min);c=p.eval(this.max);""===h&&(h=-Infinity);""===c&&(c=Infinity);q=Math.min(Math.max(q,h),c);this.discrete&&(d=p.eval(this.incr),q=0==d?0:this.initial_value+d*Math.round((q-this.initial_value)/d));n=p.eval(this.decimals);0>=n&&(n=0);return q=parseFloat(parseFloat(q).toFixed(n))}increase(){this.changeValue(parseFloat(this.value)+this.evaluator.eval(this.incr))}decrease(){this.changeValue(parseFloat(this.value)-this.evaluator.eval(this.incr))}changeValue(u){this.activeIfValue&&
(this.value=this.validateValue(u),this.field.value=this.formatOutputValue(this.value),this.evaluator.setVariable(this.id,this.value),this.updateAndExecAction())}addEvents(){function u(J,C,G){a.clearTimeout(H);if(A.up||A.down)C.call(A),J=G?J:10,H=a.setTimeout(function(){u(J,C)},J)}function e(J){J.preventDefault();A.whichBtn=a.whichBtn(J);"L"==A.whichBtn&&A.activeIfValue&&(A.up=!0,u(x,A.increase,!0))}function w(J){J.preventDefault();A.whichBtn=a.whichBtn(J);"L"==A.whichBtn&&A.activeIfValue&&(A.down=
!0,u(x,A.decrease,!0))}function B(J){A.up=!1;a.clearTimeout(H);A.updateStyle()}function y(J){A.down=!1;a.clearTimeout(H);A.updateStyle()}b=a.hasTouchSupport;var A=this,x=b?500:200,H;A.divUp.oncontextmenu=A.divDown.oncontextmenu=A.field.oncontextmenu=A.label.oncontextmenu=A.cover.oncontextmenu=function(){return!1};this.label.addEventListener("touchstart",a.preventDefault);this.label.addEventListener("mousedown",a.preventDefault);this.field.addEventListener("keydown",function(J){13==J.keyCode&&A.changeValue(A.field.value)});
this.divUp.addEventListener("touchstart",e);this.divUp.addEventListener("mousedown",e);this.divDown.addEventListener("touchstart",w);this.divDown.addEventListener("mousedown",w);this.divUp.addEventListener("mouseout",function(J){A.up=!1;a.clearTimeout(H);J.preventDefault();A.updateStyle()});this.divDown.addEventListener("mouseout",function(J){A.down=!1;a.clearTimeout(H);J.preventDefault();A.updateStyle()});this.divUp.addEventListener("touchend",B);window.addEventListener("touchend",B);this.divUp.addEventListener("mouseup",
B);window.addEventListener("mouseup",B);this.divDown.addEventListener("touchend",y);window.addEventListener("touchend",y);this.divDown.addEventListener("mouseup",y);window.addEventListener("mouseup",y);document.addEventListener("visibilitychange",function(J){A.up=!1;A.down=!1;a.clearTimeout(H);A.updateStyle()});this.field.addEventListener("blur",function(J){A.drawIfValue&&A.changeValue(A.field.value,!0)});A.field.addEventListener("click",function(J){this.focus()});A.cover.addEventListener("click",
function(J){J=A.evaluator.eval(A.kbexp);A.activeIfValue&&A.parent.keyboard.show(A,A.kblayout,J[0][0]||0,J[0][1]||0,A.id,A.field,A.onlyText)})}}a.Spinner=z;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var p,k;class f extends a.Control{constructor(v,q){super(v,q);this.label_color=this.label_color||new a.Color("e0e4e8",v.evaluator);this.label_text_color=this.label_text_color||new a.Color("000000",v.evaluator);this.typeCtr="checkbox";this.pressed=q.pressed||!1;this.radio_group=(q.radio_group||"").trim();""!==this.radio_group&&(this.typeCtr="radio");this.name_str=this.name;this.name.match(/^\[.*\]?/)?this.name=this.parser.parse(this.name.substring(1,this.name.length-
1)):this.name=this.parser.parse("'"+this.name.trim()+"'");this.tabindex=++this.parent.tabindex;this.containerControl=a.newHTML("div",{class:"DescartesCheckboxContainer",id:this.id});this.checkbox=a.newHTML("input",{type:this.typeCtr,id:this.id+this.typeCtr,class:"DescartesCheckbox",tabindex:this.tabindex});""!==this.radio_group&&this.checkbox.setAttribute("name",this.radio_group);this.checkbox.internalID=this.id;this.label=a.newHTML("canvas",{class:"DescartesCheckboxLabel"});this.label_ctx=this.label.getContext("2d");
this.ratio=v.ratio;this.dummyLabel=a.newHTML("label",{"for":this.id+this.typeCtr});this.value=this.evaluator.eval(this.valueExpr);this.evaluator.setVariable(this.id,this.value);this.containerControl.appendChild(this.label);this.containerControl.appendChild(this.checkbox);this.containerControl.appendChild(this.dummyLabel);this.addControlContainer(this.containerControl);this.addEvents();this.init()}init(v){p=this.evaluator;this.label.innerHTML=p.eval(this.name).toString();this.labelFontSize=0<p.eval(this.font_size)?
p.eval(this.font_size):a.getFieldFontSize(this.h);v=Math.max(this.w-this.h,0);this.text_object=new a.TextObject({parent:{decimal_symbol:this.parent.decimal_symbol},evaluator:this.evaluator,decimals:this.decimals,fixed:!1,align:"left",anchor:"center_center",width:this.parser.parse("0"),font_size:this.parser.parse(""+this.labelFontSize),font_family:this.font_family,italics:this.italics,bold:this.bold},this.name_str);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0,!0);this.containerControl.setAttribute("style",
`width:${this.w}px;height:${this.h}px;left:${this.x}px;top:${this.y}px;z-index:${this.zIndex};`);"right"==this.position?(this.dummyLabel.setAttribute("style",`position:absolute;width:${this.h}px;height:${this.h}px;left:${v}px;`),this.checkbox.setAttribute("style",`width:${this.h}px;height:${this.h}px;left:${v}px;`),this.label.setAttribute("style",`font-size:${this.labelFontSize}px;width:${v}px;height:${this.h}px;line-height:${this.h}px;background-color:${this.label_color.getColor()};color:${this.label_text_color.getColor()};`)):
(this.dummyLabel.setAttribute("style",`position:absolute;width:${this.h}px;height:${this.h}px;left:0;`),this.checkbox.setAttribute("style",`width:${this.h}px;height:${this.h}px;left:0;`),this.label.setAttribute("style",`font-size:${this.labelFontSize}px;width:${v}px;height:${this.h}px;line-height:${this.h}px;background-color:${this.label_color.getColor()};color:${this.label_text_color.getColor()};left:${this.h}px`));this.checkbox.checked=0!=this.evaluator.getVariable(this.id);this.label.width=v*this.ratio;
this.label.height=this.h*this.ratio;this.update()}update(){p=this.evaluator;this.activeIfValue=0<p.eval(this.activeif);this.drawIfValue=0<p.eval(this.drawif);this.checkbox.disabled=!this.activeIfValue;this.containerControl.style.display=this.drawIfValue?"block":"none";if(!this.parent.animation.playing||document.activeElement!=this.checkbox){var v=0!==p.getVariable(this.id)?1:0;if(""===this.radio_group)this.pressed?(this.value=this.checkbox.checked?1:0,this.pressed=!1):(this.value=v,this.checkbox.checked=
0!==this.value),p.setVariable(this.id,this.value);else{this.value=p.getVariable(this.id);p.setVariable(this.radio_group,0);v=document.querySelectorAll("[name="+this.radio_group+"]");var q=-1;if(this.pressed){for(var d=v.length-1;0<=d;d--)p.setVariable(v[d].internalID,0),v[d].checked=!1;p.setVariable(this.id,1);this.checkbox.checked=!0;this.value=1;p.setVariable(this.radio_group,this.id);this.pressed=0}else{for(d=v.length-1;0<=d;d--)q=0!=p.getVariable(v[d].internalID)?d:q,p.setVariable(v[d].internalID,
0),v[d].checked=!1;0<=q&&(p.setVariable(v[q].internalID,1),v[q].checked=!0,p.setVariable(this.radio_group,v[q].internalID));this.value=this.checkbox.checked?1:0}}}this.updatePositionAndSize();this.label_ctx.setTransform(this.ratio,0,0,this.ratio,0,0);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0);this.label_ctx.clearRect(0,0,this.label.width,this.label.height);!(k=this.label_color.getColor())||"CanvasGradient"!==k.constructor.name&&"CanvasPattern"!==k.constructor.name||
(this.label_ctx.fillStyle=k,this.label_ctx.fillRect(0,0,this.label_ctx.canvas.width,this.label_ctx.canvas.height));this.text_object.textNodes.metrics.w>this.label.width/this.ratio?(this.text_object.anchor="center_left",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),5,this.label.height/this.ratio/2)):(this.text_object.anchor="center_center",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),this.label.width/this.ratio/2,this.label.height/this.ratio/2));this.label_ctx.setTransform(1,
0,0,1,0,0)}addEvents(){var v=this;v.checkbox.oncontextmenu=v.label.oncontextmenu=v.dummyLabel.oncontextmenu=function(){return!1};v.label.addEventListener("touchstart",a.preventDefault);v.label.addEventListener("mousedown",a.preventDefault);v.dummyLabel.addEventListener("mousedown",a.preventDefault);v.checkbox.addEventListener("click",function(q){v.pressed=!0;v.updateAndExecAction()})}}a.Checkbox=f;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var p,k,f,v,q,d,n;class h extends a.Control{constructor(c,b){super(c,b);this.label_color=this.label_color||new a.Color("e0e4e8",c.evaluator);this.label_text_color=this.label_text_color||new a.Color("000000",c.evaluator);this.name_str=this.name;this.name.match(/^\[.*\]?/)?this.name=this.parser.parse(this.name.substring(1,this.name.length-1)):this.name=this.parser.parse("'"+this.name.trim()+"'");void 0===this.valueExprString&&(this.valueExprString=this.onlyText?
"0":"");this.emptyString=!1;this.ok=0;this.tabindex=++this.parent.tabindex;this.regExpDecimalSymbol=new RegExp("\\"+this.parent.decimal_symbol,"g");this.answer&&(this.answer.match("krypto_")&&(this.answer=(new a.Krypto).decode(this.answer.substring(7))),this.answerPattern=this.answer,this.answer=a.buildRegularExpressionsPatterns(this.answer,this.evaluator),this.onlyText?(b=this.answerPattern.indexOf("|"),this.firstAnswer=-1==b?this.answerPattern:this.answerPattern.substring(0,b)):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(g){g=g.toString();return"''"==g||"'"==g?"":g&&g.match(/^'/)&&g.match(/'$/)?g.substring(1,g.length-1):g},this.formatOutputValue=function(g){return g.toString()});this.containerControl=a.newHTML("div",{class:"DescartesTextFieldContainer",
id:this.id});this.field=a.newHTML("input",{type:"text",id:this.id+"TextField",class:"DescartesTextFieldField",tabindex:this.tabindex});this.label=a.newHTML("canvas",{class:"DescartesTextFieldLabel"});this.label_ctx=this.label.getContext("2d");this.ratio=c.ratio;this.containerControl.appendChild(this.label);this.containerControl.appendChild(this.field);this.cover=a.newHTML("div",{class:"TextfieldCover"});this.keyboard&&this.containerControl.appendChild(this.cover);this.addControlContainer(this.containerControl);
this.addEvents();this.init()}init(c){p=this.evaluator;this.label.innerHTML=p.eval(this.name).toString();var b=this.label.textContent;c||(this.value=this.validateValue(p.eval(this.valueExpr)));c=this.formatOutputValue(this.value);this.fieldFontSize=0<p.eval(this.font_size)?p.eval(this.font_size):a.getFieldFontSize(this.h);this.text_object=new a.TextObject({parent:{decimal_symbol:this.parent.decimal_symbol},evaluator:this.evaluator,decimals:this.decimals,fixed:!1,align:"left",anchor:"center_center",
width:this.parser.parse("0"),font_size:this.parser.parse(""+this.fieldFontSize),font_family:this.font_family,italics:this.italics,bold:this.bold},this.name_str);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0,!0);var g=a.getTextWidth(c+"_",this.fieldFontSize+"px "+a.sansserif_font),r=parseInt(this.w/2),l=this.text_object.textNodes.metrics.w+parseInt(this.fieldFontSize);this.visible||(r=this.w,g=0);r<l&&(r=l);""==b&&(r=0);this.w-r<g&&(r=this.w-g);0>r&&(r=0);b=this.w-r;this.containerControl.setAttribute("style",
`width:${this.w}px;height:${this.h}px;left:${this.x}px;top:${this.y}px;z-index:${this.zIndex};`);this.field.setAttribute("style",`font-size:${this.fieldFontSize}px;width:${b}px;height:${this.h}px;left:${r}px; font-family:${"Serif"==this.font_family?a.serif_font:"Monospaced"==this.font_family?a.monospace_font:a.sansserif_font};`);this.field.value=c;this.cover.setAttribute("style",`;width:${b}px;height:${this.h}px;left:${r}px;`);this.label.setAttribute("style",`font-size:${this.fieldFontSize}px;width:${r}px;height:${this.h}px;line-height:${this.h}px;background-color:${this.label_color.getColor()};color:${this.label_text_color.getColor()};`);
this.label.width=r*this.ratio;this.label.height=this.h*this.ratio;this.evaluate&&(this.ok=this.evaluateAnswer());this.evaluator.setVariable(this.id,this.value);this.evaluator.setVariable(this.id+".ok",this.ok);this.oldValue=this.value;this.update()}update(){p=this.evaluator;this.activeIfValue=0<p.eval(this.activeif);this.drawIfValue=0<p.eval(this.drawif);this.field.disabled=!this.activeIfValue;this.containerControl.style.display=this.drawIfValue?"block":"none";this.parent.animation.playing&&document.activeElement==
this.field||(k=this.field.value,f=this.value,this.value=this.validateValue(p.getVariable(this.id)),this.field.value=this.formatOutputValue(this.value),this.value===f&&this.field.value!=k&&(this.value=this.validateValue(k),this.field.value=this.formatOutputValue(this.value)),p.setVariable(this.id,this.value));this.updatePositionAndSize();this.label_ctx.setTransform(this.ratio,0,0,this.ratio,0,0);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0);this.label_ctx.clearRect(0,0,
this.label.width,this.label.height);!(n=this.label_color.getColor())||"CanvasGradient"!==n.constructor.name&&"CanvasPattern"!==n.constructor.name||(this.label_ctx.fillStyle=n,this.label_ctx.fillRect(0,0,this.label_ctx.canvas.width,this.label_ctx.canvas.height));this.text_object.textNodes.metrics.w>this.label.width/this.ratio?(this.text_object.anchor="center_left",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),5,this.label.height/this.ratio/2)):(this.text_object.anchor="center_center",
this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),this.label.width/this.ratio/2,this.label.height/this.ratio/2));this.label_ctx.setTransform(1,0,0,1,0,0)}validateValue(c){if(""===c||"''"==c)return"";p=this.evaluator;c=c.toString().replace(this.regExpDecimalSymbol,".","g");v=c==parseFloat(c)?parseFloat(c):parseFloat(p.eval(p.parser.parse(c)));isNaN(v)&&(v=0);q=p.eval(this.min);d=p.eval(this.max);""===q&&(q=-Infinity);""===d&&(d=Infinity);v<q&&(v=q);v>d&&(v=d);this.discrete&&(c=
p.eval(this.incr),v=0===c?0:c*Math.round(v/c));return v=parseFloat(parseFloat(v).toFixed(p.eval(this.decimals)))}formatOutputValue(c){return""===c?"":super.formatOutputValue(c)}changeValue(c){this.activeIfValue&&(this.value=this.validateValue(c),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())}evaluateAnswer(){return a.esCorrecto(this.answer,
this.value,this.evaluator,this.answer)}getFirstAnswer(){return this.answer?this.onlyText?this.firstAnswer:this.evaluator.eval(this.firstAnswer):""}addEvents(){var c=this;c.field.oncontextmenu=c.label.oncontextmenu=c.cover.oncontextmenu=function(){return!1};c.label.addEventListener("touchstart",a.preventDefault);c.label.addEventListener("mousedown",a.preventDefault);this.field.addEventListener("blur",function(b){c.drawIfValue&&c.changeValue(c.field.value,!0)});this.field.addEventListener("keydown",
function(b){c.activeIfValue&&13==b.keyCode&&c.changeValue(c.field.value,!0)});c.field.addEventListener("click",function(b){this.focus()});c.cover.addEventListener("click",function(b){b=c.evaluator.eval(c.kbexp);c.activeIfValue&&c.parent.keyboard.show(c,c.kblayout,b[0][0]||0,b[0][1]||0,c.id,c.field,c.onlyText)})}}a.TextField=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var p=Math.abs,k,f,v,q,d,n,h,c,b,g,r;class l extends a.Control{constructor(m,z){function u(w){e.options=w.split(",");e.menuOptions=[];e.strValue=[];w=0;for(var B=e.options.length;w<B;w++){var y=e.customSplit(e.options[w]);1==y.length?(e.menuOptions.push(y[0]),e.strValue.push(w.toString())):2==y.length&&(e.menuOptions.push(y[0]),""==y[1]?e.strValue.push(w.toString()):e.strValue.push(y[1]))}w=0;for(B=e.menuOptions.length;w<B;w++)e.menuOptions[w].match(/^\[/)&&
e.menuOptions[w].match(/\]$/)?e.menuOptions[w]=k.parse(e.menuOptions[w].substring(1,e.menuOptions[w].length-1)):e.menuOptions[w]=k.parse("'"+e.menuOptions[w]+"'");w=0;for(B=e.strValue.length;w<B;w++)e.strValue[w].match(/^\[/)&&e.strValue[w].match(/\]$/)?e.strValue[w]=k.parse(e.strValue[w].substring(1,e.strValue[w].length-1)):e.strValue[w]=k.parse(e.strValue[w]);e.select.innerHTML="";w=0;for(B=e.menuOptions.length;w<B;w++)y=a.newHTML("option"),y.innerHTML=f.eval(e.menuOptions[w]),e.select.appendChild(y);
return 0}super(m,z);this.label_color=this.label_color||new a.Color("e0e4e8",m.evaluator);this.label_text_color=this.label_text_color||new a.Color("000000",m.evaluator);this.options=z.options||"";k=this.parser;f=this.evaluator;this.ok=0;this.tabindex=++this.parent.tabindex;this.answer&&(this.answer.match("krypto_")&&(this.answer=(new a.Krypto).decode(this.answer.substring(7))),this.answer=parseInt(this.answer.split(",")[0].replace("[",""))||0);this.name_str=this.name;this.name.match(/^\[.*\]?/)?this.name=
this.parser.parse(this.name.substring(1,this.name.length-1)):this.name=this.parser.parse("'"+this.name+"'");var e=this;this.evaluator.setFunction(this.id+".setOptions",u);this.containerControl=a.newHTML("div",{class:"DescartesMenuContainer",id:this.id});this.label=a.newHTML("canvas",{class:"DescartesMenuLabel"});this.label_ctx=this.label.getContext("2d");this.ratio=m.ratio;this.select=a.newHTML("select",{id:this.id+"_menuSelect",class:"DescartesMenuSelect",tabindex:this.tabindex});this.field=a.newHTML("input",
{type:"text",id:this.id+"_menuField",class:"DescartesMenuField",tabindex:this.tabindex});u(this.options);this.containerControl.appendChild(this.label);this.containerControl.appendChild(this.select);this.visible&&this.containerControl.appendChild(this.field);this.cover=a.newHTML("div",{class:"TextfieldCover"});this.keyboard&&this.visible&&this.containerControl.appendChild(this.cover);this.addControlContainer(this.containerControl);this.addEvents();this.init()}init(m){f=this.evaluator;this.label.innerHTML=
f.eval(this.name).toString();var z=this.label.textContent;this.fieldFontSize=0<f.eval(this.font_size)?f.eval(this.font_size):a.getFieldFontSize(this.h);this.text_object=new a.TextObject({parent:{decimal_symbol:this.parent.decimal_symbol},evaluator:this.evaluator,decimals:this.decimals,fixed:!1,align:"left",anchor:"center_center",width:this.parser.parse("0"),font_size:this.parser.parse(""+this.fieldFontSize),font_family:this.font_family,italics:this.italics,bold:this.bold},this.name_str);this.text_object.draw(this.label_ctx,
this.label_text_color.getColor(),0,0,!0);var u=0,e=0;this.value=m?this.value:f.eval(this.valueExpr);this.indexValue=this.getIndex(this.value);for(var w=0,B=this.menuOptions.length;w<B;w++)m=a.getTextWidth(f.eval(this.menuOptions[w]).toString(),this.fieldFontSize+"px "+a.sansserif_font),m>u&&(u=m,e=w);u+=25;m=a.getTextWidth(this.formatOutputValue(f.eval(this.strValue[e])),this.fieldFontSize+"px "+a.sansserif_font)+7;e=this.text_object.textNodes.metrics.w+parseInt(this.fieldFontSize);""==z&&(e=0);this.visible||
(m=0);for(z=this.w-m-e;z<u&&0<e;)e--,z++;for(;z<u&&0<m;)m--,z++;for(;e+z+m+1<this.w;)z++,m++;u=e;w=u+z;m=this.w-w;B=this.formatOutputValue(f.eval(this.strValue[this.indexValue]));this.containerControl.setAttribute("style",`width:${this.w}px;height:${this.h}px;left:${this.x}px;top:${this.y}px;z-index:${this.zIndex};`);this.label.setAttribute("style",`font-size:${this.fieldFontSize}px;width:${e}px;height:${this.h}px;line-height:${this.h}px;background-color:${this.label_color.getColor()};color:${this.label_text_color.getColor()};`);
this.label.width=e*this.ratio;this.label.height=this.h*this.ratio;this.field.value=B;this.field.setAttribute("style",`font-size:${this.fieldFontSize}px;width:${m}px;height:${this.h}px;left:${w}px;`);this.cover.setAttribute("style",`width:${m}px;height:${this.h}px;left:${w}px;`);this.select.setAttribute("style",`text-align:left;font-size:${this.fieldFontSize}px;width:${z}px;height:${this.h}px;left:${u}px;`);this.select.selectedIndex=this.indexValue;f.setVariable(this.id,parseFloat(B.replace(this.parent.decimal_symbol,
".")));this.update()}update(){f=this.evaluator;this.activeIfValue=0<f.eval(this.activeif);this.drawIfValue=0<f.eval(this.drawif);this.field.disabled=this.activeIfValue?!1:!0;this.select.disabled=this.activeIfValue?!1:!0;this.drawIfValue?this.containerControl.style.display="block":(this.click=!1,this.containerControl.style.display="none");if(!this.parent.animation.playing||document.activeElement!=this.select){for(var m=0,z=this.menuOptions.length;m<z;m++)this.select.options[m].innerHTML=f.eval(this.menuOptions[m]);
this.value=f.getVariable(this.id);isNaN(this.value)&&(this.value=0);this.field.value=this.formatOutputValue(this.value);f.setVariable(this.id,parseFloat(this.value));this.select.selectedIndex=parseFloat(this.getIndex(this.value))}this.ok=this.value==this.answer?1:0;this.evaluator.setVariable(this.id+".ok",this.ok);this.updatePositionAndSize();this.label_ctx.setTransform(this.ratio,0,0,this.ratio,0,0);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0);this.label_ctx.clearRect(0,
0,this.label.width,this.label.height);!(r=this.label_color.getColor())||"CanvasGradient"!==r.constructor.name&&"CanvasPattern"!==r.constructor.name||(this.label_ctx.fillStyle=r,this.label_ctx.fillRect(0,0,this.label_ctx.canvas.width,this.label_ctx.canvas.height));this.text_object.textNodes.metrics.w>this.label.width/this.ratio?(this.text_object.anchor="center_left",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),5,this.label.height/this.ratio/2)):(this.text_object.anchor="center_center",
this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),this.label.width/this.ratio/2,this.label.height/this.ratio/2));this.label_ctx.setTransform(1,0,0,1,0,0)}customSplit(m){n=!1;h="";c=0;for(b=-1;c<m.length;){g=m.charAt(c);if("["===g&&-1===b){if(n||""!=h)h+="\u00a6";b++}else"["===g?b++:"]"===g&&0===b?(n=!0,b--):"]"==m.charAt(c)&&(b=0>b?b:b-1);h+=m.charAt(c);c++}return h.split("\u00a6")}getIndex(m){m=parseFloat(m.toString().replace(this.parent.decimal_symbol,"."));v=-1;q=Infinity;for(var z=
0,u=this.strValue.length;z<u;z++)d=p(m-parseFloat(this.evaluator.eval(this.strValue[z]))),d<=q&&(q=d,v=z);return v}changeValue(){this.activeIfValue&&(this.evaluator.setVariable(this.id,this.value),this.updateAndExecAction())}addEvents(){var m=this;m.select.oncontextmenu=m.label.oncontextmenu=m.field.oncontextmenu=m.cover.oncontextmenu=function(){return!1};m.label.addEventListener("touchstart",a.preventDefault);m.label.addEventListener("mousedown",a.preventDefault);this.select.addEventListener("change",
function(z){m.value=m.evaluator.eval(m.strValue[this.selectedIndex]);m.field.value=m.formatOutputValue(m.value);m.evaluator.setVariable(m.id,m.field.value);m.changeValue();z.preventDefault()});this.field.addEventListener("keydown",function(z){13==z.keyCode&&(m.indexValue=m.getIndex(m.field.value),m.value=m.evaluator.eval(m.strValue[m.indexValue]),m.field.value=m.formatOutputValue(m.indexValue),m.select.selectedIndex=m.indexValue,m.changeValue())});this.field.addEventListener("blur",function(z){m.drawIfValue&&
m.changeValue(m.field.value,!0)});m.field.addEventListener("click",function(z){this.focus()});m.cover.addEventListener("click",function(z){z=m.evaluator.eval(m.kbexp);m.activeIfValue&&m.parent.keyboard.show(m,m.kblayout,z[0][0]||0,z[0][1]||0,m.id,m.field,m.onlyText)})}}a.Menu=l;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var p=Math.floor,k,f,v,q,d,n,h,c,b,g,r,l,m,z,u,e,w,B;class y extends a.Control{constructor(A,x){super(A,x);this.label_color=this.label_color||new a.Color("e0e4e8",A.evaluator);this.label_text_color=this.label_text_color||new a.Color("000000",A.evaluator);this.name_str=this.name;this.name.match(/^\[.*\]?/)?this.name=this.parser.parse(this.name.substring(1,this.name.length-1)):this.name=this.parser.parse("'"+this.name+"'");this.orientation=this.w>=this.h?
"h":"v";this.container=a.newHTML("div",{class:"DescartesScrollbarContainer",id:this.id});this.canvas=a.newHTML("canvas");this.divUp=a.newHTML("div",{class:"DescartesCatcher up"});this.divDown=a.newHTML("div",{class:"DescartesCatcher down"});this.field=a.newHTML("input",{type:"text",id:this.id+"scrollbar",class:"DescartesScrollbarField"});this.scrollHandler=a.newHTML("div",{class:"DescartesCatcher manipulator"});this.label=a.newHTML("canvas",{class:"DescartesScrollbarLabel"});this.label_ctx=this.label.getContext("2d");
this.ratio=A.ratio;this.container.appendChild(this.canvas);this.container.appendChild(this.label);this.container.appendChild(this.divUp);this.container.appendChild(this.divDown);this.container.appendChild(this.field);this.container.appendChild(this.scrollHandler);this.cover=a.newHTML("div",{class:"TextfieldCover"});this.keyboard&&this.visible&&this.container.appendChild(this.cover);this.addControlContainer(this.container);this.addEvents();this.init()}init(){k=this.evaluator;0==k.eval(this.decimals)?
this.incr=1:this.incr=(k.eval(this.max)-k.eval(this.min))/100;this.value=this.validateValue(k.eval(this.valueExpr));v=this.formatOutputValue(this.value);q=this.evaluator.eval(this.expresion);this.x=q[0][0];this.y=q[0][1];4==q[0].length&&(this.w=q[0][2],this.h=q[0][3]);this.orientation=this.w>=this.h?"h":"v";this.initScroll(v);this.changeScrollPositionFromValue();this.prePos=this.pos;k.setVariable(this.id,this.value)}initScroll(A){f=this;k=f.evaluator;f.label.innerHTML=k.eval(f.name).toString();w=
this.label.textContent;var x="v"===f.orientation?parseInt(19+5*(f.h-100)/100):f.h;f.fieldFontSize=0<k.eval(f.font_size)?k.eval(f.font_size):"v"===f.orientation?x-parseInt(f.h/20)-1:a.getFieldFontSize(x);this.text_object=new a.TextObject({parent:{decimal_symbol:this.parent.decimal_symbol},evaluator:this.evaluator,decimals:this.decimals,fixed:!1,align:"left",anchor:"center_center",width:this.parser.parse("0"),font_size:this.parser.parse(""+this.fieldFontSize),font_family:this.font_family,italics:this.italics,
bold:this.bold},f.name_str);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0,!0);A=a.getTextWidth(A+"_",f.fieldFontSize+"px "+a.sansserif_font);var H=f.parent.getSpaceById(f.spaceID).h;f.labelHeight=""==w?0:x;f.fieldHeight=""==f.visible?0:x;if("v"===f.orientation)f.canvasWidth=f.w,f.canvasHeight=f.h-f.labelHeight-f.fieldHeight,18<=f.canvasHeight+f.y-H&&(f.canvasHeight=H),x=f.fieldHeight,A=x+f.canvasHeight,f.canvasX=0,f.canvasY=f.fieldHeight,f.labelWidth=f.w,f.labelY=A,f.upWidth=
f.downW=f.w,f.upHeight=f.downH=f.w,f.upX=0,f.upY=f.fieldHeight,f.downX=0,f.downY=A-f.downH,f.fieldWidth=f.w,f.fieldX=0,f.scrollHandlerW=f.w,f.scrollHandlerH=parseInt((f.canvasHeight-f.upHeight-f.downH-f.labelHeight-f.fieldHeight)/10),f.scrollHandlerH=f.canvasHeight-f.upHeight-f.downH-f.labelHeight-f.fieldHeight>2*f.w?f.w:f.scrollHandlerH,f.scrollHandlerH=15>f.scrollHandlerH?15:f.scrollHandlerH,f.limInf=A-f.downH-f.scrollHandlerH,f.limSup=x+f.downH;else{x=this.text_object.textNodes.metrics.w+parseInt(this.fieldFontSize);
f.labelWidth=x;f.fieldWidth=A;""==w&&(f.labelWidth=0);f.visible||(f.fieldWidth=0);for(A=f.w-f.fieldWidth-f.labelWidth;58>A&&0<f.labelWidth;)f.labelWidth--,A++;for(;58>A&&0<f.fieldWidth;)f.fieldWidth--,A++;x=f.labelWidth;H=x+A;f.fieldWidth=f.w-H;f.canvasWidth=A;f.canvasHeight=f.h;f.canvasX=f.labelWidth;f.canvasY=0;f.fieldX=f.canvasWidth+f.labelWidth;f.labelHeight=f.h;f.labelY=0;f.upWidth=f.downW=f.h;f.upHeight=f.downH=f.h;f.upX=H-f.downW;f.upY=0;f.downX=f.labelWidth;f.downY=0;f.scrollHandlerW=parseInt((f.canvasWidth-
f.upWidth-f.downW)/10);f.scrollHandlerW=f.canvasWidth-f.upWidth-f.downW>2*f.h?f.h:f.scrollHandlerW;f.scrollHandlerW=15>f.scrollHandlerW?15:f.scrollHandlerW;f.scrollHandlerH=f.h;f.limInf=x+f.downW;f.limSup=x+f.canvasWidth-f.downW-f.scrollHandlerW}f.container.setAttribute("style",`width:${f.w}px;height:${f.h}px;left:${f.x}px;top:${f.y}px;z-index:${f.zIndex};`);f.canvas.setAttribute("width",f.w+"px");f.canvas.setAttribute("height",f.h+"px");f.canvas.setAttribute("style","position:absolute;left:0;top:0;");
f.ctx=f.canvas.getContext("2d");f.ctx.imageSmoothingEnabled=!1;f.divUp.setAttribute("style",`width:${f.upWidth}px;height:${f.upHeight}px;left:${f.upX}px;top:${f.upY}px;`);f.divDown.setAttribute("style",`width:${f.downW}px;height:${f.downH}px;left:${f.downX}px;top:${f.downY}px;`);f.scrollHandler.setAttribute("style",`width:${f.scrollHandlerW}px;height:${f.scrollHandlerH}px;left:${"v"===f.orientation?0:f.limInf}px;top:${"v"===f.orientation?f.limInf:0}px;`);f.field.setAttribute("style",`font-size:${f.fieldFontSize}px;width:${f.fieldWidth}px;height:${f.fieldHeight}px;left:${f.fieldX}px;top:0;`);
f.cover.setAttribute("style",`width:${f.fieldWidth}px;height:${f.fieldHeight}px;left:${f.fieldX}px;top:0;`);0===f.fieldHeight&&(f.field.style.display="none");f.label.setAttribute("style",`font-size:${f.fieldFontSize}px;width:${f.labelWidth}px;height:${f.labelHeight}px;line-height:${f.labelHeight}px;left:0;top:${f.labelY}px;background-color:${this.label_color.getColor()};color:${this.label_text_color.getColor()};`);this.label.width=f.labelWidth*this.ratio;this.label.height=f.labelHeight*this.ratio}update(){k=
this.evaluator;0==k.eval(this.decimals)?this.incr=1:this.incr=(k.eval(this.max)-k.eval(this.min))/100;this.activeIfValue=0<k.eval(this.activeif);this.drawIfValue=0<k.eval(this.drawif);this.field.disabled=!this.activeIfValue;this.drawIfValue?(this.container.style.display="block",this.draw()):this.container.style.display="none";this.updatePositionAndSize();var A=this.validateValue(k.getVariable(this.id));A==this.value||0<Math.abs(A-this.value)&&1E-9>Math.abs(A-this.value)||(this.value=A,this.changeScrollPositionFromValue(),
this.prePos=this.pos);this.value=A;this.field.value=this.formatOutputValue(this.value);k.setVariable(this.id,this.value);this.label_ctx.setTransform(this.ratio,0,0,this.ratio,0,0);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0);this.label_ctx.clearRect(0,0,this.label.width,this.label.height);!(B=this.label_color.getColor())||"CanvasGradient"!==B.constructor.name&&"CanvasPattern"!==B.constructor.name||(this.label_ctx.fillStyle=B,this.label_ctx.fillRect(0,0,this.label_ctx.canvas.width,
this.label_ctx.canvas.height));this.text_object.textNodes.metrics.w>this.label.width/this.ratio?(this.text_object.anchor="center_left",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),5,this.label.height/this.ratio/2)):(this.text_object.anchor="center_center",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),this.label.width/this.ratio/2,this.label.height/this.ratio/2));this.label_ctx.setTransform(1,0,0,1,0,0)}draw(){f=this;d=f.ctx;h=p(this.w);n=p(this.h);
d.fillStyle=this.color.getColor();d.fillRect(0,0,h,n);d.fillStyle="black";d.beginPath();"h"===f.orientation?(d.lineWidth=1,d.strokeStyle="rgba(0,0,0,0.3)",d.strokeRect(parseInt(f.labelWidth)+.5,.5,h-1-parseInt(f.labelWidth),n-1),d.lineWidth=Math.ceil(12*f.upWidth/100)||1,d.strokeStyle=f.colorInt.getColor(),d.moveTo(f.downX+62.215*f.upWidth/100,20*f.downH/100),d.lineTo(f.downX+32.449*f.upWidth/100,f.downH/2),d.lineTo(f.downX+62.215*f.upWidth/100,80*f.downH/100),d.moveTo(f.upX+32.449*f.upWidth/100,
20*f.downH/100),d.lineTo(f.upX+62.215*f.upWidth/100,f.downH/2),d.lineTo(f.upX+32.449*f.upWidth/100,80*f.downH/100),d.stroke(),b=p(f.pos),c=Math.ceil(n/10)||1,d.fillStyle=this.colorInt.getColor(),d.fillRect(b+.5,c,p(f.scrollHandlerW),n-2*c)):(d.lineWidth=1,d.strokeStyle="rgba(0,0,0,0.3)",d.strokeRect(.5,.5,h-1,n-parseInt(f.labelHeight)-.5),d.lineWidth=Math.ceil(12*f.upWidth/100)||1,d.strokeStyle=f.colorInt.getColor(),d.moveTo(20*f.upWidth/100,f.h-f.labelHeight-70*f.downH/100),d.lineTo(50*f.upWidth/
100,f.h-f.labelHeight-40.237*f.downH/100),d.lineTo(80*f.upWidth/100,f.h-f.labelHeight-70*f.downH/100),d.moveTo(20*f.upWidth/100,70*f.downH/100),d.lineTo(50*f.upWidth/100,40.237*f.downH/100),d.lineTo(80*f.upWidth/100,70*f.downH/100),d.stroke(),b=p(f.pos),c=Math.ceil(h/10)||1,d.fillStyle=this.colorInt.getColor(),d.fillRect(c,b+.5,h-2*c,p(f.scrollHandlerH)));f.activeIfValue||(d.fillStyle="rgba(255,255,255,0.5)",d.fillRect(0,0,d.canvas.width,d.canvas.height))}validateValue(A){k=this.evaluator;g=A.toString();
g=parseFloat(g.replace(this.parent.decimal_symbol,"."));isNaN(g)&&(g=0);this.minimo=k.eval(this.min);g<this.minimo&&(this.value=null,g=this.minimo);this.maximo=k.eval(this.max);g>this.maximo&&(this.value=null,g=this.maximo);r=this.incr;g=0!=r?g*r/r:0;this.fixed&&(g=parseFloat(parseFloat(g).toFixed(k.eval(this.decimals))));return g}increase(){this.changeValue(parseFloat(this.value)+this.incr)}decrease(){this.changeValue(parseFloat(this.value)-this.incr)}increase10(){c=(this.evaluator.eval(this.max)-
this.evaluator.eval(this.min))/10;"h"==this.orientation?this.clickPos.x>this.prePos&&this.changeValue(parseFloat(this.value)+c):this.clickPos.y<this.prePos&&this.changeValue(parseFloat(this.value)+c)}decrease10(){c=(this.evaluator.eval(this.max)-this.evaluator.eval(this.min))/10;"h"==this.orientation?this.clickPos.x<this.prePos&&this.changeValue(parseFloat(this.value)-c):this.clickPos.y>this.prePos&&this.changeValue(parseFloat(this.value)-c)}changeValue(A){this.activeIfValue&&(l=this.validateValue(A),
l!=this.value&&(this.value=l,this.field.value=this.formatOutputValue(l),this.changeScrollPositionFromValue(),this.prePos=this.pos,this.evaluator.setVariable(this.id,this.value)),this.updateAndExecAction())}changeValueForScrollMovement(){k=this.evaluator;m=this.limInf;z=this.limSup;u=k.eval(this.min);e=k.eval(this.max);r=this.incr;l=p((this.pos-m)*(e-u)/(z-m)/r)*r+u;l!=this.value&&(this.value=l,this.field.value=this.formatOutputValue(l),k.setVariable(this.id,this.value),this.parent.updateControls(),
this.actionExec.execute(),this.parent.update())}changeScrollPositionFromValue(){k=this.evaluator;m=this.limInf;z=this.limSup;u=k.eval(this.min);e=k.eval(this.max);r=this.incr;this.pos=(this.value-u)*(z-m)/(e-u)+m;this.scrollHandler.style["h"==this.orientation?"left":"top"]=this.pos+"px"}addEvents(){function A(X,aa,D,K){a.clearTimeout(Q);(S.up||S.down||S.canvasClick)&&1E-7<Math.abs(S.value-K)&&(aa.call(S),X=D?X:30,Q=a.setTimeout(function(){A(X,aa,!1,K)},X))}function x(X){X.preventDefault();S.whichBtn=
a.whichBtn(X);"L"==S.whichBtn&&S.activeIfValue&&(S.clickPos=a.getCursorPosition(X,S.container),S.canvasClick=!0,"h"==S.orientation?S.clickPos.x<S.prePos?A(350,S.decrease10,!0,S.minimo):A(350,S.increase10,!0,S.maximo):S.clickPos.y<S.prePos?A(350,S.increase10,!0,S.maximo):A(350,S.decrease10,!0,S.minimo))}function H(X){S.canvasClick=!1;a.clearTimeout(Q)}function J(X){1==S.canvasClick&&(S.clickPos=a.getCursorPosition(X,S.container),X.preventDefault())}function C(X){S.scrollClick=!1;S.prePos=S.pos;window.removeEventListener("mouseup",
C,!1);window.removeEventListener("mousemove",F,!1);X.preventDefault()}function G(X){S.scrollClick=!1;S.prePos=S.pos;window.removeEventListener("touchend",G,!1);window.removeEventListener("touchmove",F,!1);X.preventDefault()}function F(X){var aa=a.getCursorPosition(X,S.container);"h"==S.orientation?(S.pos=S.prePos-(S.initPos.x-aa.x),S.pos<S.limInf&&(S.pos=S.limInf),S.pos>S.limSup&&(S.pos=S.limSup),S.scrollHandler.setAttribute("style",`width:${S.scrollHandlerW}px;height:${S.h}px;left:${S.pos}px;top:0;`)):
(S.pos=S.prePos-(S.initPos.y-aa.y),S.pos>S.limInf&&(S.pos=S.limInf),S.pos<S.limSup&&(S.pos=S.limSup),S.scrollHandler.setAttribute("style",`width:${S.w}px;height:${S.scrollHandlerH}px;left:0;top:${S.pos}px;`));S.changeValueForScrollMovement();X.preventDefault()}function P(X){X.preventDefault();S.whichBtn=a.whichBtn(X);"L"==S.whichBtn&&S.activeIfValue&&(S.up=!0,A(350,S.increase,!0,S.maximo))}function E(X){X.preventDefault();S.whichBtn=a.whichBtn(X);"L"==S.whichBtn&&S.activeIfValue&&(S.down=!0,A(350,
S.decrease,!0,S.minimo))}function N(X){S.down=!1;a.clearTimeout(Q);X.preventDefault()}function W(X){S.up=!1;a.clearTimeout(Q);S.draw()}function T(X){S.down=!1;a.clearTimeout(Q);S.draw()}var S=this,Q;S.canvas.oncontextmenu=S.divUp.oncontextmenu=S.divDown.oncontextmenu=S.label.oncontextmenu=S.field.oncontextmenu=S.scrollHandler.oncontextmenu=S.cover.oncontextmenu=function(){return!1};this.field.addEventListener("keydown",function(X){13==X.keyCode&&S.changeValue(S.field.value)});this.field.addEventListener("blur",
function(X){S.drawIfValue&&S.changeValue(S.field.value,!0)});this.canvas.addEventListener("touchstart",x);this.canvas.addEventListener("mousedown",x);this.divDown.addEventListener("mouseout",N);window.addEventListener("touchend",H);window.addEventListener("mouseup",H);this.canvas.addEventListener("touchmove",J);this.canvas.addEventListener("mousemove",J);this.scrollHandler.addEventListener("touchstart",function(X){S.activeIfValue&&(S.scrollClick=!0,S.initPos=a.getCursorPosition(X,S.container),window.addEventListener("touchend",
G),window.addEventListener("touchmove",F),X.preventDefault())});this.scrollHandler.addEventListener("mousedown",function(X){S.activeIfValue&&(S.scrollClick=!0,S.initPos=a.getCursorPosition(X,S.container),window.addEventListener("mouseup",C),window.addEventListener("mousemove",F),X.preventDefault())});this.divUp.addEventListener("touchstart",P);this.divUp.addEventListener("mousedown",P);this.divDown.addEventListener("touchstart",E);this.divDown.addEventListener("mousedown",E);this.divUp.addEventListener("mouseout",
function(X){S.up=!1;a.clearTimeout(Q);X.preventDefault()});this.divDown.addEventListener("mouseout",N);window.addEventListener("touchend",W);window.addEventListener("mouseup",W);window.addEventListener("touchend",T);window.addEventListener("mouseup",T);S.cover.addEventListener("click",function(X){X=S.evaluator.eval(S.kbexp);S.activeIfValue&&S.parent.keyboard.show(S,S.kblayout,X[0][0]||0,X[0][1]||0,S.id,S.field,S.onlyText)})}}a.Scrollbar=y;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var p,k;class f extends a.Control{constructor(v,q){super(v,q);var d=this;d.controls=q.controls||!0;d.file=q.file||"";d.oldDrawIf=0;v=d.evaluator.eval(d.expresion);4==v[0].length?(d.w=v[0][2],d.h=v[0][3]):(d.w=200,d.h=28);d.audio=d.parent.getAudio(d.file);d.oldFile=d.file;"]"===d.file.charAt(d.file.length-1)&&(d.file=d.evaluator.parser.parse(d.file.substring(1,d.file.length-1)));d.autoplay&&(d.audio.setAttribute("autoplay","autoplay"),d.audio.play());d.loop&&
d.audio.setAttribute("loop","loop");d.controls&&d.audio.setAttribute("controls","controls");d.audio.setAttribute("style",`position:absolute;width:${d.w}px;left:${d.x}px;top:${d.y}px;z-index:${d.zIndex};`);d.addControlContainer(d.audio);d.evaluator.setFunction(d.id+".play",function(){try{d.audio.play()}catch(n){}return 0});d.evaluator.setFunction(d.id+".pause",function(){try{d.audio.pause()}catch(n){}return 0});d.evaluator.setFunction(d.id+".stop",function(){try{d.audio.pause(),d.audio.currentTime=
0}catch(n){}return 0});d.evaluator.setFunction(d.id+".currentTime",function(n){try{d.audio.currentTime=parseFloat(n)}catch(h){}return 0});d.audio.addEventListener("timeupdate",function(n){d.evaluator.setVariable(d.id+".currentTime",d.audio.currentTime);d.evaluator.setVariable(d.id+".playing",d.audio.paused?0:1);d.evaluator.setVariable(d.id+".duration",d.audio.duration)})}init(){this.audio.style.left=this.x+"px";this.audio.style.top=this.y+"px";this.update()}update(){p=this.evaluator;"string"!==typeof this.file&&
(this.tmpFile=p.eval(this.file),this.oldFile!==this.tmpFile&&(this.oldFile=this.audio.src=this.tmpFile));(k=0<p.eval(this.drawif))?this.audio.style.display="block":(this.audio.style.display="none",k!==this.oldDrawIf&&this.audio.pause());this.oldDrawIf=k;this.updatePositionAndSize()}}a.Audio=f;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var p,k;class f extends a.Control{constructor(v,q){super(v,q);var d=this;d.controls=q.controls||!0;d.file=q.file||"";d.oldDrawIf=0;p=d.evaluator;v=p.eval(d.expresion);4==v[0].length?(d.w=v[0][2],d.h=v[0][3]):(d.w=null,d.h=null);v=d.file;q=v.lastIndexOf(".");-1!=q&&(v=d.file.substring(0,q));d.video=a.newHTML("video",{poster:v+".png",style:`position:absolute;overflow:hidden;left:${d.x}px;top:${d.y}px;outline:none;background:rgba(0,0,0,0);`});d.autoplay&&
d.video.setAttribute("autoplay","autoplay");d.loop&&d.video.setAttribute("loop","loop");d.controls&&d.video.setAttribute("controls","controls");d.w&&(d.video.setAttribute("width",d.w),d.video.setAttribute("height",d.h));d.video.canPlayType("video/mp4")&&(q=a.newHTML("source",{src:v+".mp4",type:"video/mp4"}),d.video.appendChild(q));d.video.canPlayType("video/ogg")&&(q=a.newHTML("source",{src:v+".ogg",type:"video/ogg"}),d.video.appendChild(q),q=a.newHTML("source",{src:v+".ogv",type:"video/ogg"}),d.video.appendChild(q));
d.video.canPlayType("video/webm")&&(q=a.newHTML("source",{src:v+".webm",type:"video/webm"}),d.video.appendChild(q));d.addControlContainer(d.video);p.setFunction(d.id+".play",function(){try{d.video.play()}catch(n){}return 0});p.setFunction(d.id+".pause",function(){try{d.video.pause()}catch(n){}return 0});p.setFunction(d.id+".stop",function(){try{d.video.pause(),d.video.currentTime=0}catch(n){}return 0});p.setFunction(d.id+".currentTime",function(n){try{d.video.currentTime=parseFloat(n)}catch(h){}return 0});
d.video.addEventListener("timeupdate",function(n){p.setVariable(d.id+".currentTime",d.video.currentTime)})}init(){this.video.style.left=this.x+"px";this.video.style.top=this.y+"px";this.update()}update(){p=this.evaluator;(k=0<p.eval(this.drawif))?this.video.style.display="block":(this.video.style.display="none",k!==this.oldDrawIf&&this.video.pause());this.oldDrawIf=k;this.updatePositionAndSize()}}a.Video=f;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var p,k,f;class v extends a.Control{constructor(q,d){super(q,d);this.font_family=d.font_family||"Monospaced";this.style=d.style||",PLAIN,";this.font_size=d.font_size||12;typeof("number"!==this.font_size)&&(this.font_size=this.evaluator.eval(this.font_size));this.font=this.font_family+this.style+this.font_size;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 n=this.parent.lessonParser.parseText(this.answer)}this.containerControl=a.newHTML("div",{class:"DescartesTextAreaContainer",id:this.id,spellcheck:"false"});this.textArea=a.newHTML("textarea",{class:"DescartesTextAreaContainer",spellcheck:"false"});this.textAreaAnswer=a.newHTML("div",{class:"DescartesTextAreaContainer"});this.showButton=a.newHTML("div",{class:"DJS_Gradient"});this.activeCover=a.newHTML("div");this.containerControl.appendChild(this.textArea);this.containerControl.appendChild(this.textAreaAnswer);
this.containerControl.appendChild(this.showButton);this.containerControl.appendChild(this.activeCover);this.cover=a.newHTML("div",{class:"TextfieldCover"});this.keyboard&&this.containerControl.appendChild(this.cover);this.addControlContainer(this.containerControl);this.showAnswer=!1;this.text=this.rawText||"";n&&"simpleText"!==n.type&&(this.answer=this.text.hasFormula?"":n.toHTML());this.evaluator.setVariable(this.id,this.text);var h=this,c;this.evaluator.setFunction(this.id+".insertAtCursor",function(b){c=
h.textArea.selectionStart+b.length;h.textArea.value=h.textArea.value.substring(0,h.textArea.selectionStart)+b+h.textArea.value.substring(h.textArea.selectionEnd);h.textArea.selectionStart=h.textArea.selectionEnd=c;h.textArea.focus();return 0});this.evaluator.setFunction(this.id+".update",function(){h.update()});this.addEvents();this.init()}init(){k=this.answer?28:4;p=this.evaluator;var q=this.text.replace(/\\n/g,"\n");this.containerControl.setAttribute("style",`width:${this.w}px;height:${this.h}px;left:${this.x}px;top:${this.y}px;z-index:${this.zIndex};`);
let d=`padding:5px;width:${this.w-4}px;height:${this.h-k}px;left:2px;top:2px;background-color:white;text-align:left;font:${a.convertFont(this.font)};line-height:${this.font_size}px;`;this.textArea.setAttribute("style",d);this.textArea.value=q;this.textAreaAnswer.setAttribute("style",`${d}display:${this.showAnswer?"block":"none"};`);this.textAreaAnswer.innerHTML=`<span>${this.answer}</span>`;this.showButton.setAttribute("style",`width:20px;height:16px;position:absolute;bottom:4px;right:4px;cursor:pointer;border:1px outset #f0f8ff;display:${this.answer?
"block":"none"};`);this.showButton.innerHTML=`<span style="position:relative;top:1px;text-align:center;font:11px ${a.sansserif_font};">S</span>`;this.activeCover.setAttribute("style",`position:absolute;width:${this.w}px;height:${this.h}px;left:${this.x}px;top:${this.y}px;`);this.cover.setAttribute("style",`;position:absolute;width:${this.w}px;height:${this.h}px;left:0px;top:0px;`);this.update()}update(){p=this.evaluator;this.activeIfValue=0<p.eval(this.activeif);this.drawIfValue=0<p.eval(this.drawif);
p.getVariable(this.id)!==this.oldValue&&(this.textArea.value=(p.getVariable(this.id)||"").replace(/\\n/g,"\n"));f=this.textArea.value||"";f="\n"===f.charAt(f.length-1)?f.substring(0,f.length-1):f;f=f.replace(/\n/g,"\\n").replace(/\s/g," ");p.setVariable(this.id,f);this.oldFieldValue=f;this.oldValue=p.getVariable(this.id);this.activeCover.style.display=this.activeIfValue?"none":"block";this.containerControl.style.display=this.drawIfValue?"block":"none";this.updatePositionAndSize()}changeValue(q){this.textArea.value=
q;this.update()}addEvents(){function q(n){n.preventDefault()}var d=this;d.cover.oncontextmenu=function(){return!1};d.showButton.addEventListener("mousedown",function(n){n.preventDefault();d.showAnswer=!d.showAnswer;d.textAreaAnswer.style.display=d.showAnswer?"block":"none";d.showButton.childNodes[0].childNodes[0].textContent=d.showAnswer?"T":"S"});d.showButton.addEventListener("mouseup",q);d.showButton.addEventListener("mouseout",q);d.textArea.addEventListener("blur",function(){var n=window.getSelection();
d.cursorInd=n.focusOffset});d.textArea.addEventListener("paste",n=>{n.preventDefault();document.execCommand("insertHTML",!1,n.clipboardData.getData("text/plain").replace(/\n/g,"<br>"))});d.textArea.addEventListener("keydown",function(n){if("PageDown"===n.key||"PageUp"===n.key)n.stopPropagation(),n.preventDefault()});d.cover.addEventListener("pointerdown",function(n){n=d.evaluator.eval(d.kbexp);d.activeIfValue&&d.parent.keyboard.show(d,d.kblayout,n[0][0]||0,n[0][1]||0,d.id,d.textArea,!0)})}}a.TextArea=
v;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var p=2*Math.PI,k,f,v,q,d,n,h,c,b,g,r,l;class m extends a.Control{constructor(z,u){super(z,u);f=z.evaluator.parser;this.spaceID=u.spaceID||"";this.text=u.text||"";this.size=u.size||f.parse("4");this.font=u.font||"Serif,PLAIN,12";this.image=new Image;this.image.onload=function(){this.ready=1};this.imageSrc=u.imageSrc||"";this.imageSrc.match(/^\[.*\]?/)?this.imageSrc=this.parser.parse(this.imageSrc.substring(1,this.imageSrc.length-1)):this.imageSrc=this.parser.parse("'"+
this.imageSrc+"'");this.font=a.convertFont(this.font);if(this.constraintExpr){this.constraint=f.parse(this.constraintExpr);"(expr)"==this.constraint.type&&(this.constraint=f.parse(this.constraintExpr.substring(1,this.constraintExpr.length-1)));if("compOperator"==this.constraint.type){u=this.constraint.childs[0];var e=this.constraint.childs[1];"identifier"!=u.type||"y"!=u.value||e.contains("y")?"identifier"!=u.type||"x"!=u.value||e.contains("x")?this.newt=new a.R2Newton(this.evaluator,this.constraint):
(this.constVar="y",this.noConstVar="x",this.evalConst=this.evalConstXoY,this.constraint=e):(this.constVar="x",this.noConstVar="y",this.evalConst=this.evalConstXoY,this.constraint=e)}else this.constraint=null;g=new a.R2(0,0)}this.container=this.getContainer();this.mouseCatcher=a.newHTML("div",{class:"DescartesGraphicControl",id:this.id,dragged:!0,tabindex:"-1",style:`cursor:pointer;background-color:transparent;z-index:${this.zIndex};`});this.ctx=this.space.ctx;this.container.appendChild(this.mouseCatcher);
this.addEvents();this.xStr=this.id+".x";this.yStr=this.id+".y";this.activoStr=this.id+".activo";this.activeStr=this.id+".active";""!==this.space.id&&2!==z.version?(this.mxStr=this.space.id+".mouse_x",this.myStr=this.space.id+".mouse_y",this.mclickedStr=this.space.id+".mouse_clicked",this.mclicizquierdoStr=this.space.id+".clic_izquierdo"):(this.mxStr="mouse_x",this.myStr="mouse_y",this.mclickedStr="mouse_clicked",this.mclicizquierdoStr="clic_izquierdo");this.init()}init(z){k=this.evaluator;r=a.hasTouchSupport;
z||(z=k.eval(this.expresion),this.x=z[0][0],this.y=z[0][1],k.setVariable(this.xStr,this.x),k.setVariable(this.yStr,this.y));this.img_src_eval=k.eval(this.imageSrc).toString().trim();""==this.img_src_eval||this.img_src_eval.toLowerCase().match(/vacio.gif$/)?(this.width=2*k.eval(this.size),this.height=2*k.eval(this.size),this._w=r&&48>this.width?48:this.width,this._h=r&&48>this.height?48:this.height,this.mouseCatcher.style.borderRadius=parseInt(Math.min(this._w,this._h)/2)+"px"):(this.image=this.parent.getImage(this.img_src_eval),
this.width=this.image.width,this.height=this.image.height,this._w=Math.max(this.width,32),this._h=Math.max(this.height,32));this.mouseCatcher.style.width=this._w+"px";this.mouseCatcher.style.height=this._h+"px";this.mouseCatcher.style.left=parseInt(this.space.getAbsoluteX(this.x)-this._w/2)+"px";this.mouseCatcher.style.top=parseInt(this.space.getAbsoluteY(this.y)-this._h/2)+"px";k.setVariable(this.activoStr,0);k.setVariable(this.activeStr,0);this.setImage=!1;this.update()}update(){k=this.evaluator;
k.eval(this.imageSrc).toString().trim()!==this.img_src_eval&&this.init(!0);this.activeIfValue=0<k.eval(this.activeif);this.drawIfValue=0<k.eval(this.drawif);this.x=k.getVariable(this.xStr);this.y=k.getVariable(this.yStr);v=this.space.getAbsoluteX(this.x);q=this.space.getAbsoluteY(this.y);this.mouseCatcher.style.display=this.activeIfValue?"block":"none";this.mouseCatcher.style.left=parseInt(v-this._w/2)+"px";this.mouseCatcher.style.top=parseInt(q-this._h/2)+"px";this.constraint&&this.evalConst();this.draw()}draw(){k=
this.evaluator;this.drawIfValue&&(c=this.ctx,b=this.space.backgroundCtx,v=parseInt(this.space.getAbsoluteX(this.x))+.5,q=parseInt(this.space.getAbsoluteY(this.y))+.5,""!=this.text&&this.drawText(v,q),this.image.ready?(d=this.image.width/2,n=this.image.height/2,this.image.complete&&!this.setImage&&c.drawImage(this.image,parseInt(v-d),parseInt(q-n)),this.trace&&(b.save(),b.translate(v,q),b.scale(parseInt(d),parseInt(n)),b.beginPath(),b.arc(0,0,1,0,p),b.restore(),b.lineWidth=1,b.strokeStyle=this.trace.getColor(),
b.stroke())):(d=parseInt(this.width/2),c.beginPath(),c.arc(v,q,d,0,p),c.fillStyle=this.colorInt.getColor(),c.fill(),c.lineWidth=1,c.strokeStyle=this.color.getColor(),c.stroke(),this.active&&(c.strokeStyle=this.colorInt.borderColor(),c.beginPath(),c.arc(v,q,d-2,0,p),c.stroke()),this.trace&&(b.strokeStyle=this.trace.getColor(),b.beginPath(),b.arc(v,q,d,0,p),b.stroke())))}evalConst(){g.set(this.x,this.y);h=this.newt.findZero(g,1/this.space.scale,!0);this.x=h.x;this.y=h.y;this.evaluator.setVariable(this.xStr,
this.x);this.evaluator.setVariable(this.yStr,this.y)}evalConstXoY(){k=this.evaluator;l=k.getVariable(this.constVar);k.setVariable(this.constVar,this[this.constVar]);this[this.noConstVar]=k.eval(this.constraint);k.setVariable(this.xStr,this.x);k.setVariable(this.yStr,this.y);k.setVariable(this.constVar,l)}drawText(z,u){c=this.ctx;k=this.evaluator;"simpleText"==this.text.type?(c.fillStyle=this.color.getColor(),c.font=this.font,c.textBaseline="alphabetic",c.fillText(this.text.toString(k.eval(this.decimals),
this.fixed),parseInt(z+1+this.width/2),parseInt(u-1-this.height/2))):(c.fillStyle=this.color.getColor(),c.strokeStyle=this.color.getColor(),c.textBaseline="alphabetic",this.text.draw(c,parseInt(z+1+this.width/2),parseInt(u-1-this.height/2),this.decimals,this.fixed,"start",!0,this.color.getColor()))}getContainer(){for(var z=this.parent.spaces,u,e=0,w=z.length;e<w;e++)if(u=z[e],u.id==this.spaceID)return u.addCtr(this),this.zIndex=u.zIndex,this.space=u,u.graphicControlContainer;z[0].addCtr(this);this.zIndex=
z[0].zIndex;this.space=z[0];return z[0].graphicControlContainer}deactivate(){this.active=!1;this.evaluator.setVariable(this.activoStr,0);this.evaluator.setVariable(this.activeStr,0);this.evaluator.setVariable(this.mclicizquierdoStr,0)}addEvents(){function z(A){document.body.focus();A.preventDefault();y.whichBtn=a.whichBtn(A);"L"==y.whichBtn&&y.activeIfValue&&(y.parent.deactivateGraphicControls(),y.click=y.active=!0,y.evaluator.setVariable(y.activoStr,1),y.evaluator.setVariable(y.activeStr,1),y.evaluator.setVariable(y.mclickedStr,
0),y.evaluator.setVariable(y.mclicizquierdoStr,0),y.posAnte=a.getCursorPosition(A,y.container),y.prePos={x:y.space.getAbsoluteX(y.x),y:y.space.getAbsoluteY(y.y)},y.evaluator.setVariable(y.mxStr,y.space.getRelativeX(y.posAnte.x)),y.evaluator.setVariable(y.myStr,y.space.getRelativeY(y.posAnte.y)),y.parent.update(),window.addEventListener("touchend",u),window.addEventListener("touchmove",e),window.addEventListener("mouseup",u),window.addEventListener("mousemove",e))}function u(A){document.body.focus();
A.preventDefault();A.stopPropagation();y.evaluator.setVariable(y.mclickedStr,1);y.evaluator.setVariable(y.mclicizquierdoStr,1);if(y.activeIfValue||y.active)y.click=!1,window.removeEventListener("mouseup",u),window.removeEventListener("mousemove",e),window.removeEventListener("touchend",u),window.removeEventListener("touchmove",e),B=a.getCursorPosition(A,y.container)||B,y.posX=y.prePos.x-(y.posAnte.x-B.x),y.posY=y.prePos.y-(y.posAnte.y-B.y),y.evaluator.setVariable(y.xStr,y.space.getRelativeX(y.posX)),
y.evaluator.setVariable(y.yStr,y.space.getRelativeY(y.posY)),y.evaluator.setVariable(y.mxStr,y.space.getRelativeX(B.x)),y.evaluator.setVariable(y.myStr,y.space.getRelativeY(B.y)),y.parent.updateControls(),y.parent.update(),y.mouseCatcher.style.left=y.space.getAbsoluteX(y.x)-y._w/2+"px",y.mouseCatcher.style.top=y.space.getAbsoluteY(y.y)-y._h/2+"px";A=y.evaluator.getVariable(y.activeStr);y.parent.deactivateGraphicControls();y.parent.updateControls();y.evaluator.setVariable(y.activoStr,A);y.evaluator.setVariable(y.activeStr,
A);y.parent.update()}function e(A){A.preventDefault();y.evaluator.setVariable(y.mclickedStr,0);y.evaluator.setVariable(y.mclicizquierdoStr,0);B=a.getCursorPosition(A,y.container);y.posX=y.prePos.x-(y.posAnte.x-B.x);y.posY=y.prePos.y-(y.posAnte.y-B.y);y.evaluator.setVariable(y.xStr,y.space.getRelativeX(y.posX));y.evaluator.setVariable(y.yStr,y.space.getRelativeY(y.posY));y.evaluator.setVariable(y.mxStr,y.space.getRelativeX(B.x));y.evaluator.setVariable(y.myStr,y.space.getRelativeY(B.y));80<Date.now()-
w&&(y.parent.updateControls(),y.parent.update(),w=Date.now())}var w=0,B,y=this;this.active=this.over=this.click=!1;this.mouseCatcher.oncontextmenu=function(){return!1};this.mouseCatcher.addEventListener("touchstart",z);this.mouseCatcher.addEventListener("mousedown",z);this.mouseCatcher.addEventListener("mouseover",function(A){y.over=!0});this.mouseCatcher.addEventListener("mouseout",function(A){y.over=!1;y.click=!1})}}a.GraphicControl=m;return a}(descartesJS||{});
descartesJS=function(a,p){var k,f,v,q,d,n,h,c,b,g;function r(I){return I.charAt(0).toUpperCase()+I.substring(1)}if(a.loadLib)return a;var l=/[\w-//]*(\.png|\.jpg|\.gif|\.svg|\.webp)/gi,m,z,u,e,w,B,y,A,x,H,J,C,G,F,P,E,N,W,T,S,Q,X,aa,D,K,R,O,L,M;class U{constructor(I){this.parent=I;this.parser=I.evaluator.parser;this.RTFparser=new a.RTFParser(I.evaluator)}parseButtonsConfig(I){var V={rowsNorth:0,rowsSouth:0,widthEast:125,widthWest:125,height:23};I=this.split(I);for(var Z=0,Y=I.length;Z<Y;Z++)switch(u=
I[Z][0],e=I[Z][1],z=p[u],z){case "rowsNorth":case "rowsSouth":case "widthEast":case "widthWest":case "height":V[z]=parseInt(e);break;case "about":case "config":case "init":case "clear":V[z]="true"===p[e];break;default:console.warn("Propiedad de botones no identificada: <"+u+"> valor: <"+e+">")}return V}parseSpace(I){w={};I=this.split(I);for(var V=0,Z=I.length;V<Z;V++)switch(u=I[V][0],e=I[V][1],z=p[u],a.DEBUG.paramName=u,a.DEBUG.objectName="Space",z){case "type":if("R2"===e||"R3"===e)e=p[e];w[z]=e;
break;case "id":a.DEBUG.idName=e;case "x_axis":case "y_axis":case "cID":case "file":case "border_width":case "border_radius":case "info":w[z]=e;break;case "fixed":case "numbers":case "sensitive_to_mouse_movements":case "3D":case "split":case "resizable":w[z]="true"===p[e];break;case "bg_display":case "render":w[z]=p[e];break;case "border_color":case "net":case "net10":case "axes":case "text":w[z]=""!=e?"false"===p[e]?"":new a.Color(e,this.parent.evaluator):"";break;case "O.x":w.OxExpr=e;break;case "O.y":w.OyExpr=
e;break;case "image":w.imageSrc=e;break;case "x":m=e;"%"===m[m.length-1]?(w.xPercentExpr=m.trim(),m=(this.parent.container.width*parseFloat(m)/100).toString()):m=e;w.xExpr=this.parser.parse(m);break;case "y":m=e;"%"===m[m.length-1]?(w.yPercentExpr=m.trim(),m=(this.parent.container.height*parseFloat(m)/100).toString()):m=e;w.yExpr=this.parser.parse(m);break;case "width":m=e.trim();w.wModExpr=m;"%"===m[m.length-1]?(w.wExpr=m,m=this.parent.container.width*parseFloat(m)/100):(m=parseFloat(e),m!=e&&(m=
this.parent.container.width,w._w_=e.trim()));w.w=m;break;case "height":m=e.trim();w.hModExpr=m;"%"===m[m.length-1]?(w.hExpr=m,m=this.parent.container.height*parseFloat(m)/100):(m=parseFloat(e),m!=e&&(m=this.parent.container.height,w._h_=e.trim()));w.h=m;break;case "drawif":""!=e&&(w.drawif=this.parser.parse(e));break;case "scale":m=parseFloat(e);isNaN(m)&&(m=48);w.scale=m;break;case "background":w.background=new a.Color(e,this.parent.evaluator);break;default:console.warn("Propiedad del espacio no identificada: <"+
u+"> valor: <"+e+">")}return new a["Space"+w.type](this.parent,w)}parseControl(I){B={type:"Numeric",gui:"Spinner"};I=this.split(I);for(var V=0,Z=I.length;V<Z;V++)switch(u=I[V][0],e=I[V][1],z=p[u],a.DEBUG.paramName=u,a.DEBUG.objectName="Control",z){case "type":m=p[e.trim()];"graphic"===m?m="GraphicControl":"text"===m&&(m="TextArea");B.type=r(m);break;case "gui":m=p[e];"textfield"===m&&(m="TextField");B[z]=r(m);break;case "id":a.DEBUG.idName=e;case "name":case "parameter":case "tooltip":case "tooltipFont":case "Explanation":case "ExplanationFont":case "cID":case "options":case "font":case "font_family":case "file":case "answer":case "cssClass":case "radio_group":case "extra_style":case "kblayout":case "info":B[z]=
e;break;case "region":case "position":case "action":case "msg_pos":case "poster":case "text_align":case "image_align":case "btn_pos":B[z]=p[e];break;case "fixed":case "visible":case "discrete":case "onlyText":case "evaluate":case "autoplay":case "loop":case "controls":case "flat":case "keyboard":B[z]="true"===p[e];break;case "color":case "colorInt":case "label_color":case "label_text_color":case "trace":B[z]=new a.Color(e,this.parent.evaluator);break;case "font_size":case "drawif":case "activeif":case "decimals":case "min":case "max":case "size":""!==
e&&(B[z]=this.parser.parse(e));break;case "constraint":B.constraintExpr=e;break;case "image":B.imageSrc=e;break;case "image_dec":B.image_dec_src=e;break;case "image_inc":B.image_inc_src=e;break;case "space":B.spaceID=e;break;case "expresion":B.expresion=this.parser.parse(e.replace(")(",","));case "kbexp":B.kbexp=this.parser.parse(e.replace(")(",","));break;case "borderColor":B[z]="false"===p[e]?"":e;break;case "bold":"false"!=p[e]&&(B.bold="bold");break;case "italics":"false"!=p[e]&&(B.italics="italic");
break;case "underlined":"false"!=p[e]&&(B.underlined=!0);break;case "value":var Y=e.replace(/&squot;/g,"'");Y.match(/^\|/)&&(Y="'"+Y.substring(1),Y.match(/\|$/)&&(Y=Y.substring(0,Y.length-1)+"'"));B.valueExpr=this.parser.parse(Y);B.valueExprString=Y;break;case "incr":0!=e&&(B.incr=this.parser.parse(e));break;case "exponentialif":B.exponentialif=parseFloat(e);break;case "text":B.rawText=e;Y=this.parseText(e);for(var ba=0,ca=Y.length;ba<ca;ba++)Y[ba]=this.parser.parse(Y[ba],!1);B.text=Y;break;default:ba=
u.indexOf("."),Y=p[u.substring(0,ba)],ba=p[u.substring(ba+1)],"parameter"===Y&&"font"===ba?B.parameterFont=e:"Explanation"===Y&&"font"===ba?B.ExplanationFont=e:"tooltip"===Y&&"font"===ba?B.tooltipFont=e:console.warn("Propiedad de control no identificada: <"+u+"> valor: <"+e+">")}return new a["Numeric"===B.type?B.gui:B.type](this.parent,B)}parseGraphic(I,V,Z,Y){y={rotateExp:Y,parameter:"t"};I=this.split(I);Y=0;for(var ba=I.length;Y<ba;Y++)if(u=I[Y][0],e=I[Y][1],z=p[u],a.DEBUG.paramName=u,a.DEBUG.objectName=
"Graphic",""!=e)switch(z){case "type":a.DEBUG.idName=e;y[z]=r(p[e]);break;case "align":case "anchor":case "lineDash":y[z]=p[e];break;case "background":case "abs_coord":case "visible":case "editable":case "fixed":case "vectors":case "bold":case "italics":case "underlined":y[z]="true"===p[e];break;case "shadowColor":case "color":case "fill":case "fillP":case "fillM":case "arrow":case "trace":y[z]="false"===p[e]?"":new a.Color(e,this.parent.evaluator);break;case "border_size":case "shadowBlur":case "shadowOffsetX":case "shadowOffsetY":case "family":case "parameter":case "info":case "font":case "font_family":case "name":case "init":case "end":y[z]=
e;break;case "drawif":case "width":case "decimals":case "size":case "spear":case "center":case "radius":case "border_radius":case "opacity":case "inirot":case "inipos":case "range":case "clip":""!==e&&(y[z]=this.parser.parse(e));break;case "font_size":e=e.trim();e.match(/^\[.*\]?/)&&(e=e.substring(1,e.length-1));""!==e&&(y[z]=this.parser.parse(e));break;case "space":y.spaceID=e;break;case "expresion":""!==e&&("Macro"!==y.type?(y.expresion=this.parser.parse(e),y.expresionString=e):y.expresion=e);break;
case "text":y.text=e;break;case "file":var ca=e.replace(/&squot;/g,"'").trim();"["===ca.charAt(0)&&"]"===ca.charAt(ca.length-1)&&(ca=ca.substring(1,ca.length-1));ca.match(l)&&(ca="'"+ca+"'");y.file=this.parser.parse(ca);break;case "border":""!=e&&"false"!=p[e]&&(y.border=new a.Color(e,this.parent.evaluator));break;default:if(void 0!=y.family&&u.substring(0,y.family.length+1)===y.family+".")switch(p[u.substring(y.family.length+1)]){case "interval":""!=e&&(y.family_interval=this.parser.parse(e));break;
case "steps":""!=e&&(y.family_steps=this.parser.parse(e))}else if(void 0!=y.parameter&&u.match(y.parameter+"."))switch(y.parameter!==u.substring(0,u.indexOf(y.parameter)+y.parameter.length)&&(y.parameter=u.substring(0,u.indexOf(y.parameter)+y.parameter.length)),p[u.substring(y.parameter.length+1)]){case "interval":""!=e&&(y.parameter_interval=this.parser.parse(e));break;case "steps":""!=e&&(y.parameter_steps=this.parser.parse(e))}else console.warn("Propiedad del gr\u00e1fico no identificada: <"+u+
"> valor: <"+e+">")}V&&(y.abs_coord=V);Z&&(y.background=Z);return new a[y.type](this.parent,y)}parse3DGraphic(I,V,Z,Y){y={rotateExp:Y,parameter:"t"};I=this.split(I);V=0;for(Z=I.length;V<Z;V++)switch(u=I[V][0],e=I[V][1],z=p[u],a.DEBUG.paramName=u,a.DEBUG.objectName="Graphic3D",z){case "type":a.DEBUG.idName=e;m=p[e];switch(m){case "cube":case "box":case "tetrahedron":case "octahedron":case "sphere":case "dodecahedron":case "icosahedron":case "ellipsoid":case "cone":case "cylinder":case "torus":case "mesh":y.subType=
m,m="OtherGeometry"}y[z]=r(m);break;case "model":case "align":case "anchor":case "lineDash":y[z]=p[e];break;case "shadowColor":case "fill":y[z]="false"===p[e]?"":new a.Color(e,this.parent.evaluator);break;case "background":case "fixed":case "split":case "bold":case "italics":case "underlined":y[z]="true"===p[e];break;case "edges":"false"===p[e]?y[z]="":("true"===p[e]&&(e="808080"),y[z]=new a.Color(e,this.parent.evaluator));break;case "border":""!=e&&"false"!=p[e]&&(y.border=new a.Color(e,this.parent.evaluator));
break;case "color":case "backcolor":y[z]=new a.Color(e,this.parent.evaluator);break;case "drawif":case "width":case "length":case "height":case "R":case "r":case "decimals":case "Nu":case "Nv":case "inipos":case "endpos":case "offset_angle":case "offset_dist":case "font_size":""!=e&&(y[z]=this.parser.parse(e));break;case "border_size":case "shadowBlur":case "shadowOffsetX":case "shadowOffsetY":case "family":case "parameter":case "font":case "font_family":case "name":case "inirot":case "endrot":case "info":y[z]=
e;break;case "space":y.spaceID=e;break;case "expresion":"Macro"!=y.type&&"Curve"!=y.type&&"Surface"!=y.type?(y.expresion=this.parser.parse(e),y.expresionString=e):y.expresion=e.replace(/\\n/g,";");break;case "text":y.text=e;break;case "file":Y=e.replace(/&squot;/g,"'");"["===Y.charAt(0)&&"]"===Y.charAt(Y.length-1)&&(Y=Y.substring(1,Y.length-1));Y.match(/./)&&(Y="'"+Y+"'");y.file=this.parser.parse(Y);break;default:void 0!==y.family&&u.substring(0,y.family.length+1)===y.family+"."?"interval"===p[u.substring(y.family.length+
1)]?""!=e&&(y.family_interval=this.parser.parse(e)):""!=e&&(y.family_steps=this.parser.parse(e)):console.warn("Propiedad del gr\u00e1fico 3D no identificada: <"+u+"> valor: <"+e+">")}return new a[y.type+"3D"](this.parent,y)}parseAuxiliar(I){A={};I=this.split(I);for(var V=0,Z=I.length;V<Z;V++)I[V][1]=I[V][1].replace(/&squot;/g,"'");V=0;for(Z=I.length;V<Z;V++)switch(u=I[V][0],e=I[V][1],z=p[u],a.DEBUG.paramName=u,a.DEBUG.objectName="Auxiliar",z){case "info":case "code":case "doc":break;case "id":a.DEBUG.idName=
e;case "file":case "init":case "doExpr":case "whileExpr":case "range":case "local":case "expresion":case "condition":case "parameter":A[z]=e.replace(/&squot;/g,"'");break;case "editable":case "constant":case "array":case "matrix":case "algorithm":case "event":case "sequence":A[z]="true"===p[e];break;case "size":case "rows":case "columns":case "x":case "y":case "width":case "height":A[z]=this.parser.parse(e);break;case "evaluate":case "execution":case "msg_pos":case "action":case "type":A[z]=p[e];
break;default:var Y=u.indexOf("."),ba=p[u.substring(0,Y)];Y=p[u.substring(Y+1)];"parameter"===ba&&"font"===Y?A.parameterFont=e:console.warn("Propiedad del auxiliar no identificada: <"+u+"> valor: <"+e+">")}A.sequence?A.type="sequence":A.constant?A.type="constant":A.algorithm&&A.evaluate?A.type="algorithm":A.array&&!A.matrix&&")"!=A.id.charAt(A.id.length-1)?A.type="vector":A.matrix&&")"!=A.id.charAt(A.id.length-1)?A.type="matrix":A.event&&")"!=A.id.charAt(A.id.length-1)?A.type="event":"library"===
A.type?A.type="library":")"===A.id.charAt(A.id.length-1)?A.type="function":A.type="variable";a.DEBUG.typeName=A.type;switch(A.type){case "sequence":new a.Function(this.parent,A);break;case "constant":I=new a.Constant(this.parent,A);A.evaluate&&"always"===A.evaluate&&this.parent.auxiliaries.push(I);break;case "algorithm":this.parent.auxiliaries.push(new a.Algorithm(this.parent,A));break;case "vector":I=new a.Vector(this.parent,A);A.evaluate&&"always"===A.evaluate&&this.parent.auxiliaries.push(I);break;
case "matrix":I=new a.Matrix(this.parent,A);A.evaluate&&"always"===A.evaluate&&this.parent.auxiliaries.push(I);break;case "event":this.parent.events.push(new a.Event(this.parent,A));break;case "library":new a.Library(this.parent,A);break;case "variable":new a.Variable(this.parent,A);break;default:new a.Function(this.parent,A)}}parseAction(I){x=I.action;H=I.parent;J=I.parameter;return x?new (a[r(x)])(H,J):{execute:function(){}}}parseAnimation(I){var V={};I=this.split(I);for(var Z=0,Y=I.length;Z<Y;Z++)switch(u=
I[Z][0],e=I[Z][1],z=p[u],z){case "id":case "delay":case "init":case "doExpr":case "whileExpr":V[z]=e.replace(/&squot;/g,"'");break;case "controls":case "auto":case "loop":case "algorithm":case "evaluate":V[z]="true"===p[e];break;default:console.warn("Propiedad de la animaci\u00f3n no identificada: <"+u+">  <"+e+">")}return new a.Animation(this.parent,V)}parsePleca(I,V){I=this.split(I);f=k="";v=0;q="#536891";d="white";n="left";h="";c="SansSerif,BOLD,20";b="SansSerif,PLAIN,18";g=void 0;for(var Z=0,
Y=I.length;Z<Y;Z++)switch(u=I[Z][0],e=I[Z][1],u){case "title":k=e;break;case "subtitle":f=e;break;case "subtitlines":v=e;break;case "bgcolor":""!=e&&(q=(new a.Color(e,this.parent.evaluator)).getColor());break;case "fgcolor":""!=e&&(d=(new a.Color(e,this.parent.evaluator)).getColor());break;case "align":""!=e&&(n=e);break;case "titleimage":h=e;break;case "titlefont":c=""!=e?a.convertFont(e):a.convertFont(c);break;case "subtitlefont":b=""!=e?a.convertFont(e):a.convertFont(b);break;default:console.warn("Propiedad de la pleca no identificada: <"+
u+">  <"+e+">")}if(""===k&&""===f)return a.newHTML("div");W=b.substring(0,b.indexOf("px"));W=W.substring(W.lastIndexOf(" "));""!=h&&(T=this.parent.getImage(h),S=T.height);g=a.newHTML("div",{id:"descartesPleca"});S?(g.setAttribute("style",`position:absolute;left:0;top:0;text-align:${n};width:${V}px;height:${S}px;background-color:${q};color:${d};padding-top:8px;padding:8px ${15}px 8px ${15}px;margin:0;overflow:hidden;z-index:1;`),T.setAttribute("style","position: absolute;left:0;top:0;z-index:-1;width:100%;height:100%;"),
g.appendChild(T)):g.setAttribute("style",`position:absolute;left:0;top:0;text-align:${n};width:${V}px;background:${q};color:${d};padding:12px ${15}px 12px ${15}px;margin:0;z-index:100;`);Q=a.newHTML("div",{style:`padding:0;margin:0;font:${c};overflow:hidden;white-space:nowrap;`});Q.innerHTML=k;X=a.newHTML("div");if(1===parseInt(v)){O=0;aa=a.newHTML("div");aa.innerHTML=f;document.body.appendChild(aa);K=W;do K-=O,aa.setAttribute("style",`padding:0;margin:0;font:${b};font-size:${K}px;width:${V-30}px;line-height:${K}px;`),
D=aa.offsetHeight,R=D/K,O=1;while(1<R&&8<K);document.body.removeChild(aa);X.setAttribute("style",`padding:0;margin:0;font:${b};font-size:${K}px;line-height:1em;overflow:hidden;white-space:nowrap;`)}else X.setAttribute("style",`padding:0;margin:0;font:${b};line-height:1em;`);X.innerHTML=f;g.appendChild(Q);g.appendChild(X);g.imageHeight=S;return g}split(I){if("string"!==typeof I)return[];C=[];I=(I||"").replace(/\\'/g,"\u2019");G=F=E=0;for(P=N=!1;G<I.length;)" "!==I.charAt(G)||P||G++," "===I.charAt(G)||
P||(P=!0,E=G),"="!==I.charAt(G)||"'"!==I.charAt(G+1)||N||(N=!0,C[F]=[I.substring(E,G)],E=G+2,G+=2),N&&"'"===I.charAt(G)&&(P=N=!1,C[F].push(I.substring(E,G)),F++),"="!==I.charAt(G)||"'"===I.charAt(G+1)||N||(C[F]=[I.substring(E,G)],E=G+1,G++,L=I.substring(G).indexOf("="),-1===L?M=L=I.length:(L+=G,M=I.substring(G,L).lastIndexOf(" "),M=-1===M?I.length:M+G),C[F].push(I.substring(E,M)),F++,P=!1,G=M),G++;return C}parseText(I){I=I||"";return I.match(/^\{\\rtf1/)?this.RTFparser.parse(I.substring(10)):new a.SimpleText(this.parent,
I)}}a.LessonParser=U;return a}(descartesJS||{},babel);
descartesJS=function(a){function p(y,A){if(0==A)return 1;if(0>A)return NaN;if(0<=y||n(A)===A)return Math.pow(y,A);if(0>y){var x=1/A,H=n(x);if(H===x&&1===H%2)return-Math.pow(-y,A)}return NaN}function k(y,A){z=[];z.type="matrix";z.rows=y;z.cols=A;e=0;for(w=A;e<w;e++)z[e]=Array(y).fill(0);return z}function f(y,A){l=y.rows;m=y.cols;z=k(l,m);var x;for(e=0;e<l;e++)for(u=0;u<m;u++){for(w=x=0;w<m;w++)x+=y[w][e]*A[u][w];z[u][e]=x}return z}function v(y,A,x){for(var H=k(x.length-1,x.length-1),J=0,C=H.length;J<
C;J++)for(var G=0;G<C;G++)H[J][G]=J<y?G<A?x[J][G]:x[J][G+1]:J<A?x[J+1][G]:x[J+1][G+1];return H}function q(y){if(1<y.cols){for(var A=0,x=1,H=0,J=y.cols;H<J;H++)A+=x*y[0][H]*q(v(0,H,y)),x=-x;return A}return y[0][0]}if(a.loadLib)return a;var d={},n=Math.floor,h,c,b,g,r,l,m,z,u,e,w;class B{constructor(y,A){this.sep="";this.type=y;this.value=A;this.parent=null;this.childs=[]}getRoot(){return null===this.parent?this:this.parent.getRoot()}addChild(y){y.parent=this;this.childs.push(y)}replaceLastChild(y){b=
this.childs.length-1;c=this.childs[b];c.parent=null;this.childs[b]=y;y.parent=this;return y}contains(y){if(this.value===y)return!0;for(var A=0,x=this.childs.length;A<x;A++)if(this.childs[A].contains(y))return!0;return!1}equalToMinus(){return"compOperator"===this.type?(this.type="operator",this.value="-",r=new B("compOperator","=="),r.addChild(this),r.addChild(new B("number","0")),g=this.getRoot(),g.setAllEvalFun(),g):this}getChildren(){if("(expr)"===this.type||"[expr]"===this.type){if(this.childArray)return this.childArray;
this.childArray=[];for(let y=0,A=this.childs.length;y<A;y++)if("square_bracket"===this.childs[y].type||"parentheses"===this.childs[y].type)this.childArray=this.childArray.concat(this.childs[y].childs);return this.childArray}return null}setAllEvalFun(){this.setEvalFun();for(var y=0,A=this.childs.length;y<A;y++)this.childs[y].setAllEvalFun()}setEvalFun(){if("number"===this.type)this.evaluate=function(){return parseFloat(this.value)};else if("string"===this.type)this.evaluate=function(){return this.value.replace(/\\u0027/g,
"'")};else if("identifier"===this.type&&0===this.childs.length)if("rnd"===this.value)this.evaluate=function(){return Math.random()};else{var y;this.evaluate=function(E,N){y=E.variables[this.value];if("object"===typeof y&&void 0==y.length)return y.evaluate(E);void 0==y&&(N||E.matrices[this.value]?y=E.matrices[this.value]:E.vectors[this.value]&&(y=E.vectors[this.value]));return void 0!==y?y:0}}else if("identifier"===this.type&&"square_bracket"===this.childs[0].type&&1===this.childs[0].childs.length){var A;
this.evaluate=function(E){try{return A=E.getVector(this.value,this.childs[0].childs[0].evaluate(E)),void 0!==A?A:0}catch(N){return 0}}}else if("identifier"===this.type&&"square_bracket"===this.childs[0].type&&1<this.childs[0].childs.length)this.evaluate=function(E){try{return A=E.getMatrix(this.value,this.childs[0].childs[0].evaluate(E),this.childs[0].childs[1].evaluate(E)),void 0!==A?A:0}catch(N){return 0}};else if("identifier"===this.type&&"parentheses"===this.childs[0].type){var x,H,J;this.evaluate=
function(E){x=[];for(var N=0,W=this.childs[0].childs.length;N<W;N++)x[N]=this.childs[0].childs[N].evaluate(E);if("_Eval_"===this.value){h=0<x.length?x[0]:0;if("number"==typeof h)return"NaN";h.match(",")&&parseFloat(h.replace(",","."))==h.replace(",",".")&&(h=h.replace(",","."));if(void 0==d[h]){H=h.match(/:=/g)?!0:!1;if(h.match(";")){var T=!1,S=[],Q=0;N=0;for(W=h.length;N<W;N++){var X=h.charAt(N);"'"===X&&(T=!T);T||";"!==X||(S.push(h.substring(Q,N)),Q=N+1)}S.push(h.substring(Q));h="("+S.join(")(")+
")"}d[h]=E.parser.parse(h,H)}J=E.eval(d[h]);return void 0!=J?J:NaN}return E.functions[this.value].apply(E,x)}}else if("operator"===this.type)"+"===this.value?this.evaluate=function(E){var N=this.childs[0].evaluate(E,!0);E=this.childs[1].evaluate(E,!0);if("matrix"!==N.type||"matrix"!==E.type)return"number"==typeof N&&"string"==typeof E?N=a.removeNeedlessDecimals(N.toString()):"string"==typeof N&&"number"==typeof E&&(E=a.removeNeedlessDecimals(E.toString())),N+E;l=N.rows;m=N.cols;z=k(l,m);for(e=0;e<
l;e++)for(u=0;u<m;u++)z[u][e]=N[u][e]+E[u][e];return z}:"-"===this.value?this.evaluate=function(E){var N=this.childs[0].evaluate(E,!0);E=this.childs[1].evaluate(E,!0);if("matrix"!==N.type||"matrix"!==E.type)return N-E;l=N.rows;m=N.cols;z=k(l,m);for(e=0;e<l;e++)for(u=0;u<m;u++)z[u][e]=N[u][e]-E[u][e];return z}:"*"===this.value?this.evaluate=function(E){var N=this.childs[0].evaluate(E,!0);E=this.childs[1].evaluate(E,!0);return"matrix"!==N.type||"matrix"!==E.type?N*E:f(N,E)}:"/"===this.value?this.evaluate=
function(E){var N=this.childs[0].evaluate(E,!0);E=this.childs[1].evaluate(E,!0);if("matrix"!==N.type||"matrix"!==E.type)return N/E;var W=k(E.length,E.length),T=q(E);if(0===T)E=0;else{T=1/T;if(1<E.length)for(var S=0,Q=E.length;S<Q;S++){var X=T;for(var aa=0;aa<Q;aa++)W[aa][S]=X*q(v(S,aa,E)),X=-X;T=-T}else W[0][0]=T;E=W}N=0===E?k(N.rows,N.cols):f(N,E);return N}:"%"===this.value?this.evaluate=function(E){var N=this.childs[0].evaluate(E);E=this.childs[1].evaluate(E);return N-n(N/E)*E}:"^"===this.value&&
(this.evaluate=function(E){var N=this.childs[0].evaluate(E);E=this.childs[1].evaluate(E);return 0<=E?p(N,E):1/p(N,-E)});else if("compOperator"===this.type)"<"===this.value?this.evaluate=function(E){return+(this.childs[0].evaluate(E)<this.childs[1].evaluate(E))}:"<="===this.value?this.evaluate=function(E){return+(this.childs[0].evaluate(E)<=this.childs[1].evaluate(E))}:">"===this.value?this.evaluate=function(E){return+(this.childs[0].evaluate(E)>this.childs[1].evaluate(E))}:">="===this.value?this.evaluate=
function(E){return+(this.childs[0].evaluate(E)>=this.childs[1].evaluate(E))}:"=="===this.value?this.evaluate=function(E){var N=this.childs[0].evaluate(E);E=this.childs[1].evaluate(E);return"number"==typeof N&&"number"==typeof E?+(1E-8>Math.abs(N-E)):+(N===E)}:"!="===this.value&&(this.evaluate=function(E){var N=this.childs[0].evaluate(E);E=this.childs[1].evaluate(E);return"number"==typeof N&&"number"==typeof E?+!(1E-8>Math.abs(N-E)):+(N!==E)});else if("boolOperator"===this.type)"&"===this.value?this.evaluate=
function(E){return this.childs[0].evaluate(E)?this.childs[1].evaluate(E)?1:0:0}:"|"===this.value?this.evaluate=function(E){return this.childs[0].evaluate(E)?1:this.childs[1].evaluate(E)?1:0}:"!"===this.value&&(this.evaluate=function(E){return+!this.childs[0].evaluate(E)});else if("conditional"===this.type)this.evaluate=function(E){return 0<this.childs[0].evaluate(E)?this.childs[1].evaluate(E):this.childs[2]?this.childs[2].evaluate(E):0};else if("sign"===this.type)this.evaluate="sign+"===this.value?
function(E){return this.childs[0].evaluate(E)}:function(E){return-this.childs[0].evaluate(E)};else if("parentheses"===this.type)this.evaluate=function(E,N){return this.childs[0].evaluate(E,N)};else if("(expr)"===this.type||"[expr]"===this.type)this.evaluate=function(E){var N=this.childs.length,W=[];if(1===N&&1===this.childs[0].childs.length&&"(expr)"===this.type)W=this.childs[0].childs[0].evaluate(E);else for(var T=0;T<N;T++){var S=[];for(var Q=0,X=this.childs[T].childs.length;Q<X;Q++)S.push(this.childs[T].childs[Q].evaluate(E));
W[T]=S}return W};else if("assign"===this.type){var C,G=this.childs[0],F=this.childs[1],P=G.childs[0]?G.childs[0].childs:null;this.evaluate=1===G.childs.length&&"square_bracket"===G.childs[0].type&&1===P.length?function(E){C=F.evaluate(E);E.setVector(G.value,P[0].evaluate(E),C);return C}:1===G.childs.length&&"square_bracket"===G.childs[0].type&&2===P.length?function(E){C=F.evaluate(E);E.setMatrix(G.value,P[0].evaluate(E),P[1].evaluate(E),C);return C}:function(E){C=F.evaluate(E);return C.type?E.matrices[G.value]=
C:"object"!==typeof E.variables[G.value]?E.variables[G.value]=C:0}}}}a.Node=B;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var p,k,f,v,q,d,n,h,c=/^\s+/,b=/^[a-zA-Z_\u00C0-\u021B\u0391-\u03C9]+[a-zA-Z_0-9\u00C0-\u021B\u0391-\u03C9]*([.]*[0-9a-zA-Z_\u00C0-\u021B\u0391-\u03C9]+[0-9]*)*/,g=/^[0-9]+[.][0-9]+|^[.][0-9]+|^[0-9]+/,r=/^==|^!=|^<=|^<|^>=|^>|^#/,l=/^!|^~|^&&|^&|^\|\||^\|/,m=/^=|^:=/,z=/^[\?:]/,u=/^[\+\-\*\/%\^\u2212\u00b7\u00D7\u00F7]/,e=/^\[|^\]/,w=/^\(|^\)/,B=/^,/,y=/^;/,A=/\|/g,x=/\|\*/g,H=/\*\|/g,J,C=/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/;
class G{constructor(){}tokenize(F){function P(N,W,T){k.push({type:N,value:W});d=d.slice(T);v+=T;h=N}if(p=F){var E=F.indexOf("//");0<=E&&":"!==F[E-1]&&(F=F.substring(0,E));F=F.replace(/\\u(\S+) /g,function(N,W){return 39!==parseInt(W,16)?String.fromCharCode(parseInt(W,16)):N});F=F.replace(/&sup(.+?);/g,"^$1 ");F=F.replace(/&squot;/g,"'");F.match(/=\|\*/g)&&(F=F.replace(x,"'").replace(H,"'"));F.match(/=\|/g)&&(F=F.replace(A,"'"));E=F.trim();"|"==E.charAt(0)&&"|"==E.charAt(E.length-1)&&(F=E.replace(A,
"'"))}k=[];f=!1;v=0;d=F;for(h="";F&&v<F.length;)if(f=v,"'"==d[0]){for(n=1;"'"!=d[n];)if(n<d.length)n++;else{console.info(">Error, unknown symbol: ["+d+"], in the string \u300a"+p+"\u300b");return}q=d.substring(1,n);P("string",q,q.length+2)}else if(q=d.match(c))d=d.slice(q[0].length),v+=q[0].length;else if(q=d.match(u))q[0]=q[0].replace(/\u00F7/g,"/").replace(/\u2212/g,"-").replace(/\u00b7/g,"*").replace(/\u00D7/g,"*"),P("operator",q[0],q[0].length);else if(q=d.match(b))"number"===h&&k.push({type:"operator",
value:"*"}),P("identifier",q[0],q[0].length);else if(q=d.match(g))P("number",q[0],q[0].length);else if(q=d.match(r))E=q[0],"#"==E&&(E="!="),P("compOperator",E,q[0].length);else if(q=d.match(l))E=q[0],"||"==E?E="|":"&&"==E?E="&":"~"==E&&(E="!"),P("boolOperator",E,q[0].length);else if((q=d.match(m))&&!d.match(/^==/))P("assign",q[0],q[0].length);else if(q=d.match(z))P("conditional",q[0],q[0].length);else if(q=d.match(e))P("square_bracket",q[0],q[0].length);else if(q=d.match(w))"("==q&&"number"===h&&
k.push({type:"operator",value:"*"}),P("parentheses",q[0],q[0].length);else if(q=d.match(B))P("separator",q[0],q[0].length);else if(178===d.charCodeAt(0))k.push({type:"operator",value:"^"}),P("number",2,1);else if(179===d.charCodeAt(0))k.push({type:"operator",value:"^"}),P("number",3,1);else if(q=d.match(y))P("final_of_expression",q[0],q[0].length);else if(f==v){a.DEBUG.setError(a.DEBUG.EXPRESSION,p);return}return k}flatTokens(F,P){F=F||[];P=P||"";J="";for(var E=0,N=F.length;E<N;E++)J="string"==F[E].type?
J+"&squot;"+F[E].value+"&squot;":"identifier"!=F[E].type||F[E].value.match(C)?J+F[E].value:J+P+F[E].value;return J}}a.Tokenizer=G;return a}(descartesJS||{});
descartesJS=function(a){function p(e){switch(e){case "=":return 1;case ":=":return 1;case "(":return 2;case "[":return 2;case "?":return 2;case ":":return 3;case "?:":return 3;case "|":return 6;case "&":return 7;case "<":return 5;case "<=":return 5;case ">":return 5;case ">=":return 5;case "==":return 5;case "!=":return 5;case "+":return 6;case "-":return 6;case "/":return 7;case "*":return 7;case "sign-":return 7;case "sign+":return 7;case "!":return 8;case "%":return 8;case "^":return 9;default:return 9}}
function k(e){return isNaN(parseFloat(e))?e.replace(/^\s|\s$/g,"").replace(/^'|'$/g,""):parseFloat(e)==e?parseFloat(e):e.replace(/^\s|\s$/g,"").replace(/^'|'$/g,"")}if(a.loadLib)return a;a.reservedIds=new String("-_-rnd-pi-\u03c0-e-Infinity-isTouch-esT\u00e1ctil-device-dispositivo-screenOrientation-screenWidth-screenHeight-sqr-sqrt-ra\u00edz-exp-log-log10-abs-ent-sgn-ind-sin-sen-cos-tan-cot-sec-csc-sinh-senh-cosh-tanh-coth-sech-csch-asin-asen-acos-atan-atan2-floor-ceil-round-min-max-_Trace_-_Print_-_Num_-_Stop_Audios_-esCorrecto-escorrecto-parent.set-parent.update-parent.exec-isNumber-toFixed-_NumToStr_-_NumACadena_-charAt-_charAt_-_letraEn_-substring-_substring_-_subcadena_-strLength-_length_-_longitud_-indexOf-_indexOf_-\u00edndiceDe-lastIndexOf-replace-_replace_-_reemplazar_-toLowerCase-toUpperCase-trim-_Load_-_GetValues_-_GetMatrix_-_MatrixToStr_-_StrToMatrix_-_GetVector_-_VectorToStr_-_StrToVector_-_ExecStr_-_ExecBlock_-_Save_-_Open_-_SaveState_-_OpenState_-_AnchoDeCadena_-_strWidth_-R-G-B-_Rojo_-_Red_-_Verde_-_Green_-_Azul_-_Blue_-DJS.typeof-");
var f=Date.now(),v,q,d,n,h,c,b,g,r,l,m,z;class u{constructor(e){this.evaluator=e;this.tokenizer=new a.Tokenizer;this.vectors={};this.matrices={};this.variables={};this.functions={};this.definitions={};this.registerDefaultValues();this.registerExternalValues&&this.registerExternalValues()}setDefinition(e,w){this.definitions[e]=w}getDefinition(e){return this.definitions[e]}setVariable(e,w){this.variables[e]=w}getVariable(e){return this.variables[e]}setVector(e,w,B){this.vectors[e][w]=B}getVector(e){this.vectors.hasOwnProperty(e)||
(this.vectors[e]=[0,0,0]);return this.vectors[e]}setMatrix(e,w,B,y){this.matrices[e][w][B]=y}getMatrix(e){this.matrices.hasOwnProperty(e)||(this.matrices[e]=[[0,0,0],[0,0,0],[0,0,0]]);return this.matrices[e]}setFunction(e,w){this.functions[e]=w}getFunction(e){this.functions.hasOwnProperty(e)||(this.functions[e]=function(){return 0});return this.functions[e]}parse(e,w){(d=this.tokenizer.tokenize(e))||(d=[]);n=null;w=!w||!1;v=g=b=c=0;for(q=d.length;v<q;v++){r=d[v];l=r.value;m=r.type;if("identifier"===
m)if(v+1<q&&"parentheses"===d[v+1].type&&"("===d[v+1].value)this.getFunction(l);else if(v+1<q&&"square_bracket"===d[v+1].type&&"["===d[v+1].value)d[v+3]&&"square_bracket"===d[v+3].type&&"]"===d[v+3].value?this.getVector(l):this.getMatrix(l);else{var B=l.match(/(\w*)\.mouse_x|(\w*)\.mouse_y|(\w*)\.mouse_pressed|(\w*)\.mouse_clicked|(\w*)\.clic_izquierdo/);B&&(this.variables[(B[1]||B[2]||B[3]||B[4]||B[5])+".DESCARTESJS_no_fixed"]=1);this.getVariable(l,!0)}"assign"===m&&w&&":="!=l&&(m="compOperator",
l="==");if("assign"===m)if(h=new a.Node(m,l),null!=n)if("identifier"===n.type)n.parent&&n.parent.replaceLastChild(h),h.addChild(n),n=h,w=!0;else if("square_bracket"===n.type)h.addChild(n.parent),n=h,w=!0;else{h.type="compOperator";h.value="==";for(w=!0;n.parent&&p(n.parent.value)>=p(h.value);)n=n.parent;n.parent&&n.parent.replaceLastChild(h);h.addChild(n);n=h}else{console.info("Error1: en la expresi\u00f3n \u300a "+e+" \u300b, en el token {valor: "+l+", tipo: "+m+"}");break}else if("parentheses"===
m&&"("===l||"square_bracket"===m&&"["===l)if(h=new a.Node(m,l),"("===l&&c++,"["===l&&b++,null===n)"("===l&&(new a.Node("(expr)","(expr)")).addChild(h),"["===l&&(new a.Node("[expr]","[expr]")).addChild(h),n=h;else if("operator"===n.type||"boolOperator"===n.type||"compOperator"===n.type||"conditional"===n.type||"assign"===n.type)n.addChild(h),n=h;else if("sign"===n.type)n.addChild(h),n=h;else if("parentheses"===n.type&&"("===n.value)n.addChild(h),n=h;else if("square_bracket"===n.type&&"["===n.value)n.addChild(h),
n=h;else if("parentheses"===n.type&&"()"===n.value)n.parent.addChild(h),n=h;else if("square_bracket"===n.type&&"[]"===n.value)n.parent.addChild(h),n=h;else if("identifier"===n.type)n.addChild(h),n=h;else{console.info("Error2: en la expresi\u00f3n \u300a "+e+" \u300b, en el token ["+v+"] {valor: "+l+", tipo: "+m+"}");break}else if("parentheses"===m&&")"===l)if(c--,null===n)console.info("Error3: en la expresi\u00f3n \u300a "+e+" \u300b, en el token (valor:"+l+", tipo:"+m);else{for(;n&&n.parent&&("("!=
n.value||"("==n.value&&"parentheses"!=n.type);)n=n.parent;if(n&&"("===n.value)n.value="()";else break}else if("square_bracket"===m&&"]"===l)if(b--,null===n)console.info("Error5: en la expresi\u00f3n \u300a "+e+" \u300b, en el token (valor:"+l+", tipo:"+m);else{for(;n&&n.parent&&("["!=n.value||"["==n.value&&"square_bracket"!=n.type);)n=n.parent;if(n&&"["===n.value)n.value="[]";else{console.info("Error6: en la expresi\u00f3n \u300a "+e+" \u300b, en el token {valor: "+l+", tipo: "+m+"}");break}}else if("number"===
m||"string"===m||"identifier"===m)if(h=new a.Node(m,l),null===n)n=h;else if("operator"===n.type||"compOperator"===n.type||"boolOperator"===n.type||"parentheses"===n.type&&"("===n.value||"square_bracket"===n.type&&"["===n.value||"sign"===n.type||"conditional"===n.type||"assign"===n.type)n.addChild(h),n=h;else{a.DEBUG.setError(a.DEBUG.EXPRESSION,e);break}else if("operator"===m||"compOperator"===m||"boolOperator"===m)if(h=new a.Node(m,l),null===n)if("-"===l||"+"===l)h.type="sign",h.value="sign"+l,n=
h;else if("!"===l)n=h;else{console.info("Error8: en la expresi\u00f3n \u300a "+e+" \u300b, en el token {valor: "+l+", tipo: "+m+"}");break}else if("operator"===n.type||"compOperator"===n.type||"boolOperator"===n.type||"assign"===n.type||"conditional"===n.type||"square_bracket"===n.type&&"["===n.value&&("-"===l||"+"===l||"!"===l)||"parentheses"===n.type&&"("===n.value&&("-"===l||"+"===l||"!"===l)){if("-"===l||"+"===l)h.type="sign",h.value="sign"+l;n.addChild(h);n=h}else if("number"===n.type||"parentheses"===
n.type&&"()"===n.value||"square_bracket"===n.type&&"[]"===n.value||"string"===n.type||"identifier"===n.type||"conditional"===n.type||"assign"===n.type){for(;n.parent&&p(n.parent.value)>=p(h.value);)n=n.parent;n.parent&&n.parent.replaceLastChild(h);h.addChild(n);n=h}else{console.info("Error9: en la expresi\u00f3n \u300a "+e+" \u300b, en el token {valor: "+l+", tipo: "+m+"}");break}else if("conditional"===m)if(h=new a.Node(m,l),null!=n)if("?"===h.value){for(g++;n.parent&&p(n.parent.value)>p(h.value);)n=
n.parent;n.parent&&n.parent.replaceLastChild(h);h.addChild(n);n=h}else{for(g--;n&&n.parent&&("?"!=n.value||"?"==n.value&&"conditional"!=n.type);)n=n.parent;if(n&&"?"===n.value)n.value="?:";else{console.info("Error10: en la expresi\u00f3n \u300a "+e+" \u300b, en el token {valor: "+l+", tipo: "+m+"}");break}}else{console.info("Error11: en la expresi\u00f3n \u300a "+e+" \u300b, en el token {valor: "+l+", tipo: "+m+"}");break}else if("separator"===m)if(null!=n)for(;n.parent&&"("!=n.value&&"["!=n.value;)n=
n.parent;else{console.info("Error12: en la expresi\u00f3n \u300a "+e+" \u300b, en el token {valor: "+l+", tipo: "+m+"}");break}else{console.info("Error13: en la expresi\u00f3n \u300a "+e+" \u300b, en el token {valor: "+l+", tipo: "+m+"}");break}}0<c&&a.DEBUG.setError(a.DEBUG.PARENTHESIS_CLOSING,e);0>c&&a.DEBUG.setError(a.DEBUG.PARENTHESIS_OPENING,e);0<b&&a.DEBUG.setError(a.DEBUG.BRACKET_CLOSING,e);0>b&&a.DEBUG.setError(a.DEBUG.BRACKET_OPENING,e);0!=g&&a.DEBUG.setError(a.DEBUG.INCOMPLETE_IF,e);(z=
n?n.getRoot():null)&&z.setAllEvalFun();return z}registerDefaultValues(){var e=this;e.variables._NUM_MAX_ITE_ALG_=1E5;e.variables.rnd=Math.random;e.variables.pi=e.variables["\u03c0"]=a.returnValue(Math.PI);e.variables.e=a.returnValue(Math.E);e.variables.Infinity=Infinity;e.variables["-Infinity"]=-Infinity;e.variables.isTouch=e.variables["esT\u00e1ctil"]=a.hasTouchSupport?1:0;e.variables.device=e.variables.dispositivo=function(){const C=navigator.userAgent;return/(tablet|ipad|playbook|silk)|(android(?!.*mobi))/i.test(C)?
"tablet":/Mobile|iP(hone|od)|Android|BlackBerry|IEMobile|Kindle|Silk-Accelerated|(hpw|web)OS|Opera M(obi|ini)/.test(C)?"mobile":"desktop"}();Object.defineProperties(e.variables,{screenOrientation:{get:function(){return window.matchMedia("(orientation: landscape)").matches?"landscape":"portrait"}},screenWidth:{get:function(){return window.innerWidth}},screenHeight:{get:function(){return window.innerHeight}}});e.functions.sqr=function(C){return C*C};e.functions.sqrt=e.functions["ra\u00edz"]=Math.sqrt;
e.functions.exp=Math.exp;e.functions.log=Math.log;e.functions.log10=function(C){return Math.log(C)/Math.log(10)};e.functions.abs=Math.abs;e.functions.ent=Math.floor;e.functions.sgn=function(C){return 0<C?1:0>C?-1:0};e.functions.ind=function(C){return C?1:0};e.functions.sin=e.functions.sen=Math.sin;e.functions.cos=Math.cos;e.functions.tan=Math.tan;e.functions.cot=function(C){return 1/Math.tan(C)};e.functions.sec=function(C){return 1/Math.cos(C)};e.functions.csc=function(C){return 1/Math.sin(C)};e.functions.sinh=
e.functions.senh=function(C){return(Math.exp(C)-Math.exp(-C))/2};e.functions.cosh=function(C){return(Math.exp(C)+Math.exp(-C))/2};e.functions.tanh=function(C){return(Math.exp(C)-Math.exp(-C))/(Math.exp(C)+Math.exp(-C))};e.functions.coth=function(C){return 1/e.functions.tanh(C)};e.functions.sech=function(C){return 1/e.functions.cosh(C)};e.functions.csch=function(C){return 1/e.functions.sinh(C)};e.functions.asin=e.functions.asen=Math.asin;e.functions.acos=Math.acos;e.functions.atan=Math.atan;e.functions.atan2=
Math.atan2;e.functions.floor=Math.floor;e.functions.ceil=Math.ceil;e.functions.round=Math.round;e.functions.min=Math.min;e.functions.max=Math.max;e.functions._Trace_=e.functions._Print_=function(){console.info.apply(console,arguments);return 0};e.functions._Num_=function(C){if("number"==typeof C)return"NaN";C=C.replace(",",".");return parseFloat(C)==C?parseFloat(C):"NaN"};e.functions.isNumber=function(C){return Number.isFinite(C)?1:0};e.functions._Stop_Audios_=function(){e.evaluator.parent.stopAudios()};
e.functions.esCorrecto=function(C,G,F){return a.esCorrecto(C,G,e.evaluator,F)};e.functions.escorrecto=function(C,G,F){return a.escorrecto(C,G,e.evaluator,F)};window.parent!==window&&(e.functions["parent.set"]=function(C,G){window.parent.postMessage({type:"set",name:C,value:G},"*");return 0},e.functions["parent.update"]=function(){window.parent.postMessage({type:"update"},"*");return 0},e.functions["parent.exec"]=function(C,G){window.parent.postMessage({type:"exec",name:C,value:G},"*");return 0});
e.functions.toFixed=e.functions._NumToStr_=e.functions._NumACadena_=function(C,G){C=isNaN(parseFloat(C))?0:parseFloat(C);return C.toFixed(parseInt(G||0))};e.functions.charAt=e.functions._charAt_=e.functions._letraEn_=function(C,G){C=(C||"").toString();G=isNaN(parseInt(G))?0:parseInt(G);return C.charAt(G)};e.functions.substring=e.functions._substring_=e.functions._subcadena_=function(C,G,F){C=(C||"").toString();G=isNaN(parseInt(G))?0:parseInt(G);F=isNaN(parseInt(F))?0:parseInt(F);return 0<=G&&0<=F?
C.substring(G,F):0>G&&0<=F?C.substring(F):0>F&&0<=G?C.substring(G):""};e.functions.strLength=e.functions._length_=e.functions._longitud_=function(C){return(C||"").toString().length};e.functions.indexOf=e.functions._indexOf_=e.functions["_\u00edndiceDe_"]=function(C,G){return(C||"").toString().indexOf((G||"").toString())};e.functions.lastIndexOf=function(C,G){return(C||"").toString().lastIndexOf((G||"").toString())};e.functions.replace=e.functions._replace_=e.functions._reemplazar_=function(C,G,F){C=
(C||"").toString();G=(G||"").toString();F=(F||"").toString();for(var P=C.indexOf(G);0<=P;)C=C.substring(0,P)+F+C.substring(P+G.length),P=C.indexOf(G,P+F.length);return C};e.functions.toLowerCase=function(C){return(C||"").toString().toLowerCase()};e.functions.toUpperCase=function(C){return(C||"").toString().toUpperCase()};e.functions.trim=function(C){return(C||"").toString().trim()};e.functions._Load_=function(C){var G="";C&&(G=(G=document.getElementById(C))&&"descartes/archivo"==G.type?G.text:a.openExternalFile(C));
return G||""};e.functions._GetValues_=function(C,G){return e.functions._ExecBlock_(e.functions._Load_(C).replace(/&brvbar;/g,String.fromCharCode("166")),G)};e.functions._GetMatrix_=function(C,G){return e.functions._StrToMatrix_(e.functions._Load_(C).replace(/&brvbar;/g,String.fromCharCode("166")),G)};e.functions._MatrixToStr_=function(C){var G=e.matrices[C];if(G){for(var F="<"+C+">\\n",P=e.getVariable(C+".columnas_usadas")||G.cols||0,E=e.getVariable(C+".filas_usadas")||G.rows||0,N,W=0;W<P;W++){for(var T=
0;T<E;T++)N=G[W][T],void 0!==N&&("string"==typeof N?N="'"+N+"'":"number"==typeof N&&(N=a.removeNeedlessDecimals(N.toFixed(6))),F+=N+(T<E-1?" \u00a6 ":""));F=F.replace(/(\u00A6 )$/g,"")+"\\n"}return F+"</"+C+">"}return""};e.functions._StrToMatrix_=function(C,G){var F=[],P=!1,E=!1;F.type="matrix";if(C){C=C.replace(/\r|\\r/g,"").split(/\n|\\n/);for(var N=0,W=C.length;N<W;N++)C[N].match("<"+G+">")?(E=!0,P=C[N].trim().split("<"+G+">"),2==P.length&&""!=P[1]&&F.push(P[1].split(String.fromCharCode("166")).map(k)),
P=!0):(C[N].match("</"+G+">")&&(P=C[N].trim().split("</"+G+">"),2==P.length&&""!=P[0]&&F.push(P[0].split(String.fromCharCode("166")).map(k)),P=!1,N=C.length),P&&F.push(C[N].split(String.fromCharCode("166")).map(k)));e.matrices[G]=F;e.matrices[G].rows=F&&F[0]&&F[0].length?F[0].length:0;e.matrices[G].cols=F&&F.length?F.length:0;e.setVariable(G+".filas",e.matrices[G].rows);e.setVariable(G+".columnas",e.matrices[G].cols)}return E?"OK":"ERROR"};e.functions._GetVector_=function(C,G){return e.functions._StrToVector_(e.functions._Load_(C),
G)};e.functions._VectorToStr_=function(C){var G=e.vectors[C];if(G){for(var F="<"+C+">\\n",P=e.getVariable(C+".long_usada")||G._size_||0,E,N=0;N<P;N++)E=G[N],void 0!==E?("number"==typeof E&&(E=parseFloat(E)),F+=E+"\\n"):F+="0\\n";return F+"</"+C+">"}return""};e.functions._StrToVector_=function(C,G){var F=[],P=!1,E=!1;F.type="vector";if(C){C=C.replace(/\r|\\r/g,"").split(/\n|\\n/);for(var N=0,W=C.length;N<W;N++)C[N].match("<"+G+">")?P=E=!0:(C[N].match("</"+G+">")&&(P=!1,N=C.length),P&&F.push(k(C[N])));
F._size_=F.length;e.vectors[G]=F;e.setVariable(G+".long",F.length);e.setVariable(G+".long_usada",F.length)}return E?"OK":"ERROR"};e.functions._ExecStr_=function(C){return e.functions._ExecBlock_(C,"")};e.functions._ExecBlock_=function(C,G){var F=[],P=""==G;if(C){C=C.replace(/\r|\\r/g,"").split(/\n|\\n/);for(var E=0,N=C.length;E<N;E++)C[E].match("<"+G+">")?(P=C[E].trim().split("<"+G+">"),2==P.length&&""!=P[1]&&(F=F.concat(P[1].split(String.fromCharCode("166")))),P=!0):C[E].match("</"+G+">")?(P=C[E].trim().split("</"+
G+">"),2==P.length&&""!=P[0]&&(F=F.concat(P[0].split(String.fromCharCode("166")))),P=!1):P&&(F=F.concat(C[E].split(String.fromCharCode("166"))));E=0;for(N=F.length;E<N;E++)P=F[E].split("="),P[0]=P[0].trim(),2==P.length&&""!=P[0]&&(isNaN(parseFloat(P[1]))?e.setVariable(P[0],P[1].replace(/^\s|\s$/g,"").replace(/^'|'$/g,"")):e.setVariable(P[0],parseFloat(P[1])))}return 0};var w=a.newHTML("a",{target:"_blank"}),B,y=null;a.newBlobContent=null;e.functions._Save_=function(C,G){e.evaluator.parent.removeButtonClick();
1500<Date.now()-f&&(f=Date.now(),document.body.appendChild(w),y=G.replace(/\\r/g,"").replace(/\\n/g,"\r\n").replace(/\\q/g,"'").replace(/\\_/g,"\\"),B=new Blob(["\ufeff",y],{type:"text/plain;charset=utf-8"}),w.setAttribute("href",window.URL.createObjectURL(B)),w.setAttribute("download",C),y!=a.newBlobContent&&(w.click(),a.newBlobContent=y),document.body.removeChild(w));return 0};var A=a.newHTML("a",{target:"_blank"});e.functions._SaveSpace_=function(C,G){e.evaluator.parent.removeButtonClick();1500<
Date.now()-f&&(f=Date.now(),document.body.appendChild(A),y=G,A.setAttribute("href",y),A.setAttribute("download",C),y!=a.newBlobContent&&(A.click(),a.newBlobContent=y),document.body.removeChild(A));return 0};var x,H,J=a.newHTML("input",{type:"file"});J.addEventListener("change",function(C){x=C.target.files;H=new FileReader;H.onload=function(G){a.addExternalFileContent(x[0].name,G.target.result);e.setVariable("DJS.fileName",x[0].name);e.setVariable("DJS.fileContent",G.target.result);e.getFunction(e._callback)&&
(e.getFunction(e._callback).apply(e.evaluator,[]),e.evaluator.parent.update());J.value=""};0<x.length&&H.readAsText(x[0])});e.functions._Open_=function(C){e.evaluator.parent.removeButtonClick();1500<Date.now()-f&&(e._callback=C,J.click(),f=Date.now());return 0};e.functions._AnchoDeCadena_=e.functions._strWidth_=function(C,G,F,P){return a.getTextWidth(C,a.convertFont(G+","+F+","+P))};e.functions.R=e.functions._Rojo_=e.functions._Red_=function(C){return(new a.Color(C)).r/255};e.functions.G=e.functions._Verde_=
e.functions._Green_=function(C){return(new a.Color(C)).g/255};e.functions.B=e.functions._Azul_=e.functions._Blue_=function(C){return(new a.Color(C)).b/255};e.functions["DJS.typeof"]=function(C){return C.rows?"matrix":C._size_?"vector":typeof C}}}a.Parser=u;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var p=Math.floor;class k{constructor(f){this.parent=f;this.parser=new a.Parser(this);this.variables=this.parser.variables;this.functions=this.parser.functions;this.vectors=this.parser.vectors;this.matrices=this.parser.matrices;this.definitions=this.parser.definitions}setDefinition(f,v){this.definitions[f]=v}getDefinition(f){return this.definitions[f]}setVariable(f,v){this.variables[f]=v}getVariable(f){return this.variables[f]}setVector(f,v,q){v=0>v?0:
p(v);this.vectors[f][v]=q}getVector(f,v){v=0>v?0:p(v);return this.vectors[f][v]}setMatrix(f,v,q,d){v=0>v?0:p(v);q=0>q?0:p(q);void 0==this.matrices[f][v]&&(this.matrices[f][v]=[]);this.matrices[f][v][q]=d}getMatrix(f,v,q){v=0>v?0:p(v);q=0>q?0:p(q);return this.matrices[f][v][q]}setFunction(f,v){this.functions[f]=v}getFunction(f){return this.functions[f]}eval(f){return f?f.evaluate(this):0}}a.externalEvaluator=new k;a.Evaluator=k;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var p,k,f,v,q,d,n,h,c,b,g,r,l,m,z;class u{constructor(e,w){this.parent=e;this.evaluator=e.evaluator;this.decimals=e.decimals;this.fixed=e.fixed;this.align=e.align||"left";this.anchor=e.anchor||"a_top_left";this.decimal_symbol=e.parent.decimal_symbol;this.w=this.h=100;this.hasContent=""!==w;this.textStr=(w||"").replace(/\\{/g,"\\curlyBracketOpen ").replace(/\\}/g,"\\curlyBracketClose ").replace(/\\\[/g,"\\squareBracketOpen ").replace(/\\\]/g,"\\squareBracketClose ");
this.oldTextStr=this.oldWidth=this.oldSize=this.oldColor=this.oldPosX=this.oldPoxY=null;w.match(/^\{\\rtf1/)?(this.type="rtfNode",this.text=w,this.textNodes=(new a.RTFParser(e.evaluator)).parse(w.substring(10)),this.draw=this.drawRTF):(this.descarTeXParser=new a.DescarTeXParser,this.text=this.parseSimpleText(this.textStr),this.textNodes=new a.TextNode("","textLineBlock",null,null),this.draw=this.drawText)}drawText(e,w,B,y,A){p=this.evaluator.eval(this.decimals);k=this.evaluator.eval(this.parent.width);
f=this.evaluator.eval(this.parent.font_size);v=w.getColor?w.getColor():w;q=this.textToString(this.text,p,this.fixed).replace(/\\{/g,"\\curlyBracketOpen ").replace(/\\}/g,"\\curlyBracketClose ").replace(/\\\[/g,"\\squareBracketOpen ").replace(/\\\]/g,"\\squareBracketClose ");0<=q.indexOf("[")&&(q=this.textToString(this.parseSimpleText(q),p,this.fixed));if(this.oldTextStr!==q||this.oldWidth!==k||this.oldSize!==f||this.oldColor!==v||this.oldPosX!==B||this.oldPoxY!==y)d=new a.TextStyle({size:f,family:this.parent.font_family||
"arial",italic:this.parent.italics||!1,bold:this.parent.bold||!1,color:v,align:this.align,border:this.parent.border,border_size:this.parent.border_size,shadowBlur:this.parent.shadowBlur,shadowOffsetX:this.parent.shadowOffsetX,shadowOffsetY:this.parent.shadowOffsetY,shadowColor:this.parent.shadowColor||"transparent"}),this.textNodes=this.descarTeXParser.parse(q,this.evaluator,d),this.textNodes.update(B,y,p,this.fixed,this.align,this.anchor,v,k);A||this.textNodes.draw(e);this.oldTextStr=q;this.oldWidth=
k;this.oldSize=f;this.oldColor=v;this.oldPosX=B;this.oldPoxY=y}drawRTF(e,w,B,y,A){w=w.getColor?w.getColor():w;e.fillStyle=e.strokeStyle=w;e.textBaseline="alphabetic";this.textNodes.style.align!==this.align&&this.textNodes.propagateStyle("align",this.align);this.textNodes.update(B,y,this.evaluator.eval(this.decimals),this.fixed,this.align,this.anchor,w,this.evaluator.eval(this.parent.width));A||this.textNodes.draw(e)}parseSimpleText(e){e=e.replace("&#x2013","\u2013").replace(/&squot;/g,"'");n=[];h=
"'";b=c=0;g=-1;for(m=e.length;c<m;)r=e.charAt(c),l=e.charAt(c-1),"["===r&&"\\"===l?(n.push(e.substring(b,c-1)+"["),b=c+1):"]"===r&&"\\"===l?(n.push(e.substring(b,c-1)+"]"),b=c+1):"["===r&&-1===g?(n.push(e.substring(b,c)),b=c,g++):"["===r?g++:"]"===r&&0===g?(n.push(this.evaluator.parser.parse(e.substring(b,c+1))),b=c+1,g--):("]"==e.charAt(c)&&(g=0>g?g:g-1),h+=e.charAt(c)),c++;n.push(e.substring(b,c));return n}textToString(e,w,B){h="";if("rtfNode"!==e.type)for(var y=0,A=e.length;y<A;y++)"string"===
typeof e[y]?h+=e[y]:(z=this.evaluator.eval(e[y])[0][0],""!==z&&("string"===typeof z?h+=z:Infinity===z?h+="Infinity":-Infinity===z?h+="-Infinity":isNaN(z)||"NaN"===z?h+="NaN":(z=parseFloat(z),z=B?z.toFixed(w):a.removeNeedlessDecimals(z.toFixed(w)),h+=z.toString().replace(".",this.decimal_symbol))));return h}}a.TextObject=u;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var p;class k{constructor(){}tokenize(f){f=f.replace(/\\n/g,"\\newline ");var v=[],q=null,d=0,n=f.length;f.charAt(0);var h=!1,c=!1,b=0;p="";for(var g=0;g<n;g++){var r=f.charAt(g);var l=f.charAt(g+1);"\\"===r&&"$"===l&&(c=!0);"{"===r?b++:"}"===r&&(b--,c&&0===b&&(c=!1));c?"_"===r?"{"===l?p+="\\subindex":(p+="\\subindex{"+l+"}",g++):"^"===r?"{"===l?p+="\\superindex":(p+="\\superindex{"+l+"}",g++):p+=r:p+=r}f=p;l=f.charAt(0);for(n=f.length;d<n;)r=l,l=f.charAt(d+
1),h&&("{"===r||"["===r||"\\"===r||" "===r?(h=!1," "===r&&(q={type:"ignore"},v.push(q))):q.value+=r),h||"\\"!==r?h||"{"!==r&&"["!==r?h||"}"!==r&&"]"!==r?h||(q&&"text"===q.type?q.value+=r:q&&"ignore"===q.type?(v.pop(),q=v[v.length-1]):(q={type:"text",value:r},v.push(q))):(q={type:"close",value:r},v.push(q)):(q={type:"open",value:r},v.push(q)):(h=!0,q={type:"command",value:""},v.push(q)),d++;return v}}a.DescarTeXTokenizer=k;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;class p{constructor(){this.tokenizer=new a.DescarTeXTokenizer}parse(k,f,v){k=this.tokenizer.tokenize(k);var q=new a.TextNode("","textBlock",v,null),d=new a.TextNode("","textLineBlock",v.clone(),null);q.addChild(d);for(var n=[],h=void 0,c=v,b=[v],g,r,l,m,z=!1,u=0,e=k.length;u<e;u++)if("text"===k[u].type)if("color_parameter"===h)r=new a.Color(k[u].value,f);else if("text_size_parameter"===h)l=parseFloat(k[u].value);else if("textLineBlock"===d.nodeType){g=
k[u].value.split(" ");for(var w=0,B=g.length;w<B;w++)""!==g[w]&&d.addChild(new a.TextNode(g[w],"text",c.clone(),null)),w+1<B&&d.addChild(new a.TextNode(" ","space",c.clone(),null))}else d.addChild(new a.TextNode(k[u].value,"text",c.clone(),null));else"command"===k[u].type&&"curlyBracketOpen"===k[u].value?d.addChild(new a.TextNode("{","text",c.clone(),null)):"command"===k[u].type&&"curlyBracketClose"===k[u].value?d.addChild(new a.TextNode("}","text",c.clone(),null)):"command"===k[u].type&&"squareBracketOpen"===
k[u].value?d.addChild(new a.TextNode("[","text",c.clone(),null)):"command"===k[u].type&&"squareBracketClose"===k[u].value?d.addChild(new a.TextNode("]","text",c.clone(),null)):"command"===k[u].type&&"newline"===k[u].value?(0===d.children.length&&d.addChild(new a.TextNode("","text",c.clone(),null)),d=new a.TextNode("","textLineBlock",v.clone(),null),q.addChild(d)):"command"===k[u].type&&"b"===k[u].value?(h="bold",n.push(h)):"command"===k[u].type&&"i"===k[u].value?(h="italic",n.push(h)):"command"===
k[u].type&&"o"===k[u].value?(h="overline",n.push(h)):"command"===k[u].type&&"u"===k[u].value?(h="underline",n.push(h)):"command"===k[u].type&&"color"===k[u].value?(h="color",n.push(h)):"command"===k[u].type&&"ts"===k[u].value?(h="text_size",n.push(h)):"command"===k[u].type&&"sansserif"===k[u].value.toLowerCase()?(h="sansserif",n.push(h)):"command"===k[u].type&&"serif"===k[u].value.toLowerCase()?(h="serif",n.push(h)):"command"===k[u].type&&"monospace"===k[u].value.toLowerCase()?(h="monospace",n.push(h)):
"command"===k[u].type&&"c"===k[u].value?(h="center",n.push(h)):"command"===k[u].type&&"l"===k[u].value?(h="left",n.push(h)):"command"===k[u].type&&"r"===k[u].value?(h="right",n.push(h)):"command"===k[u].type&&"j"===k[u].value?(h="justify",n.push(h)):"command"===k[u].type&&"$"===k[u].value?(h="formula",n.push(h),z=!0):"command"===k[u].type&&"sum"===k[u].value?(h="sum",n.push(h)):"command"===k[u].type&&"prod"===k[u].value?(h="prod",n.push(h)):"command"===k[u].type&&"int"===k[u].value?(h="integral",
n.push(h)):"command"===k[u].type&&"lim"===k[u].value?(h="limit",n.push(h)):"command"===k[u].type&&"sqrt"===k[u].value?(h="radical",n.push(h)):"command"===k[u].type&&"subindex"===k[u].value?(h="subIndex",n.push(h)):"command"===k[u].type&&"superindex"===k[u].value?(h="superIndex",n.push(h)):"command"===k[u].type&&"frac"===k[u].value?(h="numerator",n.push(h)):"open"===k[u].type&&"{"===k[u].value&&void 0!==h?"bold"===h||"italic"===h||"overline"===h||"underline"===h?(c=c.clone(),c[h]=!0,b.push(c)):"sansserif"===
h?(c=c.clone(),c.family="sansserif",b.push(c)):"serif"===h?(c=c.clone(),c.family="serif",b.push(c)):"monospace"===h?(c=c.clone(),c.family="monospaced",b.push(c)):"text_size"===h?h="text_size_parameter":"text_size_text"===h?(c=c.clone(),c.size=l,b.push(c)):"color"===h?h="color_parameter":"color_text"===h?(c=c.clone(),c.color=r,b.push(c)):"center"===h||"left"===h||"right"===h||"justify"===h?(c=c.clone(),c.align=h,b.push(c),d=new a.TextNode("","textLineBlock",c.clone(),null),q.addChild(d)):"formula"===
h?(c=c.clone(),b.push(c),m=new a.TextNode("","formula",c.clone(),null),d.addChild(m),d=m):"subIndex"===h||"superIndex"===h?z?(c=c.clone(),b.push(c),m=new a.TextNode("",h,c.clone(),null),d.addChild(m),d=m):d.addChild(new a.TextNode("subIndex"===h?"_":"^","text",c.clone(),null)):"radical"===h?z&&(m=new a.TextNode("","radical",c.clone(),null),d.addChild(m),d=m,c=c.clone(),b.push(c),m=new a.TextNode("","index",c.clone(),null),d.addChild(m),d=m,h="index"):"index"===h?z&&(b.pop(),c=b[b.length-1],m=new a.TextNode("",
"radicand",c.clone(),null),d.addChild(m),d=m,h="radicand"):"sum"===h||"integral"===h||"limit"===h||"prod"===h?z&&(m=new a.TextNode("",h,c.clone(),null),d.addChild(m),d=m,c=c.clone(),b.push(c),m=new a.TextNode("","from",c.clone(),null),d.addChild(m),d=m,h="from",n[n.length-1]=h):"from"===h?z&&(m=new a.TextNode("","to",c.clone(),null),d.addChild(m),d=m,h="to",n[n.length-1]=h):"to"===h?z&&(b.pop(),c=b[b.length-1],m=new a.TextNode("","what",c.clone(),null),d.addChild(m),d=m,h="what",n[n.length-1]=h):
"numerator"===h?z&&(m=new a.TextNode("","fraction",c.clone(),null),d.addChild(m),d=m,c=c.clone(),b.push(c),m=new a.TextNode("","numerator",c.clone(),null),d.addChild(m),d=m,h="numerator"):"denominator"===h&&(m=new a.TextNode("",h,c.clone(),null),d.addChild(m),d=m):"close"===k[u].type&&"}"===k[u].value&&void 0!==h&&("bold"===h||"italic"===h||"overline"===h||"underline"===h||"color_text"===h||"color"===h||"text_size_text"===h||"text_size"===h||"sansserif"===h||"serif"===h||"monospace"===h?(b.pop(),
c=b[b.length-1],n.pop(),h=n[n.length-1]):"color_parameter"===h?h="color_text":"text_size_parameter"===h?h="text_size_text":"center"===h||"left"===h||"right"===h||"justify"===h?(b.pop(),c=b[b.length-1],n.pop(),h=n[n.length-1],k[u+1]&&"command"===k[u+1].type&&"newline"===k[u+1].value?d=q:(d=new a.TextNode("","textLineBlock",c.clone(),null),q.addChild(d))):"formula"===d.nodeType?(z=!1,b.pop(),c=b[b.length-1],n.pop(),h=n[n.length-1],d=d.parent):"subIndex"===d.nodeType||"superIndex"===d.nodeType?z&&(b.pop(),
c=b[b.length-1],n.pop(),h=n[n.length-1],d=d.parent):"index"===d.nodeType?d=d.parent:"radicand"===d.nodeType?(n.pop(),h=n[n.length-1],d=d.parent.parent):"from"===d.nodeType?d=d.parent:"to"===d.nodeType?d=d.parent:"what"===d.nodeType?(n.pop(),h=n[n.length-1],d=d.parent.parent):"numerator"===d.nodeType?(h="denominator",d=d.parent):"denominator"===d.nodeType&&(b.pop(),c=b[b.length-1],n.pop(),h=n[n.length-1],d=d.parent.parent));var y,A,x=null,H=[];q.children.forEach(function(J){for(var C=0,G=J.children.length;C<
G-1;C++)y=J.children[C],A=J.children[C+1],"text"===y.nodeType&&"text"===A.nodeType&&y.style.equals(A.style)?(null===x&&(x=y,m=y.clone(),x.changeNodeType("word"),x.value="___"+m.value,x.addChild(m)),m=A.clone(),x.addChild(m),H.push(A),x.value+=m.value):x=null});H.forEach(function(J){J.parent.removeChild(J)});q.normalize();q.adjustFontSize();return q}}a.DescarTeXParser=p;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var p;class k{constructor(f){this.size=20;this.family="Arimo";this.overline=this.underline=this.bold=this.italic=!1;this.border=this.color=null;this.align="left";f=f||{};this.set(f)}clone(){return new k(Object.assign({},this))}set(f){Object.assign(this,f)}equals(f){var v=!0,q;for(q in this)this.hasOwnProperty(q)&&(v=v&&this[q]===f[q]);return v}toString(f){/arial|sansserif/i.test(this.family)?p=a.sansserif_font:/times|serif/i.test(this.family)?p=f?a.math_font:
a.serif_font:/courier|monospaced/i.test(this.family)&&(p=a.monospace_font);return((this.bold?"bold":"")+" "+(this.italic?"italic":"")+" "+this.size+"px "+p).trim()}}a.TextStyle=k;return a}(descartesJS||{});
descartesJS=function(a){function p(c,b){for(var g=0,r=0;r<b;r++)g+=c[r];return g}function k(c){var b={ascent:0,descent:0,h:0,w:0,x:0,y:0,offsetX:0,offsetY:0,marginX:0,marginY:0,paddingX:0,paddingY:0};if(""==c.trim())return b;var g=parseInt(c.match(/(\d+\.*)+px/)[0]);c=c.match("sansserif")?"sansserif":c.match("serif")?"serif":"monospace";b.ascent=Math.ceil((h[c].ascent+25)*g/h[c].unitsPerEm);b.descent=Math.ceil(Math.abs((h[c].descent-25)*g/h[c].unitsPerEm));b.h=b.ascent+b.descent;return b}if(a.loadLib)return a;
var f=!1,v="#000000",q=2,d=!1;(new Path2D("m 759,1 c -8,0 -15,4 -20,14 L 325,878 153,500 c -5,-11 -11,-14 -17,-9 L 2,596 c -5,4 17,30 22,26 l 65,-47 193,422 c 3,6 27,6 32,-4 L 773,40 V 1 Z")).svgData="m 759,1 c -8,0 -15,4 -20,14 L 325,878 153,500 c -5,-11 -11,-14 -17,-9 L 2,596 c -5,4 17,30 22,26 l 65,-47 193,422 c 3,6 27,6 32,-4 L 773,40 V 1 Z";(new Path2D("M 780,707 H 750 C 728,805 695,872 585,872 H 180 L 509,447 225,65 h 313 c 130,0 167,49 188,181 h 30 V 0 H 25 L 384,500 0,1000 h 729 z")).svgData=
"M 780,707 H 750 C 728,805 695,872 585,872 H 180 L 509,447 225,65 h 313 c 130,0 167,49 188,181 h 30 V 0 H 25 L 384,500 0,1000 h 729 z";(new Path2D("m 150,828 c -21,88 -42,144 -83,144 -6,0 -9,-2 -9,-6 0,-9 15,-8 15,-34 0,-14 -13,-22 -27,-22 -24,0 -45,22 -45,51 0,20 21,39 56,39 97,0 141,-105 159,-176 L 375,181 c 23,-91 45,-154 89,-153 6,0 9,2 9,6 0,7 -15,13 -15,35 0,14 13,20 27,20 24,0 45,-22 45,-51 C 530,18 508,0 473,0 368,0 326,120 309,190 Z")).svgData="m 150,828 c -21,88 -42,144 -83,144 -6,0 -9,-2 -9,-6 0,-9 15,-8 15,-34 0,-14 -13,-22 -27,-22 -24,0 -45,22 -45,51 0,20 21,39 56,39 97,0 141,-105 159,-176 L 375,181 c 23,-91 45,-154 89,-153 6,0 9,2 9,6 0,7 -15,13 -15,35 0,14 13,20 27,20 24,0 45,-22 45,-51 C 530,18 508,0 473,0 368,0 326,120 309,190 Z";
(new Path2D("m 876.3561,999.59384 v -27.38613 h -17.60537 c -64.55302,0 -96.82952,-41.07919 -96.82952,-124.21565 V 144.75542 c 0,-83.136456 27.38612,-117.369116 114.43489,-117.369116 V 1.7633057e-4 H 1.184082e-5 V 27.386304 H 16.627304 c 60.640711,0 98.785676,24.4519 98.785676,121.281426 v 716.9297 c 0,71.39954 -31.298433,106.61028 -96.829524,106.61028 H 1.184082e-5 v 27.38613 H 359.93198 v -27.38613 h -30.32036 c -64.55302,0 -86.07069,-40.10112 -86.07069,-131.06218 V 64.553192 H 633.79325 V 841.14553 c 0,75.31185 -17.60537,131.06218 -86.07068,131.06218 h -31.29844 v 27.38613 z")).svgData=
"m 876.3561,999.59384 v -27.38613 h -17.60537 c -64.55302,0 -96.82952,-41.07919 -96.82952,-124.21565 V 144.75542 c 0,-83.136456 27.38612,-117.369116 114.43489,-117.369116 V 1.7633057e-4 H 1.184082e-5 V 27.386304 H 16.627304 c 60.640711,0 98.785676,24.4519 98.785676,121.281426 v 716.9297 c 0,71.39954 -31.298433,106.61028 -96.829524,106.61028 H 1.184082e-5 v 27.38613 H 359.93198 v -27.38613 h -30.32036 c -64.55302,0 -86.07069,-40.10112 -86.07069,-131.06218 V 64.553192 H 633.79325 V 841.14553 c 0,75.31185 -17.60537,131.06218 -86.07068,131.06218 h -31.29844 v 27.38613 z";
class n{constructor(c,b,g,r){this.type="rtfNode";this.evaluator=r;this.parent=null;this.children=[];this.metrics={ascent:0,descent:0,h:0,w:0,x:0,y:0,offsetX:0,offsetY:0,marginX:0,marginY:0,paddingX:0,paddingY:0};this.value=c;this.style=g;this.changeNodeType(b);this.drawBorder=a.in_editor?this.drawBorderSpecial:function(){}}changeNodeType(c){this.nodeType=c;this.draw=null;switch(this.nodeType){case "textBlock":this.draw=this.drawTextBlock;break;case "textLineBlock":this.draw=this.drawTextLineBlock;
break;case "formula":this.draw=this.drawFormula;break;case "superIndex":this.draw=this.drawSuperIndex;break;case "subIndex":this.draw=this.drawSubIndex;break;case "dynamicText":this.draw=this.drawDynamicText;this.decimal_symbol=this.evaluator.parent.decimal_symbol;break;case "fraction":this.draw=this.drawFraction;break;case "numerator":case "denominator":this.draw=this.drawNumDen;break;case "radical":this.draw=this.drawRadical;break;case "limit":this.draw=this.drawLimit;break;case "integral":this.draw=
this.drawIntegral;break;case "prod":this.draw=this.drawProd;break;case "sum":this.draw=this.drawSum;break;case "matrix":this.draw=this.drawMatrix;break;case "defparts":this.draw=this.drawDefparts;break;case "text":case "newLine":case "mathSymbol":this.draw=this.drawText;break;case "space":this.draw=this.drawSpace;break;case "word":this.draw=this.drawWord;break;case "hyperlink":this.draw=this.drawHyperlink;break;case "index":case "radicand":case "from":case "to":case "what":case "element":this.draw=
this.drawGenericBlock;break;case "componentNumCtrl":this.draw=this.drawComponentNumCtrl;break;case "componentSpace":this.draw=this.drawComponentSpace}}clone(){for(var c=new n(this.value,this.nodeType,this.style.clone()),b=0,g=this.children.length;b<g;b++)c.addChild(this.children[b].clone());return c}toStr(){for(var c=this.value,b=0,g=this.children.length;b<g;b++)c+=" "+this.children[b].toStr();return c}stringify(){var c='{"NT":"'+(this.nodeType+'",');c+='"V":"'+(this.value||"")+'",';c+='"C":[';for(var b=
0,g=this.children.length;b<g;b++)c+=this.children[b].stringify()+(b==g-1?"":",");c=c+'],"S":'+JSON.stringify(this.style);return c+"}"}addChild(c,b){b&&null!==c.parent&&c.parent.removeChild(c);c.parent=this;this.children.push(c)}removeChild(c){var b=this.children.indexOf(c);-1!==b&&(c.parent=null,this.children.splice(b,1))}getFirstTextNode(){for(var c=this;0<c.children.length;)c=c.children[0];return c}getLastTextNode(){for(var c=this;0<c.children.length;)c=c.children[c.children.length-1];return c}nextSibling(){if(this.parent)for(var c=
null,b=0,g=this.parent.children.length;b<g;b++){if(c)return this.parent.children[b];this.parent.children[b]===this&&(c=!0)}return null}prevSibling(){if(this.parent)for(var c=0,b=this.parent.children.length-1;c<b;c++)if(this.parent.children[c+1]===this)return this.parent.children[c];return null}queryAll(c){var b=[];"string"===typeof c&&(c=new RegExp(c));for(var g=0,r=this.children.length;g<r;g++)b=b.concat(this.children[g].queryAll(c));this.nodeType.match(c)&&b.push(this);return b}insertBefore(c,b){c=
this.children.indexOf(c);-1!==c&&(b.parent=this,this.children.splice(c,0,b))}insertAfter(c,b){c=this.children.indexOf(c);-1!==c&&(b.parent=this,this.children.splice(c+1,0,b))}normalize(){for(var c=this.queryAll(/textLineBlock|formula|numerator|denominator|superIndex|subIndex|index|subIndex|radicand|from|to|what|element/),b=0,g=c.length;b<g;b++)0===c[b].children.length&&c[b].addChild(new n("","text",c[b].style));c=this.queryAll(/formula|fraction|superIndex|subIndex|radical|sum|integral|prod|limit|matrix|defparts|dynamicText|componentNumCtrl|componentSpace/);
b=0;for(g=c.length;b<g;b++){var r=c[b];(null===r.prevSibling()||null!==r.prevSibling()&&"text"!==r.prevSibling().nodeType)&&r.parent.insertBefore(r,new n("","text",r.parent.style));(null===r.nextSibling()||null!==r.nextSibling()&&"text"!==r.nextSibling().nodeType)&&r.parent.insertAfter(r,new n("","text",r.parent.style))}return this}removeEmptyText(){for(var c=this.queryAll(/text/),b=0,g=c.length;b<g;b++)""===c[b].value&&c[b].parent&&c[b].parent.removeChild(c[b])}adjustFontSize(c){var b=this.style.size;
"formula"===this.nodeType&&(c=!0);for(var g=0,r=this.children.length;g<r;g++)"text"===this.children[g].nodeType&&c?(this.children[g].style.size=b,this.children[g].styleString=this.children[g].style.toString()):"index"===this.children[g].nodeType?(this.children[g].style.size=Math.max(parseInt(b-.5*b),8),this.children[g].styleString=this.children[g].style.toString(),this.children[g].adjustFontSize(!0)):"to"===this.children[g].nodeType||"from"===this.children[g].nodeType?(this.children[g].style.size=
Math.max(parseInt(b-.2*b),8),this.children[g].styleString=this.children[g].style.toString(),this.children[g].adjustFontSize(!0)):"numerator"===this.children[g].nodeType||"denominator"===this.children[g].nodeType?(this.children[g].style.size=Math.max(parseInt(b-.1*b),8),this.children[g].styleString=this.children[g].style.toString(),this.children[g].adjustFontSize(!0)):"subIndex"===this.children[g].nodeType||"superIndex"===this.children[g].nodeType?(this.children[g].style.size=Math.max(parseInt(b-.33*
b),8),this.children[g].styleString=this.children[g].style.toString(),this.children[g].adjustFontSize(!0)):(c&&(this.children[g].style.size=b,this.children[g].styleString=this.children[g].style.toString()),this.children[g].adjustFontSize(c))}propagateStyle(c,b){this.style[c]=b;this.styleString=this.style.toString();for(var g=0,r=this.children.length;g<r;g++)this.children[g].propagateStyle(c,b)}update(c,b,g,r,l,m,z,u){q=g;d=r;v=z;this.metrics.w=this.metrics.h=0;z=b;if(20<=u)for(g=0;g<this.children.length;g++)this.children[g].breakLines(u);
g=0;for(r=this.children.length;g<r;g++){var e=this.children[g];e.updateLine();e.metrics.offsetX=c;e.metrics.y=b;b+=parseInt(e.metrics.ascent+.5);e.metrics.offsetY=b;l=parseInt(e.metrics.descent+.5)+parseInt(1.5+.05*e.style.size);b+=l;this.metrics.h+=e.metrics.h;this.metrics.w=Math.max(this.metrics.w,e.metrics.w)}b=z;m=m||"";m.match("right")?c-=this.metrics.w:m.match("_center")&&(c-=this.metrics.w/2);m.match("bottom")?b-=this.metrics.h:m.match("center_")&&(b-=this.metrics.h/2);m=this.children;g=0;
for(r=m.length;g<r;g++)"left"===m[g].style.align?m[g].metrics.offsetX=c:"right"===m[g].style.align?m[g].metrics.offsetX=c+this.metrics.w-m[g].metrics.w:"center"===m[g].style.align?m[g].metrics.offsetX=c+(this.metrics.w-m[g].metrics.w)/2:"justify"===m[g].style.align&&20<=u&&(l=g<r-1?m[g+1].value:null,m[g].metrics.offsetX=c,"wrap"===l&&m[g].justifyAux(u)),m[g].metrics.y=b,b+=parseInt(m[g].metrics.ascent+.5),m[g].metrics.offsetY=b,l=parseInt(m[g].metrics.descent+.5)+parseInt(1.5+.05*m[g].style.size),
b+=l}breakLines(c){for(var b,g=0,r=!1,l=[],m=0,z=this.children.length;m<z;m++)b=this.children[m],r?l.push(b):("text"===b.nodeType||"space"===b.nodeType?(a.ctx.font=b.style.toString(),b.metrics.w=a.ctx.measureText(b.value).width):"word"===b.nodeType?b.updateLine():"formula"===b.nodeType&&b.updateFormula(),g+=b.metrics.w,g>c&&"space"!==b.nodeType&&0<m&&(r=!0,l.push(b)));if(0<l.length)for(c=new n("wrap","textLineBlock",this.style.clone(),null),this.parent.insertAfter(this,c),m=0,z=l.length;m<z;m++)l[m].parent&&
l[m].parent.removeChild(l[m]),c.addChild(l[m])}updateLine(c){var b=this;if("textLineBlock"===this.nodeType||"word"===this.nodeType){this.metrics.w=0;this.metrics.ascent=0;for(var g=this.metrics.descent=0,r=this.children,l,m=0,z=r.length;m<z;m++){l=r[m];if("text"===l.nodeType){a.ctx.font=l.style.toString();var u=""!==l.value?l.value:a.in_editor?"\u200a":"";l.metrics=k(a.ctx.font);l.metrics.w=a.ctx.measureText(u).width;l.metrics.offsetX=g;Object.defineProperties(l.metrics,{x:{get:function(){return b.metrics.offsetX+
this.offsetX}},y:{get:function(){return b.metrics.offsetY+this.offsetY}}})}"space"===l.nodeType?(a.ctx.font=l.style.toString(),l.metrics=k(a.ctx.font),l.metrics.w=m===z-1?0:c?c:a.ctx.measureText(" ").width,l.metrics.offsetX=g,Object.defineProperties(l.metrics,{x:{get:function(){return b.metrics.offsetX+this.offsetX}},y:{get:function(){return b.metrics.offsetY+this.offsetY}}})):"word"===l.nodeType&&(l.updateLine(),l.metrics.offsetX_aux=g,Object.defineProperties(l.metrics,{offsetX:{get:function(){return b.metrics.offsetX+
this.offsetX_aux}},offsetY:{get:function(){return b.metrics.offsetY}}}));"hyperlink"===l.nodeType&&(a.ctx.font=l.styleString,u=""!==l.value?l.value:a.in_editor?"\u200a":"",l.metrics=k(a.ctx.font),l.metrics.w=a.ctx.measureText(u).width,l.metrics.offsetX=g,Object.defineProperties(l.metrics,{x:{get:function(){return b.metrics.offsetX+this.offsetX}},y:{get:function(){return b.metrics.offsetY}}}),l.clickCatcher||(l.clickCatcher=a.newHTML("div",{style:`position:absolute;width:${l.metrics.w}px;height:${l.metrics.h}px;cursor:pointer;`}),
l.clickCatcher.rtfNode=l,l.clickCatcher.action=new a.OpenURL(this.evaluator.parent,l.URL),l.clickCatcher.addEventListener("click",function(e){this.rtfNode.click=!0;this.action.execute();this.rtfNode.draw(this.rtfNode.ctx)})));"componentNumCtrl"===l.nodeType&&(l.componentNumCtrl=this.evaluator.parent.getControlByCId(l.value),a.ctx.font=l.styleString,l.metrics=k(a.ctx.font),l.metrics.w=l.componentNumCtrl.w,l.metrics.h=l.componentNumCtrl.h,l.metrics.offsetX=g,Object.defineProperties(l.metrics,{x:{get:function(){return b.metrics.offsetX+
this.offsetX}},y:{get:function(){return b.metrics.offsetY}}}));"componentSpace"===l.nodeType?(l.componentSpace=this.evaluator.parent.getSpaceByCId(l.value),a.ctx.font=l.styleString,l.metrics=k(a.ctx.font),l.metrics.w=l.componentSpace.w,l.metrics.h=l.componentSpace.h,l.metrics.offsetX=g,Object.defineProperties(l.metrics,{x:{get:function(){return b.metrics.offsetX+this.offsetX}},y:{get:function(){return b.metrics.offsetY}}})):"formula"===l.nodeType&&(l.updateFormula(),l.metrics.marginX=l.metrics.marginY=
l.metrics.paddingX=l.metrics.paddingY=0,l.metrics.offsetX_aux=g,Object.defineProperties(l.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return b.metrics.offsetX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return b.metrics.offsetY}}}),l.metrics.w+=2*l.metrics.paddingX,l.metrics.ascent+=l.metrics.paddingY,l.metrics.descent+=l.metrics.paddingY,l.metrics.h+=2*l.metrics.paddingY,g+=2*l.metrics.marginX);this.metrics.w+=l.metrics.w+
2*l.metrics.marginX;this.metrics.ascent=Math.max(this.metrics.ascent,l.metrics.ascent);this.metrics.descent=Math.max(this.metrics.descent,l.metrics.descent);g+=l.metrics.w}this.metrics.h=this.metrics.ascent+this.metrics.descent}}updateFormula(){var c=this;this.metrics={ascent:0,descent:0,h:0,w:0,x:0,y:0,offsetX:0,offsetY:0,marginX:0,marginY:0,paddingX:0,paddingY:0};for(var b=this.children,g,r=0,l={metrics:{ascent:0,descent:0,h:0,w:0,x:0,y:0,offsetX:0,offsetY:0,marginX:0,marginY:0,paddingX:0,paddingY:0}},
m=0,z=b.length;m<z;m++){g=b[m];if("text"===g.nodeType){a.ctx.font=g.style.toString(!0);var u=""!==g.value?g.value:a.in_editor?"\u200a":"";g.metrics=k(a.ctx.font);g.metrics.w=a.ctx.measureText(u).width;g.metrics.offsetX=r;Object.defineProperties(g.metrics,{x:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.offsetX}},y:{get:function(){return c.metrics.offsetY}}});r+=c.metrics.marginX}else if("dynamicText"===g.nodeType){u=void 0===g.decimals?q:g.evaluator.eval(g.decimals);var e=void 0===
g.fixed?d:g.fixed,w=g.evaluator.eval(g.value);parseFloat(w).toString()===w.toString()&&(w=e?parseFloat(w).toFixed(u):a.removeNeedlessDecimals(parseFloat(w).toFixed(u)),w=(""+w).replace(".",g.decimal_symbol));g.evalValue=w;a.ctx.font=g.style.toString(!0);g.metrics=k(a.ctx.font);g.metrics.marginX=0;g.metrics.paddingX=0;g.metrics.w=a.ctx.measureText(w).width+2*g.metrics.paddingX;g.metrics.offsetX_aux=r;Object.defineProperties(g.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},
offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.offsetX_aux+this.marginX}},offsetY:{get:function(){return c.metrics.offsetY}}});r+=2*g.metrics.marginX}if("superIndex"===g.nodeType)u=g,u.updateFormula(),u.metrics.marginX=0,u.metrics.paddingX=0,u.metrics.paddingY=0,u.metrics.offsetX_aux=r,u.metrics.prevChild=l,Object.defineProperties(u.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+
this.offsetX_aux+this.marginX}},offsetY:{get:function(){return c.metrics.offsetY+this.ascent+(this.prevChild.metrics.descent-this.prevChild.metrics.ascent)/2-this.h}}}),u.metrics.w+=2*u.metrics.paddingX,u.metrics.ascent+=u.metrics.paddingY,u.metrics.descent+=u.metrics.paddingY,u.metrics.h+=2*u.metrics.paddingY,u.metrics.tmp_ascent=u.metrics.h+(u.metrics.prevChild.metrics.ascent-u.metrics.prevChild.metrics.descent)/2,r+=2*u.metrics.marginX;else if("subIndex"===g.nodeType)u=g,u.updateFormula(),u.metrics.marginX=
0,u.metrics.paddingX=0,u.metrics.paddingY=0,u.metrics.offsetX_aux=r,u.metrics.prevChild=l,Object.defineProperties(u.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY+this.ascent+(this.prevChild.metrics.descent-this.prevChild.metrics.ascent)/2}}}),u.metrics.w+=u.metrics.paddingX,u.metrics.ascent+=u.metrics.paddingY,u.metrics.descent+=
u.metrics.paddingY,u.metrics.h+=2*u.metrics.paddingY,this.metrics.descent=u.metrics.ascent+(u.metrics.prevChild.metrics.descent-u.metrics.prevChild.metrics.ascent)/2+u.metrics.descent,r+=u.metrics.marginX;else if("fraction"===g.nodeType){e=g;e.updateFormula();u=e.children;w=u[0];u=u[1];e.metrics.marginX=parseInt(.5+.075*this.style.size);e.metrics.paddingX=0;e.metrics.paddingY=0;var B=Math.max(w.metrics.w,u.metrics.w)+2*e.metrics.paddingX;e.metrics.prevChild=l;e.metrics.offsetX_aux=r;var y=parseInt(-l.metrics.descent+
4*l.metrics.h/9);Object.defineProperties(e.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY+y}},offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY-y}}});Object.defineProperties(w.metrics,{parent:{value:e},maxWidth:{value:B},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+parseInt((this.maxWidth-
this.w)/2)}},offsetY:{get:function(){return this.parent.metrics.offsetY-this.descent-this.parent.metrics.paddingY}}});Object.defineProperties(u.metrics,{parent:{value:e},maxWidth:{value:B},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+parseInt((this.maxWidth-this.w)/2)}},offsetY:{get:function(){return this.parent.metrics.offsetY+this.ascent+this.parent.metrics.paddingY}}});e.metrics.w=B;e.metrics.ascent=w.metrics.h+
y+2*e.metrics.paddingY;e.metrics.descent=u.metrics.h-y+2*e.metrics.paddingY;e.metrics.h=w.metrics.h+u.metrics.h+4*e.metrics.paddingY;r+=2*e.metrics.marginX}else if("radical"===g.nodeType){l=g;l.updateFormula();u=l.children;e=u[0];var A=u[1];l.metrics.marginX=parseInt(1.5+.075*this.style.size);l.metrics.paddingX=parseInt(1.5+.075*this.style.size);l.metrics.paddingY=parseInt(1.5+.05*this.style.size);l.metrics.offsetX_aux=r;Object.defineProperties(l.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},
offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY}}});u=l.style.size;l.radicalSign={w:u,scaleX:u/722,scaleY:A.metrics.h/1E3};w=parseInt(e.metrics.w-2*l.radicalSign.w/3);Object.defineProperties(l.radicalSign,{parent:{value:l},displaceIndex:{value:w},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+Math.max(this.displaceIndex,0)}},y:{get:function(){return c.metrics.offsetY-
A.metrics.ascent}}});Object.defineProperties(e.metrics,{parent:{value:l},displaceIndex:{value:w},fontSize:{value:u},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+Math.max(this.displaceIndex,0)-this.displaceIndex}},offsetY:{get:function(){return c.metrics.offsetY-this.descent-2*this.fontSize/5}}});Object.defineProperties(A.metrics,{parent:{value:l},displaceIndex:{value:w},x:{get:function(){return this.offsetX}},
y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+this.parent.radicalSign.w+Math.max(this.displaceIndex,0)}},offsetY:{get:function(){return c.metrics.offsetY}}});w=e.metrics.w<2*l.radicalSign.w/3?l.radicalSign.w:parseInt(e.metrics.w+l.radicalSign.w/3);l.metrics.w=w+2*l.metrics.paddingX+A.metrics.w;l.metrics.ascent=Math.max(A.metrics.ascent,e.metrics.h+2*u/5)+l.metrics.paddingY;l.metrics.descent=A.metrics.descent+l.metrics.paddingY;
l.metrics.h=l.metrics.ascent+l.metrics.descent;r+=2*l.metrics.marginX}else if("sum"===g.nodeType){e=g;e.updateFormula();u=e.children;w=u[0];B=u[1];var x=u[2];e.metrics.marginX=parseInt(1.5+.075*this.style.size);e.metrics.paddingX=parseInt(1.5+.075*this.style.size);e.metrics.paddingY=parseInt(1.5+.05*this.style.size);e.metrics.offsetX_aux=r;Object.defineProperties(e.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+
c.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY}}});a.ctx.font=g.style.toString();var H=k(a.ctx.font);l=parseInt(1.2*H.h);u=parseInt(.5+780*l/1E3);e.sigmaSign={w:u,h:l,scale:l/1E3};var J=Math.max(B.metrics.w,w.metrics.w,e.sigmaSign.w);e.sigmaSign.parent=e;Object.defineProperties(e.sigmaSign,{sumWidth:{value:J},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.sumWidth-this.w)/2)}},y:{get:function(){return c.metrics.offsetY+
H.descent-(this.h+H.h)/2}}});u=H.descent-B.metrics.descent-(l+H.h)/2-e.metrics.paddingY;Object.defineProperties(B.metrics,{parent:{value:e},sumWidth:{value:J},newBaselineTo:{value:u},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.sumWidth-this.w)/2)}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaselineTo}}});l=w.metrics.ascent+H.descent+(l-H.h)/2+e.metrics.paddingY;
Object.defineProperties(w.metrics,{parent:{value:e},sumWidth:{value:J},newBaselineFrom:{value:l},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.sumWidth-this.w)/2)}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaselineFrom}}});Object.defineProperties(x.metrics,{parent:{value:e},sumWidth:{value:J},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},
offsetX:{get:function(){return this.parent.metrics.offsetX+2*this.parent.metrics.paddingX+this.sumWidth}},offsetY:{get:function(){return c.metrics.offsetY}}});e.metrics.w=J+x.metrics.w+3*e.metrics.paddingX;e.metrics.ascent=Math.max(x.metrics.ascent,-u+B.metrics.ascent)+e.metrics.paddingY;e.metrics.descent=Math.max(x.metrics.descent,l+w.metrics.descent)+e.metrics.paddingY;e.metrics.h=e.metrics.ascent+e.metrics.descent;r+=2*e.metrics.marginX}else if("integral"===g.nodeType){e=g;e.updateFormula();u=
e.children;w=u[0];B=u[1];x=u[2];e.metrics.marginX=parseInt(1.5+.075*this.style.size);e.metrics.paddingX=parseInt(1.5+.075*this.style.size);e.metrics.paddingY=parseInt(1.5+.05*this.style.size);e.metrics.offsetX_aux=r;Object.defineProperties(e.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY}}});a.ctx.font=g.style.toString();
H=k(a.ctx.font);J=parseInt(1.2*H.h);var C=parseInt(10.5+529*J/1E3);e.sign={w:C,h:J,scale:J/1E3};e.sign.parent=e;Object.defineProperties(e.sign,{x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX}},y:{get:function(){return c.metrics.offsetY+H.descent-(this.h+H.h)/2}}});u=H.descent-(J+H.h)/2-B.metrics.descent+J/3;Object.defineProperties(B.metrics,{parent:{value:e},integralWidth:{value:C},newBaselineTo:{value:u},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},
offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt(4*this.integralWidth/5)}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaselineTo}}});l=H.descent+w.metrics.ascent/2;Object.defineProperties(w.metrics,{parent:{value:e},integralWidth:{value:C},newBaselineFrom:{value:l},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt(2*
this.integralWidth/5)}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaselineFrom}}});C=Math.max(parseInt(3*C/5)+B.metrics.w,parseInt(2*C/5+w.metrics.w))+e.metrics.paddingX;Object.defineProperties(x.metrics,{parent:{value:e},whatDisplace:{value:C},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+this.whatDisplace}},offsetY:{get:function(){return c.metrics.offsetY}}});
e.metrics.w=C+x.metrics.w+2*e.metrics.paddingX;e.metrics.ascent=Math.max(x.metrics.ascent,-u+B.metrics.ascent)+e.metrics.paddingY;e.metrics.descent=Math.max(x.metrics.descent,l+w.metrics.descent,J-e.metrics.ascent)+e.metrics.paddingY;e.metrics.h=Math.max(e.metrics.ascent+e.metrics.descent,J);r+=2*e.metrics.marginX}else if("prod"===g.nodeType)e=g,e.updateFormula(),u=e.children,w=u[0],B=u[1],x=u[2],e.metrics.marginX=parseInt(1.5+.075*this.style.size),e.metrics.paddingX=parseInt(1.5+.075*this.style.size),
e.metrics.paddingY=parseInt(1.5+.05*this.style.size),e.metrics.offsetX_aux=r,Object.defineProperties(e.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY}}}),a.ctx.font=g.style.toString(),H=k(a.ctx.font),l=parseInt(1.2*H.h),u=parseInt(.5+876*l/1E3),e.piSign={w:u,h:l,scale:l/1E3},J=Math.max(B.metrics.w,w.metrics.w,
e.piSign.w),e.piSign.parent=e,Object.defineProperties(e.piSign,{prodWidth:{value:J},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.prodWidth-this.w)/2)}},y:{get:function(){return c.metrics.offsetY+H.descent-(this.h+H.h)/2}}}),u=H.descent-B.metrics.descent-(l+H.h)/2-e.metrics.paddingY,Object.defineProperties(B.metrics,{parent:{value:e},prodWidth:{value:J},newBaselineTo:{value:u},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},
offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.prodWidth-this.w)/2)}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaselineTo}}}),l=w.metrics.ascent+H.descent+(l-H.h)/2+e.metrics.paddingY,Object.defineProperties(w.metrics,{parent:{value:e},prodWidth:{value:J},newBaselineFrom:{value:l},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+
parseInt((this.prodWidth-this.w)/2)}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaselineFrom}}}),Object.defineProperties(x.metrics,{parent:{value:e},prodWidth:{value:J},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+2*this.parent.metrics.paddingX+this.prodWidth}},offsetY:{get:function(){return c.metrics.offsetY}}}),e.metrics.w=J+x.metrics.w+3*e.metrics.paddingX,e.metrics.ascent=Math.max(x.metrics.ascent,
-u+B.metrics.ascent)+e.metrics.paddingY,e.metrics.descent=Math.max(x.metrics.descent,l+w.metrics.descent)+e.metrics.paddingY,e.metrics.h=e.metrics.ascent+e.metrics.descent,r+=2*e.metrics.marginX;else if("limit"===g.nodeType){l=g;l.updateFormula();u=l.children;var G=u[0];e=u[1];u=u[2];l.metrics.marginX=parseInt(1.5+.075*this.style.size);l.metrics.paddingX=parseInt(1.5+.075*this.style.size);l.metrics.paddingY=parseInt(1.5+.05*this.style.size);l.metrics.offsetX_aux=r;Object.defineProperties(l.metrics,
{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY}}});a.ctx.font=g.style.toString();H=k(a.ctx.font);w=parseInt(.5+a.ctx.measureText("l\u00edm").width);B=parseInt(.5+a.ctx.measureText("\u2192").width);x=Math.max(w,G.metrics.w+B+e.metrics.w);l.limitText={parent:l};Object.defineProperties(l.limitText,{limitWidth:{value:x},
limitTextWidth:{value:w},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+(this.limitWidth-this.limitTextWidth)/2}}});w=H.descent+Math.max(G.metrics.ascent,e.metrics.ascent,2*H.ascent/3)+l.metrics.paddingY;l.limitArrow={parent:l};Object.defineProperties(l.limitArrow,{newBaseline:{value:w},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+G.metrics.w}},y:{get:function(){return c.metrics.offsetY+this.newBaseline}}});Object.defineProperties(G.metrics,
{parent:{value:l},newBaseline:{value:w},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaseline}}});Object.defineProperties(e.metrics,{parent:{value:l},arrowWidth:{value:B},newBaseline:{value:w},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+
this.parent.metrics.paddingX+G.metrics.w+this.arrowWidth}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaseline}}});Object.defineProperties(u.metrics,{parent:{value:l},limitWidth:{value:x},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+2*this.parent.metrics.paddingX+this.limitWidth}},offsetY:{get:function(){return c.metrics.offsetY}}});l.metrics.w=x+u.metrics.w+3*l.metrics.paddingX;l.metrics.ascent=
Math.max(u.metrics.ascent,H.ascent)+l.metrics.paddingY;B=0;u=Math.max(G.metrics.descent,e.metrics.descent,u.metrics.descent);if(0!=G.metrics.h||0!=e.metrics.h)B=w,u=Math.max(G.metrics.descent,e.metrics.descent,u-B);l.metrics.descent=B+u+l.metrics.paddingY;l.metrics.h=l.metrics.ascent+l.metrics.descent;r+=2*l.metrics.marginX}else if("matrix"===g.nodeType){w=g;w.updateFormula();u=w.children;B=w.rows;x=w.columns;w.metrics.marginX=parseInt(1.5+.075*this.style.size);w.metrics.paddingX=parseInt(5+.075*
this.style.size);w.metrics.paddingY=parseInt(1.5+.05*this.style.size);w.metrics.offsetX_aux=r;Object.defineProperties(w.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY}}});a.ctx.font=g.style.toString();H=k(a.ctx.font);J=[];C=[];l=0;for(var F=B*x;l<F;l++){var P=parseInt(l/x);var E=l%x;J[P]=Math.max(J[P]||0,u[l].metrics.h);
C[E]=Math.max(C[E]||0,u[l].metrics.w)}var N=(1+x)*w.metrics.paddingX;for(l=0;l<x;l++)N+=C[l];var W=(1+B)*w.metrics.paddingY;for(l=0;l<B;l++)W+=J[l];e=H.descent-H.h/2;l=0;for(F=B*x;l<F;l++)P=parseInt(l/x),E=l%x,u[l].metrics.offsetX_aux=p(C,E)+(C[E]-u[l].metrics.w)/2+E*w.metrics.paddingX,u[l].metrics.offsetY_aux=p(J,P)+(J[P]-u[l].metrics.h)/2+(1+P)*w.metrics.paddingY,Object.defineProperties(u[l].metrics,{parent:{value:w},matrixH:{value:W},dispY:{value:e},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},
offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY-this.matrixH/2+this.ascent+this.offsetY_aux+this.dispY}}});w.metrics.w=N;w.metrics.ascent=W/2-e;w.metrics.descent=W/2+e;w.metrics.h=w.metrics.ascent+w.metrics.descent;r+=2*w.metrics.marginX}else if("defparts"===g.nodeType){w=g;w.updateFormula();u=g.children;B=g.parts;w.metrics.marginX=parseInt(1.5+.075*this.style.size);w.metrics.paddingX=parseInt(1.5+
.075*this.style.size);w.metrics.paddingY=parseInt(1.5+.05*this.style.size);w.metrics.offsetX_aux=r;Object.defineProperties(w.metrics,{parent:{value:c},x:{get:function(){return this.offsetX-2*this.marginX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+3*this.marginX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY}}});a.ctx.font=g.style.toString();H=k(a.ctx.font);x=0;J=w.metrics.paddingY;e=H.descent-H.h/2;for(l=0;l<B;l++)u[l].metrics.offsetY_aux=
J,x=Math.max(x,u[l].metrics.w),J+=u[l].metrics.h+w.metrics.paddingY,Object.defineProperties(u[l].metrics,{parent:{value:w},dispY:{value:e},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX}},offsetY:{get:function(){return c.metrics.offsetY-this.parent.metrics.defpartsH/2+this.ascent+this.offsetY_aux+this.dispY}}});w.metrics.defpartsH=J;w.metrics.w=x+4*w.metrics.paddingX;w.metrics.ascent=
J/2-e;w.metrics.descent=J/2+e;w.metrics.h=w.metrics.ascent+w.metrics.descent;r+=2*w.metrics.marginX}else if("numerator"===g.nodeType||"denominator"===g.nodeType||"index"===g.nodeType||"radicand"===g.nodeType||"from"===g.nodeType||"to"===g.nodeType||"what"===g.nodeType||"element"===g.nodeType)g.updateFormula(),g.metrics.paddingX=parseInt(1.5+.075*this.style.size),g.metrics.paddingY=parseInt(1.5+.05*this.style.size),g.metrics.ascent+=g.metrics.paddingY,g.metrics.descent+=g.metrics.paddingY,g.metrics.h=
g.metrics.ascent+g.metrics.descent,1==g.children.length&&"text"==g.children[0].nodeType&&""==g.children[0].value?(g.metrics.w=0,a.in_editor||(g.metrics.ascent=g.metrics.descent=g.metrics.h=0)):g.metrics.w+=2*g.metrics.paddingX;l=g;this.metrics.ascent=Math.max(this.metrics.ascent,g.metrics.tmp_ascent||g.metrics.ascent);this.metrics.descent=Math.max(this.metrics.descent,g.metrics.descent);this.metrics.w+=g.metrics.w+2*g.metrics.marginX;this.metrics.h=this.metrics.ascent+this.metrics.descent;r+=g.metrics.w}}justifyAux(c){for(var b=
0,g=0,r=0,l=this.children.length;r<l-1;r++)"space"===this.children[r].nodeType?b++:g+=this.children[r].metrics.w;this.updateLine((c-g)/b)}drawTextBlock(c){c.fillStyle=v;c.shadowBlur=this.style.shadowBlur;c.shadowOffsetX=this.style.shadowOffsetX;c.shadowOffsetY=this.style.shadowOffsetY;c.shadowColor=this.style.shadowColor;for(var b=0,g=this.children.length;b<g;b++)this.children[b].draw(c);c.shadowColor="transparent"}drawTextLineBlock(c){for(var b=0,g=this.children.length;b<g;b++)f=!1,this.children[b].draw(c)}drawText(c){if(""!==
this.value){var b=this.metrics.x,g=this.metrics.y;c.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:v;c.font=this.style.toString(f);c.beginPath();this.style.overline&&(c.rect(b,g-this.metrics.ascent+parseInt(1+this.style.size/25),this.metrics.w,parseInt(1+this.style.size/25)),c.fill());this.style.underline&&(c.rect(b,g+parseInt(1+this.style.size/10),this.metrics.w,parseInt(1+this.style.size/25)),c.fill());if(this.style.border){var r=c.strokeStyle;
c.lineWidth=this.style.border_size&&0<parseInt(this.style.border_size)?parseInt(this.style.border_size):1+parseInt(this.style.size/8);c.lineJoin="round";c.miterLimit=2;c.strokeStyle=this.style.border.getColor();c.strokeText(this.value,b,g);c.strokeStyle=r}c.fillText(this.value,b,g)}}drawWord(c){for(var b=0,g=this.children.length;b<g;b++)this.children[b].draw(c)}drawSpace(c){}drawDynamicText(c){var b=this.metrics.x+this.metrics.paddingX,g=this.metrics.y;c.fillStyle=null!==this.style.color?this.style.color.getColor?
this.style.color.getColor():this.style.color:v;c.font=this.style.toString(f);c.beginPath();this.style.overline&&(c.rect(b,g-this.metrics.ascent+parseInt(1+this.style.size/25),this.metrics.w,parseInt(1+this.style.size/25)),c.fill());this.style.underline&&(c.rect(b,g+parseInt(1+this.style.size/10),this.metrics.w,parseInt(1+this.style.size/25)),c.fill());c.fillText(this.evalValue,b,g);this.drawBorder(c,"blue")}drawHyperlink(c){var b=this.metrics.x,g=this.metrics.y;this.ctx=c;this.clickCatcher.parentNode||
(c.canvas.nextSibling.className?c.canvas.parentNode.insertBefore(this.clickCatcher,c.canvas.nextSibling.nextSibling):c.canvas.parentNode.insertBefore(this.clickCatcher,c.canvas.nextSibling));this.clickCatcher.style.left=b+"px";this.clickCatcher.style.top=g-this.metrics.ascent+"px";c.fillStyle="blue";this.click&&(c.fillStyle="white",c.fillRect(b,g-this.metrics.ascent,this.metrics.w,this.metrics.h),c.fillStyle="red");c.font=this.style.toString(f);c.beginPath();c.rect(b,g+parseInt(1+this.style.size/
10),this.metrics.w,parseInt(1+this.style.size/25));c.fill();c.fillText(this.value,b,g)}drawFormula(c){for(var b=0,g=this.children.length;b<g;b++)f=!0,this.children[b].draw(c);this.drawBorder(c,"blue")}drawFraction(c){c.lineWidth=5;c.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:v;c.beginPath();var b=parseInt(1+this.style.size/24);c.rect(this.metrics.x,this.metrics.offsetY-parseInt(b/2),this.metrics.w,b);c.fill();this.children[0].draw(c);this.children[1].draw(c);
this.drawBorder(c,"blue")}drawNumDen(c){for(var b=0,g=this.children.length;b<g;b++)this.children[b].draw(c);this.drawBorder(c,"blue")}drawSuperIndex(c){for(var b=0,g=this.children.length;b<g;b++)this.children[b].draw(c);this.drawBorder(c,"blue")}drawSubIndex(c){for(var b=0,g=this.children.length;b<g;b++)this.children[b].draw(c);this.drawBorder(c,"blue")}drawRadical(c){c.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:v;c.save();c.translate(this.radicalSign.x,
this.radicalSign.y);c.scale(this.radicalSign.scaleX,this.radicalSign.scaleY);this.drawRadicalSign(c);c.restore();c.beginPath();c.fillRect(this.children[1].metrics.x+2.5,this.radicalSign.y-.5,this.children[1].metrics.w-1.5,parseInt(1+this.style.size/18));for(var b=0,g=this.children.length;b<g;b++)this.children[b].draw(c);this.drawBorder(c,"blue")}drawSum(c){c.save();c.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:v;c.translate(this.sigmaSign.x,
this.sigmaSign.y);c.scale(this.sigmaSign.scale,this.sigmaSign.scale);if(this.style.border){var b=c.strokeStyle;c.lineWidth=this.style.border_size&&0<parseInt(this.style.border_size)?parseInt(this.style.border_size):1+parseInt(this.style.size/8);c.lineWidth=parseInt(c.lineWidth/this.sigmaSign.scale);c.lineJoin="round";c.miterLimit=2;c.strokeStyle=this.style.border.getColor();c.strokeStyle=b}this.drawSigmaSign(c);c.restore();b=0;for(var g=this.children.length;b<g;b++)this.children[b].draw(c);this.drawBorder(c,
"blue")}drawIntegral(c){c.save();c.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:v;c.translate(this.sign.x,this.sign.y);c.scale(this.sign.scale,this.sign.scale);this.drawIntegralSign(c);c.restore();for(var b=0,g=this.children.length;b<g;b++)this.children[b].draw(c);this.drawBorder(c,"blue")}drawProd(c){c.save();c.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:v;c.translate(this.piSign.x,
this.piSign.y);c.scale(this.piSign.scale,this.piSign.scale);this.drawProdSign(c);c.restore();for(var b=0,g=this.children.length;b<g;b++)this.children[b].draw(c);this.drawBorder(c,"blue")}drawLimit(c){for(var b=0,g=this.children.length;b<g;b++)this.children[b].draw(c);c.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:v;c.font=this.style.toString();c.fillText("l\u00edm",this.limitText.x,this.metrics.y);0!=this.children[1].metrics.h&&c.fillText("\u2192",
this.limitArrow.x,this.limitArrow.y);this.drawBorder(c,"blue")}drawMatrix(c){for(var b=0,g=this.children.length;b<g;b++)this.children[b].draw(c);g=parseInt(1.5+this.style.size/25);b=g/2;c.lineWidth=g;c.strokeStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:v;c.beginPath();if(0==this.matrix_type)c.moveTo(this.metrics.x+b+1.5*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent),c.lineTo(this.metrics.x+b,this.metrics.y+b-this.metrics.ascent),
c.lineTo(this.metrics.x+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h),c.lineTo(this.metrics.x+b+1.5*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent+this.metrics.h),c.moveTo(this.metrics.x+this.metrics.w-b-1.5*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent),c.lineTo(this.metrics.x+this.metrics.w-b,this.metrics.y+b-this.metrics.ascent),c.lineTo(this.metrics.x+this.metrics.w-b,this.metrics.y+b-this.metrics.ascent+this.metrics.h),c.lineTo(this.metrics.x+this.metrics.w-b-
1.5*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent+this.metrics.h);else if(1==this.matrix_type)c.moveTo(this.metrics.x+b+2*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent),c.bezierCurveTo(this.metrics.x-b,this.metrics.y+b-this.metrics.ascent,this.metrics.x-b,this.metrics.y+b-this.metrics.ascent+this.metrics.h,this.metrics.x+b+2*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent+this.metrics.h),c.moveTo(this.metrics.x+this.metrics.w-b-2*this.metrics.marginX,this.metrics.y+
b-this.metrics.ascent),c.bezierCurveTo(this.metrics.x+this.metrics.w+b,this.metrics.y+b-this.metrics.ascent,this.metrics.x+this.metrics.w+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h,this.metrics.x+this.metrics.w-b-2*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent+this.metrics.h);else if(2==this.matrix_type){g=3*this.metrics.marginX;var r=g/2;c.moveTo(this.metrics.x+b+g,this.metrics.y+b-this.metrics.ascent);c.bezierCurveTo(this.metrics.x+b+r,this.metrics.y+b-this.metrics.ascent,
this.metrics.x+b+r,this.metrics.y+b-this.metrics.ascent,this.metrics.x+b+r,this.metrics.y+b-this.metrics.ascent+2*this.metrics.marginX);c.lineTo(this.metrics.x+b+r,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2-5*this.metrics.marginX);c.bezierCurveTo(this.metrics.x+b+r,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+r,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2);c.bezierCurveTo(this.metrics.x+
b+r,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+r,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+r,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2+5*this.metrics.marginX);c.lineTo(this.metrics.x+b+r,this.metrics.y+b-this.metrics.ascent+this.metrics.h-2*this.metrics.marginX);c.bezierCurveTo(this.metrics.x+b+r,this.metrics.y-b-this.metrics.ascent+this.metrics.h,this.metrics.x+b+r,this.metrics.y-b-this.metrics.ascent+this.metrics.h,this.metrics.x+
b+g,this.metrics.y-b-this.metrics.ascent+this.metrics.h);c.moveTo(this.metrics.x+this.metrics.w+b-g,this.metrics.y+b-this.metrics.ascent);c.bezierCurveTo(this.metrics.x+this.metrics.w+b-r,this.metrics.y+b-this.metrics.ascent,this.metrics.x+this.metrics.w+b-r,this.metrics.y+b-this.metrics.ascent,this.metrics.x+this.metrics.w+b-r,this.metrics.y+b-this.metrics.ascent+2*this.metrics.marginX);c.lineTo(this.metrics.x+this.metrics.w+b-r,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2-5*this.metrics.marginX);
c.bezierCurveTo(this.metrics.x+this.metrics.w+b-r,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+this.metrics.w+b-r,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+this.metrics.w+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2);c.bezierCurveTo(this.metrics.x+this.metrics.w+b-r,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+this.metrics.w+b-r,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+this.metrics.w+
b-r,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2+5*this.metrics.marginX);c.lineTo(this.metrics.x+this.metrics.w+b-r,this.metrics.y+b-this.metrics.ascent+this.metrics.h-2*this.metrics.marginX);c.bezierCurveTo(this.metrics.x+this.metrics.w+b-r,this.metrics.y-b-this.metrics.ascent+this.metrics.h,this.metrics.x+this.metrics.w+b-r,this.metrics.y-b-this.metrics.ascent+this.metrics.h,this.metrics.x+this.metrics.w+b-g,this.metrics.y-b-this.metrics.ascent+this.metrics.h)}else 3==this.matrix_type?
(c.moveTo(this.metrics.x+b,this.metrics.y+b-this.metrics.ascent),c.lineTo(this.metrics.x+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h),c.moveTo(this.metrics.x+this.metrics.w-b,this.metrics.y+b-this.metrics.ascent),c.lineTo(this.metrics.x+this.metrics.w-b,this.metrics.y+b-this.metrics.ascent+this.metrics.h)):4==this.matrix_type&&(c.moveTo(this.metrics.x+b,this.metrics.y+b-this.metrics.ascent),c.lineTo(this.metrics.x+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h),c.moveTo(this.metrics.x+
b+1.25*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent),c.lineTo(this.metrics.x+b+1.25*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent+this.metrics.h),c.moveTo(this.metrics.x+this.metrics.w-b,this.metrics.y+b-this.metrics.ascent),c.lineTo(this.metrics.x+this.metrics.w-b,this.metrics.y+b-this.metrics.ascent+this.metrics.h),c.moveTo(this.metrics.x+this.metrics.w-b-1.25*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent),c.lineTo(this.metrics.x+this.metrics.w-b-1.25*this.metrics.marginX,
this.metrics.y+b-this.metrics.ascent+this.metrics.h));c.stroke();this.drawBorder(c,"blue")}drawDefparts(c){for(var b=0,g=this.children.length;b<g;b++)this.children[b].draw(c);g=parseInt(1.5+this.style.size/25);b=g/2;c.lineWidth=g;c.strokeStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:v;c.beginPath();g=3*this.metrics.marginX;var r=g/2;c.moveTo(this.metrics.x+b+g,this.metrics.y+b-this.metrics.ascent);c.bezierCurveTo(this.metrics.x+b+r,this.metrics.y+
b-this.metrics.ascent,this.metrics.x+b+r,this.metrics.y+b-this.metrics.ascent,this.metrics.x+b+r,this.metrics.y+b-this.metrics.ascent+2*this.metrics.marginX);c.lineTo(this.metrics.x+b+r,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2-5*this.metrics.marginX);c.bezierCurveTo(this.metrics.x+b+r,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+r,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2);c.bezierCurveTo(this.metrics.x+
b+r,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+r,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+r,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2+5*this.metrics.marginX);c.lineTo(this.metrics.x+b+r,this.metrics.y+b-this.metrics.ascent+this.metrics.h-2*this.metrics.marginX);c.bezierCurveTo(this.metrics.x+b+r,this.metrics.y-b-this.metrics.ascent+this.metrics.h,this.metrics.x+b+r,this.metrics.y-b-this.metrics.ascent+this.metrics.h,this.metrics.x+
b+g,this.metrics.y-b-this.metrics.ascent+this.metrics.h);c.stroke();this.drawBorder(c,"blue")}drawGenericBlock(c){for(var b=0,g=this.children.length;b<g;b++)this.children[b].draw(c);this.drawBorder(c,"blue")}drawComponentNumCtrl(c){this.componentNumCtrl.expresion=this.evaluator.parser.parse("("+this.metrics.x+","+(this.metrics.y-this.metrics.ascent)+","+this.componentNumCtrl.w+","+this.componentNumCtrl.h+")");this.componentNumCtrl&&this.componentNumCtrl.parent&&this.componentNumCtrl.parent.readyApp&&
this.componentNumCtrl.update(!0)}drawComponentSpace(c){this.componentSpace.xExpr=this.evaluator.parser.parse(this.metrics.x.toString());this.componentSpace.yExpr=this.evaluator.parser.parse((this.metrics.y-this.metrics.ascent).toString());this.componentSpace&&this.componentSpace.parent&&this.componentSpace.parent.readyApp&&this.componentSpace.update(!0)}drawRadicalSign(c){c.beginPath();c.moveTo(759,1);c.bezierCurveTo(751,1,744,5,739,15);c.lineTo(325,878);c.lineTo(153,500);c.bezierCurveTo(148,489,
142,486,136,491);c.lineTo(2,596);c.bezierCurveTo(-3,600,19,626,24,622);c.lineTo(89,575);c.lineTo(282,997);c.bezierCurveTo(285,1003,309,1003,314,993);c.lineTo(773,40);c.lineTo(773,1);c.closePath();c.stroke();c.fill()}drawSigmaSign(c){c.beginPath();c.moveTo(780,707);c.lineTo(750,707);c.bezierCurveTo(728,805,695,872,585,872);c.lineTo(180,872);c.lineTo(509,447);c.lineTo(225,65);c.lineTo(538,65);c.bezierCurveTo(668,65,705,114,726,246);c.lineTo(756,246);c.lineTo(756,0);c.lineTo(25,0);c.lineTo(384,500);
c.lineTo(0,1E3);c.lineTo(729,1E3);c.closePath();c.stroke();c.fill()}drawIntegralSign(c){c.beginPath();c.moveTo(150,828);c.bezierCurveTo(129,916,108,972,67,972);c.bezierCurveTo(61,972,58,970,58,966);c.bezierCurveTo(58,957,73,958,73,932);c.bezierCurveTo(73,918,60,910,46,910);c.bezierCurveTo(22,910,1,932,1,961);c.bezierCurveTo(1,981,22,1E3,57,1E3);c.bezierCurveTo(154,1E3,198,895,216,824);c.lineTo(375,181);c.bezierCurveTo(398,90,420,27,464,28);c.bezierCurveTo(470,28,473,30,473,34);c.bezierCurveTo(473,
41,458,47,458,69);c.bezierCurveTo(458,83,471,89,485,89);c.bezierCurveTo(509,89,530,67,530,38);c.bezierCurveTo(530,18,508,0,473,0);c.bezierCurveTo(368,0,326,120,309,190);c.closePath();c.stroke();c.fill()}drawProdSign(c){c.beginPath();c.moveTo(876.3561,999.59384);c.lineTo(876.3561,972.20771);c.lineTo(858.75073,972.20771);c.bezierCurveTo(794.19771,972.20771,761.92121,931.12852,761.92121,847.99206);c.lineTo(761.92121,144.75542);c.bezierCurveTo(761.92121,61.618964,789.30733,27.386304,876.3561,27.386304);
c.lineTo(876.3561,1.7633057E-4);c.lineTo(1.184082E-5,1.7633057E-4);c.lineTo(1.184082E-5,27.386304);c.lineTo(16.627304,27.386304);c.bezierCurveTo(77.268015,27.386304,115.41298,51.838204,115.41298,148.66773);c.lineTo(115.41298,865.59743);c.bezierCurveTo(115.41298,936.99697,84.114547,972.20771,18.583456,972.20771);c.lineTo(1.184082E-5,972.20771);c.lineTo(1.184082E-5,999.59384);c.lineTo(359.93198,999.59384);c.lineTo(359.93198,972.20771);c.lineTo(329.61162,972.20771);c.bezierCurveTo(265.0586,972.20771,
243.54093,932.10659,243.54093,841.14553);c.lineTo(243.54093,64.553192);c.lineTo(633.79325,64.553192);c.lineTo(633.79325,841.14553);c.bezierCurveTo(633.79325,916.45738,616.18788,972.20771,547.72257,972.20771);c.lineTo(516.42413,972.20771);c.lineTo(516.42413,999.59384);c.closePath();c.stroke();c.fill()}drawBorderSpecial(c,b){c.beginPath();c.setLineDash([1,2]);c.strokeStyle=b;c.lineWidth=1;c.rect(parseInt(this.metrics.x)+.5,parseInt(this.metrics.y-this.metrics.ascent)+.5,this.metrics.w,this.metrics.h);
c.stroke();c.setLineDash([])}toRTF(){var c=[],b=[],g="";this.mergeTextNodes();for(var r=0,l=this.children.length;r<l;r++){var m=this.children[r];"textLineBlock"===m.nodeType&&(g+=m.toRTFAux(c,b)+(1<l&&r<l-1?"\\par":""))}m="{\\fonttbl";r=0;for(l=c.length;r<l;r++)m+="\\f"+r+"\\fcharset0 "+c[r]+";";c="";if(0<b.length){c="{\\colortbl";r=0;for(l=b.length;r<l;r++)c+=b[r];c+="}"}return"{\\rtf1\\uc0"+(m+"}")+c+g+"}"}toRTFAux(c,b){for(var g,r,l,m=null,z="",u,e,w,B,y,A=0,x=this.children.length;A<x;A++)u=e=
"",g=this.children[A],w=this.addToFontTable(g.style.family,c),B=g.style.size,y=this.addToColorTable(g.style.color,b),null===y&&0<b.length&&(y=this.addToColorTable(v,b)),y!==m&&(u+="\\cf"+y,m=y),w!==r&&(u+="\\f"+w,r=w),B!==l&&(u+="\\fs"+2*B,l=B),g.style.italic&&(u+="\\i",e="\\i0"+e),g.style.bold&&(u+="\\b",e="\\b0"+e),g.style.underline&&(u+="\\ul",e="\\ulnone"+e),g.style.overline&&(u+="\\ol",e="\\olnone"+e),"text"===g.nodeType?(g.value=g.value.replace(/\\{/g,"{").replace(/\\}/g,"}").replace(/{/g,"\\{").replace(/}/g,
"\\}"),g=""!==u?u+" "+g.value+e:""!==z&&"}"!==z.charAt(z.length-1)?" "+g.value:g.value,z+=g):"formula"===g.nodeType?z+="{\\*\\mjaformula"+g.formulaToRTF(r,l,m,c,b)+"}":"componentSpace"===g.nodeType?z+="{\\*\\component\\Space "+g.value+"}":"componentNumCtrl"===g.nodeType&&(z+="{\\*\\component\\NumCtrl "+g.value+"}");return z}formulaToRTF(c,b,g,r,l){for(var m,z="",u,e,w,B,y=0,A=this.children.length;y<A;y++)u=e="",m=this.children[y],w=this.addToFontTable(m.style.family,r),B=this.addToColorTable(m.style.color,
l),null===B&&0<l.length&&(B=this.addToColorTable(v,l)),w!==c&&(u+="\\f"+w,c=w),B!==g&&(u+="\\cf"+B,"text"!==m.nodeType||"text"===m.nodeType&&""!==m.value)&&(g=B),m.style.italic&&(u+="\\i",e="\\i0"+e),m.style.bold&&(u+="\\b",e="\\b0"+e),m.style.underline&&(u+="\\ul",e="\\ulnone"+e),m.style.overline&&(u+="\\ol",e="\\olnone"+e),"text"===m.nodeType&&""!==m.value?(m.value=m.value.replace(/\\{/g,"{").replace(/\\}/g,"}").replace(/{/g,"\\{").replace(/}/g,"\\}"),tmpRTF=""!==u?u+" "+m.value+e:"}"!==z.charAt(z.length-
1)?" "+m.value:m.value,z+=tmpRTF):"dynamicText"===m.nodeType?(m.value=""===m.value?" ":m.value,z+=u+"{\\expr "+m.value+"\\decimals "+(m.decimals||2)+"\\fixed"+(m.fixed?1:0)+"}"+e):"fraction"===m.nodeType||"radical"===m.nodeType||"index"===m.nodeType||"radicand"===m.nodeType||"sum"===m.nodeType||"integral"===m.nodeType||"prod"===m.nodeType||"limit"===m.nodeType||"from"===m.nodeType||"to"===m.nodeType||"what"===m.nodeType||"element"===m.nodeType?z+="{\\"+m.nodeType+m.formulaToRTF(c,b,g,r,l)+"}":"numerator"===
m.nodeType?z+="{\\num"+m.formulaToRTF(c,b,g,r,l)+"}":"denominator"===m.nodeType?z+="{\\den"+m.formulaToRTF(c,b,g,r,l)+"}":"superIndex"===m.nodeType?z+="{\\supix"+m.formulaToRTF(c,b,g,r,l)+"}":"subIndex"===m.nodeType?z+="{\\subix"+m.formulaToRTF(c,b,g,r,l)+"}":"matrix"===m.nodeType?z+="{\\matrix\\rows "+(m.rows||2)+"\\columns "+(m.columns||2)+m.formulaToRTF(c,b,g,r,l)+"}":"defparts"===m.nodeType&&(z+="{\\defparts\\parts "+(m.parts||2)+m.formulaToRTF(c,b,g,r,l)+"}");return z}addToFontTable(c,b){var g;
c.match(/times/i)?g="Times New Roman":c.match(/courier/i)?g="Courier New":c.match(/arial/i)&&(g="Arial");c=b.indexOf(g);-1===c&&(c=b.length,b.push(g));return c}addToColorTable(c,b){if(c){c="\\red"+parseInt(c.substring(1,3),16)+"\\green"+parseInt(c.substring(3,5),16)+"\\blue"+parseInt(c.substring(5,7),16)+";";var g=b.indexOf(c);-1===g&&(g=b.length,b.push(c));return g}return null}mergeTextNodes(){for(var c=[],b=null,g=0,r=this.children.length;g<r;g++)"text"===this.children[g].nodeType?null!==b&&"text"===
b.nodeType&&b.style.equals(this.children[g].style)&&(this.children[g].value=b.value+this.children[g].value,c.push(b)):this.children[g].mergeTextNodes(),b=this.children[g];g=0;for(r=c.length;g<r;g++)this.removeChild(c[g])}}var h={sansserif:{ascent:1854,descent:-434,lineGap:67,capHeight:1409,xHeight:1082,unitsPerEm:2048},serif:{ascent:1825,descent:-443,lineGap:87,capHeight:1341,xHeight:940,unitsPerEm:2048},monospace:{ascent:1705,descent:-615,lineGap:0,capHeight:1349,xHeight:1082,unitsPerEm:2048}};a.TextNode=
n;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var p=String.fromCharCode,k,f,v,q,d,n,h,c,b,g,r;class l{constructor(){}tokenize(m){if(m)m=m.replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&quote;/g,"''").replace(/&squot;/g,"'").replace(/\\rquote /g,"'").replace(/\\endash /g,"-").replace(/\n/g," ").replace(/\r/g,"").replace(/\\uc(\d+) /g,"").replace(/\\uc(\d+)/g,"");else return[];k=[];f="";q=v=0;n=m.charAt(0);h=!1;for(c="text";v<m.length;)d=n,n=m.charAt(v+1),h?"\\"===n||"{"===n||"}"===n||" "===n||
";"===n?(h=!1,f+=d," "===n?(v++,n=m.charAt(v+1),r=!0):r=!1,(b=f.match(/^'([0-9a-f]{2})/))?(g="","text"===c&&(g=k.pop().value),f=g+=p(parseInt(b[1],16))+f.substring(3)):(b=f.match(/^u[0-9]+/))?(g="","text"===c&&(g=k.pop().value),f=g+=p(b[0].substring(1))):("{"===f||"}"===f||"\\"==d?(k.push({type:"text",value:f+(r?" ":"")}),c="text"):(k.push({type:"controlWord",value:f}),c="controlWord"),f="")):"{"==d||"}"==d||"\\"==d?(h=!1,k.push({type:"text",value:d}),c="text"):f+=d:"\\"===d?(h=!0,""!==f&&(k.push({type:"text",
value:f}),c="text",f="")):"{"===d?(q++,""!==f&&(k.push({type:"text",value:f}),f=""),k.push({type:"openBlock",value:q}),c="openBlock"):"}"===d?(""!==f&&(k.push({type:"text",value:f}),f=""),k.push({type:"closeBlock",value:q}),c="closeBlock",q--):f+=d,v++;""!==f&&k.push({type:"text",value:f});return k}}a.RTFTokenizer=l;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var p=Math.max,k,f,v,q,d,n,h,c,b,g,r,l,m,z,u,e,w,B,y,A,x,H,J,C,G,F,P,E,N,W,T;class S{constructor(Q){this.evaluator=Q;this.tokenizer=new a.RTFTokenizer}parse(Q){k=this.tokenizer.tokenize(Q);f={};q=2;if("openBlock"===k[0].type&&"fonttbl"===k[1].value){for(v=k[0].value;"closeBlock"!==k[q].type&&k[q].value!==v;)f[k[q].value]=k[q+2].value.substring(0,k[q+2].value.length-1),q+=3;q++}d={};n=0;if("openBlock"===k[q].type&&"colortbl"===k[q+1].value){v=k[q++].value;
for(q++;"closeBlock"!==k[q].type&&k[q].value!==v;)h=parseInt(k[q++].value.substring(3)).toString(16),c=parseInt(k[q++].value.substring(5)).toString(16),b=parseInt(k[q++].value.substring(4)).toString(16),";"===k[q].value&&q++,d[n++]="#"+(2>h.length?"0"+h:h)+(2>c.length?"0"+c:c)+(2>b.length?"0"+b:b);q++}z=m=l=null;N=E=P=x=A=y=B=w=e=u=!1;H=[new a.TextStyle];J=H[0];G=C=-1;F=[];g=W=new a.TextNode("","textBlock",J,this.evaluator);r=new a.TextNode("","textLineBlock",J,this.evaluator);g.addChild(r);W.stableWidth=
!0;W.hasFormula=!1;Q=q;for(var X=k.length;Q<X;Q++){if("controlWord"==k[Q].type)if(f[k[Q].value])J.set({family:f[k[Q].value]});else if(k[Q].value.match(/^fs(\d+)/))J.set({size:parseInt(k[Q].value.match(/^fs(\d+)/)[1]/2)});else if("b"==k[Q].value)J.set({bold:!0}),0<F.length&&F[F.length-1].style.set({bold:!0});else if("b0"==k[Q].value)J.set({bold:!1}),0<F.length&&F[F.length-1].style.set({bold:!1});else if("i"==k[Q].value)J.set({italic:!0}),0<F.length&&F[F.length-1].style.set({italic:!0});else if("i0"==
k[Q].value)J.set({italic:!1}),0<F.length&&F[F.length-1].style.set({italic:!1});else if("ul"==k[Q].value)J.set({underline:!0}),0<F.length&&F[F.length-1].style.set({underline:!0});else if("ulnone"==k[Q].value)J.set({underline:!1}),0<F.length&&F[F.length-1].style.set({underline:!1});else if("ol"==k[Q].value)J.set({overline:!0}),0<F.length&&F[F.length-1].style.set({overline:!0});else if("olnone"==k[Q].value)J.set({overline:!1}),0<F.length&&F[F.length-1].style.set({overline:!1});else if(k[Q].value.match(/^cf(\d+)/))J.set({color:d[parseInt(k[Q].value.substring(2))]}),
0<F.length&&(F[F.length-1].style.color=J.color);else if("par"==k[Q].value){g=new a.TextNode("","textLineBlock",J.clone(),this.evaluator);if("textBlock"!=r.nodeType)for(r=r.parent;"textBlock"!=r.nodeType;)r=r.parent;r.addChild(g);r=g}else if("mjaformula"==k[Q].value)W.hasFormula=!0,G=C,u=!0,g=new a.TextNode("","formula",J.clone(),this.evaluator),r.addChild(g),r=g,F[F.length-1]=g;else if("fraction"==k[Q].value||"radicand"==k[Q].value||"radical"==k[Q].value||"what"==k[Q].value||"sum"==k[Q].value||"integral"==
k[Q].value||"limit"==k[Q].value){var aa=F[F.length-2].style.clone();g=new a.TextNode("",k[Q].value,aa,this.evaluator);F[F.length-2].addChild(g);F[F.length-1]=g}else"index"==k[Q].value?(aa=F[F.length-2].style.clone(),aa.size=p(parseInt(aa.size-.5*aa.size),8),g=new a.TextNode("",k[Q].value,aa,this.evaluator),F[F.length-2].addChild(g),F[F.length-1]=g):"to"==k[Q].value||"from"==k[Q].value?(aa=F[F.length-2].style.clone(),aa.size=p(parseInt(aa.size-.2*aa.size),8),g=new a.TextNode("",k[Q].value,aa,this.evaluator),
F[F.length-2].addChild(g),F[F.length-1]=g):"num"==k[Q].value||"den"==k[Q].value?(aa=F[F.length-2].style.clone(),aa.size=p(Math.round(aa.size-.1*aa.size),8),"num"==k[Q].value?g=new a.TextNode("","numerator",aa,this.evaluator):"den"==k[Q].value&&(g=new a.TextNode("","denominator",aa,this.evaluator)),F[F.length-2].addChild(g),F[F.length-1]=g):"subix"==k[Q].value||"supix"==k[Q].value?(aa=F[F.length-2].style.clone(),aa.size=p(Math.floor(aa.size-.33*aa.size),8),"subix"==k[Q].value?g=new a.TextNode("","subIndex",
aa,this.evaluator):"supix"==k[Q].value&&(g=new a.TextNode("","superIndex",aa,this.evaluator)),g.originalStyle=F[F.length-2].style.clone(),F[F.length-2].addChild(g),F[F.length-1]=g):"defparts"==k[Q].value||"matrix"==k[Q].value||"element"==k[Q].value?(aa=F[F.length-2].style.clone(),g=new a.TextNode("",k[Q].value,aa,this.evaluator),F[F.length-2].addChild(g),F[F.length-1]=g,"defparts"==k[Q].value?z=g:"matrix"==k[Q].value&&(m=g,m.matrix_type=0)):"parts"==k[Q].value?x=!0:"type"==k[Q].value?B=!0:"rows"==
k[Q].value?y=!0:"columns"==k[Q].value?A=!0:"expr"==k[Q].value?(W.stableWidth=!1,e=!0):"decimals"==k[Q].value?w=!0:"fixed1"==k[Q].value?l.fixed=!0:"fixed0"==k[Q].value?l.fixed=!1:"component"!=k[Q].value&&("NumCtrl"==k[Q].value?P=!0:"Space"==k[Q].value?E=!0:"hyperlink"==k[Q].value&&(N=!0));if("text"==k[Q].type)if(x)z.parts=parseInt(k[Q].value),x=!1;else if(B)m.matrix_type=parseInt(k[Q].value),B=!1;else if(y)m.rows=parseInt(k[Q].value),y=!1;else if(A)m.columns=parseInt(k[Q].value),A=!1;else if(w)l.decimals=
this.evaluator.parser.parse(k[Q].value+""),w=!1;else if(N){T=k[Q].value.split("|")[0];aa=J.clone();g=new a.TextNode(T,"hyperlink",aa,this.evaluator);g.URL=k[Q].value.split("|")[1];if("textLineBlock"!=r.nodeType)for(r=r.parent;"textLineBlock"!=r.nodeType;)r=r.parent;r.addChild(g);N=!1}else if(P)g=new a.TextNode(k[Q].value,"componentNumCtrl",J.clone(),this.evaluator),r.addChild(g),P=!1;else if(E)g=new a.TextNode(k[Q].value,"componentSpace",J.clone(),this.evaluator),r.addChild(g),E=!1;else if(e)aa=F[F.length-
2].style.clone(),T=this.evaluator.parser.parse(k[Q].value),g=new a.TextNode(T,"dynamicText",aa,this.evaluator),F[F.length-2].addChild(g),l=F[F.length-1]=g,e=!1;else if(e||u)!e&&u&&(T=k[Q].value,g=new a.TextNode(T,"text",F[F.length-1].style.clone(),this.evaluator),F[F.length-1].addChild(g));else{T=k[Q].value;g=new a.TextNode(T,"text",J.clone(),this.evaluator);if("textLineBlock"!=r.nodeType)for(r=r.parent;"textLineBlock"!=r.nodeType;)r=r.parent;r.addChild(g)}else if("openBlock"==k[Q].type)C=k[Q].value,
J=J.clone(),H.push(J),F.push(null);else if("closeBlock"==k[Q].type)k[Q].value==G&&(G=-1,u=!1,r=r.parent),H.pop(),J=H[H.length-1],F.pop();else if("("==k[Q].type||")"==k[Q].type)aa=F[F.length-1].style.clone(),aa.italic="",g=new a.TextNode(k[Q].type,"mathSymbol",aa,this.evaluator),F[F.length-1].addChild(g);else if("+"==k[Q].type||"-"==k[Q].type||"*"==k[Q].type||"="==k[Q].type)g=new a.TextNode(k[Q].type,"mathSymbol",F[F.length-1].style.clone(),this.evaluator),F[F.length-1].addChild(g)}return W.normalize()}}
a.RTFParser=S;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var p,k,f,v,q,d,n,h,c,b,g;class r{constructor(l,m){this.parent=l;k=this.evaluator=this.parent.evaluator;f=k.parser;this.id="";this.type="2D";this.xExpr=f.parse("0");this.yExpr=f.parse("0");this.w=parseInt(l.container.width);this.h=parseInt(l.container.height);this.drawif=f.parse("1");this.fixed=!1;this.scale=48;this.Oy=this.Ox=0;this.image=new Image;this.image.onload=function(){this.ready=1};this.imageSrc="";this.bg_display="topleft";this.background=new a.Color("ffffff");
this.net=new a.Color("b8c4c8");this.net10=new a.Color("889498");this.axes=new a.Color("405860");this.numbers=this.text=!1;this.y_axis=this.x_axis="";this.sensitive_to_mouse_movements=!1;this.cID="";this.mouse_y=this.mouse_x=0;this.ctrs=[];this.graphicsCtr=[];this.graphics=[];this.backGraphics=[];this.zIndex=l.zIndex;this.border_width=0;this.border_color=new a.Color("000000");this.border_radius=0;this.plecaHeight=l.plecaHeight||0;this.displaceRegionNorth=l.displaceRegionNorth||0;this.displaceRegionWest=
l.displaceRegionWest||0;Object.assign(this,m);this.initSpace()}initSpace(){var l=this;p=l.parent;k=l.evaluator;v=l.id;l.resizable||(l.displaceRegionNorth=p.displaceRegionNorth||0,l.displaceRegionSouth=p.displaceRegionSouth||0,l.displaceRegionEast=p.displaceRegionEast||0,l.displaceRegionWest=p.displaceRegionWest||0,h=parseInt(p.container.width),n=parseInt(p.container.height),void 0!=l.wExpr&&(l.w=parseInt(h-l.displaceRegionWest-l.displaceRegionEast)*parseFloat(l.wExpr)/100),void 0!=l.hExpr&&(l.h=parseInt(n-
l.displaceRegionNorth-l.displaceRegionSouth)*parseFloat(l.hExpr)/100),void 0!=l.xPercentExpr&&(l.xExpr=k.parser.parse((parseInt(h-l.displaceRegionWest-this.displaceRegionEast)*parseFloat(l.xPercentExpr)/100).toString())),void 0!=l.yPercentExpr&&(l.yExpr=k.parser.parse((parseInt(n-l.displaceRegionNorth-l.displaceRegionSouth)*parseFloat(l.yPercentExpr)/100).toString())),l.x=k.eval(l.xExpr)+l.displaceRegionWest,l.y=k.eval(l.yExpr)+l.plecaHeight+l.displaceRegionNorth,l.container&&(l.container.style.left=
l.x+"px",l.container.style.top=l.y+"px"),0<=l.y?(q=n-l.y,l.h>q&&(l.h=q)):(q=l.h+l.y,l.h=q>=n?n:q),0<=l.x?(d=h-l.x,l.w>d&&(l.w=d)):(d=l.w+l.x,l.w=d>=h?h:d));""==l.imageSrc&&/vacio.gif$/i.test(l.imageSrc.trim())||(l.image=p.getImage(l.imageSrc));l.OxExpr&&(b=l.OxExpr,"%"===b[b.length-1]?l.Ox=l.w*parseFloat(b)/100:(c=parseFloat(b),c!=b&&(c=0),l.Ox=c));l.OyExpr&&(g=l.OyExpr,"%"===g[g.length-1]?l.Oy=l.h*parseFloat(g)/100:(c=parseFloat(g),c!=g&&(c=0),l.Oy=c));""!==l.id&&2!==p.version?(k.setVariable(v+"._w",
l.w),k.setVariable(v+"._h",l.h),k.setVariable(v+".escala",k.getVariable(v+".escala")||l.scale),k.setVariable(v+".Ox",k.getVariable(v+".Ox")||l.Ox),k.setVariable(v+".Oy",k.getVariable(v+".Oy")||l.Oy),k.setVariable(v+".mouse_x",0),k.setVariable(v+".mouse_y",0),k.setVariable(v+".mouse_pressed",0),k.setVariable(v+".mouse_clicked",0),k.setVariable(v+".clic_izquierdo",0)):(c=k.getVariable("_w"),k.setVariable("_w",void 0===c?l.w:c),c=k.getVariable("_h"),void 0===c&&(c=l.h),k.setVariable("_h",c),c=k.getVariable("escala"),
void 0===c&&(c=l.scale),k.setVariable("escala",c),c=k.getVariable("Ox"),void 0===c&&(c=l.Ox),k.setVariable("Ox",c),c=k.getVariable("Oy"),void 0===c&&(c=l.Oy),k.setVariable("Oy",c),k.setVariable("mouse_x",0),k.setVariable("mouse_y",0),k.setVariable("mouse_pressed",0),k.setVariable("mouse_clicked",0),k.setVariable("clic_izquierdo",0),2==p.version&&""===l.x_axis&&""===l.y_axis&&(l.axes=""));l.w_2=l.w/2;l.h_2=l.h/2;k.setFunction(v+".download_image",function(m){l.evaluator.functions._SaveSpace_(m,l.canvas.toDataURL("image/png"))})}addCtr(l){"GraphicControl"===
l.type?this.graphicsCtr.push(l):this.ctrs.push(l)}addGraph(l,m){"2D"===this.type&&m||"3D"===this.type&&!m||(l.background&&"3D"!==this.type?this.backGraphics.push(l):this.graphics.push(l))}clearClick(){this.evaluator.setVariable(this.mclickedString,0);this.evaluator.setVariable(this.mclicizquierdoString,0)}getRelativeX(l){return(parseInt(l)-this.w_2-this.Ox)/this.scale}getRelativeY(l){return(-parseInt(l)+this.h_2+this.Oy)/this.scale}getAbsoluteX(l){return l*this.scale+this.w_2+this.Ox}getAbsoluteY(l){return-l*
this.scale+this.h_2+this.Oy}}a.Space=r;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var p;class k{constructor(f){p=this;p.parent=f;p.width=228;p.vSpace=25;p.container=a.newHTML("div",{style:`box-sizing:border-box;border-style:ridge;border-width:5px;border-color:gray;box-shadow:#000 0 0 25px 5px;overflow-y:scroll;overflow-x:hidden;position:fixed;left:0;top:0;z-index:10000;background-color:#63b4fb;width:${p.width+27}px;height:460px;`});p.movable=a.newHTML("div",{style:`position:absolute;left:0;top:0;width:${p.width+27}px;height:${p.vSpace}px;line-height:${p.vSpace}px;background-color:#ddd;cursor:move;padding-left:75px;font-family:${a.sansserif_font};font-size:18px;`});
p.movable.innerHTML="Descartes";p.container.appendChild(p.movable);p.ctrs=[]}init(){function f(h){p.newPos=a.getCursorPosition(h,document.body);p.container.style.left=p.initialPosition.x+(p.newPos.x-p.oldPos.x)*a.cssScale+"px";p.container.style.top=p.initialPosition.y+(p.newPos.y-p.oldPos.y)*a.cssScale+"px"}function v(h){h.preventDefault();document.body.removeEventListener("mousemove",f);document.body.removeEventListener("mouseup",v)}p=this;document.body.appendChild(this.container);for(var q=p.parent.evaluator.parser,
d=0,n=p.ctrs.length;d<n;d++)p.ctrs[d].expresion=q.parse("(0,"+(p.vSpace+23+35*d)+","+p.width+",35)"),p.ctrs[d].update();p.numCtr=n;d=new a.Button(p.parent,{region:"external",name:"english"==p.language?"about":"cr\u00e9ditos",font_size:q.parse("15"),expresion:q.parse("(0,"+p.vSpace+","+p.width/2+",25)")});d.actionExec={execute:a.showAbout};d.update();(new a.Button(p.parent,{region:"external",name:"config",font_size:q.parse("15"),action:"config",expresion:q.parse("("+p.width/2+","+p.vSpace+","+p.width/
2+",25)")})).update();(new a.Button(p.parent,{region:"external",name:"english"==p.language?"init":"inicio",font_size:q.parse("15"),action:"init",expresion:q.parse("(0,"+(p.vSpace+23+35*n)+","+p.width/2+",25)")})).update();(new a.Button(p.parent,{region:"external",name:"english"==p.language?"clear":"limpiar",font_size:q.parse("15"),action:"clear",expresion:q.parse("("+p.width/2+","+(p.vSpace+23+35*n)+","+p.width/2+",25)")})).update();q=new a.Button(p.parent,{region:"external",name:"english"==p.language?
"close":"cerrar",font_size:q.parse("15"),expresion:q.parse("("+p.width/4+","+(p.vSpace+46+35*n)+","+p.width/2+",25)")});q.update();q.btn.addEventListener("click",function(h){p.hide()});p.setPositionAndSize();p.movable.addEventListener("mousedown",function(h){h.preventDefault();p.oldPos=a.getCursorPosition(h,document.body);p.initialPosition={x:p.container.offsetLeft,y:p.container.offsetTop};document.body.addEventListener("mousemove",f);document.body.addEventListener("mouseup",v)});p.hide()}addCtr(f){this.ctrs.push(f)}show(){this.setPositionAndSize();
this.container.style.display="block"}hide(){this.container.style.display="none"}setPositionAndSize(){p=this;var f=p.vSpace+46+35*p.numCtr+25+10;p.container.style.left=Math.max(parseInt(window.innerWidth-p.width)/2,0)+"px";p.container.style.top="5px";p.container.style.height=window.innerHeight<p.vSpace+75?p.vSpace+75+"px":f>window.innerHeight-10?window.innerHeight-10:f+"px"}}a.SpaceExternal=k;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var p=Math.floor,k=Math.round,f=2*Math.PI,v=a.convertFont("Serif,BOLD+ITALIC,16"),q=a.convertFont("Monospaced,PLAIN,12"),d,n,h,c,b,g,r,l,m,z,u,e,w,B,y,A,x,H,J,C,G,F,P,E,N,W,T,S,Q,X,aa,D;class K extends a.Space{constructor(R,O){super(R,O);d=this;d.ratio=R.ratio;d.canvas=a.newHTML("canvas",{id:d.id+"_canvas",class:"DescartesSpace2DCanvas",width:d.w*d.ratio});d.backCanvas=a.newHTML("canvas",{id:d.id+"_background",width:d.w*d.ratio});d.canvas.style=d.backCanvas.style=
`${0<d.border_width?"border:"+d.border_width+"px solid "+d.border_color.getColor()+";":""}${d.border_radius?"border-radius:"+d.border_radius+"px;":""}`;d.canvas.style.zIndex=d.zIndex;d.canvas.style.width=d.backCanvas.style.width=d.w+"px";d.canvas.style.height=d.backCanvas.style.height=d.h+"px";d.ctx=d.canvas.getContext("2d");d.backCtx=d.backCanvas.getContext("2d");d.ctx.imageSmoothingEnabled=d.backCtx.imageSmoothingEnabled=!1;d.graphicControlContainer=a.newHTML("div",{id:d.id+"_graphicControls",style:`position:absolute;left:0;top:0;z-index:${d.zIndex};`});
d.numericalControlContainer=a.newHTML("div",{id:d.id+"_numericalControls",style:`position:absolute;left:0;top:0;z-index:${d.zIndex};`});d.container=a.newHTML("div",{id:d.id,class:"DescartesSpace2DContainer",style:`z-index:${d.zIndex};`});d.parent.arquimedes&&"#f0f8fa"===d.background.getColor()&&(d.container.style.boxShadow="0 0 5px 0 #b8c4c8");d.container.appendChild(d.backCanvas);d.container.appendChild(d.canvas);d.container.appendChild(d.graphicControlContainer);d.container.appendChild(d.numericalControlContainer);
R.container.insertBefore(d.container,R.loader);O=d.id+".image";d.parent.images[O]=d.canvas;d.parent.images[O].ready=1;d.parent.images[O].complete=d.parent.images[O].canvas=!0;d.evaluator.setVariable(O,O);O=d.id+".back";d.parent.images[O]=d.backCanvas;d.parent.images[O].ready=1;d.parent.images[O].complete=d.parent.images[O].canvas=!0;d.evaluator.setVariable(O,O);O=""!==d.id&&2!==R.version?d.id+".":"";d.OxStr=O+"Ox";d.OyStr=O+"Oy";d.scaleStr=O+"escala";d.wStr=O+"_w";d.hStr=O+"_h";d.mxStr=O+"mouse_x";
d.myStr=O+"mouse_y";d.mpressedStr=O+"mouse_pressed";d.mclickedStr=O+"mouse_clicked";d.mclickIzqStr=O+"clic_izquierdo";d.click=0;d.resizable&&(d.wModExpr=R.evaluator.parser.parse(d.wModExpr),d.hModExpr=R.evaluator.parser.parse(d.hModExpr));"descartesJS_stage"!==d.id?d.addEvents():d.canvas.oncontextmenu=function(L){return!1};R.evaluator.setVariable(d.id+"._refresh_back_",1)}init(){d=this;this.initSpace();d.canvas&&(d.old_w=d.w,d.old_h=d.h,d.canvas.width=d.backCanvas.width=d.w*d.ratio,d.canvas.height=
d.backCanvas.height=d.h*d.ratio,d.canvas.style.width=d.backCanvas.style.width=d.w+"px",d.canvas.style.height=d.backCanvas.style.height=d.h+"px")}update(R){d=this;n=d.evaluator;h=d.parent;if(d.resizable){if(Q=d.evaluator.eval(d.wModExpr),X=d.evaluator.eval(d.hModExpr),d.old_w!=Q||d.old_h!=X)d.w=Q,d.h=X,d.w_2=d.w/2,d.h_2=d.h/2,n.setVariable(d.wStr,d.w),n.setVariable(d.hStr,d.h),d.old_w=d.w,d.old_h=d.h,d.canvas.width=d.backCanvas.width=d.w*d.ratio,d.canvas.height=d.backCanvas.height=d.h*d.ratio,d.canvas.style.width=
d.backCanvas.style.width=d.w+"px",d.canvas.style.height=d.backCanvas.style.height=d.h+"px",R=!0}else n.setVariable(d.wStr,d.w),n.setVariable(d.hStr,d.h);d.drawIfValue=0<n.eval(d.drawif);if(d.drawIfValue){b=d.x!==n.eval(d.xExpr)+d.displaceRegionWest;g=d.y!==n.eval(d.yExpr)+h.plecaHeight+d.displaceRegionNorth;d.spaceChange=R||b||g||d.drawBefore!==d.drawIfValue||d.Ox!==n.getVariable(d.OxStr)||d.Oy!==n.getVariable(d.OyStr)||d.scale!==n.getVariable(d.scaleStr)||d.backColor!==d.background.getColor();d.x=
b?n.eval(d.xExpr)+d.displaceRegionWest:d.x;d.y=g?n.eval(d.yExpr)+h.plecaHeight+d.displaceRegionNorth:d.y;d.Ox=n.getVariable(d.OxStr);d.Oy=n.getVariable(d.OyStr);d.scale=n.getVariable(d.scaleStr);d.drawBefore=d.drawIfValue;d.scale=Math.max(1E-6,Math.min(1E6,d.scale));n.setVariable(d.scaleStr,d.scale);if(b||g)d.container.style.left=d.x+"px",d.container.style.top=d.y+"px";d.container.style.display="block";d.drawTrace=!d.spaceChange&&(!d.fixed&&!d.click||d.fixed);d.spaceChange&&(d.backCtx.setTransform(d.ratio,
0,0,d.ratio,0,0),d.drawBackground());d.ctx.setTransform(d.ratio,0,0,d.ratio,0,0);d.draw()}else d.container.style.display="none"}drawBackground(){d=this;n=d.evaluator;c=d.backCtx;c.clearRect(0,0,d.backCanvas.width,d.backCanvas.height);c.fillStyle=d.backColor=d.background.getColor();c.fillRect(0,0,d.backCanvas.width,d.backCanvas.height);d.image&&""!=d.image.src&&d.image.ready&&d.image.complete&&("topleft"===d.bg_display?c.drawImage(d.image,0,0):"stretch"===d.bg_display?c.drawImage(d.image,0,0,d.w,d.h):
"patch"===d.bg_display?(c.fillStyle=c.createPattern(d.image,"repeat"),c.fillRect(0,0,d.w,d.h)):"imgcenter"===d.bg_display&&c.drawImage(d.image,(d.w-d.image.width)/2,(d.h-d.image.height)/2));l=d.scale;m=0;for(z=0>d.w+d.h?0:d.w+d.h;l>z;)l/=10,m++;for(;l<z/10;)l*=10;c.lineWidth=1;""!==d.net&&(c.strokeStyle=d.net.getColor(),d.drawMarks(c,l/10,-1));if(2!==d.parent.version&&""!==d.net10||2===d.parent.version&&""!==d.net&&""!==d.net10)c.strokeStyle=d.net10.getColor(),d.drawMarks(c,l,-1);if(""!==d.axes){var R=
"";"no"==d.x_axis&&(R+="x");"no"==d.y_axis&&(R+="y");c.strokeStyle=d.axes.getColor();c.beginPath();"no"==d.x_axis||""===d.x_axis&&2===d.parent.version||(c.moveTo(0,p(d.h/2+d.Oy)+.5),c.lineTo(d.w,p(d.h/2+d.Oy)+.5));"no"==d.y_axis||""===d.y_axis&&2===d.parent.version||(c.moveTo(p(d.w/2+d.Ox)+.5,0),c.lineTo(p(d.w/2+d.Ox)+.5,d.h));c.lineWidth=1.2;c.stroke();c.lineWidth=1;d.drawMarks(c,l,4,R);d.drawMarks(c,l/2,2,R);d.drawMarks(c,l/10,1,R)}if(""!==d.x_axis||""!==d.y_axis)c.fillStyle=""!==d.axes?d.axes.getColor():
"#000",c.font=v,c.textAlign="right",c.textBaseline="alphabetic","no"!=d.x_axis&&c.fillText(d.x_axis,p(d.w)-2,p(d.h/2+d.Oy)+12),"no"!=d.y_axis&&c.fillText(d.y_axis,p(d.w/2+d.Ox)-2,12);d.numbers&&""!=d.axes&&(c.fillStyle=d.axes.getColor(),c.font=v,c.textAlign="start",c.textBaseline="bottom",l>(d.w+d.h)/2?d.drawNumbers(c,l/5,l<=d.scale?m+1:m):l>(d.w+d.h)/4?d.drawNumbers(c,l/2,l<=d.scale?m+1:m):d.drawNumbers(c,l,m));R=0;for(var O=this.backGraphics.length;R<O;R++)this.backGraphics[R].draw()}draw(){d=this;
c=d.ctx;n.getVariable(d.id+"._refresh_back_")&&c.clearRect(0,0,d.canvas.width,d.canvas.height);for(var R=0,O=d.graphics.length;R<O;R++)r=d.graphics[R],""!==r.trace&&d.drawTrace&&r.drawTrace(),r.draw();R=0;for(O=d.graphicsCtr.length;R<O;R++)d.graphicsCtr[R].draw();""!=d.text&&d.click&&"L"===d.whichBtn&&(c.save(),c.strokeStyle=c.fillStyle=d.text.getColor(),c.lineWidth=1,c.font=q,c.textAlign="center",c.textBaseline="alphabetic",G=1>=d.scale?d.mouse_x.toFixed(0):d.mouse_x.toFixed(parseInt(d.scale).toString().length+
1),F=1>=d.scale?d.mouse_y.toFixed(0):d.mouse_y.toFixed(parseInt(d.scale).toString().length+1),P="("+G+","+F+")",E=p(c.measureText(P).width/2),N=d.getAbsoluteX(d.mouse_x),W=d.getAbsoluteY(d.mouse_y),T=p(N),S=p(W-10),T+E>d.w?T=d.w-E:0>T-E&&(T=E),S+1>d.h?S=d.h:0>S-14&&(S=15),c.fillText(P,T,S),c.beginPath(),c.arc(N,W,2.5,0,f,!0),c.stroke(),c.restore())}drawMarks(R,O,L,M){u=this.w;e=this.h;J=x=0;H=u;C=e;y=p(u/2+this.Ox);A=p(e/2+this.Oy);0<=L&&(x=y-L,H=y+L,J=A-L,C=A+L);R.beginPath();if(!M||M&&!M.match("x"))for(L=
-k(y/O);(w=y+k(L*O))<u;L++)R.moveTo(w+.5,J+.5),R.lineTo(w+.5,C+.5);if(!M||M&&!M.match("y"))for(L=-k(A/O);(B=A+k(L*O))<e;L++)R.moveTo(x+.5,B+.5),R.lineTo(H+.5,B+.5);R.stroke()}drawNumbers(R,O,L){u=this.w;e=this.h;y=p(u/2+this.Ox);A=p(e/2+this.Oy);for(L=-k(y/O);(w=y+k(L*O))<u;L++)R.fillText(parseFloat((L*O/this.scale).toFixed(4)),w+1,A-2);for(L=-k(A/O);(B=A+k(L*O))<e;L++)0!==parseFloat(-L*O/this.scale)&&R.fillText(parseFloat((-L*O/this.scale).toFixed(4)),y+5,B+5)}addEvents(){function R(V){window.focus();
document.activeElement.blur();if(I.evaluator.variables[I.id+".DESCARTESJS_no_fixed"]||!I.fixed||I.sensitive_to_mouse_movements)I.click=0,I.evaluator.setVariable(I.mpressedStr,0),I.evaluator.setVariable(I.mclickedStr,1),I.evaluator.setVariable(I.mclickIzqStr,1),window.removeEventListener("touchmove",U),window.removeEventListener("touchend",R),V.stopPropagation(),V.preventDefault(),I.parent.update()}function O(V){document.activeElement.blur();window.focus();V.stopPropagation();V.preventDefault();I.click=
0;I.evaluator.setVariable(I.mpressedStr,0);I.evaluator.setVariable(I.mclickedStr,1);I.evaluator.setVariable(I.mclickIzqStr,1);"R"===I.whichBtn&&(window.removeEventListener("mousemove",M),I.posZoom==I.posZoomNew&&a.showConfig&&(I.parent.externalSpace.show(),I.posZoom=!1,I.posZoomNew=!0));window.removeEventListener("mousemove",U);window.removeEventListener("mouseup",O);I.parent.deactivateGraphicControls();I.parent.update()}function L(V){I.posAnte=a.getCursorPosition(V,I.container);I.mouse_x=I.getRelativeX(I.posAnte.x);
I.mouse_y=I.getRelativeY(I.posAnte.y);I.evaluator.setVariable(I.mxStr,I.mouse_x);I.evaluator.setVariable(I.myStr,I.mouse_y);I.evaluator.setVariable(I.mclickedStr,0);I.evaluator.setVariable(I.mclickIzqStr,0);I.parent.update()}function M(V){V.preventDefault();I.posZoomNew=a.getCursorPosition(V,I.container).y;I.evaluator.setVariable(I.scaleStr,I.tempScale+I.tempScale/45*((I.posZoom-I.posZoomNew)/10));I.parent.update()}function U(V){V.preventDefault();V.stopPropagation();I.fixed||(I.posNext=a.getCursorPosition(V,
I.container),aa=I.posAnte.x-I.posNext.x,D=I.posAnte.y-I.posNext.y,I.evaluator.setVariable(I.OxStr,I.Ox-aa),I.evaluator.setVariable(I.OyStr,I.Oy-D));L(V)}var I=this;I.posZoom=I.posZoomNew=null;I.canvas.oncontextmenu=function(V){return!1};this.sensitive_to_mouse_movements&&this.canvas.addEventListener("touchmove",L);this.canvas.addEventListener("touchstart",function(V){window.focus();document.activeElement.blur();if(I.evaluator.variables[I.id+".DESCARTESJS_no_fixed"]||!I.fixed||I.sensitive_to_mouse_movements)I.parent.clearClick(),
I.click=1,I.evaluator.setVariable(I.mpressedStr,1),I.evaluator.setVariable(I.mclickedStr,0),I.evaluator.setVariable(I.mclickIzqStr,0),I.parent.deactivateGraphicControls(),L(V),window.addEventListener("touchmove",U),window.addEventListener("touchend",R),V.stopPropagation(),V.preventDefault()});this.sensitive_to_mouse_movements&&this.canvas.addEventListener("mousemove",L);this.canvas.addEventListener("mousedown",function(V){window.focus();document.activeElement.blur();V.stopPropagation();V.preventDefault();
I.parent.clearClick();I.click=1;I.parent.deactivateGraphicControls();I.whichBtn=a.whichBtn(V);"R"===I.whichBtn?(window.addEventListener("mouseup",O),I.posZoom=a.getCursorPosition(V,I.container).y,I.posZoomNew=I.posZoom,I.fixed||(I.tempScale=I.scale,window.addEventListener("mousemove",M))):"L"===I.whichBtn&&(I.evaluator.setVariable(I.mpressedStr,1),I.evaluator.setVariable(I.mclickedStr,0),I.evaluator.setVariable(I.mclickIzqStr,0),L(V),window.addEventListener("mousemove",U),window.addEventListener("mouseup",
O))});document.addEventListener("visibilitychange",function(V){O(V)});document.addEventListener("mouseleave",function(V){I.click=0;I.evaluator.setVariable(I.mpressedStr,0);I.evaluator.setVariable(I.mclickedStr,1);I.evaluator.setVariable(I.mclickIzqStr,1);window.removeEventListener("mousemove",U);window.removeEventListener("mouseup",O)})}}a.Space2D=K;return a}(descartesJS||{});
descartesJS=function(a){var p,k,f;if(a.loadLib)return a;var v=Math.floor,q=Math.max,d=Math.cos,n=Math.sin,h,c,b,g,r,l,m,z,u,e,w,B,y,A,x,H,J=[],C,G,F,P,E,N,W,T,S,Q,X;class aa extends a.Space{constructor(D,K){super(D,K);b=this;b.backCanvas=a.newHTML("canvas",{id:b.id+"_background",width:b.w+"px",height:b.h+"px"});b.canvas=a.newHTML("canvas",{id:b.id+"_canvas",width:b.w+"px",height:b.h+"px",class:"DescartesSpace3DCanvas",style:"z-index: "+b.zIndex+";"});b.ctx=b.canvas.getContext("2d");b.ctx.imageSmoothingEnabled=
!1;b.canvas.style=b.backCanvas.style=`${0<b.border_width?"border:"+b.border_width+"px solid "+b.border_color.getColor()+";":""}${b.border_radius?"border-radius:"+b.border_radius+"px;":""}`;K=b.id+".image";b.parent.images[K]=b.canvas;b.parent.images[K].ready=1;b.parent.images[K].complete=!0;b.parent.images[K].canvas=!0;b.evaluator.setVariable(K,K);b.graphicControlContainer=a.newHTML("div",{id:b.id+"_graphicControls",style:`position:absolute;left:0px;top:0px;z-index:${b.zIndex};`});b.numericalControlContainer=
a.newHTML("div",{id:b.id+"_numericalControls",style:`position:absolute;left:0px;top:0px;z-index:${b.zIndex};`});b.container=a.newHTML("div",{id:b.id,class:"DescartesSpace3DContainer",style:`z-index:${b.zIndex};`});b.container.appendChild(b.backCanvas);b.container.appendChild(b.canvas);b.container.appendChild(b.graphicControlContainer);b.container.appendChild(b.numericalControlContainer);D.container.insertBefore(b.container,D.loader);b.eye={x:0,y:0,z:0};b.lights=[{x:50,y:50,z:70},{x:50,y:-50,z:30},
{x:20,y:0,z:-80},{x:0,y:0,z:0}];K=0;for(var R=b.lights.length;K<R;K++)b.lights[K]=a.normalize3D(b.lights[K]);b.light3={x:0,y:0,z:0};b.intensity=[.4,.5,.3,0];b.userIntensity=0;b.dim=1;b.tmpIntensity=[];b.OxStr=b.id+".Ox";b.OyStr=b.id+".Oy";b.scaleStr=b.id+".escala";b.wStr=b.id+"._w";b.hStr=b.id+"._h";b.obsStr=b.id+".observador";b.ojoXStr=b.id+".Ojo.x";b.ojoYStr=b.id+".Ojo.y";b.ojoZStr=b.id+".Ojo.z";b.rotZStr=b.id+".rot.z";b.rotYStr=b.id+".rot.y";b.userIDimStr=b.id+".userIlum.dim";b.userIIStr=b.id+
".userIlum.I";b.userIxStr=b.id+".userIlum.x";b.userIyStr=b.id+".userIlum.y";b.userIzStr=b.id+".userIlum.z";b.evaluator.setVariable(b.rotZStr,0);b.evaluator.setVariable(b.rotYStr,0);b.evaluator.setVariable(b.userIDimStr,b.dim);b.evaluator.setVariable(b.userIIStr,b.userIntensity);b.evaluator.setVariable(b.userIxStr,0);b.evaluator.setVariable(b.userIyStr,0);b.evaluator.setVariable(b.userIzStr,0);X=new a.Primitive3D({vertices:[new a.Vector4D(0,0,0,1)],type:"vertex"},b);b.evaluator.setFunction(b.id+"._X3D2D_",
function(O,L,M){X.vertices[0].x=O;X.vertices[0].y=L;X.vertices[0].z=M;X.computeDepth(b);return X.projVert[0].x});b.evaluator.setFunction(b.id+"._Y3D2D_",function(O,L,M){X.vertices[0].x=O;X.vertices[0].y=L;X.vertices[0].z=M;X.computeDepth(b);return X.projVert[0].y});b.resizable&&(b.wModExpr=D.evaluator.parser.parse(b.wModExpr),b.hModExpr=D.evaluator.parser.parse(b.hModExpr));b.ratio=1;b.addEvents()}init(D){b=this;b.initSpace();b.canvas&&(b.canvas.width=b.backCanvas.width=b.w,b.canvas.height=b.backCanvas.height=
b.h,b.canvas.style.width=b.backCanvas.style.width=b.w+"px",b.canvas.style.height=b.backCanvas.style.height=b.h+"px");b.w_2=b.w/2;b.h_2=b.h/2;b.w_plus_h=b.w+b.h;b.oldMouse={x:0,y:0};b.S={x:b.h/1080*-20.6*(40/b.scale),y:0,z:0};b.Ojo={x:3*b.w_2,y:0,z:0};b.evaluator.setVariable(b.ojoXStr,b.Ojo.x);b.evaluator.setVariable(b.ojoYStr,b.Ojo.y);b.evaluator.setVariable(b.ojoZStr,b.Ojo.z)}update(D){b=this;h=b.evaluator;c=b.parent;h.setVariable(b.wStr,b.w);h.setVariable(b.hStr,b.h);b.drawIfValue=0<h.eval(b.drawif);
if(b.drawIfValue){b.resizable&&(wModExpr=b.evaluator.eval(b.wModExpr),hModExpr=b.evaluator.eval(b.hModExpr),b.old_w!=wModExpr||b.old_h!=hModExpr)&&(b.w=wModExpr,b.h=hModExpr,b.w_2=b.w/2,b.h_2=b.h/2,h.setVariable(b.wStr,b.w),h.setVariable(b.hStr,b.h),b.old_w=b.w,b.old_h=b.h,b.canvas.width=b.backCanvas.width=b.w*b.ratio,b.canvas.height=b.backCanvas.height=b.h*b.ratio,b.canvas.style.width=b.backCanvas.style.width=b.w+"px",b.canvas.style.height=b.backCanvas.style.height=b.h+"px",D=!0,b.S={x:b.h/1080*
-20.6*(40/b.scale),y:0,z:0},b.Ojo={x:3*b.w_2,y:0,z:0},b.evaluator.setVariable(b.ojoXStr,b.Ojo.x),b.evaluator.setVariable(b.ojoYStr,b.Ojo.y),b.evaluator.setVariable(b.ojoZStr,b.Ojo.z));l=b.x!==h.eval(b.xExpr)+b.displaceRegionWest;m=b.y!==h.eval(b.yExpr)+c.plecaHeight+b.displaceRegionNorth;b.spaceChange=D||l||m||b.drawBefore!==b.drawIfValue||b.Ox!==h.getVariable(b.OxStr)||b.Oy!==h.getVariable(b.OyStr)||b.Ojo.x!==h.getVariable(b.ojoXStr)||b.Ojo.y!==h.getVariable(b.ojoYStr)||b.Ojo.z!==h.getVariable(b.ojoZStr)||
b.scale!==h.getVariable(b.scaleStr);b.x=l?h.eval(b.xExpr)+b.displaceRegionWest:b.x;b.y=m?h.eval(b.yExpr)+c.plecaHeight+b.displaceRegionNorth:b.y;b.Ojo.x=h.getVariable(b.ojoXStr);b.Ojo.y=h.getVariable(b.ojoYStr);b.Ojo.z=h.getVariable(b.ojoZStr);b.Ox=h.getVariable(b.OxStr);b.Oy=h.getVariable(b.OyStr);b.scale=h.getVariable(b.scaleStr);b.drawBefore=b.drawIfValue;if(D||void 0==b.observer){D=0;for(var K=b.parent.controls.length;D<K;D++)b.parent.controls[D].id===b.obsStr&&(Q=!0);b.observer=Q?h.getVariable(b.obsStr)||
2.5*b.w_plus_h:2.5*b.w_plus_h;b.observer=q(b.observer,.25*b.w_plus_h);h.setVariable(b.obsStr,b.observer)}1E-6>b.scale?(b.scale=1E-6,h.setVariable(b.scaleStr,1E-6)):1E6<b.scale&&(b.scale=1E6,h.setVariable(b.scaleStr,1E6));if(l||m)b.container.style.left=b.x+"px",b.container.style.top=b.y+"px";b.container.style.display="block";b.dim=h.getVariable(b.userIDimStr);b.userIntensity=h.getVariable(b.userIIStr);b.light3={x:parseInt(h.getVariable(b.userIxStr)),y:parseInt(h.getVariable(b.userIyStr)),z:parseInt(h.getVariable(b.userIzStr))};
b.updateCamera();b.draw()}else b.container.style.display="none"}updateCamera(){this.eye=a.scalarProduct3D(this.Ojo,1/this.scale)}rotateVertex(D){e=a.degToRad(b.evaluator.getVariable(b.rotZStr));w=d(e);B=n(e);p=D.x*w-D.y*B;k=D.x*B+D.y*w;f=D.z;e=a.degToRad(b.evaluator.getVariable(b.rotYStr));w=d(e);B=n(e);return{x:f*B+p*w,y:k,z:f*w-p*B}}project(D){b=this;this.evaluator.getVariable("URL.oldProj");var K=b.eye.x/(D.x-b.eye.x);return{x:b.getAbsoluteX(K*(b.eye.y-D.y)),y:b.getAbsoluteY(K*(b.eye.z-D.z)),z:b.eye.x-
D.x}}computeColor(D,K,R){"object"!=typeof D&&(D.match("rgba")?D=a.RGBAToHexColor(D):D.match("#")&&(D=new a.Color(D.substring(1))));P=a.subtract3D(this.eye,K.average);E=a.norm3D(P);N=a.scalarProduct3D(P,1/E);this.lights[3]=a.subtract3D(this.light3,K.average);H=a.norm3D(this.lights[3]);for(var O=0,L=this.intensity.length-1;O<L;O++)J[O]=this.intensity[O]*this.dim;J[3]=this.userIntensity*this.userIntensity/H||0;C=R?this.dim/2:this.dim/4;G=0;F=0>K.direction?K.normal:a.scalarProduct3D(K.normal,-1);O=0;
for(L=this.lights.length;O<L;O++){if(R){K=Math;var M=K.max,U=a,I=U.dotProduct3D;var V=this.lights[O];W=a.subtract3D(V,a.scalarProduct3D(F,a.dotProduct3D(V,F)));T=a.add3D(V,a.scalarProduct3D(W,-2));S=a.norm3D(T);V=0!==S?a.scalarProduct3D(T,1/S):a.scalarProduct3D(V,-1);G=M.call(K,0,I.call(U,V,N));G*=G*G}else G=Math.max(0,a.dotProduct3D(this.lights[O],F));C+=J[O]*G}C=Math.min(C,1);y=v(D.r*C);A=v(D.g*C);x=v(D.b*C);return"rgba("+y+","+A+","+x+","+D.a+")"}draw(){this.ctx.clearRect(0,0,this.canvas.width,
this.canvas.height);this.ctx.fillStyle=this.background.getColor();this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height);this.image&&""!=this.image.src&&this.image.ready&&this.image.complete&&("topleft"===this.bg_display?this.ctx.drawImage(this.image,0,0):"stretch"===this.bg_display?this.ctx.drawImage(this.image,0,0,this.w,this.h):"patch"===this.bg_display?(this.ctx.fillStyle=ctx.createPattern(this.image,"repeat"),this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height)):"center"===this.bg_display&&
this.ctx.drawImage(this.image,(this.w-this.image.width)/2,(this.h-this.image.height)/2));if(!this.click){for(var D=0,K=this.graphics.length;D<K;D++)this.graphics[D].update();this.primitives=[];if(this.split)for(D=0,K=this.graphics.length;D<K;D++){g=this.graphics[D];for(var R=D+1;R<K;R++)r=this.graphics[R],g.splitFace(r),r.splitFace(g);this.primitives=this.primitives.concat(g.primitives||[])}else for(D=0,K=this.graphics.length;D<K;D++){g=this.graphics[D];if(g.split)for(R=D+1;R<K;R++)r=this.graphics[R],
r.split&&g.splitFace(r);this.primitives=this.primitives.concat(g.primitives||[])}}D=0;for(K=this.primitives.length;D<K;D++)this.primitives[D].computeDepth(this);this.primitives=this.primitives.sort(function(O,L){return L.depth-O.depth});if("painter"===this.render)this.drawPainter(this.primitives);else for(D=0,K=this.primitives.length;D<K;D++)this.primitives[D].draw(this.ctx,this);D=0;for(K=this.graphicsCtr.length;D<K;D++)this.graphicsCtr[D].draw()}drawPainter(D){for(var K=D.length,R=0;R<K;R++)D[R].drawn=
!1,D[R].draw(this.ctx,this);for(var O=[],L=[],M=0,U=D.length,I=.001,V,Z;;){V=U;for(R=0;R<K;R++)if(!D[R].drawn){Z=!0;for(var Y=0;Y<K;Y++)if(Y!=R&&!D[Y].drawn&&D[R].inFrontOf(O,D[Y],I)){Z=!1;break}Z&&(U--,L[M++]=D[R],D[R].drawn=!0)}if(0==U)break;else if(U==V){if(I*=10,.1<I){for(R=0;R<K;R++)D[R].drawn||(L[M++]=D[R],D[R].drawn=!0);break}}else I=.001}for(R=0;R<K;R++)L[R].draw(this.ctx,this)}rayFromEye(D,K){return{x:-this.eye.x,y:(D-(this.w_2+this.Ox))/this.scale-this.eye.y,z:(this.h_2+this.Oy-K)/this.scale-
this.eye.z}}addEvents(){function D(U){window.focus();document.activeElement.blur();M.click=0;M.evaluator.setVariable(M.id+".mouse_pressed",0);window.removeEventListener("touchmove",L,!1);window.removeEventListener("touchend",D,!1);U.preventDefault();M.parent.update()}function K(U){document.body.focus();M.click=0;M.evaluator.setVariable(M.id+".mouse_pressed",0);U.preventDefault();"R"===M.whichBtn&&(window.removeEventListener("mousemove",O,!1),M.posZoom==M.posZoomNew&&a.showConfig&&M.parent.externalSpace.show());
window.removeEventListener("mousemove",L,!1);window.removeEventListener("mouseup",K,!1);M.parent.update()}function R(U){M.posAnte=a.getCursorPosition(U,M.container);M.mouse_x=M.getRelativeX(M.posAnte.x);M.mouse_y=M.getRelativeY(M.posAnte.y);M.evaluator.setVariable(M.id+".mouse_x",M.mouse_x);M.evaluator.setVariable(M.id+".mouse_y",M.mouse_y);M.parent.update()}function O(U){U.preventDefault();M.posZoomNew=a.getCursorPosition(U,M.container).y;M.evaluator.setVariable(M.scaleStr,M.tempScale+M.tempScale/
45*((M.posZoom-M.posZoomNew)/10));M.posObserverNew=a.getCursorPosition(U,M.container).x;M.evaluator.setVariable(M.obsStr,M.tempObserver-2.5*(M.posObserver-M.posObserverNew));M.parent.update()}function L(U){if(!M.fixed&&M.click){z=(M.getAbsoluteX(M.oldMouse.x)-M.getAbsoluteX(M.mouse_x))/4;u=(-M.getAbsoluteY(M.oldMouse.y)+M.getAbsoluteY(M.mouse_y))/4;if(z!==M.disp.x||u!==M.disp.y)M.alpha=a.degToRad(M.evaluator.getVariable(M.rotZStr)),M.beta=a.degToRad(-M.evaluator.getVariable(M.rotYStr)),M.alpha=a.radToDeg(M.alpha)-
z,M.beta=a.radToDeg(M.beta)-u,M.evaluator.setVariable(M.rotZStr,M.alpha),M.evaluator.setVariable(M.rotYStr,-M.beta),M.disp.x=z,M.disp.y=u,M.oldMouse.x=M.getRelativeX(M.posAnte.x),M.oldMouse.y=M.getRelativeY(M.posAnte.y);R(U);U.preventDefault()}}var M=this;this.canvas.oncontextmenu=function(){return!1};this.canvas.addEventListener("touchstart",function(U){window.focus();document.activeElement.blur();M.click=1;M.evaluator.setVariable(M.id+".mouse_pressed",1);M.parent.deactivateGraphicControls();M.posAnte=
a.getCursorPosition(U,M.container);M.oldMouse.x=M.getRelativeX(M.posAnte.x);M.oldMouse.y=M.getRelativeY(M.posAnte.y);R(U);window.addEventListener("touchmove",L);window.addEventListener("touchend",D);U.preventDefault()});this.canvas.addEventListener("mousedown",function(U){document.body.focus();M.click=1;M.parent.deactivateGraphicControls();M.whichBtn=a.whichBtn(U);"R"===M.whichBtn?(window.addEventListener("mouseup",K),M.posObserver=a.getCursorPosition(U,M.container).x,M.posObserverNew=M.posObserver,
M.posZoom=a.getCursorPosition(U,M.container).y,M.posZoomNew=M.posZoom,M.fixed||(M.tempScale=M.scale,M.tempObserver=M.observer,window.addEventListener("mousemove",O))):"L"==M.whichBtn&&(M.evaluator.setVariable(M.id+".mouse_pressed",1),M.posAnte=a.getCursorPosition(U,M.container),M.oldMouse.x=M.getRelativeX(M.posAnte.x),M.oldMouse.y=M.getRelativeY(M.posAnte.y),R(U),window.addEventListener("mousemove",L),window.addEventListener("mouseup",K));U.preventDefault()});this.disp={x:0,y:0};document.addEventListener("visibilitychange",
function(U){K(U)});document.addEventListener("mouseleave",function(U){K(U)})}}a.Space3D=aa;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var p,k,f,v,q,d;class n extends a.Space{constructor(h,c){super(h,c);p=this.parent.evaluator;void 0!=this._w_&&(h=p.parser.parse(this._w_),this._w_="number"!=h.type?h:void 0);void 0!=this._h_&&(h=p.parser.parse(this._h_),this._h_="number"!=h.type?h:void 0);this.isFirefox=/firefox/i.test(window.navigator.userAgent);this.file=this.file?this.file.trim():"";this.file.match(/^\[/)&&this.file.match(/\]$/)?this.file=p.parser.parse(this.file.substring(1,this.file.length-
1)):this.file.match(/^'/)&&this.file.match(/'$/)?this.file=p.parser.parse(this.file):this.file=p.parser.parse("'"+this.file+"'");this.oldFile=p.eval(this.file);this.MyIFrame=a.newHTML("iframe",{marginheight:0,marginwidth:0,frameborder:0,scrolling:"auto",style:"position:absolute;left:0;top:0;"});0!=this.oldFile&&this.MyIFrame.setAttribute("src",this.oldFile);this.container=a.newHTML("div",{id:this.id,style:`${a.isIOS?"overflow:scroll;-webkit-overflow-scrolling:touch;overflow-scrolling:touch;":""}position:absolute;width:${this.w}px;height:${this.h}px;left:${this.x}px;top:${this.y}px;z-index:${this.zIndex};background-repeat:no-repeat;background-position:center;`});
this.container.appendChild(this.MyIFrame);this.imageSrc&&(this.container.style.backgroundImage="url("+this.imageSrc+")");this.parent.container.insertBefore(this.container,this.parent.loader);var b=this;this.MyIFrame.onload=function(g){var r=this;b.evaluator.setFunction(b.id+".set",function(l,m){r.contentWindow.postMessage({type:"set",name:l,value:m},"*");return 0});b.evaluator.setFunction(b.id+".update",function(){r.contentWindow.postMessage({type:"update"},"*");return 0});b.evaluator.setFunction(b.id+
".exec",function(l,m){r.contentWindow.postMessage({type:"exec",name:l,value:m},"*");return 0});b.evaluator.setFunction(b.id+".changeConf",function(l){if(l){if(a.cacheFiles[l])var m=a.cacheFiles[l];else m=(m=document.getElementById(l))&&"descartes/embed"===m.type?m.textContent:a.openExternalFile(l),m=(m=(new DOMParser).parseFromString(m,"text/html").querySelector("ajs"))?m.innerHTML:"",a.cacheFiles[l]=m;r.contentWindow.postMessage({type:"change_config",filename:l,content:m},"*")}return 0});b.evaluator.setFunction(b.id+
".changeContent",function(l){l&&(l=(l=(new DOMParser).parseFromString(l.replace(/&sq;/g,"'"),"text/html").querySelector("ajs"))?l.innerHTML:"",r.contentWindow.postMessage({type:"change_content",content:l},"*"))});b.ImReady=!b.isFirefox;b.isFirefox||(b.container.style.visibility="visible",b.container.style.opacity="1",b.container.style.zIndex=b.zIndex,b.container.style.display=b.drawIfValue?"block":"none");b.MyIFrame.style.visibility="visible";b.container.style.backgroundImage=""};this.update=this.iframeUpdate;
this.evaluator.setVariable(this.id+"._scroll",0)}init(){q=this;q.initSpace();q.MyIFrame&&Object.assign(q.MyIFrame.style,{width:q.w+"px",height:q.h+"px"})}iframeUpdate(h){p=this.evaluator;this.drawIfValue=0<p.eval(this.drawif);this.ImReady?this.container.style.display=this.drawIfValue?"block":"none":(this.container.style.visibility=this.drawIfValue?"visible":"hidden",this.container.style.opacity=this.drawIfValue?"1":"0",this.container.style.zIndex=this.drawIfValue?this.zIndex:-1E3);if(this.drawIfValue){h&&
(this.x=this.y=Infinity);k=this.x!==p.eval(this.xExpr)+this.displaceRegionWest;f=this.y!==p.eval(this.yExpr)+this.parent.plecaHeight+this.displaceRegionNorth;this.x=k?p.eval(this.xExpr)+this.displaceRegionWest:this.x;this.y=f?p.eval(this.yExpr)+this.parent.plecaHeight+this.displaceRegionNorth:this.y;void 0!=this._w_&&(h=p.eval(this._w_),this.w!==h&&(this.container.style.width=this.MyIFrame.style.width=h+"px",this.w=h));void 0!=this._h_&&(h=p.eval(this._h_),this.h!==h&&(this.container.style.height=
this.MyIFrame.style.height=h+"px",this.h=h));if(k||f)this.container.style.left=this.x+"px",this.container.style.top=this.y+"px";v=p.eval(this.file);v!==this.oldFile&&(this.ImReady=!1,this.isFirefox||(this.container.style.display="block",this.container.style.visibility=this.drawIfValue?"visible":"hidden",this.container.style.opacity=this.drawIfValue?"1":"0",this.container.style.zIndex=this.drawIfValue?this.zIndex:-1E3),this.imageSrc&&(this.container.style.backgroundImage="url("+this.imageSrc+")"),
this.MyIFrame.style.visibility="hidden",this.oldFile=v,this.MyIFrame.contentWindow.location.replace(v));d=p.getVariable(this.id+"._scroll");1==d?(this.MyIFrame.setAttribute("scrolling","yes"),this.MyIFrame.style.overflow=""):-1==d?(this.MyIFrame.setAttribute("scrolling","no"),this.MyIFrame.style.overflow="hidden"):(this.MyIFrame.setAttribute("scrolling","auto"),this.MyIFrame.style.overflow="")}else this.MyIFrame.contentWindow.blur()}}a.SpaceHTMLIFrame=n;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var p=1;class k{constructor(f){this.children=f.children;this.lessonParser=f.lessonParser;this.images=f.images;this.images.length=f.images.length;this.audios=f.audios;this.audios.length=f.audios.length;this.descartesApp=f;this.imgLoader=a.newHTML("div",{class:"DescartesLoaderImage"});this.progress=a.newHTML("progress",{class:"PBL",value:0,max:100});f.imgLoader?(f.loader.style.backgroundColor="rgba(0,0,0,0)",this.imgLoader.setAttribute("style",`background-image:url(${f.imgLoader});background-size:contain;`)):
(p=f.width<f.height?f.width/1144:f.height/1092,p=2.5<p?2.5:p,this.imgLoader.setAttribute("style",`background-image:url(${a.loaderImg.src});background-position:50% 33.5%;background-size:${880*p}px;`),this.progress.setAttribute("style",`visibility:visible;left:${(f.width-726*p)/2}px;top:${33.5*f.height/100+940*p/2}px;width:${726*p}px;height:${14*p}px;`));f.loader.appendChild(this.imgLoader);f.loader.appendChild(this.progress);f.firstRun=!1;this.initPreloader()}initPreloader(){var f=this,v=f.children,
q=f.images,d=f.audios,n=/[\w\.\-//]*(\.png|\.jpg|\.gif|\.svg|\.webp)/gi,h=/[\w\.\-//]*(\.ogg|\.oga|\.mp3|\.wav)/gi;q["lib/DescartesCCLicense.png"]=a.getCCLImg();q["lib/DescartesCCLicense.png"].ready=1;var c,b;var g=0;for(c=v.length;g<c;g++)if("rtf"!==v[g].name){if(v[g].value.match(/'macro'|'makro'/g)){var r="";var l=f.lessonParser.split(v[g].value);var m=0;for(b=l.length;m<b;m++)"expresion"===babel[l[m][0]]&&(r=l[m][1]);if(r)var z=(z=document.getElementById(r))&&"descartes/macro"==z.type?z.text:a.openExternalFile(r);
if(z&&(l=z.match(n)))for(r=0,b=l.length;r<b;r++)m=l[r],m.toLowerCase().match(/vacio.gif$/)||""==m.substring(0,m.length-4)||(q[m]=new Image,q[m].addEventListener("load",function(){this.ready=1}),q[m].addEventListener("error",function(){this.errorload=1}),q[m].src=m)}if(l=v[g].value.match(n))for(r=0,b=l.length;r<b;r++)m=l[r],m.toLowerCase().match(/vacio.gif$/)||""==m.substring(0,m.length-4)||(q[m]=new Image,q[m].addEventListener("load",function(){this.ready=1}),q[m].addEventListener("error",function(){this.errorload=
1}),q[m].src=m);if(l=v[g].value.match(h))for(r=0,m=l.length;r<m;r++)f.initAudio(l[r])}for(let B in q)q.hasOwnProperty(B)&&f.images.length++;for(let B in d)d.hasOwnProperty(B)&&f.audios.length++;var u=f.images.length+f.audios.length;0<u&&f.progress.setAttribute("max",u);var e,w=function(){e=0;for(var B in q)q.hasOwnProperty(B)&&(q[B].ready||q[B].errorload)&&e++;for(B in d)d.hasOwnProperty(B)&&(d[B].ready||d[B].errorload)&&e++;f.progress.setAttribute("value",e);e!=u?f.timer=a.setTimeout(w,1):f.descartesApp.initBuildApp()};
w()}initAudio(f){var v=this.audios;v[f]=new Audio(f);v[f].filename=f;var q=function(){this.ready=1},d=function(){this.canPlayType("audio/"+this.filename.substring(this.filename.length-3))||"mp3"!=this.filename.substring(this.filename.length-3)?(console.warn("El archivo '"+f+"' no puede ser reproducido"),this.errorload=1):(v[f]=new Audio(this.filename.replace("mp3","ogg")),v[f].filename=this.filename.replace("mp3","ogg"),v[f].addEventListener("canplaythrough",q),v[f].addEventListener("load",q),v[f].addEventListener("error",
d),v[f].load())};v[f].addEventListener("canplaythrough",q);v[f].addEventListener("load",q);v[f].addEventListener("error",d);a.hasTouchSupport?(v[f].load(),v[f].play(),a.setTimeout(function(){v[f].pause()},20),v[f].ready=1):v[f].load()}}a.DescartesLoader=k;return a}(descartesJS||{});
descartesJS=function(a){function p(h){for(var c="[",b=0,g=h.length;b<g;b++)Array.isArray(h[b])?c+=p(h[b]):(f=h[b]||0,"string"==typeof f&&(f="'"+f+"'"),c+=f),b<g-1&&(c+=",");return c+"]"}function k(){v=window.innerWidth/this.width;q=window.innerHeight/this.height;a.cssScale=d=Math.min(v,q);this.container.style.transformOrigin="0 0";this.container.parentNode.style.width=window.innerWidth+"px";this.container.parentNode.style.height=window.innerHeight+"px";v<q?(this.container.style.left="0",this.container.style.top=
"50%",this.container.style.transform=`translate3d(0px,0px,0px) scale(${d}) translate(0,-50%)`):(this.container.style.left="50%",this.container.style.top="0",this.container.style.transform=`translate3d(0px,0px,0px) scale(${d}) translate(-50%,0)`)}if(a.loadLib)return a;var f,v,q,d;class n{constructor(h){this.animation={playing:!1,play:function(){},stop:function(){},reinit:function(){}};this.ratio=a._ratio;this.applet=h;this.parentC=h.parentNode;this.width=parseFloat(h.getAttribute("width"));this.height=
parseFloat(h.getAttribute("height"));this.decimal_symbol=".";this.decimal_symbol_regexp=RegExp("\\.","g");this.language="espa\u00f1ol";this.children=h.getElementsByTagName("param");a.ccLicense=!0;for(var c=0,b=this.children.length;c<b;c++)"CreativeCommonsLicense"===this.children[c].name&&(a.ccLicense="no"!==this.children[c].value);this.code=h.getAttribute("code");this.saveState=[];this.images={length:-1};this.audios={length:-1};this.firstRun=!0;this.keyboard=new a.Keyboard(this);this.scaleToFit=function(){};
this.init()}init(){this.stop();this.evaluator=new a.Evaluator(this);this.evaluator.setVariable("DJS.w",this.width);this.evaluator.setVariable("DJS.h",this.height);this.getURLParameters();this.lessonParser=new a.LessonParser(this);this.arquimedes=/DescartesWeb2_0|Arquimedes|Discurso/i.test(this.code);this.licenseA=a.ccLicense?"{\\rtf1\\uc0{\\fonttbl\\f0\\fcharset0 Arial;}{\\f0\\fs34 __________________________________________________________________________________\\par \\fs22                                        Los contenidos de esta unidad did\u00e1ctica interactiva est\u00e1n bajo una licencia {\\*\\hyperlink Creative Commons|https://creativecommons.org/licenses/by-nc-sa/4.0/deed.es}, si no se indica lo contrario.\\par                                        La unidad did\u00e1ctica fue creada con Descartes, que es un producto de c\u00f3digo abierto, {\\*\\hyperlink Creditos|https://arquimedes.matem.unam.mx/Descartes5/creditos/conCCL.html}\\par }":
"";for(var h=this.children,c,b=0,g=0,r=a.ccLicense?90:0,l=0,m=h.length;l<m;l++)c=h[l],"rtf_height"==c.name&&(b=parseInt(c.value)+120||this.height),"Buttons"==babel[c.name]&&(this.buttonsConfig=this.lessonParser.parseButtonsConfig(c.value),g=this.buttonsConfig.height),"image_loader"==c.name&&(this.imgLoader=c.value),"expand"==c.name&&(this.expand=c.value),"docBase"==c.name&&(this.docBase=c.value,c=a.newHTML("base",{id:"descartesJS_base",href:this.docBase}),document.head.appendChild(c));this.arquimedes&&
(this.ratio=1,b&&(this.height=b+g+r));this.externalSpace&&document.body.removeChild(this.externalSpace.container);this.externalSpace=new a.SpaceExternal(this);this.northSpace={container:a.newHTML("div"),controls:[]};this.southSpace={container:a.newHTML("div"),controls:[]};this.eastSpace={container:a.newHTML("div"),controls:[]};this.westSpace={container:a.newHTML("div"),controls:[]};this.editableRegion={container:a.newHTML("div"),textFields:[]};this.controls=[];this.auxiliaries=[];this.events=[];this.nIframes=
this.plecaHeight=this.tabindex=this.zIndex=0;void 0!=this.container&&(this.cleanCanvasImages(),this.parentC.removeChild(this.container),delete this.container,delete this.loader);this.container=a.newHTML("div");this.loader=a.newHTML("div",{class:"DescartesLoader"});this.parentC.insertBefore(this.container,this.parentC.firstChild);this.container.width=this.loader.width=this.width;this.container.height=this.loader.height=this.height;this.container.className="DescartesAppContainer";this.container.setAttribute("style",
`width:${this.width}px;height:${this.height}px;`);this.container.appendChild(this.loader);"fit"==this.expand&&(this.container.parentNode.removeAttribute("align"),this.container.parentNode.style.overflow="hidden",this.scaleToFit=k,this.scaleToFit());"cover"==this.expand&&(this.scaleToFit=function(){this.width=window.innerWidth;this.height=window.innerHeight;this.container.width=this.width;this.container.height=this.height;this.container.setAttribute("style",`width:${this.width}px;height:${this.height}px;`);
if(this.spaces)for(var z=0,u=this.spaces.length;z<u;z++)this.spaces[z].initSpace(),this.spaces[z].init(),this.spaces[z].update(!0)},this.scaleToFit());this.spaces=[];this.firstRun?(this.loader.style.display="block",new a.DescartesLoader(this)):this.initBuildApp()}initBuildApp(){a.showConfig=!0;for(var h=this.children,c,b=this.lessonParser,g=[],r=[],l=[],m=[],z=[],u=[],e=0,w=h.length;e<w;e++)if(c=h[e],"editable"==babel[c.name])a.showConfig="false"!=babel[c.value];else if("language"==babel[c.name])this.language=
c.value;else if("pleca"==c.name)c=b.parsePleca(c.value,this.width),this.container.insertBefore(c,this.loader),this.plecaHeight=c.imageHeight?c.imageHeight:c.offsetHeight;else if("Buttons"==babel[c.name])this.buttonsConfig=b.parseButtonsConfig(c.value);else if("decimal_symbol"==babel[c.name])this.decimal_symbol=c.value,this.decimal_symbol_regexp=new RegExp("\\"+this.decimal_symbol,"g");else if("version"==babel[c.name])this.version=parseInt(c.value);else if("language"==babel[c.name])this.language=c.value;
else if("rtf"==c.name){var B=(this.width-780)/2,y=parseInt(this.height)-this.plecaHeight-this.buttonsConfig.height-45;m.push(`space='descartesJS_stage' type='text' abs_coord='yes' expresion='[10,20]' background='yes' text='${c.value.replace(/'/g,"&squot;")}'`,`space='descartesJS_stage' type='text' abs_coord='yes' expresion='[${B},${y-25}]' background='yes' text='${this.licenseA}'`);a.ccLicense&&m.push(`space='descartesJS_stage' type='image' expresion='[${B+15},${y}]' background='yes' abs_coord='yes' file='lib/DescartesCCLicense.png'`)}else"E"==
c.name.charAt(0)?(c.value.match(/'HTMLIFrame'/)&&this.nIframes++,g.push(c.value)):/^C_/.test(c.name)?r.push(c.value):/^A_/.test(c.name)?l.push(c.value):/^G_/.test(c.name)?(c.value.match(/type='fill'|tipo='relleno'|tipus='ple'|mota='betea'|type='plein'|tipo='recheo'|tipo='curva_piena'|tipo='preencher'|tipus='ple'/)&&(this.ratio=1),m.push(c.value)):/^S_/.test(c.name)?z.push(c.value):"Animation"==babel[c.name]&&u.push(c.value);this.arquimedes&&(this.stage={container:a.newHTML("div",{id:"descartesJS_Stage"}),
scroll:0},this.stage.stageSpace=this.lessonParser.parseSpace(`tipo='R2' id='descartesJS_stage' fondo='${a.TextController?"ffffffff":"blanco"}' x='0' y='0' fijo='yes' red='no' red10='no' ejes='no' text='no' ancho='${this.width}' alto='${this.height}'`),this.stage.container.appendChild(this.stage.stageSpace.container),this.container.appendChild(this.stage.container),this.spaces.push(this.stage.stageSpace));e=0;for(w=g.length;e<w;e++)h=b.parseSpace(g[e]),this.arquimedes&&this.stage.container.appendChild(h.container),
this.spaces.push(h),this.zIndex++;e=0;for(w=m.length;e<w;e++)if(a.DEBUG.elemIndex=e,g=b.parseGraphic(m[e]))this.editableRegionVisible=this.editableRegionVisible||g.visible,g.space.addGraph(g);e=0;for(w=z.length;e<w;e++)(g=b.parse3DGraphic(z[e]))&&g.space.addGraph(g,!0);e=0;for(w=r.length;e<w;e++)this.controls.push(b.parseControl(r[e]));e=0;for(w=l.length;e<w;e++)b.parseAuxiliar(l[e]);e=0;for(w=u.length;e<w;e++)this.animation=b.parseAnimation(u[e]);this.configRegions();this.updateAuxiliaries();this.updateAuxiliaries();
e=0;for(w=this.controls.length;e<w;e++)this.controls[e].init();this.updateControls();this.updateSpaces(!0);var A=this;this.nIframes?a.setTimeout(function(){A.finishInit()},200*this.nIframes):this.finishInit()}finishInit(){this.evaluator.setVariable("decimalSymbol",this.decimal_symbol);this.update();this.loader.style.display="none";window.parent!==window&&(this.parentC.style.margin=this.parentC.style.padding="0px","fit"==this.expand&&window.addEventListener("touchmove",b=>{b.preventDefault();b.stopPropagation()}),
window.parent.postMessage({type:"reportSize",href:window.location.href,width:this.width,height:this.height},"*"),window.parent.postMessage({type:"ready",value:window.location.href},"*"),a.onResize());window.opener&&window.opener.postMessage({type:"isResizeNeeded",href:window.location.href},"*");this.externalSpace.init();try{var h=new CustomEvent("descartesReady",{detail:this});window.dispatchEvent(h)}catch(b){console.warn("CustomEvents not supported in this browser")}let c=this;this.evaluator.setFunction("openKB",
function(b,g,r,l,m,z,u,e,w,B,y){c.keyboard.show(null,b,g,r,l,{x:m,y:z,w:u,h:e,fs:w+"px",value:B+"",type:"custom",tagName:"textfield"},y)});this.readyApp=!0}adjustSize(){document.body.style.margin=document.body.style.padding=this.parentC.style.margin=this.parentC.style.padding="0px";var h=parseInt(this.width)+30,c=parseInt(this.height)+90;window.moveTo((parseInt(screen.width)-h)/2,(parseInt(screen.height)-c)/2);window.resizeTo(h,c);a.onResize()}configRegions(){var h=this.evaluator.parser,c=this.buttonsConfig||
{},b=this.container,g="15",r=100,l=100,m=100,z=100;2==this.version&&(g="14",r=63,l=50,m=44,z=53);var u=0,e=0,w=0,B=0,y=0,A=this.northSpace.controls,x=this.southSpace.controls,H=this.eastSpace.controls,J=this.westSpace.controls;if(0<c.rowsNorth||0<A.length||c.about||c.config){0>=c.rowsNorth?(u=c.height,c.rowsNorth=1):u=c.height*c.rowsNorth;var C=this.northSpace.container;C.id="descartesJS_north";C.setAttribute("style",`width:${b.width}px;height:${u}px;left:0;top:${this.plecaHeight}px;`);b.insertBefore(C,
this.loader);C=b.width;var G=0;c.about?(G=r,C-=G):r=0;c.config&&(C-=l);var F=Math.ceil(A.length/c.rowsNorth),P=C/F;var E=0;for(var N=A.length;E<N;E++)A[E].expresion=h.parse(`(${G+E%F*P},${c.height*Math.floor(E/F)},${P},${c.height})`),A[E].init();c.about&&(E=new a.Button(this,{region:"north",name:"english"==this.language?"about":"cr\u00e9ditos",font_size:h.parse(g),expresion:h.parse(`(0,0,${r},${u})`)}),E.actionExec={execute:a.showAbout},E.update());c.config&&(new a.Button(this,{region:"north",name:"config",
font_size:h.parse(g),action:"config",expresion:h.parse(`(${C+r},0,${l},${u})`)})).update()}if(0<c.rowsSouth||0<x.length||c.init||c.clear){0>=c.rowsSouth?(e=c.height,c.rowsSouth=1):e=c.height*c.rowsSouth;r=b.width;G=0;c.init?(G=m,r-=G):m=0;c.clear&&(r-=z);C=this.southSpace.container;C.id="descartesJS_south";C.setAttribute("style",`width:${b.width}px;height:${e}px;left:0;bottom:0;`);b.insertBefore(C,this.loader);F=Math.ceil(x.length/c.rowsSouth);P=r/F;E=0;for(N=x.length;E<N;E++)x[E].expresion=h.parse(`(${G+
E%F*P},${c.height*Math.floor(E/F)},${P},${c.height})`),x[E].init();c.init&&(new a.Button(this,{region:"south",name:"english"==this.language?"init":"inicio",font_size:h.parse(g),action:"init",expresion:h.parse(`(0,0,${m},${e})`)})).update();c.clear&&(new a.Button(this,{region:"south",name:"english"==this.language?"clear":"limpiar",font_size:h.parse(g),action:"clear",expresion:h.parse(`(${r+m},0,${z},${e})`)})).update()}if(0<H.length)for(E=b.height-u-e,B=c.widthEast,C=this.eastSpace.container,C.id=
"descartesJS_east",C.setAttribute("style",`width:${B}px;height:${E}px;right:0;top:${u}px;`),b.insertBefore(C,this.loader),E=0,N=H.length;E<N;E++)H[E].expresion=h.parse(`(0,${c.height*E},${B},${c.height})`),H[E].init();if(0<J.length)for(E=b.height-u-e,y=c.widthWest,C=this.westSpace.container,C.id="descartesJS_west",C.setAttribute("style",`width:${y}px;height:${E}px;left:0;top:${u}px;`),b.insertBefore(C,this.loader),E=0,N=J.length;E<N;E++)J[E].expresion=h.parse(`(0,${c.height*E},${y},${c.height}`),
J[E].init();if(this.editableRegionVisible)for(w=c.height,C=this.editableRegion.container,C.id="descartesJS_editableRegion",C.setAttribute("style",`position:absolute;width:${b.width}px;height:${w}px;left:0;top:${b.height-e-c.height}px;`),b.insertBefore(C,this.loader),h=this.editableRegion.textFields,b=b.width/h.length,c=a.getFieldFontSize(w),E=0,N=h.length;E<N;E++)"div"==h[E].type?(C.appendChild(h[E].container),h[E].container.setAttribute("style",`font-family:${a.sansserif_font};width:${b-4}px;height:${w}px;position:absolute;left:${E*
b}px;top:0;`),J=h[E].container.firstChild,J.setAttribute("style",`font-family:${a.sansserif_font};font-size:${c}px;padding-top:0;background-color:#e0e4e8;position:absolute;left:0;top:0;height:${w}px;text-align:center;line-height:${w}px;`),H=J.offsetWidth,J.style.width=H+"px",J.firstChild.textContent=J.firstChild.textContent.substring(3,J.firstChild.textContent.length-3),h[E].container.lastChild.setAttribute("style",`font-family:${a.monospace_font};font-size:${c}px;width:${b-H}px;height:${w}px;position:absolute;left:${H}px;top:0;border:2px groove white;`)):
(C.appendChild(h[E]),h[E].setAttribute("style",`font-family:${a.monospace_font};font-size:${c}px;width:${b}px;height:${w}px;position:absolute;left:${E*b}px;top:0;border:2px groove white;`));this.displaceRegionNorth=u;this.displaceRegionSouth=e+(w||0);this.displaceRegionEast=B;this.displaceRegionWest=y;E=0;for(N=this.spaces.length;E<N;E++)this.spaces[E].init()}update(){this.updateAuxiliaries();this.updateControls();this.updateEvents();this.updateControls();this.updateSpaces()}clearClick(){for(var h=
0,c=this.spaces.length;h<c;h++)this.spaces[h].clearClick()}removeButtonClick(){a.newBlobContent=null;for(var h=0,c=this.controls.length;h<c;h++)this.controls[h].buttonClick=!1}deactivateGraphicControls(){for(var h,c=0,b=this.controls.length;c<b;c++)h=this.controls[c],"GraphicControl"==h.type&&h.deactivate()}updateAuxiliaries(){for(var h=0,c=this.auxiliaries.length;h<c;h++)this.auxiliaries[h].update()}updateEvents(){for(var h=0,c=this.events.length;h<c;h++)this.events[h].update()}updateControls(){for(var h=
0,c=this.controls.length;h<c;h++)this.controls[h].update()}updateSpaces(h){for(var c=0,b=this.spaces.length;c<b;c++)this.spaces[c].update(h)}clear(){for(var h=0,c=this.spaces.length;h<c;h++)this.spaces[h].spaceChange=!0,this.spaces[h].drawBackground&&this.spaces[h].drawBackground()}play(){this.animation.play()}stop(){this.animation.stop()}reinitAnimation(){this.animation.reinit()}stopAudios(){this.stop();for(var h in this.audios)this.audios.hasOwnProperty(h)&&this.audios[h].pause&&(this.audios[h].pause(),
this.audios[h].currentTime=0)}getImage(h){var c=this.images;return h?(c[h]||(c[h]=new Image,c[h].addEventListener("load",function(){this.ready=1}),c[h].addEventListener("error",function(){this.ready=0;this.errorload=1}),c[h].src=h),c[h]):new Image}getAudio(h){var c=this.audios;if(h){if(!c[h]){h.lastIndexOf(".");c[h]=new Audio(h);var b=function(r){this.ready=1};c[h].addEventListener("canplaythrough",b);var g=function(r){this.canPlayType("audio/"+h.substring(h.length-3))||"mp3"!=h.substring(h.length-
3)?(console.warn("El archivo '"+h+"' no puede ser reproducido"),this.errorload=1):(c[h]=new Audio(h.replace("mp3","ogg")),c[h].addEventListener("canplaythrough",b),c[h].addEventListener("load",b),c[h].addEventListener("error",g),c[h].load())};c[h].addEventListener("error",g);c[h].play();a.setTimeout(function(){c[h].pause()},15)}return c[h]}return new Audio}getControlByCId(h){return this.getControlById(h,!0)}getControlById(h,c){c=c?"cID":"id";for(var b,g=0,r=this.controls.length;g<r;g++)if(b=this.controls[g],
b[c]==h)return b;return{update:function(){},w:0,h:0}}getSpaceByCId(h){return this.getSpaceById(h,!0)}getSpaceById(h,c){c=c?"cID":"id";for(var b,g=0,r=this.spaces.length;g<r;g++)if(b=this.spaces[g],b[c]==h)return b;return{update:function(){},w:0,h:0}}getURLParameters(){let h=window.location.href;var c=h.indexOf("?");if(-1!=c){h=decodeURIComponent(h.substring(c+1)).split("&");for(var b=0,g=h.length;b<g;b++)c=h[b].split("="),2==c.length&&(+c[1]==+c[1]&&(c[1]=parseFloat(c[1])),this.evaluator.setVariable("URL."+
c[0],c[1]))}}getState(){var h="",c=this.evaluator.variables,b;for(b in c)if(c.hasOwnProperty(b)){var g=c[b];"string"==typeof g&&(g="'"+g+"'");void 0!=g&&"rnd"!=b&&"\u03c0"!=b&&"pi"!=b&&"e"!=b&&"Infinity"!=b&&"-Infinity"!=b&&"object"!=typeof g&&(h=""!=h?h+"\n"+b+"="+g:b+"="+g)}g=this.evaluator.vectors;for(var r in g)g.hasOwnProperty(r)&&(h+="\n"+r+"="+p(g[r]));r=this.evaluator.matrices;for(var l in r)r.hasOwnProperty(l)&&(h+="\n"+l+"="+p(r[l]));return h}setState(h,c){h=h.split("\n");for(var b,g,r=
0,l=h.length;r<l;r++)b=h[r].split("="),2<=b.length&&(g=eval(b[1]),-1!=b[1].indexOf("[[")?(this.evaluator.matrices[b[0]]=g,this.evaluator.matrices[b[0]].rows=g.length,this.evaluator.matrices[b[0]].cols=g[0].length):-1!=b[1].indexOf("[")?(this.evaluator.vectors[b[0]]=g,this.evaluator.variables[b[0]+".long"]=g.length):this.evaluator.variables[b[0]]=g);c||this.update()}getEvaluation(){for(var h=correct=0,c="",b=0,g=this.controls.length;b<g;b++)"textfield"==this.controls[b].gui&&this.controls[b].evaluate&&
(h++,correct+=this.controls[b].ok,this.controls[b].value=""==this.controls[b].value?"''":this.controls[b].value,c+=" \\n "+this.controls[b].id+"="+this.controls[b].value+"|"+this.controls[b].ok);return"questions="+h+" \\n correct="+correct+" \\n wrong="+(h-correct)+c}showSolution(){for(var h=this.controls,c=0,b=h.length;c<b;c++)"textfield"==h[c].gui&&h[c].evaluate&&h[c].changeValue(h[c].getFirstAnswer());this.update()}showAnswer(){for(var h=0,c=this.saveState.length;h<c;h++)this.evaluator.eval(this.saveState[h]);
this.update()}cleanCanvasImages(){this.container.querySelectorAll("canvas").forEach(h=>{h.width=h.height=1;h.style.width=h.style.height="1px"});this.spaces.forEach(h=>{h.canvas&&(h.canvas=h.ctx=null);h.backCanvas&&(h.backCanvas=h.backCtx=null)});for(let h in this.images)this.images[h].nodeName&&"canvas"===this.images[h].nodeName.toLowerCase()&&delete this.images[h]}}a.DescartesApp=n;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.DEBUG={PARENTHESIS_CLOSING:"Faltan par\u00e9ntesis por cerrar",PARENTHESIS_OPENING:"Faltan par\u00e9ntesis por abrir",BRACKET_CLOSING:"Faltan corchetes por cerrar",BRACKET_OPENING:"Faltan corchetes por abrir",INCOMPLETE_IF:"Condicional incompleta",EXPRESSION:"En la expresi\u00f3n",setError:function(p,k){p=`Error: ${p} en\u300a ${k} \u300b`;var f="";switch(a.DEBUG.objectName){case "Auxiliar":k="event"===a.DEBUG.typeName||"algorithm"===a.DEBUG.typeName||
"constant"===a.DEBUG.typeName?"En el programa ":"En la definici\u00f3n ";if("doExpr"==babel[a.DEBUG.paramName]||"init"==babel[a.DEBUG.paramName])f=" en la l\u00ednea "+(a.DEBUG.lineCount+1);p+=`${k}\u300c${a.DEBUG.idName}\u300d, en el par\u00e1metro \u300c${a.DEBUG.paramName}\u300d${f}.`;break;case "Graphic":p+=`En el gr\u00e1fico #${a.DEBUG.elemIndex+1} de tipo \u300c${a.DEBUG.idName}\u300d, en el par\u00e1metro \u300c${a.DEBUG.paramName}\u300d.`}console.info(p)}};return a}(descartesJS||{});
descartesJS=function(a){function p(){k().forEach(d=>{a.apps.push(new a.DescartesApp(d));d.className="DescartesJS"})}function k(){return[...document.querySelectorAll("applet,ajs")].filter(d=>/Descartes|DescartesJS|descinst.DescartesWeb2_0.class|Arquimedes|Discurso/i.test(d.getAttribute("code")))}function f(){document.querySelectorAll(".DescartesAppContainer").forEach(d=>{d.remove()})}async function v(d){await document.fonts.ready;d=a.newHTML("div");var n='<div style="font-size:12px;visibility:hidden;">';
"descartesJS_serif descartesJS_sansserif descartesJS_monospace DJS_symbol DJS_sansserif DJS_serif DJS_monospace DJS_math".split(" ").forEach(h=>{n+=`<div style="font-family:${h};"><span>_</span><span style="font-weight:bold;">_</span><span style="font-style:italic;">_</span><span style="font-weight:bold;font-style:italic;">_</span></div>`});d.innerHTML=n+"</div>";document.body.appendChild(d);a.getFeatures();a.hasCanvas?(window.scrollTo(0,100),f(),p(),window.addEventListener("resize",a.onResize),window.scrollTo(0,
0)):document.getElementById("StyleDescartesApps").innerHTML="applet.DescartesJS,applet,ajs.DescartesJS,ajs{display:block;}";d.remove()}if(a.loadLib)return a;a.apps=[];a.getDescartesApps=function(){return a.apps};(function(){var d=document.getElementById("StyleDescartesApps");d&&d.remove();d=a.newHTML("style",{id:"StyleDescartesApps",type:"text/css",rel:"stylesheet"});d.innerHTML="applet.DescartesJS,applet,ajs.DescartesJS,ajs{display:none;}";document.head.appendChild(d)})();a.onResize=function(d){0<
a.apps.length&&a.apps[0].scaleToFit()};var q={};a.onMessage=function(d){if(0<a.apps.length){var n=d.data;if(n)if("set"===n.type)"string"==typeof n.value||"number"==typeof n.value?a.apps[0].evaluator.setVariable(n.name,n.value):n.value&&void 0!=n.value.rows?a.apps[0].evaluator.matrices[n.name]=n.value:a.apps[0].evaluator.vectors[n.name]=n.value;else if("update"===n.type)a.apps[0].update();else if("exec"===n.type)(d=a.apps[0].evaluator.getFunction(n.name))&&d.apply(a.apps[0].evaluator,n.value.toString().split(","));
else if("isResizeNeeded"===n.type)d.source.postMessage({type:"doResize"},"*");else if("doResize"===n.type)0<a.apps.length&&a.apps[0].adjustSize();else if("change_config"===n.type){q[n.filename]?d=q[n.filename]:(d=a.newHTML("div"),d.innerHTML=n.content,d=d.getElementsByTagName("param"),q[n.filename]=d);let h=document.querySelector("base");h||(h=a.newHTML("base"),document.body.appendChild(h));h.setAttribute("href",n.filename);a.apps[0].children=d;a.apps[0].init()}else"change_content"===n.type&&(d=a.newHTML("div"),
d.innerHTML=n.content,d=d.getElementsByTagName("param"),a.apps[0].children=d,a.apps[0].init())}};void 0==a.loadLib&&(a.loadLib=!0,window.addEventListener("load",v),window.addEventListener("message",a.onMessage),["webkitTransitionEnd","transitionend","oTransitionEnd","MSTransitionEnd"].forEach(d=>{window.addEventListener(d,n=>{a.onResize(n)})}));return a}(descartesJS||{});
