/*
 Joel Espinosa Longi
 jlongi@im.unam.mx
 https://github.com/jlongi/DescartesJS
 LGPL - http://www.gnu.org/licenses/lgpl.html
 2025-10-09
*/
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.arrayIteratorImpl=function(b){var a=0;return function(){return a<b.length?{done:!1,value:b[a++]}:{done:!0}}};$jscomp.arrayIterator=function(b){return{next:$jscomp.arrayIteratorImpl(b)}};$jscomp.makeIterator=function(b){var a="undefined"!=typeof Symbol&&Symbol.iterator&&b[Symbol.iterator];return a?a.call(b):$jscomp.arrayIterator(b)};$jscomp.arrayFromIterator=function(b){for(var a,c=[];!(a=b.next()).done;)c.push(a.value);return c};
$jscomp.arrayFromIterable=function(b){return b instanceof Array?b:$jscomp.arrayFromIterator($jscomp.makeIterator(b))};$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(b){var a=function(){};a.prototype=b;return new a};$jscomp.underscoreProtoCanBeSet=function(){var b={a:!0},a={};try{return a.__proto__=b,a.a}catch(c){}return!1};
$jscomp.setPrototypeOf="function"==typeof Object.setPrototypeOf?Object.setPrototypeOf:$jscomp.underscoreProtoCanBeSet()?function(b,a){b.__proto__=a;if(b.__proto__!==a)throw new TypeError(b+" is not extensible");return b}:null;
$jscomp.inherits=function(b,a){b.prototype=$jscomp.objectCreate(a.prototype);b.prototype.constructor=b;if($jscomp.setPrototypeOf){var c=$jscomp.setPrototypeOf;c(b,a)}else for(c in a)if("prototype"!=c)if(Object.defineProperties){var h=Object.getOwnPropertyDescriptor(a,c);h&&Object.defineProperty(b,c,h)}else b[c]=a[c];b.superClass_=a.prototype};$jscomp.getGlobal=function(b){return"undefined"!=typeof window&&window===b?b:"undefined"!=typeof global&&null!=global?global:b};$jscomp.global=$jscomp.getGlobal(this);
$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(b,a,c){b!=Array.prototype&&b!=Object.prototype&&(b[a]=c.value)};$jscomp.polyfill=function(b,a,c,h){if(a){c=$jscomp.global;b=b.split(".");for(h=0;h<b.length-1;h++){var l=b[h];l in c||(c[l]={});c=c[l]}b=b[b.length-1];h=c[b];a=a(h);a!=h&&null!=a&&$jscomp.defineProperty(c,b,{configurable:!0,writable:!0,value:a})}};$jscomp.FORCE_POLYFILL_PROMISE=!1;
$jscomp.polyfill("Promise",function(b){function a(){this.batch_=null}function c(a){return a instanceof l?a:new l(function(b,d){b(a)})}if(b&&!$jscomp.FORCE_POLYFILL_PROMISE)return b;a.prototype.asyncExecute=function(a){if(null==this.batch_){this.batch_=[];var b=this;this.asyncExecuteFunction(function(){b.executeBatch_()})}this.batch_.push(a)};var h=$jscomp.global.setTimeout;a.prototype.asyncExecuteFunction=function(a){h(a,0)};a.prototype.executeBatch_=function(){for(;this.batch_&&this.batch_.length;){var a=
this.batch_;this.batch_=[];for(var b=0;b<a.length;++b){var d=a[b];a[b]=null;try{d()}catch(f){this.asyncThrow_(f)}}}this.batch_=null};a.prototype.asyncThrow_=function(a){this.asyncExecuteFunction(function(){throw a;})};var l=function(a){this.state_=0;this.result_=void 0;this.onSettledCallbacks_=[];var b=this.createResolveAndReject_();try{a(b.resolve,b.reject)}catch(n){b.reject(n)}};l.prototype.createResolveAndReject_=function(){function a(a){return function(f){d||(d=!0,a.call(b,f))}}var b=this,d=!1;
return{resolve:a(this.resolveTo_),reject:a(this.reject_)}};l.prototype.resolveTo_=function(a){if(a===this)this.reject_(new TypeError("A Promise cannot resolve to itself"));else if(a instanceof l)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)}};l.prototype.resolveToNonPromiseObj_=function(a){var b=void 0;try{b=a.then}catch(n){this.reject_(n);return}"function"==typeof b?
this.settleSameAsThenable_(b,a):this.fulfill_(a)};l.prototype.reject_=function(a){this.settle_(2,a)};l.prototype.fulfill_=function(a){this.settle_(1,a)};l.prototype.settle_=function(a,b){if(0!=this.state_)throw Error("Cannot settle("+a+", "+b+"): Promise already settled in state"+this.state_);this.state_=a;this.result_=b;this.executeOnSettledCallbacks_()};l.prototype.executeOnSettledCallbacks_=function(){if(null!=this.onSettledCallbacks_){for(var a=0;a<this.onSettledCallbacks_.length;++a)d.asyncExecute(this.onSettledCallbacks_[a]);
this.onSettledCallbacks_=null}};var d=new a;l.prototype.settleSameAsPromise_=function(a){var b=this.createResolveAndReject_();a.callWhenSettled_(b.resolve,b.reject)};l.prototype.settleSameAsThenable_=function(a,b){var d=this.createResolveAndReject_();try{a.call(b,d.resolve,d.reject)}catch(f){d.reject(f)}};l.prototype.then=function(a,b){function d(a,b){return"function"==typeof a?function(b){try{f(a(b))}catch(w){m(w)}}:b}var f,m,c=new l(function(a,b){f=a;m=b});this.callWhenSettled_(d(a,f),d(b,m));return c};
l.prototype.catch=function(a){return this.then(void 0,a)};l.prototype.callWhenSettled_=function(a,b){function c(){switch(f.state_){case 1:a(f.result_);break;case 2:b(f.result_);break;default:throw Error("Unexpected state: "+f.state_);}}var f=this;null==this.onSettledCallbacks_?d.asyncExecute(c):this.onSettledCallbacks_.push(c)};l.resolve=c;l.reject=function(a){return new l(function(b,d){d(a)})};l.race=function(a){return new l(function(b,d){for(var f=$jscomp.makeIterator(a),m=f.next();!m.done;m=f.next())c(m.value).callWhenSettled_(b,
d)})};l.all=function(a){var b=$jscomp.makeIterator(a),d=b.next();return d.done?c([]):new l(function(a,m){function f(b){return function(f){e[b]=f;g--;0==g&&a(e)}}var e=[],g=0;do e.push(void 0),g++,c(d.value).callWhenSettled_(f(e.length-1),m),d=b.next();while(!d.done)})};return l},"es6","es3");$jscomp.SYMBOL_PREFIX="jscomp_symbol_";$jscomp.initSymbol=function(){$jscomp.initSymbol=function(){};$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol)};
$jscomp.SymbolClass=function(b,a){this.$jscomp$symbol$id_=b;$jscomp.defineProperty(this,"description",{configurable:!0,writable:!0,value:a})};$jscomp.SymbolClass.prototype.toString=function(){return this.$jscomp$symbol$id_};$jscomp.Symbol=function(){function b(c){if(this instanceof b)throw new TypeError("Symbol is not a constructor");return new $jscomp.SymbolClass($jscomp.SYMBOL_PREFIX+(c||"")+"_"+a++,c)}var a=0;return b}();
$jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var b=$jscomp.global.Symbol.iterator;b||(b=$jscomp.global.Symbol.iterator=$jscomp.global.Symbol("Symbol.iterator"));"function"!=typeof Array.prototype[b]&&$jscomp.defineProperty(Array.prototype,b,{configurable:!0,writable:!0,value:function(){return $jscomp.iteratorPrototype($jscomp.arrayIteratorImpl(this))}});$jscomp.initSymbolIterator=function(){}};
$jscomp.initSymbolAsyncIterator=function(){$jscomp.initSymbol();var b=$jscomp.global.Symbol.asyncIterator;b||(b=$jscomp.global.Symbol.asyncIterator=$jscomp.global.Symbol("Symbol.asyncIterator"));$jscomp.initSymbolAsyncIterator=function(){}};$jscomp.iteratorPrototype=function(b){$jscomp.initSymbolIterator();b={next:b};b[$jscomp.global.Symbol.iterator]=function(){return this};return b};$jscomp.generator={};
$jscomp.generator.ensureIteratorResultIsObject_=function(b){if(!(b instanceof Object))throw new TypeError("Iterator result "+b+" 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(b){this.yieldResult=b};
$jscomp.generator.Context.prototype.throw_=function(b){this.abruptCompletion_={exception:b,isException:!0};this.jumpToErrorHandler_()};$jscomp.generator.Context.prototype.return=function(b){this.abruptCompletion_={return:b};this.nextAddress=this.finallyAddress_};$jscomp.generator.Context.prototype.jumpThroughFinallyBlocks=function(b){this.abruptCompletion_={jumpTo:b};this.nextAddress=this.finallyAddress_};$jscomp.generator.Context.prototype.yield=function(b,a){this.nextAddress=a;return{value:b}};
$jscomp.generator.Context.prototype.yieldAll=function(b,a){b=$jscomp.makeIterator(b);var c=b.next();$jscomp.generator.ensureIteratorResultIsObject_(c);if(c.done)this.yieldResult=c.value,this.nextAddress=a;else return this.yieldAllIterator_=b,this.yield(c.value,a)};$jscomp.generator.Context.prototype.jumpTo=function(b){this.nextAddress=b};$jscomp.generator.Context.prototype.jumpToEnd=function(){this.nextAddress=0};
$jscomp.generator.Context.prototype.setCatchFinallyBlocks=function(b,a){this.catchAddress_=b;void 0!=a&&(this.finallyAddress_=a)};$jscomp.generator.Context.prototype.setFinallyBlock=function(b){this.catchAddress_=0;this.finallyAddress_=b||0};$jscomp.generator.Context.prototype.leaveTryBlock=function(b,a){this.nextAddress=b;this.catchAddress_=a||0};
$jscomp.generator.Context.prototype.enterCatchBlock=function(b){this.catchAddress_=b||0;b=this.abruptCompletion_.exception;this.abruptCompletion_=null;return b};$jscomp.generator.Context.prototype.enterFinallyBlock=function(b,a,c){c?this.finallyContexts_[c]=this.abruptCompletion_:this.finallyContexts_=[this.abruptCompletion_];this.catchAddress_=b||0;this.finallyAddress_=a||0};
$jscomp.generator.Context.prototype.leaveFinallyBlock=function(b,a){a=this.finallyContexts_.splice(a||0)[0];if(a=this.abruptCompletion_=this.abruptCompletion_||a){if(a.isException)return this.jumpToErrorHandler_();void 0!=a.jumpTo&&this.finallyAddress_<a.jumpTo?(this.nextAddress=a.jumpTo,this.abruptCompletion_=null):this.nextAddress=this.finallyAddress_}else this.nextAddress=b};$jscomp.generator.Context.prototype.forIn=function(b){return new $jscomp.generator.Context.PropertyIterator(b)};
$jscomp.generator.Context.PropertyIterator=function(b){this.object_=b;this.properties_=[];for(var a in b)this.properties_.push(a);this.properties_.reverse()};$jscomp.generator.Context.PropertyIterator.prototype.getNext=function(){for(;0<this.properties_.length;){var b=this.properties_.pop();if(b in this.object_)return b}return null};$jscomp.generator.Engine_=function(b){this.context_=new $jscomp.generator.Context;this.program_=b};
$jscomp.generator.Engine_.prototype.next_=function(b){this.context_.start_();if(this.context_.yieldAllIterator_)return this.yieldAllStep_(this.context_.yieldAllIterator_.next,b,this.context_.next_);this.context_.next_(b);return this.nextStep_()};
$jscomp.generator.Engine_.prototype.return_=function(b){this.context_.start_();var a=this.context_.yieldAllIterator_;if(a)return this.yieldAllStep_("return"in a?a["return"]:function(a){return{value:a,done:!0}},b,this.context_.return);this.context_.return(b);return this.nextStep_()};
$jscomp.generator.Engine_.prototype.throw_=function(b){this.context_.start_();if(this.context_.yieldAllIterator_)return this.yieldAllStep_(this.context_.yieldAllIterator_["throw"],b,this.context_.next_);this.context_.throw_(b);return this.nextStep_()};
$jscomp.generator.Engine_.prototype.yieldAllStep_=function(b,a,c){try{var h=b.call(this.context_.yieldAllIterator_,a);$jscomp.generator.ensureIteratorResultIsObject_(h);if(!h.done)return this.context_.stop_(),h;var l=h.value}catch(d){return this.context_.yieldAllIterator_=null,this.context_.throw_(d),this.nextStep_()}this.context_.yieldAllIterator_=null;c.call(this.context_,l);return this.nextStep_()};
$jscomp.generator.Engine_.prototype.nextStep_=function(){for(;this.context_.nextAddress;)try{var b=this.program_(this.context_);if(b)return this.context_.stop_(),{value:b.value,done:!1}}catch(a){this.context_.yieldResult=void 0,this.context_.throw_(a)}this.context_.stop_();if(this.context_.abruptCompletion_){b=this.context_.abruptCompletion_;this.context_.abruptCompletion_=null;if(b.isException)throw b.exception;return{value:b.return,done:!0}}return{value:void 0,done:!0}};
$jscomp.generator.Generator_=function(b){this.next=function(a){return b.next_(a)};this.throw=function(a){return b.throw_(a)};this.return=function(a){return b.return_(a)};$jscomp.initSymbolIterator();this[Symbol.iterator]=function(){return this}};$jscomp.generator.createGenerator=function(b,a){a=new $jscomp.generator.Generator_(new $jscomp.generator.Engine_(a));$jscomp.setPrototypeOf&&$jscomp.setPrototypeOf(a,b.prototype);return a};
$jscomp.asyncExecutePromiseGenerator=function(b){function a(a){return b.next(a)}function c(a){return b.throw(a)}return new Promise(function(h,l){function d(b){b.done?h(b.value):Promise.resolve(b.value).then(a,c).then(d,l)}d(b.next())})};$jscomp.asyncExecutePromiseGeneratorFunction=function(b){return $jscomp.asyncExecutePromiseGenerator(b())};$jscomp.asyncExecutePromiseGeneratorProgram=function(b){return $jscomp.asyncExecutePromiseGenerator(new $jscomp.generator.Generator_(new $jscomp.generator.Engine_(b)))};
$jscomp.checkStringArgs=function(b,a,c){if(null==b)throw new TypeError("The 'this' value for String.prototype."+c+" must not be null or undefined");if(a instanceof RegExp)throw new TypeError("First argument to String.prototype."+c+" must not be a regular expression");return b+""};
$jscomp.polyfill("String.prototype.repeat",function(b){return b?b:function(a){var b=$jscomp.checkStringArgs(this,null,"repeat");if(0>a||1342177279<a)throw new RangeError("Invalid count value");a|=0;for(var h="";a;)if(a&1&&(h+=b),a>>>=1)b+=b;return h}},"es6","es3");
$jscomp.polyfill("String.prototype.startsWith",function(b){return b?b:function(a,b){var c=$jscomp.checkStringArgs(this,a,"startsWith");a+="";var l=c.length,d=a.length;b=Math.max(0,Math.min(b|0,c.length));for(var k=0;k<d&&b<l;)if(c[b++]!=a[k++])return!1;return k>=d}},"es6","es3");
$jscomp.polyfill("String.prototype.endsWith",function(b){return b?b:function(a,b){var c=$jscomp.checkStringArgs(this,a,"endsWith");a+="";void 0===b&&(b=c.length);b=Math.max(0,Math.min(b|0,c.length));for(var l=a.length;0<l&&0<b;)if(c[--b]!=a[--l])return!1;return 0>=l}},"es6","es3");$jscomp.stringPadding=function(b,a){b=void 0!==b?String(b):" ";return 0<a&&b?b.repeat(Math.ceil(a/b.length)).substring(0,a):""};
$jscomp.polyfill("String.prototype.padStart",function(b){return b?b:function(a,b){var c=$jscomp.checkStringArgs(this,null,"padStart");return $jscomp.stringPadding(b,a-c.length)+c}},"es8","es3");$jscomp.owns=function(b,a){return Object.prototype.hasOwnProperty.call(b,a)};$jscomp.assign="function"==typeof Object.assign?Object.assign:function(b,a){for(var c=1;c<arguments.length;c++){var h=arguments[c];if(h)for(var l in h)$jscomp.owns(h,l)&&(b[l]=h[l])}return b};
$jscomp.polyfill("Object.assign",function(b){return b||$jscomp.assign},"es6","es3");$jscomp.polyfill("Array.prototype.fill",function(b){return b?b:function(a,b,h){var c=this.length||0;0>b&&(b=Math.max(0,c+b));if(null==h||h>c)h=c;h=Number(h);0>h&&(h=Math.max(0,c+h));for(b=Number(b||0);b<h;b++)this[b]=a;return this}},"es6","es3");$jscomp.findInternal=function(b,a,c){b instanceof String&&(b=String(b));for(var h=b.length,l=0;l<h;l++){var d=b[l];if(a.call(c,d,l,b))return{i:l,v:d}}return{i:-1,v:void 0}};
$jscomp.polyfill("Array.prototype.find",function(b){return b?b:function(a,b){return $jscomp.findInternal(this,a,b).v}},"es6","es3");$jscomp.polyfill("Object.is",function(b){return b?b:function(a,b){return a===b?0!==a||1/a===1/b:a!==a&&b!==b}},"es6","es3");
$jscomp.polyfill("Array.prototype.includes",function(b){return b?b:function(a,b){var c=this;c instanceof String&&(c=String(c));var l=c.length;b=b||0;for(0>b&&(b=Math.max(b+l,0));b<l;b++){var d=c[b];if(d===a||Object.is(d,a))return!0}return!1}},"es7","es3");$jscomp.polyfill("String.prototype.includes",function(b){return b?b:function(a,b){return-1!==$jscomp.checkStringArgs(this,a,"includes").indexOf(a,b||0)}},"es6","es3");
$jscomp.polyfill("Array.prototype.flat",function(b){return b?b:function(a){a=void 0===a?1:Number(a);for(var b=[],h=0;h<this.length;h++){var l=this[h];Array.isArray(l)&&0<a?(l=Array.prototype.flat.call(l,a-1),b.push.apply(b,l)):b.push(l)}return b}},"es9","es5");$jscomp.polyfill("Math.trunc",function(b){return b?b:function(a){a=Number(a);if(isNaN(a)||Infinity===a||-Infinity===a||0===a)return a;var b=Math.floor(Math.abs(a));return 0>a?-b:b}},"es6","es3");
$jscomp.polyfill("Math.sign",function(b){return b?b:function(a){a=Number(a);return 0===a||isNaN(a)?a:0<a?1:-1}},"es6","es3");$jscomp.polyfill("Number.isFinite",function(b){return b?b:function(a){return"number"!==typeof a?!1:!isNaN(a)&&Infinity!==a&&-Infinity!==a}},"es6","es3");
var babel=function(b){if(b.loadLib)return b;b.loadLib=!0;b.no=b.ez=b.non=b["n\u00e3o"]=b.falso=b["false"]=b.fals=b.gezurra=b.faux=b.fals="false";b["s\u00ed"]=b.yes=b.bai=b.oui=b.si=b.sim=b.verdadero=b["true"]=b.veritable=b.egia=b.vrai=b.verdadeiro=b.veritable="true";b.negro=b.black=b.negre=b.beltza=b.noir=b.preto=b["#000000"]="#000000";b.maxenta=b.magenta=b["#ff00ff"]="#ff00ff";b.azul=b.blue=b.blau=b.urdina=b.bleu=b["#0000ff"]="#0000ff";b.turquesa=b.cyan=b.turkesa=b.turquoise=b["#00ffff"]="#00ffff";
b.verde=b.green=b.verd=b.berdea=b.vert=b["#00ff00"]="#00ff00";b.amarillo=b.yellow=b.groc=b.horia=b.jaune=b.amarelo=b["#ffff00"]="#ffff00";b.naranja=b.orange=b.taronja=b.laranja=b.laranxa=b["#ffc800"]="#ffc800";b.rojo=b.red=b.vermell=b.gorria=b.rouge=b.vermello=b.vermelho=b["#ff0000"]="#ff0000";b.pink=b.rosa=b.arrosa=b.rose=b["#ffafaf"]="#ffafaf";b.grisObscuro=b.darkGray=b.grisFosc=b["gris iluna"]=b.grisObscur=b.grisEscuro=b.cinzaEscuro=b["#404040"]="#404040";b.gris=b.gray=b.grisa=b.cinza=b["#808080"]=
"#808080";b.grisClaro=b.lightGray=b.grisClar=b["gris argia"]=b.grisClair=b.cinzaClaro=b["#c0c0c0"]="#c0c0c0";b.blanco=b.white=b.blanc=b.zuria=b.branco=b["#ffffff"]="#ffffff";b.escala=b.scale=b.eskala=b["\u00e9chelle"]="scale";b.nombre=b.name=b.nom=b.izena=b.nome="name";b.ikusgai=b["vis\u00edvel"]=b.visible="visible";b.rastro=b.trace=b.rastre=b.arrastoa="trace";b.fondo=b.background=b.fons=b.hondoa=b.fond=b.fundo="background";b["par\u00e1metro"]=b.parameter=b.parametroa=b["par\u00e2metro"]=b["par\u00e0metre"]=
"parameter";b["sucesi\u00f3n"]=b.sequence=b["successi\u00f3"]=b.segida=b.succession=b["seq\u00fc\u00eancia"]="sequence";b["tama\u00f1o"]=b.size=b.neurria=b.taille=b.tamanho=b["grand\u00e0ria"]="size";b.decimales=b.decimals=b.hamartarra=b["d\u00e9cimales"]=b.decimais="decimals";b.red=b.net=b.xarxa=b.sarea=b["r\u00e9seau"]=b.rede=b.malha="net";b.red10=b.net10=b.xarxa10=b.sarea10=b["r\u00e9seau10"]=b.rede10=b.malha10="net10";b.ejes=b.axes=b.eixos=b.ardatzak=b.eixes="axes";b["cr\u00e9ditos"]=b.about=
b["cr\u00e8dits"]=b.kreditoak=b["cr\u00e9dits"]=b.sobre="about";b.config=b.konfig=b["configura\u00e7\u00e3o"]="config";b.inicio=b.init=b.inici=b.hasiera=b.commencement=b["in\u00edcio"]="init";b.limpiar=b.clear=b.neteja=b.ezabatu=b.nettoye=b.limpar="clear";b.incr=b.gehi=b.incremento="incr";b.min=b.inf="min";b.max=b.sup=b["m\u00e1x"]="max";b.relleno=b.fill=b.ple=b.betea=b.plein=b.recheo=b.preencher="fill";b["relleno+"]=b["fill+"]=b["ple+"]=b["betea+"]=b["plein+"]=b["recheo+"]=b["preencher+"]=b.fillP=
"fillP";b["relleno-"]=b["fill-"]=b["ple-"]=b["betea-"]=b["plein-"]=b["recheo-"]=b["preencher-"]=b.fillM="fillM";b.flecha=b.arrow=b.fletxa=b.gezia=b["fl\u00e8che"]=b.frecha=b.seta="arrow";b.punta=b.spear=b.muturra=b.pointe=b.ponta="spear";b["regi\u00f3n"]=b.region=b["regi\u00f3"]=b.eskualde=b["r\u00e9gion"]=b["rexi\u00f3n"]=b["regi\u00e3o"]="region";b.norte=b.north=b.nord=b.ipar="north";b.sur=b.south=b.sud=b.hego=b.sul="south";b.este=b.east=b.est=b.ekialde=b.leste="east";b.oeste=b.west=b.oest=b.hegoalde=
b.ouest="west";b.exterior=b.external=b.kanpoalde=b.externo="external";b["expresi\u00f3n"]=b.expresion=b["expresi\u00f3"]=b.adierazpen=b["express\u00e3o"]="expresion";b.tipo=b.type=b.tipus=b.mota="type";b["posici\u00f3n"]=b.position=b["posici\u00f3"]=b.posizio=b["posi\u00e7\u00e3o"]="position";b["constricci\u00f3n"]=b.constraint=b["constricci\u00f3"]=b.beharte=b.constriction=b["constrici\u00f3n"]=b["restri\u00e7\u00e3o"]="constraint";b.valor=b.value=b.balio=b.valeur="value";b["ecuaci\u00f3n"]=b.equation=
b["equaci\u00f3"]=b.ekuazio=b["\u00e9quation"]=b["equa\u00e7\u00e3o"]="equation";b.curva=b.curve=b.corba=b.kurba=b.courbe="curve";b.texto=b.text=b.testu=b.texte=b.testua="text";b.punto=b.point=b.punt=b.puntu=b.ponto=b.dot="point";b.segmento=b.segment=b.zuzenki="segment";b.arco=b.arc=b.arku="arc";b["pol\u00edgono"]=b.polygon=b["pol\u00edgon"]=b.poligono=b.polygone="polygon";b.imagen=b.image=b.imatge=b.irudi=b.imaxe=b.imagem=b.bg_image=b.irudia=b.imagem_de_fundo=b.irundia="image";b["Versi\u00f3n"]=
b.Version=b["Versi\u00f3"]=b["Vers\u00e3o"]=b.version="version";b.Idioma=b.Language=b.Hizkuntza=b.Langue=b.language="language";b["O.x"]="O.x";b["O.y"]="O.y";b.Botones=b.Buttons=b.Botons=b.Botoiak=b.Boutons=b["Bot\u00f3ns"]=b["Bot\u00f5es"]=b.Botons="Buttons";b["Animaci\u00f3n"]=b.Animation=b["Animaci\u00f3"]=b.Animazio=b["Anima\u00e7\u00e3o"]="Animation";b.constante=b.constant=b.Konstante="constant";b.fuente=b.font=b.iturri=b.source=b.fonte="font";b["num\u00e9rico"]=b.numeric=b["num\u00e8ric"]=b.zenbakizko=
b["num\u00e9rique"]="numeric";b["gr\u00e1fico"]=b.graphic=b["gr\u00e0fic"]=b.grafiko=b.graphique="graphic";b.hacer=b["do"]=b.fer=b.egin=b.faire=b.facer=b.fazer=b.doExpr="doExpr";b.mientras=b["while"]=b.mentre=b.bitartean=b["tandis que"]=b.mentres=b.enquanto=b.whileExpr="whileExpr";b.evaluar=b.evaluate=b.avalua=b.ebaluatu=b["\u00e9valuer"]=b.avaliar="evaluate";b.variable=b.aldagaia=b["vari\u00e1vel"]="variable";b["funci\u00f3n"]=b["function"]=b["funci\u00f3"]=b.funtzio=b.fonction=b["fun\u00e7\u00e3o"]=
"function";b.algoritmo=b.algorithm=b.algorisme=b.algorithme="algorithm";b.vector=b.array=b.bektore=b.vecteur=b.matriz="array";b["dibujar-si"]=b["draw-if"]=b["marraztu-baldin"]=b["dessiner-si"]=b["debuxar-se"]=b["desenhar-se"]=b["dibuixa-si"]=b.drawif="drawif";b.dominio=b.range=b.domini=b["izate-eremua"]=b.domain=b["dom\u00ednio"]="range";b.pausa=b.delay=b.eten="delay";b["eje-x"]=b["x-axis"]=b["eix-x"]=b["x-ardatza"]=b["axe-x"]=b["eixe-x"]=b["eixo-x"]=b.x_axis="x_axis";b["eje-y"]=b["y-axis"]=b["eix-y"]=
b["y-ardatza"]=b["axe-y"]=b["eixe-y"]=b["eixo-y"]=b.y_axis="y_axis";b["n\u00fameros"]=b.numbers=b.nombres=b.zenbakiak="numbers";b["exponencial-si"]=b["exponential-if"]=b["esponentzial-baldin"]=b["exponentiel-si"]=b["exponencial-se"]=b.exponentialif="exponentialif";b.familia=b.family=b["fam\u00edlia"]=b.famille="family";b.intervalo=b.interval=b.tarte=b.intervalle="interval";b.pasos=b.steps=b.passos=b.pausoak=b.pas="steps";b.centro=b.center=b.centre=b.zentro="center";b.radio=b.radius=b.radi=b.erradio=
b.rayon=b.raio="radius";b.fin=b.end=b.fi=b.bukaera=b.fim="end";b["una-sola-vez"]=b["only-once"]=b["una-sola-vegada"]=b["behin-bakarrik"]=b["une-seule-fois"]=b["unha-soa-vez"]=b["apenas-uma-vez"]=b.onlyOnce="onlyOnce";b.siempre=b.always=b.sempre=b.beti=b.toujours="always";b["color-int"]=b["int-colour"]=b["barruko-kolore"]=b["couleur-int"]=b["cor-int"]=b.colorInt="colorInt";b.repetir=b.loop=b.repeteix=b.errepikatu=b["r\u00e9p\u00e9ter"]="loop";b.controles=b.controls=b.kontrolak=b["contr\u00f4les"]=
b.controis="controls";b.animar=b.animate=b.anima=b.animatu=b.animer="animate";b.auto="auto";b.y=b.top="y";b.espacio=b.space=b.espai=b.espazio=b.espace=b.espazo=b["espa\u00e7o"]="space";b.Nu="Nu";b.Nv="Nv";b.alto=b.height=b.alt=b.altu=b.haut=b.altura=b["al\u00e7ada"]=b.hauteur=b.alto="height";b.ancho=b.depth=b.amplada=b.zabalera=b.largeur=b.profundidade=b.amplada=b.width=b.ample=b.large=b.largura="width";b.largo=b.length=b.llargada=b.luzera=b.longueur=b.longo=b.comprimento=b.llargada="length";b.color_reverso=
b.backcolor=b.color_revers=b["atzealde kolorea"]=b.couleur_revers=b.cor_reverso=b.cor_de_fundo="backcolor";b.aristas=b.edges=b.arestes=b.ertzak=b["ar\u00eates"]=b.arestas="edges";b.rotini=b.inirot="inirot";b.posini=b.inipos="inipos";b["tri\u00e1ngulo"]=b.triangle=b.hirukia=b["tri\u00e2ngulo"]="triangle";b.cara=b.face=b.aurpegi="face";b.polireg=b.regpoly=b["pol\u00edgonoRegular"]="polireg";b.superficie=b.surface=b["superf\u00edcie"]=b.azalera="surface";b.cubo=b.cube=b.cub=b.kubo="cube";b["paralelep\u00edpedo"]=
b.box=b["paral\u00b7lelep\u00edpede"]=b.paralelepipedo=b["parall\u00e9l\u00e9pip\u00e8de"]="box";b.cono=b.cone=b.con=b.kono=b["c\u00f4ne"]="cone";b.cilindro=b.cylinder=b.cilindre=b.zilindro=b.cylindre="cylinder";b.esfera=b.sphere=b["sph\u00e8re"]="sphere";b.tetraedro=b.tetrahedron=b.tetraedre=b["t\u00e9tra\u00e8dre"]="tetrahedron";b.octaedro=b.octahedron=b.octaedre=b.oktaedro=b["octa\u00e8dre"]="octahedron";b.dodecaedro=b.dodecahedron=b.dodecaedre=b.dodekaedro=b["dod\u00e9ca\u00e8dre"]="dodecahedron";
b.icosaedro=b.icosahedron=b.icosaedre=b.ikosaedro=b["icosa\u00e8dre"]="icosahedron";b.elipsoide=b.ellipsoid=b["el\u00b7lipsoide"]=b["ellipso\u00efde"]=b["elips\u00f3ide"]="ellipsoid";b.macro=b.makro="macro";b.id="id";b.modelo=b.model=b.eredu=b["mod\u00e8le"]="model";b.color=b.kolore=b.couleur=b.cor=b.colour=b.kolorea="color";b.luz=b.light=b.llum=b.argia=b["lumi\u00e8re"]="light";b.metal=b.metall=b["m\u00e9tal"]="metal";b.alambre=b.wire=b.filferro=b.alanbre=b["fil de fer"]=b.arame="wire";b.cortar=
b.split=b.talla=b.moztu=b.couper=b.dividir="split";b.despliegue=b.render=b.desplegament=b.zabaltze=b["d\u00e8ploiement"]=b.despregamento=b.processar="render";b.orden=b.sort=b.ordre=b.ordena=b.orde=b.ordenar="sort";b.pintor=b.painter=b.margolari=b.peintre="painter";b["trazado de rayos"]=b["ray trace"]=b["tra\u00e7at de raigs"]=b["izpi trazadura"]=b["trace de rayons"]=b["trazado de raios"]=b["tra\u00e7ado de raios"]=b.raytrace="raytrace";b.despl_imagen=b.bg_display=b.despl_imatge=b["irudi desplazamendu"]=
b.despl_image=b.despr_imaxe=b["apresenta\u00e7\u00e3o_de_imagem"]="bg_display";b["arr-izq"]=b.topleft=b["dalt-esq"]=b["goi-ezk"]=b["au-dessus-gau"]=b["arr-esq"]=b["acima-esquerda"]="topleft";b["expand."]=b.stretch=b.hedatu=b["expandir "]="stretch";b.mosaico=b.patch=b.mosaic=b.mosaiko=b["mosa\u00efque"]="patch";b.centrada=b.zentratu=b["centr\u00e9e"]=b.centrado=b.imgcenter="imgcenter";b.archivo=b.file=b.fitxer=b.artxibo=b.fichier=b.arquivo="file";b.filas_norte=b.rows_north=b.files_nord=b["HTML kodea"]=
b.files_nord=b.filas_norte=b.linhas_norte=b.files_nord=b.rowsNorth="rowsNorth";b.filas_sur=b.rows_south=b.files_sud=b.ipar_lerro=b.files_sud=b.filas_sur=b.linhas_sul=b.files_sud=b.rowsSouth="rowsSouth";b.ancho_este=b.width_east=b.ample_est=b.hego_lerro=b.ample_est=b.ancho_leste=b.largura_leste=b.ample_est=b.widthEast="widthEast";b.ancho_oeste=b.width_west=b.ample_oest=b.ekialde_zabalera=b.ample_ouest=b.ancho_oeste=b.largura_oeste=b.ample_oest=b.widthWest="widthWest";b.fijo=b.fixed=b.fix=b.hegoalde_zabalera=
b.fixe=b.fixo="fixed";b["Reiniciar Animaci\u00f3n"]=b["Init Animation"]=b["Reinicia Animaci\u00f3"]=b.finko=b["Recommencer l'Animation"]=b["Reiniciar Anima\u00e7\u00e3o"]=b.initAnimation="initAnimation";b["Explicaci\u00f3n"]=b.Explanation=b.Azalpena=b.Explication=b["Explica\u00e7\u00e3o"]=b["Explicaci\u00f3"]="Explanation";b.tooltip=b.dica="tooltip";b.discreto=b.discrete=b.discret=b.diskretu="discrete";b.interfaz=b.gui=b["interf\u00edcie"]=b.interfaze=b["interface"]="gui";b.pulsador=b.spinner=b.polsador=
b.pultsadore=b.bouton="spinner";b["campo de texto"]=b.textfield=b["camp de text"]=b["testu esarrua"]=b["champ de texte"]="textfield";b["men\u00fa"]=b.choice=b.menu=b.escolha="menu";b.barra=b.scrollbar=b.barre="scrollbar";b.opciones=b.options=b.opcions=b.aukerak=b["opci\u00f3ns"]=b["op\u00e7\u00f5es"]="options";b.interior=b.barruko=b["int\u00e9rieur"]="interior";b["condici\u00f3n"]=b.condition=b["condici\u00f3"]=b.baldintza=b["condi\u00e7\u00e3o"]="condition";b["acci\u00f3n"]=b.action=b["acci\u00f3"]=
b.ekintza=b["a\u00e7\u00e3o"]="action";b.evento=b.event=b.esdeveniment=b.gertaera=b["\u00e9v\u00e9nement"]="event";b["abrir URL"]=b["open URL"]=b["obre URL"]=b["URL zabaldu"]=b["ouvrir URL"]=b.openURL="openURL";b["abrir Escena"]=b["open Scene"]=b["obre Escena"]=b["eszena zabaldu"]=b["ouvrir Escena"]=b["abrir Cena"]=b.openScene="openScene";b["bot\u00f3n"]=b.button=b["bot\u00f3"]=b.botoi=b.bouton=b["bot\u00e3o"]="button";b.mensaje=b.message=b.mezua=b.mensaxe=b.mensagem=b.missatge="message";b.alternar=
b.alternate=b.alterna=b.txandakatu=b.alterner="alternate";b["ejecuci\u00f3n"]=b.execution=b["execuci\u00f3"]=b.gauzatze=b["ex\u00e9cution"]=b["execuci\u00f3n"]=b["execu\u00e7\u00e3o"]="execution";b.calcular=b.calculate=b.calcula=b.kalkulatu=b.calculer="calculate";b.coord_abs=b.abs_coord=b.koor_abs="abs_coord";b.negrita=b.bold=b.negreta=b.lodi=b["caract\u00e8re gras"]=b.negra=b.negrito="bold";b.cursiva=b.italics=b.etzana=b.italique=b["it\u00e1lico"]="italics";b.subrayada=b.underlined=b.subratllat=
b.azpimarratua=b.soulignement=b["subli\u00f1ada"]=b.sublinhado="underlined";b.pos_mensajes=b.msg_pos=b.pos_missatges=b.mezuen_pos=b.pos_messages=b.pos_mensaxes="msg_pos";b.izquierda=b.left=b.esquerra=b.eskerrean=b.gauche=b.esquerda=b.esquerda=b.esquerra=b.x="x";b.derecha=b.right=b.dreta=b.eskuinan=b.droite=b.dereita=b.direita=b.dreta="right";b["sensible_a_los_movimientos_del_rat\u00f3n"]=b.sensitive_to_mouse_movements=b["sensible_als_moviments_del_ratol\u00ed"]=b["xagu mugimenduarekiko sentikorra"]=
b.sensible_aux_mouvements_du_souris=b.sensible_aos_movementos_do_rato=b["sens\u00edvel_aos_movimentos_do_mouse"]="sensitive_to_mouse_movements";b.reproducir=b.play=b.reprodueix=b.erreproduzitu=b.reproduire=b.reproduzir=b.playAudio="playAudio";b["activo-si"]=b["active-if"]=b["actiu-si"]=b["altiboa-baldin"]=b["actif-si"]=b["activo-se"]=b["ativo-se"]=b.activeif="activeif";b.rotfin=b.finrot=b.bukrot=b.endrot="endrot";b.posfin=b.finpos=b.bukpos=b.endpos="endpos";b.editable=b.editagarria=b["edit\u00e1vel"]=
"editable";b.R2="2D";b.R3="3D";b.vectores=b.bektoreak=b.vecteurs=b.vetores=b.vectors="vectors";b["fuente puntos"]=b["font size"]=b["font punts"]=b["puntu iturria"]=b["source points"]=b["fonte puntos"]=b["fonte pontos"]=b.font_size="font_size";b.escenario=b.scenario=b.escenari=b.agertoki=b["sc\u00e8ne"]=b["cen\u00e1rio"]="scenario";b.cID="cID";b.matriz=b.matrix=b.matriu=b.matrice="matrix";b.filas=b.rows=b.files="rows";b.columnas=b.columns=b.colonnes="columns";b.solo_texto=b.only_text=b.seulement_texte=
b["s\u00f3_texto"]=b.tan_sols_texte=b.onlyText="onlyText";b.respuesta=b.answer="answer";b.peso=b.weight=b.pes="weight";b.decimal_symbol=b["signo decimal"]=b["decimal symbol"]="decimal_symbol";b.info="info";b.library="library";b.color_contorn_text=b.color_text_border=b.color_borde_texto=b.muga_testuaren_kolorea=b.couleur_contour_texte=b.cor_borde_texto=b.colore_bordo_testo=b.cor_borda_texto=b.color_contorn_text=b.border="border";b.video=b["vid\u00e9o"]="video";b.audio=b["\u00e0udio"]="audio";b.autoplay=
"autoplay";b.poster="poster";b.opacidad=b.opacity=b["opacit\u00e9"]=b.opacitat=b.opacidade="opacity";b.alinear=b.align=b["ali\u00f1ar"]=b.aligner="align";b.anchor="anchor";b.a_left="left";b.a_center="center";b.a_right="right";b.a_justify="justify";b.a_top_left="top_left";b.a_top_center="top_center";b.a_top_right="top_right";b.a_center_left="center_left";b.a_center_center="center_center";b.a_center_right="center_right";b.a_bottom_left="bottom_left";b.a_bottom_center="bottom_center";b.a_bottom_right=
"bottom_right";b.malla=b.mesh="mesh";b.local=b.Local="local";b.rectangle=b["rect\u00e1ngulo"]="rectangle";b.lineDash="lineDash";b.solid="solid";b.dot="dot";b.dash="dash";b.dash_dot="dash_dot";b.offset_dist="offset_dist";b.offset_angle="offset_angle";b.flat="flat";b.borderColor="borderColor";b.text_align="text_align";b.image_align="image_align";b.checkbox="checkbox";b.torus=b.toro="torus";b.R="R";b.r="r";b.border_radius="border_radius";b.radio_group="radio_group";b.font_family="font_family";b.resizable=
"resizable";b.slider="slider";b.antialias="antialias";b.image_loader="image_loader";b.expand="expand";b.cover=b.cubrir="cover";b.fit=b.escalar="fit";b.code="code";b.doc="doc";b.image_dec="image_dec";b.image_inc="image_inc";b.btn_pos="btn_pos";b.border_width="border_width";b.border_color="border_color";b.v_left="v_left";b.v_right="v_right";b.h_left="h_left";b.h_right="h_right";b.h_left_right="h_left_right";b.label_color="label_color";b.label_text_color="label_text_color";b.shadowColor="shadowColor";
b.shadowBlur="shadowBlur";b.shadowOffsetX="shadowOffsetX";b.shadowOffsetY="shadowOffsetY";b.border_size="border_size";b.clip="clip";b.keyboard="keyboard";b.kblayout="kblayout";b.kbexp="kbexp";b.extra_style="extra_style";return b}(babel||Object.create(null)),descartesJS=function(b){if(b.loadLib)return b;b.addFonts=function(){var a={sansserif:{},serif:{},monospace:{},math:{}};a.sansserif.normal_bold=" ";
a.sansserif.italic_bold=" ";
a.sansserif.italic_normal=" ";
a.sansserif.normal_normal=" ";
a.monospace.normal_bold=" ";
a.monospace.italic_bold=" ";
a.monospace.italic_normal=" ";
a.monospace.normal_normal=" ";
a.serif.normal_bold=" ";
a.serif.italic_bold=" ";
a.serif.italic_normal=" ";
a.serif.normal_normal=" ";
a.math.normal_bold=a.math.italic_bold=" ";
a.math.italic_normal=a.math.normal_normal=" ";
for(var b=[["normal","bold"],["italic","bold"],["italic","normal"],["normal","normal"]],h="",l=$jscomp.makeIterator(["sansserif","monospace","serif","math"]),d=l.next();!d.done;d=l.next()){d=d.value;for(var k=$jscomp.makeIterator(b),g=k.next();!g.done;g=k.next())g=g.value,h+="@font-face{font-family:'DJS_"+d+"';src:url('data:font/woff2;charset=utf-8;base64,"+a[d][g[0]+"_"+g[1]]+"') format('woff2');font-style:"+g[0]+";font-weight:"+g[1]+";} "}return h};return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;b.addSymbolFont=function(){for(var a="",b=$jscomp.makeIterator([["normal","bold"],["italic","bold"],["italic","normal"],["normal","normal"]]),h=b.next();!h.done;h=b.next())h=h.value,a+="@font-face{font-family:'DJS_symbol';src:url('data:font/woff2;charset=utf-8;base64, ') format('woff2');font-style:"+
h[0]+";font-weight:"+h[1]+";} ";return a};return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,l={bold:"Bold",italic:"Italic",italics:"Italic","bold+italic":"Italic Bold"};b.serif_font="descartesJS_serif,DJS_symbol,DJS_serif,Times,'Times New Roman','Liberation Serif','Nimbus Roman No9 L Regular',serif";b.sansserif_font="descartesJS_sansserif,DJS_symbol,DJS_sansserif,Helvetica,Arial,'Liberation Sans','Nimbus Sans L',sans-serif";b.monospace_font="descartesJS_monospace,DJS_symbol,DJS_monospace,'Courier New',Courier,'Liberation Mono','Nimbus Mono L',monospace";b.math_font=
"descartesJS_math,DJS_symbol,DJS_math,DJS_serif,Times,'Times New Roman','Liberation Serif','Nimbus Roman No9 L Regular',serif";b.convertFont=function(d){if(""==d)return"";a=d.split(",");c="";c+=b.getFontStyle(a[1])+" ";c+=a[2]+"px ";return c+=b.getFontName(a[0].split(" ")[0])};b.getFontName=function(a){a=a.toLowerCase();h=b.monospace_font;/sansserif|arial|helvetica/.test(a)?h=b.sansserif_font:/serif|times/.test(a)&&(h=b.serif_font);return h};b.getFontStyle=function(a){return l[a.toLowerCase()]||""};
b.getTextWidth=function(a,c){b.ctx.font=c;return Math.round(b.ctx.measureText(a).width)};b.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 b}(descartesJS||{});
descartesJS=function(b){function a(){var a,b,d,e,g,c,h;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"),c="-"===e[0][0]?"-":"",g="-"===c?parseFloat(e[0].substring(1)).oToFixed(11):parseFloat(e[0]).oToFixed(11),h=parseInt(e[1]),b=g.indexOf("."),g=g.replace(".",""),0>b+h?(b=0>b?1:b,a=c+"0."+"0".repeat(Math.abs(b+h))+g):a=c+g+"0".repeat(h-g.length+1));b=a.indexOf(".");
-1===b?0<f&&(a+="."+"0".repeat(f)):(d=a.length-b-1,a=d>=f?11>=f?parseFloat(a).oToFixed(f):a.substring(0,b+f+1):a+"0".repeat(f-d));return a}}if(b.loadLib)return b;var c=360/(2*Math.PI),h=2*Math.PI/360,l=Math.floor,d,k,g,n;b.rangeOK=1;b.cssScale=1;b.radToDeg=function(a){return a*c};b.degToRad=function(a){return a*h};b.getFeatures=function(){var f="";try{f=navigator.appVersion.toLowerCase()}catch(m){console.warn("navigator.appVersion is deprecated")}b.hasTouchSupport=window.hasOwnProperty&&window.hasOwnProperty("ontouchstart")||
"ontouchstart"in window||/android/i.test(f);b.isIOS=/iPad|iPhone/i.test(navigator.userAgent);f=b.newHTML("canvas");b.hasCanvas=f.getContext&&f.getContext("2d");b.hasCanvas&&(f.width=f.height=1,b.ctx=b.hasCanvas,b._ratio=2);a()};b.removeNeedlessDecimals=function(a){if("string"==typeof a&&(g=a.indexOf("."),-1!==g)){n=a.substring(g);if(0==parseFloat(n))return a.substring(0,g);for(var b=n.length-1;0<b;b--)if("0"!==n.charAt(b))return a.substring(0,g+b+1)}return a};b.whichBtn=function(a){return a.pointerType&&
("touch"===a.pointerType||"pen"===a.pointerType)||a.touches?"L":0===a.button?"L":1===a.button?"M":"R"};b.createGradient=function(a,b,d){a=void 0===a?0:a;b=void 0===b?100:b;d="linear-gradient("+(void 0===d?0:d)+"deg,";for(var f=2*a,g=a;g<b;g++)a=l(100-g-35),d+="rgba(0,0,0,"+a*a*192/1E4/255+") "+(2*g-f)+"%, ";return d+"rgba(0,0,0,0.1) 100%)"};b.getCursorPosition=function(a,g){d=a;a.touches&&0<a.touches.length&&(d=a.touches[0]);if(!d||"undefined"===typeof d.clientX)return null;k=g.getBoundingClientRect();
return{x:(d.clientX-k.left)/b.cssScale,y:(d.clientY-k.top)/b.cssScale}};b.splitSeparator=function(a){a=a.replace(/\\n/g,"\n");for(var b=!1,f,d=[],g=0,c=0,h=a.length;c<h;c++)f=a.charAt(c),"'"===f&&(b=!b),b||";"!==f&&"\n"!==f||(d.push(a.substring(g,c).replace(/\n/g,"\\n")),g=c+1);d.push(a.substring(g).replace(/\n/g,"\\n"));return d};b.preventDefault=function(a){a.stopPropagation();a.preventDefault();return!1};b.convertHTMLEntities=function(a){var f=b.newHTML("textarea");f.innerHTML=a;return f.value};
b.newHTML=function(a,b){a=document.createElement(a);for(var f in b)a.setAttribute(f,b[f]);return a};window.requestAnimationFrame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame;window.cancelAnimationFrame=window.cancelAnimationFrame||window.mozCancelAnimationFrame;b.setInterval=function(a,b){function f(){Date.now()-d>=b&&(a.call(),d=Date.now());g.value=requestAnimationFrame(f)}if(!requestAnimationFrame)return setInterval(a,
b);var d=Date.now(),g={};g.value=requestAnimationFrame(f);return g};b.clearInterval=function(a){a&&(cancelAnimationFrame?cancelAnimationFrame(a.value):clearInterval(a))};b.setTimeout=function(a,b){function f(){Date.now()-d>=b?a.call():g.value=requestAnimationFrame(f)}if(!requestAnimationFrame)return setTimeout(a,b);var d=Date.now(),g={};g.value=requestAnimationFrame(f);return g};b.clearTimeout=function(a){a&&(cancelAnimationFrame?cancelAnimationFrame(a.value):clearTimeout(a))};b.showAbout=function(){window.open("https://arquimedes.matem.unam.mx/Descartes5/creditos/",
"cr\u00e9ditos","width=700,height=500,titlebar=0,toolbar=0,location=0,menubar=0,resizable=0,scrollbars=0,status=0")};return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;b.cacheFiles=Object.create(null);b.openFile=function(a){if(b.cacheFiles[a])return b.cacheFiles[a];var c=null,h=new XMLHttpRequest;h.open("GET",a,!1);try{h.send(null),c=200===h.status||304===h.status?h.responseText:h.responseText||"",c=404===h.status?"":c,c.match(String.fromCharCode(65533))&&(h.open("GET",a,!1),h.overrideMimeType("text/plain;charset=ISO-8859-1"),h.send(null),c=h.responseText)}catch(l){c=null}return c};b.addExternalFileContent=function(a,
c){b.cacheFiles[a]=c};return b}(descartesJS||{});
descartesJS=function(b){function a(a){a=a.replace(/\+/g,"\\+").replace(/\*/g,"\\*").replace(/\(/g,"\\(").replace(/\)/g,"\\)");l=a.trim();a={ignoreAccents:!1,ignoreCaps:!1,regExp:null};/^'.*'$/.test(l)&&(a.ignoreCaps=!0,l=l.slice(1,-1),/^`.*\u00b4$/.test(l)&&(a.ignoreAccents=!0,l=l.slice(1,-1)));/^`.*\u00b4$/.test(l)&&(a.ignoreAccents=!0,l=l.slice(1,-1),/^'.*'$/.test(l)&&(a.ignoreCaps=!0,l=l.slice(1,-1)));l.startsWith("\\*")&&!l.endsWith("\\*")?l=l.substring(2)+"$":!l.startsWith("\\*")&&l.endsWith("\\*")?
l="^"+l.substring(0,l.length-2):l.startsWith("\\*")||l.endsWith("\\*")?l.startsWith("\\*")&&l.endsWith("\\*")&&(l=l.substring(2,l.length-2)):l="^"+l+"$";a.regExp=l.replace(/\?/g,"[\\S\\s]{1}");return a}function c(a,f){a=void 0===a?"":a;var d={},g=a.match(/^\s*(\(|\[)(.*)(\)|\])\s*$/);g?(d.type=g[1]+g[3],g=b.splitComa(g[2]),d.min=f.parser.parse(g[0]),d.max=f.parser.parse(g[1])):(d.type="[]",d.min=d.max=f.parser.parse(a));return d}function h(a){return(void 0===a?"":a).toString().normalize("NFD").replace(/[\u0300-\u036f]/g,
"")}if(b.loadLib)return b;var l,d,k,g;b.answerRegEx=function(b,f,g){b=void 0===b?"":b;g&&/^\(.*\)$/.test(b)&&(b=b.slice(1,-1));b=b.replace(/&squot;/g,"'").replace(/&amp;/g,"&").split("|");for(var m=0,e=b.length;m<e;m++){d=b[m].split("&");k=[];for(var h=$jscomp.makeIterator(d),l=h.next();!l.done;l=h.next())l=l.value,g?k.push(a(l)):k.push(c(l,f));b[m]=k}return b};b.esCorrecto=function(a,b,d){b=(void 0===b?"":b)+"";a=$jscomp.makeIterator(a);for(var f=a.next();!f.done;f=a.next()){f=f.value;g=!0;f=$jscomp.makeIterator(f);
for(var e=f.next();!e.done;e=f.next())if(e=e.value,l=e.regExp)e.ignoreAccents&&(b=h(b),l=h(l)),e.ignoreCaps&&(b=b.toLowerCase(),l=h(l).toLowerCase()),g=g&&!!b.match(l);else{var c;if(c=g){c=b;var m=d;c=parseFloat(c);var k=m.eval(e.min);m=m.eval(e.max);m=")"==e.type[1]?c<m:c<m||1E-9>Math.abs(m-c);c=("("==e.type[0]?k<c:k<c||1E-9>Math.abs(k-c))&&m}g=c}if(g)return 1}return 0};return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;b.loaderImg=new Image;b.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>");
b.getSvgArrowUp=function(a,b){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===b?"24c":b)+'" d="m19.5 17.5-7.5-12-7.5 12z"/></svg>')};b.getSvgArrowDown=function(a,b){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===b?"d00018":b)+'"/></svg>')};b.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>")};b.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>")};
b.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 b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=Math.floor,c=/[\w-//]*(\.png|\.jpg|\.gif|\.svg|\.webp)/gi,h,l,d,k,g,n,f,m,p,e,u,v,w,q,r,y,x,z,A=function(a,f){this.r=this.g=this.b=0;this.a=1;this.evaluator=f;this.getColor=this.getColorStr;if(!a)this.colorStr="rgba("+this.r+","+this.g+","+this.b+","+this.a+")";else if(/^GradL/.test(a)){a=b.splitComa(a.substring(6,a.length-1));this.x1=this.evaluator.parser.parse(a[0]);this.y1=this.evaluator.parser.parse(a[1]);this.x2=this.evaluator.parser.parse(a[2]);
this.y2=this.evaluator.parser.parse(a[3]);this.stops=[];for(var g=4;g<a.length;g++)""!=a[g]&&(f=a[g].split("|"),this.stops.push({percentage:this.evaluator.parser.parse(f[1]),color:"#"+f[2]}));this.getColor=this.getLinearGradient}else if(/^Pattern/.test(a))this.img_src=a.substring(8,a.length-1),this.img_src.match(c)&&(this.img_src="'"+this.img_src+"'"),this.img_src=this.evaluator.parser.parse(this.img_src),this.getColor=this.getPattern;else if(babel[a])"net"===babel[a]&&(a="rojo"),a=babel[a],this.r=
b.toHex(a.substring(1,3)),this.g=b.toHex(a.substring(3,5)),this.b=b.toHex(a.substring(5,7)),this.colorStr=a;else if(6===a.length)this.r=b.toHex(a.substring(0,2)),this.g=b.toHex(a.substring(2,4)),this.b=b.toHex(a.substring(4,6)),this.colorStr="#"+a;else if(8===a.length)this.r=b.toHex(a.substring(2,4)),this.g=b.toHex(a.substring(4,6)),this.b=b.toHex(a.substring(6,8)),this.a=1-b.toHex(a.substring(0,2))/255,this.colorStr="rgba("+this.r+","+this.g+","+this.b+","+this.a+")";else if("("===a[0]){l=[];d=b.splitComa(a.substring(1,
a.length-1));a=0;for(f=d.length;a<f;a++)n=d[a],k=parseInt(n,16),n!==k.toString(16)&&n!=="0"+k.toString(16)?("["===n.charAt(0)&&"]"===n.charAt(n.length-1)&&(n=n.substring(1,n.length-1)),l.push(this.evaluator.parser.parse(n))):l.push(this.evaluator.parser.parse((k/255).toString()));this.rExpr=l[0];this.gExpr=l[1];this.bExpr=l[2];this.aExpr=l[3];this.getColor=this.getColorExp}};A.prototype.getColorStr=function(){return this.colorStr};A.prototype.getColorExp=function(){h=this.evaluator;this.r=a(255*h.eval(this.rExpr));
this.g=a(255*h.eval(this.gExpr));this.b=a(255*h.eval(this.bExpr));this.a=1-h.eval(this.aExpr);return"rgba("+this.r+","+this.g+","+this.b+","+this.a+")"};A.prototype.getLinearGradient=function(){h=this.evaluator;y=b.ctx.createLinearGradient(h.eval(this.x1),h.eval(this.y1),h.eval(this.x2),h.eval(this.y2));for(var a=0;a<this.stops.length;a++)r=h.eval(this.stops[a].percentage),r=0>r?0:1<r?1:r,y.addColorStop(r,this.stops[a].color);return y};A.prototype.getPattern=function(){z=this.evaluator.parent;if(x=
z.getImage(this.evaluator.eval(this.img_src)))try{return b.ctx.createPattern(x,"repeat")}catch(C){}return"ff00ff"};A.prototype.borderColor=function(){return 380>this.r+this.g+this.b?"#ffffff":"#000000"};b.toHex=function(a){return parseInt("0x"+a,16)};b.RGBAToHexColor=function(a){a=a.substring(5,a.length-1).split(",");u=parseInt(a[0]).toString(16).padStart(2,"0");v=parseInt(a[1]).toString(16).padStart(2,"0");w=parseInt(a[2]).toString(16).padStart(2,"0");q=(255-parseInt(255*parseFloat(a[3]))).toString(16).padStart(2,
"0");return new A(q+u+v+w)};b.splitComa=function(a){g=[];for(var b=p=m=f=0,d=a.length;b<d;b++)e=a[b],"("===e?f++:")"===e?f--:"["===e?m++:"]"===e?m--:","===e&&0===f&&0===m&&(g.push(a.substring(p,b)),p=b+1);g.push(a.substring(p));return g};b.Color=A;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=function(a){var c=this;this.parent=a;this.container=b.newHTML("div",{class:"DescartesKeyboardContainer"});this.display=b.newHTML("textarea",{class:"DescartesKeyboardDisplay",spellcheck:"false",inputmode:"none"});this.container.appendChild(this.display);this.keyContainer=b.newHTML("div",{style:"position:absolute; padding-bottom:5px;",class:"DescartesKeysContainer"});this.container.appendChild(this.keyContainer);this.additionalKeys=b.newHTML("div",
{style:"position:absolute; padding: 0 5px 5px 0; display:none;",class:"DescartesKeysContainer"});this.container.appendChild(this.additionalKeys);this.newLine=b.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(){c.insert("\n")});this.container.appendChild(this.newLine);this.display.addEventListener("keydown",
function(a){c.keypressed=!0;if(27===a.keyCode)c.close();else if(13===a.keyCode)c.onEnter()});this.key_pressed=this.delete_pressed=!1;var l,d;this.keyContainer.addEventListener("pointerdown",function(a){if(/^(k_op|k_dot|k_a|k_e|k_i|k_o|k_u)$/.test(a.target.id)){a.target.onpointerleave=function(){clearTimeout(l)};var b=a.target.textContent.trim().toLowerCase();l=setTimeout(function(){c.key_pressed=!0;c.showAditionalKeys(b)},600)}else"k_del"==a.target.id&&(a.target.onpointerleave=function(){clearTimeout(d)},
d=setInterval(function(){c.delete_pressed=!0;c.delete()},200))});this.keyContainer.addEventListener("pointerup",function(a){if(a.target!=c.keyContainer&&a.target!=c.container)if(a.preventDefault(),a.stopPropagation(),"k_left"==a.target.id)c.display.selectionStart=c.display.selectionEnd=Math.max(0,c.display.selectionStart-1);else if("k_right"==a.target.id)c.display.selectionStart=c.display.selectionEnd=Math.min(c.display.value.length,c.display.selectionStart+1);else if("k_del"==a.target.id)c.delete_pressed||
c.delete(),clearTimeout(d),c.delete_pressed=!1;else if("k_\u221a"==a.target.id)c.insert("\u221a(");else if("k_space"==a.target.id)c.insert(" ");else if("k_esc"==a.target.id)c.close();else if("k_shift"==a.target.id){a=c.keyContainer.querySelectorAll("div");var b=c.additionalKeys.querySelectorAll("div");c.shift=!c.shift;c.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)c["setLayout_"+c.layout_mode.replace("alfa","num")]();else if("k_alfa_layout"==a.target.id)c["setLayout_"+c.layout_mode.replace("num","alfa")]();else if("k_clear"==a.target.id)c.display.value="";else if(/^(k_op|k_dot|k_a|k_e|k_i|k_o|k_u)$/.test(a.target.id))clearTimeout(l),
c.key_pressed||(c.insert(a.target.textContent.trim()),c.additionalKeys.style.display="none"),c.key_pressed=!1;else if("k_return"==a.target.id)c.onEnter();else a=a.target.textContent.trim(),c.insert(a),c.additionalKeys.style.display="none";c.display.focus()});this.keyContainer.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation()});var k=!1;this.additionalKeys.addEventListener("pointerdown",function(a){k=!0});this.additionalKeys.addEventListener("pointerup",function(a){k&&(a.target!=
c.keyContainer&&a.target!=c.container&&(a.preventDefault(),a.stopPropagation(),a=a.target.textContent.trim(),c.insert(a)),c.key_pressed=!1,c.additionalKeys.style.display="none");k=!1;c.display.focus()})};a.prototype.insert=function(a){this.display.setRangeText(a);this.display.selectionStart+=a.length;this.display.selectionStart=this.display.selectionEnd;this.display.focus()};a.prototype.delete=function(){this.display.selectionStart==this.display.selectionEnd&&(this.display.selectionStart=Math.max(0,
this.display.selectionStart-1));this.display.setRangeText("")};a.prototype.addKey=function(a,b,l){return"<div "+(b?"id='"+b+"'":"")+" "+(l?"style='"+l+"'":"")+">"+a+"</div>"};a.prototype.addKeys=function(a){var b=this,c="";a.forEach(function(a){c="object"===typeof a?c+b.addKey(a.val,a.id,a.style):c+b.addKey(a)});return c};a.prototype.showAditionalKeys=function(a){var b=[];"."==a?b=",;:-_\u00bf?\u00a1!()".split(""):"+"==a?b=["-","\u00d7","\u00f7","^"]:"a"==a?b=["\u00e1","\u00e0","\u00e4","\u00e2"]:
"e"==a?b=["\u00e9","\u00e8","\u00eb","\u00ea"]:"i"==a?b=["\u00ed","\u00ec","\u00ef","\u00ee"]:"o"==a?b=["\u00f3","\u00f2","\u00f6","\u00f4"]:"u"==a&&(b=["\u00fa","\u00f9","\u00fc","\u00fb"]);this.additionalKeys.innerHTML=this.addKeys(b);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"};
a.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_del"},{val:"\u21b5",id:"k_return"}]);this.keyContainer.style.width="635px"};a.prototype.setLayout_7x2=function(){this.keyContainer.innerHTML=this.addKeys([1,2,3,4,5,{val:this.parent.decimal_symbol},{val:"\u232b",id:"k_del"},6,7,8,9,0,"-",{val:"\u21b5",id:"k_return"}]);this.keyContainer.style.width="320px"};a.prototype.setLayout_10x2=function(){this.keyContainer.innerHTML=
this.addKeys(["(",1,2,3,4,5,"\u00b2","/","\u00d7",{val:"\u232b",id:"k_del"},")",6,7,8,9,0,{val:this.parent.decimal_symbol},"-","+",{val:"\u21b5",id:"k_return"}]);this.keyContainer.style.width="455px"};a.prototype.setLayout_4x4=function(){this.keyContainer.innerHTML=this.addKeys([7,8,9,{val:"\u232b",id:"k_del"},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"};a.prototype.setLayout_5x4=function(){this.keyContainer.innerHTML=
this.addKeys([7,8,9,"\u00b2",{val:"\u232b",id:"k_del"},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"};a.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_del"},{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};a.prototype.setLayout_11x4=function(){this.keyContainer.innerHTML=this.addKeys([1,2,3,4,5,6,7,8,9,0,{val:"\u232b",id:"k_del"},"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"};a.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_del",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"};a.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_del"},
{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"};a.prototype.showCustomKB=function(a){var b=a.querySelectorAll("div");a=parseInt(a.getAttribute("cols")||b.length);var c=[],d,k;b=$jscomp.makeIterator(b);for(d=b.next();!d.done;d=b.next()){var g=d.value;d={val:g.textContent};if(k=g.getAttribute("id"))d.id=k;if(k=g.getAttribute("size"))d.style=
"width:"+(40*parseInt(k)+5*(parseInt(k)-1))+"px;transform:none !important;";c.push(d)}this.keyContainer.innerHTML=this.addKeys(c);this.keyContainer.style.width=5+45*a+"px"};a.prototype.setLayout=function(a){this.layout_mode=a;var b=document.getElementById("kb_"+a);b?this.showCustomKB(b):"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()};a.prototype.show=function(a,b,l,d,k,g,n){this.ctr=a;this.var_id=k;this.onlyText=n;this.container.parentNode||this.parent.container.appendChild(this.container);this.container.style.display="block";this.setDisplay(g);this.setLayout(b);this.keyContainer.style.left=l+"px";this.keyContainer.style.top=d+"px";this.additionalKeys.style.display="none"};a.prototype.close=function(){this.container.style.display=
"none";this.parent.deactivateControls();this.parent.update()};a.prototype.setDisplay=function(a){if("custom"==a.type){var c=a.x;var l=a.y;var d=a.w;var k=a.h;var g=a.fs}else l=this.container.getBoundingClientRect(),k=a.getBoundingClientRect(),c=k.left/b.cssScale-l.left/b.cssScale,l=k.top/b.cssScale-l.top/b.cssScale,d=k.width/b.cssScale,k=k.height/b.cssScale,g=a.style.fontSize;"textarea"==a.tagName.toLowerCase()?(this.display.setAttribute("style","left:"+c+"px;top:"+l+"px;width:"+d+"px;height:"+k+
"px;font-size:"+g+";line-height:1.2em;padding:5px;font:"+a.style.font+";"),this.newLine.style.left=c+d-42+"px",this.newLine.style.top=l+k-42+"px",this.newLine.style.display="block"):(this.display.setAttribute("style","left:"+c+"px;top:"+l+"px;width:"+d+"px;height:"+k+"px;font-size:"+g+";line-height:"+k+"px;white-space:nowrap;"),this.newLine.style.display="none");this.display.value=a.value||"";this.display.focus();this.display.selectionStart=this.display.selectionEnd=this.display.value.length};a.prototype.onEnter=
function(){var a=this.display.value;if(!this.onlyText){var b=this.parent.evaluator.parser.parse(a.replace(/\u221a/g,"sqrt"));try{b&&(a=this.parent.evaluator.eval(b))}catch(k){a=0}}if(this.ctr)this.ctr.changeValue(a,!0);else if(this.var_id=(this.var_id+"").trim(),b=this.var_id.indexOf("["),-1==b)this.parent.evaluator.setVariable(this.var_id,a);else{var l=this.var_id.indexOf(","),d=this.var_id.substring(0,b);-1==l?this.parent.evaluator.setVector(d,parseInt(this.var_id.substring(b+1)),a):this.parent.evaluator.setMatrix(d,
parseInt(this.var_id.substring(b+1)),parseInt(this.var_id.substring(l+1)),a)}this.close()};b.Keyboard=a;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=document.head,c=b.newHTML("meta",{name:"viewport",content:"width=device-width,initial-scale=1.0,user-scalable=yes"});a.querySelector("meta[name=viewport]")||a.appendChild(c);c=b.newHTML("meta",{name:"mobile-web-app-capable",content:"yes"});a.appendChild(c);c=b.newHTML("meta",{name:"apple-mobile-web-app-capable",content:"yes"});a.appendChild(c);c=b.newHTML("meta",{name:"apple-mobile-web-app-status-bar-style",content:"black"});a.appendChild(c);(a=
document.getElementById("StyleDescartesApps2"))&&a.remove();a=b.newHTML("style",{rel:"stylesheet",type:"text/css",id:"StyleDescartesApps2"});document.head.insertBefore(a,document.head.firstChild);a.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.DescartesSpaceIframe{position:absolute;left:0;top:0;width:inherit;height:inherit;}\n.DescartesSpaceIframeContainer{position:absolute;background-repeat:no-repeat;background-position:center;}\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("+
b.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("+b.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,.DescartesSliderField{font-family:"+
b.sansserif_font+";padding:0 2px;border:solid #666 1px;position:absolute;  outline: none;}\n.DescartesSpinnerField:focus,.DescartesTextFieldField:focus,.DescartesMenuField:focus,.DescartesScrollbarField:focus,.DescartesSliderField:focus{border:2px solid #3f88fb;}\ninput[type=text]:disabled,.DescartesMenuSelect:disabled{background-color:#e3e3e3;cursor:not-allowed;opacity:1;}\n.DescartesSpinnerLabel,.DescartesCheckboxLabel,.DescartesMenuLabel,.DescartesScrollbarLabel,.DescartesSliderLabel,.DescartesTextFieldLabel{font-family:"+
b.sansserif_font+";font-weight:normal;text-align:center;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;position:absolute;left:0;top:0;}\n.DescartesGraphicControl{cursor:pointer;background-color:transparent;touch-action:none;border-style:none;position:absolute;}\n.DescartesTextAreaContainer{position:absolute;overflow:hidden;background:#F7F7F7;border:solid #666 1px;}\n.DescartesTextArea {position:absolute;padding:5px;left:2px;top:2px;background-color:white;text-align:left;border:none;outline:none;resize:none;}\n.DescartesTextArea:focus {outline:3px solid #3f88fb;}\n.DescartesMenuSelect{font-family:"+
b.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('"+b.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,.DescartesSliderContainer{touch-action:none;background:#eee;overflow:hidden;position:absolute;}\n.DescartesSliderContainer{background:transparent;}\n.DescartesRange{-webkit-appearance:none;appearance:none;background:transparent;cursor: pointer;}\n.DescartesRange::-webkit-slider-runnable-track{background:var(--track_color);height:var(--track_h);border-radius:var(--track_h);}\n.DescartesRange::-moz-range-track{background:var(--track_color);height:var(--track_h);border-radius:var(--track_h);}\n.DescartesRange::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;margin-top:calc(var(--track_h) / 2 - var(--thumb_size) / 2);border-radius:50%;background-color:var(--thumb_color);height:var(--thumb_size);width:var(--thumb_size);}\n.DescartesRange::-moz-range-thumb{border:none;border-radius:50%;background-color:var(--thumb_color);height:var(--thumb_size);width:var(--thumb_size);}\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:"+
b.createGradient(50,100)+", url('"+b.getSvgArrowUp()+"');}\n.DJS_Up[horizontal=true]{background-color:#f0f8ff;background-image:"+b.createGradient(50,100,90)+", url('"+b.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:"+b.createGradient(0,50)+", url('"+b.getSvgArrowDown()+"');}\n.DJS_Down[horizontal=true]{background-color:#f0f8ff;background-image:"+
b.createGradient(50,100,-90)+", url('"+b.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:"+
b.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:"+b.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"+
(b.addSymbolFont?b.addSymbolFont():"")+(b.addFonts?b.addFonts():"")+"@media print{body{margin:0;padding:0;}\n.DescartesAppContainer{transform:none !important;left:0 !important;top:0 !important;}\ndiv:has(.DescartesAppContainer){overflow:unset !important;width:100% !important;height:100% !important;}}";return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=Math.sin,c=Math.floor,h=Math.random,l=Math.round,d=Math.abs,k=String.fromCharCode,g,n,f,m,p,e,u,v,w,q,r=function(a){this.key=(void 0===a?0:a).toString()};r.prototype.getKey=function(b){g=[];for(var f=0;256>f;f++)g[f]=k(this.alfanum(c(d(7.5*(a(1*f-b)+a(1.4*f+b)+a(.6*f-b)+a(2.2*f+b))))));return g.join("")};r.prototype.encode=function(a){n=c(31*h());this.key=this.getKey(n);return k(this.alfanum(n))+this.encripta(a)};r.prototype.decode=function(a){n=
this.numalfa(a.charCodeAt(0));this.key=this.getKey(n);return this.desencripta(a.substring(1))};r.prototype.encripta=function(a){return this.bytesToString(this.encriptaAux(this.stringToBytes(a)))};r.prototype.encriptaAux=function(a){if(null==a||null==this.key)return null;e=Array(3*a.length);for(var b=0,f=a.length;b<f;b++)w=256*c(a[b]+128)+l(255*h())+65536*l(255*h()),q=c((w<<this.shift(b))/256),e[3*b]=this.alfanum(q%32),e[3*b+1]=this.alfanum(q/32%32),e[3*b+2]=this.alfanum(q/1024%32);return e};r.prototype.desencripta=
function(a){return this.bytesToString(this.desencriptaAux(this.stringToBytes(a)))};r.prototype.desencriptaAux=function(a){if(null==a||null==this.key)return null;u=Array(a.length/3);for(var b=0,f=u.length;b<f;b++)q=this.numalfa(a[3*b])+32*this.numalfa(a[3*b+1])+1024*this.numalfa(a[3*b+2]),w=c(256*q>>this.shift(b)),v=c(w/256)%256-128,0>v&&(v+=256),u[b]=v;return u};r.prototype.alfanum=function(a){return(10>a?48:87)+c(a)};r.prototype.numalfa=function(a){return a-(58>a?48:87)};r.prototype.stringToBytes=
function(a){m=[];for(var b=0,f=a.length;b<f;b++)m.push(a.charCodeAt(b));return m};r.prototype.bytesToString=function(a){for(var b=0,f=a.length;b<f;b++)a[b]=k(a[b]);return a.join("")};r.prototype.shift=function(a){f=this.key.charCodeAt(a%this.key.length);m=this.numalfa(f);p=c(m/2%8);0==p&&(p=4);return p};r.prototype.parseByte=function(a){a=parseInt(a);a=0>a?0:a;return 255<a?255:a};b.Krypto=r;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c=function(a,c){var d=this;d.parent=a;var k=a.evaluator;a=k.parser;d.delay=a.parse(c.delay?c.delay:"60");d.loop=c.loop?c.loop:!1;d.auto=void 0==c.auto?!0:c.auto;d.controls=c.controls;b.parseExpr(d,c,a);d.animExec=function(){for(var a=$jscomp.makeIterator(d.doExpr),c=a.next();!c.done;c=a.next())k.eval(c.value);d.parent.update();d.playing&&(0<k.eval(d.whileExpr)||d.loop)?d.timer=b.setTimeout(d.animExec,k.eval(d.delay)):(d.stop(),d.pause=!1,d.parent.update())};
d.playing=!1;d.auto&&d.play()};c.prototype.play=function(){a=this;a.playing?(a.pause=!0,a.stop()):(a.pause||a.reinit(),a.playing=!0,a.pause=!1,a.timer=b.setTimeout(a.animExec,Math.max(10,a.parent.evaluator.eval(a.delay))))};c.prototype.stop=function(){this.playing=!1;b.clearTimeout(this.timer)};c.prototype.reinit=function(){for(var a=$jscomp.makeIterator(this.init),b=a.next();!b.done;b=a.next())this.parent.evaluator.eval(b.value)};b.Animation=c;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=function(a,b){this.parent=a;this.parameter=(void 0===b?"":b).replace(/\\n/g,"\n").replace(/&squot;/g,"'")};a.prototype.execute=function(){alert(this.parameter)};b.Message=a;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=function(a,h){var c=this;this.parent=a;h=b.splitSeparator(((void 0===h?"":h)||"").replace(/&squot;/g,"'"));this.inst=h.map(function(a){return c.parent.evaluator.parser.parse(a,!0)}).filter(function(a){return a})};a.prototype.execute=function(){for(var a=$jscomp.makeIterator(this.inst),b=a.next();!b.done;b=a.next())this.parent.evaluator.eval(b.value)};b.Calculate=a;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=function(a,b){this.parent=a;this.param=(void 0===b?"":b).trim();this.target="_blank"};a.prototype.execute=function(a){a=void 0===a?"":a;var c=this.param,d=c.match(/^(.*)\s*target=(.*)/);d&&(c=d[1].trim(),this.target=d[2].trim());/^\[.*\]$/.test(c)&&(c=this.parent.evaluator.eval(this.parent.evaluator.parser.parse(c.slice(1,-1))));if(d=c.match(/^javascript:(.*)$/)){c=new b.SimpleText(this.parent,d[1].replace(/&squot;/g,"'"));try{(new Function(c.toString()))()}catch(k){}}else/^(http|www)/.test(c)||
(d=window.__dirname||window.location.href,c=d.substring(0,d.lastIndexOf("/")+1)+c),c.startsWith("www.")&&(c="https://"+c),window.open(c,this.target,a)};var c=function(b,c){return a.call(this,b,void 0===c?"":c)||this};$jscomp.inherits(c,a);c.prototype.execute=function(){a.prototype.execute.call(this,"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")};
b.OpenURL=a;b.OpenScene=c;return b}(descartesJS||{});descartesJS=function(b){if(b.loadLib)return b;var a=function(a){this.parent=a};a.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>")};b.Config=a;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=function(a){this.parent=a};a.prototype.execute=function(){this.parent.init()};b.Init=a;return b}(descartesJS||{});descartesJS=function(b){if(b.loadLib)return b;var a=function(a){this.parent=a};a.prototype.execute=function(){this.parent.clear()};b.Clear=a;return b}(descartesJS||{});descartesJS=function(b){if(b.loadLib)return b;var a=function(a){this.parent=a};a.prototype.execute=function(){this.parent.play()};b.Animate=a;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=function(a){this.parent=a};a.prototype.execute=function(){this.parent.reinitAnimation()};b.InitAnimation=a;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=function(a,b){b=void 0===b?"":b;this.parent=a;(a=b.match(/[\w\.\-//]*(\.ogg|\.oga|\.mp3|\.wav)/gi))?this.filename=this.parent.evaluator.parser.parse("'"+a+"'"):(/^\[.*\]$/.test(b)&&(b=b.slice(1,-1)),this.filename=this.parent.evaluator.parser.parse(b))};a.prototype.execute=function(){var a=this.parent.getAudio(this.parent.evaluator.eval(this.filename));a.paused?a.play():(a.pause(),a.currentTime=0)};b.PlayAudio=a;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,l=function(b,c){a=this;a.parent=b;a.evaluator=b.evaluator;a.id=a.expresion=a.init=a.privateVars=a.doExpr=a.whileExpr="";a.evaluate="onlyOnce";Object.assign(a,c)};l.prototype.firstRun=function(){};l.prototype.update=function(){};b.splitInstructions=function(a,c){c=c?b.splitSeparator(c):[""];return c.map(function(d,c){b.DEBUG.lineCount=c;return a.parse(d,!0)}).filter(function(a){return a})};b.parseExpr=function(a,c,g){b.DEBUG.pName="inicio";a.init=
b.splitInstructions(g,c.init);b.DEBUG.pName="local";a.privateVars=b.getPrivateVariables(g,c.local);b.DEBUG.pName="hacer";a.doExpr=b.splitInstructions(g,c.doExpr);b.DEBUG.pName="mientras";a.whileExpr=g.parse(c.whileExpr)};b.getPrivateVariables=function(a,b){c=[];b=b?b.split(/;|,/):[""];b=$jscomp.makeIterator(b);for(var d=b.next();!d.done;d=b.next())(h=a.parse(d.value,!0))&&c.push(h);a=0;for(b=c.length;a<b;a++)c[a]="assign"===c[a].type?c[a].childs[0].value:"identifier"===c[a].type?c[a].value:"";return c};
b.Auxiliary=l;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=function(a,h){h=b.Auxiliary.call(this,a,h)||this;var c=h.evaluator;h.expresionString=h.expresion;h.expresion=c.parser.parse(h.expresionString);h.expresion&&c.setVariable(h.id,h.expresion);h.editable&&(h.registerTextField(),a.editableRegionVisible=!0);return h};$jscomp.inherits(a,b.Auxiliary);a.prototype.registerTextField=function(){var a=this,h=a.evaluator,l=b.newHTML("div"),d=b.newHTML("label");d.appendChild(document.createTextNode("___"+a.id+"=___"));
var k=b.newHTML("input");k.value=a.expresionString;k.disabled=!a.editable;l.appendChild(d);l.appendChild(k);k.onkeydown=function(b){13==b.keyCode&&(a.expresion=parser.parse(this.value),h.setVariable(a.id,a.expresion),a.parent.update())};a.parent.editableRegion.textFields.push({container:l,type:"div"})};b.Variable=a;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=function(a,h){a=b.Auxiliary.call(this,a,h)||this;a.expresion=a.evaluator.parser.parse(a.expresion);a.update();return a};$jscomp.inherits(a,b.Auxiliary);a.prototype.update=function(){this.evaluator.setVariable(this.id,this.evaluator.eval(this.expresion))};b.Constant=a;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,l,d,k=function(d,c){a=c=b.Auxiliary.call(this,d,c)||this;h=d.evaluator.parser;a.size=a.size||h.parse("3");a.expresion=a.expresion.split(";");a.parseFile=h.parse(a.file);a.update();return c};$jscomp.inherits(k,b.Auxiliary);k.prototype.update=function(){var g=this;a=this;var k=a.expresion,f;c=a.evaluator;h=c.parser;a.oldFile=a.file;if(l=c.eval(a.parseFile))a.file=l;a.file&&(d=(f=document.getElementById(a.file))&&"descartes/vectorFile"==f.type?
f.text:b.openFile(a.file),null!=d&&(d=d.replace(/\r/g,"").split("\n"),d=d.filter(function(a){return""!==a.trim()})),null==d||1==d.length&&""==d[0]?(d=[],a.size=h.parse("0")):(k=d,a.size=null),null===a.size&&(a.size=h.parse(k.length+"")));var m,p;k=k.map(function(b,f){(p=h.parse(b,!0))&&"assign"!==p.type&&(m=NaN,","==g.parent.decimal_symbol&&(m=parseFloat(b.replace(",","."))),p=h.parse(a.id+"["+f+"]="+(isNaN(m)?b:m),!0));return p});f=Array(parseInt(Math.abs(c.eval(a.size)))).fill(0);f._size_=f.length;
c.vectors[a.id]=f;c.setVariable(a.id+".long",f._size_);k=$jscomp.makeIterator(k);for(f=k.next();!f.done;f=k.next())c.eval(f.value)};b.Vector=k;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,l,d,k,g,n=/'[^']*'|"[^"]*"|[^,']+/g,f=/'[^']*'|"[^"]*"|[^;']+/g,m=function(m,e){a=e=b.Auxiliary.call(this,m,e)||this;c=m.evaluator;h=c.parser;a.rows=a.rows||h.parse("3");a.columns=a.columns||h.parse("3");if(a.file){var p=document.getElementById(a.file);g=p&&"descartes/matrixFile"==p.type?p.text:b.openFile(a.file);var v,w;null!=g&&(d=0,l=null,g=g.replace(/\r/g,"").split("\n"),a.expresion=[],g.forEach(function(b){b&&(v="."==m.decimal_symbol?b.trim().match(n)||
[]:b.trim().match(f)||[],null==l&&(l=v.length),v.forEach(function(b,f){b=b.trim();w="."==m.decimal_symbol?parseFloat(b):parseFloat(b.replace(",","."));isNaN(w)&&!/^'.*'$/.test(b)?(w=b.replace(/^"(.*)"$/,"$1"),w="'"+w+"'"):(","==m.decimal_symbol&&(b=b.replace(",",".")),w=b);a.expresion.push(h.parse(a.id+"["+d+","+f+"]:="+w))}),d++)}),a.rows=h.parse(l+""),a.columns=h.parse(d+""));if(null==g||1==g.length&&""==g[0])a.expresion=[],a.rows=h.parse("0"),a.columns=h.parse("0")}else a.expresion=b.splitInstructions(h,
a.expresion),l=c.eval(a.rows),d=c.eval(a.columns);k=[];k.type="matrix";p=0;for(var q=d;p<q;p++)k[p]=Array(l).fill(0);c.matrices[a.id]=k;a.update();return e};$jscomp.inherits(m,b.Auxiliary);m.prototype.update=function(){a=this;c=a.evaluator;k=c.matrices[a.id];k.rows=c.eval(a.rows);k.cols=c.eval(a.columns);c.setVariable(a.id+".filas",k.rows);c.setVariable(a.id+".columnas",k.cols);for(var b=$jscomp.makeIterator(a.expresion),f=b.next();!f.done;f=b.next())c.eval(f.value)};b.Matrix=m;return b}(descartesJS||
{});
descartesJS=function(b){if(b.loadLib)return b;var a=function(a,h){var c=b.Auxiliary.call(this,a,h)||this;var d=c.evaluator;a=d.parser;h=c.id.indexOf("(");c.name=c.id.substring(0,h);c.params=c.id.substring(h+1,c.id.indexOf(")"));c.domain=c.range?a.parse(c.range):a.parse("1");c.params=""===c.params?[]:c.params.split(",");c.numParams=c.params.length;c.algorithm||(c.init=c.doExpr=c.whileExpr="");b.parseExpr(c,c,a);c.expresion=a.parse(c.expresion);var k;c.functionExec=function(){var a=arguments,h=0;if(c.numParams<=
arguments.length){for(var f=[],m=$jscomp.makeIterator(c.privateVars),p=m.next();!p.done;p=m.next())p=p.value,f.push(d.getVariable(p)),d.setVariable(p,0);var e=[];c.params.forEach(function(b,f){e.push(d.getVariable(b));d.setVariable(b,a[f])});m=$jscomp.makeIterator(c.init);for(p=m.next();!p.done;p=m.next())d.eval(p.value);k=d.getVariable("_NUM_MAX_ITE_ALG_")||1E5;do{m=$jscomp.makeIterator(c.doExpr);for(p=m.next();!p.done;p=m.next())d.eval(p.value);if(++h>k)return console.warn("se ha excedido el l\u00edmite de "+
k+" repeticiones en la funci\u00f3n \u00ab"+c.name+"\u00bb"),0}while(0<d.eval(c.whileExpr));h=d.eval(c.expresion);b.rangeOK=d.eval(c.domain);c.params.forEach(function(a,b){d.setVariable(a,e[b])});c.privateVars.forEach(function(a,b){d.setVariable(a,f[b])});return h}return 0};d.setFunction(c.name,c.functionExec);return c};$jscomp.inherits(a,b.Auxiliary);b.Function=a;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h=function(a,c){a=b.Auxiliary.call(this,a,c)||this;b.parseExpr(a,a,a.evaluator.parser);return a};$jscomp.inherits(h,b.Auxiliary);h.prototype.algorithmExec=function(){var b=0;c=this.evaluator;a=c.getVariable("_NUM_MAX_ITE_ALG_")||1E5;for(var d=$jscomp.makeIterator(this.init),k=d.next();!k.done;k=d.next())c.eval(k.value);do{d=$jscomp.makeIterator(this.doExpr);for(k=d.next();!k.done;k=d.next())c.eval(k.value);if(++b>a)return console.warn("se ha excedido el l\u00edmite de "+
a+" repeticiones en el algoritmo \u00ab"+this.name+"\u00bb"),0}while(0<c.eval(this.whileExpr))};h.prototype.update=function(){this.algorithmExec();"onlyOnce"===this.evaluate&&(this.update=function(){})};b.Algorithm=h;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=function(a,h){var c=b.Auxiliary.call(this,a,h)||this;a=c.evaluator;delete c.evaluate;c.condition=a.parser.parse(c.condition);c.lastEval=!1;c.action=c.parent.lessonParser.parseAction(c);"onlyOnce"==c.execution&&(c.eventExec=function(){0<c.evaluator.eval(c.condition)&&!c.lastEval&&(c.lastEval=!0,c.action.execute())});"alternate"==c.execution&&(c.eventExec=function(){var a=0<c.evaluator.eval(c.condition);a&&!c.lastEval?(c.action.execute(),c.lastEval=
!0):!a&&c.lastEval&&(c.lastEval=!1)});"always"==c.execution&&(c.eventExec=function(){0<c.evaluator.eval(c.condition)&&c.action.execute()});return c};$jscomp.inherits(a,b.Auxiliary);a.prototype.update=function(){this.eventExec()};b.Event=a;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=function(a,h){var c=b.Auxiliary.call(this,a,h)||this;h=h.file;var d=null;h&&(d=(d=document.getElementById(h))&&"descartes/library"===d.type?d.text:b.openFile(h));if(d)for(d=b.convertHTMLEntities(d).replace(/\r/g,"").split("\n"),h=$jscomp.makeIterator(d),d=h.next();!d.done;d=h.next())d=d.value,""!==d.trim()&&a.lessonParser.parseAuxiliar(d);return c};$jscomp.inherits(a,b.Auxiliary);b.Library=a;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,l,d,k,g,n,f=function(f,c){a=this;a.parent=f;a.evaluator=f.evaluator;var d=a.evaluator.parser;a.spaceID=a.type=a.trace=a.family=a.text="";a.background=a.visible=a.editable=!1;a.drawif=d.parse("1");a.abs_coord=c&&c.type&&"text"===c.type.toLowerCase();a.color=new b.Color("20303a");a.expresion=d.parse("(0,0)");a.family_interval=d.parse("[0,1]");a.family_steps=d.parse("8");a.font="SansSerif,PLAIN,"+(5<=a.parent.version?"18":"12");a.fixed=!0;a.decimals=
d.parse("2");Object.assign(this,c);a.space=a.getSpace();a.canvas=a.background?a.space.backCanvas:a.space.canvas;a.ctx=a.canvas.getContext("2d");a.trace&&(a.traceCtx=a.space.backCtx);a.font_str=a.font;a.font=b.convertFont(a.font);a.fontSize=a.font.match(/([\d\.]+)px/);a.fontSize=a.fontSize?parseFloat(a.fontSize[1]):10;a.font_style=b.getFontStyle(a.font_str.split(",")[1]);if("boolean"===typeof a.bold||"boolean"===typeof a.italics)a.font_style=(a.italics?"Italic ":"")+(a.bold?"Bold ":"");a.font_family||
(a.font_family=a.font_str.split(",")[0]);a.font_family=b.getFontName(a.font_family);"undefined"===typeof a.font_size&&(a.font_size=f.evaluator.parser.parse(a.fontSize.toString()))};f.prototype.getSpace=function(){var a=this;return this.parent.spaces.find(function(b){return b.id===a.spaceID})||this.parent.spaces[0]};f.prototype.getFamilyValues=function(){a=this;c=a.evaluator;var b=$jscomp.makeIterator(c.eval(a.family_interval)[0]);a.fInf=b.next().value;a.fSup=b.next().value;a.fSteps=Math.round(c.eval(a.family_steps));
a.fSep=0<a.fSteps?(a.fSup-a.fInf)/a.fSteps:0};f.prototype.drawFamilyAux=function(b,f,d){a=this;c=a.evaluator;a.getFamilyValues();h=c.getVariable(a.family);if(0<=a.fSteps)for(var e=0,g=a.fSteps;e<=g;e++)c.setVariable(a.family,a.fInf+e*a.fSep),0<c.eval(a.drawif)&&(a.update(),a.drawAux(b,f,d));c.setVariable("_Text_H_",0);c.setVariable(a.family,h)};f.prototype.draw=function(a,b){""!==this.family?this.drawFamilyAux(this.ctx,a,b):0<this.evaluator.eval(this.drawif)&&(this.update(),this.drawAux(this.ctx,
a,b));this.ctx.setLineDash([])};f.prototype.drawTrace=function(a,b){""!=this.family?this.drawFamilyAux(this.traceCtx,a,b):0<this.evaluator.eval(this.drawif)&&(this.update(),this.drawAux(this.traceCtx,a,b))};f.prototype.rotate=function(a,b,f){g=Math.cos(f);n=Math.sin(f);return{x:a*g-b*n,y:a*n+b*g}};f.prototype.dashStyle=function(){k=this.ctx;k.lineCap="butt";switch(this.lineDash){case "dot":k.setLineDash([k.lineWidth,k.lineWidth]);break;case "dash":k.setLineDash([4*k.lineWidth,3*k.lineWidth]);break;
case "dash_dot":k.setLineDash([4*k.lineWidth,2*k.lineWidth,k.lineWidth,2*k.lineWidth]);break;default:k.lineCap="round",k.setLineDash([])}};f.prototype.drawText=function(a,b,f,g,k,h,n,r,y,x,z){a.textNode=b;if("rtfNode"===b.type)a.fillStyle=a.strokeStyle=k.getColor(),a.textBaseline="alphabetic",a.textNode.pos={x:f,y:g},b.update(a,f,g,y,x,n,z,k.getColor());else for("simpleText"===b.type&&(b=b.toString(y,x).split("\\n")),c=this.evaluator,a.fillStyle=k.getColor(),a.font=h,a.textAlign=n,a.textBaseline=
r,d=1.2*this.fontSize||0,k=0,h=b.length;k<h;k++)l=b[k],this.border&&(a.strokeStyle=this.border.getColor(),a.lineWidth=4,a.lineJoin="round",a.miterLimit=2,a.strokeText(l,f,g+d*k)),a.fillText(l,f,g+d*k)};b.Graphic=f;return b}(descartesJS||{});
descartesJS=function(b){function a(a,c,d){d=void 0===d?"":d;for(var f=$jscomp.makeIterator(a),g=f.next();!g.done;g=f.next())if(g=g.value,"identifier"===g.type&&!(b.reservedIds+d).match("-"+g.value+"-")||"R"===g.value||"G"===g.value||"B"===g.value)g.value=c+"."+g.value;return a}function c(b,c,d,f){c=d.tokenize(c.replace(/&squot;/g,"'"));c=a(c,f);return(/^\\expr/.test(b)?"\\expr ":"\\decimals ")+d.flatTokens(c)}if(b.loadLib)return b;var h,l=/[\w\.\-//]*(\.png|\.jpg|\.gif|\.svg|\.webp)/gi,d=function(d,
g,n,f){var m;h=m=b.Graphic.call(this,d,g)||this;h.hasExpresion=h.hasExpresion||!1;h.graphics=[];Object.assign(h,g);h.hasExpresion=void 0!==h.expresion;if(!h.hasExpresion)return m;"'"!==String(h.expresion).charAt(0)&&(h.expresion="'"+h.expresion+"'");h.expresion=h.evaluator.parser.parse(h.expresion);g=h.evaluator.eval(h.expresion);if(g)var p=(p=document.getElementById(g))&&"descartes/macro"===p.type?p.text:b.openFile(g);if(p){g=b.convertHTMLEntities(p).replace(/\r/g,"").split("\n");p=[];d=d.lessonParser;
var e=new b.Tokenizer,k;g=$jscomp.makeIterator(g);for(k=g.next();!k.done;k=g.next())if(k=k.value,k.includes("=")){k=d.split(k);for(var v=$jscomp.makeIterator(k),w=v.next();!w.done;w=v.next())if((w=w.value)&&1<k.length&&("id"===babel[w[0]]||"type"===babel[w[0]])){p.push(k);break}}w=0;for(var q=p.length;w<q;w++){k=(g=p[w]||[],g[0])&&"id"===g[0][0];v=!1;for(var r=0,y=g.length;r<y;r++){var x=g[r][0];var z=g[r][1];var A=x.indexOf(".");-1===A||k?A=babel[x]:(A=babel[x.substring(A+1)],g[r][0]=h.name+"."+
x);"type"===A&&"surface"===babel[z]&&(v=!0);if(n.includes("3D")){if(("font"===A||"font_family"===A||("fill"===A||"color"===A||"backcolor"===A||"arrow"===A)&&"("!==g[r][1].charAt(0)||"file"===A&&g[r][1].match(l)||"id"!==A&&void 0!==babel[g[r][1]])&&"width"!==A&&"height"!==A&&"length"!==A)continue}else if(("font"===A||"font_family"===A||("fill"===A||"color"===A||"border"===A||"arrow"===A)&&"("!==g[r][1].charAt(0)||"file"===A&&g[r][1].match(l)||"id"!==A&&void 0!==babel[g[r][1]])&&"radius"!==A)continue;
if(v&&"expresion"===A){z=g[r][1].split(" ");A="";for(var C=0,H=z.length;C<H;C++){for(var D=z[C].replace(/&squot;/g,"'").split(";"),F=0,G=D.length;F<G;F++)x=e.tokenize(D[F].replace(/\\n/g,";")),x=a(x,h.name,n.includes("3D")?"-x-y-z-u-v-":""),D[F]=e.flatTokens(x);A+=D.join(";")+" "}g[r][1]=A}else{if("text"===A)if(/\{\\rtf1/.test(z))z=z.replace(/\\expr\s*([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,function(a,b){return c(a,b,e,h.name)}).replace(/\\decimals\s*([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,
function(a,b){return c(a,b,e,h.name)});else{z=d.parseText(z).txtEleMacros;A=0;for(C=z.length;A<C;A++)x=e.tokenize(z[A].replace(/&squot;/g,"'")),x=a(x,h.name),z[A]=e.flatTokens(x).replace(/&squot;/g,"'").replace(/'\+\(/g,"[").replace(/\)\+'/g,"]"),z[A]=z[A].slice(1,-1);z=z.join("")}else{z=z.replace(/&squot;/g,"'").split(";");A=0;for(C=z.length;A<C;A++)x=e.tokenize(z[A].replace(/\\n/g,";")),x=a(x,h.name,n.includes("3D")?"-Euler-":""),z[A]=e.flatTokens(x);z=z.join(";")}g[r][1]=z}}}v=0;for(w=p.length;v<
w;v++)if(p[v][0]){g="";k=!1;q=0;for(r=p[v].length;q<r;q++)"type"===babel[p[v][q][0]]&&f.includes("-"+babel[p[v][q][1]]+"-")&&(k=!0),g+=p[v][q][0]+"='"+p[v][q][1]+"' ";p[v]=g+(k?" space='"+h.spaceID+"'":"");k?h.graphics.push(d[n](p[v],h.abs_coord,h.background,h.inirot)):d.parseAuxiliar(p[v])}}return m};$jscomp.inherits(d,b.Graphic);b.BaseMacro=d;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,l,d,k,g,n=function(b,c){this.text=c=c.replace("&#x2013","\u2013").replace(/&squot;/g,"'");this.txtEle=[];this.txtEleMacros=[];this.parent=b;this.evaluator=b.evaluator;this.type="simpleText";a="'";l=h=0;for(d=-1;h<c.length;)k=c.charAt(h),g=c.charAt(h-1),"["===k&&"\\"===g?(this.txtEle.push(c.substring(l,h-1)+"["),this.txtEleMacros.push("'"+c.substring(l,h-1)+"['"),l=h+1):"]"===k&&"\\"===g?(this.txtEle.push(c.substring(l,h-1)+"]"),this.txtEleMacros.push("'"+
c.substring(l,h-1)+"]'"),l=h+1):"["===k&&-1===d?(this.txtEle.push(c.substring(l,h)),this.txtEleMacros.push("'"+c.substring(l,h)+"'"),l=h,d++):"["===k?d++:"]"===k&&0===d?(this.txtEle.push(this.evaluator.parser.parse(c.substring(l,h+1))),this.txtEleMacros.push("["+c.substring(l,h+1)+"]"),l=h+1,d--):("]"==c.charAt(h)&&(d=0>d?d:d-1),a+=c.charAt(h)),h++;this.txtEle.push(c.substring(l,h));this.txtEleMacros.push("'"+c.substring(l,h)+"'")};n.prototype.toString=function(f,d){a="";for(var g=$jscomp.makeIterator(this.txtEle),
e=g.next();!e.done;e=g.next())e=e.value,"string"===typeof e?a+=e:(c=this.evaluator.eval(e)[0][0],""!==c&&("string"===typeof c?a+=c:Infinity==c?a+="Infinity":-Infinity==c?a+="-Infinity":isNaN(c)||"NaN"==c?a+="NaN":(c=parseFloat(c),c=d?c.toFixed(f):b.removeNeedlessDecimals(c.toFixed(f)),a+=c.toString().replace(".",this.parent.decimal_symbol))));return a};b.SimpleText=n;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,l,d,k,g,n,f,m,p,e,u,v,w,q,r,y,x,z,A,C,H,D,F,G,B,I,O,Q,K,P,N,E,L=function(a,c){c=b.Graphic.call(this,a,c)||this;c.width=c.width||a.evaluator.parser.parse("1");c.fillP=c.fillP||"";c.fillM=c.fillM||"";c.parseExpression();c.visible=2===c.parent.version&&void 0==c.visible?!0:c.visible;c.visible&&c.registerTextField();e=new b.R2;u=new b.R2;v=new b.R2;w=new b.R2;r=new b.R2;c.cInd=0;return c};$jscomp.inherits(L,b.Graphic);L.prototype.parseExpression=
function(){if("compOperator"===this.expresion.type){var a=this.expresion.childs[0],c=this.expresion.childs[1];"identifier"!=a.type||"y"!=a.value||c.contains("y")?"identifier"!=c.type||"y"!=c.value||a.contains("y")?"identifier"!=a.type||"x"!=a.value||c.contains("x")?"identifier"!=c.type||"x"!=c.value||a.contains("x")||(this.funExpr=c,this.of_y=!0,this.drawAux=this.drawAuxFun):(this.funExpr=c,this.of_y=!0,this.drawAux=this.drawAuxFun):(this.funExpr=a,this.of_y=!1,this.drawAux=this.drawAuxFun):(this.funExpr=
c,this.of_y=!1,this.drawAux=this.drawAuxFun)}this.newt=new b.R2Newton(this.evaluator,this.expresion)};L.prototype.update=function(){};L.prototype.draw=function(){""!=this.family?this.drawFamilyAux(this.ctx,this.fill,this.color):(this.update(),this.drawAux(this.ctx,this.fill,this.color))};L.prototype.drawFamilyAux=function(a,b,f){h=this.evaluator;this.getFamilyValues();c=h.getVariable(this.family);if(0<=this.fSteps)for(var d=0,g=this.fSteps;d<=g;d++)h.setVariable(this.family,this.fInf+d*this.fSep),
this.update(),this.drawAux(a,b,f);h.setVariable(this.family,c)};L.prototype.drawTrace=function(){b.Graphic.prototype.drawTrace.call(this,this.fill,this.trace)};L.prototype.drawAux=function(c,M,L){if(!(0>=this.evaluator.eval(this.drawif))){this.cInd=0;h=this.evaluator;l=this.space;d=h.eval(this.width);c.strokeStyle=this.color.getColor();c.lineWidth=d;k=h.getVariable("x");g=h.getVariable("y");n=l.w+24;f=l.h+24;m=n/9;3>m&&(m=3);p=f/7;3>p&&(p=3);0==this.cInd?(a=[],this.cInd++):this.cInd=(this.cInd+1)%
1E7;e.set(0,0);u.set(0,0);v.set(0,0);N=.25;E=8;this.abs_coord||(N/=l.scale,E/=l.scale);c.beginPath();for(B=parseInt(p/2);B<f;B+=p)for(G=parseInt(m/2);G<n;G+=m){if(this.abs_coord){r.set(G,B);q=this.newt.findZero(r,N);if(null==q)continue;h.setVariable("x",q.x);h.setVariable("y",q.y);w.set(q.x,q.y)}else{r.set(l.getRelativeX(G),l.getRelativeY(B));q=this.newt.findZero(r,N);if(null==q)continue;h.setVariable("x",q.x);h.setVariable("y",q.y);w.set(l.getAbsoluteX(q.x),l.getAbsoluteY(q.y))}y=w.ix();x=w.iy();
if(-12<=y&&y<n+24&&-12<=x&&x<f+24){if(a[y+12+(x+12)*l.w]===this.cInd)continue;a[y+12+(x+12)*l.w]=this.cInd}b.rangeOK&&(c.moveTo(y,x),c.lineTo(y,x));e.x=q.x;e.y=q.y;u.x=q.x;u.y=q.y;z=this.newt.getUnitNormal();if(0!=z.x||0!=z.y)for(z.rotL90(),v.x=z.x,v.y=z.y,C=A=0,H=!1;2>C;)if(H&&(v.x=-z.x,v.y=-z.y,q.x=e.x,q.y=e.y,u.x=q.x,u.y=q.y,this.abs_coord?w.set(q.x,q.y):w.set(l.getAbsoluteX(q.x),l.getAbsoluteY(q.y)),y=w.ix(),x=w.iy(),H=!1,A=0),q.x+=E*v.x,q.y+=E*v.y,q=this.newt.findZero(q,N),null!=q){h.setVariable("x",
q.x);h.setVariable("y",q.y);v.x=q.x-u.x;v.y=q.y-u.y;v.normalize();if(0==v.x&&0==v.y)break;u.x=q.x;u.y=q.y;this.abs_coord?w.set(q.x,q.y):w.set(l.getAbsoluteX(q.x),l.getAbsoluteY(q.y));D=parseInt(w.ix());F=parseInt(w.iy());if(D!=y||F!=x)if(I=y,O=x,y=D,x=F,-12<=y&&y<n+24&&-12<=x&&x<f+24){A=0;Q=a[y+12+(x+12)*l.w];a[y+12+(x+12)*l.w]=this.cInd;for(M=1;8>M;M++)K=I+Math.round((y-I)*M/8),P=O+Math.round((x-O)*M/8),0<=K&&K<n&&0<=P&&P<f&&(a[K+12+(P+12)*l.w]=this.cInd);b.rangeOK&&(c.moveTo(I,O),c.lineTo(y,x));
if(Q===this.cInd)break}else H=!0,C++;else 4<++A&&(H=!0,C++)}}c.stroke();h.setVariable("x",k);h.setVariable("y",g)}};L.prototype.X=function(a,b,c){c||(b=this.space.w/2+this.space.Ox+this.space.scale*b);b<-a&&(b=-a);b>this.space.w+a&&(b=this.space.w+a);return b};L.prototype.Y=function(a,b,c){c||(b=this.space.h/2+this.space.Oy-this.space.scale*b);b<-a&&(b=-a);b>this.space.h+a&&(b=this.space.h+a);return b};L.prototype.XX=function(a,b,c){return Math.round(this.X(a,b,c))};L.prototype.YY=function(a,b,c){return Math.round(this.Y(a,
b,c))};L.prototype.extrapolate=function(a,c,f,d,g,e){h=this.evaluator;for(var m=h.getVariable(c),p=e/2,k=0,l,q,n,A,u,v;1E-15<Math.abs(p);){l=h.getVariable(c);q=h.getVariable(c)+p;h.setVariable(c,q);n=!0;try{A=g,g=h.eval(this.funExpr),h.setVariable(f,g),0<h.eval(a)?(u=new b.R2(Math.min(A,g),Math.max(A,g)),v=0,v=0<e?this.Singularity(Math.abs(p),c,d,l,A,q,g,u):this.Singularity(Math.abs(p),c,d,q,g,l,A,u),0<v&&(n=!1)):n=!1}catch(da){n=!1}n?k+=p:h.setVariable(c,l);p/=2}h.setVariable(c,m);return new b.R2(k/
Math.abs(e),g)};L.prototype.extrapolateOnSingularity=function(a,c,f,d,g,e){h=this.evaluator;d=h.getVariable(c);for(var m=e/2,p=0,k=g,l;1E-15<Math.abs(m);){h.setVariable(c,h.getVariable(c)+m);l=!0;if(0<h.eval(a))try{k=h.eval(this.funExpr),h.setVariable(f,k),0>=h.eval(a)&&(l=!1)}catch(X){l=!1}else l=!1;l?p+=m:h.setVariable(c,h.getVariable(c)-m);m/=2}if(0==p)for(m=e/2,p=e,k=g;1E-15<Math.abs(m);){h.setVariable(c,h.getVariable(c)-m);f=!0;if(0<h.eval(a))try{k=h.eval(this.funExpr)}catch(X){f=!1}else f=!1;
f?p+=-m:h.setVariable(c,h.getVariable(c)+m);m/=2}h.setVariable(c,d);return new b.R2(p/Math.abs(e),k)};L.prototype.Singularity=function(a,b,c,f,d,g,e,m){h=this.evaluator;if(isNaN(e)||isNaN(d)||isNaN(m.y)||isNaN(m.x)||f>=g)return 2;var p=h.getVariable(b),k=0;try{if(1E-15>Math.abs(g-f)||1E-12>Math.abs(g-f)&&Math.abs(e-d)>Math.abs(a))return h.setVariable(b,p),1;var l=(f+g)/2;h.setVariable(b,l);var n=NaN;try{n=h.eval(this.funExpr)}catch(ba){return 2}if(isNaN(n))return 5;if(Math.abs(e-d)>a){h.setVariable(b,
f-1E-12);var q=h.eval(this.funExpr);q=(d-q)/1E-12;h.setVariable(b,g+1E-12);var A=(h.eval(this.funExpr)-e)/1E-12;if((10>Math.abs(A)||10>Math.abs(q))&&(0<=A&&0<=q||0>=A&&0>=q)&&4*Math.abs(A)<Math.abs((e-d)/(g-f)))return h.setVariable(b,p),2}if(isNaN(m.x)||isNaN(m.y)||isNaN(n))return 2;if(!(m.x<=n&&n<=m.y)){h.setVariable(b,l);m.x=Math.min(d,n);m.y=Math.max(d,n);var u=this.Singularity(a/2,b,c,f,d,l,n,m);h.setVariable(b,g);m.x=Math.min(e,n);m.y=Math.max(e,n);var v=this.Singularity(a/2,b,c,l,n,g,e,m);k=
Math.max(u,v)}}catch(ba){k=1}h.setVariable(b,p);return k};L.prototype.drawAuxFun=function(a,c,f){h=this.evaluator;k=h.getVariable("x");g=h.getVariable("y");b.rangeOK=1;c="x";var d="y";this.of_y&&(c="y",d="x");var e=this.drawif,m=h.eval(this.width),p=!1,l=new b.R2(this.space.w/2+this.space.Ox,this.space.h/2+this.space.Oy),n=this.of_y?l.ix():l.iy(),q=0,A=0,u=0,v=0,w=1/this.space.scale;l=w*(this.of_y?-this.space.h+l.y:-l.x);var r=0;this.abs_coord&&(l=0,w=1);for(var C,x,F,y,z,B,G,N,D,P=this.of_y?this.space.h+
2:this.space.w+2;u<=P;){C=!0;x=0;h.setVariable(c,l);try{F=h.eval(this.funExpr),isNaN(F)||(h.setVariable(d,F),0<h.eval(this.drawif)&&b.rangeOK?(p?(y=Math.min(r,F),z=Math.max(r,F),B=new b.R2(y,z),x=this.Singularity(w,c,0,l-w,r,l,F,B),0===x?(r<=F?(r=B.x,F=B.y):(F=B.x,r=B.y),G=parseInt(this.of_y?this.XX(m,r,this.abs_coord):this.YY(m,r,this.abs_coord)),q=this.abs_coord?Math.round(F):parseInt(this.of_y?this.XX(m,F,this.abs_coord):this.YY(m,F,this.abs_coord)),this.fillM&&q>n&&(a.lineWidth=1,a.strokeStyle=
this.fillM.getColor(),a.beginPath(),this.of_y?(a.moveTo(n+1,this.space.h-u+.5),a.lineTo(q,this.space.h-u+.5)):(a.moveTo(u+.5,n+1),a.lineTo(u+.5,q)),a.stroke()),this.fillP&&q<n&&(a.lineWidth=1,a.strokeStyle=this.fillP.getColor(),a.beginPath(),this.of_y?(a.moveTo(n-1,this.space.h-u+.5),a.lineTo(q,this.space.h-u+.5)):(a.moveTo(u+.5,n-1),a.lineTo(u+.5,q)),a.stroke()),a.lineWidth=m,a.strokeStyle=f.getColor(),a.beginPath(),this.of_y?(a.moveTo(G+.5,this.space.h-v),a.lineTo(q+.5,this.space.h-u)):(a.moveTo(v+
.5,G),a.lineTo(u+.5,q)),a.stroke()):1===x?(h.setVariable(c,l-w),N=this.extrapolate(e,c,d,0,r,w),q=this.of_y?this.XX(m,N.y,this.abs_coord):this.YY(m,N.y,this.abs_coord),a.lineWidth=m,a.strokeStyle=f.getColor(),a.beginPath(),this.of_y?(a.moveTo(A+.5,this.space.h-v),a.lineTo(q+.5,this.space.h-v+Math.round(N.x))):(a.moveTo(v+.5,A),a.lineTo(v+Math.round(N.x)+.5,q)),h.setVariable(c,l),D=this.extrapolate(e,c,d,0,F,-w),A=this.of_y?this.XX(m,D.y,this.abs_coord):this.YY(m,D.y,this.abs_coord),q=this.of_y?this.XX(m,
F,this.abs_coord):this.YY(m,F,this.abs_coord),a.lineWidth=m,a.strokeStyle=f.getColor(),a.beginPath(),this.of_y?(a.moveTo(A+.5,this.space.h-u),a.lineTo(q+.5,this.space.h-u)):(a.moveTo(u+.5,A),a.lineTo(u+.5,q)),a.stroke()):2===x&&(q=this.of_y?this.XX(m,F,this.abs_coord):this.YY(m,F,this.abs_coord),a.lineWidth=m,a.strokeStyle=f.getColor(),a.beginPath(),this.of_y?(a.moveTo(A+.5,this.space.h-u),a.lineTo(q+.5,this.space.h-u)):(a.moveTo(u+.5,A),a.lineTo(u+.5,q)))):(D=this.extrapolateOnSingularity(e,c,d,
0,F,-w),A=this.of_y?this.XX(m,D.y,this.abs_coord):this.YY(m,D.y,this.abs_coord),q=this.of_y?this.XX(m,F,this.abs_coord):this.YY(m,F,this.abs_coord),a.lineWidth=m,a.strokeStyle=f.getColor(),a.beginPath(),this.of_y?(a.moveTo(A,this.space.h-(u+Math.round(D.x))+.5),a.lineTo(q,this.space.h-u+.5)):(a.moveTo(u+Math.round(D.x),A),a.lineTo(u,q)),a.stroke()),r=F):C=!1)}catch(ea){C=!1}p&&!C&&(h.setVariable(c,l-w),h.setVariable(d,r),N=this.extrapolate(e,c,d,0,r,w),q=parseInt(this.of_y?this.XX(m,N.y,this.abs_coord):
this.YY(m,N.y,this.abs_coord)),0<h.eval(this.drawif)&&b.rangeOK&&(a.lineWidth=m,a.strokeStyle=f.getColor(),a.beginPath(),this.of_y?(a.moveTo(A,this.space.h-(v+Math.round(N.x))+.5),a.lineTo(q,this.space.h-(v+Math.round(N.x))+.5)):(a.moveTo(v+Math.round(N.x)+.5,A),a.lineTo(v+Math.round(N.x)+.5,q)),a.stroke()),h.setVariable(c,l));p=C;l+=w;A=q;v=u++}h.setVariable("x",k);h.setVariable("y",g)};L.prototype.registerTextField=function(){var a=this,c=b.newHTML("input");c.value=a.expresionString;c.disabled=
!a.editable;c.onkeydown=function(b){13==b.keyCode&&(a.expresion=a.evaluator.parser.parse(this.value),a.parseExpression(),a.parent.update())};a.parent.editableRegion.textFields.push(c)};b.Equation=L;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=Math.round,c,h,l,d,k,g,n=function(a,c){c=b.Graphic.call(this,a,c)||this;c.param=c.param||"t";c.parameter_interval=c.parameter_interval||a.evaluator.parser.parse("[0,1]");c.parameter_steps=c.parameter_steps||a.evaluator.parser.parse("8");c.width=c.width||a.evaluator.parser.parse("1");c.fill=c.fill||"";c.visible=2===c.parent.version&&void 0==c.visible?!0:c.visible;c.visible&&c.registerTextField();return c};$jscomp.inherits(n,b.Graphic);n.prototype.update=
function(){c=this.evaluator;var a=$jscomp.makeIterator(c.eval(this.parameter_interval)[0]);this.paraInf=a.next().value;this.paraSup=a.next().value;this.pSteps=c.eval(this.parameter_steps);this.paraSep=0<this.pSteps?Math.abs(this.paraSup-this.paraInf)/this.pSteps:0};n.prototype.draw=function(){b.Graphic.prototype.draw.call(this,this.fill,this.color)};n.prototype.drawTrace=function(){b.Graphic.prototype.drawTrace.call(this,this.fill,this.trace)};n.prototype.drawAux=function(f,m,p){c=this.evaluator;
h=this.space;f.lineWidth=Math.max(1E-6,a(c.eval(this.width)));f.lineCap=f.lineJoin="round";f.strokeStyle=p.getColor();l=c.getVariable(this.param);f.beginPath();c.setVariable(this.param,this.paraInf);d=c.eval(this.expresion)[0];this.X=a(this.abs_coord?d[0]:h.getAbsoluteX(d[0]));this.Y=a(this.abs_coord?d[1]:h.getAbsoluteY(d[1]));this.rotateExp&&(k=b.degToRad(c.eval(this.rotateExp)),g=this.rotate(d[0],d[1],k),this.X=a(this.abs_coord?g.x:h.getAbsoluteX(g.x)),this.Y=a(this.abs_coord?g.y:h.getAbsoluteY(g.y)));
f.moveTo(this.X+.5,this.Y+.5);for(p=1;p<=this.pSteps;p++)c.setVariable(this.param,this.paraInf+p*this.paraSep),d=c.eval(this.expresion)[0],this.rotateExp&&(g=this.rotate(d[0],d[1],k),d[0]=g.x,d[1]=g.y),this.X=a(this.abs_coord?d[0]:h.getAbsoluteX(d[0])),this.Y=a(this.abs_coord?d[1]:h.getAbsoluteY(d[1])),!isNaN(this.X)&&!isNaN(this.Y)&&-1E6<this.X&&1E6>this.X&&-1E6<this.Y&&1E6>this.Y&&f.lineTo(this.X+.5,this.Y+.5);this.fill&&(f.fillStyle=m.getColor(),f.fill("evenodd"));this.dashStyle();f.stroke();f.setLineDash([]);
c.setVariable(this.param,l)};n.prototype.registerTextField=function(){var a=this,c=b.newHTML("input");c.value=a.expresionString;c.disabled=!a.editable;c.onkeydown=function(b){13==b.keyCode&&(a.expresion=a.evaluator.parser.parse(this.value),a.parent.update())};a.parent.editableRegion.textFields.push(c);console.log(a.parent.editableRegion.textFields)};b.Curve=n;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=2*Math.PI,c=Math.round,h,l,d,k,g,n,f,m,p,e=function(a,c){c=b.Graphic.call(this,a,c)||this;c.size=c.size||a.evaluator.parser.parse("2");c.range=c.range||a.evaluator.parser.parse("[1, 100]");c.visible=2===c.parent.version&&void 0==c.visible?!0:c.visible;c.visible&&c.registerTextField();return c};$jscomp.inherits(e,b.Graphic);e.prototype.update=function(){h=this.evaluator;var a=$jscomp.makeIterator(h.eval(this.expresion)[0]);this.X=a.next().value;this.Y=
a.next().value;this.rotateExp&&(d=this.rotate(this.X,this.Y,b.degToRad(h.eval(this.rotateExp))),this.X=d.x,this.Y=d.y);n=h.eval(this.range)[0];this.rangeInf=n[0];this.rangeMax=n[1]};e.prototype.draw=function(){b.Graphic.prototype.draw.call(this,this.color,this.color)};e.prototype.drawTrace=function(){b.Graphic.prototype.drawTrace.call(this,this.trace,this.trace)};e.prototype.drawAux=function(d,e){h=this.evaluator;l=this.space;m=f=Math.ceil(h.eval(this.size)-.4);d.fillStyle=e.getColor();d.beginPath();
this.rangeInf>this.rangeMax&&(p=this.rangeInf,this.rangeInf=this.rangeMax,this.rangeMax=p);e=h.getVariable("n");for(var n=this.rangeInf,q=this.rangeMax;n<=q;n++){h.setVariable("n",n);var u=$jscomp.makeIterator(h.eval(this.expresion)[0]);this.X=u.next().value;this.Y=u.next().value;k=c(this.abs_coord?this.X:l.getAbsoluteX(this.X));g=c(this.abs_coord?this.Y:l.getAbsoluteY(this.Y));d.beginPath();d.arc(k,g,f,0,a);d.fill()}d.fill();this.text!=[""]&&(this.fontSize=Math.max(5,h.eval(this.font_size)),this.font=
this.font_style+" "+this.fontSize+"px "+this.font_family,b.Graphic.prototype.drawText.call(this,d,this.text,k+m,g-m,this.color,this.font,"start","alphabetic",h.eval(this.decimals),this.fixed,!0));h.setVariable("n",e)};e.prototype.registerTextField=function(){var a=this,c=b.newHTML("input");c.value=a.expresionString;c.disabled=!a.editable;c.onkeydown=function(b){13==b.keyCode&&(a.expresion=a.evaluator.parser.parse(this.value),a.parent.update())};a.parent.editableRegion.textFields.push(c)};b.Sequence=
e;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=2*Math.PI,c=Math.round,h,l,d,k,g,n,f=function(a,c){c=b.Graphic.call(this,a,c)||this;c.size=c.size||a.evaluator.parser.parse("2");c.text=new b.TextObject(c,c.text);return c};$jscomp.inherits(f,b.Graphic);f.prototype.update=function(){h=this.evaluator;var a=$jscomp.makeIterator(h.eval(this.expresion)[0]);this.X=a.next().value;this.Y=a.next().value;this.rotateExp&&(d=this.rotate(this.X,this.Y,b.degToRad(h.eval(this.rotateExp))),this.X=d.x,this.Y=d.y)};
f.prototype.draw=function(){b.Graphic.prototype.draw.call(this,this.color,this.color)};f.prototype.drawTrace=function(){b.Graphic.prototype.drawTrace.call(this,this.trace,this.trace)};f.prototype.drawAux=function(b,f){l=this.space;b.fillStyle=f.getColor();k=c(this.abs_coord?this.X:l.getAbsoluteX(this.X));g=c(this.abs_coord?this.Y:l.getAbsoluteY(this.Y));n=c(this.evaluator.eval(this.size));0<n&&(b.beginPath(),b.arc(k,g,n,0,a),b.fill());this.text.hasContent&&this.text.draw(b,f,k,g)};b.Point=f;return b}(descartesJS||
{});
descartesJS=function(b){if(b.loadLib)return b;var a=Math.round,c=2*Math.PI,h,l,d,k,g,n,f,m,p,e,u,v=function(a,c){c=b.Graphic.call(this,a,c)||this;c.width=c.width||a.evaluator.parser.parse("1");c.size=c.size||a.evaluator.parser.parse("2");c.text=new b.TextObject(c,c.text);return c};$jscomp.inherits(v,b.Graphic);v.prototype.update=function(){h=this.evaluator;d=h.eval(this.expresion);this.points=[];for(var a=0,c=d.length;a<c;a++)this.points[a]={x:d[a][0],y:d[a][1]};if(this.rotateExp)for(k=b.degToRad(h.eval(this.rotateExp)),a=
0,c=this.points.length;a<c;a++)this.points[a]=this.rotate(this.points[a].x,this.points[a].y,k)};v.prototype.draw=function(){b.Graphic.prototype.draw.call(this,this.color,this.color)};v.prototype.drawTrace=function(){b.Graphic.prototype.drawTrace.call(this,this.trace,this.trace)};v.prototype.drawAux=function(b,d,k){h=this.evaluator;l=this.space;u=a(h.eval(this.width));b.lineWidth=Math.max(1E-6,u);g=h.eval(this.size);b.fillStyle=d.getColor();b.strokeStyle=k.getColor();b.lineCap="round";n=0==b.lineWidth%
2?0:.5;this.abs_coord?(f=a(this.points[0].x),m=a(this.points[0].y),p=a(this.points[1].x),e=a(this.points[1].y)):(f=a(l.getAbsoluteX(this.points[0].x)),m=a(l.getAbsoluteY(this.points[0].y)),p=a(l.getAbsoluteX(this.points[1].x)),e=a(l.getAbsoluteY(this.points[1].y)));b.beginPath();b.moveTo(f+n,m+n);b.lineTo(p+n,e+n);this.dashStyle();b.stroke();0<g&&(b.beginPath(),b.arc(f,m,g,0,c),b.arc(p,e,g,0,c),b.fill());b.setLineDash([]);this.text.hasContent&&this.text.draw(b,k,parseInt((f+p)/2)-3,parseInt((m+e)/
2)+3)};b.Segment=v;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=Math.floor,c=Math.round,h,l,d,k,g,n,f,m,p,e,u,v,w,q=function(a,c){c=b.Graphic.call(this,a,c)||this;c.width=c.width||a.evaluator.parser.parse("5");c.size=c.size||a.evaluator.parser.parse("2");c.spear=c.spear||a.evaluator.parser.parse("8");c.arrow=c.arrow||new b.Color("ee0022");c.text=new b.TextObject(c,c.text);c.V=new b.Vector2D(0,0);c.points=[];return c};$jscomp.inherits(q,b.Graphic);q.prototype.update=function(){h=this.evaluator;l=h.eval(this.expresion);
for(var a=0,c=l.length;a<c;a++)this.points[a]={x:l[a][0],y:l[a][1]};if(this.rotateExp)for(d=b.degToRad(h.eval(this.rotateExp)),a=0,c=this.points.length;a<c;a++)this.points[a]=this.rotate(this.points[a].x,this.points[a].y,d)};q.prototype.draw=function(){b.Graphic.prototype.draw.call(this,this.arrow,this.color)};q.prototype.drawTrace=function(){b.Graphic.prototype.drawTrace.call(this,this.arrow,this.trace)};q.prototype.drawAux=function(b,d,q){h=this.evaluator;k=this.space;l=this.points;g=Math.max(0,
h.eval(this.width));n=Math.ceil(g/2);f=k.scale;this.V.x=l[1].x-l[0].x;this.V.y=l[1].y-l[0].y;m=this.V.vLength();this.angle=Math.atan2(this.V.y,this.V.x);b.fillStyle=d.getColor();b.strokeStyle=q.getColor();b.lineWidth=2;this.abs_coord?(p=c(l[0].x),e=c(l[0].y),u=c(l[1].x),v=c(l[1].y)):(p=c(k.getAbsoluteX(l[0].x)),e=c(k.getAbsoluteY(l[0].y)),u=c(k.getAbsoluteX(l[1].x)),v=c(k.getAbsoluteY(l[1].y)));w=Math.max(0,h.eval(this.spear));b.save();b.translate(p,e);this.abs_coord?b.rotate(this.angle):(m*=f,b.rotate(-this.angle));
b.beginPath();b.moveTo(-n,a(-n));b.lineTo(a(m-w-g),a(-n));b.lineTo(a(m-2*w),a(-w-n));b.lineTo(a(m),0);b.lineTo(a(m-2*w),a(w+n));b.lineTo(a(m-w-g),a(n));b.lineTo(-n,a(n));b.closePath();b.stroke();b.fill();b.restore();this.text.hasContent&&this.text.draw(b,q,parseInt((p+u)/2)-3,parseInt((e+v)/2)+3)};b.Arrow=q;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=Math.round,c,h,l,d,k,g,n,f,m=function(a,c){c=b.Graphic.call(this,a,c)||this;c.width=c.width||a.evaluator.parser.parse("1");c.fill=c.fill||"";c.points=[];return c};$jscomp.inherits(m,b.Graphic);m.prototype.update=function(){c=this.evaluator;l=c.eval(this.expresion);for(var a=0,f=l.length;a<f;a++)this.points[a]={x:l[a][0],y:l[a][1]};if(this.rotateExp)for(d=b.degToRad(c.eval(this.rotateExp)),a=0,f=this.points.length;a<f;a++)this.points[a]=this.rotate(this.points[a].x,
this.points[a].y,d)};m.prototype.draw=function(){b.Graphic.prototype.draw.call(this,this.fill,this.color)};m.prototype.drawTrace=function(){b.Graphic.prototype.drawTrace.call(this,this.trace,this.trace)};m.prototype.drawAux=function(b,d,m){c=this.evaluator;h=this.space;k=a(c.eval(this.width));b.lineWidth=Math.max(1E-6,k);b.strokeStyle=m.getColor();b.lineCap=b.lineJoin="round";g=0<k?.5:0;n=a(this.abs_coord?this.points[0].x:h.getAbsoluteX(this.points[0].x));f=a(this.abs_coord?this.points[0].y:h.getAbsoluteY(this.points[0].y));
b.beginPath();b.moveTo(n+g,f+g);m=1;for(var e=this.points.length;m<e;m++)n=a(this.abs_coord?this.points[m].x:h.getAbsoluteX(this.points[m].x)),f=a(this.abs_coord?this.points[m].y:h.getAbsoluteY(this.points[m].y)),b.lineTo(n+g,f+g);this.fill&&(b.fillStyle=d.getColor(),b.fill());this.dashStyle();b.stroke();b.setLineDash([])};b.Polygon=m;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=Math.round,c=Math.min,h=Math.max,l=Math.abs,d,k,g,n,f,m,p,e,u,v,w,q,r=function(a,c){c=b.Graphic.call(this,a,c)||this;c.width=c.width||a.evaluator.parser.parse("1");c.fill=c.fill||"";c.border_radius=c.border_radius||a.evaluator.parser.parse("0");return c};$jscomp.inherits(r,b.Graphic);r.prototype.update=function(){d=this.evaluator;m=d.eval(this.expresion);this.X=m[0][0];this.Y=m[0][1];this.w=150;this.h=100;this.rotateExp&&(g=this.rotate(m[0][0],m[0][1],
b.degToRad(d.eval(this.rotateExp))),this.X=g.x,this.Y=g.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=h(0,this.w);this.h=h(0,this.h)};r.prototype.draw=function(){b.Graphic.prototype.draw.call(this,this.fill,this.color)};r.prototype.drawTrace=function(){b.Graphic.prototype.drawTrace.call(this,this.fill,this.trace,"trace")};r.prototype.drawAux=function(b,g,m,A){d=this.evaluator;k=this.space;n=a(d.eval(this.width));b.lineWidth=h(1E-6,
n);b.strokeStyle=m.getColor();b.lineCap="round";b.lineJoin="miter";f=0<n?.5:0;p=a(this.abs_coord?this.X:k.getAbsoluteX(this.X))+f;e=a(this.abs_coord?this.Y:k.getAbsoluteY(this.Y))+f;u=this.abs_coord?this.w:this.w*k.scale;v=this.abs_coord?this.h:-this.h*k.scale;w=c(h(0,d.eval(this.border_radius)),.5*l(u),.5*l(v));q=this.abs_coord?1:-1;b.beginPath();0==w?(b.moveTo(p,e),b.lineTo(p+u,e),b.lineTo(p+u,e+v),b.lineTo(p,e+v)):(b.moveTo(p+w,e),b.lineTo(p+u-w,e),b.arcTo(p+u,e,p+u,e+q*w,w),b.lineTo(p+u,e+v-q*
w),b.arcTo(p+u,e+v,p+u-w,e+v,w),b.lineTo(p+w,e+v),b.arcTo(p,e+v,p,e+v-q*w,w),b.lineTo(p,e+q*w),b.arcTo(p,e,p+w,e,w));b.closePath();this.fill&&(b.fillStyle=g.getColor(),b.fill());this.dashStyle();b.stroke();b.setLineDash([])};b.Rectangle=r;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=Math.PI,c=a/2,h=2*a,l=Math.round,d=Math.min,k=Math.max,g=Math.acos,n=Math.sqrt,f,m,p,e,u,v,w,q,r,y,x,z,A,C,H,D,F,G,B=function(a,c){c=b.Graphic.call(this,a,c)||this;c.width=c.width||a.evaluator.parser.parse("1");c.fill=c.fill||"";c.center=c.center||a.evaluator.parser.parse("(0,0)");c.radius=c.radius||a.evaluator.parser.parse("1");c.init=c.init||"0";c.end=c.end||"90";c.init.startsWith("_(")&&(c.iFlag=!0,c.init=c.init.slice(1));c.end.startsWith("_(")&&
(c.eFlag=!0,c.end=c.end.slice(1));c.initExpr=a.evaluator.parser.parse(c.init);c.endExpr=a.evaluator.parser.parse(c.end);c.text=new b.TextObject(c,c.text);return c};$jscomp.inherits(B,b.Graphic);B.prototype.update=function(){f=this.evaluator;var l=$jscomp.makeIterator(f.eval(this.center)[0]);this.X=l.next().value;this.Y=l.next().value;m=0;this.rotateExp&&(m=b.degToRad(f.eval(this.rotateExp)),p=Math.cos(m),e=Math.sin(m),u=this.X*p-this.Y*e,v=this.X*e+this.Y*p,this.X=u,this.Y=v);var F=f.eval(this.initExpr);
l=f.eval(this.endExpr);/^(\(|\[).*(\)|\])$/i.test(this.initExpr.type)&&/^(\(|\[).*(\)|\])$/i.test(this.endExpr.type)?(F=$jscomp.makeIterator(F[0]),w=F.next().value,q=F.next().value,l=$jscomp.makeIterator(l[0]),r=l.next().value,y=l.next().value,this.vectors?this.abs_coord&&(q=-q,y=-y):(w-=this.X,q=-q+this.Y,r-=this.X,y=-y+this.Y,this.abs_coord||(q=-q,y=-y)),x=0==w?0>q?3*c:c:g(1*w/n(w*w+q*q)),z=0==r?0>y?3*c:c:g(1*r/n(r*r+y*y)),x+=m,z+=m,0<w&&0<q&&this.abs_coord&&(x=h-x),0<w&&0>q&&!this.abs_coord&&(x=
h-x),0>w&&0>q&&!this.abs_coord&&(x=h-x),0>w&&0<q&&this.abs_coord&&(x=h-x),0<r&&0<y&&this.abs_coord&&(z=h-z),0<r&&0>y&&!this.abs_coord&&(z=h-z),0>r&&0>y&&!this.abs_coord&&(z=h-z),0>r&&0<y&&this.abs_coord&&(z=h-z),this.iFlag?(A=x,x=z,z=A):(A=d(x,z),C=k(x,z),x=A,z=C,z-x>a&&this.abs_coord&&(x=C,z=A),z-x<=a&&!this.abs_coord&&(x=C,z=A)),this.iniAng=x,this.endAng=z,this.drawPoints=!0):(this.iniAng=b.degToRad(F)+m,this.endAng=b.degToRad(l)+m,this.drawAngle=!0)};B.prototype.draw=function(){b.Graphic.prototype.draw.call(this,
this.fill,this.color)};B.prototype.drawTrace=function(){b.Graphic.prototype.drawTrace.call(this,this.fill,this.trace)};B.prototype.drawAux=function(a,b,c){f=this.evaluator;H=this.space;G=Math.max(0,f.eval(this.radius));a.lineWidth=Math.max(1E-6,l(f.eval(this.width)));a.lineCap="round";a.strokeStyle=c.getColor();this.abs_coord?(D=l(this.X),F=l(this.Y)):(D=l(H.getAbsoluteX(this.X)),F=l(H.getAbsoluteY(this.Y)),G*=H.scale,this.iniAng=-this.iniAng,this.endAng=-this.endAng);this.drawAngle&&this.iniAng>
this.endAng&&(c=$jscomp.makeIterator([this.endAng,this.iniAng]),this.iniAng=c.next().value,this.endAng=c.next().value);this.fill&&(a.fillStyle=b.getColor(),a.beginPath(),a.moveTo(D,F),a.arc(D,F,G,this.iniAng,this.endAng,void 0),a.fill());a.beginPath();a.arc(D,F,G,this.iniAng,this.endAng,void 0);this.dashStyle();a.stroke();this.text.hasContent&&this.text.draw(a,this.color,D,F)};b.Arc=B;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,l,d=function(a,c){c=b.Graphic.call(this,a,c)||this;c.width=c.width||a.evaluator.parser.parse("0");c.align||(c.align="left");c.anchor||(c.anchor="top_left");c.shadowColor=c.shadowColor?c.shadowColor.getColor():"transparent";c.text=new b.TextObject(c,c.text);return c};$jscomp.inherits(d,b.Graphic);d.prototype.update=function(){a=this.evaluator;var d=$jscomp.makeIterator(a.eval(this.expresion)[0]);this.X=d.next().value;this.Y=d.next().value;this.rotateExp&&
(c=this.rotate(this.X,this.Y,b.degToRad(a.eval(this.rotateExp))),this.X=c.x,this.Y=c.y)};d.prototype.draw=function(){b.Graphic.prototype.draw.call(this,this.color)};d.prototype.drawTrace=function(){b.Graphic.prototype.drawTrace.call(this,this.trace)};d.prototype.drawAux=function(a,b){this.abs_coord?(h=parseInt(this.X),l=parseInt(this.Y)):(h=parseInt(this.space.getAbsoluteX(this.X)),l=parseInt(this.space.getAbsoluteY(this.Y)));this.text.draw(a,b,h,l)};b.Text=d;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=Math.round,c,h,l,d,k,g,n,f,m,p,e,u=function(a,c){e=c=b.Graphic.call(this,a,c)||this;e.file=e.file||"";e.inirot=e.inirot||a.evaluator.parser.parse("0");e.img=new Image;e.scaleX=e.scaleY=1;e.ratio=a.ratio;a=e.expresion.getChildren();e.x_e=a[0];e.y_e=a[1];2<a.length&&(e.centered=!0,e.s_x_e=a[2],e.s_y_e=3<a.length?a[3]:a[2]);e.evaluator.eval(e.clip)&&(e.clip=e.clip.getChildren());e.update();return c};$jscomp.inherits(u,b.Graphic);u.prototype.update=
function(){var a=this;c=a.evaluator;a.X=c.eval(a.x_e);a.Y=c.eval(a.y_e);a.rotateExp&&(h=a.rotate(a.X,a.Y,b.degToRad(c.eval(a.rotateExp))),a.X=h.x,a.Y=h.y);a.centered&&(a.scaleX=c.eval(a.s_x_e),a.scaleY=c.eval(a.s_y_e),0==a.scaleX&&(a.scaleX=1E-5),0==a.scaleY&&(a.scaleY=1E-5));if((l=c.eval(a.file))||""==l)a.img=a.parent.getImage(l),a.img.hasUpdate||(a.img.hasUpdate=!0,a.img.addEventListener("load",function(){a.space.update(!0)}))};u.prototype.draw=function(){b.Graphic.prototype.draw.call(this)};u.prototype.drawTrace=
function(){b.Graphic.prototype.drawTrace.call(this)};u.prototype.drawAux=function(h){e=this;c=e.evaluator;e.img&&e.img.ready&&e.img.complete&&(e.clip?(m=c.eval(e.clip[2]),p=c.eval(e.clip[3])):(m=e.img.width,p=e.img.height,e.img.canvas&&(m=a(m/e.img.ratio),p=a(p/e.img.ratio))),d=e.centered?0:a(m/2),k=e.centered?0:a(p/2),g=a(e.abs_coord?e.X:e.space.getAbsoluteX(e.X)),n=a(e.abs_coord?e.Y:e.space.getAbsoluteY(e.Y)),f=b.degToRad(-c.eval(e.inirot)),h.save(),h.translate(g+d,n+k),h.rotate(f),e.opacity&&(h.globalAlpha=
c.eval(e.opacity)),h.scale(e.scaleX,e.scaleY),e.clip?e.img.canvas?h.drawImage(e.img,c.eval(e.clip[0])*e.img.ratio,c.eval(e.clip[1])*e.img.ratio,m*e.img.ratio,p*e.img.ratio,-m/2,-p/2,m,p):h.drawImage(e.img,c.eval(e.clip[0]),c.eval(e.clip[1]),m,p,-m/2,-p/2,m,p):h.drawImage(e.img,-m/2,-p/2,m,p),h.restore())};b.Image=u;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,l,d,k,g,n=document.createElement("canvas").getContext("2d");n.canvas.width=1;n.canvas.height=1;var f=function(a,c){return b.Graphic.call(this,a,c)||this};$jscomp.inherits(f,b.Graphic);f.prototype.update=function(){var a=$jscomp.makeIterator(this.evaluator.eval(this.expresion)[0]);this.X=a.next().value;this.Y=a.next().value};f.prototype.draw=function(){b.Graphic.prototype.draw.call(this,this.color,this.color)};f.prototype.drawTrace=function(){b.Graphic.prototype.drawTrace.call(this,
this.trace,this.trace)};f.prototype.drawAux=function(b,f){f=f.getColor();n.clearRect(0,0,1,1);n.fillStyle=f;n.fillRect(0,0,1,1);f=(new Uint32Array(n.getImageData(0,0,1,1).data.buffer))[0];k=b.getImageData(0,0,this.space.w,this.space.h);g=new Uint32Array(k.data.buffer);a=parseInt(this.abs_coord?this.X:this.space.getAbsoluteX(this.X));c=parseInt(this.abs_coord?this.Y:this.space.getAbsoluteY(this.Y));var e=k.width;l=0>a||0>c||a>=e||c>=k.height?-1:g[a+c*e];if(-1!=l&&f!=l){h=[a,c];for(d=0;0<h.length&&
!(d++,c=h.pop(),a=h.pop(),e=k.width,l==(0>a||0>c||a>=e||c>=k.height?-1:g[a+c*e])&&(g[a+c*k.width]=f,h.push(a-1,c),h.push(a+1,c),h.push(a,c-1),h.push(a,c+1)),d>=this.space.w*this.space.h););b.putImageData(k,0,0)}};b.Fill=f;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c=function(a,c){var d=b.BaseMacro.call(this,a,c,"parseGraphic","-text-image-point-polygon-arc-segment-arrow-macro-curve-equation-sequence-rectangle-fill-")||this;d.inirot=d.inirot||a.evaluator.parser.parse("0");d.inipos=d.inipos||a.evaluator.parser.parse("(0,0)");Object.assign(d,c);return d};$jscomp.inherits(c,b.BaseMacro);c.prototype.update=function(){a=this.evaluator.eval(this.inipos)[0];this.iniPosX=a[0];this.iniPosY=a[1]};c.prototype.drawAux=
function(a){for(var b=0,c=this.graphics.length;b<c;b++)this.graphics[b]&&(a.save(),this.graphics[b].abs_coord?a.translate(this.iniPosX,this.iniPosY):a.translate(this.iniPosX*this.space.scale,-this.iniPosY*this.space.scale),this.graphics[b].draw(),a.restore())};b.Macro=c;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=Math.sqrt,c=Math.sin,h=Math.cos,l=Math.abs,d=function(a,b,c,d){a=void 0===a?0:a;b=void 0===b?0:b;c=void 0===c?0:c;d=void 0===d?1:d;this.D=new Float32Array(4);this.set(a,b,c,d)};d.prototype.set=function(a,b,c,d){this.D[0]=a;this.D[1]=b;this.D[2]=c;this.D[3]=d;return this};d.prototype.norm3D=function(){var b=this.D[0],c=this.D[1],d=this.D[2];return a(b*b+c*c+d*d)};d.prototype.normalize3D=function(a){a=void 0===a?new d:a;var b=this.norm3D();if(0===
b)return a.set(0,0,0,this.w);b=1/b;return a.set(this.D[0]*b,this.D[1]*b,this.D[2]*b,this.w)};d.prototype.dotProduct3D=function(a){return this.D[0]*a.D[0]+this.D[1]*a.D[1]+this.D[2]*a.D[2]};d.prototype.crossProduct3D=function(a,b){b=void 0===b?new d:b;var c=$jscomp.makeIterator(this.D),g=c.next().value,k=c.next().value;c=c.next().value;var e=$jscomp.makeIterator(a.D);a=e.next().value;var h=e.next().value;e=e.next().value;return b.set(k*e-c*h,c*a-g*e,g*h-k*a,b.w)};d.prototype.scalarProd3D=function(a,
b){b=void 0===b?new d:b;return b.set(this.D[0]*a,this.D[1]*a,this.D[2]*a,this.w)};d.prototype.subtract3D=function(a,b){b=void 0===b?new d:b;return b.set(this.D[0]-a.D[0],this.D[1]-a.D[1],this.D[2]-a.D[2],this.w)};d.prototype.add3D=function(a,b){b=void 0===b?new d:b;return b.set(this.D[0]+a.D[0],this.D[1]+a.D[1],this.D[2]+a.D[2],this.w)};d.prototype.equals3D=function(a,b){return l(this.D[0]-a.D[0])<=b&&l(this.D[1]-a.D[1])<=b&&l(this.D[2]-a.D[2])<=b};d.prototype.clone=function(){return new d(this.D[0],
this.D[1],this.D[2],this.D[3])};$jscomp.global.Object.defineProperties(d.prototype,{x:{configurable:!0,enumerable:!0,get:function(){return this.D[0]},set:function(a){this.D[0]=a}},y:{configurable:!0,enumerable:!0,get:function(){return this.D[1]},set:function(a){this.D[1]=a}},z:{configurable:!0,enumerable:!0,get:function(){return this.D[2]},set:function(a){this.D[2]=a}},w:{configurable:!0,enumerable:!0,get:function(){return this.D[3]},set:function(a){this.D[3]=a}}});var k=function(a,b,c,d,k,e,h,l,
w,q,r,y,x,z,A,C){a=void 0===a?0:a;b=void 0===b?0:b;c=void 0===c?0:c;d=void 0===d?0:d;k=void 0===k?0:k;e=void 0===e?0:e;h=void 0===h?0:h;l=void 0===l?0:l;w=void 0===w?0:w;q=void 0===q?0:q;r=void 0===r?0:r;y=void 0===y?0:y;x=void 0===x?0:x;z=void 0===z?0:z;A=void 0===A?0:A;C=void 0===C?0:C;this.D=new Float32Array(16);this.set(a,b,c,d,k,e,h,l,w,q,r,y,x,z,A,C)};k.prototype.set=function(a,b,c,d,k,e,h,l,w,q,r,y,x,z,A,C){var f=this.D;f[0]=a;f[1]=b;f[2]=c;f[3]=d;f[4]=k;f[5]=e;f[6]=h;f[7]=l;f[8]=w;f[9]=q;
f[10]=r;f[11]=y;f[12]=x;f[13]=z;f[14]=A;f[15]=C;return this};k.prototype.setIdentity=function(){var a=this.D;a[0]=1;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=1;a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=1;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return this};k.prototype.mulV4=function(a,b){b=void 0===b?new d:b;var c=this.D,g=a.D;a=b.D;var k=g[0],e=g[1],h=g[2];g=g[3];a[0]=k*c[0]+e*c[4]+h*c[8]+g*c[12];a[1]=k*c[1]+e*c[5]+h*c[9]+g*c[13];a[2]=k*c[2]+e*c[6]+h*c[10]+g*c[14];a[3]=k*c[3]+e*c[7]+h*c[11]+g*c[15];return b};k.prototype.translate=
function(a,b){b=void 0===b?(new k).setIdentity():b;var c=this.D,g=b.D;a instanceof d||(a=new d(a.x,a.y,a.z,a.w));var p=a.D[0],e=a.D[1];a=a.D[2];g[0]=c[0];g[1]=c[1];g[2]=c[2];g[3]=c[3];g[4]=c[4];g[5]=c[5];g[6]=c[6];g[7]=c[7];g[8]=c[8];g[9]=c[9];g[10]=c[10];g[11]=c[11];g[12]=c[0]*p+c[4]*e+c[8]*a+c[12];g[13]=c[1]*p+c[5]*e+c[9]*a+c[13];g[14]=c[2]*p+c[6]*e+c[10]*a+c[14];g[15]=c[3]*p+c[7]*e+c[11]*a+c[15];return b};k.prototype.rotateX=function(a,b){b=void 0===b?(new k).setIdentity():b;var d=this.D,g=b.D,
p=c(a);a=h(a);g[0]=d[0];g[1]=d[1];g[2]=d[2];g[3]=d[3];g[4]=d[4]*a+d[8]*p;g[5]=d[5]*a+d[9]*p;g[6]=d[6]*a+d[10]*p;g[7]=d[7]*a+d[11]*p;g[8]=d[4]*-p+d[8]*a;g[9]=d[5]*-p+d[9]*a;g[10]=d[6]*-p+d[10]*a;g[11]=d[7]*-p+d[11]*a;g[12]=d[12];g[13]=d[13];g[14]=d[14];g[15]=d[15];return b};k.prototype.rotateY=function(a,b){b=void 0===b?(new k).setIdentity():b;var d=this.D,g=b.D,p=c(a);a=h(a);g[0]=d[0]*a+d[8]*-p;g[1]=d[1]*a+d[9]*-p;g[2]=d[2]*a+d[10]*-p;g[3]=d[3]*a+d[11]*-p;g[4]=d[4];g[5]=d[5];g[6]=d[6];g[7]=d[7];g[8]=
d[0]*p+d[8]*a;g[9]=d[1]*p+d[9]*a;g[10]=d[2]*p+d[10]*a;g[11]=d[3]*p+d[11]*a;g[12]=d[12];g[13]=d[13];g[14]=d[14];g[15]=d[15];return b};k.prototype.rotateZ=function(a,b){b=void 0===b?(new k).setIdentity():b;var d=this.D,g=b.D,p=c(a);a=h(a);g[0]=d[0]*a+d[4]*p;g[1]=d[1]*a+d[5]*p;g[2]=d[2]*a+d[6]*p;g[3]=d[3]*a+d[7]*p;g[4]=d[0]*-p+d[4]*a;g[5]=d[1]*-p+d[5]*a;g[6]=d[2]*-p+d[6]*a;g[7]=d[3]*-p+d[7]*a;g[8]=d[8];g[9]=d[9];g[10]=d[10];g[11]=d[11];g[12]=d[12];g[13]=d[13];g[14]=d[14];g[15]=d[15];return b};k.prototype.clone=
function(){var a=new k;a.D.set(this.D);return a};b.norm3D=function(a){a instanceof d||(a=new d(a.x,a.y,a.z,a.w));return a.norm3D()};b.normalize3D=function(a){a instanceof d||(a=new d(a.x,a.y,a.z,a.w));return a.normalize3D().clone()};b.dotProduct3D=function(a,b){a instanceof d||(a=new d(a.x,a.y,a.z,a.w));b instanceof d||(b=new d(b.x,b.y,b.z,b.w));return a.dotProduct3D(b)};b.crossProduct3D=function(a,b){a instanceof d||(a=new d(a.x,a.y,a.z,a.w));b instanceof d||(b=new d(b.x,b.y,b.z,b.w));return a.crossProduct3D(b).clone()};
b.scalarProd3D=function(a,b){a instanceof d||(a=new d(a.x,a.y,a.z,a.w));return a.scalarProd3D(b).clone()};b.subtract3D=function(a,b){a instanceof d||(a=new d(a.x,a.y,a.z,a.w));b instanceof d||(b=new d(b.x,b.y,b.z,b.w));return a.subtract3D(b).clone()};b.add3D=function(a,b){a instanceof d||(a=new d(a.x,a.y,a.z,a.w));b instanceof d||(b=new d(b.x,b.y,b.z,b.w));return a.add3D(b).clone()};b.equals3D=function(a,b,c){a instanceof d||(a=new d(a.x,a.y,a.z,a.w));b instanceof d||(b=new d(b.x,b.y,b.z,b.w));return a.equals3D(b,
c)};b.Vec4D=d;b.Mat4=k;return b}(descartesJS||{});
descartesJS=function(b){function a(a){a.textNode=null;0!==parseInt(this.size)&&(a.lineWidth=1,a.fillStyle=this.backColor,a.strokeStyle=this.frontColor,a.beginPath(),a.arc(this.projV[0].x,this.projV[0].y,this.size,0,g),a.fill(),a.stroke())}function c(a,b){a.textNode=null;a.lineCap=a.lineJoin="round";a.lineWidth=.4;a.beginPath();a.moveTo(this.projV[0].x,this.projV[0].y);for(var c=1,d=this.projV.length;c<d;c++)a.lineTo(this.projV[c].x,this.projV[c].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=b.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 h(a){a.textNode=null;v=this.evaluator.getVariable(this.family);
this.evaluator.setVariable(this.family,this.fVal);this.fontSize=m(5,this.evaluator.eval(this.font_size));this.font=this.font_style+" "+this.fontSize+"px "+this.font_family;this.drawText(a,this.text,this.projV[0].x,this.projV[0].y,this.frontColor,this.font,"left","alphabetic",this.decimals,this.fixed,!0);this.evaluator.setVariable(this.family,v)}function l(a){a.textNode=null;a.lineCap="butt";a.lineJoin="round";a.lineWidth=this.lineWidth;a.strokeStyle=this.frontColor;a.beginPath();a.moveTo(this.projV[0].x,
this.projV[0].y);a.lineTo(this.projV[1].x,this.projV[1].y);"dot"===this.lineDash?a.setLineDash([a.lineWidth,a.lineWidth]):"dash"===this.lineDash?a.setLineDash([4*a.lineWidth,3*a.lineWidth]):"dash_dot"===this.lineDash?a.setLineDash([4*a.lineWidth,2*a.lineWidth,a.lineWidth,2*a.lineWidth]):(a.lineCap="round",a.setLineDash([]));a.stroke()}function d(a,c,d){return b.normalize3D(b.crossProduct3D(b.subtract3D(a,c),b.subtract3D(a,d)))}if(b.loadLib)return b;var k,g=2*Math.PI,n=Math.abs,f=Math.min,m=Math.max,
p,e,u,v,w,q,r,y,x,z=function(b,e){Object.assign(this,b);k=this;k.space=e;k.projV=[];k.spaceV=[];k.newProjV=[];k.newSpaceV=[];"vertex"===k.type?k.draw=a:"face"===k.type?(k.normal=d(k.V[0],k.V[1],k.V[2]),k.draw=c):"text"===k.type?k.draw=h:"edge"===k.type&&(k.draw=l);k.isText&&(k.computeDepth=function(){this.normal={x:0,y:0,z:0};this.projV=this.V;this.depth=this.V[0].z;this.avg=this.V[0]})};z.prototype.computeDepth=function(a){k=this;k.space=a;k.avg={x:0,y:0,z:0};k.removeDoubles();k.normal={x:0,y:1,
z:0};k.direction={x:1,y:0,z:0};for(var c=k.V.length,e=0;e<c;e++)k.spaceV[e]=a.rotateVertex(k.V[e]),k.avg.x+=k.spaceV[e].x,k.avg.y+=k.spaceV[e].y,k.avg.z+=k.spaceV[e].z;k.avg=b.scalarProd3D(k.avg,1/c);k.avg_proy=a.project(k.avg);k.depth=b.norm3D(b.subtract3D(a.eye,k.avg));2<k.V.length&&(k.normal=d(k.spaceV[0],k.spaceV[1],k.spaceV[2]));c=0;for(e=k.V.length;c<e;c++)k.newSpaceV[c]=k.spaceV[c],k.projV[c]=k.newProjV[c]=a.project(k.spaceV[c]);2<k.V.length&&(k.direction=d(k.projV[0],k.projV[1],k.projV[2]).z);
k.minDistToEye=Infinity;k.maxDistToEye=-Infinity;k.minX=Infinity;k.maxX=-Infinity;k.minY=Infinity;k.maxY=-Infinity;c=0;for(e=k.V.length;c<e;c++)q=b.norm3D(b.subtract3D(k.spaceV[c],a.eye)),k.minDistToEye=f(k.minDistToEye,q),k.maxDistToEye=m(k.maxDistToEye,q);a=0;for(c=k.V.length;a<c;a++)k.minX>k.projV[a].x&&(k.minX=k.projV[a].x),k.maxX<k.projV[a].x&&(k.maxX=k.projV[a].x),k.minY>k.projV[a].y&&(k.minY=k.projV[a].y),k.maxY<k.projV[a].y&&(k.maxY=k.projV[a].y)};z.prototype.removeDoubles=function(){k=this;
if("edge"!==k.type){w=[];for(var a=0,b=k.V.length;a<b;a++)(1E-8<n(k.V[a].x-k.V[(a+1)%b].x)||1E-8<n(k.V[a].y-k.V[(a+1)%b].y)||1E-8<n(k.V[a].z-k.V[(a+1)%b].z)||1E-8<n(k.V[a].w-k.V[(a+1)%b].w))&&w.push(k.V[a]);0===w.length&&w.push(k.V[0]);k.V=w}};z.prototype.drawText=function(a,c,d,f,g,k,m,h,l,q,n){p=this.evaluator;a.textNode=c;k=p.eval(this.offset_dist);m=-b.degToRad(p.eval(this.offset_angle));d+=k*Math.cos(m);f+=k*Math.sin(m);a.textNode.pos={x:d,y:f};c.hasContent&&(c.draw(a,g,d,f,!0),u=this.fromPoint?
c.textNodes.metrics.w/2:0,e=this.fromPoint?c.textNodes.metrics.h/2:0,c.draw(a,g,d-u,f-e))};z.prototype.splitFace=function(a){if(this.intersects(a)){var c=null,d=null,e=0,f=0,g,k=this.V,m=a.V;var p=0;for(g=m.length;p<g;p++){var h=this.intersection(m[p],m[(p+1)%g]);if(null!==h)if(null===c){if(c=h,e=p,2===m.length){d=c;break}}else if(!b.equals3D(h,c,1E-8)){d=h;f=p;break}}if(null!==c&&null!==d){p=this.isInterior(c)||this.isInterior(d);var l=g=null;if(!p&&3<=m.length){var q=0;for(k=k.length;q<k;q++)if(h=
a.intersection(this.V[q],this.V[(q+1)%k]),null!==h)if(null===g)g=h;else if(!b.equals3D(h,g,1E-8)){l=h;break}}if(p||null!==g&&null!==l&&a.isInterior(g)&&a.isInterior(l)){l=!0;k=h=null;if(2===m.length)b.equals3D(c,m[0],1E-8)||b.equals3D(c,m[1],1E-8)?l=!1:(h=[],h[0]=m[0],h[1]=c,k=[],k[0]=c,k[1]=m[1]);else for(h=[],k=[],q=g=p=0;q<m.length;q++)q<e?h[p++]=m[q]:q==e?(h[p++]=m[q],h[p++]=c,k[g++]=c):q<f?k[g++]=m[q]:q==f?(k[g++]=m[q],k[g++]=d,h[p++]=d):h[p++]=m[q];if(l){c=[];c[0]=new z({V:h,type:"face",frontColor:a.frontColor,
backColor:a.backColor,edges:a.edges,model:a.model},this.space);c[0].removeDoubles();c[0].normal=a.normal;c[1]=new z({V:k,type:"face",frontColor:a.frontColor,backColor:a.backColor,edges:a.edges,model:a.model},this.space);c[1].removeDoubles();c[1].normal=a.normal;if(2<c[0].V.length)return 2<c[1].V.length?c:[c[0]];if(2<c[1].V.length)return[c[1]]}}}}return[a]};z.prototype.intersects=function(a){return this.intersectsPlane(a)&&a.intersectsPlane(this)};z.prototype.intersectsPlane=function(a){var c=this.V;
var d=a.V;if(0<c.length){var e=b.dotProduct3D(d[0],a.normal);var f=b.dotProduct3D(c[0],a.normal);if(1E-8>n(e-f))return!0;for(var g=1,k=c.length;g<k;g++)if(d=b.dotProduct3D(c[g],a.normal),1E-8>n(e-d)||d>e&&f<e||d<e&&f>e)return!0}return!1};z.prototype.intersection=function(a,c){var d=this.V;if(0<d.length){c=b.subtract3D(c,a);var e=b.dotProduct3D(c,this.normal);if(0!==e&&(d=b.dotProduct3D(b.subtract3D(d[0],a),this.normal)/e,-1E-8<d&&1.00000001>d))return b.add3D(a,b.scalarProd3D(c,d))}return null};z.prototype.isInterior=
function(a){var c=this.V;if(0<c.length)for(var d=0,e=b.subtract3D(c[0],a),f=0,g=c.length;f<g;f++){var k=b.subtract3D(c[(f+1)%g],a),m=b.dotProduct3D(b.crossProduct3D(e,k),this.normal);if(1E-8>n(m)){if(0>b.dotProduct3D(e,k))break}else{if(0>d&&0<m||0<d&&0>m)return!1;e=k;d=m}}return!0};z.prototype.inFrontOf=function(a,b,c){if(this.minDistToEye>=b.maxDistToEye||this.maxX<=b.minX||this.minX>=b.maxX||this.maxY<=b.minY||this.minY>=b.maxY)return!1;for(x=0;3>x;x++)if(r=null,r=0===x?this.intersections(b):1===
x?b.verticesContainedIn(this):this.verticesContainedIn(b),null!=r&&0<r.length){for(var d=$jscomp.makeIterator(r),e=d.next();!e.done;e=d.next())a.push(e.value);d=$jscomp.makeIterator(r);for(e=d.next();!e.done;e=d.next()){e=e.value;y=this.space.rayFromEye(e.x,e.y);try{t=this.distanceToEyeAlong(y)-b.distanceToEyeAlong(y);if(t<=-c)return!0;if(t>=c)return!1}catch(G){}}}return!1};z.prototype.intersections=function(a){for(var c=[],d,e,f,g=new b.R2,k=this.newSpaceV,m=a.newSpaceV,p=this.newProjV,h=a.newProjV,
l=0,q=k.length;l<q;l++){a=k[l];d=k[(l+1)%q];for(var n=0,u=m.length;n<u;n++)e=m[n],f=m[(n+1)%u],a!=e&&a!=f&&d!=e&&d!=f&&(e=g.intersection(p[l],p[(l+1)%q],h[n],h[(n+1)%u]),null!=e&&c.push(e))}return c};z.prototype.distanceToEyeAlong=function(a){a=b.dotProduct3D(this.normal,a);if(1E-6<n(a))return b.dotProduct3D(b.subtract3D(this.avg,this.space.eye),this.normal)/a;throw new Exception("Face is invisible");};z.prototype.verticesContainedIn=function(a){for(var b=[],c=this.newSpaceV,d=this.newProjV,e=0,f=
c.length;e<f;e++)!a.isVertex(c[e])&&a.appearsToContain(d[e])&&b.push(d[e]);return b};z.prototype.appearsToContain=function(a){for(var b=0,c,d=this.newProjV,e=0,g=this.newSpaceV.length;e<g;e++){c=(d[e].x-a.x)*(d[(e+1)%g].y-a.y)-(d[(e+1)%g].x-a.x)*(d[e].y-a.y);if(0!=b)if(1E-8>n(c)){if(1E-8<n(d[e].x-d[(e+1)%g].x))return f(d[e].x,d[(e+1)%g].x)<=a.x+1E-8&&a.x<=m(d[e].x,d[(e+1)%g].x)+1E-8;if(1E-8<n(d[e].y-d[(e+1)%g].y))return f(d[e].y,d[(e+1)%g].y)<=a.y+1E-8&&a.y<=m(d[e].y,d[(e+1)%g].y)+1E-8}else if(0<
b&&0>c||0>b&&0<c)return!1;b=c}return!0};z.prototype.isVertex=function(a){for(var c=$jscomp.makeIterator(this.newSpaceV),d=c.next();!d.done;d=c.next())if(b.equals3D(a,d.value,1E-8))return!0;return!1};b.Primitive3D=z;return b}(descartesJS||{});
descartesJS=function(b){function a(a){for(var b=[],c=0,d,f=a.length,g=a.length-1;-1<g;g--)d=a.charAt(g),0==c?"="==d&&(c=1):1==c?" "!=d&&(c="<"===d||">"===d?0:2):2==c&&" "==d&&(b.unshift(a.substring(g+1,f)),f=g,c=0);b.unshift(a.substring(0,f));return b}if(b.loadLib)return b;var c,h=b.degToRad,l,d,k,g,n,f,m=function(a,d){c=this;c.parent=a;c.evaluator=a.evaluator;var e=a.evaluator.parser;c.spaceID="E0";c.background=!1;c.type="";c.color=new b.Color("eeffaa");c.backcolor=new b.Color("6090a0");c.Nu=c.Nv=
c.evaluator.parser.parse("7");c.drawif=e.parse("1");c.abs_coord=!1;c.family="";c.family_interval=e.parse("[0,1]");c.family_steps=e.parse("8");c.font="SansSerif,PLAIN,18";c.fixed=!0;c.text="";c.decimals=e.parse("2");c.inirot=c.endrot="(0,0,0)";c.inirotEuler=c.endrotEuler=!1;c.inipos=c.endpos=e.parse("(0,0,0)");c.model="color";Object.assign(c,d);void 0==c.expresion&&"macro"!==c.type&&(c.expresion=e.parse("(0,0)"));c.space=c.getSpace();c.canvas=c.background?c.space.backCanvas:c.space.canvas;c.ctx=c.canvas.getContext("2d");
c.font_str=c.font;c.font=b.convertFont(c.font);c.fontSize=c.font.match(/([\d\.]+)px/);c.fontSize=c.fontSize?parseFloat(c.fontSize[1]):10;c.font_style=b.getFontStyle(c.font_str.split(",")[1]);if("boolean"===typeof c.bold||"boolean"===typeof c.italics)c.font_style=(c.italics?"Italic ":"")+(c.bold?"Bold ":"");c.font_family||(c.font_family=c.font_str.split(",")[0]);c.font_family=b.getFontName(c.font_family);"undefined"===typeof c.font_size&&(c.font_size=a.evaluator.parser.parse(c.fontSize.toString()));
c.inirot.includes("Euler")&&(c.inirot=c.inirot.replace("Euler",""),c.inirotEuler=!0);c.endrot.includes("Euler")&&(c.endrot=c.endrot.replace("Euler",""),c.endrotEuler=!0);c.inirot=e.parse(c.inirot);c.endrot=e.parse(c.endrot);c.inirotM=new b.Mat4;c.inirotM_X=new b.Mat4;c.inirotM_Y=new b.Mat4;c.inirotM_Z=new b.Mat4;c.iniposM=new b.Mat4;c.endrotM=new b.Mat4;c.endrotM_X=new b.Mat4;c.endrotM_Y=new b.Mat4;c.endrotM_Z=new b.Mat4;c.endposM=new b.Mat4;f=new b.Mat4};m.prototype.getSpace=function(){var a=this;
return this.parent.spaces.find(function(b){return b.id===a.spaceID})||this.parent.spaces[0]};m.prototype.getFamilyValues=function(){c=this;l=c.evaluator;var a=$jscomp.makeIterator(l.eval(c.family_interval)[0]);c.fInf=a.next().value;c.fSup=a.next().value;c.fSteps=Math.round(l.eval(c.family_steps));c.fSep=0<c.fSteps?(c.fSup-c.fInf)/c.fSteps:0};m.prototype.buildFamilyPrimitives=function(){c=this;l=c.evaluator;c.getFamilyValues();d=l.getVariable(c.family);if(0<=c.fSteps)for(var a=0,b=c.fSteps;a<=b;a++)c.fVal=
c.fInf+a*c.fSep,l.setVariable(c.family,c.fVal),l.eval(c.drawif)&&c.buildPrimitives();l.setVariable(c.family,d)};m.prototype.update=function(){c=this;c.primitives=[];c.evaluator.eval(c.drawif)&&(c.family||c.buildPrimitives());c.family&&c.buildFamilyPrimitives()};m.prototype.updateMVMatrix=function(){c=this;k=c.evaluator.eval(c.inirot)[0];c.inirotEuler?(c.inirotM.setIdentity(),c.inirotM=c.inirotM.rotateZ(h(k[0])),c.inirotM=c.inirotM.rotateX(h(k[1])),c.inirotM=c.inirotM.rotateZ(h(k[2]))):(f.setIdentity(),
f.rotateX(h(k[0]),c.inirotM_X),f.rotateY(h(k[1]),c.inirotM_Y),f.rotateZ(h(k[2]),c.inirotM_Z));k=c.evaluator.eval(c.inipos)[0];c.iniposM=c.iniposM.setIdentity().translate({x:k[0],y:k[1],z:k[2]});k=c.evaluator.eval(c.endrot)[0];c.endrotEuler?(c.endrotM.setIdentity(),c.endrotM=c.endrotM.rotateZ(h(k[0])),c.endrotM=c.endrotM.rotateX(h(k[1])),c.endrotM=c.endrotM.rotateZ(h(k[2]))):(f.setIdentity(),f.rotateX(h(k[0]),c.endrotM_X),f.rotateY(h(k[1]),c.endrotM_Y),f.rotateZ(h(k[2]),c.endrotM_Z));k=c.evaluator.eval(c.endpos)[0];
c.endposM=c.endposM.setIdentity().translate({x:k[0],y:k[1],z:k[2]})};m.prototype.transformVertex=function(a){c=this;g=c.inirotEuler?c.inirotM.mulV4(a):c.inirotM_Z.mulV4(c.inirotM_Y.mulV4(c.inirotM_X.mulV4(a)));g=c.iniposM.mulV4(g);g=c.endrotEuler?c.endrotM.mulV4(g):c.endrotM_Z.mulV4(c.endrotM_Y.mulV4(c.endrotM_X.mulV4(g)));g=c.endposM.mulV4(g);c.macroChildren&&(g=c.applyMacroTransform(g));return g};m.prototype.applyMacroTransform=function(a){c=this;g=c.macro_inirotEuler?c.macro_inirotM.mulV4(a):c.macro_inirotM_Z.mulV4(c.macro_inirotM_Y.mulV4(c.macro_inirotM_X.mulV4(a)));
g=c.macro_iniposM.mulV4(g);g=c.macro_endrotEuler?c.macro_endrotM.mulV4(g):c.macro_endrotM_Z.mulV4(c.macro_endrotM_Y.mulV4(c.macro_endrotM_X.mulV4(g)));return g=c.macro_endposM.mulV4(g)};m.prototype.parseExpression=function(){for(var b=[],c=$jscomp.makeIterator(this.expresion.split(";")),d=c.next();!d.done;d=c.next())d=d.value,""!==d.trim()&&b.push.apply(b,$jscomp.arrayFromIterable(a(d)));c=0;for(d=b.length;c<d;c++)b[c]=this.evaluator.parser.parse(b[c],!0);return b};m.prototype.splitFace=function(a){for(var b=
$jscomp.makeIterator(this.primitives),c=b.next();!c.done;c=b.next())if(c=c.value,n=[],"face"===c.type){for(var d=$jscomp.makeIterator(a.primitives),f=d.next();!f.done;f=d.next())f=f.value,"face"===f.type?n.push.apply(n,$jscomp.arrayFromIterable(c.splitFace(f))):n.push(f);a.primitives=n}};b.Graphic3D=m;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,l,d,k,g=function(a,c){return b.Graphic3D.call(this,a,c)||this};$jscomp.inherits(g,b.Graphic3D);g.prototype.buildPrimitives=function(){a=this;c=a.evaluator;a.updateMVMatrix();h=c.eval(a.expresion)[0];l=h[0];d=h[1];k=h[2];a.primitives.push(new b.Primitive3D({V:[a.transformVertex(new b.Vec4D(l,d,k))],type:"vertex",backColor:a.backcolor.getColor(),frontColor:a.color.getColor(),size:c.eval(a.width)}));""!==a.text&&(a.offset_dist=a.offset_dist||c.parser.parse("10"),
a.offset_angle=a.offset_angle||c.parser.parse("270"),a.primitives.push(new b.Primitive3D({V:[a.transformVertex(new b.Vec4D(l,d,k))],type:"text",fromPoint:!0,frontColor:a.color.getColor(),font_size:a.font_size,font_style:a.font_style,font_family:a.font_family,decimals:c.eval(a.decimals),fixed:a.fixed,evaluator:c,text:new b.TextObject(a,a.text),family:a.family,familyValue:a.fVal,offset_dist:a.offset_dist,offset_angle:a.offset_angle},a.space)))};b.Point3D=g;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,l,d=function(a,c){c=b.Graphic3D.call(this,a,c)||this;c.width=c.width||a.evaluator.parser.parse("1");return c};$jscomp.inherits(d,b.Graphic3D);d.prototype.buildPrimitives=function(){a=this;h=a.evaluator;a.updateMVMatrix();c=h.getVariable("u");h.setVariable("u",a.Nu);l=h.eval(a.expresion);a.primitives.push(new b.Primitive3D({V:[a.transformVertex(new b.Vec4D(l[0][0],l[0][1],l[0][2])),a.transformVertex(new b.Vec4D(l[1][0],l[1][1],l[1][2]))],type:"edge",
lineDash:a.lineDash,frontColor:a.color.getColor(),lineWidth:h.eval(a.width)},a.space));h.setVariable("u",c)};b.Segment3D=d;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,l,d,k,g,n,f,m,p,e=function(c,d){a=d=b.Graphic3D.call(this,c,d)||this;a.param=a.param||"t";a.parameter_interval=a.parameter_interval||c.evaluator.parser.parse("[0,1]");a.parameter_steps=a.parameter_steps||c.evaluator.parser.parse("8");a.expresion=a.parseExpression();return d};$jscomp.inherits(e,b.Graphic3D);e.prototype.buildPrimitives=function(){a=this;c=a.evaluator;a.updateMVMatrix();d=c.getVariable("x");k=c.getVariable("y");g=c.getVariable("z");
h=c.getVariable("u");l=c.getVariable("v");c.setVariable("u",0);c.setVariable("v",0);n=parseInt(c.eval(a.Nu));f=parseInt(c.eval(a.Nv));m=[];for(var e=0;e<=n;e++){c.setVariable("u",e/n);for(var v=0;v<=f;v++){c.setVariable("v",v/f);for(var w=$jscomp.makeIterator(a.expresion),q=w.next();!q.done;q=w.next())c.eval(q.value);m.push(a.transformVertex(new b.Vec4D(c.getVariable("x"),c.getVariable("y"),c.getVariable("z"))))}}e=a.color.getColor();v=a.backcolor.getColor();w=a.edges?a.edges.getColor():"";for(q=
0;q<n;q++)for(var r=0;r<f;r++)p=[],p.push(m[r+q*f+q]),p.push(m[r+1+q*f+q]),p.push(m[r+2+(q+1)*f+q]),p.push(m[r+1+(q+1)*f+q]),a.primitives.push(new b.Primitive3D({V:p,type:"face",frontColor:e,backColor:v,edges:w,model:a.model},a.space));c.setVariable("x",d);c.setVariable("y",k);c.setVariable("z",g);c.setVariable("u",h);c.setVariable("v",l)};b.Surface3D=e;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,l,d=function(a,c){c=b.Graphic3D.call(this,a,c)||this;c.width=c.width||a.evaluator.parser.parse("1");return c};$jscomp.inherits(d,b.Graphic3D);d.prototype.buildPrimitives=function(){a=this;c=a.evaluator;a.updateMVMatrix();h=c.eval(a.expresion);l=a.color.getColor();for(var d=0,g=h.length-1;d<g;d++)a.primitives.push(new b.Primitive3D({V:[a.transformVertex(new b.Vec4D(h[d][0],h[d][1],h[d][2])),a.transformVertex(new b.Vec4D(h[d+1][0],h[d+1][1],h[d+
1][2]))],type:"edge",frontColor:l,lineWidth:c.eval(a.width)},a.space))};b.Polygon3D=d;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,l,d,k,g,n,f=function(c,d){a=d=b.Graphic3D.call(this,c,d)||this;a.width=a.width||c.evaluator.parser.parse("1");a.expresion=a.parseExpression();return d};$jscomp.inherits(f,b.Graphic3D);f.prototype.buildPrimitives=function(){a=this;n=a.evaluator;a.updateMVMatrix();d=n.getVariable("x");k=n.getVariable("y");g=n.getVariable("z");l=n.getVariable("u");n.setVariable("u",0);h=n.eval(a.Nu);c=[];for(var f=0;f<=h;f++){n.setVariable("u",f/h);for(var p=$jscomp.makeIterator(a.expresion),
e=p.next();!e.done;e=p.next())n.eval(e.value);c.push(a.transformVertex(new b.Vec4D(n.getVariable("x"),n.getVariable("y"),n.getVariable("z"))))}f=0;for(p=c.length-1;f<p;f++)a.primitives.push(new b.Primitive3D({V:[c[f],c[f+1]],type:"edge",frontColor:a.color.getColor(),lineWidth:n.eval(a.width)},a.space));a.fill&&2<c.length&&a.primitives.push(new b.Primitive3D({V:c,type:"face",frontColor:a.fill.getColor(),backColor:a.fill.getColor(),edges:"",model:a.model},a.space));n.setVariable("x",d);n.setVariable("y",
k);n.setVariable("z",g);n.setVariable("u",l)};b.Curve3D=f;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,l=function(a,c){return b.Graphic3D.call(this,a,c)||this};$jscomp.inherits(l,b.Graphic3D);l.prototype.buildPrimitives=function(){a=this;c=a.evaluator;a.updateMVMatrix();h=c.eval(a.expresion);a.primitives.push(new b.Primitive3D({V:[a.transformVertex(new b.Vec4D(h[0][0],h[0][1],h[0][2])),a.transformVertex(new b.Vec4D(h[2][0],h[2][1],h[2][2])),a.transformVertex(new b.Vec4D(h[1][0],h[1][1],h[1][2]))],type:"face",frontColor:a.color.getColor(),backColor:a.backcolor.getColor(),
edges:a.edges?a.edges.getColor():"",model:a.model},a.space))};b.Triangle3D=l;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,l,d=function(a,c){return b.Graphic3D.call(this,a,c)||this};$jscomp.inherits(d,b.Graphic3D);d.prototype.buildPrimitives=function(){a=this;h=a.evaluator;a.updateMVMatrix();l=h.eval(a.expresion);c=[];for(var d=l.length-1;0<=d;d--)c.push(a.transformVertex(new b.Vec4D(l[d][0],l[d][1],l[d][2])));a.primitives.push(new b.Primitive3D({V:c,type:"face",frontColor:a.color.getColor(),backColor:a.backcolor.getColor(),edges:a.edges?a.edges.getColor():"",model:a.model},
a.space))};b.Face3D=d;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,l,d,k,g,n=function(c,d){a=d=b.Graphic3D.call(this,c,d)||this;a.width=a.width||c.evaluator.parser.parse("2");a.length=a.length||c.evaluator.parser.parse("2");return d};$jscomp.inherits(n,b.Graphic3D);n.prototype.buildPrimitives=function(){a=this;g=a.evaluator;a.updateMVMatrix();c=g.eval(a.Nu);h=[a.transformVertex(new b.Vec4D)];l=g.eval(a.width)/2;d=g.eval(a.length)/2;k=2*Math.PI/c;for(var f=0;f<c;f++)h.push(a.transformVertex(new b.Vec4D(l*Math.cos(k*
f),d*Math.sin(k*f),0)));f=a.color.getColor();for(var m=a.backcolor.getColor(),p=a.edges?a.edges.getColor():"",e=0;e<c;e++)a.primitives.push(new b.Primitive3D({V:[h[0],e+2<=c?h[e+2]:h[1],h[e+1]],type:"face",frontColor:f,backColor:m,edges:p,model:a.model},a.space))};b.Polireg3D=n;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,l=function(a,c){a=b.Graphic3D.call(this,a,c)||this;a.shadowColor=a.shadowColor?a.shadowColor.getColor():"transparent";return a};$jscomp.inherits(l,b.Graphic3D);l.prototype.buildPrimitives=function(){a=this;c=a.evaluator;h=c.eval(a.expresion)[0];a.primitives.push(new b.Primitive3D({V:[new b.Vec4D(h[0],h[1],0)],type:"text",frontColor:a.color.getColor(),font_size:a.font_size,font_style:a.font_style,font_family:a.font_family,decimals:c.eval(a.decimals),
fixed:a.fixed,displace:0,isText:!0,evaluator:c,text:new b.TextObject(a,a.text),family:a.family,familyValue:a.fVal},a.space))};b.Text3D=l;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,l,d=b.degToRad,k=0,g=function(c,d){var f;a=f=b.BaseMacro.call(this,c,d,"parse3DGraphic","-point-segment-polygon-curve-triangle-face-polireg-surface-text-cube-box-tetrahedron-octahedron-sphere-dodecahedron-icosahedron-ellipsoid-cone-cylinder-torus-mesh-macro-")||this;a.inirot=a.inirot||"(0,0,0)";a.inirotEuler=a.inirotEuler||!1;a.inipos=a.inipos||c.evaluator.parser.parse("(0,0,0)");a.endrot=a.endrot||"(0,0,0)";a.endrotEuler=a.endrotEuler||!1;a.endpos=
a.endpos||c.evaluator.parser.parse("(0,0,0)");a.name=a.name||"_M_"+k++;Object.assign(a,d);"string"===typeof a.inirot&&a.inirot.includes("Euler")&&(a.inirot=a.inirot.replace("Euler",""),a.inirotEuler=!0);"string"===typeof a.endrot&&a.endrot.includes("Euler")&&(a.endrot=a.endrot.replace("Euler",""),a.endrotEuler=!0);a.inirot=a.evaluator.parser.parse(a.inirot);a.endrot=a.evaluator.parser.parse(a.endrot);a.inirotM=new b.Mat4;a.inirotM_X=new b.Mat4;a.inirotM_Y=new b.Mat4;a.inirotM_Z=new b.Mat4;a.iniposM=
new b.Mat4;a.endrotM=new b.Mat4;a.endrotM_X=new b.Mat4;a.endrotM_Y=new b.Mat4;a.endrotM_Z=new b.Mat4;a.endposM=new b.Mat4;h=new b.Mat4;c=$jscomp.makeIterator(a.graphics);for(d=c.next();!d.done;d=c.next())d.value.macroChildren=!0;return f};$jscomp.inherits(g,b.BaseMacro);g.prototype.buildFamilyPrimitives=function(){a=this;c=a.evaluator;a.getFamilyValues();var b=c.getVariable(a.family);if(0<=a.fSteps)for(var d=0,g=a.fSteps;d<=g;d++)a.fVal=a.fInf+d*a.fSep,c.setVariable(a.family,a.fVal),c.eval(a.drawif)&&
a.updateMacro();c.setVariable(a.family,b)};g.prototype.update=function(){a=this;a.primitives=[];a.evaluator.eval(a.drawif)&&(a.family||a.updateMacro());a.family&&a.buildFamilyPrimitives()};g.prototype.updateMacro=function(){a=this;a.updateTransformation();if(a.inipos){var b=a.evaluator.eval(a.inipos)[0];a.iniPosX=b[0];a.iniPosY=b[1]}b=$jscomp.makeIterator(a.graphics);for(var c=b.next();!c.done;c=b.next())c=c.value,c.macro_inirotEuler=a.inirotEuler,c.macro_inirotM=a.inirotM,c.macro_inirotM_X=a.inirotM_X,
c.macro_inirotM_Y=a.inirotM_Y,c.macro_inirotM_Z=a.inirotM_Z,c.macro_iniposM=a.iniposM,c.macro_endrotEuler=a.endrotEuler,c.macro_endrotM=a.endrotM,c.macro_endrotM_X=a.endrotM_X,c.macro_endrotM_Y=a.endrotM_Y,c.macro_endrotM_Z=a.endrotM_Z,c.macro_endposM=a.endposM,c.update();b=0;for(c=a.graphics.length;b<c;b++){var d=a.graphics[b];if(d.split||a.split)for(var g=b+1;g<c;g++){var e=a.graphics[g];(e.split||a.split)&&d.splitFace(e)}a.primitives=a.primitives.concat(d.primitives||[])}};g.prototype.updateTransformation=
function(){a=this;l=a.evaluator.eval(a.inirot)[0];a.inirotEuler?(a.inirotM.setIdentity(),a.inirotM=a.inirotM.rotateZ(d(l[0])),a.inirotM=a.inirotM.rotateX(d(l[1])),a.inirotM=a.inirotM.rotateZ(d(l[2]))):(h.setIdentity(),h.rotateX(d(l[0]),a.inirotM_X),h.rotateY(d(l[1]),a.inirotM_Y),h.rotateZ(d(l[2]),a.inirotM_Z));l=a.evaluator.eval(a.inipos)[0];a.iniposM=a.iniposM.setIdentity().translate({x:l[0],y:l[1],z:l[2]});l=a.evaluator.eval(a.endrot)[0];a.endrotEuler?(a.endrotM.setIdentity(),a.endrotM=a.endrotM.rotateZ(d(l[0])),
a.endrotM=a.endrotM.rotateX(d(l[1])),a.endrotM=a.endrotM.rotateZ(d(l[2]))):(h.setIdentity(),h.rotateX(d(l[0]),a.endrotM_X),h.rotateY(d(l[1]),a.endrotM_Y),h.rotateZ(d(l[2]),a.endrotM_Z));l=a.evaluator.eval(a.endpos)[0];a.endposM=a.endposM.setIdentity().translate({x:l[0],y:l[1],z:l[2]})};g.prototype.drawAux=function(a){};b.Macro3D=g;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c=Math.PI,h=2*c,l=Math.sqrt(3),d=Math.sin,k=Math.cos,g,n,f,m,p,e,u,v,w,q,r,y,x=function(c,d){a=d=b.Graphic3D.call(this,c,d)||this;a.width=a.width||c.evaluator.parser.parse("2");a.height=a.height||c.evaluator.parser.parse("2");a.length=a.length||c.evaluator.parser.parse("2");a.R=a.R||c.evaluator.parser.parse("2");a.r=a.r||c.evaluator.parser.parse("1");g=b.Vec4D;return d};$jscomp.inherits(x,b.Graphic3D);x.prototype.buildPrimitives=function(){a=this;
n=a.evaluator;a.updateMVMatrix();a.buildGeometry(n.eval(a.width),n.eval(a.height),n.eval(a.length),n.eval(a.Nu),n.eval(a.Nv));for(var c=a.color.getColor(),d=a.backcolor.getColor(),e=a.edges?a.edges.getColor():"",g=$jscomp.makeIterator(a.faces),k=g.next();!k.done;k=g.next()){k=k.value;f=[];k=$jscomp.makeIterator(k);for(var m=k.next();!m.done;m=k.next())f.push(a.transformVertex(a.V[m.value]));a.primitives.push(new b.Primitive3D({V:f,type:"face",frontColor:c,backColor:d,edges:e,model:a.model},a.space))}};
x.prototype.changeGeometry=function(a,b,c,d,e){return this.oldW===a&&this.oldH===b&&this.oldL===c&&this.oldNu===d&&this.oldNv===e};x.prototype.updateValues=function(a,b,c,d,e){this.oldW=a;this.oldH=b;this.oldL=c;this.oldNv=e;this.oldNu=d};var z=function(a,b){a=x.call(this,a,b)||this;a.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]];return a};$jscomp.inherits(z,x);z.prototype.buildGeometry=function(a,b,c,d,e){a/=2;b/=2;c/=2;this.changeGeometry(a,b,c,d,e)||(this.V=[new g(a,c,b),
new g(a,-c,b),new g(a,c,-b),new g(a,-c,-b),new g(-a,c,b),new g(-a,-c,b),new g(-a,c,-b),new g(-a,-c,-b)],this.updateValues(a,b,c,d,e))};var A=function(a,b){return z.call(this,a,b)||this};$jscomp.inherits(A,z);A.prototype.buildGeometry=function(a,b,c,d,e){b=a/l;z.prototype.buildGeometry.call(this,b,b,b,d,e)};var C=function(a,b){a=x.call(this,a,b)||this;a.faces=[[1,3,2],[0,1,2],[0,2,3],[0,3,1]];return a};$jscomp.inherits(C,x);C.prototype.buildGeometry=function(a,b,c,d,e){a/=2;if(!this.changeGeometry(a,
b,c,d,e)){var f=h/3,k=Math.cos(f),m=Math.sin(f);f=2*a*Math.sqrt(2)/3;var p=-a/3,l=f*k+0*m;k=-f*m+0*k;this.V=[new g(0,0,a),new g(l,k,p),new g(l,-k,p),new g(f,0,p)];this.updateValues(a,b,c,d,e)}};var H=function(a,b){a=x.call(this,a,b)||this;a.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]];return a};$jscomp.inherits(H,x);H.prototype.buildGeometry=function(a,b,c,d,e){a/=2;this.changeGeometry(a,b,c,d,e)||(this.V=[new g(0,0,a),new g(a,0,0),new g(-a,0,0),new g(0,a,0),new g(0,-a,
0),new g(0,0,-a)],this.updateValues(a,b,c,d,e))};var D=function(a,b){return x.call(this,a,b)||this};$jscomp.inherits(D,x);D.prototype.buildGeometry=function(a,b,e,f,l){a/=2;b/=2;e/=2;if(!this.changeGeometry(a,b,e,f,l)){this.V=[new g(0,0,b)];for(var q=1;q<f;q++){p=q*c/f;for(var n=0;n<l;n++)m=n*h/l,this.V.push(new g(a*d(p)*k(m),e*d(p)*d(m),b*k(p)))}this.V.push(new g(0,0,-b));this.faces=[];for(q=0;q<l;q++)this.faces.push([0,(q+1)%l+1,q%l+1]);for(q=1;q<f-1;q++)for(n=0;n<l;n++)this.faces.push([n+1+(q-
1)*l,(n+1)%l+1+(q-1)*l,(n+1)%l+1+q*l,n+1+q*l]);for(q=0;q<l;q++)this.faces.push([this.V.length-1,this.V.length-1-l+q,this.V.length-1-l+(q+1)%l]);this.updateValues(a,b,e,f,l)}};var F=function(a,b){return D.call(this,a,b)||this};$jscomp.inherits(F,D);F.prototype.buildGeometry=function(a,b,c,d,e){D.prototype.buildGeometry.call(this,a,a,a,d,e)};var G=function(a,b){a=x.call(this,a,b)||this;a.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]];return a};$jscomp.inherits(G,x);G.prototype.buildGeometry=function(a,d,e,f,k){a/=Math.PI;if(!this.changeGeometry(a,d,e,f,k)){v=a/1.6180339887;w=1.6180339887*a;this.V=[new g(a,a,a),new g(a,a,-a),new g(a,-a,a),new g(a,-a,-a),new g(-a,a,a),new g(-a,a,-a),new g(-a,-a,a),new g(-a,-a,-a),new g(0,v,w),new g(0,v,-w),new g(0,-v,w),new g(0,-v,-w),new g(v,w,0),new g(v,-w,0),new g(-v,w,0),new g(-v,-w,0),new g(w,0,v),new g(w,0,-v),new g(-w,
0,v),new g(-w,0,-v)];q=(new b.Mat4).setIdentity().rotateY(-c/6);for(var m=0,p=this.V.length;m<p;m++)this.V[m]=q.mulV4(this.V[m]);this.updateValues(a,d,e,f,k)}};var B=function(a,b){a=x.call(this,a,b)||this;a.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]];return a};$jscomp.inherits(B,x);B.prototype.buildGeometry=function(a,c,d,e,f){a/=3.8;if(!this.changeGeometry(a,c,d,e,
f)){w=1.6180339887*a;this.V=[new g(0,a,w),new g(0,a,-w),new g(0,-a,w),new g(0,-a,-w),new g(a,w,0),new g(a,-w,0),new g(-a,w,0),new g(-a,-w,0),new g(w,0,a),new g(w,0,-a),new g(-w,0,a),new g(-w,0,-a)];q=(new b.Mat4).setIdentity().rotateY(-1.0285);for(var k=0,m=this.V.length;k<m;k++)this.V[k]=q.mulV4(this.V[k]);this.updateValues(a,c,d,e,f)}};var I=function(a,b){return x.call(this,a,b)||this};$jscomp.inherits(I,x);I.prototype.buildGeometry=function(a,b,c,e,f){a/=2;b/=2;c/=2;if(!this.changeGeometry(a,b,
c,e,f)){this.V=[];for(var m=0;m<f;m++)for(var p=0;p<e;p++)this.V.push(new g(a*(f-m)/f*k(p*h/e),c*(f-m)/f*d(p*h/e),b-2*m*b/f));this.V.push(new g(0,0,-b));this.faces=[];for(m=0;m<f-1;m++)for(p=0;p<e;p++)this.faces.push([p+m*e,(p+1)%e+m*e,(p+1)%e+(m+1)*e,p+(m+1)*e]);for(m=0;m<e;m++)this.faces.push([this.V.length-1,this.V.length-1-e+m,this.V.length-1-e+(m+1)%e]);this.updateValues(a,b,c,e,f)}};var O=function(a,b){return x.call(this,a,b)||this};$jscomp.inherits(O,x);O.prototype.buildGeometry=function(a,
b,c,e,f){a/=2;b/=2;c/=2;if(!this.changeGeometry(a,b,c,e,f)){this.V=[];for(var m=0;m<f+1;m++)for(var p=0;p<e;p++)this.V.push(new g(a*k(p*h/e),c*d(p*h/e),b-2*m*b/f));this.faces=[];for(m=0;m<f;m++)for(p=0;p<e;p++)this.faces.push([p+m*e,(p+1)%e+m*e,(p+1)%e+(m+1)*e,p+(m+1)*e]);this.updateValues(a,b,c,e,f)}};var Q=function(a,b){return x.call(this,a,b)||this};$jscomp.inherits(Q,x);Q.prototype.buildGeometry=function(a,b,c,f,m){a/=2;b/=2;c/=2;e=n.eval(this.R);u=n.eval(this.r);if(!this.changeGeometry(a,b,c,
f,m)){this.V=[];for(var p=0;p<m+1;p++)for(var l=0;l<f;l++)this.V.push(new g(-(e+u*d(h*l/f))*d(h*p/m),(e+u*d(h*l/f))*k(h*p/m),u*k(h*l/f)));this.faces=[];for(p=0;p<m;p++)for(l=0;l<f;l++)this.faces.push([l+p*f,l+(p+1)*f,(l+1)%f+(p+1)*f,(l+1)%f+p*f]);this.updateValues(a,b,c,f,m)}};var K=function(c,d){c=x.call(this,c,d)||this;a.fileData=b.openFile(a.evaluator.eval(a.file)).split(/\r/);return c};$jscomp.inherits(K,x);K.prototype.buildGeometry=function(){this.V=[];this.faces=[];for(var a=0,b=this.fileData.length;a<
b;a++)r=this.fileData[a],r.startsWith("V")?(y=r.slice(2,-1).split(",").map(parseFloat),this.V.push(new g(y[0]||0,y[1]||0,y[2]||0))):r.startsWith("F")&&(y=r.slice(2,-1).split(",").map(parseInt),this.faces.push(y.reverse()))};b.OtherGeometry3D=x;b.Cube3D=A;b.Box3D=z;b.Tetrahedron3D=C;b.Octahedron3D=H;b.Sphere3D=F;b.Ellipsoid3D=D;b.Dodecahedron3D=G;b.Icosahedron3D=B;b.Cone3D=I;b.Cylinder3D=O;b.Torus3D=Q;b.Mesh3D=K;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=Math.max,c=Math.min,h=Math.PI,l=Math.cos,d=Math.sin,k=Math.abs,g=Math.round,n,f,m,p,e,u,v,w,q,r,y,x,z,A,C,H,D,F,G=function(a,b){this.x=void 0===a?0:a;this.y=void 0===b?0:b};G.prototype.set=function(a,b){this.x=void 0===a?0:a;this.y=void 0===b?0:b;return this};G.prototype.copy=function(){return new G(this.x,this.y)};G.prototype.ix=function(){return g(a(c(this.x,32E3),-32E3))};G.prototype.iy=function(){return g(a(c(this.y,32E3),-32E3))};G.prototype.equals=
function(a){return this.x===a.x&&this.y===a.y};G.prototype.norm2=function(){return this.x*this.x+this.y*this.y};G.prototype.norm=function(){return Math.sqrt(this.norm2())};G.prototype.distance=function(a){f=this.copy();f.sub(a);return f.norm()};G.prototype.dot=function(a){return this.x*a.x+this.y*a.y};G.prototype.det=function(a){return this.x*a.y-this.y*a.x};G.prototype.mul=function(a){this.x*=a;this.y*=a};G.prototype.div=function(a){this.x/=a;this.y/=a};G.prototype.add=function(a){this.x+=a.x;this.y+=
a.y};G.prototype.sub=function(a){this.x-=a.x;this.y-=a.y};G.prototype.normalize=function(){n=this.norm();0!=n&&this.div(n)};G.prototype.rotR90=function(){n=this.x;this.x=this.y;this.y=-n};G.prototype.rotL90=function(){n=this.x;this.x=-this.y;this.y=n};G.prototype.rot=function(a){m=this.copy();u=l(a);v=d(a);this.x=m.x*u-m.y*v;this.y=m.x*v+m.y*u};G.prototype.rot2=function(a){this.rot(a*h/180)};G.prototype.intersection=function(b,d,f,g){w=d.x-b.x;q=f.x-g.x;r=f.x-b.x;y=d.y-b.y;x=f.y-g.y;z=f.y-b.y;F=w*
x-q*y;return 1E-6<k(F)?(p=(r*x-z*q)/F,e=(-r*y+z*w)/F,0<=p&&1>=p&&0<=e&&1>=e?new G(b.x+w*p,b.y+y*p):null):(d.x-f.x)*z!=(d.y-f.y)*r?null:b.x!=d.x?(A=c(b.x,d.x),C=a(b.x,d.x),A<=f.x&&f.x<=C?f:A<=g.x&&g.x<=C?g:null):f.x!=g.x?(H=c(f.x,g.x),D=a(f.x,g.x),H<=b.x&&b.x<=D?b:H<=d.x&&d.x<=D?d:null):b.y!=d.y?(A=c(b.y,d.y),C=a(b.y,d.y),A<=f.y&&f.y<=C?f:A<=g.y&&g.y<=C?g:null):f.y!=g.y?(H=c(f.y,g.y),D=a(f.y,g.y),H<=b.y&&b.y<=D?b:H<=d.y&&d.y<=D?d:null):b.x==f.x&&b.y==f.y?b:null};b.R2=G;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,l,d,k,g,n,f,m=function(a,c){this.evaluator=a;this.constraint=c;/==|<|>|<=|>=/.test(this.constraint.value)&&(/</.test(this.constraint.value)?this.sign="<":/>/.test(this.constraint.value)?this.sign=">":this.sign="=",this.constraint=this.constraint.equalToMinus(),this.constraint=this.constraint.childs[0]);k=new b.R2(0,0);d=new b.R2(0,0);f=new b.R2(0,0)};m.prototype.getUnitNormal=function(){this.normal.normalize();return f.set(this.normal.x,this.normal.y)};
m.prototype.gradient=function(b){a=this.evaluator;k.x=0;k.y=0;g=a.getVariable("x");n=a.getVariable("y");a.setVariable("x",b.x);a.setVariable("y",b.y);this.f0=a.eval(this.constraint);a.setVariable("x",a.getVariable("x")+1E-6);c=a.eval(this.constraint);k.x=(c-this.f0)/1E-6;k.x=isNaN(k.x)?Infinity:k.x;a.setVariable("x",a.getVariable("x")-1E-6);a.setVariable("y",a.getVariable("y")+1E-6);c=a.eval(this.constraint);k.y=(c-this.f0)/1E-6;k.y=isNaN(k.y)?Infinity:k.y;a.setVariable("x",g);a.setVariable("y",n);
return k};m.prototype.findZero=function(b,c,f){a=this.evaluator;d.x=b.x;d.y=b.y;g=a.getVariable("x");n=a.getVariable("y");a.setVariable("x",b.x);a.setVariable("y",b.y);this.f0=a.eval(this.constraint);if("<"==this.sign&&0>=this.f0||">"==this.sign&&0<=this.f0)return d;a.setVariable("x",g);a.setVariable("y",n);for(var e=0;16>e;e++)if(h=d.x,l=d.y,this.normal=this.gradient(d),0!=this.normal.norm2()&&this.normal.mul(-this.f0/this.normal.norm2()),d.x=h+this.normal.x,d.y=l+this.normal.y,this.normal.norm()<
c)return 0===this.normal.x&&0===this.normal.y&&(this.normal.x=d.x-b.x,this.normal.y=d.y-b.y),d;return f?d:null};b.R2Newton=m;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=function(a,b){this.x=a;this.y=b};a.prototype.vLength=function(){return Math.sqrt(this.x*this.x+this.y*this.y)};a.prototype.dotProduct=function(a){return this.x*a.x+this.y*a.y};a.prototype.angleBetweenVectors=function(a){return Math.acos(this.dotProduct(a)/(this.vLength()*a.vLength()))};a.AXIS_X=new a(1,0);a.AXIS_Y=new a(0,1);b.Vector2D=a;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c=Math.floor,h=Math.round,l,d,k,g,n,f,m,p,e,u,v,w,q,r=function(c,d){a=this;a.parent=c;a.evaluator=c.evaluator;var e=a.parser=c.evaluator.parser;a.id="GraphicControl"!==d.type?"C":"G";a.region="south";a.x=a.y=0;a.w="Video"!==d.type?100:350;a.h="Video"!==d.type?23:120;a.keyboard=!1;a.kblayout="1x16";"GraphicControl"!==d.type&&"Audio"!==d.type&&"Video"!==d.type?"TextArea"!==d.type?a.expresion=e.parse("(0,0,100,23)"):(a.expresion=e.parse("(0,0,300,200)"),
a.w=300,a.h=200):a.expresion=e.parse("(0,0)");a.fixed=a.visible=!0;a.color=new b.Color("Scrollbar"==d.gui?"e0e4e8":"222222");a.colorInt="cc0022";"Scrollbar"==d.gui?a.colorInt="182C61":"GraphicControl"!==d.type&&(a.colorInt="f0f8ff");a.colorInt=new b.Color(a.colorInt);a.font_size=e.parse("0");a.type=a.gui=a.bold=a.italics=a.underlined=a.action=a.param=a.tooltip=a.Explanation=a.msg_pos=a.cID="";a.paramFont=a.tooltipFont=a.ExplanationFont="Monospace 12px";a.drawif=a.activeif=e.parse("1");a.valueExpr=
e.parse("0");a.decimals=e.parse("2");a.min=e.parse("-Infinity");a.max=e.parse("Infinity");a.incr=e.parse("0.1");a.discrete=a.exponentialif=!1;a.zIndex=-1;Object.assign(a,d);/Video|Audio/.test(a.type)&&(a.region="interior");void 0==a.name&&(a.name=2==a.parent.version?a.id:"_nada_");a.name=/_\._|_nada_|_void_/.test(a.name)?"":a.name;d=a.evaluator.eval(a.expresion)[0];a.x=h(d[0]);a.y=h(d[1]);4==d.length&&(a.w=h(d[2]),a.h=h(d[3]));a.actionExec=c.lessonParser.parseAction(a)};r.prototype.init=function(){};
r.prototype.update=function(){};r.prototype.draw=function(){};r.prototype.getContainer=function(){a=this;var b=a.parent.spaces;if("interior"===a.region)for(var c=$jscomp.makeIterator(b),d=c.next();!d.done;d=c.next()){if(d=d.value,d.id===a.spaceID)return d.addCtr(a),a.zIndex=d.zIndex,a.space=d,d.numCtrContainer}else{if("external"===a.region)return a.parent.externalSpace.addCtr(a),a.parent.externalSpace.container;if("scenario"===a.region)return a.cID?(a.expresion=a.evaluator.parser.parse("(0,-1000,"+
a.w+","+a.h+")"),a.parent.stage.stageSpace.addCtr(a),a.zIndex=a.parent.stage.stageSpace.zIndex,a.parent.stage.stageSpace.numCtrContainer):a.parent.externalSpace.container;if(/north|south|east|west/.test(a.region))return a.parent[a.region+"Space"].controls.push(a),a.parent[a.region+"Space"].container}b[0].addCtr(a);a.zIndex=b[0].zIndex;return b[0].numCtrContainer};r.prototype.addControlContainer=function(a){this.getContainer().appendChild(a)};r.prototype.updatePositionAndSize=function(){a=this;k=g=
n=f=!1;m=a.evaluator.eval(a.expresion)[0];p=h(m[0]);k=h(a.x)!==p;a.x=p;p=h(m[1]);g=h(a.y)!==p;a.y=p;4===m.length&&(p=h(m[2]),n=h(a.w)!==p,a.w=p,p=h(m[3]),f=h(a.h)!==p,a.h=p);if(n||f||k||g)a.init(!0,!0),a.draw()};r.prototype.formatValue=function(b){a=this;q=a.parent;e=b+"";u=a.evaluator.eval(a.decimals);v=e.indexOf(".");-1!=v&&(w=e.substring(v+1),w.length>u&&(e=parseFloat(e).toFixed(u)));a.fixed&&(2!==q.version||2===q.version&&!a.exponentialif)&&(e=parseFloat(b).toFixed(u));a.exponentialif&&0!=parseFloat(e)&&
(e=a.fixed&&2!==q.version?parseFloat(e).toExponential(u):parseFloat(e).toExponential(),e=e.toUpperCase().replace("+",""));return e.replace(".",q.decimal_symbol)};r.prototype.updateAndExecAction=function(){q=this.parent;q.updateControls();"init"===this.action&&(this.click=!1);this.actionExec.execute();q.updateControls();"animate"!==this.action&&q.update();q.updateControls()};r.prototype.createGradient=function(a,b){this.linearGradient=this.ctx.createLinearGradient(0,0,0,b);l=b*b;for(a=0;a<b;a++)d=
c(a-35*b*.01),this.linearGradient.addColorStop(a/b,"rgba(0,0,0,"+d*d*192/l/255+")")};b.Control=r;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c=/[\w\.\-//]*(\.gif)/gi,h=/CanvasGradient|CanvasPattern/,l=Math.floor,d=Math.abs,k,g,n,f,m,p,e,u,v,w,q,r,y,x,z,A,C,H,D,F,G,B,I,O,Q,K,P,N,E,L,J,M,U,Y,W,T,R=function(c,d){var e;a=e=b.Control.call(this,c,d)||this;a.imageSrc=d.imageSrc||"";a.image=d.image||new Image;a.imageOver=d.imageOver||new Image;a.imageDown=d.imageDown||new Image;a.flat=d.flat||!1;a.borderColor=d.borderColor||!1;a.text_align=d.text_align||"center_center";a.image_align=d.image_align||
"center_center";a.font_family=b.getFontName(d.font_family||"arial");a.ratio=c.ratio;-1===a.font_size&&(a.noFSize=!0);a.borderColor&&(a.borderColor=new b.Color(a.borderColor));a.text_align=a.text_align.split("_");a.image_align=a.image_align.split("_");a.oName=a.name;/^\[.*\]$/.test(a.name)?a.name=a.parser.parse(a.name.slice(1,-1)):a.name=a.parser.parse("'"+a.name+"'");a.classContainer=a.cssClass?" "+a.cssClass+" ":"";a.extra_style=a.extra_style||"";/^_STYLE_/.test(a.imageSrc.trim())&&(a.imageSrc="vacio.gif",
a.extra_style=a.imageSrc.trim().substring(8));if(a.extra_style){a.customStyle=!0;a.btnStyle=[];a.conStyle=[];a.conStyle.textBorder=3;var f;c=$jscomp.makeIterator(a.extra_style.split("|"));for(d=c.next();!d.done;d=c.next()){d=(f=d.value.trim().match(/(.*)=(.*)/))?f[1].trim():"";f=f?f[2].trim():"";var g=f.match(/rgb/g)?"":"#";"class"===d?a.classContainer=" "+f:"border"===d?(a.btnStyle.push({type:"border-style",value:"solid"}),a.btnStyle.push({type:"border-width",value:f+"px"})):"borderRadius"===d?(a.btnStyle.push({type:"border-radius",
value:f+"px"}),a.conStyle.push({type:"border-radius",value:f+"px"})):"borderColor"===d?a.btnStyle.push({type:"border-color",value:g+f}):/^(overColor|downColor|inactiveColor|inactiveColorBorder|shadowTextColor|shadowBoxColor|shadowInsetBoxColor)$/.test(d)?a.conStyle[d]=g+f:"font"===d?a.conStyle[d]=f.toLowerCase():/^(shadowTextBlur|shadowTextOffsetX|shadowTextOffsetY|shadowBoxBlur|shadowBoxOffsetX|shadowBoxOffsetY|shadowInsetBoxBlur|shadowInsetBoxOffsetX|shadowInsetBoxOffsetY|textBorder)$/.test(d)?
a.conStyle[d]=parseFloat(f)||0:/^(imgSizeW|imgSizeH)$/.test(d)?a[d]=parseFloat(f)||0:"flat"===d&&(a[d]=1==parseInt(f))}}a.imageSrc.startsWith("_COLORES_")&&(c=a.imageSrc.split("_"),a.colorInt=new b.Color(c[2]),a.color=new b.Color(c[3]),a.font_size=a.parser.parse(c[5]),a.imageSrc="");/^\[.*\]$/.test(a.imageSrc)?a.imageSrc=a.parser.parse(a.imageSrc.slice(1,-1)):a.imageSrc=a.parser.parse("'"+a.imageSrc+"'");c=a.evaluator.eval(a.imageSrc).toString().trim();if(""!=c)if(L=c.substr(0,c.lastIndexOf(".")),
J=c.substr(c.lastIndexOf(".")),c.match(/vacio.gif$/i))e.imageSrc=e.parser.parse("'vacio.gif'"),e.image.ready=1,3===e.parent.version&&(e.name=e.parser.parse("")),e.emptyImage={ready:!0},e.parser.parse("'vacio.gif'");else if(e.image=e.parent.getImage(c),L)try{e.imageOver=e.parent.getImage(L+"_over"+J),e.imageDown=e.parent.getImage(L+"_down"+J)}catch(ca){}a.container=b.newHTML("div",{class:"DescartesButtonContainer"+a.classContainer,id:a.id,style:"width:"+a.w+"px;height:"+a.h+"px;left:"+a.x+"px;top:"+
a.y+"px;z-index:"+a.zIndex+";"});a.btn=b.newHTML("canvas",{width:a.w*a.ratio,height:a.h*a.ratio,style:"position:absolute;left:0;top:0;width:"+a.w+"px;height:"+a.h+"px;"});a.ctx=a.btn.getContext("2d");a.ctx.imageSmoothingEnabled=!1;a.tooltip&&(a.btn.title=a.tooltip);a.container.appendChild(a.btn);a.addControlContainer(a.container);a.addEvents();a.init();return e};$jscomp.inherits(R,b.Control);R.prototype.init=function(c){a=this;k=a.evaluator;F=a.container;g=a.btn;n=a.ctx;f=k.eval(a.expresion)[0];a.x=
f[0];a.y=f[1];4==f.length&&(a.w=parseInt(f[2]),a.h=parseInt(f[3]));g.width=a.w*a.ratio;g.height=a.h*a.ratio;g.setAttribute("style","position:absolute;left:0;top:0;width:"+a.w+"px;height:"+a.h+"px;box-sizing:border-box;");F.setAttribute("style","width:"+a.w+"px;height:"+a.h+"px;left:"+a.x+"px;top:"+a.y+"px;z-index:"+a.zIndex+";display:block;");if(a.btnStyle)for(var d=$jscomp.makeIterator(a.btnStyle),e=d.next();!e.done;e=d.next())e=e.value,g.style[e.type]=e.value;if(a.conStyle){d=$jscomp.makeIterator(a.conStyle);
for(e=d.next();!e.done;e=d.next())e=e.value,F.style[e.type]=e.value;a.conStyle.shadowBoxColor&&(F.style.boxShadow=(a.conStyle.shadowBoxOffsetX||0)+"px "+(a.conStyle.shadowBoxOffsetY||2)+"px "+(a.conStyle.shadowBoxBlur||2)+"px 1px "+a.conStyle.shadowBoxColor);a.conStyle.shadowInsetBoxColor&&(g.style.boxShadow=(a.conStyle.shadowInsetBoxOffsetX||0)+"px "+(a.conStyle.shadowInsetBoxOffsetY||-2)+"px "+(a.conStyle.shadowInsetBoxBlur||1)+"px 1px "+a.conStyle.shadowInsetBoxColor+" inset")}a.noFSize&&(a.font_size=
k.parser.parse(b.getFieldFontSize(this.h)+""));a.fs_evaluated=k.eval(a.font_size);a.createGradient(a.w,a.h);F.style.display=0<k.eval(a.drawif)?"block":"none";n.lineJoin="round";n.font=a.italics+" "+a.bold+" "+a.fs_evaluated+"px "+a.font_family;a.text_object=new b.TextObject({parent:{decimal_symbol:a.parent.decimal_symbol},evaluator:k,decimals:a.decimals,fixed:!1,align:"left",anchor:"center_center",width:a.parser.parse("0"),font_size:a.font_size,font_family:a.font_family,italics:a.italics,bold:a.bold,
border:a.borderColor,border_size:a.conStyle?a.conStyle.textBorder:void 0,shadowBlur:a.conStyle&&a.conStyle.shadowTextColor?a.conStyle.shadowTextBlur||1:void 0,shadowOffsetX:a.conStyle&&a.conStyle.shadowTextColor?a.conStyle.shadowTextOffsetX||0:void 0,shadowOffsetY:a.conStyle&&a.conStyle.shadowTextColor?a.conStyle.shadowTextOffsetY||2:void 0,shadowColor:a.conStyle&&a.conStyle.shadowTextColor?a.conStyle.shadowTextColor:void 0},a.oName);a.draw(c)};R.prototype.update=function(){a=this;k=a.evaluator;F=
a.container;a.activeIfValue=0<k.eval(a.activeif);a.drawIfValue=0<k.eval(a.drawif);(a.space?a.space.drawIfValue:1)&&a.drawIfValue?(F.style.display="block",a.draw(),F.style.cursor=a.btn.style.cursor=a.activeIfValue?"pointer":"not-allowed",F.setAttribute("active",a.activeIfValue),a.updatePositionAndSize()):(F.style.display="none",a.buttonClick=!1)};R.prototype.draw=function(d){a=this;F=a.container;k=a.evaluator;g=a.btn;n=a.ctx;p=k.eval(a.name);a.text_object.draw(b.ctx,"#000000",0,0);p=a.text_object.textNodes.toStr();
e=a.evaluator.eval(a.imageSrc).toString().trim();if(!d&&(G=a.over===a.oldOver,B=a.buttonClick===a.oldButtonClick,I=a.activeIfValue===a.oldActiveIfValue,O=a.drawIfValue===a.oldDrawIfValue,Q=p===a.oldName,K=e===a.oldImageSrc,P=a.colorInt.getColor()===a.oldBackColor,N=a.color.getColor()===a.oldTextColor,E=a.image.ready===a.oldImageReady,a.oldOver=a.over,a.oldButtonClick=a.buttonClick,a.oldActiveIfValue=a.activeIfValue,a.oldDrawIfValue=a.drawIfValue,a.oldName=p,a.oldImageSrc=e,a.oldBackColor=a.colorInt.getColor(),
a.oldTextColor=a.color.getColor(),a.oldImageReady=a.image.ready,G&&B&&I&&O&&Q&&K&&P&&N&&E))return;n.save();n.setTransform(a.ratio,0,0,a.ratio,0,0);m=a.fs_evaluated;F.setAttribute("data-name",p);e?(u="vacio.gif"===e?this.emptyImage:this.parent.getImage(e),L=e.substr(0,e.lastIndexOf(".")),J=e.substr(e.lastIndexOf(".")),M=L+"_over"+J,U=L+"_down"+J,Y="vacio.gif"===e?this.emptyImage:this.parent.getImage(M),W="vacio.gif"===e?this.emptyImage:this.parent.getImage(U)):u=Y=W=a.emptyImg;n.clearRect(0,0,a.w,
a.h);w=q=a.buttonClick?1:0;a.text_object.draw(n,a.color.getColor(),0,0,!0);r=a.text_object.textNodes.metrics.w;y=a.text_object.textNodes.metrics.h;"center"==a.text_align[1]?H=l(a.w/2+w)-.5:"left"==a.text_align[1]?H=r/2+5+w:"right"==a.text_align[1]&&(H=a.w-r/2+w-5);"center"==a.text_align[0]?D=l(a.h/2+q)-.5:"top"==a.text_align[0]?D=y/2+q+4:"bottom"==a.text_align[0]&&(D=a.h-y/2+q-3);if(u){if(x=a.imgSizeW||u.width,z=a.imgSizeH||u.height,"center"==a.image_align[1]?A=parseInt((a.w-x)/2)+w:"left"==a.image_align[1]?
A=w:"right"==a.image_align[1]&&(A=a.w-x+w),"center"==a.image_align[0]?C=parseInt((a.h-z)/2)+q:"top"==a.image_align[0]?C=q:"bottom"==a.image_align[0]&&(C=a.h-z+q),u&&u.ready)if(u!==a.emptyImg&&u.complete)if(e.match(c))g.style.backgroundRepeat="no-repeat",g.style.backgroundImage="url('"+e+"')",g.style.backgroundPosition=A+"px "+C+"px";else{if("center"!=a.image_align[0]||"center"!=a.image_align[1])(T=a.colorInt.getColor())&&h.test(T.constructor.name)?(n.fillStyle=T,n.fillRect(0,0,a.w,a.h)):F.style.backgroundColor=
T;n.drawImage(u,0,0,u.width,u.height,A,C,x,z)}else a.emptyImg&&a.customStyle&&((T=a.colorInt.getColor())&&h.test(T.constructor.name)?(n.fillStyle=T,n.fillRect(0,0,a.w,a.h)):F.style.backgroundColor=T)}else(T=a.colorInt.getColor())&&h.test(T.constructor.name)?(n.fillStyle=T,n.fillRect(0,0,a.w,a.h)):(F.style.backgroundColor=T,a.flat||(a.buttonClick||(a.drawLine(n,a.w-1,0,a.w-1,a.h,"rgba(0,0,0,0.5)"),a.drawLine(n,0,0,0,a.h,"rgba(0,0,0,0.09)"),a.drawLine(n,1,0,1,a.h,"rgba(0,0,0,0.03)")),n.fillStyle=a.linearGradient,
n.fillRect(0,0,a.w,a.h)));a.activeIfValue&&(Y!==a.emptyImg&&a.over&&Y.ready&&Y.complete?M.match(c)?(g.style.backgroundImage="url('"+M+"')",g.style.backgroundPosition=A+"px "+C+"px"):n.drawImage(Y,A,C):a.customStyle&&a.conStyle.overColor&&a.over&&(F.style.backgroundColor=a.conStyle.overColor));a.activeIfValue?W!==a.emptyImg&&a.buttonClick&&W.ready&&W.complete?U.match(c)?(g.style.backgroundImage="url('"+U+"')",g.style.backgroundPosition=A+"px "+C+"px"):n.drawImage(W,A,C):a.customStyle&&a.conStyle.downColor&&
a.buttonClick&&(F.style.backgroundColor=a.conStyle.downColor):a.buttonClick&&!u&&(n.fillStyle="rgba(0,0,0,0.09)",n.fillRect(0,0,a.w,a.h));n.fillStyle=a.color.getColor();a.customStyle&&a.conStyle.shadowTextColor&&0<a.conStyle.textBorder&&(n.lineWidth=a.conStyle.textBorder,n.strokeStyle=a.conStyle.shadowTextColor);a.borderColor&&(n.lineWidth=parseInt(m/6),n.strokeStyle=a.borderColor.getColor());a.text_object.draw(n,a.color.getColor(),H,D);a.underlined&&(n.strokeStyle=a.color.getColor(),n.lineWidth=
l(.1*m)||2,n.lineCap="round",n.beginPath(),n.moveTo(H-r/2+w,D+l(m/2)+l(m/5)-1.5),n.lineTo(H+r/2+w,D+l(m/2)+l(m/5)-1.5),n.stroke());a.activeIfValue||(a.customStyle&&a.conStyle.inactiveColor?F.style.backgroundColor=a.conStyle.inactiveColor:(n.fillStyle="rgba(240,240,240,0.6)",n.fillRect(0,0,a.w,a.h)));n.restore();a._image_pos_x=A;a._image_pos_y=C};R.prototype.drawLine=function(a,b,c,d,e,f,g){a.lineWidth=void 0===g?1:g;a.strokeStyle=void 0===f?"black":f;v=a.lineWidth%2*.5;a.beginPath();a.moveTo(l(b)+
v,l(c)+v);a.lineTo(l(d)+v,l(e)+v);a.stroke()};R.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)};R.prototype.addEvents=function(){function a(c,d,g){b.clearTimeout(f);e.buttonClick&&e.drawIfValue&&e.activeIfValue&&(d.call(e),c=g?c:100,f=b.setTimeout(function(){a(c,d,!1)},c))}function c(c){e.parent.deactivateControls();this.focus();c.preventDefault();c.stopPropagation();
document.activeElement!=document.body&&document.activeElement.blur();e.whichBtn=b.whichBtn(c);"L"==e.whichBtn&&e.activeIfValue&&(e.buttonClick=!0,e.draw(),"calculate"==e.action&&(e.evaluator.setVariable(e.id,e.evaluator.eval(e.valueExpr)),a(1E3,e.updateAndExecAction,!0)),e.btn.removeEventListener("touchend",d),e.btn.addEventListener("touchend",d),e.btn.removeEventListener("mouseup",d),e.btn.addEventListener("mouseup",d))}function d(a){b.newBlobContent=null;this.focus();a.preventDefault();a.stopPropagation();
e.activeIfValue||e.buttonClick?(e.buttonClick=!1,e.draw(),"calculate"!=e.action&&(e.evaluator.setVariable(e.id,e.evaluator.eval(e.valueExpr)),e.updateAndExecAction()),e.btn.removeEventListener("touchend",d),e.btn.removeEventListener("mouseup",d)):e.parent.update()}var e=this,f;this.over=this.buttonClick=!1;this.btn.addEventListener("touchstart",c);this.btn.addEventListener("mousedown",c);this.btn.addEventListener("mouseover",function(a){a.preventDefault();a.stopPropagation();e.over=!0;e.draw()});
this.btn.addEventListener("mouseout",function(a){b.newBlobContent=null;a.preventDefault();a.stopPropagation();e.over=!1;e.buttonClick=!1;e.draw()});document.addEventListener("visibilitychange",function(a){b.newBlobContent=null;e.buttonClick=!1})};b.Button=R;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,l,d,k,g,n,f,m,p,e,u,v,w,q=function(c,d){a=d=b.Control.call(this,c,d)||this;a.flat=a.image_dec_src&&a.image_inc_src;a.btn_pos=a.btn_pos||"v_left";a.horizontal="h_left"===a.btn_pos||"h_right"===a.btn_pos||"h_left_right"===a.btn_pos;a.label_color=a.label_color||new b.Color("e0e4e8",c.evaluator);a.label_text_color=a.label_text_color||new b.Color("000000",c.evaluator);a.tabindex=++c.tabindex;a.name_str=a.name;a.initial_value=0;try{a.initial_value=
a.evaluator.eval(a.parser.parse(a.valueExprString))}catch(x){console.log(x)}/^&squot;.*&squot;$/.test(a.name)&&(a.name=a.name.replace("&squot;","\\u0027"));/^\[.*\]$/.test(a.name)?a.name=a.parser.parse(a.name.slice(1,-1)):a.name=a.parser.parse("'"+a.name+"'");a.container=b.newHTML("div",{class:"DescartesSpinnerContainer",id:a.id});a.divUp=b.newHTML("div",{class:"DJS_Up"});a.divDown=b.newHTML("div",{class:"DJS_Down"});a.field=b.newHTML("input",{type:"text",id:a.id+"_spinner",class:"DescartesSpinnerField",
tabindex:a.tabindex});a.label=b.newHTML("canvas",{class:"DescartesSpinnerLabel"});a.label_ctx=a.label.getContext("2d");a.ratio=c.ratio;a.container.appendChild(a.label);a.container.appendChild(a.field);a.container.appendChild(a.divUp);a.container.appendChild(a.divDown);a.cover=b.newHTML("div",{class:"TextfieldCover"});a.keyboard&&a.visible&&a.container.appendChild(a.cover);a.addControlContainer(a.container);e=a.evaluator.parser.parse("1");a.originalIncr=a.incr;if(0>a.evaluator.eval(a.decimals)||0===
a.evaluator.eval(a.incr))c=a.evaluator.eval(a.incr),0<c?a.originalIncr=a.incr=a.evaluator.parser.parse(parseInt(c).toString()):a.incr=e;a.image_dec_src&&(/^\[.*\]$/.test(a.image_dec_src)?a.image_dec_src=a.parser.parse(a.image_dec_src.slice(1,-1)):a.image_dec_src=a.parser.parse("'"+a.image_dec_src+"'"),a.old_image_dec_src=a.evaluator.eval(a.image_dec_src).toString().trim(),a.image_dec=a.parent.getImage(a.old_image_dec_src));a.image_inc_src&&(/^\[.*\]$/.test(a.image_inc_src)?a.image_inc_src=a.parser.parse(a.image_inc_src.slice(1,
-1)):a.image_inc_src=a.parser.parse("'"+a.image_inc_src+"'"),a.old_image_inc_src=a.evaluator.eval(a.image_inc_src).toString().trim(),a.image_inc=a.parent.getImage(a.old_image_inc_src));a.addEvents();a.init();return d};$jscomp.inherits(q,b.Control);q.prototype.init=function(d,e){a=this;c=a.evaluator;a.label.innerHTML=c.eval(a.name).toString();d=a.label.textContent;e||(a.value=a.validateValue(c.eval(a.valueExpr)));e=a.formatValue(a.value);a.fieldFontSize=0<c.eval(a.font_size)?c.eval(a.font_size):b.getFieldFontSize(a.h);
a.text_object=new b.TextObject({parent:{decimal_symbol:a.parent.decimal_symbol},evaluator:c,decimals:a.decimals,fixed:!1,align:"left",anchor:"center_center",width:a.parser.parse("0"),font_size:a.parser.parse(""+a.fieldFontSize),font_family:a.font_family,italics:a.italics,bold:a.bold},a.name_str);a.text_object.draw(a.label_ctx,a.label_text_color.getColor(),0,0,!0);var f=2!==a.parent.version?"__":"_____",g=b.getTextWidth(e+"_",a.fieldFontSize+"px "+b.sansserif_font);if(a.horizontal){var m=parseInt(a.h),
k=parseInt(a.w/2-m);f=a.text_object.textNodes.metrics.w+parseInt(a.fieldFontSize);a.visible||(k=a.w-2*m,g=0);k<f&&(k=f);""==d&&(k=0);a.w-k-m<g&&(k=a.w-m-g);0>k&&(k=0);d=a.w-(k+2*m);a.container.setAttribute("style","width:"+a.w+"px;height:"+a.h+"px;left:"+a.x+"px;top:"+a.y+"px;z-index:"+a.zIndex+";background-color:transparent;");a.divUp.setAttribute("style","width:"+m+"px;height:"+m+"px;"+("h_left"===a.btn_pos?"left:"+(k+m):"right:0")+"px;top:0;"+(a.flat?"border-width:0;":""));a.divDown.setAttribute("style",
"width:"+m+"px;height:"+m+"px;left:"+(k+("h_right"===a.btn_pos?d:0))+"px;top:0;"+(a.flat?"border-width:0;":""));a.field.setAttribute("style","font-family:"+b.sansserif_font+";font-size:"+a.fieldFontSize+"px;width:"+d+"px;height:"+a.h+"px;left:"+(m+k+("h_left"===a.btn_pos?m:"h_right"===a.btn_pos?-m:0))+"px;text-align:center;");a.cover.setAttribute("style","width:"+d+"px;height:"+a.h+"px;left:"+(m+k+("h_left"===a.btn_pos?m:"h_right"===a.btn_pos?-m:0))+"px;text-align:center;");a.field.value=e;a.visible||
(a.field.style.display="none");a.label.setAttribute("style","font-size:"+a.fieldFontSize+"px;width:"+k+"px;height:"+a.h+"px;line-height:"+a.h+"px;background-color:"+a.label_color.getColor()+";color:"+a.label_text_color.getColor()+";");a.label.width=k*a.ratio}else m=2+parseInt(a.h/2),k=parseInt(a.w/2-m/2),f=b.getTextWidth(d+f,a.fieldFontSize+"px "+b.sansserif_font),a.visible||(k=a.w-m,g=0),k<f&&(k=f),""==d&&(k=0),a.w-k-m<g&&(k=a.w-m-g),0>k&&(k=0),d=a.w-(k+m),a.container.setAttribute("style","width:"+
a.w+"px;height:"+a.h+"px;left:"+a.x+"px;top:"+a.y+"px;z-index:"+a.zIndex+";background-color:transparent;"),g="width:"+m+"px;left:"+(k+("v_right"===a.btn_pos?d:0))+"px;",a.divUp.setAttribute("style",g+";height:"+(a.h/2+1)+"px;top:0;"+(a.flat?"border-width:0;":"")),a.divDown.setAttribute("style",g+";height:"+(a.h/2-1)+"px;top:"+(a.h/2+1)+"px;"+(a.flat?"border-width:0;":"")),a.field.setAttribute("style","font-family:"+b.sansserif_font+";font-size:"+a.fieldFontSize+"px;width:"+d+"px;height:"+a.h+"px;left:"+
(("v_left"===a.btn_pos?m:0)+k)+"px;"),a.cover.setAttribute("style","width:"+d+"px;height:"+a.h+"px;left:"+(("v_left"===a.btn_pos?m:0)+k)+"px;"),a.field.value=e,a.visible||(a.field.style.display="none"),a.label.setAttribute("style","font-size:"+a.fieldFontSize+"px;width:"+k+"px;height:"+a.h+"px;line-height:"+a.h+"px;background-color:"+a.label_color.getColor()+";color:"+a.label_text_color.getColor()+";"),a.label.width=k*a.ratio;a.label.height=a.h*a.ratio;a.image_dec&&a.image_dec.ready&&(a.divDown.style["background-image"]=
"url("+a.image_dec.src+")");a.image_inc&&a.image_inc.ready&&(a.divUp.style["background-image"]="url("+a.image_inc.src+")");a.divUp.setAttribute("horizontal",a.horizontal);a.divDown.setAttribute("horizontal",a.horizontal);c.setVariable(a.id,a.value)};q.prototype.update=function(){a=this;c=a.evaluator;0>c.eval(a.decimals)?(h=c.eval(a.incr),0<h?a.originalIncr=a.incr=c.parser.parse(parseInt(h).toString()):a.incr=e):a.incr=0!==c.eval(a.originalIncr)?a.originalIncr:e;a.activeIfValue=0<c.eval(a.activeif);
a.drawIfValue=0<c.eval(a.drawif);a.field.disabled=!a.activeIfValue;a.divUp.setAttribute("active",!a.field.disabled);a.divDown.setAttribute("active",!a.field.disabled);a.drawIfValue?(a.updateStyle(),a.container.style.display="block"):(a.click=!1,a.container.style.display="none");a.image_dec&&(u=a.evaluator.eval(a.image_dec_src).toString().trim(),a.old_image_dec_src!==u&&(a.divDown.style["background-image"]="url("+u+")",a.old_image_dec_src=u));a.image_inc&&(v=a.evaluator.eval(a.image_inc_src).toString().trim(),
a.old_image_inc_src!==v&&(a.divUp.style["background-image"]="url("+v+")",a.image_inc_src=v));a.updatePositionAndSize();a.parent.animation.playing&&document.activeElement==a.field||(l=a.field.value,d=a.value,a.value=a.validateValue(c.getVariable(a.id)),a.field.value=a.formatValue(a.value),a.value==d&&a.field.value!=l&&(a.value=a.validateValue(l),a.field.value=a.formatValue(a.value)),c.setVariable(a.id,a.value));a.label_ctx.setTransform(a.ratio,0,0,a.ratio,0,0);a.text_object.draw(a.label_ctx,a.label_text_color.getColor(),
0,0);a.label_ctx.clearRect(0,0,a.label.width,a.label.height);(w=a.label_color.getColor())&&/CanvasGradient|CanvasPattern/.test(w.constructor.name)&&(a.label_ctx.fillStyle=w,a.label_ctx.fillRect(0,0,a.label_ctx.canvas.width,a.label_ctx.canvas.height));a.text_object.textNodes.metrics.w>a.label.width/a.ratio?(a.text_object.anchor="center_left",a.text_object.draw(a.label_ctx,a.label_text_color.getColor(),5,a.label.height/a.ratio/2)):(a.text_object.anchor="center_center",a.text_object.draw(a.label_ctx,
a.label_text_color.getColor(),a.label.width/a.ratio/2,a.label.height/a.ratio/2));a.label_ctx.setTransform(1,0,0,1,0,0)};q.prototype.updateStyle=function(){a=this;a.divUp.style.borderStyle=a.up?"inset":"outset";a.divUp.style.borderColor=a.up?"gray":"#f0f8ff";a.divUp.style.backgroundColor=a.up?"#bfbfbf":"";a.divUp.style.backgroundColor=a.flat?"transparent":a.divUp.style.backgroundColor;a.divUp.style.backgroundPosition=a.up?"calc(50% + 1px) calc(50% + 1px)":"center";a.divDown.style.borderStyle=a.down?
"inset":"outset";a.divDown.style.borderColor=a.down?"gray":"#f0f8ff";a.divDown.style.backgroundColor=a.down?"#bfbfbf":"";a.divDown.style.backgroundColor=a.flat?"transparent":a.divDown.style.backgroundColor;a.divDown.style.backgroundPosition=a.down?"calc(50% + 1px) calc(50% + 1px)":"center"};q.prototype.validateValue=function(a){c=this.evaluator;isNaN(parseFloat(a))||a.toString().includes("e")&&(a=parseFloat(a).toFixed(20));a=void 0!=a?a.toString():"0";a=a.replace(this.parent.decimal_symbol,".");k=
a==parseFloat(a)?parseFloat(a):parseFloat(c.eval(c.parser.parse(a)));isNaN(k)&&(k=0);f=c.eval(this.min);m=c.eval(this.max);""===f&&(f=-Infinity);""===m&&(m=Infinity);k=Math.min(Math.max(k,f),m);this.discrete&&(g=c.eval(this.incr),k=0==g?0:this.initial_value+g*Math.round((k-this.initial_value)/g));n=c.eval(this.decimals);0>=n&&(n=0);return k=parseFloat(parseFloat(k).toFixed(n))};q.prototype.increase=function(){this.changeValue(parseFloat(this.value)+this.evaluator.eval(this.incr))};q.prototype.decrease=
function(){this.changeValue(parseFloat(this.value)-this.evaluator.eval(this.incr))};q.prototype.changeValue=function(a){this.activeIfValue&&(this.value=this.validateValue(a),this.field.value=this.formatValue(this.value),this.evaluator.setVariable(this.id,this.value),this.updateAndExecAction())};q.prototype.addEvents=function(){function a(c,d,e){b.clearTimeout(m);if(g.up||g.down)d.call(g),c=e?c:10,m=b.setTimeout(function(){a(c,d)},c)}function c(c){c.preventDefault();g.whichBtn=b.whichBtn(c);"L"==g.whichBtn&&
g.activeIfValue&&(g.up=!0,a(k,g.increase,!0))}function d(c){c.preventDefault();g.whichBtn=b.whichBtn(c);"L"==g.whichBtn&&g.activeIfValue&&(g.down=!0,a(k,g.decrease,!0))}function e(a){g.up=!1;b.clearTimeout(m);g.updateStyle()}function f(a){g.down=!1;b.clearTimeout(m);g.updateStyle()}p=b.hasTouchSupport;var g=this,k=p?500:200,m;g.label.addEventListener("touchstart",b.preventDefault);g.label.addEventListener("mousedown",b.preventDefault);g.field.addEventListener("keydown",function(a){13==a.keyCode&&
g.changeValue(g.field.value)});g.divUp.addEventListener("touchstart",c);g.divUp.addEventListener("mousedown",c);g.divDown.addEventListener("touchstart",d);g.divDown.addEventListener("mousedown",d);g.divUp.addEventListener("mouseout",function(a){g.up=!1;b.clearTimeout(m);a.preventDefault();g.updateStyle()});g.divDown.addEventListener("mouseout",function(a){g.down=!1;b.clearTimeout(m);a.preventDefault();g.updateStyle()});g.divUp.addEventListener("touchend",e);window.addEventListener("touchend",e);g.divUp.addEventListener("mouseup",
e);window.addEventListener("mouseup",e);g.divDown.addEventListener("touchend",f);window.addEventListener("touchend",f);g.divDown.addEventListener("mouseup",f);window.addEventListener("mouseup",f);document.addEventListener("visibilitychange",function(a){g.up=g.down=!1;b.clearTimeout(m);g.updateStyle()});g.field.addEventListener("blur",function(a){g.drawIfValue&&g.changeValue(g.field.value,!0)});g.field.addEventListener("click",function(a){this.focus()});g.cover.addEventListener("click",function(a){a=
g.evaluator.eval(g.kbexp);g.activeIfValue&&g.parent.keyboard.show(g,g.kblayout,a[0][0]||0,a[0][1]||0,g.id,g.field,g.onlyText)})};b.Spinner=q;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,l=function(c,k){var d;a=d=b.Control.call(this,c,k)||this;a.label_color=a.label_color||new b.Color("e0e4e8",c.evaluator);a.label_text_color=a.label_text_color||new b.Color("000000",c.evaluator);a.typeCtr="checkbox";a.pressed=k.pressed||!1;a.radio_group=(k.radio_group||"").trim();""!==a.radio_group&&(a.typeCtr="radio");a.name_str=a.name;/^&squot;.*&squot;$/.test(a.name)&&(a.name=a.name.replace("&squot;","\\u0027"));/^\[.*\]$/.test(a.name)?a.name=
a.parser.parse(a.name.slice(1,-1)):a.name=a.parser.parse("'"+a.name.trim()+"'");a.tabindex=++c.tabindex;a.containerControl=b.newHTML("div",{class:"DescartesCheckboxContainer",id:a.id});a.checkbox=b.newHTML("input",{type:a.typeCtr,id:a.id+a.typeCtr,class:"DescartesCheckbox",tabindex:a.tabindex});""!==a.radio_group&&a.checkbox.setAttribute("name",a.radio_group);a.checkbox.internalID=a.id;a.label=b.newHTML("canvas",{class:"DescartesCheckboxLabel"});a.label_ctx=a.label.getContext("2d");a.ratio=c.ratio;
a.dummyLabel=b.newHTML("label",{"for":a.id+a.typeCtr});a.value=a.evaluator.eval(a.valueExpr);a.evaluator.setVariable(a.id,a.value);a.containerControl.appendChild(a.label);a.containerControl.appendChild(a.checkbox);a.containerControl.appendChild(a.dummyLabel);a.addControlContainer(a.containerControl);a.addEvents();a.init();return d};$jscomp.inherits(l,b.Control);l.prototype.init=function(d){a=this;c=a.evaluator;a.label.innerHTML=c.eval(a.name).toString();a.labelFontSize=0<c.eval(a.font_size)?c.eval(a.font_size):
b.getFieldFontSize(a.h);d=Math.max(a.w-a.h,0);a.text_object=new b.TextObject({parent:{decimal_symbol:a.parent.decimal_symbol},evaluator:c,decimals:a.decimals,fixed:!1,align:"left",anchor:"center_center",width:a.parser.parse("0"),font_size:a.parser.parse(""+a.labelFontSize),font_family:a.font_family,italics:a.italics,bold:a.bold},a.name_str);a.text_object.draw(a.label_ctx,a.label_text_color.getColor(),0,0,!0);a.containerControl.setAttribute("style","width:"+a.w+"px;height:"+a.h+"px;left:"+a.x+"px;top:"+
a.y+"px;z-index:"+a.zIndex+";");"right"==a.position?(a.dummyLabel.setAttribute("style","position:absolute;width:"+a.h+"px;height:"+a.h+"px;left:"+d+"px;"),a.checkbox.setAttribute("style","width:"+a.h+"px;height:"+a.h+"px;left:"+d+"px;"),a.label.setAttribute("style","font-size:"+a.labelFontSize+"px;width:"+d+"px;height:"+a.h+"px;line-height:"+a.h+"px;background-color:"+a.label_color.getColor()+";color:"+a.label_text_color.getColor()+";")):(a.dummyLabel.setAttribute("style","position:absolute;width:"+
a.h+"px;height:"+a.h+"px;left:0;"),a.checkbox.setAttribute("style","width:"+a.h+"px;height:"+a.h+"px;left:0;"),a.label.setAttribute("style","font-size:"+a.labelFontSize+"px;width:"+d+"px;height:"+a.h+"px;line-height:"+a.h+"px;background-color:"+a.label_color.getColor()+";color:"+a.label_text_color.getColor()+";left:"+a.h+"px"));a.checkbox.checked=0!=c.getVariable(a.id);a.label.width=d*a.ratio;a.label.height=a.h*a.ratio;a.update()};l.prototype.update=function(){a=this;c=a.evaluator;a.activeIfValue=
0<c.eval(a.activeif);a.drawIfValue=0<c.eval(a.drawif);a.checkbox.disabled=!a.activeIfValue;a.containerControl.style.display=a.drawIfValue?"block":"none";if(!a.parent.animation.playing||document.activeElement!=a.checkbox){var b=0!==c.getVariable(a.id)?1:0;if(""===a.radio_group)a.pressed?(a.value=a.checkbox.checked?1:0,a.pressed=!1):(a.value=b,a.checkbox.checked=0!==a.value),c.setVariable(a.id,a.value);else{a.value=c.getVariable(a.id);c.setVariable(a.radio_group,0);b=document.querySelectorAll("[name="+
a.radio_group+"]");var k=-1;if(a.pressed){for(k=b.length-1;0<=k;k--)c.setVariable(b[k].internalID,0),b[k].checked=!1;c.setVariable(a.id,1);a.checkbox.checked=!0;a.value=1;c.setVariable(a.radio_group,a.id);a.pressed=0}else{for(var g=b.length-1;0<=g;g--)k=0!=c.getVariable(b[g].internalID)?g:k,c.setVariable(b[g].internalID,0),b[g].checked=!1;0<=k&&(c.setVariable(b[k].internalID,1),b[k].checked=!0,c.setVariable(a.radio_group,b[k].internalID));a.value=a.checkbox.checked?1:0}}}a.updatePositionAndSize();
a.label_ctx.setTransform(a.ratio,0,0,a.ratio,0,0);a.text_object.draw(a.label_ctx,a.label_text_color.getColor(),0,0);a.label_ctx.clearRect(0,0,a.label.width,a.label.height);(h=a.label_color.getColor())&&/CanvasGradient|CanvasPattern/.test(h.constructor.name)&&(a.label_ctx.fillStyle=h,a.label_ctx.fillRect(0,0,a.label_ctx.canvas.width,a.label_ctx.canvas.height));a.text_object.textNodes.metrics.w>a.label.width/a.ratio?(a.text_object.anchor="center_left",a.text_object.draw(a.label_ctx,a.label_text_color.getColor(),
5,a.label.height/a.ratio/2)):(a.text_object.anchor="center_center",a.text_object.draw(a.label_ctx,a.label_text_color.getColor(),a.label.width/a.ratio/2,a.label.height/a.ratio/2));a.label_ctx.setTransform(1,0,0,1,0,0)};l.prototype.addEvents=function(){var a=this;a.label.ontouchstart=a.label.onmousedown=a.dummyLabel.onmousedown=b.preventDefault;a.checkbox.addEventListener("click",function(){a.pressed=!0;a.updateAndExecAction()})};b.Checkbox=l;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,l,d,k,g,n,f,m=function(c,d){a=d=b.Control.call(this,c,d)||this;a.label_color=a.label_color||new b.Color("e0e4e8",c.evaluator);a.label_text_color=a.label_text_color||new b.Color("000000",c.evaluator);a.name_str=a.name;/^&squot;.*&squot;$/.test(a.name)&&(a.name=a.name.replace("&squot;","\\u0027"));/^\[.*\]$/.test(a.name)?a.name=a.parser.parse(a.name.slice(1,-1)):a.name=a.parser.parse("'"+a.name.trim()+"'");void 0===a.valueExprString&&(a.valueExprString=
a.onlyText?"0":"");a.emptyString=!1;a.ok=0;a.tabindex=++c.tabindex;if(a.evaluate)if(a.answer){if(f=a.answer.match(/^krypto_(.*)$/))a.answer=(new b.Krypto).decode(f[1]);a.answer=b.answerRegEx(a.answer,a.evaluator,a.onlyText)}else a.evaluate=!1;a.onlyText&&(/^'.*'$/.test(a.valueExprString)||(a.valueExpr=a.evaluator.parser.parse("'"+a.valueExprString+"'")),a.validateValue=function(a){a=a.toString();return"''"==a||"'"==a?"":a&&/^'.*'$/.test(a)?a.slice(1,-1):a},a.formatValue=function(a){return a.toString()});
a.containerControl=b.newHTML("div",{class:"DescartesTextFieldContainer",id:a.id});a.field=b.newHTML("input",{type:"text",id:a.id+"TextField",class:"DescartesTextFieldField",tabindex:a.tabindex});a.label=b.newHTML("canvas",{class:"DescartesTextFieldLabel"});a.label_ctx=a.label.getContext("2d");a.ratio=c.ratio;a.containerControl.appendChild(a.label);a.containerControl.appendChild(a.field);a.cover=b.newHTML("div",{class:"TextfieldCover"});a.keyboard&&a.containerControl.appendChild(a.cover);a.activoStr=
a.id+".activo";a.activeStr=a.id+".active";a.addControlContainer(a.containerControl);a.addEvents();a.init();return d};$jscomp.inherits(m,b.Control);m.prototype.init=function(d){a=this;c=a.evaluator;a.label.innerHTML=c.eval(a.name).toString();var e=a.label.textContent;d||(a.value=a.validateValue(c.eval(a.valueExpr)));d=a.formatValue(a.value);a.fieldFontSize=0<c.eval(a.font_size)?c.eval(a.font_size):b.getFieldFontSize(a.h);a.text_object=new b.TextObject({parent:{decimal_symbol:a.parent.decimal_symbol},
evaluator:c,decimals:a.decimals,fixed:!1,align:"left",anchor:"center_center",width:a.parser.parse("0"),font_size:a.parser.parse(""+a.fieldFontSize),font_family:a.font_family,italics:a.italics,bold:a.bold},a.name_str);a.text_object.draw(a.label_ctx,a.label_text_color.getColor(),0,0,!0);var f=b.getTextWidth(d+"_",a.fieldFontSize+"px "+b.sansserif_font),g=parseInt(a.w/2),m=a.text_object.textNodes.metrics.w+parseInt(a.fieldFontSize);a.visible||(g=a.w,f=0);g<m&&(g=m);""==e&&(g=0);a.w-g<f&&(g=a.w-f);0>
g&&(g=0);e=a.w-g;a.containerControl.setAttribute("style","width:"+a.w+"px;height:"+a.h+"px;left:"+a.x+"px;top:"+a.y+"px;z-index:"+a.zIndex+";");a.field.setAttribute("style","font-size:"+a.fieldFontSize+"px;width:"+e+"px;height:"+a.h+"px;left:"+g+"px; font-family:"+("Serif"==a.font_family?b.serif_font:"Monospaced"==a.font_family?b.monospace_font:b.sansserif_font)+";");a.field.value=d;a.cover.setAttribute("style",";width:"+e+"px;height:"+a.h+"px;left:"+g+"px;");a.label.setAttribute("style","font-size:"+
a.fieldFontSize+"px;width:"+g+"px;height:"+a.h+"px;line-height:"+a.h+"px;background-color:"+a.label_color.getColor()+";color:"+a.label_text_color.getColor()+";");a.label.width=g*a.ratio;a.label.height=a.h*a.ratio;a.evaluate&&(a.ok=a.evalAnswer());a.evaluator.setVariable(a.id,a.value);a.evaluator.setVariable(a.id+".ok",a.ok);a.oldValue=a.value;a.update()};m.prototype.update=function(){a=this;c=a.evaluator;a.activeIfValue=0<c.eval(a.activeif);a.drawIfValue=0<c.eval(a.drawif);a.field.disabled=!a.activeIfValue;
a.containerControl.style.display=a.drawIfValue?"block":"none";a.parent.animation.playing&&document.activeElement==a.field||(h=a.field.value,l=a.value,a.value=a.validateValue(c.getVariable(a.id)),a.field.value=a.formatValue(a.value),a.value===l&&a.field.value!=h&&(a.value=a.validateValue(h),a.field.value=a.formatValue(a.value)),c.setVariable(a.id,a.value));a.updatePositionAndSize();a.label_ctx.setTransform(a.ratio,0,0,a.ratio,0,0);a.text_object.draw(a.label_ctx,a.label_text_color.getColor(),0,0);a.label_ctx.clearRect(0,
0,a.label.width,a.label.height);(n=a.label_color.getColor())&&/CanvasGradient|CanvasPattern/.test(n.constructor.name)&&(a.label_ctx.fillStyle=n,a.label_ctx.fillRect(0,0,a.label_ctx.canvas.width,a.label_ctx.canvas.height));a.text_object.textNodes.metrics.w>a.label.width/a.ratio?(a.text_object.anchor="center_left",a.text_object.draw(a.label_ctx,a.label_text_color.getColor(),5,a.label.height/a.ratio/2)):(a.text_object.anchor="center_center",a.text_object.draw(a.label_ctx,a.label_text_color.getColor(),
a.label.width/a.ratio/2,a.label.height/a.ratio/2));a.label_ctx.setTransform(1,0,0,1,0,0)};m.prototype.validateValue=function(a){if(""===a||"''"==a)return"";c=this.evaluator;a=a.toString().replace(this.parent.decimal_symbol_regexp,".");d=a==parseFloat(a)?parseFloat(a):parseFloat(c.eval(c.parser.parse(a)));isNaN(d)&&(d=0);k=c.eval(this.min);g=c.eval(this.max);""===k&&(k=-Infinity);""===g&&(g=Infinity);d<k&&(d=k);d>g&&(d=g);this.discrete&&(a=c.eval(this.incr),d=0===a?0:a*Math.round(d/a));return d=parseFloat(parseFloat(d).toFixed(c.eval(this.decimals)))};
m.prototype.formatValue=function(a){return""===a?a:b.Control.prototype.formatValue.call(this,a)};m.prototype.changeValue=function(a){this.activeIfValue&&(this.value=this.validateValue(a),this.field.value=this.formatValue(this.value),this.evaluate&&(this.ok=this.evalAnswer()),this.evaluator.setVariable(this.id,this.value),this.evaluator.setVariable(this.id+".ok",this.ok),this.updateAndExecAction())};m.prototype.evalAnswer=function(){return b.esCorrecto(this.answer,this.value,this.evaluator)};m.prototype.deactivate=
function(){this.evaluator.setVariable(this.activoStr,0);this.evaluator.setVariable(this.activeStr,0)};m.prototype.addEvents=function(){var a=this;a.label.addEventListener("touchstart",b.preventDefault);a.label.addEventListener("mousedown",b.preventDefault);a.field.addEventListener("mousedown",function(b){a.parent.deactivateControls();a.evaluator.setVariable(a.activoStr,1);a.evaluator.setVariable(a.activeStr,1);a.parent.update()});a.field.addEventListener("blur",function(b){a.drawIfValue&&a.changeValue(a.field.value,
!0)});a.field.addEventListener("keydown",function(b){a.activeIfValue&&13==b.keyCode&&a.changeValue(a.field.value,!0)});a.field.addEventListener("click",function(a){this.focus()});a.cover.addEventListener("click",function(b){a.parent.deactivateControls();a.evaluator.setVariable(a.activoStr,1);a.evaluator.setVariable(a.activeStr,1);a.parent.update();b=a.evaluator.eval(a.kbexp);a.activeIfValue&&a.parent.keyboard.show(a,a.kblayout,b[0][0]||0,b[0][1]||0,a.id,a.field,a.onlyText)})};b.TextField=m;return b}(descartesJS||
{});
descartesJS=function(b){if(b.loadLib)return b;var a,c=Math.abs,h,l,d,k,g,n,f,m,p,e,u,v=function(a,c){function d(a){f.options=a.split(",");f.menuOptions=[];f.strVal=[];for(var c=0,d=f.options.length;c<d;c++)a=f.customSplit(f.options[c]),1==a.length?(f.menuOptions.push(a[0]),f.strVal.push(c.toString())):2==a.length&&(f.menuOptions.push(a[0]),""==a[1]?f.strVal.push(c.toString()):f.strVal.push(a[1]));a=0;for(c=f.menuOptions.length;a<c;a++)/^\[.*\]$/.test(f.menuOptions[a])?f.menuOptions[a]=h.parse(f.menuOptions[a].slice(1,-1)):
f.menuOptions[a]=h.parse("'"+f.menuOptions[a]+"'");a=0;for(c=f.strVal.length;a<c;a++)/^\[.*\]$/.test(f.strVal[a])?f.strVal[a]=h.parse(f.strVal[a].slice(1,-1)):f.strVal[a]=h.parse(f.strVal[a]);f.select.innerHTML="";a=$jscomp.makeIterator(f.menuOptions);for(c=a.next();!c.done;c=a.next())d=c.value,c=b.newHTML("option"),c.innerHTML=l.eval(d),f.select.appendChild(c);return 0}var e,f=e=b.Control.call(this,a,c)||this;h=f.parser;l=f.evaluator;f.label_color=f.label_color||new b.Color("e0e4e8",l);f.label_text_color=
f.label_text_color||new b.Color("000000",l);f.options=c.options||"";f.ok=0;f.tabindex=++a.tabindex;f.answer&&(/^krypto_/.test(f.answer)&&(f.answer=(new b.Krypto).decode(f.answer.substring(7))),f.answer=parseInt(f.answer.split(",")[0].replace("[",""))||0);f.name_str=f.name;/^&squot;.*&squot;$/.test(f.name)&&(f.name=f.name.replace("&squot;","\\u0027"));/^\[.*\]$/.test(f.name)?f.name=f.parser.parse(f.name.slice(1,-1)):f.name=f.parser.parse("'"+f.name+"'");f.evaluator.setFunction(f.id+".setOptions",d);
f.containerControl=b.newHTML("div",{class:"DescartesMenuContainer",id:f.id});f.label=b.newHTML("canvas",{class:"DescartesMenuLabel"});f.label_ctx=f.label.getContext("2d");f.ratio=a.ratio;f.select=b.newHTML("select",{id:f.id+"_menuSelect",class:"DescartesMenuSelect",tabindex:f.tabindex});f.field=b.newHTML("input",{type:"text",id:f.id+"_menuField",class:"DescartesMenuField",tabindex:f.tabindex});d(f.options);f.containerControl.appendChild(f.label);f.containerControl.appendChild(f.select);f.visible&&
f.containerControl.appendChild(f.field);f.cover=b.newHTML("div",{class:"TextfieldCover"});f.keyboard&&f.visible&&f.containerControl.appendChild(f.cover);f.addControlContainer(f.containerControl);f.addEvents();f.init();return e};$jscomp.inherits(v,b.Control);v.prototype.init=function(c){a=this;l=a.evaluator;a.label.innerHTML=l.eval(a.name).toString();var d=a.label.textContent;a.fieldFontSize=0<l.eval(a.font_size)?l.eval(a.font_size):b.getFieldFontSize(a.h);a.text_object=new b.TextObject({parent:{decimal_symbol:a.parent.decimal_symbol},
evaluator:l,decimals:a.decimals,fixed:!1,align:"left",anchor:"center_center",width:a.parser.parse("0"),font_size:a.parser.parse(""+a.fieldFontSize),font_family:a.font_family,italics:a.italics,bold:a.bold},a.name_str);a.text_object.draw(a.label_ctx,a.label_text_color.getColor(),0,0,!0);var e=0,f=0;a.value=c?a.value:l.eval(a.valueExpr);a.idxVal=a.getIndex(a.value);for(var g=0,m=a.menuOptions.length;g<m;g++)c=b.getTextWidth(l.eval(a.menuOptions[g]).toString(),a.fieldFontSize+"px "+b.sansserif_font),
c>e&&(e=c,f=g);e+=25;c=b.getTextWidth(a.formatValue(l.eval(a.strVal[f])),a.fieldFontSize+"px "+b.sansserif_font)+7;f=a.text_object.textNodes.metrics.w+parseInt(a.fieldFontSize);""==d&&(f=0);a.visible||(c=0);for(d=a.w-c-f;d<e&&0<f;)f--,d++;for(;d<e&&0<c;)c--,d++;for(;f+d+c+1<a.w;)d++,c++;e=f;g=e+d;c=a.w-g;m=a.formatValue(l.eval(a.strVal[a.idxVal]));a.containerControl.setAttribute("style","width:"+a.w+"px;height:"+a.h+"px;left:"+a.x+"px;top:"+a.y+"px;z-index:"+a.zIndex+";");a.label.setAttribute("style",
"font-size:"+a.fieldFontSize+"px;width:"+f+"px;height:"+a.h+"px;line-height:"+a.h+"px;background-color:"+a.label_color.getColor()+";color:"+a.label_text_color.getColor()+";");a.label.width=f*a.ratio;a.label.height=a.h*a.ratio;a.field.value=m;a.field.setAttribute("style","font-size:"+a.fieldFontSize+"px;width:"+c+"px;height:"+a.h+"px;left:"+g+"px;");a.cover.setAttribute("style","width:"+c+"px;height:"+a.h+"px;left:"+g+"px;");a.select.setAttribute("style","text-align:left;font-size:"+a.fieldFontSize+
"px;width:"+d+"px;height:"+a.h+"px;left:"+e+"px;");a.select.selectedIndex=a.idxVal;l.setVariable(a.id,parseFloat(m.replace(a.parent.decimal_symbol,".")));a.update()};v.prototype.update=function(){a=this;l=a.evaluator;a.activeIfValue=0<l.eval(a.activeif);a.drawIfValue=0<l.eval(a.drawif);a.field.disabled=a.activeIfValue?!1:!0;a.select.disabled=a.activeIfValue?!1:!0;a.drawIfValue?a.containerControl.style.display="block":(a.click=!1,a.containerControl.style.display="none");if(!a.parent.animation.playing||
document.activeElement!=a.select){for(var b=0,c=a.menuOptions.length;b<c;b++)a.select.options[b].innerHTML=(l.eval(a.menuOptions[b])||"").replace(/\\u002C/g,",");a.value=l.getVariable(a.id);isNaN(a.value)&&(a.value=0);a.field.value=a.formatValue(a.value);l.setVariable(a.id,parseFloat(a.value));a.select.selectedIndex=parseFloat(a.getIndex(a.value))}a.ok=a.value==a.answer?1:0;a.evaluator.setVariable(a.id+".ok",a.ok);a.updatePositionAndSize();a.label_ctx.setTransform(a.ratio,0,0,a.ratio,0,0);a.text_object.draw(a.label_ctx,
a.label_text_color.getColor(),0,0);a.label_ctx.clearRect(0,0,a.label.width,a.label.height);(u=a.label_color.getColor())&&/CanvasGradient|CanvasPattern/.test(u.constructor.name)&&(a.label_ctx.fillStyle=u,a.label_ctx.fillRect(0,0,a.label_ctx.canvas.width,a.label_ctx.canvas.height));a.text_object.textNodes.metrics.w>a.label.width/a.ratio?(a.text_object.anchor="center_left",a.text_object.draw(a.label_ctx,a.label_text_color.getColor(),5,a.label.height/a.ratio/2)):(a.text_object.anchor="center_center",
a.text_object.draw(a.label_ctx,a.label_text_color.getColor(),a.label.width/a.ratio/2,a.label.height/a.ratio/2));a.label_ctx.setTransform(1,0,0,1,0,0)};v.prototype.customSplit=function(a){n=!1;f="";m=0;for(p=-1;m<a.length;){e=a.charAt(m);if("["===e&&-1===p){if(n||""!=f)f+="\u00a6";p++}else"["===e?p++:"]"===e&&0===p?(n=!0,p--):"]"==a.charAt(m)&&(p=0>p?p:p-1);f+=a.charAt(m);m++}return f.split("\u00a6")};v.prototype.getIndex=function(a){a=parseFloat(a.toString().replace(this.parent.decimal_symbol,"."));
d=-1;k=Infinity;for(var b=0,e=this.strVal.length;b<e;b++)g=c(a-parseFloat(this.evaluator.eval(this.strVal[b]))),g<=k&&(k=g,d=b);this.select.options[this.select.selectedIndex]&&this.evaluator.setVariable(this.id+".txt",this.select.options[this.select.selectedIndex].text);return d};v.prototype.changeValue=function(b,c){a=this;a.activeIfValue&&(c&&(a.idxVal=a.getIndex(b),a.value=a.evaluator.eval(a.strVal[a.idxVal]),a.field.value=a.formatValue(a.idxVal),a.select.selectedIndex=a.idxVal),a.evaluator.setVariable(a.id,
a.value),a.updateAndExecAction())};v.prototype.addEvents=function(){var a=this;a.label.addEventListener("touchstart",b.preventDefault);a.label.addEventListener("mousedown",b.preventDefault);a.select.addEventListener("change",function(b){a.value=a.evaluator.eval(a.strVal[this.selectedIndex]);a.field.value=a.formatValue(a.value);a.evaluator.setVariable(a.id,a.field.value);a.changeValue();b.preventDefault()});a.field.addEventListener("keydown",function(b){13==b.keyCode&&(a.idxVal=a.getIndex(a.field.value),
a.value=a.evaluator.eval(a.strVal[a.idxVal]),a.field.value=a.formatValue(a.idxVal),a.select.selectedIndex=a.idxVal,a.changeValue())});a.field.addEventListener("blur",function(b){a.drawIfValue&&a.changeValue(a.field.value,!0)});a.field.addEventListener("click",function(b){a.field.focus()});a.cover.addEventListener("click",function(b){b=a.evaluator.eval(a.kbexp);a.activeIfValue&&a.parent.keyboard.show(a,a.kblayout,b[0][0]||0,b[0][1]||0,a.id,a.field,a.onlyText)})};b.Menu=v;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c=Math.floor,h,l,d,k,g,n,f,m,p,e,u,v,w,q,r,y,x,z=function(c,d){a=d=b.Control.call(this,c,d)||this;a.label_color=a.label_color||new b.Color("e0e4e8",c.evaluator);a.label_text_color=a.label_text_color||new b.Color("000000",c.evaluator);a.name_str=a.name;/^&squot;.*&squot;$/.test(a.name)&&(a.name=a.name.replace("&squot;","\\u0027"));/^\[.*\]$/.test(a.name)?a.name=a.parser.parse(a.name.slice(1,-1)):a.name=a.parser.parse("'"+a.name+"'");a.orientation=
a.w>=a.h?"h":"v";a.container=b.newHTML("div",{class:"DescartesScrollbarContainer",id:a.id});a.canvas=b.newHTML("canvas");a.divUp=b.newHTML("div",{class:"DescartesCatcher up"});a.divDown=b.newHTML("div",{class:"DescartesCatcher down"});a.field=b.newHTML("input",{type:"text",id:a.id+"scrollbar",class:"DescartesScrollbarField"});a.handler=b.newHTML("div",{class:"DescartesCatcher manipulator"});a.label=b.newHTML("canvas",{class:"DescartesScrollbarLabel"});a.label_ctx=a.label.getContext("2d");a.ratio=
c.ratio;a.container.appendChild(a.canvas);a.container.appendChild(a.label);a.container.appendChild(a.divUp);a.container.appendChild(a.divDown);a.container.appendChild(a.field);a.container.appendChild(a.handler);a.cover=b.newHTML("div",{class:"TextfieldCover"});a.keyboard&&a.visible&&a.container.appendChild(a.cover);a.addControlContainer(a.container);a.addEvents();a.init();return d};$jscomp.inherits(z,b.Control);z.prototype.init=function(){a=this;h=a.evaluator;0==h.eval(a.decimals)?a.incr=1:a.incr=
(h.eval(a.max)-h.eval(a.min))/100;a.value=a.validateValue(h.eval(a.valueExpr));l=a.formatValue(a.value);d=a.evaluator.eval(a.expresion)[0];a.x=d[0];a.y=d[1];4==d.length&&(a.w=d[2],a.h=d[3]);a.orientation=a.w>=a.h?"h":"v";a.initScroll(l);a.changeScrollPosition();a.prePos=a.pos;h.setVariable(a.id,a.value)};z.prototype.initScroll=function(c){a=this;h=a.evaluator;a.label.innerHTML=h.eval(a.name).toString();y=a.label.textContent;var d="v"===a.orientation?parseInt(19+5*(a.h-100)/100):a.h;a.fieldFontSize=
0<h.eval(a.font_size)?h.eval(a.font_size):"v"===a.orientation?d-parseInt(a.h/20)-1:b.getFieldFontSize(d);a.text_object=new b.TextObject({parent:{decimal_symbol:a.parent.decimal_symbol},evaluator:a.evaluator,decimals:a.decimals,fixed:!1,align:"left",anchor:"center_center",width:a.parser.parse("0"),font_size:a.parser.parse(""+a.fieldFontSize),font_family:a.font_family,italics:a.italics,bold:a.bold},a.name_str);a.text_object.draw(a.label_ctx,a.label_text_color.getColor(),0,0,!0);c=b.getTextWidth(c+"_",
a.fieldFontSize+"px "+b.sansserif_font);var e=a.parent.getSpaceById(a.spaceID).h;a.labelHeight=""==y?0:d;a.fieldHeight=""==a.visible?0:d;if("v"===a.orientation)a.canvasWidth=a.w,a.canvasHeight=a.h-a.labelHeight-a.fieldHeight,18<=a.canvasHeight+a.y-e&&(a.canvasHeight=e),d=a.fieldHeight,c=d+a.canvasHeight,a.canvasX=0,a.canvasY=a.fieldHeight,a.labelWidth=a.w,a.labelY=c,a.upWidth=a.downW=a.w,a.upHeight=a.downH=a.w,a.upX=0,a.upY=a.fieldHeight,a.downX=0,a.downY=c-a.downH,a.fieldWidth=a.w,a.fieldX=0,a.handlerW=
a.w,a.handlerH=parseInt((a.canvasHeight-a.upHeight-a.downH-a.labelHeight-a.fieldHeight)/10),a.handlerH=a.canvasHeight-a.upHeight-a.downH-a.labelHeight-a.fieldHeight>2*a.w?a.w:a.handlerH,a.handlerH=15>a.handlerH?15:a.handlerH,a.limInf=c-a.downH-a.handlerH,a.limSup=d+a.downH;else{d=a.text_object.textNodes.metrics.w+parseInt(a.fieldFontSize);a.labelWidth=d;a.fieldWidth=c;""==y&&(a.labelWidth=0);a.visible||(a.fieldWidth=0);for(d=a.w-a.fieldWidth-a.labelWidth;58>d&&0<a.labelWidth;)a.labelWidth--,d++;for(;58>
d&&0<a.fieldWidth;)a.fieldWidth--,d++;c=a.labelWidth;e=c+d;a.fieldWidth=a.w-e;a.canvasWidth=d;a.canvasHeight=a.h;a.canvasX=a.labelWidth;a.canvasY=0;a.fieldX=a.canvasWidth+a.labelWidth;a.labelHeight=a.h;a.labelY=0;a.upWidth=a.downW=a.h;a.upHeight=a.downH=a.h;a.upX=e-a.downW;a.upY=0;a.downX=a.labelWidth;a.downY=0;a.handlerW=parseInt((a.canvasWidth-a.upWidth-a.downW)/10);a.handlerW=a.canvasWidth-a.upWidth-a.downW>2*a.h?a.h:a.handlerW;a.handlerW=15>a.handlerW?15:a.handlerW;a.handlerH=a.h;a.limInf=c+a.downW;
a.limSup=c+a.canvasWidth-a.downW-a.handlerW}a.container.setAttribute("style","width:"+a.w+"px;height:"+a.h+"px;left:"+a.x+"px;top:"+a.y+"px;z-index:"+a.zIndex+";");a.canvas.setAttribute("width",a.w+"px");a.canvas.setAttribute("height",a.h+"px");a.canvas.setAttribute("style","position:absolute;left:0;top:0;");a.ctx=a.canvas.getContext("2d");a.ctx.imageSmoothingEnabled=!1;a.divUp.setAttribute("style","width:"+a.upWidth+"px;height:"+a.upHeight+"px;left:"+a.upX+"px;top:"+a.upY+"px;");a.divDown.setAttribute("style",
"width:"+a.downW+"px;height:"+a.downH+"px;left:"+a.downX+"px;top:"+a.downY+"px;");a.handler.setAttribute("style","width:"+a.handlerW+"px;height:"+a.handlerH+"px;left:"+("v"===a.orientation?0:a.limInf)+"px;top:"+("v"===a.orientation?a.limInf:0)+"px;");a.field.setAttribute("style","font-size:"+a.fieldFontSize+"px;width:"+a.fieldWidth+"px;height:"+a.fieldHeight+"px;left:"+a.fieldX+"px;top:0;");a.cover.setAttribute("style","width:"+a.fieldWidth+"px;height:"+a.fieldHeight+"px;left:"+a.fieldX+"px;top:0;");
0===a.fieldHeight&&(a.field.style.display="none");a.label.setAttribute("style","font-size:"+a.fieldFontSize+"px;width:"+a.labelWidth+"px;height:"+a.labelHeight+"px;line-height:"+a.labelHeight+"px;left:0;top:"+a.labelY+"px;background-color:"+a.label_color.getColor()+";color:"+a.label_text_color.getColor()+";");a.label.width=a.labelWidth*a.ratio;a.label.height=a.labelHeight*a.ratio};z.prototype.update=function(){a=this;h=a.evaluator;0==h.eval(a.decimals)?a.incr=1:a.incr=(h.eval(a.max)-h.eval(a.min))/
100;a.activeIfValue=0<h.eval(a.activeif);a.drawIfValue=0<h.eval(a.drawif);a.field.disabled=!a.activeIfValue;a.drawIfValue?(a.container.style.display="block",a.draw()):a.container.style.display="none";a.updatePositionAndSize();var b=a.validateValue(h.getVariable(a.id));b==a.value||0<Math.abs(b-a.value)&&1E-9>Math.abs(b-a.value)||(a.value=b,a.changeScrollPosition(),a.prePos=a.pos);a.value=b;a.field.value=a.formatValue(a.value);h.setVariable(a.id,a.value);a.label_ctx.setTransform(a.ratio,0,0,a.ratio,
0,0);a.text_object.draw(a.label_ctx,a.label_text_color.getColor(),0,0);a.label_ctx.clearRect(0,0,a.label.width,a.label.height);(x=a.label_color.getColor())&&/CanvasGradient|CanvasPattern/.test(x.constructor.name)&&(a.label_ctx.fillStyle=x,a.label_ctx.fillRect(0,0,a.label_ctx.canvas.width,a.label_ctx.canvas.height));a.text_object.textNodes.metrics.w>a.label.width/a.ratio?(a.text_object.anchor="center_left",a.text_object.draw(a.label_ctx,a.label_text_color.getColor(),5,a.label.height/a.ratio/2)):(a.text_object.anchor=
"center_center",a.text_object.draw(a.label_ctx,a.label_text_color.getColor(),a.label.width/a.ratio/2,a.label.height/a.ratio/2));a.label_ctx.setTransform(1,0,0,1,0,0)};z.prototype.draw=function(){a=this;k=a.ctx;n=c(a.w);g=c(a.h);k.fillStyle=a.color.getColor();k.fillRect(0,0,n,g);k.fillStyle="black";k.beginPath();"h"===a.orientation?(k.lineWidth=1,k.strokeStyle="rgba(0,0,0,0.3)",k.strokeRect(parseInt(a.labelWidth)+.5,.5,n-1-parseInt(a.labelWidth),g-1),k.lineWidth=Math.ceil(12*a.upWidth/100)||1,k.strokeStyle=
a.colorInt.getColor(),k.moveTo(a.downX+62.215*a.upWidth/100,20*a.downH/100),k.lineTo(a.downX+32.449*a.upWidth/100,a.downH/2),k.lineTo(a.downX+62.215*a.upWidth/100,80*a.downH/100),k.moveTo(a.upX+32.449*a.upWidth/100,20*a.downH/100),k.lineTo(a.upX+62.215*a.upWidth/100,a.downH/2),k.lineTo(a.upX+32.449*a.upWidth/100,80*a.downH/100),k.stroke(),m=c(a.pos),f=Math.ceil(g/10)||1,k.fillStyle=a.colorInt.getColor(),k.fillRect(m+.5,f,c(a.handlerW),g-2*f)):(k.lineWidth=1,k.strokeStyle="rgba(0,0,0,0.3)",k.strokeRect(.5,
.5,n-1,g-parseInt(a.labelHeight)-.5),k.lineWidth=Math.ceil(12*a.upWidth/100)||1,k.strokeStyle=a.colorInt.getColor(),k.moveTo(20*a.upWidth/100,a.h-a.labelHeight-70*a.downH/100),k.lineTo(50*a.upWidth/100,a.h-a.labelHeight-40.237*a.downH/100),k.lineTo(80*a.upWidth/100,a.h-a.labelHeight-70*a.downH/100),k.moveTo(20*a.upWidth/100,a.upY+70*a.downH/100),k.lineTo(50*a.upWidth/100,a.upY+40.237*a.downH/100),k.lineTo(80*a.upWidth/100,a.upY+70*a.downH/100),k.stroke(),m=c(a.pos),f=Math.ceil(n/10)||1,k.fillStyle=
a.colorInt.getColor(),k.fillRect(f,m+.5,n-2*f,c(a.handlerH)));a.activeIfValue||(k.fillStyle="rgba(255,255,255,0.5)",k.fillRect(0,0,k.canvas.width,k.canvas.height))};z.prototype.validateValue=function(b){a=this;h=a.evaluator;p=b.toString();p=parseFloat(p.replace(a.parent.decimal_symbol,"."));isNaN(p)&&(p=0);a.minimo=h.eval(a.min);p<a.minimo&&(a.value=null,p=a.minimo);a.maximo=h.eval(a.max);p>a.maximo&&(a.value=null,p=a.maximo);e=a.incr;p=0!=e?p*e/e:0;a.fixed&&(p=parseFloat(parseFloat(p).toFixed(h.eval(a.decimals))));
return p};z.prototype.increase=function(){this.changeValue(parseFloat(this.value)+this.incr)};z.prototype.decrease=function(){this.changeValue(parseFloat(this.value)-this.incr)};z.prototype.increase10=function(){a=this;f=(a.evaluator.eval(a.max)-a.evaluator.eval(a.min))/10;"h"==a.orientation?a.clickPos.x>a.prePos&&a.changeValue(parseFloat(a.value)+f):a.clickPos.y<a.prePos&&a.changeValue(parseFloat(a.value)+f)};z.prototype.decrease10=function(){a=this;f=(a.evaluator.eval(a.max)-a.evaluator.eval(a.min))/
10;"h"==a.orientation?a.clickPos.x<a.prePos&&a.changeValue(parseFloat(a.value)-f):a.clickPos.y>a.prePos&&a.changeValue(parseFloat(a.value)-f)};z.prototype.changeValue=function(b){a=this;a.activeIfValue&&(u=a.validateValue(b),u!=a.value&&(a.value=u,a.field.value=a.formatValue(u),a.changeScrollPosition(),a.prePos=a.pos,a.evaluator.setVariable(a.id,a.value)),a.updateAndExecAction())};z.prototype.changeValueMovement=function(){h=this.evaluator;v=this.limInf;w=this.limSup;q=h.eval(this.min);r=h.eval(this.max);
e=this.incr;u=c((this.pos-v)*(r-q)/(w-v)/e)*e+q;u!=this.value&&(this.value=u,this.field.value=this.formatValue(u),h.setVariable(this.id,this.value),this.parent.updateControls(),this.actionExec.execute(),this.parent.update())};z.prototype.changeScrollPosition=function(){a=this;h=a.evaluator;v=a.limInf;w=a.limSup;q=h.eval(a.min);r=h.eval(a.max);e=a.incr;a.pos=(a.value-q)*(w-v)/(r-q)+v;a.handler.style["h"==a.orientation?"left":"top"]=a.pos+"px"};z.prototype.addEvents=function(){function a(c,d,e,f){b.clearTimeout(u);
(n.up||n.down||n.canvasClick)&&1E-7<Math.abs(n.value-f)&&(d.call(n),c=e?c:30,u=b.setTimeout(function(){a(c,d,!1,f)},c))}function c(c){c.preventDefault();n.whichBtn=b.whichBtn(c);"L"==n.whichBtn&&n.activeIfValue&&(n.clickPos=b.getCursorPosition(c,n.container),n.canvasClick=!0,"h"==n.orientation?n.clickPos.x<n.prePos?a(350,n.decrease10,!0,n.minimo):a(350,n.increase10,!0,n.maximo):n.clickPos.y<n.prePos?a(350,n.increase10,!0,n.maximo):a(350,n.decrease10,!0,n.minimo))}function d(a){n.canvasClick=!1;b.clearTimeout(u)}
function e(a){1==n.canvasClick&&(n.clickPos=b.getCursorPosition(a,n.container),a.preventDefault())}function f(a){n.scrollClick=!1;n.prePos=n.pos;window.removeEventListener("mouseup",f,!1);window.removeEventListener("mousemove",m,!1);a.preventDefault()}function g(a){n.scrollClick=!1;n.prePos=n.pos;window.removeEventListener("touchend",g,!1);window.removeEventListener("touchmove",m,!1);a.preventDefault()}function m(a){var c=b.getCursorPosition(a,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.handler.setAttribute("style","width:"+n.handlerW+"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.handler.setAttribute("style","width:"+n.w+"px;height:"+n.handlerH+"px;left:0;top:"+n.pos+"px;"));n.changeValueMovement();a.preventDefault()}function k(c){c.preventDefault();n.whichBtn=b.whichBtn(c);"L"==n.whichBtn&&n.activeIfValue&&
(n.up=!0,a(350,n.increase,!0,n.maximo))}function h(c){c.preventDefault();n.whichBtn=b.whichBtn(c);"L"==n.whichBtn&&n.activeIfValue&&(n.down=!0,a(350,n.decrease,!0,n.minimo))}function p(a){n.down=!1;b.clearTimeout(u);a.preventDefault()}function l(a){n.up=!1;b.clearTimeout(u);n.draw()}function q(a){n.down=!1;b.clearTimeout(u);n.draw()}var n=this,u;n.field.addEventListener("keydown",function(a){13==a.keyCode&&n.changeValue(n.field.value)});n.field.addEventListener("blur",function(a){n.drawIfValue&&n.changeValue(n.field.value,
!0)});n.canvas.addEventListener("touchstart",c);n.canvas.addEventListener("mousedown",c);n.divDown.addEventListener("mouseout",p);window.addEventListener("touchend",d);window.addEventListener("mouseup",d);n.canvas.addEventListener("touchmove",e);n.canvas.addEventListener("mousemove",e);n.handler.addEventListener("touchstart",function(a){n.activeIfValue&&(n.scrollClick=!0,n.initPos=b.getCursorPosition(a,n.container),window.addEventListener("touchend",g),window.addEventListener("touchmove",m),a.preventDefault())});
n.handler.addEventListener("mousedown",function(a){n.activeIfValue&&(n.scrollClick=!0,n.initPos=b.getCursorPosition(a,n.container),window.addEventListener("mouseup",f),window.addEventListener("mousemove",m),a.preventDefault())});n.divUp.addEventListener("touchstart",k);n.divUp.addEventListener("mousedown",k);n.divDown.addEventListener("touchstart",h);n.divDown.addEventListener("mousedown",h);n.divUp.addEventListener("mouseout",function(a){n.up=!1;b.clearTimeout(u);a.preventDefault()});n.divDown.addEventListener("mouseout",
p);window.addEventListener("touchend",l);window.addEventListener("mouseup",l);window.addEventListener("touchend",q);window.addEventListener("mouseup",q);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)})};b.Scrollbar=z;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c=Math.floor,h,l,d,k,g,n,f,m,p,e,u=function(c,d){a=d=b.Control.call(this,c,d)||this;a.label_color=a.label_color||new b.Color("e0e4e8",c.evaluator);a.label_text_color=a.label_text_color||new b.Color("000000",c.evaluator);a.name_str=a.name;/^&squot;.*&squot;$/.test(a.name)&&(a.name=a.name.replace("&squot;","\\u0027"));/^\[.*\]$/.test(a.name)?a.name=a.parser.parse(a.name.slice(1,-1)):a.name=a.parser.parse("'"+a.name+"'");a.orientation=a.w>=a.h?"h":
"v";a.container=b.newHTML("div",{class:"DescartesSliderContainer",id:a.id});a.field=b.newHTML("input",{type:"text",id:a.id+"slider",class:"DescartesSliderField"});a.sliderCtr=b.newHTML("input",{type:"range",id:a.id+"range",min:0,max:100,step:"any",class:"DescartesRange"});a.label=b.newHTML("canvas",{class:"DescartesSliderLabel"});a.label_ctx=a.label.getContext("2d");a.ratio=c.ratio;a.container.appendChild(a.label);a.container.appendChild(a.field);a.container.appendChild(a.sliderCtr);a.cover=b.newHTML("div",
{class:"TextfieldCover"});a.keyboard&&a.visible&&a.container.appendChild(a.cover);a.addControlContainer(a.container);a.addEvents();a.init();return d};$jscomp.inherits(u,b.Control);u.prototype.init=function(){a=this;h=a.evaluator;a.value=a.validateValue(h.eval(a.valueExpr));l=a.formatValue(a.value);d=a.evaluator.eval(a.expresion)[0];a.x=d[0];a.y=d[1];4==d.length&&(a.w=d[2],a.h=d[3]);a.orientation=a.w>=a.h?"h":"v";a.initSlider(l);a.changeSliderPosition();a.prePos=a.pos;h.setVariable(a.id,a.value)};
u.prototype.initSlider=function(c){a=this;h=a.evaluator;a.label.innerHTML=h.eval(a.name).toString();p=a.label.textContent;var d="v"===a.orientation?parseInt(19+5*(a.h-100)/100):a.h;a.fieldFontSize=0<h.eval(a.font_size)?h.eval(a.font_size):"v"===a.orientation?d-parseInt(a.h/20)-1:b.getFieldFontSize(d);a.text_object=new b.TextObject({parent:{decimal_symbol:a.parent.decimal_symbol},evaluator:h,decimals:a.decimals,fixed:!1,align:"left",anchor:"center_center",width:a.parser.parse("0"),font_size:a.parser.parse(""+
a.fieldFontSize),font_family:a.font_family,italics:a.italics,bold:a.bold},a.name_str);a.text_object.draw(a.label_ctx,a.label_text_color.getColor(),0,0,!0);c=b.getTextWidth(c+"_",a.fieldFontSize+"px "+b.sansserif_font);var e=a.parent.getSpaceById(a.spaceID).h;a.labelHeight=""==p?0:d;a.fieldHeight=""==a.visible?0:d;if("v"===a.orientation)a.canvasWidth=a.w,a.canvasHeight=a.h-a.labelHeight-a.fieldHeight,18<=a.canvasHeight+a.y-e&&(a.canvasHeight=e),d=a.fieldHeight+a.canvasHeight,a.canvasX=0,a.canvasY=
a.fieldHeight,a.labelWidth=a.w,a.labelY=d,a.upWidth=a.downW=a.w,a.upHeight=a.downH=a.w,a.fieldWidth=a.w,a.fieldX=0,a.sliderCtr.style="position:absolute;left:0;top:"+a.canvasY+"px;width:"+a.canvasHeight+"px;height:"+a.canvasWidth+"px;transform-origin:"+a.canvasWidth/2+"px "+a.canvasWidth/2+"px;transform:rotate(90deg);margin:0;padding:0;--thumb_size:"+a.canvasWidth+"px;--track_h:"+parseInt(a.canvasWidth/3)+"px;";else{d=a.text_object.textNodes.metrics.w+parseInt(a.fieldFontSize);a.labelWidth=d;a.fieldWidth=
c;""==p&&(a.labelWidth=0);a.visible||(a.fieldWidth=0);for(d=a.w-a.fieldWidth-a.labelWidth;58>d&&0<a.labelWidth;)a.labelWidth--,d++;for(;58>d&&0<a.fieldWidth;)a.fieldWidth--,d++;a.fieldWidth=a.w-(a.labelWidth+d);a.canvasWidth=d;a.canvasHeight=a.h;a.canvasX=a.labelWidth;a.canvasY=0;a.fieldX=a.canvasWidth+a.labelWidth;a.labelHeight=a.h;a.labelY=0;a.upWidth=a.downW=a.h;a.upHeight=a.downH=a.h;a.sliderCtr.style="position:absolute;left:"+a.canvasX+"px;top:0;width:"+a.canvasWidth+"px;height:"+a.canvasHeight+
"px;margin:0;padding:0;--thumb_size:"+a.canvasHeight+"px;--track_h:"+parseInt(a.canvasHeight/3)+"px;"}a.container.setAttribute("style","width:"+a.w+"px;height:"+a.h+"px;left:"+a.x+"px;top:"+a.y+"px;z-index:"+a.zIndex+";");a.field.setAttribute("style","font-size:"+a.fieldFontSize+"px;width:"+a.fieldWidth+"px;height:"+a.fieldHeight+"px;left:"+a.fieldX+"px;top:0;");a.cover.setAttribute("style","width:"+a.fieldWidth+"px;height:"+a.fieldHeight+"px;left:"+a.fieldX+"px;top:0;");0===a.fieldHeight&&(a.field.style.display=
"none");a.label.setAttribute("style","font-size:"+a.fieldFontSize+"px;width:"+a.labelWidth+"px;height:"+a.labelHeight+"px;line-height:"+a.labelHeight+"px;left:0;top:"+a.labelY+"px;background-color:"+a.label_color.getColor()+";color:"+a.label_text_color.getColor()+";");a.label.width=a.labelWidth*a.ratio;a.label.height=a.labelHeight*a.ratio};u.prototype.update=function(){h=this.evaluator;this.activeIfValue=0<h.eval(this.activeif);this.drawIfValue=0<h.eval(this.drawif);this.activeIfValue?(this.field.disabled=
this.sliderCtr.disabled=!1,this.sliderCtr.style.filter=""):(this.field.disabled=this.sliderCtr.disabled=!0,this.sliderCtr.style.filter="grayscale(60%)");this.drawIfValue?(this.container.style.display="block",this.draw()):this.container.style.display="none";this.updatePositionAndSize();var a=this.validateValue(h.getVariable(this.id));a==this.value||0<Math.abs(a-this.value)&&1E-9>Math.abs(a-this.value)||(this.value=a,this.changeSliderPosition(),this.prePos=this.pos);this.value=a;this.field.value=this.formatValue(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);(e=this.label_color.getColor())&&/CanvasGradient|CanvasPattern/.test(e.constructor.name)&&(this.label_ctx.fillStyle=e,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)};u.prototype.draw=function(){a=this;a.sliderCtr.style.setProperty("--track_color",a.color.getColor());a.sliderCtr.style.setProperty("--thumb_color",
a.colorInt.getColor());a.sliderCtr.value=a.pos};u.prototype.validateValue=function(b){a=this;h=a.evaluator;k=b.toString();k=parseFloat(k.replace(a.parent.decimal_symbol,"."));isNaN(k)&&(k=0);a.minimo=h.eval(a.min);k<a.minimo&&(a.value=null,k=a.minimo);a.maximo=h.eval(a.max);k>a.maximo&&(a.value=null,k=a.maximo);g=h.eval(a.incr);k=0!=g?k*g/g:0;a.fixed&&(k=parseFloat(parseFloat(k).toFixed(h.eval(a.decimals))));return k};u.prototype.changeValue=function(b){a=this;a.activeIfValue&&(n=a.validateValue(b),
n!=a.value&&(a.value=n,a.field.value=a.formatValue(n),a.changeSliderPosition(),a.prePos=a.pos,a.evaluator.setVariable(a.id,a.value)),a.updateAndExecAction())};u.prototype.changeValueForSliderMovement=function(){h=this.evaluator;f=h.eval(this.min);m=h.eval(this.max);g=h.eval(this.incr);n=c(this.pos*(m-f)/100/g)*g+f;n!=this.value&&(this.value=n,this.field.value=this.formatValue(n),h.setVariable(this.id,this.value),this.parent.updateControls(),this.actionExec.execute(),this.parent.update())};u.prototype.changeSliderPosition=
function(){h=this.evaluator;f=h.eval(this.min);m=h.eval(this.max);g=h.eval(this.incr);this.pos=100*(this.value-f)/(m-f)};u.prototype.addEvents=function(){var a=this;a.field.addEventListener("keydown",function(b){13==b.keyCode&&a.changeValue(a.field.value)});a.field.addEventListener("blur",function(b){a.drawIfValue&&a.changeValue(a.field.value,!0)});a.cover.addEventListener("click",function(b){b=a.evaluator.eval(a.kbexp);a.activeIfValue&&a.parent.keyboard.show(a,a.kblayout,b[0][0]||0,b[0][1]||0,a.id,
a.field,a.onlyText)});a.sliderCtr.addEventListener("input",function(b){a.pos=b.target.value;a.changeValueForSliderMovement()})};b.Slider=u;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,l=function(a,c){var d=b.Control.call(this,a,c)||this;d.controls=c.controls||!0;d.file=c.file||"";d.oldDrawIf=0;a=d.evaluator.eval(d.expresion);c=4==a[0].length;d.w=c?a[0][2]:200;d.h=c?a[0][3]:28;d.audio=d.parent.getAudio(d.file);d.oldFile=d.file;/^\[.*\]$/.test(d.file)&&(d.file=d.evaluator.parser.parse(d.file.slice(1,-1)));d.autoplay&&(d.audio.setAttribute("autoplay","autoplay"),d.audio.play());d.loop&&d.audio.setAttribute("loop","loop");d.controls&&
d.audio.setAttribute("controls","controls");d.audio.setAttribute("style","position:absolute;width:"+d.w+"px;left:"+d.x+"px;top:"+d.y+"px;z-index:"+d.zIndex+";");d.addControlContainer(d.audio);d.evaluator.setFunction(d.id+".play",function(){try{d.audio.play()}catch(n){}return 0});d.evaluator.setFunction(d.id+".pause",function(){try{d.audio.pause()}catch(n){}return 0});d.evaluator.setFunction(d.id+".stop",function(){try{d.audio.pause(),d.audio.currentTime=0}catch(n){}return 0});d.evaluator.setFunction(d.id+
".currentTime",function(a){try{d.audio.currentTime=parseFloat(a)}catch(f){}return 0});d.audio.addEventListener("timeupdate",function(){d.evaluator.setVariable(d.id+".currentTime",d.audio.currentTime);d.evaluator.setVariable(d.id+".playing",d.audio.paused?0:1);d.evaluator.setVariable(d.id+".duration",d.audio.duration)});return d};$jscomp.inherits(l,b.Control);l.prototype.init=function(){this.audio.style.left=this.x+"px";this.audio.style.top=this.y+"px";this.update()};l.prototype.update=function(){a=
this.evaluator;"string"!==typeof this.file&&(c=a.eval(this.file),this.old!==c&&(this.audio.src=this.old=c));h=0<a.eval(this.drawif);this.audio.style.display=h?"block":"none";h||h===this.oldDIF||this.audio.pause();this.oldDIF=h;this.updatePositionAndSize()};b.Audio=l;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,l=function(d,k){a=d=b.Control.call(this,d,k)||this;a.controls=k.controls||!0;a.file=k.file||"";a.oldDrawIf=0;c=a.evaluator;k=c.eval(a.expresion)[0];4==k.length?(a.w=k[2],a.h=k[3]):(a.w=null,a.h=null);k=a.file;var g=k.lastIndexOf(".");-1!=g&&(k=a.file.substring(0,g));a.video=b.newHTML("video",{poster:k+".png",style:"position:absolute;overflow:hidden;left:"+a.x+"px;top:"+a.y+"px;outline:none;background:rgba(0,0,0,0);"});a.autoplay&&a.video.setAttribute("autoplay",
"autoplay");a.loop&&a.video.setAttribute("loop","loop");a.controls&&a.video.setAttribute("controls","controls");a.w&&(a.video.setAttribute("width",a.w),a.video.setAttribute("height",a.h));a.video.canPlayType("video/mp4")&&(g=b.newHTML("source",{src:k+".mp4",type:"video/mp4"}),a.video.appendChild(g));a.video.canPlayType("video/ogg")&&(g=b.newHTML("source",{src:k+".ogg",type:"video/ogg"}),a.video.appendChild(g),g=b.newHTML("source",{src:k+".ogv",type:"video/ogg"}),a.video.appendChild(g));a.video.canPlayType("video/webm")&&
(g=b.newHTML("source",{src:k+".webm",type:"video/webm"}),a.video.appendChild(g));a.addControlContainer(a.video);c.setFunction(a.id+".play",function(){try{a.video.play()}catch(n){}return 0});c.setFunction(a.id+".pause",function(){try{a.video.pause()}catch(n){}return 0});c.setFunction(a.id+".stop",function(){try{a.video.pause(),a.video.currentTime=0}catch(n){}return 0});c.setFunction(a.id+".currentTime",function(b){try{a.video.currentTime=parseFloat(b)}catch(f){}return 0});a.video.addEventListener("timeupdate",
function(b){c.setVariable(a.id+".currentTime",a.video.currentTime)});return d};$jscomp.inherits(l,b.Control);l.prototype.init=function(){this.video.style.left=this.x+"px";this.video.style.top=this.y+"px";this.update()};l.prototype.update=function(){a=this;c=a.evaluator;(h=0<c.eval(a.drawif))?a.video.style.display="block":(a.video.style.display="none",h!==a.oldDrawIf&&a.video.pause());a.oldDrawIf=h;a.updatePositionAndSize()};b.Video=l;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,l,d=function(a,c){var d=b.Control.call(this,a,c)||this;d.font_family=c.font_family||"sansserif";d.style=c.style||",PLAIN,";d.font_size=c.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.evaluator.setVariable(d.id+"._scroll_x",0);d.evaluator.setVariable(d.id+"._scroll_y",0);d.region="interior";d.tabindex=++a.tabindex;d.answer&&(/^krypto_/.test(d.answer)&&(d.answer=
(new b.Krypto).decode(d.answer.substring(7))),d.parent.lessonParser.parseText(d.answer));d.containerControl=b.newHTML("div",{class:"DescartesTextAreaContainer",id:d.id,spellcheck:"false"});d.textArea=b.newHTML("textarea",{class:"DescartesTextArea",spellcheck:"false"});d.textAreaAnswer=b.newHTML("div",{class:"DescartesTextArea"});d.showButton=b.newHTML("div",{class:"DJS_Gradient"});d.containerControl.appendChild(d.textArea);d.containerControl.appendChild(d.textAreaAnswer);d.containerControl.appendChild(d.showButton);
d.cover=b.newHTML("div",{class:"TextfieldCover"});d.keyboard&&d.containerControl.appendChild(d.cover);d.addControlContainer(d.containerControl);d.showAnswer=!1;d.text=d.rawText||"";d.evaluator.setVariable(d.id,d.text);var f;d.evaluator.setFunction(d.id+".insertAtCursor",function(a){f=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=f;d.textArea.focus();
return 0});d.evaluator.setFunction(d.id+".update",function(){d.update()});d.evaluator.setFunction(d.id+".scrollTo",function(a){d.textArea.scrollTop=a});d.addEvents();d.init();return d};$jscomp.inherits(d,b.Control);d.prototype.init=function(){a=this;h=a.answer?30:7;c=a.evaluator;var d=a.text.replace(/\\n/g,"\n");a.containerControl.setAttribute("style","width:"+a.w+"px;height:"+a.h+"px;left:"+a.x+"px;top:"+a.y+"px;z-index:"+a.zIndex+";");var g="width:"+(a.w-6)+"px;height:"+(a.h-h)+"px;font:"+b.convertFont(a.font)+
";line-height:"+a.font_size+"px;";a.textArea.setAttribute("style",g);a.textArea.value=d;a.textAreaAnswer.setAttribute("style",g+"display:"+(a.showAnswer?"block":"none")+";");a.textAreaAnswer.innerHTML="<span>"+a.answer+"</span>";a.showButton.setAttribute("style","text-align:center;width:20px;height:16px;position:absolute;bottom:4px;right:4px;cursor:pointer;border:1px outset #c0c0c0;display:"+(a.answer?"block":"none")+";");a.showButton.innerHTML='<span style="position:relative;top:1px;text-align:center;font:11px '+
b.sansserif_font+';">S</span>';a.cover.setAttribute("style","position:absolute;width:"+a.w+"px;height:"+a.h+"px;left:0px;top:0px;");a.update()};d.prototype.update=function(){a=this;c=a.evaluator;a.activeIfValue=0<c.eval(a.activeif);a.drawIfValue=0<c.eval(a.drawif);c.getVariable(a.id)!==a.oldValue&&(a.textArea.value=(c.getVariable(a.id)||"").replace(/\\n/g,"\n"));l=a.textArea.value||"";l="\n"===l.charAt(l.length-1)?l.substring(0,l.length-1):l;l=l.replace(/\n/g,"\\n").replace(/\s/g," ");c.setVariable(a.id,
l);a.oldFieldValue=l;a.oldValue=c.getVariable(a.id);a.activeIfValue?a.textArea.removeAttribute("disabled"):a.textArea.setAttribute("disabled",!0);a.containerControl.style.display=a.drawIfValue?"block":"none";a.textArea.style["overflow-x"]=0<c.getVariable(a.id+"._scroll_x")?"auto":"unset";a.textArea.style["overflow-y"]=0<c.getVariable(a.id+"._scroll_y")?"auto":"unset";a.updatePositionAndSize()};d.prototype.changeValue=function(a){this.textArea.value=a;this.update()};d.prototype.addEvents=function(){var a=
this;a.showButton.addEventListener("mousedown",function(b){b.preventDefault();a.showAnswer=!a.showAnswer;a.textAreaAnswer.style.display=a.showAnswer?"block":"none";a.showButton.childNodes[0].childNodes[0].textContent=a.showAnswer?"T":"S";a.textArea.blur()});a.showButton.onmouseup=a.showButton.onmouseout=function(a){a.preventDefault()};a.textArea.addEventListener("blur",function(){a.cursorInd=window.getSelection().focusOffset});a.textArea.addEventListener("paste",function(a){a.preventDefault();document.execCommand("insertHTML",
!1,a.clipboardData.getData("text/plain").replace(/\n/g,"<br>"))});a.textArea.addEventListener("keydown",function(a){if("PageDown"===a.key||"PageUp"===a.key)a.stopPropagation(),a.preventDefault()});a.cover.addEventListener("pointerdown",function(b){b=a.evaluator.eval(a.kbexp);a.activeIfValue&&a.parent.keyboard.show(a,a.kblayout,b[0][0]||0,b[0][1]||0,a.id,a.textArea,!0)})};b.TextArea=d;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c=2*Math.PI,h,l,d,k,g,n,f,m,p,e,u,v,w=function(c,d){var f=b.Control.call(this,c,d)||this;l=c.evaluator.parser;a=f;a.spaceID=d.spaceID||"";a.text=d.text||"";a.size=d.size||l.parse("4");a.font=d.font||"Serif,PLAIN,12";a.image=new Image;a.image.onload=function(){this.ready=1};a.imageSrc=d.imageSrc||"";/^\[.*\]$/.test(a.imageSrc)?a.imageSrc=a.parser.parse(a.imageSrc.slice(1,-1)):a.imageSrc=a.parser.parse("'"+a.imageSrc+"'");a.font=b.convertFont(a.font);
if(a.constraintExpr){a.constraint=l.parse(a.constraintExpr);"(expr)"==a.constraint.type&&(a.constraint=l.parse(a.constraintExpr.substring(1,a.constraintExpr.length-1)));if("compOperator"==a.constraint.type){d=a.constraint.childs[0];var g=a.constraint.childs[1];"identifier"!=d.type||"y"!=d.value||g.contains("y")?"identifier"!=d.type||"x"!=d.value||g.contains("x")?a.newt=new b.R2Newton(a.evaluator,a.constraint):(a.constVar="y",a.noConstVar="x",a.evalConst=a.evalConstXoY,a.constraint=g):(a.constVar=
"x",a.noConstVar="y",a.evalConst=a.evalConstXoY,a.constraint=g)}else a.constraint=null;e=new b.R2(0,0)}a.container=a.getContainer();a.mouseCatcher=b.newHTML("div",{class:"DescartesGraphicControl",id:a.id,dragged:!0,tabindex:"-1",style:"z-index:"+a.zIndex+";"});a.ctx=a.space.ctx;a.container.appendChild(a.mouseCatcher);a.addEvents();a.xStr=a.id+".x";a.yStr=a.id+".y";a.activoStr=a.id+".activo";a.activeStr=a.id+".active";c=""!==a.space.id&&2!==c.version?a.space.id+".":"";a.mX=c+"mouse_x";a.mY=c+"mouse_y";
a.mClicked=c+"mouse_clicked";a.mClicIzq=c+"clic_izquierdo";a.init();return f};$jscomp.inherits(w,b.Control);w.prototype.init=function(c){a=this;h=a.evaluator;u=b.hasTouchSupport;c||(c=h.eval(a.expresion)[0],a.x=c[0],a.y=c[1],h.setVariable(a.xStr,a.x),h.setVariable(a.yStr,a.y));a.img_src_eval=h.eval(a.imageSrc).toString().trim();""==a.img_src_eval||/vacio.gif$/i.test(a.img_src_eval)?(a.width=2*h.eval(a.size),a.height=2*h.eval(a.size),a._w=u&&48>a.width?48:a.width,a._h=u&&48>a.height?48:a.height,a.mouseCatcher.style.borderRadius=
parseInt(Math.min(a._w,a._h)/2)+"px"):(a.image=a.parent.getImage(a.img_src_eval),a.width=a.image.width,a.height=a.image.height,a._w=Math.max(a.width,32),a._h=Math.max(a.height,32));a.mouseCatcher.style.width=a._w+"px";a.mouseCatcher.style.height=a._h+"px";a.mouseCatcher.style.left=parseInt(a.space.getAbsoluteX(a.x)-a._w/2)+"px";a.mouseCatcher.style.top=parseInt(a.space.getAbsoluteY(a.y)-a._h/2)+"px";h.setVariable(a.activoStr,0);h.setVariable(a.activeStr,0);a.setImage=!1;a.update()};w.prototype.update=
function(){a=this;h=a.evaluator;h.eval(a.imageSrc).toString().trim()!==a.img_src_eval&&a.init(!0);a.activeIfValue=0<h.eval(a.activeif);a.drawIfValue=0<h.eval(a.drawif);a.x=h.getVariable(a.xStr);a.y=h.getVariable(a.yStr);d=a.space.getAbsoluteX(a.x);k=a.space.getAbsoluteY(a.y);a.mouseCatcher.style.display=a.activeIfValue?"block":"none";a.mouseCatcher.style.left=parseInt(d-a._w/2)+"px";a.mouseCatcher.style.top=parseInt(k-a._h/2)+"px";a.constraint&&a.evalConst();a.draw()};w.prototype.draw=function(){a=
this;h=a.evaluator;a.drawIfValue&&(m=a.ctx,p=a.space.backgroundCtx,d=parseInt(a.space.getAbsoluteX(this.x))+.5,k=parseInt(a.space.getAbsoluteY(this.y))+.5,""!=a.text&&a.drawText(d,k),a.image.ready?(g=a.image.width/2,n=a.image.height/2,a.image.complete&&!a.setImage&&m.drawImage(a.image,parseInt(d-g),parseInt(k-n)),a.trace&&(p.save(),p.translate(d,k),p.scale(parseInt(g),parseInt(n)),p.beginPath(),p.arc(0,0,1,0,c),p.restore(),p.lineWidth=1,p.strokeStyle=a.trace.getColor(),p.stroke())):(g=parseInt(a.width/
2),m.beginPath(),m.arc(d,k,g,0,c),m.fillStyle=a.colorInt.getColor(),m.fill(),m.lineWidth=1,m.strokeStyle=a.color.getColor(),m.stroke(),a.active&&(m.strokeStyle=a.colorInt.borderColor(),m.beginPath(),m.arc(d,k,g-2,0,c),m.stroke()),a.trace&&(p.strokeStyle=a.trace.getColor(),p.beginPath(),p.arc(d,k,g,0,c),p.stroke())))};w.prototype.evalConst=function(){e.set(this.x,this.y);f=this.newt.findZero(e,1/this.space.scale,!0);this.x=f.x;this.y=f.y;this.evaluator.setVariable(this.xStr,this.x);this.evaluator.setVariable(this.yStr,
this.y)};w.prototype.evalConstXoY=function(){h=this.evaluator;v=h.getVariable(this.constVar);h.setVariable(this.constVar,this[this.constVar]);this[this.noConstVar]=h.eval(this.constraint);h.setVariable(this.xStr,this.x);h.setVariable(this.yStr,this.y);h.setVariable(this.constVar,v)};w.prototype.drawText=function(b,c){a=this;h=a.evaluator;m=a.ctx;m.fillStyle=a.color.getColor();m.textBaseline="alphabetic";"simpleText"==a.text.type?(m.font=a.font,m.fillText(a.text.toString(h.eval(a.decimals),a.fixed),
parseInt(b+1+a.width/2),parseInt(c-1-a.height/2))):(m.strokeStyle=a.color.getColor(),a.text.draw(m,parseInt(b+1+a.width/2),parseInt(c-1-a.height/2),a.decimals,a.fixed,"start",!0,a.color.getColor()))};w.prototype.getContainer=function(){for(var a=this.parent.spaces,b=$jscomp.makeIterator(a),c=b.next();!c.done;c=b.next())if(c=c.value,c.id==this.spaceID)return c.addCtr(this),this.zIndex=c.zIndex,this.space=c,c.graphicControlContainer;a[0].addCtr(this);this.zIndex=a[0].zIndex;this.space=a[0];return a[0].graphicControlContainer};
w.prototype.deactivate=function(){this.active=!1;this.evaluator.setVariable(this.activoStr,0);this.evaluator.setVariable(this.activeStr,0);this.evaluator.setVariable(this.mClicIzq,0)};w.prototype.addEvents=function(){function a(a){document.body.focus();a.preventDefault();g.whichBtn=b.whichBtn(a);"L"==g.whichBtn&&g.activeIfValue&&(g.parent.deactivateControls(),g.click=g.active=!0,g.evaluator.setVariable(g.activoStr,1),g.evaluator.setVariable(g.activeStr,1),g.evaluator.setVariable(g.mClicked,0),g.evaluator.setVariable(g.mClicIzq,
0),g.posAnte=b.getCursorPosition(a,g.container),g.prePos={x:g.space.getAbsoluteX(g.x),y:g.space.getAbsoluteY(g.y)},g.evaluator.setVariable(g.mX,g.space.getRelativeX(g.posAnte.x)),g.evaluator.setVariable(g.mY,g.space.getRelativeY(g.posAnte.y)),g.parent.update(),window.addEventListener("touchend",c),window.addEventListener("touchmove",d),window.addEventListener("mouseup",c),window.addEventListener("mousemove",d))}function c(a){document.body.focus();a.preventDefault();a.stopPropagation();g.evaluator.setVariable(g.mClicked,
1);g.evaluator.setVariable(g.mClicIzq,1);if(g.activeIfValue||g.active)g.click=!1,window.removeEventListener("mouseup",c),window.removeEventListener("mousemove",d),window.removeEventListener("touchend",c),window.removeEventListener("touchmove",d),f=b.getCursorPosition(a,g.container)||f,g.posX=g.prePos.x-(g.posAnte.x-f.x),g.posY=g.prePos.y-(g.posAnte.y-f.y),g.evaluator.setVariable(g.xStr,g.space.getRelativeX(g.posX)),g.evaluator.setVariable(g.yStr,g.space.getRelativeY(g.posY)),g.evaluator.setVariable(g.mX,
g.space.getRelativeX(f.x)),g.evaluator.setVariable(g.mY,g.space.getRelativeY(f.y)),g.parent.updateControls(),g.parent.update(),g.mouseCatcher.style.left=g.space.getAbsoluteX(g.x)-g._w/2+"px",g.mouseCatcher.style.top=g.space.getAbsoluteY(g.y)-g._h/2+"px";a=g.evaluator.getVariable(g.activeStr);g.parent.deactivateControls();g.parent.updateControls();g.evaluator.setVariable(g.activoStr,a);g.evaluator.setVariable(g.activeStr,a);g.parent.update()}function d(a){a.preventDefault();g.evaluator.setVariable(g.mClicked,
0);g.evaluator.setVariable(g.mClicIzq,0);f=b.getCursorPosition(a,g.container);g.posX=g.prePos.x-(g.posAnte.x-f.x);g.posY=g.prePos.y-(g.posAnte.y-f.y);g.evaluator.setVariable(g.xStr,g.space.getRelativeX(g.posX));g.evaluator.setVariable(g.yStr,g.space.getRelativeY(g.posY));g.evaluator.setVariable(g.mX,g.space.getRelativeX(f.x));g.evaluator.setVariable(g.mY,g.space.getRelativeY(f.y));80<Date.now()-e&&(g.parent.updateControls(),g.parent.update(),e=Date.now())}var e=0,f,g=this;g.click=!1;g.over=!1;g.active=
!1;g.mouseCatcher.addEventListener("touchstart",a);g.mouseCatcher.addEventListener("mousedown",a);g.mouseCatcher.addEventListener("mouseover",function(a){g.over=!0});g.mouseCatcher.addEventListener("mouseout",function(a){g.over=!1;g.click=!1})};b.GraphicControl=w;return b}(descartesJS||{});
descartesJS=function(b,a){function c(a){return a?a[0].toUpperCase()+a.substring(1):""}if(b.loadLib)return b;var h=/[\w-//]*(\.png|\.jpg|\.gif|\.svg|\.webp)/gi,l,d,k,g,n,f,m,p,e,u,v,w,q,r,y,x,z=function(a){this.parent=a;this.parser=a.evaluator.parser;this.RTFparser=new b.RTFParser(a.evaluator)};z.prototype.parseButtonsConfig=function(b){var c={rowsNorth:0,rowsSouth:0,widthEast:125,widthWest:125,height:23};b=this.split(b);for(var e=0,f=b.length;e<f;e++)switch(k=b[e][0],g=b[e][1],d=a[k],d){case "rowsNorth":case "rowsSouth":case "widthEast":case "widthWest":case "height":c[d]=
parseInt(g);break;case "about":case "config":case "init":case "clear":c[d]="true"===a[g];break;default:console.warn("Propiedad de botones no identificada: <"+k+"> valor: <"+g+">")}return c};z.prototype.parseSpace=function(c){n={};c=this.split(c);for(var e=0,f=c.length;e<f;e++)switch(k=c[e][0],g=c[e][1],d=a[k],b.DEBUG.paramName=k,b.DEBUG.objectName="Space",d){case "info":break;case "type":if("R2"===g||"R3"===g)g=a[g];n[d]=g;break;case "id":b.DEBUG.idName=g;case "x_axis":case "y_axis":case "cID":case "file":case "border_width":case "border_radius":n[d]=
g;break;case "fixed":case "numbers":case "sensitive_to_mouse_movements":case "3D":case "split":case "resizable":n[d]="true"===a[g];break;case "bg_display":case "render":n[d]=a[g];break;case "border_color":case "net":case "net10":case "axes":case "text":n[d]="";""!=g&&(n[d]="false"===a[g]?"":new b.Color(g,this.parent.evaluator));break;case "O.x":n.OxExpr=g;break;case "O.y":n.OyExpr=g;break;case "image":n.imageSrc=g;break;case "x":case "y":l=g.trim();var m="x"===d?this.parent.container.width:this.parent.container.height;
"%"===l[l.length-1]?(n[d+"PercentExpr"]=l,l=(m*parseFloat(l)/100).toString()):l=g.trim();n[d+"Expr"]=this.parser.parse(l);break;case "width":case "height":l=g.trim();n[d[0]+"ModExpr"]=l;"%"===l[l.length-1]?(n[d[0]+"Expr"]=l,l=this.parent.container[d]*parseFloat(l)/100):(l=parseFloat(g),l!=g&&(l=this.parent.container[d],n["_"+d[0]+"_"]=g.trim()));n[d[0]]=l;break;case "drawif":""!=g&&(n[d]=this.parser.parse(g));break;case "scale":l=parseFloat(g);isNaN(l)&&(l=48);n[d]=l;break;case "background":n[d]=
new b.Color(g,this.parent.evaluator);break;default:console.warn("Propiedad del espacio no identificada: <"+k+"> valor: <"+g+">")}return new b["Space"+n.type](this.parent,n)};z.prototype.parseControl=function(e){f={type:"Numeric",gui:"Spinner"};e=this.split(e);for(var m=0,h=e.length;m<h;m++)switch(k=e[m][0],g=e[m][1],d=a[k],b.DEBUG.paramName=k,b.DEBUG.objectName="Control",d){case "info":break;case "type":l=a[g.trim()];"graphic"===l?l="GraphicControl":"text"===l&&(l="TextArea");f[d]=c(l);break;case "gui":l=
a[g];"textfield"===l&&(l="TextField");f[d]=c(l);break;case "id":b.DEBUG.idName=g;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":f[d]=g;break;case "region":case "position":case "action":case "msg_pos":case "poster":case "text_align":case "image_align":case "btn_pos":f[d]=a[g];break;case "fixed":case "visible":case "discrete":case "onlyText":case "evaluate":case "autoplay":case "loop":case "controls":case "flat":case "keyboard":f[d]=
"true"===a[g];break;case "color":case "colorInt":case "label_color":case "label_text_color":case "trace":f[d]=new b.Color(g,this.parent.evaluator);break;case "font_size":case "drawif":case "activeif":case "decimals":case "min":case "max":case "size":""!==g&&(f[d]=this.parser.parse(g));break;case "constraint":f.constraintExpr=g;break;case "image":f.imageSrc=g;break;case "image_dec":f.image_dec_src=g;break;case "image_inc":f.image_inc_src=g;break;case "space":f.spaceID=g;break;case "expresion":case "kbexp":f[d]=
this.parser.parse(g.replace(")(",","));break;case "borderColor":f[d]="false"===a[g]?"":g;break;case "bold":case "italics":"false"!=a[g]&&(f[d]=d);break;case "underlined":"false"!=a[g]&&(f.underlined=!0);break;case "value":var p=g.replace(/&squot;/g,"'").replace(/^\|(.*)\|$/,"'$1'");f.valueExpr=this.parser.parse(p);f.valueExprString=p;break;case "incr":0!=g&&(f[d]=this.parser.parse(g));break;case "exponentialif":f[d]=parseFloat(g);break;case "text":f.rawText=g;p=this.parseText(g);for(var q=0,n=p.length;q<
n;q++)p[q]=this.parser.parse(p[q],!1);f[d]=p;break;default:p=k.indexOf("."),q=a[k.substring(0,p)],"font"===a[k.substring(p+1)]&&/parameter|Explanation|tooltip/.test(q)?f[q+"Font"]=g:console.warn("Propiedad de control no identificada: <"+k+"> valor: <"+g+">")}return new b["Numeric"===f.type?f.gui:f.type](this.parent,f)};z.prototype.parseGraphic=function(e,f,p,l){m={rotateExp:l,parameter:"t"};e=this.split(e);l=0;for(var q=e.length;l<q;l++)if(k=e[l][0],g=e[l][1],d=a[k],b.DEBUG.paramName=k,b.DEBUG.objectName=
"Graphic",""!=g)switch(d){case "info":break;case "type":b.DEBUG.idName=g;m[d]=c(a[g]);break;case "align":case "anchor":case "lineDash":m[d]=a[g];break;case "background":case "abs_coord":case "visible":case "editable":case "fixed":case "vectors":case "bold":case "italics":case "underlined":m[d]="true"===a[g];break;case "shadowColor":case "color":case "fill":case "fillP":case "fillM":case "arrow":case "trace":m[d]="false"===a[g]?"":new b.Color(g,this.parent.evaluator);break;case "border_size":case "shadowBlur":case "shadowOffsetX":case "shadowOffsetY":case "family":case "parameter":case "font":case "font_family":case "name":case "init":case "end":m[d]=
g;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":""!==g&&(m[d]=this.parser.parse(g));break;case "font_size":g=g.trim();/^\[.*\]$/.test(g)&&(g=g.slice(1,-1));""!==g&&(m[d]=this.parser.parse(g));break;case "space":m[d+"ID"]=g;break;case "expresion":""!==g&&("Macro"!==m.type?(m[d]=this.parser.parse(g),m.expresionString=g):m[d]=g);break;case "text":m[d]=g;break;
case "file":var n=g.replace(/&squot;/g,"'").trim();/^\[.*\]$/.test(n)&&(n=n.slice(1,-1));n.match(h)&&(n="'"+n+"'");n.startsWith("data:image/")?m[d]=this.parser.parse("'"+n+"'"):m[d]=this.parser.parse(n);break;case "border":""!=g&&"false"!=a[g]&&(m[d]=new b.Color(g,this.parent.evaluator));break;default:if(void 0!=m.family&&(n=m.family.length+1,k.substring(0,n)===m.family+".")){n=a[k.substring(n)];/interval|steps/.test(n)&&""!=g&&(m["family_"+n]=this.parser.parse(g));break}void 0!=m.parameter&&k.match(m.parameter+
".")?(n=k.substring(0,k.indexOf(m.parameter)+m.parameter.length),m.parameter!==n&&(m.parameter=n),n=a[k.substring(m.parameter.length+1)],/interval|steps/.test(n)&&""!=g&&(m["parameter_"+n]=this.parser.parse(g))):console.warn("Propiedad del gr\u00e1fico no identificada: <"+k+"> valor: <"+g+">")}f&&(m.abs_coord=f);p&&(m.background=p);return new b[m.type](this.parent,m)};z.prototype.parse3DGraphic=function(e,f,h,p){m={rotateExp:p,parameter:"t"};e=this.split(e);f=0;for(h=e.length;f<h;f++)switch(k=e[f][0],
g=e[f][1],d=a[k],b.DEBUG.paramName=k,b.DEBUG.objectName="Graphic3D",d){case "info":break;case "type":b.DEBUG.idName=g;l=a[g];m[d]=c(l);break;case "model":case "align":case "anchor":case "lineDash":m[d]=a[g];break;case "shadowColor":case "fill":m[d]="false"===a[g]?"":new b.Color(g,this.parent.evaluator);break;case "background":case "fixed":case "split":case "bold":case "italics":case "underlined":m[d]="true"===a[g];break;case "edges":"false"===a[g]?m[d]="":("true"===a[g]&&(g="808080"),m[d]=new b.Color(g,
this.parent.evaluator));break;case "border":""!=g&&"false"!=a[g]&&(m.border=new b.Color(g,this.parent.evaluator));break;case "color":case "backcolor":m[d]=new b.Color(g,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":""!=g&&(m[d]=this.parser.parse(g));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":m[d]=
g;break;case "space":m[d+"ID"]=g;break;case "expresion":/Macro|Curve|Surface/.test(m.type)?m[d]=g.replace(/\\n/g,";"):(m[d]=this.parser.parse(g),m.expresionString=g);break;case "text":m.text=g;break;case "file":p=g.replace(/&squot;/g,"'").trim();/^\[.*\]$/.test(p)&&(p=p.slice(1,-1));/./.test(p)&&(p="'"+p+"'");m[d]=this.parser.parse(p);break;default:if(void 0!=m.family&&(p=m.family.length+1,k.substring(0,p)===m.family+".")){p=a[k.substring(p)];/interval|steps/.test(p)&&""!=g&&(m["family_"+p]=this.parser.parse(g));
break}console.warn("Propiedad del gr\u00e1fico 3D no identificada: <"+k+"> valor: <"+g+">")}return new b[m.type+"3D"](this.parent,m)};z.prototype.parseAuxiliar=function(c){p={};c=this.split(c);for(var e=0,f=c.length;e<f;e++)c[e][1]=c[e][1].replace(/&squot;/g,"'");e=0;for(f=c.length;e<f;e++)switch(k=c[e][0],g=c[e][1],d=a[k],b.DEBUG.paramName=k,b.DEBUG.objectName="Auxiliar",d){case "info":case "code":case "doc":break;case "id":b.DEBUG.idName=g;case "file":case "init":case "doExpr":case "whileExpr":case "range":case "local":case "expresion":case "condition":case "parameter":p[d]=
g.replace(/&squot;/g,"'");break;case "editable":case "constant":case "array":case "matrix":case "algorithm":case "event":case "sequence":p[d]="true"===a[g];break;case "size":case "rows":case "columns":case "x":case "y":case "width":case "height":p[d]=this.parser.parse(g);break;case "evaluate":case "execution":case "msg_pos":case "action":case "type":p[d]=a[g];break;default:var m=k.indexOf("."),h=a[k.substring(0,m)];m=a[k.substring(m+1)];"parameter"===h&&"font"===m?p[h+"Font"]=g:console.warn("Propiedad del auxiliar no identificada: <"+
k+"> valor: <"+g+">")}p.sequence?p.type="sequence":p.constant?p.type="constant":p.algorithm&&p.evaluate?p.type="algorithm":p.array&&!p.matrix&&")"!=p.id.charAt(p.id.length-1)?p.type="vector":p.matrix&&")"!=p.id.charAt(p.id.length-1)?p.type="matrix":p.event&&")"!=p.id.charAt(p.id.length-1)?p.type="event":"library"===p.type?p.type="library":")"===p.id.charAt(p.id.length-1)?p.type="function":p.type="variable";b.DEBUG.typeName=p.type;switch(p.type){case "sequence":new b.Function(this.parent,p);break;
case "constant":c=new b.Constant(this.parent,p);p.evaluate&&"always"===p.evaluate&&this.parent.auxiliaries.push(c);break;case "algorithm":this.parent.auxiliaries.push(new b.Algorithm(this.parent,p));break;case "vector":c=new b.Vector(this.parent,p);p.evaluate&&"always"===p.evaluate&&this.parent.auxiliaries.push(c);break;case "matrix":c=new b.Matrix(this.parent,p);p.evaluate&&"always"===p.evaluate&&this.parent.auxiliaries.push(c);break;case "event":this.parent.events.push(new b.Event(this.parent,p));
break;case "library":new b.Library(this.parent,p);break;case "variable":new b.Variable(this.parent,p);break;default:new b.Function(this.parent,p)}};z.prototype.parseAction=function(a){return a.action?new (b[c(a.action)])(a.parent,a.parameter):{execute:function(){}}};z.prototype.parseAnimation=function(c){var e={};c=this.split(c);for(var f=0,m=c.length;f<m;f++)switch(k=c[f][0],g=c[f][1],d=a[k],b.DEBUG.pName=k,b.DEBUG.objectName="Animation",d){case "info":break;case "id":case "delay":case "init":case "doExpr":case "whileExpr":e[d]=
g.replace(/&squot;/g,"'");break;case "controls":case "auto":case "loop":case "algorithm":case "evaluate":e[d]="true"===a[g];break;default:console.warn("Propiedad de la animaci\u00f3n no identificada: <"+k+"> valor: <"+g+">")}return new b.Animation(this.parent,e)};z.prototype.split=function(a){if("string"!==typeof a)return[];e=[];a=(a||"").replace(/\\'/g,"\u2019");u=v=q=0;for(w=r=!1;u<a.length;)" "!==a[u]||w||u++," "===a[u]||w||(w=!0,q=u),"="!==a[u]||"'"!==a[u+1]||r||(r=!0,e[v]=[a.substring(q,u)],
q=u+2,u+=2),r&&"'"===a[u]&&(w=r=!1,e[v].push(a.substring(q,u)),v++),"="!==a[u]||"'"===a[u+1]||r||(e[v]=[a.substring(q,u)],q=u+1,u++,y=a.substring(u).indexOf("="),-1===y?y=x=a.length:(y+=u,x=a.substring(u,y).lastIndexOf(" "),x=-1===x?a.length:x+u),e[v].push(a.substring(q,x)),v++,w=!1,u=x),u++;return e};z.prototype.parseText=function(a){a=void 0===a?"":a;return/^\{\\rtf1/.test(a)?this.RTFparser.parse(a.substring(10)):new b.SimpleText(this.parent,a)};b.LessonParser=z;return b}(descartesJS||{},babel);
descartesJS=function(b){function a(){return parseFloat(this.value)}function c(){return this.value.replace(/\\u0027/g,"'")}function h(a,b){var 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}function l(a){try{var b=a.getVector(this.value,this.childs[0].childs[0].evaluate(a));return void 0!==b?b:0}catch(aa){return 0}}function d(a){try{var b=
a.getMatrix(this.value,this.childs[0].childs[0].evaluate(a),this.childs[0].childs[1].evaluate(a));return void 0!==b?b:0}catch(aa){return 0}}function k(a){return a.functions[this.value].apply(a,this.childs[0].childs.map(function(b){return b.evaluate(a)}))}function g(a){var c=this.childs[0].evaluate(a,!0);a=this.childs[1].evaluate(a,!0);if("matrix"!==c.type||"matrix"!==a.type)return"number"==typeof c&&"string"==typeof a?c=b.removeNeedlessDecimals(c.toString()):"string"==typeof c&&"number"==typeof a&&
(a=b.removeNeedlessDecimals(a.toString())),c+a;W=c.rows;T=c.cols;R=K(W,T);for(S=0;S<W;S++)for(V=0;V<T;V++)R[V][S]=c[V][S]+a[V][S];return R}function n(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;W=b.rows;T=b.cols;R=K(W,T);for(S=0;S<W;S++)for(V=0;V<T;V++)R[V][S]=b[V][S]-a[V][S];return R}function f(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:P(b,a)}function m(a){var b=
this.childs[0].evaluate(a,!0);a=this.childs[1].evaluate(a,!0);if("matrix"!==b.type||"matrix"!==a.type)return b/a;var c=K(a.length,a.length),d=E(a);if(0===d)a=0;else{d=1/d;if(1<a.length)for(var e=0,f=a.length;e<f;e++){var g=d;for(var m=0;m<f;m++)c[m][e]=g*E(N(e,m,a)),g=-g;d=-d}else c[0][0]=d;a=c}b=0===a?K(b.rows,b.cols):P(b,a);return b}function p(a){var b=this.childs[0].evaluate(a);a=this.childs[1].evaluate(a);return b-L(b/a)*a}function e(a){var b=this.childs[0].evaluate(a);a=this.childs[1].evaluate(a);
return 0<=a?Q(b,a):1/Q(b,-a)}function u(a){return+(this.childs[0].evaluate(a)<this.childs[1].evaluate(a))}function v(a){return+(this.childs[0].evaluate(a)<=this.childs[1].evaluate(a))}function w(a){return+(this.childs[0].evaluate(a)>this.childs[1].evaluate(a))}function q(a){return+(this.childs[0].evaluate(a)>=this.childs[1].evaluate(a))}function r(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)}function y(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)}function x(a){return this.childs[0].evaluate(a)?this.childs[1].evaluate(a)?1:0:0}function z(a){return this.childs[0].evaluate(a)?1:this.childs[1].evaluate(a)?1:0}function A(a){return+!this.childs[0].evaluate(a)}function C(a){return 0<this.childs[0].evaluate(a)?this.childs[1].evaluate(a):this.childs[2]?this.childs[2].evaluate(a):0}function H(a){return this.childs[0].evaluate(a)}
function D(a){return-this.childs[0].evaluate(a)}function F(a,b){return this.childs[0].evaluate(a,b)}function G(a){return 1===this.childs.length&&1===this.childs[0].childs.length&&"(expr)"===this.type?this.childs[0].childs[0].evaluate(a):this.childs.map(function(b){return b.childs.map(function(b){return b.evaluate(a)})})}function B(a){var b=this.childs[0],c=b.childs[0]?b.childs[0].childs:null,d=this.childs[1].evaluate(a);a.setVector(b.value,c[0].evaluate(a),d);return d}function I(a){var b=this.childs[0],
c=b.childs[0]?b.childs[0].childs:null,d=this.childs[1].evaluate(a);a.setMatrix(b.value,c[0].evaluate(a),c[1].evaluate(a),d);return d}function O(a){var b=this.childs[0],c=this.childs[1].evaluate(a);return c.type?a.matrices[b.value]=c:"object"!==typeof a.variables[b.value]?a.variables[b.value]=c:0}function Q(a,b){if(0==b)return 1;if(0>b)return NaN;if(0<=a||L(b)===b)return Math.pow(a,b);if(0>a){var c=1/b,d=L(c);if(d===c&&1===d%2)return-Math.pow(-a,b)}return NaN}function K(a,b){R=[];R.type="matrix";R.rows=
a;R.cols=b;S=0;for(Z=b;S<Z;S++)R[S]=Array(a).fill(0);return R}function P(a,b){W=a.rows;T=a.cols;R=K(W,T);var c;for(S=0;S<W;S++)for(V=0;V<T;V++){for(Z=c=0;Z<T;Z++)c+=a[Z][S]*b[V][Z];R[V][S]=c}return R}function N(a,b,c){for(var d=K(c.length-1,c.length-1),e=0,f=d.length;e<f;e++)for(var g=0;g<f;g++)d[e][g]=e<a?g<b?c[e][g]:c[e][g+1]:e<b?c[e+1][g]:c[e+1][g+1];return d}function E(a){if(1<a.cols){for(var b=0,c=1,d=0,e=a.cols;d<e;d++)b+=c*a[0][d]*E(N(0,d,a)),c=-c;return b}return a[0][0]}if(b.loadLib)return b;
var L=Math.floor,J,M,U,Y,W,T,R,V,S,Z,X=function(a,b){this.sep="";this.type=a;this.value=b;this.parent=null;this.childs=[]};X.prototype.getRoot=function(){return null===this.parent?this:this.parent.getRoot()};X.prototype.addChild=function(a){a.parent=this;this.childs.push(a)};X.prototype.replaceLastChild=function(a){M=this.childs.length-1;J=this.childs[M];J.parent=null;this.childs[M]=a;a.parent=this;return a};X.prototype.contains=function(a){return this.value===a?!0:this.childs.some(function(b){return b.contains(a)})};
X.prototype.equalToMinus=function(){return"compOperator"===this.type?(this.type="operator",this.value="-",Y=new X("compOperator","=="),Y.addChild(this),Y.addChild(new X("number","0")),U=this.getRoot(),U.setAllEvalFun(),U):this};X.prototype.getChildren=function(){if("(expr)"===this.type||"[expr]"===this.type){if(this.childArray)return this.childArray;this.childArray=[];for(var a=$jscomp.makeIterator(this.childs),b=a.next();!b.done;b=a.next())b=b.value,/square_bracket|parentheses/.test(b.type)&&this.childArray.push.apply(this.childArray,
$jscomp.arrayFromIterable(b.childs));return this.childArray}return null};X.prototype.setAllEvalFun=function(){this.setEvalFun();for(var a=$jscomp.makeIterator(this.childs),b=a.next();!b.done;b=a.next())b.value.setAllEvalFun()};X.prototype.setEvalFun=function(){if("number"===this.type)this.evaluate=a;else if("string"===this.type)this.evaluate=c;else if("identifier"===this.type&&0===this.childs.length)this.evaluate=h;else if("identifier"===this.type&&"square_bracket"===this.childs[0].type&&1===this.childs[0].childs.length)this.evaluate=
l;else if("identifier"===this.type&&"square_bracket"===this.childs[0].type&&1<this.childs[0].childs.length)this.evaluate=d;else if("identifier"===this.type&&"parentheses"===this.childs[0].type)this.evaluate=k;else if("operator"===this.type)"+"===this.value?this.evaluate=g:"-"===this.value?this.evaluate=n:"*"===this.value?this.evaluate=f:"/"===this.value?this.evaluate=m:"%"===this.value?this.evaluate=p:"^"===this.value&&(this.evaluate=e);else if("compOperator"===this.type)"<"===this.value?this.evaluate=
u:"<="===this.value?this.evaluate=v:">"===this.value?this.evaluate=w:">="===this.value?this.evaluate=q:"=="===this.value?this.evaluate=r:"!="===this.value&&(this.evaluate=y);else if("boolOperator"===this.type)"&"===this.value?this.evaluate=x:"|"===this.value?this.evaluate=z:"!"===this.value&&(this.evaluate=A);else if("conditional"===this.type)this.evaluate=C;else if("sign"===this.type)this.evaluate="sign+"===this.value?H:D;else if("parentheses"===this.type)this.evaluate=F;else if("(expr)"===this.type||
"[expr]"===this.type)this.evaluate=G;else if("assign"===this.type){var b=this.childs[0],S=b.childs[0]?b.childs[0].childs:null;this.evaluate=1===b.childs.length&&"square_bracket"===b.childs[0].type&&1===S.length?B:1===b.childs.length&&"square_bracket"===b.childs[0].type&&2===S.length?I:O}};b.Node=X;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,l,d,k,g,n,f=/^\s+/,m=/^[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]*)*/,p=/^([0-9]+[.][0-9]+|[.][0-9]+|[0-9]+)/,e=/^(==|!=|<=|<|>=|>|#)/,u=/^(!|~|&&|&|\|\||\|)/,v=/^(=|:=)/,w=/^[\?:]/,q=/^[\+\-\*\/%\^\u2212\u00b7\u00D7\u00F7]/,r=/^(\[|\])/,y=/^(\(|\))/,x=/^,/,z=/^;/,A=/\|/g,C=/\|\*/g,H=/\*\|/g,D=/^\/\//g,F=/:\/\//g,G,B=/rnd|pi|e|Infinity|-Infinity|sqr|sqrt|ra\u00edz|exp|log|log10|abs|ent|sgn|ind|sin|sen|cos|tan|cot|sec|csc|sinh|senh|cosh|tanh|coth|sech|csch|asin|asen|acos|atan|min|max/,
I=function(){};I.prototype.tokenize=function(B){function G(a,b,d){c.push({type:a,value:b});k=k.slice(d);l+=d;n=a}if(a=B){B=B.replace(/\\u(\S+) /g,function(a,b){return 39!==parseInt(b,16)?String.fromCharCode(parseInt(b,16)):a}).replace(/&sup(.+?);/g,"^$1 ").replace(/&squot;/g,"'").replace(/\brnd\b/g,"random()");B.match(/=\|\*/g)&&(B=B.replace(C,"'").replace(H,"'"));B.match(/=\|/g)&&(B=B.replace(A,"'"));var I=B.trim();"|"==I[0]&&"|"==I[I.length-1]&&(B=I.replace(A,"'"))}c=[];h=!1;l=0;k=B;for(n="";B&&
l<B.length;)if(h=l,"'"==k[0]){for(g=1;"'"!=k[g];)if(g<k.length)g++;else return;d=k.substring(1,g);G("string",d,d.length+2)}else{if(d=k.match(D))if(k.match(F))continue;else{l=2*B.length;break}if(d=k.match(f))k=k.slice(d[0].length),l+=d[0].length;else if(d=k.match(q))d[0]=d[0].replace(/\u00F7/g,"/").replace(/\u2212/g,"-").replace(/\u00b7/g,"*").replace(/\u00D7/g,"*"),G("operator",d[0],d[0].length);else if(d=k.match(m))"number"===n&&c.push({type:"operator",value:"*"}),G("identifier",d[0],d[0].length);
else if(d=k.match(p))G("number",d[0],d[0].length);else if(d=k.match(e))I=d[0],"#"==I&&(I="!="),G("compOperator",I,d[0].length);else if(d=k.match(u))I=d[0],"||"==I?I="|":"&&"==I?I="&":"~"==I&&(I="!"),G("boolOperator",I,d[0].length);else if((d=k.match(v))&&!/^==/.test(k))G("assign",d[0],d[0].length);else if(d=k.match(w))G("conditional",d[0],d[0].length);else if(d=k.match(r))G("square_bracket",d[0],d[0].length);else if(d=k.match(y))"("==d&&"number"===n&&c.push({type:"operator",value:"*"}),G("parentheses",
d[0],d[0].length);else if(d=k.match(x))G("separator",d[0],d[0].length);else if(178===k.charCodeAt(0))c.push({type:"operator",value:"^"}),G("number",2,1);else if(179===k.charCodeAt(0))c.push({type:"operator",value:"^"}),G("number",3,1);else if(d=k.match(z))G("final_of_expression",d[0],d[0].length);else if(h==l){b.DEBUG.setError(b.DEBUG.EXPRESSION,a);return}}return c};I.prototype.flatTokens=function(a,b){a=void 0===a?[]:a;b=void 0===b?"":b;G="";a=$jscomp.makeIterator(a);for(var c=a.next();!c.done;c=
a.next())c=c.value,G="string"==c.type?G+("&squot;"+c.value+"&squot;"):"identifier"!=c.type||B.test(c.value)?G+c.value:G+(b+c.value);return G};b.Tokenizer=I;return b}(descartesJS||{});
descartesJS=function(b){function a(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 c(a){a=String(a).trim().replace(/^'|'$/g,"");var b=parseFloat(a);return isNaN(b)||String(b)!==a?a:b}function h(a,b,c,d){console.info("Error"+a+": en la expresi\u00f3n \u300a"+b+"\u300b, en el token {valor: "+c+", tipo: "+d+"}")}if(b.loadLib)return b;b.reservedIds="-_-_NUM_MAX_ITE_ALG_-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-piso-ceil-techo-round-redondeo-trunc-truncamiento-min-max-_Trace_-_Print_-_Num_-isNumber-esN\u00famero-random-aleatorio-_Stop_Audios_-parent.set-parent.update-parent.exec-toFixed-_NumToStr_-_NumACadena_-charAt-_charAt_-_letraEn_-substring-_substring_-_subcadena_-strLength-_length_-_longitud_-indexOf-_indexOf_-\u00edndiceDe-lastIndexOf-replace-_replace_-_reemplazar_-toLowerCase-toUpperCase-trim-_Load_-_GetValues_-_GetMatrix_-_MatrixToStr_-_StrToMatrix_-_GetVector_-_VectorToStr_-_StrToVector_-_ExecStr_-_ExecBlock_-_Save_-_SaveSpace_-_Open_-_SaveState_-_OpenState_-_AnchoDeCadena_-_strWidth_-R-G-B-_Rojo_-_Red_-_Verde_-_Green_-_Azul_-_Blue_-DJS.typeof-DJS.squote-DJS.comma-DJS.w-DJS.h-";
var l,d,k,g,n,f,m,p,e,u,v=function(a){this.evaluator=a;this.tokenizer=new b.Tokenizer;this.vectors={};this.matrices={};this.variables={};this.functions={};this.definitions={};this.registerDefaultValues();this.registerExternalValues&&this.registerExternalValues()};v.prototype.parse=function(c,q){(l=this.tokenizer.tokenize(c))||(l=[]);d=null;q=!q||!1;for(var v=f=n=g=0,w=l.length;v<w;v++){m=l[v];p=m.value;e=m.type;if("identifier"===e)if(l[v+1]&&"parentheses"===l[v+1].type&&"("===l[v+1].value)this.functions.hasOwnProperty(p)||
(this.functions[p]=function(){return 0});else if(l[v+1]&&"square_bracket"===l[v+1].type&&"["===l[v+1].value)l[v+3]&&"square_bracket"===l[v+3].type&&"]"===l[v+3].value?this.vectors.hasOwnProperty(p)||(this.vectors[p]=[0,0,0]):this.matrices.hasOwnProperty(p)||(this.matrices[p]=[[0,0,0],[0,0,0],[0,0,0]]);else{var x=p.match(/(\w*)(\.mouse_x|\.mouse_y|\.mouse_pressed|\.mouse_clicked|\.clic_izquierdo)$/);x&&(this.variables[x[1]+".DJS_NO_FIXED"]=1)}"assign"===e&&q&&":="!=p&&(e="compOperator",p="==");if("assign"===
e)if(k=new b.Node(e,p),null!=d){q=!0;if("identifier"===d.type)d.parent&&d.parent.replaceLastChild(k),k.addChild(d);else if("square_bracket"===d.type)k.addChild(d.parent);else{k.type="compOperator";for(k.value="==";d.parent&&a(d.parent.value)>=a(k.value);)d=d.parent;d.parent&&d.parent.replaceLastChild(k);k.addChild(d)}d=k}else{h(1,c,p,e);break}else if("parentheses"===e&&"("===p||"square_bracket"===e&&"["===p)if(k=new b.Node(e,p),"("===p&&g++,"["===p&&n++,null===d)"("===p&&(new b.Node("(expr)","(expr)")).addChild(k),
"["===p&&(new b.Node("[expr]","[expr]")).addChild(k),d=k;else if("operator"===d.type||"boolOperator"===d.type||"compOperator"===d.type||"conditional"===d.type||"assign"===d.type)d.addChild(k),d=k;else if("sign"===d.type)d.addChild(k),d=k;else if("parentheses"===d.type&&"("===d.value)d.addChild(k),d=k;else if("square_bracket"===d.type&&"["===d.value)d.addChild(k),d=k;else if("parentheses"===d.type&&"()"===d.value)d.parent.addChild(k),d=k;else if("square_bracket"===d.type&&"[]"===d.value)d.parent.addChild(k),
d=k;else if("identifier"===d.type)d.addChild(k),d=k;else{h(2,c,p,e);break}else if("parentheses"===e&&")"===p)if(g--,null===d)h(3,c,p,e);else{for(;d&&d.parent&&("("!=d.value||"("==d.value&&"parentheses"!=d.type);)d=d.parent;if(d&&"("===d.value)d.value="()";else{h(4,c,p,e);break}}else if("square_bracket"===e&&"]"===p)if(n--,null===d)h(5,c,p,e);else{for(;d&&d.parent&&("["!=d.value||"["==d.value&&"square_bracket"!=d.type);)d=d.parent;if(d&&"["===d.value)d.value="[]";else{h(6,c,p,e);break}}else if("number"===
e||"string"===e||"identifier"===e)if(k=new b.Node(e,p),null===d)d=k;else if("operator"===d.type||"compOperator"===d.type||"boolOperator"===d.type||"parentheses"===d.type&&"("===d.value||"square_bracket"===d.type&&"["===d.value||"sign"===d.type||"conditional"===d.type||"assign"===d.type)d.addChild(k),d=k;else break;else if("operator"===e||"compOperator"===e||"boolOperator"===e)if(k=new b.Node(e,p),null===d)if("-"===p||"+"===p)k.type="sign",k.value="sign"+p,d=k;else if("!"===p)d=k;else{h(8,c,p,e);break}else if("operator"===
d.type||"compOperator"===d.type||"boolOperator"===d.type||"assign"===d.type||"conditional"===d.type||"square_bracket"===d.type&&"["===d.value&&("-"===p||"+"===p||"!"===p)||"parentheses"===d.type&&"("===d.value&&("-"===p||"+"===p||"!"===p)){if("-"===p||"+"===p)k.type="sign",k.value="sign"+p;d.addChild(k);d=k}else if("number"===d.type||"parentheses"===d.type&&"()"===d.value||"square_bracket"===d.type&&"[]"===d.value||"string"===d.type||"identifier"===d.type||"conditional"===d.type||"assign"===d.type){for(;d.parent&&
a(d.parent.value)>=a(k.value);)d=d.parent;d.parent&&d.parent.replaceLastChild(k);k.addChild(d);d=k}else{h(9,c,p,e);break}else if("conditional"===e)if(k=new b.Node(e,p),null!=d)if("?"===k.value){for(f++;d.parent&&a(d.parent.value)>a(k.value);)d=d.parent;d.parent&&d.parent.replaceLastChild(k);k.addChild(d);d=k}else{for(f--;d&&d.parent&&("?"!=d.value||"?"==d.value&&"conditional"!=d.type);)d=d.parent;if(d&&"?"===d.value)d.value="?:";else{h(10,c,p,e);break}}else{h(11,c,p,e);break}else if("separator"===
e)if(null!=d)for(;d.parent&&"("!=d.value&&"["!=d.value;)d=d.parent;else{h(12,c,p,e);break}else{h(13,c,p,e);break}}0<g&&b.DEBUG.setError(b.DEBUG.PARENTHESIS_CLOSING,c);0>g&&b.DEBUG.setError(b.DEBUG.PARENTHESIS_OPENING,c);0<n&&b.DEBUG.setError(b.DEBUG.BRACKET_CLOSING,c);0>n&&b.DEBUG.setError(b.DEBUG.BRACKET_OPENING,c);0!=f&&b.DEBUG.setError(b.DEBUG.INCOMPLETE_IF,c);(u=d?d.getRoot():null)&&u.setAllEvalFun();return u};v.prototype.registerDefaultValues=function(){var a=Date.now(),d=this;d.variables._NUM_MAX_ITE_ALG_=
1E5;d.variables.pi=d.variables["\u03c0"]=Math.PI;d.variables.e=Math.E;d.variables.Infinity=Infinity;d.variables["-Infinity"]=-Infinity;d.variables.isTouch=d.variables["esT\u00e1ctil"]=b.hasTouchSupport?1:0;d.variables.device=d.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(d.variables,
{screenOrientation:{get:function(){return window.matchMedia("(orientation: landscape)").matches?"landscape":"portrait"}},screenWidth:{get:function(){return window.innerWidth}},screenHeight:{get:function(){return window.innerHeight}}});d.variables["DJS.squote"]="\\u0027";d.variables["DJS.comma"]="\\u002C";var e={};d.functions._Eval_=function(a){a=void 0===a?"":a;if(""==a)return 0;if("number"==typeof a)return"NaN";var b=a.replace(",",".");/,/.test(a)&&parseFloat(b)==b&&(a=b);if(void 0==e[a])if(b=a.match(/:=/g)?
!0:!1,/;/.test(a)){for(var c=!1,f,g=[],m=0,k=0,h=a.length;k<h;k++)f=a[k],"'"===f&&(c=!c),c||";"!==f||(g.push(a.substring(m,k)),m=k+1);g.push(a.substring(m));e[a]=d.parse("("+g.join(")(")+")",b)}else e[a]=d.parse(a,b);a=d.evaluator.eval(e[a]);return void 0!=a?a:"NaN"};d.functions.sqr=function(a){return a*a};d.functions.sqrt=d.functions["ra\u00edz"]=Math.sqrt;d.functions.exp=Math.exp;d.functions.log=Math.log;d.functions.log10=Math.log10?Math.log10:function(a){return Math.log(a)/Math.log(10)};d.functions.abs=
Math.abs;d.functions.ent=function(a){return Math.trunc(parseFloat(a)+1E-16*Math.sign(a))};d.functions.sgn=Math.sign;d.functions.ind=function(a){return a?1:0};d.functions.sin=d.functions.sen=Math.sin;d.functions.cos=Math.cos;d.functions.tan=Math.tan;d.functions.cot=function(a){return 1/Math.tan(a)};d.functions.sec=function(a){return 1/Math.cos(a)};d.functions.csc=function(a){return 1/Math.sin(a)};d.functions.sinh=d.functions.senh=Math.sinh?Math.sinh:function(a){return(Math.exp(a)-Math.exp(-a))/2};
d.functions.cosh=Math.cosh?Math.cosh:function(a){return(Math.exp(a)+Math.exp(-a))/2};d.functions.tanh=Math.tanh?Math.tanh:function(a){return(Math.exp(a)-Math.exp(-a))/(Math.exp(a)+Math.exp(-a))};d.functions.coth=function(a){return 1/d.functions.tanh(a)};d.functions.sech=function(a){return 1/d.functions.cosh(a)};d.functions.csch=function(a){return 1/d.functions.sinh(a)};d.functions.asin=d.functions.asen=Math.asin;d.functions.acos=Math.acos;d.functions.atan=Math.atan;d.functions.atan2=Math.atan2;d.functions.floor=
d.functions.piso=Math.floor;d.functions.ceil=d.functions.techo=Math.ceil;d.functions.round=d.functions.redondeo=Math.round;d.functions.trunc=d.functions.truncamiento=Math.trunc;d.functions.min=Math.min;d.functions.max=Math.max;d.functions._Trace_=d.functions._Print_=function(){console.info.apply(console,arguments);return 0};d.functions._Num_=function(a){if("number"==typeof a)return"NaN";a=a.replace(",",".");return parseFloat(a)==a?parseFloat(a):"NaN"};d.functions.isNumber=d.functions["esN\u00famero"]=
function(a){return Number.isFinite(a)?1:0};d.functions.random=d.functions.aleatorio=function(a,b){a=isNaN(parseFloat(a))?0:parseFloat(a);b=isNaN(parseFloat(b))?1:parseFloat(b);a>b&&(b=$jscomp.makeIterator([b,a]),a=b.next().value,b=b.next().value);return a+Math.random()*(b-a)};d.functions._Stop_Audios_=function(){d.evaluator.parent.stopAudios()};window.parent!==window&&(d.functions["parent.set"]=function(a,b){window.parent.postMessage({type:"set",name:a,value:b},"*");return 0},d.functions["parent.update"]=
function(){window.parent.postMessage({type:"update"},"*");return 0},d.functions["parent.exec"]=function(a,b){window.parent.postMessage({type:"exec",name:a,value:b},"*");return 0});d.functions.toFixed=d.functions._NumToStr_=d.functions._NumACadena_=function(a,b){a=isNaN(parseFloat(a))?0:parseFloat(a);return a.toFixed(parseInt(b||0)).replace(".",d.evaluator.parent.decimal_symbol)};d.functions.charAt=d.functions._charAt_=d.functions._letraEn_=function(a,b){a=(a||"").toString();b=isNaN(parseInt(b))?0:
parseInt(b);return a.charAt(b)};d.functions.substring=d.functions._substring_=d.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):""};d.functions.strLength=d.functions._length_=d.functions._longitud_=function(a){return(a||"").toString().length};d.functions.indexOf=d.functions._indexOf_=d.functions["_\u00edndiceDe_"]=function(a,b){return(a||
"").toString().indexOf((b||"").toString())};d.functions.lastIndexOf=function(a,b){return(a||"").toString().lastIndexOf((b||"").toString())};d.functions.replace=d.functions._replace_=d.functions._reemplazar_=function(a,b,c){a=(a||"").toString();b=(b||"").toString();c=(c||"").toString();for(var d=a.indexOf(b);0<=d;)a=a.substring(0,d)+c+a.substring(d+b.length),d=a.indexOf(b,d+c.length);return a};d.functions.toLowerCase=function(a){return(a||"").toString().toLowerCase()};d.functions.toUpperCase=function(a){return(a||
"").toString().toUpperCase()};d.functions.trim=function(a){return(a||"").toString().trim()};d.functions._Load_=function(a){var c="";a&&(c=(c=document.getElementById(a))&&"descartes/archivo"==c.type?c.text:b.openFile(a));return c||""};d.functions._GetValues_=function(a,b){return d.functions._ExecBlock_(d.functions._Load_(a).replace(/&brvbar;/g,String.fromCharCode("166")),b)};d.functions._GetMatrix_=function(a,b){return d.functions._StrToMatrix_(d.functions._Load_(a).replace(/&brvbar;/g,String.fromCharCode("166")),
b)};d.functions._MatrixToStr_=function(a){var c=d.matrices[a];if(c){for(var e="<"+a+">\\n",f=d.evaluator.getVariable(a+".columnas_usadas")||c.cols||0,g=d.evaluator.getVariable(a+".filas_usadas")||c.rows||0,m,k=0;k<f;k++){for(var h=0;h<g;h++)m=c[k][h],void 0!==m&&("string"==typeof m?m="'"+m+"'":"number"==typeof m&&(m=b.removeNeedlessDecimals(m.toFixed(6))),e+=m+(h<g-1?" \u00a6 ":""));e=e.replace(/(\u00A6 )$/g,"")+"\\n"}return e+"</"+a+">"}return""};d.functions._StrToMatrix_=function(a,b){var e=[],
f=!1,g=!1;e.type="matrix";if(a){a=a.replace(/\r|\\r/g,"").split(/\n|\\n/);for(var m=0,k=a.length;m<k;m++)a[m].match("<"+b+">")?(g=!0,f=a[m].trim().split("<"+b+">"),2==f.length&&""!=f[1]&&e.push(f[1].split(String.fromCharCode("166")).map(c)),f=!0):(a[m].match("</"+b+">")&&(f=a[m].trim().split("</"+b+">"),2==f.length&&""!=f[0]&&e.push(f[0].split(String.fromCharCode("166")).map(c)),f=!1,m=a.length),f&&e.push(a[m].split(String.fromCharCode("166")).map(c)));d.matrices[b]=e;d.matrices[b].rows=e&&e[0]&&
e[0].length?e[0].length:0;d.matrices[b].cols=e&&e.length?e.length:0;d.evaluator.setVariable(b+".filas",d.matrices[b].rows);d.evaluator.setVariable(b+".columnas",d.matrices[b].cols)}return g?"OK":"ERROR"};d.functions._GetVector_=function(a,b){return d.functions._StrToVector_(d.functions._Load_(a),b)};d.functions._VectorToStr_=function(a){var b=d.vectors[a];if(b){for(var c="<"+a+">\\n",e=d.evaluator.getVariable(a+".long_usada")||b._size_||0,f,g=0;g<e;g++)f=b[g],void 0!==f?("number"==typeof f&&(f=parseFloat(f)),
c+=f+"\\n"):c+="0\\n";return c+"</"+a+">"}return""};d.functions._StrToVector_=function(a,b){var e=[],f=!1,g=!1;e.type="vector";if(a){a=a.replace(/\r|\\r/g,"").split(/\n|\\n/);for(var m=0,k=a.length;m<k;m++)a[m].match("<"+b+">")?f=g=!0:(a[m].match("</"+b+">")&&(f=!1,m=a.length),f&&e.push(c(a[m])));e._size_=e.length;d.vectors[b]=e;d.evaluator.setVariable(b+".long",e.length);d.evaluator.setVariable(b+".long_usada",e.length)}return g?"OK":"ERROR"};d.functions._ExecStr_=function(a){return d.functions._ExecBlock_(a,
"")};d.functions._ExecBlock_=function(a,b){var c=[],e=""==b;if(a){a=a.replace(/\r|\\r/g,"").split(/\n|\\n/);for(var f=0,g=a.length;f<g;f++)a[f].match("<"+b+">")?(e=a[f].trim().split("<"+b+">"),2==e.length&&""!=e[1]&&(c=c.concat(e[1].split(String.fromCharCode("166")))),e=!0):a[f].match("</"+b+">")?(e=a[f].trim().split("</"+b+">"),2==e.length&&""!=e[0]&&(c=c.concat(e[0].split(String.fromCharCode("166")))),e=!1):e&&(c=c.concat(a[f].split(String.fromCharCode("166"))));a=0;for(b=c.length;a<b;a++)e=c[a].split("="),
e[0]=e[0].trim(),2==e.length&&""!=e[0]&&(isNaN(parseFloat(e[1]))?d.evaluator.setVariable(e[0],e[1].trim().replace(/^'|'$/g,"")):d.evaluator.setVariable(e[0],parseFloat(e[1])))}return 0};var f=b.newHTML("a",{target:"_blank"}),g,m=null;b.newBlobContent=null;d.functions._Save_=function(c,e){d.evaluator.parent.removeButtonClick();1500<Date.now()-a&&(a=Date.now(),document.body.appendChild(f),m=e.replace(/\\r/g,"").replace(/\\n/g,"\r\n").replace(/\\q/g,"'").replace(/\\_/g,"\\").replace(/\\br/g,"\\n"),g=
new Blob(["\ufeff",m],{type:"text/plain;charset=utf-8"}),f.setAttribute("href",window.URL.createObjectURL(g)),f.setAttribute("download",c),m!=b.newBlobContent&&(f.click(),b.newBlobContent=m),document.body.removeChild(f));return 0};var k=b.newHTML("a",{target:"_blank"});d.functions._SaveSpace_=function(c,e){d.evaluator.parent.removeButtonClick();1500<Date.now()-a&&(a=Date.now(),document.body.appendChild(k),m=e,k.setAttribute("href",m),k.setAttribute("download",c),m!=b.newBlobContent&&(k.click(),b.newBlobContent=
m),document.body.removeChild(k));return 0};var h,p,l=b.newHTML("input",{type:"file"});l.addEventListener("change",function(a){h=a.target.files;p=new FileReader;p.onload=function(a){b.addExternalFileContent(h[0].name,a.target.result);d.evaluator.setVariable("DJS.fileName",h[0].name);d.evaluator.setVariable("DJS.fileContent",a.target.result);if(a=d.evaluator.getFunction(d._callback))a.apply(d.evaluator,[]),d.evaluator.parent.update();l.value=""};0<h.length&&p.readAsText(h[0])});d.functions._Open_=function(b){d.evaluator.parent.removeButtonClick();
1500<Date.now()-a&&(d._callback=b,l.click(),a=Date.now());return 0};d.functions._AnchoDeCadena_=d.functions._strWidth_=function(a,c,d,e){return b.getTextWidth(a,b.convertFont(c+","+d+","+e))};d.functions.R=d.functions._Rojo_=d.functions._Red_=function(a){return(new b.Color(a)).r/255};d.functions.G=d.functions._Verde_=d.functions._Green_=function(a){return(new b.Color(a)).g/255};d.functions.B=d.functions._Azul_=d.functions._Blue_=function(a){return(new b.Color(a)).b/255};d.functions.HSV2RGB=function(a,
b,c){0>a&&(a+=360);a%=360;b*=c;var d=b*(1-Math.abs(a/60%2-1));c-=b;if(0<=a&&60>a){var e=b;var f=d;var g=0}else 60<=a&&120>a?(e=d,f=b,g=0):120<=a&&180>a?(e=0,f=b,g=d):180<=a&&240>a?(e=0,f=d,g=b):240<=a&&300>a?(e=d,f=0,g=b):300<=a&&360>a&&(e=b,f=0,g=d);e=Math.round(255*(e+c));f=Math.round(255*(f+c));g=Math.round(255*(g+c));return""+e.toString(16).padStart(2,"0")+f.toString(16).padStart(2,"0")+g.toString(16).padStart(2,"0")};d.functions["DJS.typeof"]=function(a){return a.rows?"matrix":a._size_?"vector":
typeof a}};b.Parser=v;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=Math.floor,c=function(a){this.parent=a;this.parser=new b.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};c.prototype.setDefinition=function(a,b){this.definitions[a]=b};c.prototype.getDefinition=function(a){return this.definitions[a]};c.prototype.setVariable=function(a,b){this.variables[a]=b};c.prototype.getVariable=
function(a){return this.variables[a]};c.prototype.setVector=function(b,c,d){c=0>c?0:a(c);this.vectors[b][c]=d};c.prototype.getVector=function(b,c){c=0>c?0:a(c);return this.vectors[b][c]};c.prototype.setMatrix=function(b,c,d,k){c=0>c?0:a(c);d=0>d?0:a(d);void 0==this.matrices[b][c]&&(this.matrices[b][c]=[]);this.matrices[b][c][d]=k};c.prototype.getMatrix=function(b,c,d){c=0>c?0:a(c);d=0>d?0:a(d);return this.matrices[b][c][d]};c.prototype.setFunction=function(a,b){this.functions[a]=b};c.prototype.getFunction=
function(a){return this.functions[a]};c.prototype.eval=function(a){return a?a.evaluate(this):0};b.externalEvaluator=new c;b.Evaluator=c;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,l,d,k,g,n,f,m,p,e,u,v,w,q,r=function(c,d){a=this;a.parent=c;a.evaluator=c.evaluator;a.decimals=c.decimals;a.fixed=c.fixed;a.align=c.align||"left";a.anchor=c.anchor||"a_top_left";a.decimal_symbol=c.parent.decimal_symbol;a.w=a.h=100;a.hasContent=""!==d;a.textStr=(d||"").replace(/\\{/g,"\\curlyBracketOpen ").replace(/\\}/g,"\\curlyBracketClose ").replace(/\\\[/g,"\\squareBracketOpen ").replace(/\\\]/g,"\\squareBracketClose ");a.oldTextStr=a.oldWidth=
a.oldSize=a.oldColor=a.oldPosX=a.oldPoxY=null;/^\{\\rtf1/.test(d)?(a.type="rtfNode",a.text=d,a.textNodes=(new b.RTFParser(c.evaluator)).parse(d.substring(10)),a.draw=a.drawRTF):(a.descarTeXParser=new b.DescarTeXParser,a.text=a.parseSimpleText(a.textStr),a.textNodes=new b.TextNode("","txtLineBlock",null,null),a.draw=a.drawText)};r.prototype.drawText=function(e,f,m,p,n){a=this;c=a.evaluator.eval(a.decimals);h=a.evaluator.eval(a.parent.width);l=a.evaluator.eval(a.parent.font_size);d=f.getColor?f.getColor():
f;k=a.textToString(a.text,c,a.fixed).replace(/\\{/g,"\\curlyBracketOpen ").replace(/\\}/g,"\\curlyBracketClose ").replace(/\\\[/g,"\\squareBracketOpen ").replace(/\\\]/g,"\\squareBracketClose ");0<=k.indexOf("[")&&(k=a.textToString(a.parseSimpleText(k),c,a.fixed));if(a.oldTextStr!==k||a.oldWidth!==h||a.oldSize!==l||a.oldColor!==d||a.oldPosX!==m||a.oldPoxY!==p)g=new b.TextStyle({size:l,family:a.parent.font_family||"arial",italic:a.parent.italics||!1,bold:a.parent.bold||!1,color:d,align:a.align,border:a.parent.border,
border_size:a.parent.border_size,shadowBlur:a.parent.shadowBlur,shadowOffsetX:a.parent.shadowOffsetX,shadowOffsetY:a.parent.shadowOffsetY,shadowColor:a.parent.shadowColor||"transparent"}),a.textNodes=a.descarTeXParser.parse(k,a.evaluator,g),a.textNodes.update(m,p,c,a.fixed,a.align,a.anchor,d,h);n||a.textNodes.draw(e);a.oldTextStr=k;a.oldWidth=h;a.oldSize=l;a.oldColor=d;a.oldPosX=m;a.oldPoxY=p};r.prototype.drawRTF=function(a,b,c,d,e){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,d,this.evaluator.eval(this.decimals),this.fixed,this.align,this.anchor,b,this.evaluator.eval(this.parent.width));e||this.textNodes.draw(a)};r.prototype.parseSimpleText=function(a){a=a.replace("&#x2013","\u2013").replace(/&squot;/g,"'");n=[];f="'";p=m=0;e=-1;for(w=a.length;m<w;)u=a.charAt(m),v=a.charAt(m-1),"["===u&&"\\"===v?(n.push(a.substring(p,m-1)+"["),p=m+1):"]"===u&&
"\\"===v?(n.push(a.substring(p,m-1)+"]"),p=m+1):"["===u&&-1===e?(n.push(a.substring(p,m)),p=m,e++):"["===u?e++:"]"===u&&0===e?(n.push(this.evaluator.parser.parse(a.substring(p,m+1))),p=m+1,e--):("]"==a.charAt(m)&&(e=0>e?e:e-1),f+=a.charAt(m)),m++;n.push(a.substring(p,m));return n};r.prototype.textToString=function(a,c,d){f="";if("rtfNode"!==a.type)for(var e=0,g=a.length;e<g;e++)"string"===typeof a[e]?f+=a[e]:(q=this.evaluator.eval(a[e])[0][0],""!==q&&("string"===typeof q?f+=q:Infinity===q?f+="Infinity":
-Infinity===q?f+="-Infinity":isNaN(q)||"NaN"===q?f+="NaN":(q=parseFloat(q),q=d?q.toFixed(c):b.removeNeedlessDecimals(q.toFixed(c)),f+=q.toString().replace(".",this.decimal_symbol))));return f};b.TextObject=r;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c=function(){};c.prototype.tokenize=function(b){b=b.replace(/\\n/g,"\\newline ");var c=[],d=null,k=0,g=b.length;b.charAt(0);var h=!1,f=!1,m=0;a="";for(var p=0;p<g;p++){var e=b.charAt(p);var u=b.charAt(p+1);"\\"===e&&"$"===u&&(f=!0);"{"===e?m++:"}"===e&&(m--,f&&0===m&&(f=!1));f?"_"===e?"{"===u?a+="\\subindex":(a+="\\subindex{"+u+"}",p++):"^"===e?"{"===u?a+="\\superindex":(a+="\\superindex{"+u+"}",p++):a+=e:a+=e}b=a;u=b.charAt(0);for(g=b.length;k<
g;)e=u,u=b.charAt(k+1),h&&("{"===e||"["===e||"\\"===e||" "===e?(h=!1," "===e&&(d={type:"ignore"},c.push(d))):d.value+=e),h||"\\"!==e?h||"{"!==e&&"["!==e?h||"}"!==e&&"]"!==e?h||(d&&"text"===d.type?d.value+=e:d&&"ignore"===d.type?(c.pop(),d=c[c.length-1]):(d={type:"text",value:e},c.push(d))):(d={type:"close",value:e},c.push(d)):(d={type:"open",value:e},c.push(d)):(h=!0,d={type:"command",value:""},c.push(d)),k++;return c};b.DescarTeXTokenizer=c;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=function(){this.tokenizer=new b.DescarTeXTokenizer};a.prototype.parse=function(a,h,l){a=this.tokenizer.tokenize(a);var c=new b.TextNode("","textBlock",l,null),k=new b.TextNode("","textLineBlock",l.clone(),null);c.addChild(k);for(var g=[],n=void 0,f=l,m=[l],p,e,u,v,w=!1,q=0,r=a.length;q<r;q++)if("text"===a[q].type)if("color_parameter"===n)e=new b.Color(a[q].value,h);else if("text_size_parameter"===n)u=parseFloat(a[q].value);else if("textLineBlock"===
k.nodeType){p=a[q].value.split(" ");for(var y=0,x=p.length;y<x;y++)""!==p[y]&&k.addChild(new b.TextNode(p[y],"text",f.clone(),null)),y+1<x&&k.addChild(new b.TextNode(" ","space",f.clone(),null))}else k.addChild(new b.TextNode(a[q].value,"text",f.clone(),null));else"command"===a[q].type&&"curlyBracketOpen"===a[q].value?k.addChild(new b.TextNode("{","text",f.clone(),null)):"command"===a[q].type&&"curlyBracketClose"===a[q].value?k.addChild(new b.TextNode("}","text",f.clone(),null)):"command"===a[q].type&&
"squareBracketOpen"===a[q].value?k.addChild(new b.TextNode("[","text",f.clone(),null)):"command"===a[q].type&&"squareBracketClose"===a[q].value?k.addChild(new b.TextNode("]","text",f.clone(),null)):"command"===a[q].type&&"newline"===a[q].value?(0===k.children.length&&k.addChild(new b.TextNode("","text",f.clone(),null)),k=new b.TextNode("","textLineBlock",l.clone(),null),c.addChild(k)):"command"===a[q].type&&"b"===a[q].value?(n="bold",g.push(n)):"command"===a[q].type&&"i"===a[q].value?(n="italic",
g.push(n)):"command"===a[q].type&&"o"===a[q].value?(n="overline",g.push(n)):"command"===a[q].type&&"u"===a[q].value?(n="underline",g.push(n)):"command"===a[q].type&&"color"===a[q].value?(n="color",g.push(n)):"command"===a[q].type&&"ts"===a[q].value?(n="text_size",g.push(n)):"command"===a[q].type&&"sansserif"===a[q].value.toLowerCase()?(n="sansserif",g.push(n)):"command"===a[q].type&&"serif"===a[q].value.toLowerCase()?(n="serif",g.push(n)):"command"===a[q].type&&"monospace"===a[q].value.toLowerCase()?
(n="monospace",g.push(n)):"command"===a[q].type&&"c"===a[q].value?(n="center",g.push(n)):"command"===a[q].type&&"l"===a[q].value?(n="left",g.push(n)):"command"===a[q].type&&"r"===a[q].value?(n="right",g.push(n)):"command"===a[q].type&&"j"===a[q].value?(n="justify",g.push(n)):"command"===a[q].type&&"$"===a[q].value?(n="formula",g.push(n),w=!0):"command"===a[q].type&&"sum"===a[q].value?(n="sum",g.push(n)):"command"===a[q].type&&"prod"===a[q].value?(n="prod",g.push(n)):"command"===a[q].type&&"int"===
a[q].value?(n="integral",g.push(n)):"command"===a[q].type&&"lim"===a[q].value?(n="limit",g.push(n)):"command"===a[q].type&&"sqrt"===a[q].value?(n="radical",g.push(n)):"command"===a[q].type&&"subindex"===a[q].value?(n="subIndex",g.push(n)):"command"===a[q].type&&"superindex"===a[q].value?(n="superIndex",g.push(n)):"command"===a[q].type&&"frac"===a[q].value?(n="numerator",g.push(n)):"open"===a[q].type&&"{"===a[q].value&&void 0!==n?"bold"===n||"italic"===n||"overline"===n||"underline"===n?(f=f.clone(),
f[n]=!0,m.push(f)):"sansserif"===n?(f=f.clone(),f.family="sansserif",m.push(f)):"serif"===n?(f=f.clone(),f.family="serif",m.push(f)):"monospace"===n?(f=f.clone(),f.family="monospaced",m.push(f)):"text_size"===n?n="text_size_parameter":"text_size_text"===n?(f=f.clone(),f.size=u,m.push(f)):"color"===n?n="color_parameter":"color_text"===n?(f=f.clone(),f.color=e,m.push(f)):"center"===n||"left"===n||"right"===n||"justify"===n?(f=f.clone(),f.align=n,m.push(f),k=new b.TextNode("","textLineBlock",f.clone(),
null),c.addChild(k)):"formula"===n?(f=f.clone(),m.push(f),v=new b.TextNode("","formula",f.clone(),null),k.addChild(v),k=v):"subIndex"===n||"superIndex"===n?w?(f=f.clone(),m.push(f),v=new b.TextNode("",n,f.clone(),null),k.addChild(v),k=v):k.addChild(new b.TextNode("subIndex"===n?"_":"^","text",f.clone(),null)):"radical"===n?w&&(v=new b.TextNode("","radical",f.clone(),null),k.addChild(v),k=v,f=f.clone(),m.push(f),v=new b.TextNode("","index",f.clone(),null),k.addChild(v),k=v,n="index"):"index"===n?w&&
(m.pop(),f=m[m.length-1],v=new b.TextNode("","radicand",f.clone(),null),k.addChild(v),k=v,n="radicand"):"sum"===n||"integral"===n||"limit"===n||"prod"===n?w&&(v=new b.TextNode("",n,f.clone(),null),k.addChild(v),k=v,f=f.clone(),m.push(f),v=new b.TextNode("","from",f.clone(),null),k.addChild(v),k=v,n="from",g[g.length-1]=n):"from"===n?w&&(v=new b.TextNode("","to",f.clone(),null),k.addChild(v),k=v,n="to",g[g.length-1]=n):"to"===n?w&&(m.pop(),f=m[m.length-1],v=new b.TextNode("","what",f.clone(),null),
k.addChild(v),k=v,n="what",g[g.length-1]=n):"numerator"===n?w&&(v=new b.TextNode("","fraction",f.clone(),null),k.addChild(v),k=v,f=f.clone(),m.push(f),v=new b.TextNode("","numerator",f.clone(),null),k.addChild(v),k=v,n="numerator"):"denominator"===n&&(v=new b.TextNode("",n,f.clone(),null),k.addChild(v),k=v):"close"===a[q].type&&"}"===a[q].value&&void 0!==n&&("bold"===n||"italic"===n||"overline"===n||"underline"===n||"color_text"===n||"color"===n||"text_size_text"===n||"text_size"===n||"sansserif"===
n||"serif"===n||"monospace"===n?(m.pop(),f=m[m.length-1],g.pop(),n=g[g.length-1]):"color_parameter"===n?n="color_text":"text_size_parameter"===n?n="text_size_text":"center"===n||"left"===n||"right"===n||"justify"===n?(m.pop(),f=m[m.length-1],g.pop(),n=g[g.length-1],a[q+1]&&"command"===a[q+1].type&&"newline"===a[q+1].value?k=c:(k=new b.TextNode("","textLineBlock",f.clone(),null),c.addChild(k))):"formula"===k.nodeType?(w=!1,m.pop(),f=m[m.length-1],g.pop(),n=g[g.length-1],k=k.parent):"subIndex"===k.nodeType||
"superIndex"===k.nodeType?w&&(m.pop(),f=m[m.length-1],g.pop(),n=g[g.length-1],k=k.parent):"index"===k.nodeType?k=k.parent:"radicand"===k.nodeType?(g.pop(),n=g[g.length-1],k=k.parent.parent):"from"===k.nodeType?k=k.parent:"to"===k.nodeType?k=k.parent:"what"===k.nodeType?(g.pop(),n=g[g.length-1],k=k.parent.parent):"numerator"===k.nodeType?(n="denominator",k=k.parent):"denominator"===k.nodeType&&(m.pop(),f=m[m.length-1],g.pop(),n=g[g.length-1],k=k.parent.parent));var z,A,C=null,H=[];c.children.forEach(function(a){for(var b=
0,c=a.children.length;b<c-1;b++)z=a.children[b],A=a.children[b+1],"text"===z.nodeType&&"text"===A.nodeType&&z.style.equals(A.style)?(null===C&&(C=z,v=z.clone(),C.changeNodeType("word"),C.value="___"+v.value,C.addChild(v)),v=A.clone(),C.addChild(v),H.push(A),C.value+=v.value):C=null});H.forEach(function(a){a.parent.removeChild(a)});c.normalize();c.adjustFontSize();return c};b.DescarTeXParser=a;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c=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)};c.prototype.clone=function(){return new c(Object.assign({},this))};c.prototype.set=function(a){Object.assign(this,a)};c.prototype.equals=function(a){var b=!0,c;for(c in this)this.hasOwnProperty(c)&&(b=b&&this[c]===a[c]);return b};c.prototype.toString=function(c){/arial|sansserif/i.test(this.family)?
a=b.sansserif_font:/times|serif/i.test(this.family)?a=c?b.math_font:b.serif_font:/courier|monospaced/i.test(this.family)&&(a=b.monospace_font);return((this.bold?"bold":"")+" "+(this.italic?"italic":"")+" "+this.size+"px "+a).trim()};b.TextStyle=c;return b}(descartesJS||{});
descartesJS=function(b){function a(a,b){for(var c=0,d=0;d<b;d++)c+=a[d];return c}function c(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((n[a].ascent+25)*c/n[a].unitsPerEm);b.descent=Math.ceil(Math.abs((n[a].descent-25)*c/n[a].unitsPerEm));b.h=b.ascent+b.descent;return b}if(b.loadLib)return b;
var h=!1,l="#000000",d=2,k=!1,g=function(a,c,d,e){this.type="rtfNode";this.evaluator=e;this.parent=null;this.children=[];this.metrics={ascent:0,descent:0,h:0,w:0,x:0,y:0,offsetX:0,offsetY:0,marginX:0,marginY:0,paddingX:0,paddingY:0};this.value=a;this.style=d;this.changeNodeType(c);this.drawBorder=b.in_editor?this.drawBorderSpecial:function(){}};g.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}};g.prototype.clone=function(){for(var a=new g(this.value,this.nodeType,this.style.clone()),b=0,c=this.children.length;b<c;b++)a.addChild(this.children[b].clone());return a};g.prototype.toStr=function(){for(var a=this.value,b=0,c=this.children.length;b<c;b++)a+=" "+this.children[b].toStr();return a};g.prototype.stringify=function(){var a="{"+('"NT":"'+
this.nodeType+'",');a+='"V":"'+(this.value||"")+'",';a+='"C":[';for(var b=0,c=this.children.length;b<c;b++)a+=this.children[b].stringify()+(b==c-1?"":",");a=a+"],"+('"S":'+JSON.stringify(this.style));return a+"}"};g.prototype.addChild=function(a,b){b&&null!==a.parent&&a.parent.removeChild(a);a.parent=this;this.children.push(a)};g.prototype.removeChild=function(a){var b=this.children.indexOf(a);-1!==b&&(a.parent=null,this.children.splice(b,1))};g.prototype.getFirstTextNode=function(){for(var a=this;0<
a.children.length;)a=a.children[0];return a};g.prototype.getLastTextNode=function(){for(var a=this;0<a.children.length;)a=a.children[a.children.length-1];return a};g.prototype.nextSibling=function(){if(this.parent)for(var a=null,b=0,c=this.parent.children.length;b<c;b++){if(a)return this.parent.children[b];this.parent.children[b]===this&&(a=!0)}return null};g.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};g.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};g.prototype.insertBefore=function(a,b){a=this.children.indexOf(a);-1!==a&&(b.parent=this,this.children.splice(a,0,b))};g.prototype.insertAfter=function(a,b){a=this.children.indexOf(a);-1!==a&&(b.parent=this,this.children.splice(a+1,0,b))};g.prototype.normalize=function(){for(var a=
this.queryAll(/textLineBlock|formula|numerator|denominator|superIndex|subIndex|index|subIndex|radicand|from|to|what|element/),b=0,c=a.length;b<c;b++)0===a[b].children.length&&a[b].addChild(new g("","text",a[b].style));a=this.queryAll(/formula|fraction|superIndex|subIndex|radical|sum|integral|prod|limit|matrix|defparts|dynamicText|componentNumCtrl|componentSpace/);b=0;for(c=a.length;b<c;b++){var d=a[b];(null===d.prevSibling()||null!==d.prevSibling()&&"text"!==d.prevSibling().nodeType)&&d.parent.insertBefore(d,
new g("","text",d.parent.style));(null===d.nextSibling()||null!==d.nextSibling()&&"text"!==d.nextSibling().nodeType)&&d.parent.insertAfter(d,new g("","text",d.parent.style))}return this};g.prototype.removeEmptyText=function(){for(var a=this.queryAll(/text/),b=0,c=a.length;b<c;b++)""===a[b].value&&a[b].parent&&a[b].parent.removeChild(a[b])};g.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))};g.prototype.propagateStyle=function(a,b){this.style[a]=b;this.styleString=this.style.toString();for(var c=0,d=this.children.length;c<d;c++)this.children[c].propagateStyle(a,b)};g.prototype.update=function(a,b,c,e,g,h,n,q){d=c;k=e;l=n;this.metrics.w=this.metrics.h=0;n=b;if(20<=q)for(c=0;c<this.children.length;c++)this.children[c].breakLines(q);c=0;for(e=this.children.length;c<e;c++){var f=this.children[c];
f.updateLine();f.metrics.offsetX=a;f.metrics.y=b;b+=parseInt(f.metrics.ascent+.5);f.metrics.offsetY=b;g=parseInt(f.metrics.descent+.5)+parseInt(1.5+.05*f.style.size);b+=g;this.metrics.h+=f.metrics.h;this.metrics.w=Math.max(this.metrics.w,f.metrics.w)}b=n;h=h||"";h.match("right")?a-=this.metrics.w:h.match("_center")&&(a-=this.metrics.w/2);h.match("bottom")?b-=this.metrics.h:h.match("center_")&&(b-=this.metrics.h/2);h=this.children;c=0;for(e=h.length;c<e;c++)"left"===h[c].style.align?h[c].metrics.offsetX=
a:"right"===h[c].style.align?h[c].metrics.offsetX=a+this.metrics.w-h[c].metrics.w:"center"===h[c].style.align?h[c].metrics.offsetX=a+(this.metrics.w-h[c].metrics.w)/2:"justify"===h[c].style.align&&20<=q&&(g=c<e-1?h[c+1].value:null,h[c].metrics.offsetX=a,"wrap"===g&&h[c].justifyAux(q)),h[c].metrics.y=b,b+=parseInt(h[c].metrics.ascent+.5),h[c].metrics.offsetY=b,g=parseInt(h[c].metrics.descent+.5)+parseInt(1.5+.05*h[c].style.size),b+=g};g.prototype.breakLines=function(a){for(var c,d=0,e=!1,f=[],k=0,
h=this.children.length;k<h;k++)c=this.children[k],e?f.push(c):("text"===c.nodeType||"space"===c.nodeType?(b.ctx.font=c.style.toString(),c.metrics.w=b.ctx.measureText(c.value).width):"word"===c.nodeType?c.updateLine():"formula"===c.nodeType&&c.updateFormula(),d+=c.metrics.w,d>a&&"space"!==c.nodeType&&0<k&&(e=!0,f.push(c)));if(0<f.length)for(a=new g("wrap","textLineBlock",this.style.clone(),null),this.parent.insertAfter(this,a),k=0,h=f.length;k<h;k++)f[k].parent&&f[k].parent.removeChild(f[k]),a.addChild(f[k])};
g.prototype.updateLine=function(a){var d=this;if("textLineBlock"===this.nodeType||"word"===this.nodeType){this.metrics.w=0;this.metrics.ascent=0;for(var f=this.metrics.descent=0,e=this.children,g,k=0,h=e.length;k<h;k++){g=e[k];if("text"===g.nodeType){b.ctx.font=g.style.toString();var l=""!==g.value?g.value:b.in_editor?"\u200a":"";g.metrics=c(b.ctx.font);g.metrics.w=b.ctx.measureText(l).width;g.metrics.offsetX=f;Object.defineProperties(g.metrics,{x:{get:function(){return d.metrics.offsetX+this.offsetX}},
y:{get:function(){return d.metrics.offsetY+this.offsetY}}})}"space"===g.nodeType?(b.ctx.font=g.style.toString(),g.metrics=c(b.ctx.font),g.metrics.w=k===h-1?0:a?a:b.ctx.measureText(" ").width,g.metrics.offsetX=f,Object.defineProperties(g.metrics,{x:{get:function(){return d.metrics.offsetX+this.offsetX}},y:{get:function(){return d.metrics.offsetY+this.offsetY}}})):"word"===g.nodeType&&(g.updateLine(),g.metrics.offsetX_aux=f,Object.defineProperties(g.metrics,{offsetX:{get:function(){return d.metrics.offsetX+
this.offsetX_aux}},offsetY:{get:function(){return d.metrics.offsetY}}}));"hyperlink"===g.nodeType&&(b.ctx.font=g.styleString,l=""!==g.value?g.value:b.in_editor?"\u200a":"",g.metrics=c(b.ctx.font),g.metrics.w=b.ctx.measureText(l).width,g.metrics.offsetX=f,Object.defineProperties(g.metrics,{x:{get:function(){return d.metrics.offsetX+this.offsetX}},y:{get:function(){return d.metrics.offsetY}}}),g.clickCatcher||(g.clickCatcher=b.newHTML("div",{style:"position:absolute;width:"+g.metrics.w+"px;height:"+
g.metrics.h+"px;cursor:pointer;"}),g.clickCatcher.rtfNode=g,g.clickCatcher.action=new b.OpenURL(this.evaluator.parent,g.URL),g.clickCatcher.addEventListener("click",function(a){this.rtfNode.click=!0;this.action.execute();this.rtfNode.draw(this.rtfNode.ctx)})));"componentNumCtrl"===g.nodeType&&(g.componentNumCtrl=this.evaluator.parent.getControlByCId(g.value),b.ctx.font=g.styleString,g.metrics=c(b.ctx.font),g.metrics.w=g.componentNumCtrl.w,g.metrics.h=g.componentNumCtrl.h,g.metrics.offsetX=f,Object.defineProperties(g.metrics,
{x:{get:function(){return d.metrics.offsetX+this.offsetX}},y:{get:function(){return d.metrics.offsetY}}}));"componentSpace"===g.nodeType?(g.componentSpace=this.evaluator.parent.getSpaceByCId(g.value),b.ctx.font=g.styleString,g.metrics=c(b.ctx.font),g.metrics.w=g.componentSpace.w,g.metrics.h=g.componentSpace.h,g.metrics.offsetX=f,Object.defineProperties(g.metrics,{x:{get:function(){return d.metrics.offsetX+this.offsetX}},y:{get:function(){return d.metrics.offsetY}}})):"formula"===g.nodeType&&(g.updateFormula(),
g.metrics.marginX=g.metrics.marginY=g.metrics.paddingX=g.metrics.paddingY=0,g.metrics.offsetX_aux=f,Object.defineProperties(g.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return d.metrics.offsetX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return d.metrics.offsetY}}}),g.metrics.w+=2*g.metrics.paddingX,g.metrics.ascent+=g.metrics.paddingY,g.metrics.descent+=g.metrics.paddingY,g.metrics.h+=2*g.metrics.paddingY,f+=2*g.metrics.marginX);
this.metrics.w+=g.metrics.w+2*g.metrics.marginX;this.metrics.ascent=Math.max(this.metrics.ascent,g.metrics.ascent);this.metrics.descent=Math.max(this.metrics.descent,g.metrics.descent);f+=g.metrics.w}this.metrics.h=this.metrics.ascent+this.metrics.descent}};g.prototype.updateFormula=function(){var f=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 g=this.children,h,e=0,l={metrics:{ascent:0,descent:0,h:0,w:0,x:0,y:0,offsetX:0,
offsetY:0,marginX:0,marginY:0,paddingX:0,paddingY:0}},n=0,w=g.length;n<w;n++){h=g[n];if("text"===h.nodeType){b.ctx.font=h.style.toString(!0);var q=""!==h.value?h.value:b.in_editor?"\u200a":"";h.metrics=c(b.ctx.font);h.metrics.w=b.ctx.measureText(q).width;h.metrics.offsetX=e;Object.defineProperties(h.metrics,{x:{get:function(){return f.metrics.offsetX+f.metrics.paddingX+this.offsetX}},y:{get:function(){return f.metrics.offsetY}}});e+=f.metrics.marginX}else if("dynamicText"===h.nodeType){q=void 0===
h.decimals?d:h.evaluator.eval(h.decimals);var r=void 0===h.fixed?k:h.fixed,y=h.evaluator.eval(h.value);parseFloat(y).toString()===y.toString()&&(y=r?parseFloat(y).toFixed(q):b.removeNeedlessDecimals(parseFloat(y).toFixed(q)),y=(""+y).replace(".",h.decimal_symbol));h.evalValue=y;b.ctx.font=h.style.toString(!0);h.metrics=c(b.ctx.font);h.metrics.marginX=0;h.metrics.paddingX=0;h.metrics.w=b.ctx.measureText(y).width+2*h.metrics.paddingX;h.metrics.offsetX_aux=e;Object.defineProperties(h.metrics,{x:{get:function(){return this.offsetX}},
y:{get:function(){return this.offsetY}},offsetX:{get:function(){return f.metrics.offsetX+f.metrics.paddingX+this.offsetX_aux+this.marginX}},offsetY:{get:function(){return f.metrics.offsetY}}});e+=2*h.metrics.marginX}if("superIndex"===h.nodeType)q=h,q.updateFormula(),q.metrics.marginX=0,q.metrics.paddingX=0,q.metrics.paddingY=0,q.metrics.offsetX_aux=e,q.metrics.prevChild=l,Object.defineProperties(q.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return f.metrics.offsetX+
f.metrics.paddingX+this.offsetX_aux+this.marginX}},offsetY:{get:function(){return f.metrics.offsetY+this.ascent+(this.prevChild.metrics.descent-this.prevChild.metrics.ascent)/2-this.h}}}),q.metrics.w+=2*q.metrics.paddingX,q.metrics.ascent+=q.metrics.paddingY,q.metrics.descent+=q.metrics.paddingY,q.metrics.h+=2*q.metrics.paddingY,q.metrics.tmp_ascent=q.metrics.h+(q.metrics.prevChild.metrics.ascent-q.metrics.prevChild.metrics.descent)/2,e+=2*q.metrics.marginX;else if("subIndex"===h.nodeType)q=h,q.updateFormula(),
q.metrics.marginX=0,q.metrics.paddingX=0,q.metrics.paddingY=0,q.metrics.offsetX_aux=e,q.metrics.prevChild=l,Object.defineProperties(q.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return f.metrics.offsetX+f.metrics.paddingX+this.offsetX_aux}},offsetY:{get:function(){return f.metrics.offsetY+this.ascent+(this.prevChild.metrics.descent-this.prevChild.metrics.ascent)/2}}}),q.metrics.w+=q.metrics.paddingX,q.metrics.ascent+=q.metrics.paddingY,
q.metrics.descent+=q.metrics.paddingY,q.metrics.h+=2*q.metrics.paddingY,this.metrics.descent=q.metrics.ascent+(q.metrics.prevChild.metrics.descent-q.metrics.prevChild.metrics.ascent)/2+q.metrics.descent,e+=q.metrics.marginX;else if("fraction"===h.nodeType){r=h;r.updateFormula();q=r.children;y=q[0];q=q[1];r.metrics.marginX=parseInt(.5+.075*this.style.size);r.metrics.paddingX=0;r.metrics.paddingY=0;var x=Math.max(y.metrics.w,q.metrics.w)+2*r.metrics.paddingX;r.metrics.prevChild=l;r.metrics.offsetX_aux=
e;var z=parseInt(-l.metrics.descent+4*l.metrics.h/9);Object.defineProperties(r.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY+z}},offsetX:{get:function(){return f.metrics.offsetX+f.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return f.metrics.offsetY-z}}});Object.defineProperties(y.metrics,{parent:{value:r},maxWidth:{value:x},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(q.metrics,{parent:{value:r},maxWidth:{value:x},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}}});r.metrics.w=
x;r.metrics.ascent=y.metrics.h+z+2*r.metrics.paddingY;r.metrics.descent=q.metrics.h-z+2*r.metrics.paddingY;r.metrics.h=y.metrics.h+q.metrics.h+4*r.metrics.paddingY;e+=2*r.metrics.marginX}else if("radical"===h.nodeType){l=h;l.updateFormula();q=l.children;r=q[0];var A=q[1];l.metrics.marginX=parseInt(1.5+.075*this.style.size);l.metrics.paddingX=parseInt(1.5+.075*this.style.size);l.metrics.paddingY=parseInt(1.5+.05*this.style.size);l.metrics.offsetX_aux=e;Object.defineProperties(l.metrics,{x:{get:function(){return this.offsetX}},
y:{get:function(){return this.offsetY}},offsetX:{get:function(){return f.metrics.offsetX+f.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return f.metrics.offsetY}}});q=l.style.size;l.radicalSign={w:q,scaleX:q/722,scaleY:A.metrics.h/1E3};y=parseInt(r.metrics.w-2*l.radicalSign.w/3);Object.defineProperties(l.radicalSign,{parent:{value:l},displaceIndex:{value:y},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+Math.max(this.displaceIndex,0)}},
y:{get:function(){return f.metrics.offsetY-A.metrics.ascent}}});Object.defineProperties(r.metrics,{parent:{value:l},displaceIndex:{value:y},fontSize:{value:q},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 f.metrics.offsetY-this.descent-2*this.fontSize/5}}});Object.defineProperties(A.metrics,{parent:{value:l},
displaceIndex:{value:y},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 f.metrics.offsetY}}});y=r.metrics.w<2*l.radicalSign.w/3?l.radicalSign.w:parseInt(r.metrics.w+l.radicalSign.w/3);l.metrics.w=y+2*l.metrics.paddingX+A.metrics.w;l.metrics.ascent=Math.max(A.metrics.ascent,r.metrics.h+2*q/5)+
l.metrics.paddingY;l.metrics.descent=A.metrics.descent+l.metrics.paddingY;l.metrics.h=l.metrics.ascent+l.metrics.descent;e+=2*l.metrics.marginX}else if("sum"===h.nodeType){r=h;r.updateFormula();q=r.children;y=q[0];x=q[1];var C=q[2];r.metrics.marginX=parseInt(1.5+.075*this.style.size);r.metrics.paddingX=parseInt(1.5+.075*this.style.size);r.metrics.paddingY=parseInt(1.5+.05*this.style.size);r.metrics.offsetX_aux=e;Object.defineProperties(r.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},
offsetX:{get:function(){return f.metrics.offsetX+f.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return f.metrics.offsetY}}});b.ctx.font=h.style.toString();var H=c(b.ctx.font);l=parseInt(1.2*H.h);q=parseInt(.5+780*l/1E3);r.sigmaSign={w:q,h:l,scale:l/1E3};var D=Math.max(x.metrics.w,y.metrics.w,r.sigmaSign.w);r.sigmaSign.parent=r;Object.defineProperties(r.sigmaSign,{sumWidth:{value:D},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.sumWidth-
this.w)/2)}},y:{get:function(){return f.metrics.offsetY+H.descent-(this.h+H.h)/2}}});q=H.descent-x.metrics.descent-(l+H.h)/2-r.metrics.paddingY;Object.defineProperties(x.metrics,{parent:{value:r},sumWidth:{value:D},newBaselineTo:{value:q},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 f.metrics.offsetY+this.newBaselineTo}}});
l=y.metrics.ascent+H.descent+(l-H.h)/2+r.metrics.paddingY;Object.defineProperties(y.metrics,{parent:{value:r},sumWidth:{value:D},newBaselineFrom:{value:l},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.sumWidth-this.w)/2)}},offsetY:{get:function(){return f.metrics.offsetY+this.newBaselineFrom}}});Object.defineProperties(C.metrics,{parent:{value:r},sumWidth:{value:D},
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 f.metrics.offsetY}}});r.metrics.w=D+C.metrics.w+3*r.metrics.paddingX;r.metrics.ascent=Math.max(C.metrics.ascent,-q+x.metrics.ascent)+r.metrics.paddingY;r.metrics.descent=Math.max(C.metrics.descent,l+y.metrics.descent)+r.metrics.paddingY;r.metrics.h=r.metrics.ascent+r.metrics.descent;
e+=2*r.metrics.marginX}else if("integral"===h.nodeType){r=h;r.updateFormula();q=r.children;y=q[0];x=q[1];C=q[2];r.metrics.marginX=parseInt(1.5+.075*this.style.size);r.metrics.paddingX=parseInt(1.5+.075*this.style.size);r.metrics.paddingY=parseInt(1.5+.05*this.style.size);r.metrics.offsetX_aux=e;Object.defineProperties(r.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return f.metrics.offsetX+f.metrics.paddingX+this.marginX+this.offsetX_aux}},
offsetY:{get:function(){return f.metrics.offsetY}}});b.ctx.font=h.style.toString();H=c(b.ctx.font);D=parseInt(1.2*H.h);var F=parseInt(10.5+529*D/1E3);r.sign={w:F,h:D,scale:D/1E3};r.sign.parent=r;Object.defineProperties(r.sign,{x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX}},y:{get:function(){return f.metrics.offsetY+H.descent-(this.h+H.h)/2}}});q=H.descent-(D+H.h)/2-x.metrics.descent+D/3;Object.defineProperties(x.metrics,{parent:{value:r},integralWidth:{value:F},
newBaselineTo:{value:q},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 f.metrics.offsetY+this.newBaselineTo}}});l=H.descent+y.metrics.ascent/2;Object.defineProperties(y.metrics,{parent:{value:r},integralWidth:{value:F},newBaselineFrom:{value:l},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},
offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt(2*this.integralWidth/5)}},offsetY:{get:function(){return f.metrics.offsetY+this.newBaselineFrom}}});F=Math.max(parseInt(3*F/5)+x.metrics.w,parseInt(2*F/5+y.metrics.w))+r.metrics.paddingX;Object.defineProperties(C.metrics,{parent:{value:r},whatDisplace:{value:F},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 f.metrics.offsetY}}});r.metrics.w=F+C.metrics.w+2*r.metrics.paddingX;r.metrics.ascent=Math.max(C.metrics.ascent,-q+x.metrics.ascent)+r.metrics.paddingY;r.metrics.descent=Math.max(C.metrics.descent,l+y.metrics.descent,D-r.metrics.ascent)+r.metrics.paddingY;r.metrics.h=Math.max(r.metrics.ascent+r.metrics.descent,D);e+=2*r.metrics.marginX}else if("prod"===h.nodeType)r=h,r.updateFormula(),q=r.children,y=q[0],x=q[1],C=q[2],r.metrics.marginX=parseInt(1.5+
.075*this.style.size),r.metrics.paddingX=parseInt(1.5+.075*this.style.size),r.metrics.paddingY=parseInt(1.5+.05*this.style.size),r.metrics.offsetX_aux=e,Object.defineProperties(r.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return f.metrics.offsetX+f.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return f.metrics.offsetY}}}),b.ctx.font=h.style.toString(),H=c(b.ctx.font),l=parseInt(1.2*H.h),q=parseInt(.5+
876*l/1E3),r.piSign={w:q,h:l,scale:l/1E3},D=Math.max(x.metrics.w,y.metrics.w,r.piSign.w),r.piSign.parent=r,Object.defineProperties(r.piSign,{prodWidth:{value:D},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.prodWidth-this.w)/2)}},y:{get:function(){return f.metrics.offsetY+H.descent-(this.h+H.h)/2}}}),q=H.descent-x.metrics.descent-(l+H.h)/2-r.metrics.paddingY,Object.defineProperties(x.metrics,{parent:{value:r},prodWidth:{value:D},newBaselineTo:{value:q},
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 f.metrics.offsetY+this.newBaselineTo}}}),l=y.metrics.ascent+H.descent+(l-H.h)/2+r.metrics.paddingY,Object.defineProperties(y.metrics,{parent:{value:r},prodWidth:{value:D},newBaselineFrom:{value:l},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},
offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.prodWidth-this.w)/2)}},offsetY:{get:function(){return f.metrics.offsetY+this.newBaselineFrom}}}),Object.defineProperties(C.metrics,{parent:{value:r},prodWidth:{value:D},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 f.metrics.offsetY}}}),
r.metrics.w=D+C.metrics.w+3*r.metrics.paddingX,r.metrics.ascent=Math.max(C.metrics.ascent,-q+x.metrics.ascent)+r.metrics.paddingY,r.metrics.descent=Math.max(C.metrics.descent,l+y.metrics.descent)+r.metrics.paddingY,r.metrics.h=r.metrics.ascent+r.metrics.descent,e+=2*r.metrics.marginX;else if("limit"===h.nodeType){l=h;l.updateFormula();q=l.children;var G=q[0];r=q[1];q=q[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 f.metrics.offsetX+f.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return f.metrics.offsetY}}});b.ctx.font=h.style.toString();H=c(b.ctx.font);y=parseInt(.5+b.ctx.measureText("l\u00edm").width);x=parseInt(.5+b.ctx.measureText("\u2192").width);C=Math.max(y,G.metrics.w+x+r.metrics.w);
l.limitText={parent:l};Object.defineProperties(l.limitText,{limitWidth:{value:C},limitTextWidth:{value:y},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+(this.limitWidth-this.limitTextWidth)/2}}});y=H.descent+Math.max(G.metrics.ascent,r.metrics.ascent,2*H.ascent/3)+l.metrics.paddingY;l.limitArrow={parent:l};Object.defineProperties(l.limitArrow,{newBaseline:{value:y},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+G.metrics.w}},y:{get:function(){return f.metrics.offsetY+
this.newBaseline}}});Object.defineProperties(G.metrics,{parent:{value:l},newBaseline:{value:y},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 f.metrics.offsetY+this.newBaseline}}});Object.defineProperties(r.metrics,{parent:{value:l},arrowWidth:{value:x},newBaseline:{value:y},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},
offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+G.metrics.w+this.arrowWidth}},offsetY:{get:function(){return f.metrics.offsetY+this.newBaseline}}});Object.defineProperties(q.metrics,{parent:{value:l},limitWidth:{value:C},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 f.metrics.offsetY}}});
l.metrics.w=C+q.metrics.w+3*l.metrics.paddingX;l.metrics.ascent=Math.max(q.metrics.ascent,H.ascent)+l.metrics.paddingY;x=0;q=Math.max(G.metrics.descent,r.metrics.descent,q.metrics.descent);if(0!=G.metrics.h||0!=r.metrics.h)x=y,q=Math.max(G.metrics.descent,r.metrics.descent,q-x);l.metrics.descent=x+q+l.metrics.paddingY;l.metrics.h=l.metrics.ascent+l.metrics.descent;e+=2*l.metrics.marginX}else if("matrix"===h.nodeType){y=h;y.updateFormula();q=y.children;x=y.rows;C=y.columns;y.metrics.marginX=parseInt(1.5+
.075*this.style.size);y.metrics.paddingX=parseInt(5+.075*this.style.size);y.metrics.paddingY=parseInt(1.5+.05*this.style.size);y.metrics.offsetX_aux=e;Object.defineProperties(y.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return f.metrics.offsetX+f.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return f.metrics.offsetY}}});b.ctx.font=h.style.toString();H=c(b.ctx.font);D=[];F=[];l=0;for(var B=x*C;l<B;l++){var I=
parseInt(l/C);var O=l%C;D[I]=Math.max(D[I]||0,q[l].metrics.h);F[O]=Math.max(F[O]||0,q[l].metrics.w)}var Q=(1+C)*y.metrics.paddingX;for(l=0;l<C;l++)Q+=F[l];var K=(1+x)*y.metrics.paddingY;for(l=0;l<x;l++)K+=D[l];r=H.descent-H.h/2;l=0;for(B=x*C;l<B;l++)I=parseInt(l/C),O=l%C,q[l].metrics.offsetX_aux=a(F,O)+(F[O]-q[l].metrics.w)/2+O*y.metrics.paddingX,q[l].metrics.offsetY_aux=a(D,I)+(D[I]-q[l].metrics.h)/2+(1+I)*y.metrics.paddingY,Object.defineProperties(q[l].metrics,{parent:{value:y},matrixH:{value:K},
dispY:{value:r},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 f.metrics.offsetY-this.matrixH/2+this.ascent+this.offsetY_aux+this.dispY}}});y.metrics.w=Q;y.metrics.ascent=K/2-r;y.metrics.descent=K/2+r;y.metrics.h=y.metrics.ascent+y.metrics.descent;e+=2*y.metrics.marginX}else if("defparts"===h.nodeType){y=h;y.updateFormula();q=h.children;
x=h.parts;y.metrics.marginX=parseInt(1.5+.075*this.style.size);y.metrics.paddingX=parseInt(1.5+.075*this.style.size);y.metrics.paddingY=parseInt(1.5+.05*this.style.size);y.metrics.offsetX_aux=e;Object.defineProperties(y.metrics,{parent:{value:f},x:{get:function(){return this.offsetX-2*this.marginX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return f.metrics.offsetX+f.metrics.paddingX+3*this.marginX+this.offsetX_aux}},offsetY:{get:function(){return f.metrics.offsetY}}});b.ctx.font=
h.style.toString();H=c(b.ctx.font);C=0;D=y.metrics.paddingY;r=H.descent-H.h/2;for(l=0;l<x;l++)q[l].metrics.offsetY_aux=D,C=Math.max(C,q[l].metrics.w),D+=q[l].metrics.h+y.metrics.paddingY,Object.defineProperties(q[l].metrics,{parent:{value:y},dispY:{value:r},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 f.metrics.offsetY-this.parent.metrics.defpartsH/
2+this.ascent+this.offsetY_aux+this.dispY}}});y.metrics.defpartsH=D;y.metrics.w=C+4*y.metrics.paddingX;y.metrics.ascent=D/2-r;y.metrics.descent=D/2+r;y.metrics.h=y.metrics.ascent+y.metrics.descent;e+=2*y.metrics.marginX}else if("numerator"===h.nodeType||"denominator"===h.nodeType||"index"===h.nodeType||"radicand"===h.nodeType||"from"===h.nodeType||"to"===h.nodeType||"what"===h.nodeType||"element"===h.nodeType)h.updateFormula(),h.metrics.paddingX=parseInt(1.5+.075*this.style.size),h.metrics.paddingY=
parseInt(1.5+.05*this.style.size),h.metrics.ascent+=h.metrics.paddingY,h.metrics.descent+=h.metrics.paddingY,h.metrics.h=h.metrics.ascent+h.metrics.descent,1==h.children.length&&"text"==h.children[0].nodeType&&""==h.children[0].value?(h.metrics.w=0,b.in_editor||(h.metrics.ascent=h.metrics.descent=h.metrics.h=0)):h.metrics.w+=2*h.metrics.paddingX;l=h;this.metrics.ascent=Math.max(this.metrics.ascent,h.metrics.tmp_ascent||h.metrics.ascent);this.metrics.descent=Math.max(this.metrics.descent,h.metrics.descent);
this.metrics.w+=h.metrics.w+2*h.metrics.marginX;this.metrics.h=this.metrics.ascent+this.metrics.descent;e+=h.metrics.w}};g.prototype.justifyAux=function(a){for(var b=0,c=0,d=0,f=this.children.length;d<f-1;d++)"space"===this.children[d].nodeType?b++:c+=this.children[d].metrics.w;this.updateLine((a-c)/b)};g.prototype.drawTextBlock=function(a){a.fillStyle=l;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"};g.prototype.drawTextLineBlock=function(a){for(var b=0,c=this.children.length;b<c;b++)h=!1,this.children[b].draw(a)};g.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:l;a.font=this.style.toString(h);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)}};g.prototype.drawWord=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a)};g.prototype.drawSpace=function(a){};g.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:l;a.font=this.style.toString(h);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")};g.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(h);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)};g.prototype.drawFormula=function(a){for(var b=0,c=this.children.length;b<c;b++)h=
!0,this.children[b].draw(a);this.drawBorder(a,"blue")};g.prototype.drawFraction=function(a){a.lineWidth=5;a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:l;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")};g.prototype.drawNumDen=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);
this.drawBorder(a,"blue")};g.prototype.drawSuperIndex=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};g.prototype.drawSubIndex=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};g.prototype.drawRadical=function(a){a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:l;this.style.border&&(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.lineWidth/=Math.max(this.radicalSign.scaleX,this.radicalSign.scaleY));a.save();a.font="1000px DJS_symbol";a.translate(this.radicalSign.x,this.radicalSign.y);a.scale(this.radicalSign.scaleX,this.radicalSign.scaleY);this.style.border&&a.strokeText("\u221a",-70,800);a.fillText("\u221a",-70,800);a.restore();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")};g.prototype.drawSum=function(a){a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:l;a.font=1.9*this.sigmaSign.w+"px DJS_symbol";this.style.border&&(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("\u03a3",this.sigmaSign.x,this.sigmaSign.y+this.sigmaSign.h));a.fillText("\u03a3",this.sigmaSign.x,this.sigmaSign.y+this.sigmaSign.h);for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};g.prototype.drawIntegral=function(a){a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:l;a.font=1.5*this.sign.w+"px DJS_symbol";this.style.border&&
(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("\u222b",this.sign.x,this.sign.y+3*this.sign.h/4));a.fillText("\u222b",this.sign.x,this.sign.y+3*this.sign.h/4);for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};g.prototype.drawProd=function(a){a.fillStyle=null!==this.style.color?
this.style.color.getColor?this.style.color.getColor():this.style.color:l;a.font=1.5*this.piSign.w+"px DJS_symbol";this.style.border&&(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("\u03a0",this.piSign.x,this.piSign.y+this.piSign.h));a.fillText("\u03a0",this.piSign.x,this.piSign.y+this.piSign.h);for(var b=0,c=this.children.length;b<
c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};g.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:l;this.style.border&&(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.font=this.style.toString();this.style.border&&a.strokeText("l\u00edm",this.limitText.x,this.metrics.y);a.fillText("l\u00edm",this.limitText.x,this.metrics.y);0!=this.children[1].metrics.h&&(this.style.border&&a.strokeText("\u2192",this.limitArrow.x,this.limitArrow.y),a.fillText("\u2192",this.limitArrow.x,this.limitArrow.y));this.drawBorder(a,"blue")};g.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:l;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 d=c/2;a.moveTo(this.metrics.x+b+c,this.metrics.y+b-this.metrics.ascent);a.bezierCurveTo(this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent,this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent,this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+2*this.metrics.marginX);a.lineTo(this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2-5*this.metrics.marginX);
a.bezierCurveTo(this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2);a.bezierCurveTo(this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2+5*this.metrics.marginX);a.lineTo(this.metrics.x+
b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h-2*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+b+d,this.metrics.y-b-this.metrics.ascent+this.metrics.h,this.metrics.x+b+d,this.metrics.y-b-this.metrics.ascent+this.metrics.h,this.metrics.x+b+c,this.metrics.y-b-this.metrics.ascent+this.metrics.h);a.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-d,this.metrics.y+b-this.metrics.ascent,this.metrics.x+this.metrics.w+
b-d,this.metrics.y+b-this.metrics.ascent,this.metrics.x+this.metrics.w+b-d,this.metrics.y+b-this.metrics.ascent+2*this.metrics.marginX);a.lineTo(this.metrics.x+this.metrics.w+b-d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2-5*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+this.metrics.w+b-d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+this.metrics.w+b-d,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-d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+this.metrics.w+b-d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+this.metrics.w+b-d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2+5*this.metrics.marginX);a.lineTo(this.metrics.x+this.metrics.w+b-d,this.metrics.y+b-this.metrics.ascent+this.metrics.h-2*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+this.metrics.w+b-d,this.metrics.y-
b-this.metrics.ascent+this.metrics.h,this.metrics.x+this.metrics.w+b-d,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")};g.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:l;a.beginPath();c=3*this.metrics.marginX;var d=c/2;a.moveTo(this.metrics.x+b+c,this.metrics.y+b-this.metrics.ascent);a.bezierCurveTo(this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent,this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent,this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+2*this.metrics.marginX);a.lineTo(this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2-
5*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2);a.bezierCurveTo(this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2+5*this.metrics.marginX);
a.lineTo(this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h-2*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+b+d,this.metrics.y-b-this.metrics.ascent+this.metrics.h,this.metrics.x+b+d,this.metrics.y-b-this.metrics.ascent+this.metrics.h,this.metrics.x+b+c,this.metrics.y-b-this.metrics.ascent+this.metrics.h);a.stroke();this.drawBorder(a,"blue")};g.prototype.drawGenericBlock=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};
g.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)};g.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)};g.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([])};g.prototype.toRTF=function(){var a=[],b=[],c="";this.mergeTextNodes();
for(var d=0,g=this.children.length;d<g;d++){var k=this.children[d];"textLineBlock"===k.nodeType&&(c+=k.toRTFAux(a,b)+(1<g&&d<g-1?"\\par":""))}k="{\\fonttbl";d=0;for(g=a.length;d<g;d++)k+="\\f"+d+"\\fcharset0 "+a[d]+";";a="";if(0<b.length){a="{\\colortbl";d=0;for(g=b.length;d<g;d++)a+=b[d];a+="}"}return"{\\rtf1\\uc0"+(k+"}")+a+c+"}"};g.prototype.toRTFAux=function(a,b){for(var c,d,g,f=null,k="",h,m,n,x,z,A=0,C=this.children.length;A<C;A++)h=m="",c=this.children[A],n=this.addToFontTable(c.style.family,
a),x=c.style.size,z=this.addToColorTable(c.style.color,b),null===z&&0<b.length&&(z=this.addToColorTable(l,b)),z!==f&&(h+="\\cf"+z,f=z),n!==d&&(h+="\\f"+n,d=n),x!==g&&(h+="\\fs"+2*x,g=x),c.style.italic&&(h+="\\i",m="\\i0"+m),c.style.bold&&(h+="\\b",m="\\b0"+m),c.style.underline&&(h+="\\ul",m="\\ulnone"+m),c.style.overline&&(h+="\\ol",m="\\olnone"+m),"text"===c.nodeType?(c.value=c.value.replace(/\\{/g,"{").replace(/\\}/g,"}").replace(/{/g,"\\{").replace(/}/g,"\\}"),c=""!==h?h+" "+c.value+m:""!==k&&
"}"!==k.charAt(k.length-1)?" "+c.value:c.value,k+=c):"formula"===c.nodeType?k+="{\\*\\mjaformula"+c.formulaToRTF(d,g,f,a,b)+"}":"componentSpace"===c.nodeType?k+="{\\*\\component\\Space "+c.value+"}":"componentNumCtrl"===c.nodeType&&(k+="{\\*\\component\\NumCtrl "+c.value+"}");return k};g.prototype.formulaToRTF=function(a,b,c,d,g){for(var e,f="",k,h,m,n,p=0,u=this.children.length;p<u;p++)k=h="",e=this.children[p],m=this.addToFontTable(e.style.family,d),n=this.addToColorTable(e.style.color,g),null===
n&&0<g.length&&(n=this.addToColorTable(l,g)),m!==a&&(k+="\\f"+m,a=m),n!==c&&(k+="\\cf"+n,"text"!==e.nodeType||"text"===e.nodeType&&""!==e.value)&&(c=n),e.style.italic&&(k+="\\i",h="\\i0"+h),e.style.bold&&(k+="\\b",h="\\b0"+h),e.style.underline&&(k+="\\ul",h="\\ulnone"+h),e.style.overline&&(k+="\\ol",h="\\olnone"+h),"text"===e.nodeType&&""!==e.value?(e.value=e.value.replace(/\\{/g,"{").replace(/\\}/g,"}").replace(/{/g,"\\{").replace(/}/g,"\\}"),tmpRTF=""!==k?k+" "+e.value+h:"}"!==f.charAt(f.length-
1)?" "+e.value:e.value,f+=tmpRTF):"dynamicText"===e.nodeType?(e.value=""===e.value?" ":e.value,f+=k+"{\\expr "+e.value+"\\decimals "+(e.decimals||2)+"\\fixed"+(e.fixed?1:0)+"}"+h):"fraction"===e.nodeType||"radical"===e.nodeType||"index"===e.nodeType||"radicand"===e.nodeType||"sum"===e.nodeType||"integral"===e.nodeType||"prod"===e.nodeType||"limit"===e.nodeType||"from"===e.nodeType||"to"===e.nodeType||"what"===e.nodeType||"element"===e.nodeType?f+="{\\"+e.nodeType+e.formulaToRTF(a,b,c,d,g)+"}":"numerator"===
e.nodeType?f+="{\\num"+e.formulaToRTF(a,b,c,d,g)+"}":"denominator"===e.nodeType?f+="{\\den"+e.formulaToRTF(a,b,c,d,g)+"}":"superIndex"===e.nodeType?f+="{\\supix"+e.formulaToRTF(a,b,c,d,g)+"}":"subIndex"===e.nodeType?f+="{\\subix"+e.formulaToRTF(a,b,c,d,g)+"}":"matrix"===e.nodeType?f+="{\\matrix\\rows "+(e.rows||2)+"\\columns "+(e.columns||2)+e.formulaToRTF(a,b,c,d,g)+"}":"defparts"===e.nodeType&&(f+="{\\defparts\\parts "+(e.parts||2)+e.formulaToRTF(a,b,c,d,g)+"}");return f};g.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};g.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};g.prototype.mergeTextNodes=function(){for(var a=[],b=null,c=0,d=this.children.length;c<
d;c++)"text"===this.children[c].nodeType?null!==b&&"text"===b.nodeType&&b.style.equals(this.children[c].style)&&(this.children[c].value=b.value+this.children[c].value,a.push(b)):this.children[c].mergeTextNodes(),b=this.children[c];c=0;for(d=a.length;c<d;c++)this.removeChild(a[c])};var n={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}};b.TextNode=g;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=String.fromCharCode,c,h,l,d,k,g,n,f,m,p,e,u=function(){};u.prototype.tokenize=function(b){if(b)b=b.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[];c=[];h="";d=l=0;g=b.charAt(0);n=!1;for(f="text";l<b.length;)k=g,g=b.charAt(l+1),n?"\\"===g||"{"===g||"}"===
g||" "===g||";"===g?(n=!1,h+=k," "===g?(l++,g=b.charAt(l+1),e=!0):e=!1,(m=h.match(/^'([0-9a-f]{2})/))?(p="","text"===f&&(p=c.pop().value),h=p+=a(parseInt(m[1],16))+h.substring(3)):(m=h.match(/^u[0-9]+/))?(p="","text"===f&&(p=c.pop().value),h=p+=a(m[0].substring(1))):("{"===h||"}"===h||"\\"==k?(c.push({type:"text",value:h+(e?" ":"")}),f="text"):(c.push({type:"controlWord",value:h}),f="controlWord"),h="")):"{"==k||"}"==k||"\\"==k?(n=!1,c.push({type:"text",value:k}),f="text"):h+=k:"\\"===k?(n=!0,""!==
h&&(c.push({type:"text",value:h}),f="text",h="")):"{"===k?(d++,""!==h&&(c.push({type:"text",value:h}),h=""),c.push({type:"openBlock",value:d}),f="openBlock"):"}"===k?(""!==h&&(c.push({type:"text",value:h}),h=""),c.push({type:"closeBlock",value:d}),f="closeBlock",d--):h+=k,l++;""!==h&&c.push({type:"text",value:h});return c};b.RTFTokenizer=u;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=Math.max,c,h,l,d,k,g,n,f,m,p,e,u,v,w,q,r,y,x,z,A,C,H,D,F,G,B,I,O,Q,K,P,N=function(a){this.evaluator=a;this.tokenizer=new b.RTFTokenizer};N.prototype.parse=function(E){c=this.tokenizer.tokenize(E);h={};d=2;if("openBlock"===c[0].type&&"fonttbl"===c[1].value){for(l=c[0].value;"closeBlock"!==c[d].type&&c[d].value!==l;)h[c[d].value]=c[d+2].value.substring(0,c[d+2].value.length-1),d+=3;d++}k={};g=0;if("openBlock"===c[d].type&&"colortbl"===c[d+1].value){l=
c[d++].value;for(d++;"closeBlock"!==c[d].type&&c[d].value!==l;)n=parseInt(c[d++].value.substring(3)).toString(16),f=parseInt(c[d++].value.substring(5)).toString(16),m=parseInt(c[d++].value.substring(4)).toString(16),";"===c[d].value&&d++,k[g++]="#"+(2>n.length?"0"+n:n)+(2>f.length?"0"+f:f)+(2>m.length?"0"+m:m);d++}w=v=u=null;Q=O=I=C=A=z=x=y=r=q=!1;H=[new b.TextStyle];D=H[0];G=F=-1;B=[];p=K=new b.TextNode("","textBlock",D,this.evaluator);e=new b.TextNode("","textLineBlock",D,this.evaluator);p.addChild(e);
K.stableWidth=!0;K.hasFormula=!1;E=d;for(var L=c.length;E<L;E++){if("controlWord"==c[E].type)if(h[c[E].value])D.set({family:h[c[E].value]});else if(c[E].value.match(/^fs(\d+)/))D.set({size:parseInt(c[E].value.match(/^fs(\d+)/)[1]/2)});else if("b"==c[E].value)D.set({bold:!0}),0<B.length&&B[B.length-1].style.set({bold:!0});else if("b0"==c[E].value)D.set({bold:!1}),0<B.length&&B[B.length-1].style.set({bold:!1});else if("i"==c[E].value)D.set({italic:!0}),0<B.length&&B[B.length-1].style.set({italic:!0});
else if("i0"==c[E].value)D.set({italic:!1}),0<B.length&&B[B.length-1].style.set({italic:!1});else if("ul"==c[E].value)D.set({underline:!0}),0<B.length&&B[B.length-1].style.set({underline:!0});else if("ulnone"==c[E].value)D.set({underline:!1}),0<B.length&&B[B.length-1].style.set({underline:!1});else if("ol"==c[E].value)D.set({overline:!0}),0<B.length&&B[B.length-1].style.set({overline:!0});else if("olnone"==c[E].value)D.set({overline:!1}),0<B.length&&B[B.length-1].style.set({overline:!1});else if(c[E].value.match(/^cf(\d+)/))D.set({color:k[parseInt(c[E].value.substring(2))]}),
0<B.length&&(B[B.length-1].style.color=D.color);else if("par"==c[E].value){p=new b.TextNode("","textLineBlock",D.clone(),this.evaluator);if("textBlock"!=e.nodeType)for(e=e.parent;"textBlock"!=e.nodeType;)e=e.parent;e.addChild(p);e=p}else if("mjaformula"==c[E].value)K.hasFormula=!0,G=F,q=!0,p=new b.TextNode("","formula",D.clone(),this.evaluator),e.addChild(p),e=p,B[B.length-1]=p;else if("fraction"==c[E].value||"radicand"==c[E].value||"radical"==c[E].value||"what"==c[E].value||"sum"==c[E].value||"integral"==
c[E].value||"limit"==c[E].value){var J=B[B.length-2].style.clone();p=new b.TextNode("",c[E].value,J,this.evaluator);B[B.length-2].addChild(p);B[B.length-1]=p}else"index"==c[E].value?(J=B[B.length-2].style.clone(),J.size=a(parseInt(J.size-.5*J.size),8),p=new b.TextNode("",c[E].value,J,this.evaluator),B[B.length-2].addChild(p),B[B.length-1]=p):"to"==c[E].value||"from"==c[E].value?(J=B[B.length-2].style.clone(),J.size=a(parseInt(J.size-.2*J.size),8),p=new b.TextNode("",c[E].value,J,this.evaluator),B[B.length-
2].addChild(p),B[B.length-1]=p):"num"==c[E].value||"den"==c[E].value?(J=B[B.length-2].style.clone(),J.size=a(Math.round(J.size-.1*J.size),8),"num"==c[E].value?p=new b.TextNode("","numerator",J,this.evaluator):"den"==c[E].value&&(p=new b.TextNode("","denominator",J,this.evaluator)),B[B.length-2].addChild(p),B[B.length-1]=p):"subix"==c[E].value||"supix"==c[E].value?(J=B[B.length-2].style.clone(),J.size=a(Math.floor(J.size-.33*J.size),8),"subix"==c[E].value?p=new b.TextNode("","subIndex",J,this.evaluator):
"supix"==c[E].value&&(p=new b.TextNode("","superIndex",J,this.evaluator)),p.originalStyle=B[B.length-2].style.clone(),B[B.length-2].addChild(p),B[B.length-1]=p):"defparts"==c[E].value||"matrix"==c[E].value||"element"==c[E].value?(J=B[B.length-2].style.clone(),p=new b.TextNode("",c[E].value,J,this.evaluator),B[B.length-2].addChild(p),B[B.length-1]=p,"defparts"==c[E].value?w=p:"matrix"==c[E].value&&(v=p,v.matrix_type=0)):"parts"==c[E].value?C=!0:"type"==c[E].value?x=!0:"rows"==c[E].value?z=!0:"columns"==
c[E].value?A=!0:"expr"==c[E].value?(K.stableWidth=!1,r=!0):"decimals"==c[E].value?y=!0:"fixed1"==c[E].value?u.fixed=!0:"fixed0"==c[E].value?u.fixed=!1:"component"!=c[E].value&&("NumCtrl"==c[E].value?I=!0:"Space"==c[E].value?O=!0:"hyperlink"==c[E].value&&(Q=!0));if("text"==c[E].type)if(C)w.parts=parseInt(c[E].value),C=!1;else if(x)v.matrix_type=parseInt(c[E].value),x=!1;else if(z)v.rows=parseInt(c[E].value),z=!1;else if(A)v.columns=parseInt(c[E].value),A=!1;else if(y)u.decimals=this.evaluator.parser.parse(c[E].value+
""),y=!1;else if(Q){P=c[E].value.split("|")[0];J=D.clone();p=new b.TextNode(P,"hyperlink",J,this.evaluator);p.URL=c[E].value.split("|")[1];if("textLineBlock"!=e.nodeType)for(e=e.parent;"textLineBlock"!=e.nodeType;)e=e.parent;e.addChild(p);Q=!1}else if(I)p=new b.TextNode(c[E].value,"componentNumCtrl",D.clone(),this.evaluator),e.addChild(p),I=!1;else if(O)p=new b.TextNode(c[E].value,"componentSpace",D.clone(),this.evaluator),e.addChild(p),O=!1;else if(r)J=B[B.length-2].style.clone(),P=this.evaluator.parser.parse(c[E].value),
p=new b.TextNode(P,"dynamicText",J,this.evaluator),B[B.length-2].addChild(p),u=B[B.length-1]=p,r=!1;else if(r||q)!r&&q&&(P=c[E].value,p=new b.TextNode(P,"text",B[B.length-1].style.clone(),this.evaluator),B[B.length-1].addChild(p));else{P=c[E].value;p=new b.TextNode(P,"text",D.clone(),this.evaluator);if("textLineBlock"!=e.nodeType)for(e=e.parent;"textLineBlock"!=e.nodeType;)e=e.parent;e.addChild(p)}else if("openBlock"==c[E].type)F=c[E].value,D=D.clone(),H.push(D),B.push(null);else if("closeBlock"==
c[E].type)c[E].value==G&&(G=-1,q=!1,e=e.parent),H.pop(),D=H[H.length-1],B.pop();else if("("==c[E].type||")"==c[E].type)J=B[B.length-1].style.clone(),J.italic="",p=new b.TextNode(c[E].type,"mathSymbol",J,this.evaluator),B[B.length-1].addChild(p);else if("+"==c[E].type||"-"==c[E].type||"*"==c[E].type||"="==c[E].type)p=new b.TextNode(c[E].type,"mathSymbol",B[B.length-1].style.clone(),this.evaluator),B[B.length-1].addChild(p)}return K.normalize()};b.RTFParser=N;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,l,d,k,g,n,f,m,p,e,u=function(c,d){a=this;a.parent=c;a.evaluator=a.parent.evaluator;h=a.evaluator;l=h.parser;a.id=a.imageSrc=a.x_axis=a.y_axis=a.cID="";a.type="2D";a.xExpr=a.yExpr=l.parse("0");a.w=parseInt(c.container.width);a.h=parseInt(c.container.height);a.drawif=l.parse("1");a.fixed=a.text=a.numbers=a.sensitive_to_mouse_movements=!1;a.scale=48;a.Ox=a.Oy=a.mouse_x=a.mouse_y=a.border_width=a.border_radius=0;a.image=new Image;a.image.onload=
function(){this.ready=1};a.bg_display="topleft";a.background=new b.Color("ffffff");a.net=new b.Color("b8c4c8");a.net10=new b.Color("889498");a.axes=new b.Color("405860");a.border_color=new b.Color("000000");a.ctrs=[];a.graphicsCtr=[];a.graphics=[];a.backGraphics=[];a.zIndex=c.zIndex;a.plecaHeight=c.plecaHeight||0;a.displaceRegionNorth=c.displaceRegionNorth||0;a.displaceRegionWest=c.displaceRegionWest||0;Object.assign(a,d);a.initSpace()};u.prototype.initSpace=function(){a=this;c=a.parent;h=a.evaluator;
d=a.id+".";a.resizable||(a.displaceRegionNorth=c.displaceRegionNorth||0,a.displaceRegionSouth=c.displaceRegionSouth||0,a.displaceRegionEast=c.displaceRegionEast||0,a.displaceRegionWest=c.displaceRegionWest||0,f=parseInt(c.container.width),n=parseInt(c.container.height),void 0!=a.wExpr&&(a.w=parseInt(f-a.displaceRegionWest-a.displaceRegionEast)*parseFloat(a.wExpr)/100),void 0!=a.hExpr&&(a.h=parseInt(n-a.displaceRegionNorth-a.displaceRegionSouth)*parseFloat(a.hExpr)/100),void 0!=a.xPercentExpr&&(a.xExpr=
h.parser.parse((parseInt(f-a.displaceRegionWest-a.displaceRegionEast)*parseFloat(a.xPercentExpr)/100).toString())),void 0!=a.yPercentExpr&&(a.yExpr=h.parser.parse((parseInt(n-a.displaceRegionNorth-a.displaceRegionSouth)*parseFloat(a.yPercentExpr)/100).toString())),a.x=h.eval(a.xExpr)+a.displaceRegionWest,a.y=h.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?(k=n-a.y,a.h>k&&(a.h=k)):(k=a.h+a.y,a.h=k>=n?n:k),0<=a.x?
(g=f-a.x,a.w>g&&(a.w=g)):(g=a.w+a.x,a.w=g>=f?f:g));""==a.imageSrc&&/vacio.gif$/i.test(a.imageSrc.trim())||(a.image=c.getImage(a.imageSrc));a.OxExpr&&(p=a.OxExpr,p.endsWith("%")?a.Ox=a.w*parseFloat(p)/100:(m=parseFloat(p),m!=p&&(m=0),a.Ox=m));a.OyExpr&&(e=a.OyExpr,e.endsWith("%")?a.Oy=a.h*parseFloat(e)/100:(m=parseFloat(e),m!=e&&(m=0),a.Oy=m));""!==a.id&&2!==c.version?(h.setVariable(d+"_w",a.w),h.setVariable(d+"_h",a.h),h.setVariable(d+"escala",h.getVariable(d+"escala")||a.scale),h.setVariable(d+"Ox",
h.getVariable(d+"Ox")||a.Ox),h.setVariable(d+"Oy",h.getVariable(d+"Oy")||a.Oy),h.setVariable(d+"mouse_x",0),h.setVariable(d+"mouse_y",0),h.setVariable(d+"mouse_pressed",0),h.setVariable(d+"mouse_clicked",0),h.setVariable(d+"clic_izquierdo",0)):(m=h.getVariable("_w"),h.setVariable("_w",void 0===m?a.w:m),m=h.getVariable("_h"),void 0===m&&(m=a.h),h.setVariable("_h",m),m=h.getVariable("escala"),void 0===m&&(m=a.scale),h.setVariable("escala",m),m=h.getVariable("Ox"),void 0===m&&(m=a.Ox),h.setVariable("Ox",
m),m=h.getVariable("Oy"),void 0===m&&(m=a.Oy),h.setVariable("Oy",m),h.setVariable("mouse_x",0),h.setVariable("mouse_y",0),h.setVariable("mouse_pressed",0),h.setVariable("mouse_clicked",0),h.setVariable("clic_izquierdo",0),2==c.version&&""===a.x_axis&&""===a.y_axis&&(a.axes=""));a.w_2=a.w/2;a.h_2=a.h/2;h.setFunction(d+"download_image",function(b){a.evaluator.functions._SaveSpace_(b,a.canvas.toDataURL("image/png"))})};u.prototype.addCtr=function(a){"GraphicControl"===a.type?this.graphicsCtr.push(a):
this.ctrs.push(a)};u.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))};u.prototype.clearClick=function(){this.evaluator.setVariable(this.mclickedString,0);this.evaluator.setVariable(this.mclicizquierdoString,0)};u.prototype.getRelativeX=function(a){return(parseInt(a)-this.w_2-this.Ox)/this.scale};u.prototype.getRelativeY=function(a){return(-parseInt(a)+this.h_2+this.Oy)/this.scale};u.prototype.getAbsoluteX=
function(a){return a*this.scale+this.w_2+this.Ox};u.prototype.getAbsoluteY=function(a){return-a*this.scale+this.h_2+this.Oy};b.Space=u;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c=function(c){a=this;a.parent=c;a.width=228;a.vSpace=25;a.container=b.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:"+(a.width+27)+"px;height:460px;"});a.movable=b.newHTML("div",{style:"position:absolute;left:0;top:0;width:"+(a.width+27)+"px;height:"+a.vSpace+
"px;line-height:"+a.vSpace+"px;background-color:#ddd;cursor:move;padding-left:75px;font-family:"+b.sansserif_font+";font-size:18px;"});a.movable.innerHTML="Descartes";a.container.appendChild(a.movable);a.ctrs=[]};c.prototype.init=function(){function c(c){a.newPos=b.getCursorPosition(c,document.body);a.container.style.left=a.initialPosition.x+(a.newPos.x-a.oldPos.x)*b.cssScale+"px";a.container.style.top=a.initialPosition.y+(a.newPos.y-a.oldPos.y)*b.cssScale+"px"}function l(a){a.preventDefault();document.body.removeEventListener("mousemove",
c);document.body.removeEventListener("mouseup",l)}a=this;document.body.appendChild(a.container);var d=a.parent.evaluator.parser;a.numCtr=a.ctrs.length;a.ctrs.forEach(function(b,c){b.expresion=d.parse("(0,"+(a.vSpace+23+35*c)+","+a.width+",35)");b.update()});var k=new b.Button(a.parent,{region:"external",name:"english"==a.language?"about":"cr\u00e9ditos",font_size:d.parse("15"),expresion:d.parse("(0,"+a.vSpace+","+a.width/2+",25)")});k.actionExec={execute:b.showAbout};k.update();(new b.Button(a.parent,
{region:"external",name:"config",font_size:d.parse("15"),action:"config",expresion:d.parse("("+a.width/2+","+a.vSpace+","+a.width/2+",25)")})).update();(new b.Button(a.parent,{region:"external",name:"english"==a.language?"init":"inicio",font_size:d.parse("15"),action:"init",expresion:d.parse("(0,"+(a.vSpace+23+35*a.numCtr)+","+a.width/2+",25)")})).update();(new b.Button(a.parent,{region:"external",name:"english"==a.language?"clear":"limpiar",font_size:d.parse("15"),action:"clear",expresion:d.parse("("+
a.width/2+","+(a.vSpace+23+35*a.numCtr)+","+a.width/2+",25)")})).update();k=new b.Button(a.parent,{region:"external",name:"english"==a.language?"close":"cerrar",font_size:d.parse("15"),expresion:d.parse("("+a.width/4+","+(a.vSpace+46+35*a.numCtr)+","+a.width/2+",25)")});k.update();k.btn.addEventListener("click",function(b){a.hide()});a.setPositionAndSize();a.movable.addEventListener("mousedown",function(d){d.preventDefault();a.oldPos=b.getCursorPosition(d,document.body);a.initialPosition={x:a.container.offsetLeft,
y:a.container.offsetTop};document.body.addEventListener("mousemove",c);document.body.addEventListener("mouseup",l)});a.hide()};c.prototype.addCtr=function(a){this.ctrs.push(a)};c.prototype.show=function(){this.setPositionAndSize();this.container.style.display="block"};c.prototype.hide=function(){this.container.style.display="none"};c.prototype.setPositionAndSize=function(){a=this;var b=a.vSpace+46+35*a.numCtr+25+10;a.container.style.left=Math.max(parseInt(window.innerWidth-a.width)/2,0)+"px";a.container.style.top=
"5px";a.container.style.height=window.innerHeight<a.vSpace+75?a.vSpace+75+"px":b>window.innerHeight-10?window.innerHeight-10+"px":b+"px"};b.SpaceExternal=c;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c=2*Math.PI,h=b.convertFont("Serif,BOLD+ITALIC,16"),l=b.convertFont("Monospaced,PLAIN,12"),d=Math.floor,k=Math.round,g,n,f,m,p,e,u,v,w,q,r,y,x,z,A,C,H,D,F,G,B,I,O,Q,K,P,N,E,L,J,M=function(c,d){a=d=b.Space.call(this,c,d)||this;a.ratio=c.ratio;a.canvas=b.newHTML("canvas",{id:a.id+"_canvas",class:"DescartesSpace2DCanvas",width:a.w*a.ratio+"px",height:a.h*a.ratio+"px"});a.backCanvas=b.newHTML("canvas",{id:a.id+"_background",width:a.w*a.ratio+"px",height:a.h*
a.ratio+"px"});a.canvas.style=a.backCanvas.style=(0<a.border_width?"border:"+a.border_width+"px solid "+a.border_color.getColor()+";":"")+(a.border_radius?"border-radius:"+a.border_radius+"px;":"");a.canvas.style.zIndex=a.zIndex;a.canvas.style.width=a.backCanvas.style.width=a.w+"px";a.canvas.style.height=a.backCanvas.style.height=a.h+"px";a.ctx=a.canvas.getContext("2d");a.backCtx=a.backCanvas.getContext("2d");a.ctx.imageSmoothingEnabled=a.backCtx.imageSmoothingEnabled=!1;a.canvas.ratio=a.ratio;a.backCanvas.ratio=
a.ratio;a.graphicControlContainer=b.newHTML("div",{id:a.id+"_graphicControls",style:"position:absolute;left:0;top:0;z-index:"+a.zIndex+";"});a.numCtrContainer=b.newHTML("div",{id:a.id+"_numericalControls",style:"position:absolute;left:0;top:0;z-index:"+a.zIndex+";"});a.container=b.newHTML("div",{id:a.id,class:"DescartesSpace2DContainer",style:"z-index:"+a.zIndex+";"});a.container.appendChild(a.backCanvas);a.container.appendChild(a.canvas);a.container.appendChild(a.graphicControlContainer);a.container.appendChild(a.numCtrContainer);
c.container.insertBefore(a.container,c.loader);var e=a.id+".image";a.parent.images[e]=a.canvas;a.parent.images[e].ready=1;a.parent.images[e].complete=a.parent.images[e].canvas=!0;a.evaluator.setVariable(e,e);e=a.id+".back";a.parent.images[e]=a.backCanvas;a.parent.images[e].ready=1;a.parent.images[e].complete=a.parent.images[e].canvas=!0;a.evaluator.setVariable(e,e);e=""!==a.id&&2!==c.version?a.id+".":"";a.OxStr=e+"Ox";a.OyStr=e+"Oy";a.scaleStr=e+"escala";a.wStr=e+"_w";a.hStr=e+"_h";a.mxStr=e+"mouse_x";
a.myStr=e+"mouse_y";a.mpressedStr=e+"mouse_pressed";a.mclickedStr=e+"mouse_clicked";a.mclickIzqStr=e+"clic_izquierdo";a.click=0;a.resizable&&(a.wModExpr=c.evaluator.parser.parse(a.wModExpr),a.hModExpr=c.evaluator.parser.parse(a.hModExpr));"descartesJS_stage"!==a.id&&a.addEvents();c.evaluator.setVariable(a.id+"._refresh_back_",1);return d};$jscomp.inherits(M,b.Space);M.prototype.init=function(){a=this;a.initSpace();a.canvas&&(a.old_w=a.w,a.old_h=a.h,a.canvas.width=a.backCanvas.width=a.w*a.ratio,a.canvas.height=
a.backCanvas.height=a.h*a.ratio,a.canvas.style.width=a.backCanvas.style.width=a.w+"px",a.canvas.style.height=a.backCanvas.style.height=a.h+"px")};M.prototype.update=function(b){a=this;g=a.evaluator;n=a.parent;if(a.resizable){if(N=a.evaluator.eval(a.wModExpr),E=a.evaluator.eval(a.hModExpr),a.old_w!=N||a.old_h!=E)a.w=N,a.h=E,a.w_2=a.w/2,a.h_2=a.h/2,g.setVariable(a.wStr,a.w),g.setVariable(a.hStr,a.h),a.old_w=a.w,a.old_h=a.h,a.canvas.width=a.backCanvas.width=a.w*a.ratio,a.canvas.height=a.backCanvas.height=
a.h*a.ratio,a.canvas.style.width=a.backCanvas.style.width=a.w+"px",a.canvas.style.height=a.backCanvas.style.height=a.h+"px",b=!0}else g.setVariable(a.wStr,a.w),g.setVariable(a.hStr,a.h);a.drawIfValue=0<g.eval(a.drawif);if(a.drawIfValue){m=a.x!==g.eval(a.xExpr)+a.displaceRegionWest;p=a.y!==g.eval(a.yExpr)+n.plecaHeight+a.displaceRegionNorth;a.spaceChange=b||m||p||a.drawBefore!==a.drawIfValue||a.Ox!==g.getVariable(a.OxStr)||a.Oy!==g.getVariable(a.OyStr)||a.scale!==g.getVariable(a.scaleStr)||a.backColor!==
a.background.getColor();a.x=m?g.eval(a.xExpr)+a.displaceRegionWest:a.x;a.y=p?g.eval(a.yExpr)+n.plecaHeight+a.displaceRegionNorth:a.y;a.Ox=g.getVariable(a.OxStr);a.Oy=g.getVariable(a.OyStr);a.scale=g.getVariable(a.scaleStr);a.drawBefore=a.drawIfValue;a.scale=Math.max(1E-6,Math.min(1E6,a.scale));g.setVariable(a.scaleStr,a.scale);if(m||p)a.container.style.left=a.x+"px",a.container.style.top=a.y+"px";a.container.style.display="block";a.drawTrace=!a.spaceChange&&(!a.fixed&&!a.click||a.fixed);a.spaceChange&&
(a.backCtx.setTransform(a.ratio,0,0,a.ratio,0,0),a.drawBackground());a.ctx.setTransform(a.ratio,0,0,a.ratio,0,0);a.draw()}else a.container.style.display="none"};M.prototype.drawBackground=function(){a=this;g=a.evaluator;f=a.backCtx;f.clearRect(0,0,a.backCanvas.width,a.backCanvas.height);f.fillStyle=a.backColor=a.background.getColor();f.fillRect(0,0,a.backCanvas.width,a.backCanvas.height);a.image&&""!=a.image.src&&a.image.ready&&a.image.complete&&("topleft"===a.bg_display?f.drawImage(a.image,0,0):
"stretch"===a.bg_display?f.drawImage(a.image,0,0,a.w,a.h):"patch"===a.bg_display?(f.fillStyle=f.createPattern(a.image,"repeat"),f.fillRect(0,0,a.w,a.h)):"imgcenter"===a.bg_display&&f.drawImage(a.image,(a.w-a.image.width)/2,(a.h-a.image.height)/2));e=a.scale;u=0;for(v=Math.max(0,a.w+a.h);e>v;)e/=10,u++;for(;e<v/10;)e*=10;f.lineWidth=1;""!==a.net&&(f.strokeStyle=a.net.getColor(),a.drawMarks(f,e/10,-1));if(2!==a.parent.version&&""!==a.net10||2===a.parent.version&&""!==a.net&&""!==a.net10)f.strokeStyle=
a.net10.getColor(),a.drawMarks(f,e,-1);if(""!==a.axes){var b="";"no"==a.x_axis&&(b+="x");"no"==a.y_axis&&(b+="y");f.strokeStyle=a.axes.getColor();f.beginPath();"no"==a.x_axis||""===a.x_axis&&2===a.parent.version||(f.moveTo(0,d(a.h/2+a.Oy)+.5),f.lineTo(a.w,d(a.h/2+a.Oy)+.5));"no"==a.y_axis||""===a.y_axis&&2===a.parent.version||(f.moveTo(d(a.w/2+a.Ox)+.5,0),f.lineTo(d(a.w/2+a.Ox)+.5,a.h));f.lineWidth=1.2;f.stroke();f.lineWidth=1;a.drawMarks(f,e,4,b);a.drawMarks(f,e/2,2,b);a.drawMarks(f,e/10,1,b)}if(""!==
a.x_axis||""!==a.y_axis)f.fillStyle=""!==a.axes?a.axes.getColor():"#000",f.font=h,f.textAlign="right",f.textBaseline="alphabetic","no"!=a.x_axis&&f.fillText(a.x_axis,d(a.w)-2,d(a.h/2+a.Oy)+12),"no"!=a.y_axis&&f.fillText(a.y_axis,d(a.w/2+a.Ox)-2,12);a.numbers&&""!=a.axes&&(f.fillStyle=a.axes.getColor(),f.font=h,f.textAlign="start",f.textBaseline="bottom",e>(a.w+a.h)/2?a.drawNumbers(f,e/5,e<=a.scale?u+1:u):e>(a.w+a.h)/4?a.drawNumbers(f,e/2,e<=a.scale?u+1:u):a.drawNumbers(f,e,u));b=$jscomp.makeIterator(a.backGraphics);
for(var c=b.next();!c.done;c=b.next())c.value.draw()};M.prototype.draw=function(){a=this;f=a.ctx;g.getVariable(a.id+"._refresh_back_")&&f.clearRect(0,0,a.canvas.width,a.canvas.height);for(var b=$jscomp.makeIterator(a.graphics),e=b.next();!e.done;e=b.next())e=e.value,""!==e.trace&&a.drawTrace&&e.drawTrace(),e.draw();b=$jscomp.makeIterator(a.graphicsCtr);for(e=b.next();!e.done;e=b.next())e.value.draw();""!=a.text&&a.click&&"L"===a.whichBtn&&(f.save(),f.strokeStyle=f.fillStyle=a.text.getColor(),f.lineWidth=
1,f.font=l,f.textAlign="center",f.textBaseline="alphabetic",F=1>=a.scale?a.mouse_x.toFixed(0):a.mouse_x.toFixed(parseInt(a.scale).toString().length+1),G=1>=a.scale?a.mouse_y.toFixed(0):a.mouse_y.toFixed(parseInt(a.scale).toString().length+1),B="("+F+","+G+")",I=d(f.measureText(B).width/2),O=a.getAbsoluteX(a.mouse_x),Q=a.getAbsoluteY(a.mouse_y),K=d(O),P=d(Q-10),K+I>a.w?K=a.w-I:0>K-I&&(K=I),P+1>a.h?P=a.h:0>P-14&&(P=15),f.fillText(B,K,P),f.beginPath(),f.arc(O,Q,2.5,0,c),f.stroke(),f.restore())};M.prototype.drawMarks=
function(a,b,c,e){w=this.w;q=this.h;H=A=0;C=w;D=q;x=d(w/2+this.Ox);z=d(q/2+this.Oy);0<=c&&(A=x-c,C=x+c,H=z-c,D=z+c);a.beginPath();if(!e||e&&!e.match("x"))for(c=-k(x/b);(r=x+k(c*b))<w;c++)a.moveTo(r+.5,H+.5),a.lineTo(r+.5,D+.5);if(!e||e&&!e.match("y"))for(e=-k(z/b);(y=z+k(e*b))<q;e++)a.moveTo(A+.5,y+.5),a.lineTo(C+.5,y+.5);a.stroke()};M.prototype.drawNumbers=function(a,b,c){w=this.w;q=this.h;x=d(w/2+this.Ox);z=d(q/2+this.Oy);for(c=-k(x/b);(r=x+k(c*b))<w;c++)a.fillText(parseFloat((c*b/this.scale).toFixed(4)),
r+1,z-2);for(c=-k(z/b);(y=z+k(c*b))<q;c++)0!==parseFloat(-c*b/this.scale)&&a.fillText(parseFloat((-c*b/this.scale).toFixed(4)),x+5,y+5)};M.prototype.addEvents=function(){function a(b){window.focus();document.activeElement.blur();if(f.evaluator.variables[f.id+".DJS_NO_FIXED"]||!f.fixed||f.sensitive_to_mouse_movements)f.click=0,f.evaluator.setVariable(f.mpressedStr,0),f.evaluator.setVariable(f.mclickedStr,1),f.evaluator.setVariable(f.mclickIzqStr,1),window.removeEventListener("touchmove",g),window.removeEventListener("touchend",
a),b.stopPropagation(),b.preventDefault(),f.parent.update()}function c(a){document.activeElement.blur();window.focus();a.stopPropagation();a.preventDefault();f.click=0;f.evaluator.setVariable(f.mpressedStr,0);f.evaluator.setVariable(f.mclickedStr,1);f.evaluator.setVariable(f.mclickIzqStr,1);"R"===f.whichBtn&&(window.removeEventListener("mousemove",e),f.posZoom==f.posZoomNew&&b.showConfig&&(f.parent.externalSpace.show(),f.posZoom=!1,f.posZoomNew=!0));window.removeEventListener("mousemove",g);window.removeEventListener("mouseup",
c);f.parent.deactivateControls();f.parent.update()}function d(a){f.posAnte=b.getCursorPosition(a,f.container);f.mouse_x=f.getRelativeX(f.posAnte.x);f.mouse_y=f.getRelativeY(f.posAnte.y);f.evaluator.setVariable(f.mxStr,f.mouse_x);f.evaluator.setVariable(f.myStr,f.mouse_y);f.evaluator.setVariable(f.mclickedStr,0);f.evaluator.setVariable(f.mclickIzqStr,0);f.parent.update()}function e(a){a.preventDefault();f.posZoomNew=b.getCursorPosition(a,f.container).y;f.evaluator.setVariable(f.scaleStr,f.tempScale+
f.tempScale/45*((f.posZoom-f.posZoomNew)/10));f.parent.update()}function g(a){a.preventDefault();a.stopPropagation();f.fixed||(f.posNext=b.getCursorPosition(a,f.container),L=f.posAnte.x-f.posNext.x,J=f.posAnte.y-f.posNext.y,f.evaluator.setVariable(f.OxStr,f.Ox-L),f.evaluator.setVariable(f.OyStr,f.Oy-J));d(a)}var f=this;f.posZoom=f.posZoomNew=null;f.sensitive_to_mouse_movements&&f.canvas.addEventListener("touchmove",d);f.canvas.addEventListener("touchstart",function(b){window.focus();document.activeElement.blur();
if(f.evaluator.variables[f.id+".DJS_NO_FIXED"]||!f.fixed||f.sensitive_to_mouse_movements)f.parent.clearClick(),f.click=1,f.evaluator.setVariable(f.mpressedStr,1),f.evaluator.setVariable(f.mclickedStr,0),f.evaluator.setVariable(f.mclickIzqStr,0),f.parent.deactivateControls(),d(b),window.addEventListener("touchmove",g),window.addEventListener("touchend",a),b.stopPropagation(),b.preventDefault()});f.sensitive_to_mouse_movements&&f.canvas.addEventListener("mousemove",d);f.canvas.addEventListener("mousedown",
function(a){window.focus();document.activeElement.blur();a.stopPropagation();a.preventDefault();f.parent.clearClick();f.click=1;f.parent.deactivateControls();f.whichBtn=b.whichBtn(a);"R"===f.whichBtn?(window.addEventListener("mouseup",c),f.posZoom=b.getCursorPosition(a,f.container).y,f.posZoomNew=f.posZoom,f.fixed||(f.tempScale=f.scale,window.addEventListener("mousemove",e))):"L"===f.whichBtn&&(f.evaluator.setVariable(f.mpressedStr,1),f.evaluator.setVariable(f.mclickedStr,0),f.evaluator.setVariable(f.mclickIzqStr,
0),d(a),window.addEventListener("mousemove",g),window.addEventListener("mouseup",c))});document.addEventListener("visibilitychange",function(a){c(a)});document.addEventListener("mouseleave",function(a){f.click=0;f.evaluator.setVariable(f.mpressedStr,0);f.evaluator.setVariable(f.mclickedStr,1);f.evaluator.setVariable(f.mclickIzqStr,1);window.removeEventListener("mousemove",g);window.removeEventListener("mouseup",c)})};b.Space2D=M;return b}(descartesJS||{});
descartesJS=function(b){var a,c,h;function l(a,c){N=b.subtract3D(a,b.scalarProd3D(c,b.dotProduct3D(a,c)));E=b.add3D(a,b.scalarProd3D(N,-2));L=b.norm3D(E);return 0!==L?b.scalarProd3D(E,1/L):b.scalarProd3D(a,-1)}function d(a,b){return b.depth-a.depth}if(b.loadLib)return b;var k=Math.floor,g=Math.max,n=Math.cos,f=Math.sin,m,p,e,u,v,w,q,r,y,x,z,A,C,H,D,F,G=[],B,I,O,Q,K,P,N,E,L,J,M,U=function(a,c){e=c=b.Space.call(this,a,c)||this;e.ratio=a.ratio;e.backCanvas=b.newHTML("canvas",{id:e.id+"_background",width:e.w*
e.ratio+"px",height:e.h*e.ratio+"px"});e.canvas=b.newHTML("canvas",{id:e.id+"_canvas",width:e.w*e.ratio+"px",height:e.h*e.ratio+"px",class:"DescartesSpace3DCanvas",style:"z-index: "+e.zIndex+";"});e.ctx=e.canvas.getContext("2d");e.ctx.imageSmoothingEnabled=!1;e.canvas.ratio=e.ratio;e.canvas.style=e.backCanvas.style=(0<e.border_width?"border:"+e.border_width+"px solid "+e.border_color.getColor()+";":"")+(e.border_radius?"border-radius:"+e.border_radius+"px;":"");var d=e.id+".image";e.parent.images[d]=
e.canvas;e.parent.images[d].ready=1;e.parent.images[d].complete=!0;e.parent.images[d].canvas=!0;e.evaluator.setVariable(d,d);e.graphicControlContainer=b.newHTML("div",{id:e.id+"_graphicControls",style:"position:absolute;left:0px;top:0px;z-index:"+e.zIndex+";"});e.numCtrContainer=b.newHTML("div",{id:e.id+"_numericalControls",style:"position:absolute;left:0px;top:0px;z-index:"+e.zIndex+";"});e.container=b.newHTML("div",{id:e.id,class:"DescartesSpace3DContainer",style:"z-index:"+e.zIndex+";"});e.container.appendChild(e.backCanvas);
e.container.appendChild(e.canvas);e.container.appendChild(e.graphicControlContainer);e.container.appendChild(e.numCtrContainer);a.container.insertBefore(e.container,a.loader);e.eye={x:0,y:0,z:0};e.lights=[{x:50,y:50,z:70},{x:50,y:-50,z:30},{x:20,y:0,z:-80},{x:0,y:0,z:0}];d=0;for(var g=e.lights.length;d<g;d++)e.lights[d]=b.normalize3D(e.lights[d]);e.light3={x:0,y:0,z:0};e.intensity=[.4,.5,.3,0];e.userIntensity=0;e.dim=1;e.tmpIntensity=[];e.OxStr=e.id+".Ox";e.OyStr=e.id+".Oy";e.scaleStr=e.id+".escala";
e.wStr=e.id+"._w";e.hStr=e.id+"._h";e.mxStr=e.id+".mouse_x";e.myStr=e.id+".mouse_y";e.mpressedStr=e.id+".mouse_pressed";e.mclickedStr=e.id+".mouse_clicked";e.mclickIzqStr=e.id+".clic_izquierdo";e.obsStr=e.id+".observador";e.ojoXStr=e.id+".Ojo.x";e.ojoYStr=e.id+".Ojo.y";e.ojoZStr=e.id+".Ojo.z";e.rotZStr=e.id+".rot.z";e.rotYStr=e.id+".rot.y";e.userIDimStr=e.id+".userIlum.dim";e.userIIStr=e.id+".userIlum.I";e.userIxStr=e.id+".userIlum.x";e.userIyStr=e.id+".userIlum.y";e.userIzStr=e.id+".userIlum.z";
e.evaluator.setVariable(e.rotZStr,0);e.evaluator.setVariable(e.rotYStr,0);e.evaluator.setVariable(e.userIDimStr,e.dim);e.evaluator.setVariable(e.userIIStr,e.userIntensity);e.evaluator.setVariable(e.userIxStr,0);e.evaluator.setVariable(e.userIyStr,0);e.evaluator.setVariable(e.userIzStr,0);M=new b.Primitive3D({V:[new b.Vec4D],type:"vertex"},e);e.evaluator.setFunction(e.id+"._X3D2D_",function(a,b,c){M.V[0].x=a;M.V[0].y=b;M.V[0].z=c;M.computeDepth(e);return M.projV[0].x});e.evaluator.setFunction(e.id+
"._Y3D2D_",function(a,b,c){M.V[0].x=a;M.V[0].y=b;M.V[0].z=c;M.computeDepth(e);return M.projV[0].y});e.resizable&&(e.wModExpr=a.evaluator.parser.parse(e.wModExpr),e.hModExpr=a.evaluator.parser.parse(e.hModExpr));e.addEvents();return c};$jscomp.inherits(U,b.Space);U.prototype.init=function(a){e=this;e.initSpace();e.canvas&&(e.old_w=e.w,e.old_h=e.h,e.canvas.width=e.backCanvas.width=e.w*e.ratio,e.canvas.height=e.backCanvas.height=e.h*e.ratio,e.canvas.style.width=e.backCanvas.style.width=e.w+"px",e.canvas.style.height=
e.backCanvas.style.height=e.h+"px");e.w_2=e.w/2;e.h_2=e.h/2;e.w_plus_h=e.w+e.h;e.oldMouse={x:0,y:0};e.S={x:e.h/1080*-20.6*(40/e.scale),y:0,z:0};e.Ojo={x:3*e.w_2,y:0,z:0};e.evaluator.setVariable(e.ojoXStr,e.Ojo.x);e.evaluator.setVariable(e.ojoYStr,e.Ojo.y);e.evaluator.setVariable(e.ojoZStr,e.Ojo.z)};U.prototype.update=function(a){e=this;m=e.evaluator;p=e.parent;m.setVariable(e.wStr,e.w);m.setVariable(e.hStr,e.h);e.drawIfValue=0<m.eval(e.drawif);if(e.drawIfValue){e.resizable&&(wModExpr=e.evaluator.eval(e.wModExpr),
hModExpr=e.evaluator.eval(e.hModExpr),e.old_w!=wModExpr||e.old_h!=hModExpr)&&(e.w=wModExpr,e.h=hModExpr,e.w_2=e.w/2,e.h_2=e.h/2,m.setVariable(e.wStr,e.w),m.setVariable(e.hStr,e.h),e.old_w=e.w,e.old_h=e.h,e.canvas.width=e.backCanvas.width=e.w*e.ratio,e.canvas.height=e.backCanvas.height=e.h*e.ratio,e.canvas.style.width=e.backCanvas.style.width=e.w+"px",e.canvas.style.height=e.backCanvas.style.height=e.h+"px",a=!0,e.S={x:e.h/1080*-20.6*(40/e.scale),y:0,z:0},e.Ojo={x:3*e.w_2,y:0,z:0},e.evaluator.setVariable(e.ojoXStr,
e.Ojo.x),e.evaluator.setVariable(e.ojoYStr,e.Ojo.y),e.evaluator.setVariable(e.ojoZStr,e.Ojo.z));w=e.x!==m.eval(e.xExpr)+e.displaceRegionWest;q=e.y!==m.eval(e.yExpr)+p.plecaHeight+e.displaceRegionNorth;e.spaceChange=a||w||q||e.drawBefore!==e.drawIfValue||e.Ox!==m.getVariable(e.OxStr)||e.Oy!==m.getVariable(e.OyStr)||e.Ojo.x!==m.getVariable(e.ojoXStr)||e.Ojo.y!==m.getVariable(e.ojoYStr)||e.Ojo.z!==m.getVariable(e.ojoZStr)||e.scale!==m.getVariable(e.scaleStr);e.x=w?m.eval(e.xExpr)+e.displaceRegionWest:
e.x;e.y=q?m.eval(e.yExpr)+p.plecaHeight+e.displaceRegionNorth:e.y;e.Ojo.x=m.getVariable(e.ojoXStr);e.Ojo.y=m.getVariable(e.ojoYStr);e.Ojo.z=m.getVariable(e.ojoZStr);e.Ox=m.getVariable(e.OxStr);e.Oy=m.getVariable(e.OyStr);e.scale=m.getVariable(e.scaleStr);e.drawBefore=e.drawIfValue;if(a||void 0==e.observer){a=0;for(var b=e.parent.controls.length;a<b;a++)e.parent.controls[a].id===e.obsStr&&(J=!0);e.observer=J?m.getVariable(e.obsStr)||2.5*e.w_plus_h:2.5*e.w_plus_h;e.observer=g(e.observer,.25*e.w_plus_h);
m.setVariable(e.obsStr,e.observer)}1E-6>e.scale?(e.scale=1E-6,m.setVariable(e.scaleStr,1E-6)):1E6<e.scale&&(e.scale=1E6,m.setVariable(e.scaleStr,1E6));if(w||q)e.container.style.left=e.x+"px",e.container.style.top=e.y+"px";e.container.style.display="block";e.dim=m.getVariable(e.userIDimStr);e.userIntensity=m.getVariable(e.userIIStr);e.light3={x:parseInt(m.getVariable(e.userIxStr)),y:parseInt(m.getVariable(e.userIyStr)),z:parseInt(m.getVariable(e.userIzStr))};e.updateCamera();e.ctx.setTransform(e.ratio,
0,0,e.ratio,0,0);e.draw()}else e.container.style.display="none"};U.prototype.updateCamera=function(){this.eye=b.scalarProd3D(this.Ojo,1/this.scale)};U.prototype.rotateVertex=function(d){x=b.degToRad(e.evaluator.getVariable(e.rotZStr));z=n(x);A=f(x);a=d.x*z-d.y*A;c=d.x*A+d.y*z;h=d.z;x=b.degToRad(e.evaluator.getVariable(e.rotYStr));z=n(x);A=f(x);return{x:h*A+a*z,y:c,z:h*z-a*A}};U.prototype.project=function(a){var b=e.eye.x/(a.x-e.eye.x);return{x:e.getAbsoluteX(b*(e.eye.y-a.y)),y:e.getAbsoluteY(b*(e.eye.z-
a.z)),z:e.eye.x-a.x}};U.prototype.computeColor=function(a,c,d){"object"!=typeof a&&(a.match("rgba")?a=b.RGBAToHexColor(a):a.match("#")&&(a=new b.Color(a.substring(1))));Q=b.subtract3D(this.eye,c.avg);K=b.norm3D(Q);P=b.scalarProd3D(Q,1/K);this.lights[3]=b.subtract3D(this.light3,c.avg);F=b.norm3D(this.lights[3]);for(var e=0,g=this.intensity.length-1;e<g;e++)G[e]=this.intensity[e]*this.dim;G[3]=this.userIntensity*this.userIntensity/F||0;B=d?this.dim/2:this.dim/4;I=0;O=0>c.direction?c.normal:b.scalarProd3D(c.normal,
-1);c=0;for(e=this.lights.length;c<e;c++)d?(I=Math.max(0,b.dotProduct3D(l(this.lights[c],O),P)),I*=I*I):I=Math.max(0,b.dotProduct3D(this.lights[c],O)),B+=G[c]*I;B=Math.min(B,1);C=k(a.r*B);H=k(a.g*B);D=k(a.b*B);return"rgba("+C+","+H+","+D+","+a.a+")"};U.prototype.draw=function(){e=this;e.ctx.clearRect(0,0,e.canvas.width,e.canvas.height);e.ctx.fillStyle=e.background.getColor();e.ctx.fillRect(0,0,e.canvas.width,e.canvas.height);e.image&&""!=e.image.src&&e.image.ready&&e.image.complete&&("topleft"===
e.bg_display?e.ctx.drawImage(e.image,0,0):"stretch"===e.bg_display?e.ctx.drawImage(e.image,0,0,e.w,e.h):"patch"===e.bg_display?(e.ctx.fillStyle=ctx.createPattern(e.image,"repeat"),e.ctx.fillRect(0,0,e.canvas.width,e.canvas.height)):"center"===e.bg_display&&e.ctx.drawImage(e.image,(e.w-e.image.width)/2,(e.h-e.image.height)/2));if(!e.click){for(var a=$jscomp.makeIterator(e.graphics),b=a.next();!b.done;b=a.next())b.value.update();e.primitives=[];if(e.split)for(a=0,b=e.graphics.length;a<b;a++){u=e.graphics[a];
for(var c=a+1;c<b;c++)v=e.graphics[c],u.splitFace(v),v.splitFace(u);e.primitives=e.primitives.concat(u.primitives||[])}else for(a=0,b=this.graphics.length;a<b;a++){u=this.graphics[a];if(u.split)for(c=a+1;c<b;c++)v=this.graphics[c],v.split&&u.splitFace(v);this.primitives=this.primitives.concat(u.primitives||[])}}b=$jscomp.makeIterator(this.primitives);for(a=b.next();!a.done;a=b.next())a.value.computeDepth(this);this.primitives=this.primitives.sort(d);if("painter"===this.render)this.drawPainter(this.primitives);
else for(b=$jscomp.makeIterator(this.primitives),a=b.next();!a.done;a=b.next())a.value.draw(this.ctx,this);a=$jscomp.makeIterator(this.graphicsCtr);for(b=a.next();!b.done;b=a.next())b.value.draw()};U.prototype.drawPainter=function(a){for(var b=a.length,c=0;c<b;c++)a[c].drawn=!1,a[c].draw(this.ctx,this);var d=[];c=[];for(var e=0,g=a.length,f=.001,k,h;;){k=g;for(var l=0;l<b;l++)if(!a[l].drawn){h=!0;for(var m=0;m<b;m++)if(m!=l&&!a[m].drawn&&a[l].inFrontOf(d,a[m],f)){h=!1;break}h&&(g--,c[e++]=a[l],a[l].drawn=
!0)}if(0==g)break;else if(g==k){if(f*=10,.1<f){for(d=0;d<b;d++)a[d].drawn||(c[e++]=a[d],a[d].drawn=!0);break}}else f=.001}for(a=0;a<b;a++)c[a].draw(this.ctx,this)};U.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}};U.prototype.addEvents=function(){function a(b){window.focus();document.activeElement.blur();f.click=0;f.evaluator.setVariable(f.mpressedStr,0);window.removeEventListener("touchmove",g,!1);
window.removeEventListener("touchend",a,!1);b.preventDefault();f.parent.update()}function c(a){document.body.focus();f.click=0;f.evaluator.setVariable(f.mpressedStr,0);a.preventDefault();"R"===f.whichBtn&&(window.removeEventListener("mousemove",e,!1),f.posZoom==f.posZoomNew&&b.showConfig&&f.parent.externalSpace.show());window.removeEventListener("mousemove",g,!1);window.removeEventListener("mouseup",c,!1);f.parent.update()}function d(a){f.posAnte=b.getCursorPosition(a,f.container);f.mouse_x=f.getRelativeX(f.posAnte.x);
f.mouse_y=f.getRelativeY(f.posAnte.y);f.evaluator.setVariable(f.mxStr,f.mouse_x);f.evaluator.setVariable(f.myStr,f.mouse_y);f.parent.update()}function e(a){a.preventDefault();f.posZoomNew=b.getCursorPosition(a,f.container).y;f.evaluator.setVariable(f.scaleStr,f.tempScale+f.tempScale/45*((f.posZoom-f.posZoomNew)/10));f.posObserverNew=b.getCursorPosition(a,f.container).x;f.evaluator.setVariable(f.obsStr,f.tempObserver-2.5*(f.posObserver-f.posObserverNew));f.parent.update()}function g(a){if(!f.fixed&&
f.click){r=(f.getAbsoluteX(f.oldMouse.x)-f.getAbsoluteX(f.mouse_x))/4;y=(-f.getAbsoluteY(f.oldMouse.y)+f.getAbsoluteY(f.mouse_y))/4;if(r!==f.disp.x||y!==f.disp.y)f.alpha=b.degToRad(f.evaluator.getVariable(f.rotZStr)),f.beta=b.degToRad(-f.evaluator.getVariable(f.rotYStr)),f.alpha=b.radToDeg(f.alpha)-r,f.beta=b.radToDeg(f.beta)-y,f.evaluator.setVariable(f.rotZStr,f.alpha),f.evaluator.setVariable(f.rotYStr,-f.beta),f.disp.x=r,f.disp.y=y,f.oldMouse.x=f.getRelativeX(f.posAnte.x),f.oldMouse.y=f.getRelativeY(f.posAnte.y);
d(a);a.preventDefault()}}var f=this;f.canvas.addEventListener("touchstart",function(c){window.focus();document.activeElement.blur();f.click=1;f.evaluator.setVariable(f.mpressedStr,1);f.parent.deactivateControls();f.posAnte=b.getCursorPosition(c,f.container);f.oldMouse.x=f.getRelativeX(f.posAnte.x);f.oldMouse.y=f.getRelativeY(f.posAnte.y);d(c);window.addEventListener("touchmove",g);window.addEventListener("touchend",a);c.preventDefault()});f.canvas.addEventListener("mousedown",function(a){document.body.focus();
f.click=1;f.parent.deactivateControls();f.whichBtn=b.whichBtn(a);"R"===f.whichBtn?(window.addEventListener("mouseup",c),f.posObserver=b.getCursorPosition(a,f.container).x,f.posObserverNew=f.posObserver,f.posZoom=b.getCursorPosition(a,f.container).y,f.posZoomNew=f.posZoom,f.fixed||(f.tempScale=f.scale,f.tempObserver=f.observer,window.addEventListener("mousemove",e))):"L"==f.whichBtn&&(f.evaluator.setVariable(f.mpressedStr,1),f.posAnte=b.getCursorPosition(a,f.container),f.oldMouse.x=f.getRelativeX(f.posAnte.x),
f.oldMouse.y=f.getRelativeY(f.posAnte.y),d(a),window.addEventListener("mousemove",g),window.addEventListener("mouseup",c));a.preventDefault()});f.disp={x:0,y:0};document.addEventListener("visibilitychange",function(a){c(a)});document.addEventListener("mouseleave",function(a){c(a)})};b.Space3D=U;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,l,d,k,g,n,f=function(a,d){var e=b.Space.call(this,a,d)||this;c=e.parent.evaluator;void 0!=e._w_&&(a=c.parser.parse(e._w_),e._w_="number"!=a.type?a:void 0);void 0!=e._h_&&(a=c.parser.parse(e._h_),e._h_="number"!=a.type?a:void 0);e.isFirefox=/firefox/i.test(window.navigator.userAgent);e.file=e.file?e.file.trim():"";/^\[.*\]$/.test(e.file)?e.file=c.parser.parse(e.file.slice(1,-1)):/^'.*'$/.test(e.file)?e.file=c.parser.parse(e.file):e.file=c.parser.parse("'"+
e.file+"'");e.oldFile=c.eval(e.file);e.MyIFrame=b.newHTML("iframe",{marginheight:0,marginwidth:0,frameborder:0,scrolling:"auto",class:"DescartesSpaceIframe"});0!=e.oldFile&&e.MyIFrame.setAttribute("src",e.oldFile);e.container=b.newHTML("div",{id:e.id,class:"DescartesSpaceIframeContainer",style:"width:"+e.w+"px;height:"+e.h+"px;left:"+e.x+"px;top:"+e.y+"px;z-index:"+e.zIndex+";"+(b.isIOS?"overflow:scroll;-webkit-overflow-scrolling:touch;overflow-scrolling:touch;":"")});e.container.appendChild(e.MyIFrame);
e.imageSrc&&(e.container.style.backgroundImage="url("+e.imageSrc+")");e.parent.container.insertBefore(e.container,e.parent.loader);e.MyIFrame.onload=function(a){var c=this;e.evaluator.setFunction(e.id+".set",function(a,b){c.contentWindow.postMessage({type:"set",name:a,value:b},"*");return 0});e.evaluator.setFunction(e.id+".update",function(){c.contentWindow.postMessage({type:"update"},"*");return 0});e.evaluator.setFunction(e.id+".exec",function(a,b){c.contentWindow.postMessage({type:"exec",name:a,
value:b},"*");return 0});e.evaluator.setFunction(e.id+".changeConf",function(a){if(a){if(b.cacheFiles[a])var d=b.cacheFiles[a];else d=(d=document.getElementById(a))&&"descartes/embed"===d.type?d.textContent:b.openFile(a),d=(d=(new DOMParser).parseFromString(d,"text/html").querySelector("ajs"))?d.innerHTML:"",b.cacheFiles[a]=d;c.contentWindow.postMessage({type:"change_config",filename:a,content:d},"*")}return 0});e.evaluator.setFunction(e.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},"*"))});e.ImReady=!e.isFirefox;e.isFirefox||(e.container.style.visibility="visible",e.container.style.opacity="1",e.container.style.zIndex=e.zIndex,e.container.style.display=e.drawIfValue?"block":"none");e.MyIFrame.style.visibility="visible";e.container.style.backgroundImage=""};e.update();e.evaluator.setVariable(e.id+"._scroll",0);return e};$jscomp.inherits(f,b.Space);f.prototype.init=
function(){this.initSpace()};f.prototype.update=function(b){a=this;h=a.container;c=a.evaluator;a.drawIfValue=0<c.eval(a.drawif);a.ImReady?h.style.display=a.drawIfValue?"block":"none":(h.style.visibility=a.drawIfValue?"visible":"hidden",h.style.opacity=a.drawIfValue?"1":"0",h.style.zIndex=a.drawIfValue?a.zIndex:-1E3);if(a.drawIfValue){b&&(a.x=a.y=Infinity);k=c.eval(a.xExpr)+a.displaceRegionWest;if(l=a.x!==k)a.x=k;k=c.eval(a.yExpr)+a.parent.plecaHeight+a.displaceRegionNorth;if(d=a.y!==k)a.y=k;void 0!=
a._w_&&(k=c.eval(a._w_),a.w!==k&&(a.container.style.width=k+"px",a.w=k));void 0!=a._h_&&(k=c.eval(a._h_),a.h!==k&&(h.style.height=k+"px",a.h=k));if(l||d)a.container.style.left=a.x+"px",a.container.style.top=a.y+"px";g=c.eval(a.file);g!==a.oldFile&&(a.ImReady=!1,a.isFirefox||(h.style.display="block",h.style.visibility=a.drawIfValue?"visible":"hidden",h.style.opacity=a.drawIfValue?"1":"0",h.style.zIndex=a.drawIfValue?a.zIndex:-1E3),a.imageSrc&&(h.style.backgroundImage="url("+a.imageSrc+")"),a.MyIFrame.style.visibility=
"hidden",a.oldFile=g,a.MyIFrame.contentWindow.location.replace(g));n=c.getVariable(a.id+"._scroll");1==n?(a.MyIFrame.setAttribute("scrolling","yes"),a.MyIFrame.style.overflow=""):-1==n?(a.MyIFrame.setAttribute("scrolling","no"),a.MyIFrame.style.overflow="hidden"):(a.MyIFrame.setAttribute("scrolling","auto"),a.MyIFrame.style.overflow="")}else a.MyIFrame.contentWindow.blur()};b.SpaceHTMLIFrame=f;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=1,c=function(c){this.children=c.children;this.lessonParser=c.lessonParser;this.images=c.images;this.audios=c.audios;this.im_l=this.au_l=0;this.descartesApp=c;var h=document.querySelectorAll('script[type="descartes/imagen"]'),d;h=$jscomp.makeIterator(h);for(d=h.next();!d.done;d=h.next()){var k=d.value;this.images[k.id]=new Image;this.images[k.id].onload=function(){this.ready=1};d=k.innerText.trim();d.startsWith("data:image/svg+xml,")&&(d=encodeURIComponent(d).replace("data%3Aimage%2Fsvg%2Bxml%2C",
"data:image/svg+xml,"));this.images[k.id].src=d}this.imgLoader=b.newHTML("div",{class:"DescartesLoaderImage"});this.progress=b.newHTML("progress",{class:"PBL",value:0,max:100});c.imgLoader?(c.loader.style.backgroundColor="transparent",this.imgLoader.setAttribute("style","background-image:url("+c.imgLoader+");background-size:contain;")):(a=c.width<c.height?c.width/1144:c.height/1092,a=Math.min(2.5,a),this.imgLoader.setAttribute("style","background-image:url("+b.loaderImg.src+");background-position:50% 33.5%;background-size:"+
880*a+"px;"),this.progress.setAttribute("style","visibility:visible;left:"+(c.width-726*a)/2+"px;top:"+(33.5*c.height/100+940*a/2)+"px;width:"+726*a+"px;height:"+14*a+"px;"));c.loader.appendChild(this.imgLoader);c.loader.appendChild(this.progress);c.firstRun=!1;this.initPreloader()};c.prototype.initPreloader=function(){var a=this,c=a.children,d=a.images,k=a.audios,g=/[\w\.\-//]*(\.png|\.jpg|\.gif|\.svg|\.webp)/gi,n=/[\w\.\-//]*(\.ogg|\.oga|\.mp3|\.wav)/gi,f=/'macro'|'makro'/g,m;var p=0;for(m=c.length;p<
m;p++){if(c[p].value.match(f)){var e="";var u=void 0;var v=a.lessonParser.split(c[p].value);var w=0;for(var q=v.length;w<q;w++)"expresion"===babel[v[w][0]]&&(e=v[w][1]);e&&(u=(u=document.getElementById(e))&&"descartes/macro"==u.type?u.text:b.openFile(e));if(u&&(u=u.match(g)))for(e=0,w=u.length;e<w;e++)v=u[e],v.toLowerCase().endsWith("vacio.gif")||""==v.substring(0,v.length-4)||d[v]||(d[v]=this.descartesApp.getImageAux(v))}if(u=c[p].value.match(g))for(e=0,w=u.length;e<w;e++)v=u[e],v.toLowerCase().endsWith("vacio.gif")||
""==v.substring(0,v.length-4)||d[v]||(d[v]=this.descartesApp.getImageAux(v));if(u=c[p].value.match(n))for(e=0,v=u.length;e<v;e++)k[u[e]]||(k[u[e]]=this.descartesApp.getAudioAux(u[e]))}for(var r in d)d.hasOwnProperty(r)&&a.im_l++;for(var y in k)k.hasOwnProperty(y)&&a.au_l++;var x=a.im_l+a.au_l;0<x&&a.progress.setAttribute("max",x);var z,A=function(){z=0;for(var c in d)d.hasOwnProperty(c)&&(d[c].ready||d[c].errorload)&&z++;for(var e in k)k.hasOwnProperty(e)&&(k[e].ready||k[e].errorload)&&z++;a.progress.setAttribute("value",
z);z!=x?a.timer=b.setTimeout(A,1):a.descartesApp.initBuildApp()};A()};b.DescartesLoader=c;return b}(descartesJS||{});
descartesJS=function(b){function a(){b.cssScale=Math.min(window.innerWidth/this.width,window.innerHeight/this.height);this.container.parentNode.style.width=window.innerWidth+"px";this.container.parentNode.style.height=window.innerHeight+"px";this.container.style.transform="translate(-50%, -50%) scale("+b.cssScale+")"}if(b.loadLib)return b;var c=/type='fill'|tipo='relleno'|tipus='ple'|mota='betea'|type='plein'|tipo='recheo'|tipo='curva_piena'|tipo='preencher'|tipus='ple'/,h=function(a){this.animation=
{playing:!1,play:function(){},stop:function(){},reinit:function(){}};this.ratio=b._ratio;this.URL=window.location.href;this.applet=a;this.parentC=a.parentNode;this.width=parseFloat(a.getAttribute("width"));this.height=parseFloat(a.getAttribute("height"));this.decimal_symbol=".";this.decimal_symbol_regexp=/\./g;this.language="espa\u00f1ol";this.children=a.getElementsByTagName("param");this.code=a.getAttribute("code");this.images={};this.audios={};this.firstRun=!0;this.keyboard=new b.Keyboard(this);
this.scaleToFit=function(){};this.init()};h.prototype.init=function(){this.stop();this.evaluator=new b.Evaluator(this);this.evaluator.setVariable("DJS.w",this.width);this.evaluator.setVariable("DJS.h",this.height);this.evaluator.setVariable("DJS.container_w",this.width);this.evaluator.setVariable("DJS.container_h",this.height);this.getURLParameters();this.lessonParser=new b.LessonParser(this);var c,d=$jscomp.makeIterator(this.children);for(c=d.next();!c.done;c=d.next())if(c=c.value,"Buttons"==babel[c.name])this.buttonsConfig=
this.lessonParser.parseButtonsConfig(c.value);else if("image_loader"==c.name)this.imgLoader=c.value;else if("expand"==c.name)this.expand=c.value;else if("docBase"==c.name)document.head.appendChild(b.newHTML("base",{id:"descartesJS_base",href:c.value}));else if(c.name.startsWith("E_"))break;this.externalSpace&&this.externalSpace.container.parentNode&&document.body.removeChild(this.externalSpace.container);this.externalSpace=new b.SpaceExternal(this);this.northSpace={container:b.newHTML("div"),controls:[]};
this.southSpace={container:b.newHTML("div"),controls:[]};this.eastSpace={container:b.newHTML("div"),controls:[]};this.westSpace={container:b.newHTML("div"),controls:[]};this.editableRegion={container:b.newHTML("div"),textFields:[]};this.spaces=[];this.controls=[];this.auxiliaries=[];this.events=[];this.zIndex=this.tabindex=this.plecaHeight=this.nIframes=0;void 0!=this.container&&(this.cleanCanvasImages(),this.parentC.removeChild(this.container),delete this.container,delete this.loader);this.container=
b.newHTML("div");this.loader=b.newHTML("div",{class:"DescartesLoader"});this.container.addEventListener("contextmenu",b.preventDefault);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&&
(d=b.newHTML("style",{rel:"stylesheet",type:"text/css",id:"StyleDescartesAppsPrint"}),document.head.insertBefore(d,document.head.firstChild),d.innerHTML="@page{margin:0cm;size:"+this.width+"px "+this.height+"px;}",(d=document.querySelector("meta[name=viewport"))&&window.parent==window&&d.setAttribute("content","width="+this.width+",initial-scale=1.0,user-scalable=no"),document.body.style.margin=document.body.style.padding=0,document.body.style.overflow="hidden",this.container.parentNode.removeAttribute("align"),
this.container.parentNode.style.overflow="hidden",this.container.style.left=this.container.style.top="50%",this.container.style.transformOrigin="50% 50%",this.scaleToFit=a,this.scaleToFit());"cover"==this.expand&&(this.scaleToFit=function(){this.container.width=this.width=window.innerWidth;this.container.height=this.height=window.innerHeight;this.container.setAttribute("style","width:"+this.width+"px;height:"+this.height+"px;");this.evaluator.setVariable("DJS.container_w",this.container.width);this.evaluator.setVariable("DJS.container_h",
this.container.height);try{this.update()}catch(n){}if(this.spaces)for(var a=$jscomp.makeIterator(this.spaces),b=a.next();!b.done;b=a.next())b=b.value,b.initSpace(),b.init(),b.update(!0)},this.scaleToFit());this.firstRun?(this.loader.style.display="block",new b.DescartesLoader(this)):this.initBuildApp()};h.prototype.initBuildApp=function(){b.showConfig=!0;var a=this,d,k=a.lessonParser,g=[],h=[],f=[],m=[],p=[],e=[],u=$jscomp.makeIterator(a.children);for(d=u.next();!d.done;d=u.next())d=d.value,"editable"==
babel[d.name]?b.showConfig="false"!=babel[d.value]:"language"==babel[d.name]?a.language=d.value:"Buttons"==babel[d.name]?a.buttonsConfig=k.parseButtonsConfig(d.value):"decimal_symbol"==babel[d.name]?(a.decimal_symbol=d.value,a.decimal_symbol_regexp=new RegExp("\\"+a.decimal_symbol,"g")):"version"==babel[d.name]?a.version=parseInt(d.value):d.name.startsWith("E_")?(/='HTMLIFrame'/.test(d.value)&&a.nIframes++,g.push(d.value)):d.name.startsWith("C_")?h.push(d.value):d.name.startsWith("A_")?f.push(d.value):
d.name.startsWith("G_")?(c.test(d.value)&&(a.ratio=1),m.push(d.value)):d.name.startsWith("S_")?p.push(d.value):"Animation"==babel[d.name]&&e.push(d.value);g=$jscomp.makeIterator(g);for(u=g.next();!u.done;u=g.next())a.spaces.push(k.parseSpace(u.value)),a.zIndex++;m.forEach(function(c,d){b.DEBUG.elemIndex=d;if(c=k.parseGraphic(c))a.editableRegionVisible=a.editableRegionVisible||c.visible,c.space.addGraph(c)});p.forEach(function(a,c){b.DEBUG.elemIndex=c;(a=k.parse3DGraphic(a))&&a.space.addGraph(a,!0)});
h=$jscomp.makeIterator(h);for(m=h.next();!m.done;m=h.next())a.controls.push(k.parseControl(m.value));f=$jscomp.makeIterator(f);for(h=f.next();!h.done;h=f.next())k.parseAuxiliar(h.value);e=$jscomp.makeIterator(e);for(f=e.next();!f.done;f=e.next())a.animation=k.parseAnimation(f.value);a.configRegions();a.updateAuxiliaries();a.updateAuxiliaries();e=$jscomp.makeIterator(a.controls);for(f=e.next();!f.done;f=e.next())f.value.init();a.updateControls();a.updateSpaces(!0);b.setTimeout(function(){a.finishInit()},
10*a.nIframes);document.addEventListener("keydown",function(c){if(c.ctrlKey&&c.shiftKey&&"C"===c.key||c.commandKey&&c.shiftKey&&"C"===c.key)navigator.clipboard.writeText(a.applet.innerHTML),b.preventDefault(c)})};h.prototype.finishInit=function(){var a=this;a.evaluator.setVariable("decimalSymbol",a.decimal_symbol);a.update();a.loader.parentNode.removeChild(a.loader);window.parent!==window&&(a.parentC.style.margin=a.parentC.style.padding="0px","fit"==a.expand&&window.addEventListener("touchmove",function(a){a.preventDefault();
a.stopPropagation()}),window.parent.postMessage({type:"reportSize",href:a.URL,width:a.width,height:a.height},"*"),window.parent.postMessage({type:"ready",value:a.URL},"*"),b.onResize());window.opener&&window.opener.postMessage({type:"isResizeNeeded",href:a.URL},"*");b.showConfig&&a.externalSpace.init();try{window.dispatchEvent(new CustomEvent("descartesReady",{detail:a}))}catch(d){console.warn("CustomEvents not supported in this browser")}a.evaluator.setFunction("openKB",function(b,c,g,h,f,l,p,e,
u,v,w){a.keyboard.show(null,b,c,g,h,{x:f,y:l,w:p,h:e,fs:u+"px",value:v+"",type:"custom",tagName:"textfield"},w)});a.readyApp=!0};h.prototype.adjustSize=function(){document.body.style.margin=document.body.style.padding=this.parentC.style.margin=this.parentC.style.padding="0px";var a=parseInt(this.width+30),c=parseInt(this.height+90);window.moveTo(parseInt(screen.width-a)/2,parseInt(screen.height-c)/2);window.resizeTo(a,c);b.onResize()};h.prototype.configRegions=function(){var a=this.evaluator.parser,
c=this.buttonsConfig||{},k=this.container,g=100,h=100,f=0,m=0,p=0,e=0,u=0,v=this.northSpace.controls,w=this.southSpace.controls;var q=this.eastSpace.controls;var r=this.westSpace.controls;if(0<c.rowsNorth||0<v.length||c.about||c.config){0>=c.rowsNorth?(f=c.height,c.rowsNorth=1):f=c.height*c.rowsNorth;var y=this.northSpace.container;y.id="descartesJS_north";y.setAttribute("style","width:"+k.width+"px;height:"+f+"px;left:0;top:"+this.plecaHeight+"px;");k.insertBefore(y,this.loader);y=k.width;var x=
0;c.about?(x=g,y-=x):g=0;c.config&&(y-=100);for(var z=Math.ceil(v.length/c.rowsNorth),A=y/z,C=0,H=v.length;C<H;C++)v[C].expresion=a.parse("("+(x+C%z*A)+","+c.height*Math.floor(C/z)+","+A+","+c.height+")"),v[C].init();c.about&&(v=new b.Button(this,{region:"north",name:"english"==this.language?"about":"cr\u00e9ditos",font_size:a.parse("15"),expresion:a.parse("(0,0,"+g+","+f+")")}),v.actionExec={execute:b.showAbout},v.update());c.config&&(new b.Button(this,{region:"north",name:"config",font_size:a.parse("15"),
action:"config",expresion:a.parse("("+(y+g)+",0,100,"+f+")")})).update()}if(0<c.rowsSouth||0<w.length||c.init||c.clear){0>=c.rowsSouth?(m=c.height,c.rowsSouth=1):m=c.height*c.rowsSouth;g=k.width;y=0;c.init?(y=h,g-=y):h=0;c.clear&&(g-=100);v=this.southSpace.container;v.id="descartesJS_south";v.setAttribute("style","width:"+k.width+"px;height:"+m+"px;left:0;bottom:0;");k.insertBefore(v,this.loader);v=Math.ceil(w.length/c.rowsSouth);x=g/v;z=0;for(A=w.length;z<A;z++)w[z].expresion=a.parse("("+(y+z%v*
x)+","+c.height*Math.floor(z/v)+","+x+","+c.height+")"),w[z].init();c.init&&(new b.Button(this,{region:"south",name:"english"==this.language?"init":"inicio",font_size:a.parse("15"),action:"init",expresion:a.parse("(0,0,"+h+","+m+")")})).update();c.clear&&(new b.Button(this,{region:"south",name:"english"==this.language?"clear":"limpiar",font_size:a.parse("15"),action:"clear",expresion:a.parse("("+(g+h)+",0,100,"+m+")")})).update()}if(0<q.length)for(h=k.height-f-m,e=c.widthEast,w=this.eastSpace.container,
w.id="descartesJS_east",w.setAttribute("style","width:"+e+"px;height:"+h+"px;right:0;top:"+f+"px;"),k.insertBefore(w,this.loader),h=0,w=q.length;h<w;h++)q[h].expresion=a.parse("(0,"+c.height*h+","+e+","+c.height+")"),q[h].init();if(0<r.length)for(q=k.height-f-m,u=c.widthWest,h=this.westSpace.container,h.id="descartesJS_west",h.setAttribute("style","width:"+u+"px;height:"+q+"px;left:0;top:"+f+"px;"),k.insertBefore(h,this.loader),q=0,h=r.length;q<h;q++)r[q].expresion=a.parse("(0,"+c.height*q+","+u+
","+c.height),r[q].init();if(this.editableRegionVisible)for(p=c.height,a=this.editableRegion.container,a.id="descartesJS_editableRegion",a.setAttribute("style","position:absolute;width:"+k.width+"px;height:"+p+"px;left:0;top:"+(k.height-m-c.height)+"px;"),k.insertBefore(a,this.loader),c=this.editableRegion.textFields,k=k.width/c.length,r=b.getFieldFontSize(p),q=0,h=c.length;q<h;q++)"div"==c[q].type?(a.appendChild(c[q].container),c[q].container.setAttribute("style","font-family:"+b.sansserif_font+
";width:"+(k-4)+"px;height:"+p+"px;position:absolute;left:"+q*k+"px;top:0;"),w=c[q].container.firstChild,w.setAttribute("style","font-family:"+b.sansserif_font+";font-size:"+r+"px;padding-top:0;background-color:#e0e4e8;position:absolute;left:0;top:0;height:"+p+"px;text-align:center;line-height:"+p+"px;"),g=w.offsetWidth,w.style.width=g+"px",w.firstChild.textContent=w.firstChild.textContent.substring(3,w.firstChild.textContent.length-3),c[q].container.lastChild.setAttribute("style","font-family:"+
b.monospace_font+";font-size:"+r+"px;width:"+(k-g)+"px;height:"+p+"px;position:absolute;left:"+g+"px;top:0;border:2px groove white;")):(a.appendChild(c[q]),c[q].setAttribute("style","font-family:"+b.monospace_font+";font-size:"+r+"px;width:"+k+"px;height:"+p+"px;position:absolute;left:"+q*k+"px;top:0;border:2px groove white;"));this.displaceRegionNorth=f;this.displaceRegionSouth=m+(p||0);this.displaceRegionEast=e;this.displaceRegionWest=u;f=$jscomp.makeIterator(this.spaces);for(m=f.next();!m.done;m=
f.next())m.value.init()};h.prototype.update=function(){this.updateAuxiliaries();this.updateControls();this.updateEvents();this.updateControls();this.updateSpaces()};h.prototype.clearClick=function(){for(var a=$jscomp.makeIterator(this.spaces),b=a.next();!b.done;b=a.next())b.value.clearClick()};h.prototype.removeButtonClick=function(){b.newBlobContent=null;for(var a=$jscomp.makeIterator(this.controls),c=a.next();!c.done;c=a.next())c.value.buttonClick=!1};h.prototype.deactivateControls=function(){if(this.controls)for(var a=
$jscomp.makeIterator(this.controls),b=a.next();!b.done;b=a.next())b=b.value,b.deactivate&&b.deactivate()};h.prototype.updateAuxiliaries=function(){for(var a=$jscomp.makeIterator(this.auxiliaries),b=a.next();!b.done;b=a.next())b.value.update()};h.prototype.updateEvents=function(){for(var a=$jscomp.makeIterator(this.events),b=a.next();!b.done;b=a.next())b.value.update()};h.prototype.updateControls=function(){for(var a=$jscomp.makeIterator(this.controls),b=a.next();!b.done;b=a.next())b.value.update()};
h.prototype.updateSpaces=function(a){for(var b=$jscomp.makeIterator(this.spaces),c=b.next();!c.done;c=b.next())c.value.update(a)};h.prototype.clear=function(){for(var a=$jscomp.makeIterator(this.spaces),b=a.next();!b.done;b=a.next())b=b.value,b.spaceChange=!0,b.drawBackground&&b.drawBackground()};h.prototype.play=function(){this.animation.play()};h.prototype.stop=function(){this.animation.stop()};h.prototype.reinitAnimation=function(){this.animation.reinit()};h.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)};h.prototype.getImage=function(a){return a?(this.images[a]||(this.images[a]=this.getImageAux(a)),this.images[a]):new Image};h.prototype.getImageAux=function(a){var b=new Image;a.startsWith("http")&&(b.crossOrigin="Anonymous");b.onload=function(){this.ready=1};b.onerror=function(){this.errorload=1};b.src=a;return b};h.prototype.getAudio=function(a){return a?(this.audios[a]||
(this.audios[a]=this.getAudioAux(a)),this.audios[a]):new Audio};h.prototype.getAudioAux=function(a){var c=new Audio(a);c.filename=a;var k=function(){this.ready=1},g=function(){this.canPlayType("audio/"+this.filename.substring(this.filename.length-3))||"mp3"!=this.filename.substring(this.filename.length-3)?(console.warn("El archivo "+a+" no puede ser reproducido"),this.errorload=1):(c=new Audio(this.filename.replace("mp3","ogg")),c.filename=this.filename.replace("mp3","ogg"),c.addEventListener("canplaythrough",
k),c.addEventListener("load",k),c.addEventListener("error",g),c.load())};c.addEventListener("canplaythrough",k);c.addEventListener("load",k);c.addEventListener("error",g);b.hasTouchSupport?(c.load(),c.play(),b.setTimeout(function(){c.pause()},20),c.ready=1):c.load();return c};h.prototype.getControlByCId=function(a){return this.getControlById(a,!0)};h.prototype.getControlById=function(a,b){b=b?"cID":"id";for(var c=$jscomp.makeIterator(this.controls),d=c.next();!d.done;d=c.next())if(d=d.value,d[b]==
a)return d;return{update:function(){},w:0,h:0}};h.prototype.getSpaceByCId=function(a){return this.getSpaceById(a,!0)};h.prototype.getSpaceById=function(a,b){b=b?"cID":"id";for(var c=$jscomp.makeIterator(this.spaces),d=c.next();!d.done;d=c.next())if(d=d.value,d[b]==a)return d;return{update:function(){},w:0,h:0}};h.prototype.getURLParameters=function(){var a=this.URL,b=a.indexOf("?");if(-1!=b)for(a=decodeURIComponent(a.substring(b+1)).split("&"),a=$jscomp.makeIterator(a),b=a.next();!b.done;b=a.next())b=
b.value.split("="),2==b.length&&this.evaluator.setVariable("URL."+b[0],+b[1]==+b[1]?parseFloat(b[1]):b[1])};h.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]};b.DescartesApp=
h;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;b.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(a,c){a="Error: "+a+" en\u300a "+c+" \u300b";var h="";switch(b.DEBUG.objectName){case "Auxiliar":c="event"===b.DEBUG.typeName||"algorithm"===b.DEBUG.typeName||
"constant"===b.DEBUG.typeName?"En el programa ":"En la definici\u00f3n ";if("doExpr"==babel[b.DEBUG.pName]||"init"==babel[b.DEBUG.pName])h=" en la l\u00ednea "+(b.DEBUG.lineCount+1);a+=c+"\u300c"+b.DEBUG.idName+"\u300d, en el par\u00e1metro \u300c"+b.DEBUG.pName+"\u300d"+h+".";break;case "Graphic":a+="En el gr\u00e1fico #"+(b.DEBUG.elemIndex+1)+" de tipo \u300c"+b.DEBUG.idName+"\u300d, en el par\u00e1metro \u300c"+b.DEBUG.pName+"\u300d.";break;case "Animation":if("doExpr"==babel[b.DEBUG.pName]||"init"==
babel[b.DEBUG.pName])h=" en la l\u00ednea "+(b.DEBUG.lineCount+1);a+=". En la Animaci\u00f3n, en el par\u00e1metro \u300c"+b.DEBUG.pName+"\u300d"+h+"."}console.info(a)}};return b}(descartesJS||{});
descartesJS=function(b){function a(){c().forEach(function(a){b.apps.push(new b.DescartesApp(a));a.className="DescartesJS"})}function c(){return[].concat($jscomp.arrayFromIterable(document.querySelectorAll("applet,ajs"))).filter(function(a){return/Descartes|DescartesJS|DescartesWeb2_0/i.test(a.getAttribute("code"))})}function h(){document.querySelectorAll(".DescartesAppContainer").forEach(function(a){a.remove()})}function l(){var c,d;return $jscomp.asyncExecutePromiseGeneratorProgram(function(g){switch(g.nextAddress){case 1:return g.setCatchFinallyBlocks(2),
c=[],["descartesJS_serif","descartesJS_sansserif","descartesJS_monospace","DJS_symbol","DJS_math"].forEach(function(a){c.push(document.fonts.load("9px "+a));c.push(document.fonts.load("bold 9px "+a));c.push(document.fonts.load("italic 9px "+a));c.push(document.fonts.load("bold italic 9px "+a))}),g.yield(Promise.all(c),4);case 4:g.leaveTryBlock(3);break;case 2:return d=g.enterCatchBlock(),console.log(d),g.return();case 3:b.getFeatures(),b.hasCanvas?(window.scrollTo(0,100),h(),a(),window.addEventListener("resize",
b.onResize),window.scrollTo(0,0)):document.getElementById("StyleDescartesApps").innerHTML="applet.DescartesJS,applet,ajs.DescartesJS,ajs{display:block;}",g.jumpToEnd()}})}if(b.loadLib)return b;b.apps=[];b.getDescartesApps=function(){return b.apps};(function(){var a=document.getElementById("StyleDescartesApps");a&&a.remove();a=b.newHTML("style",{id:"StyleDescartesApps",type:"text/css",rel:"stylesheet"});a.innerHTML="applet.DescartesJS,applet,ajs.DescartesJS,ajs{display:none;}";document.head.appendChild(a)})();
b.onResize=function(){0<b.apps.length&&b.apps[0].scaleToFit()};var d={};b.onMessage=function(a){if(0<b.apps.length){var c=a.data;if(c)switch(c.type){case "set":"string"==typeof c.value||"number"==typeof c.value?b.apps[0].evaluator.setVariable(c.name,c.value):c.value&&void 0!=c.value.rows?b.apps[0].evaluator.matrices[c.name]=c.value:b.apps[0].evaluator.vectors[c.name]=c.value;break;case "update":b.apps[0].update();break;case "exec":(a=b.apps[0].evaluator.getFunction(c.name))&&a.apply(b.apps[0].evaluator,
c.value.toString().split(","));break;case "isResizeNeeded":a.source.postMessage({type:"doResize"},"*");break;case "doResize":0<b.apps.length&&b.apps[0].adjustSize();break;case "change_config":d[c.filename]?a=d[c.filename]:(a=b.newHTML("div"),a.innerHTML=c.content,a=a.getElementsByTagName("param"),d[c.filename]=a);b.apps[0].children=a;b.apps[0].init();break;case "change_content":a=b.newHTML("div"),a.innerHTML=c.content,a=a.getElementsByTagName("param"),b.apps[0].children=a,b.apps[0].init()}}};void 0==
b.loadLib&&(b.loadLib=!0,window.addEventListener("load",l),window.addEventListener("message",b.onMessage),["webkitTransitionEnd","transitionend","oTransitionEnd","MSTransitionEnd"].forEach(function(a){window.addEventListener(a,function(a){b.onResize(a)})}));return b}(descartesJS||{});
