/*
 Joel Espinosa Longi
 jlongi@im.unam.mx
 https://github.com/jlongi/DescartesJS
 LGPL - http://www.gnu.org/licenses/lgpl.html
 2023-11-16
*/
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.arrayIteratorImpl=function(a){var h=0;return function(){return h<a.length?{done:!1,value:a[h++]}:{done:!0}}};$jscomp.arrayIterator=function(a){return{next:$jscomp.arrayIteratorImpl(a)}};$jscomp.makeIterator=function(a){var h="undefined"!=typeof Symbol&&Symbol.iterator&&a[Symbol.iterator];return h?h.call(a):$jscomp.arrayIterator(a)};$jscomp.arrayFromIterator=function(a){for(var h,d=[];!(h=a.next()).done;)d.push(h.value);return d};
$jscomp.arrayFromIterable=function(a){return a instanceof Array?a:$jscomp.arrayFromIterator($jscomp.makeIterator(a))};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.SIMPLE_FROUND_POLYFILL=!1;$jscomp.objectCreate=$jscomp.ASSUME_ES5||"function"==typeof Object.create?Object.create:function(a){var h=function(){};h.prototype=a;return new h};$jscomp.underscoreProtoCanBeSet=function(){var a={a:!0},h={};try{return h.__proto__=a,h.a}catch(d){}return!1};
$jscomp.setPrototypeOf="function"==typeof Object.setPrototypeOf?Object.setPrototypeOf:$jscomp.underscoreProtoCanBeSet()?function(a,h){a.__proto__=h;if(a.__proto__!==h)throw new TypeError(a+" is not extensible");return a}:null;
$jscomp.inherits=function(a,h){a.prototype=$jscomp.objectCreate(h.prototype);a.prototype.constructor=a;if($jscomp.setPrototypeOf){var d=$jscomp.setPrototypeOf;d(a,h)}else for(d in h)if("prototype"!=d)if(Object.defineProperties){var e=Object.getOwnPropertyDescriptor(h,d);e&&Object.defineProperty(a,d,e)}else a[d]=h[d];a.superClass_=h.prototype};$jscomp.getGlobal=function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global&&null!=global?global:a};$jscomp.global=$jscomp.getGlobal(this);
$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(a,h,d){a!=Array.prototype&&a!=Object.prototype&&(a[h]=d.value)};$jscomp.polyfill=function(a,h,d,e){if(h){d=$jscomp.global;a=a.split(".");for(e=0;e<a.length-1;e++){var q=a[e];q in d||(d[q]={});d=d[q]}a=a[a.length-1];e=d[a];h=h(e);h!=e&&null!=h&&$jscomp.defineProperty(d,a,{configurable:!0,writable:!0,value:h})}};$jscomp.FORCE_POLYFILL_PROMISE=!1;
$jscomp.polyfill("Promise",function(a){function h(){this.batch_=null}function d(a){return a instanceof q?a:new q(function(b,e){b(a)})}if(a&&!$jscomp.FORCE_POLYFILL_PROMISE)return a;h.prototype.asyncExecute=function(a){if(null==this.batch_){this.batch_=[];var b=this;this.asyncExecuteFunction(function(){b.executeBatch_()})}this.batch_.push(a)};var e=$jscomp.global.setTimeout;h.prototype.asyncExecuteFunction=function(a){e(a,0)};h.prototype.executeBatch_=function(){for(;this.batch_&&this.batch_.length;){var a=
this.batch_;this.batch_=[];for(var e=0;e<a.length;++e){var d=a[e];a[e]=null;try{d()}catch(c){this.asyncThrow_(c)}}}this.batch_=null};h.prototype.asyncThrow_=function(a){this.asyncExecuteFunction(function(){throw a;})};var q=function(a){this.state_=0;this.result_=void 0;this.onSettledCallbacks_=[];var b=this.createResolveAndReject_();try{a(b.resolve,b.reject)}catch(m){b.reject(m)}};q.prototype.createResolveAndReject_=function(){function a(a){return function(c){d||(d=!0,a.call(e,c))}}var e=this,d=!1;
return{resolve:a(this.resolveTo_),reject:a(this.reject_)}};q.prototype.resolveTo_=function(a){if(a===this)this.reject_(new TypeError("A Promise cannot resolve to itself"));else if(a instanceof q)this.settleSameAsPromise_(a);else{a:switch(typeof a){case "object":var b=null!=a;break a;case "function":b=!0;break a;default:b=!1}b?this.resolveToNonPromiseObj_(a):this.fulfill_(a)}};q.prototype.resolveToNonPromiseObj_=function(a){var b=void 0;try{b=a.then}catch(m){this.reject_(m);return}"function"==typeof b?
this.settleSameAsThenable_(b,a):this.fulfill_(a)};q.prototype.reject_=function(a){this.settle_(2,a)};q.prototype.fulfill_=function(a){this.settle_(1,a)};q.prototype.settle_=function(a,e){if(0!=this.state_)throw Error("Cannot settle("+a+", "+e+"): Promise already settled in state"+this.state_);this.state_=a;this.result_=e;this.executeOnSettledCallbacks_()};q.prototype.executeOnSettledCallbacks_=function(){if(null!=this.onSettledCallbacks_){for(var a=0;a<this.onSettledCallbacks_.length;++a)p.asyncExecute(this.onSettledCallbacks_[a]);
this.onSettledCallbacks_=null}};var p=new h;q.prototype.settleSameAsPromise_=function(a){var b=this.createResolveAndReject_();a.callWhenSettled_(b.resolve,b.reject)};q.prototype.settleSameAsThenable_=function(a,e){var b=this.createResolveAndReject_();try{a.call(e,b.resolve,b.reject)}catch(c){b.reject(c)}};q.prototype.then=function(a,e){function b(a,b){return"function"==typeof a?function(b){try{c(a(b))}catch(z){f(z)}}:b}var c,f,g=new q(function(a,b){c=a;f=b});this.callWhenSettled_(b(a,c),b(e,f));return g};
q.prototype.catch=function(a){return this.then(void 0,a)};q.prototype.callWhenSettled_=function(a,e){function b(){switch(c.state_){case 1:a(c.result_);break;case 2:e(c.result_);break;default:throw Error("Unexpected state: "+c.state_);}}var c=this;null==this.onSettledCallbacks_?p.asyncExecute(b):this.onSettledCallbacks_.push(b)};q.resolve=d;q.reject=function(a){return new q(function(b,e){e(a)})};q.race=function(a){return new q(function(b,e){for(var c=$jscomp.makeIterator(a),f=c.next();!f.done;f=c.next())d(f.value).callWhenSettled_(b,
e)})};q.all=function(a){var b=$jscomp.makeIterator(a),e=b.next();return e.done?d([]):new q(function(a,f){function c(c){return function(f){k[c]=f;m--;0==m&&a(k)}}var k=[],m=0;do k.push(void 0),m++,d(e.value).callWhenSettled_(c(k.length-1),f),e=b.next();while(!e.done)})};return q},"es6","es3");$jscomp.SYMBOL_PREFIX="jscomp_symbol_";$jscomp.initSymbol=function(){$jscomp.initSymbol=function(){};$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol)};
$jscomp.SymbolClass=function(a,h){this.$jscomp$symbol$id_=a;$jscomp.defineProperty(this,"description",{configurable:!0,writable:!0,value:h})};$jscomp.SymbolClass.prototype.toString=function(){return this.$jscomp$symbol$id_};$jscomp.Symbol=function(){function a(d){if(this instanceof a)throw new TypeError("Symbol is not a constructor");return new $jscomp.SymbolClass($jscomp.SYMBOL_PREFIX+(d||"")+"_"+h++,d)}var h=0;return a}();
$jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var a=$jscomp.global.Symbol.iterator;a||(a=$jscomp.global.Symbol.iterator=$jscomp.global.Symbol("Symbol.iterator"));"function"!=typeof Array.prototype[a]&&$jscomp.defineProperty(Array.prototype,a,{configurable:!0,writable:!0,value:function(){return $jscomp.iteratorPrototype($jscomp.arrayIteratorImpl(this))}});$jscomp.initSymbolIterator=function(){}};
$jscomp.initSymbolAsyncIterator=function(){$jscomp.initSymbol();var a=$jscomp.global.Symbol.asyncIterator;a||(a=$jscomp.global.Symbol.asyncIterator=$jscomp.global.Symbol("Symbol.asyncIterator"));$jscomp.initSymbolAsyncIterator=function(){}};$jscomp.iteratorPrototype=function(a){$jscomp.initSymbolIterator();a={next:a};a[$jscomp.global.Symbol.iterator]=function(){return this};return a};$jscomp.generator={};
$jscomp.generator.ensureIteratorResultIsObject_=function(a){if(!(a instanceof Object))throw new TypeError("Iterator result "+a+" is not an object");};$jscomp.generator.Context=function(){this.isRunning_=!1;this.yieldAllIterator_=null;this.yieldResult=void 0;this.nextAddress=1;this.finallyAddress_=this.catchAddress_=0;this.finallyContexts_=this.abruptCompletion_=null};
$jscomp.generator.Context.prototype.start_=function(){if(this.isRunning_)throw new TypeError("Generator is already running");this.isRunning_=!0};$jscomp.generator.Context.prototype.stop_=function(){this.isRunning_=!1};$jscomp.generator.Context.prototype.jumpToErrorHandler_=function(){this.nextAddress=this.catchAddress_||this.finallyAddress_};$jscomp.generator.Context.prototype.next_=function(a){this.yieldResult=a};
$jscomp.generator.Context.prototype.throw_=function(a){this.abruptCompletion_={exception:a,isException:!0};this.jumpToErrorHandler_()};$jscomp.generator.Context.prototype.return=function(a){this.abruptCompletion_={return:a};this.nextAddress=this.finallyAddress_};$jscomp.generator.Context.prototype.jumpThroughFinallyBlocks=function(a){this.abruptCompletion_={jumpTo:a};this.nextAddress=this.finallyAddress_};$jscomp.generator.Context.prototype.yield=function(a,h){this.nextAddress=h;return{value:a}};
$jscomp.generator.Context.prototype.yieldAll=function(a,h){a=$jscomp.makeIterator(a);var d=a.next();$jscomp.generator.ensureIteratorResultIsObject_(d);if(d.done)this.yieldResult=d.value,this.nextAddress=h;else return this.yieldAllIterator_=a,this.yield(d.value,h)};$jscomp.generator.Context.prototype.jumpTo=function(a){this.nextAddress=a};$jscomp.generator.Context.prototype.jumpToEnd=function(){this.nextAddress=0};
$jscomp.generator.Context.prototype.setCatchFinallyBlocks=function(a,h){this.catchAddress_=a;void 0!=h&&(this.finallyAddress_=h)};$jscomp.generator.Context.prototype.setFinallyBlock=function(a){this.catchAddress_=0;this.finallyAddress_=a||0};$jscomp.generator.Context.prototype.leaveTryBlock=function(a,h){this.nextAddress=a;this.catchAddress_=h||0};
$jscomp.generator.Context.prototype.enterCatchBlock=function(a){this.catchAddress_=a||0;a=this.abruptCompletion_.exception;this.abruptCompletion_=null;return a};$jscomp.generator.Context.prototype.enterFinallyBlock=function(a,h,d){d?this.finallyContexts_[d]=this.abruptCompletion_:this.finallyContexts_=[this.abruptCompletion_];this.catchAddress_=a||0;this.finallyAddress_=h||0};
$jscomp.generator.Context.prototype.leaveFinallyBlock=function(a,h){h=this.finallyContexts_.splice(h||0)[0];if(h=this.abruptCompletion_=this.abruptCompletion_||h){if(h.isException)return this.jumpToErrorHandler_();void 0!=h.jumpTo&&this.finallyAddress_<h.jumpTo?(this.nextAddress=h.jumpTo,this.abruptCompletion_=null):this.nextAddress=this.finallyAddress_}else this.nextAddress=a};$jscomp.generator.Context.prototype.forIn=function(a){return new $jscomp.generator.Context.PropertyIterator(a)};
$jscomp.generator.Context.PropertyIterator=function(a){this.object_=a;this.properties_=[];for(var h in a)this.properties_.push(h);this.properties_.reverse()};$jscomp.generator.Context.PropertyIterator.prototype.getNext=function(){for(;0<this.properties_.length;){var a=this.properties_.pop();if(a in this.object_)return a}return null};$jscomp.generator.Engine_=function(a){this.context_=new $jscomp.generator.Context;this.program_=a};
$jscomp.generator.Engine_.prototype.next_=function(a){this.context_.start_();if(this.context_.yieldAllIterator_)return this.yieldAllStep_(this.context_.yieldAllIterator_.next,a,this.context_.next_);this.context_.next_(a);return this.nextStep_()};
$jscomp.generator.Engine_.prototype.return_=function(a){this.context_.start_();var h=this.context_.yieldAllIterator_;if(h)return this.yieldAllStep_("return"in h?h["return"]:function(a){return{value:a,done:!0}},a,this.context_.return);this.context_.return(a);return this.nextStep_()};
$jscomp.generator.Engine_.prototype.throw_=function(a){this.context_.start_();if(this.context_.yieldAllIterator_)return this.yieldAllStep_(this.context_.yieldAllIterator_["throw"],a,this.context_.next_);this.context_.throw_(a);return this.nextStep_()};
$jscomp.generator.Engine_.prototype.yieldAllStep_=function(a,h,d){try{var e=a.call(this.context_.yieldAllIterator_,h);$jscomp.generator.ensureIteratorResultIsObject_(e);if(!e.done)return this.context_.stop_(),e;var q=e.value}catch(p){return this.context_.yieldAllIterator_=null,this.context_.throw_(p),this.nextStep_()}this.context_.yieldAllIterator_=null;d.call(this.context_,q);return this.nextStep_()};
$jscomp.generator.Engine_.prototype.nextStep_=function(){for(;this.context_.nextAddress;)try{var a=this.program_(this.context_);if(a)return this.context_.stop_(),{value:a.value,done:!1}}catch(h){this.context_.yieldResult=void 0,this.context_.throw_(h)}this.context_.stop_();if(this.context_.abruptCompletion_){a=this.context_.abruptCompletion_;this.context_.abruptCompletion_=null;if(a.isException)throw a.exception;return{value:a.return,done:!0}}return{value:void 0,done:!0}};
$jscomp.generator.Generator_=function(a){this.next=function(h){return a.next_(h)};this.throw=function(h){return a.throw_(h)};this.return=function(h){return a.return_(h)};$jscomp.initSymbolIterator();this[Symbol.iterator]=function(){return this}};$jscomp.generator.createGenerator=function(a,h){h=new $jscomp.generator.Generator_(new $jscomp.generator.Engine_(h));$jscomp.setPrototypeOf&&$jscomp.setPrototypeOf(h,a.prototype);return h};
$jscomp.asyncExecutePromiseGenerator=function(a){function h(e){return a.next(e)}function d(e){return a.throw(e)}return new Promise(function(e,q){function p(a){a.done?e(a.value):Promise.resolve(a.value).then(h,d).then(p,q)}p(a.next())})};$jscomp.asyncExecutePromiseGeneratorFunction=function(a){return $jscomp.asyncExecutePromiseGenerator(a())};$jscomp.asyncExecutePromiseGeneratorProgram=function(a){return $jscomp.asyncExecutePromiseGenerator(new $jscomp.generator.Generator_(new $jscomp.generator.Engine_(a)))};
$jscomp.checkStringArgs=function(a,h,d){if(null==a)throw new TypeError("The 'this' value for String.prototype."+d+" must not be null or undefined");if(h instanceof RegExp)throw new TypeError("First argument to String.prototype."+d+" must not be a regular expression");return a+""};
$jscomp.polyfill("String.prototype.repeat",function(a){return a?a:function(a){var d=$jscomp.checkStringArgs(this,null,"repeat");if(0>a||1342177279<a)throw new RangeError("Invalid count value");a|=0;for(var e="";a;)if(a&1&&(e+=d),a>>>=1)d+=d;return e}},"es6","es3");$jscomp.owns=function(a,h){return Object.prototype.hasOwnProperty.call(a,h)};
$jscomp.assign="function"==typeof Object.assign?Object.assign:function(a,h){for(var d=1;d<arguments.length;d++){var e=arguments[d];if(e)for(var q in e)$jscomp.owns(e,q)&&(a[q]=e[q])}return a};$jscomp.polyfill("Object.assign",function(a){return a||$jscomp.assign},"es6","es3");
$jscomp.polyfill("Array.prototype.fill",function(a){return a?a:function(a,d,e){var h=this.length||0;0>d&&(d=Math.max(0,h+d));if(null==e||e>h)e=h;e=Number(e);0>e&&(e=Math.max(0,h+e));for(d=Number(d||0);d<e;d++)this[d]=a;return this}},"es6","es3");$jscomp.findInternal=function(a,h,d){a instanceof String&&(a=String(a));for(var e=a.length,q=0;q<e;q++){var p=a[q];if(h.call(d,p,q,a))return{i:q,v:p}}return{i:-1,v:void 0}};
$jscomp.polyfill("Array.prototype.find",function(a){return a?a:function(a,d){return $jscomp.findInternal(this,a,d).v}},"es6","es3");$jscomp.polyfill("Array.prototype.flat",function(a){return a?a:function(a){a=void 0===a?1:Number(a);for(var d=[],e=0;e<this.length;e++){var h=this[e];Array.isArray(h)&&0<a?(h=Array.prototype.flat.call(h,a-1),d.push.apply(d,h)):d.push(h)}return d}},"es9","es5");
$jscomp.polyfill("Number.isFinite",function(a){return a?a:function(a){return"number"!==typeof a?!1:!isNaN(a)&&Infinity!==a&&-Infinity!==a}},"es6","es3");
var babel=function(a){if(a.loadLib)return a;a.loadLib=!0;a.no=a.ez=a.non=a["n\u00e3o"]=a.falso=a["false"]=a.fals=a.gezurra=a.faux=a.fals="false";a["s\u00ed"]=a.yes=a.bai=a.oui=a.si=a.sim=a.verdadero=a["true"]=a.veritable=a.egia=a.vrai=a.verdadeiro=a.veritable="true";a.negro=a.black=a.negre=a.beltza=a.noir=a.preto=a["#000000"]="#000000";a.maxenta=a.magenta=a["#ff00ff"]="#ff00ff";a.azul=a.blue=a.blau=a.urdina=a.bleu=a["#0000ff"]="#0000ff";a.turquesa=a.cyan=a.turkesa=a.turquoise=a["#00ffff"]="#00ffff";
a.verde=a.green=a.verd=a.berdea=a.vert=a["#00ff00"]="#00ff00";a.amarillo=a.yellow=a.groc=a.horia=a.jaune=a.amarelo=a["#ffff00"]="#ffff00";a.naranja=a.orange=a.taronja=a.laranja=a.laranxa=a["#ffc800"]="#ffc800";a.rojo=a.red=a.vermell=a.gorria=a.rouge=a.vermello=a.vermelho=a["#ff0000"]="#ff0000";a.pink=a.rosa=a.arrosa=a.rose=a["#ffafaf"]="#ffafaf";a.grisObscuro=a.darkGray=a.grisFosc=a["gris iluna"]=a.grisObscur=a.grisEscuro=a.cinzaEscuro=a["#404040"]="#404040";a.gris=a.gray=a.grisa=a.cinza=a["#808080"]=
"#808080";a.grisClaro=a.lightGray=a.grisClar=a["gris argia"]=a.grisClair=a.cinzaClaro=a["#c0c0c0"]="#c0c0c0";a.blanco=a.white=a.blanc=a.zuria=a.branco=a["#ffffff"]="#ffffff";a.escala=a.scale=a.eskala=a["\u00e9chelle"]="scale";a.nombre=a.name=a.nom=a.izena=a.nome="name";a.ikusgai=a["vis\u00edvel"]=a.visible="visible";a.rastro=a.trace=a.rastre=a.arrastoa="trace";a.fondo=a.background=a.fons=a.hondoa=a.fond=a.fundo="background";a["par\u00e1metro"]=a.parameter=a.parametroa=a["par\u00e2metro"]=a["par\u00e0metre"]=
"parameter";a["sucesi\u00f3n"]=a.sequence=a["successi\u00f3"]=a.segida=a.succession=a["seq\u00fc\u00eancia"]="sequence";a["tama\u00f1o"]=a.size=a.neurria=a.taille=a.tamanho=a["grand\u00e0ria"]="size";a.decimales=a.decimals=a.hamartarra=a["d\u00e9cimales"]=a.decimais="decimals";a.red=a.net=a.xarxa=a.sarea=a["r\u00e9seau"]=a.rede=a.malha="net";a.red10=a.net10=a.xarxa10=a.sarea10=a["r\u00e9seau10"]=a.rede10=a.malha10="net10";a.ejes=a.axes=a.eixos=a.ardatzak=a.eixes="axes";a["cr\u00e9ditos"]=a.about=
a["cr\u00e8dits"]=a.kreditoak=a["cr\u00e9dits"]=a.sobre="about";a.config=a.konfig=a["configura\u00e7\u00e3o"]="config";a.inicio=a.init=a.inici=a.hasiera=a.commencement=a["in\u00edcio"]="init";a.limpiar=a.clear=a.neteja=a.ezabatu=a.nettoye=a.limpar="clear";a.incr=a.gehi=a.incremento="incr";a.min=a.inf="min";a.max=a.sup=a["m\u00e1x"]="max";a.relleno=a.fill=a.ple=a.betea=a.plein=a.recheo=a.preencher="fill";a["relleno+"]=a["fill+"]=a["ple+"]=a["betea+"]=a["plein+"]=a["recheo+"]=a["preencher+"]=a.fillP=
"fillP";a["relleno-"]=a["fill-"]=a["ple-"]=a["betea-"]=a["plein-"]=a["recheo-"]=a["preencher-"]=a.fillM="fillM";a.flecha=a.arrow=a.fletxa=a.gezia=a["fl\u00e8che"]=a.frecha=a.seta="arrow";a.punta=a.spear=a.muturra=a.pointe=a.ponta="spear";a["regi\u00f3n"]=a.region=a["regi\u00f3"]=a.eskualde=a["r\u00e9gion"]=a["rexi\u00f3n"]=a["regi\u00e3o"]="region";a.norte=a.north=a.nord=a.ipar="north";a.sur=a.south=a.sud=a.hego=a.sul="south";a.este=a.east=a.est=a.ekialde=a.leste="east";a.oeste=a.west=a.oest=a.hegoalde=
a.ouest="west";a.exterior=a.external=a.kanpoalde=a.externo="external";a["expresi\u00f3n"]=a.expresion=a["expresi\u00f3"]=a.adierazpen=a["express\u00e3o"]="expresion";a.tipo=a.type=a.tipus=a.mota="type";a["posici\u00f3n"]=a.position=a["posici\u00f3"]=a.posizio=a["posi\u00e7\u00e3o"]="position";a["constricci\u00f3n"]=a.constraint=a["constricci\u00f3"]=a.beharte=a.constriction=a["constrici\u00f3n"]=a["restri\u00e7\u00e3o"]="constraint";a.valor=a.value=a.balio=a.valeur="value";a["ecuaci\u00f3n"]=a.equation=
a["equaci\u00f3"]=a.ekuazio=a["\u00e9quation"]=a["equa\u00e7\u00e3o"]="equation";a.curva=a.curve=a.corba=a.kurba=a.courbe="curve";a.texto=a.text=a.testu=a.texte=a.testua="text";a.punto=a.point=a.punt=a.puntu=a.ponto=a.dot="point";a.segmento=a.segment=a.zuzenki="segment";a.arco=a.arc=a.arku="arc";a["pol\u00edgono"]=a.polygon=a["pol\u00edgon"]=a.poligono=a.polygone="polygon";a.imagen=a.image=a.imatge=a.irudi=a.imaxe=a.imagem=a.bg_image=a.irudia=a.imagem_de_fundo=a.irundia="image";a["Versi\u00f3n"]=
a.Version=a["Versi\u00f3"]=a["Vers\u00e3o"]=a.version="version";a.Idioma=a.Language=a.Hizkuntza=a.Langue=a.language="language";a["O.x"]="O.x";a["O.y"]="O.y";a.Botones=a.Buttons=a.Botons=a.Botoiak=a.Boutons=a["Bot\u00f3ns"]=a["Bot\u00f5es"]=a.Botons="Buttons";a["Animaci\u00f3n"]=a.Animation=a["Animaci\u00f3"]=a.Animazio=a["Anima\u00e7\u00e3o"]="Animation";a.constante=a.constant=a.Konstante="constant";a.fuente=a.font=a.iturri=a.source=a.fonte="font";a["num\u00e9rico"]=a.numeric=a["num\u00e8ric"]=a.zenbakizko=
a["num\u00e9rique"]="numeric";a["gr\u00e1fico"]=a.graphic=a["gr\u00e0fic"]=a.grafiko=a.graphique="graphic";a.hacer=a["do"]=a.fer=a.egin=a.faire=a.facer=a.fazer=a.doExpr="doExpr";a.mientras=a["while"]=a.mentre=a.bitartean=a["tandis que"]=a.mentres=a.enquanto=a.whileExpr="whileExpr";a.evaluar=a.evaluate=a.avalua=a.ebaluatu=a["\u00e9valuer"]=a.avaliar="evaluate";a.variable=a.aldagaia=a["vari\u00e1vel"]="variable";a["funci\u00f3n"]=a["function"]=a["funci\u00f3"]=a.funtzio=a.fonction=a["fun\u00e7\u00e3o"]=
"function";a.algoritmo=a.algorithm=a.algorisme=a.algorithme="algorithm";a.vector=a.array=a.bektore=a.vecteur=a.matriz="array";a["dibujar-si"]=a["draw-if"]=a["marraztu-baldin"]=a["dessiner-si"]=a["debuxar-se"]=a["desenhar-se"]=a["dibuixa-si"]=a.drawif="drawif";a.dominio=a.range=a.domini=a["izate-eremua"]=a.domain=a["dom\u00ednio"]="range";a.pausa=a.delay=a.eten="delay";a["eje-x"]=a["x-axis"]=a["eix-x"]=a["x-ardatza"]=a["axe-x"]=a["eixe-x"]=a["eixo-x"]=a.x_axis="x_axis";a["eje-y"]=a["y-axis"]=a["eix-y"]=
a["y-ardatza"]=a["axe-y"]=a["eixe-y"]=a["eixo-y"]=a.y_axis="y_axis";a["n\u00fameros"]=a.numbers=a.nombres=a.zenbakiak="numbers";a["exponencial-si"]=a["exponential-if"]=a["esponentzial-baldin"]=a["exponentiel-si"]=a["exponencial-se"]=a.exponentialif="exponentialif";a.familia=a.family=a["fam\u00edlia"]=a.famille="family";a.intervalo=a.interval=a.tarte=a.intervalle="interval";a.pasos=a.steps=a.passos=a.pausoak=a.pas="steps";a.centro=a.center=a.centre=a.zentro="center";a.radio=a.radius=a.radi=a.erradio=
a.rayon=a.raio="radius";a.fin=a.end=a.fi=a.bukaera=a.fim="end";a["una-sola-vez"]=a["only-once"]=a["una-sola-vegada"]=a["behin-bakarrik"]=a["une-seule-fois"]=a["unha-soa-vez"]=a["apenas-uma-vez"]=a.onlyOnce="onlyOnce";a.siempre=a.always=a.sempre=a.beti=a.toujours="always";a["color-int"]=a["int-colour"]=a["barruko-kolore"]=a["couleur-int"]=a["cor-int"]=a.colorInt="colorInt";a.repetir=a.loop=a.repeteix=a.errepikatu=a["r\u00e9p\u00e9ter"]="loop";a.controles=a.controls=a.kontrolak=a["contr\u00f4les"]=
a.controis="controls";a.animar=a.animate=a.anima=a.animatu=a.animer="animate";a.auto="auto";a.y=a.top="y";a.espacio=a.space=a.espai=a.espazio=a.espace=a.espazo=a["espa\u00e7o"]="space";a.Nu="Nu";a.Nv="Nv";a.alto=a.height=a.alt=a.altu=a.haut=a.altura=a["al\u00e7ada"]=a.hauteur=a.alto="height";a.ancho=a.depth=a.amplada=a.zabalera=a.largeur=a.profundidade=a.amplada=a.width=a.ample=a.large=a.largura="width";a.largo=a.length=a.llargada=a.luzera=a.longueur=a.longo=a.comprimento=a.llargada="length";a.color_reverso=
a.backcolor=a.color_revers=a["atzealde kolorea"]=a.couleur_revers=a.cor_reverso=a.cor_de_fundo="backcolor";a.aristas=a.edges=a.arestes=a.ertzak=a["ar\u00eates"]=a.arestas="edges";a.rotini=a.inirot="inirot";a.posini=a.inipos="inipos";a["tri\u00e1ngulo"]=a.triangle=a.hirukia=a["tri\u00e2ngulo"]="triangle";a.cara=a.face=a.aurpegi="face";a.polireg=a.regpoly=a["pol\u00edgonoRegular"]="polireg";a.superficie=a.surface=a["superf\u00edcie"]=a.azalera="surface";a.cubo=a.cube=a.cub=a.kubo="cube";a["paralelep\u00edpedo"]=
a.box=a["paral\u00b7lelep\u00edpede"]=a.paralelepipedo=a["parall\u00e9l\u00e9pip\u00e8de"]="box";a.cono=a.cone=a.con=a.kono=a["c\u00f4ne"]="cone";a.cilindro=a.cylinder=a.cilindre=a.zilindro=a.cylindre="cylinder";a.esfera=a.sphere=a["sph\u00e8re"]="sphere";a.tetraedro=a.tetrahedron=a.tetraedre=a["t\u00e9tra\u00e8dre"]="tetrahedron";a.octaedro=a.octahedron=a.octaedre=a.oktaedro=a["octa\u00e8dre"]="octahedron";a.dodecaedro=a.dodecahedron=a.dodecaedre=a.dodekaedro=a["dod\u00e9ca\u00e8dre"]="dodecahedron";
a.icosaedro=a.icosahedron=a.icosaedre=a.ikosaedro=a["icosa\u00e8dre"]="icosahedron";a.elipsoide=a.ellipsoid=a["el\u00b7lipsoide"]=a["ellipso\u00efde"]=a["elips\u00f3ide"]="ellipsoid";a.macro=a.makro="macro";a.id="id";a.modelo=a.model=a.eredu=a["mod\u00e8le"]="model";a.color=a.kolore=a.couleur=a.cor=a.colour=a.kolorea="color";a.luz=a.light=a.llum=a.argia=a["lumi\u00e8re"]="light";a.metal=a.metall=a["m\u00e9tal"]="metal";a.alambre=a.wire=a.filferro=a.alanbre=a["fil de fer"]=a.arame="wire";a.cortar=
a.split=a.talla=a.moztu=a.couper=a.dividir="split";a.despliegue=a.render=a.desplegament=a.zabaltze=a["d\u00e8ploiement"]=a.despregamento=a.processar="render";a.orden=a.sort=a.ordre=a.ordena=a.orde=a.ordenar="sort";a.pintor=a.painter=a.margolari=a.peintre="painter";a["trazado de rayos"]=a["ray trace"]=a["tra\u00e7at de raigs"]=a["izpi trazadura"]=a["trace de rayons"]=a["trazado de raios"]=a["tra\u00e7ado de raios"]=a.raytrace="raytrace";a.despl_imagen=a.bg_display=a.despl_imatge=a["irudi desplazamendu"]=
a.despl_image=a.despr_imaxe=a["apresenta\u00e7\u00e3o_de_imagem"]="bg_display";a["arr-izq"]=a.topleft=a["dalt-esq"]=a["goi-ezk"]=a["au-dessus-gau"]=a["arr-esq"]=a["acima-esquerda"]="topleft";a["expand."]=a.stretch=a.hedatu=a["expandir "]="stretch";a.mosaico=a.patch=a.mosaic=a.mosaiko=a["mosa\u00efque"]="patch";a.centrada=a.zentratu=a["centr\u00e9e"]=a.centrado=a.imgcenter="imgcenter";a.archivo=a.file=a.fitxer=a.artxibo=a.fichier=a.arquivo="file";a.filas_norte=a.rows_north=a.files_nord=a["HTML kodea"]=
a.files_nord=a.filas_norte=a.linhas_norte=a.files_nord=a.rowsNorth="rowsNorth";a.filas_sur=a.rows_south=a.files_sud=a.ipar_lerro=a.files_sud=a.filas_sur=a.linhas_sul=a.files_sud=a.rowsSouth="rowsSouth";a.ancho_este=a.width_east=a.ample_est=a.hego_lerro=a.ample_est=a.ancho_leste=a.largura_leste=a.ample_est=a.widthEast="widthEast";a.ancho_oeste=a.width_west=a.ample_oest=a.ekialde_zabalera=a.ample_ouest=a.ancho_oeste=a.largura_oeste=a.ample_oest=a.widthWest="widthWest";a.fijo=a.fixed=a.fix=a.hegoalde_zabalera=
a.fixe=a.fixo="fixed";a["Reiniciar Animaci\u00f3n"]=a["Init Animation"]=a["Reinicia Animaci\u00f3"]=a.finko=a["Recommencer l'Animation"]=a["Reiniciar Anima\u00e7\u00e3o"]=a.initAnimation="initAnimation";a["Explicaci\u00f3n"]=a.Explanation=a.Azalpena=a.Explication=a["Explica\u00e7\u00e3o"]=a["Explicaci\u00f3"]="Explanation";a.tooltip=a.dica="tooltip";a.discreto=a.discrete=a.discret=a.diskretu="discrete";a.interfaz=a.gui=a["interf\u00edcie"]=a.interfaze=a["interface"]="gui";a.pulsador=a.spinner=a.polsador=
a.pultsadore=a.bouton="spinner";a["campo de texto"]=a.textfield=a["camp de text"]=a["testu esarrua"]=a["champ de texte"]="textfield";a["men\u00fa"]=a.choice=a.menu=a.escolha="menu";a.barra=a.scrollbar=a.barre="scrollbar";a.opciones=a.options=a.opcions=a.aukerak=a["opci\u00f3ns"]=a["op\u00e7\u00f5es"]="options";a.interior=a.barruko=a["int\u00e9rieur"]="interior";a["condici\u00f3n"]=a.condition=a["condici\u00f3"]=a.baldintza=a["condi\u00e7\u00e3o"]="condition";a["acci\u00f3n"]=a.action=a["acci\u00f3"]=
a.ekintza=a["a\u00e7\u00e3o"]="action";a.evento=a.event=a.esdeveniment=a.gertaera=a["\u00e9v\u00e9nement"]="event";a["abrir URL"]=a["open URL"]=a["obre URL"]=a["URL zabaldu"]=a["ouvrir URL"]=a.openURL="openURL";a["abrir Escena"]=a["open Scene"]=a["obre Escena"]=a["eszena zabaldu"]=a["ouvrir Escena"]=a["abrir Cena"]=a.openScene="openScene";a["bot\u00f3n"]=a.button=a["bot\u00f3"]=a.botoi=a.bouton=a["bot\u00e3o"]="button";a.mensaje=a.message=a.mezua=a.mensaxe=a.mensagem=a.missatge="message";a.alternar=
a.alternate=a.alterna=a.txandakatu=a.alterner="alternate";a["ejecuci\u00f3n"]=a.execution=a["execuci\u00f3"]=a.gauzatze=a["ex\u00e9cution"]=a["execuci\u00f3n"]=a["execu\u00e7\u00e3o"]="execution";a.calcular=a.calculate=a.calcula=a.kalkulatu=a.calculer="calculate";a.coord_abs=a.abs_coord=a.koor_abs="abs_coord";a.negrita=a.bold=a.negreta=a.lodi=a["caract\u00e8re gras"]=a.negra=a.negrito="bold";a.cursiva=a.italics=a.etzana=a.italique=a["it\u00e1lico"]="italics";a.subrayada=a.underlined=a.subratllat=
a.azpimarratua=a.soulignement=a["subli\u00f1ada"]=a.sublinhado="underlined";a.pos_mensajes=a.msg_pos=a.pos_missatges=a.mezuen_pos=a.pos_messages=a.pos_mensaxes="msg_pos";a.izquierda=a.left=a.esquerra=a.eskerrean=a.gauche=a.esquerda=a.esquerda=a.esquerra=a.x="x";a.derecha=a.right=a.dreta=a.eskuinan=a.droite=a.dereita=a.direita=a.dreta="right";a["sensible_a_los_movimientos_del_rat\u00f3n"]=a.sensitive_to_mouse_movements=a["sensible_als_moviments_del_ratol\u00ed"]=a["xagu mugimenduarekiko sentikorra"]=
a.sensible_aux_mouvements_du_souris=a.sensible_aos_movementos_do_rato=a["sens\u00edvel_aos_movimentos_do_mouse"]="sensitive_to_mouse_movements";a.reproducir=a.play=a.reprodueix=a.erreproduzitu=a.reproduire=a.reproduzir=a.playAudio="playAudio";a["activo-si"]=a["active-if"]=a["actiu-si"]=a["altiboa-baldin"]=a["actif-si"]=a["activo-se"]=a["ativo-se"]=a.activeif="activeif";a.rotfin=a.finrot=a.bukrot=a.endrot="endrot";a.posfin=a.finpos=a.bukpos=a.endpos="endpos";a.editable=a.editagarria=a["edit\u00e1vel"]=
"editable";a.R2="2D";a.R3="3D";a.vectores=a.bektoreak=a.vecteurs=a.vetores=a.vectors="vectors";a["fuente puntos"]=a["font size"]=a["font punts"]=a["puntu iturria"]=a["source points"]=a["fonte puntos"]=a["fonte pontos"]=a.font_size="font_size";a.escenario=a.scenario=a.escenari=a.agertoki=a["sc\u00e8ne"]=a["cen\u00e1rio"]="scenario";a.cID="cID";a.matriz=a.matrix=a.matriu=a.matrice="matrix";a.filas=a.rows=a.files="rows";a.columnas=a.columns=a.colonnes="columns";a.solo_texto=a.only_text=a.seulement_texte=
a["s\u00f3_texto"]=a.tan_sols_texte=a.onlyText="onlyText";a.respuesta=a.answer="answer";a.peso=a.weight=a.pes="weight";a.decimal_symbol=a["signo decimal"]=a["decimal symbol"]="decimal_symbol";a.info="info";a.library="library";a.color_contorn_text=a.color_text_border=a.color_borde_texto=a.muga_testuaren_kolorea=a.couleur_contour_texte=a.cor_borde_texto=a.colore_bordo_testo=a.cor_borda_texto=a.color_contorn_text=a.border="border";a.video=a["vid\u00e9o"]="video";a.audio=a["\u00e0udio"]="audio";a.autoplay=
"autoplay";a.poster="poster";a.opacidad=a.opacity=a["opacit\u00e9"]=a.opacitat=a.opacidade="opacity";a.alinear=a.align=a["ali\u00f1ar"]=a.aligner="align";a.anchor="anchor";a.a_left="left";a.a_center="center";a.a_right="right";a.a_justify="justify";a.a_top_left="top_left";a.a_top_center="top_center";a.a_top_right="top_right";a.a_center_left="center_left";a.a_center_center="center_center";a.a_center_right="center_right";a.a_bottom_left="bottom_left";a.a_bottom_center="bottom_center";a.a_bottom_right=
"bottom_right";a.malla=a.mesh="mesh";a.local=a.Local="local";a.rectangle=a["rect\u00e1ngulo"]="rectangle";a.lineDash="lineDash";a.solid="solid";a.dot="dot";a.dash="dash";a.dash_dot="dash_dot";a.offset_dist="offset_dist";a.offset_angle="offset_angle";a.flat="flat";a.borderColor="borderColor";a.text_align="text_align";a.image_align="image_align";a.checkbox="checkbox";a.torus=a.toro="torus";a.R="R";a.r="r";a.border_radius="border_radius";a.radio_group="radio_group";a.font_family="font_family";a.resizable=
"resizable";a.antialias="antialias";a.image_loader="image_loader";a.expand="expand";a.cover=a.cubrir="cover";a.fit=a.escalar="fit";a.code="code";a.doc="doc";a.image_dec="image_dec";a.image_inc="image_inc";a.btn_pos="btn_pos";a.border_width="border_width";a.border_color="border_color";a.v_left="v_left";a.v_right="v_right";a.h_left="h_left";a.h_right="h_right";a.h_left_right="h_left_right";a.label_color="label_color";a.label_text_color="label_text_color";a.shadowColor="shadowColor";a.shadowBlur="shadowBlur";
a.shadowOffsetX="shadowOffsetX";a.shadowOffsetY="shadowOffsetY";a.border_size="border_size";a.clip="clip";a.keyboard="keyboard";a.kblayout="kblayout";a.kbexp="kbexp";a.extra_style="extra_style";return a}(babel||Object.create(null)),descartesJS=function(a){if(a.loadLib)return a;a.arimoBFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.arimoBIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.arimoIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.arimoRFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.cousineBFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.cousineBIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.cousineIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.cousineRFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.tinosBFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.tinosBIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.tinosIFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.tinosRFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.mathBFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.mathRFont=function(){return"data:font/woff2;charset=utf-8;base64, "};
a.addFonts=function(){return"@font-face{font-family:'DJS_sansserif';src:url('"+a.arimoBFont()+"') format('woff2');font-style:normal;font-weight:bold;}\n@font-face{font-family:'DJS_sansserif';src:url('"+a.arimoBIFont()+"') format('woff2');font-style:italic;font-weight:bold;}\n@font-face{font-family:'DJS_sansserif';src:url('"+a.arimoIFont()+"') format('woff2');font-style:italic;font-weight:normal;}\n@font-face{font-family:'DJS_sansserif';src:url('"+a.arimoRFont()+"') format('woff2');font-style:normal;font-weight:normal;}\n@font-face{font-family:'DJS_monospace';src:url('"+
a.cousineBFont()+"') format('woff2');font-style:normal;font-weight:bold;}\n@font-face{font-family:'DJS_monospace';src:url('"+a.cousineBIFont()+"') format('woff2');font-style:italic;font-weight:bold;}\n@font-face{font-family:'DJS_monospace';src:url('"+a.cousineIFont()+"') format('woff2');font-style:italic;font-weight:normal;}\n@font-face{font-family:'DJS_monospace';src:url('"+a.cousineRFont()+"') format('woff2');font-style:normal;font-weight:normal;}\n@font-face{font-family:'DJS_serif';src:url('"+
a.tinosBFont()+"') format('woff2');font-style:normal;font-weight:bold;}\n@font-face{font-family:'DJS_serif';src:url('"+a.tinosBIFont()+"') format('woff2');font-style:italic;font-weight:bold;}\n@font-face{font-family:'DJS_serif';src:url('"+a.tinosIFont()+"') format('woff2');font-style:italic;font-weight:normal;}\n@font-face{font-family:'DJS_serif';src:url('"+a.tinosRFont()+"') format('woff2');font-style:normal;font-weight:normal;}\n@font-face{font-family:'DJS_math';src:url('"+a.mathBFont()+"') format('woff2');font-style:normal;font-weight:bold;}\n@font-face{font-family:'DJS_math';src:url('"+
a.mathBFont()+"') format('woff2');font-style:italic;font-weight:bold;}\n@font-face{font-family:'DJS_math';src:url('"+a.mathRFont()+"') format('woff2');font-style:italic;font-weight:normal;}\n@font-face{font-family:'DJS_math';src:url('"+a.mathRFont()+"') format('woff2');font-style:normal;font-weight:normal;}\n"};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.symbolFont=function(){return"data:font/woff2;charset=utf-8;base64, "};a.addSymbolFont=
function(){return"@font-face{font-family:'DJS_symbol';src:url('"+a.symbolFont()+"') format('woff2');font-style:normal;font-weight:bold;}\n@font-face{font-family:'DJS_symbol';src:url('"+a.symbolFont()+"') format('woff2');font-style:italic;font-weight:bold;}\n@font-face{font-family:'DJS_symbol';src:url('"+a.symbolFont()+"') format('woff2');font-style:italic;font-weight:normal;}\n@font-face{font-family:'DJS_symbol';src:url('"+a.symbolFont()+"') format('woff2');font-style:normal;font-weight:normal;}"};
return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,d,e,q={bold:"Bold",italic:"Italic",italics:"Italic","bold+italic":"Italic Bold"};a.serif_font="descartesJS_serif,DJS_symbol,DJS_serif,Times,'Times New Roman','Liberation Serif','Nimbus Roman No9 L Regular',serif";a.sansserif_font="descartesJS_sansserif,DJS_symbol,DJS_sansserif,Helvetica,Arial,'Liberation Sans','Nimbus Sans L',sans-serif";a.monospace_font="descartesJS_monospace,DJS_symbol,DJS_monospace,'Courier New',Courier,'Liberation Mono','Nimbus Mono L',monospace";a.math_font=
"descartesJS_math,DJS_symbol,DJS_math,DJS_serif,Times,'Times New Roman','Liberation Serif','Nimbus Roman No9 L Regular',serif";a.convertFont=function(e){if(""==e)return"";h=e.split(",");d="";d+=a.getFontStyle(h[1])+" ";d+=h[2]+"px ";return d+=a.getFontName(h[0].split(" ")[0])};a.getFontName=function(d){d=d.toLowerCase();e=a.monospace_font;if("serif"===d||"times new roman"===d||"timesroman"===d||"times"===d)e=a.serif_font;else if("sansserif"===d||"arial"===d||"helvetica"===d)e=a.sansserif_font;return e};
a.getFontStyle=function(a){return q[a.toLowerCase()]||""};a.getTextWidth=function(e,b){a.ctx.font=b;return Math.round(a.ctx.measureText(e).width)};a.getFieldFontSize=function(a){a=Math.min(50,a);return a=24<=a?Math.floor(a/2+2-a/16):20<=a?12:17<=a?11:15<=a?10:9};return a}(descartesJS||{});
descartesJS=function(a){function h(){var a,c,b,e,d,k,m;Number.prototype.oToFixed=Number.prototype.toFixed;Number.prototype.toFixed=function(f){f=Math.max(0,parseInt(void 0===f?0:f));a=this.toString();-1!==a.indexOf("e")&&(e=a.split("e"),k="-"===e[0][0]?"-":"",d="-"===k?parseFloat(e[0].substring(1)).oToFixed(11):parseFloat(e[0]).oToFixed(11),m=parseInt(e[1]),c=d.indexOf("."),d=d.replace(".",""),0>c+m?(c=0>c?1:c,a=k+"0."+"0".repeat(Math.abs(c+m))+d):a=k+d+"0".repeat(m-d.length+1));c=a.indexOf(".");
-1===c?0<f&&(a+="."+"0".repeat(f)):(b=a.length-c-1,a=b>=f?11>=f?parseFloat(a).oToFixed(f):a.substring(0,c+f+1):a+"0".repeat(f-b));return a}}if(a.loadLib)return a;var d=2*Math.PI,e=Math.floor,q,p,b,k;a.rangeOK=1;a.cssScale=1;a.radToDeg=function(a){return 360/d*a};a.degToRad=function(a){return d/360*a};a.drawLine=function(a,c,b,d,m,h,n){a.lineWidth=void 0===n?1:n;a.strokeStyle=void 0===h?"black":h;k=a.lineWidth%2*.5;a.beginPath();a.moveTo(e(c)+k,e(b)+k);a.lineTo(e(d)+k,e(m)+k);a.stroke()};a.getColor=
function(a,c){if("string"===typeof c)return c;q=a.eval(c);return"rgba("+e(255*q[0][0])+","+e(255*q[0][1])+","+e(255*q[0][2])+","+(1-q[0][3])+")"};a.getFeatures=function(){var c=navigator.appVersion.toLowerCase();a.hasTouchSupport=window.hasOwnProperty&&window.hasOwnProperty("ontouchstart")||"ontouchstart"in window||/android/i.test(c);a.isIOS=/iPad|iPhone/i.test(navigator.userAgent);a.isMsEdge=/Edge/i.test(navigator.userAgent);c=a.newHTML("canvas");a.hasCanvas=c.getContext&&c.getContext("2d");a.hasCanvas&&
(c.width=c.height=1,a.ctx=a.hasCanvas,a._ratio=2);h()};var m,c;a.removeNeedlessDecimals=function(a){if("string"==typeof a&&(m=a.indexOf("."),-1!==m)){c=a.substring(m);if(0==parseFloat(c))return a.substring(0,m);for(var b=c.length-1;0<b;b--)if("0"!==c.charAt(b))return a.substring(0,m+b+1)}return a};a.returnValue=function(a){return"number"===typeof a?parseFloat(a.toFixed(11)):a};a.whichBtn=function(a){return a.touches?"L":0===a.button?"L":1===a.button?"M":"R"};a.createGradient=function(a,c,b){a=void 0===
a?0:a;c=void 0===c?100:c;b="linear-gradient("+(void 0===b?0:b)+"deg,";for(var f=2*a,g=a;g<c;g++)a=e(100-g-35),b+="rgba(0,0,0,"+a*a*192/1E4/255+") "+(2*g-f)+"%, ";return b+"rgba(0,0,0,0.1) 100%)"};a.getCursorPosition=function(c,g){p=c.touches?c.touches[0]:c;b=g.getBoundingClientRect();return p?{x:(p.pageX-window.pageXOffset-b.left)/a.cssScale,y:(p.pageY-window.pageYOffset-b.top)/a.cssScale}:null};a.splitSeparator=function(a){a=a.replace(/\\n/g,"\n");for(var c=!1,b,f=[],e=0,d=0,k=a.length;d<k;d++)b=
a.charAt(d),"'"===b&&(c=!c),c||";"!==b&&"\n"!==b||(f.push(a.substring(e,d).replace(/\n/g,"\\n")),e=d+1);f.push(a.substring(e).replace(/\n/g,"\\n"));return f};a.preventDefault=function(a){a.preventDefault();return!1};a.convertHTMLEntities=function(c){var b=a.newHTML("textarea");b.innerHTML=c;return b.value};a.newHTML=function(a,c){a=document.createElement(a);for(var b in c)a.setAttribute(b,c[b]);return a};window.requestAnimationFrame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||
window.msRequestAnimationFrame;window.cancelAnimationFrame=window.cancelAnimationFrame||window.mozCancelAnimationFrame;a.setInterval=function(a,c){function b(){Date.now()-f>=c&&(a.call(),f=Date.now());g.value=requestAnimationFrame(b)}if(!requestAnimationFrame)return setInterval(a,c);var f=Date.now(),g={};g.value=requestAnimationFrame(b);return g};a.clearInterval=function(a){a&&(cancelAnimationFrame?cancelAnimationFrame(a.value):clearInterval(a))};a.setTimeout=function(a,c){function b(){Date.now()-
f>=c?a.call():g.value=requestAnimationFrame(b)}if(!requestAnimationFrame)return setTimeout(a,c);var f=Date.now(),g={};g.value=requestAnimationFrame(b);return g};a.clearTimeout=function(a){a&&(cancelAnimationFrame?cancelAnimationFrame(a.value):clearTimeout(a))};a.showAbout=function(){var c="<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&&(c+="<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>");c+="</body> </html>";var b=window.open("","creditos","width=700,height=500,titlebar=0,toolbar=0,location=0,menubar=0,resizable=0,scrollbars=0,status=0");
b.document.write(c);b.document.close()};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.cacheFiles=Object.create(null);a.openFile=function(h){if(a.cacheFiles[h])return a.cacheFiles[h];var d=null,e=new XMLHttpRequest;e.open("GET",h,!1);try{e.send(null),d=200===e.status||304===e.status?e.responseText:e.responseText||"",d=404===e.status?"":d,d.match(String.fromCharCode(65533))&&(e.open("GET",h,!1),e.overrideMimeType("text/plain;charset=ISO-8859-1"),e.send(null),d=e.responseText)}catch(q){d=null}return d};a.addExternalFileContent=function(h,
d){a.cacheFiles[h]=d};return a}(descartesJS||{});
descartesJS=function(a){function h(a){z=a.indexOf("--radial--");-1!=z&&(a=a.substring(0,z));a=a.replace(/\+/g,"\\+").replace(/\*/g,"\\*");p=a.trim();a={ignoreAccents:!1,ignoreCaps:!1,regExp:null};p[0]==p[p.length-1]&&"'"==p[0]&&(a.ignoreCaps=!0,p=p.substring(1,p.length-1),"`"==p[0]&&"\u00b4"==p[p.length-1]&&(a.ignoreAccents=!0,p=p.substring(1,p.length-1)));"`"==p[0]&&"\u00b4"==p[p.length-1]&&(a.ignoreAccents=!0,p=p.substring(1,p.length-1),p[0]==p[p.length-1]&&"'"==p[0]&&(a.ignoreCaps=!0,p=p.substring(1,
p.length-1)));"*"===p.charAt(0)&&"*"!==p.charAt(p.length-1)?p=p.substring(1)+"$":"*"!==p.charAt(0)&&"*"===p.charAt(p.length-1)?p="^"+p.substring(0,p.length-1):"*"!==p.charAt(0)&&"*"!==p.charAt(p.length-1)?p="^"+p+"$":"*"===p.charAt(0)&&"*"===p.charAt(p.length-1)&&(p=p.substring(1,p.length-1));a.regExp=p.replace(/\?/g,"[\\S\\s]{1}");return a}function d(a,c){p=(a||"").trim();a={ignoreAccents:!1,ignoreCaps:!1,regExp:null};a.expr=p.split(",");a.expr[0]=a.expr[0].trim();a.expr[0]={type:a.expr[0].charAt(0),
expr:c.parser.parse(a.expr[0].substring(1))};a.expr[1]=a.expr[1].trim();a.expr[1]={type:a.expr[1].charAt(a.expr[1].length-1),expr:c.parser.parse(a.expr[1].substring(0,a.expr[1].length-1))};return a}function e(a,b,e){b=parseFloat(b);c=a.expr[0];f=a.expr[1];g=e.eval(c.expr);v=e.eval(f.expr);r="("==c.type||"["==c.type;u=")"==f.type||"]"==f.type;return r&&b>g&&u&&b<=v?1:0}function q(a){return a.toString().replace(/\u00e1/g,"a").replace(/\u00e9/g,"e").replace(/\u00ed/g,"i").replace(/\u00f3/g,"o").replace(/\u00fa/g,
"u").replace(/\u00c1/g,"A").replace(/\u00c9/g,"E").replace(/\u00cd/g,"I").replace(/\u00d3/g,"O").replace(/\u00da/g,"U").replace(/\u00f1/g,"n").replace(/\u00d1/g,"N")}if(a.loadLib)return a;var p,b,k,m,c,f,g,v,r,u,z;a.buildRegularExpressionsPatterns=function(a,c){a=a||"";"("===a.charAt(0)&&")"===a.charAt(a.length-1)&&-1===a.indexOf(",")&&(a=a.substring(1,a.length-1));a=a.replace(/&squot;/g,"'").replace(/&amp;/g,"&").split("|");for(var l=0,f=a.length;l<f;l++){b=a[l].split("&");k=[];for(var g=0,e=b.length;g<
e;g++)p=b[g],-1===p.indexOf(",")||"("!==p.charAt(0)&&"["!==p.charAt(0)||")"!==p.charAt(p.length-1)&&"]"!==p.charAt(p.length-1)?k.push(h(p)):k.push(d(p,c));a[l]=k}return a};a.escorrecto=function(c,l,f,g){f=f||a.externalEvaluator;g=g||a.buildRegularExpressionsPatterns(c,f);l=q(l);c=0;for(var d=g.length;c<d;c++){b=g[c];m=!0;for(var k=0,h=b.length;k<h;k++)m=b[k].regExp?m&&!!l.match(new RegExp(q(b[k].regExp),"i")):m&&e(b[k],l,f);if(m)return 1}return 0};a.esCorrecto=function(c,l,f,g){f=f||a.externalEvaluator;
g=g||a.buildRegularExpressionsPatterns(c,f);l+="";c=0;for(var d=g.length;c<d;c++){b=g[c];m=!0;for(var k=0,h=b.length;k<h;k++)(p=b[k].regExp)?(b[k].ignoreAccents&&(l=q(l),p=q(p)),b[k].ignoreCaps&&(l=l.toLowerCase(),p=q(p).toLowerCase()),m=m&&!!l.match(p)):m=m=m&&e(b[k],l,f);if(m)return 1}return 0};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.loaderImg=new Image;a.loaderImg.src="data:image/svg+xml;base64,"+btoa("<svg xmlns='http://www.w3.org/2000/svg' width='880' height='840' viewBox='0 0 880 840'><path d='M440 80c-132.5 0-240 107.5-240 240s107.5 240 240 240 240-107.5 240-240S572.5 80 440 80zm-11.1 462.2c-122.7 0-224.4-99.5-224.4-222.2S306.2 97.8 428.9 97.8 651.1 197.3 651.1 320s-99.5 222.2-222.2 222.2zm-11.1-426.6c-112.9 0-208.9 91.5-208.9 204.4s96 204.4 208.9 204.4S622.2 432.9 622.2 320s-91.5-204.4-204.4-204.4zm-11.1 391.1c-103.1 0-193.3-83.6-193.3-186.7s90.2-186.7 193.3-186.7S593.3 216.9 593.3 320s-83.5 186.7-186.6 186.7zm-11.1-355.6c-93.3 0-177.8 75.6-177.8 168.9s84.5 168.9 177.8 168.9S564.4 413.3 564.4 320c0-93.3-75.6-168.9-168.8-168.9zm-11.2 320c-83.5 0-162.2-67.7-162.2-151.1S301 168.9 384.4 168.9 535.6 236.5 535.6 320s-67.7 151.1-151.2 151.1zm-11.1-284.4c-73.6 0-146.7 59.7-146.7 133.3s73 133.3 146.7 133.3S506.7 393.6 506.7 320 447 186.7 373.3 186.7zm-11.1 248.9c-63.8 0-131.1-51.7-131.1-115.6s67.3-115.6 131.1-115.6S477.8 256.2 477.8 320 426 435.6 362.2 435.6zm-11.1-213.4c-54 0-115.6 43.8-115.6 97.8s61.6 97.8 115.6 97.8c54 0 97.8-43.8 97.8-97.8s-43.8-97.8-97.8-97.8zM340 400c-44.2 0-100-35.8-100-80s55.8-80 100-80 80 35.8 80 80-35.8 80-80 80z' fill='#2daae4'/><path d='M115.8 600.7c32.5 0 48.8 24.8 48.8 49.7 0 24.9-16.2 49.6-48.8 49.6H80.2v-99.3zm0 85c23 0 34.6-17.6 34.6-35.2s-11.6-35.4-34.6-35.4H94.5v70.6zm118.2 0V700h-60.6v-99.3h60.5V615h-46v28h45v14.5h-45l-.05 28.2zm42.2.9c10.6 0 22.3-6 22.3-16.2 0-1-.1-2.1-.4-3.4-1.7-7.5-11.9-8.8-21.9-9.8-15.5-1.6-33.7-5-35.2-25.65-.6-6.65 1.1-13.25 5.4-18.85 6.7-8.7 18.6-13.2 30.1-13.2 15.3 0 31.2 8 33.8 26.1l-14.3.7c-2-8.9-11.6-12.8-20.3-12.6-6.7.1-14.1 2.4-18 7.5-2 2.6-2.7 5.8-2.4 9.2.7 10.2 11.9 11.5 22.6 12.5 13.6 1.7 30.5 5.3 34.4 21.2.4 2.1.7 4.5.7 6.5 0 19.2-19 30.2-36.9 30.2-15.3 0-33.9-9.1-35.8-26.8l-.1-2.7 14.5-.3.1 1.8c1 8.9 12.2 13.8 21.4 13.8zm58-71.7c8.7-8.9 20.9-14.8 34.4-14.8 22.7 0 40.6 14.2 46.3 36.6h-14.2c-5.3-14.9-17.5-22.4-32.1-22.4-9.5 0-18.2 4.1-24.4 10.7-6.2 6.5-10.2 15.3-10.2 25.6 0 9.9 4 18.7 10.2 25.3 6.2 6.6 14.9 10.6 24.4 10.6 15.1 0 27.8-8.7 32.9-23.7h14.1c-5.7 22.6-23.9 37.9-47 37.9-13.5 0-25.7-5.7-34.4-14.8-8.5-9.1-14.2-21.6-14.2-35.4 0-14 5.7-26.5 14.2-35.6zm144.6 55.8h-35.6c-3.8 9.1-8.8 21-11.9 29.3h-15.5l39.9-100.7h10.5L506 700h-15.3zm-30.3-13.4h24.7L461 622.2zm96.9-7.7c12.1 0 18-8.7 18-17.3 0-8.5-6-17.2-18-17.2h-22V700h-14.2v-99.4h36.2c21.6 0 32.4 15.9 32.4 31.7 0 14.1-8.7 27.4-25.7 30.4l31.4 37.3h-18.6l-36.2-43.6-.05-6.8zm64.9 50.8v-85.3h-30.1v-14.5h74.4v14.5h-30v85.3zm112.2-14.7V700H662v-99.3h60.5V615h-46v28h45v14.5h-45l-.05 28.2zm42.3.9c10.6 0 22.3-6 22.3-16.2 0-1-.1-2.1-.4-3.4-1.7-7.5-11.9-8.8-21.9-9.8-15.5-1.6-33.7-5-35.2-25.65-.6-6.65 1.1-13.25 5.4-18.85 6.7-8.7 18.6-13.2 30.1-13.2 15.3 0 31.2 8 33.8 26.1l-14.3.7c-2-8.9-11.6-12.8-20.3-12.6-6.7.1-14.1 2.4-18 7.5-2 2.6-2.7 5.8-2.4 9.2.7 10.2 11.9 11.5 22.6 12.5 13.6 1.7 30.5 5.3 34.4 21.2.4 2.1.7 4.5.7 6.5 0 19.2-19 30.2-36.9 30.2-15.3 0-33.9-9.1-35.8-26.8l-.1-2.7 14.5-.3.1 1.8c1 8.9 12.2 13.8 21.4 13.8z' fill='#868686'/></svg>");a.getCCLImg=
function(){var a=new Image;a.src="data:image/svg+xml;base64,"+btoa("<svg xmlns='http://www.w3.org/2000/svg' width='88' height='31' viewBox='0 0 120 42'><path fill='#aab2ab' stroke='#000' d='M.5.5h119v41H.5z'/><path d='M0 29.5h120V42H0z'/><circle cx='21' cy='19.5' r='18.25' fill='#aab2ab'/><path d='M49.935 33.105c.364.298.585.806.585 1.284 0 .403-.07.592-.228.833-.158.242-.377.405-.674.547.41.118.715.323.917.617.202.294.303.649.303 1.063 0 .68-.302 1.117-.721 1.465-.432.359-1.067.455-1.622.455H45.28v-6.622h3.122c.579 0 1.127.025 1.533.358zM48.8 35.24c.175-.141.307-.323.307-.6 0-.331-.126-.473-.307-.612-.188-.145-.351-.147-.697-.147H46.74v1.545h1.363c.26 0 .51-.035.697-.186zm-.5 2.996c.288 0 .553-.018.753-.181a.885.885 0 0 0 .325-.691c0-.34-.095-.552-.288-.727-.196-.177-.446-.218-.762-.218h-1.59v1.817zm2.795-5.489h1.633l1.55 2.616 1.543-2.616h1.623l-2.459 4.08v2.542h-1.46v-2.578zm21.34 6.622H71.07v-6.622h1.448l2.774 4.443.008-4.443h1.367v6.622H75.21l-2.765-4.433zm8.48-5.558c-1.07 0-1.893.887-1.893 2.224 0 1.336.91 2.263 1.893 2.263.823 0 1.503-.646 1.503-1.485h1.41c0 1.63-1.022 2.704-2.913 2.704-1.89 0-3.259-1.07-3.259-3.434 0-2.363 1.407-3.499 3.26-3.499 1.853 0 2.857.96 2.857 2.386h-1.41c0-.774-.755-1.159-1.448-1.159zm17.845 4.297c.27.228.68.283 1.023.283.485 0 .93-.072 1.157-.413.157-.235.118-.615-.043-.848-.223-.323-.713-.38-1.078-.474-.498-.129-.996-.18-1.437-.412-.411-.215-.835-.486-1.078-.881-.139-.225-.172-.506-.172-.775 0-.703.348-1.153.788-1.513.453-.371 1.11-.442 1.687-.49.698-.057 1.352.088 1.843.491.472.387.697 1.03.807 1.644h-1.414c.047-.386-.17-.615-.406-.798-.241-.188-.589-.207-.895-.204-.23.002-.486.028-.669.167-.177.135-.328.36-.328.584 0 .238.161.48.352.622.444.333 1.09.218 1.621.38.398.122.854.17 1.167.445.422.371.797.972.797 1.485 0 .672-.279 1.154-.701 1.517-.54.466-1.37.532-2.055.599-.756.021-1.449-.117-1.97-.558-.505-.427-.849-1.13-.849-1.792h1.413c0 .476.176.717.44.941zm7.886-5.361l2.477 6.622h-1.512l-.501-1.475h-2.477l-.52 1.475h-1.465l2.504-6.622zm-1.632 4.06h1.716l-.845-2.427z' fill='#fff'/><g stroke-width='2' fill='#fff' stroke='#000'><circle r='14.25' cy='19.5' cx='21' stroke-width='2.8'/><circle r='10.55' cx='52' cy='15'/><circle r='10.55' cy='15' cx='78'/><circle r='10.55' cx='104' cy='14.981'/></g><circle r='1.625' cy='9' cx='52'/><path d='M18.75 17.979c-.39-.852-.974-1.278-1.755-1.278-1.378 0-2.067.928-2.067 2.784 0 1.856.69 2.783 2.067 2.783.91 0 1.56-.452 1.951-1.357l1.91 1.017c-.91 1.618-2.277 2.428-4.098 2.428-1.406 0-2.531-.43-3.377-1.292-.846-.862-1.27-2.05-1.27-3.564 0-1.487.438-2.668 1.31-3.543.87-.875 1.958-1.312 3.259-1.312 1.926 0 3.304.759 4.14 2.275zm8.99 0c-.39-.852-.964-1.278-1.72-1.278-1.405 0-2.109.928-2.109 2.784 0 1.856.704 2.783 2.11 2.783.912 0 1.55-.452 1.915-1.357l1.953 1.017c-.91 1.618-2.274 2.428-4.092 2.428-1.404 0-2.526-.43-3.372-1.292-.843-.862-1.266-2.05-1.266-3.564 0-1.487.429-2.668 1.287-3.543.857-.875 1.947-1.312 3.273-1.312 1.923 0 3.3.759 4.13 2.275l-2.108 1.059zm27.381-5.862a.75.75 0 0 0-.75-.75h-4.743a.75.75 0 0 0-.749.75v4.742h1.324v5.617h3.594v-5.617h1.324zm13.779-.352l10.343 4.66a.867.867 0 0 1 .312.696c0 .887-.754 1.154-1.435 1.154-1.05 0-1.818-.324-2.588-1.048l-1.598 1.609c.962.84 2.22 1.374 3.52 1.389v1.789h1.332v-1.79c1.584-.115 2.895-1.108 3.191-2.58l4.471 2.048.852-2.129-10.391-4.682a.467.467 0 0 1-.106-.295c0-.723.814-.9 1.39-.9.71 0 1.42.281 1.983.68L81.7 10.8a5.005 5.005 0 0 0-2.914-1.065V7.95h-1.332v1.787c-1.417.083-2.587.83-2.987 2.059l-4.533-2.073zm29.88 1.58c.461-2.918 2.515-4.478 5.09-4.478 3.7 0 5.957 2.686 5.957 6.268 0 3.495-2.4 6.21-6.016 6.21-2.487 0-4.714-1.53-5.12-4.535h2.922c.087 1.56 1.1 2.109 2.546 2.109 1.648 0 2.718-1.53 2.718-3.87 0-2.456-.925-3.755-2.661-3.755-1.272 0-2.371.462-2.603 2.05l.85-.005-2.3 2.3-2.299-2.3.915.006z'/></svg>");
return a};a.getSvgArrowUp=function(a,d){return"data:image/svg+xml;base64,"+btoa('<svg xmlns=\'http://www.w3.org/2000/svg\' width="24" height="24" viewBox="0 0 24 24"><path transform="rotate('+(a?90:0)+',12,12)" fill="#'+(void 0===d?"24c":d)+'" d="m19.5 17.5-7.5-12-7.5 12z"/></svg>')};a.getSvgArrowDown=function(a,d){return"data:image/svg+xml;base64,"+btoa('<svg xmlns=\'http://www.w3.org/2000/svg\' width="24" height="24" viewBox="0 0 24 24"><path transform="rotate('+(a?90:0)+',12,12)" d="m19.5 5-7.5 12-7.5-12z" fill="#'+
(void 0===d?"d00018":d)+'"/></svg>')};a.getSvgMenu=function(){return"data:image/svg+xml;base64,"+btoa("<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'><path d='M6.64 8L12 12.962 17.36 8 19 9.519 12 16 5 9.519z'/></svg>")};a.getSvgCheckbox=function(){return"data:image/svg+xml;base64,"+btoa("<svg xmlns='http://www.w3.org/2000/svg' width='45' height='45' viewBox='0 0 45 45'><path d='M37.095 6.284L15.473 27.905l-7.568-7.567L2.5 25.743l12.973 12.973L42.5 11.69z' fill='#1e272e'/></svg>")};
a.getSvgRadio=function(){return"data:image/svg+xml;base64,"+btoa('<svg xmlns=\'http://www.w3.org/2000/svg\' width="45" height="45" viewBox="0 0 45 45"><circle cx="22.5" cy="22.5" r="15" fill="#1e272e"/></svg>')};return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.floor,d=/[\w-//]*(\.png|\.jpg|\.gif|\.svg|\.webp)/gi,e,q,p,b,k,m,c,f,g,v,r,u,z,n,l,x,w,y,A=function(c,l){this.r=this.g=this.b=0;this.a=1;this.evaluator=l;this.getColor=this.getColorStr;if(!c)this.colorStr="rgba("+this.r+","+this.g+","+this.b+","+this.a+")";else if(c.match(/^GradL/)){c=this.splitComa(c.substring(6,c.length-1));this.x1=this.evaluator.parser.parse(c[0]);this.y1=this.evaluator.parser.parse(c[1]);this.x2=this.evaluator.parser.parse(c[2]);
this.y2=this.evaluator.parser.parse(c[3]);this.stops=[];for(var f=4;f<c.length;f++)""!=c[f]&&(l=c[f].split("|"),this.stops.push({percentage:this.evaluator.parser.parse(l[1]),color:"#"+l[2]}));this.getColor=this.getLinearGradient}else if(c.match(/^Pattern/))this.img_src=c.substring(8,c.length-1),this.img_src.match(d)&&(this.img_src="'"+this.img_src+"'"),this.img_src=this.evaluator.parser.parse(this.img_src),this.getColor=this.getPattern;else if(babel[c])"net"===babel[c]&&(c="rojo"),c=babel[c],this.r=
a.toHex(c.substring(1,3)),this.g=a.toHex(c.substring(3,5)),this.b=a.toHex(c.substring(5,7)),this.colorStr=c;else if(6===c.length)this.r=a.toHex(c.substring(0,2)),this.g=a.toHex(c.substring(2,4)),this.b=a.toHex(c.substring(4,6)),this.colorStr="#"+c;else if(8===c.length)this.r=a.toHex(c.substring(2,4)),this.g=a.toHex(c.substring(4,6)),this.b=a.toHex(c.substring(6,8)),this.a=1-a.toHex(c.substring(0,2))/255,this.colorStr="rgba("+this.r+","+this.g+","+this.b+","+this.a+")";else if("("===c[0]){q=[];p=this.splitComa(c.substring(1,
c.length-1));c=0;for(l=p.length;c<l;c++)m=p[c],b=parseInt(m,16),m!==b.toString(16)&&m!=="0"+b.toString(16)?("["===m.charAt(0)&&"]"===m.charAt(m.length-1)&&(m=m.substring(1,m.length-1)),q.push(this.evaluator.parser.parse(m))):q.push(this.evaluator.parser.parse((b/255).toString()));this.rExpr=q[0];this.gExpr=q[1];this.bExpr=q[2];this.aExpr=q[3];this.getColor=this.getColorExp}};A.prototype.splitComa=function(a){k=[];for(var b=g=f=c=0,l=a.length;b<l;b++)v=a.charAt(b),"("===v?c++:")"===v?c--:"["===v?f++:
"]"===v?f--:","===v&&0===c&&0===f&&(k.push(a.substring(g,b)),g=b+1);k.push(a.substring(g));return k};A.prototype.getColorStr=function(){return this.colorStr};A.prototype.getColorExp=function(){e=this.evaluator;this.r=h(255*e.eval(this.rExpr));this.g=h(255*e.eval(this.gExpr));this.b=h(255*e.eval(this.bExpr));this.a=1-e.eval(this.aExpr);return"rgba("+this.r+","+this.g+","+this.b+","+this.a+")"};A.prototype.getLinearGradient=function(){x=a.ctx.createLinearGradient(this.evaluator.eval(this.x1),this.evaluator.eval(this.y1),
this.evaluator.eval(this.x2),this.evaluator.eval(this.y2));for(var c=0;c<this.stops.length;c++)l=this.evaluator.eval(this.stops[c].percentage),l=0>l?0:1<l?1:l,x.addColorStop(l,this.stops[c].color);return x};A.prototype.getPattern=function(){y=this.evaluator.parent;if(w=y.getImage(this.evaluator.eval(this.img_src)))try{return a.ctx.createPattern(w,"repeat")}catch(E){}return"ff00ff"};A.prototype.borderColor=function(){return 380>this.r+this.g+this.b?"#ffffff":"#000000"};a.toHex=function(a){return parseInt("0x"+
a,16)};a.RGBAToHexColor=function(a){a=a.substring(5,a.length-1).split(",");r=parseInt(a[0]).toString(16);u=parseInt(a[1]).toString(16);z=parseInt(a[2]).toString(16);n=(255-parseInt(255*parseFloat(a[3]))).toString(16);1===r.length&&(r="0"+r);1===u.length&&(u="0"+u);1===z.length&&(z="0"+z);1===n.length&&(n="0"+n);return new A(n+r+u+z)};a.Color=A;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=function(d){var e=this;this.parent=d;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",function(){e.insert("\n")});this.container.appendChild(this.newLine);
this.display.addEventListener("keydown",function(a){e.keypressed=!0;if(27===a.keyCode)e.close();else if(13===a.keyCode)e.onEnter()});this.key_pressed=!1;var h;this.delete_pressed=!1;var p;this.keyContainer.addEventListener("pointerdown",function(a){if("k_op"==a.target.id||"k_dot"==a.target.id||"k_a"==a.target.id||"k_e"==a.target.id||"k_i"==a.target.id||"k_o"==a.target.id||"k_u"==a.target.id){a.target.onpointerleave=function(){clearTimeout(h)};var b=a.target.textContent.trim().toLowerCase();h=setTimeout(function(){e.key_pressed=
!0;e.showAditionalKeys(b)},600)}else"k_delete"==a.target.id&&(a.target.onpointerleave=function(){clearTimeout(p)},p=setInterval(function(){e.delete_pressed=!0;e.delete()},200))});this.keyContainer.addEventListener("pointerup",function(a){if(a.target!=e.keyContainer&&a.target!=e.container)if(a.preventDefault(),a.stopPropagation(),"k_left"==a.target.id)e.display.selectionStart=e.display.selectionEnd=Math.max(0,e.display.selectionStart-1);else if("k_right"==a.target.id)e.display.selectionStart=e.display.selectionEnd=
Math.min(e.display.value.length,e.display.selectionStart+1);else if("k_delete"==a.target.id)e.delete_pressed||e.delete(),clearTimeout(p),e.delete_pressed=!1;else if("k_\u221a"==a.target.id)e.insert("\u221a(");else if("k_space"==a.target.id)e.insert(" ");else if("k_esc"==a.target.id)e.close();else if("k_shift"==a.target.id){a=e.keyContainer.querySelectorAll("div");var b=e.additionalKeys.querySelectorAll("div");e.shift=!e.shift;e.shift?(a.forEach(function(a){1==a.textContent.trim().length&&(a.textContent=
a.textContent.toUpperCase());"k_point_comma"==a.getAttribute("id")&&(a.textContent=",")}),b.forEach(function(a){a.textContent=a.textContent.toUpperCase()})):(a.forEach(function(a){1==a.textContent.trim().length&&(a.textContent=a.textContent.toLowerCase());"k_point_comma"==a.getAttribute("id")&&(a.textContent=".")}),b.forEach(function(a){a.textContent=a.textContent.toLowerCase()}))}else if("k_num_layout"==a.target.id)e["setLayout_"+e.layout_mode.replace("alfa","num")]();else if("k_alfa_layout"==a.target.id)e["setLayout_"+
e.layout_mode.replace("num","alfa")]();else if("k_clear"==a.target.id)e.display.value="";else if("k_op"==a.target.id||"k_dot"==a.target.id||"k_a"==a.target.id||"k_e"==a.target.id||"k_i"==a.target.id||"k_o"==a.target.id||"k_u"==a.target.id)clearTimeout(h),e.key_pressed||(e.insert(a.target.textContent.trim()),e.additionalKeys.style.display="none"),e.key_pressed=!1;else if("k_return"==a.target.id)e.onEnter();else a=a.target.textContent.trim(),e.insert(a),e.additionalKeys.style.display="none";e.display.focus()});
this.keyContainer.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation()});var b=!1;this.additionalKeys.addEventListener("pointerdown",function(a){b=!0});this.additionalKeys.addEventListener("pointerup",function(a){b&&(a.target!=e.keyContainer&&a.target!=e.container&&(a.preventDefault(),a.stopPropagation(),a=a.target.textContent.trim(),e.insert(a)),e.key_pressed=!1,e.additionalKeys.style.display="none");b=!1;e.display.focus()})};h.prototype.insert=function(a){this.display.setRangeText(a);
this.display.selectionStart+=a.length;this.display.selectionStart=this.display.selectionEnd};h.prototype.delete=function(){this.display.selectionStart==this.display.selectionEnd&&(this.display.selectionStart=Math.max(0,this.display.selectionStart-1));this.display.setRangeText("")};h.prototype.addKey=function(a,e,h){return"<div "+(e?"id='"+e+"'":"")+" "+(h?"style='"+h+"'":"")+">"+a+"</div>"};h.prototype.addKeys=function(a){var e=this,d="";a.forEach(function(a){d="object"===typeof a?d+e.addKey(a.val,
a.id,a.style):d+e.addKey(a)});return d};h.prototype.showAditionalKeys=function(a){var e=[];"."==a?e=",;:-_\u00bf?\u00a1!()".split(""):"+"==a?e=["-","\u00d7","\u00f7","^"]:"a"==a?e=["\u00e1","\u00e0","\u00e4","\u00e2"]:"e"==a?e=["\u00e9","\u00e8","\u00eb","\u00ea"]:"i"==a?e=["\u00ed","\u00ec","\u00ef","\u00ee"]:"o"==a?e=["\u00f3","\u00f2","\u00f6","\u00f4"]:"u"==a&&(e=["\u00fa","\u00f9","\u00fc","\u00fb"]);this.additionalKeys.innerHTML=this.addKeys(e);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"};h.prototype.setLayout_14x1=function(){this.keyContainer.innerHTML=this.addKeys([1,2,3,4,5,6,7,8,9,0,{val:this.parent.decimal_symbol},"-",{val:"\u232b",id:"k_delete"},{val:"\u21b5",id:"k_return"}]);this.keyContainer.style.width="635px"};h.prototype.setLayout_7x2=function(){this.keyContainer.innerHTML=this.addKeys([1,2,3,
4,5,{val:this.parent.decimal_symbol},{val:"\u232b",id:"k_delete"},6,7,8,9,0,"-",{val:"\u21b5",id:"k_return"}]);this.keyContainer.style.width="320px"};h.prototype.setLayout_10x2=function(){this.keyContainer.innerHTML=this.addKeys(["(",1,2,3,4,5,"\u00b2","/","\u00d7",{val:"\u232b",id:"k_delete"},")",6,7,8,9,0,{val:this.parent.decimal_symbol},"-","+",{val:"\u21b5",id:"k_return"}]);this.keyContainer.style.width="455px"};h.prototype.setLayout_4x4=function(){this.keyContainer.innerHTML=this.addKeys([7,
8,9,{val:"\u232b",id:"k_delete"},4,5,6,"+",1,2,3,"-",{val:0,style:"width:85px;"},{val:this.parent.decimal_symbol},{val:"\u21b5",id:"k_return"}]);this.keyContainer.style.width="185px"};h.prototype.setLayout_5x4=function(){this.keyContainer.innerHTML=this.addKeys([7,8,9,"\u00b2",{val:"\u232b",id:"k_delete"},4,5,6,"/","\u00d7",1,2,3,"\u2212","+",{val:0,style:"width:85px;"},".",{val:"\u21b5",id:"k_return",style:"margin-left:50px;"}]);this.keyContainer.style.width="230px"};h.prototype.setLayout_11x3=function(){this.keyContainer.innerHTML=
this.addKeys(["q","w",{val:"e",id:"k_e"},"r","t","y",{val:"u",id:"k_u"},{val:"i",id:"k_i"},{val:"o",id:"k_o"},"p",{val:"\u232b",id:"k_delete"},{val:"a",id:"k_a"},"s","d","f","g","h","j","k","l","\u00f1",{val:".",id:"k_dot"},{val:"\u21c5",id:"k_shift"},"z","x","c","v","b","n","m",{val:"",id:"k_space",style:"width:85px;"},{val:"\u21b5",id:"k_return"}]);this.keyContainer.style.width="500px";this.shift=!1};h.prototype.setLayout_11x4=function(){this.keyContainer.innerHTML=this.addKeys([1,2,3,4,5,6,7,8,
9,0,{val:"\u232b",id:"k_delete"},"q","w",{val:"e",id:"k_e"},"r","t","y",{val:"u",id:"k_u"},{val:"i",id:"k_i"},{val:"o",id:"k_o"},"p",{val:"+",id:"k_op"},{val:"a",id:"k_a"},"s","d","f","g","h","j","k","l","\u00f1",{val:".",id:"k_dot"},{val:"\u21c5",id:"k_shift"},"z","x","c","v","b","n","m",{val:"",id:"k_space",style:"width:85px;"},{val:"\u21b5",id:"k_return"}]);this.keyContainer.style.width="500px"};h.prototype.setLayout_10x4_alfa=function(){this.keyContainer.innerHTML=this.addKeys(["q","w",{val:"e",
id:"k_e"},"r","t","y",{val:"u",id:"k_u"},{val:"i",id:"k_i"},{val:"o",id:"k_o"},"p",{val:"a",id:"k_a"},"s","d","f","g","h","j","k","l","\u00f1",{val:"\u21c5",id:"k_shift",style:"width:62.5px;"},"z","x","c","v","b","n","m",{val:"\u232b",id:"k_delete",style:"width:62.5px;"},{val:"123",id:"k_num_layout",style:"width:85px;"},{val:"",id:"k_space",style:"width:220px;transform:none !important;"},{val:"/",id:"k_slash"},{val:".",id:"k_dot"},{val:"\u21b5",id:"k_return"}]);this.keyContainer.style.width="455px"};
h.prototype.setLayout_10x4_num=function(){this.keyContainer.innerHTML=this.addKeys(["1","2","3","4","5","6","7","8","9","0","@",'"',"$","_","-","+","(",")","/","*","&","|","\u00ba",":",";","\u00a1","!","\u00bf","?",{val:"\u232b",id:"k_delete"},{val:"ABC",id:"k_alfa_layout",style:"width:85px;"},{val:"",id:"k_space",style:"width:220px;transform:none !important;"},{val:",",id:"k_slash"},{val:".",id:"k_dot"},{val:"\u21b5",id:"k_return"}]);this.keyContainer.style.width="455px"};h.prototype.showCustomKB=
function(a){var e=a.querySelectorAll("div");a=parseInt(a.getAttribute("cols")||e.length);for(var d=[],h,b,k=0;k<e.length;k++){h={val:e[k].textContent};if(b=e[k].getAttribute("id"))h.id=b;if(b=e[k].getAttribute("size"))h.style="width:"+(40*parseInt(b)+5*(parseInt(b)-1))+"px;transform:none !important;";d.push(h)}this.keyContainer.innerHTML=this.addKeys(d);this.keyContainer.style.width=5+45*a+"px"};h.prototype.setLayout=function(a){this.layout_mode=a;var e=document.getElementById("kb_"+a);e?this.showCustomKB(e):
"14x1"==a?this.setLayout_14x1():"7x2"==a?this.setLayout_7x2():"10x2"==a?this.setLayout_10x2():"4x4"==a?this.setLayout_4x4():"5x4"==a?this.setLayout_5x4():"11x3"==a?this.setLayout_11x3():"11x4"==a?this.setLayout_11x4():"10x4_alfa"==a?this.setLayout_10x4_alfa():"10x4_num"==a?this.setLayout_10x4_num():this.setLayout_14x1()};h.prototype.show=function(a,e,h,p,b,k,m){this.ctr=a;this.var_id=b;this.onlyText=m;this.container.parentNode||this.parent.container.appendChild(this.container);this.container.style.display=
"block";this.setDisplay(k);this.setLayout(e);this.keyContainer.style.left=h+"px";this.keyContainer.style.top=p+"px";this.additionalKeys.style.display="none"};h.prototype.close=function(){this.container.style.display="none";this.parent.deactivateControls();this.parent.update()};h.prototype.setDisplay=function(d){if("custom"==d.type){var e=d.x;var h=d.y;var p=d.w;var b=d.h;var k=d.fs}else h=this.container.getBoundingClientRect(),b=d.getBoundingClientRect(),e=b.left/a.cssScale-h.left/a.cssScale,h=b.top/
a.cssScale-h.top/a.cssScale,p=b.width/a.cssScale,b=b.height/a.cssScale,k=d.style.fontSize;"textarea"==d.tagName.toLowerCase()?(this.display.setAttribute("style","left:"+e+"px;top:"+h+"px;width:"+p+"px;height:"+b+"px;font-size:"+k+";line-height:1.2em;padding:5px;font:"+d.style.font+";"),this.newLine.style.left=e+p-42+"px",this.newLine.style.top=h+b-42+"px",this.newLine.style.display="block"):(this.display.setAttribute("style","left:"+e+"px;top:"+h+"px;width:"+p+"px;height:"+b+"px;font-size:"+k+";line-height:"+
b+"px;white-space:nowrap;"),this.newLine.style.display="none");this.display.value=d.value||"";this.display.focus();this.display.selectionStart=this.display.selectionEnd=this.display.value.length};h.prototype.onEnter=function(){var a=this.display.value;if(!this.onlyText){var e=this.parent.evaluator.parser.parse(a.replace(/\u221a/g,"sqrt"));try{e&&(a=this.parent.evaluator.eval(e))}catch(b){a=0}}if(this.ctr)this.ctr.changeValue(a,!0);else if(this.var_id=(this.var_id+"").trim(),e=this.var_id.indexOf("["),
-1==e)this.parent.evaluator.setVariable(this.var_id,a);else{var h=this.var_id.indexOf(","),p=this.var_id.substring(0,e);-1==h?this.parent.evaluator.setVector(p,parseInt(this.var_id.substring(e+1)),a):this.parent.evaluator.setMatrix(p,parseInt(this.var_id.substring(e+1)),parseInt(this.var_id.substring(h+1)),a)}this.close()};a.Keyboard=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=document.head,d=a.newHTML("meta",{"http-equiv":"X-UA-Compatible",content:"IE=edge,chrome=1"});h.appendChild(d);d=a.newHTML("meta",{name:"viewport",content:"width=device-width,initial-scale=1.0,user-scalable=yes"});document.querySelector("meta[name=viewport]")||h.appendChild(d);d=a.newHTML("meta",{name:"mobile-web-app-capable",content:"yes"});h.appendChild(d);d=a.newHTML("meta",{name:"apple-mobile-web-app-capable",content:"yes"});h.appendChild(d);
d=a.newHTML("meta",{name:"apple-mobile-web-app-status-bar-style",content:"black"});h.appendChild(d);(h=document.getElementById("StyleDescartesApps2"))&&h.remove();h=a.newHTML("style",{rel:"stylesheet",type:"text/css",id:"StyleDescartesApps2"});document.head.insertBefore(h,document.head.firstChild);h.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 h=Math.sin,d=Math.floor,e=Math.random,q=Math.round,p=Math.abs,b=String.fromCharCode,k,m,c,f,g,v,r,u,z,n,l=function(a){this.key=(void 0===a?0:a).toString()};l.prototype.getKey=function(a){k=[];for(var c=0;256>c;c++)k[c]=b(this.alfanum(d(p(7.5*(h(1*c-a)+h(1.4*c+a)+h(.6*c-a)+h(2.2*c+a))))));return k.join("")};l.prototype.encode=function(a){m=d(31*e());this.key=this.getKey(m);return b(this.alfanum(m))+this.encripta(a)};l.prototype.decode=function(a){m=
this.numalfa(a.charCodeAt(0));this.key=this.getKey(m);return this.desencripta(a.substring(1))};l.prototype.encripta=function(a){return this.bytesToString(this.encriptaAux(this.stringToBytes(a)))};l.prototype.encriptaAux=function(a){if(null==a||null==this.key)return null;v=Array(3*a.length);for(var c=0,b=a.length;c<b;c++)z=256*d(a[c]+128)+q(255*e())+65536*q(255*e()),n=d((z<<this.shift(c))/256),v[3*c]=this.alfanum(n%32),v[3*c+1]=this.alfanum(n/32%32),v[3*c+2]=this.alfanum(n/1024%32);return v};l.prototype.desencripta=
function(a){return this.bytesToString(this.desencriptaAux(this.stringToBytes(a)))};l.prototype.desencriptaAux=function(a){if(null==a||null==this.key)return null;r=Array(a.length/3);for(var c=0,b=r.length;c<b;c++)n=this.numalfa(a[3*c])+32*this.numalfa(a[3*c+1])+1024*this.numalfa(a[3*c+2]),z=d(256*n>>this.shift(c)),u=d(z/256)%256-128,0>u&&(u+=256),r[c]=u;return r};l.prototype.alfanum=function(a){return(10>a?48:87)+d(a)};l.prototype.numalfa=function(a){return a-(58>a?48:87)};l.prototype.stringToBytes=
function(a){f=[];for(var c=0,b=a.length;c<b;c++)f.push(a.charCodeAt(c));return f};l.prototype.bytesToString=function(a){for(var c=0,l=a.length;c<l;c++)a[c]=b(a[c]);return a.join("")};l.prototype.shift=function(a){c=this.key.charCodeAt(a%this.key.length);f=this.numalfa(c);g=d(f/2%8);0==g&&(g=4);return g};l.prototype.parseByte=function(a){a=parseInt(a);a=0>a?0:a;return 255<a?255:a};a.Krypto=l;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=function(d,e){this.parent=d;var h=d.evaluator,p=h.parser;d=new a.Auxiliary(d);var b=this;b.delay=p.parse(e.delay?e.delay:"60");b.loop=e.loop?e.loop:!1;b.auto=void 0==e.auto?!0:e.auto;b.controls=e.controls;b.init=d.splitInstructions(p,e.init);b.doExpr=d.splitInstructions(p,e.doExpr);e.whileExpr&&(b.whileExpr=p.parse(e.whileExpr));var k,m=b.doExpr.length;b.animExec=function(){for(k=0;k<m;k++)h.eval(b.doExpr[k]);b.parent.update();b.playing&&(0<h.eval(b.whileExpr)||
b.loop)?b.timer=a.setTimeout(b.animExec,h.eval(b.delay)):(b.stop(),b.pause=!1,b.parent.update())};b.playing=!1;b.auto&&b.play()};h.prototype.play=function(){this.playing?(this.pause=!0,this.stop()):(this.pause||this.reinit(),this.playing=!0,this.pause=!1,this.timer=a.setTimeout(this.animExec,Math.max(10,this.parent.evaluator.eval(this.delay))))};h.prototype.stop=function(){this.playing=!1;a.clearTimeout(this.timer)};h.prototype.reinit=function(){for(var a=0,e=this.init.length;a<e;a++)this.parent.evaluator.eval(this.init[a])};
a.Animation=h;return a}(descartesJS||{});descartesJS=function(a){if(a.loadLib)return a;var h=function(a){this.parent=a;this.evaluator=this.parent.evaluator};h.prototype.execute=function(){};a.Action=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=function(d,e){e=void 0===e?"":e;d=a.Action.call(this,d)||this;d.parameter=e.replace(/\\n/g,"\n").replace(/&squot;/g,"'");return d};$jscomp.inherits(h,a.Action);h.prototype.execute=function(){alert(this.parameter)};a.Message=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=function(d,e){e=void 0===e?"":e;d=a.Action.call(this,d)||this;e=a.splitSeparator((e||"").replace(/&squot;/g,"'"));d.inst=[];for(var h,p=0,b=e.length;p<b;p++)(h=d.evaluator.parser.parse(e[p],!0))&&d.inst.push(h);return d};$jscomp.inherits(h,a.Action);h.prototype.execute=function(){for(var a=0,e=this.inst.length;a<e;a++)this.evaluator.eval(this.inst[a])};a.Calculate=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=function(d,e){d=a.Action.call(this,d)||this;d.parameter=e.trim();d.target="_blank";return d};$jscomp.inherits(h,a.Action);h.prototype.execute=function(){var d=this.parameter;d.match(/^\[.*\]?/)&&(d=this.evaluator.eval(this.evaluator.parser.parse(d.substring(1,d.length-1))));var e=d.indexOf("target");-1!=e&&(this.target=d.substring(e),this.target=this.target.substring(this.target.indexOf("=")+1),d=d.substring(0,e-1));if("javascript"==d.substring(0,
10)){d=new a.SimpleText(this.parent,d.substring(11).replace(/&squot;/g,"'"));try{eval(d.toString())}catch(q){}}else"http"!=d.substring(0,4)&&(e=window.__dirname||window.location.href,d=e.substring(0,e.lastIndexOf("/")+1)+d),window.open(d,this.target)};a.OpenURL=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=function(d,e){e=void 0===e?"":e;d=a.Action.call(this,d)||this;d.parameter=e.trim();d.target="_blank";return d};$jscomp.inherits(h,a.Action);h.prototype.execute=function(){var a=this.parameter;a.match(/^\[.*\]?/)&&(a=this.evaluator.eval(this.evaluator.parser.parse(a.substring(1,a.length-1))));var e=a.indexOf("target");-1!=e&&(this.target=a.substring(e),this.target=this.target.substring(this.target.indexOf("=")+1),a=a.substring(0,e-1));if("javascript"==
a.substring(0,10)){a=a.substring(11).replace(/&squot;/g,"'");try{eval(a.toString())}catch(q){}}else"http"!=a.substring(0,4)&&(e=window.__dirname||window.location.href,a=e.substring(0,e.lastIndexOf("/")+1)+a),window.open(a,this.target,"width="+this.parent.width+",height="+this.parent.height+",left="+(window.screen.width-this.parent.width)/2+",top="+(window.screen.height-this.parent.height)/2+",location=0,menubar=0,scrollbars=0,status=0,titlebar=0,toolbar=0")};a.OpenScene=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=function(d){return a.Action.call(this,d)||this};$jscomp.inherits(h,a.Action);h.prototype.execute=function(){this.parent.editor?this.parent.editor.show():window.open("about:blank","_blank","width=800px,height=600px,location=no,menubar=no,scrollbars=yes").document.write("<xmp style='width:100%;height:100%;'>"+this.parent.applet.outerHTML.replace(/<applet/g,"<ajs").replace(/<\/applet/g,"</ajs")+"</xmp>")};a.Config=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=function(d){return a.Action.call(this,d)||this};$jscomp.inherits(h,a.Action);h.prototype.execute=function(){this.parent.init()};a.Init=h;return a}(descartesJS||{});descartesJS=function(a){if(a.loadLib)return a;var h=function(d){return a.Action.call(this,d)||this};$jscomp.inherits(h,a.Action);h.prototype.execute=function(){this.parent.clear()};a.Clear=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=function(d){return a.Action.call(this,d)||this};$jscomp.inherits(h,a.Action);h.prototype.execute=function(){this.parent.play()};a.Animate=h;return a}(descartesJS||{});descartesJS=function(a){if(a.loadLib)return a;var h=function(d){return a.Action.call(this,d)||this};$jscomp.inherits(h,a.Action);h.prototype.execute=function(){this.parent.reinitAnimation()};a.InitAnimation=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=/[\w\.\-//]*(\.ogg|\.oga|\.mp3|\.wav)/gi,d=function(e,d){d=void 0===d?"":d;e=a.Action.call(this,e)||this;d.match(h)?e.filename=e.evaluator.parser.parse("'"+d.match(h)+"'"):(d.match(/^\[.*\]?/)&&(d=d.substring(1,d.length-1)),e.filename=e.evaluator.parser.parse(d));return e};$jscomp.inherits(d,a.Action);d.prototype.execute=function(){var a=this.theAudio=this.parent.getAudio(this.evaluator.eval(this.filename));a.paused?a.play():(a.pause(),a.currentTime=
0)};a.PlayAudio=d;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,d,e=function(a,e){this.parent=a;this.evaluator=a.evaluator;this.local=this.expresion=this.id="";this.evaluate="onlyOnce";Object.assign(this,e)};e.prototype.firstRun=function(){};e.prototype.update=function(){};e.prototype.splitInstructions=function(e,p){d=[];p=p?a.splitSeparator(p):[""];for(var b=0,k=p.length;b<k;b++)a.DEBUG.lineCount=b,(h=e.parse(p[b],!0))&&d.push(h);return d};e.prototype.getPrivateVariables=function(a,e){d=[];e=e?e.split(/;|,/):
[""];for(var b=0,k=e.length;b<k;b++)(h=a.parse(e[b],!0))&&d.push(h);b=0;for(k=d.length;b<k;b++)d[b]="assign"===d[b].type?d[b].childs[0].value:"identifier"===d[b].type?d[b].value:"";return d};e.prototype.parseExpressions=function(e){a.DEBUG.paramName="inicio";this.init=this.splitInstructions(e,this.init);a.DEBUG.paramName="local";this.privateVars=this.getPrivateVariables(e,this.local);a.DEBUG.paramName="hacer";this.doExpr=this.splitInstructions(e,this.doExpr);a.DEBUG.paramName="mientras";this.whileExpr=
e.parse(this.whileExpr)};a.Auxiliary=e;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=function(d,e){d=a.Auxiliary.call(this,d,e)||this;e=d.evaluator.parser;d.expresionString=d.expresion;d.expresion=e.parse(d.expresionString);d.expresion&&e.setVariable(d.id,d.expresion);d.editable&&(d.registerTextField(),d.parent.editableRegionVisible=!0);return d};$jscomp.inherits(h,a.Auxiliary);h.prototype.registerTextField=function(){var d=a.newHTML("div"),e=a.newHTML("label");e.appendChild(document.createTextNode("___"+this.id+"=___"));var h=a.newHTML("input");
h.value=this.expresionString;h.disabled=!this.editable;d.appendChild(e);d.appendChild(h);var p=this,b=p.evaluator.parser;h.onkeydown=function(a){13==a.keyCode&&(p.expresion=b.parse(this.value),b.setVariable(p.id,p.expresion),p.parent.update())};this.parent.editableRegion.textFields.push({container:d,type:"div"})};a.Variable=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=function(d,e){d=a.Auxiliary.call(this,d,e)||this;d.expresion=d.evaluator.parser.parse(d.expresion);d.update();return d};$jscomp.inherits(h,a.Auxiliary);h.prototype.update=function(){this.evaluator.setVariable(this.id,this.evaluator.eval(this.expresion))};a.Constant=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,d,e,q,p=function(b,e){e=a.Auxiliary.call(this,b,e)||this;h=b.evaluator;d=h.parser;e.size=e.size||d.parse("3");e.expresion=e.expresion.split(";");e.parseFile=d.parse(e.file);e.update();return e};$jscomp.inherits(p,a.Auxiliary);p.prototype.update=function(){var b=this.expresion,k;h=this.evaluator;d=h.parser;this.oldFile=this.file;if(e=h.eval(this.parseFile))this.file=e;if(this.file){q=(k=document.getElementById(this.file))&&"descartes/vectorFile"==
k.type?k.text:a.openFile(this.file);if(null!=q){q=q.replace(/\r/g,"").split("\n");var m=[];k=0;for(var c=q.length;k<c;k++)""!=q[k]&&m.push(q[k]);q=m}null==q||1==q.length&&""==q[0]?(q=[],this.size=d.parse("0")):(b=q,this.size=null);null===this.size&&(this.size=d.parse(b.length+""))}var f;m=[];k=0;for(c=b.length;k<c;k++)(f=d.parse(b[k],!0))&&"assign"!=f.type&&(f=d.parse(this.id+"["+k+"]="+b[k],!0)),m.push(f);b=Array(parseInt(Math.abs(h.eval(this.size)))).fill(0);b._size_=b.length;h.vectors[this.id]=
b;h.setVariable(this.id+".long",b._size_);k=0;for(c=m.length;k<c;k++)h.eval(m[k])};a.Vector=p;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,d,e,q,p,b=function(b,m){m=a.Auxiliary.call(this,b,m)||this;h=b.evaluator;d=h.parser;m.rows=m.rows||d.parse("3");m.columns=m.columns||d.parse("3");m.expresion=m.splitInstructions(d,m.expresion);e=h.eval(m.rows);q=h.eval(m.columns);p=[];p.type="matrix";b=0;for(var c=q;b<c;b++)p[b]=Array(e).fill(0);h.matrices[m.id]=p;m.update();return m};$jscomp.inherits(b,a.Auxiliary);b.prototype.update=function(){h=this.evaluator;e=h.eval(this.rows);q=h.eval(this.columns);
h.setVariable(this.id+".filas",e);h.setVariable(this.id+".columnas",q);p=h.matrices[this.id];p.rows=e;p.cols=q;for(var a=0,b=this.expresion.length;a<b;a++)h.eval(this.expresion[a])};a.Matrix=b;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=function(d,e){var h=a.Auxiliary.call(this,d,e)||this;var p=h.evaluator;d=p.parser;e=h.id.indexOf("(");h.name=h.id.substring(0,e);h.params=h.id.substring(e+1,h.id.indexOf(")"));h.domain=h.range?d.parse(h.range):d.parse("1");h.params=""===h.params?[]:h.params.split(",");h.numParams=h.params.length;h.algorithm||(h.init="",h.doExpr="",h.whileExpr="");h.parseExpressions(d);h.expresion=d.parse(h.expresion);var b;h.functionExec=function(){h.iterations=
0;if(h.numParams<=arguments.length){for(var e=[],d=0,c=h.privateVars.length;d<c;d++)e.push(p.getVariable(h.privateVars[d])),p.setVariable(h.privateVars[d],0);var f=[];d=0;for(c=h.params.length;d<c;d++)f.push(p.getVariable(h.params[d])),p.setVariable(h.params[d],arguments[d]);d=0;for(c=h.init.length;d<c;d++)p.eval(h.init[d]);b=p.getVariable("_NUM_MAX_ITE_ALG_")||1E5;do{d=0;for(c=h.doExpr.length;d<c;d++)p.eval(h.doExpr[d]);if(++h.iterations>b)return console.warn("se ha excedido el l\u00edmite de "+
b+" repeticiones en la funci\u00f3n << "+h.name+" >>"),0}while(0<p.eval(h.whileExpr));var g=p.eval(h.expresion);a.rangeOK=p.eval(h.domain);d=0;for(c=h.params.length;d<c;d++)p.setVariable(h.params[d],f[d]);d=0;for(c=h.privateVars.length;d<c;d++)p.setVariable(h.privateVars[d],e[d]);return g}return 0};p.setFunction(h.name,h.functionExec);return h};$jscomp.inherits(h,a.Auxiliary);a.Function=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=function(d,e){var h=a.Auxiliary.call(this,d,e)||this;var p=h.evaluator;h.parseExpressions(p.parser);var b;h.algorithmExec=function(){h.iterations=0;b=p.getVariable("_NUM_MAX_ITE_ALG_")||1E5;for(var a=0,e=h.init.length;a<e;a++)p.eval(h.init[a]);do{a=0;for(e=h.doExpr.length;a<e;a++)p.eval(h.doExpr[a]);if(++h.iterations>b)return console.warn("se ha excedido el l\u00edmite de "+b+" repeticiones en el algoritmo << "+h.name+" >>"),0}while(0<p.eval(h.whileExpr))};
return h};$jscomp.inherits(h,a.Auxiliary);h.prototype.update=function(){this.algorithmExec();"onlyOnce"===this.evaluate&&(this.update=function(){})};a.Algorithm=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=function(d,e){d=a.Auxiliary.call(this,d,e)||this;e=d.evaluator;delete d.evaluate;d.condition=e.parser.parse(d.condition);d.lastEval=!1;d.action=d.parent.lessonParser.parseAction(d);"onlyOnce"==d.execution&&(d.eventExec=function(){0<this.evaluator.eval(this.condition)&&!this.lastEval&&(this.lastEval=!0,this.action.execute())});"alternate"==d.execution&&(d.eventExec=function(){var a=0<this.evaluator.eval(this.condition);a&&!this.lastEval?(this.action.execute(),
this.lastEval=!0):!a&&this.lastEval&&(this.lastEval=!1)});"always"==d.execution&&(d.eventExec=function(){0<this.evaluator.eval(this.condition)&&this.action.execute()});return d};$jscomp.inherits(h,a.Auxiliary);h.prototype.update=function(){this.eventExec()};a.Event=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=function(d,e){var h=a.Auxiliary.call(this,d,e)||this;e=e.file;if(e)var p=(p=document.getElementById(e))&&"descartes/library"===p.type?p.text:a.openFile(e);if(p){p=a.convertHTMLEntities(p).replace(/\r/g,"").split("\n");e=0;for(var b=p.length;e<b;e++)""!==p[e].trim()&&d.lessonParser.parseAuxiliar(p[e])}return h};$jscomp.inherits(h,a.Auxiliary);a.Library=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,d,e,q,p,b,k,m,c=function(c,b){this.parent=c;this.evaluator=c.evaluator;var f=this.evaluator.parser;this.spaceID="";this.background=!1;this.type="";this.drawif=f.parse("1");this.abs_coord=b&&b.type&&"text"===b.type.toLowerCase()?!0:!1;this.color=new a.Color("20303a");this.trace="";this.expresion=f.parse("(0,0)");this.family="";this.family_interval=f.parse("[0,1]");this.family_steps=f.parse("8");this.editable=this.visible=!1;this.font="SansSerif,PLAIN,"+
(5<=this.parent.version?"18":"12");this.fixed=!0;this.text="";this.decimals=f.parse("2");Object.assign(this,b);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=c.evaluator.parser.parse(this.fontSize.toString()))};c.prototype.getSpace=
function(){var a=this;return this.parent.spaces.find(function(c){return c.id===a.spaceID})||this.parent.spaces[0]};c.prototype.getFamilyValues=function(){h=this.evaluator;d=h.eval(this.family_interval);this.familyInf=d[0][0];this.familySup=d[0][1];this.fSteps=Math.round(h.eval(this.family_steps));this.family_sep=0<this.fSteps?(this.familySup-this.familyInf)/this.fSteps:0};c.prototype.drawFamilyAux=function(a,c,b){h=this.evaluator;this.getFamilyValues();e=h.getVariable(this.family);if(0<=this.fSteps)for(var f=
0,g=this.fSteps;f<=g;f++)h.setVariable(this.family,this.familyInf+f*this.family_sep),0<h.eval(this.drawif)&&(this.update(),a.oldTextNode=null,this.drawAux(a,c,b));h.setVariable("_Text_H_",0);h.setVariable(this.family,e)};c.prototype.draw=function(a,c){""!==this.family?this.drawFamilyAux(this.ctx,a,c):0<this.evaluator.eval(this.drawif)&&(this.update(),this.drawAux(this.ctx,a,c));this.ctx.setLineDash([])};c.prototype.drawTrace=function(a,c){""!=this.family?this.drawFamilyAux(this.traceCtx,a,c):0<this.evaluator.eval(this.drawif)&&
(this.update(),this.drawAux(this.traceCtx,a,c))};c.prototype.rotate=function(a,c,b){k=Math.cos(b);m=Math.sin(b);return{x:a*k-c*m,y:a*m+c*k}};c.prototype.dashStyle=function(){b=this.ctx;"dot"===this.lineDash?(b.lineCap="butt",b.setLineDash([b.lineWidth,b.lineWidth])):"dash"===this.lineDash?(b.lineCap="butt",b.setLineDash([4*b.lineWidth,3*b.lineWidth])):"dash_dot"===this.lineDash?(b.lineCap="butt",b.setLineDash([4*b.lineWidth,2*b.lineWidth,b.lineWidth,2*b.lineWidth])):b.setLineDash([])};c.prototype.drawText=
function(a,c,b,e,d,k,m,l,x,w,y){a.textNode=c;if("rtfNode"===c.type)a.fillStyle=a.strokeStyle=d.getColor(),a.textBaseline="alphabetic",a.textNode.pos={x:b,y:e},c.update(a,b,e,x,w,m,y,d.getColor());else for("simpleText"===c.type&&(c=c.toString(x,w).split("\\n")),h=this.evaluator,a.fillStyle=d.getColor(),a.font=k,a.textAlign=m,a.textBaseline=l,p=1.2*this.fontSize||0,d=0,k=c.length;d<k;d++)q=c[d],this.border&&(a.strokeStyle=this.border.getColor(),a.lineWidth=4,a.lineJoin="round",a.miterLimit=2,a.strokeText(q,
b,e+p*d)),a.fillText(q,b,e+p*d)};a.Graphic=c;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,d,e,q,p,b,k,m=function(a,f){this.text=f=f.replace("&#x2013","\u2013").replace(/&squot;/g,"'");this.textElements=[];this.textElementsMacros=[];this.parent=a;this.evaluator=a.evaluator;this.type="simpleText";h="'";q=e=0;for(p=-1;e<f.length;)b=f.charAt(e),k=f.charAt(e-1),"["===b&&"\\"===k?(this.textElements.push(f.substring(q,e-1)+"["),this.textElementsMacros.push("'"+f.substring(q,e-1)+"['"),q=e+1):"]"===b&&"\\"===k?(this.textElements.push(f.substring(q,
e-1)+"]"),this.textElementsMacros.push("'"+f.substring(q,e-1)+"]'"),q=e+1):"["===b&&-1===p?(this.textElements.push(f.substring(q,e)),this.textElementsMacros.push("'"+f.substring(q,e)+"'"),q=e,p++):"["===b?p++:"]"===b&&0===p?(this.textElements.push(this.evaluator.parser.parse(f.substring(q,e+1))),this.textElementsMacros.push("["+f.substring(q,e+1)+"]"),q=e+1,p--):("]"==f.charAt(e)&&(p=0>p?p:p-1),h+=f.charAt(e)),e++;this.textElements.push(f.substring(q,e));this.textElementsMacros.push("'"+f.substring(q,
e)+"'")};m.prototype.toString=function(c,b){h="";for(var f=0,e=this.textElements.length;f<e;f++)"string"===typeof this.textElements[f]?h+=this.textElements[f]:(d=this.evaluator.eval(this.textElements[f])[0][0],""!==d&&("string"===typeof d?h+=d:Infinity==d?h+="Infinity":-Infinity==d?h+="-Infinity":isNaN(d)||"NaN"==d?h+="NaN":(d=parseFloat(d),d=b?d.toFixed(c):a.removeNeedlessDecimals(d.toFixed(c)),h+=d.toString().replace(".",this.parent.decimal_symbol))));return h};a.SimpleText=m;return a}(descartesJS||
{});
descartesJS=function(a){if(a.loadLib)return a;var h,d,e,q,p,b,k,m,c,f,g,v,r,u,z,n,l,x,w,y,A,E,J,F,G,D,B,L,H,M,P,I,O,C,Q,K=function(c,b){b=a.Graphic.call(this,c,b)||this;b.width=b.width||c.evaluator.parser.parse("1");b.fillP=b.fillP||"";b.fillM=b.fillM||"";b.parseExpression();b.visible=2===b.parent.version&&void 0==b.visible?!0:b.visible;b.visible&&b.registerTextField();r=new a.R2;u=new a.R2;z=new a.R2;x=new a.R2;n=new a.R2;b.cInd=0;return b};$jscomp.inherits(K,a.Graphic);K.prototype.parseExpression=function(){if("compOperator"===
this.expresion.type){var c=this.expresion.childs[0],b=this.expresion.childs[1];"identifier"!=c.type||"y"!=c.value||b.contains("y")?"identifier"!=b.type||"y"!=b.value||c.contains("y")?"identifier"!=c.type||"x"!=c.value||b.contains("x")?"identifier"!=b.type||"x"!=b.value||c.contains("x")||(this.funExpr=b,this.of_y=!0,this.drawAux=this.drawAuxFun):(this.funExpr=b,this.of_y=!0,this.drawAux=this.drawAuxFun):(this.funExpr=c,this.of_y=!1,this.drawAux=this.drawAuxFun):(this.funExpr=b,this.of_y=!1,this.drawAux=
this.drawAuxFun)}this.newt=new a.R2Newton(this.evaluator,this.expresion)};K.prototype.update=function(){};K.prototype.draw=function(){""!=this.family?this.drawFamilyAux(this.ctx,this.fill,this.color):(this.update(),this.drawAux(this.ctx,this.fill,this.color))};K.prototype.drawFamilyAux=function(a,c,b){e=this.evaluator;this.getFamilyValues();d=e.getVariable(this.family);if(0<=this.fSteps)for(var l=0,f=this.fSteps;l<=f;l++)e.setVariable(this.family,this.familyInf+l*this.family_sep),this.update(),this.drawAux(a,
c,b);e.setVariable(this.family,d)};K.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.fill,this.trace)};K.prototype.drawAux=function(d,N,S){if(!(0>=this.evaluator.eval(this.drawif))){this.cInd=0;e=this.evaluator;q=e.parser;p=this.space;b=e.eval(this.width);d.strokeStyle=this.color.getColor();d.lineWidth=b;k=q.getVariable("x");m=q.getVariable("y");c=p.w+24;f=p.h+24;g=c/9;3>g&&(g=3);v=f/7;3>v&&(v=3);0==this.cInd?(h=[],this.cInd++):this.cInd=(this.cInd+1)%1E7;r.set(0,0);u.set(0,
0);z.set(0,0);C=.25;Q=8;this.abs_coord||(C/=p.scale,Q/=p.scale);d.beginPath();for(L=parseInt(v/2);L<f;L+=v)for(B=parseInt(g/2);B<c;B+=g){if(this.abs_coord){x.set(B,L);l=this.newt.findZero(x,C);if(null==l)continue;e.setVariable("x",l.x);e.setVariable("y",l.y);n.set(l.x,l.y)}else{x.set(p.getRelativeX(B),p.getRelativeY(L));l=this.newt.findZero(x,C);if(null==l)continue;e.setVariable("x",l.x);e.setVariable("y",l.y);n.set(p.getAbsoluteX(l.x),p.getAbsoluteY(l.y))}w=n.ix();y=n.iy();if(-12<=w&&w<c+24&&-12<=
y&&y<f+24){if(h[w+12+(y+12)*p.w]===this.cInd)continue;h[w+12+(y+12)*p.w]=this.cInd}a.rangeOK&&(d.moveTo(w,y),d.lineTo(w,y));r.x=l.x;r.y=l.y;u.x=l.x;u.y=l.y;A=this.newt.getUnitNormal();if(0!=A.x||0!=A.y)for(A.rotL90(),z.x=A.x,z.y=A.y,J=E=0,F=!1;2>J;)if(F&&(z.x=-A.x,z.y=-A.y,l.x=r.x,l.y=r.y,u.x=l.x,u.y=l.y,this.abs_coord?n.set(l.x,l.y):n.set(p.getAbsoluteX(l.x),p.getAbsoluteY(l.y)),w=n.ix(),y=n.iy(),F=!1,E=0),l.x+=Q*z.x,l.y+=Q*z.y,l=this.newt.findZero(l,C),null!=l){e.setVariable("x",l.x);e.setVariable("y",
l.y);z.x=l.x-u.x;z.y=l.y-u.y;z.normalize();if(0==z.x&&0==z.y)break;u.x=l.x;u.y=l.y;this.abs_coord?n.set(l.x,l.y):n.set(p.getAbsoluteX(l.x),p.getAbsoluteY(l.y));G=parseInt(n.ix());D=parseInt(n.iy());if(G!=w||D!=y)if(H=w,M=y,w=G,y=D,-12<=w&&w<c+24&&-12<=y&&y<f+24){E=0;P=h[w+12+(y+12)*p.w];h[w+12+(y+12)*p.w]=this.cInd;for(N=1;8>N;N++)I=H+Math.round((w-H)*N/8),O=M+Math.round((y-M)*N/8),0<=I&&I<c&&0<=O&&O<f&&(h[I+12+(O+12)*p.w]=this.cInd);a.rangeOK&&(d.moveTo(H,M),d.lineTo(w,y));if(P===this.cInd)break}else F=
!0,J++;else 4<++E&&(F=!0,J++)}}d.stroke()}};K.prototype.X=function(a,c,b){b||(c=this.space.w/2+this.space.Ox+this.space.scale*c);c<-a&&(c=-a);c>this.space.w+a&&(c=this.space.w+a);return c};K.prototype.Y=function(a,c,b){b||(c=this.space.h/2+this.space.Oy-this.space.scale*c);c<-a&&(c=-a);c>this.space.h+a&&(c=this.space.h+a);return c};K.prototype.XX=function(a,c,b){return Math.round(this.X(a,c,b))};K.prototype.YY=function(a,c,b){return Math.round(this.Y(a,c,b))};K.prototype.extrapolate=function(c,b,
l,f,g,e){for(var d=this.evaluator.getVariable(b),h=e/2,k=0,m,r,u,p,n,v;1E-15<Math.abs(h);){m=this.evaluator.getVariable(b);r=this.evaluator.getVariable(b)+h;this.evaluator.setVariable(b,r);u=!0;try{p=g,g=this.evaluator.eval(this.funExpr),this.evaluator.setVariable(l,g),0<this.evaluator.eval(c)?(n=new a.R2(Math.min(p,g),Math.max(p,g)),v=0,v=0<e?this.Singularity(Math.abs(h),b,f,m,p,r,g,n):this.Singularity(Math.abs(h),b,f,r,g,m,p,n),0<v&&(u=!1)):u=!1}catch(aa){u=!1}u?k+=h:this.evaluator.setVariable(b,
m);h/=2}this.evaluator.setVariable(b,d);return new a.R2(k/Math.abs(e),g)};K.prototype.extrapolateOnSingularity=function(c,b,l,f,g,e){f=this.evaluator.getVariable(b);for(var d=e/2,h=0,k=g,m;1E-15<Math.abs(d);){this.evaluator.setVariable(b,this.evaluator.getVariable(b)+d);m=!0;if(0<this.evaluator.eval(c))try{k=this.evaluator.eval(this.funExpr),this.evaluator.setVariable(l,k),0>=this.evaluator.eval(c)&&(m=!1)}catch(X){m=!1}else m=!1;m?h+=d:this.evaluator.setVariable(b,this.evaluator.getVariable(b)-d);
d/=2}if(0==h)for(d=e/2,h=e,k=g;1E-15<Math.abs(d);){this.evaluator.setVariable(b,this.evaluator.getVariable(b)-d);m=!0;if(0<this.evaluator.eval(c))try{k=this.evaluator.eval(this.funExpr)}catch(X){m=!1}else m=!1;m?h+=-d:this.evaluator.setVariable(b,this.evaluator.getVariable(b)+d);d/=2}this.evaluator.setVariable(b,f);return new a.R2(h/Math.abs(e),k)};K.prototype.Singularity=function(a,c,b,l,f,g,e,d){if(isNaN(e)||isNaN(f)||isNaN(d.y)||isNaN(d.x)||l>=g)return 2;var h=this.evaluator.getVariable(c),k=0;
try{if(1E-15>Math.abs(g-l)||1E-12>Math.abs(g-l)&&Math.abs(e-f)>Math.abs(a))return this.evaluator.setVariable(c,h),1;var m=(l+g)/2;this.evaluator.setVariable(c,m);var r=NaN;try{r=this.evaluator.eval(this.funExpr)}catch(Y){return 2}if(isNaN(r))return 5;if(Math.abs(e-f)>a){this.evaluator.setVariable(c,l-1E-12);var u=this.evaluator.eval(this.funExpr);u=(f-u)/1E-12;this.evaluator.setVariable(c,g+1E-12);var p=(this.evaluator.eval(this.funExpr)-e)/1E-12;if((10>Math.abs(p)||10>Math.abs(u))&&(0<=p&&0<=u||
0>=p&&0>=u)&&4*Math.abs(p)<Math.abs((e-f)/(g-l)))return this.evaluator.setVariable(c,h),2}if(isNaN(d.x)||isNaN(d.y)||isNaN(r))return 2;if(!(d.x<=r&&r<=d.y)){this.evaluator.setVariable(c,m);d.x=Math.min(f,r);d.y=Math.max(f,r);var n=this.Singularity(a/2,c,b,l,f,m,r,d);this.evaluator.setVariable(c,g);d.x=Math.min(e,r);d.y=Math.max(e,r);var v=this.Singularity(a/2,c,b,m,r,g,e,d);k=Math.max(n,v)}}catch(Y){k=1}this.evaluator.setVariable(c,h);return k};K.prototype.discontLR=function(a,c,b,l){var f=c+b,g=
f+b,e=c-b;b=e-b;this.evaluator.setVariable("x",c);c=this.evaluator.eval(a);if(isNaN(c)||!isFinite(c)||Math.abs(c)>l)return!0;this.evaluator.setVariable("x",f);f=this.evaluator.eval(a);if(isNaN(f)||!isFinite(f)||Math.abs(f)>l)return!0;this.evaluator.setVariable("x",g);g=this.evaluator.eval(a);if(isNaN(g)||!isFinite(g)||Math.abs(g)>l)return!0;this.evaluator.setVariable("x",e);e=this.evaluator.eval(a);if(isNaN(e)||!isFinite(e)||Math.abs(e)>l)return!0;this.evaluator.setVariable("x",b);a=this.evaluator.eval(a);
if(isNaN(a)||!isFinite(a)||Math.abs(a)>l)return!0;l=3*c-4*f+g;a=3*c-4*e+a;return.8<Math.abs((l*l-a*a)/(l*l+a*a+1E-4))?!0:!1};K.prototype.drawAuxFun1=function(c,b,l){k=this.evaluator.parser.getVariable("x");m=this.evaluator.parser.getVariable("y");a.rangeOK=1;if(this.evaluator.eval(this.drawif)){b="x";this.of_y&&(b="y");c.beginPath();c.lineWidth=this.evaluator.eval(this.width);c.strokeStyle=l.getColor();for(var f=-1;f<=this.space.w;f+=1){l=this.space.getRelativeX(f);this.evaluator.setVariable(b,l);
var g=this.evaluator.eval(this.funExpr);var e=this.space.getAbsoluteX(l);g=this.space.getAbsoluteY(g);this.discontLR(this.funExpr,l,.001,100)?c.moveTo(e,g):c.lineTo(e,g)}c.stroke();this.evaluator.parser.setVariable("x",k);this.evaluator.parser.setVariable("y",m)}};K.prototype.drawAuxFun=function(c,b,l){k=this.evaluator.parser.getVariable("x");m=this.evaluator.parser.getVariable("y");a.rangeOK=1;b="x";var f="y";this.of_y&&(b="y",f="x");var g=this.drawif,e=this.evaluator.eval(this.width),d=!1,h=new a.R2(this.space.w/
2+this.space.Ox,this.space.h/2+this.space.Oy),r=this.of_y?h.ix():h.iy(),u=0,p=0,n=0,v=0,q=1/this.space.scale;h=q*(this.of_y?-this.space.h+h.y:-h.x);var E=0;this.abs_coord&&(h=0,q=1);for(var y,z,x,A,w,B,G,H,D,F=this.of_y?this.space.h+2:this.space.w+2;n<=F;){y=!0;z=0;this.evaluator.setVariable(b,h);try{x=this.evaluator.eval(this.funExpr),isNaN(x)||(this.evaluator.setVariable(f,x),0<this.evaluator.eval(this.drawif)&&a.rangeOK?(d?(A=Math.min(E,x),w=Math.max(E,x),B=new a.R2(A,w),z=this.Singularity(q,b,
0,h-q,E,h,x,B),0===z?(E<=x?(E=B.x,x=B.y):(x=B.x,E=B.y),G=parseInt(this.of_y?this.XX(e,E,this.abs_coord):this.YY(e,E,this.abs_coord)),u=this.abs_coord?Math.round(x):parseInt(this.of_y?this.XX(e,x,this.abs_coord):this.YY(e,x,this.abs_coord)),this.fillM&&u>r&&(c.lineWidth=1,c.strokeStyle=this.fillM.getColor(),c.beginPath(),this.of_y?(c.moveTo(r+1,this.space.h-n+.5),c.lineTo(u,this.space.h-n+.5)):(c.moveTo(n+.5,r+1),c.lineTo(n+.5,u)),c.stroke()),this.fillP&&u<r&&(c.lineWidth=1,c.strokeStyle=this.fillP.getColor(),
c.beginPath(),this.of_y?(c.moveTo(r-1,this.space.h-n+.5),c.lineTo(u,this.space.h-n+.5)):(c.moveTo(n+.5,r-1),c.lineTo(n+.5,u)),c.stroke()),c.lineWidth=e,c.strokeStyle=l.getColor(),c.beginPath(),this.of_y?(c.moveTo(G+.5,this.space.h-v),c.lineTo(u+.5,this.space.h-n)):(c.moveTo(v+.5,G),c.lineTo(n+.5,u)),c.stroke()):1===z?(this.evaluator.setVariable(b,h-q),H=this.extrapolate(g,b,f,0,E,q),u=this.of_y?this.XX(e,H.y,this.abs_coord):this.YY(e,H.y,this.abs_coord),c.lineWidth=e,c.strokeStyle=l.getColor(),c.beginPath(),
this.of_y?(c.moveTo(p+.5,this.space.h-v),c.lineTo(u+.5,this.space.h-v+Math.round(H.x))):(c.moveTo(v+.5,p),c.lineTo(v+Math.round(H.x)+.5,u)),this.evaluator.setVariable(b,h),D=this.extrapolate(g,b,f,0,x,-q),p=this.of_y?this.XX(e,D.y,this.abs_coord):this.YY(e,D.y,this.abs_coord),u=this.of_y?this.XX(e,x,this.abs_coord):this.YY(e,x,this.abs_coord),c.lineWidth=e,c.strokeStyle=l.getColor(),c.beginPath(),this.of_y?(c.moveTo(p+.5,this.space.h-n),c.lineTo(u+.5,this.space.h-n)):(c.moveTo(n+.5,p),c.lineTo(n+
.5,u)),c.stroke()):2===z&&(u=this.of_y?this.XX(e,x,this.abs_coord):this.YY(e,x,this.abs_coord),c.lineWidth=e,c.strokeStyle=l.getColor(),c.beginPath(),this.of_y?(c.moveTo(p+.5,this.space.h-n),c.lineTo(u+.5,this.space.h-n)):(c.moveTo(n+.5,p),c.lineTo(n+.5,u)))):(D=this.extrapolateOnSingularity(g,b,f,0,x,-q),p=this.of_y?this.XX(e,D.y,this.abs_coord):this.YY(e,D.y,this.abs_coord),u=this.of_y?this.XX(e,x,this.abs_coord):this.YY(e,x,this.abs_coord),c.lineWidth=e,c.strokeStyle=l.getColor(),c.beginPath(),
this.of_y?(c.moveTo(p,this.space.h-(n+Math.round(D.x))+.5),c.lineTo(u,this.space.h-n+.5)):(c.moveTo(n+Math.round(D.x),p),c.lineTo(n,u)),c.stroke()),E=x):y=!1)}catch(ba){y=!1}d&&!y&&(this.evaluator.setVariable(b,h-q),this.evaluator.setVariable(f,E),H=this.extrapolate(g,b,f,0,E,q),u=parseInt(this.of_y?this.XX(e,H.y,this.abs_coord):this.YY(e,H.y,this.abs_coord)),0<this.evaluator.eval(this.drawif)&&a.rangeOK&&(c.lineWidth=e,c.strokeStyle=l.getColor(),c.beginPath(),this.of_y?(c.moveTo(p,this.space.h-(v+
Math.round(H.x))+.5),c.lineTo(u,this.space.h-(v+Math.round(H.x))+.5)):(c.moveTo(v+Math.round(H.x)+.5,p),c.lineTo(v+Math.round(H.x)+.5,u)),c.stroke()),this.evaluator.setVariable(b,h));d=y;h+=q;p=u;v=n++}this.evaluator.parser.setVariable("x",k);this.evaluator.parser.setVariable("y",m)};K.prototype.registerTextField=function(){var c=a.newHTML("input");c.value=this.expresionString;c.disabled=!this.editable;var b=this;oncontextmenu=function(a){return!1};c.onkeydown=function(a){13==a.keyCode&&(b.expresion=
b.evaluator.parser.parse(this.value),b.parseExpression(),b.parent.update())};this.parent.editableRegion.textFields.push(c)};a.Equation=K;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.round,d,e,q,p,b,k,m,c=function(c,b){b=a.Graphic.call(this,c,b)||this;b.parameter=b.parameter||"t";b.parameter_interval=b.parameter_interval||c.evaluator.parser.parse("[0,1]");b.parameter_steps=b.parameter_steps||c.evaluator.parser.parse("8");b.width=b.width||c.evaluator.parser.parse("1");b.fill=b.fill||"";b.visible=2===b.parent.version&&void 0==b.visible?!0:b.visible;b.visible&&b.registerTextField();return b};$jscomp.inherits(c,a.Graphic);c.prototype.update=
function(){d=this.evaluator;e=d.eval(this.parameter_interval);this.paraInf=e[0][0];this.paraSup=e[0][1];this.pSteps=d.eval(this.parameter_steps);this.paraSep=0<this.pSteps?Math.abs(this.paraSup-this.paraInf)/this.pSteps:0};c.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.fill,this.color)};c.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.fill,this.trace)};c.prototype.drawAux=function(c,g,e){d=this.evaluator;q=this.space;c.lineWidth=Math.max(1E-6,h(d.eval(this.width)));
c.lineCap=c.lineJoin="round";c.strokeStyle=e.getColor();p=d.getVariable(this.parameter);c.beginPath();d.setVariable(this.parameter,this.paraInf);b=d.eval(this.expresion);this.exprX=h(this.abs_coord?b[0][0]:q.getAbsoluteX(b[0][0]));this.exprY=h(this.abs_coord?b[0][1]:q.getAbsoluteY(b[0][1]));this.rotateExp&&(k=a.degToRad(d.eval(this.rotateExp)),m=this.rotate(b[0][0],b[0][1],k),this.exprX=h(this.abs_coord?m.x:q.getAbsoluteX(m.x)),this.exprY=h(this.abs_coord?m.y:q.getAbsoluteY(m.y)));c.moveTo(this.exprX+
.5,this.exprY+.5);for(e=1;e<=this.pSteps;e++)d.setVariable(this.parameter,this.paraInf+e*this.paraSep),b=d.eval(this.expresion),this.rotateExp&&(m=this.rotate(b[0][0],b[0][1],k),b[0][0]=m.x,b[0][1]=m.y),this.exprX=h(this.abs_coord?b[0][0]:q.getAbsoluteX(b[0][0])),this.exprY=h(this.abs_coord?b[0][1]:q.getAbsoluteY(b[0][1])),!isNaN(this.exprX)&&!isNaN(this.exprY)&&-1E6<this.exprX&&1E6>this.exprX&&-1E6<this.exprY&&1E6>this.exprY&&c.lineTo(this.exprX+.5,this.exprY+.5);this.fill&&(c.fillStyle=g.getColor(),
c.fill("evenodd"));this.dashStyle();c.stroke();c.setLineDash([]);d.setVariable(this.parameter,p)};c.prototype.registerTextField=function(){var c=a.newHTML("input");c.value=this.expresionString;c.disabled=!this.editable;var b=this;c.oncontextmenu=function(){return!1};c.onkeydown=function(a){13==a.keyCode&&(b.expresion=b.evaluator.parser.parse(this.value),b.parent.update())};this.parent.editableRegion.textFields.push(c)};a.Curve=c;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=2*Math.PI,d=Math.round,e,q,p,b,k,m,c,f,g,v,r=function(c,b){b=a.Graphic.call(this,c,b)||this;b.size=b.size||c.evaluator.parser.parse("2");b.range=b.range||c.evaluator.parser.parse("[1, 100]");b.visible=2===b.parent.version&&void 0==b.visible?!0:b.visible;b.visible&&b.registerTextField();return b};$jscomp.inherits(r,a.Graphic);r.prototype.update=function(){e=this.evaluator;p=e.eval(this.expresion);this.exprX=p[0][0];this.exprY=p[0][1];this.rotateExp&&
(b=this.rotate(p[0][0],p[0][1],a.degToRad(e.eval(this.rotateExp))),this.exprX=b.x,this.exprY=b.y);c=e.eval(this.range);this.rangeInf=c[0][0];this.rangeMax=c[0][1]};r.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.color,this.color)};r.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.trace,this.trace)};r.prototype.drawAux=function(c,b){e=this.evaluator;q=this.space;g=f=Math.ceil(e.eval(this.size)-.4);c.fillStyle=b.getColor();c.beginPath();this.rangeInf>
this.rangeMax&&(v=this.rangeInf,this.rangeInf=this.rangeMax,this.rangeMax=v);b=e.getVariable("n");for(var r=this.rangeInf,l=this.rangeMax;r<=l;r++)e.setVariable("n",r),p=e.eval(this.expresion),this.exprX=p[0][0],this.exprY=p[0][1],k=d(this.abs_coord?this.exprX:q.getAbsoluteX(this.exprX)),m=d(this.abs_coord?this.exprY:q.getAbsoluteY(this.exprY)),c.beginPath(),c.arc(k,m,f,0,h,!0),c.fill();c.fill();this.text!=[""]&&(this.fontSize=Math.max(5,e.eval(this.font_size)),this.font=this.font_style+" "+this.fontSize+
"px "+this.font_family,a.Graphic.prototype.drawText.call(this,c,this.text,k+g,m-g,this.color,this.font,"start","alphabetic",e.eval(this.decimals),this.fixed,!0));e.setVariable("n",b)};r.prototype.registerTextField=function(){var c=a.newHTML("input");c.value=this.expresionString;c.disabled=!this.editable;var b=this;oncontextmenu=function(a){return!1};c.onkeydown=function(a){13==a.keyCode&&(b.expresion=b.evaluator.parser.parse(this.value),b.parent.update())};this.parent.editableRegion.textFields.push(c)};
a.Sequence=r;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=2*Math.PI,d=Math.round,e,q,p,b,k,m,c,f=function(c,b){b=a.Graphic.call(this,c,b)||this;b.size=b.size||c.evaluator.parser.parse("2");b.text=new a.TextObject(b,b.text);return b};$jscomp.inherits(f,a.Graphic);f.prototype.update=function(){e=this.evaluator;p=e.eval(this.expresion);this.exprX=p[0][0];this.exprY=p[0][1];this.rotateExp&&(b=this.rotate(p[0][0],p[0][1],a.degToRad(e.eval(this.rotateExp))),this.exprX=b.x,this.exprY=b.y)};f.prototype.draw=function(){a.Graphic.prototype.draw.call(this,
this.color,this.color)};f.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.trace,this.trace)};f.prototype.drawAux=function(a,b){q=this.space;a.fillStyle=b.getColor();k=d(this.abs_coord?this.exprX:q.getAbsoluteX(this.exprX));m=d(this.abs_coord?this.exprY:q.getAbsoluteY(this.exprY));c=d(this.evaluator.eval(this.size));0<c&&(a.beginPath(),a.arc(k,m,c,0,h),a.fill());this.text.hasContent&&this.text.draw(a,b,k,m)};a.Point=f;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.round,d=2*Math.PI,e,q,p,b,k,m,c,f,g,v,r=function(c,b){b=a.Graphic.call(this,c,b)||this;b.width=b.width||c.evaluator.parser.parse("1");b.size=b.size||c.evaluator.parser.parse("2");b.text=new a.TextObject(b,b.text);return b};$jscomp.inherits(r,a.Graphic);r.prototype.update=function(){e=this.evaluator;p=e.eval(this.expresion);this.endPoints=[];for(var c=0,f=p.length;c<f;c++)this.endPoints[c]={x:p[c][0],y:p[c][1]};if(this.rotateExp)for(b=a.degToRad(e.eval(this.rotateExp)),
c=0,f=this.endPoints.length;c<f;c++)this.endPoints[c]=this.rotate(this.endPoints[c].x,this.endPoints[c].y,b)};r.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.color,this.color)};r.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.trace,this.trace)};r.prototype.drawAux=function(a,b,r){e=this.evaluator;q=this.space;a.lineWidth=Math.max(1E-6,h(e.eval(this.width)));k=e.eval(this.size);a.fillStyle=b.getColor();a.strokeStyle=r.getColor();a.lineCap="round";m=
0==a.lineWidth%2?0:.5;this.abs_coord?(c=h(this.endPoints[0].x),f=h(this.endPoints[0].y),g=h(this.endPoints[1].x),v=h(this.endPoints[1].y)):(c=h(q.getAbsoluteX(this.endPoints[0].x)),f=h(q.getAbsoluteY(this.endPoints[0].y)),g=h(q.getAbsoluteX(this.endPoints[1].x)),v=h(q.getAbsoluteY(this.endPoints[1].y)));a.beginPath();a.moveTo(c+m,f+m);a.lineTo(g+m,v+m);this.dashStyle();a.stroke();0<k&&(a.beginPath(),a.arc(c,f,k,0,d),a.arc(g,v,k,0,d),a.fill());a.setLineDash([]);this.text.hasContent&&this.text.draw(a,
r,parseInt((c+g)/2)-3,parseInt((f+v)/2)+3)};a.Segment=r;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.floor,d=Math.round,e,q,p,b,k,m,c,f,g,v,r,u,z,n=function(c,b){b=a.Graphic.call(this,c,b)||this;b.width=b.width||c.evaluator.parser.parse("5");b.size=b.size||c.evaluator.parser.parse("2");b.spear=b.spear||c.evaluator.parser.parse("8");b.arrow=b.arrow||new a.Color("ee0022");b.text=new a.TextObject(b,b.text);b.endPoints=[];b.vect=new a.Vector2D(0,0);return b};$jscomp.inherits(n,a.Graphic);n.prototype.update=function(){e=this.evaluator;q=e.eval(this.expresion);
for(var c=0,b=q.length;c<b;c++)this.endPoints[c]={x:q[c][0],y:q[c][1]};if(this.rotateExp)for(p=a.degToRad(e.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,p)};n.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.arrow,this.color)};n.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.arrow,this.trace)};n.prototype.drawAux=function(a,p,n){e=this.evaluator;b=this.space;k=Math.max(0,
e.eval(this.width));m=Math.ceil(k/2);c=b.scale;this.vect.x=this.endPoints[1].x-this.endPoints[0].x;this.vect.y=this.endPoints[1].y-this.endPoints[0].y;f=this.vect.vectorLength();this.angle=Math.atan2(this.vect.y,this.vect.x);a.fillStyle=p.getColor();a.strokeStyle=n.getColor();a.lineWidth=2;this.abs_coord?(g=d(this.endPoints[0].x),v=d(this.endPoints[0].y),r=d(this.endPoints[1].x),u=d(this.endPoints[1].y)):(g=d(b.getAbsoluteX(this.endPoints[0].x)),v=d(b.getAbsoluteY(this.endPoints[0].y)),r=d(b.getAbsoluteX(this.endPoints[1].x)),
u=d(b.getAbsoluteY(this.endPoints[1].y)));z=Math.max(0,e.eval(this.spear));a.save();a.translate(g,v);this.abs_coord?a.rotate(this.angle):(f*=c,a.rotate(-this.angle));a.beginPath();a.moveTo(-m,h(-m));a.lineTo(h(f-z-k),h(-m));a.lineTo(h(f-2*z),h(-z-m));a.lineTo(h(f),0);a.lineTo(h(f-2*z),h(z+m));a.lineTo(h(f-z-k),h(m));a.lineTo(-m,h(m));a.closePath();a.stroke();a.fill();a.restore();this.text.hasContent&&this.text.draw(a,n,parseInt((g+r)/2)-3,parseInt((v+u)/2)+3)};a.Arrow=n;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.round,d,e,q,p,b,k,m=function(c,b){b=a.Graphic.call(this,c,b)||this;b.width=b.width||c.evaluator.parser.parse("1");b.fill=b.fill||"";b.endPoints=[];return b};$jscomp.inherits(m,a.Graphic);m.prototype.update=function(){d=this.evaluator;q=d.eval(this.expresion);for(var c=0,b=q.length;c<b;c++)this.endPoints[c]={x:q[c][0],y:q[c][1]};if(this.rotateExp)for(p=a.degToRad(d.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,p)};m.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.fill,this.color)};m.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.trace,this.trace)};m.prototype.drawAux=function(a,f,g){d=this.evaluator;e=this.space;a.lineWidth=Math.max(1E-6,h(d.eval(this.width)));a.strokeStyle=g.getColor();a.lineCap=a.lineJoin="round";b=h(this.abs_coord?this.endPoints[0].x:e.getAbsoluteX(this.endPoints[0].x));k=h(this.abs_coord?this.endPoints[0].y:e.getAbsoluteY(this.endPoints[0].y));
a.beginPath();a.moveTo(b+0,k+0);g=1;for(var c=this.endPoints.length;g<c;g++)b=h(this.abs_coord?this.endPoints[g].x:e.getAbsoluteX(this.endPoints[g].x)),k=h(this.abs_coord?this.endPoints[g].y:e.getAbsoluteY(this.endPoints[g].y)),a.lineTo(b+0,k+0);this.fill&&(a.fillStyle=f.getColor(),a.fill());this.dashStyle();a.stroke();a.setLineDash([])};a.Polygon=m;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.round,d=Math.min,e=Math.max,q=Math.abs,p,b,k,m,c,f,g,v,r,u,z=function(c,b){b=a.Graphic.call(this,c,b)||this;b.width=b.width||c.evaluator.parser.parse("1");b.fill=b.fill||"";b.border_radius=b.border_radius||c.evaluator.parser.parse("0");b.endPoints=[];return b};$jscomp.inherits(z,a.Graphic);z.prototype.update=function(){p=this.evaluator;m=p.eval(this.expresion);this.exprX=m[0][0];this.exprY=m[0][1];this.w=150;this.h=100;this.rotateExp&&(k=this.rotate(m[0][0],
m[0][1],a.degToRad(p.eval(this.rotateExp))),this.exprX=k.x,this.exprY=k.y);4<=m[0].length&&(this.w=m[0][2],this.h=m[0][3]);m[1]&&2==m[1].length&&(this.w=m[1][0],this.h=m[1][1]);this.w=e(0,this.w);this.h=e(0,this.h)};z.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.fill,this.color)};z.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.fill,this.trace,"trace")};z.prototype.drawAux=function(a,l,k,m){p=this.evaluator;b=this.space;a.lineWidth=Math.max(1E-6,h(p.eval(this.width)));
a.strokeStyle=k.getColor();a.lineCap="round";a.lineJoin="miter";c=h(this.abs_coord?this.exprX:b.getAbsoluteX(this.exprX))+0;f=h(this.abs_coord?this.exprY:b.getAbsoluteY(this.exprY))+0;g=this.abs_coord?this.w:this.w*b.scale;v=this.abs_coord?this.h:-this.h*b.scale;r=d(e(0,p.eval(this.border_radius)),.5*q(g),.5*q(v));u=this.abs_coord?1:-1;a.beginPath();0!==r?(a.moveTo(c+r,f),a.lineTo(c+g-r,f),a.quadraticCurveTo(c+g,f,c+g,f+u*r),a.lineTo(c+g,f+v-u*r),a.quadraticCurveTo(c+g,f+v,c+g-r,f+v),a.lineTo(c+r,
f+v),a.quadraticCurveTo(c,f+v,c,f+v-u*r),a.lineTo(c,f+u*r),a.quadraticCurveTo(c,f,c+r,f),a.lineTo(c+r,f)):(a.moveTo(c,f),a.lineTo(c+g,f),a.lineTo(c+g,f+v),a.lineTo(c,f+v),a.lineTo(c,f));this.fill&&(a.fillStyle=l.getColor(),a.fill());this.dashStyle();a.stroke();a.setLineDash([])};a.Rectangle=z;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.round,d=Math.min,e=Math.max,q=Math.acos,p=Math.sqrt,b=Math.PI,k=b/2,m=2*b,c,f,g,v,r,u,z,n,l,x,w,y,A,E,J,F,G,D,B,L,H=function(c,b){b=a.Graphic.call(this,c,b)||this;b.width=b.width||c.evaluator.parser.parse("1");b.fill=b.fill||"";b.center=b.center||c.evaluator.parser.parse("(0,0)");b.radius=b.radius||c.evaluator.parser.parse("1");b.init=b.init||"0";b.end=b.end||"90";b.init.match(/^_\(/)&&(b.initFlag=!0,b.init=b.init.substring(1));b.end.match(/^_\(/)&&
(b.endFlag=!0,b.end=b.end.substring(1));b.initExpr=c.evaluator.parser.parse(b.init);b.endExpr=c.evaluator.parser.parse(b.end);b.text=new a.TextObject(b,b.text);return b};$jscomp.inherits(H,a.Graphic);H.prototype.update=function(){c=this.evaluator;f=c.eval(this.center);this.exprX=f[0][0];this.exprY=f[0][1];g=0;this.rotateExp&&(g=a.degToRad(c.eval(this.rotateExp)),v=Math.cos(g),r=Math.sin(g),u=this.exprX*v-this.exprY*r,z=this.exprX*r+this.exprY*v,this.exprX=u,this.exprY=z);var h=c.eval(this.initExpr),
B=c.eval(this.endExpr);/^(\(|\[)expr(\)|\])$/i.test(this.initExpr.type)&&/^(\(|\[)expr(\)|\])$/i.test(this.endExpr.type)?(n=h[0][0],l=h[0][1],x=B[0][0],w=B[0][1],this.vectors?this.abs_coord&&(l=-l,w=-w):(n-=this.exprX,l=-l+this.exprY,x-=this.exprX,w=-w+this.exprY,this.abs_coord||(l=-l,w=-w)),y=0==n?0>l?3*k:k:q(1*n/p(n*n+l*l)),A=0==x?0>w?3*k:k:q(1*x/p(x*x+w*w)),y+=g,A+=g,0<n&&0<l&&this.abs_coord&&(y=m-y),0<n&&0>l&&!this.abs_coord&&(y=m-y),0>n&&0>l&&!this.abs_coord&&(y=m-y),0>n&&0<l&&this.abs_coord&&
(y=m-y),0<x&&0<w&&this.abs_coord&&(A=m-A),0<x&&0>w&&!this.abs_coord&&(A=m-A),0>x&&0>w&&!this.abs_coord&&(A=m-A),0>x&&0<w&&this.abs_coord&&(A=m-A),this.initFlag?(E=y,y=A,A=E):(E=d(y,A),J=e(y,A),y=E,A=J,A-y>b&&this.abs_coord&&(y=J,A=E),A-y<=b&&!this.abs_coord&&(y=J,A=E)),this.iniAng=y,this.endAng=A,this.drawPoints=!0):(this.iniAng=a.degToRad(h)+g,this.endAng=a.degToRad(B)+g,this.drawAngle=!0)};H.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.fill,this.color)};H.prototype.drawTrace=
function(){a.Graphic.prototype.drawTrace.call(this,this.fill,this.trace)};H.prototype.drawAux=function(a,b,l){c=this.evaluator;F=this.space;B=Math.max(0,c.eval(this.radius));a.lineWidth=Math.max(1E-6,h(c.eval(this.width)));a.lineCap="round";a.strokeStyle=l.getColor();this.abs_coord?(G=h(this.exprX),D=h(this.exprY)):(G=h(F.getAbsoluteX(this.exprX)),D=h(F.getAbsoluteY(this.exprY)),B*=F.scale,this.iniAng=-this.iniAng,this.endAng=-this.endAng);this.drawAngle&&this.iniAng>this.endAng&&(L=this.iniAng,this.iniAng=
this.endAng,this.endAng=L);this.fill&&(a.fillStyle=b.getColor(),a.beginPath(),a.moveTo(G,D),a.arc(G,D,B,this.iniAng,this.endAng,void 0),a.fill());a.beginPath();a.arc(G,D,B,this.iniAng,this.endAng,void 0);this.dashStyle();a.stroke();this.text.hasContent&&this.text.draw(a,this.color,G,D)};a.Arc=H;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,d,e,q,p,b=function(b,e){e=a.Graphic.call(this,b,e)||this;e.width=e.width||b.evaluator.parser.parse("0");e.align||(e.align="left");e.anchor||(e.anchor="top_left");e.shadowColor=e.shadowColor?e.shadowColor.getColor():"transparent";e.text=new a.TextObject(e,e.text);return e};$jscomp.inherits(b,a.Graphic);b.prototype.update=function(){h=this.evaluator;d=h.eval(this.expresion);this.exprX=d[0][0];this.exprY=d[0][1];this.rotateExp&&(e=this.rotate(d[0][0],
d[0][1],a.degToRad(h.eval(this.rotateExp))),this.exprX=e.x,this.exprY=e.y)};b.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.color)};b.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,this.trace)};b.prototype.drawAux=function(a,b){this.abs_coord?(q=parseInt(this.exprX),p=parseInt(this.exprY)):(q=parseInt(this.space.getAbsoluteX(this.exprX)),p=parseInt(this.space.getAbsoluteY(this.exprY)));this.text.draw(a,b,q,p)};a.Text=b;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.round,d,e,q,p,b,k,m,c,f,g,v,r=function(c,b){b=a.Graphic.call(this,c,b)||this;b.file=b.file||"";b.inirot=b.inirot||c.evaluator.parser.parse("0");b.img=new Image;b.scaleX=b.scaleY=1;b.ratio=c.ratio;c=b.expresion.getChildren();b.x_e=c[0];b.y_e=c[1];2<c.length&&(b.centered=!0,b.s_x_e=c[2],b.s_y_e=3<c.length?c[3]:c[2]);b.evaluator.eval(b.clip)&&(b.clip=b.clip.getChildren());b.update();return b};$jscomp.inherits(r,a.Graphic);r.prototype.update=function(){d=
this.evaluator;var c=d.eval(this.x_e),b=d.eval(this.y_e);this.exprX=c;this.exprY=b;this.rotateExp&&(e=this.rotate(c,b,a.degToRad(d.eval(this.rotateExp))),this.exprX=e.x,this.exprY=e.y);this.centered&&(this.scaleX=d.eval(this.s_x_e),this.scaleY=d.eval(this.s_y_e),0==this.scaleX&&(this.scaleX=1E-5),0==this.scaleY&&(this.scaleY=1E-5));var f=this;if((q=d.eval(this.file))||""==q)this.img=this.parent.getImage(q),this.img.addEventListener("load",function(a){f.space.update(!0)})};r.prototype.draw=function(){a.Graphic.prototype.draw.call(this)};
r.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this)};r.prototype.drawAux=function(e){d=this.evaluator;p=this.space;this.img&&this.img.ready&&this.img.complete&&(this.clip?(g=d.eval(this.clip[2]),v=d.eval(this.clip[3])):(g=this.img.width,v=this.img.height,this.img.canvas&&(g=h(g/this.ratio),v=h(v/this.ratio))),b=this.centered?0:h(g/2),k=this.centered?0:h(v/2),m=h(this.abs_coord?this.exprX:p.getAbsoluteX(this.exprX)),c=h(this.abs_coord?this.exprY:p.getAbsoluteY(this.exprY)),f=
a.degToRad(-d.eval(this.inirot)),e.save(),e.translate(m+b,c+k),e.rotate(f),this.opacity&&(e.globalAlpha=d.eval(this.opacity)),e.scale(this.scaleX,this.scaleY),this.clip?this.img.canvas?e.drawImage(this.img,d.eval(this.clip[0])*this.ratio,d.eval(this.clip[1])*this.ratio,g*this.ratio,v*this.ratio,-g/2,-v/2,g,v):e.drawImage(this.img,d.eval(this.clip[0]),d.eval(this.clip[1]),g,v,-g/2,-v/2,g,v):e.drawImage(this.img,-g/2,-v/2,g,v),e.restore())};a.Image=r;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,d,e,q,p,b,k,m,c=document.createElement("canvas").getContext("2d");c.canvas.width=1;c.canvas.height=1;var f=function(c,b){return a.Graphic.call(this,c,b)||this};$jscomp.inherits(f,a.Graphic);f.prototype.update=function(){h=this.evaluator.eval(this.expresion);this.exprX=h[0][0];this.exprY=h[0][1]};f.prototype.draw=function(){a.Graphic.prototype.draw.call(this,this.color,this.color)};f.prototype.drawTrace=function(){a.Graphic.prototype.drawTrace.call(this,
this.trace,this.trace)};f.prototype.drawAux=function(a,f){f=f.getColor();c.clearRect(0,0,1,1);c.fillStyle=f;c.fillRect(0,0,1,1);f=(new Uint32Array(c.getImageData(0,0,1,1).data.buffer))[0];k=a.getImageData(0,0,this.space.w,this.space.h);m=new Uint32Array(k.data.buffer);this.abs_coord?(d=parseInt(this.exprX),e=parseInt(this.exprY)):(d=parseInt(this.space.getAbsoluteX(this.exprX)),e=parseInt(this.space.getAbsoluteY(this.exprY)));if(!(0>d||0>e||d>=this.space.w||e>=this.space.h)){q=[d,e];var g=k.width;
p=0>d||0>e||d>=g||e>=k.height?-1:m[d+e*g];for(b=0;0<q.length&&!(b++,e=q.pop(),d=q.pop(),g=k.width,p==(0>d||0>e||d>=g||e>=k.height?-1:m[d+e*g])&&(m[d+e*k.width]=f,q.push(d-1,e),q.push(d+1,e),q.push(d,e-1),q.push(d,e+1)),b>=this.space.w*this.space.h*8););a.putImageData(k,0,0)}};a.Fill=f;return a}(descartesJS||{});
descartesJS=function(a,h){if(a.loadLib)return a;var d=new String("-text-image-point-polygon-arc-segment-arrow-macro-curve-equation-sequence-rectangle-fill-"),e=/[\w\.\-//]*(\.png|\.jpg|\.gif|\.svg|\.webp)/gi,q,p=function(b,k){var m=a.Graphic.call(this,b,k)||this;m.hasExpresion=m.hasExpresion||!1;m.inirot=m.inirot||b.evaluator.parser.parse("0");m.inipos=m.inipos||b.evaluator.parser.parse("(0,0)");Object.assign(m,k);m.hasExpresion=void 0!==m.expresion;m.graphics=[];b=b.lessonParser;var c=new a.Tokenizer;
if(!m.hasExpresion)return m;"'"!==m.expresion.charAt(0)&&(m.expresion="'"+m.expresion+"'");m.expresion=m.evaluator.parser.parse(m.expresion);k=m.evaluator.eval(m.expresion);if(k)var f=(f=document.getElementById(k))&&"descartes/macro"==f.type?f.text:a.openFile(k);if(f){var g=a.convertHTMLEntities(f).replace(/\r/g,"").split("\n");f=[];k=0;for(var p=g.length;k<p;k++)if(g[k].trim()){var r=g[k].indexOf("=");if(-1!==r){r=b.split(g[k]);for(var u=0,q=r.length;u<q;u++)if(r[u]&&1<r.length&&("id"===h[r[u][0]]||
"type"===h[r[u][0]])){f.push(r);break}}}u=function(b,l){l=c.tokenize(l.replace(/&squot;/g,"'"));for(var f=0,g=l.length;f<g;f++)if("identifier"==l[f].type&&!a.reservedIds.match("-"+l[f].value+"-")||"R"===l[f].value||"G"===l[f].value||"B"===l[f].value)l[f].value=m.name+"."+l[f].value;return(b.match(/^\\expr/)?"\\expr ":"\\decimals ")+c.flatTokens(l)};k=0;for(p=f.length;k<p;k++){var n=(q=f[k]||[],q[0])&&"id"===q[0][0];g=0;for(r=q.length;g<r;g++){var l=q[g][0].indexOf(".");-1===l||n?l=h[q[g][0]]:(l=h[q[g][0].substring(l+
1)],q[g][0]=m.name+"."+q[g][0]);if(!("font"===l||"font_family"===l||("fill"===l||"color"===l||"border"===l||"arrow"===l)&&"("!==q[g][1].charAt(0)||"file"===l&&q[g][1].match(e)||"id"!==l&&void 0!==h[q[g][1]])||"radius"===l)if("text"==l)if(q[g][1].match(/\{\\rtf1/))l=q[g][1],l=l.replace(/\\expr ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,u),l=l.replace(/\\decimals ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,u),q[g][1]=l;else{var x=b.parseText(q[g][1]).textElementsMacros;for(var w=
0,y=x.length;w<y;w++){l=c.tokenize(x[w].replace(/&squot;/g,"'"));for(var A=0,E=l.length;A<E;A++)if("identifier"===l[A].type&&!a.reservedIds.match("-"+l[A].value+"-")||"R"===l[A].value||"G"===l[A].value||"B"===l[A].value)l[A].value=m.name+"."+l[A].value;l=c.flatTokens(l).replace(/&squot;/g,"'").replace(/'\+\(/g,"[").replace(/\)\+'/g,"]");x[w]=l.substring(1,l.length-1)}q[g][1]=x.join("")}else{x=q[g][1].replace(/&squot;/g,"'").split(";");w=0;for(y=x.length;w<y;w++){l=c.tokenize(x[w].replace(/\\n/g,";"));
A=0;for(E=l.length;A<E;A++)if("identifier"===l[A].type&&!a.reservedIds.match("-"+l[A].value+"-")||"R"===l[A].value||"G"===l[A].value||"B"===l[A].value)l[A].value=m.name+"."+l[A].value;x[w]=c.flatTokens(l)}q[g][1]=x.join(";")}}}k=0;for(p=f.length;k<p;k++)if(f[k][0]){u="";q=!1;g=0;for(r=f[k].length;g<r;g++)"type"===h[f[k][g][0]]&&d.match("-"+h[f[k][g][1]]+"-")&&(q=!0),u=u+f[k][g][0]+"='"+f[k][g][1]+"' ";f[k]=u+(q?" space='"+m.spaceID+"'":"");q?m.graphics.push(b.parseGraphic(f[k],m.abs_coord,m.background,
m.inirot)):b.parseAuxiliar(f[k])}}return m};$jscomp.inherits(p,a.Graphic);p.prototype.update=function(){q=this.evaluator.eval(this.inipos);this.iniPosX=q[0][0];this.iniPosY=q[0][1]};p.prototype.drawAux=function(a){for(var b=0,e=this.graphics.length;b<e;b++)this.graphics[b]&&(a.save(),this.graphics[b].abs_coord?a.translate(this.iniPosX,this.iniPosY):a.translate(this.iniPosX*this.space.scale,-this.iniPosY*this.space.scale),this.graphics[b].draw(),a.restore())};a.Macro=p;return a}(descartesJS||{},babel);
descartesJS=function(a){if(a.loadLib)return a;var h=Math.sqrt,d=Math.sin,e=Math.cos,q=Math.abs,p,b,k,m,c,f,g,v,r,u,z,n,l,x,w,y=function(a,c,b,l){this.x=a||0;this.y=c||0;this.z=b||0;this.w=l||0;this.adjustDec()};y.prototype.adjustDec=function(){this.x=parseInt(1E9*this.x)/1E9;this.y=parseInt(1E9*this.y)/1E9;this.z=parseInt(1E9*this.z)/1E9};var A=function(a,c,b,l,f,g,e,d,h,k,m,r,p,u,n,v){this.a00=a||0;this.a01=c||0;this.a02=b||0;this.a03=l||0;this.a10=f||0;this.a11=g||0;this.a12=e||0;this.a13=d||0;
this.a20=h||0;this.a21=k||0;this.a22=m||0;this.a23=r||0;this.a30=p||0;this.a31=u||0;this.a32=n||0;this.a33=v||0};A.prototype.setIdentity=function(){this.a00=1;this.a10=this.a03=this.a02=this.a01=0;this.a11=1;this.a21=this.a20=this.a13=this.a12=0;this.a22=1;this.a32=this.a31=this.a30=this.a23=0;this.a33=1;return this};A.prototype.multiplyVector4=function(a){return new y(a.x*this.a00+a.y*this.a10+a.z*this.a20+a.w*this.a30,a.x*this.a01+a.y*this.a11+a.z*this.a21+a.w*this.a31,a.x*this.a02+a.y*this.a12+
a.z*this.a22+a.w*this.a32,a.x*this.a03+a.y*this.a13+a.z*this.a23+a.w*this.a33)};A.prototype.translate=function(a){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*a.x+this.a10*a.y+this.a20*a.z+this.a30,this.a01*a.x+this.a11*a.y+this.a21*a.z+this.a31,this.a02*a.x+this.a12*a.y+this.a22*a.z+this.a32,this.a03*a.x+this.a13*a.y+this.a23*a.z+this.a33)};A.prototype.rotateX=function(a){b=d(a);k=e(a);v=this.a10;r=this.a11;u=this.a12;
z=this.a13;n=this.a20;l=this.a21;x=this.a22;w=this.a23;return new A(this.a00,this.a01,this.a02,this.a03,v*k+n*b,r*k+l*b,u*k+x*b,z*k+w*b,v*-b+n*k,r*-b+l*k,u*-b+x*k,z*-b+w*k,this.a30,this.a31,this.a32,this.a33)};A.prototype.rotateY=function(a){b=d(a);k=e(a);m=this.a00;c=this.a01;f=this.a02;g=this.a03;n=this.a20;l=this.a21;x=this.a22;w=this.a23;return new A(m*k+n*-b,c*k+l*-b,f*k+x*-b,g*k+w*-b,this.a10,this.a11,this.a12,this.a13,m*b+n*k,c*b+l*k,f*b+x*k,g*b+w*k,this.a30,this.a31,this.a32,this.a33)};A.prototype.rotateZ=
function(a){b=d(a);k=e(a);m=this.a00;c=this.a01;f=this.a02;g=this.a03;v=this.a10;r=this.a11;u=this.a12;z=this.a13;return new A(m*k+v*b,c*k+r*b,f*k+u*b,g*k+z*b,m*-b+v*k,c*-b+r*k,f*-b+u*k,g*-b+z*k,this.a20,this.a21,this.a22,this.a23,this.a30,this.a31,this.a32,this.a33)};a.norm3D=function(a){return h(a.x*a.x+a.y*a.y+a.z*a.z)};a.normalize3D=function(c){p=a.norm3D(c);if(0===p)return{x:0,y:0,z:0};if(1===p)return{x:c.x,y:c.y,z:c.z};p=1/p;return{x:c.x*p,y:c.y*p,z:c.z*p}};a.dotProduct3D=function(a,c){return a.x*
c.x+a.y*c.y+a.z*c.z};a.crossProduct3D=function(a,c){return{x:a.y*c.z-a.z*c.y,y:a.z*c.x-a.x*c.z,z:a.x*c.y-a.y*c.x}};a.scalarProduct3D=function(a,c){return{x:a.x*c,y:a.y*c,z:a.z*c}};a.subtract3D=function(a,c){return{x:a.x-c.x,y:a.y-c.y,z:a.z-c.z}};a.add3D=function(a,c){return{x:a.x+c.x,y:a.y+c.y,z:a.z+c.z}};a.equals3DEpsilon=function(a,c,b){return q(a.x-c.x)<=b&&q(a.y-c.y)<=b&&q(a.z-c.z)<=b};a.Vector4D=y;a.Matrix4x4=A;return a}(descartesJS||{});
descartesJS=function(a){function h(a){a.textNode=null;0!==parseInt(this.size)&&(a.lineWidth=1,a.fillStyle=this.backColor,a.strokeStyle=this.frontColor,a.beginPath(),a.arc(this.projVert[0].x,this.projVert[0].y,this.size,0,b),a.fill(),a.stroke())}function d(a,c){a.textNode=null;a.lineCap=k;a.lineJoin=lineJoin;a.lineWidth=.4;a.beginPath();a.moveTo(this.projVert[0].x,this.projVert[0].y);r=1;for(u=this.projVert.length;r<u;r++)a.lineTo(this.projVert[r].x,this.projVert[r].y);a.closePath();"color"===this.model?
(a.fillStyle=0>this.direction?this.backColor:this.frontColor,a.strokeStyle=a.fillStyle,a.stroke(),a.fill()):"light"===this.model||"metal"===this.model?(a.fillStyle=c.computeColor(0>this.direction?this.backColor:this.frontColor,this,"metal"===this.model),a.strokeStyle=a.fillStyle,a.stroke(),a.fill()):"wire"===this.model&&(a.lineWidth=1.25,a.strokeStyle=this.frontColor,a.stroke());this.edges&&"wire"!==this.model&&(a.lineWidth=1,a.strokeStyle=this.edges,a.stroke())}function e(a){a.textNode=null;a.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(a,this.text,this.projVert[0].x,this.projVert[0].y,this.frontColor,this.font,"left","alphabetic",this.decimals,this.fixed,!0);this.evaluator.setVariable(this.family,g)}function q(a){a.textNode=null;a.lineCap=k;a.lineJoin=lineJoin;a.lineWidth=this.lineWidth;
a.strokeStyle=this.frontColor;a.beginPath();a.moveTo(this.projVert[0].x,this.projVert[0].y);a.lineTo(this.projVert[1].x,this.projVert[1].y);"dot"===this.lineDash?(a.lineCap="butt",a.setLineDash([a.lineWidth,a.lineWidth])):"dash"===this.lineDash?(a.lineCap="butt",a.setLineDash([4*a.lineWidth,3*a.lineWidth])):"dash_dot"===this.lineDash?(a.lineCap="butt",a.setLineDash([4*a.lineWidth,2*a.lineWidth,a.lineWidth,2*a.lineWidth])):a.setLineDash([]);a.stroke()}function p(c,b,l){return a.normalize3D(a.crossProduct3D(a.subtract3D(c,
b),a.subtract3D(c,l)))}if(a.loadLib)return a;var b=2*Math.PI,k=lineJoin="round",m,c,f,g,v,r,u,z,n,l,x,w,y,A=function(a,c){Object.assign(this,a);this.space=c;this.projVert=[];this.spaceVertices=[];this.newProjVert=[];this.newSpaceVert=[];"vertex"===this.type?this.draw=h:"face"===this.type?(this.normal=p(this.vertices[0],this.vertices[1],this.vertices[2]),this.draw=d):"text"===this.type?this.draw=e:"edge"===this.type&&(this.draw=q);this.isText&&(this.computeDepth=function(){this.normal={x:0,y:0,z:0};
this.projVert=this.vertices;this.depth=this.vertices[0].z;this.average=this.vertices[0]})};A.prototype.computeDepth=function(c){this.space=c;this.average={x:0,y:0,z:0};this.removeDoubles();this.normal={x:0,y:1,z:0};this.direction={x:1,y:0,z:0};r=0;for(u=this.vertices.length;r<u;r++)this.spaceVertices[r]=c.rotateVertex(this.vertices[r]),this.average.x+=this.spaceVertices[r].x,this.average.y+=this.spaceVertices[r].y,this.average.z+=this.spaceVertices[r].z;this.average=a.scalarProduct3D(this.average,
1/u);this.average_proy=c.project(this.average);this.depth=a.norm3D(a.subtract3D(c.eye,this.average));2<this.vertices.length&&(this.normal=p(this.spaceVertices[0],this.spaceVertices[1],this.spaceVertices[2]));r=0;for(u=this.vertices.length;r<u;r++)this.newSpaceVert[r]=this.spaceVertices[r],this.projVert[r]=this.newProjVert[r]=c.project(this.spaceVertices[r]);2<this.vertices.length&&(this.direction=p(this.projVert[0],this.projVert[1],this.projVert[2]).z);this.minDistanceToEye=Infinity;this.maxDistanceToEye=
-Infinity;this.minx=Infinity;this.maxx=-Infinity;this.miny=Infinity;this.maxy=-Infinity;r=0;for(u=this.vertices.length;r<u;r++)z=a.norm3D(a.subtract3D(this.spaceVertices[r],c.eye)),this.minDistanceToEye=Math.min(this.minDistanceToEye,z),this.maxDistanceToEye=Math.max(this.maxDistanceToEye,z);r=0;for(u=this.vertices.length;r<u;r++)this.minx>this.projVert[r].x&&(this.minx=this.projVert[r].x),this.maxx<this.projVert[r].x&&(this.maxx=this.projVert[r].x),this.miny>this.projVert[r].y&&(this.miny=this.projVert[r].y),
this.maxy<this.projVert[r].y&&(this.maxy=this.projVert[r].y)};A.prototype.removeDoubles=function(){if("edge"!==this.type){v=[];r=0;for(u=this.vertices.length;r<u;r++)(1E-8<Math.abs(this.vertices[r].x-this.vertices[(r+1)%u].x)||1E-8<Math.abs(this.vertices[r].y-this.vertices[(r+1)%u].y)||1E-8<Math.abs(this.vertices[r].z-this.vertices[(r+1)%u].z)||1E-8<Math.abs(this.vertices[r].w-this.vertices[(r+1)%u].w))&&v.push(this.vertices[r]);0===v.length&&v.push(this.vertices[0]);this.vertices=v}};A.prototype.drawText=
function(b,l,g,e,d,h,k,r,p,u,n){m=this.evaluator;b.textNode=l;h=m.eval(this.offset_dist);k=-a.degToRad(m.eval(this.offset_angle));g+=h*Math.cos(k);e+=h*Math.sin(k);b.textNode.pos={x:g,y:e};l.hasContent&&(l.draw(b,d,g,e,!0),f=this.fromPoint?l.textNodes.metrics.w/2:0,c=this.fromPoint?l.textNodes.metrics.h/2:0,l.draw(b,d,g-f,e-c))};A.prototype.splitFace=function(c){if(this.intersects(c)){var b=i2=null,l=ix2=0,f,g;var e=this.vertices;var d=c.vertices;var h=0;for(g=d.length;h<g;h++){var k=this.intersection(d[h],
d[(h+1)%g]);if(null!==k)if(null===b){if(b=k,l=h,2===d.length){i2=b;break}}else if(!a.equals3DEpsilon(k,b,1E-8)){i2=k;ix2=h;break}}if(null!==b&&null!==i2){h=this.isInterior(b)||this.isInterior(i2);var m=f=null;if(!h&&3<=d.length)for(g=0,e=e.length;g<e;g++)if(k=c.intersection(this.vertices[g],this.vertices[(g+1)%e]),null!==k)if(null===f)f=k;else if(!a.equals3DEpsilon(k,f,1E-8)){m=k;break}if(h||null!==f&&null!==m&&c.isInterior(f)&&c.isInterior(m)){m=!0;e=k=null;if(2===d.length)a.equals3DEpsilon(b,d[0],
1E-8)||a.equals3DEpsilon(b,d[1],1E-8)?m=!1:(k=[],k[0]=d[0],k[1]=b,e=[],e[0]=b,e[1]=d[1]);else for(k=[],e=[],h=g=f=0;h<d.length;h++)h<l?k[f++]=d[h]:h==l?(k[f++]=d[h],k[f++]=b,e[g++]=b):h<ix2?e[g++]=d[h]:h==ix2?(e[g++]=d[h],e[g++]=i2,k[f++]=i2):k[f++]=d[h];if(m){b=[];b[0]=new A({vertices:k,type:"face",frontColor:c.frontColor,backColor:c.backColor,edges:c.edges,model:c.model},this.space);b[0].removeDoubles();b[0].normal=c.normal;b[1]=new A({vertices:e,type:"face",frontColor:c.frontColor,backColor:c.backColor,
edges:c.edges,model:c.model},this.space);b[1].removeDoubles();b[1].normal=c.normal;if(2<b[0].vertices.length)return 2<b[1].vertices.length?b:[b[0]];if(2<b[1].vertices.length)return[b[1]]}}}}return[c]};A.prototype.intersects=function(a){return this.intersectsPlane(a)&&a.intersectsPlane(this)};A.prototype.intersectsPlane=function(c){var b=this.vertices;var l=c.vertices;if(0<b.length){var f=a.dotProduct3D(l[0],c.normal);var g=a.dotProduct3D(b[0],c.normal);if(1E-8>Math.abs(f-g))return!0;for(var e=1,d=
b.length;e<d;e++)if(l=a.dotProduct3D(b[e],c.normal),1E-8>Math.abs(f-l)||l>f&&g<f||l<f&&g>f)return!0}return!1};A.prototype.intersection=function(c,b){var l=this.vertices;if(0<l.length){b=a.subtract3D(b,c);var f=a.dotProduct3D(b,this.normal);if(0!==f&&(l=a.dotProduct3D(a.subtract3D(l[0],c),this.normal)/f,-1E-8<l&&1.00000001>l))return a.add3D(c,a.scalarProduct3D(b,l))}return null};A.prototype.isInterior=function(c){var b=this.vertices;if(0<b.length)for(var l=0,f=a.subtract3D(b[0],c),g=0,e=b.length;g<
e;g++){var d=a.subtract3D(b[(g+1)%e],c),h=a.dotProduct3D(a.crossProduct3D(f,d),this.normal);if(1E-8>Math.abs(h)){if(0>a.dotProduct3D(f,d))break}else{if(0>l&&0<h||0<l&&0>h)return!1;f=d;l=h}}return!0};A.prototype.inFrontOf=function(a,c,b){if(this.minDistanceToEye>=c.maxDistanceToEye||this.maxx<=c.minx||this.minx>=c.maxx||this.maxy<=c.miny||this.miny>=c.maxy)return!1;for(w=0;3>w;w++)if(n=null,n=0===w?this.intersections(c):1===w?c.verticesContainedIn(this):this.verticesContainedIn(c),null!=n&&0<n.length){for(y=
0;y<n.length;y++)a.push(n[y]);r=0;for(u=n.length;r<u;r++){l=n[r];x=this.space.rayFromEye(l.x,l.y);try{t=this.distanceToEyeAlong(x)-c.distanceToEyeAlong(x);if(t<=-b)return!0;if(t>=b)return!1}catch(G){}}}return!1};A.prototype.intersections=function(c){for(var b=[],l,f,g,e=new a.R2,d=this.newSpaceVert,h=c.newSpaceVert,k=this.newProjVert,m=c.newProjVert,r=0,p=d.length;r<p;r++){c=d[r];l=d[(r+1)%p];for(var u=0,n=h.length;u<n;u++)f=h[u],g=h[(u+1)%n],c!=f&&c!=g&&l!=f&&l!=g&&(f=e.intersection(k[r],k[(r+1)%
p],m[u],m[(u+1)%n]),null!=f&&b.push(f))}return b};A.prototype.distanceToEyeAlong=function(c){c=a.dotProduct3D(this.normal,c);if(1E-6<Math.abs(c))return a.dotProduct3D(a.subtract3D(this.average,this.space.eye),this.normal)/c;throw new Exception("Face is invisible");};A.prototype.verticesContainedIn=function(a){for(var c=[],b=this.newSpaceVert,l=this.newProjVert,f=0,g=b.length;f<g;f++)!a.isVertex(b[f])&&a.appearsToContain(l[f])&&c.push(l[f]);return c};A.prototype.appearsToContain=function(a){for(var c=
0,b,l=this.newProjVert,f=0,g=this.newSpaceVert.length;f<g;f++){b=(l[f].x-a.x)*(l[(f+1)%g].y-a.y)-(l[(f+1)%g].x-a.x)*(l[f].y-a.y);if(0!=c)if(1E-8>Math.abs(b)){if(1E-8<Math.abs(l[f].x-l[(f+1)%g].x))return Math.min(l[f].x,l[(f+1)%g].x)<=a.x+1E-8&&a.x<=Math.max(l[f].x,l[(f+1)%g].x)+1E-8;if(1E-8<Math.abs(l[f].y-l[(f+1)%g].y))return Math.min(l[f].y,l[(f+1)%g].y)<=a.y+1E-8&&a.y<=Math.max(l[f].y,l[(f+1)%g].y)+1E-8}else if(0<c&&0>b||0>c&&0<b)return!1;c=b}return!0};A.prototype.isVertex=function(c){for(var b=
this.newSpaceVert,l=0,f=b.length;l<f;l++)if(a.equals3DEpsilon(c,b[l],1E-8))return!0;return!1};a.Primitive3D=A;return a}(descartesJS||{});
descartesJS=function(a){function h(a){for(var c=[],b=0,f,g=a.length,e=a.length-1;-1<e;e--)f=a.charAt(e),0==b?"="==f&&(b=1):1==b?" "!=f&&(b="<"===f||">"===f?0:2):2==b&&" "==f&&(c.unshift(a.substring(e+1,g)),g=e,b=0);c.unshift(a.substring(0,g));return c}if(a.loadLib)return a;var d={x:0,y:0,z:0},e,q,p,b,k,m=a.degToRad,c,f=function(c,b){this.parent=c;this.evaluator=c.evaluator;var f=c.evaluator.parser;this.spaceID="E0";this.background=!1;this.type="";this.color=new a.Color("eeffaa");this.backcolor=new a.Color("6090a0");
this.Nu=this.evaluator.parser.parse("7");this.Nv=this.evaluator.parser.parse("7");this.drawif=f.parse("1");this.abs_coord=!1;this.family="";this.family_interval=f.parse("[0,1]");this.family_steps=f.parse("8");this.font="SansSerif,PLAIN,18";this.fixed=!0;this.text="";this.decimals=f.parse("2");this.inirot="(0,0,0)";this.inirotEuler=!1;this.inipos=f.parse("(0,0,0)");this.endrot="(0,0,0)";this.endrotEuler=!1;this.endpos=f.parse("(0,0,0)");this.model="color";Object.assign(this,b);void 0==this.expresion&&
"macro"!=this.type&&(this.expresion=f.parse("(0,0)"));this.space=this.getSpace();this.canvas=this.background?this.space.backCanvas:this.space.canvas;this.ctx=this.canvas.getContext("2d");this.font_str=this.font;this.font=a.convertFont(this.font);this.fontSize=(this.fontSize=this.font.match(/([\d\.]+)px/))?parseFloat(this.fontSize[1]):10;this.font_style=a.getFontStyle(this.font_str.split(",")[1]);if("boolean"===typeof this.bold||"boolean"===typeof this.italics)this.bold&&!this.italics?this.font_style=
"Bold ":!this.bold&&this.italics?this.font_style="Italic ":this.bold&&this.italics?this.font_style="Italic Bold ":this.bold||this.italics||(this.font_style=" ");this.font_family||(this.font_family=this.font_str.split(",")[0]);this.font_family=a.getFontName(this.font_family);"undefined"===typeof this.font_size&&(this.font_size=c.evaluator.parser.parse(this.fontSize.toString()));this.inirot.match("Euler")&&(this.inirot=this.inirot.replace("Euler",""),this.inirotEuler=!0);this.endrot.match("Euler")&&
(this.endrot=this.endrot.replace("Euler",""),this.endrotEuler=!0);this.inirot=f.parse(this.inirot);this.endrot=f.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};f.prototype.getSpace=function(){for(var a=this.parent.spaces,c,b=0,
f=a.length;b<f;b++)if(c=a[b],c.id==this.spaceID)return c;return a[0]};f.prototype.getFamilyValues=function(){e=this.evaluator;q=e.eval(this.family_interval);this.familyInf=q[0][0];this.familySup=q[0][1];this.fSteps=Math.round(e.eval(this.family_steps));this.family_sep=0<this.fSteps?(this.familySup-this.familyInf)/this.fSteps:0};f.prototype.buildFamilyPrimitives=function(){e=this.evaluator;this.getFamilyValues();p=e.getVariable(this.family);if(0<=this.fSteps)for(var a=0,c=this.fSteps;a<=c;a++)e.setVariable(this.family,
this.familyInf+a*this.family_sep),this.familyValue=this.familyInf+a*this.family_sep,e.eval(this.drawif)&&this.buildPrimitives();e.setVariable(this.family,p)};f.prototype.update=function(){this.primitives=[];this.evaluator.eval(this.drawif)&&(this.family||this.buildPrimitives());this.family&&this.buildFamilyPrimitives()};f.prototype.updateMVMatrix=function(){b=this.evaluator.eval(this.inirot);this.inirotEuler?(this.inirotM=this.inirotM.setIdentity(),this.inirotM=this.inirotM.rotateZ(m(b[0][0])),this.inirotM=
this.inirotM.rotateX(m(b[0][1])),this.inirotM=this.inirotM.rotateZ(m(b[0][2]))):(this.inirotM_X=this.inirotM_X.setIdentity().rotateX(m(b[0][0])),this.inirotM_Y=this.inirotM_Y.setIdentity().rotateY(m(b[0][1])),this.inirotM_Z=this.inirotM_Z.setIdentity().rotateZ(m(b[0][2])));b=this.evaluator.eval(this.inipos);d={x:b[0][0],y:b[0][1],z:b[0][2]};this.iniposM=this.iniposM.setIdentity().translate(d);b=this.evaluator.eval(this.endrot);this.endrotEuler?(this.endrotM=this.endrotM.setIdentity(),this.endrotM=
this.endrotM.rotateZ(m(b[0][0])),this.endrotM=this.endrotM.rotateX(m(b[0][1])),this.endrotM=this.endrotM.rotateZ(m(b[0][2]))):(this.endrotM_X=this.endrotM_X.setIdentity().rotateX(m(b[0][0])),this.endrotM_Y=this.endrotM_Y.setIdentity().rotateY(m(b[0][1])),this.endrotM_Z=this.endrotM_Z.setIdentity().rotateZ(m(b[0][2])));b=this.evaluator.eval(this.endpos);d={x:b[0][0],y:b[0][1],z:b[0][2]};this.endposM=this.endposM.setIdentity().translate(d)};f.prototype.transformVertex=function(a){this.inirotEuler?k=
this.inirotM.multiplyVector4(a):(k=this.inirotM_X.multiplyVector4(a),k=this.inirotM_Y.multiplyVector4(k),k=this.inirotM_Z.multiplyVector4(k));k=this.iniposM.multiplyVector4(k);this.endrotEuler?k=this.endrotM.multiplyVector4(k):(k=this.endrotM_X.multiplyVector4(k),k=this.endrotM_Y.multiplyVector4(k),k=this.endrotM_Z.multiplyVector4(k));k=this.endposM.multiplyVector4(k);this.macroChildren&&(k=this.applyMacroTransform(k));k.adjustDec();return k};f.prototype.applyMacroTransform=function(a){this.macro_inirotEuler?
k=this.macro_inirotM.multiplyVector4(a):(k=this.macro_inirotM_X.multiplyVector4(a),k=this.macro_inirotM_Y.multiplyVector4(k),k=this.macro_inirotM_Z.multiplyVector4(k));k=this.macro_iniposM.multiplyVector4(k);this.macro_endrotEuler?k=this.macro_endrotM.multiplyVector4(k):(k=this.macro_endrotM_X.multiplyVector4(k),k=this.macro_endrotM_Y.multiplyVector4(k),k=this.macro_endrotM_Z.multiplyVector4(k));return k=this.macro_endposM.multiplyVector4(k)};f.prototype.parseExpression=function(){for(var a=this.expresion.split(";"),
c=[],b=0,f=a.length;b<f;b++)""!==a[b].trim()&&(c=c.concat(h(a[b])));b=0;for(f=c.length;b<f;b++)c[b]=this.evaluator.parser.parse(c[b],!0);return c};f.prototype.splitFace=function(a){for(var b=0,f=this.primitives.length;b<f;b++)if(c=[],"face"===this.primitives[b].type){for(var g=0,e=a.primitives.length;g<e;g++)"face"===a.primitives[g].type?c=c.concat(this.primitives[b].splitFace(a.primitives[g])):c.push(a.primitives[g]);a.primitives=c}};a.Graphic3D=f;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,d,e,q,p,b=function(b,e){return a.Graphic3D.call(this,b,e)||this};$jscomp.inherits(b,a.Graphic3D);b.prototype.buildPrimitives=function(){h=this.evaluator;this.updateMVMatrix();d=h.eval(this.expresion);e=d[0][0];q=d[0][1];p=d[0][2];this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(e,q,p,1))],type:"vertex",backColor:this.backcolor.getColor(),frontColor:this.color.getColor(),size:h.eval(this.width)}));""!==this.text&&
(this.offset_dist=this.offset_dist||h.parser.parse("10"),this.offset_angle=this.offset_angle||h.parser.parse("270"),this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(e,q,p,1))],type:"text",fromPoint:!0,frontColor:this.color.getColor(),font_size:this.font_size,font_style:this.font_style,font_family:this.font_family,decimals:h.eval(this.decimals),fixed:this.fixed,evaluator:h,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=b;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,d,e,q,p,b,k,m,c,f=function(c,b){b=a.Graphic3D.call(this,c,b)||this;b.width=b.width||c.evaluator.parser.parse("1");return b};$jscomp.inherits(f,a.Graphic3D);f.prototype.buildPrimitives=function(){m=this.evaluator;this.updateMVMatrix();k=m.getVariable("u");m.setVariable("u",this.Nu);c=m.eval(this.expresion);h=c[0][0];d=c[0][1];e=c[0][2];q=c[1][0];p=c[1][1];b=c[1][2];this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(h,
d,e,1)),this.transformVertex(new a.Vector4D(q,p,b,1))],type:"edge",lineDash:this.lineDash,frontColor:this.color.getColor(),lineWidth:m.eval(this.width)},this.space));m.setVariable("u",k)};a.Segment3D=f;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,d,e,q,p,b,k,m,c,f,g,v,r,u,z=function(c,b){b=a.Graphic3D.call(this,c,b)||this;b.parameter=b.parameter||"t";b.parameter_interval=b.parameter_interval||c.evaluator.parser.parse("[0,1]");b.parameter_steps=b.parameter_steps||c.evaluator.parser.parse("8");b.expresion=b.parseExpression();return b};$jscomp.inherits(z,a.Graphic3D);z.prototype.buildPrimitives=function(){h=this.evaluator;this.updateMVMatrix();q=h.getVariable("x");p=h.getVariable("y");b=h.getVariable("z");
d=h.getVariable("u");e=h.getVariable("v");h.setVariable("u",0);h.setVariable("v",0);k=parseInt(h.eval(this.Nu));m=parseInt(h.eval(this.Nv));c=[];for(g=0;g<=k;g++)for(h.setVariable("u",g/k),v=0;v<=m;v++){h.setVariable("v",v/m);r=0;for(u=this.expresion.length;r<u;r++)h.eval(this.expresion[r]);c.push(this.transformVertex(new a.Vector4D(h.getVariable("x"),h.getVariable("y"),h.getVariable("z"),1)))}var n=this.color.getColor(),l=this.backcolor.getColor(),x=this.edges?this.edges.getColor():"";for(g=0;g<
k;g++)for(v=0;v<m;v++)f=[],f.push(c[v+g*m+g]),f.push(c[v+1+g*m+g]),f.push(c[v+2+(g+1)*m+g]),f.push(c[v+1+(g+1)*m+g]),this.primitives.push(new a.Primitive3D({vertices:f,type:"face",frontColor:n,backColor:l,edges:x,model:this.model},this.space));h.setVariable("x",q);h.setVariable("y",p);h.setVariable("z",b);h.setVariable("u",d);h.setVariable("v",e)};a.Surface3D=z;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,d,e,q,p,b,k,m,c=function(c,b){b=a.Graphic3D.call(this,c,b)||this;b.width=b.width||c.evaluator.parser.parse("1");return b};$jscomp.inherits(c,a.Graphic3D);c.prototype.buildPrimitives=function(){k=this.evaluator;this.updateMVMatrix();m=k.eval(this.expresion);for(var c=this.color.getColor(),g=0,v=m.length-1;g<v;g++)h=m[g][0],d=m[g][1],e=m[g][2],q=m[g+1][0],p=m[g+1][1],b=m[g+1][2],this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(h,
d,e,1)),this.transformVertex(new a.Vector4D(q,p,b,1))],type:"edge",frontColor:c,lineWidth:k.eval(this.width)},this.space))};a.Polygon3D=c;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,d,e,q,p,b,k,m=function(c,b){b=a.Graphic3D.call(this,c,b)||this;b.width=b.width||c.evaluator.parser.parse("1");b.expresion=b.parseExpression();return b};$jscomp.inherits(m,a.Graphic3D);m.prototype.buildPrimitives=function(){k=this.evaluator;this.updateMVMatrix();q=k.getVariable("x");p=k.getVariable("y");b=k.getVariable("z");e=k.getVariable("u");k.setVariable("u",0);d=k.eval(this.Nu);h=[];for(var c=0;c<=d;c++){k.setVariable("u",c/d);for(var f=0,g=
this.expresion.length;f<g;f++)k.eval(this.expresion[f]);h.push(this.transformVertex(new a.Vector4D(k.getVariable("x"),k.getVariable("y"),k.getVariable("z"),1)))}c=0;for(f=h.length-1;c<f;c++)this.primitives.push(new a.Primitive3D({vertices:[h[c],h[c+1]],type:"edge",frontColor:this.color.getColor(),lineWidth:k.eval(this.width)},this.space));this.fill&&2<h.length&&this.primitives.push(new a.Primitive3D({vertices:h,type:"face",frontColor:this.fill.getColor(),backColor:this.fill.getColor(),edges:"",model:this.model},
this.space));k.setVariable("x",q);k.setVariable("y",b);k.setVariable("z",p);k.setVariable("u",e)};a.Curve3D=m;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,d,e,q,p,b,k,m,c,f,g,v=function(c,b){return a.Graphic3D.call(this,c,b)||this};$jscomp.inherits(v,a.Graphic3D);v.prototype.buildPrimitives=function(){f=this.evaluator;this.updateMVMatrix();g=f.eval(this.expresion);h=g[0][0];d=g[0][1];e=g[0][2];q=g[1][0];p=g[1][1];b=g[1][2];k=g[2][0];m=g[2][1];c=g[2][2];var r=this.edges?this.edges.getColor():"";this.primitives.push(new a.Primitive3D({vertices:[this.transformVertex(new a.Vector4D(h,d,e,1)),this.transformVertex(new a.Vector4D(k,
m,c,1)),this.transformVertex(new a.Vector4D(q,p,b,1))],type:"face",frontColor:this.color.getColor(),backColor:this.backcolor.getColor(),edges:r,model:this.model},this.space))};a.Triangle3D=v;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,d,e,q=function(e,b){return a.Graphic3D.call(this,e,b)||this};$jscomp.inherits(q,a.Graphic3D);q.prototype.buildPrimitives=function(){d=this.evaluator;this.updateMVMatrix();e=d.eval(this.expresion);h=[];for(var p=e.length-1;0<=p;p--)h.push(this.transformVertex(new a.Vector4D(e[p][0],e[p][1],e[p][2],1)));p=this.edges?this.edges.getColor():"";this.primitives.push(new a.Primitive3D({vertices:h,type:"face",frontColor:this.color.getColor(),backColor:this.backcolor.getColor(),
edges:p,model:this.model},this.space))};a.Face3D=q;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,d,e,q,p,b,k=function(b,c){c=a.Graphic3D.call(this,b,c)||this;c.width=c.width||b.evaluator.parser.parse("2");c.length=c.length||b.evaluator.parser.parse("2");return c};$jscomp.inherits(k,a.Graphic3D);k.prototype.buildPrimitives=function(){b=this.evaluator;this.updateMVMatrix();h=b.eval(this.Nu);d=[this.transformVertex(new a.Vector4D(0,0,0,1))];e=b.eval(this.width)/2;q=b.eval(this.length)/2;p=2*Math.PI/h;for(var k=0;k<h;k++)d.push(this.transformVertex(new a.Vector4D(e*
Math.cos(p*k),q*Math.sin(p*k),0,1)));var c=this.color.getColor(),f=this.backcolor.getColor(),g=this.edges?this.edges.getColor():"";for(k=0;k<h;k++)this.primitives.push(new a.Primitive3D({vertices:[d[0],k+2<=h?d[k+2]:d[1],d[k+1]],type:"face",frontColor:c,backColor:f,edges:g,model:this.model},this.space))};a.Polireg3D=k;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,d,e,q,p=function(b,e){b=a.Graphic3D.call(this,b,e)||this;b.shadowColor=b.shadowColor?b.shadowColor.getColor():"transparent";return b};$jscomp.inherits(p,a.Graphic3D);p.prototype.buildPrimitives=function(){h=this.evaluator;d=h.eval(this.expresion);e=d[0][0];q=d[0][1];this.primitives.push(new a.Primitive3D({vertices:[new a.Vector4D(e,q,0,1)],type:"text",frontColor:this.color.getColor(),font_size:this.font_size,font_style:this.font_style,font_family:this.font_family,
decimals:h.eval(this.decimals),fixed:this.fixed,displace:0,isText:!0,evaluator:h,text:new a.TextObject(this,this.text),family:this.family,familyValue:this.familyValue},this.space))};a.Text3D=p;return a}(descartesJS||{});
descartesJS=function(a,h){if(a.loadLib)return a;var d=new String("-point-segment-polygon-curve-triangle-face-polireg-surface-text-cube-box-tetrahedron-octahedron-sphere-dodecahedron-icosahedron-ellipsoid-cone-cylinder-torus-mesh-macro-"),e=/[\w\.\-//]*(\.png|\.jpg|\.gif|\.svg|\.webp)/gi,q,p,b=0,k=function(k,c){var f=a.Graphic.call(this,k,c)||this;f.expresion=f.expresion||void 0;f.inirot=f.inirot||"(0,0,0)";f.inirotEuler=f.inirotEuler||!1;f.inipos=f.inipos||k.evaluator.parser.parse("(0,0,0)");f.endrot=
f.endrot||"(0,0,0)";f.endrotEuler=f.endrotEuler||!1;f.endpos=f.endpos||k.evaluator.parser.parse("(0,0,0)");f.name=f.name||"_descartes_empty_name_"+b++;Object.assign(f,c);f.inirot.match("Euler")&&(f.inirot=f.inirot.replace("Euler",""),f.inirotEuler=!0);f.endrot.match("Euler")&&(f.endrot=f.endrot.replace("Euler",""),f.endrotEuler=!0);f.inirot=f.evaluator.parser.parse(f.inirot);f.endrot=f.evaluator.parser.parse(f.endrot);f.inirotM=new a.Matrix4x4;f.inirotM_X=new a.Matrix4x4;f.inirotM_Y=new a.Matrix4x4;
f.inirotM_Z=new a.Matrix4x4;f.iniposM=new a.Matrix4x4;f.endrotM=new a.Matrix4x4;f.endrotM_X=new a.Matrix4x4;f.endrotM_Y=new a.Matrix4x4;f.endrotM_Z=new a.Matrix4x4;f.endposM=new a.Matrix4x4;f.graphics=[];k=k.lessonParser;var g=new a.Tokenizer;if(void 0==f.expresion)return f;"'"!==f.expresion.charAt(0)&&(f.expresion="'"+f.expresion+"'");f.expresion=f.evaluator.parser.parse(f.expresion);c=f.evaluator.eval(f.expresion);if(c)var m=(m=document.getElementById(c))&&"descartes/macro"==m.type?m.text:a.openFile(c);
if(m){var r=a.convertHTMLEntities(m).replace(/\r/g,"").split("\n");m=[];c=0;for(var p=r.length;c<p;c++){var q=r[c].indexOf("=");if(-1!==q){q=k.split(r[c]);for(var n=0,l=q.length;n<l;n++)if(q[n]&&1<q.length&&("id"===h[q[n][0]]||"type"===h[q[n][0]])){m.push(q);break}}}c=0;for(p=m.length;c<p;c++){l=(n=m[c]||[],n[0])&&"id"===n[0][0];var x=!1;r=0;for(q=n.length;r<q;r++){var w=n[r][0].indexOf(".");-1===w||l?w=h[n[r][0]]:(w=h[n[r][0].substring(w+1)],n[r][0]=f.name+"."+n[r][0]);"type"===w&&"surface"===h[n[r][1]]&&
(x=!0);if(!("font"===w||"font_family"===w||("fill"===w||"color"===w||"backcolor"===w||"arrow"===w)&&"("!==n[r][1].charAt(0)||"file"===w&&n[r][1].match(e)||"id"!==w&&void 0!==h[n[r][1]])||"width"===w||"height"===w||"length"===w)if(x&&"expresion"===w){var y=n[r][1].split(" ");for(var A="",E=0,J=y.length;E<J;E++){for(var F=y[E].replace(/&squot;/g,"'").split(";"),G=0,D=F.length;G<D;G++){w=g.tokenize(F[G].replace(/\\n/g,";"));for(var B=0,L=w.length;B<L;B++)if("identifier"===w[B].type&&!(a.reservedIds+
"-x-y-z-u-v-").match("-"+w[B].value+"-")||"R"===w[B].value||"G"===w[B].value||"B"===w[B].value)w[B].value=f.name+"."+w[B].value;F[G]=g.flatTokens(w)}A+=F.join(";")+" "}n[r][1]=A}else if("text"==w)if(n[r][1].match(/\{\\rtf1/)){w=n[r][1];var H=f;y=function(c,b){b=g.tokenize(b.replace(/&squot;/g,"'"));for(var l=0,f=b.length;l<f;l++)if("identifier"==b[l].type&&!a.reservedIds.match("-"+b[l].value+"-")||"R"===b[l].value||"G"===b[l].value||"B"===b[l].value)b[l].value=H.name+"."+b[l].value;return(c.match(/^\\expr/)?
"\\expr ":"\\decimals ")+g.flatTokens(b)};w=w.replace(/\\expr ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,y);w=w.replace(/\\decimals ([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,y);n[r][1]=w}else{y=k.parseText(n[r][1]).textElementsMacros;A=0;for(E=y.length;A<E;A++){w=g.tokenize(y[A].replace(/&squot;/g,"'"));J=0;for(F=w.length;J<F;J++)if("identifier"===w[J].type&&!a.reservedIds.match("-"+w[J].value+"-")||"R"===w[J].value||"G"===w[J].value||"B"===w[J].value)w[J].value=f.name+"."+w[J].value;
w=g.flatTokens(w).replace(/&squot;/g,"'").replace(/'\+\(/g,"[").replace(/\)\+'/g,"]");y[A]=w.substring(1,w.length-1)}n[r][1]=y.join("")}else{F=n[r][1].replace(/&squot;/g,"'").split(";");G=0;for(D=F.length;G<D;G++){w=g.tokenize(F[G].replace(/\\n/g,";"));B=0;for(L=w.length;B<L;B++)if("identifier"===w[B].type&&!(a.reservedIds+"-Euler-").match("-"+w[B].value+"-")||"R"===w[B].value||"G"===w[B].value||"B"===w[B].value)w[B].value=f.name+"."+w[B].value;F[G]=g.flatTokens(w)}n[r][1]=F.join(";")}}}c=0;for(p=
m.length;c<p;c++)if(m[c][0]){n="";l=!1;r=0;for(q=m[c].length;r<q;r++)"type"===h[m[c][r][0]]&&d.match("-"+h[m[c][r][1]]+"-")&&(l=!0),n=n+m[c][r][0]+"='"+m[c][r][1]+"' ";m[c]=n+(l?" space='"+f.spaceID+"'":"");l?f.graphics.push(k.parse3DGraphic(m[c],f.abs_coord,f.background,f.inirot)):k.parseAuxiliar(m[c])}}c=0;for(p=f.graphics.length;c<p;c++)f.graphics[c].macroChildren=!0;return f};$jscomp.inherits(k,a.Graphic);k.prototype.buildFamilyPrimitives=function(){evaluator=this.evaluator;this.getFamilyValues();
var a=evaluator.getVariable(this.family);if(0<=this.fSteps)for(var 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,a)};k.prototype.update=function(){this.primitives=[];this.evaluator.eval(this.drawif)&&(this.family||this.updateMacro());this.family&&this.buildFamilyPrimitives()};k.prototype.updateMacro=function(){this.updateTransformation();
if(this.inipos){var a=this.evaluator.eval(this.inipos);this.iniPosX=a[0][0];this.iniPosY=a[0][1]}a=0;for(var c=this.graphics.length;a<c;a++)q=this.graphics[a],q.macro_inirotEuler=this.inirotEuler,q.macro_inirotM=this.inirotM,q.macro_inirotM_X=this.inirotM_X,q.macro_inirotM_Y=this.inirotM_Y,q.macro_inirotM_Z=this.inirotM_Z,q.macro_iniposM=this.iniposM,q.macro_endrotEuler=this.endrotEuler,q.macro_endrotM=this.endrotM,q.macro_endrotM_X=this.endrotM_X,q.macro_endrotM_Y=this.endrotM_Y,q.macro_endrotM_Z=
this.endrotM_Z,q.macro_endposM=this.endposM,q.update();a=0;for(c=this.graphics.length;a<c;a++){q=this.graphics[a];if(q.split||this.split)for(var b=a+1;b<c;b++)p=this.graphics[b],(p.split||this.split)&&q.splitFace(p);this.primitives=this.primitives.concat(q.primitives||[])}};k.prototype.updateTransformation=function(){tmpExpr=this.evaluator.eval(this.inirot);this.inirotEuler?(this.inirotM=this.inirotM.setIdentity(),this.inirotM=this.inirotM.rotateZ(a.degToRad(tmpExpr[0][0])),this.inirotM=this.inirotM.rotateX(a.degToRad(tmpExpr[0][1])),
this.inirotM=this.inirotM.rotateZ(a.degToRad(tmpExpr[0][2]))):(this.inirotM_X=this.inirotM_X.setIdentity().rotateX(a.degToRad(tmpExpr[0][0])),this.inirotM_Y=this.inirotM_Y.setIdentity().rotateY(a.degToRad(tmpExpr[0][1])),this.inirotM_Z=this.inirotM_Z.setIdentity().rotateZ(a.degToRad(tmpExpr[0][2])));tmpExpr=this.evaluator.eval(this.inipos);translate={x:tmpExpr[0][0],y:tmpExpr[0][1],z:tmpExpr[0][2]};this.iniposM=this.iniposM.setIdentity().translate(translate);tmpExpr=this.evaluator.eval(this.endrot);
this.endrotEuler?(this.endrotM=this.endrotM.setIdentity(),this.endrotM=this.endrotM.rotateZ(a.degToRad(tmpExpr[0][0])),this.endrotM=this.endrotM.rotateX(a.degToRad(tmpExpr[0][1])),this.endrotM=this.endrotM.rotateZ(a.degToRad(tmpExpr[0][2]))):(this.endrotM_X=this.endrotM_X.setIdentity().rotateX(a.degToRad(tmpExpr[0][0])),this.endrotM_Y=this.endrotM_Y.setIdentity().rotateY(a.degToRad(tmpExpr[0][1])),this.endrotM_Z=this.endrotM_Z.setIdentity().rotateZ(a.degToRad(tmpExpr[0][2])));tmpExpr=this.evaluator.eval(this.endpos);
translate={x:tmpExpr[0][0],y:tmpExpr[0][1],z:tmpExpr[0][2]};this.endposM=this.endposM.setIdentity().translate(translate)};k.prototype.drawAux=function(a){};a.Macro3D=k;return a}(descartesJS||{},babel);
descartesJS=function(a){function h(a,c,b,l,f){d.call(this,a/n,a/n,a/n,l,f)}function d(a,c,b,f,g){a/=2;c/=2;b/=2;this.changeGeometry(a,c,b,f,g)||(this.vertices=[new l(a,b,c,1),new l(a,-b,c,1),new l(a,b,-c,1),new l(a,-b,-c,1),new l(-a,b,c,1),new l(-a,-b,c,1),new l(-a,b,-c,1),new l(-a,-b,-c,1)],this.faces=[[2,3,1,0],[1,5,4,0],[5,7,6,4],[6,7,3,2],[4,6,2,0],[3,7,5,1]],this.updateValues(a,c,b,f,g))}function e(a,c,b,f,g){a/=2;if(!this.changeGeometry(a,c,b,f,g)){var e=2*Math.PI/3,d=2*a*Math.sqrt(2)/3,h=-a/
3,k=d*Math.cos(e)+0*Math.sin(e);e=-d*Math.sin(e)+0*Math.cos(e);this.vertices=[new l(0,0,a,1),new l(k,e,h,1),new l(k,-e,h,1),new l(d,0,h,1)];this.faces=[[1,3,2],[0,1,2],[0,2,3],[0,3,1]];this.updateValues(a,c,b,f,g)}}function q(a,c,b,f,g){a/=2;this.changeGeometry(a,c,b,f,g)||(this.vertices=[new l(0,0,a,1),new l(a,0,0,1),new l(-a,0,0,1),new l(0,a,0,1),new l(0,-a,0,1),new l(0,0,-a,1)],this.faces=[[3,1,0],[2,3,0],[1,4,0],[4,2,0],[1,3,5],[3,2,5],[4,1,5],[2,4,5]],this.updateValues(a,c,b,f,g))}function p(c,
b,f,g,e){c/=Math.PI;if(!this.changeGeometry(c,b,f,g,e)){B=c/1.6180339887;L=1.6180339887*c;this.vertices=[new l(c,c,c,1),new l(c,c,-c,1),new l(c,-c,c,1),new l(c,-c,-c,1),new l(-c,c,c,1),new l(-c,c,-c,1),new l(-c,-c,c,1),new l(-c,-c,-c,1),new l(0,B,L,1),new l(0,B,-L,1),new l(0,-B,L,1),new l(0,-B,-L,1),new l(B,L,0,1),new l(B,-L,0,1),new l(-B,L,0,1),new l(-B,-L,0,1),new l(L,0,B,1),new l(L,0,-B,1),new l(-L,0,B,1),new l(-L,0,-B,1)];H=(new a.Matrix4x4).setIdentity().rotateY(-u/6);I=0;for(O=this.vertices.length;I<
O;I++)this.vertices[I]=H.multiplyVector4(this.vertices[I]);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(c,b,f,g,e)}}function b(c,b,f,g,e){c/=3.8;if(!this.changeGeometry(c,b,f,g,e)){L=1.6180339887*c;this.vertices=[new l(0,c,L,1),new l(0,c,-L,1),new l(0,-c,L,1),new l(0,-c,-L,1),new l(c,L,0,1),new l(c,-L,0,1),new l(-c,L,0,1),new l(-c,-L,0,1),
new l(L,0,c,1),new l(L,0,-c,1),new l(-L,0,c,1),new l(-L,0,-c,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]];H=(new a.Matrix4x4).setIdentity().rotateY(-1.0285);I=0;for(O=this.vertices.length;I<O;I++)this.vertices[I]=H.multiplyVector4(this.vertices[I]);this.updateValues(c,b,f,g,e)}}function k(a,c,b,f,g){a/=2;this.isSphere?b=c=a:(c/=2,b/=2);if(!this.changeGeometry(a,
c,b,f,g)){this.vertices=[new l(0,0,c,1)];for(I=1;I<f;I++)for(F=I*u/f,C=0;C<g;C++)J=C*z/g,y=a*v(F)*r(J),A=b*v(F)*v(J),E=c*r(F),this.vertices.push(new l(y,A,E,1));this.vertices.push(new l(0,0,-c,1));this.faces=[];for(I=0;I<g;I++)this.faces.push([0,(I+1)%g+1,I%g+1]);for(I=1;I<f-1;I++)for(C=0;C<g;C++)this.faces.push([C+1+(I-1)*g,(C+1)%g+1+(I-1)*g,(C+1)%g+1+I*g,C+1+I*g]);for(I=0;I<g;I++)this.faces.push([this.vertices.length-1,this.vertices.length-1-g+I,this.vertices.length-1-g+(I+1)%g]);this.updateValues(a,
c,b,f,g)}}function m(a,c,b,f,g){a/=2;c/=2;b/=2;if(!this.changeGeometry(a,c,b,f,g)){this.vertices=[];for(I=0;I<g;I++)for(C=0;C<f;C++)y=a*(g-I)/g*r(C*z/f),A=b*(g-I)/g*v(C*z/f),E=c-2*I*c/g,this.vertices.push(new l(y,A,E,1));this.vertices.push(new l(0,0,-c,1));this.faces=[];for(I=0;I<g-1;I++)for(C=0;C<f;C++)this.faces.push([C+I*f,(C+1)%f+I*f,(C+1)%f+(I+1)*f,C+(I+1)*f]);for(I=0;I<f;I++)this.faces.push([this.vertices.length-1,this.vertices.length-1-f+I,this.vertices.length-1-f+(I+1)%f]);this.updateValues(a,
c,b,f,g)}}function c(a,c,b,f,g){a/=2;c/=2;b/=2;if(!this.changeGeometry(a,c,b,f,g)){this.vertices=[];for(I=0;I<g+1;I++)for(C=0;C<f;C++)y=a*r(C*z/f),A=b*v(C*z/f),E=c-2*I*c/g,this.vertices.push(new l(y,A,E,1));this.faces=[];for(I=0;I<g;I++)for(C=0;C<f;C++)this.faces.push([C+I*f,(C+1)%f+I*f,(C+1)%f+(I+1)*f,C+(I+1)*f]);this.updateValues(a,c,b,f,g)}}function f(a,c,b,f,g){a/=2;c/=2;b/=2;G=x.eval(this.R);D=x.eval(this.r);if(!this.changeGeometry(a,c,b,f,g)){this.vertices=[];for(I=0;I<g+1;I++)for(C=0;C<f;C++)y=
-(G+D*v(z*C/f))*v(z*I/g),A=(G+D*v(z*C/f))*r(z*I/g),E=D*r(z*C/f),this.vertices.push(new l(y,A,E,1));this.faces=[];for(I=0;I<g;I++)for(C=0;C<f;C++)this.faces.push([C+I*f,C+(I+1)*f,(C+1)%f+(I+1)*f,(C+1)%f+I*f]);this.updateValues(a,c,b,f,g)}}function g(){this.vertices=[];this.faces=[];I=0;for(O=this.fileData.length;I<O;I++)M=this.fileData[I],M.match(/^V\(/)?(P=M.substring(2,M.length-1).split(",").map(parseFloats),this.vertices.push(new l(P[0]||0,P[1]||0,P[2]||0,1))):M.match(/^F\(/)&&(P=M.substring(2,
M.length-1).split(",").map(parseInt),this.faces.push(P.reverse()))}if(a.loadLib)return a;var v=Math.sin,r=Math.cos,u=Math.PI,z=2*u,n=Math.sqrt(3),l,x,w,y,A,E,J,F,G,D,B,L,H,M,P,I,O,C,Q,K=function(r,n){n=a.Graphic3D.call(this,r,n)||this;n.width=n.width||r.evaluator.parser.parse("2");n.height=n.height||r.evaluator.parser.parse("2");n.length=n.length||r.evaluator.parser.parse("2");n.R=n.R||r.evaluator.parser.parse("2");n.r=n.r||r.evaluator.parser.parse("1");l=a.Vector4D;switch(n.subType){case "cube":n.buildGeometry=
h;break;case "box":n.buildGeometry=d;break;case "tetrahedron":n.buildGeometry=e;break;case "octahedron":n.buildGeometry=q;break;case "sphere":n.isSphere=!0;case "ellipsoid":n.buildGeometry=k;break;case "dodecahedron":n.buildGeometry=p;break;case "icosahedron":n.buildGeometry=b;break;case "cone":n.buildGeometry=m;break;case "cylinder":n.buildGeometry=c;break;case "torus":n.buildGeometry=f;break;case "mesh":n.fileData=a.openFile(n.evaluator.eval(n.file)).split(/\r/),n.buildGeometry=g}return n};$jscomp.inherits(K,
a.Graphic3D);K.prototype.buildPrimitives=function(){x=this.evaluator;this.updateMVMatrix();this.buildGeometry(x.eval(this.width),x.eval(this.height),x.eval(this.length),x.eval(this.Nu),x.eval(this.Nv));var c=this.color.getColor(),b=this.backcolor.getColor(),f=this.edges?this.edges.getColor():"";I=0;for(O=this.faces.length;I<O;I++){w=[];C=0;for(Q=this.faces[I].length;C<Q;C++)w.push(this.transformVertex(this.vertices[this.faces[I][C]]));this.primitives.push(new a.Primitive3D({vertices:w,type:"face",
frontColor:c,backColor:b,edges:f,model:this.model},this.space))}};K.prototype.changeGeometry=function(a,c,b,f,l){return this.oldWidth===a&&this.oldHeight===c&&this.oldLength===b&&this.oldNu===f&&this.oldNv===l};K.prototype.updateValues=function(a,c,b,f,l){this.oldWidth=a;this.oldHeight=c;this.oldLength=b;this.oldNv=l;this.oldNu=f};a.OtherGeometry3D=K;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.max,d=Math.min,e=Math.PI,q=Math.cos,p=Math.sin,b=Math.abs,k=Math.round,m,c,f,g,v,r,u,z,n,l,x,w,y,A,E,J,F,G,D=function(a,c){this.x=void 0===a?0:a;this.y=void 0===c?0:c};D.prototype.set=function(a,c){this.x=void 0===a?0:a;this.y=void 0===c?0:c;return this};D.prototype.copy=function(){return new D(this.x,this.y)};D.prototype.ix=function(){return k(h(d(this.x,32E3),-32E3))};D.prototype.iy=function(){return k(h(d(this.y,32E3),-32E3))};D.prototype.equals=
function(a){return this.x===a.x&&this.y===a.y};D.prototype.norm2=function(){return this.x*this.x+this.y*this.y};D.prototype.norm=function(){return Math.sqrt(this.norm2())};D.prototype.distance=function(a){c=this.copy();c.sub(a);return c.norm()};D.prototype.dot=function(a){return this.x*a.x+this.y*a.y};D.prototype.det=function(a){return this.x*a.y-this.y*a.x};D.prototype.mul=function(a){this.x*=a;this.y*=a};D.prototype.div=function(a){this.x/=a;this.y/=a};D.prototype.add=function(a){this.x+=a.x;this.y+=
a.y};D.prototype.sub=function(a){this.x-=a.x;this.y-=a.y};D.prototype.normalize=function(){m=this.norm();0!=m&&this.div(m)};D.prototype.rotR90=function(){m=this.x;this.x=this.y;this.y=-m};D.prototype.rotL90=function(){m=this.x;this.x=-this.y;this.y=m};D.prototype.rot=function(a){f=this.copy();r=q(a);u=p(a);this.x=f.x*r-f.y*u;this.y=f.x*u+f.y*r};D.prototype.rot2=function(a){this.rot(a*e/180)};D.prototype.intersection=function(a,c,f,e){z=c.x-a.x;n=f.x-e.x;l=f.x-a.x;x=c.y-a.y;w=f.y-e.y;y=f.y-a.y;G=z*
w-n*x;return 1E-6<b(G)?(g=(l*w-y*n)/G,v=(-l*x+y*z)/G,0<=g&&1>=g&&0<=v&&1>=v?new D(a.x+z*g,a.y+x*g):null):(c.x-f.x)*y!=(c.y-f.y)*l?null:a.x!=c.x?(A=d(a.x,c.x),E=h(a.x,c.x),A<=f.x&&f.x<=E?f:A<=e.x&&e.x<=E?e:null):f.x!=e.x?(J=d(f.x,e.x),F=h(f.x,e.x),J<=a.x&&a.x<=F?a:J<=c.x&&c.x<=F?c:null):a.y!=c.y?(A=d(a.y,c.y),E=h(a.y,c.y),A<=f.y&&f.y<=E?f:A<=e.y&&e.y<=E?e:null):f.y!=e.y?(J=d(f.y,e.y),F=h(f.y,e.y),J<=a.y&&a.y<=F?a:J<=c.y&&c.y<=F?c:null):a.x==f.x&&a.y==f.y?a:null};a.R2=D;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,d,e,q,p,b,k,m,c,f=function(f,e){this.evaluator=f;this.constraint=e;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];b=
new a.R2(0,0);p=new a.R2(0,0);c=new a.R2(0,0)};f.prototype.getUnitNormal=function(){this.normal.normalize();return c.set(this.normal.x,this.normal.y)};f.prototype.gradient=function(a){h=this.evaluator;b.x=0;b.y=0;k=h.getVariable("x");m=h.getVariable("y");h.setVariable("x",a.x);h.setVariable("y",a.y);this.f0=h.eval(this.constraint);h.setVariable("x",h.getVariable("x")+1E-6);d=h.eval(this.constraint);b.x=(d-this.f0)/1E-6;b.x=isNaN(b.x)?Infinity:b.x;h.setVariable("x",h.getVariable("x")-1E-6);h.setVariable("y",
h.getVariable("y")+1E-6);d=h.eval(this.constraint);b.y=(d-this.f0)/1E-6;b.y=isNaN(b.y)?Infinity:b.y;h.setVariable("x",k);h.setVariable("y",m);return b};f.prototype.findZero=function(a,c,b){h=this.evaluator;p.x=a.x;p.y=a.y;k=h.getVariable("x");m=h.getVariable("y");h.setVariable("x",a.x);h.setVariable("y",a.y);this.f0=h.eval(this.constraint);if("menor"===this.sign&&0>=this.f0||"mayor"===this.sign&&0<=this.f0)return p;h.setVariable("x",k);h.setVariable("y",m);for(var f=0;16>f;f++)if(e=p.x,q=p.y,this.normal=
this.gradient(p),0!=this.normal.norm2()&&this.normal.mul(-this.f0/this.normal.norm2()),p.x=e+this.normal.x,p.y=q+this.normal.y,this.normal.norm()<c)return 0===this.normal.x&&0===this.normal.y&&(this.normal.x=p.x-a.x,this.normal.y=p.y-a.y),p;return b?p:null};a.R2Newton=f;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=function(a,e){this.x=a;this.y=e};h.prototype.vectorLength=function(){return Math.sqrt(this.x*this.x+this.y*this.y)};h.prototype.dotProduct=function(a){return this.x*a.x+this.y*a.y};h.prototype.angleBetweenVectors=function(a){return Math.acos(this.dotProduct(a)/(this.vectorLength()*a.vectorLength()))};h.AXIS_X=new h(1,0);h.AXIS_Y=new h(0,1);a.Vector2D=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.floor,d=Math.round,e,q,p,b,k,m,c,f,g,v,r,u,z,n=function(c,b){this.parent=c;this.evaluator=c.evaluator;var f=this.parser=c.evaluator.parser;this.id="GraphicControl"!==b.type?"C":"G";this.gui=this.type="";this.region="south";this.y=this.x=0;this.w="Video"!==b.type?100:350;this.h="Video"!==b.type?23:120;this.keyboard=!1;this.kblayout="1x16";"GraphicControl"!==b.type&&"Audio"!==b.type&&"Video"!==b.type?"TextArea"!==b.type?this.expresion=f.parse("(0,0,100,23)"):
(this.expresion=f.parse("(0,0,300,200)"),this.w=300,this.h=200):this.expresion=f.parse("(0,0)");this.visible=this.fixed=!0;this.color=new a.Color("Scrollbar"==b.gui?"e0e4e8":"222222");this.colorInt="cc0022";"Scrollbar"==b.gui?this.colorInt="182C61":"GraphicControl"!==b.type&&(this.colorInt="f0f8ff");this.colorInt=new a.Color(this.colorInt);this.font_size=f.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=f.parse("1");this.activeif=f.parse("1");this.valueExpr=f.parse("0");this.decimals=f.parse("2");this.min=f.parse("-Infinity");this.max=f.parse("Infinity");this.incr=f.parse("0.1");this.exponentialif=this.discrete=!1;this.zIndex=-1;Object.assign(this,b);"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;b=this.evaluator.eval(this.expresion);this.x=d(b[0][0]);this.y=d(b[0][1]);4==b[0].length&&(this.w=d(b[0][2]),this.h=d(b[0][3]));this.actionExec=c.lessonParser.parseAction(this)};n.prototype.init=function(){};n.prototype.update=function(){};n.prototype.draw=function(){};n.prototype.getContainer=function(){var a=this.parent.spaces;if("interior"===this.region)for(var c=0,b=a.length;c<b;c++){var f=a[c];if(f.id===this.spaceID)return f.addCtr(this),
this.zIndex=f.zIndex,this.space=f,f.numCtrContainer}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.numCtrContainer):this.parent.externalSpace.container;if(/north|south|east|west/.test(this.region))return this.parent[this.region+
"Space"].controls.push(this),this.parent[this.region+"Space"].container}a[0].addCtr(this);this.zIndex=a[0].zIndex;return a[0].numCtrContainer};n.prototype.addControlContainer=function(a){var c=this.getContainer();c.childNodes[0]?c.insertBefore(a,c.childNodes[0]):c.appendChild(a)};n.prototype.updatePositionAndSize=function(){p=b=k=m=!1;c=this.evaluator.eval(this.expresion);f=d(c[0][0]);p=d(this.x)!==f;this.x=f;f=d(c[0][1]);b=d(this.y)!==f;this.y=f;4===c[0].length&&(f=d(c[0][2]),k=d(this.w)!==f,this.w=
f,f=d(c[0][3]),m=d(this.h)!==f,this.h=f);if(k||m||p||b)this.init(!0,!0),this.draw()};n.prototype.formatOutputValue=function(a){z=this.parent;g=a+"";v=this.evaluator.eval(this.decimals);r=g.indexOf(".");-1!=r&&(u=g.substring(r+1),u.length>v&&(g=parseFloat(g).toFixed(v)));this.fixed&&(2!==z.version||2===z.version&&!this.exponentialif)&&(g=parseFloat(a).toFixed(v));this.exponentialif&&0!=parseFloat(g)&&(g=this.fixed&&2!==z.version?parseFloat(g).toExponential(v):parseFloat(g).toExponential(),g=g.toUpperCase().replace("+",
""));return g.replace(".",z.decimal_symbol)};n.prototype.updateAndExecAction=function(){this.parent.updateControls();"init"===this.action&&(this.click=!1);this.actionExec.execute();this.parent.updateControls();"animate"!==this.action&&this.parent.update();this.parent.updateControls()};n.prototype.createGradient=function(a,c){this.linearGradient=this.ctx.createLinearGradient(0,0,0,c);e=c*c;for(a=0;a<c;a++)q=h(a-35*c/100),this.linearGradient.addColorStop(a/c,"rgba(0,0,0,"+q*q*192/e/255+")")};a.Control=
n;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.floor,d=Math.abs,e=/[\w\.\-//]*(\.gif)/gi,q,p,b,k,m,c,f,g,v,r,u,z,n,l,x,w,y,A,E,J,F,G,D,B,L,H,M,P,I,O,C,Q,K,R,N,S=function(c,b){var f=a.Control.call(this,c,b)||this;f.imageSrc=b.imageSrc||"";f.image=b.image||new Image;f.imageOver=b.imageOver||new Image;f.imageDown=b.imageDown||new Image;f.flat=b.flat||!1;f.borderColor=b.borderColor||!1;f.text_align=b.text_align||"center_center";f.image_align=b.image_align||"center_center";f.font_family=a.getFontName(b.font_family||
"arial");f.ratio=c.ratio;-1===f.font_size&&(f.noFSize=!0);f.borderColor&&(f.borderColor=new a.Color(f.borderColor));f.text_align=f.text_align.split("_");f.image_align=f.image_align.split("_");f.old_name=f.name;f.name.match(/^\[.*\]?/)?f.name=f.parser.parse(f.name.substring(1,f.name.length-1)):f.name=f.parser.parse("'"+f.name+"'");f.classContainer=f.cssClass?" "+f.cssClass+" ":"";f.extra_style=f.imageSrc.trim().match("^_STYLE_")?f.imageSrc.trim().substring(8):f.extra_style||"";f.imageSrc.trim().match("^_STYLE_")&&
(f.imageSrc="vacio.gif");if(f.extra_style){f.customStyle=!0;f.btnStyle=[];f.conStyle=[];f.conStyle.textBorder=3;c=f.extra_style.split("|");for(var l,g=0,e=c.length;g<e;g++)b=c[g],l=b.match(/rgb/g),b.match("class=")?f.classContainer=" "+b.substring(6):b.match("border=")?(f.btnStyle.push({type:"border-style",value:"solid"}),f.btnStyle.push({type:"border-width",value:b.substring(7).trim()+"px"})):b.match("borderRadius=")?(f.btnStyle.push({type:"border-radius",value:b.substring(13).trim()+"px"}),f.conStyle.push({type:"border-radius",
value:b.substring(13).trim()+"px"})):b.match("borderColor=")?f.btnStyle.push({type:"border-color",value:(l?"":"#")+b.substring(12).trim()}):b.match("overColor=")?f.conStyle.overColor=(l?"":"#")+b.substring(10).trim():b.match("downColor=")?f.conStyle.downColor=(l?"":"#")+b.substring(10).trim():b.match("font=")?f.conStyle.font=b.substring(5).trim().toLowerCase():b.match("inactiveColor=")?f.conStyle.inactiveColor=(l?"":"#")+b.substring(14).trim():b.match("inactiveColorBorder=")?f.conStyle.inactiveColorBorder=
(l?"":"#")+b.substring(20).trim():b.match("shadowTextBlur=")?f.conStyle.shadowTextBlur=parseFloat(b.substring(15).trim()):b.match("shadowTextOffsetX=")?f.conStyle.shadowTextOffsetX=parseFloat(b.substring(18).trim()):b.match("shadowTextOffsetY=")?f.conStyle.shadowTextOffsetY=parseFloat(b.substring(18).trim()):b.match("shadowTextColor=")?f.conStyle.shadowTextColor=(l?"":"#")+b.substring(16).trim():b.match("shadowBoxBlur=")?f.conStyle.shadowBoxBlur=parseFloat(b.substring(14).trim()):b.match("shadowBoxOffsetX=")?
f.conStyle.shadowBoxOffsetX=parseFloat(b.substring(17).trim()):b.match("shadowBoxOffsetY=")?f.conStyle.shadowBoxOffsetY=parseFloat(b.substring(17).trim()):b.match("shadowBoxColor=")?f.conStyle.shadowBoxColor=(l?"":"#")+b.substring(15).trim():b.match("shadowInsetBoxBlur=")?f.conStyle.shadowInsetBoxBlur=parseFloat(b.substring(19).trim()):b.match("shadowInsetBoxOffsetX=")?f.conStyle.shadowInsetBoxOffsetX=parseFloat(b.substring(22).trim()):b.match("shadowInsetBoxOffsetY=")?f.conStyle.shadowInsetBoxOffsetY=
parseFloat(b.substring(22).trim()):b.match("shadowInsetBoxColor=")?f.conStyle.shadowInsetBoxColor=(l?"":"#")+b.substring(20).trim():b.match("textBorder=")?f.conStyle.textBorder=parseFloat(b.substring(11).trim()):b.match("flat=")?f.flat=1==parseInt(b.substring(5).trim()):b.match("imgSizeW=")?f.imgSizeW=parseFloat(b.substring(9))||0:b.match("imgSizeH=")&&(f.imgSizeH=parseFloat(b.substring(9))||0)}f.imageSrc.match("_COLORES_")&&(c=f.imageSrc.split("_"),f.colorInt=new a.Color(c[2]),f.color=new a.Color(c[3]),
f.font_size=f.parser.parse(c[5]),f.imageSrc="");f.imageSrc.match(/^\[.*\]?/)?f.imageSrc=f.parser.parse(f.imageSrc.substring(1,f.imageSrc.length-1)):f.imageSrc=f.parser.parse("'"+f.imageSrc+"'");c=f.evaluator.eval(f.imageSrc).toString().trim();if(""!=c)if(b=c.substr(0,c.lastIndexOf(".")),l=c.substr(c.lastIndexOf(".")),c.match(/vacio.gif$/i))f.imageSrc=f.parser.parse("'vacio.gif'"),f.image.ready=1,3===f.parent.version&&(f.name=f.parser.parse("")),f.emptyImage={ready:!0},f.parser.parse("'vacio.gif'");
else if(f.image=f.parent.getImage(c),b)try{f.imageOver=f.parent.getImage(b+"_over"+l),f.imageDown=f.parent.getImage(b+"_down"+l)}catch(Z){}f.container=a.newHTML("div",{class:"DescartesButtonContainer"+f.classContainer,id:f.id,style:"width:"+f.w+"px;height:"+f.h+"px;left:"+f.x+"px;top:"+f.y+"px;z-index:"+f.zIndex+";"});f.btn=a.newHTML("canvas",{width:f.w*f.ratio,height:f.h*f.ratio,style:"position:absolute;left:0;top:0;width:"+f.w+"px;height:"+f.h+"px;"});f.ctx=f.btn.getContext("2d");f.ctx.imageSmoothingEnabled=
!1;f.tooltip&&(f.btn.title=f.tooltip);f.container.appendChild(f.btn);f.addControlContainer(f.container);f.addEvents();f.init();return f};$jscomp.inherits(S,a.Control);S.prototype.init=function(c){q=this.evaluator;E=this.container;p=this.btn;b=this.ctx;k=q.eval(this.expresion);this.x=k[0][0];this.y=k[0][1];4==k[0].length&&(this.w=parseInt(k[0][2]),this.h=parseInt(k[0][3]));p.width=this.w*this.ratio;p.height=this.h*this.ratio;p.setAttribute("style","position:absolute;left:0;top:0;width:"+this.w+"px;height:"+
this.h+"px;box-sizing:border-box;");E.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 f=0,l=this.btnStyle.length;f<l;f++)p.style[this.btnStyle[f].type]=this.btnStyle[f].value;if(this.conStyle){f=0;for(l=this.conStyle.length;f<l;f++)E.style[this.conStyle[f].type]=this.conStyle[f].value;if(this.conStyle.shadowBoxColor){f=this.conStyle.shadowBoxOffsetX||0;l=this.conStyle.shadowBoxOffsetY||
2;var g=this.conStyle.shadowBoxBlur||2;E.style.boxShadow=f+"px "+l+"px "+g+"px 1px "+this.conStyle.shadowBoxColor}this.conStyle.shadowInsetBoxColor&&(f=this.conStyle.shadowInsetBoxOffsetX||0,l=this.conStyle.shadowInsetBoxOffsetY||-2,g=this.conStyle.shadowInsetBoxBlur||1,p.style.boxShadow=f+"px "+l+"px "+g+"px 1px "+this.conStyle.shadowInsetBoxColor+" inset")}this.noFSize&&(this.font_size=q.parser.parse(a.getFieldFontSize(this.h)+""));this.fs_evaluated=q.eval(this.font_size);this.createGradient(this.w,
this.h);E.style.display=0<q.eval(this.drawif)?"block":"none";b.lineJoin="round";b.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(c)};S.prototype.update=function(){q=this.evaluator;E=
this.container;p=this.btn;this.activeIfValue=0<q.eval(this.activeif);this.drawIfValue=0<q.eval(this.drawif);(this.space?this.space.drawIfValue:1)&&this.drawIfValue?(E.style.display="block",this.draw(),E.style.cursor=p.style.cursor=this.activeIfValue?"pointer":"not-allowed",E.setAttribute("active",this.activeIfValue),this.updatePositionAndSize()):(E.style.display="none",this.buttonClick=!1)};S.prototype.draw=function(d){E=this.container;q=this.evaluator;p=this.btn;b=this.ctx;c=q.eval(this.name);this.text_object.draw(a.ctx,
"#000000",0,0);c=this.text_object.textNodes.toStr();f=this.evaluator.eval(this.imageSrc).toString().trim();if(!d&&(J=this.over===this.oldOver,F=this.buttonClick===this.oldButtonClick,G=this.activeIfValue===this.oldActiveIfValue,D=this.drawIfValue===this.oldDrawIfValue,B=c===this.oldName,L=f===this.oldImageSrc,H=this.colorInt.getColor()===this.oldBackColor,M=this.color.getColor()===this.oldTextColor,P=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=f,this.oldBackColor=this.colorInt.getColor(),this.oldTextColor=this.color.getColor(),this.oldImageReady=this.image.ready,J&&F&&G&&D&&B&&L&&H&&M&&P))return;b.save();b.setTransform(this.ratio,0,0,this.ratio,0,0);m=this.fs_evaluated;E.setAttribute("data-name",c);f?(g="vacio.gif"===f?this.emptyImage:this.parent.getImage(f),I=f.substr(0,f.lastIndexOf(".")),O=f.substr(f.lastIndexOf(".")),C=I+"_over"+
O,Q=I+"_down"+O,K="vacio.gif"===f?this.emptyImage:this.parent.getImage(C),R="vacio.gif"===f?this.emptyImage:this.parent.getImage(Q)):R=K=g=this.emptyImage;b.clearRect(0,0,this.w,this.h);v=r=0;this.buttonClick&&(v=r=1);this.text_object.draw(b,this.color.getColor(),0,0,!0);u=this.text_object.textNodes.metrics.w;z=this.text_object.textNodes.metrics.h;"center"==this.text_align[1]?y=h(this.w/2+v)-.5:"left"==this.text_align[1]?y=u/2+5+v:"right"==this.text_align[1]&&(y=this.w-u/2+v-5);"center"==this.text_align[0]?
A=h(this.h/2+r)-.5:"top"==this.text_align[0]?A=z/2+r+4:"bottom"==this.text_align[0]&&(A=this.h-z/2+r-3);if(g){if(n=this.imgSizeW?this.imgSizeW:g.width,l=this.imgSizeH?this.imgSizeH:g.height,"center"==this.image_align[1]?x=parseInt((this.w-n)/2)+v:"left"==this.image_align[1]?x=v:"right"==this.image_align[1]&&(x=this.w-n+v),"center"==this.image_align[0]?w=parseInt((this.h-l)/2)+r:"top"==this.image_align[0]?w=r:"bottom"==this.image_align[0]&&(w=this.h-l+r),g&&g.ready)if(g!==this.emptyImage&&g.complete)if(f.match(e))this.btn.style.backgroundRepeat=
"no-repeat",this.btn.style.backgroundImage="url('"+f+"')",this.btn.style.backgroundPosition=x+"px "+w+"px";else{if("center"!=this.image_align[0]||"center"!=this.image_align[1])N=this.colorInt.getColor(),!N||"CanvasGradient"!==N.constructor.name&&"CanvasPattern"!==N.constructor.name?E.style.backgroundColor=N:(b.fillStyle=N,b.fillRect(0,0,this.w,this.h));b.drawImage(g,0,0,g.width,g.height,x,w,n,l)}else this.emptyImage&&this.customStyle&&(N=this.colorInt.getColor(),!N||"CanvasGradient"!==N.constructor.name&&
"CanvasPattern"!==N.constructor.name?E.style.backgroundColor=N:(b.fillStyle=N,b.fillRect(0,0,this.w,this.h)))}else N=this.colorInt.getColor(),!N||"CanvasGradient"!==N.constructor.name&&"CanvasPattern"!==N.constructor.name?(E.style.backgroundColor=N,this.flat||(this.buttonClick||(a.drawLine(b,this.w-1,0,this.w-1,this.h,"rgba(0,0,0,0.5)"),a.drawLine(b,0,0,0,this.h,"rgba(0,0,0,0.09)"),a.drawLine(b,1,0,1,this.h,"rgba(0,0,0,0.03)")),b.fillStyle=this.linearGradient,b.fillRect(0,0,this.w,this.h))):(b.fillStyle=
N,b.fillRect(0,0,this.w,this.h));this.activeIfValue&&(K!==this.emptyImage&&this.over&&K.ready&&K.complete?C.match(e)?(this.btn.style.backgroundImage="url('"+C+"')",this.btn.style.backgroundPosition=x+"px "+w+"px"):b.drawImage(K,x,w):this.customStyle&&this.conStyle.overColor&&this.over&&(E.style.backgroundColor=this.conStyle.overColor));this.activeIfValue?R!==this.emptyImage&&this.buttonClick&&R.ready&&R.complete?Q.match(e)?(this.btn.style.backgroundImage="url('"+Q+"')",this.btn.style.backgroundPosition=
x+"px "+w+"px"):b.drawImage(R,x,w):this.customStyle&&this.conStyle.downColor&&this.buttonClick&&(E.style.backgroundColor=this.conStyle.downColor):this.buttonClick&&!g&&(b.fillStyle="rgba(0,0,0,0.09)",b.fillRect(0,0,this.w,this.h));b.fillStyle=this.color.getColor();this.customStyle&&this.conStyle.shadowTextColor&&0<this.conStyle.textBorder&&(b.lineWidth=this.conStyle.textBorder,b.strokeStyle=this.conStyle.shadowTextColor);this.borderColor&&(b.lineWidth=parseInt(m/6),b.strokeStyle=this.borderColor.getColor());
this.text_object.draw(b,this.color.getColor(),y,A);this.underlined&&(b.strokeStyle=this.color.getColor(),b.lineWidth=h(m/10)||2,b.lineCap="round",b.beginPath(),b.moveTo(y-u/2+v,A+h(m/2)+h(m/5)-1.5),b.lineTo(y+u/2+v,A+h(m/2)+h(m/5)-1.5),b.stroke());this.activeIfValue||(this.customStyle&&this.conStyle.inactiveColor?E.style.backgroundColor=this.conStyle.inactiveColor:(b.fillStyle="rgba(240,240,240,0.6)",b.fillRect(0,0,this.w,this.h)));b.restore();this._image_pos_x=x;this._image_pos_y=w};S.prototype.drawTextBorder=
function(){this.colorInt.getColor();this.color.getColor();return!(.5>(d(this.colorInt.r-this.color.r)+d(this.colorInt.g-this.color.g)+d(this.colorInt.b-this.color.b))/255)};S.prototype.buttonPressed=function(){this.updateAndExecAction()};S.prototype.addEvents=function(){function c(b,f,e){a.clearTimeout(g);l.buttonClick&&l.drawIfValue&&l.activeIfValue&&(f.call(l),b=e?b:100,g=a.setTimeout(function(){c(b,f,!1)},b))}function b(b){this.focus();b.preventDefault();b.stopPropagation();document.activeElement!=
document.body&&document.activeElement.blur();l.whichBtn=a.whichBtn(b);"L"==l.whichBtn&&l.activeIfValue&&(l.buttonClick=!0,l.draw(),"calculate"==l.action&&(l.evaluator.setVariable(l.id,l.evaluator.eval(l.valueExpr)),c(1E3,l.buttonPressed,!0)),l.btn.removeEventListener("touchend",f),l.btn.addEventListener("touchend",f),l.btn.removeEventListener("mouseup",f),l.btn.addEventListener("mouseup",f))}function f(c){a.newBlobContent=null;this.focus();c.preventDefault();c.stopPropagation();if(l.activeIfValue||
l.buttonClick)l.buttonClick=!1,l.draw(),"calculate"!=l.action&&(l.evaluator.setVariable(l.id,l.evaluator.eval(l.valueExpr)),l.buttonPressed()),l.btn.removeEventListener("touchend",f),l.btn.removeEventListener("mouseup",f);l.parent.update()}var l=this,g;l.btn.oncontextmenu=function(){return!1};this.over=this.buttonClick=!1;this.btn.addEventListener("touchstart",b);this.btn.addEventListener("mousedown",b);this.btn.addEventListener("mouseover",function(a){a.preventDefault();a.stopPropagation();l.over=
!0;l.draw()});this.btn.addEventListener("mouseout",function(c){a.newBlobContent=null;c.preventDefault();c.stopPropagation();l.over=!1;l.buttonClick=!1;l.draw()});document.addEventListener("visibilitychange",function(c){a.newBlobContent=null;l.buttonClick=!1})};a.Button=S;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,d,e,q,p,b,k,m,c,f,g,v,r,u,z=function(c,b){b=a.Control.call(this,c,b)||this;b.flat=b.image_dec_src&&b.image_inc_src;b.btn_pos=b.btn_pos||"v_left";b.horizontal="h_left"===b.btn_pos||"h_right"===b.btn_pos||"h_left_right"===b.btn_pos;b.label_color=b.label_color||new a.Color("e0e4e8",c.evaluator);b.label_text_color=b.label_text_color||new a.Color("000000",c.evaluator);b.tabindex=++b.parent.tabindex;b.name_str=b.name;b.initial_value=0;try{b.initial_value=
b.evaluator.eval(b.parser.parse(b.valueExprString))}catch(x){console.log(x)}b.name.match(/^\[.*\]?/)?b.name=b.parser.parse(b.name.substring(1,b.name.length-1)):b.name=b.parser.parse("'"+b.name+"'");b.container=a.newHTML("div",{class:"DescartesSpinnerContainer",id:b.id});b.divUp=a.newHTML("div",{class:"DJS_Up"});b.divDown=a.newHTML("div",{class:"DJS_Down"});b.field=a.newHTML("input",{type:"text",id:b.id+"_spinner",class:"DescartesSpinnerField",tabindex:b.tabindex});b.label=a.newHTML("canvas",{class:"DescartesSpinnerLabel"});
b.label_ctx=b.label.getContext("2d");b.ratio=c.ratio;b.container.appendChild(b.label);b.container.appendChild(b.field);b.container.appendChild(b.divUp);b.container.appendChild(b.divDown);b.cover=a.newHTML("div",{class:"TextfieldCover"});b.keyboard&&b.visible&&b.container.appendChild(b.cover);b.addControlContainer(b.container);g=b.evaluator.parser.parse("1");b.originalIncr=b.incr;if(0>b.evaluator.eval(b.decimals)||0===b.evaluator.eval(b.incr))c=b.evaluator.eval(b.incr),0<c?(b.incr=b.evaluator.parser.parse(parseInt(c).toString()),
b.originalIncr=b.incr):b.incr=g;b.image_dec_src&&(b.image_dec_src.match(/^\[.*\]?/)?b.image_dec_src=b.parser.parse(b.image_dec_src.substring(1,b.image_dec_src.length-1)):b.image_dec_src=b.parser.parse("'"+b.image_dec_src+"'"),b.old_image_dec_src=b.evaluator.eval(b.image_dec_src).toString().trim(),b.image_dec=b.parent.getImage(b.old_image_dec_src));b.image_inc_src&&(b.image_inc_src.match(/^\[.*\]?/)?b.image_inc_src=b.parser.parse(b.image_inc_src.substring(1,b.image_inc_src.length-1)):b.image_inc_src=
b.parser.parse("'"+b.image_inc_src+"'"),b.old_image_inc_src=b.evaluator.eval(b.image_inc_src).toString().trim(),b.image_inc=b.parent.getImage(b.old_image_inc_src));b.addEvents();b.init();return b};$jscomp.inherits(z,a.Control);z.prototype.init=function(c,b){h=this.evaluator;this.label.innerHTML=h.eval(this.name).toString();var f=this.label.textContent;b||(this.value=this.validateValue(h.eval(this.valueExpr)));b=this.formatOutputValue(this.value);this.fieldFontSize=0<h.eval(this.font_size)?h.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 l=2!==this.parent.version?"__":"_____",g=a.getTextWidth(b+
"_",this.fieldFontSize+"px "+a.sansserif_font);if(this.horizontal){c=parseInt(this.h);var e=parseInt(this.w/2-c);l=this.text_object.textNodes.metrics.w+parseInt(this.fieldFontSize);this.visible||(e=this.w-2*c,g=0);e<l&&(e=l);""==f&&(e=0);this.w-e-c<g&&(e=this.w-c-g);0>e&&(e=0);f=this.w-(e+2*c);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:"+
c+"px;height:"+c+"px;"+("h_left"===this.btn_pos?"left:"+(e+c):"right:0")+"px;top:0;"+(this.flat?"border-width:0;":""));this.divDown.setAttribute("style","width:"+c+"px;height:"+c+"px;left:"+(e+("h_right"===this.btn_pos?f:0))+"px;top:0;"+(this.flat?"border-width:0;":""));this.field.setAttribute("style","font-family:"+a.sansserif_font+";font-size:"+this.fieldFontSize+"px;width:"+f+"px;height:"+this.h+"px;left:"+(c+e+("h_left"===this.btn_pos?c:"h_right"===this.btn_pos?-c:0))+"px;text-align:center;");
this.cover.setAttribute("style","width:"+f+"px;height:"+this.h+"px;left:"+(c+e+("h_left"===this.btn_pos?c:"h_right"===this.btn_pos?-c:0))+"px;text-align:center;")}else c=2+parseInt(this.h/2),e=parseInt(this.w/2-c/2),l=a.getTextWidth(f+l,this.fieldFontSize+"px "+a.sansserif_font),this.visible||(e=this.w-c,g=0),e<l&&(e=l),""==f&&(e=0),this.w-e-c<g&&(e=this.w-c-g),0>e&&(e=0),f=this.w-(e+c),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;"),l="width:"+c+"px;left:"+(e+("v_right"===this.btn_pos?f:0))+"px;",this.divUp.setAttribute("style",l+";height:"+(this.h/2+1)+"px;top:0;"+(this.flat?"border-width:0;":"")),this.divDown.setAttribute("style",l+";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:"+f+"px;height:"+this.h+"px;left:"+(("v_left"===this.btn_pos?
c:0)+e)+"px;"),this.cover.setAttribute("style","width:"+f+"px;height:"+this.h+"px;left:"+(("v_left"===this.btn_pos?c:0)+e)+"px;");this.field.value=b;this.visible||(this.field.style.display="none");this.label.setAttribute("style","font-size:"+this.fieldFontSize+"px;width:"+e+"px;height:"+this.h+"px;line-height:"+this.h+"px;background-color:"+this.label_color.getColor()+";color:"+this.label_text_color.getColor()+";");this.label.width=e*this.ratio;this.label.height=this.h*this.ratio;this.image_dec&&
this.image_dec.ready&&(this.divDown.style["background-image"]="url("+this.image_dec.src+")");this.image_inc&&this.image_inc.ready&&(this.divUp.style["background-image"]="url("+this.image_inc.src+")");this.divUp.setAttribute("horizontal",this.horizontal?!0:!1);this.divDown.setAttribute("horizontal",this.horizontal?!0:!1);h.setVariable(this.id,this.value)};z.prototype.update=function(){h=this.evaluator;0>h.eval(this.decimals)?(d=h.eval(this.incr),0<d?this.originalIncr=this.incr=h.parser.parse(parseInt(d).toString()):
this.incr=g):this.incr=0!==h.eval(this.originalIncr)?this.originalIncr:g;this.activeIfValue=0<h.eval(this.activeif);this.drawIfValue=0<h.eval(this.drawif);this.field.disabled=!this.activeIfValue;this.divUp.setAttribute("active",!this.field.disabled);this.divDown.setAttribute("active",!this.field.disabled);this.drawIfValue?(this.updateStyle(),this.container.style.display="block"):(this.click=!1,this.container.style.display="none");this.image_dec&&(v=this.evaluator.eval(this.image_dec_src).toString().trim(),
this.old_image_dec_src!==v&&(this.divDown.style["background-image"]="url("+v+")",this.old_image_dec_src=v));this.image_inc&&(r=this.evaluator.eval(this.image_inc_src).toString().trim(),this.old_image_inc_src!==r&&(this.divUp.style["background-image"]="url("+r+")",this.image_inc_src=r));this.updatePositionAndSize();this.parent.animation.playing&&document.activeElement==this.field||(e=this.field.value,q=this.value,this.value=this.validateValue(h.getVariable(this.id)),this.field.value=this.formatOutputValue(this.value),
this.value==q&&this.field.value!=e&&(this.value=this.validateValue(e),this.field.value=this.formatOutputValue(this.value)),h.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);!(u=this.label_color.getColor())||"CanvasGradient"!==u.constructor.name&&"CanvasPattern"!==u.constructor.name||(this.label_ctx.fillStyle=u,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)};z.prototype.updateStyle=
function(){this.divUp.style.borderStyle=this.up?"inset":"outset";this.divUp.style.borderColor=this.up?"gray":"#f0f8ff";this.divUp.style.backgroundColor=this.up?"#bfbfbf":"";this.divUp.style.backgroundColor=this.flat?"transparent":this.divUp.style.backgroundColor;this.divUp.style.backgroundPosition=this.up?"calc(50% + 1px) calc(50% + 1px)":"center";this.divDown.style.borderStyle=this.down?"inset":"outset";this.divDown.style.borderColor=this.down?"gray":"#f0f8ff";this.divDown.style.backgroundColor=
this.down?"#bfbfbf":"";this.divDown.style.backgroundColor=this.flat?"transparent":this.divDown.style.backgroundColor;this.divDown.style.backgroundPosition=this.down?"calc(50% + 1px) calc(50% + 1px)":"center"};z.prototype.validateValue=function(a){h=this.evaluator;isNaN(parseFloat(a))||a.toString().match("e")&&(a=parseFloat(a).toFixed(20));a=void 0!=a?a.toString():"0";a=a.replace(this.parent.decimal_symbol,".");p=a==parseFloat(a)?parseFloat(a):parseFloat(h.eval(h.parser.parse(a)));isNaN(p)&&(p=0);
m=h.eval(this.min);c=h.eval(this.max);""===m&&(m=-Infinity);""===c&&(c=Infinity);p=Math.min(Math.max(p,m),c);this.discrete&&(b=h.eval(this.incr),p=0==b?0:this.initial_value+b*Math.round((p-this.initial_value)/b));k=h.eval(this.decimals);0>=k&&(k=0);return p=parseFloat(parseFloat(p).toFixed(k))};z.prototype.increase=function(){this.changeValue(parseFloat(this.value)+this.evaluator.eval(this.incr))};z.prototype.decrease=function(){this.changeValue(parseFloat(this.value)-this.evaluator.eval(this.incr))};
z.prototype.changeValue=function(a){this.activeIfValue&&(this.value=this.validateValue(a),this.field.value=this.formatOutputValue(this.value),this.evaluator.setVariable(this.id,this.value),this.updateAndExecAction())};z.prototype.addEvents=function(){function c(b,f,l){a.clearTimeout(m);if(h.up||h.down)f.call(h),b=l?b:10,m=a.setTimeout(function(){c(b,f)},b)}function b(b){b.preventDefault();h.whichBtn=a.whichBtn(b);"L"==h.whichBtn&&h.activeIfValue&&(h.up=!0,c(k,h.increase,!0))}function g(b){b.preventDefault();
h.whichBtn=a.whichBtn(b);"L"==h.whichBtn&&h.activeIfValue&&(h.down=!0,c(k,h.decrease,!0))}function e(c){h.up=!1;a.clearTimeout(m);h.updateStyle()}function d(c){h.down=!1;a.clearTimeout(m);h.updateStyle()}f=a.hasTouchSupport;var h=this,k=f?500:200,m;h.divUp.oncontextmenu=h.divDown.oncontextmenu=h.field.oncontextmenu=h.label.oncontextmenu=h.cover.oncontextmenu=function(){return!1};this.label.addEventListener("touchstart",a.preventDefault);this.label.addEventListener("mousedown",a.preventDefault);this.field.addEventListener("keydown",
function(a){13==a.keyCode&&h.changeValue(h.field.value)});this.divUp.addEventListener("touchstart",b);this.divUp.addEventListener("mousedown",b);this.divDown.addEventListener("touchstart",g);this.divDown.addEventListener("mousedown",g);this.divUp.addEventListener("mouseout",function(c){h.up=!1;a.clearTimeout(m);c.preventDefault();h.updateStyle()});this.divDown.addEventListener("mouseout",function(c){h.down=!1;a.clearTimeout(m);c.preventDefault();h.updateStyle()});this.divUp.addEventListener("touchend",
e);window.addEventListener("touchend",e);this.divUp.addEventListener("mouseup",e);window.addEventListener("mouseup",e);this.divDown.addEventListener("touchend",d);window.addEventListener("touchend",d);this.divDown.addEventListener("mouseup",d);window.addEventListener("mouseup",d);document.addEventListener("visibilitychange",function(c){h.up=!1;h.down=!1;a.clearTimeout(m);h.updateStyle()});this.field.addEventListener("blur",function(a){h.drawIfValue&&h.changeValue(h.field.value,!0)});h.field.addEventListener("click",
function(a){this.focus()});h.cover.addEventListener("click",function(a){a=h.evaluator.eval(h.kbexp);h.activeIfValue&&h.parent.keyboard.show(h,h.kblayout,a[0][0]||0,a[0][1]||0,h.id,h.field,h.onlyText)})};a.Spinner=z;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,d,e=function(e,h){var b=a.Control.call(this,e,h)||this;b.label_color=b.label_color||new a.Color("e0e4e8",e.evaluator);b.label_text_color=b.label_text_color||new a.Color("000000",e.evaluator);b.typeCtr="checkbox";b.pressed=h.pressed||!1;b.radio_group=(h.radio_group||"").trim();""!==b.radio_group&&(b.typeCtr="radio");b.name_str=b.name;b.name.match(/^\[.*\]?/)?b.name=b.parser.parse(b.name.substring(1,b.name.length-1)):b.name=b.parser.parse("'"+b.name.trim()+
"'");b.tabindex=++b.parent.tabindex;b.containerControl=a.newHTML("div",{class:"DescartesCheckboxContainer",id:b.id});b.checkbox=a.newHTML("input",{type:b.typeCtr,id:b.id+b.typeCtr,class:"DescartesCheckbox",tabindex:b.tabindex});""!==b.radio_group&&b.checkbox.setAttribute("name",b.radio_group);b.checkbox.internalID=b.id;b.label=a.newHTML("canvas",{class:"DescartesCheckboxLabel"});b.label_ctx=b.label.getContext("2d");b.ratio=e.ratio;b.dummyLabel=a.newHTML("label",{"for":b.id+b.typeCtr});b.value=b.evaluator.eval(b.valueExpr);
b.evaluator.setVariable(b.id,b.value);b.containerControl.appendChild(b.label);b.containerControl.appendChild(b.checkbox);b.containerControl.appendChild(b.dummyLabel);b.addControlContainer(b.containerControl);b.addEvents();b.init();return b};$jscomp.inherits(e,a.Control);e.prototype.init=function(e){h=this.evaluator;this.label.innerHTML=h.eval(this.name).toString();this.labelFontSize=0<h.eval(this.font_size)?h.eval(this.font_size):a.getFieldFontSize(this.h);e=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:"+e+"px;"),this.checkbox.setAttribute("style","width:"+this.h+"px;height:"+this.h+"px;left:"+e+"px;"),this.label.setAttribute("style","font-size:"+this.labelFontSize+"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.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:"+e+"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=e*this.ratio;this.label.height=
this.h*this.ratio;this.update()};e.prototype.update=function(){h=this.evaluator;this.activeIfValue=0<h.eval(this.activeif);this.drawIfValue=0<h.eval(this.drawif);this.checkbox.disabled=!this.activeIfValue;this.containerControl.style.display=this.drawIfValue?"block":"none";if(!this.parent.animation.playing||document.activeElement!=this.checkbox){var a=0!==h.getVariable(this.id)?1:0;if(""===this.radio_group)this.pressed?(this.value=this.checkbox.checked?1:0,this.pressed=!1):(this.value=a,this.checkbox.checked=
0!==this.value),h.setVariable(this.id,this.value);else{this.value=h.getVariable(this.id);h.setVariable(this.radio_group,0);a=document.querySelectorAll("[name="+this.radio_group+"]");var e=-1;if(this.pressed){for(var b=a.length-1;0<=b;b--)h.setVariable(a[b].internalID,0),a[b].checked=!1;h.setVariable(this.id,1);this.checkbox.checked=!0;this.value=1;h.setVariable(this.radio_group,this.id);this.pressed=0}else{for(b=a.length-1;0<=b;b--)e=0!=h.getVariable(a[b].internalID)?b:e,h.setVariable(a[b].internalID,
0),a[b].checked=!1;0<=e&&(h.setVariable(a[e].internalID,1),a[e].checked=!0,h.setVariable(this.radio_group,a[e].internalID));this.value=this.checkbox.checked?1:0}}}this.updatePositionAndSize();this.label_ctx.setTransform(this.ratio,0,0,this.ratio,0,0);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),0,0);this.label_ctx.clearRect(0,0,this.label.width,this.label.height);!(d=this.label_color.getColor())||"CanvasGradient"!==d.constructor.name&&"CanvasPattern"!==d.constructor.name||
(this.label_ctx.fillStyle=d,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)};e.prototype.addEvents=function(){var e=this;e.checkbox.oncontextmenu=e.label.oncontextmenu=e.dummyLabel.oncontextmenu=function(){return!1};e.label.addEventListener("touchstart",a.preventDefault);e.label.addEventListener("mousedown",a.preventDefault);e.dummyLabel.addEventListener("mousedown",a.preventDefault);e.checkbox.addEventListener("click",function(){e.pressed=!0;e.updateAndExecAction()})};a.Checkbox=e;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,d,e,q,p,b,k,m=function(c,b){b=a.Control.call(this,c,b)||this;b.label_color=b.label_color||new a.Color("e0e4e8",c.evaluator);b.label_text_color=b.label_text_color||new a.Color("000000",c.evaluator);b.name_str=b.name;b.name.match(/^\[.*\]?/)?b.name=b.parser.parse(b.name.substring(1,b.name.length-1)):b.name=b.parser.parse("'"+b.name.trim()+"'");void 0===b.valueExprString&&(b.valueExprString=b.onlyText?"0":"");b.emptyString=!1;b.ok=0;b.tabindex=++b.parent.tabindex;
b.regExpDecimalSymbol=new RegExp("\\"+b.parent.decimal_symbol,"g");if(b.answer)if(b.answer.match("krypto_")&&(b.answer=(new a.Krypto).decode(b.answer.substring(7))),b.answerPattern=b.answer,b.answer=a.buildRegularExpressionsPatterns(b.answer,b.evaluator),b.onlyText){var f=b.answerPattern.indexOf("|");b.firstAnswer=-1==f?b.answerPattern:b.answerPattern.substring(0,f)}else b.firstAnswer=b.parser.parse(b.answerPattern.substring(1,b.answerPattern.indexOf(",")));b.onlyText&&(b.valueExprString.match(/^'/)&&
b.valueExprString.match(/'$/)||(b.valueExpr=b.evaluator.parser.parse("'"+b.valueExprString+"'")),b.validateValue=function(a){a=a.toString();return"''"==a||"'"==a?"":a&&a.match(/^'/)&&a.match(/'$/)?a.substring(1,a.length-1):a},b.formatOutputValue=function(a){return a.toString()});b.containerControl=a.newHTML("div",{class:"DescartesTextFieldContainer",id:b.id});b.field=a.newHTML("input",{type:"text",id:b.id+"TextField",class:"DescartesTextFieldField",tabindex:b.tabindex});b.label=a.newHTML("canvas",
{class:"DescartesTextFieldLabel"});b.label_ctx=b.label.getContext("2d");b.ratio=c.ratio;b.containerControl.appendChild(b.label);b.containerControl.appendChild(b.field);b.cover=a.newHTML("div",{class:"TextfieldCover"});b.keyboard&&b.containerControl.appendChild(b.cover);b.activoStr=b.id+".activo";b.activeStr=b.id+".active";b.addControlContainer(b.containerControl);b.addEvents();b.init();return b};$jscomp.inherits(m,a.Control);m.prototype.init=function(c){h=this.evaluator;this.label.innerHTML=h.eval(this.name).toString();
var b=this.label.textContent;c||(this.value=this.validateValue(h.eval(this.valueExpr)));c=this.formatOutputValue(this.value);this.fieldFontSize=0<h.eval(this.font_size)?h.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 e=a.getTextWidth(c+"_",this.fieldFontSize+"px "+a.sansserif_font),d=parseInt(this.w/2),k=this.text_object.textNodes.metrics.w+parseInt(this.fieldFontSize);this.visible||(d=this.w,e=0);d<k&&(d=k);""==b&&(d=0);this.w-d<e&&(d=this.w-e);0>d&&(d=0);b=this.w-d;this.containerControl.setAttribute("style","width:"+this.w+"px;height:"+this.h+"px;left:"+this.x+"px;top:"+this.y+
"px;z-index:"+this.zIndex+";");this.field.setAttribute("style","font-size:"+this.fieldFontSize+"px;width:"+b+"px;height:"+this.h+"px;left:"+d+"px; 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:"+d+"px;");this.label.setAttribute("style","font-size:"+this.fieldFontSize+"px;width:"+d+"px;height:"+this.h+"px;line-height:"+this.h+"px;background-color:"+
this.label_color.getColor()+";color:"+this.label_text_color.getColor()+";");this.label.width=d*this.ratio;this.label.height=this.h*this.ratio;this.evaluate&&(this.ok=this.evaluateAnswer());this.evaluator.setVariable(this.id,this.value);this.evaluator.setVariable(this.id+".ok",this.ok);this.oldValue=this.value;this.update()};m.prototype.update=function(){h=this.evaluator;this.activeIfValue=0<h.eval(this.activeif);this.drawIfValue=0<h.eval(this.drawif);this.field.disabled=!this.activeIfValue;this.containerControl.style.display=
this.drawIfValue?"block":"none";this.parent.animation.playing&&document.activeElement==this.field||(d=this.field.value,e=this.value,this.value=this.validateValue(h.getVariable(this.id)),this.field.value=this.formatOutputValue(this.value),this.value===e&&this.field.value!=d&&(this.value=this.validateValue(d),this.field.value=this.formatOutputValue(this.value)),h.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);!(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)};m.prototype.validateValue=function(a){if(""===a||"''"==a)return"";h=this.evaluator;a=a.toString().replace(this.regExpDecimalSymbol,".","g");q=a==parseFloat(a)?parseFloat(a):parseFloat(h.eval(h.parser.parse(a)));isNaN(q)&&(q=0);p=h.eval(this.min);b=h.eval(this.max);
""===p&&(p=-Infinity);""===b&&(b=Infinity);q<p&&(q=p);q>b&&(q=b);this.discrete&&(a=h.eval(this.incr),q=0===a?0:a*Math.round(q/a));return q=parseFloat(parseFloat(q).toFixed(h.eval(this.decimals)))};m.prototype.formatOutputValue=function(c){return""===c?"":a.Control.prototype.formatOutputValue.call(this,c)};m.prototype.changeValue=function(a){this.activeIfValue&&(this.value=this.validateValue(a),this.field.value=this.formatOutputValue(this.value),this.evaluate&&(this.ok=this.evaluateAnswer()),this.evaluator.setVariable(this.id,
this.value),this.evaluator.setVariable(this.id+".ok",this.ok),this.updateAndExecAction())};m.prototype.evaluateAnswer=function(){return a.esCorrecto(this.answer,this.value,this.evaluator,this.answer)};m.prototype.getFirstAnswer=function(){return this.answer?this.onlyText?this.firstAnswer:this.evaluator.eval(this.firstAnswer):""};m.prototype.deactivate=function(){this.evaluator.setVariable(this.activoStr,0);this.evaluator.setVariable(this.activeStr,0)};m.prototype.addEvents=function(){var b=this;b.field.oncontextmenu=
b.label.oncontextmenu=b.cover.oncontextmenu=function(){return!1};b.label.addEventListener("touchstart",a.preventDefault);b.label.addEventListener("mousedown",a.preventDefault);this.field.addEventListener("mousedown",function(a){b.parent.deactivateControls();b.evaluator.setVariable(b.activoStr,1);b.evaluator.setVariable(b.activeStr,1);b.parent.update()});this.field.addEventListener("blur",function(a){b.drawIfValue&&b.changeValue(b.field.value,!0)});this.field.addEventListener("keydown",function(a){b.activeIfValue&&
13==a.keyCode&&b.changeValue(b.field.value,!0)});b.field.addEventListener("click",function(a){this.focus()});b.cover.addEventListener("click",function(a){b.parent.deactivateControls();b.evaluator.setVariable(b.activoStr,1);b.evaluator.setVariable(b.activeStr,1);b.parent.update();a=b.evaluator.eval(b.kbexp);b.activeIfValue&&b.parent.keyboard.show(b,b.kblayout,a[0][0]||0,a[0][1]||0,b.id,b.field,b.onlyText)})};a.TextField=m;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.abs,d,e,q,p,b,k,m,c,f,g,v,r=function(b,c){function f(b){g.options=b.split(",");g.menuOptions=[];g.strValue=[];b=0;for(var c=g.options.length;b<c;b++){var f=g.customSplit(g.options[b]);1==f.length?(g.menuOptions.push(f[0]),g.strValue.push(b.toString())):2==f.length&&(g.menuOptions.push(f[0]),""==f[1]?g.strValue.push(b.toString()):g.strValue.push(f[1]))}b=0;for(c=g.menuOptions.length;b<c;b++)g.menuOptions[b].match(/^\[/)&&g.menuOptions[b].match(/\]$/)?
g.menuOptions[b]=d.parse(g.menuOptions[b].substring(1,g.menuOptions[b].length-1)):g.menuOptions[b]=d.parse("'"+g.menuOptions[b]+"'");b=0;for(c=g.strValue.length;b<c;b++)g.strValue[b].match(/^\[/)&&g.strValue[b].match(/\]$/)?g.strValue[b]=d.parse(g.strValue[b].substring(1,g.strValue[b].length-1)):g.strValue[b]=d.parse(g.strValue[b]);g.select.innerHTML="";b=0;for(c=g.menuOptions.length;b<c;b++)f=a.newHTML("option"),f.innerHTML=e.eval(g.menuOptions[b]),g.select.appendChild(f);return 0}var l=a.Control.call(this,
b,c)||this;l.label_color=l.label_color||new a.Color("e0e4e8",b.evaluator);l.label_text_color=l.label_text_color||new a.Color("000000",b.evaluator);l.options=c.options||"";d=l.parser;e=l.evaluator;l.ok=0;l.tabindex=++l.parent.tabindex;l.answer&&(l.answer.match("krypto_")&&(l.answer=(new a.Krypto).decode(l.answer.substring(7))),l.answer=parseInt(l.answer.split(",")[0].replace("[",""))||0);l.name_str=l.name;l.name.match(/^\[.*\]?/)?l.name=l.parser.parse(l.name.substring(1,l.name.length-1)):l.name=l.parser.parse("'"+
l.name+"'");var g=l;l.evaluator.setFunction(l.id+".setOptions",f);l.containerControl=a.newHTML("div",{class:"DescartesMenuContainer",id:l.id});l.label=a.newHTML("canvas",{class:"DescartesMenuLabel"});l.label_ctx=l.label.getContext("2d");l.ratio=b.ratio;l.select=a.newHTML("select",{id:l.id+"_menuSelect",class:"DescartesMenuSelect",tabindex:l.tabindex});l.field=a.newHTML("input",{type:"text",id:l.id+"_menuField",class:"DescartesMenuField",tabindex:l.tabindex});f(l.options);l.containerControl.appendChild(l.label);
l.containerControl.appendChild(l.select);l.visible&&l.containerControl.appendChild(l.field);l.cover=a.newHTML("div",{class:"TextfieldCover"});l.keyboard&&l.visible&&l.containerControl.appendChild(l.cover);l.addControlContainer(l.containerControl);l.addEvents();l.init();return l};$jscomp.inherits(r,a.Control);r.prototype.init=function(b){e=this.evaluator;this.label.innerHTML=e.eval(this.name).toString();var c=this.label.textContent;this.fieldFontSize=0<e.eval(this.font_size)?e.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 f=0,g=0;this.value=b?this.value:e.eval(this.valueExpr);
this.indexValue=this.getIndex(this.value);for(var d=0,h=this.menuOptions.length;d<h;d++)b=a.getTextWidth(e.eval(this.menuOptions[d]).toString(),this.fieldFontSize+"px "+a.sansserif_font),b>f&&(f=b,g=d);f+=25;b=a.getTextWidth(this.formatOutputValue(e.eval(this.strValue[g])),this.fieldFontSize+"px "+a.sansserif_font)+7;g=this.text_object.textNodes.metrics.w+parseInt(this.fieldFontSize);""==c&&(g=0);this.visible||(b=0);for(c=this.w-b-g;c<f&&0<g;)g--,c++;for(;c<f&&0<b;)b--,c++;for(;g+c+b+1<this.w;)c++,
b++;f=g;d=f+c;b=this.w-d;h=this.formatOutputValue(e.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:"+g+"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=g*this.ratio;this.label.height=
this.h*this.ratio;this.field.value=h;this.field.setAttribute("style","font-size:"+this.fieldFontSize+"px;width:"+b+"px;height:"+this.h+"px;left:"+d+"px;");this.cover.setAttribute("style","width:"+b+"px;height:"+this.h+"px;left:"+d+"px;");this.select.setAttribute("style","text-align:left;font-size:"+this.fieldFontSize+"px;width:"+c+"px;height:"+this.h+"px;left:"+f+"px;");this.select.selectedIndex=this.indexValue;e.setVariable(this.id,parseFloat(h.replace(this.parent.decimal_symbol,".")));this.update()};
r.prototype.update=function(){e=this.evaluator;this.activeIfValue=0<e.eval(this.activeif);this.drawIfValue=0<e.eval(this.drawif);this.field.disabled=this.activeIfValue?!1:!0;this.select.disabled=this.activeIfValue?!1:!0;this.drawIfValue?this.containerControl.style.display="block":(this.click=!1,this.containerControl.style.display="none");if(!this.parent.animation.playing||document.activeElement!=this.select){for(var a=0,b=this.menuOptions.length;a<b;a++)this.select.options[a].innerHTML=e.eval(this.menuOptions[a]);
this.value=e.getVariable(this.id);isNaN(this.value)&&(this.value=0);this.field.value=this.formatOutputValue(this.value);e.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);!(v=this.label_color.getColor())||"CanvasGradient"!==v.constructor.name&&"CanvasPattern"!==v.constructor.name||(this.label_ctx.fillStyle=v,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)};r.prototype.customSplit=function(a){k=!1;m="";c=0;for(f=-1;c<a.length;){g=a.charAt(c);if("["===g&&-1===f){if(k||""!=m)m+="\u00a6";f++}else"["===g?f++:"]"===g&&0===f?(k=!0,f--):"]"==a.charAt(c)&&(f=0>f?f:f-1);m+=a.charAt(c);c++}return m.split("\u00a6")};r.prototype.getIndex=function(a){a=parseFloat(a.toString().replace(this.parent.decimal_symbol,
"."));q=-1;p=Infinity;for(var c=0,f=this.strValue.length;c<f;c++)b=h(a-parseFloat(this.evaluator.eval(this.strValue[c]))),b<=p&&(p=b,q=c);return q};r.prototype.changeValue=function(){this.activeIfValue&&(this.evaluator.setVariable(this.id,this.value),this.updateAndExecAction())};r.prototype.addEvents=function(){var b=this;b.select.oncontextmenu=b.label.oncontextmenu=b.field.oncontextmenu=b.cover.oncontextmenu=function(){return!1};b.label.addEventListener("touchstart",a.preventDefault);b.label.addEventListener("mousedown",
a.preventDefault);this.select.addEventListener("change",function(a){b.value=b.evaluator.eval(b.strValue[this.selectedIndex]);b.field.value=b.formatOutputValue(b.value);b.evaluator.setVariable(b.id,b.field.value);b.changeValue();a.preventDefault()});this.field.addEventListener("keydown",function(a){13==a.keyCode&&(b.indexValue=b.getIndex(b.field.value),b.value=b.evaluator.eval(b.strValue[b.indexValue]),b.field.value=b.formatOutputValue(b.indexValue),b.select.selectedIndex=b.indexValue,b.changeValue())});
this.field.addEventListener("blur",function(a){b.drawIfValue&&b.changeValue(b.field.value,!0)});b.field.addEventListener("click",function(a){this.focus()});b.cover.addEventListener("click",function(a){a=b.evaluator.eval(b.kbexp);b.activeIfValue&&b.parent.keyboard.show(b,b.kblayout,a[0][0]||0,a[0][1]||0,b.id,b.field,b.onlyText)})};a.Menu=r;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.floor,d,e,q,p,b,k,m,c,f,g,v,r,u,z,n,l,x,w,y=function(b,c){c=a.Control.call(this,b,c)||this;c.label_color=c.label_color||new a.Color("e0e4e8",b.evaluator);c.label_text_color=c.label_text_color||new a.Color("000000",b.evaluator);c.name_str=c.name;c.name.match(/^\[.*\]?/)?c.name=c.parser.parse(c.name.substring(1,c.name.length-1)):c.name=c.parser.parse("'"+c.name+"'");c.orientation=c.w>=c.h?"h":"v";c.container=a.newHTML("div",{class:"DescartesScrollbarContainer",
id:c.id});c.canvas=a.newHTML("canvas");c.divUp=a.newHTML("div",{class:"DescartesCatcher up"});c.divDown=a.newHTML("div",{class:"DescartesCatcher down"});c.field=a.newHTML("input",{type:"text",id:c.id+"scrollbar",class:"DescartesScrollbarField"});c.scrollHandler=a.newHTML("div",{class:"DescartesCatcher manipulator"});c.label=a.newHTML("canvas",{class:"DescartesScrollbarLabel"});c.label_ctx=c.label.getContext("2d");c.ratio=b.ratio;c.container.appendChild(c.canvas);c.container.appendChild(c.label);c.container.appendChild(c.divUp);
c.container.appendChild(c.divDown);c.container.appendChild(c.field);c.container.appendChild(c.scrollHandler);c.cover=a.newHTML("div",{class:"TextfieldCover"});c.keyboard&&c.visible&&c.container.appendChild(c.cover);c.addControlContainer(c.container);c.addEvents();c.init();return c};$jscomp.inherits(y,a.Control);y.prototype.init=function(){d=this.evaluator;0==d.eval(this.decimals)?this.incr=1:this.incr=(d.eval(this.max)-d.eval(this.min))/100;this.value=this.validateValue(d.eval(this.valueExpr));q=
this.formatOutputValue(this.value);p=this.evaluator.eval(this.expresion);this.x=p[0][0];this.y=p[0][1];4==p[0].length&&(this.w=p[0][2],this.h=p[0][3]);this.orientation=this.w>=this.h?"h":"v";this.initScroll(q);this.changeScrollPositionFromValue();this.prePos=this.pos;d.setVariable(this.id,this.value)};y.prototype.initScroll=function(b){e=this;d=e.evaluator;e.label.innerHTML=d.eval(e.name).toString();x=this.label.textContent;var c="v"===e.orientation?parseInt(19+5*(e.h-100)/100):e.h;e.fieldFontSize=
0<d.eval(e.font_size)?d.eval(e.font_size):"v"===e.orientation?c-parseInt(e.h/20)-1:a.getFieldFontSize(c);this.text_object=new a.TextObject({parent:{decimal_symbol:this.parent.decimal_symbol},evaluator:this.evaluator,decimals:this.decimals,fixed:!1,align:"left",anchor:"center_center",width:this.parser.parse("0"),font_size:this.parser.parse(""+this.fieldFontSize),font_family:this.font_family,italics:this.italics,bold:this.bold},e.name_str);this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),
0,0,!0);b=a.getTextWidth(b+"_",e.fieldFontSize+"px "+a.sansserif_font);var f=e.parent.getSpaceById(e.spaceID).h;e.labelHeight=""==x?0:c;e.fieldHeight=""==e.visible?0:c;if("v"===e.orientation)e.canvasWidth=e.w,e.canvasHeight=e.h-e.labelHeight-e.fieldHeight,18<=e.canvasHeight+e.y-f&&(e.canvasHeight=f),c=e.fieldHeight,b=c+e.canvasHeight,e.canvasX=0,e.canvasY=e.fieldHeight,e.labelWidth=e.w,e.labelY=b,e.upWidth=e.downW=e.w,e.upHeight=e.downH=e.w,e.upX=0,e.upY=e.fieldHeight,e.downX=0,e.downY=b-e.downH,
e.fieldWidth=e.w,e.fieldX=0,e.scrollHandlerW=e.w,e.scrollHandlerH=parseInt((e.canvasHeight-e.upHeight-e.downH-e.labelHeight-e.fieldHeight)/10),e.scrollHandlerH=e.canvasHeight-e.upHeight-e.downH-e.labelHeight-e.fieldHeight>2*e.w?e.w:e.scrollHandlerH,e.scrollHandlerH=15>e.scrollHandlerH?15:e.scrollHandlerH,e.limInf=b-e.downH-e.scrollHandlerH,e.limSup=c+e.downH;else{c=this.text_object.textNodes.metrics.w+parseInt(this.fieldFontSize);e.labelWidth=c;e.fieldWidth=b;""==x&&(e.labelWidth=0);e.visible||(e.fieldWidth=
0);for(b=e.w-e.fieldWidth-e.labelWidth;58>b&&0<e.labelWidth;)e.labelWidth--,b++;for(;58>b&&0<e.fieldWidth;)e.fieldWidth--,b++;c=e.labelWidth;f=c+b;e.fieldWidth=e.w-f;e.canvasWidth=b;e.canvasHeight=e.h;e.canvasX=e.labelWidth;e.canvasY=0;e.fieldX=e.canvasWidth+e.labelWidth;e.labelHeight=e.h;e.labelY=0;e.upWidth=e.downW=e.h;e.upHeight=e.downH=e.h;e.upX=f-e.downW;e.upY=0;e.downX=e.labelWidth;e.downY=0;e.scrollHandlerW=parseInt((e.canvasWidth-e.upWidth-e.downW)/10);e.scrollHandlerW=e.canvasWidth-e.upWidth-
e.downW>2*e.h?e.h:e.scrollHandlerW;e.scrollHandlerW=15>e.scrollHandlerW?15:e.scrollHandlerW;e.scrollHandlerH=e.h;e.limInf=c+e.downW;e.limSup=c+e.canvasWidth-e.downW-e.scrollHandlerW}e.container.setAttribute("style","width:"+e.w+"px;height:"+e.h+"px;left:"+e.x+"px;top:"+e.y+"px;z-index:"+e.zIndex+";");e.canvas.setAttribute("width",e.w+"px");e.canvas.setAttribute("height",e.h+"px");e.canvas.setAttribute("style","position:absolute;left:0;top:0;");e.ctx=e.canvas.getContext("2d");e.ctx.imageSmoothingEnabled=
!1;e.divUp.setAttribute("style","width:"+e.upWidth+"px;height:"+e.upHeight+"px;left:"+e.upX+"px;top:"+e.upY+"px;");e.divDown.setAttribute("style","width:"+e.downW+"px;height:"+e.downH+"px;left:"+e.downX+"px;top:"+e.downY+"px;");e.scrollHandler.setAttribute("style","width:"+e.scrollHandlerW+"px;height:"+e.scrollHandlerH+"px;left:"+("v"===e.orientation?0:e.limInf)+"px;top:"+("v"===e.orientation?e.limInf:0)+"px;");e.field.setAttribute("style","font-size:"+e.fieldFontSize+"px;width:"+e.fieldWidth+"px;height:"+
e.fieldHeight+"px;left:"+e.fieldX+"px;top:0;");e.cover.setAttribute("style","width:"+e.fieldWidth+"px;height:"+e.fieldHeight+"px;left:"+e.fieldX+"px;top:0;");0===e.fieldHeight&&(e.field.style.display="none");e.label.setAttribute("style","font-size:"+e.fieldFontSize+"px;width:"+e.labelWidth+"px;height:"+e.labelHeight+"px;line-height:"+e.labelHeight+"px;left:0;top:"+e.labelY+"px;background-color:"+this.label_color.getColor()+";color:"+this.label_text_color.getColor()+";");this.label.width=e.labelWidth*
this.ratio;this.label.height=e.labelHeight*this.ratio};y.prototype.update=function(){d=this.evaluator;0==d.eval(this.decimals)?this.incr=1:this.incr=(d.eval(this.max)-d.eval(this.min))/100;this.activeIfValue=0<d.eval(this.activeif);this.drawIfValue=0<d.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(d.getVariable(this.id));a==this.value||
0<Math.abs(a-this.value)&&1E-9>Math.abs(a-this.value)||(this.value=a,this.changeScrollPositionFromValue(),this.prePos=this.pos);this.value=a;this.field.value=this.formatOutputValue(this.value);d.setVariable(this.id,this.value);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);!(w=this.label_color.getColor())||"CanvasGradient"!==w.constructor.name&&"CanvasPattern"!==
w.constructor.name||(this.label_ctx.fillStyle=w,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)};y.prototype.draw=function(){e=this;b=e.ctx;m=h(this.w);k=h(this.h);b.fillStyle=this.color.getColor();b.fillRect(0,0,m,k);b.fillStyle="black";b.beginPath();"h"===e.orientation?(b.lineWidth=1,b.strokeStyle="rgba(0,0,0,0.3)",b.strokeRect(parseInt(e.labelWidth)+.5,.5,m-1-parseInt(e.labelWidth),k-1),b.lineWidth=Math.ceil(12*e.upWidth/100)||1,b.strokeStyle=e.colorInt.getColor(),b.moveTo(e.downX+62.215*e.upWidth/100,20*e.downH/100),b.lineTo(e.downX+
32.449*e.upWidth/100,e.downH/2),b.lineTo(e.downX+62.215*e.upWidth/100,80*e.downH/100),b.moveTo(e.upX+32.449*e.upWidth/100,20*e.downH/100),b.lineTo(e.upX+62.215*e.upWidth/100,e.downH/2),b.lineTo(e.upX+32.449*e.upWidth/100,80*e.downH/100),b.stroke(),f=h(e.pos),c=Math.ceil(k/10)||1,b.fillStyle=this.colorInt.getColor(),b.fillRect(f+.5,c,h(e.scrollHandlerW),k-2*c)):(b.lineWidth=1,b.strokeStyle="rgba(0,0,0,0.3)",b.strokeRect(.5,.5,m-1,k-parseInt(e.labelHeight)-.5),b.lineWidth=Math.ceil(12*e.upWidth/100)||
1,b.strokeStyle=e.colorInt.getColor(),b.moveTo(20*e.upWidth/100,e.h-e.labelHeight-70*e.downH/100),b.lineTo(50*e.upWidth/100,e.h-e.labelHeight-40.237*e.downH/100),b.lineTo(80*e.upWidth/100,e.h-e.labelHeight-70*e.downH/100),b.moveTo(20*e.upWidth/100,70*e.downH/100),b.lineTo(50*e.upWidth/100,40.237*e.downH/100),b.lineTo(80*e.upWidth/100,70*e.downH/100),b.stroke(),f=h(e.pos),c=Math.ceil(m/10)||1,b.fillStyle=this.colorInt.getColor(),b.fillRect(c,f+.5,m-2*c,h(e.scrollHandlerH)));e.activeIfValue||(b.fillStyle=
"rgba(255,255,255,0.5)",b.fillRect(0,0,b.canvas.width,b.canvas.height))};y.prototype.validateValue=function(a){d=this.evaluator;g=a.toString();g=parseFloat(g.replace(this.parent.decimal_symbol,"."));isNaN(g)&&(g=0);this.minimo=d.eval(this.min);g<this.minimo&&(this.value=null,g=this.minimo);this.maximo=d.eval(this.max);g>this.maximo&&(this.value=null,g=this.maximo);v=this.incr;g=0!=v?g*v/v:0;this.fixed&&(g=parseFloat(parseFloat(g).toFixed(d.eval(this.decimals))));return g};y.prototype.increase=function(){this.changeValue(parseFloat(this.value)+
this.incr)};y.prototype.decrease=function(){this.changeValue(parseFloat(this.value)-this.incr)};y.prototype.increase10=function(){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)};y.prototype.decrease10=function(){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)};y.prototype.changeValue=function(a){this.activeIfValue&&(r=this.validateValue(a),r!=this.value&&(this.value=r,this.field.value=this.formatOutputValue(r),this.changeScrollPositionFromValue(),this.prePos=this.pos,this.evaluator.setVariable(this.id,this.value)),this.updateAndExecAction())};y.prototype.changeValueForScrollMovement=function(){d=this.evaluator;u=this.limInf;z=
this.limSup;n=d.eval(this.min);l=d.eval(this.max);v=this.incr;r=h((this.pos-u)*(l-n)/(z-u)/v)*v+n;r!=this.value&&(this.value=r,this.field.value=this.formatOutputValue(r),d.setVariable(this.id,this.value),this.parent.updateControls(),this.actionExec.execute(),this.parent.update())};y.prototype.changeScrollPositionFromValue=function(){d=this.evaluator;u=this.limInf;z=this.limSup;n=d.eval(this.min);l=d.eval(this.max);v=this.incr;this.pos=(this.value-n)*(z-u)/(l-n)+u;this.scrollHandler.style["h"==this.orientation?
"left":"top"]=this.pos+"px"};y.prototype.addEvents=function(){function b(c,f,g,e){a.clearTimeout(q);(n.up||n.down||n.canvasClick)&&1E-7<Math.abs(n.value-e)&&(f.call(n),c=g?c:30,q=a.setTimeout(function(){b(c,f,!1,e)},c))}function c(c){c.preventDefault();n.whichBtn=a.whichBtn(c);"L"==n.whichBtn&&n.activeIfValue&&(n.clickPos=a.getCursorPosition(c,n.container),n.canvasClick=!0,"h"==n.orientation?n.clickPos.x<n.prePos?b(350,n.decrease10,!0,n.minimo):b(350,n.increase10,!0,n.maximo):n.clickPos.y<n.prePos?
b(350,n.increase10,!0,n.maximo):b(350,n.decrease10,!0,n.minimo))}function f(b){n.canvasClick=!1;a.clearTimeout(q)}function g(b){1==n.canvasClick&&(n.clickPos=a.getCursorPosition(b,n.container),b.preventDefault())}function e(a){n.scrollClick=!1;n.prePos=n.pos;window.removeEventListener("mouseup",e,!1);window.removeEventListener("mousemove",d,!1);a.preventDefault()}function l(a){n.scrollClick=!1;n.prePos=n.pos;window.removeEventListener("touchend",l,!1);window.removeEventListener("touchmove",d,!1);
a.preventDefault()}function d(b){var c=a.getCursorPosition(b,n.container);"h"==n.orientation?(n.pos=n.prePos-(n.initPos.x-c.x),n.pos<n.limInf&&(n.pos=n.limInf),n.pos>n.limSup&&(n.pos=n.limSup),n.scrollHandler.setAttribute("style","width:"+n.scrollHandlerW+"px;height:"+n.h+"px;left:"+n.pos+"px;top:0;")):(n.pos=n.prePos-(n.initPos.y-c.y),n.pos>n.limInf&&(n.pos=n.limInf),n.pos<n.limSup&&(n.pos=n.limSup),n.scrollHandler.setAttribute("style","width:"+n.w+"px;height:"+n.scrollHandlerH+"px;left:0;top:"+
n.pos+"px;"));n.changeValueForScrollMovement();b.preventDefault()}function h(c){c.preventDefault();n.whichBtn=a.whichBtn(c);"L"==n.whichBtn&&n.activeIfValue&&(n.up=!0,b(350,n.increase,!0,n.maximo))}function k(c){c.preventDefault();n.whichBtn=a.whichBtn(c);"L"==n.whichBtn&&n.activeIfValue&&(n.down=!0,b(350,n.decrease,!0,n.minimo))}function m(b){n.down=!1;a.clearTimeout(q);b.preventDefault()}function r(b){n.up=!1;a.clearTimeout(q);n.draw()}function p(b){n.down=!1;a.clearTimeout(q);n.draw()}var n=this,
q;n.canvas.oncontextmenu=n.divUp.oncontextmenu=n.divDown.oncontextmenu=n.label.oncontextmenu=n.field.oncontextmenu=n.scrollHandler.oncontextmenu=n.cover.oncontextmenu=function(){return!1};this.field.addEventListener("keydown",function(a){13==a.keyCode&&n.changeValue(n.field.value)});this.field.addEventListener("blur",function(a){n.drawIfValue&&n.changeValue(n.field.value,!0)});this.canvas.addEventListener("touchstart",c);this.canvas.addEventListener("mousedown",c);this.divDown.addEventListener("mouseout",
m);window.addEventListener("touchend",f);window.addEventListener("mouseup",f);this.canvas.addEventListener("touchmove",g);this.canvas.addEventListener("mousemove",g);this.scrollHandler.addEventListener("touchstart",function(b){n.activeIfValue&&(n.scrollClick=!0,n.initPos=a.getCursorPosition(b,n.container),window.addEventListener("touchend",l),window.addEventListener("touchmove",d),b.preventDefault())});this.scrollHandler.addEventListener("mousedown",function(b){n.activeIfValue&&(n.scrollClick=!0,
n.initPos=a.getCursorPosition(b,n.container),window.addEventListener("mouseup",e),window.addEventListener("mousemove",d),b.preventDefault())});this.divUp.addEventListener("touchstart",h);this.divUp.addEventListener("mousedown",h);this.divDown.addEventListener("touchstart",k);this.divDown.addEventListener("mousedown",k);this.divUp.addEventListener("mouseout",function(b){n.up=!1;a.clearTimeout(q);b.preventDefault()});this.divDown.addEventListener("mouseout",m);window.addEventListener("touchend",r);
window.addEventListener("mouseup",r);window.addEventListener("touchend",p);window.addEventListener("mouseup",p);n.cover.addEventListener("click",function(a){a=n.evaluator.eval(n.kbexp);n.activeIfValue&&n.parent.keyboard.show(n,n.kblayout,a[0][0]||0,a[0][1]||0,n.id,n.field,n.onlyText)})};a.Scrollbar=y;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,d,e=function(e,d){var b=a.Control.call(this,e,d)||this;b.controls=d.controls||!0;b.file=d.file||"";b.oldDrawIf=0;e=b.evaluator.eval(b.expresion);4==e[0].length?(b.w=e[0][2],b.h=e[0][3]):(b.w=200,b.h=28);b.audio=b.parent.getAudio(b.file);b.oldFile=b.file;"]"===b.file.charAt(b.file.length-1)&&(b.file=b.evaluator.parser.parse(b.file.substring(1,b.file.length-1)));b.autoplay&&(b.audio.setAttribute("autoplay","autoplay"),b.audio.play());b.loop&&b.audio.setAttribute("loop",
"loop");b.controls&&b.audio.setAttribute("controls","controls");b.audio.setAttribute("style","position:absolute;width:"+b.w+"px;left:"+b.x+"px;top:"+b.y+"px;z-index:"+b.zIndex+";");b.addControlContainer(b.audio);b.evaluator.setFunction(b.id+".play",function(){try{b.audio.play()}catch(k){}return 0});b.evaluator.setFunction(b.id+".pause",function(){try{b.audio.pause()}catch(k){}return 0});b.evaluator.setFunction(b.id+".stop",function(){try{b.audio.pause(),b.audio.currentTime=0}catch(k){}return 0});
b.evaluator.setFunction(b.id+".currentTime",function(a){try{b.audio.currentTime=parseFloat(a)}catch(m){}return 0});b.audio.addEventListener("timeupdate",function(){b.evaluator.setVariable(b.id+".currentTime",b.audio.currentTime);b.evaluator.setVariable(b.id+".playing",b.audio.paused?0:1);b.evaluator.setVariable(b.id+".duration",b.audio.duration)});return b};$jscomp.inherits(e,a.Control);e.prototype.init=function(){this.audio.style.left=this.x+"px";this.audio.style.top=this.y+"px";this.update()};e.prototype.update=
function(){h=this.evaluator;"string"!==typeof this.file&&(this.tmpFile=h.eval(this.file),this.oldFile!==this.tmpFile&&(this.oldFile=this.audio.src=this.tmpFile));(d=0<h.eval(this.drawif))?this.audio.style.display="block":(this.audio.style.display="none",d!==this.oldDrawIf&&this.audio.pause());this.oldDrawIf=d;this.updatePositionAndSize()};a.Audio=e;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,d,e=function(e,d){var b=a.Control.call(this,e,d)||this;b.controls=d.controls||!0;b.file=d.file||"";b.oldDrawIf=0;h=b.evaluator;e=h.eval(b.expresion);4==e[0].length?(b.w=e[0][2],b.h=e[0][3]):(b.w=null,b.h=null);e=b.file;d=e.lastIndexOf(".");-1!=d&&(e=b.file.substring(0,d));b.video=a.newHTML("video",{poster:e+".png",style:"position:absolute;overflow:hidden;left:"+b.x+"px;top:"+b.y+"px;outline:none;background:rgba(0,0,0,0);"});b.autoplay&&b.video.setAttribute("autoplay",
"autoplay");b.loop&&b.video.setAttribute("loop","loop");b.controls&&b.video.setAttribute("controls","controls");b.w&&(b.video.setAttribute("width",b.w),b.video.setAttribute("height",b.h));b.video.canPlayType("video/mp4")&&(d=a.newHTML("source",{src:e+".mp4",type:"video/mp4"}),b.video.appendChild(d));b.video.canPlayType("video/ogg")&&(d=a.newHTML("source",{src:e+".ogg",type:"video/ogg"}),b.video.appendChild(d),d=a.newHTML("source",{src:e+".ogv",type:"video/ogg"}),b.video.appendChild(d));b.video.canPlayType("video/webm")&&
(d=a.newHTML("source",{src:e+".webm",type:"video/webm"}),b.video.appendChild(d));b.addControlContainer(b.video);h.setFunction(b.id+".play",function(){try{b.video.play()}catch(k){}return 0});h.setFunction(b.id+".pause",function(){try{b.video.pause()}catch(k){}return 0});h.setFunction(b.id+".stop",function(){try{b.video.pause(),b.video.currentTime=0}catch(k){}return 0});h.setFunction(b.id+".currentTime",function(a){try{b.video.currentTime=parseFloat(a)}catch(m){}return 0});b.video.addEventListener("timeupdate",
function(a){h.setVariable(b.id+".currentTime",b.video.currentTime)});return b};$jscomp.inherits(e,a.Control);e.prototype.init=function(){this.video.style.left=this.x+"px";this.video.style.top=this.y+"px";this.update()};e.prototype.update=function(){h=this.evaluator;(d=0<h.eval(this.drawif))?this.video.style.display="block":(this.video.style.display="none",d!==this.oldDrawIf&&this.video.pause());this.oldDrawIf=d;this.updatePositionAndSize()};a.Video=e;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,d,e,q=function(e,b){var d=a.Control.call(this,e,b)||this;d.font_family=b.font_family||"Monospaced";d.style=b.style||",PLAIN,";d.font_size=b.font_size||12;typeof("number"!==d.font_size)&&(d.font_size=d.evaluator.eval(d.font_size));d.font=d.font_family+d.style+d.font_size;d.region="interior";d.tabindex=++d.parent.tabindex;if(d.answer){d.answer.match("krypto_")&&(d.answer=(new a.Krypto).decode(d.answer.substring(7)));var h=d.parent.lessonParser.parseText(d.answer)}d.containerControl=
a.newHTML("div",{class:"DescartesTextAreaContainer",id:d.id,spellcheck:"false"});d.textArea=a.newHTML("textarea",{class:"DescartesTextAreaContainer",spellcheck:"false"});d.textAreaAnswer=a.newHTML("div",{class:"DescartesTextAreaContainer"});d.showButton=a.newHTML("div",{class:"DJS_Gradient"});d.activeCover=a.newHTML("div");d.containerControl.appendChild(d.textArea);d.containerControl.appendChild(d.textAreaAnswer);d.containerControl.appendChild(d.showButton);d.containerControl.appendChild(d.activeCover);
d.cover=a.newHTML("div",{class:"TextfieldCover"});d.keyboard&&d.containerControl.appendChild(d.cover);d.addControlContainer(d.containerControl);d.showAnswer=!1;d.text=d.rawText||"";h&&"simpleText"!==h.type&&(d.answer=d.text.hasFormula?"":h.toHTML());d.evaluator.setVariable(d.id,d.text);var c;d.evaluator.setFunction(d.id+".insertAtCursor",function(a){c=d.textArea.selectionStart+a.length;d.textArea.value=d.textArea.value.substring(0,d.textArea.selectionStart)+a+d.textArea.value.substring(d.textArea.selectionEnd);
d.textArea.selectionStart=d.textArea.selectionEnd=c;d.textArea.focus();return 0});d.evaluator.setFunction(d.id+".update",function(){d.update()});d.addEvents();d.init();return d};$jscomp.inherits(q,a.Control);q.prototype.init=function(){d=this.answer?28:4;h=this.evaluator;var e=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+";");var b="padding:5px;width:"+(this.w-4)+"px;height:"+
(this.h-d)+"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",b);this.textArea.value=e;this.textAreaAnswer.setAttribute("style",b+"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()};q.prototype.update=function(){h=this.evaluator;this.activeIfValue=0<h.eval(this.activeif);
this.drawIfValue=0<h.eval(this.drawif);h.getVariable(this.id)!==this.oldValue&&(this.textArea.value=(h.getVariable(this.id)||"").replace(/\\n/g,"\n"));e=this.textArea.value||"";e="\n"===e.charAt(e.length-1)?e.substring(0,e.length-1):e;e=e.replace(/\n/g,"\\n").replace(/\s/g," ");h.setVariable(this.id,e);this.oldFieldValue=e;this.oldValue=h.getVariable(this.id);this.activeCover.style.display=this.activeIfValue?"none":"block";this.containerControl.style.display=this.drawIfValue?"block":"none";this.updatePositionAndSize()};
q.prototype.changeValue=function(a){this.textArea.value=a;this.update()};q.prototype.addEvents=function(){function a(a){a.preventDefault()}var b=this;b.cover.oncontextmenu=function(){return!1};b.showButton.addEventListener("mousedown",function(a){a.preventDefault();b.showAnswer=!b.showAnswer;b.textAreaAnswer.style.display=b.showAnswer?"block":"none";b.showButton.childNodes[0].childNodes[0].textContent=b.showAnswer?"T":"S"});b.showButton.addEventListener("mouseup",a);b.showButton.addEventListener("mouseout",
a);b.textArea.addEventListener("blur",function(){var a=window.getSelection();b.cursorInd=a.focusOffset});b.textArea.addEventListener("paste",function(a){a.preventDefault();document.execCommand("insertHTML",!1,a.clipboardData.getData("text/plain").replace(/\n/g,"<br>"))});b.textArea.addEventListener("keydown",function(a){if("PageDown"===a.key||"PageUp"===a.key)a.stopPropagation(),a.preventDefault()});b.cover.addEventListener("pointerdown",function(a){a=b.evaluator.eval(b.kbexp);b.activeIfValue&&b.parent.keyboard.show(b,
b.kblayout,a[0][0]||0,a[0][1]||0,b.id,b.textArea,!0)})};a.TextArea=q;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=2*Math.PI,d,e,q,p,b,k,m,c,f,g,v,r,u=function(b,c){var f=a.Control.call(this,b,c)||this;e=b.evaluator.parser;f.spaceID=c.spaceID||"";f.text=c.text||"";f.size=c.size||e.parse("4");f.font=c.font||"Serif,PLAIN,12";f.image=new Image;f.image.onload=function(){this.ready=1};f.imageSrc=c.imageSrc||"";f.imageSrc.match(/^\[.*\]?/)?f.imageSrc=f.parser.parse(f.imageSrc.substring(1,f.imageSrc.length-1)):f.imageSrc=f.parser.parse("'"+f.imageSrc+"'");f.font=a.convertFont(f.font);
if(f.constraintExpr){f.constraint=e.parse(f.constraintExpr);"(expr)"==f.constraint.type&&(f.constraint=e.parse(f.constraintExpr.substring(1,f.constraintExpr.length-1)));if("compOperator"==f.constraint.type){c=f.constraint.childs[0];var d=f.constraint.childs[1];"identifier"!=c.type||"y"!=c.value||d.contains("y")?"identifier"!=c.type||"x"!=c.value||d.contains("x")?f.newt=new a.R2Newton(f.evaluator,f.constraint):(f.constVar="y",f.noConstVar="x",f.evalConst=f.evalConstXoY,f.constraint=d):(f.constVar=
"x",f.noConstVar="y",f.evalConst=f.evalConstXoY,f.constraint=d)}else f.constraint=null;g=new a.R2(0,0)}f.container=f.getContainer();f.mouseCatcher=a.newHTML("div",{class:"DescartesGraphicControl",id:f.id,dragged:!0,tabindex:"-1",style:"cursor:pointer;background-color:transparent;z-index:"+f.zIndex+";"});f.ctx=f.space.ctx;f.container.appendChild(f.mouseCatcher);f.addEvents();f.xStr=f.id+".x";f.yStr=f.id+".y";f.activoStr=f.id+".activo";f.activeStr=f.id+".active";""!==f.space.id&&2!==b.version?(f.mX=
f.space.id+".mouse_x",f.mY=f.space.id+".mouse_y",f.mClicked=f.space.id+".mouse_clicked",f.mClicIzq=f.space.id+".clic_izquierdo"):(f.mX="mouse_x",f.mY="mouse_y",f.mClicked="mouse_clicked",f.mClicIzq="clic_izquierdo");f.init();return f};$jscomp.inherits(u,a.Control);u.prototype.init=function(b){d=this.evaluator;v=a.hasTouchSupport;b||(b=d.eval(this.expresion),this.x=b[0][0],this.y=b[0][1],d.setVariable(this.xStr,this.x),d.setVariable(this.yStr,this.y));this.img_src_eval=d.eval(this.imageSrc).toString().trim();
""==this.img_src_eval||this.img_src_eval.toLowerCase().match(/vacio.gif$/)?(this.width=2*d.eval(this.size),this.height=2*d.eval(this.size),this._w=v&&48>this.width?48:this.width,this._h=v&&48>this.height?48:this.height,this.mouseCatcher.style.borderRadius=parseInt(Math.min(this._w,this._h)/2)+"px"):(this.image=this.parent.getImage(this.img_src_eval),this.width=this.image.width,this.height=this.image.height,this._w=Math.max(this.width,32),this._h=Math.max(this.height,32));this.mouseCatcher.style.width=
this._w+"px";this.mouseCatcher.style.height=this._h+"px";this.mouseCatcher.style.left=parseInt(this.space.getAbsoluteX(this.x)-this._w/2)+"px";this.mouseCatcher.style.top=parseInt(this.space.getAbsoluteY(this.y)-this._h/2)+"px";d.setVariable(this.activoStr,0);d.setVariable(this.activeStr,0);this.setImage=!1;this.update()};u.prototype.update=function(){d=this.evaluator;d.eval(this.imageSrc).toString().trim()!==this.img_src_eval&&this.init(!0);this.activeIfValue=0<d.eval(this.activeif);this.drawIfValue=
0<d.eval(this.drawif);this.x=d.getVariable(this.xStr);this.y=d.getVariable(this.yStr);q=this.space.getAbsoluteX(this.x);p=this.space.getAbsoluteY(this.y);this.mouseCatcher.style.display=this.activeIfValue?"block":"none";this.mouseCatcher.style.left=parseInt(q-this._w/2)+"px";this.mouseCatcher.style.top=parseInt(p-this._h/2)+"px";this.constraint&&this.evalConst();this.draw()};u.prototype.draw=function(){d=this.evaluator;this.drawIfValue&&(c=this.ctx,f=this.space.backgroundCtx,q=parseInt(this.space.getAbsoluteX(this.x))+
.5,p=parseInt(this.space.getAbsoluteY(this.y))+.5,""!=this.text&&this.drawText(q,p),this.image.ready?(b=this.image.width/2,k=this.image.height/2,this.image.complete&&!this.setImage&&c.drawImage(this.image,parseInt(q-b),parseInt(p-k)),this.trace&&(f.save(),f.translate(q,p),f.scale(parseInt(b),parseInt(k)),f.beginPath(),f.arc(0,0,1,0,h),f.restore(),f.lineWidth=1,f.strokeStyle=this.trace.getColor(),f.stroke())):(b=parseInt(this.width/2),c.beginPath(),c.arc(q,p,b,0,h),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(q,p,b-2,0,h),c.stroke()),this.trace&&(f.strokeStyle=this.trace.getColor(),f.beginPath(),f.arc(q,p,b,0,h),f.stroke())))};u.prototype.evalConst=function(){g.set(this.x,this.y);m=this.newt.findZero(g,1/this.space.scale,!0);this.x=m.x;this.y=m.y;this.evaluator.setVariable(this.xStr,this.x);this.evaluator.setVariable(this.yStr,this.y)};u.prototype.evalConstXoY=
function(){d=this.evaluator;r=d.getVariable(this.constVar);d.setVariable(this.constVar,this[this.constVar]);this[this.noConstVar]=d.eval(this.constraint);d.setVariable(this.xStr,this.x);d.setVariable(this.yStr,this.y);d.setVariable(this.constVar,r)};u.prototype.drawText=function(a,b){c=this.ctx;d=this.evaluator;"simpleText"==this.text.type?(c.fillStyle=this.color.getColor(),c.font=this.font,c.textBaseline="alphabetic",c.fillText(this.text.toString(d.eval(this.decimals),this.fixed),parseInt(a+1+this.width/
2),parseInt(b-1-this.height/2))):(c.fillStyle=this.color.getColor(),c.strokeStyle=this.color.getColor(),c.textBaseline="alphabetic",this.text.draw(c,parseInt(a+1+this.width/2),parseInt(b-1-this.height/2),this.decimals,this.fixed,"start",!0,this.color.getColor()))};u.prototype.getContainer=function(){for(var a=this.parent.spaces,b,c=0,f=a.length;c<f;c++)if(b=a[c],b.id==this.spaceID)return b.addCtr(this),this.zIndex=b.zIndex,this.space=b,b.graphicControlContainer;a[0].addCtr(this);this.zIndex=a[0].zIndex;
this.space=a[0];return a[0].graphicControlContainer};u.prototype.deactivate=function(){this.active=!1;this.evaluator.setVariable(this.activoStr,0);this.evaluator.setVariable(this.activeStr,0);this.evaluator.setVariable(this.mClicIzq,0)};u.prototype.addEvents=function(){function b(b){document.body.focus();b.preventDefault();d.whichBtn=a.whichBtn(b);"L"==d.whichBtn&&d.activeIfValue&&(d.parent.deactivateControls(),d.click=d.active=!0,d.evaluator.setVariable(d.activoStr,1),d.evaluator.setVariable(d.activeStr,
1),d.evaluator.setVariable(d.mClicked,0),d.evaluator.setVariable(d.mClicIzq,0),d.posAnte=a.getCursorPosition(b,d.container),d.prePos={x:d.space.getAbsoluteX(d.x),y:d.space.getAbsoluteY(d.y)},d.evaluator.setVariable(d.mX,d.space.getRelativeX(d.posAnte.x)),d.evaluator.setVariable(d.mY,d.space.getRelativeY(d.posAnte.y)),d.parent.update(),window.addEventListener("touchend",c),window.addEventListener("touchmove",f),window.addEventListener("mouseup",c),window.addEventListener("mousemove",f))}function c(b){document.body.focus();
b.preventDefault();b.stopPropagation();d.evaluator.setVariable(d.mClicked,1);d.evaluator.setVariable(d.mClicIzq,1);if(d.activeIfValue||d.active)d.click=!1,window.removeEventListener("mouseup",c),window.removeEventListener("mousemove",f),window.removeEventListener("touchend",c),window.removeEventListener("touchmove",f),g=a.getCursorPosition(b,d.container)||g,d.posX=d.prePos.x-(d.posAnte.x-g.x),d.posY=d.prePos.y-(d.posAnte.y-g.y),d.evaluator.setVariable(d.xStr,d.space.getRelativeX(d.posX)),d.evaluator.setVariable(d.yStr,
d.space.getRelativeY(d.posY)),d.evaluator.setVariable(d.mX,d.space.getRelativeX(g.x)),d.evaluator.setVariable(d.mY,d.space.getRelativeY(g.y)),d.parent.updateControls(),d.parent.update(),d.mouseCatcher.style.left=d.space.getAbsoluteX(d.x)-d._w/2+"px",d.mouseCatcher.style.top=d.space.getAbsoluteY(d.y)-d._h/2+"px";b=d.evaluator.getVariable(d.activeStr);d.parent.deactivateControls();d.parent.updateControls();d.evaluator.setVariable(d.activoStr,b);d.evaluator.setVariable(d.activeStr,b);d.parent.update()}
function f(b){b.preventDefault();d.evaluator.setVariable(d.mClicked,0);d.evaluator.setVariable(d.mClicIzq,0);g=a.getCursorPosition(b,d.container);d.posX=d.prePos.x-(d.posAnte.x-g.x);d.posY=d.prePos.y-(d.posAnte.y-g.y);d.evaluator.setVariable(d.xStr,d.space.getRelativeX(d.posX));d.evaluator.setVariable(d.yStr,d.space.getRelativeY(d.posY));d.evaluator.setVariable(d.mX,d.space.getRelativeX(g.x));d.evaluator.setVariable(d.mY,d.space.getRelativeY(g.y));80<Date.now()-e&&(d.parent.updateControls(),d.parent.update(),
e=Date.now())}var e=0,g,d=this;this.active=this.over=this.click=!1;this.mouseCatcher.oncontextmenu=function(){return!1};this.mouseCatcher.addEventListener("touchstart",b);this.mouseCatcher.addEventListener("mousedown",b);this.mouseCatcher.addEventListener("mouseover",function(a){d.over=!0});this.mouseCatcher.addEventListener("mouseout",function(a){d.over=!1;d.click=!1})};a.GraphicControl=u;return a}(descartesJS||{});
descartesJS=function(a,h){var d,e,q,p,b,k,m,c,f,g;function v(a){return a.charAt(0).toUpperCase()+a.substring(1)}if(a.loadLib)return a;var r=/[\w-//]*(\.png|\.jpg|\.gif|\.svg|\.webp)/gi,u,z,n,l,x,w,y,A,E,J,F,G,D,B,L,H,M,P,I,O,C,Q,K,R,N,S,W,V,U,T=function(b){this.parent=b;this.parser=b.evaluator.parser;this.RTFparser=new a.RTFParser(b.evaluator)};T.prototype.parseButtonsConfig=function(a){var b={rowsNorth:0,rowsSouth:0,widthEast:125,widthWest:125,height:23};a=this.split(a);for(var c=0,f=a.length;c<
f;c++)switch(n=a[c][0],l=a[c][1],z=h[n],z){case "rowsNorth":case "rowsSouth":case "widthEast":case "widthWest":case "height":b[z]=parseInt(l);break;case "about":case "config":case "init":case "clear":b[z]="true"===h[l];break;default:console.warn("Propiedad de botones no identificada: <"+n+"> valor: <"+l+">")}return b};T.prototype.parseSpace=function(b){x={};b=this.split(b);for(var c=0,f=b.length;c<f;c++)switch(n=b[c][0],l=b[c][1],z=h[n],a.DEBUG.paramName=n,a.DEBUG.objectName="Space",z){case "type":if("R2"===
l||"R3"===l)l=h[l];x[z]=l;break;case "id":a.DEBUG.idName=l;case "x_axis":case "y_axis":case "cID":case "file":case "border_width":case "border_radius":case "info":x[z]=l;break;case "fixed":case "numbers":case "sensitive_to_mouse_movements":case "3D":case "split":case "resizable":x[z]="true"===h[l];break;case "bg_display":case "render":x[z]=h[l];break;case "border_color":case "net":case "net10":case "axes":case "text":x[z]=""!=l?"false"===h[l]?"":new a.Color(l,this.parent.evaluator):"";break;case "O.x":x.OxExpr=
l;break;case "O.y":x.OyExpr=l;break;case "image":x.imageSrc=l;break;case "x":u=l;"%"===u[u.length-1]?(x.xPercentExpr=u.trim(),u=(this.parent.container.width*parseFloat(u)/100).toString()):u=l;x.xExpr=this.parser.parse(u);break;case "y":u=l;"%"===u[u.length-1]?(x.yPercentExpr=u.trim(),u=(this.parent.container.height*parseFloat(u)/100).toString()):u=l;x.yExpr=this.parser.parse(u);break;case "width":u=l.trim();x.wModExpr=u;"%"===u[u.length-1]?(x.wExpr=u,u=this.parent.container.width*parseFloat(u)/100):
(u=parseFloat(l),u!=l&&(u=this.parent.container.width,x._w_=l.trim()));x.w=u;break;case "height":u=l.trim();x.hModExpr=u;"%"===u[u.length-1]?(x.hExpr=u,u=this.parent.container.height*parseFloat(u)/100):(u=parseFloat(l),u!=l&&(u=this.parent.container.height,x._h_=l.trim()));x.h=u;break;case "drawif":""!=l&&(x.drawif=this.parser.parse(l));break;case "scale":u=parseFloat(l);isNaN(u)&&(u=48);x.scale=u;break;case "background":x.background=new a.Color(l,this.parent.evaluator);break;default:console.warn("Propiedad del espacio no identificada: <"+
n+"> valor: <"+l+">")}return new a["Space"+x.type](this.parent,x)};T.prototype.parseControl=function(b){w={type:"Numeric",gui:"Spinner"};b=this.split(b);for(var c=0,f=b.length;c<f;c++)switch(n=b[c][0],l=b[c][1],z=h[n],a.DEBUG.paramName=n,a.DEBUG.objectName="Control",z){case "type":u=h[l.trim()];"graphic"===u?u="GraphicControl":"text"===u&&(u="TextArea");w.type=v(u);break;case "gui":u=h[l];"textfield"===u&&(u="TextField");w[z]=v(u);break;case "id":a.DEBUG.idName=l;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":w[z]=
l;break;case "region":case "position":case "action":case "msg_pos":case "poster":case "text_align":case "image_align":case "btn_pos":w[z]=h[l];break;case "fixed":case "visible":case "discrete":case "onlyText":case "evaluate":case "autoplay":case "loop":case "controls":case "flat":case "keyboard":w[z]="true"===h[l];break;case "color":case "colorInt":case "label_color":case "label_text_color":case "trace":w[z]=new a.Color(l,this.parent.evaluator);break;case "font_size":case "drawif":case "activeif":case "decimals":case "min":case "max":case "size":""!==
l&&(w[z]=this.parser.parse(l));break;case "constraint":w.constraintExpr=l;break;case "image":w.imageSrc=l;break;case "image_dec":w.image_dec_src=l;break;case "image_inc":w.image_inc_src=l;break;case "space":w.spaceID=l;break;case "expresion":w.expresion=this.parser.parse(l.replace(")(",","));case "kbexp":w.kbexp=this.parser.parse(l.replace(")(",","));break;case "borderColor":w[z]="false"===h[l]?"":l;break;case "bold":"false"!=h[l]&&(w.bold="bold");break;case "italics":"false"!=h[l]&&(w.italics="italic");
break;case "underlined":"false"!=h[l]&&(w.underlined=!0);break;case "value":var g=l.replace(/&squot;/g,"'");g.match(/^\|/)&&(g="'"+g.substring(1),g.match(/\|$/)&&(g=g.substring(0,g.length-1)+"'"));w.valueExpr=this.parser.parse(g);w.valueExprString=g;break;case "incr":0!=l&&(w.incr=this.parser.parse(l));break;case "exponentialif":w.exponentialif=parseFloat(l);break;case "text":w.rawText=l;g=this.parseText(l);for(var e=0,d=g.length;e<d;e++)g[e]=this.parser.parse(g[e],!1);w.text=g;break;default:e=n.indexOf("."),
g=h[n.substring(0,e)],e=h[n.substring(e+1)],"parameter"===g&&"font"===e?w.parameterFont=l:"Explanation"===g&&"font"===e?w.ExplanationFont=l:"tooltip"===g&&"font"===e?w.tooltipFont=l:console.warn("Propiedad de control no identificada: <"+n+"> valor: <"+l+">")}return new a["Numeric"===w.type?w.gui:w.type](this.parent,w)};T.prototype.parseGraphic=function(b,c,f,g){y={rotateExp:g,parameter:"t"};b=this.split(b);g=0;for(var e=b.length;g<e;g++)if(n=b[g][0],l=b[g][1],z=h[n],a.DEBUG.paramName=n,a.DEBUG.objectName=
"Graphic",""!=l)switch(z){case "type":a.DEBUG.idName=l;y[z]=v(h[l]);break;case "align":case "anchor":case "lineDash":y[z]=h[l];break;case "background":case "abs_coord":case "visible":case "editable":case "fixed":case "vectors":case "bold":case "italics":case "underlined":y[z]="true"===h[l];break;case "shadowColor":case "color":case "fill":case "fillP":case "fillM":case "arrow":case "trace":y[z]="false"===h[l]?"":new a.Color(l,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]=
l;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":""!==l&&(y[z]=this.parser.parse(l));break;case "font_size":l=l.trim();l.match(/^\[.*\]?/)&&(l=l.substring(1,l.length-1));""!==l&&(y[z]=this.parser.parse(l));break;case "space":y.spaceID=l;break;case "expresion":""!==l&&("Macro"!==y.type?(y.expresion=this.parser.parse(l),y.expresionString=l):y.expresion=l);break;
case "text":y.text=l;break;case "file":var d=l.replace(/&squot;/g,"'").trim();"["===d.charAt(0)&&"]"===d.charAt(d.length-1)&&(d=d.substring(1,d.length-1));d.match(r)&&(d="'"+d+"'");y.file=this.parser.parse(d);break;case "border":""!=l&&"false"!=h[l]&&(y.border=new a.Color(l,this.parent.evaluator));break;default:if(void 0!=y.family&&n.substring(0,y.family.length+1)===y.family+".")switch(h[n.substring(y.family.length+1)]){case "interval":""!=l&&(y.family_interval=this.parser.parse(l));break;case "steps":""!=
l&&(y.family_steps=this.parser.parse(l))}else if(void 0!=y.parameter&&n.match(y.parameter+"."))switch(y.parameter!==n.substring(0,n.indexOf(y.parameter)+y.parameter.length)&&(y.parameter=n.substring(0,n.indexOf(y.parameter)+y.parameter.length)),h[n.substring(y.parameter.length+1)]){case "interval":""!=l&&(y.parameter_interval=this.parser.parse(l));break;case "steps":""!=l&&(y.parameter_steps=this.parser.parse(l))}else console.warn("Propiedad del gr\u00e1fico no identificada: <"+n+"> valor: <"+l+">")}c&&
(y.abs_coord=c);f&&(y.background=f);return new a[y.type](this.parent,y)};T.prototype.parse3DGraphic=function(b,c,f,g){y={rotateExp:g,parameter:"t"};b=this.split(b);c=0;for(f=b.length;c<f;c++)switch(n=b[c][0],l=b[c][1],z=h[n],a.DEBUG.paramName=n,a.DEBUG.objectName="Graphic3D",z){case "type":a.DEBUG.idName=l;u=h[l];switch(u){case "cube":case "box":case "tetrahedron":case "octahedron":case "sphere":case "dodecahedron":case "icosahedron":case "ellipsoid":case "cone":case "cylinder":case "torus":case "mesh":y.subType=
u,u="OtherGeometry"}y[z]=v(u);break;case "model":case "align":case "anchor":case "lineDash":y[z]=h[l];break;case "shadowColor":case "fill":y[z]="false"===h[l]?"":new a.Color(l,this.parent.evaluator);break;case "background":case "fixed":case "split":case "bold":case "italics":case "underlined":y[z]="true"===h[l];break;case "edges":"false"===h[l]?y[z]="":("true"===h[l]&&(l="808080"),y[z]=new a.Color(l,this.parent.evaluator));break;case "border":""!=l&&"false"!=h[l]&&(y.border=new a.Color(l,this.parent.evaluator));
break;case "color":case "backcolor":y[z]=new a.Color(l,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":""!=l&&(y[z]=this.parser.parse(l));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]=
l;break;case "space":y.spaceID=l;break;case "expresion":"Macro"!=y.type&&"Curve"!=y.type&&"Surface"!=y.type?(y.expresion=this.parser.parse(l),y.expresionString=l):y.expresion=l.replace(/\\n/g,";");break;case "text":y.text=l;break;case "file":g=l.replace(/&squot;/g,"'");"["===g.charAt(0)&&"]"===g.charAt(g.length-1)&&(g=g.substring(1,g.length-1));g.match(/./)&&(g="'"+g+"'");y.file=this.parser.parse(g);break;default:void 0!==y.family&&n.substring(0,y.family.length+1)===y.family+"."?"interval"===h[n.substring(y.family.length+
1)]?""!=l&&(y.family_interval=this.parser.parse(l)):""!=l&&(y.family_steps=this.parser.parse(l)):console.warn("Propiedad del gr\u00e1fico 3D no identificada: <"+n+"> valor: <"+l+">")}return new a[y.type+"3D"](this.parent,y)};T.prototype.parseAuxiliar=function(b){A={};b=this.split(b);for(var c=0,f=b.length;c<f;c++)b[c][1]=b[c][1].replace(/&squot;/g,"'");c=0;for(f=b.length;c<f;c++)switch(n=b[c][0],l=b[c][1],z=h[n],a.DEBUG.paramName=n,a.DEBUG.objectName="Auxiliar",z){case "info":case "code":case "doc":break;
case "id":a.DEBUG.idName=l;case "file":case "init":case "doExpr":case "whileExpr":case "range":case "local":case "expresion":case "condition":case "parameter":A[z]=l.replace(/&squot;/g,"'");break;case "editable":case "constant":case "array":case "matrix":case "algorithm":case "event":case "sequence":A[z]="true"===h[l];break;case "size":case "rows":case "columns":case "x":case "y":case "width":case "height":A[z]=this.parser.parse(l);break;case "evaluate":case "execution":case "msg_pos":case "action":case "type":A[z]=
h[l];break;default:var g=n.indexOf("."),e=h[n.substring(0,g)];g=h[n.substring(g+1)];"parameter"===e&&"font"===g?A.parameterFont=l:console.warn("Propiedad del auxiliar no identificada: <"+n+"> valor: <"+l+">")}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":b=new a.Constant(this.parent,A);A.evaluate&&"always"===A.evaluate&&this.parent.auxiliaries.push(b);break;case "algorithm":this.parent.auxiliaries.push(new a.Algorithm(this.parent,A));break;case "vector":b=new a.Vector(this.parent,A);A.evaluate&&"always"===A.evaluate&&this.parent.auxiliaries.push(b);break;
case "matrix":b=new a.Matrix(this.parent,A);A.evaluate&&"always"===A.evaluate&&this.parent.auxiliaries.push(b);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)}};T.prototype.parseAction=function(b){E=b.action;J=b.parent;F=b.parameter;return E?new (a[v(E)])(J,F):{execute:function(){}}};T.prototype.parseAnimation=function(b){var c={};
b=this.split(b);for(var f=0,g=b.length;f<g;f++)switch(n=b[f][0],l=b[f][1],z=h[n],z){case "id":case "delay":case "init":case "doExpr":case "whileExpr":c[z]=l.replace(/&squot;/g,"'");break;case "controls":case "auto":case "loop":case "algorithm":case "evaluate":c[z]="true"===h[l];break;default:console.warn("Propiedad de la animaci\u00f3n no identificada: <"+n+">  <"+l+">")}return new a.Animation(this.parent,c)};T.prototype.parsePleca=function(h,r){h=this.split(h);e=d="";q=0;p="#536891";b="white";k=
"left";m="";c="SansSerif,BOLD,20";f="SansSerif,PLAIN,18";g=void 0;for(var u=0,v=h.length;u<v;u++)switch(n=h[u][0],l=h[u][1],n){case "title":d=l;break;case "subtitle":e=l;break;case "subtitlines":q=l;break;case "bgcolor":""!=l&&(p=(new a.Color(l,this.parent.evaluator)).getColor());break;case "fgcolor":""!=l&&(b=(new a.Color(l,this.parent.evaluator)).getColor());break;case "align":""!=l&&(k=l);break;case "titleimage":m=l;break;case "titlefont":c=""!=l?a.convertFont(l):a.convertFont(c);break;case "subtitlefont":f=
""!=l?a.convertFont(l):a.convertFont(f);break;default:console.warn("Propiedad de la pleca no identificada: <"+n+">  <"+l+">")}if(""===d&&""===e)return a.newHTML("div");P=f.substring(0,f.indexOf("px"));P=P.substring(P.lastIndexOf(" "));""!=m&&(I=this.parent.getImage(m),O=I.height);g=a.newHTML("div",{id:"descartesPleca"});O?(g.setAttribute("style","position:absolute;left:0;top:0;text-align:"+k+";width:"+r+"px;height:"+O+"px;background-color:"+p+";color:"+b+";padding-top:8px;padding:8px 15px 8px 15px;margin:0;overflow:hidden;z-index:1;"),
I.setAttribute("style","position: absolute;left:0;top:0;z-index:-1;width:100%;height:100%;"),g.appendChild(I)):g.setAttribute("style","position:absolute;left:0;top:0;text-align:"+k+";width:"+r+"px;background:"+p+";color:"+b+";padding:12px 15px 12px 15px;margin:0;z-index:100;");C=a.newHTML("div",{style:"padding:0;margin:0;font:"+c+";overflow:hidden;white-space:nowrap;"});C.innerHTML=d;Q=a.newHTML("div");if(1===parseInt(q)){W=0;K=a.newHTML("div");K.innerHTML=e;document.body.appendChild(K);N=P;do N-=
W,K.setAttribute("style","padding:0;margin:0;font:"+f+";font-size:"+N+"px;width:"+(r-30)+"px;line-height:"+N+"px;"),R=K.offsetHeight,S=R/N,W=1;while(1<S&&8<N);document.body.removeChild(K);Q.setAttribute("style","padding:0;margin:0;font:"+f+";font-size:"+N+"px;line-height:1em;overflow:hidden;white-space:nowrap;")}else Q.setAttribute("style","padding:0;margin:0;font:"+f+";line-height:1em;");Q.innerHTML=e;g.appendChild(C);g.appendChild(Q);g.imageHeight=O;return g};T.prototype.split=function(a){if("string"!==
typeof a)return[];G=[];a=(a||"").replace(/\\'/g,"\u2019");D=B=H=0;for(L=M=!1;D<a.length;)" "!==a.charAt(D)||L||D++," "===a.charAt(D)||L||(L=!0,H=D),"="!==a.charAt(D)||"'"!==a.charAt(D+1)||M||(M=!0,G[B]=[a.substring(H,D)],H=D+2,D+=2),M&&"'"===a.charAt(D)&&(L=M=!1,G[B].push(a.substring(H,D)),B++),"="!==a.charAt(D)||"'"===a.charAt(D+1)||M||(G[B]=[a.substring(H,D)],H=D+1,D++,V=a.substring(D).indexOf("="),-1===V?U=V=a.length:(V+=D,U=a.substring(D,V).lastIndexOf(" "),U=-1===U?a.length:U+D),G[B].push(a.substring(H,
U)),B++,L=!1,D=U),D++;return G};T.prototype.parseText=function(b){b=b||"";return b.match(/^\{\\rtf1/)?this.RTFparser.parse(b.substring(10)):new a.SimpleText(this.parent,b)};a.LessonParser=T;return a}(descartesJS||{},babel);
descartesJS=function(a){function h(a,c){if(0==c)return 1;if(0>c)return NaN;if(0<=a||b(c)===c)return Math.pow(a,c);if(0>a){var f=1/c,g=b(f);if(g===f&&1===g%2)return-Math.pow(-a,c)}return NaN}function d(a,b){z=[];z.type="matrix";z.rows=a;z.cols=b;l=0;for(x=b;l<x;l++)z[l]=Array(a).fill(0);return z}function e(a,b){r=a.rows;u=a.cols;z=d(r,u);var c;for(l=0;l<r;l++)for(n=0;n<u;n++){for(x=c=0;x<u;x++)c+=a[x][l]*b[n][x];z[n][l]=c}return z}function q(a,b,c){for(var f=d(c.length-1,c.length-1),g=0,e=f.length;g<
e;g++)for(var l=0;l<e;l++)f[g][l]=g<a?l<b?c[g][l]:c[g][l+1]:g<b?c[g+1][l]:c[g+1][l+1];return f}function p(a){if(1<a.cols){for(var b=0,c=1,f=0,g=a.cols;f<g;f++)b+=c*a[0][f]*p(q(0,f,a)),c=-c;return b}return a[0][0]}if(a.loadLib)return a;var b=Math.floor,k={},m,c,f,g,v,r,u,z,n,l,x,w=function(a,b){this.sep="";this.type=a;this.value=b;this.parent=null;this.childs=[]};w.prototype.getRoot=function(){return null===this.parent?this:this.parent.getRoot()};w.prototype.addChild=function(a){a.parent=this;this.childs.push(a)};
w.prototype.replaceLastChild=function(a){f=this.childs.length-1;c=this.childs[f];c.parent=null;this.childs[f]=a;a.parent=this;return a};w.prototype.contains=function(a){if(this.value===a)return!0;for(var b=0,c=this.childs.length;b<c;b++)if(this.childs[b].contains(a))return!0;return!1};w.prototype.equalToMinus=function(){return"compOperator"===this.type?(this.type="operator",this.value="-",v=new w("compOperator","=="),v.addChild(this),v.addChild(new w("number","0")),g=this.getRoot(),g.setAllEvalFun(),
g):this};w.prototype.getChildren=function(){if("(expr)"===this.type||"[expr]"===this.type){if(this.childArray)return this.childArray;this.childArray=[];for(var a=0,b=this.childs.length;a<b;a++)if("square_bracket"===this.childs[a].type||"parentheses"===this.childs[a].type)this.childArray=this.childArray.concat(this.childs[a].childs);return this.childArray}return null};w.prototype.setAllEvalFun=function(){this.setEvalFun();for(var a=0,b=this.childs.length;a<b;a++)this.childs[a].setAllEvalFun()};w.prototype.setEvalFun=
function(){if("number"===this.type)this.evaluate=function(){return parseFloat(this.value)};else if("string"===this.type)this.evaluate=function(){return this.value.replace(/\\u0027/g,"'")};else if("identifier"===this.type&&0===this.childs.length)if("rnd"===this.value)this.evaluate=function(){return Math.random()};else{var c;this.evaluate=function(a,b){c=a.variables[this.value];if("object"===typeof c&&void 0==c.length)return c.evaluate(a);void 0==c&&(b||a.matrices[this.value]?c=a.matrices[this.value]:
a.vectors[this.value]&&(c=a.vectors[this.value]));return void 0!==c?c:0}}else if("identifier"===this.type&&"square_bracket"===this.childs[0].type&&1===this.childs[0].childs.length){var f;this.evaluate=function(a){try{return f=a.getVector(this.value,this.childs[0].childs[0].evaluate(a)),void 0!==f?f:0}catch(M){return 0}}}else if("identifier"===this.type&&"square_bracket"===this.childs[0].type&&1<this.childs[0].childs.length)this.evaluate=function(a){try{return f=a.getMatrix(this.value,this.childs[0].childs[0].evaluate(a),
this.childs[0].childs[1].evaluate(a)),void 0!==f?f:0}catch(M){return 0}};else if("identifier"===this.type&&"parentheses"===this.childs[0].type){var g,v,x;this.evaluate=function(a){g=[];for(var b=0,c=this.childs[0].childs.length;b<c;b++)g[b]=this.childs[0].childs[b].evaluate(a);if("_Eval_"===this.value){m=0<g.length?g[0]:0;if("number"==typeof m)return"NaN";m.match(",")&&parseFloat(m.replace(",","."))==m.replace(",",".")&&(m=m.replace(",","."));if(void 0==k[m]){v=m.match(/:=/g)?!0:!1;if(m.match(";")){var f=
!1,e=[],d=0;b=0;for(c=m.length;b<c;b++){var l=m.charAt(b);"'"===l&&(f=!f);f||";"!==l||(e.push(m.substring(d,b)),d=b+1)}e.push(m.substring(d));m="("+e.join(")(")+")"}k[m]=a.parser.parse(m,v)}x=a.eval(k[m]);return void 0!=x?x:NaN}return a.functions[this.value].apply(a,g)}}else if("operator"===this.type)"+"===this.value?this.evaluate=function(b){var c=this.childs[0].evaluate(b,!0);b=this.childs[1].evaluate(b,!0);if("matrix"!==c.type||"matrix"!==b.type)return"number"==typeof c&&"string"==typeof b?c=a.removeNeedlessDecimals(c.toString()):
"string"==typeof c&&"number"==typeof b&&(b=a.removeNeedlessDecimals(b.toString())),c+b;r=c.rows;u=c.cols;z=d(r,u);for(l=0;l<r;l++)for(n=0;n<u;n++)z[n][l]=c[n][l]+b[n][l];return z}:"-"===this.value?this.evaluate=function(a){var b=this.childs[0].evaluate(a,!0);a=this.childs[1].evaluate(a,!0);if("matrix"!==b.type||"matrix"!==a.type)return b-a;r=b.rows;u=b.cols;z=d(r,u);for(l=0;l<r;l++)for(n=0;n<u;n++)z[n][l]=b[n][l]-a[n][l];return z}:"*"===this.value?this.evaluate=function(a){var b=this.childs[0].evaluate(a,
!0);a=this.childs[1].evaluate(a,!0);return"matrix"!==b.type||"matrix"!==a.type?b*a:e(b,a)}:"/"===this.value?this.evaluate=function(a){var b=this.childs[0].evaluate(a,!0);a=this.childs[1].evaluate(a,!0);if("matrix"!==b.type||"matrix"!==a.type)return b/a;var c=d(a.length,a.length),f=p(a);if(0===f)a=0;else{f=1/f;if(1<a.length)for(var g=0,l=a.length;g<l;g++){var h=f;for(var k=0;k<l;k++)c[k][g]=h*p(q(g,k,a)),h=-h;f=-f}else c[0][0]=f;a=c}b=0===a?d(b.rows,b.cols):e(b,a);return b}:"%"===this.value?this.evaluate=
function(a){var c=this.childs[0].evaluate(a);a=this.childs[1].evaluate(a);return c-b(c/a)*a}:"^"===this.value&&(this.evaluate=function(a){var b=this.childs[0].evaluate(a);a=this.childs[1].evaluate(a);return 0<=a?h(b,a):1/h(b,-a)});else if("compOperator"===this.type)"<"===this.value?this.evaluate=function(a){return+(this.childs[0].evaluate(a)<this.childs[1].evaluate(a))}:"<="===this.value?this.evaluate=function(a){return+(this.childs[0].evaluate(a)<=this.childs[1].evaluate(a))}:">"===this.value?this.evaluate=
function(a){return+(this.childs[0].evaluate(a)>this.childs[1].evaluate(a))}:">="===this.value?this.evaluate=function(a){return+(this.childs[0].evaluate(a)>=this.childs[1].evaluate(a))}:"=="===this.value?this.evaluate=function(a){var b=this.childs[0].evaluate(a);a=this.childs[1].evaluate(a);return"number"==typeof b&&"number"==typeof a?+(1E-8>Math.abs(b-a)):+(b===a)}:"!="===this.value&&(this.evaluate=function(a){var b=this.childs[0].evaluate(a);a=this.childs[1].evaluate(a);return"number"==typeof b&&
"number"==typeof a?+!(1E-8>Math.abs(b-a)):+(b!==a)});else if("boolOperator"===this.type)"&"===this.value?this.evaluate=function(a){return this.childs[0].evaluate(a)?this.childs[1].evaluate(a)?1:0:0}:"|"===this.value?this.evaluate=function(a){return this.childs[0].evaluate(a)?1:this.childs[1].evaluate(a)?1:0}:"!"===this.value&&(this.evaluate=function(a){return+!this.childs[0].evaluate(a)});else if("conditional"===this.type)this.evaluate=function(a){return 0<this.childs[0].evaluate(a)?this.childs[1].evaluate(a):
this.childs[2]?this.childs[2].evaluate(a):0};else if("sign"===this.type)this.evaluate="sign+"===this.value?function(a){return this.childs[0].evaluate(a)}:function(a){return-this.childs[0].evaluate(a)};else if("parentheses"===this.type)this.evaluate=function(a,b){return this.childs[0].evaluate(a,b)};else if("(expr)"===this.type||"[expr]"===this.type)this.evaluate=function(a){var b=this.childs.length,c=[];if(1===b&&1===this.childs[0].childs.length&&"(expr)"===this.type)c=this.childs[0].childs[0].evaluate(a);
else for(var f=0;f<b;f++){var g=[];for(var e=0,d=this.childs[f].childs.length;e<d;e++)g.push(this.childs[f].childs[e].evaluate(a));c[f]=g}return c};else if("assign"===this.type){var w,D=this.childs[0],B=this.childs[1],L=D.childs[0]?D.childs[0].childs:null;this.evaluate=1===D.childs.length&&"square_bracket"===D.childs[0].type&&1===L.length?function(a){w=B.evaluate(a);a.setVector(D.value,L[0].evaluate(a),w);return w}:1===D.childs.length&&"square_bracket"===D.childs[0].type&&2===L.length?function(a){w=
B.evaluate(a);a.setMatrix(D.value,L[0].evaluate(a),L[1].evaluate(a),w);return w}:function(a){w=B.evaluate(a);return w.type?a.matrices[D.value]=w:"object"!==typeof a.variables[D.value]?a.variables[D.value]=w:0}}};a.Node=w;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,d,e,q,p,b,k,m,c=/^\s+/,f=/^[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]+/,v=/^==|^!=|^<=|^<|^>=|^>|^#/,r=/^!|^~|^&&|^&|^\|\||^\|/,u=/^=|^:=/,z=/^[\?:]/,n=/^[\+\-\*\/%\^\u2212\u00b7\u00D7\u00F7]/,l=/^\[|^\]/,x=/^\(|^\)/,w=/^,/,y=/^;/,A=/\|/g,E=/\|\*/g,J=/\*\|/g,F,G=/rnd|pi|e|Infinity|-Infinity|sqr|sqrt|ra\u00edz|exp|log|log10|abs|ent|sgn|ind|sin|sen|cos|tan|cot|sec|csc|sinh|senh|cosh|tanh|coth|sech|csch|asin|asen|acos|atan|min|max/,
D=function(){};D.prototype.tokenize=function(B){function G(a,c,f){d.push({type:a,value:c});b=b.slice(f);q+=f;m=a}if(h=B){var D=B.indexOf("//");0<=D&&":"!==B[D-1]&&(B=B.substring(0,D));B=B.replace(/\\u(\S+) /g,function(a,b){return 39!==parseInt(b,16)?String.fromCharCode(parseInt(b,16)):a});B=B.replace(/&sup(.+?);/g,"^$1 ");B=B.replace(/&squot;/g,"'");B.match(/=\|\*/g)&&(B=B.replace(E,"'").replace(J,"'"));B.match(/=\|/g)&&(B=B.replace(A,"'"));D=B.trim();"|"==D.charAt(0)&&"|"==D.charAt(D.length-1)&&
(B=D.replace(A,"'"))}d=[];e=!1;q=0;b=B;for(m="";B&&q<B.length;)if(e=q,"'"==b[0]){for(k=1;"'"!=b[k];)if(k<b.length)k++;else{console.info(">Error, unknown symbol: ["+b+"], in the string \u300a"+h+"\u300b");return}p=b.substring(1,k);G("string",p,p.length+2)}else if(p=b.match(c))b=b.slice(p[0].length),q+=p[0].length;else if(p=b.match(n))p[0]=p[0].replace(/\u00F7/g,"/").replace(/\u2212/g,"-").replace(/\u00b7/g,"*").replace(/\u00D7/g,"*"),G("operator",p[0],p[0].length);else if(p=b.match(f))"number"===m&&
d.push({type:"operator",value:"*"}),G("identifier",p[0],p[0].length);else if(p=b.match(g))G("number",p[0],p[0].length);else if(p=b.match(v))D=p[0],"#"==D&&(D="!="),G("compOperator",D,p[0].length);else if(p=b.match(r))D=p[0],"||"==D?D="|":"&&"==D?D="&":"~"==D&&(D="!"),G("boolOperator",D,p[0].length);else if((p=b.match(u))&&!b.match(/^==/))G("assign",p[0],p[0].length);else if(p=b.match(z))G("conditional",p[0],p[0].length);else if(p=b.match(l))G("square_bracket",p[0],p[0].length);else if(p=b.match(x))"("==
p&&"number"===m&&d.push({type:"operator",value:"*"}),G("parentheses",p[0],p[0].length);else if(p=b.match(w))G("separator",p[0],p[0].length);else if(178===b.charCodeAt(0))d.push({type:"operator",value:"^"}),G("number",2,1);else if(179===b.charCodeAt(0))d.push({type:"operator",value:"^"}),G("number",3,1);else if(p=b.match(y))G("final_of_expression",p[0],p[0].length);else if(e==q){a.DEBUG.setError(a.DEBUG.EXPRESSION,h);return}return d};D.prototype.flatTokens=function(a,b){a=a||[];b=b||"";F="";for(var c=
0,f=a.length;c<f;c++)F="string"==a[c].type?F+"&squot;"+a[c].value+"&squot;":"identifier"!=a[c].type||a[c].value.match(G)?F+a[c].value:F+b+a[c].value;return F};a.Tokenizer=D;return a}(descartesJS||{});
descartesJS=function(a){function h(a){switch(a){case "=":return 1;case ":=":return 1;case "(":return 2;case "[":return 2;case "?":return 2;case ":":return 3;case "?:":return 3;case "|":return 6;case "&":return 7;case "<":return 5;case "<=":return 5;case ">":return 5;case ">=":return 5;case "==":return 5;case "!=":return 5;case "+":return 6;case "-":return 6;case "/":return 7;case "*":return 7;case "sign-":return 7;case "sign+":return 7;case "!":return 8;case "%":return 8;case "^":return 9;default:return 9}}
function d(a){return isNaN(parseFloat(a))?a.replace(/^\s|\s$/g,"").replace(/^'|'$/g,""):parseFloat(a)==a?parseFloat(a):a.replace(/^\s|\s$/g,"").replace(/^'|'$/g,"")}if(a.loadLib)return a;a.reservedIds=new String("-_-rnd-pi-\u03c0-e-Infinity-isTouch-esT\u00e1ctil-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 e=Date.now(),q,p,b,k,m,c,f,g,v,r,u,z,n=function(b){this.evaluator=b;this.tokenizer=new a.Tokenizer;this.vectors={};this.matrices={};this.variables={};this.functions={};this.definitions={};this.registerDefaultValues();this.registerExternalValues&&this.registerExternalValues()};n.prototype.setDefinition=function(a,b){this.definitions[a]=b};n.prototype.getDefinition=function(a){return this.definitions[a]};n.prototype.setVariable=function(a,b){this.variables[a]=b};n.prototype.getVariable=function(a){return this.variables[a]};
n.prototype.setVector=function(a,b,c){this.vectors[a][b]=c};n.prototype.getVector=function(a){this.vectors.hasOwnProperty(a)||(this.vectors[a]=[0,0,0]);return this.vectors[a]};n.prototype.setMatrix=function(a,b,c,f){this.matrices[a][b][c]=f};n.prototype.getMatrix=function(a){this.matrices.hasOwnProperty(a)||(this.matrices[a]=[[0,0,0],[0,0,0],[0,0,0]]);return this.matrices[a]};n.prototype.setFunction=function(a,b){this.functions[a]=b};n.prototype.getFunction=function(a){this.functions.hasOwnProperty(a)||
(this.functions[a]=function(){return 0});return this.functions[a]};n.prototype.parse=function(e,d){(b=this.tokenizer.tokenize(e))||(b=[]);k=null;d=!d||!1;q=g=f=c=0;for(p=b.length;q<p;q++){v=b[q];r=v.value;u=v.type;if("identifier"===u)if(q+1<p&&"parentheses"===b[q+1].type&&"("===b[q+1].value)this.getFunction(r);else if(q+1<p&&"square_bracket"===b[q+1].type&&"["===b[q+1].value)b[q+3]&&"square_bracket"===b[q+3].type&&"]"===b[q+3].value?this.getVector(r):this.getMatrix(r);else{var l=r.match(/(\w*)\.mouse_x|(\w*)\.mouse_y|(\w*)\.mouse_pressed|(\w*)\.mouse_clicked|(\w*)\.clic_izquierdo/);
l&&(this.variables[(l[1]||l[2]||l[3]||l[4]||l[5])+".DESCARTESJS_no_fixed"]=1);this.getVariable(r,!0)}"assign"===u&&d&&":="!=r&&(u="compOperator",r="==");if("assign"===u)if(m=new a.Node(u,r),null!=k)if("identifier"===k.type)k.parent&&k.parent.replaceLastChild(m),m.addChild(k),k=m,d=!0;else if("square_bracket"===k.type)m.addChild(k.parent),k=m,d=!0;else{m.type="compOperator";m.value="==";for(d=!0;k.parent&&h(k.parent.value)>=h(m.value);)k=k.parent;k.parent&&k.parent.replaceLastChild(m);m.addChild(k);
k=m}else{console.info("Error1: en la expresi\u00f3n \u300a "+e+" \u300b, en el token {valor: "+r+", tipo: "+u+"}");break}else if("parentheses"===u&&"("===r||"square_bracket"===u&&"["===r)if(m=new a.Node(u,r),"("===r&&c++,"["===r&&f++,null===k)"("===r&&(new a.Node("(expr)","(expr)")).addChild(m),"["===r&&(new a.Node("[expr]","[expr]")).addChild(m),k=m;else if("operator"===k.type||"boolOperator"===k.type||"compOperator"===k.type||"conditional"===k.type||"assign"===k.type)k.addChild(m),k=m;else if("sign"===
k.type)k.addChild(m),k=m;else if("parentheses"===k.type&&"("===k.value)k.addChild(m),k=m;else if("square_bracket"===k.type&&"["===k.value)k.addChild(m),k=m;else if("parentheses"===k.type&&"()"===k.value)k.parent.addChild(m),k=m;else if("square_bracket"===k.type&&"[]"===k.value)k.parent.addChild(m),k=m;else if("identifier"===k.type)k.addChild(m),k=m;else{console.info("Error2: en la expresi\u00f3n \u300a "+e+" \u300b, en el token ["+q+"] {valor: "+r+", tipo: "+u+"}");break}else if("parentheses"===u&&
")"===r)if(c--,null===k)console.info("Error3: en la expresi\u00f3n \u300a "+e+" \u300b, en el token (valor:"+r+", tipo:"+u);else{for(;k&&k.parent&&("("!=k.value||"("==k.value&&"parentheses"!=k.type);)k=k.parent;if(k&&"("===k.value)k.value="()";else break}else if("square_bracket"===u&&"]"===r)if(f--,null===k)console.info("Error5: en la expresi\u00f3n \u300a "+e+" \u300b, en el token (valor:"+r+", tipo:"+u);else{for(;k&&k.parent&&("["!=k.value||"["==k.value&&"square_bracket"!=k.type);)k=k.parent;if(k&&
"["===k.value)k.value="[]";else{console.info("Error6: en la expresi\u00f3n \u300a "+e+" \u300b, en el token {valor: "+r+", tipo: "+u+"}");break}}else if("number"===u||"string"===u||"identifier"===u)if(m=new a.Node(u,r),null===k)k=m;else if("operator"===k.type||"compOperator"===k.type||"boolOperator"===k.type||"parentheses"===k.type&&"("===k.value||"square_bracket"===k.type&&"["===k.value||"sign"===k.type||"conditional"===k.type||"assign"===k.type)k.addChild(m),k=m;else{a.DEBUG.setError(a.DEBUG.EXPRESSION,
e);break}else if("operator"===u||"compOperator"===u||"boolOperator"===u)if(m=new a.Node(u,r),null===k)if("-"===r||"+"===r)m.type="sign",m.value="sign"+r,k=m;else if("!"===r)k=m;else{console.info("Error8: en la expresi\u00f3n \u300a "+e+" \u300b, en el token {valor: "+r+", tipo: "+u+"}");break}else if("operator"===k.type||"compOperator"===k.type||"boolOperator"===k.type||"assign"===k.type||"conditional"===k.type||"square_bracket"===k.type&&"["===k.value&&("-"===r||"+"===r||"!"===r)||"parentheses"===
k.type&&"("===k.value&&("-"===r||"+"===r||"!"===r)){if("-"===r||"+"===r)m.type="sign",m.value="sign"+r;k.addChild(m);k=m}else if("number"===k.type||"parentheses"===k.type&&"()"===k.value||"square_bracket"===k.type&&"[]"===k.value||"string"===k.type||"identifier"===k.type||"conditional"===k.type||"assign"===k.type){for(;k.parent&&h(k.parent.value)>=h(m.value);)k=k.parent;k.parent&&k.parent.replaceLastChild(m);m.addChild(k);k=m}else{console.info("Error9: en la expresi\u00f3n \u300a "+e+" \u300b, en el token {valor: "+
r+", tipo: "+u+"}");break}else if("conditional"===u)if(m=new a.Node(u,r),null!=k)if("?"===m.value){for(g++;k.parent&&h(k.parent.value)>h(m.value);)k=k.parent;k.parent&&k.parent.replaceLastChild(m);m.addChild(k);k=m}else{for(g--;k&&k.parent&&("?"!=k.value||"?"==k.value&&"conditional"!=k.type);)k=k.parent;if(k&&"?"===k.value)k.value="?:";else{console.info("Error10: en la expresi\u00f3n \u300a "+e+" \u300b, en el token {valor: "+r+", tipo: "+u+"}");break}}else{console.info("Error11: en la expresi\u00f3n \u300a "+
e+" \u300b, en el token {valor: "+r+", tipo: "+u+"}");break}else if("separator"===u)if(null!=k)for(;k.parent&&"("!=k.value&&"["!=k.value;)k=k.parent;else{console.info("Error12: en la expresi\u00f3n \u300a "+e+" \u300b, en el token {valor: "+r+", tipo: "+u+"}");break}else{console.info("Error13: en la expresi\u00f3n \u300a "+e+" \u300b, en el token {valor: "+r+", tipo: "+u+"}");break}}0<c&&a.DEBUG.setError(a.DEBUG.PARENTHESIS_CLOSING,e);0>c&&a.DEBUG.setError(a.DEBUG.PARENTHESIS_OPENING,e);0<f&&a.DEBUG.setError(a.DEBUG.BRACKET_CLOSING,
e);0>f&&a.DEBUG.setError(a.DEBUG.BRACKET_OPENING,e);0!=g&&a.DEBUG.setError(a.DEBUG.INCOMPLETE_IF,e);(z=k?k.getRoot():null)&&z.setAllEvalFun();return z};n.prototype.registerDefaultValues=function(){var b=this;b.variables._NUM_MAX_ITE_ALG_=1E5;b.variables.rnd=Math.random;b.variables.pi=b.variables["\u03c0"]=a.returnValue(Math.PI);b.variables.e=a.returnValue(Math.E);b.variables.Infinity=Infinity;b.variables["-Infinity"]=-Infinity;b.variables.isTouch=b.variables["esT\u00e1ctil"]=a.hasTouchSupport?1:0;
b.variables.device=b.variables.dispositivo=function(){var a=navigator.userAgent;return/(tablet|ipad|playbook|silk)|(android(?!.*mobi))/i.test(a)?"tablet":/Mobile|iP(hone|od)|Android|BlackBerry|IEMobile|Kindle|Silk-Accelerated|(hpw|web)OS|Opera M(obi|ini)/.test(a)?"mobile":"desktop"}();Object.defineProperties(b.variables,{screenOrientation:{get:function(){return window.matchMedia("(orientation: landscape)").matches?"landscape":"portrait"}},screenWidth:{get:function(){return window.innerWidth}},screenHeight:{get:function(){return window.innerHeight}}});
b.functions.sqr=function(a){return a*a};b.functions.sqrt=b.functions["ra\u00edz"]=Math.sqrt;b.functions.exp=Math.exp;b.functions.log=Math.log;b.functions.log10=function(a){return Math.log(a)/Math.log(10)};b.functions.abs=Math.abs;b.functions.ent=Math.floor;b.functions.sgn=function(a){return 0<a?1:0>a?-1:0};b.functions.ind=function(a){return a?1:0};b.functions.sin=b.functions.sen=Math.sin;b.functions.cos=Math.cos;b.functions.tan=Math.tan;b.functions.cot=function(a){return 1/Math.tan(a)};b.functions.sec=
function(a){return 1/Math.cos(a)};b.functions.csc=function(a){return 1/Math.sin(a)};b.functions.sinh=b.functions.senh=function(a){return(Math.exp(a)-Math.exp(-a))/2};b.functions.cosh=function(a){return(Math.exp(a)+Math.exp(-a))/2};b.functions.tanh=function(a){return(Math.exp(a)-Math.exp(-a))/(Math.exp(a)+Math.exp(-a))};b.functions.coth=function(a){return 1/b.functions.tanh(a)};b.functions.sech=function(a){return 1/b.functions.cosh(a)};b.functions.csch=function(a){return 1/b.functions.sinh(a)};b.functions.asin=
b.functions.asen=Math.asin;b.functions.acos=Math.acos;b.functions.atan=Math.atan;b.functions.atan2=Math.atan2;b.functions.floor=Math.floor;b.functions.ceil=Math.ceil;b.functions.round=Math.round;b.functions.min=Math.min;b.functions.max=Math.max;b.functions._Trace_=b.functions._Print_=function(){console.info.apply(console,arguments);return 0};b.functions._Num_=function(a){if("number"==typeof a)return"NaN";a=a.replace(",",".");return parseFloat(a)==a?parseFloat(a):"NaN"};b.functions.isNumber=function(a){return Number.isFinite(a)?
1:0};b.functions._Stop_Audios_=function(){b.evaluator.parent.stopAudios()};b.functions.esCorrecto=function(c,f,g){return a.esCorrecto(c,f,b.evaluator,g)};b.functions.escorrecto=function(c,f,g){return a.escorrecto(c,f,b.evaluator,g)};window.parent!==window&&(b.functions["parent.set"]=function(a,b){window.parent.postMessage({type:"set",name:a,value:b},"*");return 0},b.functions["parent.update"]=function(){window.parent.postMessage({type:"update"},"*");return 0},b.functions["parent.exec"]=function(a,
b){window.parent.postMessage({type:"exec",name:a,value:b},"*");return 0});b.functions.toFixed=b.functions._NumToStr_=b.functions._NumACadena_=function(a,b){a=isNaN(parseFloat(a))?0:parseFloat(a);return a.toFixed(parseInt(b||0))};b.functions.charAt=b.functions._charAt_=b.functions._letraEn_=function(a,b){a=(a||"").toString();b=isNaN(parseInt(b))?0:parseInt(b);return a.charAt(b)};b.functions.substring=b.functions._substring_=b.functions._subcadena_=function(a,b,c){a=(a||"").toString();b=isNaN(parseInt(b))?
0:parseInt(b);c=isNaN(parseInt(c))?0:parseInt(c);return 0<=b&&0<=c?a.substring(b,c):0>b&&0<=c?a.substring(c):0>c&&0<=b?a.substring(b):""};b.functions.strLength=b.functions._length_=b.functions._longitud_=function(a){return(a||"").toString().length};b.functions.indexOf=b.functions._indexOf_=b.functions["_\u00edndiceDe_"]=function(a,b){return(a||"").toString().indexOf((b||"").toString())};b.functions.lastIndexOf=function(a,b){return(a||"").toString().lastIndexOf((b||"").toString())};b.functions.replace=
b.functions._replace_=b.functions._reemplazar_=function(a,b,c){a=(a||"").toString();b=(b||"").toString();c=(c||"").toString();for(var f=a.indexOf(b);0<=f;)a=a.substring(0,f)+c+a.substring(f+b.length),f=a.indexOf(b,f+c.length);return a};b.functions.toLowerCase=function(a){return(a||"").toString().toLowerCase()};b.functions.toUpperCase=function(a){return(a||"").toString().toUpperCase()};b.functions.trim=function(a){return(a||"").toString().trim()};b.functions._Load_=function(b){var c="";b&&(c=(c=document.getElementById(b))&&
"descartes/archivo"==c.type?c.text:a.openFile(b));return c||""};b.functions._GetValues_=function(a,c){return b.functions._ExecBlock_(b.functions._Load_(a).replace(/&brvbar;/g,String.fromCharCode("166")),c)};b.functions._GetMatrix_=function(a,c){return b.functions._StrToMatrix_(b.functions._Load_(a).replace(/&brvbar;/g,String.fromCharCode("166")),c)};b.functions._MatrixToStr_=function(c){var f=b.matrices[c];if(f){for(var g="<"+c+">\\n",e=b.getVariable(c+".columnas_usadas")||f.cols||0,d=b.getVariable(c+
".filas_usadas")||f.rows||0,h,l=0;l<e;l++){for(var k=0;k<d;k++)h=f[l][k],void 0!==h&&("string"==typeof h?h="'"+h+"'":"number"==typeof h&&(h=a.removeNeedlessDecimals(h.toFixed(6))),g+=h+(k<d-1?" \u00a6 ":""));g=g.replace(/(\u00A6 )$/g,"")+"\\n"}return g+"</"+c+">"}return""};b.functions._StrToMatrix_=function(a,c){var f=[],g=!1,e=!1;f.type="matrix";if(a){a=a.replace(/\r|\\r/g,"").split(/\n|\\n/);for(var h=0,l=a.length;h<l;h++)a[h].match("<"+c+">")?(e=!0,g=a[h].trim().split("<"+c+">"),2==g.length&&""!=
g[1]&&f.push(g[1].split(String.fromCharCode("166")).map(d)),g=!0):(a[h].match("</"+c+">")&&(g=a[h].trim().split("</"+c+">"),2==g.length&&""!=g[0]&&f.push(g[0].split(String.fromCharCode("166")).map(d)),g=!1,h=a.length),g&&f.push(a[h].split(String.fromCharCode("166")).map(d)));b.matrices[c]=f;b.matrices[c].rows=f&&f[0]&&f[0].length?f[0].length:0;b.matrices[c].cols=f&&f.length?f.length:0;b.setVariable(c+".filas",b.matrices[c].rows);b.setVariable(c+".columnas",b.matrices[c].cols)}return e?"OK":"ERROR"};
b.functions._GetVector_=function(a,c){return b.functions._StrToVector_(b.functions._Load_(a),c)};b.functions._VectorToStr_=function(a){var c=b.vectors[a];if(c){for(var f="<"+a+">\\n",g=b.getVariable(a+".long_usada")||c._size_||0,e,d=0;d<g;d++)e=c[d],void 0!==e?("number"==typeof e&&(e=parseFloat(e)),f+=e+"\\n"):f+="0\\n";return f+"</"+a+">"}return""};b.functions._StrToVector_=function(a,c){var f=[],g=!1,e=!1;f.type="vector";if(a){a=a.replace(/\r|\\r/g,"").split(/\n|\\n/);for(var h=0,l=a.length;h<l;h++)a[h].match("<"+
c+">")?g=e=!0:(a[h].match("</"+c+">")&&(g=!1,h=a.length),g&&f.push(d(a[h])));f._size_=f.length;b.vectors[c]=f;b.setVariable(c+".long",f.length);b.setVariable(c+".long_usada",f.length)}return e?"OK":"ERROR"};b.functions._ExecStr_=function(a){return b.functions._ExecBlock_(a,"")};b.functions._ExecBlock_=function(a,c){var f=[],g=""==c;if(a){a=a.replace(/\r|\\r/g,"").split(/\n|\\n/);for(var e=0,d=a.length;e<d;e++)a[e].match("<"+c+">")?(g=a[e].trim().split("<"+c+">"),2==g.length&&""!=g[1]&&(f=f.concat(g[1].split(String.fromCharCode("166")))),
g=!0):a[e].match("</"+c+">")?(g=a[e].trim().split("</"+c+">"),2==g.length&&""!=g[0]&&(f=f.concat(g[0].split(String.fromCharCode("166")))),g=!1):g&&(f=f.concat(a[e].split(String.fromCharCode("166"))));e=0;for(d=f.length;e<d;e++)g=f[e].split("="),g[0]=g[0].trim(),2==g.length&&""!=g[0]&&(isNaN(parseFloat(g[1]))?b.setVariable(g[0],g[1].replace(/^\s|\s$/g,"").replace(/^'|'$/g,"")):b.setVariable(g[0],parseFloat(g[1])))}return 0};var c=a.newHTML("a",{target:"_blank"}),f,g=null;a.newBlobContent=null;b.functions._Save_=
function(d,h){b.evaluator.parent.removeButtonClick();1500<Date.now()-e&&(e=Date.now(),document.body.appendChild(c),g=h.replace(/\\r/g,"").replace(/\\n/g,"\r\n").replace(/\\q/g,"'").replace(/\\_/g,"\\"),f=new Blob(["\ufeff",g],{type:"text/plain;charset=utf-8"}),c.setAttribute("href",window.URL.createObjectURL(f)),c.setAttribute("download",d),g!=a.newBlobContent&&(c.click(),a.newBlobContent=g),document.body.removeChild(c));return 0};var h=a.newHTML("a",{target:"_blank"});b.functions._SaveSpace_=function(c,
f){b.evaluator.parent.removeButtonClick();1500<Date.now()-e&&(e=Date.now(),document.body.appendChild(h),g=f,h.setAttribute("href",g),h.setAttribute("download",c),g!=a.newBlobContent&&(h.click(),a.newBlobContent=g),document.body.removeChild(h));return 0};var k,m,r=a.newHTML("input",{type:"file"});r.addEventListener("change",function(c){k=c.target.files;m=new FileReader;m.onload=function(c){a.addExternalFileContent(k[0].name,c.target.result);b.setVariable("DJS.fileName",k[0].name);b.setVariable("DJS.fileContent",
c.target.result);b.getFunction(b._callback)&&(b.getFunction(b._callback).apply(b.evaluator,[]),b.evaluator.parent.update());r.value=""};0<k.length&&m.readAsText(k[0])});b.functions._Open_=function(a){b.evaluator.parent.removeButtonClick();1500<Date.now()-e&&(b._callback=a,r.click(),e=Date.now());return 0};b.functions._AnchoDeCadena_=b.functions._strWidth_=function(b,c,f,g){return a.getTextWidth(b,a.convertFont(c+","+f+","+g))};b.functions.R=b.functions._Rojo_=b.functions._Red_=function(b){return(new a.Color(b)).r/
255};b.functions.G=b.functions._Verde_=b.functions._Green_=function(b){return(new a.Color(b)).g/255};b.functions.B=b.functions._Azul_=b.functions._Blue_=function(b){return(new a.Color(b)).b/255};b.functions["DJS.typeof"]=function(a){return a.rows?"matrix":a._size_?"vector":typeof a}};a.Parser=n;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.floor,d=function(e){this.parent=e;this.parser=new a.Parser(this);this.variables=this.parser.variables;this.functions=this.parser.functions;this.vectors=this.parser.vectors;this.matrices=this.parser.matrices;this.definitions=this.parser.definitions};d.prototype.setDefinition=function(a,d){this.definitions[a]=d};d.prototype.getDefinition=function(a){return this.definitions[a]};d.prototype.setVariable=function(a,d){this.variables[a]=d};d.prototype.getVariable=
function(a){return this.variables[a]};d.prototype.setVector=function(a,d,p){d=0>d?0:h(d);this.vectors[a][d]=p};d.prototype.getVector=function(a,d){d=0>d?0:h(d);return this.vectors[a][d]};d.prototype.setMatrix=function(a,d,p,b){d=0>d?0:h(d);p=0>p?0:h(p);void 0==this.matrices[a][d]&&(this.matrices[a][d]=[]);this.matrices[a][d][p]=b};d.prototype.getMatrix=function(a,d,p){d=0>d?0:h(d);p=0>p?0:h(p);return this.matrices[a][d][p]};d.prototype.setFunction=function(a,d){this.functions[a]=d};d.prototype.getFunction=
function(a){return this.functions[a]};d.prototype.eval=function(a){return a?a.evaluate(this):0};a.externalEvaluator=new d;a.Evaluator=d;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,d,e,q,p,b,k,m,c,f,g,v,r,u,z,n=function(b,c){this.parent=b;this.evaluator=b.evaluator;this.decimals=b.decimals;this.fixed=b.fixed;this.align=b.align||"left";this.anchor=b.anchor||"a_top_left";this.decimal_symbol=b.parent.decimal_symbol;this.w=this.h=100;this.hasContent=""!==c;this.textStr=(c||"").replace(/\\{/g,"\\curlyBracketOpen ").replace(/\\}/g,"\\curlyBracketClose ").replace(/\\\[/g,"\\squareBracketOpen ").replace(/\\\]/g,"\\squareBracketClose ");
this.oldTextStr=this.oldWidth=this.oldSize=this.oldColor=this.oldPosX=this.oldPoxY=null;c.match(/^\{\\rtf1/)?(this.type="rtfNode",this.text=c,this.textNodes=(new a.RTFParser(b.evaluator)).parse(c.substring(10)),this.draw=this.drawRTF):(this.descarTeXParser=new a.DescarTeXParser,this.text=this.parseSimpleText(this.textStr),this.textNodes=new a.TextNode("","textLineBlock",null,null),this.draw=this.drawText)};n.prototype.drawText=function(c,f,g,k,m){h=this.evaluator.eval(this.decimals);d=this.evaluator.eval(this.parent.width);
e=this.evaluator.eval(this.parent.font_size);q=f.getColor?f.getColor():f;p=this.textToString(this.text,h,this.fixed).replace(/\\{/g,"\\curlyBracketOpen ").replace(/\\}/g,"\\curlyBracketClose ").replace(/\\\[/g,"\\squareBracketOpen ").replace(/\\\]/g,"\\squareBracketClose ");0<=p.indexOf("[")&&(p=this.textToString(this.parseSimpleText(p),h,this.fixed));if(this.oldTextStr!==p||this.oldWidth!==d||this.oldSize!==e||this.oldColor!==q||this.oldPosX!==g||this.oldPoxY!==k)b=new a.TextStyle({size:e,family:this.parent.font_family||
"arial",italic:this.parent.italics||!1,bold:this.parent.bold||!1,color:q,align:this.align,border:this.parent.border,border_size:this.parent.border_size,shadowBlur:this.parent.shadowBlur,shadowOffsetX:this.parent.shadowOffsetX,shadowOffsetY:this.parent.shadowOffsetY,shadowColor:this.parent.shadowColor||"transparent"}),this.textNodes=this.descarTeXParser.parse(p,this.evaluator,b),this.textNodes.update(g,k,h,this.fixed,this.align,this.anchor,q,d);m||this.textNodes.draw(c);this.oldTextStr=p;this.oldWidth=
d;this.oldSize=e;this.oldColor=q;this.oldPosX=g;this.oldPoxY=k};n.prototype.drawRTF=function(a,b,c,f,g){b=b.getColor?b.getColor():b;a.fillStyle=a.strokeStyle=b;a.textBaseline="alphabetic";this.textNodes.style.align!==this.align&&this.textNodes.propagateStyle("align",this.align);this.textNodes.update(c,f,this.evaluator.eval(this.decimals),this.fixed,this.align,this.anchor,b,this.evaluator.eval(this.parent.width));g||this.textNodes.draw(a)};n.prototype.parseSimpleText=function(a){a=a.replace("&#x2013",
"\u2013").replace(/&squot;/g,"'");k=[];m="'";f=c=0;g=-1;for(u=a.length;c<u;)v=a.charAt(c),r=a.charAt(c-1),"["===v&&"\\"===r?(k.push(a.substring(f,c-1)+"["),f=c+1):"]"===v&&"\\"===r?(k.push(a.substring(f,c-1)+"]"),f=c+1):"["===v&&-1===g?(k.push(a.substring(f,c)),f=c,g++):"["===v?g++:"]"===v&&0===g?(k.push(this.evaluator.parser.parse(a.substring(f,c+1))),f=c+1,g--):("]"==a.charAt(c)&&(g=0>g?g:g-1),m+=a.charAt(c)),c++;k.push(a.substring(f,c));return k};n.prototype.textToString=function(b,c,f){m="";if("rtfNode"!==
b.type)for(var g=0,e=b.length;g<e;g++)"string"===typeof b[g]?m+=b[g]:(z=this.evaluator.eval(b[g])[0][0],""!==z&&("string"===typeof z?m+=z:Infinity===z?m+="Infinity":-Infinity===z?m+="-Infinity":isNaN(z)||"NaN"===z?m+="NaN":(z=parseFloat(z),z=f?z.toFixed(c):a.removeNeedlessDecimals(z.toFixed(c)),m+=z.toString().replace(".",this.decimal_symbol))));return m};a.TextObject=n;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,d=function(){};d.prototype.tokenize=function(a){a=a.replace(/\\n/g,"\\newline ");var e=[],d=null,b=0,k=a.length;a.charAt(0);var m=!1,c=!1,f=0;h="";for(var g=0;g<k;g++){var v=a.charAt(g);var r=a.charAt(g+1);"\\"===v&&"$"===r&&(c=!0);"{"===v?f++:"}"===v&&(f--,c&&0===f&&(c=!1));c?"_"===v?"{"===r?h+="\\subindex":(h+="\\subindex{"+r+"}",g++):"^"===v?"{"===r?h+="\\superindex":(h+="\\superindex{"+r+"}",g++):h+=v:h+=v}a=h;r=a.charAt(0);for(k=a.length;b<
k;)v=r,r=a.charAt(b+1),m&&("{"===v||"["===v||"\\"===v||" "===v?(m=!1," "===v&&(d={type:"ignore"},e.push(d))):d.value+=v),m||"\\"!==v?m||"{"!==v&&"["!==v?m||"}"!==v&&"]"!==v?m||(d&&"text"===d.type?d.value+=v:d&&"ignore"===d.type?(e.pop(),d=e[e.length-1]):(d={type:"text",value:v},e.push(d))):(d={type:"close",value:v},e.push(d)):(d={type:"open",value:v},e.push(d)):(m=!0,d={type:"command",value:""},e.push(d)),b++;return e};a.DescarTeXTokenizer=d;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=function(){this.tokenizer=new a.DescarTeXTokenizer};h.prototype.parse=function(d,e,h){d=this.tokenizer.tokenize(d);var p=new a.TextNode("","textBlock",h,null),b=new a.TextNode("","textLineBlock",h.clone(),null);p.addChild(b);for(var k=[],m=void 0,c=h,f=[h],g,v,r,u,q=!1,n=0,l=d.length;n<l;n++)if("text"===d[n].type)if("color_parameter"===m)v=new a.Color(d[n].value,e);else if("text_size_parameter"===m)r=parseFloat(d[n].value);else if("textLineBlock"===
b.nodeType){g=d[n].value.split(" ");for(var x=0,w=g.length;x<w;x++)""!==g[x]&&b.addChild(new a.TextNode(g[x],"text",c.clone(),null)),x+1<w&&b.addChild(new a.TextNode(" ","space",c.clone(),null))}else b.addChild(new a.TextNode(d[n].value,"text",c.clone(),null));else"command"===d[n].type&&"curlyBracketOpen"===d[n].value?b.addChild(new a.TextNode("{","text",c.clone(),null)):"command"===d[n].type&&"curlyBracketClose"===d[n].value?b.addChild(new a.TextNode("}","text",c.clone(),null)):"command"===d[n].type&&
"squareBracketOpen"===d[n].value?b.addChild(new a.TextNode("[","text",c.clone(),null)):"command"===d[n].type&&"squareBracketClose"===d[n].value?b.addChild(new a.TextNode("]","text",c.clone(),null)):"command"===d[n].type&&"newline"===d[n].value?(0===b.children.length&&b.addChild(new a.TextNode("","text",c.clone(),null)),b=new a.TextNode("","textLineBlock",h.clone(),null),p.addChild(b)):"command"===d[n].type&&"b"===d[n].value?(m="bold",k.push(m)):"command"===d[n].type&&"i"===d[n].value?(m="italic",
k.push(m)):"command"===d[n].type&&"o"===d[n].value?(m="overline",k.push(m)):"command"===d[n].type&&"u"===d[n].value?(m="underline",k.push(m)):"command"===d[n].type&&"color"===d[n].value?(m="color",k.push(m)):"command"===d[n].type&&"ts"===d[n].value?(m="text_size",k.push(m)):"command"===d[n].type&&"sansserif"===d[n].value.toLowerCase()?(m="sansserif",k.push(m)):"command"===d[n].type&&"serif"===d[n].value.toLowerCase()?(m="serif",k.push(m)):"command"===d[n].type&&"monospace"===d[n].value.toLowerCase()?
(m="monospace",k.push(m)):"command"===d[n].type&&"c"===d[n].value?(m="center",k.push(m)):"command"===d[n].type&&"l"===d[n].value?(m="left",k.push(m)):"command"===d[n].type&&"r"===d[n].value?(m="right",k.push(m)):"command"===d[n].type&&"j"===d[n].value?(m="justify",k.push(m)):"command"===d[n].type&&"$"===d[n].value?(m="formula",k.push(m),q=!0):"command"===d[n].type&&"sum"===d[n].value?(m="sum",k.push(m)):"command"===d[n].type&&"prod"===d[n].value?(m="prod",k.push(m)):"command"===d[n].type&&"int"===
d[n].value?(m="integral",k.push(m)):"command"===d[n].type&&"lim"===d[n].value?(m="limit",k.push(m)):"command"===d[n].type&&"sqrt"===d[n].value?(m="radical",k.push(m)):"command"===d[n].type&&"subindex"===d[n].value?(m="subIndex",k.push(m)):"command"===d[n].type&&"superindex"===d[n].value?(m="superIndex",k.push(m)):"command"===d[n].type&&"frac"===d[n].value?(m="numerator",k.push(m)):"open"===d[n].type&&"{"===d[n].value&&void 0!==m?"bold"===m||"italic"===m||"overline"===m||"underline"===m?(c=c.clone(),
c[m]=!0,f.push(c)):"sansserif"===m?(c=c.clone(),c.family="sansserif",f.push(c)):"serif"===m?(c=c.clone(),c.family="serif",f.push(c)):"monospace"===m?(c=c.clone(),c.family="monospaced",f.push(c)):"text_size"===m?m="text_size_parameter":"text_size_text"===m?(c=c.clone(),c.size=r,f.push(c)):"color"===m?m="color_parameter":"color_text"===m?(c=c.clone(),c.color=v,f.push(c)):"center"===m||"left"===m||"right"===m||"justify"===m?(c=c.clone(),c.align=m,f.push(c),b=new a.TextNode("","textLineBlock",c.clone(),
null),p.addChild(b)):"formula"===m?(c=c.clone(),f.push(c),u=new a.TextNode("","formula",c.clone(),null),b.addChild(u),b=u):"subIndex"===m||"superIndex"===m?q?(c=c.clone(),f.push(c),u=new a.TextNode("",m,c.clone(),null),b.addChild(u),b=u):b.addChild(new a.TextNode("subIndex"===m?"_":"^","text",c.clone(),null)):"radical"===m?q&&(u=new a.TextNode("","radical",c.clone(),null),b.addChild(u),b=u,c=c.clone(),f.push(c),u=new a.TextNode("","index",c.clone(),null),b.addChild(u),b=u,m="index"):"index"===m?q&&
(f.pop(),c=f[f.length-1],u=new a.TextNode("","radicand",c.clone(),null),b.addChild(u),b=u,m="radicand"):"sum"===m||"integral"===m||"limit"===m||"prod"===m?q&&(u=new a.TextNode("",m,c.clone(),null),b.addChild(u),b=u,c=c.clone(),f.push(c),u=new a.TextNode("","from",c.clone(),null),b.addChild(u),b=u,m="from",k[k.length-1]=m):"from"===m?q&&(u=new a.TextNode("","to",c.clone(),null),b.addChild(u),b=u,m="to",k[k.length-1]=m):"to"===m?q&&(f.pop(),c=f[f.length-1],u=new a.TextNode("","what",c.clone(),null),
b.addChild(u),b=u,m="what",k[k.length-1]=m):"numerator"===m?q&&(u=new a.TextNode("","fraction",c.clone(),null),b.addChild(u),b=u,c=c.clone(),f.push(c),u=new a.TextNode("","numerator",c.clone(),null),b.addChild(u),b=u,m="numerator"):"denominator"===m&&(u=new a.TextNode("",m,c.clone(),null),b.addChild(u),b=u):"close"===d[n].type&&"}"===d[n].value&&void 0!==m&&("bold"===m||"italic"===m||"overline"===m||"underline"===m||"color_text"===m||"color"===m||"text_size_text"===m||"text_size"===m||"sansserif"===
m||"serif"===m||"monospace"===m?(f.pop(),c=f[f.length-1],k.pop(),m=k[k.length-1]):"color_parameter"===m?m="color_text":"text_size_parameter"===m?m="text_size_text":"center"===m||"left"===m||"right"===m||"justify"===m?(f.pop(),c=f[f.length-1],k.pop(),m=k[k.length-1],d[n+1]&&"command"===d[n+1].type&&"newline"===d[n+1].value?b=p:(b=new a.TextNode("","textLineBlock",c.clone(),null),p.addChild(b))):"formula"===b.nodeType?(q=!1,f.pop(),c=f[f.length-1],k.pop(),m=k[k.length-1],b=b.parent):"subIndex"===b.nodeType||
"superIndex"===b.nodeType?q&&(f.pop(),c=f[f.length-1],k.pop(),m=k[k.length-1],b=b.parent):"index"===b.nodeType?b=b.parent:"radicand"===b.nodeType?(k.pop(),m=k[k.length-1],b=b.parent.parent):"from"===b.nodeType?b=b.parent:"to"===b.nodeType?b=b.parent:"what"===b.nodeType?(k.pop(),m=k[k.length-1],b=b.parent.parent):"numerator"===b.nodeType?(m="denominator",b=b.parent):"denominator"===b.nodeType&&(f.pop(),c=f[f.length-1],k.pop(),m=k[k.length-1],b=b.parent.parent));var y,A,E=null,J=[];p.children.forEach(function(a){for(var b=
0,c=a.children.length;b<c-1;b++)y=a.children[b],A=a.children[b+1],"text"===y.nodeType&&"text"===A.nodeType&&y.style.equals(A.style)?(null===E&&(E=y,u=y.clone(),E.changeNodeType("word"),E.value="___"+u.value,E.addChild(u)),u=A.clone(),E.addChild(u),J.push(A),E.value+=u.value):E=null});J.forEach(function(a){a.parent.removeChild(a)});p.normalize();p.adjustFontSize();return p};a.DescarTeXParser=h;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,d=function(a){this.size=20;this.family="Arimo";this.overline=this.underline=this.bold=this.italic=!1;this.border=this.color=null;this.align="left";a=a||{};this.set(a)};d.prototype.clone=function(){return new d(Object.assign({},this))};d.prototype.set=function(a){Object.assign(this,a)};d.prototype.equals=function(a){var d=!0,e;for(e in this)this.hasOwnProperty(e)&&(d=d&&this[e]===a[e]);return d};d.prototype.toString=function(d){/arial|sansserif/i.test(this.family)?
h=a.sansserif_font:/times|serif/i.test(this.family)?h=d?a.math_font:a.serif_font:/courier|monospaced/i.test(this.family)&&(h=a.monospace_font);return((this.bold?"bold":"")+" "+(this.italic?"italic":"")+" "+this.size+"px "+h).trim()};a.TextStyle=d;return a}(descartesJS||{});
descartesJS=function(a){function h(a,b){for(var c=0,f=0;f<b;f++)c+=a[f];return c}function d(a){var b={ascent:0,descent:0,h:0,w:0,x:0,y:0,offsetX:0,offsetY:0,marginX:0,marginY:0,paddingX:0,paddingY:0};if(""==a.trim())return b;var c=parseInt(a.match(/(\d+\.*)+px/)[0]);a=a.match("sansserif")?"sansserif":a.match("serif")?"serif":"monospace";b.ascent=Math.ceil((m[a].ascent+25)*c/m[a].unitsPerEm);b.descent=Math.ceil(Math.abs((m[a].descent-25)*c/m[a].unitsPerEm));b.h=b.ascent+b.descent;return b}if(a.loadLib)return a;
var e=!1,q="#000000",p=2,b=!1;(new Path2D("m 759,1 c -8,0 -15,4 -20,14 L 325,878 153,500 c -5,-11 -11,-14 -17,-9 L 2,596 c -5,4 17,30 22,26 l 65,-47 193,422 c 3,6 27,6 32,-4 L 773,40 V 1 Z")).svgData="m 759,1 c -8,0 -15,4 -20,14 L 325,878 153,500 c -5,-11 -11,-14 -17,-9 L 2,596 c -5,4 17,30 22,26 l 65,-47 193,422 c 3,6 27,6 32,-4 L 773,40 V 1 Z";(new Path2D("M 780,707 H 750 C 728,805 695,872 585,872 H 180 L 509,447 225,65 h 313 c 130,0 167,49 188,181 h 30 V 0 H 25 L 384,500 0,1000 h 729 z")).svgData=
"M 780,707 H 750 C 728,805 695,872 585,872 H 180 L 509,447 225,65 h 313 c 130,0 167,49 188,181 h 30 V 0 H 25 L 384,500 0,1000 h 729 z";(new Path2D("m 150,828 c -21,88 -42,144 -83,144 -6,0 -9,-2 -9,-6 0,-9 15,-8 15,-34 0,-14 -13,-22 -27,-22 -24,0 -45,22 -45,51 0,20 21,39 56,39 97,0 141,-105 159,-176 L 375,181 c 23,-91 45,-154 89,-153 6,0 9,2 9,6 0,7 -15,13 -15,35 0,14 13,20 27,20 24,0 45,-22 45,-51 C 530,18 508,0 473,0 368,0 326,120 309,190 Z")).svgData="m 150,828 c -21,88 -42,144 -83,144 -6,0 -9,-2 -9,-6 0,-9 15,-8 15,-34 0,-14 -13,-22 -27,-22 -24,0 -45,22 -45,51 0,20 21,39 56,39 97,0 141,-105 159,-176 L 375,181 c 23,-91 45,-154 89,-153 6,0 9,2 9,6 0,7 -15,13 -15,35 0,14 13,20 27,20 24,0 45,-22 45,-51 C 530,18 508,0 473,0 368,0 326,120 309,190 Z";
(new Path2D("m 876.3561,999.59384 v -27.38613 h -17.60537 c -64.55302,0 -96.82952,-41.07919 -96.82952,-124.21565 V 144.75542 c 0,-83.136456 27.38612,-117.369116 114.43489,-117.369116 V 1.7633057e-4 H 1.184082e-5 V 27.386304 H 16.627304 c 60.640711,0 98.785676,24.4519 98.785676,121.281426 v 716.9297 c 0,71.39954 -31.298433,106.61028 -96.829524,106.61028 H 1.184082e-5 v 27.38613 H 359.93198 v -27.38613 h -30.32036 c -64.55302,0 -86.07069,-40.10112 -86.07069,-131.06218 V 64.553192 H 633.79325 V 841.14553 c 0,75.31185 -17.60537,131.06218 -86.07068,131.06218 h -31.29844 v 27.38613 z")).svgData=
"m 876.3561,999.59384 v -27.38613 h -17.60537 c -64.55302,0 -96.82952,-41.07919 -96.82952,-124.21565 V 144.75542 c 0,-83.136456 27.38612,-117.369116 114.43489,-117.369116 V 1.7633057e-4 H 1.184082e-5 V 27.386304 H 16.627304 c 60.640711,0 98.785676,24.4519 98.785676,121.281426 v 716.9297 c 0,71.39954 -31.298433,106.61028 -96.829524,106.61028 H 1.184082e-5 v 27.38613 H 359.93198 v -27.38613 h -30.32036 c -64.55302,0 -86.07069,-40.10112 -86.07069,-131.06218 V 64.553192 H 633.79325 V 841.14553 c 0,75.31185 -17.60537,131.06218 -86.07068,131.06218 h -31.29844 v 27.38613 z";
var k=function(b,f,g,d){this.type="rtfNode";this.evaluator=d;this.parent=null;this.children=[];this.metrics={ascent:0,descent:0,h:0,w:0,x:0,y:0,offsetX:0,offsetY:0,marginX:0,marginY:0,paddingX:0,paddingY:0};this.value=b;this.style=g;this.changeNodeType(f);this.drawBorder=a.in_editor?this.drawBorderSpecial:function(){}};k.prototype.changeNodeType=function(a){this.nodeType=a;this.draw=null;switch(this.nodeType){case "textBlock":this.draw=this.drawTextBlock;break;case "textLineBlock":this.draw=this.drawTextLineBlock;
break;case "formula":this.draw=this.drawFormula;break;case "superIndex":this.draw=this.drawSuperIndex;break;case "subIndex":this.draw=this.drawSubIndex;break;case "dynamicText":this.draw=this.drawDynamicText;this.decimal_symbol=this.evaluator.parent.decimal_symbol;break;case "fraction":this.draw=this.drawFraction;break;case "numerator":case "denominator":this.draw=this.drawNumDen;break;case "radical":this.draw=this.drawRadical;break;case "limit":this.draw=this.drawLimit;break;case "integral":this.draw=
this.drawIntegral;break;case "prod":this.draw=this.drawProd;break;case "sum":this.draw=this.drawSum;break;case "matrix":this.draw=this.drawMatrix;break;case "defparts":this.draw=this.drawDefparts;break;case "text":case "newLine":case "mathSymbol":this.draw=this.drawText;break;case "space":this.draw=this.drawSpace;break;case "word":this.draw=this.drawWord;break;case "hyperlink":this.draw=this.drawHyperlink;break;case "index":case "radicand":case "from":case "to":case "what":case "element":this.draw=
this.drawGenericBlock;break;case "componentNumCtrl":this.draw=this.drawComponentNumCtrl;break;case "componentSpace":this.draw=this.drawComponentSpace}};k.prototype.clone=function(){for(var a=new k(this.value,this.nodeType,this.style.clone()),b=0,g=this.children.length;b<g;b++)a.addChild(this.children[b].clone());return a};k.prototype.toStr=function(){for(var a=this.value,b=0,g=this.children.length;b<g;b++)a+=" "+this.children[b].toStr();return a};k.prototype.stringify=function(){var a="{"+('"NT":"'+
this.nodeType+'",');a+='"V":"'+(this.value||"")+'",';a+='"C":[';for(var b=0,g=this.children.length;b<g;b++)a+=this.children[b].stringify()+(b==g-1?"":",");a=a+"],"+('"S":'+JSON.stringify(this.style));return a+"}"};k.prototype.addChild=function(a,b){b&&null!==a.parent&&a.parent.removeChild(a);a.parent=this;this.children.push(a)};k.prototype.removeChild=function(a){var b=this.children.indexOf(a);-1!==b&&(a.parent=null,this.children.splice(b,1))};k.prototype.getFirstTextNode=function(){for(var a=this;0<
a.children.length;)a=a.children[0];return a};k.prototype.getLastTextNode=function(){for(var a=this;0<a.children.length;)a=a.children[a.children.length-1];return a};k.prototype.nextSibling=function(){if(this.parent)for(var a=null,b=0,g=this.parent.children.length;b<g;b++){if(a)return this.parent.children[b];this.parent.children[b]===this&&(a=!0)}return null};k.prototype.prevSibling=function(){if(this.parent)for(var a=0,b=this.parent.children.length-1;a<b;a++)if(this.parent.children[a+1]===this)return this.parent.children[a];
return null};k.prototype.queryAll=function(a){var b=[];"string"===typeof a&&(a=new RegExp(a));for(var c=0,d=this.children.length;c<d;c++)b=b.concat(this.children[c].queryAll(a));this.nodeType.match(a)&&b.push(this);return b};k.prototype.insertBefore=function(a,b){a=this.children.indexOf(a);-1!==a&&(b.parent=this,this.children.splice(a,0,b))};k.prototype.insertAfter=function(a,b){a=this.children.indexOf(a);-1!==a&&(b.parent=this,this.children.splice(a+1,0,b))};k.prototype.normalize=function(){for(var a=
this.queryAll(/textLineBlock|formula|numerator|denominator|superIndex|subIndex|index|subIndex|radicand|from|to|what|element/),b=0,g=a.length;b<g;b++)0===a[b].children.length&&a[b].addChild(new k("","text",a[b].style));a=this.queryAll(/formula|fraction|superIndex|subIndex|radical|sum|integral|prod|limit|matrix|defparts|dynamicText|componentNumCtrl|componentSpace/);b=0;for(g=a.length;b<g;b++){var d=a[b];(null===d.prevSibling()||null!==d.prevSibling()&&"text"!==d.prevSibling().nodeType)&&d.parent.insertBefore(d,
new k("","text",d.parent.style));(null===d.nextSibling()||null!==d.nextSibling()&&"text"!==d.nextSibling().nodeType)&&d.parent.insertAfter(d,new k("","text",d.parent.style))}return this};k.prototype.removeEmptyText=function(){for(var a=this.queryAll(/text/),b=0,g=a.length;b<g;b++)""===a[b].value&&a[b].parent&&a[b].parent.removeChild(a[b])};k.prototype.adjustFontSize=function(a){var b=this.style.size;"formula"===this.nodeType&&(a=!0);for(var c=0,d=this.children.length;c<d;c++)"text"===this.children[c].nodeType&&
a?(this.children[c].style.size=b,this.children[c].styleString=this.children[c].style.toString()):"index"===this.children[c].nodeType?(this.children[c].style.size=Math.max(parseInt(b-.5*b),8),this.children[c].styleString=this.children[c].style.toString(),this.children[c].adjustFontSize(!0)):"to"===this.children[c].nodeType||"from"===this.children[c].nodeType?(this.children[c].style.size=Math.max(parseInt(b-.2*b),8),this.children[c].styleString=this.children[c].style.toString(),this.children[c].adjustFontSize(!0)):
"numerator"===this.children[c].nodeType||"denominator"===this.children[c].nodeType?(this.children[c].style.size=Math.max(parseInt(b-.1*b),8),this.children[c].styleString=this.children[c].style.toString(),this.children[c].adjustFontSize(!0)):"subIndex"===this.children[c].nodeType||"superIndex"===this.children[c].nodeType?(this.children[c].style.size=Math.max(parseInt(b-.33*b),8),this.children[c].styleString=this.children[c].style.toString(),this.children[c].adjustFontSize(!0)):(a&&(this.children[c].style.size=
b,this.children[c].styleString=this.children[c].style.toString()),this.children[c].adjustFontSize(a))};k.prototype.propagateStyle=function(a,b){this.style[a]=b;this.styleString=this.style.toString();for(var c=0,f=this.children.length;c<f;c++)this.children[c].propagateStyle(a,b)};k.prototype.update=function(a,f,g,d,e,h,k,m){p=g;b=d;q=k;this.metrics.w=this.metrics.h=0;k=f;if(20<=m)for(g=0;g<this.children.length;g++)this.children[g].breakLines(m);g=0;for(d=this.children.length;g<d;g++){var c=this.children[g];
c.updateLine();c.metrics.offsetX=a;c.metrics.y=f;f+=parseInt(c.metrics.ascent+.5);c.metrics.offsetY=f;e=parseInt(c.metrics.descent+.5)+parseInt(1.5+.05*c.style.size);f+=e;this.metrics.h+=c.metrics.h;this.metrics.w=Math.max(this.metrics.w,c.metrics.w)}f=k;h=h||"";h.match("right")?a-=this.metrics.w:h.match("_center")&&(a-=this.metrics.w/2);h.match("bottom")?f-=this.metrics.h:h.match("center_")&&(f-=this.metrics.h/2);h=this.children;g=0;for(d=h.length;g<d;g++)"left"===h[g].style.align?h[g].metrics.offsetX=
a:"right"===h[g].style.align?h[g].metrics.offsetX=a+this.metrics.w-h[g].metrics.w:"center"===h[g].style.align?h[g].metrics.offsetX=a+(this.metrics.w-h[g].metrics.w)/2:"justify"===h[g].style.align&&20<=m&&(e=g<d-1?h[g+1].value:null,h[g].metrics.offsetX=a,"wrap"===e&&h[g].justifyAux(m)),h[g].metrics.y=f,f+=parseInt(h[g].metrics.ascent+.5),h[g].metrics.offsetY=f,e=parseInt(h[g].metrics.descent+.5)+parseInt(1.5+.05*h[g].style.size),f+=e};k.prototype.breakLines=function(b){for(var c,g=0,d=!1,e=[],h=0,
m=this.children.length;h<m;h++)c=this.children[h],d?e.push(c):("text"===c.nodeType||"space"===c.nodeType?(a.ctx.font=c.style.toString(),c.metrics.w=a.ctx.measureText(c.value).width):"word"===c.nodeType?c.updateLine():"formula"===c.nodeType&&c.updateFormula(),g+=c.metrics.w,g>b&&"space"!==c.nodeType&&0<h&&(d=!0,e.push(c)));if(0<e.length)for(b=new k("wrap","textLineBlock",this.style.clone(),null),this.parent.insertAfter(this,b),h=0,m=e.length;h<m;h++)e[h].parent&&e[h].parent.removeChild(e[h]),b.addChild(e[h])};
k.prototype.updateLine=function(b){var c=this;if("textLineBlock"===this.nodeType||"word"===this.nodeType){this.metrics.w=0;this.metrics.ascent=0;for(var g=this.metrics.descent=0,e=this.children,h,k=0,m=e.length;k<m;k++){h=e[k];if("text"===h.nodeType){a.ctx.font=h.style.toString();var n=""!==h.value?h.value:a.in_editor?"\u200a":"";h.metrics=d(a.ctx.font);h.metrics.w=a.ctx.measureText(n).width;h.metrics.offsetX=g;Object.defineProperties(h.metrics,{x:{get:function(){return c.metrics.offsetX+this.offsetX}},
y:{get:function(){return c.metrics.offsetY+this.offsetY}}})}"space"===h.nodeType?(a.ctx.font=h.style.toString(),h.metrics=d(a.ctx.font),h.metrics.w=k===m-1?0:b?b:a.ctx.measureText(" ").width,h.metrics.offsetX=g,Object.defineProperties(h.metrics,{x:{get:function(){return c.metrics.offsetX+this.offsetX}},y:{get:function(){return c.metrics.offsetY+this.offsetY}}})):"word"===h.nodeType&&(h.updateLine(),h.metrics.offsetX_aux=g,Object.defineProperties(h.metrics,{offsetX:{get:function(){return c.metrics.offsetX+
this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY}}}));"hyperlink"===h.nodeType&&(a.ctx.font=h.styleString,n=""!==h.value?h.value:a.in_editor?"\u200a":"",h.metrics=d(a.ctx.font),h.metrics.w=a.ctx.measureText(n).width,h.metrics.offsetX=g,Object.defineProperties(h.metrics,{x:{get:function(){return c.metrics.offsetX+this.offsetX}},y:{get:function(){return c.metrics.offsetY}}}),h.clickCatcher||(h.clickCatcher=a.newHTML("div",{style:"position:absolute;width:"+h.metrics.w+"px;height:"+
h.metrics.h+"px;cursor:pointer;"}),h.clickCatcher.rtfNode=h,h.clickCatcher.action=new a.OpenURL(this.evaluator.parent,h.URL),h.clickCatcher.addEventListener("click",function(a){this.rtfNode.click=!0;this.action.execute();this.rtfNode.draw(this.rtfNode.ctx)})));"componentNumCtrl"===h.nodeType&&(h.componentNumCtrl=this.evaluator.parent.getControlByCId(h.value),a.ctx.font=h.styleString,h.metrics=d(a.ctx.font),h.metrics.w=h.componentNumCtrl.w,h.metrics.h=h.componentNumCtrl.h,h.metrics.offsetX=g,Object.defineProperties(h.metrics,
{x:{get:function(){return c.metrics.offsetX+this.offsetX}},y:{get:function(){return c.metrics.offsetY}}}));"componentSpace"===h.nodeType?(h.componentSpace=this.evaluator.parent.getSpaceByCId(h.value),a.ctx.font=h.styleString,h.metrics=d(a.ctx.font),h.metrics.w=h.componentSpace.w,h.metrics.h=h.componentSpace.h,h.metrics.offsetX=g,Object.defineProperties(h.metrics,{x:{get:function(){return c.metrics.offsetX+this.offsetX}},y:{get:function(){return c.metrics.offsetY}}})):"formula"===h.nodeType&&(h.updateFormula(),
h.metrics.marginX=h.metrics.marginY=h.metrics.paddingX=h.metrics.paddingY=0,h.metrics.offsetX_aux=g,Object.defineProperties(h.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY}}}),h.metrics.w+=2*h.metrics.paddingX,h.metrics.ascent+=h.metrics.paddingY,h.metrics.descent+=h.metrics.paddingY,h.metrics.h+=2*h.metrics.paddingY,g+=2*h.metrics.marginX);
this.metrics.w+=h.metrics.w+2*h.metrics.marginX;this.metrics.ascent=Math.max(this.metrics.ascent,h.metrics.ascent);this.metrics.descent=Math.max(this.metrics.descent,h.metrics.descent);g+=h.metrics.w}this.metrics.h=this.metrics.ascent+this.metrics.descent}};k.prototype.updateFormula=function(){var c=this;this.metrics={ascent:0,descent:0,h:0,w:0,x:0,y:0,offsetX:0,offsetY:0,marginX:0,marginY:0,paddingX:0,paddingY:0};for(var f=this.children,g,e=0,k={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,q=f.length;m<q;m++){g=f[m];if("text"===g.nodeType){a.ctx.font=g.style.toString(!0);var n=""!==g.value?g.value:a.in_editor?"\u200a":"";g.metrics=d(a.ctx.font);g.metrics.w=a.ctx.measureText(n).width;g.metrics.offsetX=e;Object.defineProperties(g.metrics,{x:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.offsetX}},y:{get:function(){return c.metrics.offsetY}}});e+=c.metrics.marginX}else if("dynamicText"===g.nodeType){n=void 0===
g.decimals?p:g.evaluator.eval(g.decimals);var l=void 0===g.fixed?b:g.fixed,x=g.evaluator.eval(g.value);parseFloat(x).toString()===x.toString()&&(x=l?parseFloat(x).toFixed(n):a.removeNeedlessDecimals(parseFloat(x).toFixed(n)),x=(""+x).replace(".",g.decimal_symbol));g.evalValue=x;a.ctx.font=g.style.toString(!0);g.metrics=d(a.ctx.font);g.metrics.marginX=0;g.metrics.paddingX=0;g.metrics.w=a.ctx.measureText(x).width+2*g.metrics.paddingX;g.metrics.offsetX_aux=e;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}}});e+=2*g.metrics.marginX}if("superIndex"===g.nodeType)n=g,n.updateFormula(),n.metrics.marginX=0,n.metrics.paddingX=0,n.metrics.paddingY=0,n.metrics.offsetX_aux=e,n.metrics.prevChild=k,Object.defineProperties(n.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}}}),n.metrics.w+=2*n.metrics.paddingX,n.metrics.ascent+=n.metrics.paddingY,n.metrics.descent+=n.metrics.paddingY,n.metrics.h+=2*n.metrics.paddingY,n.metrics.tmp_ascent=n.metrics.h+(n.metrics.prevChild.metrics.ascent-n.metrics.prevChild.metrics.descent)/2,e+=2*n.metrics.marginX;else if("subIndex"===g.nodeType)n=g,n.updateFormula(),
n.metrics.marginX=0,n.metrics.paddingX=0,n.metrics.paddingY=0,n.metrics.offsetX_aux=e,n.metrics.prevChild=k,Object.defineProperties(n.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}}}),n.metrics.w+=n.metrics.paddingX,n.metrics.ascent+=n.metrics.paddingY,
n.metrics.descent+=n.metrics.paddingY,n.metrics.h+=2*n.metrics.paddingY,this.metrics.descent=n.metrics.ascent+(n.metrics.prevChild.metrics.descent-n.metrics.prevChild.metrics.ascent)/2+n.metrics.descent,e+=n.metrics.marginX;else if("fraction"===g.nodeType){l=g;l.updateFormula();n=l.children;x=n[0];n=n[1];l.metrics.marginX=parseInt(.5+.075*this.style.size);l.metrics.paddingX=0;l.metrics.paddingY=0;var w=Math.max(x.metrics.w,n.metrics.w)+2*l.metrics.paddingX;l.metrics.prevChild=k;l.metrics.offsetX_aux=
e;var y=parseInt(-k.metrics.descent+4*k.metrics.h/9);Object.defineProperties(l.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(x.metrics,{parent:{value:l},maxWidth:{value:w},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+
parseInt((this.maxWidth-this.w)/2)}},offsetY:{get:function(){return this.parent.metrics.offsetY-this.descent-this.parent.metrics.paddingY}}});Object.defineProperties(n.metrics,{parent:{value:l},maxWidth:{value:w},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}}});l.metrics.w=
w;l.metrics.ascent=x.metrics.h+y+2*l.metrics.paddingY;l.metrics.descent=n.metrics.h-y+2*l.metrics.paddingY;l.metrics.h=x.metrics.h+n.metrics.h+4*l.metrics.paddingY;e+=2*l.metrics.marginX}else if("radical"===g.nodeType){k=g;k.updateFormula();n=k.children;l=n[0];var A=n[1];k.metrics.marginX=parseInt(1.5+.075*this.style.size);k.metrics.paddingX=parseInt(1.5+.075*this.style.size);k.metrics.paddingY=parseInt(1.5+.05*this.style.size);k.metrics.offsetX_aux=e;Object.defineProperties(k.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}}});n=k.style.size;k.radicalSign={w:n,scaleX:n/722,scaleY:A.metrics.h/1E3};x=parseInt(l.metrics.w-2*k.radicalSign.w/3);Object.defineProperties(k.radicalSign,{parent:{value:k},displaceIndex:{value:x},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+Math.max(this.displaceIndex,0)}},
y:{get:function(){return c.metrics.offsetY-A.metrics.ascent}}});Object.defineProperties(l.metrics,{parent:{value:k},displaceIndex:{value:x},fontSize:{value:n},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+Math.max(this.displaceIndex,0)-this.displaceIndex}},offsetY:{get:function(){return c.metrics.offsetY-this.descent-2*this.fontSize/5}}});Object.defineProperties(A.metrics,{parent:{value:k},
displaceIndex:{value:x},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+this.parent.radicalSign.w+Math.max(this.displaceIndex,0)}},offsetY:{get:function(){return c.metrics.offsetY}}});x=l.metrics.w<2*k.radicalSign.w/3?k.radicalSign.w:parseInt(l.metrics.w+k.radicalSign.w/3);k.metrics.w=x+2*k.metrics.paddingX+A.metrics.w;k.metrics.ascent=Math.max(A.metrics.ascent,l.metrics.h+2*n/5)+
k.metrics.paddingY;k.metrics.descent=A.metrics.descent+k.metrics.paddingY;k.metrics.h=k.metrics.ascent+k.metrics.descent;e+=2*k.metrics.marginX}else if("sum"===g.nodeType){l=g;l.updateFormula();n=l.children;x=n[0];w=n[1];var E=n[2];l.metrics.marginX=parseInt(1.5+.075*this.style.size);l.metrics.paddingX=parseInt(1.5+.075*this.style.size);l.metrics.paddingY=parseInt(1.5+.05*this.style.size);l.metrics.offsetX_aux=e;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();var J=d(a.ctx.font);k=parseInt(1.2*J.h);n=parseInt(.5+780*k/1E3);l.sigmaSign={w:n,h:k,scale:k/1E3};var F=Math.max(w.metrics.w,x.metrics.w,l.sigmaSign.w);l.sigmaSign.parent=l;Object.defineProperties(l.sigmaSign,{sumWidth:{value:F},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+J.descent-(this.h+J.h)/2}}});n=J.descent-w.metrics.descent-(k+J.h)/2-l.metrics.paddingY;Object.defineProperties(w.metrics,{parent:{value:l},sumWidth:{value:F},newBaselineTo:{value:n},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.sumWidth-this.w)/2)}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaselineTo}}});
k=x.metrics.ascent+J.descent+(k-J.h)/2+l.metrics.paddingY;Object.defineProperties(x.metrics,{parent:{value:l},sumWidth:{value:F},newBaselineFrom:{value:k},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(E.metrics,{parent:{value:l},sumWidth:{value:F},
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}}});l.metrics.w=F+E.metrics.w+3*l.metrics.paddingX;l.metrics.ascent=Math.max(E.metrics.ascent,-n+w.metrics.ascent)+l.metrics.paddingY;l.metrics.descent=Math.max(E.metrics.descent,k+x.metrics.descent)+l.metrics.paddingY;l.metrics.h=l.metrics.ascent+l.metrics.descent;
e+=2*l.metrics.marginX}else if("integral"===g.nodeType){l=g;l.updateFormula();n=l.children;x=n[0];w=n[1];E=n[2];l.metrics.marginX=parseInt(1.5+.075*this.style.size);l.metrics.paddingX=parseInt(1.5+.075*this.style.size);l.metrics.paddingY=parseInt(1.5+.05*this.style.size);l.metrics.offsetX_aux=e;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();J=d(a.ctx.font);F=parseInt(1.2*J.h);var G=parseInt(10.5+529*F/1E3);l.sign={w:G,h:F,scale:F/1E3};l.sign.parent=l;Object.defineProperties(l.sign,{x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX}},y:{get:function(){return c.metrics.offsetY+J.descent-(this.h+J.h)/2}}});n=J.descent-(F+J.h)/2-w.metrics.descent+F/3;Object.defineProperties(w.metrics,{parent:{value:l},integralWidth:{value:G},
newBaselineTo:{value:n},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt(4*this.integralWidth/5)}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaselineTo}}});k=J.descent+x.metrics.ascent/2;Object.defineProperties(x.metrics,{parent:{value:l},integralWidth:{value:G},newBaselineFrom:{value:k},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},
offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt(2*this.integralWidth/5)}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaselineFrom}}});G=Math.max(parseInt(3*G/5)+w.metrics.w,parseInt(2*G/5+x.metrics.w))+l.metrics.paddingX;Object.defineProperties(E.metrics,{parent:{value:l},whatDisplace:{value:G},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+
this.whatDisplace}},offsetY:{get:function(){return c.metrics.offsetY}}});l.metrics.w=G+E.metrics.w+2*l.metrics.paddingX;l.metrics.ascent=Math.max(E.metrics.ascent,-n+w.metrics.ascent)+l.metrics.paddingY;l.metrics.descent=Math.max(E.metrics.descent,k+x.metrics.descent,F-l.metrics.ascent)+l.metrics.paddingY;l.metrics.h=Math.max(l.metrics.ascent+l.metrics.descent,F);e+=2*l.metrics.marginX}else if("prod"===g.nodeType)l=g,l.updateFormula(),n=l.children,x=n[0],w=n[1],E=n[2],l.metrics.marginX=parseInt(1.5+
.075*this.style.size),l.metrics.paddingX=parseInt(1.5+.075*this.style.size),l.metrics.paddingY=parseInt(1.5+.05*this.style.size),l.metrics.offsetX_aux=e,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(),J=d(a.ctx.font),k=parseInt(1.2*J.h),n=parseInt(.5+
876*k/1E3),l.piSign={w:n,h:k,scale:k/1E3},F=Math.max(w.metrics.w,x.metrics.w,l.piSign.w),l.piSign.parent=l,Object.defineProperties(l.piSign,{prodWidth:{value:F},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+J.descent-(this.h+J.h)/2}}}),n=J.descent-w.metrics.descent-(k+J.h)/2-l.metrics.paddingY,Object.defineProperties(w.metrics,{parent:{value:l},prodWidth:{value:F},newBaselineTo:{value:n},
x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.prodWidth-this.w)/2)}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaselineTo}}}),k=x.metrics.ascent+J.descent+(k-J.h)/2+l.metrics.paddingY,Object.defineProperties(x.metrics,{parent:{value:l},prodWidth:{value:F},newBaselineFrom:{value:k},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(E.metrics,{parent:{value:l},prodWidth:{value:F},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}}}),
l.metrics.w=F+E.metrics.w+3*l.metrics.paddingX,l.metrics.ascent=Math.max(E.metrics.ascent,-n+w.metrics.ascent)+l.metrics.paddingY,l.metrics.descent=Math.max(E.metrics.descent,k+x.metrics.descent)+l.metrics.paddingY,l.metrics.h=l.metrics.ascent+l.metrics.descent,e+=2*l.metrics.marginX;else if("limit"===g.nodeType){k=g;k.updateFormula();n=k.children;var D=n[0];l=n[1];n=n[2];k.metrics.marginX=parseInt(1.5+.075*this.style.size);k.metrics.paddingX=parseInt(1.5+.075*this.style.size);k.metrics.paddingY=
parseInt(1.5+.05*this.style.size);k.metrics.offsetX_aux=e;Object.defineProperties(k.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();J=d(a.ctx.font);x=parseInt(.5+a.ctx.measureText("l\u00edm").width);w=parseInt(.5+a.ctx.measureText("\u2192").width);E=Math.max(x,D.metrics.w+w+l.metrics.w);
k.limitText={parent:k};Object.defineProperties(k.limitText,{limitWidth:{value:E},limitTextWidth:{value:x},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+(this.limitWidth-this.limitTextWidth)/2}}});x=J.descent+Math.max(D.metrics.ascent,l.metrics.ascent,2*J.ascent/3)+k.metrics.paddingY;k.limitArrow={parent:k};Object.defineProperties(k.limitArrow,{newBaseline:{value:x},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+D.metrics.w}},y:{get:function(){return c.metrics.offsetY+
this.newBaseline}}});Object.defineProperties(D.metrics,{parent:{value:k},newBaseline:{value:x},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaseline}}});Object.defineProperties(l.metrics,{parent:{value:k},arrowWidth:{value:w},newBaseline:{value:x},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},
offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+D.metrics.w+this.arrowWidth}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaseline}}});Object.defineProperties(n.metrics,{parent:{value:k},limitWidth:{value:E},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+2*this.parent.metrics.paddingX+this.limitWidth}},offsetY:{get:function(){return c.metrics.offsetY}}});
k.metrics.w=E+n.metrics.w+3*k.metrics.paddingX;k.metrics.ascent=Math.max(n.metrics.ascent,J.ascent)+k.metrics.paddingY;w=0;n=Math.max(D.metrics.descent,l.metrics.descent,n.metrics.descent);if(0!=D.metrics.h||0!=l.metrics.h)w=x,n=Math.max(D.metrics.descent,l.metrics.descent,n-w);k.metrics.descent=w+n+k.metrics.paddingY;k.metrics.h=k.metrics.ascent+k.metrics.descent;e+=2*k.metrics.marginX}else if("matrix"===g.nodeType){x=g;x.updateFormula();n=x.children;w=x.rows;E=x.columns;x.metrics.marginX=parseInt(1.5+
.075*this.style.size);x.metrics.paddingX=parseInt(5+.075*this.style.size);x.metrics.paddingY=parseInt(1.5+.05*this.style.size);x.metrics.offsetX_aux=e;Object.defineProperties(x.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY}}});a.ctx.font=g.style.toString();J=d(a.ctx.font);F=[];G=[];k=0;for(var B=w*E;k<B;k++){var L=
parseInt(k/E);var H=k%E;F[L]=Math.max(F[L]||0,n[k].metrics.h);G[H]=Math.max(G[H]||0,n[k].metrics.w)}var M=(1+E)*x.metrics.paddingX;for(k=0;k<E;k++)M+=G[k];var P=(1+w)*x.metrics.paddingY;for(k=0;k<w;k++)P+=F[k];l=J.descent-J.h/2;k=0;for(B=w*E;k<B;k++)L=parseInt(k/E),H=k%E,n[k].metrics.offsetX_aux=h(G,H)+(G[H]-n[k].metrics.w)/2+H*x.metrics.paddingX,n[k].metrics.offsetY_aux=h(F,L)+(F[L]-n[k].metrics.h)/2+(1+L)*x.metrics.paddingY,Object.defineProperties(n[k].metrics,{parent:{value:x},matrixH:{value:P},
dispY:{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+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY-this.matrixH/2+this.ascent+this.offsetY_aux+this.dispY}}});x.metrics.w=M;x.metrics.ascent=P/2-l;x.metrics.descent=P/2+l;x.metrics.h=x.metrics.ascent+x.metrics.descent;e+=2*x.metrics.marginX}else if("defparts"===g.nodeType){x=g;x.updateFormula();n=g.children;
w=g.parts;x.metrics.marginX=parseInt(1.5+.075*this.style.size);x.metrics.paddingX=parseInt(1.5+.075*this.style.size);x.metrics.paddingY=parseInt(1.5+.05*this.style.size);x.metrics.offsetX_aux=e;Object.defineProperties(x.metrics,{parent:{value:c},x:{get:function(){return this.offsetX-2*this.marginX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+3*this.marginX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY}}});a.ctx.font=
g.style.toString();J=d(a.ctx.font);E=0;F=x.metrics.paddingY;l=J.descent-J.h/2;for(k=0;k<w;k++)n[k].metrics.offsetY_aux=F,E=Math.max(E,n[k].metrics.w),F+=n[k].metrics.h+x.metrics.paddingY,Object.defineProperties(n[k].metrics,{parent:{value:x},dispY:{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}},offsetY:{get:function(){return c.metrics.offsetY-this.parent.metrics.defpartsH/
2+this.ascent+this.offsetY_aux+this.dispY}}});x.metrics.defpartsH=F;x.metrics.w=E+4*x.metrics.paddingX;x.metrics.ascent=F/2-l;x.metrics.descent=F/2+l;x.metrics.h=x.metrics.ascent+x.metrics.descent;e+=2*x.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;k=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;e+=g.metrics.w}};k.prototype.justifyAux=function(a){for(var b=0,c=0,e=0,d=this.children.length;e<d-1;e++)"space"===this.children[e].nodeType?b++:c+=this.children[e].metrics.w;this.updateLine((a-c)/b)};k.prototype.drawTextBlock=function(a){a.fillStyle=q;a.shadowBlur=this.style.shadowBlur;a.shadowOffsetX=this.style.shadowOffsetX;a.shadowOffsetY=this.style.shadowOffsetY;a.shadowColor=this.style.shadowColor;
for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);a.shadowColor="transparent"};k.prototype.drawTextLineBlock=function(a){for(var b=0,c=this.children.length;b<c;b++)e=!1,this.children[b].draw(a)};k.prototype.drawText=function(a){if(""!==this.value){var b=this.metrics.x,c=this.metrics.y;a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:q;a.font=this.style.toString(e);a.beginPath();this.style.overline&&(a.rect(b,c-this.metrics.ascent+
parseInt(1+this.style.size/25),this.metrics.w,parseInt(1+this.style.size/25)),a.fill());this.style.underline&&(a.rect(b,c+parseInt(1+this.style.size/10),this.metrics.w,parseInt(1+this.style.size/25)),a.fill());if(this.style.border){var d=a.strokeStyle;a.lineWidth=this.style.border_size&&0<parseInt(this.style.border_size)?parseInt(this.style.border_size):1+parseInt(this.style.size/8);a.lineJoin="round";a.miterLimit=2;a.strokeStyle=this.style.border.getColor();a.strokeText(this.value,b,c);a.strokeStyle=
d}a.fillText(this.value,b,c)}};k.prototype.drawWord=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a)};k.prototype.drawSpace=function(a){};k.prototype.drawDynamicText=function(a){var b=this.metrics.x+this.metrics.paddingX,c=this.metrics.y;a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:q;a.font=this.style.toString(e);a.beginPath();this.style.overline&&(a.rect(b,c-this.metrics.ascent+parseInt(1+this.style.size/
25),this.metrics.w,parseInt(1+this.style.size/25)),a.fill());this.style.underline&&(a.rect(b,c+parseInt(1+this.style.size/10),this.metrics.w,parseInt(1+this.style.size/25)),a.fill());a.fillText(this.evalValue,b,c);this.drawBorder(a,"blue")};k.prototype.drawHyperlink=function(a){var b=this.metrics.x,c=this.metrics.y;this.ctx=a;this.clickCatcher.parentNode||(a.canvas.nextSibling.className?a.canvas.parentNode.insertBefore(this.clickCatcher,a.canvas.nextSibling.nextSibling):a.canvas.parentNode.insertBefore(this.clickCatcher,
a.canvas.nextSibling));this.clickCatcher.style.left=b+"px";this.clickCatcher.style.top=c-this.metrics.ascent+"px";a.fillStyle="blue";this.click&&(a.fillStyle="white",a.fillRect(b,c-this.metrics.ascent,this.metrics.w,this.metrics.h),a.fillStyle="red");a.font=this.style.toString(e);a.beginPath();a.rect(b,c+parseInt(1+this.style.size/10),this.metrics.w,parseInt(1+this.style.size/25));a.fill();a.fillText(this.value,b,c)};k.prototype.drawFormula=function(a){for(var b=0,c=this.children.length;b<c;b++)e=
!0,this.children[b].draw(a);this.drawBorder(a,"blue")};k.prototype.drawFraction=function(a){a.lineWidth=5;a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:q;a.beginPath();var b=parseInt(1+this.style.size/24);a.rect(this.metrics.x,this.metrics.offsetY-parseInt(b/2),this.metrics.w,b);a.fill();this.children[0].draw(a);this.children[1].draw(a);this.drawBorder(a,"blue")};k.prototype.drawNumDen=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);
this.drawBorder(a,"blue")};k.prototype.drawSuperIndex=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};k.prototype.drawSubIndex=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};k.prototype.drawRadical=function(a){a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:q;a.save();a.translate(this.radicalSign.x,this.radicalSign.y);a.scale(this.radicalSign.scaleX,
this.radicalSign.scaleY);this.drawRadicalSign(a);a.restore();a.beginPath();a.fillRect(this.children[1].metrics.x+2.5,this.radicalSign.y-.5,this.children[1].metrics.w-1.5,parseInt(1+this.style.size/18));for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};k.prototype.drawSum=function(a){a.save();a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:q;a.translate(this.sigmaSign.x,this.sigmaSign.y);a.scale(this.sigmaSign.scale,
this.sigmaSign.scale);if(this.style.border){var b=a.strokeStyle;a.lineWidth=this.style.border_size&&0<parseInt(this.style.border_size)?parseInt(this.style.border_size):1+parseInt(this.style.size/8);a.lineWidth=parseInt(a.lineWidth/this.sigmaSign.scale);a.lineJoin="round";a.miterLimit=2;a.strokeStyle=this.style.border.getColor();a.strokeStyle=b}this.drawSigmaSign(a);a.restore();b=0;for(var c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};k.prototype.drawIntegral=function(a){a.save();
a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:q;a.translate(this.sign.x,this.sign.y);a.scale(this.sign.scale,this.sign.scale);this.drawIntegralSign(a);a.restore();for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};k.prototype.drawProd=function(a){a.save();a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:q;a.translate(this.piSign.x,this.piSign.y);
a.scale(this.piSign.scale,this.piSign.scale);this.drawProdSign(a);a.restore();for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};k.prototype.drawLimit=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:q;a.font=this.style.toString();a.fillText("l\u00edm",this.limitText.x,this.metrics.y);0!=this.children[1].metrics.h&&a.fillText("\u2192",
this.limitArrow.x,this.limitArrow.y);this.drawBorder(a,"blue")};k.prototype.drawMatrix=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);c=parseInt(1.5+this.style.size/25);b=c/2;a.lineWidth=c;a.strokeStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:q;a.beginPath();if(0==this.matrix_type)a.moveTo(this.metrics.x+b+1.5*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+b,this.metrics.y+b-
this.metrics.ascent),a.lineTo(this.metrics.x+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.lineTo(this.metrics.x+b+1.5*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.moveTo(this.metrics.x+this.metrics.w-b-1.5*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+this.metrics.w-b,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+this.metrics.w-b,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.lineTo(this.metrics.x+
this.metrics.w-b-1.5*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent+this.metrics.h);else if(1==this.matrix_type)a.moveTo(this.metrics.x+b+2*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent),a.bezierCurveTo(this.metrics.x-b,this.metrics.y+b-this.metrics.ascent,this.metrics.x-b,this.metrics.y+b-this.metrics.ascent+this.metrics.h,this.metrics.x+b+2*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.moveTo(this.metrics.x+this.metrics.w-b-2*this.metrics.marginX,
this.metrics.y+b-this.metrics.ascent),a.bezierCurveTo(this.metrics.x+this.metrics.w+b,this.metrics.y+b-this.metrics.ascent,this.metrics.x+this.metrics.w+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h,this.metrics.x+this.metrics.w-b-2*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent+this.metrics.h);else if(2==this.matrix_type){c=3*this.metrics.marginX;var e=c/2;a.moveTo(this.metrics.x+b+c,this.metrics.y+b-this.metrics.ascent);a.bezierCurveTo(this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent,
this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent,this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+2*this.metrics.marginX);a.lineTo(this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2-5*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2);a.bezierCurveTo(this.metrics.x+
b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2+5*this.metrics.marginX);a.lineTo(this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h-2*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+b+e,this.metrics.y-b-this.metrics.ascent+this.metrics.h,this.metrics.x+b+e,this.metrics.y-b-this.metrics.ascent+this.metrics.h,this.metrics.x+
b+c,this.metrics.y-b-this.metrics.ascent+this.metrics.h);a.moveTo(this.metrics.x+this.metrics.w+b-c,this.metrics.y+b-this.metrics.ascent);a.bezierCurveTo(this.metrics.x+this.metrics.w+b-e,this.metrics.y+b-this.metrics.ascent,this.metrics.x+this.metrics.w+b-e,this.metrics.y+b-this.metrics.ascent,this.metrics.x+this.metrics.w+b-e,this.metrics.y+b-this.metrics.ascent+2*this.metrics.marginX);a.lineTo(this.metrics.x+this.metrics.w+b-e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2-5*this.metrics.marginX);
a.bezierCurveTo(this.metrics.x+this.metrics.w+b-e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+this.metrics.w+b-e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+this.metrics.w+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2);a.bezierCurveTo(this.metrics.x+this.metrics.w+b-e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+this.metrics.w+b-e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+this.metrics.w+
b-e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2+5*this.metrics.marginX);a.lineTo(this.metrics.x+this.metrics.w+b-e,this.metrics.y+b-this.metrics.ascent+this.metrics.h-2*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+this.metrics.w+b-e,this.metrics.y-b-this.metrics.ascent+this.metrics.h,this.metrics.x+this.metrics.w+b-e,this.metrics.y-b-this.metrics.ascent+this.metrics.h,this.metrics.x+this.metrics.w+b-c,this.metrics.y-b-this.metrics.ascent+this.metrics.h)}else 3==this.matrix_type?
(a.moveTo(this.metrics.x+b,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.moveTo(this.metrics.x+this.metrics.w-b,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+this.metrics.w-b,this.metrics.y+b-this.metrics.ascent+this.metrics.h)):4==this.matrix_type&&(a.moveTo(this.metrics.x+b,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.moveTo(this.metrics.x+
b+1.25*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+b+1.25*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.moveTo(this.metrics.x+this.metrics.w-b,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+this.metrics.w-b,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.moveTo(this.metrics.x+this.metrics.w-b-1.25*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+this.metrics.w-b-1.25*this.metrics.marginX,
this.metrics.y+b-this.metrics.ascent+this.metrics.h));a.stroke();this.drawBorder(a,"blue")};k.prototype.drawDefparts=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);c=parseInt(1.5+this.style.size/25);b=c/2;a.lineWidth=c;a.strokeStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:q;a.beginPath();c=3*this.metrics.marginX;var e=c/2;a.moveTo(this.metrics.x+b+c,this.metrics.y+b-this.metrics.ascent);a.bezierCurveTo(this.metrics.x+
b+e,this.metrics.y+b-this.metrics.ascent,this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent,this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+2*this.metrics.marginX);a.lineTo(this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2-5*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h/
2);a.bezierCurveTo(this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2+5*this.metrics.marginX);a.lineTo(this.metrics.x+b+e,this.metrics.y+b-this.metrics.ascent+this.metrics.h-2*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+b+e,this.metrics.y-b-this.metrics.ascent+this.metrics.h,this.metrics.x+b+e,this.metrics.y-b-this.metrics.ascent+
this.metrics.h,this.metrics.x+b+c,this.metrics.y-b-this.metrics.ascent+this.metrics.h);a.stroke();this.drawBorder(a,"blue")};k.prototype.drawGenericBlock=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};k.prototype.drawComponentNumCtrl=function(a){this.componentNumCtrl.expresion=this.evaluator.parser.parse("("+this.metrics.x+","+(this.metrics.y-this.metrics.ascent)+","+this.componentNumCtrl.w+","+this.componentNumCtrl.h+")");this.componentNumCtrl&&
this.componentNumCtrl.parent&&this.componentNumCtrl.parent.readyApp&&this.componentNumCtrl.update(!0)};k.prototype.drawComponentSpace=function(a){this.componentSpace.xExpr=this.evaluator.parser.parse(this.metrics.x.toString());this.componentSpace.yExpr=this.evaluator.parser.parse((this.metrics.y-this.metrics.ascent).toString());this.componentSpace&&this.componentSpace.parent&&this.componentSpace.parent.readyApp&&this.componentSpace.update(!0)};k.prototype.drawRadicalSign=function(a){a.beginPath();
a.moveTo(759,1);a.bezierCurveTo(751,1,744,5,739,15);a.lineTo(325,878);a.lineTo(153,500);a.bezierCurveTo(148,489,142,486,136,491);a.lineTo(2,596);a.bezierCurveTo(-3,600,19,626,24,622);a.lineTo(89,575);a.lineTo(282,997);a.bezierCurveTo(285,1003,309,1003,314,993);a.lineTo(773,40);a.lineTo(773,1);a.closePath();a.stroke();a.fill()};k.prototype.drawSigmaSign=function(a){a.beginPath();a.moveTo(780,707);a.lineTo(750,707);a.bezierCurveTo(728,805,695,872,585,872);a.lineTo(180,872);a.lineTo(509,447);a.lineTo(225,
65);a.lineTo(538,65);a.bezierCurveTo(668,65,705,114,726,246);a.lineTo(756,246);a.lineTo(756,0);a.lineTo(25,0);a.lineTo(384,500);a.lineTo(0,1E3);a.lineTo(729,1E3);a.closePath();a.stroke();a.fill()};k.prototype.drawIntegralSign=function(a){a.beginPath();a.moveTo(150,828);a.bezierCurveTo(129,916,108,972,67,972);a.bezierCurveTo(61,972,58,970,58,966);a.bezierCurveTo(58,957,73,958,73,932);a.bezierCurveTo(73,918,60,910,46,910);a.bezierCurveTo(22,910,1,932,1,961);a.bezierCurveTo(1,981,22,1E3,57,1E3);a.bezierCurveTo(154,
1E3,198,895,216,824);a.lineTo(375,181);a.bezierCurveTo(398,90,420,27,464,28);a.bezierCurveTo(470,28,473,30,473,34);a.bezierCurveTo(473,41,458,47,458,69);a.bezierCurveTo(458,83,471,89,485,89);a.bezierCurveTo(509,89,530,67,530,38);a.bezierCurveTo(530,18,508,0,473,0);a.bezierCurveTo(368,0,326,120,309,190);a.closePath();a.stroke();a.fill()};k.prototype.drawProdSign=function(a){a.beginPath();a.moveTo(876.3561,999.59384);a.lineTo(876.3561,972.20771);a.lineTo(858.75073,972.20771);a.bezierCurveTo(794.19771,
972.20771,761.92121,931.12852,761.92121,847.99206);a.lineTo(761.92121,144.75542);a.bezierCurveTo(761.92121,61.618964,789.30733,27.386304,876.3561,27.386304);a.lineTo(876.3561,1.7633057E-4);a.lineTo(1.184082E-5,1.7633057E-4);a.lineTo(1.184082E-5,27.386304);a.lineTo(16.627304,27.386304);a.bezierCurveTo(77.268015,27.386304,115.41298,51.838204,115.41298,148.66773);a.lineTo(115.41298,865.59743);a.bezierCurveTo(115.41298,936.99697,84.114547,972.20771,18.583456,972.20771);a.lineTo(1.184082E-5,972.20771);
a.lineTo(1.184082E-5,999.59384);a.lineTo(359.93198,999.59384);a.lineTo(359.93198,972.20771);a.lineTo(329.61162,972.20771);a.bezierCurveTo(265.0586,972.20771,243.54093,932.10659,243.54093,841.14553);a.lineTo(243.54093,64.553192);a.lineTo(633.79325,64.553192);a.lineTo(633.79325,841.14553);a.bezierCurveTo(633.79325,916.45738,616.18788,972.20771,547.72257,972.20771);a.lineTo(516.42413,972.20771);a.lineTo(516.42413,999.59384);a.closePath();a.stroke();a.fill()};k.prototype.drawBorderSpecial=function(a,
b){a.beginPath();a.setLineDash([1,2]);a.strokeStyle=b;a.lineWidth=1;a.rect(parseInt(this.metrics.x)+.5,parseInt(this.metrics.y-this.metrics.ascent)+.5,this.metrics.w,this.metrics.h);a.stroke();a.setLineDash([])};k.prototype.toRTF=function(){var a=[],b=[],e="";this.mergeTextNodes();for(var d=0,h=this.children.length;d<h;d++){var k=this.children[d];"textLineBlock"===k.nodeType&&(e+=k.toRTFAux(a,b)+(1<h&&d<h-1?"\\par":""))}k="{\\fonttbl";d=0;for(h=a.length;d<h;d++)k+="\\f"+d+"\\fcharset0 "+a[d]+";";
a="";if(0<b.length){a="{\\colortbl";d=0;for(h=b.length;d<h;d++)a+=b[d];a+="}"}return"{\\rtf1\\uc0"+(k+"}")+a+e+"}"};k.prototype.toRTFAux=function(a,b){for(var c,e,d,f=null,h="",k,l,m,p,y,A=0,E=this.children.length;A<E;A++)k=l="",c=this.children[A],m=this.addToFontTable(c.style.family,a),p=c.style.size,y=this.addToColorTable(c.style.color,b),null===y&&0<b.length&&(y=this.addToColorTable(q,b)),y!==f&&(k+="\\cf"+y,f=y),m!==e&&(k+="\\f"+m,e=m),p!==d&&(k+="\\fs"+2*p,d=p),c.style.italic&&(k+="\\i",l="\\i0"+
l),c.style.bold&&(k+="\\b",l="\\b0"+l),c.style.underline&&(k+="\\ul",l="\\ulnone"+l),c.style.overline&&(k+="\\ol",l="\\olnone"+l),"text"===c.nodeType?(c.value=c.value.replace(/\\{/g,"{").replace(/\\}/g,"}").replace(/{/g,"\\{").replace(/}/g,"\\}"),c=""!==k?k+" "+c.value+l:""!==h&&"}"!==h.charAt(h.length-1)?" "+c.value:c.value,h+=c):"formula"===c.nodeType?h+="{\\*\\mjaformula"+c.formulaToRTF(e,d,f,a,b)+"}":"componentSpace"===c.nodeType?h+="{\\*\\component\\Space "+c.value+"}":"componentNumCtrl"===c.nodeType&&
(h+="{\\*\\component\\NumCtrl "+c.value+"}");return h};k.prototype.formulaToRTF=function(a,b,e,d,h){for(var c,f="",g,k,m,p,r=0,v=this.children.length;r<v;r++)g=k="",c=this.children[r],m=this.addToFontTable(c.style.family,d),p=this.addToColorTable(c.style.color,h),null===p&&0<h.length&&(p=this.addToColorTable(q,h)),m!==a&&(g+="\\f"+m,a=m),p!==e&&(g+="\\cf"+p,"text"!==c.nodeType||"text"===c.nodeType&&""!==c.value)&&(e=p),c.style.italic&&(g+="\\i",k="\\i0"+k),c.style.bold&&(g+="\\b",k="\\b0"+k),c.style.underline&&
(g+="\\ul",k="\\ulnone"+k),c.style.overline&&(g+="\\ol",k="\\olnone"+k),"text"===c.nodeType&&""!==c.value?(c.value=c.value.replace(/\\{/g,"{").replace(/\\}/g,"}").replace(/{/g,"\\{").replace(/}/g,"\\}"),tmpRTF=""!==g?g+" "+c.value+k:"}"!==f.charAt(f.length-1)?" "+c.value:c.value,f+=tmpRTF):"dynamicText"===c.nodeType?(c.value=""===c.value?" ":c.value,f+=g+"{\\expr "+c.value+"\\decimals "+(c.decimals||2)+"\\fixed"+(c.fixed?1:0)+"}"+k):"fraction"===c.nodeType||"radical"===c.nodeType||"index"===c.nodeType||
"radicand"===c.nodeType||"sum"===c.nodeType||"integral"===c.nodeType||"prod"===c.nodeType||"limit"===c.nodeType||"from"===c.nodeType||"to"===c.nodeType||"what"===c.nodeType||"element"===c.nodeType?f+="{\\"+c.nodeType+c.formulaToRTF(a,b,e,d,h)+"}":"numerator"===c.nodeType?f+="{\\num"+c.formulaToRTF(a,b,e,d,h)+"}":"denominator"===c.nodeType?f+="{\\den"+c.formulaToRTF(a,b,e,d,h)+"}":"superIndex"===c.nodeType?f+="{\\supix"+c.formulaToRTF(a,b,e,d,h)+"}":"subIndex"===c.nodeType?f+="{\\subix"+c.formulaToRTF(a,
b,e,d,h)+"}":"matrix"===c.nodeType?f+="{\\matrix\\rows "+(c.rows||2)+"\\columns "+(c.columns||2)+c.formulaToRTF(a,b,e,d,h)+"}":"defparts"===c.nodeType&&(f+="{\\defparts\\parts "+(c.parts||2)+c.formulaToRTF(a,b,e,d,h)+"}");return f};k.prototype.addToFontTable=function(a,b){var c;a.match(/times/i)?c="Times New Roman":a.match(/courier/i)?c="Courier New":a.match(/arial/i)&&(c="Arial");a=b.indexOf(c);-1===a&&(a=b.length,b.push(c));return a};k.prototype.addToColorTable=function(a,b){if(a){a="\\red"+parseInt(a.substring(1,
3),16)+"\\green"+parseInt(a.substring(3,5),16)+"\\blue"+parseInt(a.substring(5,7),16)+";";var c=b.indexOf(a);-1===c&&(c=b.length,b.push(a));return c}return null};k.prototype.mergeTextNodes=function(){for(var a=[],b=null,e=0,d=this.children.length;e<d;e++)"text"===this.children[e].nodeType?null!==b&&"text"===b.nodeType&&b.style.equals(this.children[e].style)&&(this.children[e].value=b.value+this.children[e].value,a.push(b)):this.children[e].mergeTextNodes(),b=this.children[e];e=0;for(d=a.length;e<
d;e++)this.removeChild(a[e])};var m={sansserif:{ascent:1854,descent:-434,lineGap:67,capHeight:1409,xHeight:1082,unitsPerEm:2048},serif:{ascent:1825,descent:-443,lineGap:87,capHeight:1341,xHeight:940,unitsPerEm:2048},monospace:{ascent:1705,descent:-615,lineGap:0,capHeight:1349,xHeight:1082,unitsPerEm:2048}};a.TextNode=k;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=String.fromCharCode,d,e,q,p,b,k,m,c,f,g,v,r=function(){};r.prototype.tokenize=function(a){if(a)a=a.replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&quote;/g,"''").replace(/&squot;/g,"'").replace(/\\rquote /g,"'").replace(/\\endash /g,"-").replace(/\n/g," ").replace(/\r/g,"").replace(/\\uc(\d+) /g,"").replace(/\\uc(\d+)/g,"");else return[];d=[];e="";p=q=0;k=a.charAt(0);m=!1;for(c="text";q<a.length;)b=k,k=a.charAt(q+1),m?"\\"===k||"{"===k||"}"===
k||" "===k||";"===k?(m=!1,e+=b," "===k?(q++,k=a.charAt(q+1),v=!0):v=!1,(f=e.match(/^'([0-9a-f]{2})/))?(g="","text"===c&&(g=d.pop().value),e=g+=h(parseInt(f[1],16))+e.substring(3)):(f=e.match(/^u[0-9]+/))?(g="","text"===c&&(g=d.pop().value),e=g+=h(f[0].substring(1))):("{"===e||"}"===e||"\\"==b?(d.push({type:"text",value:e+(v?" ":"")}),c="text"):(d.push({type:"controlWord",value:e}),c="controlWord"),e="")):"{"==b||"}"==b||"\\"==b?(m=!1,d.push({type:"text",value:b}),c="text"):e+=b:"\\"===b?(m=!0,""!==
e&&(d.push({type:"text",value:e}),c="text",e="")):"{"===b?(p++,""!==e&&(d.push({type:"text",value:e}),e=""),d.push({type:"openBlock",value:p}),c="openBlock"):"}"===b?(""!==e&&(d.push({type:"text",value:e}),e=""),d.push({type:"closeBlock",value:p}),c="closeBlock",p--):e+=b,q++;""!==e&&d.push({type:"text",value:e});return d};a.RTFTokenizer=r;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.max,d,e,q,p,b,k,m,c,f,g,v,r,u,z,n,l,x,w,y,A,E,J,F,G,D,B,L,H,M,P,I,O=function(b){this.evaluator=b;this.tokenizer=new a.RTFTokenizer};O.prototype.parse=function(C){d=this.tokenizer.tokenize(C);e={};p=2;if("openBlock"===d[0].type&&"fonttbl"===d[1].value){for(q=d[0].value;"closeBlock"!==d[p].type&&d[p].value!==q;)e[d[p].value]=d[p+2].value.substring(0,d[p+2].value.length-1),p+=3;p++}b={};k=0;if("openBlock"===d[p].type&&"colortbl"===d[p+1].value){q=
d[p++].value;for(p++;"closeBlock"!==d[p].type&&d[p].value!==q;)m=parseInt(d[p++].value.substring(3)).toString(16),c=parseInt(d[p++].value.substring(5)).toString(16),f=parseInt(d[p++].value.substring(4)).toString(16),";"===d[p].value&&p++,b[k++]="#"+(2>m.length?"0"+m:m)+(2>c.length?"0"+c:c)+(2>f.length?"0"+f:f);p++}z=u=r=null;M=H=L=E=A=y=w=x=l=n=!1;J=[new a.TextStyle];F=J[0];D=G=-1;B=[];g=P=new a.TextNode("","textBlock",F,this.evaluator);v=new a.TextNode("","textLineBlock",F,this.evaluator);g.addChild(v);
P.stableWidth=!0;P.hasFormula=!1;C=p;for(var O=d.length;C<O;C++){if("controlWord"==d[C].type)if(e[d[C].value])F.set({family:e[d[C].value]});else if(d[C].value.match(/^fs(\d+)/))F.set({size:parseInt(d[C].value.match(/^fs(\d+)/)[1]/2)});else if("b"==d[C].value)F.set({bold:!0}),0<B.length&&B[B.length-1].style.set({bold:!0});else if("b0"==d[C].value)F.set({bold:!1}),0<B.length&&B[B.length-1].style.set({bold:!1});else if("i"==d[C].value)F.set({italic:!0}),0<B.length&&B[B.length-1].style.set({italic:!0});
else if("i0"==d[C].value)F.set({italic:!1}),0<B.length&&B[B.length-1].style.set({italic:!1});else if("ul"==d[C].value)F.set({underline:!0}),0<B.length&&B[B.length-1].style.set({underline:!0});else if("ulnone"==d[C].value)F.set({underline:!1}),0<B.length&&B[B.length-1].style.set({underline:!1});else if("ol"==d[C].value)F.set({overline:!0}),0<B.length&&B[B.length-1].style.set({overline:!0});else if("olnone"==d[C].value)F.set({overline:!1}),0<B.length&&B[B.length-1].style.set({overline:!1});else if(d[C].value.match(/^cf(\d+)/))F.set({color:b[parseInt(d[C].value.substring(2))]}),
0<B.length&&(B[B.length-1].style.color=F.color);else if("par"==d[C].value){g=new a.TextNode("","textLineBlock",F.clone(),this.evaluator);if("textBlock"!=v.nodeType)for(v=v.parent;"textBlock"!=v.nodeType;)v=v.parent;v.addChild(g);v=g}else if("mjaformula"==d[C].value)P.hasFormula=!0,D=G,n=!0,g=new a.TextNode("","formula",F.clone(),this.evaluator),v.addChild(g),v=g,B[B.length-1]=g;else if("fraction"==d[C].value||"radicand"==d[C].value||"radical"==d[C].value||"what"==d[C].value||"sum"==d[C].value||"integral"==
d[C].value||"limit"==d[C].value){var K=B[B.length-2].style.clone();g=new a.TextNode("",d[C].value,K,this.evaluator);B[B.length-2].addChild(g);B[B.length-1]=g}else"index"==d[C].value?(K=B[B.length-2].style.clone(),K.size=h(parseInt(K.size-.5*K.size),8),g=new a.TextNode("",d[C].value,K,this.evaluator),B[B.length-2].addChild(g),B[B.length-1]=g):"to"==d[C].value||"from"==d[C].value?(K=B[B.length-2].style.clone(),K.size=h(parseInt(K.size-.2*K.size),8),g=new a.TextNode("",d[C].value,K,this.evaluator),B[B.length-
2].addChild(g),B[B.length-1]=g):"num"==d[C].value||"den"==d[C].value?(K=B[B.length-2].style.clone(),K.size=h(Math.round(K.size-.1*K.size),8),"num"==d[C].value?g=new a.TextNode("","numerator",K,this.evaluator):"den"==d[C].value&&(g=new a.TextNode("","denominator",K,this.evaluator)),B[B.length-2].addChild(g),B[B.length-1]=g):"subix"==d[C].value||"supix"==d[C].value?(K=B[B.length-2].style.clone(),K.size=h(Math.floor(K.size-.33*K.size),8),"subix"==d[C].value?g=new a.TextNode("","subIndex",K,this.evaluator):
"supix"==d[C].value&&(g=new a.TextNode("","superIndex",K,this.evaluator)),g.originalStyle=B[B.length-2].style.clone(),B[B.length-2].addChild(g),B[B.length-1]=g):"defparts"==d[C].value||"matrix"==d[C].value||"element"==d[C].value?(K=B[B.length-2].style.clone(),g=new a.TextNode("",d[C].value,K,this.evaluator),B[B.length-2].addChild(g),B[B.length-1]=g,"defparts"==d[C].value?z=g:"matrix"==d[C].value&&(u=g,u.matrix_type=0)):"parts"==d[C].value?E=!0:"type"==d[C].value?w=!0:"rows"==d[C].value?y=!0:"columns"==
d[C].value?A=!0:"expr"==d[C].value?(P.stableWidth=!1,l=!0):"decimals"==d[C].value?x=!0:"fixed1"==d[C].value?r.fixed=!0:"fixed0"==d[C].value?r.fixed=!1:"component"!=d[C].value&&("NumCtrl"==d[C].value?L=!0:"Space"==d[C].value?H=!0:"hyperlink"==d[C].value&&(M=!0));if("text"==d[C].type)if(E)z.parts=parseInt(d[C].value),E=!1;else if(w)u.matrix_type=parseInt(d[C].value),w=!1;else if(y)u.rows=parseInt(d[C].value),y=!1;else if(A)u.columns=parseInt(d[C].value),A=!1;else if(x)r.decimals=this.evaluator.parser.parse(d[C].value+
""),x=!1;else if(M){I=d[C].value.split("|")[0];K=F.clone();g=new a.TextNode(I,"hyperlink",K,this.evaluator);g.URL=d[C].value.split("|")[1];if("textLineBlock"!=v.nodeType)for(v=v.parent;"textLineBlock"!=v.nodeType;)v=v.parent;v.addChild(g);M=!1}else if(L)g=new a.TextNode(d[C].value,"componentNumCtrl",F.clone(),this.evaluator),v.addChild(g),L=!1;else if(H)g=new a.TextNode(d[C].value,"componentSpace",F.clone(),this.evaluator),v.addChild(g),H=!1;else if(l)K=B[B.length-2].style.clone(),I=this.evaluator.parser.parse(d[C].value),
g=new a.TextNode(I,"dynamicText",K,this.evaluator),B[B.length-2].addChild(g),r=B[B.length-1]=g,l=!1;else if(l||n)!l&&n&&(I=d[C].value,g=new a.TextNode(I,"text",B[B.length-1].style.clone(),this.evaluator),B[B.length-1].addChild(g));else{I=d[C].value;g=new a.TextNode(I,"text",F.clone(),this.evaluator);if("textLineBlock"!=v.nodeType)for(v=v.parent;"textLineBlock"!=v.nodeType;)v=v.parent;v.addChild(g)}else if("openBlock"==d[C].type)G=d[C].value,F=F.clone(),J.push(F),B.push(null);else if("closeBlock"==
d[C].type)d[C].value==D&&(D=-1,n=!1,v=v.parent),J.pop(),F=J[J.length-1],B.pop();else if("("==d[C].type||")"==d[C].type)K=B[B.length-1].style.clone(),K.italic="",g=new a.TextNode(d[C].type,"mathSymbol",K,this.evaluator),B[B.length-1].addChild(g);else if("+"==d[C].type||"-"==d[C].type||"*"==d[C].type||"="==d[C].type)g=new a.TextNode(d[C].type,"mathSymbol",B[B.length-1].style.clone(),this.evaluator),B[B.length-1].addChild(g)}return P.normalize()};a.RTFParser=O;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,d,e,q,p,b,k,m,c,f,g,v=function(b,c){this.parent=b;d=this.evaluator=this.parent.evaluator;e=d.parser;this.id="";this.type="2D";this.xExpr=e.parse("0");this.yExpr=e.parse("0");this.w=parseInt(b.container.width);this.h=parseInt(b.container.height);this.drawif=e.parse("1");this.fixed=!1;this.scale=48;this.Oy=this.Ox=0;this.image=new Image;this.image.onload=function(){this.ready=1};this.imageSrc="";this.bg_display="topleft";this.background=new a.Color("ffffff");
this.net=new a.Color("b8c4c8");this.net10=new a.Color("889498");this.axes=new a.Color("405860");this.numbers=this.text=!1;this.y_axis=this.x_axis="";this.sensitive_to_mouse_movements=!1;this.cID="";this.mouse_y=this.mouse_x=0;this.ctrs=[];this.graphicsCtr=[];this.graphics=[];this.backGraphics=[];this.zIndex=b.zIndex;this.border_width=0;this.border_color=new a.Color("000000");this.border_radius=0;this.plecaHeight=b.plecaHeight||0;this.displaceRegionNorth=b.displaceRegionNorth||0;this.displaceRegionWest=
b.displaceRegionWest||0;Object.assign(this,c);this.initSpace()};v.prototype.initSpace=function(){var a=this;h=a.parent;d=a.evaluator;q=a.id;a.resizable||(a.displaceRegionNorth=h.displaceRegionNorth||0,a.displaceRegionSouth=h.displaceRegionSouth||0,a.displaceRegionEast=h.displaceRegionEast||0,a.displaceRegionWest=h.displaceRegionWest||0,m=parseInt(h.container.width),k=parseInt(h.container.height),void 0!=a.wExpr&&(a.w=parseInt(m-a.displaceRegionWest-a.displaceRegionEast)*parseFloat(a.wExpr)/100),void 0!=
a.hExpr&&(a.h=parseInt(k-a.displaceRegionNorth-a.displaceRegionSouth)*parseFloat(a.hExpr)/100),void 0!=a.xPercentExpr&&(a.xExpr=d.parser.parse((parseInt(m-a.displaceRegionWest-this.displaceRegionEast)*parseFloat(a.xPercentExpr)/100).toString())),void 0!=a.yPercentExpr&&(a.yExpr=d.parser.parse((parseInt(k-a.displaceRegionNorth-a.displaceRegionSouth)*parseFloat(a.yPercentExpr)/100).toString())),a.x=d.eval(a.xExpr)+a.displaceRegionWest,a.y=d.eval(a.yExpr)+a.plecaHeight+a.displaceRegionNorth,a.container&&
(a.container.style.left=a.x+"px",a.container.style.top=a.y+"px"),0<=a.y?(p=k-a.y,a.h>p&&(a.h=p)):(p=a.h+a.y,a.h=p>=k?k:p),0<=a.x?(b=m-a.x,a.w>b&&(a.w=b)):(b=a.w+a.x,a.w=b>=m?m:b));""==a.imageSrc&&/vacio.gif$/i.test(a.imageSrc.trim())||(a.image=h.getImage(a.imageSrc));a.OxExpr&&(f=a.OxExpr,"%"===f[f.length-1]?a.Ox=a.w*parseFloat(f)/100:(c=parseFloat(f),c!=f&&(c=0),a.Ox=c));a.OyExpr&&(g=a.OyExpr,"%"===g[g.length-1]?a.Oy=a.h*parseFloat(g)/100:(c=parseFloat(g),c!=g&&(c=0),a.Oy=c));""!==a.id&&2!==h.version?
(d.setVariable(q+"._w",a.w),d.setVariable(q+"._h",a.h),d.setVariable(q+".escala",d.getVariable(q+".escala")||a.scale),d.setVariable(q+".Ox",d.getVariable(q+".Ox")||a.Ox),d.setVariable(q+".Oy",d.getVariable(q+".Oy")||a.Oy),d.setVariable(q+".mouse_x",0),d.setVariable(q+".mouse_y",0),d.setVariable(q+".mouse_pressed",0),d.setVariable(q+".mouse_clicked",0),d.setVariable(q+".clic_izquierdo",0)):(c=d.getVariable("_w"),d.setVariable("_w",void 0===c?a.w:c),c=d.getVariable("_h"),void 0===c&&(c=a.h),d.setVariable("_h",
c),c=d.getVariable("escala"),void 0===c&&(c=a.scale),d.setVariable("escala",c),c=d.getVariable("Ox"),void 0===c&&(c=a.Ox),d.setVariable("Ox",c),c=d.getVariable("Oy"),void 0===c&&(c=a.Oy),d.setVariable("Oy",c),d.setVariable("mouse_x",0),d.setVariable("mouse_y",0),d.setVariable("mouse_pressed",0),d.setVariable("mouse_clicked",0),d.setVariable("clic_izquierdo",0),2==h.version&&""===a.x_axis&&""===a.y_axis&&(a.axes=""));a.w_2=a.w/2;a.h_2=a.h/2;d.setFunction(q+".download_image",function(b){a.evaluator.functions._SaveSpace_(b,
a.canvas.toDataURL("image/png"))})};v.prototype.addCtr=function(a){"GraphicControl"===a.type?this.graphicsCtr.push(a):this.ctrs.push(a)};v.prototype.addGraph=function(a,b){"2D"===this.type&&b||"3D"===this.type&&!b||(a.background&&"3D"!==this.type?this.backGraphics.push(a):this.graphics.push(a))};v.prototype.clearClick=function(){this.evaluator.setVariable(this.mclickedString,0);this.evaluator.setVariable(this.mclicizquierdoString,0)};v.prototype.getRelativeX=function(a){return(parseInt(a)-this.w_2-
this.Ox)/this.scale};v.prototype.getRelativeY=function(a){return(-parseInt(a)+this.h_2+this.Oy)/this.scale};v.prototype.getAbsoluteX=function(a){return a*this.scale+this.w_2+this.Ox};v.prototype.getAbsoluteY=function(a){return-a*this.scale+this.h_2+this.Oy};a.Space=v;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,d=function(e){h=this;h.parent=e;h.width=228;h.vSpace=25;h.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:"+(h.width+27)+"px;height:460px;"});h.movable=a.newHTML("div",{style:"position:absolute;left:0;top:0;width:"+(h.width+27)+"px;height:"+h.vSpace+
"px;line-height:"+h.vSpace+"px;background-color:#ddd;cursor:move;padding-left:75px;font-family:"+a.sansserif_font+";font-size:18px;"});h.movable.innerHTML="Descartes";h.container.appendChild(h.movable);h.ctrs=[]};d.prototype.init=function(){function e(b){h.newPos=a.getCursorPosition(b,document.body);h.container.style.left=h.initialPosition.x+(h.newPos.x-h.oldPos.x)*a.cssScale+"px";h.container.style.top=h.initialPosition.y+(h.newPos.y-h.oldPos.y)*a.cssScale+"px"}function d(a){a.preventDefault();document.body.removeEventListener("mousemove",
e);document.body.removeEventListener("mouseup",d)}h=this;document.body.appendChild(this.container);for(var p=h.parent.evaluator.parser,b=0,k=h.ctrs.length;b<k;b++)h.ctrs[b].expresion=p.parse("(0,"+(h.vSpace+23+35*b)+","+h.width+",35)"),h.ctrs[b].update();h.numCtr=k;b=new a.Button(h.parent,{region:"external",name:"english"==h.language?"about":"cr\u00e9ditos",font_size:p.parse("15"),expresion:p.parse("(0,"+h.vSpace+","+h.width/2+",25)")});b.actionExec={execute:a.showAbout};b.update();(new a.Button(h.parent,
{region:"external",name:"config",font_size:p.parse("15"),action:"config",expresion:p.parse("("+h.width/2+","+h.vSpace+","+h.width/2+",25)")})).update();(new a.Button(h.parent,{region:"external",name:"english"==h.language?"init":"inicio",font_size:p.parse("15"),action:"init",expresion:p.parse("(0,"+(h.vSpace+23+35*k)+","+h.width/2+",25)")})).update();(new a.Button(h.parent,{region:"external",name:"english"==h.language?"clear":"limpiar",font_size:p.parse("15"),action:"clear",expresion:p.parse("("+h.width/
2+","+(h.vSpace+23+35*k)+","+h.width/2+",25)")})).update();p=new a.Button(h.parent,{region:"external",name:"english"==h.language?"close":"cerrar",font_size:p.parse("15"),expresion:p.parse("("+h.width/4+","+(h.vSpace+46+35*k)+","+h.width/2+",25)")});p.update();p.btn.addEventListener("click",function(a){h.hide()});h.setPositionAndSize();h.movable.addEventListener("mousedown",function(b){b.preventDefault();h.oldPos=a.getCursorPosition(b,document.body);h.initialPosition={x:h.container.offsetLeft,y:h.container.offsetTop};
document.body.addEventListener("mousemove",e);document.body.addEventListener("mouseup",d)});h.hide()};d.prototype.addCtr=function(a){this.ctrs.push(a)};d.prototype.show=function(){this.setPositionAndSize();this.container.style.display="block"};d.prototype.hide=function(){this.container.style.display="none"};d.prototype.setPositionAndSize=function(){h=this;var a=h.vSpace+46+35*h.numCtr+25+10;h.container.style.left=Math.max(parseInt(window.innerWidth-h.width)/2,0)+"px";h.container.style.top="5px";h.container.style.height=
window.innerHeight<h.vSpace+75?h.vSpace+75+"px":a>window.innerHeight-10?window.innerHeight-10:a+"px"};a.SpaceExternal=d;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=Math.floor,d=Math.round,e=2*Math.PI,q=a.convertFont("Serif,BOLD+ITALIC,16"),p=a.convertFont("Monospaced,PLAIN,12"),b,k,m,c,f,g,v,r,u,z,n,l,x,w,y,A,E,J,F,G,D,B,L,H,M,P,I,O,C,Q,K,R,N=function(c,e){b=e=a.Space.call(this,c,e)||this;b.ratio=c.ratio;b.canvas=a.newHTML("canvas",{id:b.id+"_canvas",class:"DescartesSpace2DCanvas",width:b.w*b.ratio});b.backCanvas=a.newHTML("canvas",{id:b.id+"_background",width:b.w*b.ratio});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;":"");b.canvas.style.zIndex=b.zIndex;b.canvas.style.width=b.backCanvas.style.width=b.w+"px";b.canvas.style.height=b.backCanvas.style.height=b.h+"px";b.ctx=b.canvas.getContext("2d");b.backCtx=b.backCanvas.getContext("2d");b.ctx.imageSmoothingEnabled=b.backCtx.imageSmoothingEnabled=!1;b.graphicControlContainer=a.newHTML("div",{id:b.id+"_graphicControls",style:"position:absolute;left:0;top:0;z-index:"+
b.zIndex+";"});b.numCtrContainer=a.newHTML("div",{id:b.id+"_numericalControls",style:"position:absolute;left:0;top:0;z-index:"+b.zIndex+";"});b.container=a.newHTML("div",{id:b.id,class:"DescartesSpace2DContainer",style:"z-index:"+b.zIndex+";"});b.parent.arquimedes&&"#f0f8fa"===b.background.getColor()&&(b.container.style.boxShadow="0 0 5px 0 #b8c4c8");b.container.appendChild(b.backCanvas);b.container.appendChild(b.canvas);b.container.appendChild(b.graphicControlContainer);b.container.appendChild(b.numCtrContainer);
c.container.insertBefore(b.container,c.loader);var d=b.id+".image";b.parent.images[d]=b.canvas;b.parent.images[d].ready=1;b.parent.images[d].complete=b.parent.images[d].canvas=!0;b.evaluator.setVariable(d,d);d=b.id+".back";b.parent.images[d]=b.backCanvas;b.parent.images[d].ready=1;b.parent.images[d].complete=b.parent.images[d].canvas=!0;b.evaluator.setVariable(d,d);d=""!==b.id&&2!==c.version?b.id+".":"";b.OxStr=d+"Ox";b.OyStr=d+"Oy";b.scaleStr=d+"escala";b.wStr=d+"_w";b.hStr=d+"_h";b.mxStr=d+"mouse_x";
b.myStr=d+"mouse_y";b.mpressedStr=d+"mouse_pressed";b.mclickedStr=d+"mouse_clicked";b.mclickIzqStr=d+"clic_izquierdo";b.click=0;b.resizable&&(b.wModExpr=c.evaluator.parser.parse(b.wModExpr),b.hModExpr=c.evaluator.parser.parse(b.hModExpr));"descartesJS_stage"!==b.id?b.addEvents():b.canvas.oncontextmenu=function(a){return!1};c.evaluator.setVariable(b.id+"._refresh_back_",1);return e};$jscomp.inherits(N,a.Space);N.prototype.init=function(){b=this;this.initSpace();b.canvas&&(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")};N.prototype.update=function(a){b=this;k=b.evaluator;m=b.parent;if(b.resizable){if(C=b.evaluator.eval(b.wModExpr),Q=b.evaluator.eval(b.hModExpr),b.old_w!=C||b.old_h!=Q)b.w=C,b.h=Q,b.w_2=b.w/2,b.h_2=b.h/2,k.setVariable(b.wStr,b.w),k.setVariable(b.hStr,b.h),b.old_w=b.w,b.old_h=b.h,b.canvas.width=b.backCanvas.width=
b.w*b.ratio,b.canvas.height=b.backCanvas.height=b.h*b.ratio,b.canvas.style.width=b.backCanvas.style.width=b.w+"px",b.canvas.style.height=b.backCanvas.style.height=b.h+"px",a=!0}else k.setVariable(b.wStr,b.w),k.setVariable(b.hStr,b.h);b.drawIfValue=0<k.eval(b.drawif);if(b.drawIfValue){f=b.x!==k.eval(b.xExpr)+b.displaceRegionWest;g=b.y!==k.eval(b.yExpr)+m.plecaHeight+b.displaceRegionNorth;b.spaceChange=a||f||g||b.drawBefore!==b.drawIfValue||b.Ox!==k.getVariable(b.OxStr)||b.Oy!==k.getVariable(b.OyStr)||
b.scale!==k.getVariable(b.scaleStr)||b.backColor!==b.background.getColor();b.x=f?k.eval(b.xExpr)+b.displaceRegionWest:b.x;b.y=g?k.eval(b.yExpr)+m.plecaHeight+b.displaceRegionNorth:b.y;b.Ox=k.getVariable(b.OxStr);b.Oy=k.getVariable(b.OyStr);b.scale=k.getVariable(b.scaleStr);b.drawBefore=b.drawIfValue;b.scale=Math.max(1E-6,Math.min(1E6,b.scale));k.setVariable(b.scaleStr,b.scale);if(f||g)b.container.style.left=b.x+"px",b.container.style.top=b.y+"px";b.container.style.display="block";b.drawTrace=!b.spaceChange&&
(!b.fixed&&!b.click||b.fixed);b.spaceChange&&(b.backCtx.setTransform(b.ratio,0,0,b.ratio,0,0),b.drawBackground());b.ctx.setTransform(b.ratio,0,0,b.ratio,0,0);b.draw()}else b.container.style.display="none"};N.prototype.drawBackground=function(){b=this;k=b.evaluator;c=b.backCtx;c.clearRect(0,0,b.backCanvas.width,b.backCanvas.height);c.fillStyle=b.backColor=b.background.getColor();c.fillRect(0,0,b.backCanvas.width,b.backCanvas.height);b.image&&""!=b.image.src&&b.image.ready&&b.image.complete&&("topleft"===
b.bg_display?c.drawImage(b.image,0,0):"stretch"===b.bg_display?c.drawImage(b.image,0,0,b.w,b.h):"patch"===b.bg_display?(c.fillStyle=c.createPattern(b.image,"repeat"),c.fillRect(0,0,b.w,b.h)):"imgcenter"===b.bg_display&&c.drawImage(b.image,(b.w-b.image.width)/2,(b.h-b.image.height)/2));r=b.scale;u=0;for(z=0>b.w+b.h?0:b.w+b.h;r>z;)r/=10,u++;for(;r<z/10;)r*=10;c.lineWidth=1;""!==b.net&&(c.strokeStyle=b.net.getColor(),b.drawMarks(c,r/10,-1));if(2!==b.parent.version&&""!==b.net10||2===b.parent.version&&
""!==b.net&&""!==b.net10)c.strokeStyle=b.net10.getColor(),b.drawMarks(c,r,-1);if(""!==b.axes){var a="";"no"==b.x_axis&&(a+="x");"no"==b.y_axis&&(a+="y");c.strokeStyle=b.axes.getColor();c.beginPath();"no"==b.x_axis||""===b.x_axis&&2===b.parent.version||(c.moveTo(0,h(b.h/2+b.Oy)+.5),c.lineTo(b.w,h(b.h/2+b.Oy)+.5));"no"==b.y_axis||""===b.y_axis&&2===b.parent.version||(c.moveTo(h(b.w/2+b.Ox)+.5,0),c.lineTo(h(b.w/2+b.Ox)+.5,b.h));c.lineWidth=1.2;c.stroke();c.lineWidth=1;b.drawMarks(c,r,4,a);b.drawMarks(c,
r/2,2,a);b.drawMarks(c,r/10,1,a)}if(""!==b.x_axis||""!==b.y_axis)c.fillStyle=""!==b.axes?b.axes.getColor():"#000",c.font=q,c.textAlign="right",c.textBaseline="alphabetic","no"!=b.x_axis&&c.fillText(b.x_axis,h(b.w)-2,h(b.h/2+b.Oy)+12),"no"!=b.y_axis&&c.fillText(b.y_axis,h(b.w/2+b.Ox)-2,12);b.numbers&&""!=b.axes&&(c.fillStyle=b.axes.getColor(),c.font=q,c.textAlign="start",c.textBaseline="bottom",r>(b.w+b.h)/2?b.drawNumbers(c,r/5,r<=b.scale?u+1:u):r>(b.w+b.h)/4?b.drawNumbers(c,r/2,r<=b.scale?u+1:u):
b.drawNumbers(c,r,u));a=0;for(var e=this.backGraphics.length;a<e;a++)this.backGraphics[a].draw()};N.prototype.draw=function(){b=this;c=b.ctx;k.getVariable(b.id+"._refresh_back_")&&c.clearRect(0,0,b.canvas.width,b.canvas.height);for(var a=0,d=b.graphics.length;a<d;a++)v=b.graphics[a],""!==v.trace&&b.drawTrace&&v.drawTrace(),v.draw();a=0;for(d=b.graphicsCtr.length;a<d;a++)b.graphicsCtr[a].draw();""!=b.text&&b.click&&"L"===b.whichBtn&&(c.save(),c.strokeStyle=c.fillStyle=b.text.getColor(),c.lineWidth=
1,c.font=p,c.textAlign="center",c.textBaseline="alphabetic",D=1>=b.scale?b.mouse_x.toFixed(0):b.mouse_x.toFixed(parseInt(b.scale).toString().length+1),B=1>=b.scale?b.mouse_y.toFixed(0):b.mouse_y.toFixed(parseInt(b.scale).toString().length+1),L="("+D+","+B+")",H=h(c.measureText(L).width/2),M=b.getAbsoluteX(b.mouse_x),P=b.getAbsoluteY(b.mouse_y),I=h(M),O=h(P-10),I+H>b.w?I=b.w-H:0>I-H&&(I=H),O+1>b.h?O=b.h:0>O-14&&(O=15),c.fillText(L,I,O),c.beginPath(),c.arc(M,P,2.5,0,e,!0),c.stroke(),c.restore())};N.prototype.drawMarks=
function(a,b,c,e){n=this.w;l=this.h;F=E=0;J=n;G=l;y=h(n/2+this.Ox);A=h(l/2+this.Oy);0<=c&&(E=y-c,J=y+c,F=A-c,G=A+c);a.beginPath();if(!e||e&&!e.match("x"))for(c=-d(y/b);(x=y+d(c*b))<n;c++)a.moveTo(x+.5,F+.5),a.lineTo(x+.5,G+.5);if(!e||e&&!e.match("y"))for(c=-d(A/b);(w=A+d(c*b))<l;c++)a.moveTo(E+.5,w+.5),a.lineTo(J+.5,w+.5);a.stroke()};N.prototype.drawNumbers=function(a,b,c){n=this.w;l=this.h;y=h(n/2+this.Ox);A=h(l/2+this.Oy);for(c=-d(y/b);(x=y+d(c*b))<n;c++)a.fillText(parseFloat((c*b/this.scale).toFixed(4)),
x+1,A-2);for(c=-d(A/b);(w=A+d(c*b))<l;c++)0!==parseFloat(-c*b/this.scale)&&a.fillText(parseFloat((-c*b/this.scale).toFixed(4)),y+5,w+5)};N.prototype.addEvents=function(){function b(a){window.focus();document.activeElement.blur();if(g.evaluator.variables[g.id+".DESCARTESJS_no_fixed"]||!g.fixed||g.sensitive_to_mouse_movements)g.click=0,g.evaluator.setVariable(g.mpressedStr,0),g.evaluator.setVariable(g.mclickedStr,1),g.evaluator.setVariable(g.mclickIzqStr,1),window.removeEventListener("touchmove",f),
window.removeEventListener("touchend",b),a.stopPropagation(),a.preventDefault(),g.parent.update()}function c(b){document.activeElement.blur();window.focus();b.stopPropagation();b.preventDefault();g.click=0;g.evaluator.setVariable(g.mpressedStr,0);g.evaluator.setVariable(g.mclickedStr,1);g.evaluator.setVariable(g.mclickIzqStr,1);"R"===g.whichBtn&&(window.removeEventListener("mousemove",d),g.posZoom==g.posZoomNew&&a.showConfig&&(g.parent.externalSpace.show(),g.posZoom=!1,g.posZoomNew=!0));window.removeEventListener("mousemove",
f);window.removeEventListener("mouseup",c);g.parent.deactivateControls();g.parent.update()}function e(b){g.posAnte=a.getCursorPosition(b,g.container);g.mouse_x=g.getRelativeX(g.posAnte.x);g.mouse_y=g.getRelativeY(g.posAnte.y);g.evaluator.setVariable(g.mxStr,g.mouse_x);g.evaluator.setVariable(g.myStr,g.mouse_y);g.evaluator.setVariable(g.mclickedStr,0);g.evaluator.setVariable(g.mclickIzqStr,0);g.parent.update()}function d(b){b.preventDefault();g.posZoomNew=a.getCursorPosition(b,g.container).y;g.evaluator.setVariable(g.scaleStr,
g.tempScale+g.tempScale/45*((g.posZoom-g.posZoomNew)/10));g.parent.update()}function f(b){b.preventDefault();b.stopPropagation();g.fixed||(g.posNext=a.getCursorPosition(b,g.container),K=g.posAnte.x-g.posNext.x,R=g.posAnte.y-g.posNext.y,g.evaluator.setVariable(g.OxStr,g.Ox-K),g.evaluator.setVariable(g.OyStr,g.Oy-R));e(b)}var g=this;g.posZoom=g.posZoomNew=null;g.canvas.oncontextmenu=function(a){return!1};this.sensitive_to_mouse_movements&&this.canvas.addEventListener("touchmove",e);this.canvas.addEventListener("touchstart",
function(a){window.focus();document.activeElement.blur();if(g.evaluator.variables[g.id+".DESCARTESJS_no_fixed"]||!g.fixed||g.sensitive_to_mouse_movements)g.parent.clearClick(),g.click=1,g.evaluator.setVariable(g.mpressedStr,1),g.evaluator.setVariable(g.mclickedStr,0),g.evaluator.setVariable(g.mclickIzqStr,0),g.parent.deactivateControls(),e(a),window.addEventListener("touchmove",f),window.addEventListener("touchend",b),a.stopPropagation(),a.preventDefault()});this.sensitive_to_mouse_movements&&this.canvas.addEventListener("mousemove",
e);this.canvas.addEventListener("mousedown",function(b){window.focus();document.activeElement.blur();b.stopPropagation();b.preventDefault();g.parent.clearClick();g.click=1;g.parent.deactivateControls();g.whichBtn=a.whichBtn(b);"R"===g.whichBtn?(window.addEventListener("mouseup",c),g.posZoom=a.getCursorPosition(b,g.container).y,g.posZoomNew=g.posZoom,g.fixed||(g.tempScale=g.scale,window.addEventListener("mousemove",d))):"L"===g.whichBtn&&(g.evaluator.setVariable(g.mpressedStr,1),g.evaluator.setVariable(g.mclickedStr,
0),g.evaluator.setVariable(g.mclickIzqStr,0),e(b),window.addEventListener("mousemove",f),window.addEventListener("mouseup",c))});document.addEventListener("visibilitychange",function(a){c(a)});document.addEventListener("mouseleave",function(a){g.click=0;g.evaluator.setVariable(g.mpressedStr,0);g.evaluator.setVariable(g.mclickedStr,1);g.evaluator.setVariable(g.mclickIzqStr,1);window.removeEventListener("mousemove",f);window.removeEventListener("mouseup",c)})};a.Space2D=N;return a}(descartesJS||{});
descartesJS=function(a){var h,d,e;function q(b,c){I=a.subtract3D(b,a.scalarProduct3D(c,a.dotProduct3D(b,c)));O=a.add3D(b,a.scalarProduct3D(I,-2));C=a.norm3D(O);return 0!==C?a.scalarProduct3D(O,1/C):a.scalarProduct3D(b,-1)}if(a.loadLib)return a;var p=Math.floor,b=Math.max,k=Math.cos,m=Math.sin,c,f,g,v,r,u,z,n,l,x,w,y,A,E,J,F,G=[],D,B,L,H,M,P,I,O,C,Q,K,R=function(b,c){g=c=a.Space.call(this,b,c)||this;g.backCanvas=a.newHTML("canvas",{id:g.id+"_background",width:g.w+"px",height:g.h+"px"});g.canvas=a.newHTML("canvas",
{id:g.id+"_canvas",width:g.w+"px",height:g.h+"px",class:"DescartesSpace3DCanvas",style:"z-index: "+g.zIndex+";"});g.ctx=g.canvas.getContext("2d");g.ctx.imageSmoothingEnabled=!1;g.canvas.style=g.backCanvas.style=(0<g.border_width?"border:"+g.border_width+"px solid "+g.border_color.getColor()+";":"")+(g.border_radius?"border-radius:"+g.border_radius+"px;":"");var e=g.id+".image";g.parent.images[e]=g.canvas;g.parent.images[e].ready=1;g.parent.images[e].complete=!0;g.parent.images[e].canvas=!0;g.evaluator.setVariable(e,
e);g.graphicControlContainer=a.newHTML("div",{id:g.id+"_graphicControls",style:"position:absolute;left:0px;top:0px;z-index:"+g.zIndex+";"});g.numCtrContainer=a.newHTML("div",{id:g.id+"_numericalControls",style:"position:absolute;left:0px;top:0px;z-index:"+g.zIndex+";"});g.container=a.newHTML("div",{id:g.id,class:"DescartesSpace3DContainer",style:"z-index:"+g.zIndex+";"});g.container.appendChild(g.backCanvas);g.container.appendChild(g.canvas);g.container.appendChild(g.graphicControlContainer);g.container.appendChild(g.numCtrContainer);
b.container.insertBefore(g.container,b.loader);g.eye={x:0,y:0,z:0};g.lights=[{x:50,y:50,z:70},{x:50,y:-50,z:30},{x:20,y:0,z:-80},{x:0,y:0,z:0}];e=0;for(var d=g.lights.length;e<d;e++)g.lights[e]=a.normalize3D(g.lights[e]);g.light3={x:0,y:0,z:0};g.intensity=[.4,.5,.3,0];g.userIntensity=0;g.dim=1;g.tmpIntensity=[];g.OxStr=g.id+".Ox";g.OyStr=g.id+".Oy";g.scaleStr=g.id+".escala";g.wStr=g.id+"._w";g.hStr=g.id+"._h";g.obsStr=g.id+".observador";g.ojoXStr=g.id+".Ojo.x";g.ojoYStr=g.id+".Ojo.y";g.ojoZStr=g.id+
".Ojo.z";g.rotZStr=g.id+".rot.z";g.rotYStr=g.id+".rot.y";g.userIDimStr=g.id+".userIlum.dim";g.userIIStr=g.id+".userIlum.I";g.userIxStr=g.id+".userIlum.x";g.userIyStr=g.id+".userIlum.y";g.userIzStr=g.id+".userIlum.z";g.evaluator.setVariable(g.rotZStr,0);g.evaluator.setVariable(g.rotYStr,0);g.evaluator.setVariable(g.userIDimStr,g.dim);g.evaluator.setVariable(g.userIIStr,g.userIntensity);g.evaluator.setVariable(g.userIxStr,0);g.evaluator.setVariable(g.userIyStr,0);g.evaluator.setVariable(g.userIzStr,
0);K=new a.Primitive3D({vertices:[new a.Vector4D(0,0,0,1)],type:"vertex"},g);g.evaluator.setFunction(g.id+"._X3D2D_",function(a,b,c){K.vertices[0].x=a;K.vertices[0].y=b;K.vertices[0].z=c;K.computeDepth(g);return K.projVert[0].x});g.evaluator.setFunction(g.id+"._Y3D2D_",function(a,b,c){K.vertices[0].x=a;K.vertices[0].y=b;K.vertices[0].z=c;K.computeDepth(g);return K.projVert[0].y});g.resizable&&(g.wModExpr=b.evaluator.parser.parse(g.wModExpr),g.hModExpr=b.evaluator.parser.parse(g.hModExpr));g.ratio=
1;g.addEvents();return c};$jscomp.inherits(R,a.Space);R.prototype.init=function(a){g=this;g.initSpace();g.canvas&&(g.canvas.width=g.backCanvas.width=g.w,g.canvas.height=g.backCanvas.height=g.h,g.canvas.style.width=g.backCanvas.style.width=g.w+"px",g.canvas.style.height=g.backCanvas.style.height=g.h+"px");g.w_2=g.w/2;g.h_2=g.h/2;g.w_plus_h=g.w+g.h;g.oldMouse={x:0,y:0};g.S={x:g.h/1080*-20.6*(40/g.scale),y:0,z:0};g.Ojo={x:3*g.w_2,y:0,z:0};g.evaluator.setVariable(g.ojoXStr,g.Ojo.x);g.evaluator.setVariable(g.ojoYStr,
g.Ojo.y);g.evaluator.setVariable(g.ojoZStr,g.Ojo.z)};R.prototype.update=function(a){g=this;c=g.evaluator;f=g.parent;c.setVariable(g.wStr,g.w);c.setVariable(g.hStr,g.h);g.drawIfValue=0<c.eval(g.drawif);if(g.drawIfValue){g.resizable&&(wModExpr=g.evaluator.eval(g.wModExpr),hModExpr=g.evaluator.eval(g.hModExpr),g.old_w!=wModExpr||g.old_h!=hModExpr)&&(g.w=wModExpr,g.h=hModExpr,g.w_2=g.w/2,g.h_2=g.h/2,c.setVariable(g.wStr,g.w),c.setVariable(g.hStr,g.h),g.old_w=g.w,g.old_h=g.h,g.canvas.width=g.backCanvas.width=
g.w*g.ratio,g.canvas.height=g.backCanvas.height=g.h*g.ratio,g.canvas.style.width=g.backCanvas.style.width=g.w+"px",g.canvas.style.height=g.backCanvas.style.height=g.h+"px",a=!0,g.S={x:g.h/1080*-20.6*(40/g.scale),y:0,z:0},g.Ojo={x:3*g.w_2,y:0,z:0},g.evaluator.setVariable(g.ojoXStr,g.Ojo.x),g.evaluator.setVariable(g.ojoYStr,g.Ojo.y),g.evaluator.setVariable(g.ojoZStr,g.Ojo.z));u=g.x!==c.eval(g.xExpr)+g.displaceRegionWest;z=g.y!==c.eval(g.yExpr)+f.plecaHeight+g.displaceRegionNorth;g.spaceChange=a||u||
z||g.drawBefore!==g.drawIfValue||g.Ox!==c.getVariable(g.OxStr)||g.Oy!==c.getVariable(g.OyStr)||g.Ojo.x!==c.getVariable(g.ojoXStr)||g.Ojo.y!==c.getVariable(g.ojoYStr)||g.Ojo.z!==c.getVariable(g.ojoZStr)||g.scale!==c.getVariable(g.scaleStr);g.x=u?c.eval(g.xExpr)+g.displaceRegionWest:g.x;g.y=z?c.eval(g.yExpr)+f.plecaHeight+g.displaceRegionNorth:g.y;g.Ojo.x=c.getVariable(g.ojoXStr);g.Ojo.y=c.getVariable(g.ojoYStr);g.Ojo.z=c.getVariable(g.ojoZStr);g.Ox=c.getVariable(g.OxStr);g.Oy=c.getVariable(g.OyStr);
g.scale=c.getVariable(g.scaleStr);g.drawBefore=g.drawIfValue;if(a||void 0==g.observer){a=0;for(var e=g.parent.controls.length;a<e;a++)g.parent.controls[a].id===g.obsStr&&(Q=!0);g.observer=Q?c.getVariable(g.obsStr)||2.5*g.w_plus_h:2.5*g.w_plus_h;g.observer=b(g.observer,.25*g.w_plus_h);c.setVariable(g.obsStr,g.observer)}1E-6>g.scale?(g.scale=1E-6,c.setVariable(g.scaleStr,1E-6)):1E6<g.scale&&(g.scale=1E6,c.setVariable(g.scaleStr,1E6));if(u||z)g.container.style.left=g.x+"px",g.container.style.top=g.y+
"px";g.container.style.display="block";g.dim=c.getVariable(g.userIDimStr);g.userIntensity=c.getVariable(g.userIIStr);g.light3={x:parseInt(c.getVariable(g.userIxStr)),y:parseInt(c.getVariable(g.userIyStr)),z:parseInt(c.getVariable(g.userIzStr))};g.updateCamera();g.draw()}else g.container.style.display="none"};R.prototype.updateCamera=function(){this.eye=a.scalarProduct3D(this.Ojo,1/this.scale)};R.prototype.rotateVertex=function(b){x=a.degToRad(g.evaluator.getVariable(g.rotZStr));w=k(x);y=m(x);h=b.x*
w-b.y*y;d=b.x*y+b.y*w;e=b.z;x=a.degToRad(g.evaluator.getVariable(g.rotYStr));w=k(x);y=m(x);return{x:e*y+h*w,y:d,z:e*w-h*y}};R.prototype.project=function(a){g=this;this.evaluator.getVariable("URL.oldProj");var b=g.eye.x/(a.x-g.eye.x);return{x:g.getAbsoluteX(b*(g.eye.y-a.y)),y:g.getAbsoluteY(b*(g.eye.z-a.z)),z:g.eye.x-a.x}};R.prototype.computeColor=function(b,c,e){"object"!=typeof b&&(b.match("rgba")?b=a.RGBAToHexColor(b):b.match("#")&&(b=new a.Color(b.substring(1))));H=a.subtract3D(this.eye,c.average);
M=a.norm3D(H);P=a.scalarProduct3D(H,1/M);this.lights[3]=a.subtract3D(this.light3,c.average);F=a.norm3D(this.lights[3]);for(var d=0,g=this.intensity.length-1;d<g;d++)G[d]=this.intensity[d]*this.dim;G[3]=this.userIntensity*this.userIntensity/F||0;D=e?this.dim/2:this.dim/4;B=0;L=0>c.direction?c.normal:a.scalarProduct3D(c.normal,-1);d=0;for(g=this.lights.length;d<g;d++)e?(B=Math.max(0,a.dotProduct3D(q(this.lights[d],L),P)),B*=B*B):B=Math.max(0,a.dotProduct3D(this.lights[d],L)),D+=G[d]*B;D=Math.min(D,
1);A=p(b.r*D);E=p(b.g*D);J=p(b.b*D);return"rgba("+A+","+E+","+J+","+b.a+")"};R.prototype.draw=function(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height);this.ctx.fillStyle=this.background.getColor();this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height);this.image&&""!=this.image.src&&this.image.ready&&this.image.complete&&("topleft"===this.bg_display?this.ctx.drawImage(this.image,0,0):"stretch"===this.bg_display?this.ctx.drawImage(this.image,0,0,this.w,this.h):"patch"===this.bg_display?
(this.ctx.fillStyle=ctx.createPattern(this.image,"repeat"),this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height)):"center"===this.bg_display&&this.ctx.drawImage(this.image,(this.w-this.image.width)/2,(this.h-this.image.height)/2));if(!this.click){for(var a=0,b=this.graphics.length;a<b;a++)this.graphics[a].update();this.primitives=[];if(this.split)for(a=0,b=this.graphics.length;a<b;a++){v=this.graphics[a];for(var c=a+1;c<b;c++)r=this.graphics[c],v.splitFace(r),r.splitFace(v);this.primitives=
this.primitives.concat(v.primitives||[])}else for(a=0,b=this.graphics.length;a<b;a++){v=this.graphics[a];if(v.split)for(c=a+1;c<b;c++)r=this.graphics[c],r.split&&v.splitFace(r);this.primitives=this.primitives.concat(v.primitives||[])}}a=0;for(b=this.primitives.length;a<b;a++)this.primitives[a].computeDepth(this);this.primitives=this.primitives.sort(function(a,b){return b.depth-a.depth});if("painter"===this.render)this.drawPainter(this.primitives);else for(a=0,b=this.primitives.length;a<b;a++)this.primitives[a].draw(this.ctx,
this);a=0;for(b=this.graphicsCtr.length;a<b;a++)this.graphicsCtr[a].draw()};R.prototype.drawPainter=function(a){for(var b=a.length,c=0;c<b;c++)a[c].drawn=!1,a[c].draw(this.ctx,this);for(var e=[],d=[],g=0,f=a.length,h=.001,k,l;;){k=f;for(c=0;c<b;c++)if(!a[c].drawn){l=!0;for(var m=0;m<b;m++)if(m!=c&&!a[m].drawn&&a[c].inFrontOf(e,a[m],h)){l=!1;break}l&&(f--,d[g++]=a[c],a[c].drawn=!0)}if(0==f)break;else if(f==k){if(h*=10,.1<h){for(c=0;c<b;c++)a[c].drawn||(d[g++]=a[c],a[c].drawn=!0);break}}else h=.001}for(c=
0;c<b;c++)d[c].draw(this.ctx,this)};R.prototype.rayFromEye=function(a,b){return{x:-this.eye.x,y:(a-(this.w_2+this.Ox))/this.scale-this.eye.y,z:(this.h_2+this.Oy-b)/this.scale-this.eye.z}};R.prototype.addEvents=function(){function b(a){window.focus();document.activeElement.blur();f.click=0;f.evaluator.setVariable(f.id+".mouse_pressed",0);window.removeEventListener("touchmove",g,!1);window.removeEventListener("touchend",b,!1);a.preventDefault();f.parent.update()}function c(b){document.body.focus();
f.click=0;f.evaluator.setVariable(f.id+".mouse_pressed",0);b.preventDefault();"R"===f.whichBtn&&(window.removeEventListener("mousemove",d,!1),f.posZoom==f.posZoomNew&&a.showConfig&&f.parent.externalSpace.show());window.removeEventListener("mousemove",g,!1);window.removeEventListener("mouseup",c,!1);f.parent.update()}function e(b){f.posAnte=a.getCursorPosition(b,f.container);f.mouse_x=f.getRelativeX(f.posAnte.x);f.mouse_y=f.getRelativeY(f.posAnte.y);f.evaluator.setVariable(f.id+".mouse_x",f.mouse_x);
f.evaluator.setVariable(f.id+".mouse_y",f.mouse_y);f.parent.update()}function d(b){b.preventDefault();f.posZoomNew=a.getCursorPosition(b,f.container).y;f.evaluator.setVariable(f.scaleStr,f.tempScale+f.tempScale/45*((f.posZoom-f.posZoomNew)/10));f.posObserverNew=a.getCursorPosition(b,f.container).x;f.evaluator.setVariable(f.obsStr,f.tempObserver-2.5*(f.posObserver-f.posObserverNew));f.parent.update()}function g(b){if(!f.fixed&&f.click){n=(f.getAbsoluteX(f.oldMouse.x)-f.getAbsoluteX(f.mouse_x))/4;l=
(-f.getAbsoluteY(f.oldMouse.y)+f.getAbsoluteY(f.mouse_y))/4;if(n!==f.disp.x||l!==f.disp.y)f.alpha=a.degToRad(f.evaluator.getVariable(f.rotZStr)),f.beta=a.degToRad(-f.evaluator.getVariable(f.rotYStr)),f.alpha=a.radToDeg(f.alpha)-n,f.beta=a.radToDeg(f.beta)-l,f.evaluator.setVariable(f.rotZStr,f.alpha),f.evaluator.setVariable(f.rotYStr,-f.beta),f.disp.x=n,f.disp.y=l,f.oldMouse.x=f.getRelativeX(f.posAnte.x),f.oldMouse.y=f.getRelativeY(f.posAnte.y);e(b);b.preventDefault()}}var f=this;this.canvas.oncontextmenu=
function(){return!1};this.canvas.addEventListener("touchstart",function(c){window.focus();document.activeElement.blur();f.click=1;f.evaluator.setVariable(f.id+".mouse_pressed",1);f.parent.deactivateControls();f.posAnte=a.getCursorPosition(c,f.container);f.oldMouse.x=f.getRelativeX(f.posAnte.x);f.oldMouse.y=f.getRelativeY(f.posAnte.y);e(c);window.addEventListener("touchmove",g);window.addEventListener("touchend",b);c.preventDefault()});this.canvas.addEventListener("mousedown",function(b){document.body.focus();
f.click=1;f.parent.deactivateControls();f.whichBtn=a.whichBtn(b);"R"===f.whichBtn?(window.addEventListener("mouseup",c),f.posObserver=a.getCursorPosition(b,f.container).x,f.posObserverNew=f.posObserver,f.posZoom=a.getCursorPosition(b,f.container).y,f.posZoomNew=f.posZoom,f.fixed||(f.tempScale=f.scale,f.tempObserver=f.observer,window.addEventListener("mousemove",d))):"L"==f.whichBtn&&(f.evaluator.setVariable(f.id+".mouse_pressed",1),f.posAnte=a.getCursorPosition(b,f.container),f.oldMouse.x=f.getRelativeX(f.posAnte.x),
f.oldMouse.y=f.getRelativeY(f.posAnte.y),e(b),window.addEventListener("mousemove",g),window.addEventListener("mouseup",c));b.preventDefault()});this.disp={x:0,y:0};document.addEventListener("visibilitychange",function(a){c(a)});document.addEventListener("mouseleave",function(a){c(a)})};a.Space3D=R;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h,d,e,q,p,b,k=function(b,c){var f=a.Space.call(this,b,c)||this;h=f.parent.evaluator;void 0!=f._w_&&(b=h.parser.parse(f._w_),f._w_="number"!=b.type?b:void 0);void 0!=f._h_&&(b=h.parser.parse(f._h_),f._h_="number"!=b.type?b:void 0);f.isFirefox=/firefox/i.test(window.navigator.userAgent);f.file=f.file?f.file.trim():"";f.file.match(/^\[/)&&f.file.match(/\]$/)?f.file=h.parser.parse(f.file.substring(1,f.file.length-1)):f.file.match(/^'/)&&f.file.match(/'$/)?
f.file=h.parser.parse(f.file):f.file=h.parser.parse("'"+f.file+"'");f.oldFile=h.eval(f.file);f.MyIFrame=a.newHTML("iframe",{marginheight:0,marginwidth:0,frameborder:0,scrolling:"auto",style:"position:absolute;left:0;top:0;"});0!=f.oldFile&&f.MyIFrame.setAttribute("src",f.oldFile);f.container=a.newHTML("div",{id:f.id,style:(a.isIOS?"overflow:scroll;-webkit-overflow-scrolling:touch;overflow-scrolling:touch;":"")+"position:absolute;width:"+f.w+"px;height:"+f.h+"px;left:"+f.x+"px;top:"+f.y+"px;z-index:"+
f.zIndex+";background-repeat:no-repeat;background-position:center;"});f.container.appendChild(f.MyIFrame);f.imageSrc&&(f.container.style.backgroundImage="url("+f.imageSrc+")");f.parent.container.insertBefore(f.container,f.parent.loader);f.MyIFrame.onload=function(b){var c=this;f.evaluator.setFunction(f.id+".set",function(a,b){c.contentWindow.postMessage({type:"set",name:a,value:b},"*");return 0});f.evaluator.setFunction(f.id+".update",function(){c.contentWindow.postMessage({type:"update"},"*");return 0});
f.evaluator.setFunction(f.id+".exec",function(a,b){c.contentWindow.postMessage({type:"exec",name:a,value:b},"*");return 0});f.evaluator.setFunction(f.id+".changeConf",function(b){if(b){if(a.cacheFiles[b])var f=a.cacheFiles[b];else f=(f=document.getElementById(b))&&"descartes/embed"===f.type?f.textContent:a.openFile(b),f=(f=(new DOMParser).parseFromString(f,"text/html").querySelector("ajs"))?f.innerHTML:"",a.cacheFiles[b]=f;c.contentWindow.postMessage({type:"change_config",filename:b,content:f},"*")}return 0});
f.evaluator.setFunction(f.id+".changeContent",function(a){a&&(a=(a=(new DOMParser).parseFromString(a.replace(/&sq;/g,"'"),"text/html").querySelector("ajs"))?a.innerHTML:"",c.contentWindow.postMessage({type:"change_content",content:a},"*"))});f.ImReady=!f.isFirefox;f.isFirefox||(f.container.style.visibility="visible",f.container.style.opacity="1",f.container.style.zIndex=f.zIndex,f.container.style.display=f.drawIfValue?"block":"none");f.MyIFrame.style.visibility="visible";f.container.style.backgroundImage=
""};f.update=f.iframeUpdate;f.evaluator.setVariable(f.id+"._scroll",0);return f};$jscomp.inherits(k,a.Space);k.prototype.init=function(){p=this;p.initSpace();p.MyIFrame&&Object.assign(p.MyIFrame.style,{width:p.w+"px",height:p.h+"px"})};k.prototype.iframeUpdate=function(a){h=this.evaluator;this.drawIfValue=0<h.eval(this.drawif);this.ImReady?this.container.style.display=this.drawIfValue?"block":"none":(this.container.style.visibility=this.drawIfValue?"visible":"hidden",this.container.style.opacity=
this.drawIfValue?"1":"0",this.container.style.zIndex=this.drawIfValue?this.zIndex:-1E3);if(this.drawIfValue){a&&(this.x=this.y=Infinity);d=this.x!==h.eval(this.xExpr)+this.displaceRegionWest;e=this.y!==h.eval(this.yExpr)+this.parent.plecaHeight+this.displaceRegionNorth;this.x=d?h.eval(this.xExpr)+this.displaceRegionWest:this.x;this.y=e?h.eval(this.yExpr)+this.parent.plecaHeight+this.displaceRegionNorth:this.y;void 0!=this._w_&&(a=h.eval(this._w_),this.w!==a&&(this.container.style.width=this.MyIFrame.style.width=
a+"px",this.w=a));void 0!=this._h_&&(a=h.eval(this._h_),this.h!==a&&(this.container.style.height=this.MyIFrame.style.height=a+"px",this.h=a));if(d||e)this.container.style.left=this.x+"px",this.container.style.top=this.y+"px";q=h.eval(this.file);q!==this.oldFile&&(this.ImReady=!1,this.isFirefox||(this.container.style.display="block",this.container.style.visibility=this.drawIfValue?"visible":"hidden",this.container.style.opacity=this.drawIfValue?"1":"0",this.container.style.zIndex=this.drawIfValue?
this.zIndex:-1E3),this.imageSrc&&(this.container.style.backgroundImage="url("+this.imageSrc+")"),this.MyIFrame.style.visibility="hidden",this.oldFile=q,this.MyIFrame.contentWindow.location.replace(q));b=h.getVariable(this.id+"._scroll");1==b?(this.MyIFrame.setAttribute("scrolling","yes"),this.MyIFrame.style.overflow=""):-1==b?(this.MyIFrame.setAttribute("scrolling","no"),this.MyIFrame.style.overflow="hidden"):(this.MyIFrame.setAttribute("scrolling","auto"),this.MyIFrame.style.overflow="")}else this.MyIFrame.contentWindow.blur()};
a.SpaceHTMLIFrame=k;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;var h=1,d=function(e){this.children=e.children;this.lessonParser=e.lessonParser;this.images=e.images;this.images.length=e.images.length;this.audios=e.audios;this.audios.length=e.audios.length;this.descartesApp=e;this.imgLoader=a.newHTML("div",{class:"DescartesLoaderImage"});this.progress=a.newHTML("progress",{class:"PBL",value:0,max:100});e.imgLoader?(e.loader.style.backgroundColor="rgba(0,0,0,0)",this.imgLoader.setAttribute("style","background-image:url("+
e.imgLoader+");background-size:contain;")):(h=e.width<e.height?e.width/1144:e.height/1092,h=2.5<h?2.5:h,this.imgLoader.setAttribute("style","background-image:url("+a.loaderImg.src+");background-position:50% 33.5%;background-size:"+880*h+"px;"),this.progress.setAttribute("style","visibility:visible;left:"+(e.width-726*h)/2+"px;top:"+(33.5*e.height/100+940*h/2)+"px;width:"+726*h+"px;height:"+14*h+"px;"));e.loader.appendChild(this.imgLoader);e.loader.appendChild(this.progress);e.firstRun=!1;this.initPreloader()};
d.prototype.initPreloader=function(){var e=this,d=e.children,h=e.images,b=e.audios,k=/[\w\.\-//]*(\.png|\.jpg|\.gif|\.svg|\.webp)/gi,m=/[\w\.\-//]*(\.ogg|\.oga|\.mp3|\.wav)/gi;h["lib/DescartesCCLicense.png"]=a.getCCLImg();h["lib/DescartesCCLicense.png"].ready=1;var c,f;var g=0;for(c=d.length;g<c;g++)if("rtf"!==d[g].name){if(d[g].value.match(/'macro'|'makro'/g)){var v="";var r=e.lessonParser.split(d[g].value);var u=0;for(f=r.length;u<f;u++)"expresion"===babel[r[u][0]]&&(v=r[u][1]);if(v)var z=(z=document.getElementById(v))&&
"descartes/macro"==z.type?z.text:a.openFile(v);if(z&&(r=z.match(k)))for(v=0,f=r.length;v<f;v++)u=r[v],u.toLowerCase().match(/vacio.gif$/)||""==u.substring(0,u.length-4)||(h[u]=new Image,h[u].addEventListener("load",function(){this.ready=1}),h[u].addEventListener("error",function(){this.errorload=1}),h[u].src=u)}if(r=d[g].value.match(k))for(v=0,f=r.length;v<f;v++)u=r[v],u.toLowerCase().match(/vacio.gif$/)||""==u.substring(0,u.length-4)||(h[u]=new Image,h[u].addEventListener("load",function(){this.ready=
1}),h[u].addEventListener("error",function(){this.errorload=1}),h[u].src=u);if(r=d[g].value.match(m))for(v=0,u=r.length;v<u;v++)e.initAudio(r[v])}for(var n in h)h.hasOwnProperty(n)&&e.images.length++;for(var l in b)b.hasOwnProperty(l)&&e.audios.length++;var x=e.images.length+e.audios.length;0<x&&e.progress.setAttribute("max",x);var w,y=function(){w=0;for(var c in h)h.hasOwnProperty(c)&&(h[c].ready||h[c].errorload)&&w++;for(c in b)b.hasOwnProperty(c)&&(b[c].ready||b[c].errorload)&&w++;e.progress.setAttribute("value",
w);w!=x?e.timer=a.setTimeout(y,1):e.descartesApp.initBuildApp()};y()};d.prototype.initAudio=function(e){var d=this.audios;d[e]=new Audio(e);d[e].filename=e;var h=function(){this.ready=1},b=function(){this.canPlayType("audio/"+this.filename.substring(this.filename.length-3))||"mp3"!=this.filename.substring(this.filename.length-3)?(console.warn("El archivo '"+e+"' no puede ser reproducido"),this.errorload=1):(d[e]=new Audio(this.filename.replace("mp3","ogg")),d[e].filename=this.filename.replace("mp3",
"ogg"),d[e].addEventListener("canplaythrough",h),d[e].addEventListener("load",h),d[e].addEventListener("error",b),d[e].load())};d[e].addEventListener("canplaythrough",h);d[e].addEventListener("load",h);d[e].addEventListener("error",b);a.hasTouchSupport?(d[e].load(),d[e].play(),a.setTimeout(function(){d[e].pause()},20),d[e].ready=1):d[e].load()};a.DescartesLoader=d;return a}(descartesJS||{});
descartesJS=function(a){function h(a){for(var b="[",f=0,d=a.length;f<d;f++)Array.isArray(a[f])?b+=h(a[f]):(e=a[f]||0,"string"==typeof e&&(e="'"+e+"'"),b+=e),f<d-1&&(b+=",");return b+"]"}function d(){q=window.innerWidth/this.width;p=window.innerHeight/this.height;a.cssScale=b=Math.min(q,p);this.container.style.transformOrigin="0 0";this.container.parentNode.style.width=window.innerWidth+"px";this.container.parentNode.style.height=window.innerHeight+"px";q<p?(this.container.style.left="0",this.container.style.top=
"50%",this.container.style.transform="translate3d(0px,0px,0px) scale("+b+") translate(0,-50%)"):(this.container.style.left="50%",this.container.style.top="0",this.container.style.transform="translate3d(0px,0px,0px) scale("+b+") translate(-50%,0)")}if(a.loadLib)return a;var e,q,p,b,k=function(b){this.animation={playing:!1,play:function(){},stop:function(){},reinit:function(){}};this.ratio=a._ratio;this.applet=b;this.parentC=b.parentNode;this.width=parseFloat(b.getAttribute("width"));this.height=parseFloat(b.getAttribute("height"));
this.decimal_symbol=".";this.decimal_symbol_regexp=/\./g;this.language="espa\u00f1ol";this.children=b.getElementsByTagName("param");a.ccLicense=!0;for(var c=0,f=this.children.length;c<f;c++)"CreativeCommonsLicense"===this.children[c].name&&(a.ccLicense="no"!==this.children[c].value);this.code=b.getAttribute("code");this.saveState=[];this.images={length:-1};this.audios={length:-1};this.firstRun=!0;this.keyboard=new a.Keyboard(this);this.scaleToFit=function(){};this.init()};k.prototype.init=function(){this.stop();
this.evaluator=new a.Evaluator(this);this.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 b=this.children,c,f=0,e=0,h=a.ccLicense?90:0,k=0,p=b.length;k<p;k++)c=b[k],"rtf_height"==c.name&&(f=parseInt(c.value)+120||this.height),"Buttons"==babel[c.name]&&(this.buttonsConfig=this.lessonParser.parseButtonsConfig(c.value),e=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,f&&(this.height=f+e+h));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=d,this.scaleToFit());"cover"==this.expand&&(this.scaleToFit=function(){this.width=window.innerWidth;this.height=window.innerHeight;this.container.width=this.width;this.container.height=this.height;this.container.setAttribute("style","width:"+this.width+"px;height:"+this.height+
"px;");if(this.spaces)for(var a=0,b=this.spaces.length;a<b;a++)this.spaces[a].initSpace(),this.spaces[a].init(),this.spaces[a].update(!0)},this.scaleToFit());this.spaces=[];this.firstRun?(this.loader.style.display="block",new a.DescartesLoader(this)):this.initBuildApp()};k.prototype.initBuildApp=function(){a.showConfig=!0;for(var b=this.children,c,f=this.lessonParser,d=[],e=[],h=[],k=[],p=[],n=[],l=0,q=b.length;l<q;l++)if(c=b[l],"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=f.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=f.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 w=(this.width-780)/2,y=parseInt(this.height)-this.plecaHeight-this.buttonsConfig.height-45;k.push("space='descartesJS_stage' type='text' abs_coord='yes' expresion='[10,20]' background='yes' text='"+c.value.replace(/'/g,"&squot;")+"'","space='descartesJS_stage' type='text' abs_coord='yes' expresion='["+w+","+(y-25)+"]' background='yes' text='"+this.licenseA+"'");a.ccLicense&&k.push("space='descartesJS_stage' type='image' expresion='["+(w+15)+","+y+"]' background='yes' abs_coord='yes' file='lib/DescartesCCLicense.png'")}else"E"==
c.name.charAt(0)?(c.value.match(/'HTMLIFrame'/)&&this.nIframes++,d.push(c.value)):/^C_/.test(c.name)?e.push(c.value):/^A_/.test(c.name)?h.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),k.push(c.value)):/^S_/.test(c.name)?p.push(c.value):"Animation"==babel[c.name]&&n.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));l=0;for(q=d.length;l<q;l++)b=f.parseSpace(d[l]),this.arquimedes&&this.stage.container.appendChild(b.container),
this.spaces.push(b),this.zIndex++;l=0;for(q=k.length;l<q;l++)if(a.DEBUG.elemIndex=l,d=f.parseGraphic(k[l]))this.editableRegionVisible=this.editableRegionVisible||d.visible,d.space.addGraph(d);l=0;for(q=p.length;l<q;l++)(d=f.parse3DGraphic(p[l]))&&d.space.addGraph(d,!0);l=0;for(q=e.length;l<q;l++)this.controls.push(f.parseControl(e[l]));l=0;for(q=h.length;l<q;l++)f.parseAuxiliar(h[l]);l=0;for(q=n.length;l<q;l++)this.animation=f.parseAnimation(n[l]);this.configRegions();this.updateAuxiliaries();this.updateAuxiliaries();
l=0;for(q=this.controls.length;l<q;l++)this.controls[l].init();this.updateControls();this.updateSpaces(!0);var A=this;this.nIframes?a.setTimeout(function(){A.finishInit()},200*this.nIframes):this.finishInit()};k.prototype.finishInit=function(){this.evaluator.setVariable("decimalSymbol",this.decimal_symbol);this.update();this.loader.style.display="none";window.parent!==window&&(this.parentC.style.margin=this.parentC.style.padding="0px","fit"==this.expand&&window.addEventListener("touchmove",function(a){a.preventDefault();
a.stopPropagation()}),window.parent.postMessage({type:"reportSize",href:window.location.href,width:this.width,height:this.height},"*"),window.parent.postMessage({type:"ready",value:window.location.href},"*"),a.onResize());window.opener&&window.opener.postMessage({type:"isResizeNeeded",href:window.location.href},"*");this.externalSpace.init();try{var b=new CustomEvent("descartesReady",{detail:this});window.dispatchEvent(b)}catch(f){console.warn("CustomEvents not supported in this browser")}var c=this;
this.evaluator.setFunction("openKB",function(a,b,d,e,h,k,m,l,p,q,y){c.keyboard.show(null,a,b,d,e,{x:h,y:k,w:m,h:l,fs:p+"px",value:q+"",type:"custom",tagName:"textfield"},y)});this.readyApp=!0};k.prototype.adjustSize=function(){document.body.style.margin=document.body.style.padding=this.parentC.style.margin=this.parentC.style.padding="0px";var b=parseInt(this.width)+30,c=parseInt(this.height)+90;window.moveTo((parseInt(screen.width)-b)/2,(parseInt(screen.height)-c)/2);window.resizeTo(b,c);a.onResize()};
k.prototype.configRegions=function(){var b=this.evaluator.parser,c=this.buttonsConfig||{},d=this.container,e="15",h=100,k=100,p=100,q=100;2==this.version&&(e="14",h=63,k=50,p=44,q=53);var n=0,l=0,x=0,w=0,y=0,A=this.northSpace.controls,E=this.southSpace.controls,J=this.eastSpace.controls,F=this.westSpace.controls;if(0<c.rowsNorth||0<A.length||c.about||c.config){0>=c.rowsNorth?(n=c.height,c.rowsNorth=1):n=c.height*c.rowsNorth;var G=this.northSpace.container;G.id="descartesJS_north";G.setAttribute("style",
"width:"+d.width+"px;height:"+n+"px;left:0;top:"+this.plecaHeight+"px;");d.insertBefore(G,this.loader);G=d.width;var D=0;c.about?(D=h,G-=D):h=0;c.config&&(G-=k);var B=Math.ceil(A.length/c.rowsNorth),L=G/B;var H=0;for(var M=A.length;H<M;H++)A[H].expresion=b.parse("("+(D+H%B*L)+","+c.height*Math.floor(H/B)+","+L+","+c.height+")"),A[H].init();c.about&&(H=new a.Button(this,{region:"north",name:"english"==this.language?"about":"cr\u00e9ditos",font_size:b.parse(e),expresion:b.parse("(0,0,"+h+","+n+")")}),
H.actionExec={execute:a.showAbout},H.update());c.config&&(new a.Button(this,{region:"north",name:"config",font_size:b.parse(e),action:"config",expresion:b.parse("("+(G+h)+",0,"+k+","+n+")")})).update()}if(0<c.rowsSouth||0<E.length||c.init||c.clear){0>=c.rowsSouth?(l=c.height,c.rowsSouth=1):l=c.height*c.rowsSouth;h=d.width;D=0;c.init?(D=p,h-=D):p=0;c.clear&&(h-=q);G=this.southSpace.container;G.id="descartesJS_south";G.setAttribute("style","width:"+d.width+"px;height:"+l+"px;left:0;bottom:0;");d.insertBefore(G,
this.loader);B=Math.ceil(E.length/c.rowsSouth);L=h/B;H=0;for(M=E.length;H<M;H++)E[H].expresion=b.parse("("+(D+H%B*L)+","+c.height*Math.floor(H/B)+","+L+","+c.height+")"),E[H].init();c.init&&(new a.Button(this,{region:"south",name:"english"==this.language?"init":"inicio",font_size:b.parse(e),action:"init",expresion:b.parse("(0,0,"+p+","+l+")")})).update();c.clear&&(new a.Button(this,{region:"south",name:"english"==this.language?"clear":"limpiar",font_size:b.parse(e),action:"clear",expresion:b.parse("("+
(h+p)+",0,"+q+","+l+")")})).update()}if(0<J.length)for(H=d.height-n-l,w=c.widthEast,G=this.eastSpace.container,G.id="descartesJS_east",G.setAttribute("style","width:"+w+"px;height:"+H+"px;right:0;top:"+n+"px;"),d.insertBefore(G,this.loader),H=0,M=J.length;H<M;H++)J[H].expresion=b.parse("(0,"+c.height*H+","+w+","+c.height+")"),J[H].init();if(0<F.length)for(H=d.height-n-l,y=c.widthWest,G=this.westSpace.container,G.id="descartesJS_west",G.setAttribute("style","width:"+y+"px;height:"+H+"px;left:0;top:"+
n+"px;"),d.insertBefore(G,this.loader),H=0,M=F.length;H<M;H++)F[H].expresion=b.parse("(0,"+c.height*H+","+y+","+c.height),F[H].init();if(this.editableRegionVisible)for(x=c.height,G=this.editableRegion.container,G.id="descartesJS_editableRegion",G.setAttribute("style","position:absolute;width:"+d.width+"px;height:"+x+"px;left:0;top:"+(d.height-l-c.height)+"px;"),d.insertBefore(G,this.loader),b=this.editableRegion.textFields,d=d.width/b.length,c=a.getFieldFontSize(x),H=0,M=b.length;H<M;H++)"div"==b[H].type?
(G.appendChild(b[H].container),b[H].container.setAttribute("style","font-family:"+a.sansserif_font+";width:"+(d-4)+"px;height:"+x+"px;position:absolute;left:"+H*d+"px;top:0;"),F=b[H].container.firstChild,F.setAttribute("style","font-family:"+a.sansserif_font+";font-size:"+c+"px;padding-top:0;background-color:#e0e4e8;position:absolute;left:0;top:0;height:"+x+"px;text-align:center;line-height:"+x+"px;"),J=F.offsetWidth,F.style.width=J+"px",F.firstChild.textContent=F.firstChild.textContent.substring(3,
F.firstChild.textContent.length-3),b[H].container.lastChild.setAttribute("style","font-family:"+a.monospace_font+";font-size:"+c+"px;width:"+(d-J)+"px;height:"+x+"px;position:absolute;left:"+J+"px;top:0;border:2px groove white;")):(G.appendChild(b[H]),b[H].setAttribute("style","font-family:"+a.monospace_font+";font-size:"+c+"px;width:"+d+"px;height:"+x+"px;position:absolute;left:"+H*d+"px;top:0;border:2px groove white;"));this.displaceRegionNorth=n;this.displaceRegionSouth=l+(x||0);this.displaceRegionEast=
w;this.displaceRegionWest=y;H=0;for(M=this.spaces.length;H<M;H++)this.spaces[H].init()};k.prototype.update=function(){this.updateAuxiliaries();this.updateControls();this.updateEvents();this.updateControls();this.updateSpaces()};k.prototype.clearClick=function(){for(var a=0,b=this.spaces.length;a<b;a++)this.spaces[a].clearClick()};k.prototype.removeButtonClick=function(){a.newBlobContent=null;for(var b=0,c=this.controls.length;b<c;b++)this.controls[b].buttonClick=!1};k.prototype.deactivateControls=
function(){if(this.controls)for(var a=0,b=this.controls.length;a<b;a++){var d=this.controls[a];d.deactivate&&d.deactivate()}};k.prototype.updateAuxiliaries=function(){for(var a=0,b=this.auxiliaries.length;a<b;a++)this.auxiliaries[a].update()};k.prototype.updateEvents=function(){for(var a=0,b=this.events.length;a<b;a++)this.events[a].update()};k.prototype.updateControls=function(){for(var a=0,b=this.controls.length;a<b;a++)this.controls[a].update()};k.prototype.updateSpaces=function(a){for(var b=0,
d=this.spaces.length;b<d;b++)this.spaces[b].update(a)};k.prototype.clear=function(){for(var a=0,b=this.spaces.length;a<b;a++)this.spaces[a].spaceChange=!0,this.spaces[a].drawBackground&&this.spaces[a].drawBackground()};k.prototype.play=function(){this.animation.play()};k.prototype.stop=function(){this.animation.stop()};k.prototype.reinitAnimation=function(){this.animation.reinit()};k.prototype.stopAudios=function(){this.stop();for(var a in this.audios)this.audios.hasOwnProperty(a)&&this.audios[a].pause&&
(this.audios[a].pause(),this.audios[a].currentTime=0)};k.prototype.getImage=function(a){var b=this.images;return a?(b[a]||(b[a]=new Image,b[a].addEventListener("load",function(){this.ready=1}),b[a].addEventListener("error",function(){this.ready=0;this.errorload=1}),b[a].src=a),b[a]):new Image};k.prototype.getAudio=function(b){var c=this.audios;if(b){if(!c[b]){b.lastIndexOf(".");c[b]=new Audio(b);var d=function(a){this.ready=1};c[b].addEventListener("canplaythrough",d);var e=function(a){this.canPlayType("audio/"+
b.substring(b.length-3))||"mp3"!=b.substring(b.length-3)?(console.warn("El archivo '"+b+"' no puede ser reproducido"),this.errorload=1):(c[b]=new Audio(b.replace("mp3","ogg")),c[b].addEventListener("canplaythrough",d),c[b].addEventListener("load",d),c[b].addEventListener("error",e),c[b].load())};c[b].addEventListener("error",e);c[b].play();a.setTimeout(function(){c[b].pause()},15)}return c[b]}return new Audio};k.prototype.getControlByCId=function(a){return this.getControlById(a,!0)};k.prototype.getControlById=
function(a,b){b=b?"cID":"id";for(var c,d=0,e=this.controls.length;d<e;d++)if(c=this.controls[d],c[b]==a)return c;return{update:function(){},w:0,h:0}};k.prototype.getSpaceByCId=function(a){return this.getSpaceById(a,!0)};k.prototype.getSpaceById=function(a,b){b=b?"cID":"id";for(var c,d=0,e=this.spaces.length;d<e;d++)if(c=this.spaces[d],c[b]==a)return c;return{update:function(){},w:0,h:0}};k.prototype.getURLParameters=function(){var a=window.location.href,b=a.indexOf("?");if(-1!=b){a=decodeURIComponent(a.substring(b+
1)).split("&");for(var d=0,e=a.length;d<e;d++)b=a[d].split("="),2==b.length&&(+b[1]==+b[1]&&(b[1]=parseFloat(b[1])),this.evaluator.setVariable("URL."+b[0],b[1]))}};k.prototype.getState=function(){var a="",b=this.evaluator.variables,d;for(d in b)if(b.hasOwnProperty(d)){var e=b[d];"string"==typeof e&&(e="'"+e+"'");void 0!=e&&"rnd"!=d&&"\u03c0"!=d&&"pi"!=d&&"e"!=d&&"Infinity"!=d&&"-Infinity"!=d&&"object"!=typeof e&&(a=""!=a?a+"\n"+d+"="+e:d+"="+e)}e=this.evaluator.vectors;for(var k in e)e.hasOwnProperty(k)&&
(a+="\n"+k+"="+h(e[k]));k=this.evaluator.matrices;for(var p in k)k.hasOwnProperty(p)&&(a+="\n"+p+"="+h(k[p]));return a};k.prototype.setState=function(a,b){a=a.split("\n");for(var c,d,e=0,h=a.length;e<h;e++)c=a[e].split("="),2<=c.length&&(d=eval(c[1]),-1!=c[1].indexOf("[[")?(this.evaluator.matrices[c[0]]=d,this.evaluator.matrices[c[0]].rows=d.length,this.evaluator.matrices[c[0]].cols=d[0].length):-1!=c[1].indexOf("[")?(this.evaluator.vectors[c[0]]=d,this.evaluator.variables[c[0]+".long"]=d.length):
this.evaluator.variables[c[0]]=d);b||this.update()};k.prototype.getEvaluation=function(){for(var a=correct=0,b="",d=0,e=this.controls.length;d<e;d++)"textfield"==this.controls[d].gui&&this.controls[d].evaluate&&(a++,correct+=this.controls[d].ok,this.controls[d].value=""==this.controls[d].value?"''":this.controls[d].value,b+=" \\n "+this.controls[d].id+"="+this.controls[d].value+"|"+this.controls[d].ok);return"questions="+a+" \\n correct="+correct+" \\n wrong="+(a-correct)+b};k.prototype.showSolution=
function(){for(var a=this.controls,b=0,d=a.length;b<d;b++)"textfield"==a[b].gui&&a[b].evaluate&&a[b].changeValue(a[b].getFirstAnswer());this.update()};k.prototype.showAnswer=function(){for(var a=0,b=this.saveState.length;a<b;a++)this.evaluator.eval(this.saveState[a]);this.update()};k.prototype.cleanCanvasImages=function(){this.container.querySelectorAll("canvas").forEach(function(a){a.width=a.height=1;a.style.width=a.style.height="1px"});this.spaces.forEach(function(a){a.canvas&&(a.canvas=a.ctx=null);
a.backCanvas&&(a.backCanvas=a.backCtx=null)});for(var a in this.images)this.images[a].nodeName&&"canvas"===this.images[a].nodeName.toLowerCase()&&delete this.images[a]};a.DescartesApp=k;return a}(descartesJS||{});
descartesJS=function(a){if(a.loadLib)return a;a.DEBUG={PARENTHESIS_CLOSING:"Faltan par\u00e9ntesis por cerrar",PARENTHESIS_OPENING:"Faltan par\u00e9ntesis por abrir",BRACKET_CLOSING:"Faltan corchetes por cerrar",BRACKET_OPENING:"Faltan corchetes por abrir",INCOMPLETE_IF:"Condicional incompleta",EXPRESSION:"En la expresi\u00f3n",setError:function(h,d){h="Error: "+h+" en\u300a "+d+" \u300b";var e="";switch(a.DEBUG.objectName){case "Auxiliar":d="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])e=" en la l\u00ednea "+(a.DEBUG.lineCount+1);h+=d+"\u300c"+a.DEBUG.idName+"\u300d, en el par\u00e1metro \u300c"+a.DEBUG.paramName+"\u300d"+e+".";break;case "Graphic":h+="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(h)}};return a}(descartesJS||{});
descartesJS=function(a){function h(){d().forEach(function(b){a.apps.push(new a.DescartesApp(b));b.className="DescartesJS"})}function d(){return[].concat($jscomp.arrayFromIterable(document.querySelectorAll("applet,ajs"))).filter(function(a){return/Descartes|DescartesJS|descinst.DescartesWeb2_0.class|Arquimedes|Discurso/i.test(a.getAttribute("code"))})}function e(){document.querySelectorAll(".DescartesAppContainer").forEach(function(a){a.remove()})}function q(b){var d,m;return $jscomp.asyncExecutePromiseGeneratorProgram(function(b){if(1==
b.nextAddress)return b.yield(document.fonts.ready,2);d=a.newHTML("div");m='<div style="font-size:12px;visibility:hidden;">';"descartesJS_serif descartesJS_sansserif descartesJS_monospace DJS_symbol DJS_sansserif DJS_serif DJS_monospace DJS_math".split(" ").forEach(function(a){m+='<div style="font-family:'+a+';"><span>_</span><span style="font-weight:bold;">_</span><span style="font-style:italic;">_</span><span style="font-weight:bold;font-style:italic;">_</span></div>'});d.innerHTML=m+"</div>";document.body.appendChild(d);
a.getFeatures();a.hasCanvas?(window.scrollTo(0,100),e(),h(),window.addEventListener("resize",a.onResize),window.scrollTo(0,0)):document.getElementById("StyleDescartesApps").innerHTML="applet.DescartesJS,applet,ajs.DescartesJS,ajs{display:block;}";d.remove();b.jumpToEnd()})}if(a.loadLib)return a;a.apps=[];a.getDescartesApps=function(){return a.apps};(function(){var b=document.getElementById("StyleDescartesApps");b&&b.remove();b=a.newHTML("style",{id:"StyleDescartesApps",type:"text/css",rel:"stylesheet"});
b.innerHTML="applet.DescartesJS,applet,ajs.DescartesJS,ajs{display:none;}";document.head.appendChild(b)})();a.onResize=function(b){0<a.apps.length&&a.apps[0].scaleToFit()};var p={};a.onMessage=function(b){if(0<a.apps.length){var d=b.data;if(d)if("set"===d.type)"string"==typeof d.value||"number"==typeof d.value?a.apps[0].evaluator.setVariable(d.name,d.value):d.value&&void 0!=d.value.rows?a.apps[0].evaluator.matrices[d.name]=d.value:a.apps[0].evaluator.vectors[d.name]=d.value;else if("update"===d.type)a.apps[0].update();
else if("exec"===d.type)(b=a.apps[0].evaluator.getFunction(d.name))&&b.apply(a.apps[0].evaluator,d.value.toString().split(","));else if("isResizeNeeded"===d.type)b.source.postMessage({type:"doResize"},"*");else if("doResize"===d.type)0<a.apps.length&&a.apps[0].adjustSize();else if("change_config"===d.type){p[d.filename]?b=p[d.filename]:(b=a.newHTML("div"),b.innerHTML=d.content,b=b.getElementsByTagName("param"),p[d.filename]=b);var e=document.querySelector("base");e||(e=a.newHTML("base"),document.body.appendChild(e));
e.setAttribute("href",d.filename);a.apps[0].children=b;a.apps[0].init()}else"change_content"===d.type&&(b=a.newHTML("div"),b.innerHTML=d.content,b=b.getElementsByTagName("param"),a.apps[0].children=b,a.apps[0].init())}};void 0==a.loadLib&&(a.loadLib=!0,window.addEventListener("load",q),window.addEventListener("message",a.onMessage),["webkitTransitionEnd","transitionend","oTransitionEnd","MSTransitionEnd"].forEach(function(b){window.addEventListener(b,function(b){a.onResize(b)})}));return a}(descartesJS||
{});
