/*
 Joel Espinosa Longi
 jlongi@im.unam.mx
 https://github.com/jlongi/DescartesJS
 LGPL - http://www.gnu.org/licenses/lgpl.html
 2025-09-04
*/
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 m=b[h];m in c||(c[m]={});c=c[m]}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 m?a:new m(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 m=function(a){this.state_=0;this.result_=void 0;this.onSettledCallbacks_=[];var b=this.createResolveAndReject_();try{a(b.resolve,b.reject)}catch(p){b.reject(p)}};m.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_)}};m.prototype.resolveTo_=function(a){if(a===this)this.reject_(new TypeError("A Promise cannot resolve to itself"));else if(a instanceof m)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)}};m.prototype.resolveToNonPromiseObj_=function(a){var b=void 0;try{b=a.then}catch(p){this.reject_(p);return}"function"==typeof b?
this.settleSameAsThenable_(b,a):this.fulfill_(a)};m.prototype.reject_=function(a){this.settle_(2,a)};m.prototype.fulfill_=function(a){this.settle_(1,a)};m.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_()};m.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;m.prototype.settleSameAsPromise_=function(a){var b=this.createResolveAndReject_();a.callWhenSettled_(b.resolve,b.reject)};m.prototype.settleSameAsThenable_=function(a,b){var d=this.createResolveAndReject_();try{a.call(b,d.resolve,d.reject)}catch(f){d.reject(f)}};m.prototype.then=function(a,b){function d(a,b){return"function"==typeof a?function(b){try{f(a(b))}catch(x){n(x)}}:b}var f,n,c=new m(function(a,b){f=a;n=b});this.callWhenSettled_(d(a,f),d(b,n));return c};
m.prototype.catch=function(a){return this.then(void 0,a)};m.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)};m.resolve=c;m.reject=function(a){return new m(function(b,d){d(a)})};m.race=function(a){return new m(function(b,d){for(var f=$jscomp.makeIterator(a),n=f.next();!n.done;n=f.next())c(n.value).callWhenSettled_(b,
d)})};m.all=function(a){var b=$jscomp.makeIterator(a),d=b.next();return d.done?c([]):new m(function(a,n){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),n),d=b.next();while(!d.done)})};return m},"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 m=h.value}catch(d){return this.context_.yieldAllIterator_=null,this.context_.throw_(d),this.nextStep_()}this.context_.yieldAllIterator_=null;c.call(this.context_,m);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,m){function d(b){b.done?h(b.value):Promise.resolve(b.value).then(a,c).then(d,m)}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 m=c.length,d=a.length;b=Math.max(0,Math.min(b|0,c.length));for(var l=0;l<d&&b<m;)if(c[b++]!=a[l++])return!1;return l>=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 m=a.length;0<m&&0<b;)if(c[--b]!=a[--m])return!1;return 0>=m}},"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 m in h)$jscomp.owns(h,m)&&(b[m]=h[m])}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,m=0;m<h;m++){var d=b[m];if(a.call(c,d,m,b))return{i:m,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 m=c.length;b=b||0;for(0>b&&(b=Math.max(b+m,0));b<m;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 m=this[h];Array.isArray(m)&&0<a?(m=Array.prototype.flat.call(m,a-1),b.push.apply(b,m)):b.push(m)}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="",m=$jscomp.makeIterator(["sansserif","monospace","serif","math"]),d=m.next();!d.done;d=m.next()){d=d.value;for(var l=$jscomp.makeIterator(b),g=l.next();!g.done;g=l.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,m={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 m[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,m=Math.floor,d,l,g,p;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(n){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)){p=a.substring(g);if(0==parseFloat(p))return a.substring(0,g);for(var b=p.length-1;0<b;b--)if("0"!==p.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=m(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;l=g.getBoundingClientRect();
return{x:(d.clientX-l.left)/b.cssScale,y:(d.clientY-l.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(m){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,"\\)");m=a.trim();a={ignoreAccents:!1,ignoreCaps:!1,regExp:null};/^'.*'$/.test(m)&&(a.ignoreCaps=!0,m=m.slice(1,-1),/^`.*\u00b4$/.test(m)&&(a.ignoreAccents=!0,m=m.slice(1,-1)));/^`.*\u00b4$/.test(m)&&(a.ignoreAccents=!0,m=m.slice(1,-1),/^'.*'$/.test(m)&&(a.ignoreCaps=!0,m=m.slice(1,-1)));m.startsWith("\\*")&&!m.endsWith("\\*")?m=m.substring(2)+"$":!m.startsWith("\\*")&&m.endsWith("\\*")?
m="^"+m.substring(0,m.length-2):m.startsWith("\\*")||m.endsWith("\\*")?m.startsWith("\\*")&&m.endsWith("\\*")&&(m=m.substring(2,m.length-2)):m="^"+m+"$";a.regExp=m.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 m,d,l,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 n=0,e=b.length;n<e;n++){d=b[n].split("&");l=[];for(var h=$jscomp.makeIterator(d),m=h.next();!m.done;m=h.next())m=m.value,g?l.push(a(m)):l.push(c(m,f));b[n]=l}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,m=e.regExp)e.ignoreAccents&&(b=h(b),m=h(m)),e.ignoreCaps&&(b=b.toLowerCase(),m=h(m).toLowerCase()),g=g&&!!b.match(m);else{var c;if(c=g){c=b;var n=d;c=parseFloat(c);var l=n.eval(e.min);n=n.eval(e.max);n=")"==e.type[1]?c<n:c<n||1E-9>Math.abs(n-c);c=("("==e.type[0]?l<c:l<c||1E-9>Math.abs(l-c))&&n}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,m,d,l,g,p,f,n,q,e,v,w,x,r,u,z,y,A,B=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]){m=[];d=b.splitComa(a.substring(1,
a.length-1));a=0;for(f=d.length;a<f;a++)p=d[a],l=parseInt(p,16),p!==l.toString(16)&&p!=="0"+l.toString(16)?("["===p.charAt(0)&&"]"===p.charAt(p.length-1)&&(p=p.substring(1,p.length-1)),m.push(this.evaluator.parser.parse(p))):m.push(this.evaluator.parser.parse((l/255).toString()));this.rExpr=m[0];this.gExpr=m[1];this.bExpr=m[2];this.aExpr=m[3];this.getColor=this.getColorExp}};B.prototype.getColorStr=function(){return this.colorStr};B.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+")"};B.prototype.getLinearGradient=function(){h=this.evaluator;z=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++)u=h.eval(this.stops[a].percentage),u=0>u?0:1<u?1:u,z.addColorStop(u,this.stops[a].color);return z};B.prototype.getPattern=function(){A=this.evaluator.parent;if(y=
A.getImage(this.evaluator.eval(this.img_src)))try{return b.ctx.createPattern(y,"repeat")}catch(D){}return"ff00ff"};B.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(",");v=parseInt(a[0]).toString(16).padStart(2,"0");w=parseInt(a[1]).toString(16).padStart(2,"0");x=parseInt(a[2]).toString(16).padStart(2,"0");r=(255-parseInt(255*parseFloat(a[3]))).toString(16).padStart(2,
"0");return new B(r+v+w+x)};b.splitComa=function(a){g=[];for(var b=q=n=f=0,d=a.length;b<d;b++)e=a[b],"("===e?f++:")"===e?f--:"["===e?n++:"]"===e?n--:","===e&&0===f&&0===n&&(g.push(a.substring(q,b)),q=b+1);g.push(a.substring(q));return g};b.Color=B;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 m,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(m)};var b=a.target.textContent.trim().toLowerCase();m=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(m),
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 l=!1;this.additionalKeys.addEventListener("pointerdown",function(a){l=!0});this.additionalKeys.addEventListener("pointerup",function(a){l&&(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");l=!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,m){return"<div "+(b?"id='"+b+"'":"")+" "+(m?"style='"+m+"'":"")+">"+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,l;b=$jscomp.makeIterator(b);for(d=b.next();!d.done;d=b.next()){var g=d.value;d={val:g.textContent};if(l=g.getAttribute("id"))d.id=l;if(l=g.getAttribute("size"))d.style=
"width:"+(40*parseInt(l)+5*(parseInt(l)-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,m,d,l,g,p){this.ctr=a;this.var_id=l;this.onlyText=p;this.container.parentNode||this.parent.container.appendChild(this.container);this.container.style.display="block";this.setDisplay(g);this.setLayout(b);this.keyContainer.style.left=m+"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 m=a.y;var d=a.w;var l=a.h;var g=a.fs}else m=this.container.getBoundingClientRect(),l=a.getBoundingClientRect(),c=l.left/b.cssScale-m.left/b.cssScale,m=l.top/b.cssScale-m.top/b.cssScale,d=l.width/b.cssScale,l=l.height/b.cssScale,g=a.style.fontSize;"textarea"==a.tagName.toLowerCase()?(this.display.setAttribute("style","left:"+c+"px;top:"+m+"px;width:"+d+"px;height:"+l+
"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=m+l-42+"px",this.newLine.style.display="block"):(this.display.setAttribute("style","left:"+c+"px;top:"+m+"px;width:"+d+"px;height:"+l+"px;font-size:"+g+";line-height:"+l+"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(l){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 m=this.var_id.indexOf(","),d=this.var_id.substring(0,b);-1==m?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(m+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,m=Math.round,d=Math.abs,l=String.fromCharCode,g,p,f,n,q,e,v,w,x,r,u=function(a){this.key=(void 0===a?0:a).toString()};u.prototype.getKey=function(b){g=[];for(var f=0;256>f;f++)g[f]=l(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("")};u.prototype.encode=function(a){p=c(31*h());this.key=this.getKey(p);return l(this.alfanum(p))+this.encripta(a)};u.prototype.decode=function(a){p=
this.numalfa(a.charCodeAt(0));this.key=this.getKey(p);return this.desencripta(a.substring(1))};u.prototype.encripta=function(a){return this.bytesToString(this.encriptaAux(this.stringToBytes(a)))};u.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++)x=256*c(a[b]+128)+m(255*h())+65536*m(255*h()),r=c((x<<this.shift(b))/256),e[3*b]=this.alfanum(r%32),e[3*b+1]=this.alfanum(r/32%32),e[3*b+2]=this.alfanum(r/1024%32);return e};u.prototype.desencripta=
function(a){return this.bytesToString(this.desencriptaAux(this.stringToBytes(a)))};u.prototype.desencriptaAux=function(a){if(null==a||null==this.key)return null;v=Array(a.length/3);for(var b=0,f=v.length;b<f;b++)r=this.numalfa(a[3*b])+32*this.numalfa(a[3*b+1])+1024*this.numalfa(a[3*b+2]),x=c(256*r>>this.shift(b)),w=c(x/256)%256-128,0>w&&(w+=256),v[b]=w;return v};u.prototype.alfanum=function(a){return(10>a?48:87)+c(a)};u.prototype.numalfa=function(a){return a-(58>a?48:87)};u.prototype.stringToBytes=
function(a){n=[];for(var b=0,f=a.length;b<f;b++)n.push(a.charCodeAt(b));return n};u.prototype.bytesToString=function(a){for(var b=0,f=a.length;b<f;b++)a[b]=l(a[b]);return a.join("")};u.prototype.shift=function(a){f=this.key.charCodeAt(a%this.key.length);n=this.numalfa(f);q=c(n/2%8);0==q&&(q=4);return q};u.prototype.parseByte=function(a){a=parseInt(a);a=0>a?0:a;return 255<a?255:a};b.Krypto=u;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c=function(a,c){var d=this;d.parent=a;var l=a.evaluator;a=l.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())l.eval(c.value);d.parent.update();d.playing&&(0<l.eval(d.whileExpr)||d.loop)?d.timer=b.setTimeout(d.animExec,l.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(l){}}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,m=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)};m.prototype.firstRun=function(){};m.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=m;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,m=b.newHTML("div"),d=b.newHTML("label");d.appendChild(document.createTextNode("___"+a.id+"=___"));
var l=b.newHTML("input");l.value=a.expresionString;l.disabled=!a.editable;m.appendChild(d);m.appendChild(l);l.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:m,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,m,d,l=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(l,b.Auxiliary);l.prototype.update=function(){var g=this;a=this;var l=a.expresion,f;c=a.evaluator;h=c.parser;a.oldFile=a.file;if(m=c.eval(a.parseFile))a.file=m;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")):(l=d,a.size=null),null===a.size&&(a.size=h.parse(l.length+"")));var n,q;l=l.map(function(b,f){(q=h.parse(b,!0))&&"assign"!==q.type&&(n=NaN,","==g.parent.decimal_symbol&&(n=parseFloat(b.replace(",","."))),q=h.parse(a.id+"["+f+"]="+(isNaN(n)?b:n),!0));return q});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_);l=$jscomp.makeIterator(l);for(f=l.next();!f.done;f=l.next())c.eval(f.value)};b.Vector=l;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,m,d,l,g,p=/'[^']*'|"[^"]*"|[^,']+/g,f=/'[^']*'|"[^"]*"|[^;']+/g,n=function(n,e){a=e=b.Auxiliary.call(this,n,e)||this;c=n.evaluator;h=c.parser;a.rows=a.rows||h.parse("3");a.columns=a.columns||h.parse("3");if(a.file){var q=document.getElementById(a.file);g=q&&"descartes/matrixFile"==q.type?q.text:b.openFile(a.file);var w,x;null!=g&&(d=0,m=null,g=g.replace(/\r/g,"").split("\n"),a.expresion=[],g.forEach(function(b){b&&(w="."==n.decimal_symbol?b.trim().match(p)||
[]:b.trim().match(f)||[],null==m&&(m=w.length),w.forEach(function(b,f){b=b.trim();x="."==n.decimal_symbol?parseFloat(b):parseFloat(b.replace(",","."));isNaN(x)&&!/^'.*'$/.test(b)?(x=b.replace(/^"(.*)"$/,"$1"),x="'"+x+"'"):(","==n.decimal_symbol&&(b=b.replace(",",".")),x=b);a.expresion.push(h.parse(a.id+"["+d+","+f+"]:="+x))}),d++)}),a.rows=h.parse(m+""),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),m=c.eval(a.rows),d=c.eval(a.columns);l=[];l.type="matrix";q=0;for(var r=d;q<r;q++)l[q]=Array(m).fill(0);c.matrices[a.id]=l;a.update();return e};$jscomp.inherits(n,b.Auxiliary);n.prototype.update=function(){a=this;c=a.evaluator;l=c.matrices[a.id];l.rows=c.eval(a.rows);l.cols=c.eval(a.columns);c.setVariable(a.id+".filas",l.rows);c.setVariable(a.id+".columnas",l.cols);for(var b=$jscomp.makeIterator(a.expresion),f=b.next();!f.done;f=b.next())c.eval(f.value)};b.Matrix=n;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 l;c.functionExec=function(){var a=arguments,h=0;if(c.numParams<=
arguments.length){for(var f=[],n=$jscomp.makeIterator(c.privateVars),q=n.next();!q.done;q=n.next())q=q.value,f.push(d.getVariable(q)),d.setVariable(q,0);var e=[];c.params.forEach(function(b,f){e.push(d.getVariable(b));d.setVariable(b,a[f])});n=$jscomp.makeIterator(c.init);for(q=n.next();!q.done;q=n.next())d.eval(q.value);l=d.getVariable("_NUM_MAX_ITE_ALG_")||1E5;do{n=$jscomp.makeIterator(c.doExpr);for(q=n.next();!q.done;q=n.next())d.eval(q.value);if(++h>l)return console.warn("se ha excedido el l\u00edmite de "+
l+" 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),l=d.next();!l.done;l=d.next())c.eval(l.value);do{d=$jscomp.makeIterator(this.doExpr);for(l=d.next();!l.done;l=d.next())c.eval(l.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,m,d,l,g,p,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);p=Math.sin(f);return{x:a*g-b*p,y:a*p+b*g}};f.prototype.dashStyle=function(){l=this.ctx;l.lineCap="butt";switch(this.lineDash){case "dot":l.setLineDash([l.lineWidth,l.lineWidth]);break;case "dash":l.setLineDash([4*l.lineWidth,3*l.lineWidth]);break;
case "dash_dot":l.setLineDash([4*l.lineWidth,2*l.lineWidth,l.lineWidth,2*l.lineWidth]);break;default:l.lineCap="round",l.setLineDash([])}};f.prototype.drawText=function(a,b,f,g,l,h,p,u,z,y,A){a.textNode=b;if("rtfNode"===b.type)a.fillStyle=a.strokeStyle=l.getColor(),a.textBaseline="alphabetic",a.textNode.pos={x:f,y:g},b.update(a,f,g,z,y,p,A,l.getColor());else for("simpleText"===b.type&&(b=b.toString(z,y).split("\\n")),c=this.evaluator,a.fillStyle=l.getColor(),a.font=h,a.textAlign=p,a.textBaseline=
u,d=1.2*this.fontSize||0,l=0,h=b.length;l<h;l++)m=b[l],this.border&&(a.strokeStyle=this.border.getColor(),a.lineWidth=4,a.lineJoin="round",a.miterLimit=2,a.strokeText(m,f,g+d*l)),a.fillText(m,f,g+d*l)};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,m=/[\w\.\-//]*(\.png|\.jpg|\.gif|\.svg|\.webp)/gi,d=function(d,
g,p,f){var n;h=n=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 n;"'"!==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 q=(q=document.getElementById(g))&&"descartes/macro"===q.type?q.text:b.openFile(g);if(q){g=b.convertHTMLEntities(q).replace(/\r/g,"").split("\n");q=[];d=d.lessonParser;
var e=new b.Tokenizer,l;g=$jscomp.makeIterator(g);for(l=g.next();!l.done;l=g.next())if(l=l.value,l.includes("=")){l=d.split(l);for(var w=$jscomp.makeIterator(l),x=w.next();!x.done;x=w.next())if((x=x.value)&&1<l.length&&("id"===babel[x[0]]||"type"===babel[x[0]])){q.push(l);break}}x=0;for(var r=q.length;x<r;x++){l=(g=q[x]||[],g[0])&&"id"===g[0][0];w=!1;for(var u=0,z=g.length;u<z;u++){var y=g[u][0];var A=g[u][1];var B=y.indexOf(".");-1===B||l?B=babel[y]:(B=babel[y.substring(B+1)],g[u][0]=h.name+"."+
y);"type"===B&&"surface"===babel[A]&&(w=!0);if(p.includes("3D")){if(("font"===B||"font_family"===B||("fill"===B||"color"===B||"backcolor"===B||"arrow"===B)&&"("!==g[u][1].charAt(0)||"file"===B&&g[u][1].match(m)||"id"!==B&&void 0!==babel[g[u][1]])&&"width"!==B&&"height"!==B&&"length"!==B)continue}else if(("font"===B||"font_family"===B||("fill"===B||"color"===B||"border"===B||"arrow"===B)&&"("!==g[u][1].charAt(0)||"file"===B&&g[u][1].match(m)||"id"!==B&&void 0!==babel[g[u][1]])&&"radius"!==B)continue;
if(w&&"expresion"===B){for(var D=g[u][1].split(" "),I="",E=0,G=D.length;E<G;E++){for(var H=D[E].replace(/&squot;/g,"'").split(";"),C=0,J=H.length;C<J;C++)y=a(H[C].replace(/\\n/g,";"),h.name,p.includes("3D")?"-x-y-z-u-v-":""),H[C]=e.flatTokens(y);I+=H.join(";")+" "}g[u][1]=I}if("text"===B)if(/\{\\rtf1/.test(A))A=A.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{A=d.parseText(A).txtEleMacros;B=0;for(D=A.length;B<D;B++)y=e.tokenize(A[B].replace(/&squot;/g,"'")),y=a(y,h.name),A[B]=e.flatTokens(y).replace(/&squot;/g,"'").replace(/'\+\(/g,"[").replace(/\)\+'/g,"]"),A[B]=A[B].slice(1,-1);A=A.join("")}else{A=A.replace(/&squot;/g,"'").split(";");B=0;for(D=A.length;B<D;B++)y=e.tokenize(A[B].replace(/\\n/g,";")),y=a(y,h.name,p.includes("3D")?"-Euler-":""),A[B]=e.flatTokens(y);A=A.join(";")}g[u][1]=A}}w=0;for(x=q.length;w<x;w++)if(q[w][0]){g=
"";l=!1;r=0;for(u=q[w].length;r<u;r++)"type"===babel[q[w][r][0]]&&f.includes("-"+babel[q[w][r][1]]+"-")&&(l=!0),g+=q[w][r][0]+"='"+q[w][r][1]+"' ";q[w]=g+(l?" space='"+h.spaceID+"'":"");l?h.graphics.push(d[p](q[w],h.abs_coord,h.background,h.inirot)):d.parseAuxiliar(q[w])}}return n};$jscomp.inherits(d,b.Graphic);b.BaseMacro=d;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,m,d,l,g,p=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="'";m=h=0;for(d=-1;h<c.length;)l=c.charAt(h),g=c.charAt(h-1),"["===l&&"\\"===g?(this.txtEle.push(c.substring(m,h-1)+"["),this.txtEleMacros.push("'"+c.substring(m,h-1)+"['"),m=h+1):"]"===l&&"\\"===g?(this.txtEle.push(c.substring(m,h-1)+"]"),this.txtEleMacros.push("'"+
c.substring(m,h-1)+"]'"),m=h+1):"["===l&&-1===d?(this.txtEle.push(c.substring(m,h)),this.txtEleMacros.push("'"+c.substring(m,h)+"'"),m=h,d++):"["===l?d++:"]"===l&&0===d?(this.txtEle.push(this.evaluator.parser.parse(c.substring(m,h+1))),this.txtEleMacros.push("["+c.substring(m,h+1)+"]"),m=h+1,d--):("]"==c.charAt(h)&&(d=0>d?d:d-1),a+=c.charAt(h)),h++;this.txtEle.push(c.substring(m,h));this.txtEleMacros.push("'"+c.substring(m,h)+"'")};p.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=p;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,m,d,l,g,p,f,n,q,e,v,w,x,r,u,z,y,A,B,D,I,E,G,H,C,J,P,R,L,Q,O,F,M=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;v=new b.R2;w=new b.R2;x=new b.R2;u=new b.R2;c.cInd=0;return c};$jscomp.inherits(M,b.Graphic);M.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)};M.prototype.update=function(){};M.prototype.draw=function(){""!=this.family?this.drawFamilyAux(this.ctx,this.fill,this.color):(this.update(),this.drawAux(this.ctx,this.fill,this.color))};M.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)};M.prototype.drawTrace=function(){b.Graphic.prototype.drawTrace.call(this,this.fill,this.trace)};M.prototype.drawAux=function(c,N,M){if(!(0>=this.evaluator.eval(this.drawif))){this.cInd=0;h=this.evaluator;m=this.space;d=h.eval(this.width);c.strokeStyle=this.color.getColor();c.lineWidth=d;l=h.getVariable("x");g=h.getVariable("y");p=m.w+24;f=m.h+24;n=p/9;3>n&&(n=3);q=f/7;3>q&&(q=3);0==this.cInd?(a=[],this.cInd++):this.cInd=(this.cInd+1)%
1E7;e.set(0,0);v.set(0,0);w.set(0,0);O=.25;F=8;this.abs_coord||(O/=m.scale,F/=m.scale);c.beginPath();for(C=parseInt(q/2);C<f;C+=q)for(H=parseInt(n/2);H<p;H+=n){if(this.abs_coord){u.set(H,C);r=this.newt.findZero(u,O);if(null==r)continue;h.setVariable("x",r.x);h.setVariable("y",r.y);x.set(r.x,r.y)}else{u.set(m.getRelativeX(H),m.getRelativeY(C));r=this.newt.findZero(u,O);if(null==r)continue;h.setVariable("x",r.x);h.setVariable("y",r.y);x.set(m.getAbsoluteX(r.x),m.getAbsoluteY(r.y))}z=x.ix();y=x.iy();
if(-12<=z&&z<p+24&&-12<=y&&y<f+24){if(a[z+12+(y+12)*m.w]===this.cInd)continue;a[z+12+(y+12)*m.w]=this.cInd}b.rangeOK&&(c.moveTo(z,y),c.lineTo(z,y));e.x=r.x;e.y=r.y;v.x=r.x;v.y=r.y;A=this.newt.getUnitNormal();if(0!=A.x||0!=A.y)for(A.rotL90(),w.x=A.x,w.y=A.y,D=B=0,I=!1;2>D;)if(I&&(w.x=-A.x,w.y=-A.y,r.x=e.x,r.y=e.y,v.x=r.x,v.y=r.y,this.abs_coord?x.set(r.x,r.y):x.set(m.getAbsoluteX(r.x),m.getAbsoluteY(r.y)),z=x.ix(),y=x.iy(),I=!1,B=0),r.x+=F*w.x,r.y+=F*w.y,r=this.newt.findZero(r,O),null!=r){h.setVariable("x",
r.x);h.setVariable("y",r.y);w.x=r.x-v.x;w.y=r.y-v.y;w.normalize();if(0==w.x&&0==w.y)break;v.x=r.x;v.y=r.y;this.abs_coord?x.set(r.x,r.y):x.set(m.getAbsoluteX(r.x),m.getAbsoluteY(r.y));E=parseInt(x.ix());G=parseInt(x.iy());if(E!=z||G!=y)if(J=z,P=y,z=E,y=G,-12<=z&&z<p+24&&-12<=y&&y<f+24){B=0;R=a[z+12+(y+12)*m.w];a[z+12+(y+12)*m.w]=this.cInd;for(N=1;8>N;N++)L=J+Math.round((z-J)*N/8),Q=P+Math.round((y-P)*N/8),0<=L&&L<p&&0<=Q&&Q<f&&(a[L+12+(Q+12)*m.w]=this.cInd);b.rangeOK&&(c.moveTo(J,P),c.lineTo(z,y));
if(R===this.cInd)break}else I=!0,D++;else 4<++B&&(I=!0,D++)}}c.stroke();h.setVariable("x",l);h.setVariable("y",g)}};M.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};M.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};M.prototype.XX=function(a,b,c){return Math.round(this.X(a,b,c))};M.prototype.YY=function(a,b,c){return Math.round(this.Y(a,
b,c))};M.prototype.extrapolate=function(a,c,f,d,g,e){h=this.evaluator;for(var n=h.getVariable(c),q=e/2,l=0,m,r,p,B,v,w;1E-15<Math.abs(q);){m=h.getVariable(c);r=h.getVariable(c)+q;h.setVariable(c,r);p=!0;try{B=g,g=h.eval(this.funExpr),h.setVariable(f,g),0<h.eval(a)?(v=new b.R2(Math.min(B,g),Math.max(B,g)),w=0,w=0<e?this.Singularity(Math.abs(q),c,d,m,B,r,g,v):this.Singularity(Math.abs(q),c,d,r,g,m,B,v),0<w&&(p=!1)):p=!1}catch(ea){p=!1}p?l+=q:h.setVariable(c,m);q/=2}h.setVariable(c,n);return new b.R2(l/
Math.abs(e),g)};M.prototype.extrapolateOnSingularity=function(a,c,f,d,g,e){h=this.evaluator;d=h.getVariable(c);for(var n=e/2,q=0,l=g,m;1E-15<Math.abs(n);){h.setVariable(c,h.getVariable(c)+n);m=!0;if(0<h.eval(a))try{l=h.eval(this.funExpr),h.setVariable(f,l),0>=h.eval(a)&&(m=!1)}catch(Y){m=!1}else m=!1;m?q+=n:h.setVariable(c,h.getVariable(c)-n);n/=2}if(0==q)for(n=e/2,q=e,l=g;1E-15<Math.abs(n);){h.setVariable(c,h.getVariable(c)-n);f=!0;if(0<h.eval(a))try{l=h.eval(this.funExpr)}catch(Y){f=!1}else f=!1;
f?q+=-n:h.setVariable(c,h.getVariable(c)+n);n/=2}h.setVariable(c,d);return new b.R2(q/Math.abs(e),l)};M.prototype.Singularity=function(a,b,c,f,d,g,e,n){h=this.evaluator;if(isNaN(e)||isNaN(d)||isNaN(n.y)||isNaN(n.x)||f>=g)return 2;var q=h.getVariable(b),l=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,q),1;var m=(f+g)/2;h.setVariable(b,m);var p=NaN;try{p=h.eval(this.funExpr)}catch(ca){return 2}if(isNaN(p))return 5;if(Math.abs(e-d)>a){h.setVariable(b,
f-1E-12);var r=h.eval(this.funExpr);r=(d-r)/1E-12;h.setVariable(b,g+1E-12);var B=(h.eval(this.funExpr)-e)/1E-12;if((10>Math.abs(B)||10>Math.abs(r))&&(0<=B&&0<=r||0>=B&&0>=r)&&4*Math.abs(B)<Math.abs((e-d)/(g-f)))return h.setVariable(b,q),2}if(isNaN(n.x)||isNaN(n.y)||isNaN(p))return 2;if(!(n.x<=p&&p<=n.y)){h.setVariable(b,m);n.x=Math.min(d,p);n.y=Math.max(d,p);var v=this.Singularity(a/2,b,c,f,d,m,p,n);h.setVariable(b,g);n.x=Math.min(e,p);n.y=Math.max(e,p);var w=this.Singularity(a/2,b,c,m,p,g,e,n);l=
Math.max(v,w)}}catch(ca){l=1}h.setVariable(b,q);return l};M.prototype.drawAuxFun=function(a,c,f){h=this.evaluator;l=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,n=h.eval(this.width),q=!1,m=new b.R2(this.space.w/2+this.space.Ox,this.space.h/2+this.space.Oy),p=this.of_y?m.ix():m.iy(),r=0,B=0,v=0,w=0,x=1/this.space.scale;m=x*(this.of_y?-this.space.h+m.y:-m.x);var u=0;this.abs_coord&&(m=0,x=1);for(var D,y,G,z,A,C,H,O,E,Q=this.of_y?this.space.h+
2:this.space.w+2;v<=Q;){D=!0;y=0;h.setVariable(c,m);try{G=h.eval(this.funExpr),isNaN(G)||(h.setVariable(d,G),0<h.eval(this.drawif)&&b.rangeOK?(q?(z=Math.min(u,G),A=Math.max(u,G),C=new b.R2(z,A),y=this.Singularity(x,c,0,m-x,u,m,G,C),0===y?(u<=G?(u=C.x,G=C.y):(G=C.x,u=C.y),H=parseInt(this.of_y?this.XX(n,u,this.abs_coord):this.YY(n,u,this.abs_coord)),r=this.abs_coord?Math.round(G):parseInt(this.of_y?this.XX(n,G,this.abs_coord):this.YY(n,G,this.abs_coord)),this.fillM&&r>p&&(a.lineWidth=1,a.strokeStyle=
this.fillM.getColor(),a.beginPath(),this.of_y?(a.moveTo(p+1,this.space.h-v+.5),a.lineTo(r,this.space.h-v+.5)):(a.moveTo(v+.5,p+1),a.lineTo(v+.5,r)),a.stroke()),this.fillP&&r<p&&(a.lineWidth=1,a.strokeStyle=this.fillP.getColor(),a.beginPath(),this.of_y?(a.moveTo(p-1,this.space.h-v+.5),a.lineTo(r,this.space.h-v+.5)):(a.moveTo(v+.5,p-1),a.lineTo(v+.5,r)),a.stroke()),a.lineWidth=n,a.strokeStyle=f.getColor(),a.beginPath(),this.of_y?(a.moveTo(H+.5,this.space.h-w),a.lineTo(r+.5,this.space.h-v)):(a.moveTo(w+
.5,H),a.lineTo(v+.5,r)),a.stroke()):1===y?(h.setVariable(c,m-x),O=this.extrapolate(e,c,d,0,u,x),r=this.of_y?this.XX(n,O.y,this.abs_coord):this.YY(n,O.y,this.abs_coord),a.lineWidth=n,a.strokeStyle=f.getColor(),a.beginPath(),this.of_y?(a.moveTo(B+.5,this.space.h-w),a.lineTo(r+.5,this.space.h-w+Math.round(O.x))):(a.moveTo(w+.5,B),a.lineTo(w+Math.round(O.x)+.5,r)),h.setVariable(c,m),E=this.extrapolate(e,c,d,0,G,-x),B=this.of_y?this.XX(n,E.y,this.abs_coord):this.YY(n,E.y,this.abs_coord),r=this.of_y?this.XX(n,
G,this.abs_coord):this.YY(n,G,this.abs_coord),a.lineWidth=n,a.strokeStyle=f.getColor(),a.beginPath(),this.of_y?(a.moveTo(B+.5,this.space.h-v),a.lineTo(r+.5,this.space.h-v)):(a.moveTo(v+.5,B),a.lineTo(v+.5,r)),a.stroke()):2===y&&(r=this.of_y?this.XX(n,G,this.abs_coord):this.YY(n,G,this.abs_coord),a.lineWidth=n,a.strokeStyle=f.getColor(),a.beginPath(),this.of_y?(a.moveTo(B+.5,this.space.h-v),a.lineTo(r+.5,this.space.h-v)):(a.moveTo(v+.5,B),a.lineTo(v+.5,r)))):(E=this.extrapolateOnSingularity(e,c,d,
0,G,-x),B=this.of_y?this.XX(n,E.y,this.abs_coord):this.YY(n,E.y,this.abs_coord),r=this.of_y?this.XX(n,G,this.abs_coord):this.YY(n,G,this.abs_coord),a.lineWidth=n,a.strokeStyle=f.getColor(),a.beginPath(),this.of_y?(a.moveTo(B,this.space.h-(v+Math.round(E.x))+.5),a.lineTo(r,this.space.h-v+.5)):(a.moveTo(v+Math.round(E.x),B),a.lineTo(v,r)),a.stroke()),u=G):D=!1)}catch(fa){D=!1}q&&!D&&(h.setVariable(c,m-x),h.setVariable(d,u),O=this.extrapolate(e,c,d,0,u,x),r=parseInt(this.of_y?this.XX(n,O.y,this.abs_coord):
this.YY(n,O.y,this.abs_coord)),0<h.eval(this.drawif)&&b.rangeOK&&(a.lineWidth=n,a.strokeStyle=f.getColor(),a.beginPath(),this.of_y?(a.moveTo(B,this.space.h-(w+Math.round(O.x))+.5),a.lineTo(r,this.space.h-(w+Math.round(O.x))+.5)):(a.moveTo(w+Math.round(O.x)+.5,B),a.lineTo(w+Math.round(O.x)+.5,r)),a.stroke()),h.setVariable(c,m));q=D;m+=x;B=r;w=v++}h.setVariable("x",l);h.setVariable("y",g)};M.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=M;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=Math.round,c,h,m,d,l,g,p=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(p,b.Graphic);p.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};p.prototype.draw=function(){b.Graphic.prototype.draw.call(this,this.fill,this.color)};p.prototype.drawTrace=function(){b.Graphic.prototype.drawTrace.call(this,this.fill,this.trace)};p.prototype.drawAux=function(f,n,q){c=this.evaluator;
h=this.space;f.lineWidth=Math.max(1E-6,a(c.eval(this.width)));f.lineCap=f.lineJoin="round";f.strokeStyle=q.getColor();m=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&&(l=b.degToRad(c.eval(this.rotateExp)),g=this.rotate(d[0],d[1],l),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(q=1;q<=this.pSteps;q++)c.setVariable(this.param,this.paraInf+q*this.paraSep),d=c.eval(this.expresion)[0],this.rotateExp&&(g=this.rotate(d[0],d[1],l),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=n.getColor(),f.fill("evenodd"));this.dashStyle();f.stroke();f.setLineDash([]);
c.setVariable(this.param,m)};p.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=p;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=2*Math.PI,c=Math.round,h,m,d,l,g,p,f,n,q,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);p=h.eval(this.range)[0];this.rangeInf=p[0];this.rangeMax=p[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;m=this.space;n=f=Math.ceil(h.eval(this.size)-.4);d.fillStyle=e.getColor();d.beginPath();
this.rangeInf>this.rangeMax&&(q=this.rangeInf,this.rangeInf=this.rangeMax,this.rangeMax=q);e=h.getVariable("n");for(var p=this.rangeInf,r=this.rangeMax;p<=r;p++){h.setVariable("n",p);var v=$jscomp.makeIterator(h.eval(this.expresion)[0]);this.X=v.next().value;this.Y=v.next().value;l=c(this.abs_coord?this.X:m.getAbsoluteX(this.X));g=c(this.abs_coord?this.Y:m.getAbsoluteY(this.Y));d.beginPath();d.arc(l,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,l+n,g-n,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,m,d,l,g,p,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){m=this.space;b.fillStyle=f.getColor();l=c(this.abs_coord?this.X:m.getAbsoluteX(this.X));g=c(this.abs_coord?this.Y:m.getAbsoluteY(this.Y));p=c(this.evaluator.eval(this.size));0<p&&(b.beginPath(),b.arc(l,g,p,0,a),b.fill());this.text.hasContent&&this.text.draw(b,f,l,g)};b.Point=f;return b}(descartesJS||
{});
descartesJS=function(b){if(b.loadLib)return b;var a=Math.round,c=2*Math.PI,h,m,d,l,g,p,f,n,q,e,v,w=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(w,b.Graphic);w.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(l=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,l)};w.prototype.draw=function(){b.Graphic.prototype.draw.call(this,this.color,this.color)};w.prototype.drawTrace=function(){b.Graphic.prototype.drawTrace.call(this,this.trace,this.trace)};w.prototype.drawAux=function(b,d,l){h=this.evaluator;m=this.space;v=a(h.eval(this.width));b.lineWidth=Math.max(1E-6,v);g=h.eval(this.size);b.fillStyle=d.getColor();b.strokeStyle=l.getColor();b.lineCap="round";p=0==b.lineWidth%
2?0:.5;this.abs_coord?(f=a(this.points[0].x),n=a(this.points[0].y),q=a(this.points[1].x),e=a(this.points[1].y)):(f=a(m.getAbsoluteX(this.points[0].x)),n=a(m.getAbsoluteY(this.points[0].y)),q=a(m.getAbsoluteX(this.points[1].x)),e=a(m.getAbsoluteY(this.points[1].y)));b.beginPath();b.moveTo(f+p,n+p);b.lineTo(q+p,e+p);this.dashStyle();b.stroke();0<g&&(b.beginPath(),b.arc(f,n,g,0,c),b.arc(q,e,g,0,c),b.fill());b.setLineDash([]);this.text.hasContent&&this.text.draw(b,l,parseInt((f+q)/2)-3,parseInt((n+e)/
2)+3)};b.Segment=w;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=Math.floor,c=Math.round,h,m,d,l,g,p,f,n,q,e,v,w,x,r=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(r,b.Graphic);r.prototype.update=function(){h=this.evaluator;m=h.eval(this.expresion);
for(var a=0,c=m.length;a<c;a++)this.points[a]={x:m[a][0],y:m[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)};r.prototype.draw=function(){b.Graphic.prototype.draw.call(this,this.arrow,this.color)};r.prototype.drawTrace=function(){b.Graphic.prototype.drawTrace.call(this,this.arrow,this.trace)};r.prototype.drawAux=function(b,d,r){h=this.evaluator;l=this.space;m=this.points;g=Math.max(0,
h.eval(this.width));p=Math.ceil(g/2);f=l.scale;this.V.x=m[1].x-m[0].x;this.V.y=m[1].y-m[0].y;n=this.V.vLength();this.angle=Math.atan2(this.V.y,this.V.x);b.fillStyle=d.getColor();b.strokeStyle=r.getColor();b.lineWidth=2;this.abs_coord?(q=c(m[0].x),e=c(m[0].y),v=c(m[1].x),w=c(m[1].y)):(q=c(l.getAbsoluteX(m[0].x)),e=c(l.getAbsoluteY(m[0].y)),v=c(l.getAbsoluteX(m[1].x)),w=c(l.getAbsoluteY(m[1].y)));x=Math.max(0,h.eval(this.spear));b.save();b.translate(q,e);this.abs_coord?b.rotate(this.angle):(n*=f,b.rotate(-this.angle));
b.beginPath();b.moveTo(-p,a(-p));b.lineTo(a(n-x-g),a(-p));b.lineTo(a(n-2*x),a(-x-p));b.lineTo(a(n),0);b.lineTo(a(n-2*x),a(x+p));b.lineTo(a(n-x-g),a(p));b.lineTo(-p,a(p));b.closePath();b.stroke();b.fill();b.restore();this.text.hasContent&&this.text.draw(b,r,parseInt((q+v)/2)-3,parseInt((e+w)/2)+3)};b.Arrow=r;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=Math.round,c,h,m,d,l,g,p,f,n=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(n,b.Graphic);n.prototype.update=function(){c=this.evaluator;m=c.eval(this.expresion);for(var a=0,f=m.length;a<f;a++)this.points[a]={x:m[a][0],y:m[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)};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.trace,this.trace)};n.prototype.drawAux=function(b,d,n){c=this.evaluator;h=this.space;l=a(c.eval(this.width));b.lineWidth=Math.max(1E-6,l);b.strokeStyle=n.getColor();b.lineCap=b.lineJoin="round";g=0<l?.5:0;p=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(p+g,f+g);n=1;for(var e=this.points.length;n<e;n++)p=a(this.abs_coord?this.points[n].x:h.getAbsoluteX(this.points[n].x)),f=a(this.abs_coord?this.points[n].y:h.getAbsoluteY(this.points[n].y)),b.lineTo(p+g,f+g);this.fill&&(b.fillStyle=d.getColor(),b.fill());this.dashStyle();b.stroke();b.setLineDash([])};b.Polygon=n;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=Math.round,c=Math.min,h=Math.max,m=Math.abs,d,l,g,p,f,n,q,e,v,w,x,r,u=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(u,b.Graphic);u.prototype.update=function(){d=this.evaluator;n=d.eval(this.expresion);this.X=n[0][0];this.Y=n[0][1];this.w=150;this.h=100;this.rotateExp&&(g=this.rotate(n[0][0],n[0][1],
b.degToRad(d.eval(this.rotateExp))),this.X=g.x,this.Y=g.y);4<=n[0].length&&(this.w=n[0][2],this.h=n[0][3]);n[1]&&2==n[1].length&&(this.w=n[1][0],this.h=n[1][1]);this.w=h(0,this.w);this.h=h(0,this.h)};u.prototype.draw=function(){b.Graphic.prototype.draw.call(this,this.fill,this.color)};u.prototype.drawTrace=function(){b.Graphic.prototype.drawTrace.call(this,this.fill,this.trace,"trace")};u.prototype.drawAux=function(b,g,n,B){d=this.evaluator;l=this.space;p=a(d.eval(this.width));b.lineWidth=h(1E-6,
p);b.strokeStyle=n.getColor();b.lineCap="round";b.lineJoin="miter";f=0<p?.5:0;q=a(this.abs_coord?this.X:l.getAbsoluteX(this.X))+f;e=a(this.abs_coord?this.Y:l.getAbsoluteY(this.Y))+f;v=this.abs_coord?this.w:this.w*l.scale;w=this.abs_coord?this.h:-this.h*l.scale;x=c(h(0,d.eval(this.border_radius)),.5*m(v),.5*m(w));r=this.abs_coord?1:-1;b.beginPath();0==x?(b.moveTo(q,e),b.lineTo(q+v,e),b.lineTo(q+v,e+w),b.lineTo(q,e+w)):(b.moveTo(q+x,e),b.lineTo(q+v-x,e),b.arcTo(q+v,e,q+v,e+r*x,x),b.lineTo(q+v,e+w-r*
x),b.arcTo(q+v,e+w,q+v-x,e+w,x),b.lineTo(q+x,e+w),b.arcTo(q,e+w,q,e+w-r*x,x),b.lineTo(q,e+r*x),b.arcTo(q,e,q+x,e,x));b.closePath();this.fill&&(b.fillStyle=g.getColor(),b.fill());this.dashStyle();b.stroke();b.setLineDash([])};b.Rectangle=u;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=Math.PI,c=a/2,h=2*a,m=Math.round,d=Math.min,l=Math.max,g=Math.acos,p=Math.sqrt,f,n,q,e,v,w,x,r,u,z,y,A,B,D,I,E,G,H,C=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(C,b.Graphic);C.prototype.update=function(){f=this.evaluator;var m=$jscomp.makeIterator(f.eval(this.center)[0]);this.X=m.next().value;this.Y=m.next().value;n=0;this.rotateExp&&(n=b.degToRad(f.eval(this.rotateExp)),q=Math.cos(n),e=Math.sin(n),v=this.X*q-this.Y*e,w=this.X*e+this.Y*q,this.X=v,this.Y=w);var G=f.eval(this.initExpr);
m=f.eval(this.endExpr);/^(\(|\[).*(\)|\])$/i.test(this.initExpr.type)&&/^(\(|\[).*(\)|\])$/i.test(this.endExpr.type)?(G=$jscomp.makeIterator(G[0]),x=G.next().value,r=G.next().value,m=$jscomp.makeIterator(m[0]),u=m.next().value,z=m.next().value,this.vectors?this.abs_coord&&(r=-r,z=-z):(x-=this.X,r=-r+this.Y,u-=this.X,z=-z+this.Y,this.abs_coord||(r=-r,z=-z)),y=0==x?0>r?3*c:c:g(1*x/p(x*x+r*r)),A=0==u?0>z?3*c:c:g(1*u/p(u*u+z*z)),y+=n,A+=n,0<x&&0<r&&this.abs_coord&&(y=h-y),0<x&&0>r&&!this.abs_coord&&(y=
h-y),0>x&&0>r&&!this.abs_coord&&(y=h-y),0>x&&0<r&&this.abs_coord&&(y=h-y),0<u&&0<z&&this.abs_coord&&(A=h-A),0<u&&0>z&&!this.abs_coord&&(A=h-A),0>u&&0>z&&!this.abs_coord&&(A=h-A),0>u&&0<z&&this.abs_coord&&(A=h-A),this.iFlag?(B=y,y=A,A=B):(B=d(y,A),D=l(y,A),y=B,A=D,A-y>a&&this.abs_coord&&(y=D,A=B),A-y<=a&&!this.abs_coord&&(y=D,A=B)),this.iniAng=y,this.endAng=A,this.drawPoints=!0):(this.iniAng=b.degToRad(G)+n,this.endAng=b.degToRad(m)+n,this.drawAngle=!0)};C.prototype.draw=function(){b.Graphic.prototype.draw.call(this,
this.fill,this.color)};C.prototype.drawTrace=function(){b.Graphic.prototype.drawTrace.call(this,this.fill,this.trace)};C.prototype.drawAux=function(a,b,c){f=this.evaluator;I=this.space;H=Math.max(0,f.eval(this.radius));a.lineWidth=Math.max(1E-6,m(f.eval(this.width)));a.lineCap="round";a.strokeStyle=c.getColor();this.abs_coord?(E=m(this.X),G=m(this.Y)):(E=m(I.getAbsoluteX(this.X)),G=m(I.getAbsoluteY(this.Y)),H*=I.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(E,G),a.arc(E,G,H,this.iniAng,this.endAng,void 0),a.fill());a.beginPath();a.arc(E,G,H,this.iniAng,this.endAng,void 0);this.dashStyle();a.stroke();this.text.hasContent&&this.text.draw(a,this.color,E,G)};b.Arc=C;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,m,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),m=parseInt(this.Y)):(h=parseInt(this.space.getAbsoluteX(this.X)),m=parseInt(this.space.getAbsoluteY(this.Y)));this.text.draw(a,b,h,m)};b.Text=d;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=Math.round,c,h,m,d,l,g,p,f,n,q,e,v=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(v,b.Graphic);v.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((m=c.eval(a.file))||""==m)a.img=a.parent.getImage(m),a.img.hasUpdate||(a.img.hasUpdate=!0,a.img.addEventListener("load",function(){a.space.update(!0)}))};v.prototype.draw=function(){b.Graphic.prototype.draw.call(this)};v.prototype.drawTrace=
function(){b.Graphic.prototype.drawTrace.call(this)};v.prototype.drawAux=function(h){e=this;c=e.evaluator;e.img&&e.img.ready&&e.img.complete&&(e.clip?(n=c.eval(e.clip[2]),q=c.eval(e.clip[3])):(n=e.img.width,q=e.img.height,e.img.canvas&&(n=a(n/e.img.ratio),q=a(q/e.img.ratio))),d=e.centered?0:a(n/2),l=e.centered?0:a(q/2),g=a(e.abs_coord?e.X:e.space.getAbsoluteX(e.X)),p=a(e.abs_coord?e.Y:e.space.getAbsoluteY(e.Y)),f=b.degToRad(-c.eval(e.inirot)),h.save(),h.translate(g+d,p+l),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,n*e.img.ratio,q*e.img.ratio,-n/2,-q/2,n,q):h.drawImage(e.img,c.eval(e.clip[0]),c.eval(e.clip[1]),n,q,-n/2,-q/2,n,q):h.drawImage(e.img,-n/2,-q/2,n,q),h.restore())};b.Image=v;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,m,d,l,g,p=document.createElement("canvas").getContext("2d");p.canvas.width=1;p.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();p.clearRect(0,0,1,1);p.fillStyle=f;p.fillRect(0,0,1,1);f=(new Uint32Array(p.getImageData(0,0,1,1).data.buffer))[0];l=b.getImageData(0,0,this.space.w,this.space.h);g=new Uint32Array(l.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=l.width;m=0>a||0>c||a>=e||c>=l.height?-1:g[a+c*e];if(-1!=m&&f!=m){h=[a,c];for(d=0;0<h.length&&
!(d++,c=h.pop(),a=h.pop(),e=l.width,m==(0>a||0>c||a>=e||c>=l.height?-1:g[a+c*e])&&(g[a+c*l.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(l,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,m=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],f=this.D[2];return a(b*b+c*c+f*f)};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,l=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(l*e-c*h,c*a-g*e,g*h-l*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 m(this.D[0]-a.D[0])<=b&&m(this.D[1]-a.D[1])<=b&&m(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 l=function(a,b,c,d,l,e,h,m,
x,r,u,z,y,A,B,D){a=void 0===a?0:a;b=void 0===b?0:b;c=void 0===c?0:c;d=void 0===d?0:d;l=void 0===l?0:l;e=void 0===e?0:e;h=void 0===h?0:h;m=void 0===m?0:m;x=void 0===x?0:x;r=void 0===r?0:r;u=void 0===u?0:u;z=void 0===z?0:z;y=void 0===y?0:y;A=void 0===A?0:A;B=void 0===B?0:B;D=void 0===D?0:D;this.D=new Float32Array(16);this.set(a,b,c,d,l,e,h,m,x,r,u,z,y,A,B,D)};l.prototype.set=function(a,b,c,d,l,e,h,m,x,r,u,z,y,A,B,D){var f=this.D;f[0]=a;f[1]=b;f[2]=c;f[3]=d;f[4]=l;f[5]=e;f[6]=h;f[7]=m;f[8]=x;f[9]=r;
f[10]=u;f[11]=z;f[12]=y;f[13]=A;f[14]=B;f[15]=D;return this};l.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};l.prototype.mulV4=function(a,b){b=void 0===b?new d:b;var c=this.D,g=a.D;a=b.D;var l=g[0],e=g[1],h=g[2];g=g[3];a[0]=l*c[0]+e*c[4]+h*c[8]+g*c[12];a[1]=l*c[1]+e*c[5]+h*c[9]+g*c[13];a[2]=l*c[2]+e*c[6]+h*c[10]+g*c[14];a[3]=l*c[3]+e*c[7]+h*c[11]+g*c[15];return b};l.prototype.translate=
function(a,b){b=void 0===b?(new l).setIdentity():b;var c=this.D,g=b.D;a instanceof d||(a=new d(a.x,a.y,a.z,a.w));var q=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]*q+c[4]*e+c[8]*a+c[12];g[13]=c[1]*q+c[5]*e+c[9]*a+c[13];g[14]=c[2]*q+c[6]*e+c[10]*a+c[14];g[15]=c[3]*q+c[7]*e+c[11]*a+c[15];return b};l.prototype.rotateX=function(a,b){b=void 0===b?(new l).setIdentity():b;var d=this.D,g=b.D,
q=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]*q;g[5]=d[5]*a+d[9]*q;g[6]=d[6]*a+d[10]*q;g[7]=d[7]*a+d[11]*q;g[8]=d[4]*-q+d[8]*a;g[9]=d[5]*-q+d[9]*a;g[10]=d[6]*-q+d[10]*a;g[11]=d[7]*-q+d[11]*a;g[12]=d[12];g[13]=d[13];g[14]=d[14];g[15]=d[15];return b};l.prototype.rotateY=function(a,b){b=void 0===b?(new l).setIdentity():b;var d=this.D,g=b.D,q=c(a);a=h(a);g[0]=d[0]*a+d[8]*-q;g[1]=d[1]*a+d[9]*-q;g[2]=d[2]*a+d[10]*-q;g[3]=d[3]*a+d[11]*-q;g[4]=d[4];g[5]=d[5];g[6]=d[6];g[7]=d[7];g[8]=
d[0]*q+d[8]*a;g[9]=d[1]*q+d[9]*a;g[10]=d[2]*q+d[10]*a;g[11]=d[3]*q+d[11]*a;g[12]=d[12];g[13]=d[13];g[14]=d[14];g[15]=d[15];return b};l.prototype.rotateZ=function(a,b){b=void 0===b?(new l).setIdentity():b;var d=this.D,g=b.D,q=c(a);a=h(a);g[0]=d[0]*a+d[4]*q;g[1]=d[1]*a+d[5]*q;g[2]=d[2]*a+d[6]*q;g[3]=d[3]*a+d[7]*q;g[4]=d[0]*-q+d[4]*a;g[5]=d[1]*-q+d[5]*a;g[6]=d[2]*-q+d[6]*a;g[7]=d[3]*-q+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};l.prototype.clone=
function(){var a=new l;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=l;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=1E-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();a.strokeStyle=a.fillStyle;"color"===
this.model?(a.fillStyle=0>this.direction?this.backColor:this.frontColor,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.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;w=this.evaluator.getVariable(this.family);this.evaluator.setVariable(this.family,
this.fVal);this.fontSize=n(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,w)}function m(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 l,g=2*Math.PI,p=Math.abs,f=Math.min,n=Math.max,q,e,v,w,x,r,u,z,y,A=function(b,e){Object.assign(this,
b);l=this;l.space=e;l.projV=[];l.spaceV=[];l.newProjV=[];l.newSpaceV=[];"vertex"===l.type?l.draw=a:"face"===l.type?(l.normal=d(l.V[0],l.V[1],l.V[2]),l.draw=c):"text"===l.type?l.draw=h:"edge"===l.type&&(l.draw=m);l.isText&&(l.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]})};A.prototype.computeDepth=function(a){l=this;l.space=a;l.avg={x:0,y:0,z:0};l.removeDoubles();l.normal={x:0,y:1,z:0};l.direction={x:1,y:0,z:0};for(var c=l.V.length,e=
0;e<c;e++)l.spaceV[e]=a.rotateVertex(l.V[e]),l.avg.x+=l.spaceV[e].x,l.avg.y+=l.spaceV[e].y,l.avg.z+=l.spaceV[e].z;l.avg=b.scalarProd3D(l.avg,1/c);l.avg_proy=a.project(l.avg);l.depth=b.norm3D(b.subtract3D(a.eye,l.avg));2<l.V.length&&(l.normal=d(l.spaceV[0],l.spaceV[1],l.spaceV[2]));c=0;for(e=l.V.length;c<e;c++)l.newSpaceV[c]=l.spaceV[c],l.projV[c]=l.newProjV[c]=a.project(l.spaceV[c]);2<l.V.length&&(l.direction=d(l.projV[0],l.projV[1],l.projV[2]).z);l.minDistToEye=Infinity;l.maxDistToEye=-Infinity;
l.minX=Infinity;l.maxX=-Infinity;l.minY=Infinity;l.maxY=-Infinity;c=0;for(e=l.V.length;c<e;c++)r=b.norm3D(b.subtract3D(l.spaceV[c],a.eye)),l.minDistToEye=f(l.minDistToEye,r),l.maxDistToEye=n(l.maxDistToEye,r);a=0;for(c=l.V.length;a<c;a++)l.minX>l.projV[a].x&&(l.minX=l.projV[a].x),l.maxX<l.projV[a].x&&(l.maxX=l.projV[a].x),l.minY>l.projV[a].y&&(l.minY=l.projV[a].y),l.maxY<l.projV[a].y&&(l.maxY=l.projV[a].y)};A.prototype.removeDoubles=function(){l=this;if("edge"!==l.type){x=[];for(var a=0,b=l.V.length;a<
b;a++)(1E-8<p(l.V[a].x-l.V[(a+1)%b].x)||1E-8<p(l.V[a].y-l.V[(a+1)%b].y)||1E-8<p(l.V[a].z-l.V[(a+1)%b].z)||1E-8<p(l.V[a].w-l.V[(a+1)%b].w))&&x.push(l.V[a]);0===x.length&&x.push(l.V[0]);l.V=x}};A.prototype.drawText=function(a,c,d,f,g,l,n,h,m,r,p){q=this.evaluator;a.textNode=c;l=q.eval(this.offset_dist);n=-b.degToRad(q.eval(this.offset_angle));d+=l*Math.cos(n);f+=l*Math.sin(n);a.textNode.pos={x:d,y:f};c.hasContent&&(c.draw(a,g,d,f,!0),v=this.fromPoint?c.textNodes.metrics.w/2:0,e=this.fromPoint?c.textNodes.metrics.h/
2:0,c.draw(a,g,d-v,f-e))};A.prototype.splitFace=function(a){if(this.intersects(a)){var c=null,d=null,e=0,f=0,g,l=this.V,n=a.V;var q=0;for(g=n.length;q<g;q++){var h=this.intersection(n[q],n[(q+1)%g]);if(null!==h)if(null===c){if(c=h,e=q,2===n.length){d=c;break}}else if(!b.equals3D(h,c,1E-8)){d=h;f=q;break}}if(null!==c&&null!==d){q=this.isInterior(c)||this.isInterior(d);var m=g=null;if(!q&&3<=n.length){var r=0;for(l=l.length;r<l;r++)if(h=a.intersection(this.V[r],this.V[(r+1)%l]),null!==h)if(null===g)g=
h;else if(!b.equals3D(h,g,1E-8)){m=h;break}}if(q||null!==g&&null!==m&&a.isInterior(g)&&a.isInterior(m)){m=!0;l=h=null;if(2===n.length)b.equals3D(c,n[0],1E-8)||b.equals3D(c,n[1],1E-8)?m=!1:(h=[],h[0]=n[0],h[1]=c,l=[],l[0]=c,l[1]=n[1]);else for(h=[],l=[],r=k=g=q=0;r<n.length;r++)r<e?h[q++]=n[r]:r==e?(h[q++]=n[r],h[q++]=c,l[g++]=c):r<f?l[g++]=n[r]:r==f?(l[g++]=n[r],l[g++]=d,h[q++]=d):h[q++]=n[r];if(m){c=[];c[0]=new A({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 A({V:l,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]};A.prototype.intersects=function(a){return this.intersectsPlane(a)&&a.intersectsPlane(this)};A.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>p(e-f))return!0;for(var g=1,l=c.length;g<l;g++)if(d=b.dotProduct3D(c[g],a.normal),1E-8>p(e-d)||d>e&&f<e||d<e&&f>e)return!0}return!1};A.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};A.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 l=b.subtract3D(c[(f+1)%g],a),n=b.dotProduct3D(b.crossProduct3D(e,l),this.normal);if(1E-8>p(n)){if(0>b.dotProduct3D(e,l))break}else{if(0>d&&0<n||0<d&&0>n)return!1;e=l;d=n}}return!0};A.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(y=0;3>y;y++)if(u=null,u=0===y?this.intersections(b):1===y?b.verticesContainedIn(this):
this.verticesContainedIn(b),null!=u&&0<u.length){for(var d=$jscomp.makeIterator(u),e=d.next();!e.done;e=d.next())a.push(e.value);d=$jscomp.makeIterator(u);for(e=d.next();!e.done;e=d.next()){e=e.value;z=this.space.rayFromEye(e.x,e.y);try{t=this.distanceToEyeAlong(z)-b.distanceToEyeAlong(z);if(t<=-c)return!0;if(t>=c)return!1}catch(H){}}}return!1};A.prototype.intersections=function(a){for(var c=[],d,e,f,g=new b.R2,l=this.newSpaceV,n=a.newSpaceV,q=this.newProjV,h=a.newProjV,m=0,r=l.length;m<r;m++){a=
l[m];d=l[(m+1)%r];for(var p=0,v=n.length;p<v;p++)e=n[p],f=n[(p+1)%v],a!=e&&a!=f&&d!=e&&d!=f&&(e=g.intersection(q[m],q[(m+1)%r],h[p],h[(p+1)%v]),null!=e&&c.push(e))}return c};A.prototype.distanceToEyeAlong=function(a){a=b.dotProduct3D(this.normal,a);if(1E-6<p(a))return b.dotProduct3D(b.subtract3D(this.avg,this.space.eye),this.normal)/a;throw new Exception("Face is invisible");};A.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};A.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>p(c)){if(1E-8<p(d[e].x-d[(e+1)%g].x))return f(d[e].x,d[(e+1)%g].x)<=a.x+1E-8&&a.x<=n(d[e].x,d[(e+1)%g].x)+1E-8;if(1E-8<p(d[e].y-d[(e+1)%g].y))return f(d[e].y,d[(e+1)%g].y)<=a.y+1E-8&&a.y<=n(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};
A.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=A;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,m,d,l,g,p,f,n=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};n.prototype.getSpace=function(){var a=this;
return this.parent.spaces.find(function(b){return b.id===a.spaceID})||this.parent.spaces[0]};n.prototype.getFamilyValues=function(){c=this;m=c.evaluator;var a=$jscomp.makeIterator(m.eval(c.family_interval)[0]);c.fInf=a.next().value;c.fSup=a.next().value;c.fSteps=Math.round(m.eval(c.family_steps));c.fSep=0<c.fSteps?(c.fSup-c.fInf)/c.fSteps:0};n.prototype.buildFamilyPrimitives=function(){c=this;m=c.evaluator;c.getFamilyValues();d=m.getVariable(c.family);if(0<=c.fSteps)for(var a=0,b=c.fSteps;a<=b;a++)c.fVal=
c.fInf+a*c.fSep,m.setVariable(c.family,c.fVal),m.eval(c.drawif)&&c.buildPrimitives();m.setVariable(c.family,d)};n.prototype.update=function(){c=this;c.primitives=[];c.evaluator.eval(c.drawif)&&(c.family||c.buildPrimitives());c.family&&c.buildFamilyPrimitives()};n.prototype.updateMVMatrix=function(){c=this;l=c.evaluator.eval(c.inirot)[0];c.inirotEuler?(c.inirotM.setIdentity(),c.inirotM=c.inirotM.rotateZ(h(l[0])),c.inirotM=c.inirotM.rotateX(h(l[1])),c.inirotM=c.inirotM.rotateZ(h(l[2]))):(f.setIdentity(),
f.rotateX(h(l[0]),c.inirotM_X),f.rotateY(h(l[1]),c.inirotM_Y),f.rotateZ(h(l[2]),c.inirotM_Z));l=c.evaluator.eval(c.inipos)[0];c.iniposM=c.iniposM.setIdentity().translate({x:l[0],y:l[1],z:l[2]});l=c.evaluator.eval(c.endrot)[0];c.endrotEuler?(c.endrotM.setIdentity(),c.endrotM=c.endrotM.rotateZ(h(l[0])),c.endrotM=c.endrotM.rotateX(h(l[1])),c.endrotM=c.endrotM.rotateZ(h(l[2]))):(f.setIdentity(),f.rotateX(h(l[0]),c.endrotM_X),f.rotateY(h(l[1]),c.endrotM_Y),f.rotateZ(h(l[2]),c.endrotM_Z));l=c.evaluator.eval(c.endpos)[0];
c.endposM=c.endposM.setIdentity().translate({x:l[0],y:l[1],z:l[2]})};n.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};n.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)};n.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};n.prototype.splitFace=function(a){for(var b=
$jscomp.makeIterator(this.primitives),c=b.next();!c.done;c=b.next())if(c=c.value,p=[],"face"===c.type){for(var d=$jscomp.makeIterator(a.primitives),f=d.next();!f.done;f=d.next())f=f.value,"face"===f.type?p.push.apply(p,$jscomp.arrayFromIterable(c.splitFace(f))):p.push(f);a.primitives=p}};b.Graphic3D=n;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,m,d,l,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];m=h[0];d=h[1];l=h[2];a.primitives.push(new b.Primitive3D({V:[a.transformVertex(new b.Vec4D(m,d,l))],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(m,d,l))],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,m,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);m=h.eval(a.expresion);a.primitives.push(new b.Primitive3D({V:[a.transformVertex(new b.Vec4D(m[0][0],m[0][1],m[0][2])),a.transformVertex(new b.Vec4D(m[1][0],m[1][1],m[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,m,d,l,g,p,f,n,q,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");l=c.getVariable("y");g=c.getVariable("z");
h=c.getVariable("u");m=c.getVariable("v");c.setVariable("u",0);c.setVariable("v",0);p=parseInt(c.eval(a.Nu));f=parseInt(c.eval(a.Nv));n=[];for(var e=0;e<=p;e++){c.setVariable("u",e/p);for(var w=0;w<=f;w++){c.setVariable("v",w/f);for(var x=$jscomp.makeIterator(a.expresion),r=x.next();!r.done;r=x.next())c.eval(r.value);n.push(a.transformVertex(new b.Vec4D(c.getVariable("x"),c.getVariable("y"),c.getVariable("z"))))}}e=a.color.getColor();w=a.backcolor.getColor();x=a.edges?a.edges.getColor():"";for(r=
0;r<p;r++)for(var u=0;u<f;u++)q=[],q.push(n[u+r*f+r]),q.push(n[u+1+r*f+r]),q.push(n[u+2+(r+1)*f+r]),q.push(n[u+1+(r+1)*f+r]),a.primitives.push(new b.Primitive3D({V:q,type:"face",frontColor:e,backColor:w,edges:x,model:a.model},a.space));c.setVariable("x",d);c.setVariable("y",l);c.setVariable("z",g);c.setVariable("u",h);c.setVariable("v",m)};b.Surface3D=e;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,m,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);m=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:m,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,m,d,l,g,p,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;p=a.evaluator;a.updateMVMatrix();d=p.getVariable("x");l=p.getVariable("y");g=p.getVariable("z");m=p.getVariable("u");p.setVariable("u",0);h=p.eval(a.Nu);c=[];for(var f=0;f<=h;f++){p.setVariable("u",f/h);for(var q=$jscomp.makeIterator(a.expresion),
e=q.next();!e.done;e=q.next())p.eval(e.value);c.push(a.transformVertex(new b.Vec4D(p.getVariable("x"),p.getVariable("y"),p.getVariable("z"))))}f=0;for(q=c.length-1;f<q;f++)a.primitives.push(new b.Primitive3D({V:[c[f],c[f+1]],type:"edge",frontColor:a.color.getColor(),lineWidth:p.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));p.setVariable("x",d);p.setVariable("y",
l);p.setVariable("z",g);p.setVariable("u",m)};b.Curve3D=f;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,m=function(a,c){return b.Graphic3D.call(this,a,c)||this};$jscomp.inherits(m,b.Graphic3D);m.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=m;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,m,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();m=h.eval(a.expresion);c=[];for(var d=m.length-1;0<=d;d--)c.push(a.transformVertex(new b.Vec4D(m[d][0],m[d][1],m[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,m,d,l,g,p=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(p,b.Graphic3D);p.prototype.buildPrimitives=function(){a=this;g=a.evaluator;a.updateMVMatrix();c=g.eval(a.Nu);h=[a.transformVertex(new b.Vec4D)];m=g.eval(a.width)/2;d=g.eval(a.length)/2;l=2*Math.PI/c;for(var f=0;f<c;f++)h.push(a.transformVertex(new b.Vec4D(m*Math.cos(l*
f),d*Math.sin(l*f),0)));f=a.color.getColor();for(var n=a.backcolor.getColor(),q=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:n,edges:q,model:a.model},a.space))};b.Polireg3D=p;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,m=function(a,c){a=b.Graphic3D.call(this,a,c)||this;a.shadowColor=a.shadowColor?a.shadowColor.getColor():"transparent";return a};$jscomp.inherits(m,b.Graphic3D);m.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=m;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,m,d=b.degToRad,l=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_"+l++;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;m=a.evaluator.eval(a.inirot)[0];a.inirotEuler?(a.inirotM.setIdentity(),a.inirotM=a.inirotM.rotateZ(d(m[0])),a.inirotM=a.inirotM.rotateX(d(m[1])),a.inirotM=a.inirotM.rotateZ(d(m[2]))):(h.setIdentity(),h.rotateX(d(m[0]),a.inirotM_X),h.rotateY(d(m[1]),a.inirotM_Y),h.rotateZ(d(m[2]),a.inirotM_Z));m=a.evaluator.eval(a.inipos)[0];a.iniposM=a.iniposM.setIdentity().translate({x:m[0],y:m[1],z:m[2]});m=a.evaluator.eval(a.endrot)[0];a.endrotEuler?(a.endrotM.setIdentity(),a.endrotM=a.endrotM.rotateZ(d(m[0])),
a.endrotM=a.endrotM.rotateX(d(m[1])),a.endrotM=a.endrotM.rotateZ(d(m[2]))):(h.setIdentity(),h.rotateX(d(m[0]),a.endrotM_X),h.rotateY(d(m[1]),a.endrotM_Y),h.rotateZ(d(m[2]),a.endrotM_Z));m=a.evaluator.eval(a.endpos)[0];a.endposM=a.endposM.setIdentity().translate({x:m[0],y:m[1],z:m[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,m=Math.sqrt(3),d=Math.sin,l=Math.cos,g,p,f,n,q,e,v,w,x,r,u,z,y=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(y,b.Graphic3D);y.prototype.buildPrimitives=function(){a=this;
p=a.evaluator;a.updateMVMatrix();a.buildGeometry(p.eval(a.width),p.eval(a.height),p.eval(a.length),p.eval(a.Nu),p.eval(a.Nv));for(var c=a.color.getColor(),d=a.backcolor.getColor(),e=a.edges?a.edges.getColor():"",g=$jscomp.makeIterator(a.faces),l=g.next();!l.done;l=g.next()){l=l.value;f=[];l=$jscomp.makeIterator(l);for(var n=l.next();!n.done;n=l.next())f.push(a.transformVertex(a.V[n.value]));a.primitives.push(new b.Primitive3D({V:f,type:"face",frontColor:c,backColor:d,edges:e,model:a.model},a.space))}};
y.prototype.changeGeometry=function(a,b,c,d,e){return this.oldW===a&&this.oldH===b&&this.oldL===c&&this.oldNu===d&&this.oldNv===e};y.prototype.updateValues=function(a,b,c,d,e){this.oldW=a;this.oldH=b;this.oldL=c;this.oldNv=e;this.oldNu=d};var A=function(a,b){a=y.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(A,y);A.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 B=function(a,b){return A.call(this,a,b)||this};$jscomp.inherits(B,A);B.prototype.buildGeometry=function(a,b,c,d,e){b=a/m;A.prototype.buildGeometry.call(this,b,b,b,d,e)};var D=function(a,b){a=y.call(this,a,b)||this;a.faces=[[1,3,2],[0,1,2],[0,2,3],[0,3,1]];return a};$jscomp.inherits(D,y);D.prototype.buildGeometry=function(a,b,c,d,e){a/=2;if(!this.changeGeometry(a,
b,c,d,e)){var f=h/3,l=Math.cos(f),n=Math.sin(f);f=2*a*Math.sqrt(2)/3;var q=-a/3,m=f*l+0*n;l=-f*n+0*l;this.V=[new g(0,0,a),new g(m,l,q),new g(m,-l,q),new g(f,0,q)];this.updateValues(a,b,c,d,e)}};var I=function(a,b){a=y.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(I,y);I.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 E=function(a,b){return y.call(this,a,b)||this};$jscomp.inherits(E,y);E.prototype.buildGeometry=function(a,b,e,f,m){a/=2;b/=2;e/=2;if(!this.changeGeometry(a,b,e,f,m)){this.V=[new g(0,0,b)];for(var r=1;r<f;r++){q=r*c/f;for(var p=0;p<m;p++)n=p*h/m,this.V.push(new g(a*d(q)*l(n),e*d(q)*d(n),b*l(q)))}this.V.push(new g(0,0,-b));this.faces=[];for(r=0;r<m;r++)this.faces.push([0,(r+1)%m+1,r%m+1]);for(r=1;r<f-1;r++)for(p=0;p<m;p++)this.faces.push([p+1+(r-
1)*m,(p+1)%m+1+(r-1)*m,(p+1)%m+1+r*m,p+1+r*m]);for(r=0;r<m;r++)this.faces.push([this.V.length-1,this.V.length-1-m+r,this.V.length-1-m+(r+1)%m]);this.updateValues(a,b,e,f,m)}};var G=function(a,b){return E.call(this,a,b)||this};$jscomp.inherits(G,E);G.prototype.buildGeometry=function(a,b,c,d,e){E.prototype.buildGeometry.call(this,a,a,a,d,e)};var H=function(a,b){a=y.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(H,y);H.prototype.buildGeometry=function(a,d,e,f,l){a/=Math.PI;if(!this.changeGeometry(a,d,e,f,l)){w=a/1.6180339887;x=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,w,x),new g(0,w,-x),new g(0,-w,x),new g(0,-w,-x),new g(w,x,0),new g(w,-x,0),new g(-w,x,0),new g(-w,-x,0),new g(x,0,w),new g(x,0,-w),new g(-x,
0,w),new g(-x,0,-w)];r=(new b.Mat4).setIdentity().rotateY(-c/6);for(var n=0,q=this.V.length;n<q;n++)this.V[n]=r.mulV4(this.V[n]);this.updateValues(a,d,e,f,l)}};var C=function(a,b){a=y.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(C,y);C.prototype.buildGeometry=function(a,c,d,e,f){a/=3.8;if(!this.changeGeometry(a,c,d,e,
f)){x=1.6180339887*a;this.V=[new g(0,a,x),new g(0,a,-x),new g(0,-a,x),new g(0,-a,-x),new g(a,x,0),new g(a,-x,0),new g(-a,x,0),new g(-a,-x,0),new g(x,0,a),new g(x,0,-a),new g(-x,0,a),new g(-x,0,-a)];r=(new b.Mat4).setIdentity().rotateY(-1.0285);for(var l=0,n=this.V.length;l<n;l++)this.V[l]=r.mulV4(this.V[l]);this.updateValues(a,c,d,e,f)}};var J=function(a,b){return y.call(this,a,b)||this};$jscomp.inherits(J,y);J.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 n=0;n<f;n++)for(var q=0;q<e;q++)this.V.push(new g(a*(f-n)/f*l(q*h/e),c*(f-n)/f*d(q*h/e),b-2*n*b/f));this.V.push(new g(0,0,-b));this.faces=[];for(n=0;n<f-1;n++)for(q=0;q<e;q++)this.faces.push([q+n*e,(q+1)%e+n*e,(q+1)%e+(n+1)*e,q+(n+1)*e]);for(n=0;n<e;n++)this.faces.push([this.V.length-1,this.V.length-1-e+n,this.V.length-1-e+(n+1)%e]);this.updateValues(a,b,c,e,f)}};var P=function(a,b){return y.call(this,a,b)||this};$jscomp.inherits(P,y);P.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 n=0;n<f+1;n++)for(var q=0;q<e;q++)this.V.push(new g(a*l(q*h/e),c*d(q*h/e),b-2*n*b/f));this.faces=[];for(n=0;n<f;n++)for(q=0;q<e;q++)this.faces.push([q+n*e,(q+1)%e+n*e,(q+1)%e+(n+1)*e,q+(n+1)*e]);this.updateValues(a,b,c,e,f)}};var R=function(a,b){return y.call(this,a,b)||this};$jscomp.inherits(R,y);R.prototype.buildGeometry=function(a,b,c,f,n){a/=2;b/=2;c/=2;e=p.eval(this.R);v=p.eval(this.r);if(!this.changeGeometry(a,b,c,
f,n)){this.V=[];for(var q=0;q<n+1;q++)for(var m=0;m<f;m++)this.V.push(new g(-(e+v*d(h*m/f))*d(h*q/n),(e+v*d(h*m/f))*l(h*q/n),v*l(h*m/f)));this.faces=[];for(q=0;q<n;q++)for(m=0;m<f;m++)this.faces.push([m+q*f,m+(q+1)*f,(m+1)%f+(q+1)*f,(m+1)%f+q*f]);this.updateValues(a,b,c,f,n)}};var L=function(c,d){c=y.call(this,c,d)||this;a.fileData=b.openFile(a.evaluator.eval(a.file)).split(/\r/);return c};$jscomp.inherits(L,y);L.prototype.buildGeometry=function(){this.V=[];this.faces=[];for(var a=0,b=this.fileData.length;a<
b;a++)u=this.fileData[a],u.startsWith("V")?(z=u.slice(2,-1).split(",").map(parseFloat),this.V.push(new g(z[0]||0,z[1]||0,z[2]||0))):u.startsWith("F")&&(z=u.slice(2,-1).split(",").map(parseInt),this.faces.push(z.reverse()))};b.OtherGeometry3D=y;b.Cube3D=B;b.Box3D=A;b.Tetrahedron3D=D;b.Octahedron3D=I;b.Sphere3D=G;b.Ellipsoid3D=E;b.Dodecahedron3D=H;b.Icosahedron3D=C;b.Cone3D=J;b.Cylinder3D=P;b.Torus3D=R;b.Mesh3D=L;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=Math.max,c=Math.min,h=Math.PI,m=Math.cos,d=Math.sin,l=Math.abs,g=Math.round,p,f,n,q,e,v,w,x,r,u,z,y,A,B,D,I,E,G,H=function(a,b){this.x=void 0===a?0:a;this.y=void 0===b?0:b};H.prototype.set=function(a,b){this.x=void 0===a?0:a;this.y=void 0===b?0:b;return this};H.prototype.copy=function(){return new H(this.x,this.y)};H.prototype.ix=function(){return g(a(c(this.x,32E3),-32E3))};H.prototype.iy=function(){return g(a(c(this.y,32E3),-32E3))};H.prototype.equals=
function(a){return this.x===a.x&&this.y===a.y};H.prototype.norm2=function(){return this.x*this.x+this.y*this.y};H.prototype.norm=function(){return Math.sqrt(this.norm2())};H.prototype.distance=function(a){f=this.copy();f.sub(a);return f.norm()};H.prototype.dot=function(a){return this.x*a.x+this.y*a.y};H.prototype.det=function(a){return this.x*a.y-this.y*a.x};H.prototype.mul=function(a){this.x*=a;this.y*=a};H.prototype.div=function(a){this.x/=a;this.y/=a};H.prototype.add=function(a){this.x+=a.x;this.y+=
a.y};H.prototype.sub=function(a){this.x-=a.x;this.y-=a.y};H.prototype.normalize=function(){p=this.norm();0!=p&&this.div(p)};H.prototype.rotR90=function(){p=this.x;this.x=this.y;this.y=-p};H.prototype.rotL90=function(){p=this.x;this.x=-this.y;this.y=p};H.prototype.rot=function(a){n=this.copy();v=m(a);w=d(a);this.x=n.x*v-n.y*w;this.y=n.x*w+n.y*v};H.prototype.rot2=function(a){this.rot(a*h/180)};H.prototype.intersection=function(b,d,f,g){x=d.x-b.x;r=f.x-g.x;u=f.x-b.x;z=d.y-b.y;y=f.y-g.y;A=f.y-b.y;G=x*
y-r*z;return 1E-6<l(G)?(q=(u*y-A*r)/G,e=(-u*z+A*x)/G,0<=q&&1>=q&&0<=e&&1>=e?new H(b.x+x*q,b.y+z*q):null):(d.x-f.x)*A!=(d.y-f.y)*u?null:b.x!=d.x?(B=c(b.x,d.x),D=a(b.x,d.x),B<=f.x&&f.x<=D?f:B<=g.x&&g.x<=D?g:null):f.x!=g.x?(I=c(f.x,g.x),E=a(f.x,g.x),I<=b.x&&b.x<=E?b:I<=d.x&&d.x<=E?d:null):b.y!=d.y?(B=c(b.y,d.y),D=a(b.y,d.y),B<=f.y&&f.y<=D?f:B<=g.y&&g.y<=D?g:null):f.y!=g.y?(I=c(f.y,g.y),E=a(f.y,g.y),I<=b.y&&b.y<=E?b:I<=d.y&&d.y<=E?d:null):b.x==f.x&&b.y==f.y?b:null};b.R2=H;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,m,d,l,g,p,f,n=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]);l=new b.R2(0,0);d=new b.R2(0,0);f=new b.R2(0,0)};n.prototype.getUnitNormal=function(){this.normal.normalize();return f.set(this.normal.x,this.normal.y)};
n.prototype.gradient=function(b){a=this.evaluator;l.x=0;l.y=0;g=a.getVariable("x");p=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);l.x=(c-this.f0)/1E-6;l.x=isNaN(l.x)?Infinity:l.x;a.setVariable("x",a.getVariable("x")-1E-6);a.setVariable("y",a.getVariable("y")+1E-6);c=a.eval(this.constraint);l.y=(c-this.f0)/1E-6;l.y=isNaN(l.y)?Infinity:l.y;a.setVariable("x",g);a.setVariable("y",p);
return l};n.prototype.findZero=function(b,c,f){a=this.evaluator;d.x=b.x;d.y=b.y;g=a.getVariable("x");p=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",p);for(var e=0;16>e;e++)if(h=d.x,m=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=m+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=n;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,m,d,l,g,p,f,n,q,e,v,w,x,r,u=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)};u.prototype.init=function(){};
u.prototype.update=function(){};u.prototype.draw=function(){};u.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};u.prototype.addControlContainer=function(a){this.getContainer().appendChild(a)};u.prototype.updatePositionAndSize=function(){a=this;l=g=
p=f=!1;n=a.evaluator.eval(a.expresion)[0];q=h(n[0]);l=h(a.x)!==q;a.x=q;q=h(n[1]);g=h(a.y)!==q;a.y=q;4===n.length&&(q=h(n[2]),p=h(a.w)!==q,a.w=q,q=h(n[3]),f=h(a.h)!==q,a.h=q);if(p||f||l||g)a.init(!0,!0),a.draw()};u.prototype.formatValue=function(b){a=this;r=a.parent;e=b+"";v=a.evaluator.eval(a.decimals);w=e.indexOf(".");-1!=w&&(x=e.substring(w+1),x.length>v&&(e=parseFloat(e).toFixed(v)));a.fixed&&(2!==r.version||2===r.version&&!a.exponentialif)&&(e=parseFloat(b).toFixed(v));a.exponentialif&&0!=parseFloat(e)&&
(e=a.fixed&&2!==r.version?parseFloat(e).toExponential(v):parseFloat(e).toExponential(),e=e.toUpperCase().replace("+",""));return e.replace(".",r.decimal_symbol)};u.prototype.updateAndExecAction=function(){r=this.parent;r.updateControls();"init"===this.action&&(this.click=!1);this.actionExec.execute();r.updateControls();"animate"!==this.action&&r.update();r.updateControls()};u.prototype.createGradient=function(a,b){this.linearGradient=this.ctx.createLinearGradient(0,0,0,b);m=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/m/255+")")};b.Control=u;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c=/[\w\.\-//]*(\.gif)/gi,h=/CanvasGradient|CanvasPattern/,m=Math.floor,d=Math.abs,l,g,p,f,n,q,e,v,w,x,r,u,z,y,A,B,D,I,E,G,H,C,J,P,R,L,Q,O,F,M,K,N,V,Z,X,U,S=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(M=c.substr(0,c.lastIndexOf(".")),
K=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),M)try{e.imageOver=e.parent.getImage(M+"_over"+K),e.imageDown=e.parent.getImage(M+"_down"+K)}catch(da){}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(S,b.Control);S.prototype.init=function(c){a=this;l=a.evaluator;G=a.container;g=a.btn;p=a.ctx;f=l.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;");G.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,G.style[e.type]=e.value;a.conStyle.shadowBoxColor&&(G.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=
l.parser.parse(b.getFieldFontSize(this.h)+""));a.fs_evaluated=l.eval(a.font_size);a.createGradient(a.w,a.h);G.style.display=0<l.eval(a.drawif)?"block":"none";p.lineJoin="round";p.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:l,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)};S.prototype.update=function(){a=this;l=a.evaluator;G=
a.container;a.activeIfValue=0<l.eval(a.activeif);a.drawIfValue=0<l.eval(a.drawif);(a.space?a.space.drawIfValue:1)&&a.drawIfValue?(G.style.display="block",a.draw(),G.style.cursor=a.btn.style.cursor=a.activeIfValue?"pointer":"not-allowed",G.setAttribute("active",a.activeIfValue),a.updatePositionAndSize()):(G.style.display="none",a.buttonClick=!1)};S.prototype.draw=function(d){a=this;G=a.container;l=a.evaluator;g=a.btn;p=a.ctx;q=l.eval(a.name);a.text_object.draw(b.ctx,"#000000",0,0);q=a.text_object.textNodes.toStr();
e=a.evaluator.eval(a.imageSrc).toString().trim();if(!d&&(H=a.over===a.oldOver,C=a.buttonClick===a.oldButtonClick,J=a.activeIfValue===a.oldActiveIfValue,P=a.drawIfValue===a.oldDrawIfValue,R=q===a.oldName,L=e===a.oldImageSrc,Q=a.colorInt.getColor()===a.oldBackColor,O=a.color.getColor()===a.oldTextColor,F=a.image.ready===a.oldImageReady,a.oldOver=a.over,a.oldButtonClick=a.buttonClick,a.oldActiveIfValue=a.activeIfValue,a.oldDrawIfValue=a.drawIfValue,a.oldName=q,a.oldImageSrc=e,a.oldBackColor=a.colorInt.getColor(),
a.oldTextColor=a.color.getColor(),a.oldImageReady=a.image.ready,H&&C&&J&&P&&R&&L&&Q&&O&&F))return;p.save();p.setTransform(a.ratio,0,0,a.ratio,0,0);n=a.fs_evaluated;G.setAttribute("data-name",q);e?(v="vacio.gif"===e?this.emptyImage:this.parent.getImage(e),M=e.substr(0,e.lastIndexOf(".")),K=e.substr(e.lastIndexOf(".")),N=M+"_over"+K,V=M+"_down"+K,Z="vacio.gif"===e?this.emptyImage:this.parent.getImage(N),X="vacio.gif"===e?this.emptyImage:this.parent.getImage(V)):v=Z=X=a.emptyImg;p.clearRect(0,0,a.w,
a.h);x=r=a.buttonClick?1:0;a.text_object.draw(p,a.color.getColor(),0,0,!0);u=a.text_object.textNodes.metrics.w;z=a.text_object.textNodes.metrics.h;"center"==a.text_align[1]?I=m(a.w/2+x)-.5:"left"==a.text_align[1]?I=u/2+5+x:"right"==a.text_align[1]&&(I=a.w-u/2+x-5);"center"==a.text_align[0]?E=m(a.h/2+r)-.5:"top"==a.text_align[0]?E=z/2+r+4:"bottom"==a.text_align[0]&&(E=a.h-z/2+r-3);if(v){if(y=a.imgSizeW||v.width,A=a.imgSizeH||v.height,"center"==a.image_align[1]?B=parseInt((a.w-y)/2)+x:"left"==a.image_align[1]?
B=x:"right"==a.image_align[1]&&(B=a.w-y+x),"center"==a.image_align[0]?D=parseInt((a.h-A)/2)+r:"top"==a.image_align[0]?D=r:"bottom"==a.image_align[0]&&(D=a.h-A+r),v&&v.ready)if(v!==a.emptyImg&&v.complete)if(e.match(c))g.style.backgroundRepeat="no-repeat",g.style.backgroundImage="url('"+e+"')",g.style.backgroundPosition=B+"px "+D+"px";else{if("center"!=a.image_align[0]||"center"!=a.image_align[1])(U=a.colorInt.getColor())&&h.test(U.constructor.name)?(p.fillStyle=U,p.fillRect(0,0,a.w,a.h)):G.style.backgroundColor=
U;p.drawImage(v,0,0,v.width,v.height,B,D,y,A)}else a.emptyImg&&a.customStyle&&((U=a.colorInt.getColor())&&h.test(U.constructor.name)?(p.fillStyle=U,p.fillRect(0,0,a.w,a.h)):G.style.backgroundColor=U)}else(U=a.colorInt.getColor())&&h.test(U.constructor.name)?(p.fillStyle=U,p.fillRect(0,0,a.w,a.h)):(G.style.backgroundColor=U,a.flat||(a.buttonClick||(a.drawLine(p,a.w-1,0,a.w-1,a.h,"rgba(0,0,0,0.5)"),a.drawLine(p,0,0,0,a.h,"rgba(0,0,0,0.09)"),a.drawLine(p,1,0,1,a.h,"rgba(0,0,0,0.03)")),p.fillStyle=a.linearGradient,
p.fillRect(0,0,a.w,a.h)));a.activeIfValue&&(Z!==a.emptyImg&&a.over&&Z.ready&&Z.complete?N.match(c)?(g.style.backgroundImage="url('"+N+"')",g.style.backgroundPosition=B+"px "+D+"px"):p.drawImage(Z,B,D):a.customStyle&&a.conStyle.overColor&&a.over&&(G.style.backgroundColor=a.conStyle.overColor));a.activeIfValue?X!==a.emptyImg&&a.buttonClick&&X.ready&&X.complete?V.match(c)?(g.style.backgroundImage="url('"+V+"')",g.style.backgroundPosition=B+"px "+D+"px"):p.drawImage(X,B,D):a.customStyle&&a.conStyle.downColor&&
a.buttonClick&&(G.style.backgroundColor=a.conStyle.downColor):a.buttonClick&&!v&&(p.fillStyle="rgba(0,0,0,0.09)",p.fillRect(0,0,a.w,a.h));p.fillStyle=a.color.getColor();a.customStyle&&a.conStyle.shadowTextColor&&0<a.conStyle.textBorder&&(p.lineWidth=a.conStyle.textBorder,p.strokeStyle=a.conStyle.shadowTextColor);a.borderColor&&(p.lineWidth=parseInt(n/6),p.strokeStyle=a.borderColor.getColor());a.text_object.draw(p,a.color.getColor(),I,E);a.underlined&&(p.strokeStyle=a.color.getColor(),p.lineWidth=
m(.1*n)||2,p.lineCap="round",p.beginPath(),p.moveTo(I-u/2+x,E+m(n/2)+m(n/5)-1.5),p.lineTo(I+u/2+x,E+m(n/2)+m(n/5)-1.5),p.stroke());a.activeIfValue||(a.customStyle&&a.conStyle.inactiveColor?G.style.backgroundColor=a.conStyle.inactiveColor:(p.fillStyle="rgba(240,240,240,0.6)",p.fillRect(0,0,a.w,a.h)));p.restore();a._image_pos_x=B;a._image_pos_y=D};S.prototype.drawLine=function(a,b,c,d,e,f,g){a.lineWidth=void 0===g?1:g;a.strokeStyle=void 0===f?"black":f;w=a.lineWidth%2*.5;a.beginPath();a.moveTo(m(b)+
w,m(c)+w);a.lineTo(m(d)+w,m(e)+w);a.stroke()};S.prototype.drawTextBorder=function(){this.colorInt.getColor();this.color.getColor();return!(.5>(d(this.colorInt.r-this.color.r)+d(this.colorInt.g-this.color.g)+d(this.colorInt.b-this.color.b))/255)};S.prototype.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=S;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,m,d,l,g,p,f,n,q,e,v,w,x,r=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(y){console.log(y)}/^&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(r,b.Control);r.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 n=parseInt(a.h),
l=parseInt(a.w/2-n);f=a.text_object.textNodes.metrics.w+parseInt(a.fieldFontSize);a.visible||(l=a.w-2*n,g=0);l<f&&(l=f);""==d&&(l=0);a.w-l-n<g&&(l=a.w-n-g);0>l&&(l=0);d=a.w-(l+2*n);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:"+n+"px;height:"+n+"px;"+("h_left"===a.btn_pos?"left:"+(l+n):"right:0")+"px;top:0;"+(a.flat?"border-width:0;":""));a.divDown.setAttribute("style",
"width:"+n+"px;height:"+n+"px;left:"+(l+("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:"+(n+l+("h_left"===a.btn_pos?n:"h_right"===a.btn_pos?-n:0))+"px;text-align:center;");a.cover.setAttribute("style","width:"+d+"px;height:"+a.h+"px;left:"+(n+l+("h_left"===a.btn_pos?n:"h_right"===a.btn_pos?-n: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:"+l+"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=l*a.ratio}else n=2+parseInt(a.h/2),l=parseInt(a.w/2-n/2),f=b.getTextWidth(d+f,a.fieldFontSize+"px "+b.sansserif_font),a.visible||(l=a.w-n,g=0),l<f&&(l=f),""==d&&(l=0),a.w-l-n<g&&(l=a.w-n-g),0>l&&(l=0),d=a.w-(l+n),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:"+n+"px;left:"+(l+("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?n:0)+l)+"px;"),a.cover.setAttribute("style","width:"+d+"px;height:"+a.h+"px;left:"+(("v_left"===a.btn_pos?n:0)+l)+"px;"),a.field.value=e,a.visible||(a.field.style.display="none"),a.label.setAttribute("style","font-size:"+a.fieldFontSize+"px;width:"+l+"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=l*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)};r.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&&(v=a.evaluator.eval(a.image_dec_src).toString().trim(),a.old_image_dec_src!==v&&(a.divDown.style["background-image"]="url("+v+")",a.old_image_dec_src=v));a.image_inc&&(w=a.evaluator.eval(a.image_inc_src).toString().trim(),
a.old_image_inc_src!==w&&(a.divUp.style["background-image"]="url("+w+")",a.image_inc_src=w));a.updatePositionAndSize();a.parent.animation.playing&&document.activeElement==a.field||(m=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!=m&&(a.value=a.validateValue(m),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);(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)};r.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"};r.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,".");l=
a==parseFloat(a)?parseFloat(a):parseFloat(c.eval(c.parser.parse(a)));isNaN(l)&&(l=0);f=c.eval(this.min);n=c.eval(this.max);""===f&&(f=-Infinity);""===n&&(n=Infinity);l=Math.min(Math.max(l,f),n);this.discrete&&(g=c.eval(this.incr),l=0==g?0:this.initial_value+g*Math.round((l-this.initial_value)/g));p=c.eval(this.decimals);0>=p&&(p=0);return l=parseFloat(parseFloat(l).toFixed(p))};r.prototype.increase=function(){this.changeValue(parseFloat(this.value)+this.evaluator.eval(this.incr))};r.prototype.decrease=
function(){this.changeValue(parseFloat(this.value)-this.evaluator.eval(this.incr))};r.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())};r.prototype.addEvents=function(){function a(c,d,e){b.clearTimeout(l);if(g.up||g.down)d.call(g),c=e?c:10,l=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(n,g.increase,!0))}function d(c){c.preventDefault();g.whichBtn=b.whichBtn(c);"L"==g.whichBtn&&g.activeIfValue&&(g.down=!0,a(n,g.decrease,!0))}function e(a){g.up=!1;b.clearTimeout(l);g.updateStyle()}function f(a){g.down=!1;b.clearTimeout(l);g.updateStyle()}q=b.hasTouchSupport;var g=this,n=q?500:200,l;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(l);a.preventDefault();g.updateStyle()});g.divDown.addEventListener("mouseout",function(a){g.down=!1;b.clearTimeout(l);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(l);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=r;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,m=function(c,l){var d;a=d=b.Control.call(this,c,l)||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=l.pressed||!1;a.radio_group=(l.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(m,b.Control);m.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()};m.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 l=-1;if(a.pressed){for(l=b.length-1;0<=l;l--)c.setVariable(b[l].internalID,0),b[l].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--)l=0!=c.getVariable(b[g].internalID)?g:l,c.setVariable(b[g].internalID,0),b[g].checked=!1;0<=l&&(c.setVariable(b[l].internalID,1),b[l].checked=!0,c.setVariable(a.radio_group,b[l].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)};m.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=m;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,m,d,l,g,p,f,n=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(n,b.Control);n.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),l=a.text_object.textNodes.metrics.w+parseInt(a.fieldFontSize);a.visible||(g=a.w,f=0);g<l&&(g=l);""==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()};n.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,m=a.value,a.value=a.validateValue(c.getVariable(a.id)),a.field.value=a.formatValue(a.value),a.value===m&&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);(p=a.label_color.getColor())&&/CanvasGradient|CanvasPattern/.test(p.constructor.name)&&(a.label_ctx.fillStyle=p,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)};n.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);l=c.eval(this.min);g=c.eval(this.max);""===l&&(l=-Infinity);""===g&&(g=Infinity);d<l&&(d=l);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)))};
n.prototype.formatValue=function(a){return""===a?a:b.Control.prototype.formatValue.call(this,a)};n.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())};n.prototype.evalAnswer=function(){return b.esCorrecto(this.answer,this.value,this.evaluator)};n.prototype.deactivate=
function(){this.evaluator.setVariable(this.activoStr,0);this.evaluator.setVariable(this.activeStr,0)};n.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=n;return b}(descartesJS||
{});
descartesJS=function(b){if(b.loadLib)return b;var a,c=Math.abs,h,m,d,l,g,p,f,n,q,e,v,w=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=m.eval(d),f.select.appendChild(c);return 0}var e,f=e=b.Control.call(this,a,c)||this;h=f.parser;m=f.evaluator;f.label_color=f.label_color||new b.Color("e0e4e8",m);f.label_text_color=
f.label_text_color||new b.Color("000000",m);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(w,b.Control);w.prototype.init=function(c){a=this;m=a.evaluator;a.label.innerHTML=m.eval(a.name).toString();var d=a.label.textContent;a.fieldFontSize=0<m.eval(a.font_size)?m.eval(a.font_size):b.getFieldFontSize(a.h);a.text_object=new b.TextObject({parent:{decimal_symbol:a.parent.decimal_symbol},
evaluator:m,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:m.eval(a.valueExpr);a.idxVal=a.getIndex(a.value);for(var g=0,l=a.menuOptions.length;g<l;g++)c=b.getTextWidth(m.eval(a.menuOptions[g]).toString(),a.fieldFontSize+"px "+b.sansserif_font),
c>e&&(e=c,f=g);e+=25;c=b.getTextWidth(a.formatValue(m.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;l=a.formatValue(m.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=l;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;m.setVariable(a.id,parseFloat(l.replace(a.parent.decimal_symbol,".")));a.update()};w.prototype.update=function(){a=this;m=a.evaluator;a.activeIfValue=0<m.eval(a.activeif);a.drawIfValue=0<m.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=(m.eval(a.menuOptions[b])||"").replace(/\\u002C/g,",");a.value=m.getVariable(a.id);isNaN(a.value)&&(a.value=0);a.field.value=a.formatValue(a.value);m.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);(v=a.label_color.getColor())&&/CanvasGradient|CanvasPattern/.test(v.constructor.name)&&(a.label_ctx.fillStyle=v,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)};w.prototype.customSplit=function(a){p=!1;f="";n=0;for(q=-1;n<a.length;){e=a.charAt(n);if("["===e&&-1===q){if(p||""!=f)f+="\u00a6";q++}else"["===e?q++:"]"===e&&0===q?(p=!0,q--):"]"==a.charAt(n)&&(q=0>q?q:q-1);f+=a.charAt(n);n++}return f.split("\u00a6")};w.prototype.getIndex=function(a){a=parseFloat(a.toString().replace(this.parent.decimal_symbol,"."));
d=-1;l=Infinity;for(var b=0,e=this.strVal.length;b<e;b++)g=c(a-parseFloat(this.evaluator.eval(this.strVal[b]))),g<=l&&(l=g,d=b);this.select.options[this.select.selectedIndex]&&this.evaluator.setVariable(this.id+".txt",this.select.options[this.select.selectedIndex].text);return d};w.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())};w.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=w;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c=Math.floor,h,m,d,l,g,p,f,n,q,e,v,w,x,r,u,z,y,A=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(A,b.Control);A.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));m=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(m);a.changeScrollPosition();a.prePos=a.pos;h.setVariable(a.id,a.value)};A.prototype.initScroll=function(c){a=this;h=a.evaluator;a.label.innerHTML=h.eval(a.name).toString();z=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=""==z?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;""==z&&(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};A.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);(y=a.label_color.getColor())&&/CanvasGradient|CanvasPattern/.test(y.constructor.name)&&(a.label_ctx.fillStyle=y,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)};A.prototype.draw=function(){a=this;l=a.ctx;p=c(a.w);g=c(a.h);l.fillStyle=a.color.getColor();l.fillRect(0,0,p,g);l.fillStyle="black";l.beginPath();"h"===a.orientation?(l.lineWidth=1,l.strokeStyle="rgba(0,0,0,0.3)",l.strokeRect(parseInt(a.labelWidth)+.5,.5,p-1-parseInt(a.labelWidth),g-1),l.lineWidth=Math.ceil(12*a.upWidth/100)||1,l.strokeStyle=
a.colorInt.getColor(),l.moveTo(a.downX+62.215*a.upWidth/100,20*a.downH/100),l.lineTo(a.downX+32.449*a.upWidth/100,a.downH/2),l.lineTo(a.downX+62.215*a.upWidth/100,80*a.downH/100),l.moveTo(a.upX+32.449*a.upWidth/100,20*a.downH/100),l.lineTo(a.upX+62.215*a.upWidth/100,a.downH/2),l.lineTo(a.upX+32.449*a.upWidth/100,80*a.downH/100),l.stroke(),n=c(a.pos),f=Math.ceil(g/10)||1,l.fillStyle=a.colorInt.getColor(),l.fillRect(n+.5,f,c(a.handlerW),g-2*f)):(l.lineWidth=1,l.strokeStyle="rgba(0,0,0,0.3)",l.strokeRect(.5,
.5,p-1,g-parseInt(a.labelHeight)-.5),l.lineWidth=Math.ceil(12*a.upWidth/100)||1,l.strokeStyle=a.colorInt.getColor(),l.moveTo(20*a.upWidth/100,a.h-a.labelHeight-70*a.downH/100),l.lineTo(50*a.upWidth/100,a.h-a.labelHeight-40.237*a.downH/100),l.lineTo(80*a.upWidth/100,a.h-a.labelHeight-70*a.downH/100),l.moveTo(20*a.upWidth/100,a.upY+70*a.downH/100),l.lineTo(50*a.upWidth/100,a.upY+40.237*a.downH/100),l.lineTo(80*a.upWidth/100,a.upY+70*a.downH/100),l.stroke(),n=c(a.pos),f=Math.ceil(p/10)||1,l.fillStyle=
a.colorInt.getColor(),l.fillRect(f,n+.5,p-2*f,c(a.handlerH)));a.activeIfValue||(l.fillStyle="rgba(255,255,255,0.5)",l.fillRect(0,0,l.canvas.width,l.canvas.height))};A.prototype.validateValue=function(b){a=this;h=a.evaluator;q=b.toString();q=parseFloat(q.replace(a.parent.decimal_symbol,"."));isNaN(q)&&(q=0);a.minimo=h.eval(a.min);q<a.minimo&&(a.value=null,q=a.minimo);a.maximo=h.eval(a.max);q>a.maximo&&(a.value=null,q=a.maximo);e=a.incr;q=0!=e?q*e/e:0;a.fixed&&(q=parseFloat(parseFloat(q).toFixed(h.eval(a.decimals))));
return q};A.prototype.increase=function(){this.changeValue(parseFloat(this.value)+this.incr)};A.prototype.decrease=function(){this.changeValue(parseFloat(this.value)-this.incr)};A.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)};A.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)};A.prototype.changeValue=function(b){a=this;a.activeIfValue&&(v=a.validateValue(b),v!=a.value&&(a.value=v,a.field.value=a.formatValue(v),a.changeScrollPosition(),a.prePos=a.pos,a.evaluator.setVariable(a.id,a.value)),a.updateAndExecAction())};A.prototype.changeValueMovement=function(){h=this.evaluator;w=this.limInf;x=this.limSup;r=h.eval(this.min);u=h.eval(this.max);
e=this.incr;v=c((this.pos-w)*(u-r)/(x-w)/e)*e+r;v!=this.value&&(this.value=v,this.field.value=this.formatValue(v),h.setVariable(this.id,this.value),this.parent.updateControls(),this.actionExec.execute(),this.parent.update())};A.prototype.changeScrollPosition=function(){a=this;h=a.evaluator;w=a.limInf;x=a.limSup;r=h.eval(a.min);u=h.eval(a.max);e=a.incr;a.pos=(a.value-r)*(x-w)/(u-r)+w;a.handler.style["h"==a.orientation?"left":"top"]=a.pos+"px"};A.prototype.addEvents=function(){function a(c,d,e,f){b.clearTimeout(v);
(p.up||p.down||p.canvasClick)&&1E-7<Math.abs(p.value-f)&&(d.call(p),c=e?c:30,v=b.setTimeout(function(){a(c,d,!1,f)},c))}function c(c){c.preventDefault();p.whichBtn=b.whichBtn(c);"L"==p.whichBtn&&p.activeIfValue&&(p.clickPos=b.getCursorPosition(c,p.container),p.canvasClick=!0,"h"==p.orientation?p.clickPos.x<p.prePos?a(350,p.decrease10,!0,p.minimo):a(350,p.increase10,!0,p.maximo):p.clickPos.y<p.prePos?a(350,p.increase10,!0,p.maximo):a(350,p.decrease10,!0,p.minimo))}function d(a){p.canvasClick=!1;b.clearTimeout(v)}
function e(a){1==p.canvasClick&&(p.clickPos=b.getCursorPosition(a,p.container),a.preventDefault())}function f(a){p.scrollClick=!1;p.prePos=p.pos;window.removeEventListener("mouseup",f,!1);window.removeEventListener("mousemove",l,!1);a.preventDefault()}function g(a){p.scrollClick=!1;p.prePos=p.pos;window.removeEventListener("touchend",g,!1);window.removeEventListener("touchmove",l,!1);a.preventDefault()}function l(a){var c=b.getCursorPosition(a,p.container);"h"==p.orientation?(p.pos=p.prePos-(p.initPos.x-
c.x),p.pos<p.limInf&&(p.pos=p.limInf),p.pos>p.limSup&&(p.pos=p.limSup),p.handler.setAttribute("style","width:"+p.handlerW+"px;height:"+p.h+"px;left:"+p.pos+"px;top:0;")):(p.pos=p.prePos-(p.initPos.y-c.y),p.pos>p.limInf&&(p.pos=p.limInf),p.pos<p.limSup&&(p.pos=p.limSup),p.handler.setAttribute("style","width:"+p.w+"px;height:"+p.handlerH+"px;left:0;top:"+p.pos+"px;"));p.changeValueMovement();a.preventDefault()}function n(c){c.preventDefault();p.whichBtn=b.whichBtn(c);"L"==p.whichBtn&&p.activeIfValue&&
(p.up=!0,a(350,p.increase,!0,p.maximo))}function h(c){c.preventDefault();p.whichBtn=b.whichBtn(c);"L"==p.whichBtn&&p.activeIfValue&&(p.down=!0,a(350,p.decrease,!0,p.minimo))}function q(a){p.down=!1;b.clearTimeout(v);a.preventDefault()}function m(a){p.up=!1;b.clearTimeout(v);p.draw()}function r(a){p.down=!1;b.clearTimeout(v);p.draw()}var p=this,v;p.field.addEventListener("keydown",function(a){13==a.keyCode&&p.changeValue(p.field.value)});p.field.addEventListener("blur",function(a){p.drawIfValue&&p.changeValue(p.field.value,
!0)});p.canvas.addEventListener("touchstart",c);p.canvas.addEventListener("mousedown",c);p.divDown.addEventListener("mouseout",q);window.addEventListener("touchend",d);window.addEventListener("mouseup",d);p.canvas.addEventListener("touchmove",e);p.canvas.addEventListener("mousemove",e);p.handler.addEventListener("touchstart",function(a){p.activeIfValue&&(p.scrollClick=!0,p.initPos=b.getCursorPosition(a,p.container),window.addEventListener("touchend",g),window.addEventListener("touchmove",l),a.preventDefault())});
p.handler.addEventListener("mousedown",function(a){p.activeIfValue&&(p.scrollClick=!0,p.initPos=b.getCursorPosition(a,p.container),window.addEventListener("mouseup",f),window.addEventListener("mousemove",l),a.preventDefault())});p.divUp.addEventListener("touchstart",n);p.divUp.addEventListener("mousedown",n);p.divDown.addEventListener("touchstart",h);p.divDown.addEventListener("mousedown",h);p.divUp.addEventListener("mouseout",function(a){p.up=!1;b.clearTimeout(v);a.preventDefault()});p.divDown.addEventListener("mouseout",
q);window.addEventListener("touchend",m);window.addEventListener("mouseup",m);window.addEventListener("touchend",r);window.addEventListener("mouseup",r);p.cover.addEventListener("click",function(a){a=p.evaluator.eval(p.kbexp);p.activeIfValue&&p.parent.keyboard.show(p,p.kblayout,a[0][0]||0,a[0][1]||0,p.id,p.field,p.onlyText)})};b.Scrollbar=A;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c=Math.floor,h,m,d,l,g,p,f,n,q,e,v=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(v,b.Control);v.prototype.init=function(){a=this;h=a.evaluator;a.value=a.validateValue(h.eval(a.valueExpr));m=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(m);a.changeSliderPosition();a.prePos=a.pos;h.setVariable(a.id,a.value)};
v.prototype.initSlider=function(c){a=this;h=a.evaluator;a.label.innerHTML=h.eval(a.name).toString();q=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=""==q?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;""==q&&(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};v.prototype.update=function(){h=this.evaluator;this.activeIfValue=0<h.eval(this.activeif);this.drawIfValue=0<h.eval(this.drawif);this.field.disabled=!this.activeIfValue;
this.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)};v.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};v.prototype.validateValue=function(b){a=this;h=a.evaluator;l=b.toString();l=
parseFloat(l.replace(a.parent.decimal_symbol,"."));isNaN(l)&&(l=0);a.minimo=h.eval(a.min);l<a.minimo&&(a.value=null,l=a.minimo);a.maximo=h.eval(a.max);l>a.maximo&&(a.value=null,l=a.maximo);g=h.eval(a.incr);l=0!=g?l*g/g:0;a.fixed&&(l=parseFloat(parseFloat(l).toFixed(h.eval(a.decimals))));return l};v.prototype.changeValue=function(b){a=this;a.activeIfValue&&(p=a.validateValue(b),p!=a.value&&(a.value=p,a.field.value=a.formatValue(p),a.changeSliderPosition(),a.prePos=a.pos,a.evaluator.setVariable(a.id,
a.value)),a.updateAndExecAction())};v.prototype.changeValueForSliderMovement=function(){h=this.evaluator;f=h.eval(this.min);n=h.eval(this.max);g=h.eval(this.incr);p=c(this.pos*(n-f)/100/g)*g+f;p!=this.value&&(this.value=p,this.field.value=this.formatValue(p),h.setVariable(this.id,this.value),this.parent.updateControls(),this.actionExec.execute(),this.parent.update())};v.prototype.changeSliderPosition=function(){h=this.evaluator;f=h.eval(this.min);n=h.eval(this.max);g=h.eval(this.incr);this.pos=100*
(this.value-f)/(n-f)};v.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=v;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,m=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(p){}return 0});d.evaluator.setFunction(d.id+".pause",function(){try{d.audio.pause()}catch(p){}return 0});d.evaluator.setFunction(d.id+".stop",function(){try{d.audio.pause(),d.audio.currentTime=0}catch(p){}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(m,b.Control);m.prototype.init=function(){this.audio.style.left=this.x+"px";this.audio.style.top=this.y+"px";this.update()};m.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=m;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,m=function(d,l){a=d=b.Control.call(this,d,l)||this;a.controls=l.controls||!0;a.file=l.file||"";a.oldDrawIf=0;c=a.evaluator;l=c.eval(a.expresion)[0];4==l.length?(a.w=l[2],a.h=l[3]):(a.w=null,a.h=null);l=a.file;var g=l.lastIndexOf(".");-1!=g&&(l=a.file.substring(0,g));a.video=b.newHTML("video",{poster:l+".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:l+".mp4",type:"video/mp4"}),a.video.appendChild(g));a.video.canPlayType("video/ogg")&&(g=b.newHTML("source",{src:l+".ogg",type:"video/ogg"}),a.video.appendChild(g),g=b.newHTML("source",{src:l+".ogv",type:"video/ogg"}),a.video.appendChild(g));a.video.canPlayType("video/webm")&&
(g=b.newHTML("source",{src:l+".webm",type:"video/webm"}),a.video.appendChild(g));a.addControlContainer(a.video);c.setFunction(a.id+".play",function(){try{a.video.play()}catch(p){}return 0});c.setFunction(a.id+".pause",function(){try{a.video.pause()}catch(p){}return 0});c.setFunction(a.id+".stop",function(){try{a.video.pause(),a.video.currentTime=0}catch(p){}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(m,b.Control);m.prototype.init=function(){this.video.style.left=this.x+"px";this.video.style.top=this.y+"px";this.update()};m.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=m;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,m,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"));m=a.textArea.value||"";m="\n"===m.charAt(m.length-1)?m.substring(0,m.length-1):m;m=m.replace(/\n/g,"\\n").replace(/\s/g," ");c.setVariable(a.id,
m);a.oldFieldValue=m;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,m,d,l,g,p,f,n,q,e,v,w,x=function(c,d){var f=b.Control.call(this,c,d)||this;m=c.evaluator.parser;a=f;a.spaceID=d.spaceID||"";a.text=d.text||"";a.size=d.size||m.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=m.parse(a.constraintExpr);"(expr)"==a.constraint.type&&(a.constraint=m.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(x,b.Control);x.prototype.init=function(c){a=this;h=a.evaluator;v=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=v&&48>a.width?48:a.width,a._h=v&&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()};x.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);l=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(l-a._h/2)+"px";a.constraint&&a.evalConst();a.draw()};x.prototype.draw=function(){a=
this;h=a.evaluator;a.drawIfValue&&(n=a.ctx,q=a.space.backgroundCtx,d=parseInt(a.space.getAbsoluteX(this.x))+.5,l=parseInt(a.space.getAbsoluteY(this.y))+.5,""!=a.text&&a.drawText(d,l),a.image.ready?(g=a.image.width/2,p=a.image.height/2,a.image.complete&&!a.setImage&&n.drawImage(a.image,parseInt(d-g),parseInt(l-p)),a.trace&&(q.save(),q.translate(d,l),q.scale(parseInt(g),parseInt(p)),q.beginPath(),q.arc(0,0,1,0,c),q.restore(),q.lineWidth=1,q.strokeStyle=a.trace.getColor(),q.stroke())):(g=parseInt(a.width/
2),n.beginPath(),n.arc(d,l,g,0,c),n.fillStyle=a.colorInt.getColor(),n.fill(),n.lineWidth=1,n.strokeStyle=a.color.getColor(),n.stroke(),a.active&&(n.strokeStyle=a.colorInt.borderColor(),n.beginPath(),n.arc(d,l,g-2,0,c),n.stroke()),a.trace&&(q.strokeStyle=a.trace.getColor(),q.beginPath(),q.arc(d,l,g,0,c),q.stroke())))};x.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)};x.prototype.evalConstXoY=function(){h=this.evaluator;w=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,w)};x.prototype.drawText=function(b,c){a=this;h=a.evaluator;n=a.ctx;n.fillStyle=a.color.getColor();n.textBaseline="alphabetic";"simpleText"==a.text.type?(n.font=a.font,n.fillText(a.text.toString(h.eval(a.decimals),a.fixed),
parseInt(b+1+a.width/2),parseInt(c-1-a.height/2))):(n.strokeStyle=a.color.getColor(),a.text.draw(n,parseInt(b+1+a.width/2),parseInt(c-1-a.height/2),a.decimals,a.fixed,"start",!0,a.color.getColor()))};x.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};
x.prototype.deactivate=function(){this.active=!1;this.evaluator.setVariable(this.activoStr,0);this.evaluator.setVariable(this.activeStr,0);this.evaluator.setVariable(this.mClicIzq,0)};x.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=x;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,m,d,l,g,p,f,n,q,e,v,w,x,r,u,z,y,A=function(a){this.parent=a;this.parser=a.evaluator.parser;this.RTFparser=new b.RTFParser(a.evaluator)};A.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(l=b[e][0],g=b[e][1],d=a[l],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: <"+l+"> valor: <"+g+">")}return c};A.prototype.parseSpace=function(c){p={};c=this.split(c);for(var e=0,f=c.length;e<f;e++)switch(l=c[e][0],g=c[e][1],d=a[l],b.DEBUG.paramName=l,b.DEBUG.objectName="Space",d){case "info":break;case "type":if("R2"===g||"R3"===g)g=a[g];p[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":p[d]=
g;break;case "fixed":case "numbers":case "sensitive_to_mouse_movements":case "3D":case "split":case "resizable":p[d]="true"===a[g];break;case "bg_display":case "render":p[d]=a[g];break;case "border_color":case "net":case "net10":case "axes":case "text":p[d]="";""!=g&&(p[d]="false"===a[g]?"":new b.Color(g,this.parent.evaluator));break;case "O.x":p.OxExpr=g;break;case "O.y":p.OyExpr=g;break;case "image":p.imageSrc=g;break;case "x":case "y":m=g.trim();var n="x"===d?this.parent.container.width:this.parent.container.height;
"%"===m[m.length-1]?(p[d+"PercentExpr"]=m,m=(n*parseFloat(m)/100).toString()):m=g.trim();p[d+"Expr"]=this.parser.parse(m);break;case "width":case "height":m=g.trim();p[d[0]+"ModExpr"]=m;"%"===m[m.length-1]?(p[d[0]+"Expr"]=m,m=this.parent.container[d]*parseFloat(m)/100):(m=parseFloat(g),m!=g&&(m=this.parent.container[d],p["_"+d[0]+"_"]=g.trim()));p[d[0]]=m;break;case "drawif":""!=g&&(p[d]=this.parser.parse(g));break;case "scale":m=parseFloat(g);isNaN(m)&&(m=48);p[d]=m;break;case "background":p[d]=
new b.Color(g,this.parent.evaluator);break;default:console.warn("Propiedad del espacio no identificada: <"+l+"> valor: <"+g+">")}return new b["Space"+p.type](this.parent,p)};A.prototype.parseControl=function(e){f={type:"Numeric",gui:"Spinner"};e=this.split(e);for(var n=0,h=e.length;n<h;n++)switch(l=e[n][0],g=e[n][1],d=a[l],b.DEBUG.paramName=l,b.DEBUG.objectName="Control",d){case "info":break;case "type":m=a[g.trim()];"graphic"===m?m="GraphicControl":"text"===m&&(m="TextArea");f[d]=c(m);break;case "gui":m=
a[g];"textfield"===m&&(m="TextField");f[d]=c(m);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 q=g.replace(/&squot;/g,"'").replace(/^\|(.*)\|$/,"'$1'");f.valueExpr=this.parser.parse(q);f.valueExprString=q;break;case "incr":0!=g&&(f[d]=this.parser.parse(g));break;case "exponentialif":f[d]=parseFloat(g);break;case "text":f.rawText=g;q=this.parseText(g);for(var r=0,p=q.length;r<
p;r++)q[r]=this.parser.parse(q[r],!1);f[d]=q;break;default:q=l.indexOf("."),r=a[l.substring(0,q)],"font"===a[l.substring(q+1)]&&/parameter|Explanation|tooltip/.test(r)?f[r+"Font"]=g:console.warn("Propiedad de control no identificada: <"+l+"> valor: <"+g+">")}return new b["Numeric"===f.type?f.gui:f.type](this.parent,f)};A.prototype.parseGraphic=function(e,f,q,m){n={rotateExp:m,parameter:"t"};e=this.split(e);m=0;for(var r=e.length;m<r;m++)if(l=e[m][0],g=e[m][1],d=a[l],b.DEBUG.paramName=l,b.DEBUG.objectName=
"Graphic",""!=g)switch(d){case "info":break;case "type":b.DEBUG.idName=g;n[d]=c(a[g]);break;case "align":case "anchor":case "lineDash":n[d]=a[g];break;case "background":case "abs_coord":case "visible":case "editable":case "fixed":case "vectors":case "bold":case "italics":case "underlined":n[d]="true"===a[g];break;case "shadowColor":case "color":case "fill":case "fillP":case "fillM":case "arrow":case "trace":n[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":n[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&&(n[d]=this.parser.parse(g));break;case "font_size":g=g.trim();/^\[.*\]$/.test(g)&&(g=g.slice(1,-1));""!==g&&(n[d]=this.parser.parse(g));break;case "space":n[d+"ID"]=g;break;case "expresion":""!==g&&("Macro"!==n.type?(n[d]=this.parser.parse(g),n.expresionString=g):n[d]=g);break;case "text":n[d]=g;break;
case "file":var p=g.replace(/&squot;/g,"'").trim();/^\[.*\]$/.test(p)&&(p=p.slice(1,-1));p.match(h)&&(p="'"+p+"'");p.startsWith("data:image/")?n[d]=this.parser.parse("'"+p+"'"):n[d]=this.parser.parse(p);break;case "border":""!=g&&"false"!=a[g]&&(n[d]=new b.Color(g,this.parent.evaluator));break;default:if(void 0!=n.family&&(p=n.family.length+1,l.substring(0,p)===n.family+".")){p=a[l.substring(p)];/interval|steps/.test(p)&&""!=g&&(n["family_"+p]=this.parser.parse(g));break}void 0!=n.parameter&&l.match(n.parameter+
".")?(p=l.substring(0,l.indexOf(n.parameter)+n.parameter.length),n.parameter!==p&&(n.parameter=p),p=a[l.substring(n.parameter.length+1)],/interval|steps/.test(p)&&""!=g&&(n["parameter_"+p]=this.parser.parse(g))):console.warn("Propiedad del gr\u00e1fico no identificada: <"+l+"> valor: <"+g+">")}f&&(n.abs_coord=f);q&&(n.background=q);return new b[n.type](this.parent,n)};A.prototype.parse3DGraphic=function(e,f,h,q){n={rotateExp:q,parameter:"t"};e=this.split(e);f=0;for(h=e.length;f<h;f++)switch(l=e[f][0],
g=e[f][1],d=a[l],b.DEBUG.paramName=l,b.DEBUG.objectName="Graphic3D",d){case "info":break;case "type":b.DEBUG.idName=g;m=a[g];n[d]=c(m);break;case "model":case "align":case "anchor":case "lineDash":n[d]=a[g];break;case "shadowColor":case "fill":n[d]="false"===a[g]?"":new b.Color(g,this.parent.evaluator);break;case "background":case "fixed":case "split":case "bold":case "italics":case "underlined":n[d]="true"===a[g];break;case "edges":"false"===a[g]?n[d]="":("true"===a[g]&&(g="808080"),n[d]=new b.Color(g,
this.parent.evaluator));break;case "border":""!=g&&"false"!=a[g]&&(n.border=new b.Color(g,this.parent.evaluator));break;case "color":case "backcolor":n[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&&(n[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":n[d]=
g;break;case "space":n[d+"ID"]=g;break;case "expresion":/Macro|Curve|Surface/.test(n.type)?n[d]=g.replace(/\\n/g,";"):(n[d]=this.parser.parse(g),n.expresionString=g);break;case "text":n.text=g;break;case "file":q=g.replace(/&squot;/g,"'").trim();/^\[.*\]$/.test(q)&&(q=q.slice(1,-1));/./.test(q)&&(q="'"+q+"'");n[d]=this.parser.parse(q);break;default:if(void 0!=n.family&&(q=n.family.length+1,l.substring(0,q)===n.family+".")){q=a[l.substring(q)];/interval|steps/.test(q)&&""!=g&&(n["family_"+q]=this.parser.parse(g));
break}console.warn("Propiedad del gr\u00e1fico 3D no identificada: <"+l+"> valor: <"+g+">")}return new b[n.type+"3D"](this.parent,n)};A.prototype.parseAuxiliar=function(c){q={};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(l=c[e][0],g=c[e][1],d=a[l],b.DEBUG.paramName=l,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":q[d]=
g.replace(/&squot;/g,"'");break;case "editable":case "constant":case "array":case "matrix":case "algorithm":case "event":case "sequence":q[d]="true"===a[g];break;case "size":case "rows":case "columns":case "x":case "y":case "width":case "height":q[d]=this.parser.parse(g);break;case "evaluate":case "execution":case "msg_pos":case "action":case "type":q[d]=a[g];break;default:var n=l.indexOf("."),h=a[l.substring(0,n)];n=a[l.substring(n+1)];"parameter"===h&&"font"===n?q[h+"Font"]=g:console.warn("Propiedad del auxiliar no identificada: <"+
l+"> valor: <"+g+">")}q.sequence?q.type="sequence":q.constant?q.type="constant":q.algorithm&&q.evaluate?q.type="algorithm":q.array&&!q.matrix&&")"!=q.id.charAt(q.id.length-1)?q.type="vector":q.matrix&&")"!=q.id.charAt(q.id.length-1)?q.type="matrix":q.event&&")"!=q.id.charAt(q.id.length-1)?q.type="event":"library"===q.type?q.type="library":")"===q.id.charAt(q.id.length-1)?q.type="function":q.type="variable";b.DEBUG.typeName=q.type;switch(q.type){case "sequence":new b.Function(this.parent,q);break;
case "constant":c=new b.Constant(this.parent,q);q.evaluate&&"always"===q.evaluate&&this.parent.auxiliaries.push(c);break;case "algorithm":this.parent.auxiliaries.push(new b.Algorithm(this.parent,q));break;case "vector":c=new b.Vector(this.parent,q);q.evaluate&&"always"===q.evaluate&&this.parent.auxiliaries.push(c);break;case "matrix":c=new b.Matrix(this.parent,q);q.evaluate&&"always"===q.evaluate&&this.parent.auxiliaries.push(c);break;case "event":this.parent.events.push(new b.Event(this.parent,q));
break;case "library":new b.Library(this.parent,q);break;case "variable":new b.Variable(this.parent,q);break;default:new b.Function(this.parent,q)}};A.prototype.parseAction=function(a){return a.action?new (b[c(a.action)])(a.parent,a.parameter):{execute:function(){}}};A.prototype.parseAnimation=function(c){var e={};c=this.split(c);for(var f=0,n=c.length;f<n;f++)switch(l=c[f][0],g=c[f][1],d=a[l],b.DEBUG.pName=l,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: <"+l+"> valor: <"+g+">")}return new b.Animation(this.parent,e)};A.prototype.split=function(a){if("string"!==typeof a)return[];e=[];a=(a||"").replace(/\\'/g,"\u2019");v=w=r=0;for(x=u=!1;v<a.length;)" "!==a[v]||x||v++," "===a[v]||x||(x=!0,r=v),"="!==a[v]||"'"!==a[v+1]||u||(u=!0,e[w]=[a.substring(r,v)],
r=v+2,v+=2),u&&"'"===a[v]&&(x=u=!1,e[w].push(a.substring(r,v)),w++),"="!==a[v]||"'"===a[v+1]||u||(e[w]=[a.substring(r,v)],r=v+1,v++,z=a.substring(v).indexOf("="),-1===z?z=y=a.length:(z+=v,y=a.substring(v,z).lastIndexOf(" "),y=-1===y?a.length:y+v),e[w].push(a.substring(r,y)),w++,x=!1,v=y),v++;return e};A.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=A;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 m(a){try{var b=a.getVector(this.value,this.childs[0].childs[0].evaluate(a));return void 0!==b?b:0}catch(ba){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(ba){return 0}}function l(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;X=c.rows;U=c.cols;S=L(X,U);for(T=0;T<X;T++)for(W=0;W<U;W++)S[W][T]=c[W][T]+a[W][T];return S}function p(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;X=b.rows;U=b.cols;S=L(X,U);for(T=0;T<X;T++)for(W=0;W<U;W++)S[W][T]=b[W][T]-a[W][T];return S}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:Q(b,a)}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;var c=L(a.length,a.length),d=F(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 n=0;n<f;n++)c[n][e]=g*F(O(e,n,a)),g=-g;d=-d}else c[0][0]=d;a=c}b=0===a?L(b.rows,b.cols):Q(b,a);return b}function q(a){var b=this.childs[0].evaluate(a);a=this.childs[1].evaluate(a);return b-M(b/a)*a}function e(a){var b=this.childs[0].evaluate(a);a=this.childs[1].evaluate(a);
return 0<=a?R(b,a):1/R(b,-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 x(a){return+(this.childs[0].evaluate(a)>this.childs[1].evaluate(a))}function r(a){return+(this.childs[0].evaluate(a)>=this.childs[1].evaluate(a))}function u(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 z(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){return this.childs[0].evaluate(a)?this.childs[1].evaluate(a)?1:0:0}function A(a){return this.childs[0].evaluate(a)?1:this.childs[1].evaluate(a)?1:0}function B(a){return+!this.childs[0].evaluate(a)}function D(a){return 0<this.childs[0].evaluate(a)?this.childs[1].evaluate(a):this.childs[2]?this.childs[2].evaluate(a):0}function I(a){return this.childs[0].evaluate(a)}
function E(a){return-this.childs[0].evaluate(a)}function G(a,b){return this.childs[0].evaluate(a,b)}function H(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 C(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 J(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 P(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 R(a,b){if(0==b)return 1;if(0>b)return NaN;if(0<=a||M(b)===b)return Math.pow(a,b);if(0>a){var c=1/b,d=M(c);if(d===c&&1===d%2)return-Math.pow(-a,b)}return NaN}function L(a,b){S=[];S.type="matrix";S.rows=
a;S.cols=b;T=0;for(aa=b;T<aa;T++)S[T]=Array(a).fill(0);return S}function Q(a,b){X=a.rows;U=a.cols;S=L(X,U);var c;for(T=0;T<X;T++)for(W=0;W<U;W++){for(aa=c=0;aa<U;aa++)c+=a[aa][T]*b[W][aa];S[W][T]=c}return S}function O(a,b,c){for(var d=L(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 F(a){if(1<a.cols){for(var b=0,c=1,d=0,e=a.cols;d<e;d++)b+=c*a[0][d]*F(O(0,d,a)),c=-c;return b}return a[0][0]}if(b.loadLib)return b;
var M=Math.floor,K,N,V,Z,X,U,S,W,T,aa,Y=function(a,b){this.sep="";this.type=a;this.value=b;this.parent=null;this.childs=[]};Y.prototype.getRoot=function(){return null===this.parent?this:this.parent.getRoot()};Y.prototype.addChild=function(a){a.parent=this;this.childs.push(a)};Y.prototype.replaceLastChild=function(a){N=this.childs.length-1;K=this.childs[N];K.parent=null;this.childs[N]=a;a.parent=this;return a};Y.prototype.contains=function(a){return this.value===a?!0:this.childs.some(function(b){return b.contains(a)})};
Y.prototype.equalToMinus=function(){return"compOperator"===this.type?(this.type="operator",this.value="-",Z=new Y("compOperator","=="),Z.addChild(this),Z.addChild(new Y("number","0")),V=this.getRoot(),V.setAllEvalFun(),V):this};Y.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};Y.prototype.setAllEvalFun=function(){this.setEvalFun();for(var a=$jscomp.makeIterator(this.childs),b=a.next();!b.done;b=a.next())b.value.setAllEvalFun()};Y.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=
m;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=l;else if("operator"===this.type)"+"===this.value?this.evaluate=g:"-"===this.value?this.evaluate=p:"*"===this.value?this.evaluate=f:"/"===this.value?this.evaluate=n:"%"===this.value?this.evaluate=q:"^"===this.value&&(this.evaluate=e);else if("compOperator"===this.type)"<"===this.value?this.evaluate=
v:"<="===this.value?this.evaluate=w:">"===this.value?this.evaluate=x:">="===this.value?this.evaluate=r:"=="===this.value?this.evaluate=u:"!="===this.value&&(this.evaluate=z);else if("boolOperator"===this.type)"&"===this.value?this.evaluate=y:"|"===this.value?this.evaluate=A:"!"===this.value&&(this.evaluate=B);else if("conditional"===this.type)this.evaluate=D;else if("sign"===this.type)this.evaluate="sign+"===this.value?I:E;else if("parentheses"===this.type)this.evaluate=G;else if("(expr)"===this.type||
"[expr]"===this.type)this.evaluate=H;else if("assign"===this.type){var b=this.childs[0],T=b.childs[0]?b.childs[0].childs:null;this.evaluate=1===b.childs.length&&"square_bracket"===b.childs[0].type&&1===T.length?C:1===b.childs.length&&"square_bracket"===b.childs[0].type&&2===T.length?J:P}};b.Node=Y;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,m,d,l,g,p,f=/^\s+/,n=/^[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]*)*/,q=/^([0-9]+[.][0-9]+|[.][0-9]+|[0-9]+)/,e=/^(==|!=|<=|<|>=|>|#)/,v=/^(!|~|&&|&|\|\||\|)/,w=/^(=|:=)/,x=/^[\?:]/,r=/^[\+\-\*\/%\^\u2212\u00b7\u00D7\u00F7]/,u=/^(\[|\])/,z=/^(\(|\))/,y=/^,/,A=/^;/,B=/\|/g,D=/\|\*/g,I=/\*\|/g,E=/^\/\//g,G=/:\/\//g,H,C=/rnd|pi|e|Infinity|-Infinity|sqr|sqrt|ra\u00edz|exp|log|log10|abs|ent|sgn|ind|sin|sen|cos|tan|cot|sec|csc|sinh|senh|cosh|tanh|coth|sech|csch|asin|asen|acos|atan|min|max/,
J=function(){};J.prototype.tokenize=function(C){function H(a,b,d){c.push({type:a,value:b});l=l.slice(d);m+=d;p=a}if(a=C){C=C.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()");C.match(/=\|\*/g)&&(C=C.replace(D,"'").replace(I,"'"));C.match(/=\|/g)&&(C=C.replace(B,"'"));var J=C.trim();"|"==J[0]&&"|"==J[J.length-1]&&(C=J.replace(B,"'"))}c=[];h=!1;m=0;l=C;for(p="";C&&
m<C.length;)if(h=m,"'"==l[0]){for(g=1;"'"!=l[g];)if(g<l.length)g++;else return;d=l.substring(1,g);H("string",d,d.length+2)}else{if(d=l.match(E))if(l.match(G))continue;else{m=2*C.length;break}if(d=l.match(f))l=l.slice(d[0].length),m+=d[0].length;else if(d=l.match(r))d[0]=d[0].replace(/\u00F7/g,"/").replace(/\u2212/g,"-").replace(/\u00b7/g,"*").replace(/\u00D7/g,"*"),H("operator",d[0],d[0].length);else if(d=l.match(n))"number"===p&&c.push({type:"operator",value:"*"}),H("identifier",d[0],d[0].length);
else if(d=l.match(q))H("number",d[0],d[0].length);else if(d=l.match(e))J=d[0],"#"==J&&(J="!="),H("compOperator",J,d[0].length);else if(d=l.match(v))J=d[0],"||"==J?J="|":"&&"==J?J="&":"~"==J&&(J="!"),H("boolOperator",J,d[0].length);else if((d=l.match(w))&&!/^==/.test(l))H("assign",d[0],d[0].length);else if(d=l.match(x))H("conditional",d[0],d[0].length);else if(d=l.match(u))H("square_bracket",d[0],d[0].length);else if(d=l.match(z))"("==d&&"number"===p&&c.push({type:"operator",value:"*"}),H("parentheses",
d[0],d[0].length);else if(d=l.match(y))H("separator",d[0],d[0].length);else if(178===l.charCodeAt(0))c.push({type:"operator",value:"^"}),H("number",2,1);else if(179===l.charCodeAt(0))c.push({type:"operator",value:"^"}),H("number",3,1);else if(d=l.match(A))H("final_of_expression",d[0],d[0].length);else if(h==m){b.DEBUG.setError(b.DEBUG.EXPRESSION,a);return}}return c};J.prototype.flatTokens=function(a,b){a=void 0===a?[]:a;b=void 0===b?"":b;H="";a=$jscomp.makeIterator(a);for(var c=a.next();!c.done;c=
a.next())c=c.value,H="string"==c.type?H+("&squot;"+c.value+"&squot;"):"identifier"!=c.type||C.test(c.value)?H+c.value:H+(b+c.value);return H};b.Tokenizer=J;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 m,d,l,g,p,f,n,q,e,v,w=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()};w.prototype.parse=function(c,r){(m=this.tokenizer.tokenize(c))||(m=[]);d=null;r=!r||!1;for(var w=f=p=g=0,x=m.length;w<x;w++){n=m[w];q=n.value;e=n.type;if("identifier"===e)if(m[w+1]&&"parentheses"===m[w+1].type&&"("===m[w+1].value)this.functions.hasOwnProperty(q)||
(this.functions[q]=function(){return 0});else if(m[w+1]&&"square_bracket"===m[w+1].type&&"["===m[w+1].value)m[w+3]&&"square_bracket"===m[w+3].type&&"]"===m[w+3].value?this.vectors.hasOwnProperty(q)||(this.vectors[q]=[0,0,0]):this.matrices.hasOwnProperty(q)||(this.matrices[q]=[[0,0,0],[0,0,0],[0,0,0]]);else{var y=q.match(/(\w*)(\.mouse_x|\.mouse_y|\.mouse_pressed|\.mouse_clicked|\.clic_izquierdo)$/);y&&(this.variables[y[1]+".DJS_NO_FIXED"]=1)}"assign"===e&&r&&":="!=q&&(e="compOperator",q="==");if("assign"===
e)if(l=new b.Node(e,q),null!=d){r=!0;if("identifier"===d.type)d.parent&&d.parent.replaceLastChild(l),l.addChild(d);else if("square_bracket"===d.type)l.addChild(d.parent);else{l.type="compOperator";for(l.value="==";d.parent&&a(d.parent.value)>=a(l.value);)d=d.parent;d.parent&&d.parent.replaceLastChild(l);l.addChild(d)}d=l}else{h(1,c,q,e);break}else if("parentheses"===e&&"("===q||"square_bracket"===e&&"["===q)if(l=new b.Node(e,q),"("===q&&g++,"["===q&&p++,null===d)"("===q&&(new b.Node("(expr)","(expr)")).addChild(l),
"["===q&&(new b.Node("[expr]","[expr]")).addChild(l),d=l;else if("operator"===d.type||"boolOperator"===d.type||"compOperator"===d.type||"conditional"===d.type||"assign"===d.type)d.addChild(l),d=l;else if("sign"===d.type)d.addChild(l),d=l;else if("parentheses"===d.type&&"("===d.value)d.addChild(l),d=l;else if("square_bracket"===d.type&&"["===d.value)d.addChild(l),d=l;else if("parentheses"===d.type&&"()"===d.value)d.parent.addChild(l),d=l;else if("square_bracket"===d.type&&"[]"===d.value)d.parent.addChild(l),
d=l;else if("identifier"===d.type)d.addChild(l),d=l;else{h(2,c,q,e);break}else if("parentheses"===e&&")"===q)if(g--,null===d)h(3,c,q,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,q,e);break}}else if("square_bracket"===e&&"]"===q)if(p--,null===d)h(5,c,q,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,q,e);break}}else if("number"===
e||"string"===e||"identifier"===e)if(l=new b.Node(e,q),null===d)d=l;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(l),d=l;else break;else if("operator"===e||"compOperator"===e||"boolOperator"===e)if(l=new b.Node(e,q),null===d)if("-"===q||"+"===q)l.type="sign",l.value="sign"+q,d=l;else if("!"===q)d=l;else{h(8,c,q,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&&("-"===q||"+"===q||"!"===q)||"parentheses"===d.type&&"("===d.value&&("-"===q||"+"===q||"!"===q)){if("-"===q||"+"===q)l.type="sign",l.value="sign"+q;d.addChild(l);d=l}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(l.value);)d=d.parent;d.parent&&d.parent.replaceLastChild(l);l.addChild(d);d=l}else{h(9,c,q,e);break}else if("conditional"===e)if(l=new b.Node(e,q),null!=d)if("?"===l.value){for(f++;d.parent&&a(d.parent.value)>a(l.value);)d=d.parent;d.parent&&d.parent.replaceLastChild(l);l.addChild(d);d=l}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,q,e);break}}else{h(11,c,q,e);break}else if("separator"===
e)if(null!=d)for(;d.parent&&"("!=d.value&&"["!=d.value;)d=d.parent;else{h(12,c,q,e);break}else{h(13,c,q,e);break}}0<g&&b.DEBUG.setError(b.DEBUG.PARENTHESIS_CLOSING,c);0>g&&b.DEBUG.setError(b.DEBUG.PARENTHESIS_OPENING,c);0<p&&b.DEBUG.setError(b.DEBUG.BRACKET_CLOSING,c);0>p&&b.DEBUG.setError(b.DEBUG.BRACKET_OPENING,c);0!=f&&b.DEBUG.setError(b.DEBUG.INCOMPLETE_IF,c);(v=d?d.getRoot():null)&&v.setAllEvalFun();return v};w.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=[],n=0,l=0,h=a.length;l<h;l++)f=a[l],"'"===f&&(c=!c),c||";"!==f||(g.push(a.substring(n,l)),n=l+1);g.push(a.substring(n));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,n,l=0;l<f;l++){for(var h=0;h<g;h++)n=c[l][h],void 0!==n&&("string"==typeof n?n="'"+n+"'":"number"==typeof n&&(n=b.removeNeedlessDecimals(n.toFixed(6))),e+=n+(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 n=0,l=a.length;n<l;n++)a[n].match("<"+b+">")?(g=!0,f=a[n].trim().split("<"+b+">"),2==f.length&&""!=f[1]&&e.push(f[1].split(String.fromCharCode("166")).map(c)),f=!0):(a[n].match("</"+b+">")&&(f=a[n].trim().split("</"+b+">"),2==f.length&&""!=f[0]&&e.push(f[0].split(String.fromCharCode("166")).map(c)),f=!1,n=a.length),f&&e.push(a[n].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 n=0,l=a.length;n<l;n++)a[n].match("<"+b+">")?f=g=!0:(a[n].match("</"+b+">")&&(f=!1,n=a.length),f&&e.push(c(a[n])));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,n=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),n=e.replace(/\\r/g,"").replace(/\\n/g,"\r\n").replace(/\\q/g,"'").replace(/\\_/g,"\\").replace(/\\br/g,"\\n"),g=
new Blob(["\ufeff",n],{type:"text/plain;charset=utf-8"}),f.setAttribute("href",window.URL.createObjectURL(g)),f.setAttribute("download",c),n!=b.newBlobContent&&(f.click(),b.newBlobContent=n),document.body.removeChild(f));return 0};var l=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(l),n=e,l.setAttribute("href",n),l.setAttribute("download",c),n!=b.newBlobContent&&(l.click(),b.newBlobContent=
n),document.body.removeChild(l));return 0};var h,q,m=b.newHTML("input",{type:"file"});m.addEventListener("change",function(a){h=a.target.files;q=new FileReader;q.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();m.value=""};0<h.length&&q.readAsText(h[0])});d.functions._Open_=function(b){d.evaluator.parent.removeButtonClick();
1500<Date.now()-a&&(d._callback=b,m.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){a=parseInt(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=parseInt(255*(e+c));f=parseInt(255*(f+c));g=parseInt(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=w;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,l){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]=l};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,m,d,l,g,p,f,n,q,e,v,w,x,r,u=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)};u.prototype.drawText=function(e,f,n,q,p){a=this;c=a.evaluator.eval(a.decimals);h=a.evaluator.eval(a.parent.width);m=a.evaluator.eval(a.parent.font_size);d=f.getColor?f.getColor():
f;l=a.textToString(a.text,c,a.fixed).replace(/\\{/g,"\\curlyBracketOpen ").replace(/\\}/g,"\\curlyBracketClose ").replace(/\\\[/g,"\\squareBracketOpen ").replace(/\\\]/g,"\\squareBracketClose ");0<=l.indexOf("[")&&(l=a.textToString(a.parseSimpleText(l),c,a.fixed));if(a.oldTextStr!==l||a.oldWidth!==h||a.oldSize!==m||a.oldColor!==d||a.oldPosX!==n||a.oldPoxY!==q)g=new b.TextStyle({size:m,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(l,a.evaluator,g),a.textNodes.update(n,q,c,a.fixed,a.align,a.anchor,d,h);p||a.textNodes.draw(e);a.oldTextStr=l;a.oldWidth=h;a.oldSize=m;a.oldColor=d;a.oldPosX=n;a.oldPoxY=q};u.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)};u.prototype.parseSimpleText=function(a){a=a.replace("&#x2013","\u2013").replace(/&squot;/g,"'");p=[];f="'";q=n=0;e=-1;for(x=a.length;n<x;)v=a.charAt(n),w=a.charAt(n-1),"["===v&&"\\"===w?(p.push(a.substring(q,n-1)+"["),q=n+1):"]"===v&&
"\\"===w?(p.push(a.substring(q,n-1)+"]"),q=n+1):"["===v&&-1===e?(p.push(a.substring(q,n)),q=n,e++):"["===v?e++:"]"===v&&0===e?(p.push(this.evaluator.parser.parse(a.substring(q,n+1))),q=n+1,e--):("]"==a.charAt(n)&&(e=0>e?e:e-1),f+=a.charAt(n)),n++;p.push(a.substring(q,n));return p};u.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]:(r=this.evaluator.eval(a[e])[0][0],""!==r&&("string"===typeof r?f+=r:Infinity===r?f+="Infinity":
-Infinity===r?f+="-Infinity":isNaN(r)||"NaN"===r?f+="NaN":(r=parseFloat(r),r=d?r.toFixed(c):b.removeNeedlessDecimals(r.toFixed(c)),f+=r.toString().replace(".",this.decimal_symbol))));return f};b.TextObject=u;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,l=0,g=b.length;b.charAt(0);var h=!1,f=!1,n=0;a="";for(var q=0;q<g;q++){var e=b.charAt(q);var v=b.charAt(q+1);"\\"===e&&"$"===v&&(f=!0);"{"===e?n++:"}"===e&&(n--,f&&0===n&&(f=!1));f?"_"===e?"{"===v?a+="\\subindex":(a+="\\subindex{"+v+"}",q++):"^"===e?"{"===v?a+="\\superindex":(a+="\\superindex{"+v+"}",q++):a+=e:a+=e}b=a;v=b.charAt(0);for(g=b.length;l<
g;)e=v,v=b.charAt(l+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)),l++;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,m){a=this.tokenizer.tokenize(a);var c=new b.TextNode("","textBlock",m,null),l=new b.TextNode("","textLineBlock",m.clone(),null);c.addChild(l);for(var g=[],p=void 0,f=m,n=[m],q,e,v,w,x=!1,r=0,u=a.length;r<u;r++)if("text"===a[r].type)if("color_parameter"===p)e=new b.Color(a[r].value,h);else if("text_size_parameter"===p)v=parseFloat(a[r].value);else if("textLineBlock"===
l.nodeType){q=a[r].value.split(" ");for(var z=0,y=q.length;z<y;z++)""!==q[z]&&l.addChild(new b.TextNode(q[z],"text",f.clone(),null)),z+1<y&&l.addChild(new b.TextNode(" ","space",f.clone(),null))}else l.addChild(new b.TextNode(a[r].value,"text",f.clone(),null));else"command"===a[r].type&&"curlyBracketOpen"===a[r].value?l.addChild(new b.TextNode("{","text",f.clone(),null)):"command"===a[r].type&&"curlyBracketClose"===a[r].value?l.addChild(new b.TextNode("}","text",f.clone(),null)):"command"===a[r].type&&
"squareBracketOpen"===a[r].value?l.addChild(new b.TextNode("[","text",f.clone(),null)):"command"===a[r].type&&"squareBracketClose"===a[r].value?l.addChild(new b.TextNode("]","text",f.clone(),null)):"command"===a[r].type&&"newline"===a[r].value?(0===l.children.length&&l.addChild(new b.TextNode("","text",f.clone(),null)),l=new b.TextNode("","textLineBlock",m.clone(),null),c.addChild(l)):"command"===a[r].type&&"b"===a[r].value?(p="bold",g.push(p)):"command"===a[r].type&&"i"===a[r].value?(p="italic",
g.push(p)):"command"===a[r].type&&"o"===a[r].value?(p="overline",g.push(p)):"command"===a[r].type&&"u"===a[r].value?(p="underline",g.push(p)):"command"===a[r].type&&"color"===a[r].value?(p="color",g.push(p)):"command"===a[r].type&&"ts"===a[r].value?(p="text_size",g.push(p)):"command"===a[r].type&&"sansserif"===a[r].value.toLowerCase()?(p="sansserif",g.push(p)):"command"===a[r].type&&"serif"===a[r].value.toLowerCase()?(p="serif",g.push(p)):"command"===a[r].type&&"monospace"===a[r].value.toLowerCase()?
(p="monospace",g.push(p)):"command"===a[r].type&&"c"===a[r].value?(p="center",g.push(p)):"command"===a[r].type&&"l"===a[r].value?(p="left",g.push(p)):"command"===a[r].type&&"r"===a[r].value?(p="right",g.push(p)):"command"===a[r].type&&"j"===a[r].value?(p="justify",g.push(p)):"command"===a[r].type&&"$"===a[r].value?(p="formula",g.push(p),x=!0):"command"===a[r].type&&"sum"===a[r].value?(p="sum",g.push(p)):"command"===a[r].type&&"prod"===a[r].value?(p="prod",g.push(p)):"command"===a[r].type&&"int"===
a[r].value?(p="integral",g.push(p)):"command"===a[r].type&&"lim"===a[r].value?(p="limit",g.push(p)):"command"===a[r].type&&"sqrt"===a[r].value?(p="radical",g.push(p)):"command"===a[r].type&&"subindex"===a[r].value?(p="subIndex",g.push(p)):"command"===a[r].type&&"superindex"===a[r].value?(p="superIndex",g.push(p)):"command"===a[r].type&&"frac"===a[r].value?(p="numerator",g.push(p)):"open"===a[r].type&&"{"===a[r].value&&void 0!==p?"bold"===p||"italic"===p||"overline"===p||"underline"===p?(f=f.clone(),
f[p]=!0,n.push(f)):"sansserif"===p?(f=f.clone(),f.family="sansserif",n.push(f)):"serif"===p?(f=f.clone(),f.family="serif",n.push(f)):"monospace"===p?(f=f.clone(),f.family="monospaced",n.push(f)):"text_size"===p?p="text_size_parameter":"text_size_text"===p?(f=f.clone(),f.size=v,n.push(f)):"color"===p?p="color_parameter":"color_text"===p?(f=f.clone(),f.color=e,n.push(f)):"center"===p||"left"===p||"right"===p||"justify"===p?(f=f.clone(),f.align=p,n.push(f),l=new b.TextNode("","textLineBlock",f.clone(),
null),c.addChild(l)):"formula"===p?(f=f.clone(),n.push(f),w=new b.TextNode("","formula",f.clone(),null),l.addChild(w),l=w):"subIndex"===p||"superIndex"===p?x?(f=f.clone(),n.push(f),w=new b.TextNode("",p,f.clone(),null),l.addChild(w),l=w):l.addChild(new b.TextNode("subIndex"===p?"_":"^","text",f.clone(),null)):"radical"===p?x&&(w=new b.TextNode("","radical",f.clone(),null),l.addChild(w),l=w,f=f.clone(),n.push(f),w=new b.TextNode("","index",f.clone(),null),l.addChild(w),l=w,p="index"):"index"===p?x&&
(n.pop(),f=n[n.length-1],w=new b.TextNode("","radicand",f.clone(),null),l.addChild(w),l=w,p="radicand"):"sum"===p||"integral"===p||"limit"===p||"prod"===p?x&&(w=new b.TextNode("",p,f.clone(),null),l.addChild(w),l=w,f=f.clone(),n.push(f),w=new b.TextNode("","from",f.clone(),null),l.addChild(w),l=w,p="from",g[g.length-1]=p):"from"===p?x&&(w=new b.TextNode("","to",f.clone(),null),l.addChild(w),l=w,p="to",g[g.length-1]=p):"to"===p?x&&(n.pop(),f=n[n.length-1],w=new b.TextNode("","what",f.clone(),null),
l.addChild(w),l=w,p="what",g[g.length-1]=p):"numerator"===p?x&&(w=new b.TextNode("","fraction",f.clone(),null),l.addChild(w),l=w,f=f.clone(),n.push(f),w=new b.TextNode("","numerator",f.clone(),null),l.addChild(w),l=w,p="numerator"):"denominator"===p&&(w=new b.TextNode("",p,f.clone(),null),l.addChild(w),l=w):"close"===a[r].type&&"}"===a[r].value&&void 0!==p&&("bold"===p||"italic"===p||"overline"===p||"underline"===p||"color_text"===p||"color"===p||"text_size_text"===p||"text_size"===p||"sansserif"===
p||"serif"===p||"monospace"===p?(n.pop(),f=n[n.length-1],g.pop(),p=g[g.length-1]):"color_parameter"===p?p="color_text":"text_size_parameter"===p?p="text_size_text":"center"===p||"left"===p||"right"===p||"justify"===p?(n.pop(),f=n[n.length-1],g.pop(),p=g[g.length-1],a[r+1]&&"command"===a[r+1].type&&"newline"===a[r+1].value?l=c:(l=new b.TextNode("","textLineBlock",f.clone(),null),c.addChild(l))):"formula"===l.nodeType?(x=!1,n.pop(),f=n[n.length-1],g.pop(),p=g[g.length-1],l=l.parent):"subIndex"===l.nodeType||
"superIndex"===l.nodeType?x&&(n.pop(),f=n[n.length-1],g.pop(),p=g[g.length-1],l=l.parent):"index"===l.nodeType?l=l.parent:"radicand"===l.nodeType?(g.pop(),p=g[g.length-1],l=l.parent.parent):"from"===l.nodeType?l=l.parent:"to"===l.nodeType?l=l.parent:"what"===l.nodeType?(g.pop(),p=g[g.length-1],l=l.parent.parent):"numerator"===l.nodeType?(p="denominator",l=l.parent):"denominator"===l.nodeType&&(n.pop(),f=n[n.length-1],g.pop(),p=g[g.length-1],l=l.parent.parent));var A,B,D=null,I=[];c.children.forEach(function(a){for(var b=
0,c=a.children.length;b<c-1;b++)A=a.children[b],B=a.children[b+1],"text"===A.nodeType&&"text"===B.nodeType&&A.style.equals(B.style)?(null===D&&(D=A,w=A.clone(),D.changeNodeType("word"),D.value="___"+w.value,D.addChild(w)),w=B.clone(),D.addChild(w),I.push(B),D.value+=w.value):D=null});I.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((p[a].ascent+25)*c/p[a].unitsPerEm);b.descent=Math.ceil(Math.abs((p[a].descent-25)*c/p[a].unitsPerEm));b.h=b.ascent+b.descent;return b}if(b.loadLib)return b;
var h=!1,m="#000000",d=2,l=!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,p,r){d=c;l=e;m=p;this.metrics.w=this.metrics.h=0;p=b;if(20<=r)for(c=0;c<this.children.length;c++)this.children[c].breakLines(r);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=p;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<=r&&(g=c<e-1?h[c+1].value:null,h[c].metrics.offsetX=a,"wrap"===g&&h[c].justifyAux(r)),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=[],l=0,
h=this.children.length;l<h;l++)c=this.children[l],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<l&&(e=!0,f.push(c)));if(0<f.length)for(a=new g("wrap","textLineBlock",this.style.clone(),null),this.parent.insertAfter(this,a),l=0,h=f.length;l<h;l++)f[l].parent&&f[l].parent.removeChild(f[l]),a.addChild(f[l])};
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,l=0,h=e.length;l<h;l++){g=e[l];if("text"===g.nodeType){b.ctx.font=g.style.toString();var m=""!==g.value?g.value:b.in_editor?"\u200a":"";g.metrics=c(b.ctx.font);g.metrics.w=b.ctx.measureText(m).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=l===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,m=""!==g.value?g.value:b.in_editor?"\u200a":"",g.metrics=c(b.ctx.font),g.metrics.w=b.ctx.measureText(m).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,m={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}},p=0,x=g.length;p<x;p++){h=g[p];if("text"===h.nodeType){b.ctx.font=h.style.toString(!0);var r=""!==h.value?h.value:b.in_editor?"\u200a":"";h.metrics=c(b.ctx.font);h.metrics.w=b.ctx.measureText(r).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){r=void 0===
h.decimals?d:h.evaluator.eval(h.decimals);var u=void 0===h.fixed?l:h.fixed,z=h.evaluator.eval(h.value);parseFloat(z).toString()===z.toString()&&(z=u?parseFloat(z).toFixed(r):b.removeNeedlessDecimals(parseFloat(z).toFixed(r)),z=(""+z).replace(".",h.decimal_symbol));h.evalValue=z;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(z).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)r=h,r.updateFormula(),r.metrics.marginX=0,r.metrics.paddingX=0,r.metrics.paddingY=0,r.metrics.offsetX_aux=e,r.metrics.prevChild=m,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.offsetX_aux+this.marginX}},offsetY:{get:function(){return f.metrics.offsetY+this.ascent+(this.prevChild.metrics.descent-this.prevChild.metrics.ascent)/2-this.h}}}),r.metrics.w+=2*r.metrics.paddingX,r.metrics.ascent+=r.metrics.paddingY,r.metrics.descent+=r.metrics.paddingY,r.metrics.h+=2*r.metrics.paddingY,r.metrics.tmp_ascent=r.metrics.h+(r.metrics.prevChild.metrics.ascent-r.metrics.prevChild.metrics.descent)/2,e+=2*r.metrics.marginX;else if("subIndex"===h.nodeType)r=h,r.updateFormula(),
r.metrics.marginX=0,r.metrics.paddingX=0,r.metrics.paddingY=0,r.metrics.offsetX_aux=e,r.metrics.prevChild=m,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.offsetX_aux}},offsetY:{get:function(){return f.metrics.offsetY+this.ascent+(this.prevChild.metrics.descent-this.prevChild.metrics.ascent)/2}}}),r.metrics.w+=r.metrics.paddingX,r.metrics.ascent+=r.metrics.paddingY,
r.metrics.descent+=r.metrics.paddingY,r.metrics.h+=2*r.metrics.paddingY,this.metrics.descent=r.metrics.ascent+(r.metrics.prevChild.metrics.descent-r.metrics.prevChild.metrics.ascent)/2+r.metrics.descent,e+=r.metrics.marginX;else if("fraction"===h.nodeType){u=h;u.updateFormula();r=u.children;z=r[0];r=r[1];u.metrics.marginX=parseInt(.5+.075*this.style.size);u.metrics.paddingX=0;u.metrics.paddingY=0;var y=Math.max(z.metrics.w,r.metrics.w)+2*u.metrics.paddingX;u.metrics.prevChild=m;u.metrics.offsetX_aux=
e;var A=parseInt(-m.metrics.descent+4*m.metrics.h/9);Object.defineProperties(u.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY+A}},offsetX:{get:function(){return f.metrics.offsetX+f.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return f.metrics.offsetY-A}}});Object.defineProperties(z.metrics,{parent:{value:u},maxWidth:{value:y},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(r.metrics,{parent:{value:u},maxWidth:{value:y},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}}});u.metrics.w=
y;u.metrics.ascent=z.metrics.h+A+2*u.metrics.paddingY;u.metrics.descent=r.metrics.h-A+2*u.metrics.paddingY;u.metrics.h=z.metrics.h+r.metrics.h+4*u.metrics.paddingY;e+=2*u.metrics.marginX}else if("radical"===h.nodeType){m=h;m.updateFormula();r=m.children;u=r[0];var B=r[1];m.metrics.marginX=parseInt(1.5+.075*this.style.size);m.metrics.paddingX=parseInt(1.5+.075*this.style.size);m.metrics.paddingY=parseInt(1.5+.05*this.style.size);m.metrics.offsetX_aux=e;Object.defineProperties(m.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}}});r=m.style.size;m.radicalSign={w:r,scaleX:r/722,scaleY:B.metrics.h/1E3};z=parseInt(u.metrics.w-2*m.radicalSign.w/3);Object.defineProperties(m.radicalSign,{parent:{value:m},displaceIndex:{value:z},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+Math.max(this.displaceIndex,0)}},
y:{get:function(){return f.metrics.offsetY-B.metrics.ascent}}});Object.defineProperties(u.metrics,{parent:{value:m},displaceIndex:{value:z},fontSize:{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+Math.max(this.displaceIndex,0)-this.displaceIndex}},offsetY:{get:function(){return f.metrics.offsetY-this.descent-2*this.fontSize/5}}});Object.defineProperties(B.metrics,{parent:{value:m},
displaceIndex:{value:z},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}}});z=u.metrics.w<2*m.radicalSign.w/3?m.radicalSign.w:parseInt(u.metrics.w+m.radicalSign.w/3);m.metrics.w=z+2*m.metrics.paddingX+B.metrics.w;m.metrics.ascent=Math.max(B.metrics.ascent,u.metrics.h+2*r/5)+
m.metrics.paddingY;m.metrics.descent=B.metrics.descent+m.metrics.paddingY;m.metrics.h=m.metrics.ascent+m.metrics.descent;e+=2*m.metrics.marginX}else if("sum"===h.nodeType){u=h;u.updateFormula();r=u.children;z=r[0];y=r[1];var D=r[2];u.metrics.marginX=parseInt(1.5+.075*this.style.size);u.metrics.paddingX=parseInt(1.5+.075*this.style.size);u.metrics.paddingY=parseInt(1.5+.05*this.style.size);u.metrics.offsetX_aux=e;Object.defineProperties(u.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 I=c(b.ctx.font);m=parseInt(1.2*I.h);r=parseInt(.5+780*m/1E3);u.sigmaSign={w:r,h:m,scale:m/1E3};var E=Math.max(y.metrics.w,z.metrics.w,u.sigmaSign.w);u.sigmaSign.parent=u;Object.defineProperties(u.sigmaSign,{sumWidth:{value:E},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+I.descent-(this.h+I.h)/2}}});r=I.descent-y.metrics.descent-(m+I.h)/2-u.metrics.paddingY;Object.defineProperties(y.metrics,{parent:{value:u},sumWidth:{value:E},newBaselineTo:{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+parseInt((this.sumWidth-this.w)/2)}},offsetY:{get:function(){return f.metrics.offsetY+this.newBaselineTo}}});
m=z.metrics.ascent+I.descent+(m-I.h)/2+u.metrics.paddingY;Object.defineProperties(z.metrics,{parent:{value:u},sumWidth:{value:E},newBaselineFrom:{value:m},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(D.metrics,{parent:{value:u},sumWidth:{value:E},
x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+2*this.parent.metrics.paddingX+this.sumWidth}},offsetY:{get:function(){return f.metrics.offsetY}}});u.metrics.w=E+D.metrics.w+3*u.metrics.paddingX;u.metrics.ascent=Math.max(D.metrics.ascent,-r+y.metrics.ascent)+u.metrics.paddingY;u.metrics.descent=Math.max(D.metrics.descent,m+z.metrics.descent)+u.metrics.paddingY;u.metrics.h=u.metrics.ascent+u.metrics.descent;
e+=2*u.metrics.marginX}else if("integral"===h.nodeType){u=h;u.updateFormula();r=u.children;z=r[0];y=r[1];D=r[2];u.metrics.marginX=parseInt(1.5+.075*this.style.size);u.metrics.paddingX=parseInt(1.5+.075*this.style.size);u.metrics.paddingY=parseInt(1.5+.05*this.style.size);u.metrics.offsetX_aux=e;Object.defineProperties(u.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();I=c(b.ctx.font);E=parseInt(1.2*I.h);var G=parseInt(10.5+529*E/1E3);u.sign={w:G,h:E,scale:E/1E3};u.sign.parent=u;Object.defineProperties(u.sign,{x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX}},y:{get:function(){return f.metrics.offsetY+I.descent-(this.h+I.h)/2}}});r=I.descent-(E+I.h)/2-y.metrics.descent+E/3;Object.defineProperties(y.metrics,{parent:{value:u},integralWidth:{value:G},
newBaselineTo:{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+parseInt(4*this.integralWidth/5)}},offsetY:{get:function(){return f.metrics.offsetY+this.newBaselineTo}}});m=I.descent+z.metrics.ascent/2;Object.defineProperties(z.metrics,{parent:{value:u},integralWidth:{value:G},newBaselineFrom:{value:m},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}}});G=Math.max(parseInt(3*G/5)+y.metrics.w,parseInt(2*G/5+z.metrics.w))+u.metrics.paddingX;Object.defineProperties(D.metrics,{parent:{value:u},whatDisplace:{value:G},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+
this.whatDisplace}},offsetY:{get:function(){return f.metrics.offsetY}}});u.metrics.w=G+D.metrics.w+2*u.metrics.paddingX;u.metrics.ascent=Math.max(D.metrics.ascent,-r+y.metrics.ascent)+u.metrics.paddingY;u.metrics.descent=Math.max(D.metrics.descent,m+z.metrics.descent,E-u.metrics.ascent)+u.metrics.paddingY;u.metrics.h=Math.max(u.metrics.ascent+u.metrics.descent,E);e+=2*u.metrics.marginX}else if("prod"===h.nodeType)u=h,u.updateFormula(),r=u.children,z=r[0],y=r[1],D=r[2],u.metrics.marginX=parseInt(1.5+
.075*this.style.size),u.metrics.paddingX=parseInt(1.5+.075*this.style.size),u.metrics.paddingY=parseInt(1.5+.05*this.style.size),u.metrics.offsetX_aux=e,Object.defineProperties(u.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(),I=c(b.ctx.font),m=parseInt(1.2*I.h),r=parseInt(.5+
876*m/1E3),u.piSign={w:r,h:m,scale:m/1E3},E=Math.max(y.metrics.w,z.metrics.w,u.piSign.w),u.piSign.parent=u,Object.defineProperties(u.piSign,{prodWidth:{value:E},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+I.descent-(this.h+I.h)/2}}}),r=I.descent-y.metrics.descent-(m+I.h)/2-u.metrics.paddingY,Object.defineProperties(y.metrics,{parent:{value:u},prodWidth:{value:E},newBaselineTo:{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+parseInt((this.prodWidth-this.w)/2)}},offsetY:{get:function(){return f.metrics.offsetY+this.newBaselineTo}}}),m=z.metrics.ascent+I.descent+(m-I.h)/2+u.metrics.paddingY,Object.defineProperties(z.metrics,{parent:{value:u},prodWidth:{value:E},newBaselineFrom:{value:m},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(D.metrics,{parent:{value:u},prodWidth:{value:E},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+2*this.parent.metrics.paddingX+this.prodWidth}},offsetY:{get:function(){return f.metrics.offsetY}}}),
u.metrics.w=E+D.metrics.w+3*u.metrics.paddingX,u.metrics.ascent=Math.max(D.metrics.ascent,-r+y.metrics.ascent)+u.metrics.paddingY,u.metrics.descent=Math.max(D.metrics.descent,m+z.metrics.descent)+u.metrics.paddingY,u.metrics.h=u.metrics.ascent+u.metrics.descent,e+=2*u.metrics.marginX;else if("limit"===h.nodeType){m=h;m.updateFormula();r=m.children;var H=r[0];u=r[1];r=r[2];m.metrics.marginX=parseInt(1.5+.075*this.style.size);m.metrics.paddingX=parseInt(1.5+.075*this.style.size);m.metrics.paddingY=
parseInt(1.5+.05*this.style.size);m.metrics.offsetX_aux=e;Object.defineProperties(m.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();I=c(b.ctx.font);z=parseInt(.5+b.ctx.measureText("l\u00edm").width);y=parseInt(.5+b.ctx.measureText("\u2192").width);D=Math.max(z,H.metrics.w+y+u.metrics.w);
m.limitText={parent:m};Object.defineProperties(m.limitText,{limitWidth:{value:D},limitTextWidth:{value:z},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+(this.limitWidth-this.limitTextWidth)/2}}});z=I.descent+Math.max(H.metrics.ascent,u.metrics.ascent,2*I.ascent/3)+m.metrics.paddingY;m.limitArrow={parent:m};Object.defineProperties(m.limitArrow,{newBaseline:{value:z},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+H.metrics.w}},y:{get:function(){return f.metrics.offsetY+
this.newBaseline}}});Object.defineProperties(H.metrics,{parent:{value:m},newBaseline:{value:z},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(u.metrics,{parent:{value:m},arrowWidth:{value:y},newBaseline:{value:z},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},
offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+H.metrics.w+this.arrowWidth}},offsetY:{get:function(){return f.metrics.offsetY+this.newBaseline}}});Object.defineProperties(r.metrics,{parent:{value:m},limitWidth:{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.limitWidth}},offsetY:{get:function(){return f.metrics.offsetY}}});
m.metrics.w=D+r.metrics.w+3*m.metrics.paddingX;m.metrics.ascent=Math.max(r.metrics.ascent,I.ascent)+m.metrics.paddingY;y=0;r=Math.max(H.metrics.descent,u.metrics.descent,r.metrics.descent);if(0!=H.metrics.h||0!=u.metrics.h)y=z,r=Math.max(H.metrics.descent,u.metrics.descent,r-y);m.metrics.descent=y+r+m.metrics.paddingY;m.metrics.h=m.metrics.ascent+m.metrics.descent;e+=2*m.metrics.marginX}else if("matrix"===h.nodeType){z=h;z.updateFormula();r=z.children;y=z.rows;D=z.columns;z.metrics.marginX=parseInt(1.5+
.075*this.style.size);z.metrics.paddingX=parseInt(5+.075*this.style.size);z.metrics.paddingY=parseInt(1.5+.05*this.style.size);z.metrics.offsetX_aux=e;Object.defineProperties(z.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();I=c(b.ctx.font);E=[];G=[];m=0;for(var C=y*D;m<C;m++){var J=
parseInt(m/D);var P=m%D;E[J]=Math.max(E[J]||0,r[m].metrics.h);G[P]=Math.max(G[P]||0,r[m].metrics.w)}var R=(1+D)*z.metrics.paddingX;for(m=0;m<D;m++)R+=G[m];var L=(1+y)*z.metrics.paddingY;for(m=0;m<y;m++)L+=E[m];u=I.descent-I.h/2;m=0;for(C=y*D;m<C;m++)J=parseInt(m/D),P=m%D,r[m].metrics.offsetX_aux=a(G,P)+(G[P]-r[m].metrics.w)/2+P*z.metrics.paddingX,r[m].metrics.offsetY_aux=a(E,J)+(E[J]-r[m].metrics.h)/2+(1+J)*z.metrics.paddingY,Object.defineProperties(r[m].metrics,{parent:{value:z},matrixH:{value:L},
dispY:{value:u},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+this.offsetX_aux}},offsetY:{get:function(){return f.metrics.offsetY-this.matrixH/2+this.ascent+this.offsetY_aux+this.dispY}}});z.metrics.w=R;z.metrics.ascent=L/2-u;z.metrics.descent=L/2+u;z.metrics.h=z.metrics.ascent+z.metrics.descent;e+=2*z.metrics.marginX}else if("defparts"===h.nodeType){z=h;z.updateFormula();r=h.children;
y=h.parts;z.metrics.marginX=parseInt(1.5+.075*this.style.size);z.metrics.paddingX=parseInt(1.5+.075*this.style.size);z.metrics.paddingY=parseInt(1.5+.05*this.style.size);z.metrics.offsetX_aux=e;Object.defineProperties(z.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();I=c(b.ctx.font);D=0;E=z.metrics.paddingY;u=I.descent-I.h/2;for(m=0;m<y;m++)r[m].metrics.offsetY_aux=E,D=Math.max(D,r[m].metrics.w),E+=r[m].metrics.h+z.metrics.paddingY,Object.defineProperties(r[m].metrics,{parent:{value:z},dispY:{value:u},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX}},offsetY:{get:function(){return f.metrics.offsetY-this.parent.metrics.defpartsH/
2+this.ascent+this.offsetY_aux+this.dispY}}});z.metrics.defpartsH=E;z.metrics.w=D+4*z.metrics.paddingX;z.metrics.ascent=E/2-u;z.metrics.descent=E/2+u;z.metrics.h=z.metrics.ascent+z.metrics.descent;e+=2*z.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;m=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=m;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:m;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:m;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:m;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:m;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:m;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:m;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:m;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:m;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:m;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:m;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 l=this.children[d];"textLineBlock"===l.nodeType&&(c+=l.toRTFAux(a,b)+(1<g&&d<g-1?"\\par":""))}l="{\\fonttbl";d=0;for(g=a.length;d<g;d++)l+="\\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"+(l+"}")+a+c+"}"};g.prototype.toRTFAux=function(a,b){for(var c,d,g,f=null,l="",h,n,p,y,A,B=0,D=this.children.length;B<D;B++)h=n="",c=this.children[B],p=this.addToFontTable(c.style.family,
a),y=c.style.size,A=this.addToColorTable(c.style.color,b),null===A&&0<b.length&&(A=this.addToColorTable(m,b)),A!==f&&(h+="\\cf"+A,f=A),p!==d&&(h+="\\f"+p,d=p),y!==g&&(h+="\\fs"+2*y,g=y),c.style.italic&&(h+="\\i",n="\\i0"+n),c.style.bold&&(h+="\\b",n="\\b0"+n),c.style.underline&&(h+="\\ul",n="\\ulnone"+n),c.style.overline&&(h+="\\ol",n="\\olnone"+n),"text"===c.nodeType?(c.value=c.value.replace(/\\{/g,"{").replace(/\\}/g,"}").replace(/{/g,"\\{").replace(/}/g,"\\}"),c=""!==h?h+" "+c.value+n:""!==l&&
"}"!==l.charAt(l.length-1)?" "+c.value:c.value,l+=c):"formula"===c.nodeType?l+="{\\*\\mjaformula"+c.formulaToRTF(d,g,f,a,b)+"}":"componentSpace"===c.nodeType?l+="{\\*\\component\\Space "+c.value+"}":"componentNumCtrl"===c.nodeType&&(l+="{\\*\\component\\NumCtrl "+c.value+"}");return l};g.prototype.formulaToRTF=function(a,b,c,d,g){for(var e,f="",l,h,n,p,q=0,v=this.children.length;q<v;q++)l=h="",e=this.children[q],n=this.addToFontTable(e.style.family,d),p=this.addToColorTable(e.style.color,g),null===
p&&0<g.length&&(p=this.addToColorTable(m,g)),n!==a&&(l+="\\f"+n,a=n),p!==c&&(l+="\\cf"+p,"text"!==e.nodeType||"text"===e.nodeType&&""!==e.value)&&(c=p),e.style.italic&&(l+="\\i",h="\\i0"+h),e.style.bold&&(l+="\\b",h="\\b0"+h),e.style.underline&&(l+="\\ul",h="\\ulnone"+h),e.style.overline&&(l+="\\ol",h="\\olnone"+h),"text"===e.nodeType&&""!==e.value?(e.value=e.value.replace(/\\{/g,"{").replace(/\\}/g,"}").replace(/{/g,"\\{").replace(/}/g,"\\}"),tmpRTF=""!==l?l+" "+e.value+h:"}"!==f.charAt(f.length-
1)?" "+e.value:e.value,f+=tmpRTF):"dynamicText"===e.nodeType?(e.value=""===e.value?" ":e.value,f+=l+"{\\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 p={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,m,d,l,g,p,f,n,q,e,v=function(){};v.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=m=0;g=b.charAt(0);p=!1;for(f="text";m<b.length;)l=g,g=b.charAt(m+1),p?"\\"===g||"{"===g||"}"===
g||" "===g||";"===g?(p=!1,h+=l," "===g?(m++,g=b.charAt(m+1),e=!0):e=!1,(n=h.match(/^'([0-9a-f]{2})/))?(q="","text"===f&&(q=c.pop().value),h=q+=a(parseInt(n[1],16))+h.substring(3)):(n=h.match(/^u[0-9]+/))?(q="","text"===f&&(q=c.pop().value),h=q+=a(n[0].substring(1))):("{"===h||"}"===h||"\\"==l?(c.push({type:"text",value:h+(e?" ":"")}),f="text"):(c.push({type:"controlWord",value:h}),f="controlWord"),h="")):"{"==l||"}"==l||"\\"==l?(p=!1,c.push({type:"text",value:l}),f="text"):h+=l:"\\"===l?(p=!0,""!==
h&&(c.push({type:"text",value:h}),f="text",h="")):"{"===l?(d++,""!==h&&(c.push({type:"text",value:h}),h=""),c.push({type:"openBlock",value:d}),f="openBlock"):"}"===l?(""!==h&&(c.push({type:"text",value:h}),h=""),c.push({type:"closeBlock",value:d}),f="closeBlock",d--):h+=l,m++;""!==h&&c.push({type:"text",value:h});return c};b.RTFTokenizer=v;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=Math.max,c,h,m,d,l,g,p,f,n,q,e,v,w,x,r,u,z,y,A,B,D,I,E,G,H,C,J,P,R,L,Q,O=function(a){this.evaluator=a;this.tokenizer=new b.RTFTokenizer};O.prototype.parse=function(F){c=this.tokenizer.tokenize(F);h={};d=2;if("openBlock"===c[0].type&&"fonttbl"===c[1].value){for(m=c[0].value;"closeBlock"!==c[d].type&&c[d].value!==m;)h[c[d].value]=c[d+2].value.substring(0,c[d+2].value.length-1),d+=3;d++}l={};g=0;if("openBlock"===c[d].type&&"colortbl"===c[d+1].value){m=
c[d++].value;for(d++;"closeBlock"!==c[d].type&&c[d].value!==m;)p=parseInt(c[d++].value.substring(3)).toString(16),f=parseInt(c[d++].value.substring(5)).toString(16),n=parseInt(c[d++].value.substring(4)).toString(16),";"===c[d].value&&d++,l[g++]="#"+(2>p.length?"0"+p:p)+(2>f.length?"0"+f:f)+(2>n.length?"0"+n:n);d++}x=w=v=null;R=P=J=D=B=A=y=z=u=r=!1;I=[new b.TextStyle];E=I[0];H=G=-1;C=[];q=L=new b.TextNode("","textBlock",E,this.evaluator);e=new b.TextNode("","textLineBlock",E,this.evaluator);q.addChild(e);
L.stableWidth=!0;L.hasFormula=!1;F=d;for(var M=c.length;F<M;F++){if("controlWord"==c[F].type)if(h[c[F].value])E.set({family:h[c[F].value]});else if(c[F].value.match(/^fs(\d+)/))E.set({size:parseInt(c[F].value.match(/^fs(\d+)/)[1]/2)});else if("b"==c[F].value)E.set({bold:!0}),0<C.length&&C[C.length-1].style.set({bold:!0});else if("b0"==c[F].value)E.set({bold:!1}),0<C.length&&C[C.length-1].style.set({bold:!1});else if("i"==c[F].value)E.set({italic:!0}),0<C.length&&C[C.length-1].style.set({italic:!0});
else if("i0"==c[F].value)E.set({italic:!1}),0<C.length&&C[C.length-1].style.set({italic:!1});else if("ul"==c[F].value)E.set({underline:!0}),0<C.length&&C[C.length-1].style.set({underline:!0});else if("ulnone"==c[F].value)E.set({underline:!1}),0<C.length&&C[C.length-1].style.set({underline:!1});else if("ol"==c[F].value)E.set({overline:!0}),0<C.length&&C[C.length-1].style.set({overline:!0});else if("olnone"==c[F].value)E.set({overline:!1}),0<C.length&&C[C.length-1].style.set({overline:!1});else if(c[F].value.match(/^cf(\d+)/))E.set({color:l[parseInt(c[F].value.substring(2))]}),
0<C.length&&(C[C.length-1].style.color=E.color);else if("par"==c[F].value){q=new b.TextNode("","textLineBlock",E.clone(),this.evaluator);if("textBlock"!=e.nodeType)for(e=e.parent;"textBlock"!=e.nodeType;)e=e.parent;e.addChild(q);e=q}else if("mjaformula"==c[F].value)L.hasFormula=!0,H=G,r=!0,q=new b.TextNode("","formula",E.clone(),this.evaluator),e.addChild(q),e=q,C[C.length-1]=q;else if("fraction"==c[F].value||"radicand"==c[F].value||"radical"==c[F].value||"what"==c[F].value||"sum"==c[F].value||"integral"==
c[F].value||"limit"==c[F].value){var K=C[C.length-2].style.clone();q=new b.TextNode("",c[F].value,K,this.evaluator);C[C.length-2].addChild(q);C[C.length-1]=q}else"index"==c[F].value?(K=C[C.length-2].style.clone(),K.size=a(parseInt(K.size-.5*K.size),8),q=new b.TextNode("",c[F].value,K,this.evaluator),C[C.length-2].addChild(q),C[C.length-1]=q):"to"==c[F].value||"from"==c[F].value?(K=C[C.length-2].style.clone(),K.size=a(parseInt(K.size-.2*K.size),8),q=new b.TextNode("",c[F].value,K,this.evaluator),C[C.length-
2].addChild(q),C[C.length-1]=q):"num"==c[F].value||"den"==c[F].value?(K=C[C.length-2].style.clone(),K.size=a(Math.round(K.size-.1*K.size),8),"num"==c[F].value?q=new b.TextNode("","numerator",K,this.evaluator):"den"==c[F].value&&(q=new b.TextNode("","denominator",K,this.evaluator)),C[C.length-2].addChild(q),C[C.length-1]=q):"subix"==c[F].value||"supix"==c[F].value?(K=C[C.length-2].style.clone(),K.size=a(Math.floor(K.size-.33*K.size),8),"subix"==c[F].value?q=new b.TextNode("","subIndex",K,this.evaluator):
"supix"==c[F].value&&(q=new b.TextNode("","superIndex",K,this.evaluator)),q.originalStyle=C[C.length-2].style.clone(),C[C.length-2].addChild(q),C[C.length-1]=q):"defparts"==c[F].value||"matrix"==c[F].value||"element"==c[F].value?(K=C[C.length-2].style.clone(),q=new b.TextNode("",c[F].value,K,this.evaluator),C[C.length-2].addChild(q),C[C.length-1]=q,"defparts"==c[F].value?x=q:"matrix"==c[F].value&&(w=q,w.matrix_type=0)):"parts"==c[F].value?D=!0:"type"==c[F].value?y=!0:"rows"==c[F].value?A=!0:"columns"==
c[F].value?B=!0:"expr"==c[F].value?(L.stableWidth=!1,u=!0):"decimals"==c[F].value?z=!0:"fixed1"==c[F].value?v.fixed=!0:"fixed0"==c[F].value?v.fixed=!1:"component"!=c[F].value&&("NumCtrl"==c[F].value?J=!0:"Space"==c[F].value?P=!0:"hyperlink"==c[F].value&&(R=!0));if("text"==c[F].type)if(D)x.parts=parseInt(c[F].value),D=!1;else if(y)w.matrix_type=parseInt(c[F].value),y=!1;else if(A)w.rows=parseInt(c[F].value),A=!1;else if(B)w.columns=parseInt(c[F].value),B=!1;else if(z)v.decimals=this.evaluator.parser.parse(c[F].value+
""),z=!1;else if(R){Q=c[F].value.split("|")[0];K=E.clone();q=new b.TextNode(Q,"hyperlink",K,this.evaluator);q.URL=c[F].value.split("|")[1];if("textLineBlock"!=e.nodeType)for(e=e.parent;"textLineBlock"!=e.nodeType;)e=e.parent;e.addChild(q);R=!1}else if(J)q=new b.TextNode(c[F].value,"componentNumCtrl",E.clone(),this.evaluator),e.addChild(q),J=!1;else if(P)q=new b.TextNode(c[F].value,"componentSpace",E.clone(),this.evaluator),e.addChild(q),P=!1;else if(u)K=C[C.length-2].style.clone(),Q=this.evaluator.parser.parse(c[F].value),
q=new b.TextNode(Q,"dynamicText",K,this.evaluator),C[C.length-2].addChild(q),v=C[C.length-1]=q,u=!1;else if(u||r)!u&&r&&(Q=c[F].value,q=new b.TextNode(Q,"text",C[C.length-1].style.clone(),this.evaluator),C[C.length-1].addChild(q));else{Q=c[F].value;q=new b.TextNode(Q,"text",E.clone(),this.evaluator);if("textLineBlock"!=e.nodeType)for(e=e.parent;"textLineBlock"!=e.nodeType;)e=e.parent;e.addChild(q)}else if("openBlock"==c[F].type)G=c[F].value,E=E.clone(),I.push(E),C.push(null);else if("closeBlock"==
c[F].type)c[F].value==H&&(H=-1,r=!1,e=e.parent),I.pop(),E=I[I.length-1],C.pop();else if("("==c[F].type||")"==c[F].type)K=C[C.length-1].style.clone(),K.italic="",q=new b.TextNode(c[F].type,"mathSymbol",K,this.evaluator),C[C.length-1].addChild(q);else if("+"==c[F].type||"-"==c[F].type||"*"==c[F].type||"="==c[F].type)q=new b.TextNode(c[F].type,"mathSymbol",C[C.length-1].style.clone(),this.evaluator),C[C.length-1].addChild(q)}return L.normalize()};b.RTFParser=O;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,m,d,l,g,p,f,n,q,e,v=function(c,d){a=this;a.parent=c;a.evaluator=a.parent.evaluator;h=a.evaluator;m=h.parser;a.id=a.imageSrc=a.x_axis=a.y_axis=a.cID="";a.type="2D";a.xExpr=a.yExpr=m.parse("0");a.w=parseInt(c.container.width);a.h=parseInt(c.container.height);a.drawif=m.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()};v.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),p=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(p-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(p-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?(l=p-a.y,a.h>l&&(a.h=l)):(l=a.h+a.y,a.h=l>=p?p:l),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&&(q=a.OxExpr,q.endsWith("%")?a.Ox=a.w*parseFloat(q)/100:(n=parseFloat(q),n!=q&&(n=0),a.Ox=n));a.OyExpr&&(e=a.OyExpr,e.endsWith("%")?a.Oy=a.h*parseFloat(e)/100:(n=parseFloat(e),n!=e&&(n=0),a.Oy=n));""!==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)):(n=h.getVariable("_w"),h.setVariable("_w",void 0===n?a.w:n),n=h.getVariable("_h"),void 0===n&&(n=a.h),h.setVariable("_h",n),n=h.getVariable("escala"),void 0===n&&(n=a.scale),h.setVariable("escala",n),n=h.getVariable("Ox"),void 0===n&&(n=a.Ox),h.setVariable("Ox",
n),n=h.getVariable("Oy"),void 0===n&&(n=a.Oy),h.setVariable("Oy",n),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"))})};v.prototype.addCtr=function(a){"GraphicControl"===a.type?this.graphicsCtr.push(a):
this.ctrs.push(a)};v.prototype.addGraph=function(a,b){"2D"===this.type&&b||"3D"===this.type&&!b||(a.background&&"3D"!==this.type?this.backGraphics.push(a):this.graphics.push(a))};v.prototype.clearClick=function(){this.evaluator.setVariable(this.mclickedString,0);this.evaluator.setVariable(this.mclicizquierdoString,0)};v.prototype.getRelativeX=function(a){return(parseInt(a)-this.w_2-this.Ox)/this.scale};v.prototype.getRelativeY=function(a){return(-parseInt(a)+this.h_2+this.Oy)/this.scale};v.prototype.getAbsoluteX=
function(a){return a*this.scale+this.w_2+this.Ox};v.prototype.getAbsoluteY=function(a){return-a*this.scale+this.h_2+this.Oy};b.Space=v;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 m(a){a.preventDefault();document.body.removeEventListener("mousemove",
c);document.body.removeEventListener("mouseup",m)}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 l=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)")});l.actionExec={execute:b.showAbout};l.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();l=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)")});l.update();l.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",m)});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"),m=b.convertFont("Monospaced,PLAIN,12"),d=Math.floor,l=Math.round,g,p,f,n,q,e,v,w,x,r,u,z,y,A,B,D,I,E,G,H,C,J,P,R,L,Q,O,F,M,K,N=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(N,b.Space);N.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")};N.prototype.update=function(b){a=this;g=a.evaluator;p=a.parent;if(a.resizable){if(O=a.evaluator.eval(a.wModExpr),F=a.evaluator.eval(a.hModExpr),a.old_w!=O||a.old_h!=F)a.w=O,a.h=F,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){n=a.x!==g.eval(a.xExpr)+a.displaceRegionWest;q=a.y!==g.eval(a.yExpr)+p.plecaHeight+a.displaceRegionNorth;a.spaceChange=b||n||q||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=n?g.eval(a.xExpr)+a.displaceRegionWest:a.x;a.y=q?g.eval(a.yExpr)+p.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(n||q)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"};N.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;v=0;for(w=Math.max(0,a.w+a.h);e>w;)e/=10,v++;for(;e<w/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?v+1:v):e>(a.w+a.h)/4?a.drawNumbers(f,e/2,e<=a.scale?v+1:v):a.drawNumbers(f,e,v));b=$jscomp.makeIterator(a.backGraphics);
for(var c=b.next();!c.done;c=b.next())c.value.draw()};N.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=m,f.textAlign="center",f.textBaseline="alphabetic",G=1>=a.scale?a.mouse_x.toFixed(0):a.mouse_x.toFixed(parseInt(a.scale).toString().length+1),H=1>=a.scale?a.mouse_y.toFixed(0):a.mouse_y.toFixed(parseInt(a.scale).toString().length+1),C="("+G+","+H+")",J=d(f.measureText(C).width/2),P=a.getAbsoluteX(a.mouse_x),R=a.getAbsoluteY(a.mouse_y),L=d(P),Q=d(R-10),L+J>a.w?L=a.w-J:0>L-J&&(L=J),Q+1>a.h?Q=a.h:0>Q-14&&(Q=15),f.fillText(C,L,Q),f.beginPath(),f.arc(P,R,2.5,0,c),f.stroke(),f.restore())};N.prototype.drawMarks=
function(a,b,c,e){x=this.w;r=this.h;I=B=0;D=x;E=r;y=d(x/2+this.Ox);A=d(r/2+this.Oy);0<=c&&(B=y-c,D=y+c,I=A-c,E=A+c);a.beginPath();if(!e||e&&!e.match("x"))for(c=-l(y/b);(u=y+l(c*b))<x;c++)a.moveTo(u+.5,I+.5),a.lineTo(u+.5,E+.5);if(!e||e&&!e.match("y"))for(e=-l(A/b);(z=A+l(e*b))<r;e++)a.moveTo(B+.5,z+.5),a.lineTo(D+.5,z+.5);a.stroke()};N.prototype.drawNumbers=function(a,b,c){x=this.w;r=this.h;y=d(x/2+this.Ox);A=d(r/2+this.Oy);for(c=-l(y/b);(u=y+l(c*b))<x;c++)a.fillText(parseFloat((c*b/this.scale).toFixed(4)),
u+1,A-2);for(c=-l(A/b);(z=A+l(c*b))<r;c++)0!==parseFloat(-c*b/this.scale)&&a.fillText(parseFloat((-c*b/this.scale).toFixed(4)),y+5,z+5)};N.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),M=f.posAnte.x-f.posNext.x,K=f.posAnte.y-f.posNext.y,f.evaluator.setVariable(f.OxStr,f.Ox-M),f.evaluator.setVariable(f.OyStr,f.Oy-K));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=N;return b}(descartesJS||{});
descartesJS=function(b){var a,c,h;function m(a,c){O=b.subtract3D(a,b.scalarProd3D(c,b.dotProduct3D(a,c)));F=b.add3D(a,b.scalarProd3D(O,-2));M=b.norm3D(F);return 0!==M?b.scalarProd3D(F,1/M):b.scalarProd3D(a,-1)}function d(a,b){return b.depth-a.depth}if(b.loadLib)return b;var l=Math.floor,g=Math.max,p=Math.cos,f=Math.sin,n,q,e,v,w,x,r,u,z,y,A,B,D,I,E,G,H=[],C,J,P,R,L,Q,O,F,M,K,N,V=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);N=new b.Primitive3D({V:[new b.Vec4D],type:"vertex"},e);e.evaluator.setFunction(e.id+"._X3D2D_",function(a,b,c){N.V[0].x=a;N.V[0].y=b;N.V[0].z=c;N.computeDepth(e);return N.projV[0].x});e.evaluator.setFunction(e.id+
"._Y3D2D_",function(a,b,c){N.V[0].x=a;N.V[0].y=b;N.V[0].z=c;N.computeDepth(e);return N.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(V,b.Space);V.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)};V.prototype.update=function(a){e=this;n=e.evaluator;q=e.parent;n.setVariable(e.wStr,e.w);n.setVariable(e.hStr,e.h);e.drawIfValue=0<n.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,n.setVariable(e.wStr,e.w),n.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));x=e.x!==n.eval(e.xExpr)+e.displaceRegionWest;r=e.y!==n.eval(e.yExpr)+q.plecaHeight+e.displaceRegionNorth;e.spaceChange=a||x||r||e.drawBefore!==e.drawIfValue||e.Ox!==n.getVariable(e.OxStr)||e.Oy!==n.getVariable(e.OyStr)||e.Ojo.x!==n.getVariable(e.ojoXStr)||e.Ojo.y!==n.getVariable(e.ojoYStr)||e.Ojo.z!==n.getVariable(e.ojoZStr)||e.scale!==n.getVariable(e.scaleStr);e.x=x?n.eval(e.xExpr)+e.displaceRegionWest:
e.x;e.y=r?n.eval(e.yExpr)+q.plecaHeight+e.displaceRegionNorth:e.y;e.Ojo.x=n.getVariable(e.ojoXStr);e.Ojo.y=n.getVariable(e.ojoYStr);e.Ojo.z=n.getVariable(e.ojoZStr);e.Ox=n.getVariable(e.OxStr);e.Oy=n.getVariable(e.OyStr);e.scale=n.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&&(K=!0);e.observer=K?n.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);
n.setVariable(e.obsStr,e.observer)}1E-6>e.scale?(e.scale=1E-6,n.setVariable(e.scaleStr,1E-6)):1E6<e.scale&&(e.scale=1E6,n.setVariable(e.scaleStr,1E6));if(x||r)e.container.style.left=e.x+"px",e.container.style.top=e.y+"px";e.container.style.display="block";e.dim=n.getVariable(e.userIDimStr);e.userIntensity=n.getVariable(e.userIIStr);e.light3={x:parseInt(n.getVariable(e.userIxStr)),y:parseInt(n.getVariable(e.userIyStr)),z:parseInt(n.getVariable(e.userIzStr))};e.updateCamera();e.ctx.setTransform(e.ratio,
0,0,e.ratio,0,0);e.draw()}else e.container.style.display="none"};V.prototype.updateCamera=function(){this.eye=b.scalarProd3D(this.Ojo,1/this.scale)};V.prototype.rotateVertex=function(d){y=b.degToRad(e.evaluator.getVariable(e.rotZStr));A=p(y);B=f(y);a=d.x*A-d.y*B;c=d.x*B+d.y*A;h=d.z;y=b.degToRad(e.evaluator.getVariable(e.rotYStr));A=p(y);B=f(y);return{x:h*B+a*A,y:c,z:h*A-a*B}};V.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}};V.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))));R=b.subtract3D(this.eye,c.avg);L=b.norm3D(R);Q=b.scalarProd3D(R,1/L);this.lights[3]=b.subtract3D(this.light3,c.avg);G=b.norm3D(this.lights[3]);for(var e=0,g=this.intensity.length-1;e<g;e++)H[e]=this.intensity[e]*this.dim;H[3]=this.userIntensity*this.userIntensity/G||0;C=d?this.dim/2:this.dim/4;J=0;P=0>c.direction?c.normal:b.scalarProd3D(c.normal,
-1);c=0;for(e=this.lights.length;c<e;c++)d?(J=Math.max(0,b.dotProduct3D(m(this.lights[c],P),Q)),J*=J*J):J=Math.max(0,b.dotProduct3D(this.lights[c],P)),C+=H[c]*J;C=Math.min(C,1);D=l(a.r*C);I=l(a.g*C);E=l(a.b*C);return"rgba("+D+","+I+","+E+","+a.a+")"};V.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++){v=e.graphics[a];
for(var c=a+1;c<b;c++)w=e.graphics[c],v.splitFace(w),w.splitFace(v);e.primitives=e.primitives.concat(v.primitives||[])}else for(a=0,b=this.graphics.length;a<b;a++){v=this.graphics[a];if(v.split)for(c=a+1;c<b;c++)w=this.graphics[c],w.split&&v.splitFace(w);this.primitives=this.primitives.concat(v.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()};V.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,l,h;;){l=g;for(var m=0;m<b;m++)if(!a[m].drawn){h=!0;for(var n=0;n<b;n++)if(n!=m&&!a[n].drawn&&a[m].inFrontOf(d,a[n],f)){h=!1;break}h&&(g--,c[e++]=a[m],a[m].drawn=
!0)}if(0==g)break;else if(g==l){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)};V.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}};V.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){u=(f.getAbsoluteX(f.oldMouse.x)-f.getAbsoluteX(f.mouse_x))/4;z=(-f.getAbsoluteY(f.oldMouse.y)+f.getAbsoluteY(f.mouse_y))/4;if(u!==f.disp.x||z!==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)-u,f.beta=b.radToDeg(f.beta)-z,f.evaluator.setVariable(f.rotZStr,f.alpha),f.evaluator.setVariable(f.rotYStr,-f.beta),f.disp.x=u,f.disp.y=z,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=V;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,c,h,m,d,l,g,p,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);l=c.eval(a.xExpr)+a.displaceRegionWest;if(m=a.x!==l)a.x=l;l=c.eval(a.yExpr)+a.parent.plecaHeight+a.displaceRegionNorth;if(d=a.y!==l)a.y=l;void 0!=
a._w_&&(l=c.eval(a._w_),a.w!==l&&(a.container.style.width=l+"px",a.w=l));void 0!=a._h_&&(l=c.eval(a._h_),a.h!==l&&(h.style.height=l+"px",a.h=l));if(m||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));p=c.getVariable(a.id+"._scroll");1==p?(a.MyIFrame.setAttribute("scrolling","yes"),a.MyIFrame.style.overflow=""):-1==p?(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"]');h=$jscomp.makeIterator(h);for(var d=h.next();!d.done;d=h.next())d=d.value,this.images[d.id]=new Image,this.images[d.id].onload=function(){this.ready=1},this.images[d.id].src=d.innerText.trim();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,l=a.audios,g=/[\w\.\-//]*(\.png|\.jpg|\.gif|\.svg|\.webp)/gi,p=/[\w\.\-//]*(\.ogg|\.oga|\.mp3|\.wav)/gi,f=/'macro'|'makro'/g,n;var q=0;for(n=c.length;q<n;q++){if(c[q].value.match(f)){var e="";var v=void 0;var w=a.lessonParser.split(c[q].value);
var x=0;for(var r=w.length;x<r;x++)"expresion"===babel[w[x][0]]&&(e=w[x][1]);e&&(v=(v=document.getElementById(e))&&"descartes/macro"==v.type?v.text:b.openFile(e));if(v&&(v=v.match(g)))for(e=0,x=v.length;e<x;e++)w=v[e],w.toLowerCase().endsWith("vacio.gif")||""==w.substring(0,w.length-4)||d[w]||(d[w]=this.descartesApp.getImageAux(w))}if(v=c[q].value.match(g))for(e=0,x=v.length;e<x;e++)w=v[e],w.toLowerCase().endsWith("vacio.gif")||""==w.substring(0,w.length-4)||d[w]||(d[w]=this.descartesApp.getImageAux(w));
if(v=c[q].value.match(p))for(e=0,w=v.length;e<w;e++)l[v[e]]||(l[v[e]]=this.descartesApp.getAudioAux(v[e]))}for(var u in d)d.hasOwnProperty(u)&&a.im_l++;for(var z in l)l.hasOwnProperty(z)&&a.au_l++;var y=a.im_l+a.au_l;0<y&&a.progress.setAttribute("max",y);var A,B=function(){A=0;for(var c in d)d.hasOwnProperty(c)&&(d[c].ready||d[c].errorload)&&A++;for(var e in l)l.hasOwnProperty(e)&&(l[e].ready||l[e].errorload)&&A++;a.progress.setAttribute("value",A);A!=y?a.timer=b.setTimeout(B,1):a.descartesApp.initBuildApp()};
B()};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(p){}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,l=a.lessonParser,g=[],h=[],f=[],n=[],q=[],e=[],v=$jscomp.makeIterator(a.children);for(d=v.next();!d.done;d=v.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=l.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),n.push(d.value)):d.name.startsWith("S_")?q.push(d.value):"Animation"==babel[d.name]&&e.push(d.value);g=$jscomp.makeIterator(g);for(v=g.next();!v.done;v=g.next())a.spaces.push(l.parseSpace(v.value)),a.zIndex++;n.forEach(function(c,d){b.DEBUG.elemIndex=d;if(c=l.parseGraphic(c))a.editableRegionVisible=a.editableRegionVisible||c.visible,c.space.addGraph(c)});q.forEach(function(a,c){b.DEBUG.elemIndex=c;(a=l.parse3DGraphic(a))&&a.space.addGraph(a,!0)});
h=$jscomp.makeIterator(h);for(n=h.next();!n.done;n=h.next())a.controls.push(l.parseControl(n.value));f=$jscomp.makeIterator(f);for(h=f.next();!h.done;h=f.next())l.parseAuxiliar(h.value);e=$jscomp.makeIterator(e);for(f=e.next();!f.done;f=e.next())a.animation=l.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,m,q,e,
v,w,x){a.keyboard.show(null,b,c,g,h,{x:f,y:m,w:q,h:e,fs:v+"px",value:w+"",type:"custom",tagName:"textfield"},x)});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||{},l=this.container,g=100,h=100,f=0,n=0,q=0,e=0,v=0,w=this.northSpace.controls,x=this.southSpace.controls;var r=this.eastSpace.controls;var u=this.westSpace.controls;if(0<c.rowsNorth||0<w.length||c.about||c.config){0>=c.rowsNorth?(f=c.height,c.rowsNorth=1):f=c.height*c.rowsNorth;var z=this.northSpace.container;z.id="descartesJS_north";z.setAttribute("style","width:"+l.width+"px;height:"+f+"px;left:0;top:"+this.plecaHeight+"px;");l.insertBefore(z,this.loader);z=l.width;var y=
0;c.about?(y=g,z-=y):g=0;c.config&&(z-=100);for(var A=Math.ceil(w.length/c.rowsNorth),B=z/A,D=0,I=w.length;D<I;D++)w[D].expresion=a.parse("("+(y+D%A*B)+","+c.height*Math.floor(D/A)+","+B+","+c.height+")"),w[D].init();c.about&&(w=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+")")}),w.actionExec={execute:b.showAbout},w.update());c.config&&(new b.Button(this,{region:"north",name:"config",font_size:a.parse("15"),
action:"config",expresion:a.parse("("+(z+g)+",0,100,"+f+")")})).update()}if(0<c.rowsSouth||0<x.length||c.init||c.clear){0>=c.rowsSouth?(n=c.height,c.rowsSouth=1):n=c.height*c.rowsSouth;g=l.width;z=0;c.init?(z=h,g-=z):h=0;c.clear&&(g-=100);w=this.southSpace.container;w.id="descartesJS_south";w.setAttribute("style","width:"+l.width+"px;height:"+n+"px;left:0;bottom:0;");l.insertBefore(w,this.loader);w=Math.ceil(x.length/c.rowsSouth);y=g/w;A=0;for(B=x.length;A<B;A++)x[A].expresion=a.parse("("+(z+A%w*
y)+","+c.height*Math.floor(A/w)+","+y+","+c.height+")"),x[A].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+","+n+")")})).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,"+n+")")})).update()}if(0<r.length)for(h=l.height-f-n,e=c.widthEast,x=this.eastSpace.container,
x.id="descartesJS_east",x.setAttribute("style","width:"+e+"px;height:"+h+"px;right:0;top:"+f+"px;"),l.insertBefore(x,this.loader),h=0,x=r.length;h<x;h++)r[h].expresion=a.parse("(0,"+c.height*h+","+e+","+c.height+")"),r[h].init();if(0<u.length)for(r=l.height-f-n,v=c.widthWest,h=this.westSpace.container,h.id="descartesJS_west",h.setAttribute("style","width:"+v+"px;height:"+r+"px;left:0;top:"+f+"px;"),l.insertBefore(h,this.loader),r=0,h=u.length;r<h;r++)u[r].expresion=a.parse("(0,"+c.height*r+","+v+
","+c.height),u[r].init();if(this.editableRegionVisible)for(q=c.height,a=this.editableRegion.container,a.id="descartesJS_editableRegion",a.setAttribute("style","position:absolute;width:"+l.width+"px;height:"+q+"px;left:0;top:"+(l.height-n-c.height)+"px;"),l.insertBefore(a,this.loader),c=this.editableRegion.textFields,l=l.width/c.length,u=b.getFieldFontSize(q),r=0,h=c.length;r<h;r++)"div"==c[r].type?(a.appendChild(c[r].container),c[r].container.setAttribute("style","font-family:"+b.sansserif_font+
";width:"+(l-4)+"px;height:"+q+"px;position:absolute;left:"+r*l+"px;top:0;"),x=c[r].container.firstChild,x.setAttribute("style","font-family:"+b.sansserif_font+";font-size:"+u+"px;padding-top:0;background-color:#e0e4e8;position:absolute;left:0;top:0;height:"+q+"px;text-align:center;line-height:"+q+"px;"),g=x.offsetWidth,x.style.width=g+"px",x.firstChild.textContent=x.firstChild.textContent.substring(3,x.firstChild.textContent.length-3),c[r].container.lastChild.setAttribute("style","font-family:"+
b.monospace_font+";font-size:"+u+"px;width:"+(l-g)+"px;height:"+q+"px;position:absolute;left:"+g+"px;top:0;border:2px groove white;")):(a.appendChild(c[r]),c[r].setAttribute("style","font-family:"+b.monospace_font+";font-size:"+u+"px;width:"+l+"px;height:"+q+"px;position:absolute;left:"+r*l+"px;top:0;border:2px groove white;"));this.displaceRegionNorth=f;this.displaceRegionSouth=n+(q||0);this.displaceRegionEast=e;this.displaceRegionWest=v;f=$jscomp.makeIterator(this.spaces);for(n=f.next();!n.done;n=
f.next())n.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 l=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",
l),c.addEventListener("load",l),c.addEventListener("error",g),c.load())};c.addEventListener("canplaythrough",l);c.addEventListener("load",l);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 m(){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",m),window.addEventListener("message",b.onMessage),["webkitTransitionEnd","transitionend","oTransitionEnd","MSTransitionEnd"].forEach(function(a){window.addEventListener(a,function(a){b.onResize(a)})}));return b}(descartesJS||{});
