/*
 Joel Espinosa Longi
 jlongi@im.unam.mx
 https://github.com/jlongi/DescartesJS
 LGPL - http://www.gnu.org/licenses/lgpl.html
 2026-04-20
*/
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_ES6=!1;$jscomp.ASSUME_ES2020=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.ISOLATE_POLYFILLS=!1;$jscomp.FORCE_POLYFILL_PROMISE=!1;$jscomp.FORCE_POLYFILL_PROMISE_WHEN_NO_UNHANDLED_REJECTION=!1;$jscomp.INSTRUMENT_ASYNC_CONTEXT=!0;$jscomp.objectCreate=$jscomp.ASSUME_ES5||typeof Object.create=="function"?Object.create:function(b){var a=function(){};a.prototype=b;return new a};
$jscomp.defineProperty=$jscomp.ASSUME_ES5||typeof Object.defineProperties=="function"?Object.defineProperty:function(b,a,h){if(b==Array.prototype||b==Object.prototype)return b;b[a]=h.value;return b};$jscomp.getGlobal=function(b){b=["object"==typeof globalThis&&globalThis,b,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global];for(var a=0;a<b.length;++a){var h=b[a];if(h&&h.Math==Math)return h}throw Error("Cannot find global object");};
$jscomp.global=$jscomp.ASSUME_ES2020?globalThis:$jscomp.getGlobal(this);$jscomp.IS_SYMBOL_NATIVE=typeof Symbol==="function"&&typeof Symbol("x")==="symbol";$jscomp.TRUST_ES6_POLYFILLS=!$jscomp.ISOLATE_POLYFILLS||$jscomp.IS_SYMBOL_NATIVE;$jscomp.polyfills={};$jscomp.propertyToPolyfillSymbol={};$jscomp.POLYFILL_PREFIX="$jscp$";var $jscomp$lookupPolyfilledValue=function(b,a,h){if(!h||b!=null){h=$jscomp.propertyToPolyfillSymbol[a];if(h==null)return b[a];h=b[h];return h!==void 0?h:b[a]}};
$jscomp.TYPED_ARRAY_CLASSES=function(){var b="Int8 Uint8 Uint8Clamped Int16 Uint16 Int32 Uint32 Float32 Float64".split(" ");$jscomp.global.BigInt64Array&&(b.push("BigInt64"),b.push("BigUint64"));return b}();$jscomp.polyfillTypedArrayMethod=function(b,a,h,f){if(a)for(var l=0;l<$jscomp.TYPED_ARRAY_CLASSES.length;l++){var d=$jscomp.TYPED_ARRAY_CLASSES[l]+"Array.prototype."+b;$jscomp.ISOLATE_POLYFILLS?$jscomp.polyfillIsolated(d,a,h,f):$jscomp.polyfillUnisolated(d,a,h,f)}};
$jscomp.polyfill=function(b,a,h,f){a&&($jscomp.ISOLATE_POLYFILLS?$jscomp.polyfillIsolated(b,a,h,f):$jscomp.polyfillUnisolated(b,a,h,f))};$jscomp.polyfillUnisolated=function(b,a,h,f){h=$jscomp.global;b=b.split(".");for(f=0;f<b.length-1;f++){var l=b[f];if(!(l in h))return;h=h[l]}b=b[b.length-1];f=h[b];a=a(f);a!=f&&a!=null&&$jscomp.defineProperty(h,b,{configurable:!0,writable:!0,value:a})};
$jscomp.polyfillIsolated=function(b,a,h,f){var l=b.split(".");b=l.length===1;f=l[0];f=!b&&f in $jscomp.polyfills?$jscomp.polyfills:$jscomp.global;for(var d=0;d<l.length-1;d++){var g=l[d];if(!(g in f))return;f=f[g]}l=l[l.length-1];h=$jscomp.IS_SYMBOL_NATIVE&&h==="es6"?f[l]:null;a=a(h);a!=null&&(b?$jscomp.defineProperty($jscomp.polyfills,l,{configurable:!0,writable:!0,value:a}):a!==h&&($jscomp.propertyToPolyfillSymbol[l]===void 0&&(h=Math.random()*1E9>>>0,$jscomp.propertyToPolyfillSymbol[l]=$jscomp.IS_SYMBOL_NATIVE?
$jscomp.global.Symbol(l):$jscomp.POLYFILL_PREFIX+h+"$"+l),$jscomp.defineProperty(f,$jscomp.propertyToPolyfillSymbol[l],{configurable:!0,writable:!0,value:a})))};
$jscomp.getConstructImplementation=function(){function b(){function h(){}new h;Reflect.construct(h,[],function(){});return new h instanceof h}if($jscomp.TRUST_ES6_POLYFILLS&&typeof Reflect!="undefined"&&Reflect.construct){if(b())return Reflect.construct;var a=Reflect.construct;return function(h,f,l){h=a(h,f);l&&Reflect.setPrototypeOf(h,l.prototype);return h}}return function(h,f,l){l===void 0&&(l=h);l=$jscomp.objectCreate(l.prototype||Object.prototype);return Function.prototype.apply.call(h,l,f)||
l}};$jscomp.construct={valueOf:$jscomp.getConstructImplementation}.valueOf();$jscomp.underscoreProtoCanBeSet=function(){var b={a:!0},a={};try{return a.__proto__=b,a.a}catch(h){}return!1};$jscomp.setPrototypeOf=$jscomp.ASSUME_ES6||$jscomp.TRUST_ES6_POLYFILLS&&typeof Object.setPrototypeOf=="function"?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.ASSUME_ES6||$jscomp.setPrototypeOf){var h=$jscomp.setPrototypeOf;h(b,a)}else for(h in a)if(h!="prototype")if(Object.defineProperties){var f=Object.getOwnPropertyDescriptor(a,h);f&&Object.defineProperty(b,h,f)}else b[h]=a[h];b.superClass_=a.prototype};$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=typeof Symbol!="undefined"&&Symbol.iterator&&b[Symbol.iterator];if(a)return a.call(b);if(typeof b.length=="number")return $jscomp.arrayIterator(b);throw Error(String(b)+" is not an iterable or ArrayLike");};$jscomp.arrayFromIterator=function(b){for(var a,h=[];!(a=b.next()).done;)h.push(a.value);return h};$jscomp.arrayFromIterable=function(b){return b instanceof Array?b:$jscomp.arrayFromIterator($jscomp.makeIterator(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.getNextAddressJsc=function(){return this.nextAddress};$jscomp.generator.Context.prototype.getNextAddressJsc=function(){return this.nextAddress};$jscomp.generator.Context.prototype.getYieldResultJsc=function(){return this.yieldResult};$jscomp.generator.Context.prototype.getYieldResultJsc=function(){return this.yieldResult};
$jscomp.generator.Context.prototype.return=function(b){this.abruptCompletion_={return:b};this.nextAddress=this.finallyAddress_};$jscomp.generator.Context.prototype["return"]=$jscomp.generator.Context.prototype.return;$jscomp.generator.Context.prototype.jumpThroughFinallyBlocks=function(b){this.abruptCompletion_={jumpTo:b};this.nextAddress=this.finallyAddress_};$jscomp.generator.Context.prototype.jumpThroughFinallyBlocks=$jscomp.generator.Context.prototype.jumpThroughFinallyBlocks;
$jscomp.generator.Context.prototype.yield=function(b,a){this.nextAddress=a;return{value:b}};$jscomp.generator.Context.prototype.yield=$jscomp.generator.Context.prototype.yield;$jscomp.generator.Context.prototype.yieldAll=function(b,a){b=$jscomp.makeIterator(b);var h=b.next();$jscomp.generator.ensureIteratorResultIsObject_(h);if(h.done)this.yieldResult=h.value,this.nextAddress=a;else return this.yieldAllIterator_=b,this.yield(h.value,a)};$jscomp.generator.Context.prototype.yieldAll=$jscomp.generator.Context.prototype.yieldAll;
$jscomp.generator.Context.prototype.jumpTo=function(b){this.nextAddress=b};$jscomp.generator.Context.prototype.jumpTo=$jscomp.generator.Context.prototype.jumpTo;$jscomp.generator.Context.prototype.jumpToEnd=function(){this.nextAddress=0};$jscomp.generator.Context.prototype.jumpToEnd=$jscomp.generator.Context.prototype.jumpToEnd;$jscomp.generator.Context.prototype.setCatchFinallyBlocks=function(b,a){this.catchAddress_=b;a!=void 0&&(this.finallyAddress_=a)};
$jscomp.generator.Context.prototype.setCatchFinallyBlocks=$jscomp.generator.Context.prototype.setCatchFinallyBlocks;$jscomp.generator.Context.prototype.setFinallyBlock=function(b){this.catchAddress_=0;this.finallyAddress_=b||0};$jscomp.generator.Context.prototype.setFinallyBlock=$jscomp.generator.Context.prototype.setFinallyBlock;$jscomp.generator.Context.prototype.leaveTryBlock=function(b,a){this.nextAddress=b;this.catchAddress_=a||0};$jscomp.generator.Context.prototype.leaveTryBlock=$jscomp.generator.Context.prototype.leaveTryBlock;
$jscomp.generator.Context.prototype.enterCatchBlock=function(b){this.catchAddress_=b||0;b=this.abruptCompletion_.exception;this.abruptCompletion_=null;return b};$jscomp.generator.Context.prototype.enterCatchBlock=$jscomp.generator.Context.prototype.enterCatchBlock;$jscomp.generator.Context.prototype.enterFinallyBlock=function(b,a,h){h?this.finallyContexts_[h]=this.abruptCompletion_:this.finallyContexts_=[this.abruptCompletion_];this.catchAddress_=b||0;this.finallyAddress_=a||0};
$jscomp.generator.Context.prototype.enterFinallyBlock=$jscomp.generator.Context.prototype.enterFinallyBlock;$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_();a.jumpTo!=void 0&&this.finallyAddress_<a.jumpTo?(this.nextAddress=a.jumpTo,this.abruptCompletion_=null):this.nextAddress=this.finallyAddress_}else this.nextAddress=b};
$jscomp.generator.Context.prototype.leaveFinallyBlock=$jscomp.generator.Context.prototype.leaveFinallyBlock;$jscomp.generator.Context.prototype.forIn=function(b){return new $jscomp.generator.Context.PropertyIterator(b)};$jscomp.generator.Context.prototype.forIn=$jscomp.generator.Context.prototype.forIn;$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(;this.properties_.length>0;){var b=this.properties_.pop();if(b in this.object_)return b}return null};$jscomp.generator.Context.PropertyIterator.prototype.getNext=$jscomp.generator.Context.PropertyIterator.prototype.getNext;$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(h){return{value:h,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,h){try{var f=b.call(this.context_.yieldAllIterator_,a);$jscomp.generator.ensureIteratorResultIsObject_(f);if(!f.done)return this.context_.stop_(),f;var l=f.value}catch(d){return this.context_.yieldAllIterator_=null,this.context_.throw_(d),this.nextStep_()}this.context_.yieldAllIterator_=null;h.call(this.context_,l);return this.nextStep_()};
$jscomp.generator.Engine_.prototype.nextStep_=function(){for(;this.context_.nextAddress;)try{var b=this.program_(this.context_);if(b)return this.context_.stop_(),{value:b.value,done:!1}}catch(a){this.context_.yieldResult=void 0,this.context_.throw_(a)}this.context_.stop_();if(this.context_.abruptCompletion_){b=this.context_.abruptCompletion_;this.context_.abruptCompletion_=null;if(b.isException)throw b.exception;return{value:b.return,done:!0}}return{value:void 0,done:!0}};
$jscomp.generator.Generator_=function(b){this.next=function(a){return b.next_(a)};this.throw=function(a){return b.throw_(a)};this.return=function(a){return b.return_(a)};this[Symbol.iterator]=function(){return this}};$jscomp.generator.createGenerator=function(b,a){a=new $jscomp.generator.Generator_(new $jscomp.generator.Engine_(a));$jscomp.setPrototypeOf&&b.prototype&&$jscomp.setPrototypeOf(a,b.prototype);return a};
$jscomp.asyncExecutePromiseGenerator=function(b){function a(f){return b.next(f)}function h(f){return b.throw(f)}return new Promise(function(f,l){function d(g){g.done?f(g.value):Promise.resolve(g.value).then(a,h).then(d,l)}d(b.next())})};$jscomp.asyncExecutePromiseGeneratorFunction=function(b){return $jscomp.asyncExecutePromiseGenerator(b())};$jscomp.asyncExecutePromiseGeneratorProgram=function(b){return $jscomp.asyncExecutePromiseGenerator(new $jscomp.generator.Generator_(new $jscomp.generator.Engine_(b)))};
$jscomp.checkStringArgs=function(b,a,h){if(b==null)throw new TypeError("The 'this' value for String.prototype."+h+" must not be null or undefined");if(a instanceof RegExp)throw new TypeError("First argument to String.prototype."+h+" must not be a regular expression");return b+""};$jscomp.stringPadding=function(b,a){b=b!==void 0?String(b):" ";return a>0&&b?b.repeat(Math.ceil(a/b.length)).substring(0,a):""};
$jscomp.polyfill("String.prototype.padStart",function(b){return b?b:function(a,h){var f=$jscomp.checkStringArgs(this,null,"padStart");return $jscomp.stringPadding(h,a-f.length)+f}},"es8","es3");$jscomp.polyfill("Array.prototype.includes",function(b){return b?b:function(a,h){var f=this;f instanceof String&&(f=String(f));var l=f.length;h=h||0;for(h<0&&(h=Math.max(h+l,0));h<l;h++){var d=f[h];if(d===a||Object.is(d,a))return!0}return!1}},"es7","es3");
$jscomp.checkEs6ConformanceViaProxy=function(){try{var b={},a=Object.create(new $jscomp.global.Proxy(b,{get:function(h,f,l){return h==b&&f=="q"&&l==a}}));return a.q===!0}catch(h){return!1}};$jscomp.USE_PROXY_FOR_ES6_CONFORMANCE_CHECKS=!1;$jscomp.ES6_CONFORMANCE=$jscomp.USE_PROXY_FOR_ES6_CONFORMANCE_CHECKS&&$jscomp.checkEs6ConformanceViaProxy();$jscomp.initSymbol=function(){};$jscomp.iteratorPrototype=function(b){b={next:b};b[Symbol.iterator]=function(){return this};return b};
$jscomp.owns=function(b,a){return Object.prototype.hasOwnProperty.call(b,a)};$jscomp.MapEntry=function(){};$jscomp.polyfill("Set.prototype.intersection",function(b){return b?b:function(a){$jscomp.checkIsSetInstance(this);$jscomp.checkIsSetLike(a);var h=new Set,f=$jscomp.getSmallerAndLargerSets(this,a);a=f.smallerSetIterator;f=f.largerSet;for(var l=a.next();!l.done;)f.has(l.value)&&h.add(l.value),l=a.next();return h}},"es_next","es6");
$jscomp.checkIsSetLike=function(b){if(typeof b!=="object"||b===null||typeof b.size!=="number"||b.size<0||typeof b.keys!=="function"||typeof b.has!=="function")throw new TypeError("Argument must be set-like");};$jscomp.checkIsValidIterator=function(b){if(typeof b!=="object"||b===null||typeof b.next!=="function")throw new TypeError("Invalid iterator.");return b};
$jscomp.getSmallerAndLargerSets=function(b,a){return b.size<=a.size?{smallerSetIterator:b.keys(),largerSet:a}:{smallerSetIterator:$jscomp.checkIsValidIterator(a.keys()),largerSet:b}};$jscomp.checkIsSetInstance=function(b){if(!(b instanceof Set))throw new TypeError("Method must be called on an instance of Set.");};
$jscomp.polyfill("Array.prototype.flat",function(b){return b?b:function(a){a=a===void 0?1:a;var h=[];Array.prototype.forEach.call(this,function(f){Array.isArray(f)&&a>0?(f=Array.prototype.flat.call(f,a-1),h.push.apply(h,f)):h.push(f)});return h}},"es9","es5");window.descartesJS=window.descartesJS||{};
window.babel=(b=>{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})({});
(b=>{b.addFonts=function(){const 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=" ";
const h=["sansserif","monospace","serif","math"],f=[["normal","bold"],["italic","bold"],["italic","normal"],["normal","normal"]];let l=document.styleSheets[0];for(let d of h)for(let g of f)l.insertRule(`@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]};}`)}})(descartesJS);
(b=>{b.addSymbolFont=function(){let a=[["normal","bold"],["italic","bold"],["italic","normal"],["normal","normal"]],h=document.styleSheets[0];for(let f of a)h.insertRule(`@font-face{font-family:'DJS_symbol';src:url('data:font/woff2;charset=utf-8;base64, ') format('woff2');font-style:${f[0]};font-weight:${f[1]};}`)}})(descartesJS);
(b=>{let a,h,f,l={bold:"Bold",italic:"Italic",italics:"Italic","bold+italic":"Italic Bold"};b.serif_font="descartesJS_serif,DJS_symbol,DJS_serif,Times,'Times New Roman','Liberation Serif','Nimbus Roman No9 L Regular',serif";b.sansserif_font="descartesJS_sansserif,DJS_symbol,DJS_sansserif,Helvetica,Arial,'Liberation Sans','Nimbus Sans L',sans-serif";b.monospace_font="descartesJS_monospace,DJS_symbol,DJS_monospace,'Courier New',Courier,'Liberation Mono','Nimbus Mono L',monospace";b.math_font="descartesJS_math,DJS_symbol,DJS_math,DJS_serif,Times,'Times New Roman','Liberation Serif','Nimbus Roman No9 L Regular',serif";
b.convertFont=function(d){if(d=="")return"";a=d.split(",");h="";h+=b.getFontStyle(a[1])+" ";h+=a[2]+"px ";return h+=b.getFontName(a[0].split(" ")[0])};b.getFontName=function(d){d=d.toLowerCase();f=b.monospace_font;/sansserif|arial|helvetica/.test(d)?f=b.sansserif_font:/serif|times/.test(d)&&(f=b.serif_font);return f};b.getFontStyle=function(d){return l[d.toLowerCase()]||""};b.getTextWidth=function(d,g){if(d=="")return 0;b.ctx.font=g;return Math.round(b.ctx.measureText(d).width*100)/100};b.getFieldFontSize=
function(d){d=Math.min(50,d);return d=d>=24?Math.floor(d/2+2-d/16):d>=20?12:d>=17?11:d>=15?10:9}})(descartesJS);
(b=>{function a(){let n,t,c,v,m,k,r;Number.prototype.oToFixed=Number.prototype.toFixed;Number.prototype.toFixed=function(p=0){p=Math.max(0,parseInt(p));n=this.toString();n.indexOf("e")!==-1&&(v=n.split("e"),k=v[0][0]==="-"?"-":"",m=k==="-"?parseFloat(v[0].substring(1)).oToFixed(11):parseFloat(v[0]).oToFixed(11),r=parseInt(v[1]),t=m.indexOf("."),m=m.replace(".",""),t+r<0?(t=t<0?1:t,n=k+"0."+"0".repeat(Math.abs(t+r))+m):n=k+m+"0".repeat(r-m.length+1));t=n.indexOf(".");t===-1?p>0&&(n+="."+"0".repeat(p)):
(c=n.length-t-1,n=c>=p?p<=11?parseFloat(n).oToFixed(p):n.substring(0,t+p+1):n+"0".repeat(p-c));return n}}const h=360/(Math.PI*2),f=Math.PI*2/360;let l=Math.floor,d,g,e,q;b.rangeOK=1;b.cssScale=1;b.radToDeg=function(n){return n*h};b.degToRad=function(n){return n*f};b.getFeatures=function(){var n="";try{n=navigator.appVersion.toLowerCase()}catch(t){console.warn("navigator.appVersion is deprecated")}b.hasTouchSupport=window.hasOwnProperty&&window.hasOwnProperty("ontouchstart")||"ontouchstart"in window||
/android/i.test(n);b.isIOS=/iPad|iPhone/i.test(navigator.userAgent);n=b.newHTML("canvas");b.hasCanvas=n.getContext&&n.getContext("2d");b.hasCanvas&&(n.width=n.height=1,b.ctx=b.hasCanvas,b.ctx.textRendering="geometricPrecision",n=window.devicePixelRatio||1,b._ratio=n==1?1.25:n);a()};b.removeNeedlessDecimals=function(n){if(typeof n=="string"&&(e=n.indexOf("."),e!==-1)){q=n.substring(e);if(parseFloat(q)==0)return n.substring(0,e);for(let t=q.length-1;t>0;t--)if(q.charAt(t)!=="0")return n.substring(0,
e+t+1)}return n};b.whichBtn=function(n){return n.pointerType&&(n.pointerType==="touch"||n.pointerType==="pen")||n.touches?"L":n.button===0?"L":n.button===1?"M":"R"};b.createGradient=function(n=0,t=100,c=0){c=`linear-gradient(${c}deg,`;let v=n*2;for(let m=n;m<t;m++)n=l(100-m-35),c+=`rgba(0,0,0,${n*n*192/1E4/255}) ${m*2-v}%, `;return c+"rgba(0,0,0,0.1) 100%)"};b.getCursorPosition=function(n,t){d=n;n.touches&&n.touches.length>0&&(d=n.touches[0]);if(!d||typeof d.clientX==="undefined")return null;g=t.getBoundingClientRect();
return{x:(d.clientX-g.left)/b.cssScale,y:(d.clientY-g.top)/b.cssScale}};b.splitSeparator=function(n){n=n.replace(/\\n/g,"\n");let t=!1,c,v=[],m=0;for(let k=0,r=n.length;k<r;k++)c=n.charAt(k),c==="'"&&(t=!t),t||c!==";"&&c!=="\n"||(v.push(n.substring(m,k).replace(/\n/g,"\\n")),m=k+1);v.push(n.substring(m).replace(/\n/g,"\\n"));return v};b.preventDefault=function(n){n.stopPropagation();n.preventDefault();return!1};b.convertHTMLEntities=function(n){let t=b.newHTML("textarea");t.innerHTML=n;return t.value};
b.newHTML=function(n,t){n=document.createElement(n);for(let c in t)n.setAttribute(c,t[c]);return n};window.requestAnimationFrame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame;window.cancelAnimationFrame=window.cancelAnimationFrame||window.mozCancelAnimationFrame;b.setInterval=function(n,t){function c(){Date.now()-v>=t&&(n.call(),v=Date.now());m.value=requestAnimationFrame(c)}if(!requestAnimationFrame)return setInterval(n,
t);let v=Date.now(),m={};m.value=requestAnimationFrame(c);return m};b.clearInterval=function(n){n&&(cancelAnimationFrame?cancelAnimationFrame(n.value):clearInterval(n))};b.setTimeout=function(n,t){function c(){Date.now()-v>=t?n.call():m.value=requestAnimationFrame(c)}if(!requestAnimationFrame)return setTimeout(n,t);let v=Date.now(),m={};m.value=requestAnimationFrame(c);return m};b.clearTimeout=function(n){n&&(cancelAnimationFrame?cancelAnimationFrame(n.value):clearTimeout(n))};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")}})(descartesJS);
(b=>{b.cacheFiles=Object.create(null);b.openFile=function(a){if(b.cacheFiles[a])return b.cacheFiles[a];let h=null,f=new XMLHttpRequest;f.open("GET",a,!1);try{f.send(null),h=f.status===200||f.status===304?f.responseText:f.responseText||"",h=f.status===404?"":h,h.match(String.fromCharCode(65533))&&(f.open("GET",a,!1),f.overrideMimeType("text/plain;charset=ISO-8859-1"),f.send(null),h=f.responseText)}catch(l){h=null}return h};b.addExternalFileContent=function(a,h){b.cacheFiles[a]=h}})(descartesJS);
(b=>{function a(e="",q){let n={},t=e.match(/^\s*(\(|\[)(.*)(\)|\])\s*$/);t?(n.type=t[1]+t[3],t=b.splitComa(t[2]),n.min=q.parser.parse(t[0]),n.max=q.parser.parse(t[1])):(n.type="[]",n.min=n.max=q.parser.parse(e));return n}function h(e=""){return e.toString().normalize("NFD").replace(/[\u0300-\u036f]/g,"")}let f,l,d,g;b.answerRegEx=function(e="",q,n){n&&/^\(.*\)$/.test(e)&&(e=e.slice(1,-1));e=e.replace(/&squot;/g,"'").replace(/&amp;/g,"&").split("|");for(let m=0,k=e.length;m<k;m++){l=e[m].split("&");
d=[];for(let r of l)if(n){var t=d,c=t.push,v=r;v=v.replace(/\+/g,"\\+").replace(/\*/g,"\\*").replace(/\(/g,"\\(").replace(/\)/g,"\\)");f=v.trim();v={ignoreAccents:!1,ignoreCaps:!1,regExp:null};/^'.*'$/.test(f)&&(v.ignoreCaps=!0,f=f.slice(1,-1),/^`.*\u00b4$/.test(f)&&(v.ignoreAccents=!0,f=f.slice(1,-1)));/^`.*\u00b4$/.test(f)&&(v.ignoreAccents=!0,f=f.slice(1,-1),/^'.*'$/.test(f)&&(v.ignoreCaps=!0,f=f.slice(1,-1)));f.startsWith("\\*")&&!f.endsWith("\\*")?f=f.substring(2)+"$":!f.startsWith("\\*")&&f.endsWith("\\*")?
f="^"+f.substring(0,f.length-2):f.startsWith("\\*")||f.endsWith("\\*")?f.startsWith("\\*")&&f.endsWith("\\*")&&(f=f.substring(2,f.length-2)):f="^"+f+"$";v.regExp=f.replace(/\?/g,"[\\S\\s]{1}");c.call(t,v)}else d.push(a(r,q));e[m]=d}return e};b.esCorrecto=function(e,q="",n){q+="";for(let v of e){g=!0;for(let m of v)if(f=m.regExp)m.ignoreAccents&&(q=h(q),f=h(f)),m.ignoreCaps&&(q=q.toLowerCase(),f=h(f).toLowerCase()),g=g&&!!q.match(f);else{if(e=g){e=m;var t=q,c=n;t=parseFloat(t);let k=c.eval(e.min);
c=c.eval(e.max);c=e.type[1]==")"?t<c:t<c||Math.abs(c-t)<1E-9;e=(e.type[0]=="("?k<t:k<t||Math.abs(k-t)<1E-9)&&c}g=e}if(g)return 1}return 0}})(descartesJS);
(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,h="24c"){return"data:image/svg+xml;base64,"+btoa(`<svg xmlns='http://www.w3.org/2000/svg' width="24" height="24" viewBox="0 0 24 24"><path transform="rotate(${a?90:0},12,12)" fill="#${h}" d="m19.5 17.5-7.5-12-7.5 12z"/></svg>`)};b.getSvgArrowDown=function(a,h="d00018"){return"data:image/svg+xml;base64,"+btoa(`<svg xmlns='http://www.w3.org/2000/svg' width="24" height="24" viewBox="0 0 24 24"><path transform="rotate(${a?90:0},12,12)" d="m19.5 5-7.5 12-7.5-12z" fill="#${h}"/></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>')}})(descartesJS);
(b=>{const a=Math.floor;let h=/[\w-//]*(\.png|\.jpg|\.gif|\.svg|\.webp)/gi,f,l,d,g,e,q,n,t,c,v,m,k,r,p,x,u,z,A;class w{constructor(y,D){this.r=this.g=this.b=0;this.a=1;this.evaluator=D;this.getColor=this.getColorStr;if(!y)this.colorStr=`rgba(${this.r},${this.g},${this.b},${this.a})`;else if(/^GradL/.test(y)){y=b.splitComa(y.substring(6,y.length-1));this.x1=this.evaluator.parser.parse(y[0]);this.y1=this.evaluator.parser.parse(y[1]);this.x2=this.evaluator.parser.parse(y[2]);this.y2=this.evaluator.parser.parse(y[3]);
this.stops=[];for(let F=4;F<y.length;F++)y[F]!=""&&(D=y[F].split("|"),this.stops.push({percentage:this.evaluator.parser.parse(D[1]),color:"#"+D[2]}));this.getColor=this.getLinearGradient}else if(/^Pattern/.test(y))this.img_src=y.substring(8,y.length-1),this.img_src.match(h)&&(this.img_src="'"+this.img_src+"'"),this.img_src=this.evaluator.parser.parse(this.img_src),this.getColor=this.getPattern;else if(babel[y])babel[y]==="net"&&(y="rojo"),y=babel[y],this.r=b.toHex(y.substring(1,3)),this.g=b.toHex(y.substring(3,
5)),this.b=b.toHex(y.substring(5,7)),this.colorStr=y;else if(y.length===6)this.r=b.toHex(y.substring(0,2)),this.g=b.toHex(y.substring(2,4)),this.b=b.toHex(y.substring(4,6)),this.colorStr="#"+y;else if(y.length===8)this.r=b.toHex(y.substring(2,4)),this.g=b.toHex(y.substring(4,6)),this.b=b.toHex(y.substring(6,8)),this.a=1-b.toHex(y.substring(0,2))/255,this.colorStr=`rgba(${this.r},${this.g},${this.b},${this.a})`;else if(y[0]==="("){l=[];d=b.splitComa(y.substring(1,y.length-1));for(let F=0,B=d.length;F<
B;F++)q=d[F],g=parseInt(q,16),q!==g.toString(16)&&q!=="0"+g.toString(16)?(q.charAt(0)==="["&&q.charAt(q.length-1)==="]"&&(q=q.substring(1,q.length-1)),l.push(this.evaluator.parser.parse(q))):l.push(this.evaluator.parser.parse((g/255).toString()));this.rExpr=l[0];this.gExpr=l[1];this.bExpr=l[2];this.aExpr=l[3];this.getColor=this.getColorExp}}getColorStr(){return this.colorStr}getColorExp(){f=this.evaluator;this.r=a(f.eval(this.rExpr)*255);this.g=a(f.eval(this.gExpr)*255);this.b=a(f.eval(this.bExpr)*
255);this.a=1-f.eval(this.aExpr);return`rgba(${this.r},${this.g},${this.b},${this.a})`}getLinearGradient(){f=this.evaluator;u=b.ctx.createLinearGradient(f.eval(this.x1),f.eval(this.y1),f.eval(this.x2),f.eval(this.y2));for(let y=0;y<this.stops.length;y++)x=f.eval(this.stops[y].percentage),x=x<0?0:x>1?1:x,u.addColorStop(x,this.stops[y].color);return u}getPattern(){A=this.evaluator.parent;if(z=A.getImage(this.evaluator.eval(this.img_src)))try{return b.ctx.createPattern(z,"repeat")}catch(y){}return"ff00ff"}borderColor(){return this.r+
this.g+this.b<380?"#ffffff":"#000000"}}b.toHex=function(y){return parseInt("0x"+y,16)};b.RGBAToHexColor=function(y){y=y.substring(5,y.length-1).split(",");m=parseInt(y[0]).toString(16).padStart(2,"0");k=parseInt(y[1]).toString(16).padStart(2,"0");r=parseInt(y[2]).toString(16).padStart(2,"0");p=(255-parseInt(parseFloat(y[3])*255)).toString(16).padStart(2,"0");return new w(p+m+k+r)};b.splitComa=function(y){e=[];c=t=n=0;for(let D=0,F=y.length;D<F;D++)v=y[D],v==="("?n++:v===")"?n--:v==="["?t++:v==="]"?
t--:v===","&&n===0&&t===0&&(e.push(y.substring(c,D)),c=D+1);e.push(y.substring(c));return e};b.Color=w})(descartesJS);
(b=>{class a{constructor(h){this.parent=h;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:descartesJS_sansserif; font-size:17px; font-weight:normal; line-height:38px",class:"new_line_btn"});this.newLine.textContent="\\n";this.newLine.addEventListener("pointerup",()=>{this.insert("\n")});this.container.appendChild(this.newLine);this.display.addEventListener("keydown",g=>{this.keypressed=!0;if(g.keyCode===27)this.close();
else if(g.keyCode===13)this.onEnter()});this.key_pressed=this.delete_pressed=!1;let f,l;this.keyContainer.addEventListener("pointerdown",g=>{if(/^(k_op|k_dot|k_a|k_e|k_i|k_o|k_u)$/.test(g.target.id)){g.target.onpointerleave=function(){clearTimeout(f)};let e=g.target.textContent.trim().toLowerCase();f=setTimeout(()=>{this.key_pressed=!0;this.showAditionalKeys(e)},600)}else g.target.id=="k_del"&&(g.target.onpointerleave=function(){clearTimeout(l)},l=setInterval(()=>{this.delete_pressed=!0;this.delete()},
200))});this.keyContainer.addEventListener("pointerup",g=>{if(g.target!=this.keyContainer&&g.target!=this.container)if(g.preventDefault(),g.stopPropagation(),g.target.id=="k_left")this.display.selectionStart=this.display.selectionEnd=Math.max(0,this.display.selectionStart-1);else if(g.target.id=="k_right")this.display.selectionStart=this.display.selectionEnd=Math.min(this.display.value.length,this.display.selectionStart+1);else if(g.target.id=="k_del")this.delete_pressed||this.delete(),clearTimeout(l),
this.delete_pressed=!1;else if(g.target.id=="k_\u221a")this.insert("\u221a(");else if(g.target.id=="k_space")this.insert(" ");else if(g.target.id=="k_esc")this.close();else if(g.target.id=="k_shift"){g=this.keyContainer.querySelectorAll("div");let e=this.additionalKeys.querySelectorAll("div");(this.shift=!this.shift)?(g.forEach(q=>{q.textContent.trim().length==1&&(q.textContent=q.textContent.toUpperCase());q.getAttribute("id")=="k_point_comma"&&(q.textContent=",")}),e.forEach(q=>{q.textContent=q.textContent.toUpperCase()})):
(g.forEach(q=>{q.textContent.trim().length==1&&(q.textContent=q.textContent.toLowerCase());q.getAttribute("id")=="k_point_comma"&&(q.textContent=".")}),e.forEach(q=>{q.textContent=q.textContent.toLowerCase()}))}else if(g.target.id=="k_num_layout")this["setLayout_"+this.layout_mode.replace("alfa","num")]();else if(g.target.id=="k_alfa_layout")this["setLayout_"+this.layout_mode.replace("num","alfa")]();else if(g.target.id=="k_clear")this.display.value="";else if(/^(k_op|k_dot|k_a|k_e|k_i|k_o|k_u)$/.test(g.target.id))clearTimeout(f),
this.key_pressed||(this.insert(g.target.textContent.trim()),this.additionalKeys.style.display="none"),this.key_pressed=!1;else if(g.target.id=="k_return")this.onEnter();else g=g.target.textContent.trim(),this.insert(g),this.additionalKeys.style.display="none";this.display.focus()});this.keyContainer.addEventListener("mouseup",g=>{g.preventDefault();g.stopPropagation()});let d=!1;this.additionalKeys.addEventListener("pointerdown",g=>{d=!0});this.additionalKeys.addEventListener("pointerup",g=>{d&&(g.target!=
this.keyContainer&&g.target!=this.container&&(g.preventDefault(),g.stopPropagation(),g=g.target.textContent.trim(),this.insert(g)),this.key_pressed=!1,this.additionalKeys.style.display="none");d=!1;this.display.focus()})}insert(h){this.display.setRangeText(h);this.display.selectionStart+=h.length;this.display.selectionStart=this.display.selectionEnd;this.display.focus()}delete(){this.display.selectionStart==this.display.selectionEnd&&(this.display.selectionStart=Math.max(0,this.display.selectionStart-
1));this.display.setRangeText("")}addKey(h,f,l){return`<div ${f?`id='${f}'`:""} ${l?`style='${l}'`:""}>${h}</div>`}addKeys(h){let f="";h.forEach(l=>{f=typeof l==="object"?f+this.addKey(l.val,l.id,l.style):f+this.addKey(l)});return f}showAditionalKeys(h){let f=[];h=="."?f=",;:-_\u00bf?\u00a1!()".split(""):h=="+"?f=["-","\u00d7","\u00f7","^"]:h=="a"?f=["\u00e1","\u00e0","\u00e4","\u00e2"]:h=="e"?f=["\u00e9","\u00e8","\u00eb","\u00ea"]:h=="i"?f=["\u00ed","\u00ec","\u00ef","\u00ee"]:h=="o"?f=["\u00f3",
"\u00f2","\u00f6","\u00f4"]:h=="u"&&(f=["\u00fa","\u00f9","\u00fc","\u00fb"]);this.additionalKeys.innerHTML=this.addKeys(f);this.shift&&(this.additionalKeys.innerHTML=this.additionalKeys.innerHTML.toUpperCase());this.additionalKeys.style.display="flex";this.additionalKeys.style.left=this.keyContainer.style.left;this.additionalKeys.style.top=parseFloat(this.keyContainer.style.top)-50+"px"}setLayout_14x1(){this.keyContainer.innerHTML=this.addKeys([1,2,3,4,5,6,7,8,9,0,{val:this.parent.decimal_symbol},
"-",{val:"\u232b",id:"k_del"},{val:"\u21b5",id:"k_return"}]);this.keyContainer.style.width="635px"}setLayout_7x2(){this.keyContainer.innerHTML=this.addKeys([1,2,3,4,5,{val:this.parent.decimal_symbol},{val:"\u232b",id:"k_del"},6,7,8,9,0,"-",{val:"\u21b5",id:"k_return"}]);this.keyContainer.style.width="320px"}setLayout_10x2(){this.keyContainer.innerHTML=this.addKeys(["(",1,2,3,4,5,"\u00b2","/","\u00d7",{val:"\u232b",id:"k_del"},")",6,7,8,9,0,{val:this.parent.decimal_symbol},"-","+",{val:"\u21b5",id:"k_return"}]);
this.keyContainer.style.width="455px"}setLayout_4x4(){this.keyContainer.innerHTML=this.addKeys([7,8,9,{val:"\u232b",id:"k_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"}setLayout_5x4(){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"}setLayout_11x3(){this.keyContainer.innerHTML=this.addKeys(["q","w",{val:"e",id:"k_e"},"r","t","y",{val:"u",id:"k_u"},{val:"i",id:"k_i"},{val:"o",id:"k_o"},"p",{val:"\u232b",id:"k_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}setLayout_11x4(){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"}setLayout_10x4_alfa(){this.keyContainer.innerHTML=this.addKeys(["q","w",{val:"e",
id:"k_e"},"r","t","y",{val:"u",id:"k_u"},{val:"i",id:"k_i"},{val:"o",id:"k_o"},"p",{val:"a",id:"k_a"},"s","d","f","g","h","j","k","l","\u00f1",{val:"\u21c5",id:"k_shift",style:"width:62.5px;"},"z","x","c","v","b","n","m",{val:"\u232b",id:"k_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"}setLayout_10x4_num(){this.keyContainer.innerHTML=
this.addKeys(["1","2","3","4","5","6","7","8","9","0","@",'"',"$","_","-","+","(",")","/","*","&","|","\u00ba",":",";","\u00a1","!","\u00bf","?",{val:"\u232b",id:"k_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"}showCustomKB(h){var f=h.querySelectorAll("div");h=parseInt(h.getAttribute("cols")||f.length);let l=
[];var d;for(let g of f){f={val:g.textContent};if(d=g.getAttribute("id"))f.id=d;if(d=g.getAttribute("size"))f.style=`width:${40*parseInt(d)+5*(parseInt(d)-1)}px;transform:none !important;`;l.push(f)}this.keyContainer.innerHTML=this.addKeys(l);this.keyContainer.style.width=5+h*45+"px"}setLayout(h){this.layout_mode=h;let f=document.getElementById("kb_"+h);f?this.showCustomKB(f):h=="14x1"?this.setLayout_14x1():h=="7x2"?this.setLayout_7x2():h=="10x2"?this.setLayout_10x2():h=="4x4"?this.setLayout_4x4():
h=="5x4"?this.setLayout_5x4():h=="11x3"?this.setLayout_11x3():h=="11x4"?this.setLayout_11x4():h=="10x4_alfa"?this.setLayout_10x4_alfa():h=="10x4_num"?this.setLayout_10x4_num():this.setLayout_14x1()}show(h,f,l,d,g,e,q){this.ctr=h;this.var_id=g;this.onlyText=q;this.container.parentNode||this.parent.container.appendChild(this.container);this.container.style.display="block";this.setDisplay(e);this.setLayout(f);this.keyContainer.style.left=l+"px";this.keyContainer.style.top=d+"px";this.additionalKeys.style.display=
"none"}close(){this.container.style.display="none";this.parent.deactivateControls();this.parent.update()}setDisplay(h){let f;let l;let d;if(h.type=="custom"){f=h.x;var g=h.y;l=h.w;var e=h.h;d=h.fs}else g=this.container.getBoundingClientRect(),e=h.getBoundingClientRect(),f=e.left/b.cssScale-g.left/b.cssScale,g=e.top/b.cssScale-g.top/b.cssScale,l=e.width/b.cssScale,e=e.height/b.cssScale,d=h.style.fontSize;h.tagName.toLowerCase()=="textarea"?(this.display.setAttribute("style",`left:${f}px;top:${g}px;width:${l}px;height:${e}px;font-size:${d};line-height:1.2em;padding:5px;font:${h.style.font};`),
this.newLine.style.left=f+l-42+"px",this.newLine.style.top=g+e-42+"px",this.newLine.style.display="block"):(this.display.setAttribute("style",`left:${f}px;top:${g}px;width:${l}px;height:${e}px;font-size:${d};line-height:${e}px;white-space:nowrap;`),this.newLine.style.display="none");this.display.value=h.value||"";this.display.focus();this.display.selectionStart=this.display.selectionEnd=this.display.value.length}onEnter(){let h=this.display.value;if(!this.onlyText){var f=this.parent.evaluator.parser.parse(h.replace(/\u221a/g,
"sqrt"));try{f&&(h=this.parent.evaluator.eval(f))}catch(l){h=0}}if(this.ctr)this.ctr.changeValue(h,!0);else if(this.var_id=(this.var_id+"").trim(),f=this.var_id.indexOf("["),f==-1)this.parent.evaluator.setVariable(this.var_id,h);else{let l=this.var_id.indexOf(","),d=this.var_id.substring(0,f);l==-1?this.parent.evaluator.setVector(d,parseInt(this.var_id.substring(f+1)),h):this.parent.evaluator.setMatrix(d,parseInt(this.var_id.substring(f+1)),parseInt(this.var_id.substring(l+1)),h)}this.close()}}b.Keyboard=
a})(descartesJS);
(b=>{var a=document.head;let h=b.newHTML("meta",{name:"viewport",content:"width=device-width,initial-scale=1.0,user-scalable=yes"});a.querySelector("meta[name=viewport]")||a.appendChild(h);h=b.newHTML("meta",{name:"mobile-web-app-capable",content:"yes"});a.appendChild(h);h=b.newHTML("meta",{name:"apple-mobile-web-app-capable",content:"yes"});a.appendChild(h);h=b.newHTML("meta",{name:"apple-mobile-web-app-status-bar-style",content:"black"});a.appendChild(h);(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;touch-action:manipulation;}\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@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;}}";
b.addSymbolFont();b.addFonts&&b.addFonts()})(descartesJS);
(b=>{let a=Math.sin,h=Math.floor,f=Math.random,l=Math.round,d=Math.abs,g=String.fromCharCode,e,q,n,t,c,v,m,k,r,p;class x{constructor(u=0){this.key=u.toString()}getKey(u){e=[];for(let z=0;z<256;z++)e[z]=g(this.alfanum(h(d(7.5*(a(1*z-u)+a(1.4*z+u)+a(.6*z-u)+a(2.2*z+u))))));return e.join("")}encode(u){q=h(31*f());this.key=this.getKey(q);return g(this.alfanum(q))+this.encripta(u)}decode(u){q=this.numalfa(u.charCodeAt(0));this.key=this.getKey(q);return this.desencripta(u.substring(1))}encripta(u){return this.bytesToString(this.encriptaAux(this.stringToBytes(u)))}encriptaAux(u){if(u==
null||this.key==null)return null;v=Array(3*u.length);for(let z=0,A=u.length;z<A;z++)r=h(u[z]+128)*256+l(f()*255)+l(f()*255)*256*256,p=h((r<<this.shift(z))/256),v[3*z]=this.alfanum(p%32),v[3*z+1]=this.alfanum(p/32%32),v[3*z+2]=this.alfanum(p/1024%32);return v}desencripta(u){return this.bytesToString(this.desencriptaAux(this.stringToBytes(u)))}desencriptaAux(u){if(u==null||this.key==null)return null;m=Array(u.length/3);for(let z=0,A=m.length;z<A;z++)p=this.numalfa(u[3*z])+this.numalfa(u[3*z+1])*32+
this.numalfa(u[3*z+2])*1024,r=h(p*256>>this.shift(z)),k=h(r/256)%256-128,k<0&&(k+=256),m[z]=k;return m}alfanum(u){return(u<10?48:87)+h(u)}numalfa(u){return u-(u<58?48:87)}stringToBytes(u){t=[];for(let z=0,A=u.length;z<A;z++)t.push(u.charCodeAt(z));return t}bytesToString(u){for(let z=0,A=u.length;z<A;z++)u[z]=g(u[z]);return u.join("")}shift(u){n=this.key.charCodeAt(u%this.key.length);t=this.numalfa(n);c=h(t/2%8);c==0&&(c=4);return c}parseByte(u){u=parseInt(u);u=u<0?0:u;return u>255?255:u}}b.Krypto=
x})(descartesJS);
(b=>{let a;class h{constructor(f,l){let d=this;d.parent=f;let g=f.evaluator;f=g.parser;d.delay=f.parse(l.delay?l.delay:"60");d.loop=l.loop?l.loop:!1;d.auto=l.auto==void 0?!0:l.auto;d.controls=l.controls;b.parseExpr(d,l,f);d.animExec=function(){for(let e of d.doExpr)g.eval(e);d.parent.update();d.playing&&(g.eval(d.whileExpr)>0||d.loop)?d.timer=b.setTimeout(d.animExec,g.eval(d.delay)):(d.stop(),d.pause=!1,d.parent.update())};d.playing=!1;d.auto&&d.play()}play(){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))))}stop(){this.playing=!1;b.clearTimeout(this.timer)}reinit(){for(let f of this.init)this.parent.evaluator.eval(f)}}b.Animation=h})(descartesJS);(b=>{class a{constructor(h,f=""){this.parent=h;this.parameter=f.replace(/\\n/g,"\n").replace(/&squot;/g,"'")}execute(){alert(this.parameter)}}b.Message=a})(descartesJS);
(b=>{class a{constructor(h,f=""){this.parent=h;f=b.splitSeparator((f||"").replace(/&squot;/g,"'"));this.inst=f.map(l=>this.parent.evaluator.parser.parse(l,!0)).filter(l=>l)}execute(){for(let h of this.inst)this.parent.evaluator.eval(h)}}b.Calculate=a})(descartesJS);
(b=>{class a{constructor(f,l=""){this.parent=f;this.param=l.trim();this.target="_blank"}execute(f=""){let l=this.param;var d=l.match(/^(.*)\s*target=(.*)/);d&&(l=d[1].trim(),this.target=d[2].trim());/^\[.*\]$/.test(l)&&(l=this.parent.evaluator.eval(this.parent.evaluator.parser.parse(l.slice(1,-1))));if(d=l.match(/^javascript:(.*)$/))try{(new Function(d[1]))()}catch(g){}else/^(http|www)/.test(l)||(d=window.__dirname||window.location.href,l=d.substring(0,d.lastIndexOf("/")+1)+l),l.startsWith("www.")&&
(l="https://"+l),window.open(l,this.target,f)}}class h extends a{constructor(f,l=""){super(f,l)}execute(){super.execute(`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=h})(descartesJS);
(b=>{class a{constructor(h){this.parent=h}execute(){this.parent.editor?this.parent.editor.show():window.open("about:blank","_blank","width=800px,height=600px,location=no,menubar=no,scrollbars=yes").document.write("<xmp style='width:100%;height:100%;'>"+this.parent.applet.outerHTML.replace(/<applet/g,"<ajs").replace(/<\/applet/g,"</ajs")+"</xmp>")}}b.Config=a})(descartesJS);(b=>{class a{constructor(h){this.parent=h}execute(){this.parent.init()}}b.Init=a})(descartesJS);
(b=>{class a{constructor(h){this.parent=h}execute(){this.parent.clear()}}b.Clear=a})(descartesJS);(b=>{class a{constructor(h){this.parent=h}execute(){this.parent.play()}}b.Animate=a})(descartesJS);(b=>{class a{constructor(h){this.parent=h}execute(){this.parent.reinitAnimation()}}b.InitAnimation=a})(descartesJS);
(b=>{class a{constructor(h,f=""){this.parent=h;(h=f.match(/[\w\.\-//]*(\.ogg|\.oga|\.mp3|\.wav)/gi))?this.filename=this.parent.evaluator.parser.parse(`'${h}'`):(/^\[.*\]$/.test(f)&&(f=f.slice(1,-1)),this.filename=this.parent.evaluator.parser.parse(f))}execute(){const h=this.parent.getAudio(this.parent.evaluator.eval(this.filename));h.paused?h.play():(h.pause(),h.currentTime=0)}}b.PlayAudio=a})(descartesJS);
(b=>{let a,h,f;class l{constructor(d,g){a=this;a.parent=d;a.evaluator=d.evaluator;a.id=a.expresion=a.init=a.privateVars=a.doExpr=a.whileExpr="";a.evaluate="onlyOnce";Object.assign(a,g)}firstRun(){}update(){}}b.splitInstructions=function(d,g){g=g?b.splitSeparator(g):[""];return g.map((e,q)=>{b.DEBUG.lineCount=q;return d.parse(e,!0)}).filter(e=>e)};b.parseExpr=function(d,g,e){b.DEBUG.pName="inicio";d.init=b.splitInstructions(e,g.init);b.DEBUG.pName="local";d.privateVars=b.getPrivateVariables(e,g.local);
b.DEBUG.pName="hacer";d.doExpr=b.splitInstructions(e,g.doExpr);b.DEBUG.pName="mientras";d.whileExpr=e.parse(g.whileExpr)};b.getPrivateVariables=function(d,g){h=[];g=g?g.split(/;|,/):[""];for(let e of g)(f=d.parse(e,!0))&&h.push(f);for(let e=0,q=h.length;e<q;e++)h[e]=h[e].type==="assign"?h[e].childs[0].value:h[e].type==="identifier"?h[e].value:"";return h};b.Auxiliary=l})(descartesJS);
(b=>{class a extends b.Auxiliary{constructor(h,f){super(h,f);f=this.evaluator;this.expresionString=this.expresion;(this.expresion=f.parser.parse(this.expresionString))&&f.setVariable(this.id,this.expresion);this.editable&&(this.registerTextField(),h.editableRegionVisible=!0)}registerTextField(){let h=this,f=h.evaluator,l=b.newHTML("div"),d=b.newHTML("label");d.appendChild(document.createTextNode(`___${h.id}=___`));let g=b.newHTML("input");g.value=h.expresionString;g.disabled=!h.editable;l.appendChild(d);
l.appendChild(g);g.onkeydown=function(e){e.keyCode==13&&(h.expresion=parser.parse(this.value),f.setVariable(h.id,h.expresion),h.parent.update())};h.parent.editableRegion.textFields.push({container:l,type:"div"})}}b.Variable=a})(descartesJS);(b=>{class a extends b.Auxiliary{constructor(h,f){super(h,f);this.expresion=this.evaluator.parser.parse(this.expresion);this.update()}update(){this.evaluator.setVariable(this.id,this.evaluator.eval(this.expresion))}}b.Constant=a})(descartesJS);
(b=>{let a,h,f,l,d;class g extends b.Auxiliary{constructor(e,q){super(e,q);a=this;f=e.evaluator.parser;a.size=a.size||f.parse("3");a.expresion=a.expresion.split(";");a.parseFile=f.parse(a.file);a.update()}update(){a=this;var e=a.expresion,q;h=a.evaluator;f=h.parser;a.oldFile=a.file;if(l=h.eval(a.parseFile))a.file=l;a.file&&(d=(q=document.getElementById(a.file))&&q.type=="descartes/vectorFile"?q.text:b.openFile(a.file),d!=null&&(d=d.replace(/\r/g,"").split("\n"),d=d.filter(c=>c.trim()!=="")),d==null||
d.length==1&&d[0]==""?(d=[],a.size=f.parse("0")):(e=d,a.size=null),a.size===null&&(a.size=f.parse(e.length+"")));let n,t;e=e.map((c,v)=>{(t=f.parse(c,!0))&&t.type!=="assign"&&(n=NaN,this.parent.decimal_symbol==","&&(n=parseFloat(c.replace(",","."))),t=f.parse(`${a.id}[${v}]=${isNaN(n)?c:n}`,!0));return t});q=Array(parseInt(Math.abs(h.eval(a.size)))).fill(0);q._size_=q.length;h.vectors[a.id]=q;h.setVariable(a.id+".long",q._size_);for(let c of e)h.eval(c)}}b.Vector=g})(descartesJS);
(b=>{let a,h,f,l,d,g,e;const q=/'[^']*'|"[^"]*"|[^,']+/g,n=/'[^']*'|"[^"]*"|[^;']+/g;class t extends b.Auxiliary{constructor(c,v){super(c,v);a=this;h=c.evaluator;f=h.parser;a.rows=a.rows||f.parse("3");a.columns=a.columns||f.parse("3");if(a.file){e=(v=document.getElementById(a.file))&&v.type=="descartes/matrixFile"?v.text:b.openFile(a.file);let m,k;e!=null&&(d=0,l=null,e=e.replace(/\r/g,"").split("\n"),a.expresion=[],e.forEach(r=>{r&&(m=c.decimal_symbol=="."?r.trim().match(q)||[]:r.trim().match(n)||
[],l==null&&(l=m.length),m.forEach((p,x)=>{p=p.trim();k=c.decimal_symbol=="."?parseFloat(p):parseFloat(p.replace(",","."));isNaN(k)&&!/^'.*'$/.test(p)?(k=p.replace(/^"(.*)"$/,"$1"),k=`'${k}'`):(c.decimal_symbol==","&&(p=p.replace(",",".")),k=p);a.expresion.push(f.parse(`${a.id}[${d},${x}]:=${k}`))}),d++)}),a.rows=f.parse(l+""),a.columns=f.parse(d+""));if(e==null||e.length==1&&e[0]=="")a.expresion=[],a.rows=f.parse("0"),a.columns=f.parse("0")}else a.expresion=b.splitInstructions(f,a.expresion),l=h.eval(a.rows),
d=h.eval(a.columns);g=[];g.type="matrix";for(let m=0,k=d;m<k;m++)g[m]=Array(l).fill(0);h.matrices[a.id]=g;a.update()}update(){a=this;h=a.evaluator;g=h.matrices[a.id];g.rows=h.eval(a.rows);g.cols=h.eval(a.columns);h.setVariable(a.id+".filas",g.rows);h.setVariable(a.id+".columnas",g.cols);for(let c of a.expresion)h.eval(c)}}b.Matrix=t})(descartesJS);
(b=>{class a extends b.Auxiliary{constructor(h,f){super(h,f);let l=this,d=l.evaluator;h=d.parser;f=l.id.indexOf("(");l.name=l.id.substring(0,f);l.params=l.id.substring(f+1,l.id.indexOf(")"));l.domain=l.range?h.parse(l.range):h.parse("1");l.params=l.params===""?[]:l.params.split(",");l.numParams=l.params.length;l.algorithm||(l.init=l.doExpr=l.whileExpr="");b.parseExpr(l,l,h);l.expresion=h.parse(l.expresion);let g;l.functionExec=function(){var e=0;if(l.numParams<=arguments.length){let q=[];for(let t of l.privateVars)q.push(d.getVariable(t)),
d.setVariable(t,0);let n=[];l.params.forEach((t,c)=>{n.push(d.getVariable(t));d.setVariable(t,arguments[c])});for(let t of l.init)d.eval(t);g=d.getVariable("_NUM_MAX_ITE_ALG_")||1E5;do{for(let t of l.doExpr)d.eval(t);if(++e>g)return console.warn(`se ha excedido el l\u00edmite de ${g} repeticiones en la funci\u00f3n \u00ab${l.name}\u00bb`),0}while(d.eval(l.whileExpr)>0);e=d.eval(l.expresion);b.rangeOK=d.eval(l.domain);l.params.forEach((t,c)=>{d.setVariable(t,n[c])});l.privateVars.forEach((t,c)=>{d.setVariable(t,
q[c])});return e}return 0};d.setFunction(l.name,l.functionExec)}}b.Function=a})(descartesJS);
(b=>{let a,h;class f extends b.Auxiliary{constructor(l,d){super(l,d);b.parseExpr(this,this,this.evaluator.parser)}algorithmExec(){let l=0;h=this.evaluator;a=h.getVariable("_NUM_MAX_ITE_ALG_")||1E5;for(let d of this.init)h.eval(d);do{for(let d of this.doExpr)h.eval(d);if(++l>a)return console.warn(`se ha excedido el l\u00edmite de ${a} repeticiones en el algoritmo \u00ab${this.name}\u00bb`),0}while(h.eval(this.whileExpr)>0)}update(){this.algorithmExec();this.evaluate==="onlyOnce"&&(this.update=()=>
{})}}b.Algorithm=f})(descartesJS);
(b=>{class a extends b.Auxiliary{constructor(h,f){super(h,f);let l=this;h=l.evaluator;delete l.evaluate;l.condition=h.parser.parse(l.condition);l.lastEval=!1;l.action=l.parent.lessonParser.parseAction(l);l.execution=="onlyOnce"&&(l.eventExec=function(){l.evaluator.eval(l.condition)>0&&!l.lastEval&&(l.lastEval=!0,l.action.execute())});l.execution=="alternate"&&(l.eventExec=function(){const d=l.evaluator.eval(l.condition)>0;d&&!l.lastEval?(l.action.execute(),l.lastEval=!0):!d&&l.lastEval&&(l.lastEval=
!1)});l.execution=="always"&&(l.eventExec=function(){l.evaluator.eval(l.condition)>0&&l.action.execute()})}update(){this.eventExec()}}b.Event=a})(descartesJS);(b=>{class a extends b.Auxiliary{constructor(h,f){super(h,f);f=f.file;var l=null;f&&(l=(l=document.getElementById(f))&&l.type==="descartes/library"?l.text:b.openFile(f));if(l){l=b.convertHTMLEntities(l).replace(/\r/g,"").split("\n");for(let d of l)d.trim()!==""&&h.lessonParser.parseAuxiliar(d)}}}b.Library=a})(descartesJS);
(b=>{let a,h,f,l,d,g,e;class q{constructor(n,t){this.parent=n;this.evaluator=n.evaluator;let c=this.evaluator.parser;this.spaceID=this.type=this.trace=this.family=this.text="";this.background=this.visible=this.editable=!1;this.drawif=c.parse("1");this.abs_coord=t&&t.type&&t.type.toLowerCase()=="text";this.color=new b.Color("20303a");this.expresion=c.parse("(0,0)");this.family_interval=c.parse("[0,1]");this.family_steps=c.parse("8");this.font="SansSerif,PLAIN,"+(this.parent.version>=5?"18":"12");this.fixed=
!0;this.decimals=c.parse("2");Object.assign(this,t);this.space=this.getSpace();this.canvas=this.background?this.space.backCanvas:this.space.canvas;this.ctx=this.canvas.getContext("2d");this.trace&&(this.traceCtx=this.space.backCtx);this.font_str=this.font;this.font=b.convertFont(this.font);this.fontSize=(this.fontSize=this.font.match(/([\d\.]+)px/))?parseFloat(this.fontSize[1]):10;this.font_style=b.getFontStyle(this.font_str.split(",")[1]);if(typeof this.bold=="boolean"||typeof this.italics=="boolean")this.font_style=
(this.italics?"Italic ":"")+(this.bold?"Bold ":"");this.font_family||(this.font_family=this.font_str.split(",")[0]);this.font_family=b.getFontName(this.font_family);typeof this.font_size=="undefined"&&(this.font_size=n.evaluator.parser.parse(this.fontSize.toString()))}getSpace(){return this.parent.spaces.find(n=>n.id==this.spaceID)||this.parent.spaces[0]}getFamilyValues(){a=this.evaluator;[this.fInf,this.fSup]=a.eval(this.family_interval)[0];this.fSteps=Math.round(a.eval(this.family_steps));this.fSep=
this.fSteps>0?(this.fSup-this.fInf)/this.fSteps:0}drawFamilyAux(n,t,c){a=this.evaluator;this.getFamilyValues();h=a.getVariable(this.family);if(this.fSteps>=0)for(let v=0,m=this.fSteps;v<=m;v++)a.setVariable(this.family,this.fInf+v*this.fSep),a.eval(this.drawif)>0&&(this.update(),this.drawAux(n,t,c));a.setVariable("_Text_H_",0);a.setVariable(this.family,h)}draw(n,t){this.family!==""?this.drawFamilyAux(this.ctx,n,t):this.evaluator.eval(this.drawif)>0&&(this.update(),this.drawAux(this.ctx,n,t));this.ctx.setLineDash([])}drawTrace(n,
t){this.family!=""?this.drawFamilyAux(this.traceCtx,n,t):this.evaluator.eval(this.drawif)>0&&(this.update(),this.drawAux(this.traceCtx,n,t))}rotate(n,t,c){g=Math.cos(c);e=Math.sin(c);return{x:n*g-t*e,y:n*e+t*g}}dashStyle(){d=this.ctx;d.lineCap="butt";switch(this.lineDash){case "dot":d.setLineDash([d.lineWidth,d.lineWidth]);break;case "dash":d.setLineDash([d.lineWidth*4,d.lineWidth*3]);break;case "dash_dot":d.setLineDash([d.lineWidth*4,d.lineWidth*2,d.lineWidth,d.lineWidth*2]);break;default:d.lineCap=
"round",d.setLineDash([])}}drawText(n,t,c,v,m,k,r,p,x,u,z){n.textNode=t;if(t.type=="rtfNode")n.fillStyle=n.strokeStyle=m.getColor(),n.textBaseline="alphabetic",n.textNode.pos={x:c,y:v},t.update(n,c,v,x,u,r,z,m.getColor());else{t.type=="simpleText"&&(t=t.toString(x,u).split("\\n"));a=this.evaluator;n.fillStyle=m.getColor();n.font=k;n.textAlign=r;n.textBaseline=p;l=this.fontSize*1.2||0;for(let A=0,w=t.length;A<w;A++)f=t[A],this.border&&(n.strokeStyle=this.border.getColor(),n.lineWidth=4,n.lineJoin=
"round",n.miterLimit=2,n.strokeText(f,c,v+l*A)),n.fillText(f,c,v+l*A)}}}b.Graphic=q})(descartesJS);
(b=>{function a(g,e,q=""){for(let n of g)if(n.type==="identifier"&&!(b.reservedIds+q).match(`-${n.value}-`)||n.value==="R"||n.value==="G"||n.value==="B")n.value=`${e}.${n.value}`;return g}function h(g,e,q,n){e=q.tokenize(e.replace(/&squot;/g,"'"));e=a(e,n);return(/^\\expr/.test(g)?"\\expr ":"\\decimals ")+q.flatTokens(e)}let f;const l=/[\w\.\-//]*(\.png|\.jpg|\.gif|\.svg|\.webp)/gi;class d extends b.Graphic{constructor(g,e,q,n){super(g,e);f=this;f.hasExpresion=f.hasExpresion||!1;f.graphics=[];Object.assign(f,
e);f.hasExpresion=f.expresion!==void 0;if(f.hasExpresion){String(f.expresion).charAt(0)!=="'"&&(f.expresion=`'${f.expresion}'`);f.expresion=f.evaluator.parser.parse(f.expresion);e=f.evaluator.eval(f.expresion);if(e)var t=(t=document.getElementById(e))&&t.type==="descartes/macro"?t.text:b.openFile(e);if(t){e=b.convertHTMLEntities(t).replace(/\r/g,"").split("\n");t=[];g=g.lessonParser;let p=new b.Tokenizer;for(var c of e)if(c.includes("=")){e=g.split(c);for(var v of e)if(v&&e.length>1&&(babel[v[0]]===
"id"||babel[v[0]]==="type")){t.push(e);break}}for(let x=0,u=t.length;x<u;x++){v=(c=t[x]||[],c[0])&&c[0][0]==="id";e=!1;for(let z=0,A=c.length;z<A;z++){var m=c[z][0];var k=c[z][1];var r=m.indexOf(".");r===-1||v?r=babel[m]:(r=babel[m.substring(r+1)],c[z][0]=`${f.name}.${m}`);r==="type"&&babel[k]==="surface"&&(e=!0);if(q.includes("3D")){if((r==="font"||r==="font_family"||(r==="fill"||r==="color"||r==="backcolor"||r==="arrow")&&c[z][1].charAt(0)!=="("||r==="file"&&c[z][1].match(l)||r!=="id"&&babel[c[z][1]]!==
void 0)&&r!=="width"&&r!=="height"&&r!=="length")continue}else if((r==="font"||r==="font_family"||(r==="fill"||r==="color"||r==="border"||r==="arrow")&&c[z][1].charAt(0)!=="("||r==="file"&&c[z][1].match(l)||r!=="id"&&babel[c[z][1]]!==void 0)&&r!=="radius")continue;if(e&&r==="expresion"){k=c[z][1].split(" ");r="";for(let w=0,y=k.length;w<y;w++){let D=k[w].replace(/&squot;/g,"'").split(";");for(let F=0,B=D.length;F<B;F++)m=p.tokenize(D[F].replace(/\\n/g,";")),m=a(m,f.name,q.includes("3D")?"-x-y-z-u-v-":
""),D[F]=p.flatTokens(m);r+=D.join(";")+" "}c[z][1]=r}else{if(r==="text")if(/\{\\rtf1/.test(k))k=k.replace(/\\expr\s*([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,(w,y)=>h(w,y,p,f.name)).replace(/\\decimals\s*([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,(w,y)=>h(w,y,p,f.name));else{k=g.parseText(k).txtEleMacros;for(let w=0,y=k.length;w<y;w++)m=p.tokenize(k[w].replace(/&squot;/g,"'")),m=a(m,f.name),k[w]=p.flatTokens(m).replace(/&squot;/g,"'").replace(/'\+\(/g,"[").replace(/\)\+'/g,"]"),
k[w]=k[w].slice(1,-1);k=k.join("")}else{k=k.replace(/&squot;/g,"'").split(";");for(let w=0,y=k.length;w<y;w++)m=p.tokenize(k[w].replace(/\\n/g,";")),m=a(m,f.name,q.includes("3D")?"-Euler-":""),k[w]=p.flatTokens(m);k=k.join(";")}c[z][1]=k}}}for(let x=0,u=t.length;x<u;x++)if(t[x][0]){c="";v=!1;for(let z=0,A=t[x].length;z<A;z++)babel[t[x][z][0]]==="type"&&n.includes(`-${babel[t[x][z][1]]}-`)&&(v=!0),c+=`${t[x][z][0]}='${t[x][z][1]}' `;t[x]=c+(v?` space='${f.spaceID}'`:"");v?f.graphics.push(g[q](t[x],
f.abs_coord,f.background,f.inirot)):g.parseAuxiliar(t[x])}}}}}b.BaseMacro=d})(descartesJS);
(b=>{let a,h,f,l,d,g,e;class q{constructor(n,t){this.text=t=t.replace("&#x2013","\u2013").replace(/&squot;/g,"'");this.txtEle=[];this.txtEleMacros=[];this.parent=n;this.evaluator=n.evaluator;this.type="simpleText";a="'";l=f=0;for(d=-1;f<t.length;)g=t.charAt(f),e=t.charAt(f-1),g==="["&&e==="\\"?(this.txtEle.push(t.substring(l,f-1)+"["),this.txtEleMacros.push("'"+t.substring(l,f-1)+"['"),l=f+1):g==="]"&&e==="\\"?(this.txtEle.push(t.substring(l,f-1)+"]"),this.txtEleMacros.push("'"+t.substring(l,f-1)+
"]'"),l=f+1):g==="["&&d===-1?(this.txtEle.push(t.substring(l,f)),this.txtEleMacros.push("'"+t.substring(l,f)+"'"),l=f,d++):g==="["?d++:g==="]"&&d===0?(this.txtEle.push(this.evaluator.parser.parse(t.substring(l,f+1))),this.txtEleMacros.push("["+t.substring(l,f+1)+"]"),l=f+1,d--):(t.charAt(f)=="]"&&(d=d<0?d:d-1),a+=t.charAt(f)),f++;this.txtEle.push(t.substring(l,f));this.txtEleMacros.push("'"+t.substring(l,f)+"'")}toString(n,t){a="";for(let c of this.txtEle)typeof c==="string"?a+=c:(h=this.evaluator.eval(c)[0][0],
h!==""&&(typeof h==="string"?a+=h:h==Infinity?a+="Infinity":h==-Infinity?a+="-Infinity":isNaN(h)||h=="NaN"?a+="NaN":(h=parseFloat(h),h=t?h.toFixed(n):b.removeNeedlessDecimals(h.toFixed(n)),a+=h.toString().replace(".",this.parent.decimal_symbol))));return a}}b.SimpleText=q})(descartesJS);
(b=>{let a,h,f,l,d,g,e,q,n,t,c,v,m,k,r,p,x,u,z,A,w,y,D,F,B,I,E,P,N,U,X,L,G,O;class S extends b.Graphic{constructor(H,M){super(H,M);this.width=this.width||H.evaluator.parser.parse("1");this.fillP=this.fillP||"";this.fillM=this.fillM||"";this.parseExpression();(this.visible=this.parent.version===2&&this.visible==void 0?!0:this.visible)&&this.registerTextField();v=new b.R2;m=new b.R2;k=new b.R2;r=new b.R2;x=new b.R2;this.cInd=0}parseExpression(){if(this.expresion.type==="compOperator"){let H=this.expresion.childs[0],
M=this.expresion.childs[1];H.type!="identifier"||H.value!="y"||M.contains("y")?M.type!="identifier"||M.value!="y"||H.contains("y")?H.type!="identifier"||H.value!="x"||M.contains("x")?M.type!="identifier"||M.value!="x"||H.contains("x")||(this.funExpr=M,this.of_y=!0,this.drawAux=this.drawAuxFun):(this.funExpr=M,this.of_y=!0,this.drawAux=this.drawAuxFun):(this.funExpr=H,this.of_y=!1,this.drawAux=this.drawAuxFun):(this.funExpr=M,this.of_y=!1,this.drawAux=this.drawAuxFun)}this.newt=new b.R2Newton(this.evaluator,
this.expresion)}update(){}draw(){this.family!=""?this.drawFamilyAux(this.ctx,this.fill,this.color):(this.update(),this.drawAux(this.ctx,this.fill,this.color))}drawFamilyAux(H,M,K){f=this.evaluator;this.getFamilyValues();h=f.getVariable(this.family);if(this.fSteps>=0)for(let T=0,V=this.fSteps;T<=V;T++)f.setVariable(this.family,this.fInf+T*this.fSep),this.update(),this.drawAux(H,M,K);f.setVariable(this.family,h)}drawTrace(){super.drawTrace(this.fill,this.trace)}drawAux(H,M,K){if(!(this.evaluator.eval(this.drawif)<=
0)){this.cInd=0;f=this.evaluator;l=this.space;d=f.eval(this.width);H.strokeStyle=this.color.getColor();H.lineWidth=d;g=f.getVariable("x");e=f.getVariable("y");q=l.w+24;n=l.h+24;K=n/q;M=Math.round(Math.sqrt(64/K));K=Math.round(Math.sqrt(64*K));M=Math.max(2,M);K=Math.max(2,K);t=q/M;c=n/K;t<3&&(t=3);c<3&&(c=3);this.cInd==0?(a=[],this.cInd++):this.cInd=(this.cInd+1)%1E7;v.set(0,0);m.set(0,0);k.set(0,0);G=.25;O=8;this.abs_coord||(G/=l.scale,O/=l.scale);H.beginPath();for(E=parseInt(c/2);E<n;E+=c)for(I=
parseInt(t/2);I<q;I+=t){if(this.abs_coord){x.set(I,E);p=this.newt.findZero(x,G);if(p==null)continue;f.setVariable("x",p.x);f.setVariable("y",p.y);r.set(p.x,p.y)}else{x.set(l.getRelativeX(I),l.getRelativeY(E));p=this.newt.findZero(x,G);if(p==null)continue;f.setVariable("x",p.x);f.setVariable("y",p.y);r.set(l.getAbsoluteX(p.x),l.getAbsoluteY(p.y))}u=r.ix();z=r.iy();if(u>=-12&&u<q+24&&z>=-12&&z<n+24){if(a[u+12+(z+12)*l.w]===this.cInd)continue;a[u+12+(z+12)*l.w]=this.cInd}b.rangeOK&&(H.moveTo(u,z),H.lineTo(u,
z));v.x=p.x;v.y=p.y;m.x=p.x;m.y=p.y;A=this.newt.getUnitNormal();if(A.x!=0||A.y!=0)for(A.rotL90(),k.x=A.x,k.y=A.y,y=w=0,D=!1;y<2;)if(D&&(k.x=-A.x,k.y=-A.y,p.x=v.x,p.y=v.y,m.x=p.x,m.y=p.y,this.abs_coord?r.set(p.x,p.y):r.set(l.getAbsoluteX(p.x),l.getAbsoluteY(p.y)),u=r.ix(),z=r.iy(),D=!1,w=0),p.x+=O*k.x,p.y+=O*k.y,p=this.newt.findZero(p,G),p!=null){f.setVariable("x",p.x);f.setVariable("y",p.y);k.x=p.x-m.x;k.y=p.y-m.y;k.normalize();if(k.x==0&&k.y==0)break;m.x=p.x;m.y=p.y;this.abs_coord?r.set(p.x,p.y):
r.set(l.getAbsoluteX(p.x),l.getAbsoluteY(p.y));F=parseInt(r.ix());B=parseInt(r.iy());if(F!=u||B!=z)if(P=u,N=z,u=F,z=B,u>=-12&&u<q+24&&z>=-12&&z<n+24){w=0;U=a[u+12+(z+12)*l.w];a[u+12+(z+12)*l.w]=this.cInd;for(M=1;M<8;M++)X=P+Math.round((u-P)*M/8),L=N+Math.round((z-N)*M/8),0<=X&&X<q&&0<=L&&L<n&&(a[X+12+(L+12)*l.w]=this.cInd);b.rangeOK&&(H.moveTo(P,N),H.lineTo(u,z));if(U===this.cInd)break}else D=!0,y++;else++w>4&&(D=!0,y++)}}H.stroke();f.setVariable("x",g);f.setVariable("y",e)}}X(H,M,K){K||(M=this.space.w/
2+this.space.Ox+this.space.scale*M);M<-H&&(M=-H);M>this.space.w+H&&(M=this.space.w+H);return M}Y(H,M,K){K||(M=this.space.h/2+this.space.Oy-this.space.scale*M);M<-H&&(M=-H);M>this.space.h+H&&(M=this.space.h+H);return M}XX(H,M,K){return Math.round(this.X(H,M,K))}YY(H,M,K){return Math.round(this.Y(H,M,K))}extrapolate(H,M,K,T,V,W){f=this.evaluator;let ba=f.getVariable(M),C=W/2,R=0,Y,Z,J,Q,aa,ca;for(;Math.abs(C)>1E-15;){Y=f.getVariable(M);Z=f.getVariable(M)+C;f.setVariable(M,Z);J=!0;try{Q=V,V=f.eval(this.funExpr),
f.setVariable(K,V),f.eval(H)>0?(aa=new b.R2(Math.min(Q,V),Math.max(Q,V)),ca=0,ca=W>0?this.Singularity(Math.abs(C),M,T,Y,Q,Z,V,aa):this.Singularity(Math.abs(C),M,T,Z,V,Y,Q,aa),ca>0&&(J=!1)):J=!1}catch(ea){J=!1}J?R+=C:f.setVariable(M,Y);C/=2}f.setVariable(M,ba);return new b.R2(R/Math.abs(W),V)}extrapolateOnSingularity(H,M,K,T,V,W){f=this.evaluator;T=f.getVariable(M);let ba=W/2,C=0,R=V,Y;for(;Math.abs(ba)>1E-15;){f.setVariable(M,f.getVariable(M)+ba);Y=!0;if(f.eval(H)>0)try{R=f.eval(this.funExpr),f.setVariable(K,
R),f.eval(H)<=0&&(Y=!1)}catch(Z){Y=!1}else Y=!1;Y?C+=ba:f.setVariable(M,f.getVariable(M)-ba);ba/=2}if(C==0)for(ba=W/2,C=W,R=V;Math.abs(ba)>1E-15;){f.setVariable(M,f.getVariable(M)-ba);K=!0;if(f.eval(H)>0)try{R=f.eval(this.funExpr)}catch(Z){K=!1}else K=!1;K?C+=-ba:f.setVariable(M,f.getVariable(M)+ba);ba/=2}f.setVariable(M,T);return new b.R2(C/Math.abs(W),R)}Singularity(H,M,K,T,V,W,ba,C){f=this.evaluator;if(isNaN(ba)||isNaN(V)||isNaN(C.y)||isNaN(C.x)||T>=W)return 2;let R=f.getVariable(M),Y=0;try{if(Math.abs(W-
T)<1E-15||Math.abs(W-T)<1E-12&&Math.abs(ba-V)>Math.abs(H))return f.setVariable(M,R),1;let J=(T+W)/2;f.setVariable(M,J);let Q=NaN;try{Q=f.eval(this.funExpr)}catch(aa){return 2}if(isNaN(Q))return 5;if(Math.abs(ba-V)>H){f.setVariable(M,T-1E-12);var Z=f.eval(this.funExpr);Z=(V-Z)/1E-12;f.setVariable(M,W+1E-12);let aa=(f.eval(this.funExpr)-ba)/1E-12;if((Math.abs(aa)<10||Math.abs(Z)<10)&&(aa>=0&&Z>=0||aa<=0&&Z<=0)&&4*Math.abs(aa)<Math.abs((ba-V)/(W-T)))return f.setVariable(M,R),2}if(isNaN(C.x)||isNaN(C.y)||
isNaN(Q))return 2;if(!(C.x<=Q&&Q<=C.y)){f.setVariable(M,J);C.x=Math.min(V,Q);C.y=Math.max(V,Q);let aa=this.Singularity(H/2,M,K,T,V,J,Q,C);f.setVariable(M,W);C.x=Math.min(ba,Q);C.y=Math.max(ba,Q);let ca=this.Singularity(H/2,M,K,J,Q,W,ba,C);Y=Math.max(aa,ca)}}catch(J){Y=1}f.setVariable(M,R);return Y}drawAuxFun(H,M,K){f=this.evaluator;g=f.getVariable("x");e=f.getVariable("y");b.rangeOK=1;M="x";let T="y";this.of_y&&(M="y",T="x");let V=this.drawif,W=f.eval(this.width),ba=!1;var C=new b.R2(this.space.w/
2+this.space.Ox,this.space.h/2+this.space.Oy);let R=this.of_y?C.ix():C.iy(),Y=0,Z=0,J=0,Q=0,aa=1/this.space.scale;C=aa*(this.of_y?-this.space.h+C.y:-C.x);let ca=0;this.abs_coord&&(C=0,aa=1);let ea,fa,da,ja,ma,ka,la,ha,ia,na=this.of_y?this.space.h+2:this.space.w+2;for(;J<=na;){ea=!0;fa=0;f.setVariable(M,C);try{da=f.eval(this.funExpr),isNaN(da)||(f.setVariable(T,da),f.eval(this.drawif)>0&&b.rangeOK?(ba?(ja=Math.min(ca,da),ma=Math.max(ca,da),ka=new b.R2(ja,ma),fa=this.Singularity(aa,M,0,C-aa,ca,C,da,
ka),fa===0?(ca<=da?(ca=ka.x,da=ka.y):(da=ka.x,ca=ka.y),la=parseInt(this.of_y?this.XX(W,ca,this.abs_coord):this.YY(W,ca,this.abs_coord)),Y=this.abs_coord?Math.round(da):parseInt(this.of_y?this.XX(W,da,this.abs_coord):this.YY(W,da,this.abs_coord)),this.fillM&&Y>R&&(H.lineWidth=1,H.strokeStyle=this.fillM.getColor(),H.beginPath(),this.of_y?(H.moveTo(R+1,this.space.h-J+.5),H.lineTo(Y,this.space.h-J+.5)):(H.moveTo(J+.5,R+1),H.lineTo(J+.5,Y)),H.stroke()),this.fillP&&Y<R&&(H.lineWidth=1,H.strokeStyle=this.fillP.getColor(),
H.beginPath(),this.of_y?(H.moveTo(R-1,this.space.h-J+.5),H.lineTo(Y,this.space.h-J+.5)):(H.moveTo(J+.5,R-1),H.lineTo(J+.5,Y)),H.stroke()),H.lineWidth=W,H.strokeStyle=K.getColor(),H.beginPath(),this.of_y?(H.moveTo(la+.5,this.space.h-Q),H.lineTo(Y+.5,this.space.h-J)):(H.moveTo(Q+.5,la),H.lineTo(J+.5,Y)),H.stroke()):fa===1?(f.setVariable(M,C-aa),ha=this.extrapolate(V,M,T,0,ca,aa),Y=this.of_y?this.XX(W,ha.y,this.abs_coord):this.YY(W,ha.y,this.abs_coord),H.lineWidth=W,H.strokeStyle=K.getColor(),H.beginPath(),
this.of_y?(H.moveTo(Z+.5,this.space.h-Q),H.lineTo(Y+.5,this.space.h-Q+Math.round(ha.x))):(H.moveTo(Q+.5,Z),H.lineTo(Q+Math.round(ha.x)+.5,Y)),f.setVariable(M,C),ia=this.extrapolate(V,M,T,0,da,-aa),Z=this.of_y?this.XX(W,ia.y,this.abs_coord):this.YY(W,ia.y,this.abs_coord),Y=this.of_y?this.XX(W,da,this.abs_coord):this.YY(W,da,this.abs_coord),H.lineWidth=W,H.strokeStyle=K.getColor(),H.beginPath(),this.of_y?(H.moveTo(Z+.5,this.space.h-J),H.lineTo(Y+.5,this.space.h-J)):(H.moveTo(J+.5,Z),H.lineTo(J+.5,Y)),
H.stroke()):fa===2&&(Y=this.of_y?this.XX(W,da,this.abs_coord):this.YY(W,da,this.abs_coord),H.lineWidth=W,H.strokeStyle=K.getColor(),H.beginPath(),this.of_y?(H.moveTo(Z+.5,this.space.h-J),H.lineTo(Y+.5,this.space.h-J)):(H.moveTo(J+.5,Z),H.lineTo(J+.5,Y)))):(ia=this.extrapolateOnSingularity(V,M,T,0,da,-aa),Z=this.of_y?this.XX(W,ia.y,this.abs_coord):this.YY(W,ia.y,this.abs_coord),Y=this.of_y?this.XX(W,da,this.abs_coord):this.YY(W,da,this.abs_coord),H.lineWidth=W,H.strokeStyle=K.getColor(),H.beginPath(),
this.of_y?(H.moveTo(Z,this.space.h-(J+Math.round(ia.x))+.5),H.lineTo(Y,this.space.h-J+.5)):(H.moveTo(J+Math.round(ia.x),Z),H.lineTo(J,Y)),H.stroke()),ca=da):ea=!1)}catch(oa){ea=!1}ba&&!ea&&(f.setVariable(M,C-aa),f.setVariable(T,ca),ha=this.extrapolate(V,M,T,0,ca,aa),Y=parseInt(this.of_y?this.XX(W,ha.y,this.abs_coord):this.YY(W,ha.y,this.abs_coord)),f.eval(this.drawif)>0&&b.rangeOK&&(H.lineWidth=W,H.strokeStyle=K.getColor(),H.beginPath(),this.of_y?(H.moveTo(Z,this.space.h-(Q+Math.round(ha.x))+.5),
H.lineTo(Y,this.space.h-(Q+Math.round(ha.x))+.5)):(H.moveTo(Q+Math.round(ha.x)+.5,Z),H.lineTo(Q+Math.round(ha.x)+.5,Y)),H.stroke()),f.setVariable(M,C));ba=ea;C+=aa;Z=Y;Q=J++}f.setVariable("x",g);f.setVariable("y",e)}registerTextField(){let H=this,M=b.newHTML("input");M.value=H.expresionString;M.disabled=!H.editable;M.onkeydown=function(K){K.keyCode==13&&(H.expresion=H.evaluator.parser.parse(this.value),H.parseExpression(),H.parent.update())};H.parent.editableRegion.textFields.push(M)}}b.Equation=
S})(descartesJS);
(b=>{let a=Math.round,h,f,l,d,g,e;class q extends b.Graphic{constructor(n,t){super(n,t);this.parameter=this.parameter||"t";this.parameter_interval=this.parameter_interval||n.evaluator.parser.parse("[0,1]");this.parameter_steps=this.parameter_steps||n.evaluator.parser.parse("8");this.width=this.width||n.evaluator.parser.parse("1");this.fill=this.fill||"";(this.visible=this.parent.version===2&&this.visible==void 0?!0:this.visible)&&this.registerTextField()}update(){h=this.evaluator;[this.paraInf,this.paraSup]=
h.eval(this.parameter_interval)[0];this.pSteps=h.eval(this.parameter_steps);this.paraSep=this.pSteps>0?Math.abs(this.paraSup-this.paraInf)/this.pSteps:0}draw(){super.draw(this.fill,this.color)}drawTrace(){super.drawTrace(this.fill,this.trace)}drawAux(n,t,c){h=this.evaluator;f=this.space;n.lineWidth=Math.max(1E-6,a(h.eval(this.width)));n.lineCap=n.lineJoin="round";n.strokeStyle=c.getColor();l=h.getVariable(this.parameter);n.beginPath();h.setVariable(this.parameter,this.paraInf);d=h.eval(this.expresion)[0];
this.X=a(this.abs_coord?d[0]:f.getAbsoluteX(d[0]));this.Y=a(this.abs_coord?d[1]:f.getAbsoluteY(d[1]));this.rotateExp&&(g=b.degToRad(h.eval(this.rotateExp)),e=this.rotate(d[0],d[1],g),this.X=a(this.abs_coord?e.x:f.getAbsoluteX(e.x)),this.Y=a(this.abs_coord?e.y:f.getAbsoluteY(e.y)));n.moveTo(this.X+.5,this.Y+.5);for(c=1;c<=this.pSteps;c++)h.setVariable(this.parameter,this.paraInf+c*this.paraSep),d=h.eval(this.expresion)[0],this.rotateExp&&(e=this.rotate(d[0],d[1],g),d[0]=e.x,d[1]=e.y),this.X=a(this.abs_coord?
d[0]:f.getAbsoluteX(d[0])),this.Y=a(this.abs_coord?d[1]:f.getAbsoluteY(d[1])),!isNaN(this.X)&&!isNaN(this.Y)&&this.X>-1E6&&this.X<1E6&&this.Y>-1E6&&this.Y<1E6&&n.lineTo(this.X+.5,this.Y+.5);this.fill&&(n.fillStyle=t.getColor(),n.fill("evenodd"));this.dashStyle();n.stroke();n.setLineDash([]);h.setVariable(this.parameter,l)}registerTextField(){let n=this,t=b.newHTML("input");t.value=n.expresionString;t.disabled=!n.editable;t.onkeydown=function(c){c.keyCode==13&&(n.expresion=n.evaluator.parser.parse(this.value),
n.parent.update())};n.parent.editableRegion.textFields.push(t)}}b.Curve=q})(descartesJS);
(b=>{let a=Math.PI*2,h=Math.round,f,l,d,g,e,q,n,t,c;class v extends b.Graphic{constructor(m,k){super(m,k);this.size=this.size||m.evaluator.parser.parse("2");this.range=this.range||m.evaluator.parser.parse("[1, 100]");(this.visible=this.parent.version===2&&this.visible==void 0?!0:this.visible)&&this.registerTextField()}update(){f=this.evaluator;[this.X,this.Y]=f.eval(this.expresion)[0];this.rotateExp&&(d=this.rotate(this.X,this.Y,b.degToRad(f.eval(this.rotateExp))),this.X=d.x,this.Y=d.y);q=f.eval(this.range)[0];
this.rangeInf=q[0];this.rangeMax=q[1]}draw(){super.draw(this.color,this.color)}drawTrace(){super.drawTrace(this.trace,this.trace)}drawAux(m,k){f=this.evaluator;l=this.space;t=n=Math.ceil(f.eval(this.size)-.4);m.fillStyle=k.getColor();m.beginPath();this.rangeInf>this.rangeMax&&(c=this.rangeInf,this.rangeInf=this.rangeMax,this.rangeMax=c);k=f.getVariable("n");for(let r=this.rangeInf,p=this.rangeMax;r<=p;r++)f.setVariable("n",r),[this.X,this.Y]=f.eval(this.expresion)[0],g=h(this.abs_coord?this.X:l.getAbsoluteX(this.X)),
e=h(this.abs_coord?this.Y:l.getAbsoluteY(this.Y)),m.beginPath(),m.arc(g,e,n,0,a),m.fill();m.fill();this.text!=[""]&&(this.fontSize=Math.max(5,f.eval(this.font_size)),this.font=this.font_style+" "+this.fontSize+"px "+this.font_family,super.drawText(m,this.text,g+t,e-t,this.color,this.font,"start","alphabetic",f.eval(this.decimals),this.fixed,!0));f.setVariable("n",k)}registerTextField(){let m=this,k=b.newHTML("input");k.value=m.expresionString;k.disabled=!m.editable;k.onkeydown=function(r){r.keyCode==
13&&(m.expresion=m.evaluator.parser.parse(this.value),m.parent.update())};m.parent.editableRegion.textFields.push(k)}}b.Sequence=v})(descartesJS);
(b=>{let a=Math.PI*2,h=Math.round,f,l,d,g,e,q;class n extends b.Graphic{constructor(t,c){super(t,c);this.size=this.size||t.evaluator.parser.parse("2");this.text=new b.TextObject(this,this.text)}update(){f=this.evaluator;[this.X,this.Y]=f.eval(this.expresion)[0];this.rotateExp&&(d=this.rotate(this.X,this.Y,b.degToRad(f.eval(this.rotateExp))),this.X=d.x,this.Y=d.y)}draw(){super.draw(this.color,this.color)}drawTrace(){super.drawTrace(this.trace,this.trace)}drawAux(t,c){l=this.space;t.fillStyle=c.getColor();
g=h(this.abs_coord?this.X:l.getAbsoluteX(this.X));e=h(this.abs_coord?this.Y:l.getAbsoluteY(this.Y));q=h(this.evaluator.eval(this.size));q>0&&(t.beginPath(),t.arc(g,e,q,0,a),t.fill());this.text.hasContent&&this.text.draw(t,c,g,e)}}b.Point=n})(descartesJS);
(b=>{let a=Math.round,h=Math.PI*2,f,l,d,g,e,q,n,t,c,v,m;class k extends b.Graphic{constructor(r,p){super(r,p);this.width=this.width||r.evaluator.parser.parse("1");this.size=this.size||r.evaluator.parser.parse("2");this.text=new b.TextObject(this,this.text)}update(){f=this.evaluator;d=f.eval(this.expresion);this.points=[];for(let r=0,p=d.length;r<p;r++)this.points[r]={x:d[r][0],y:d[r][1]};if(this.rotateExp){g=b.degToRad(f.eval(this.rotateExp));for(let r=0,p=this.points.length;r<p;r++)this.points[r]=
this.rotate(this.points[r].x,this.points[r].y,g)}}draw(){super.draw(this.color,this.color)}drawTrace(){super.drawTrace(this.trace,this.trace)}drawAux(r,p,x){f=this.evaluator;l=this.space;m=a(f.eval(this.width));r.lineWidth=Math.max(1E-6,m);e=f.eval(this.size);r.fillStyle=p.getColor();r.strokeStyle=x.getColor();r.lineCap="round";q=r.lineWidth%2==0?0:.5;this.abs_coord?(n=a(this.points[0].x),t=a(this.points[0].y),c=a(this.points[1].x),v=a(this.points[1].y)):(n=a(l.getAbsoluteX(this.points[0].x)),t=a(l.getAbsoluteY(this.points[0].y)),
c=a(l.getAbsoluteX(this.points[1].x)),v=a(l.getAbsoluteY(this.points[1].y)));r.beginPath();r.moveTo(n+q,t+q);r.lineTo(c+q,v+q);this.dashStyle();r.stroke();e>0&&(r.beginPath(),r.arc(n,t,e,0,h),r.arc(c,v,e,0,h),r.fill());r.setLineDash([]);this.text.hasContent&&this.text.draw(r,x,parseInt((n+c)/2)-3,parseInt((t+v)/2)+3)}}b.Segment=k})(descartesJS);
(b=>{let a=Math.floor,h=Math.round,f,l,d,g,e,q,n,t,c,v,m,k,r;class p extends b.Graphic{constructor(x,u){super(x,u);this.width=this.width||x.evaluator.parser.parse("5");this.size=this.size||x.evaluator.parser.parse("2");this.spear=this.spear||x.evaluator.parser.parse("8");this.arrow=this.arrow||new b.Color("ee0022");this.text=new b.TextObject(this,this.text);this.V=new b.Vector2D(0,0);this.points=[]}update(){f=this.evaluator;l=f.eval(this.expresion);for(let x=0,u=l.length;x<u;x++)this.points[x]={x:l[x][0],
y:l[x][1]};if(this.rotateExp){d=b.degToRad(f.eval(this.rotateExp));for(let x=0,u=this.points.length;x<u;x++)this.points[x]=this.rotate(this.points[x].x,this.points[x].y,d)}}draw(){super.draw(this.arrow,this.color)}drawTrace(){super.drawTrace(this.arrow,this.trace)}drawAux(x,u,z){f=this.evaluator;g=this.space;l=this.points;e=Math.max(0,f.eval(this.width));q=Math.ceil(e/2);n=g.scale;this.V.x=l[1].x-l[0].x;this.V.y=l[1].y-l[0].y;t=this.V.vLength();this.angle=Math.atan2(this.V.y,this.V.x);x.fillStyle=
u.getColor();x.strokeStyle=z.getColor();x.lineWidth=2;this.abs_coord?(c=h(l[0].x),v=h(l[0].y),m=h(l[1].x),k=h(l[1].y)):(c=h(g.getAbsoluteX(l[0].x)),v=h(g.getAbsoluteY(l[0].y)),m=h(g.getAbsoluteX(l[1].x)),k=h(g.getAbsoluteY(l[1].y)));r=Math.max(0,f.eval(this.spear));x.save();x.translate(c,v);this.abs_coord?x.rotate(this.angle):(t*=n,x.rotate(-this.angle));x.beginPath();x.moveTo(-q,a(-q));x.lineTo(a(t-r-e),a(-q));x.lineTo(a(t-2*r),a(-r-q));x.lineTo(a(t),0);x.lineTo(a(t-2*r),a(r+q));x.lineTo(a(t-r-e),
a(q));x.lineTo(-q,a(q));x.closePath();x.stroke();x.fill();x.restore();this.text.hasContent&&this.text.draw(x,z,parseInt((c+m)/2)-3,parseInt((v+k)/2)+3)}}b.Arrow=p})(descartesJS);
(b=>{let a=Math.round,h,f,l,d,g,e,q,n;class t extends b.Graphic{constructor(c,v){super(c,v);this.width=this.width||c.evaluator.parser.parse("1");this.fill=this.fill||"";this.points=[]}update(){h=this.evaluator;l=h.eval(this.expresion);for(let c=0,v=l.length;c<v;c++)this.points[c]={x:l[c][0],y:l[c][1]};if(this.rotateExp){d=b.degToRad(h.eval(this.rotateExp));for(let c=0,v=this.points.length;c<v;c++)this.points[c]=this.rotate(this.points[c].x,this.points[c].y,d)}}draw(){super.draw(this.fill,this.color)}drawTrace(){super.drawTrace(this.trace,
this.trace)}drawAux(c,v,m){h=this.evaluator;f=this.space;g=a(h.eval(this.width));c.lineWidth=Math.max(1E-6,g);c.strokeStyle=m.getColor();c.lineCap=c.lineJoin="round";e=g>0?.5:0;q=a(this.abs_coord?this.points[0].x:f.getAbsoluteX(this.points[0].x));n=a(this.abs_coord?this.points[0].y:f.getAbsoluteY(this.points[0].y));c.beginPath();c.moveTo(q+e,n+e);for(let k=1,r=this.points.length;k<r;k++)q=a(this.abs_coord?this.points[k].x:f.getAbsoluteX(this.points[k].x)),n=a(this.abs_coord?this.points[k].y:f.getAbsoluteY(this.points[k].y)),
c.lineTo(q+e,n+e);this.fill&&(c.fillStyle=v.getColor(),c.fill());this.dashStyle();c.stroke();c.setLineDash([])}}b.Polygon=t})(descartesJS);
(b=>{let a=Math.round,h=Math.min,f=Math.max,l=Math.abs,d,g,e,q,n,t,c,v,m,k,r,p;class x extends b.Graphic{constructor(u,z){super(u,z);this.width=this.width||u.evaluator.parser.parse("1");this.fill=this.fill||"";this.border_radius=this.border_radius||u.evaluator.parser.parse("0")}update(){d=this.evaluator;t=d.eval(this.expresion);this.X=t[0][0];this.Y=t[0][1];this.w=150;this.h=100;this.rotateExp&&(e=this.rotate(t[0][0],t[0][1],b.degToRad(d.eval(this.rotateExp))),this.X=e.x,this.Y=e.y);t[0].length>=
4&&(this.w=t[0][2],this.h=t[0][3]);t[1]&&t[1].length==2&&(this.w=t[1][0],this.h=t[1][1]);this.w=f(0,this.w);this.h=f(0,this.h)}draw(){super.draw(this.fill,this.color)}drawTrace(){super.drawTrace(this.fill,this.trace,"trace")}drawAux(u,z,A,w){d=this.evaluator;g=this.space;q=a(d.eval(this.width));u.lineWidth=f(1E-6,q);u.strokeStyle=A.getColor();u.lineCap="round";u.lineJoin="miter";n=q>0?.5:0;c=a(this.abs_coord?this.X:g.getAbsoluteX(this.X))+n;v=a(this.abs_coord?this.Y:g.getAbsoluteY(this.Y))+n;m=this.abs_coord?
this.w:this.w*g.scale;k=this.abs_coord?this.h:-this.h*g.scale;r=h(f(0,d.eval(this.border_radius)),l(m)*.5,l(k)*.5);p=this.abs_coord?1:-1;u.beginPath();r==0?(u.moveTo(c,v),u.lineTo(c+m,v),u.lineTo(c+m,v+k),u.lineTo(c,v+k)):(u.moveTo(c+r,v),u.lineTo(c+m-r,v),u.arcTo(c+m,v,c+m,v+p*r,r),u.lineTo(c+m,v+k-p*r),u.arcTo(c+m,v+k,c+m-r,v+k,r),u.lineTo(c+r,v+k),u.arcTo(c,v+k,c,v+k-p*r,r),u.lineTo(c,v+p*r),u.arcTo(c,v,c+r,v,r));u.closePath();this.fill&&(u.fillStyle=z.getColor(),u.fill());this.dashStyle();u.stroke();
u.setLineDash([])}}b.Rectangle=x})(descartesJS);
(b=>{const a=Math.PI,h=a/2,f=2*a;let l=Math.round,d=Math.min,g=Math.max,e=Math.acos,q=Math.sqrt,n,t,c,v,m,k,r,p,x,u,z,A,w,y,D,F,B,I;class E extends b.Graphic{constructor(P,N){super(P,N);this.width=this.width||P.evaluator.parser.parse("1");this.fill=this.fill||"";this.center=this.center||P.evaluator.parser.parse("(0,0)");this.radius=this.radius||P.evaluator.parser.parse("1");this.init=this.init||"0";this.end=this.end||"90";this.init.startsWith("_(")&&(this.iFlag=!0,this.init=this.init.slice(1));this.end.startsWith("_(")&&
(this.eFlag=!0,this.end=this.end.slice(1));this.initExpr=P.evaluator.parser.parse(this.init);this.endExpr=P.evaluator.parser.parse(this.end);this.text=new b.TextObject(this,this.text)}update(){n=this.evaluator;[this.X,this.Y]=n.eval(this.center)[0];t=0;this.rotateExp&&(t=b.degToRad(n.eval(this.rotateExp)),c=Math.cos(t),v=Math.sin(t),m=this.X*c-this.Y*v,k=this.X*v+this.Y*c,this.X=m,this.Y=k);let P=n.eval(this.initExpr),N=n.eval(this.endExpr);/^(\(|\[).*(\)|\])$/i.test(this.initExpr.type)&&/^(\(|\[).*(\)|\])$/i.test(this.endExpr.type)?
([r,p]=P[0],[x,u]=N[0],this.vectors?this.abs_coord&&(p=-p,u=-u):(r-=this.X,p=-p+this.Y,x-=this.X,u=-u+this.Y,this.abs_coord||(p=-p,u=-u)),z=r==0?p<0?3*h:h:e(r*1/q(r*r+p*p)),A=x==0?u<0?3*h:h:e(x*1/q(x*x+u*u)),z+=t,A+=t,r>0&&p>0&&this.abs_coord&&(z=f-z),r>0&&p<0&&!this.abs_coord&&(z=f-z),r<0&&p<0&&!this.abs_coord&&(z=f-z),r<0&&p>0&&this.abs_coord&&(z=f-z),x>0&&u>0&&this.abs_coord&&(A=f-A),x>0&&u<0&&!this.abs_coord&&(A=f-A),x<0&&u<0&&!this.abs_coord&&(A=f-A),x<0&&u>0&&this.abs_coord&&(A=f-A),this.iFlag?
(w=z,z=A,A=w):(w=d(z,A),y=g(z,A),z=w,A=y,A-z>a&&this.abs_coord&&(z=y,A=w),A-z<=a&&!this.abs_coord&&(z=y,A=w)),this.iniAng=z,this.endAng=A,this.drawPoints=!0):(this.iniAng=b.degToRad(P)+t,this.endAng=b.degToRad(N)+t,this.drawAngle=!0)}draw(){super.draw(this.fill,this.color)}drawTrace(){super.drawTrace(this.fill,this.trace)}drawAux(P,N,U){n=this.evaluator;D=this.space;I=Math.max(0,n.eval(this.radius));P.lineWidth=Math.max(1E-6,l(n.eval(this.width)));P.lineCap="round";P.strokeStyle=U.getColor();this.abs_coord?
(F=l(this.X),B=l(this.Y)):(F=l(D.getAbsoluteX(this.X)),B=l(D.getAbsoluteY(this.Y)),I*=D.scale,this.iniAng=-this.iniAng,this.endAng=-this.endAng);this.drawAngle&&this.iniAng>this.endAng&&([this.iniAng,this.endAng]=[this.endAng,this.iniAng]);this.fill&&(P.fillStyle=N.getColor(),P.beginPath(),P.moveTo(F,B),P.arc(F,B,I,this.iniAng,this.endAng,void 0),P.fill());P.beginPath();P.arc(F,B,I,this.iniAng,this.endAng,void 0);this.dashStyle();P.stroke();this.text.hasContent&&this.text.draw(P,this.color,F,B)}}
b.Arc=E})(descartesJS);
(b=>{let a,h,f,l;class d extends b.Graphic{constructor(g,e){super(g,e);this.width=this.width||g.evaluator.parser.parse("0");this.align||(this.align="left");this.anchor||(this.anchor="top_left");this.shadowColor=this.shadowColor?this.shadowColor.getColor():"transparent";this.text=new b.TextObject(this,this.text)}update(){a=this.evaluator;[this.X,this.Y]=a.eval(this.expresion)[0];this.rotateExp&&(h=this.rotate(this.X,this.Y,b.degToRad(a.eval(this.rotateExp))),this.X=h.x,this.Y=h.y)}draw(){super.draw(this.color)}drawTrace(){super.drawTrace(this.trace)}drawAux(g,
e){this.abs_coord?(f=parseInt(this.X),l=parseInt(this.Y)):(f=parseInt(this.space.getAbsoluteX(this.X)),l=parseInt(this.space.getAbsoluteY(this.Y)));this.text.draw(g,e,f,l)}}b.Text=d})(descartesJS);
(b=>{let a=Math.round,h,f,l,d,g,e,q,n,t,c,v;class m extends b.Graphic{constructor(k,r){super(k,r);v=this;v.file=v.file||"";v.inirot=v.inirot||k.evaluator.parser.parse("0");v.img=new Image;v.scaleX=v.scaleY=1;v.ratio=k.ratio;k=v.expresion.getChildren();v.x_e=k[0];v.y_e=k[1];k.length>2&&(v.centered=!0,v.s_x_e=k[2],v.s_y_e=k.length>3?k[3]:k[2]);v.evaluator.eval(v.clip)&&(v.clip=v.clip.getChildren());v.update()}update(){let k=this;h=k.evaluator;k.X=h.eval(k.x_e);k.Y=h.eval(k.y_e);k.rotateExp&&(f=k.rotate(k.X,
k.Y,b.degToRad(h.eval(k.rotateExp))),k.X=f.x,k.Y=f.y);k.centered&&(k.scaleX=h.eval(k.s_x_e),k.scaleY=h.eval(k.s_y_e),k.scaleX==0&&(k.scaleX=1E-5),k.scaleY==0&&(k.scaleY=1E-5));if((l=h.eval(k.file))||l=="")k.img=k.parent.getImage(l),k.img.hasUpdate||(k.img.hasUpdate=!0,k.img.addEventListener("load",()=>{k.space.update(!0)}))}draw(){super.draw()}drawTrace(){super.drawTrace()}drawAux(k){v=this;h=v.evaluator;v.img&&v.img.ready&&v.img.complete&&(v.clip?(t=h.eval(v.clip[2]),c=h.eval(v.clip[3])):(t=v.img.width,
c=v.img.height,v.img.canvas&&(t=a(t/v.img.ratio),c=a(c/v.img.ratio))),d=v.centered?0:a(t/2),g=v.centered?0:a(c/2),e=a(v.abs_coord?v.X:v.space.getAbsoluteX(v.X)),q=a(v.abs_coord?v.Y:v.space.getAbsoluteY(v.Y)),n=b.degToRad(-h.eval(v.inirot)),k.save(),k.translate(e+d,q+g),k.rotate(n),v.opacity&&(k.globalAlpha=h.eval(v.opacity)),k.scale(v.scaleX,v.scaleY),v.clip?v.img.canvas?k.drawImage(v.img,h.eval(v.clip[0])*v.img.ratio,h.eval(v.clip[1])*v.img.ratio,t*v.img.ratio,c*v.img.ratio,-t/2,-c/2,t,c):k.drawImage(v.img,
h.eval(v.clip[0]),h.eval(v.clip[1]),t,c,-t/2,-c/2,t,c):k.drawImage(v.img,-t/2,-c/2,t,c),k.restore())}}b.Image=m})(descartesJS);
(b=>{let a,h,f,l,d,g,e,q=document.createElement("canvas").getContext("2d");q.canvas.width=1;q.canvas.height=1;class n extends b.Graphic{constructor(t,c){super(t,c)}update(){[this.X,this.Y]=this.evaluator.eval(this.expresion)[0]}draw(){super.draw(this.color,this.color)}drawTrace(){super.drawTrace(this.trace,this.trace)}drawAux(t,c){c=c.getColor();q.clearRect(0,0,1,1);q.fillStyle=c;q.fillRect(0,0,1,1);c=(new Uint32Array(q.getImageData(0,0,1,1).data.buffer))[0];g=t.getImageData(0,0,this.space.w,this.space.h);
e=new Uint32Array(g.data.buffer);a=parseInt(this.abs_coord?this.X:this.space.getAbsoluteX(this.X));h=parseInt(this.abs_coord?this.Y:this.space.getAbsoluteY(this.Y));var v=e,m=g.width;l=a<0||h<0||a>=m||h>=g.height?-1:v[a+h*m];if(l!=-1&&c!=l){f=[a,h];for(d=0;f.length>0&&!(h=f.pop(),a=f.pop(),v=e,m=g.width,l==(a<0||h<0||a>=m||h>=g.height?-1:v[a+h*m])&&(d++,e[a+h*g.width]=c,a>0&&f.push(a-1,h),a<g.width-1&&f.push(a+1,h),h>0&&f.push(a,h-1),h<g.height-1&&f.push(a,h+1)),d>=this.space.w*this.space.h););t.putImageData(g,
0,0)}}}b.Fill=n})(descartesJS);
(b=>{let a;class h extends b.BaseMacro{constructor(f,l){super(f,l,"parseGraphic","-text-image-point-polygon-arc-segment-arrow-macro-curve-equation-sequence-rectangle-fill-");this.inirot=this.inirot||f.evaluator.parser.parse("0");this.inipos=this.inipos||f.evaluator.parser.parse("(0,0)");Object.assign(this,l)}update(){a=this.evaluator.eval(this.inipos)[0];this.iniPosX=a[0];this.iniPosY=a[1]}drawAux(f){for(let l=0,d=this.graphics.length;l<d;l++)this.graphics[l]&&(f.save(),this.graphics[l].abs_coord?
f.translate(this.iniPosX,this.iniPosY):f.translate(this.iniPosX*this.space.scale,-this.iniPosY*this.space.scale),this.graphics[l].draw(),f.restore())}}b.Macro=h})(descartesJS);
(b=>{let a=Math.sqrt,h=Math.sin,f=Math.cos,l=Math.abs;class d{constructor(e=0,q=0,n=0,t=1){this.D=new Float32Array(4);this.set(e,q,n,t)}set(e,q,n,t){this.D[0]=e;this.D[1]=q;this.D[2]=n;this.D[3]=t;return this}get x(){return this.D[0]}set x(e){this.D[0]=e}get y(){return this.D[1]}set y(e){this.D[1]=e}get z(){return this.D[2]}set z(e){this.D[2]=e}get w(){return this.D[3]}set w(e){this.D[3]=e}norm3D(){let e=this.D[0],q=this.D[1],n=this.D[2];return a(e*e+q*q+n*n)}normalize3D(e=new d){var q=this.norm3D();
if(q===0)return e.set(0,0,0,this.w);q=1/q;return e.set(this.D[0]*q,this.D[1]*q,this.D[2]*q,this.w)}dotProduct3D(e){return this.D[0]*e.D[0]+this.D[1]*e.D[1]+this.D[2]*e.D[2]}crossProduct3D(e,q=new d){let [n,t,c]=this.D,[v,m,k]=e.D;return q.set(t*k-c*m,c*v-n*k,n*m-t*v,q.w)}scalarProd3D(e,q=new d){return q.set(this.D[0]*e,this.D[1]*e,this.D[2]*e,this.w)}subtract3D(e,q=new d){return q.set(this.D[0]-e.D[0],this.D[1]-e.D[1],this.D[2]-e.D[2],this.w)}add3D(e,q=new d){return q.set(this.D[0]+e.D[0],this.D[1]+
e.D[1],this.D[2]+e.D[2],this.w)}equals3D(e,q){return l(this.D[0]-e.D[0])<=q&&l(this.D[1]-e.D[1])<=q&&l(this.D[2]-e.D[2])<=q}clone(){return new d(this.D[0],this.D[1],this.D[2],this.D[3])}}class g{constructor(e=0,q=0,n=0,t=0,c=0,v=0,m=0,k=0,r=0,p=0,x=0,u=0,z=0,A=0,w=0,y=0){this.D=new Float32Array(16);this.set(e,q,n,t,c,v,m,k,r,p,x,u,z,A,w,y)}set(e,q,n,t,c,v,m,k,r,p,x,u,z,A,w,y){let D=this.D;D[0]=e;D[1]=q;D[2]=n;D[3]=t;D[4]=c;D[5]=v;D[6]=m;D[7]=k;D[8]=r;D[9]=p;D[10]=x;D[11]=u;D[12]=z;D[13]=A;D[14]=w;
D[15]=y;return this}setIdentity(){let e=this.D;e[0]=1;e[1]=0;e[2]=0;e[3]=0;e[4]=0;e[5]=1;e[6]=0;e[7]=0;e[8]=0;e[9]=0;e[10]=1;e[11]=0;e[12]=0;e[13]=0;e[14]=0;e[15]=1;return this}mulV4(e,q=new d){let n=this.D;var t=e.D;e=q.D;let c=t[0],v=t[1],m=t[2];t=t[3];e[0]=c*n[0]+v*n[4]+m*n[8]+t*n[12];e[1]=c*n[1]+v*n[5]+m*n[9]+t*n[13];e[2]=c*n[2]+v*n[6]+m*n[10]+t*n[14];e[3]=c*n[3]+v*n[7]+m*n[11]+t*n[15];return q}translate(e,q=(new g).setIdentity()){let n=this.D,t=q.D;e instanceof d||(e=new d(e.x,e.y,e.z,e.w));
let c=e.D[0],v=e.D[1];e=e.D[2];t[0]=n[0];t[1]=n[1];t[2]=n[2];t[3]=n[3];t[4]=n[4];t[5]=n[5];t[6]=n[6];t[7]=n[7];t[8]=n[8];t[9]=n[9];t[10]=n[10];t[11]=n[11];t[12]=n[0]*c+n[4]*v+n[8]*e+n[12];t[13]=n[1]*c+n[5]*v+n[9]*e+n[13];t[14]=n[2]*c+n[6]*v+n[10]*e+n[14];t[15]=n[3]*c+n[7]*v+n[11]*e+n[15];return q}rotateX(e,q=(new g).setIdentity()){let n=this.D,t=q.D,c=h(e);e=f(e);t[0]=n[0];t[1]=n[1];t[2]=n[2];t[3]=n[3];t[4]=n[4]*e+n[8]*c;t[5]=n[5]*e+n[9]*c;t[6]=n[6]*e+n[10]*c;t[7]=n[7]*e+n[11]*c;t[8]=n[4]*-c+n[8]*
e;t[9]=n[5]*-c+n[9]*e;t[10]=n[6]*-c+n[10]*e;t[11]=n[7]*-c+n[11]*e;t[12]=n[12];t[13]=n[13];t[14]=n[14];t[15]=n[15];return q}rotateY(e,q=(new g).setIdentity()){let n=this.D,t=q.D,c=h(e);e=f(e);t[0]=n[0]*e+n[8]*-c;t[1]=n[1]*e+n[9]*-c;t[2]=n[2]*e+n[10]*-c;t[3]=n[3]*e+n[11]*-c;t[4]=n[4];t[5]=n[5];t[6]=n[6];t[7]=n[7];t[8]=n[0]*c+n[8]*e;t[9]=n[1]*c+n[9]*e;t[10]=n[2]*c+n[10]*e;t[11]=n[3]*c+n[11]*e;t[12]=n[12];t[13]=n[13];t[14]=n[14];t[15]=n[15];return q}rotateZ(e,q=(new g).setIdentity()){let n=this.D,t=q.D,
c=h(e);e=f(e);t[0]=n[0]*e+n[4]*c;t[1]=n[1]*e+n[5]*c;t[2]=n[2]*e+n[6]*c;t[3]=n[3]*e+n[7]*c;t[4]=n[0]*-c+n[4]*e;t[5]=n[1]*-c+n[5]*e;t[6]=n[2]*-c+n[6]*e;t[7]=n[3]*-c+n[7]*e;t[8]=n[8];t[9]=n[9];t[10]=n[10];t[11]=n[11];t[12]=n[12];t[13]=n[13];t[14]=n[14];t[15]=n[15];return q}clone(){let e=new g;e.D.set(this.D);return e}}b.norm3D=function(e){e instanceof d||(e=new d(e.x,e.y,e.z,e.w));return e.norm3D()};b.normalize3D=function(e){e instanceof d||(e=new d(e.x,e.y,e.z,e.w));return e.normalize3D().clone()};
b.dotProduct3D=function(e,q){e instanceof d||(e=new d(e.x,e.y,e.z,e.w));q instanceof d||(q=new d(q.x,q.y,q.z,q.w));return e.dotProduct3D(q)};b.crossProduct3D=function(e,q){e instanceof d||(e=new d(e.x,e.y,e.z,e.w));q instanceof d||(q=new d(q.x,q.y,q.z,q.w));return e.crossProduct3D(q).clone()};b.scalarProd3D=function(e,q){e instanceof d||(e=new d(e.x,e.y,e.z,e.w));return e.scalarProd3D(q).clone()};b.subtract3D=function(e,q){e instanceof d||(e=new d(e.x,e.y,e.z,e.w));q instanceof d||(q=new d(q.x,q.y,
q.z,q.w));return e.subtract3D(q).clone()};b.add3D=function(e,q){e instanceof d||(e=new d(e.x,e.y,e.z,e.w));q instanceof d||(q=new d(q.x,q.y,q.z,q.w));return e.add3D(q).clone()};b.equals3D=function(e,q,n){e instanceof d||(e=new d(e.x,e.y,e.z,e.w));q instanceof d||(q=new d(q.x,q.y,q.z,q.w));return e.equals3D(q,n)};b.Vec4D=d;b.Mat4=g})(descartesJS);
(b=>{function a(y){y.textNode=null;parseInt(this.size)!==0&&(y.lineWidth=1,y.fillStyle=this.backColor,y.strokeStyle=this.frontColor,y.beginPath(),y.arc(this.projV[0].x,this.projV[0].y,this.size,0,e),y.fill(),y.stroke())}function h(y,D){y.textNode=null;y.lineCap=y.lineJoin="round";y.lineWidth=.4;y.beginPath();y.moveTo(this.projV[0].x,this.projV[0].y);for(let F=1,B=this.projV.length;F<B;F++)y.lineTo(this.projV[F].x,this.projV[F].y);y.closePath();this.model==="color"?(y.fillStyle=this.direction<0?this.backColor:
this.frontColor,y.strokeStyle=y.fillStyle,y.stroke(),y.fill()):this.model==="light"||this.model==="metal"?(y.fillStyle=D.computeColor(this.direction<0?this.backColor:this.frontColor,this,this.model==="metal"),y.strokeStyle=y.fillStyle,y.stroke(),y.fill()):this.model==="wire"&&(y.lineWidth=1.25,y.strokeStyle=this.frontColor,y.stroke());this.edges&&this.model!=="wire"&&(y.lineWidth=1,y.strokeStyle=this.edges,y.stroke())}function f(y){y.textNode=null;k=this.evaluator.getVariable(this.family);this.evaluator.setVariable(this.family,
this.fVal);this.fontSize=t(5,this.evaluator.eval(this.font_size));this.font=`${this.font_style} ${this.fontSize}px ${this.font_family}`;this.drawText(y,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,k)}function l(y){y.textNode=null;y.lineCap="butt";y.lineJoin="round";y.lineWidth=this.lineWidth;y.strokeStyle=this.frontColor;y.beginPath();y.moveTo(this.projV[0].x,this.projV[0].y);y.lineTo(this.projV[1].x,
this.projV[1].y);this.lineDash==="dot"?y.setLineDash([y.lineWidth,y.lineWidth]):this.lineDash==="dash"?y.setLineDash([y.lineWidth*4,y.lineWidth*3]):this.lineDash==="dash_dot"?y.setLineDash([y.lineWidth*4,y.lineWidth*2,y.lineWidth,y.lineWidth*2]):(y.lineCap="round",y.setLineDash([]));y.stroke()}function d(y,D,F){return b.normalize3D(b.crossProduct3D(b.subtract3D(y,D),b.subtract3D(y,F)))}let g;const e=2*Math.PI;let q=Math.abs,n=Math.min,t=Math.max,c,v,m,k,r,p,x,u,z,A;class w{constructor(y,D){Object.assign(this,
y);g=this;g.space=D;g.projV=[];g.spaceV=[];g.newProjV=[];g.newSpaceV=[];g.type==="vertex"?g.draw=a:g.type==="face"?(g.normal=d(g.V[0],g.V[1],g.V[2]),g.draw=h):g.type==="text"?g.draw=f:g.type==="edge"&&(g.draw=l);g.isText&&(g.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]})}computeDepth(y){g=this;g.space=y;g.avg={x:0,y:0,z:0};g.removeDoubles();g.normal={x:0,y:1,z:0};g.direction={x:1,y:0,z:0};let D=g.V.length;for(let F=0;F<D;F++)g.spaceV[F]=
y.rotateVertex(g.V[F]),g.avg.x+=g.spaceV[F].x,g.avg.y+=g.spaceV[F].y,g.avg.z+=g.spaceV[F].z;g.avg=b.scalarProd3D(g.avg,1/D);g.avg_proy=y.project(g.avg);g.depth=b.norm3D(b.subtract3D(y.eye,g.avg));g.V.length>2&&(g.normal=d(g.spaceV[0],g.spaceV[1],g.spaceV[2]));for(let F=0,B=g.V.length;F<B;F++)g.newSpaceV[F]=g.spaceV[F],g.projV[F]=g.newProjV[F]=y.project(g.spaceV[F]);g.V.length>2&&(g.direction=d(g.projV[0],g.projV[1],g.projV[2]).z);g.minDistToEye=Infinity;g.maxDistToEye=-Infinity;g.minX=Infinity;g.maxX=
-Infinity;g.minY=Infinity;g.maxY=-Infinity;for(let F=0,B=g.V.length;F<B;F++)p=b.norm3D(b.subtract3D(g.spaceV[F],y.eye)),g.minDistToEye=n(g.minDistToEye,p),g.maxDistToEye=t(g.maxDistToEye,p);for(let F=0,B=g.V.length;F<B;F++)g.minX>g.projV[F].x&&(g.minX=g.projV[F].x),g.maxX<g.projV[F].x&&(g.maxX=g.projV[F].x),g.minY>g.projV[F].y&&(g.minY=g.projV[F].y),g.maxY<g.projV[F].y&&(g.maxY=g.projV[F].y)}removeDoubles(){g=this;if(g.type!=="edge"){r=[];for(let y=0,D=g.V.length;y<D;y++)(q(g.V[y].x-g.V[(y+1)%D].x)>
1E-8||q(g.V[y].y-g.V[(y+1)%D].y)>1E-8||q(g.V[y].z-g.V[(y+1)%D].z)>1E-8||q(g.V[y].w-g.V[(y+1)%D].w)>1E-8)&&r.push(g.V[y]);r.length===0&&r.push(g.V[0]);g.V=r}}drawText(y,D,F,B,I,E,P,N,U,X,L){c=this.evaluator;y.textNode=D;E=c.eval(this.offset_dist);P=-b.degToRad(c.eval(this.offset_angle));F+=E*Math.cos(P);B+=E*Math.sin(P);y.textNode.pos={x:F,y:B};D.hasContent&&(D.draw(y,I,F,B,!0),m=this.fromPoint?D.textNodes.metrics.w/2:0,v=this.fromPoint?D.textNodes.metrics.h/2:0,D.draw(y,I,F-m,B-v))}splitFace(y){if(this.intersects(y)){var D=
null;let N=null,U=0,X=0;var F,B=this.V;let L=y.V;for(let G=0,O=L.length;G<O;G++){var I=this.intersection(L[G],L[(G+1)%O]);if(I!==null)if(D===null){if(D=I,U=G,L.length===2){N=D;break}}else if(!b.equals3D(I,D,1E-8)){N=I;X=G;break}}if(D!==null&&N!==null){var E=this.isInterior(D)||this.isInterior(N);var P=F=null;if(!E&&L.length>=3)for(let G=0,O=B.length;G<O;G++)if(I=y.intersection(this.V[G],this.V[(G+1)%O]),I!==null)if(F===null)F=I;else if(!b.equals3D(I,F,1E-8)){P=I;break}if(E||F!==null&&P!==null&&y.isInterior(F)&&
y.isInterior(P)){B=!0;F=E=null;if(L.length===2)b.equals3D(D,L[0],1E-8)||b.equals3D(D,L[1],1E-8)?B=!1:(E=[],E[0]=L[0],E[1]=D,F=[],F[0]=D,F[1]=L[1]);else{E=[];F=[];I=P=0;for(let G=0;G<L.length;G++)G<U?E[P++]=L[G]:G==U?(E[P++]=L[G],E[P++]=D,F[I++]=D):G<X?F[I++]=L[G]:G==X?(F[I++]=L[G],F[I++]=N,E[P++]=N):E[P++]=L[G]}if(B){D=[];D[0]=new w({V:E,type:"face",frontColor:y.frontColor,backColor:y.backColor,edges:y.edges,model:y.model},this.space);D[0].removeDoubles();D[0].normal=y.normal;D[1]=new w({V:F,type:"face",
frontColor:y.frontColor,backColor:y.backColor,edges:y.edges,model:y.model},this.space);D[1].removeDoubles();D[1].normal=y.normal;if(D[0].V.length>2)return D[1].V.length>2?D:[D[0]];if(D[1].V.length>2)return[D[1]]}}}}return[y]}intersects(y){return this.intersectsPlane(y)&&y.intersectsPlane(this)}intersectsPlane(y){let D,F,B=this.V;var I=y.V;if(B.length>0){D=b.dotProduct3D(I[0],y.normal);F=b.dotProduct3D(B[0],y.normal);if(q(D-F)<1E-8)return!0;for(let E=1,P=B.length;E<P;E++)if(I=b.dotProduct3D(B[E],y.normal),
q(D-I)<1E-8||I>D&&F<D||I<D&&F>D)return!0}return!1}intersection(y,D){var F=this.V;if(F.length>0){D=b.subtract3D(D,y);let B=b.dotProduct3D(D,this.normal);if(B!==0&&(F=b.dotProduct3D(b.subtract3D(F[0],y),this.normal)/B,-1E-8<F&&F<1.00000001))return b.add3D(y,b.scalarProd3D(D,F))}return null}isInterior(y){let D=this.V;if(D.length>0){let F=0,B=b.subtract3D(D[0],y);for(let I=0,E=D.length;I<E;I++){let P=b.subtract3D(D[(I+1)%E],y),N=b.dotProduct3D(b.crossProduct3D(B,P),this.normal);if(q(N)<1E-8){if(b.dotProduct3D(B,
P)<0)break}else{if(F<0&&N>0||F>0&&N<0)return!1;B=P;F=N}}}return!0}inFrontOf(y,D,F){if(this.minDistToEye>=D.maxDistToEye||this.maxX<=D.minX||this.minX>=D.maxX||this.maxY<=D.minY||this.minY>=D.maxY)return!1;for(A=0;A<3;A++)if(x=null,x=A===0?this.intersections(D):A===1?D.verticesContainedIn(this):this.verticesContainedIn(D),x!=null&&x.length>0){for(let B of x)y.push(B);for(let B of x){z=this.space.rayFromEye(B.x,B.y);try{u=this.distanceToEyeAlong(z)-D.distanceToEyeAlong(z);if(u<=-F)return!0;if(u>=F)return!1}catch(I){}}}return!1}intersections(y){let D=
[],F;let B,I=new b.R2,E=this.newSpaceV,P=y.newSpaceV,N=this.newProjV,U=y.newProjV;for(let L=0,G=E.length;L<G;L++){y=E[L];F=E[(L+1)%G];for(let O=0,S=P.length;O<S;O++){var X=P[O];B=P[(O+1)%S];y!=X&&y!=B&&F!=X&&F!=B&&(X=I.intersection(N[L],N[(L+1)%G],U[O],U[(O+1)%S]),X!=null&&D.push(X))}}return D}distanceToEyeAlong(y){y=b.dotProduct3D(this.normal,y);if(q(y)>1E-6)return b.dotProduct3D(b.subtract3D(this.avg,this.space.eye),this.normal)/y;throw new Exception("Face is invisible");}verticesContainedIn(y){let D=
[],F=this.newSpaceV,B=this.newProjV;for(let I=0,E=F.length;I<E;I++)!y.isVertex(F[I])&&y.appearsToContain(B[I])&&D.push(B[I]);return D}appearsToContain(y){let D=0;var F=this.newSpaceV;let B=this.newProjV;for(let I=0,E=F.length;I<E;I++){F=(B[I].x-y.x)*(B[(I+1)%E].y-y.y)-(B[(I+1)%E].x-y.x)*(B[I].y-y.y);if(D!=0)if(q(F)<1E-8){if(q(B[I].x-B[(I+1)%E].x)>1E-8)return n(B[I].x,B[(I+1)%E].x)<=y.x+1E-8&&y.x<=t(B[I].x,B[(I+1)%E].x)+1E-8;if(q(B[I].y-B[(I+1)%E].y)>1E-8)return n(B[I].y,B[(I+1)%E].y)<=y.y+1E-8&&y.y<=
t(B[I].y,B[(I+1)%E].y)+1E-8}else if(D>0&&F<0||D<0&&F>0)return!1;D=F}return!0}isVertex(y){let D=this.newSpaceV;for(let F of D)if(b.equals3D(y,F,1E-8))return!0;return!1}}b.Primitive3D=w})(descartesJS);
(b=>{let a;const h=b.degToRad;let f,l,d,g,e,q;class n{constructor(t,c){a=this;a.parent=t;a.evaluator=t.evaluator;let v=t.evaluator.parser;a.spaceID="E0";a.background=!1;a.type="";a.color=new b.Color("eeffaa");a.backcolor=new b.Color("6090a0");a.Nu=a.Nv=a.evaluator.parser.parse("7");a.drawif=v.parse("1");a.abs_coord=!1;a.family="";a.family_interval=v.parse("[0,1]");a.family_steps=v.parse("8");a.font="SansSerif,PLAIN,18";a.fixed=!0;a.text="";a.decimals=v.parse("2");a.inirot=a.endrot="(0,0,0)";a.inirotEuler=
a.endrotEuler=!1;a.inipos=a.endpos=v.parse("(0,0,0)");a.model="color";Object.assign(a,c);a.expresion==void 0&&a.type!=="macro"&&(a.expresion=v.parse("(0,0)"));a.space=a.getSpace();a.canvas=a.background?a.space.backCanvas:a.space.canvas;a.ctx=a.canvas.getContext("2d");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(typeof a.bold==="boolean"||typeof a.italics===
"boolean")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);typeof a.font_size==="undefined"&&(a.font_size=t.evaluator.parser.parse(a.fontSize.toString()));a.inirot.includes("Euler")&&(a.inirot=a.inirot.replace("Euler",""),a.inirotEuler=!0);a.endrot.includes("Euler")&&(a.endrot=a.endrot.replace("Euler",""),a.endrotEuler=!0);a.inirot=v.parse(a.inirot);a.endrot=v.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;q=new b.Mat4}getSpace(){return this.parent.spaces.find(t=>t.id===this.spaceID)||this.parent.spaces[0]}getFamilyValues(){a=this;f=a.evaluator;[a.fInf,a.fSup]=f.eval(a.family_interval)[0];a.fSteps=Math.round(f.eval(a.family_steps));a.fSep=a.fSteps>0?(a.fSup-a.fInf)/a.fSteps:0}buildFamilyPrimitives(){a=
this;f=a.evaluator;a.getFamilyValues();l=f.getVariable(a.family);if(a.fSteps>=0)for(let t=0,c=a.fSteps;t<=c;t++)a.fVal=a.fInf+t*a.fSep,f.setVariable(a.family,a.fVal),f.eval(a.drawif)&&a.buildPrimitives();f.setVariable(a.family,l)}update(){a=this;a.primitives=[];a.evaluator.eval(a.drawif)&&(a.family||a.buildPrimitives());a.family&&a.buildFamilyPrimitives()}updateMVMatrix(){a=this;d=a.evaluator.eval(a.inirot)[0];a.inirotEuler?(a.inirotM.setIdentity(),a.inirotM=a.inirotM.rotateZ(h(d[0])),a.inirotM=a.inirotM.rotateX(h(d[1])),
a.inirotM=a.inirotM.rotateZ(h(d[2]))):(q.setIdentity(),q.rotateX(h(d[0]),a.inirotM_X),q.rotateY(h(d[1]),a.inirotM_Y),q.rotateZ(h(d[2]),a.inirotM_Z));d=a.evaluator.eval(a.inipos)[0];a.iniposM=a.iniposM.setIdentity().translate({x:d[0],y:d[1],z:d[2]});d=a.evaluator.eval(a.endrot)[0];a.endrotEuler?(a.endrotM.setIdentity(),a.endrotM=a.endrotM.rotateZ(h(d[0])),a.endrotM=a.endrotM.rotateX(h(d[1])),a.endrotM=a.endrotM.rotateZ(h(d[2]))):(q.setIdentity(),q.rotateX(h(d[0]),a.endrotM_X),q.rotateY(h(d[1]),a.endrotM_Y),
q.rotateZ(h(d[2]),a.endrotM_Z));d=a.evaluator.eval(a.endpos)[0];a.endposM=a.endposM.setIdentity().translate({x:d[0],y:d[1],z:d[2]})}transformVertex(t){a=this;g=a.inirotEuler?a.inirotM.mulV4(t):a.inirotM_Z.mulV4(a.inirotM_Y.mulV4(a.inirotM_X.mulV4(t)));g=a.iniposM.mulV4(g);g=a.endrotEuler?a.endrotM.mulV4(g):a.endrotM_Z.mulV4(a.endrotM_Y.mulV4(a.endrotM_X.mulV4(g)));g=a.endposM.mulV4(g);a.macroChildren&&(g=a.applyMacroTransform(g));return g}applyMacroTransform(t){a=this;g=a.macro_inirotEuler?a.macro_inirotM.mulV4(t):
a.macro_inirotM_Z.mulV4(a.macro_inirotM_Y.mulV4(a.macro_inirotM_X.mulV4(t)));g=a.macro_iniposM.mulV4(g);g=a.macro_endrotEuler?a.macro_endrotM.mulV4(g):a.macro_endrotM_Z.mulV4(a.macro_endrotM_Y.mulV4(a.macro_endrotM_X.mulV4(g)));return g=a.macro_endposM.mulV4(g)}parseExpression(){let t=[];for(let k of this.expresion.split(";"))if(k.trim()!==""){var c=t,v=c.push;let r;var m=k;let p=[],x=0,u=m.length;for(let z=m.length-1;z>-1;z--)r=m.charAt(z),x==0?r=="="&&(x=1):x==1?r!=" "&&(x=r==="<"||r===">"?0:2):
x==2&&r==" "&&(p.unshift(m.substring(z+1,u)),u=z,x=0);p.unshift(m.substring(0,u));v.call(c,...p)}for(let k=0,r=t.length;k<r;k++)t[k]=this.evaluator.parser.parse(t[k],!0);return t}splitFace(t){for(let c of this.primitives)if(e=[],c.type==="face"){for(let v of t.primitives)v.type==="face"?e.push(...c.splitFace(v)):e.push(v);t.primitives=e}}}b.Graphic3D=n})(descartesJS);
(b=>{let a,h,f,l,d,g;class e extends b.Graphic3D{constructor(q,n){super(q,n)}buildPrimitives(){a=this;h=a.evaluator;a.updateMVMatrix();f=h.eval(a.expresion)[0];l=f[0];d=f[1];g=f[2];a.primitives.push(new b.Primitive3D({V:[a.transformVertex(new b.Vec4D(l,d,g))],type:"vertex",backColor:a.backcolor.getColor(),frontColor:a.color.getColor(),size:h.eval(a.width)}));a.text!==""&&(a.offset_dist=a.offset_dist||h.parser.parse("10"),a.offset_angle=a.offset_angle||h.parser.parse("270"),a.primitives.push(new b.Primitive3D({V:[a.transformVertex(new b.Vec4D(l,
d,g))],type:"text",fromPoint:!0,frontColor:a.color.getColor(),font_size:a.font_size,font_style:a.font_style,font_family:a.font_family,decimals:h.eval(a.decimals),fixed:a.fixed,evaluator:h,text:new b.TextObject(a,a.text),family:a.family,fVal:a.fVal,offset_dist:a.offset_dist,offset_angle:a.offset_angle},a.space)))}}b.Point3D=e})(descartesJS);
(b=>{let a,h,f,l;class d extends b.Graphic3D{constructor(g,e){super(g,e);this.width=this.width||g.evaluator.parser.parse("1")}buildPrimitives(){a=this;f=a.evaluator;a.updateMVMatrix();h=f.getVariable("u");f.setVariable("u",a.Nu);l=f.eval(a.expresion);a.primitives.push(new b.Primitive3D({V:[a.transformVertex(new b.Vec4D(l[0][0],l[0][1],l[0][2])),a.transformVertex(new b.Vec4D(l[1][0],l[1][1],l[1][2]))],type:"edge",lineDash:a.lineDash,frontColor:a.color.getColor(),lineWidth:f.eval(a.width)},a.space));
f.setVariable("u",h)}}b.Segment3D=d})(descartesJS);
(b=>{let a,h,f,l,d,g,e,q,n,t,c;class v extends b.Graphic3D{constructor(m,k){super(m,k);a=this;a.param=a.param||"t";a.parameter_interval=a.parameter_interval||m.evaluator.parser.parse("[0,1]");a.parameter_steps=a.parameter_steps||m.evaluator.parser.parse("8");a.expresion=a.parseExpression()}buildPrimitives(){a=this;h=a.evaluator;a.updateMVMatrix();d=h.getVariable("x");g=h.getVariable("y");e=h.getVariable("z");f=h.getVariable("u");l=h.getVariable("v");h.setVariable("u",0);h.setVariable("v",0);q=parseInt(h.eval(a.Nu));
n=parseInt(h.eval(a.Nv));t=[];for(var m=0;m<=q;m++){h.setVariable("u",m/q);for(var k=0;k<=n;k++){h.setVariable("v",k/n);for(var r of a.expresion)h.eval(r);t.push(a.transformVertex(new b.Vec4D(h.getVariable("x"),h.getVariable("y"),h.getVariable("z"))))}}m=a.color.getColor();k=a.backcolor.getColor();r=a.edges?a.edges.getColor():"";for(let p=0;p<q;p++)for(let x=0;x<n;x++)c=[],c.push(t[x+p*n+p]),c.push(t[x+1+p*n+p]),c.push(t[x+2+(p+1)*n+p]),c.push(t[x+1+(p+1)*n+p]),a.primitives.push(new b.Primitive3D({V:c,
type:"face",frontColor:m,backColor:k,edges:r,model:a.model},a.space));h.setVariable("x",d);h.setVariable("y",g);h.setVariable("z",e);h.setVariable("u",f);h.setVariable("v",l)}}b.Surface3D=v})(descartesJS);
(b=>{let a,h,f,l;class d extends b.Graphic3D{constructor(g,e){super(g,e);this.width=this.width||g.evaluator.parser.parse("1")}buildPrimitives(){a=this;h=a.evaluator;a.updateMVMatrix();f=h.eval(a.expresion);l=a.color.getColor();for(let g=0,e=f.length-1;g<e;g++)a.primitives.push(new b.Primitive3D({V:[a.transformVertex(new b.Vec4D(f[g][0],f[g][1],f[g][2])),a.transformVertex(new b.Vec4D(f[g+1][0],f[g+1][1],f[g+1][2]))],type:"edge",frontColor:l,lineWidth:h.eval(a.width)},a.space))}}b.Polygon3D=d})(descartesJS);
(b=>{let a,h,f,l,d,g,e,q;class n extends b.Graphic3D{constructor(t,c){super(t,c);a=this;a.width=a.width||t.evaluator.parser.parse("1");a.expresion=a.parseExpression()}buildPrimitives(){a=this;q=a.evaluator;a.updateMVMatrix();d=q.getVariable("x");g=q.getVariable("y");e=q.getVariable("z");l=q.getVariable("u");q.setVariable("u",0);f=q.eval(a.Nu);h=[];for(let t=0;t<=f;t++){q.setVariable("u",t/f);for(let c of a.expresion)q.eval(c);h.push(a.transformVertex(new b.Vec4D(q.getVariable("x"),q.getVariable("y"),
q.getVariable("z"))))}for(let t=0,c=h.length-1;t<c;t++)a.primitives.push(new b.Primitive3D({V:[h[t],h[t+1]],type:"edge",frontColor:a.color.getColor(),lineWidth:q.eval(a.width)},a.space));a.fill&&h.length>2&&a.primitives.push(new b.Primitive3D({V:h,type:"face",frontColor:a.fill.getColor(),backColor:a.fill.getColor(),edges:"",model:a.model},a.space));q.setVariable("x",d);q.setVariable("y",g);q.setVariable("z",e);q.setVariable("u",l)}}b.Curve3D=n})(descartesJS);
(b=>{let a,h,f;class l extends b.Graphic3D{constructor(d,g){super(d,g)}buildPrimitives(){a=this;h=a.evaluator;a.updateMVMatrix();f=h.eval(a.expresion);a.primitives.push(new b.Primitive3D({V:[a.transformVertex(new b.Vec4D(f[0][0],f[0][1],f[0][2])),a.transformVertex(new b.Vec4D(f[2][0],f[2][1],f[2][2])),a.transformVertex(new b.Vec4D(f[1][0],f[1][1],f[1][2]))],type:"face",frontColor:a.color.getColor(),backColor:a.backcolor.getColor(),edges:a.edges?a.edges.getColor():"",model:a.model},a.space))}}b.Triangle3D=
l})(descartesJS);(b=>{let a,h,f,l;class d extends b.Graphic3D{constructor(g,e){super(g,e)}buildPrimitives(){a=this;f=a.evaluator;a.updateMVMatrix();l=f.eval(a.expresion);h=[];for(let g=l.length-1;g>=0;g--)h.push(a.transformVertex(new b.Vec4D(l[g][0],l[g][1],l[g][2])));a.primitives.push(new b.Primitive3D({V:h,type:"face",frontColor:a.color.getColor(),backColor:a.backcolor.getColor(),edges:a.edges?a.edges.getColor():"",model:a.model},a.space))}}b.Face3D=d})(descartesJS);
(b=>{let a,h,f,l,d,g,e;class q extends b.Graphic3D{constructor(n,t){super(n,t);a=this;a.width=a.width||n.evaluator.parser.parse("2");a.length=a.length||n.evaluator.parser.parse("2")}buildPrimitives(){a=this;e=a.evaluator;a.updateMVMatrix();h=e.eval(a.Nu);f=[a.transformVertex(new b.Vec4D)];l=e.eval(a.width)/2;d=e.eval(a.length)/2;g=2*Math.PI/h;for(var n=0;n<h;n++)f.push(a.transformVertex(new b.Vec4D(l*Math.cos(g*n),d*Math.sin(g*n),0)));n=a.color.getColor();let t=a.backcolor.getColor(),c=a.edges?a.edges.getColor():
"";for(let v=0;v<h;v++)a.primitives.push(new b.Primitive3D({V:[f[0],v+2<=h?f[v+2]:f[1],f[v+1]],type:"face",frontColor:n,backColor:t,edges:c,model:a.model},a.space))}}b.Polireg3D=q})(descartesJS);
(b=>{let a,h,f;class l extends b.Graphic3D{constructor(d,g){super(d,g);this.shadowColor=this.shadowColor?this.shadowColor.getColor():"transparent"}buildPrimitives(){a=this;h=a.evaluator;f=h.eval(a.expresion)[0];a.primitives.push(new b.Primitive3D({V:[new b.Vec4D(f[0],f[1],0)],type:"text",frontColor:a.color.getColor(),font_size:a.font_size,font_style:a.font_style,font_family:a.font_family,decimals:h.eval(a.decimals),fixed:a.fixed,displace:0,isText:!0,evaluator:h,text:new b.TextObject(a,a.text),family:a.family,
fVal:a.fVal},a.space))}}b.Text3D=l})(descartesJS);
(b=>{let a,h,f,l;const d=b.degToRad;let g=0;class e extends b.BaseMacro{constructor(q,n){super(q,n,"parse3DGraphic","-point-segment-polygon-curve-triangle-face-polireg-surface-text-cube-box-tetrahedron-octahedron-sphere-dodecahedron-icosahedron-ellipsoid-cone-cylinder-torus-mesh-macro-");a=this;a.inirot=a.inirot||"(0,0,0)";a.inirotEuler=a.inirotEuler||!1;a.inipos=a.inipos||q.evaluator.parser.parse("(0,0,0)");a.endrot=a.endrot||"(0,0,0)";a.endrotEuler=a.endrotEuler||!1;a.endpos=a.endpos||q.evaluator.parser.parse("(0,0,0)");
a.name=a.name||`_M_${g++}`;Object.assign(a,n);typeof a.inirot==="string"&&a.inirot.includes("Euler")&&(a.inirot=a.inirot.replace("Euler",""),a.inirotEuler=!0);typeof a.endrot==="string"&&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;f=new b.Mat4;for(let t of a.graphics)t.macroChildren=!0}buildFamilyPrimitives(){a=this;h=a.evaluator;a.getFamilyValues();let q=h.getVariable(a.family);if(a.fSteps>=0)for(let n=0,t=a.fSteps;n<=t;n++)a.fVal=a.fInf+n*a.fSep,h.setVariable(a.family,a.fVal),h.eval(a.drawif)&&a.updateMacro();h.setVariable(a.family,q)}update(){a=this;a.primitives=[];a.evaluator.eval(a.drawif)&&(a.family||a.updateMacro());a.family&&a.buildFamilyPrimitives()}updateMacro(){a=
this;a.updateTransformation();if(a.inipos){var q=a.evaluator.eval(a.inipos)[0];a.iniPosX=q[0];a.iniPosY=q[1]}for(var n of a.graphics)n.macro_inirotEuler=a.inirotEuler,n.macro_inirotM=a.inirotM,n.macro_inirotM_X=a.inirotM_X,n.macro_inirotM_Y=a.inirotM_Y,n.macro_inirotM_Z=a.inirotM_Z,n.macro_iniposM=a.iniposM,n.macro_endrotEuler=a.endrotEuler,n.macro_endrotM=a.endrotM,n.macro_endrotM_X=a.endrotM_X,n.macro_endrotM_Y=a.endrotM_Y,n.macro_endrotM_Z=a.endrotM_Z,n.macro_endposM=a.endposM,n.update();for(let t=
0,c=a.graphics.length;t<c;t++){q=a.graphics[t];if(q.split||a.split)for(n=t+1;n<c;n++){let v=a.graphics[n];(v.split||a.split)&&q.splitFace(v)}a.primitives=a.primitives.concat(q.primitives||[])}}updateTransformation(){a=this;l=a.evaluator.eval(a.inirot)[0];a.inirotEuler?(a.inirotM.setIdentity(),a.inirotM=a.inirotM.rotateZ(d(l[0])),a.inirotM=a.inirotM.rotateX(d(l[1])),a.inirotM=a.inirotM.rotateZ(d(l[2]))):(f.setIdentity(),f.rotateX(d(l[0]),a.inirotM_X),f.rotateY(d(l[1]),a.inirotM_Y),f.rotateZ(d(l[2]),
a.inirotM_Z));l=a.evaluator.eval(a.inipos)[0];a.iniposM=a.iniposM.setIdentity().translate({x:l[0],y:l[1],z:l[2]});l=a.evaluator.eval(a.endrot)[0];a.endrotEuler?(a.endrotM.setIdentity(),a.endrotM=a.endrotM.rotateZ(d(l[0])),a.endrotM=a.endrotM.rotateX(d(l[1])),a.endrotM=a.endrotM.rotateZ(d(l[2]))):(f.setIdentity(),f.rotateX(d(l[0]),a.endrotM_X),f.rotateY(d(l[1]),a.endrotM_Y),f.rotateZ(d(l[2]),a.endrotM_Z));l=a.evaluator.eval(a.endpos)[0];a.endposM=a.endposM.setIdentity().translate({x:l[0],y:l[1],z:l[2]})}drawAux(q){}}
b.Macro3D=e})(descartesJS);
(b=>{let a;const h=Math.PI,f=2*h,l=Math.sqrt(3);let d=Math.sin,g=Math.cos,e,q,n,t,c,v,m,k,r,p,x,u;class z extends b.Graphic3D{constructor(L,G){super(L,G);a=this;a.width=a.width||L.evaluator.parser.parse("2");a.height=a.height||L.evaluator.parser.parse("2");a.length=a.length||L.evaluator.parser.parse("2");a.R=a.R||L.evaluator.parser.parse("2");a.r=a.r||L.evaluator.parser.parse("1");e=b.Vec4D}buildPrimitives(){a=this;q=a.evaluator;a.updateMVMatrix();a.buildGeometry(q.eval(a.width),q.eval(a.height),
q.eval(a.length),q.eval(a.Nu),q.eval(a.Nv));let L=a.color.getColor(),G=a.backcolor.getColor(),O=a.edges?a.edges.getColor():"";for(let S of a.faces){n=[];for(let H of S)n.push(a.transformVertex(a.V[H]));a.primitives.push(new b.Primitive3D({V:n,type:"face",frontColor:L,backColor:G,edges:O,model:a.model},a.space))}}changeGeometry(L,G,O,S,H){return this.oldW===L&&this.oldH===G&&this.oldL===O&&this.oldNu===S&&this.oldNv===H}updateValues(L,G,O,S,H){this.oldW=L;this.oldH=G;this.oldL=O;this.oldNv=H;this.oldNu=
S}}class A extends z{constructor(L,G){super(L,G);this.faces=[[2,3,1,0],[1,5,4,0],[5,7,6,4],[6,7,3,2],[4,6,2,0],[3,7,5,1]]}buildGeometry(L,G,O,S,H){L/=2;G/=2;O/=2;this.changeGeometry(L,G,O,S,H)||(this.V=[new e(L,O,G),new e(L,-O,G),new e(L,O,-G),new e(L,-O,-G),new e(-L,O,G),new e(-L,-O,G),new e(-L,O,-G),new e(-L,-O,-G)],this.updateValues(L,G,O,S,H))}}class w extends A{constructor(L,G){super(L,G)}buildGeometry(L,G,O,S,H){G=L/l;super.buildGeometry(G,G,G,S,H)}}class y extends z{constructor(L,G){super(L,
G);this.faces=[[1,3,2],[0,1,2],[0,2,3],[0,3,1]]}buildGeometry(L,G,O,S,H){L/=2;if(!this.changeGeometry(L,G,O,S,H)){var M=f/3,K=Math.cos(M),T=Math.sin(M);M=L*2*Math.sqrt(2)/3;var V=-L/3,W=M*K+0*T;K=-M*T+0*K;this.V=[new e(0,0,L),new e(W,K,V),new e(W,-K,V),new e(M,0,V)];this.updateValues(L,G,O,S,H)}}}class D extends z{constructor(L,G){super(L,G);this.faces=[[3,1,0],[2,3,0],[1,4,0],[4,2,0],[1,3,5],[3,2,5],[4,1,5],[2,4,5]]}buildGeometry(L,G,O,S,H){L/=2;this.changeGeometry(L,G,O,S,H)||(this.V=[new e(0,0,
L),new e(L,0,0),new e(-L,0,0),new e(0,L,0),new e(0,-L,0),new e(0,0,-L)],this.updateValues(L,G,O,S,H))}}class F extends z{constructor(L,G){super(L,G)}buildGeometry(L,G,O,S,H){L/=2;G/=2;O/=2;if(!this.changeGeometry(L,G,O,S,H)){this.V=[new e(0,0,G)];for(var M=1;M<S;M++){c=M*h/S;for(var K=0;K<H;K++)t=K*f/H,this.V.push(new e(L*d(c)*g(t),O*d(c)*d(t),G*g(c)))}this.V.push(new e(0,0,-G));this.faces=[];for(M=0;M<H;M++)this.faces.push([0,(M+1)%H+1,M%H+1]);for(M=1;M<S-1;M++)for(K=0;K<H;K++)this.faces.push([K+
1+(M-1)*H,(K+1)%H+1+(M-1)*H,(K+1)%H+1+M*H,K+1+M*H]);for(M=0;M<H;M++)this.faces.push([this.V.length-1,this.V.length-1-H+M,this.V.length-1-H+(M+1)%H]);this.updateValues(L,G,O,S,H)}}}class B extends F{constructor(L,G){super(L,G)}buildGeometry(L,G,O,S,H){super.buildGeometry(L,L,L,S,H)}}class I extends z{constructor(L,G){super(L,G);this.faces=[[0,16,2,10,8],[12,1,17,16,0],[8,4,14,12,0],[2,16,17,3,13],[13,15,6,10,2],[6,18,4,8,10],[3,17,1,9,11],[13,3,11,7,15],[1,12,14,5,9],[11,9,5,19,7],[5,14,4,18,19],[6,
15,7,19,18]]}buildGeometry(L,G,O,S,H){L/=Math.PI;if(!this.changeGeometry(L,G,O,S,H)){k=L/1.6180339887;r=L*1.6180339887;this.V=[new e(L,L,L),new e(L,L,-L),new e(L,-L,L),new e(L,-L,-L),new e(-L,L,L),new e(-L,L,-L),new e(-L,-L,L),new e(-L,-L,-L),new e(0,k,r),new e(0,k,-r),new e(0,-k,r),new e(0,-k,-r),new e(k,r,0),new e(k,-r,0),new e(-k,r,0),new e(-k,-r,0),new e(r,0,k),new e(r,0,-k),new e(-r,0,k),new e(-r,0,-k)];p=(new b.Mat4).setIdentity().rotateY(-h/6);for(let M=0,K=this.V.length;M<K;M++)this.V[M]=
p.mulV4(this.V[M]);this.updateValues(L,G,O,S,H)}}}class E extends z{constructor(L,G){super(L,G);this.faces=[[10,0,2],[0,8,2],[8,5,2],[5,7,2],[7,10,2],[6,0,10],[11,6,10],[7,11,10],[7,3,11],[5,3,7],[9,3,5],[8,9,5],[4,9,8],[0,4,8],[6,4,0],[11,3,1],[6,11,1],[4,6,1],[9,4,1],[3,9,1]]}buildGeometry(L,G,O,S,H){L/=3.8;if(!this.changeGeometry(L,G,O,S,H)){r=L*1.6180339887;this.V=[new e(0,L,r),new e(0,L,-r),new e(0,-L,r),new e(0,-L,-r),new e(L,r,0),new e(L,-r,0),new e(-L,r,0),new e(-L,-r,0),new e(r,0,L),new e(r,
0,-L),new e(-r,0,L),new e(-r,0,-L)];p=(new b.Mat4).setIdentity().rotateY(-1.0285);for(let M=0,K=this.V.length;M<K;M++)this.V[M]=p.mulV4(this.V[M]);this.updateValues(L,G,O,S,H)}}}class P extends z{constructor(L,G){super(L,G)}buildGeometry(L,G,O,S,H){L/=2;G/=2;O/=2;if(!this.changeGeometry(L,G,O,S,H)){this.V=[];for(var M=0;M<H;M++)for(var K=0;K<S;K++)this.V.push(new e(L*(H-M)/H*g(K*f/S),O*(H-M)/H*d(K*f/S),G-M*2*G/H));this.V.push(new e(0,0,-G));this.faces=[];for(M=0;M<H-1;M++)for(K=0;K<S;K++)this.faces.push([K+
M*S,(K+1)%S+M*S,(K+1)%S+(M+1)*S,K+(M+1)*S]);for(M=0;M<S;M++)this.faces.push([this.V.length-1,this.V.length-1-S+M,this.V.length-1-S+(M+1)%S]);this.updateValues(L,G,O,S,H)}}}class N extends z{constructor(L,G){super(L,G)}buildGeometry(L,G,O,S,H){L/=2;G/=2;O/=2;if(!this.changeGeometry(L,G,O,S,H)){this.V=[];for(var M=0;M<H+1;M++)for(var K=0;K<S;K++)this.V.push(new e(L*g(K*f/S),O*d(K*f/S),G-M*2*G/H));this.faces=[];for(M=0;M<H;M++)for(K=0;K<S;K++)this.faces.push([K+M*S,(K+1)%S+M*S,(K+1)%S+(M+1)*S,K+(M+1)*
S]);this.updateValues(L,G,O,S,H)}}}class U extends z{constructor(L,G){super(L,G)}buildGeometry(L,G,O,S,H){L/=2;G/=2;O/=2;v=q.eval(this.R);m=q.eval(this.r);if(!this.changeGeometry(L,G,O,S,H)){this.V=[];for(var M=0;M<H+1;M++)for(var K=0;K<S;K++)this.V.push(new e(-(v+m*d(f*K/S))*d(f*M/H),(v+m*d(f*K/S))*g(f*M/H),m*g(f*K/S)));this.faces=[];for(M=0;M<H;M++)for(K=0;K<S;K++)this.faces.push([K+M*S,K+(M+1)*S,(K+1)%S+(M+1)*S,(K+1)%S+M*S]);this.updateValues(L,G,O,S,H)}}}class X extends z{constructor(L,G){super(L,
G);a.fileData=b.openFile(a.evaluator.eval(a.file)).split(/\r/)}buildGeometry(){this.V=[];this.faces=[];for(let L=0,G=this.fileData.length;L<G;L++)x=this.fileData[L],x.startsWith("V")?(u=x.slice(2,-1).split(",").map(parseFloat),this.V.push(new e(u[0]||0,u[1]||0,u[2]||0))):x.startsWith("F")&&(u=x.slice(2,-1).split(",").map(parseInt),this.faces.push(u.reverse()))}}b.OtherGeometry3D=z;b.Cube3D=w;b.Box3D=A;b.Tetrahedron3D=y;b.Octahedron3D=D;b.Sphere3D=B;b.Ellipsoid3D=F;b.Dodecahedron3D=I;b.Icosahedron3D=
E;b.Cone3D=P;b.Cylinder3D=N;b.Torus3D=U;b.Mesh3D=X})(descartesJS);
(b=>{let a=Math.max,h=Math.min,f=Math.PI,l=Math.cos,d=Math.sin,g=Math.abs,e=Math.round,q,n,t,c,v,m,k,r,p,x,u,z,A,w,y,D,F,B;class I{constructor(E=0,P=0){this.x=E;this.y=P}set(E=0,P=0){this.x=E;this.y=P;return this}copy(){return new I(this.x,this.y)}ix(){return e(a(h(this.x,32E3),-32E3))}iy(){return e(a(h(this.y,32E3),-32E3))}equals(E){return this.x===E.x&&this.y===E.y}norm2(){return this.x*this.x+this.y*this.y}norm(){return Math.sqrt(this.norm2())}distance(E){n=this.copy();n.sub(E);return n.norm()}dot(E){return this.x*
E.x+this.y*E.y}det(E){return this.x*E.y-this.y*E.x}mul(E){this.x*=E;this.y*=E}div(E){this.x/=E;this.y/=E}add(E){this.x+=E.x;this.y+=E.y}sub(E){this.x-=E.x;this.y-=E.y}normalize(){q=this.norm();q!=0&&this.div(q)}rotR90(){q=this.x;this.x=this.y;this.y=-q}rotL90(){q=this.x;this.x=-this.y;this.y=q}rot(E){t=this.copy();m=l(E);k=d(E);this.x=t.x*m-t.y*k;this.y=t.x*k+t.y*m}rot2(E){this.rot(E*f/180)}intersection(E,P,N,U){r=P.x-E.x;p=N.x-U.x;x=N.x-E.x;u=P.y-E.y;z=N.y-U.y;A=N.y-E.y;B=r*z-p*u;return g(B)>1E-6?
(c=(x*z-A*p)/B,v=(-x*u+A*r)/B,0<=c&&c<=1&&0<=v&&v<=1?new I(E.x+r*c,E.y+u*c):null):(P.x-N.x)*A!=(P.y-N.y)*x?null:E.x!=P.x?(w=h(E.x,P.x),y=a(E.x,P.x),w<=N.x&&N.x<=y?N:w<=U.x&&U.x<=y?U:null):N.x!=U.x?(D=h(N.x,U.x),F=a(N.x,U.x),D<=E.x&&E.x<=F?E:D<=P.x&&P.x<=F?P:null):E.y!=P.y?(w=h(E.y,P.y),y=a(E.y,P.y),w<=N.y&&N.y<=y?N:w<=U.y&&U.y<=y?U:null):N.y!=U.y?(D=h(N.y,U.y),F=a(N.y,U.y),D<=E.y&&E.y<=F?E:D<=P.y&&P.y<=F?P:null):E.x==N.x&&E.y==N.y?E:null}}b.R2=I})(descartesJS);
(b=>{let a,h,f,l,d,g,e,q,n;class t{constructor(c,v){this.evaluator=c;this.constraint=v;/==|<|>|<=|>=/.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]);g=new b.R2(0,0);d=new b.R2(0,0);n=new b.R2(0,0)}getUnitNormal(){this.normal.normalize();return n.set(this.normal.x,this.normal.y)}gradient(c){a=this.evaluator;g.x=0;g.y=0;e=
a.getVariable("x");q=a.getVariable("y");a.setVariable("x",c.x);a.setVariable("y",c.y);this.f0=a.eval(this.constraint);a.setVariable("x",a.getVariable("x")+1E-6);h=a.eval(this.constraint);g.x=(h-this.f0)/1E-6;g.x=isNaN(g.x)?Infinity:g.x;a.setVariable("x",a.getVariable("x")-1E-6);a.setVariable("y",a.getVariable("y")+1E-6);h=a.eval(this.constraint);g.y=(h-this.f0)/1E-6;g.y=isNaN(g.y)?Infinity:g.y;a.setVariable("x",e);a.setVariable("y",q);return g}findZero(c,v,m){a=this.evaluator;d.x=c.x;d.y=c.y;e=a.getVariable("x");
q=a.getVariable("y");a.setVariable("x",c.x);a.setVariable("y",c.y);this.f0=a.eval(this.constraint);if(this.sign=="<"&&this.f0<=0||this.sign==">"&&this.f0>=0)return d;a.setVariable("x",e);a.setVariable("y",q);for(let k=0;k<16;k++)if(f=d.x,l=d.y,this.normal=this.gradient(d),this.normal.norm2()!=0&&this.normal.mul(-this.f0/this.normal.norm2()),d.x=f+this.normal.x,d.y=l+this.normal.y,this.normal.norm()<v)return this.normal.x===0&&this.normal.y===0&&(this.normal.x=d.x-c.x,this.normal.y=d.y-c.y),d;return m?
d:null}}b.R2Newton=t})(descartesJS);(b=>{class a{constructor(h,f){this.x=h;this.y=f}vLength(){return Math.sqrt(this.x*this.x+this.y*this.y)}dotProduct(h){return this.x*h.x+this.y*h.y}angleBetweenVectors(h){return Math.acos(this.dotProduct(h)/(this.vLength()*h.vLength()))}}a.AXIS_X=new a(1,0);a.AXIS_Y=new a(0,1);b.Vector2D=a})(descartesJS);
(b=>{let a,h=Math.floor,f=Math.round,l,d,g,e,q,n,t,c,v,m,k,r,p;class x{constructor(u,z){a=this;a.parent=u;a.evaluator=u.evaluator;let A=a.parser=u.evaluator.parser;a.id=z.type!=="GraphicControl"?"C":"G";a.region="south";a.x=a.y=0;a.w=z.type!=="Video"?100:350;a.h=z.type!=="Video"?23:120;a.keyboard=!1;a.kblayout="1x16";z.type!=="GraphicControl"&&z.type!=="Audio"&&z.type!=="Video"?z.type!=="TextArea"?a.expresion=A.parse("(0,0,100,23)"):(a.expresion=A.parse("(0,0,300,200)"),a.w=300,a.h=200):a.expresion=
A.parse("(0,0)");a.fixed=a.visible=!0;a.color=new b.Color(z.gui=="Scrollbar"?"e0e4e8":"222222");a.colorInt="cc0022";z.gui=="Scrollbar"?a.colorInt="182C61":z.type!=="GraphicControl"&&(a.colorInt="f0f8ff");a.colorInt=new b.Color(a.colorInt);a.font_size=A.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=A.parse("1");a.valueExpr=A.parse("0");a.decimals=A.parse("2");
a.min=A.parse("-Infinity");a.max=A.parse("Infinity");a.incr=A.parse("0.1");a.discrete=a.exponentialif=!1;a.zIndex=-1;Object.assign(a,z);/Video|Audio/.test(a.type)&&(a.region="interior");a.name==void 0&&(a.name=a.parent.version==2?a.id:"_nada_");a.name=/_\._|_nada_|_void_/.test(a.name)?"":a.name;z=a.evaluator.eval(a.expresion)[0];a.x=f(z[0]);a.y=f(z[1]);z.length==4&&(a.w=f(z[2]),a.h=f(z[3]));a.actionExec=u.lessonParser.parseAction(a)}init(){}update(){}draw(){}getContainer(){a=this;let u=a.parent.spaces;
if(a.region==="interior")for(let z of u){if(z.id===a.spaceID)return z.addCtr(a),a.zIndex=z.zIndex,a.space=z,z.numCtrContainer}else{if(a.region==="external")return a.parent.externalSpace.addCtr(a),a.parent.externalSpace.container;if(a.region==="scenario")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}u[0].addCtr(a);a.zIndex=u[0].zIndex;return u[0].numCtrContainer}addControlContainer(u){this.getContainer().appendChild(u)}updatePositionAndSize(){a=this;g=e=q=n=!1;t=a.evaluator.eval(a.expresion)[0];c=f(t[0]);g=f(a.x)!==c;a.x=c;c=f(t[1]);e=f(a.y)!==c;a.y=c;t.length===4&&(c=f(t[2]),q=f(a.w)!==c,a.w=c,c=f(t[3]),n=f(a.h)!==c,a.h=c);if(q||n||g||e)a.init(!0,!0),a.draw()}formatValue(u){a=this;p=a.parent;v=u+"";m=a.evaluator.eval(a.decimals);
k=v.indexOf(".");k!=-1&&(r=v.substring(k+1),r.length>m&&(v=parseFloat(v).toFixed(m)));a.fixed&&(p.version!==2||p.version===2&&!a.exponentialif)&&(v=parseFloat(u).toFixed(m));a.exponentialif&&parseFloat(v)!=0&&(v=a.fixed&&p.version!==2?parseFloat(v).toExponential(m):parseFloat(v).toExponential(),v=v.toUpperCase().replace("+",""));return v.replace(".",p.decimal_symbol)}updateAndExecAction(){p=this.parent;p.updateControls();this.action==="init"&&(this.click=!1);this.actionExec.execute();p.updateControls();
this.action!=="animate"&&p.update();p.updateControls()}createGradient(u,z){this.linearGradient=this.ctx.createLinearGradient(0,0,0,z);l=z*z;for(u=0;u<z;u++)d=h(u-35*z*.01),this.linearGradient.addColorStop(u/z,`rgba(0,0,0,${d*d*192/l/255})`)}}b.Control=x})(descartesJS);
(b=>{let a;const h=/[\w\.\-//]*(\.gif)/gi,f=/CanvasGradient|CanvasPattern/;let l=Math.floor,d=Math.abs,g,e,q,n,t,c,v,m,k,r,p,x,u,z,A,w,y,D,F,B,I,E,P,N,U,X,L,G,O,S,H,M,K,T,V,W;class ba extends b.Control{constructor(C,R){super(C,R);a=this;a.imageSrc=R.imageSrc||"";a.image=R.image||new Image;a.imageOver=R.imageOver||new Image;a.imageDown=R.imageDown||new Image;a.flat=R.flat||!1;a.borderColor=R.borderColor||!1;a.text_align=R.text_align||"center_center";a.image_align=R.image_align||"center_center";a.font_family=
b.getFontName(R.font_family||"arial");a.ratio=C.ratio;a.font_size===-1&&(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;let Z;for(Y of a.extra_style.split("|"))C=(R=Y.trim().match(/(.*)=(.*)/))?R[1].trim():"",R=R?R[2].trim():"",Z=R.match(/rgb/g)?"":"#",C==="class"?a.classContainer=" "+R:C==="border"?(a.btnStyle.push({type:"border-style",value:"solid"}),a.btnStyle.push({type:"border-width",value:R+"px"})):C==="borderRadius"?(a.btnStyle.push({type:"border-radius",value:R+"px"}),a.conStyle.push({type:"border-radius",value:R+"px"})):
C==="borderColor"?a.btnStyle.push({type:"border-color",value:Z+R}):/^(overColor|downColor|inactiveColor|inactiveColorBorder|shadowTextColor|shadowBoxColor|shadowInsetBoxColor)$/.test(C)?a.conStyle[C]=Z+R:C==="font"?a.conStyle[C]=R.toLowerCase():/^(shadowTextBlur|shadowTextOffsetX|shadowTextOffsetY|shadowBoxBlur|shadowBoxOffsetX|shadowBoxOffsetY|shadowInsetBoxBlur|shadowInsetBoxOffsetX|shadowInsetBoxOffsetY|textBorder)$/.test(C)?a.conStyle[C]=parseFloat(R)||0:/^(imgSizeW|imgSizeH)$/.test(C)?a[C]=parseFloat(R)||
0:C==="flat"&&(a[C]=parseInt(R)==1)}if(a.imageSrc.startsWith("_COLORES_")){var Y=a.imageSrc.split("_");a.colorInt=new b.Color(Y[2]);a.color=new b.Color(Y[3]);a.font_size=a.parser.parse(Y[5]);a.imageSrc=""}/^\[.*\]$/.test(a.imageSrc)?a.imageSrc=a.parser.parse(a.imageSrc.slice(1,-1)):a.imageSrc=a.parser.parse(`'${a.imageSrc}'`);Y=a.evaluator.eval(a.imageSrc).toString().trim();if(Y!="")if(S=Y.substr(0,Y.lastIndexOf(".")),H=Y.substr(Y.lastIndexOf(".")),Y.match(/vacio.gif$/i))this.imageSrc=this.parser.parse("'vacio.gif'"),
this.image.ready=1,this.parent.version===3&&(this.name=this.parser.parse("")),this.emptyImage={ready:!0},this.parser.parse("'vacio.gif'");else if(this.image=this.parent.getImage(Y),S)try{this.imageOver=this.parent.getImage(S+"_over"+H),this.imageDown=this.parent.getImage(S+"_down"+H)}catch(Z){}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()}init(C){a=this;g=a.evaluator;B=a.container;e=a.btn;q=a.ctx;n=g.eval(a.expresion)[0];a.x=n[0];a.y=n[1];n.length==4&&(a.w=parseInt(n[2]),a.h=parseInt(n[3]));e.width=a.w*a.ratio;e.height=a.h*a.ratio;e.setAttribute("style",
`position:absolute;left:0;top:0;width:${a.w}px;height:${a.h}px;box-sizing:border-box;`);B.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(let R of a.btnStyle)e.style[R.type]=R.value;if(a.conStyle){for(let R of a.conStyle)B.style[R.type]=R.value;a.conStyle.shadowBoxColor&&(B.style.boxShadow=`${a.conStyle.shadowBoxOffsetX||0}px ${a.conStyle.shadowBoxOffsetY||2}px ${a.conStyle.shadowBoxBlur||2}px 1px ${a.conStyle.shadowBoxColor}`);
a.conStyle.shadowInsetBoxColor&&(e.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=g.parser.parse(b.getFieldFontSize(this.h)+""));a.fs_evaluated=g.eval(a.font_size);a.createGradient(a.w,a.h);B.style.display=g.eval(a.drawif)>0?"block":"none";q.lineJoin="round";q.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:g,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)}update(){a=this;g=a.evaluator;B=a.container;a.activeIfValue=g.eval(a.activeif)>0;a.drawIfValue=g.eval(a.drawif)>0;(a.space?a.space.drawIfValue:1)&&a.drawIfValue?(B.style.display="block",a.draw(),B.style.cursor=a.btn.style.cursor=a.activeIfValue?"pointer":"not-allowed",B.setAttribute("active",a.activeIfValue),a.updatePositionAndSize()):
(B.style.display="none",a.buttonClick=!1)}draw(C){a=this;B=a.container;g=a.evaluator;e=a.btn;q=a.ctx;c=g.eval(a.name);a.text_object.draw(b.ctx,"#000000",0,0);c=a.text_object.textNodes.toStr();v=a.evaluator.eval(a.imageSrc).toString().trim();if(!C&&(I=a.over===a.oldOver,E=a.buttonClick===a.oldButtonClick,P=a.activeIfValue===a.oldActiveIfValue,N=a.drawIfValue===a.oldDrawIfValue,U=c===a.oldName,X=v===a.oldImageSrc,L=a.colorInt.getColor()===a.oldBackColor,G=a.color.getColor()===a.oldTextColor,O=a.image.ready===
a.oldImageReady,a.oldOver=a.over,a.oldButtonClick=a.buttonClick,a.oldActiveIfValue=a.activeIfValue,a.oldDrawIfValue=a.drawIfValue,a.oldName=c,a.oldImageSrc=v,a.oldBackColor=a.colorInt.getColor(),a.oldTextColor=a.color.getColor(),a.oldImageReady=a.image.ready,I&&E&&P&&N&&U&&X&&L&&G&&O))return;q.save();q.setTransform(a.ratio,0,0,a.ratio,0,0);t=a.fs_evaluated;B.setAttribute("data-name",c);v?(m=v==="vacio.gif"?this.emptyImage:this.parent.getImage(v),S=v.substr(0,v.lastIndexOf(".")),H=v.substr(v.lastIndexOf(".")),
M=S+"_over"+H,K=S+"_down"+H,T=v==="vacio.gif"?this.emptyImage:this.parent.getImage(M),V=v==="vacio.gif"?this.emptyImage:this.parent.getImage(K)):m=T=V=a.emptyImg;q.clearRect(0,0,a.w,a.h);r=p=a.buttonClick?1:0;a.text_object.draw(q,a.color.getColor(),0,0,!0);x=a.text_object.textNodes.metrics.w;u=a.text_object.textNodes.metrics.h;a.text_align[1]=="center"?D=l(a.w/2+r)-.5:a.text_align[1]=="left"?D=x/2+5+r:a.text_align[1]=="right"&&(D=a.w-x/2+r-5);a.text_align[0]=="center"?F=l(a.h/2+p)-.5:a.text_align[0]==
"top"?F=u/2+p+4:a.text_align[0]=="bottom"&&(F=a.h-u/2+p-3);if(m){if(z=a.imgSizeW||m.width,A=a.imgSizeH||m.height,a.image_align[1]=="center"?w=parseInt((a.w-z)/2)+r:a.image_align[1]=="left"?w=r:a.image_align[1]=="right"&&(w=a.w-z+r),a.image_align[0]=="center"?y=parseInt((a.h-A)/2)+p:a.image_align[0]=="top"?y=p:a.image_align[0]=="bottom"&&(y=a.h-A+p),m&&m.ready)if(m!==a.emptyImg&&m.complete)if(v.match(h))e.style.backgroundRepeat="no-repeat",e.style.backgroundImage=`url('${v}')`,e.style.backgroundPosition=
`${w}px ${y}px`;else{if(a.image_align[0]!="center"||a.image_align[1]!="center")(W=a.colorInt.getColor())&&f.test(W.constructor.name)?(q.fillStyle=W,q.fillRect(0,0,a.w,a.h)):B.style.backgroundColor=W;q.drawImage(m,0,0,m.width,m.height,w,y,z,A)}else a.emptyImg&&a.customStyle&&((W=a.colorInt.getColor())&&f.test(W.constructor.name)?(q.fillStyle=W,q.fillRect(0,0,a.w,a.h)):B.style.backgroundColor=W)}else(W=a.colorInt.getColor())&&f.test(W.constructor.name)?(q.fillStyle=W,q.fillRect(0,0,a.w,a.h)):(B.style.backgroundColor=
W,a.flat||(a.buttonClick||(a.drawLine(q,a.w-1,0,a.w-1,a.h,"rgba(0,0,0,0.5)"),a.drawLine(q,0,0,0,a.h,"rgba(0,0,0,0.09)"),a.drawLine(q,1,0,1,a.h,"rgba(0,0,0,0.03)")),q.fillStyle=a.linearGradient,q.fillRect(0,0,a.w,a.h)));a.activeIfValue&&(T!==a.emptyImg&&a.over&&T.ready&&T.complete?M.match(h)?(e.style.backgroundImage=`url('${M}')`,e.style.backgroundPosition=`${w}px ${y}px`):q.drawImage(T,w,y):a.customStyle&&a.conStyle.overColor&&a.over&&(B.style.backgroundColor=a.conStyle.overColor));a.activeIfValue?
V!==a.emptyImg&&a.buttonClick&&V.ready&&V.complete?K.match(h)?(e.style.backgroundImage=`url('${K}')`,e.style.backgroundPosition=`${w}px ${y}px`):q.drawImage(V,w,y):a.customStyle&&a.conStyle.downColor&&a.buttonClick&&(B.style.backgroundColor=a.conStyle.downColor):a.buttonClick&&!m&&(q.fillStyle="rgba(0,0,0,0.09)",q.fillRect(0,0,a.w,a.h));q.fillStyle=a.color.getColor();a.customStyle&&a.conStyle.shadowTextColor&&a.conStyle.textBorder>0&&(q.lineWidth=a.conStyle.textBorder,q.strokeStyle=a.conStyle.shadowTextColor);
a.borderColor&&(q.lineWidth=parseInt(t/6),q.strokeStyle=a.borderColor.getColor());a.text_object.draw(q,a.color.getColor(),D,F);a.underlined&&(q.strokeStyle=a.color.getColor(),q.lineWidth=l(t*.1)||2,q.lineCap="round",q.beginPath(),q.moveTo(D-x/2+r,F+l(t/2)+l(t/5)-1.5),q.lineTo(D+x/2+r,F+l(t/2)+l(t/5)-1.5),q.stroke());a.activeIfValue||(a.customStyle&&a.conStyle.inactiveColor?B.style.backgroundColor=a.conStyle.inactiveColor:(q.fillStyle="rgba(240,240,240,0.6)",q.fillRect(0,0,a.w,a.h)));q.restore();a._image_pos_x=
w;a._image_pos_y=y}drawLine(C,R,Y,Z,J,Q="black",aa=1){C.lineWidth=aa;C.strokeStyle=Q;k=C.lineWidth%2*.5;C.beginPath();C.moveTo(l(R)+k,l(Y)+k);C.lineTo(l(Z)+k,l(J)+k);C.stroke()}drawTextBorder(){this.colorInt.getColor();this.color.getColor();return!((d(this.colorInt.r-this.color.r)+d(this.colorInt.g-this.color.g)+d(this.colorInt.b-this.color.b))/255<.5)}addEvents(){function C(Q,aa,ca){b.clearTimeout(J);Z.buttonClick&&Z.drawIfValue&&Z.activeIfValue&&(aa.call(Z),Q=ca?Q:100,J=b.setTimeout(function(){C(Q,
aa,!1)},Q))}function R(Q){Z.parent.deactivateControls();this.focus();Q.preventDefault();Q.stopPropagation();document.activeElement!=document.body&&document.activeElement.blur();Z.whichBtn=b.whichBtn(Q);Z.whichBtn=="L"&&Z.activeIfValue&&(Z.buttonClick=!0,Z.draw(),Z.action=="calculate"&&(Z.evaluator.setVariable(Z.id,Z.evaluator.eval(Z.valueExpr)),C(1E3,Z.updateAndExecAction,!0)),Z.btn.removeEventListener("touchend",Y),Z.btn.addEventListener("touchend",Y),Z.btn.removeEventListener("mouseup",Y),Z.btn.addEventListener("mouseup",
Y))}function Y(Q){b.newBlobContent=null;this.focus();Q.preventDefault();Q.stopPropagation();Z.activeIfValue||Z.buttonClick?(Z.buttonClick=!1,Z.draw(),Z.action!="calculate"&&(Z.evaluator.setVariable(Z.id,Z.evaluator.eval(Z.valueExpr)),Z.updateAndExecAction()),Z.btn.removeEventListener("touchend",Y),Z.btn.removeEventListener("mouseup",Y)):Z.parent.update()}let Z=this,J;this.over=this.buttonClick=!1;this.btn.addEventListener("touchstart",R);this.btn.addEventListener("mousedown",R);this.btn.addEventListener("mouseover",
function(Q){Q.preventDefault();Q.stopPropagation();Z.over=!0;Z.draw()});this.btn.addEventListener("mouseout",function(Q){b.newBlobContent=null;Q.preventDefault();Q.stopPropagation();Z.over=!1;Z.buttonClick=!1;Z.draw()});document.addEventListener("visibilitychange",function(Q){b.newBlobContent=null;Z.buttonClick=!1})}}b.Button=ba})(descartesJS);
(b=>{let a,h,f,l,d,g,e,q,n,t,c,v,m,k;class r extends b.Control{constructor(p,x){super(p,x);a=this;a.flat=a.image_dec_src&&a.image_inc_src;a.btn_pos=a.btn_pos||"v_left";a.horizontal=a.btn_pos==="h_left"||a.btn_pos==="h_right"||a.btn_pos==="h_left_right";a.label_color=a.label_color||new b.Color("e0e4e8",p.evaluator);a.label_text_color=a.label_text_color||new b.Color("000000",p.evaluator);a.tabindex=++p.tabindex;a.name_str=a.name;a.initial_value=0;try{a.initial_value=a.evaluator.eval(a.parser.parse(a.valueExprString))}catch(u){console.log(u)}/^&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=p.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);c=a.evaluator.parser.parse("1");a.originalIncr=a.incr;if(a.evaluator.eval(a.decimals)<0||a.evaluator.eval(a.incr)===0)p=a.evaluator.eval(a.incr),p>0?a.originalIncr=a.incr=a.evaluator.parser.parse(parseInt(p).toString()):
a.incr=c;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()}init(p,x){a=this;h=a.evaluator;a.label.innerHTML=h.eval(a.name).toString();p=a.label.textContent;x||(a.value=a.validateValue(h.eval(a.valueExpr)));x=a.formatValue(a.value);a.fieldFontSize=h.eval(a.font_size)>0?h.eval(a.font_size):b.getFieldFontSize(a.h);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);var u=a.parent.version!==2?"__":"_____",z=b.getTextWidth(x+"_",`${a.fieldFontSize}px ${b.sansserif_font}`);if(a.horizontal){var A=parseInt(a.h),w=parseInt(a.w/2-A);u=a.text_object.textNodes.metrics.w+parseInt(a.fieldFontSize);a.visible||(w=a.w-2*A,z=0);w<u&&(w=u);p==""&&(w=0);a.w-w-A<z&&(w=a.w-A-z);w<0&&(w=0);p=a.w-(w+
2*A);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:${A}px;height:${A}px;${a.btn_pos==="h_left"?"left:"+(w+A):"right:0"}px;top:0;${a.flat?"border-width:0;":""}`);a.divDown.setAttribute("style",`width:${A}px;height:${A}px;left:${w+(a.btn_pos==="h_right"?p:0)}px;top:0;${a.flat?"border-width:0;":""}`);a.field.setAttribute("style",`font-family:${b.sansserif_font};font-size:${a.fieldFontSize}px;width:${p}px;height:${a.h}px;left:${A+
w+(a.btn_pos==="h_left"?A:a.btn_pos==="h_right"?-A:0)}px;text-align:center;`);a.cover.setAttribute("style",`width:${p}px;height:${a.h}px;left:${A+w+(a.btn_pos==="h_left"?A:a.btn_pos==="h_right"?-A:0)}px;text-align:center;`);a.field.value=x;a.visible||(a.field.style.display="none");a.label.setAttribute("style",`font-size:${a.fieldFontSize}px;width:${w}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=w*a.ratio}else A=
2+parseInt(a.h/2),w=parseInt(a.w/2-A/2),u=b.getTextWidth(p+u,a.fieldFontSize+"px "+b.sansserif_font),a.visible||(w=a.w-A,z=0),w<u&&(w=u),p==""&&(w=0),a.w-w-A<z&&(w=a.w-A-z),w<0&&(w=0),p=a.w-(w+A),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;`),z=`width:${A}px;left:${w+(a.btn_pos==="v_right"?p:0)}px;`,a.divUp.setAttribute("style",`${z};height:${a.h/2+1}px;top:0;${a.flat?"border-width:0;":""}`),a.divDown.setAttribute("style",
`${z};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:${p}px;height:${a.h}px;left:${(a.btn_pos==="v_left"?A:0)+w}px;`),a.cover.setAttribute("style",`width:${p}px;height:${a.h}px;left:${(a.btn_pos==="v_left"?A:0)+w}px;`),a.field.value=x,a.visible||(a.field.style.display="none"),a.label.setAttribute("style",`font-size:${a.fieldFontSize}px;width:${w}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=w*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);h.setVariable(a.id,a.value)}update(){a=this;h=a.evaluator;h.eval(a.decimals)<0?(f=h.eval(a.incr),f>0?a.originalIncr=a.incr=h.parser.parse(parseInt(f).toString()):
a.incr=c):a.incr=h.eval(a.originalIncr)!==0?a.originalIncr:c;a.activeIfValue=h.eval(a.activeif)>0;a.drawIfValue=h.eval(a.drawif)>0;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&&(m=a.evaluator.eval(a.image_inc_src).toString().trim(),a.old_image_inc_src!==m&&(a.divUp.style["background-image"]=`url(${m})`,a.image_inc_src=m));a.updatePositionAndSize();a.parent.animation.playing&&document.activeElement==a.field||(l=a.field.value,d=a.value,a.value=a.validateValue(h.getVariable(a.id)),a.field.value=a.formatValue(a.value),a.value==d&&a.field.value!=l&&(a.value=a.validateValue(l),a.field.value=a.formatValue(a.value)),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);(k=a.label_color.getColor())&&/CanvasGradient|CanvasPattern/.test(k.constructor.name)&&(a.label_ctx.fillStyle=k,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)}updateStyle(){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"}validateValue(p){h=this.evaluator;isNaN(parseFloat(p))||p.toString().includes("e")&&(p=parseFloat(p).toFixed(20));p=p!=void 0?p.toString():
"0";p=p.replace(this.parent.decimal_symbol,".");g=p==parseFloat(p)?parseFloat(p):parseFloat(h.eval(h.parser.parse(p)));isNaN(g)&&(g=0);n=h.eval(this.min);t=h.eval(this.max);n===""&&(n=-Infinity);t===""&&(t=Infinity);g=Math.min(Math.max(g,n),t);this.discrete&&(e=h.eval(this.incr),g=e==0?0:this.initial_value+e*Math.round((g-this.initial_value)/e));q=h.eval(this.decimals);q<=0&&(q=0);return g=parseFloat(parseFloat(g).toFixed(q))}increase(){this.changeValue(parseFloat(this.value)+this.evaluator.eval(this.incr))}decrease(){this.changeValue(parseFloat(this.value)-
this.evaluator.eval(this.incr))}changeValue(p){this.activeIfValue&&(this.value=this.validateValue(p),this.field.value=this.formatValue(this.value),this.evaluator.setVariable(this.id,this.value),this.updateAndExecAction())}addEvents(){function p(D,F,B){b.clearTimeout(y);if(w.up||w.down)F.call(w),D=B?D:Math.max(D-50,25),y=b.setTimeout(function(){p(D,F)},D)}function x(D){D.preventDefault();w.whichBtn=b.whichBtn(D);w.whichBtn=="L"&&w.activeIfValue&&(w.up=!0,p(400,w.increase,!0))}function u(D){D.preventDefault();
w.whichBtn=b.whichBtn(D);w.whichBtn=="L"&&w.activeIfValue&&(w.down=!0,p(400,w.decrease,!0))}function z(D){w.up=!1;b.clearTimeout(y);w.updateStyle()}function A(D){w.down=!1;b.clearTimeout(y);w.updateStyle()}let w=this,y;w.label.addEventListener("touchstart",b.preventDefault);w.label.addEventListener("mousedown",b.preventDefault);w.field.addEventListener("keydown",function(D){D.keyCode==13&&w.changeValue(w.field.value)});w.divUp.addEventListener("touchstart",x);w.divUp.addEventListener("mousedown",
x);w.divDown.addEventListener("touchstart",u);w.divDown.addEventListener("mousedown",u);w.divUp.addEventListener("mouseout",function(D){w.up=!1;b.clearTimeout(y);D.preventDefault();w.updateStyle()});w.divDown.addEventListener("mouseout",function(D){w.down=!1;b.clearTimeout(y);D.preventDefault();w.updateStyle()});w.divUp.addEventListener("touchend",z);window.addEventListener("touchend",z);w.divUp.addEventListener("mouseup",z);window.addEventListener("mouseup",z);w.divDown.addEventListener("touchend",
A);window.addEventListener("touchend",A);w.divDown.addEventListener("mouseup",A);window.addEventListener("mouseup",A);document.addEventListener("visibilitychange",function(D){w.up=w.down=!1;b.clearTimeout(y);w.updateStyle()});w.field.addEventListener("blur",function(D){w.drawIfValue&&w.changeValue(w.field.value,!0)});w.field.addEventListener("click",function(D){this.focus()});w.cover.addEventListener("click",function(D){D=w.evaluator.eval(w.kbexp);w.activeIfValue&&w.parent.keyboard.show(w,w.kblayout,
D[0][0]||0,D[0][1]||0,w.id,w.field,w.onlyText)})}}b.Spinner=r})(descartesJS);
(b=>{let a,h,f;class l extends b.Control{constructor(d,g){super(d,g);a=this;a.label_color=a.label_color||new b.Color("e0e4e8",d.evaluator);a.label_text_color=a.label_text_color||new b.Color("000000",d.evaluator);a.typeCtr="checkbox";a.pressed=g.pressed||!1;a.radio_group=(g.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=++d.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=d.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()}init(d){a=this;h=a.evaluator;a.label.innerHTML=h.eval(a.name).toString();a.labelFontSize=h.eval(a.font_size)>0?h.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:h,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};`);a.position=="right"?(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=h.getVariable(a.id)!=0;a.label.width=d*a.ratio;a.label.height=a.h*a.ratio;a.update()}update(){a=this;h=a.evaluator;a.activeIfValue=h.eval(a.activeif)>0;a.drawIfValue=h.eval(a.drawif)>0;a.checkbox.disabled=!a.activeIfValue;a.containerControl.style.display=a.drawIfValue?"block":"none";if(!a.parent.animation.playing||document.activeElement!=a.checkbox){var d=h.getVariable(a.id)!==0?1:0;if(a.radio_group==="")a.pressed?(a.value=a.checkbox.checked?1:0,a.pressed=!1):(a.value=d,a.checkbox.checked=
a.value!==0),h.setVariable(a.id,a.value);else{a.value=h.getVariable(a.id);h.setVariable(a.radio_group,0);d=document.querySelectorAll(`[name=${a.radio_group}]`);var g=-1;if(a.pressed){for(g=d.length-1;g>=0;g--)h.setVariable(d[g].internalID,0),d[g].checked=!1;h.setVariable(a.id,1);a.checkbox.checked=!0;a.value=1;h.setVariable(a.radio_group,a.id);a.pressed=0}else{for(let e=d.length-1;e>=0;e--)g=h.getVariable(d[e].internalID)!=0?e:g,h.setVariable(d[e].internalID,0),d[e].checked=!1;g>=0&&(h.setVariable(d[g].internalID,
1),d[g].checked=!0,h.setVariable(a.radio_group,d[g].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);(f=a.label_color.getColor())&&/CanvasGradient|CanvasPattern/.test(f.constructor.name)&&(a.label_ctx.fillStyle=f,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)}addEvents(){let d=this;d.label.ontouchstart=d.label.onmousedown=d.dummyLabel.onmousedown=b.preventDefault;d.checkbox.addEventListener("click",()=>{d.pressed=!0;d.updateAndExecAction()})}}
b.Checkbox=l})(descartesJS);
(b=>{let a,h,f,l,d,g,e,q,n;class t extends b.Control{constructor(c,v){super(c,v);a=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()}'`);a.valueExprString===void 0&&(a.valueExprString=a.onlyText?"0":"");a.emptyString=
!1;a.ok=0;a.tabindex=++c.tabindex;if(a.evaluate)if(a.answer){if(n=a.answer.match(/^krypto_(.*)$/))a.answer=(new b.Krypto).decode(n[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(m){m=m.toString();return m=="''"||m=="'"?"":m&&/^'.*'$/.test(m)?m.slice(1,-1):m},a.formatValue=function(m){return m.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()}init(c){a=this;h=a.evaluator;a.label.innerHTML=h.eval(a.name).toString();var v=a.label.textContent;c||(a.value=a.validateValue(h.eval(a.valueExpr)));c=a.formatValue(a.value);a.fieldFontSize=h.eval(a.font_size)>0?h.eval(a.font_size):b.getFieldFontSize(a.h);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);var m=b.getTextWidth(c+"_",a.fieldFontSize+"px "+b.sansserif_font);let k=parseInt(a.w/2),r=a.text_object.textNodes.metrics.w+parseInt(a.fieldFontSize);a.visible||(k=a.w,m=0);k<r&&(k=r);v==""&&(k=0);a.w-k<m&&(k=a.w-m);k<0&&(k=0);v=a.w-k;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:${v}px;height:${a.h}px;left:${k}px; font-family:${a.font_family=="Serif"?b.serif_font:a.font_family=="Monospaced"?b.monospace_font:b.sansserif_font};`);a.field.value=c;a.cover.setAttribute("style",`;width:${v}px;height:${a.h}px;left:${k}px;`);a.label.setAttribute("style",`font-size:${a.fieldFontSize}px;width:${k}px;height:${a.h}px;line-height:${a.h}px;background-color:${a.label_color.getColor()};color:${a.label_text_color.getColor()};`);
a.label.width=k*a.ratio;a.label.height=a.h*a.ratio;a.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()}update(){a=this;h=a.evaluator;a.activeIfValue=h.eval(a.activeif)>0;a.drawIfValue=h.eval(a.drawif)>0;a.field.disabled=!a.activeIfValue;a.containerControl.style.display=a.drawIfValue?"block":"none";a.parent.animation.playing&&document.activeElement==a.field||(f=a.field.value,l=a.value,a.value=a.validateValue(h.getVariable(a.id)),
a.field.value=a.formatValue(a.value),a.value===l&&a.field.value!=f&&(a.value=a.validateValue(f),a.field.value=a.formatValue(a.value)),h.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);(q=a.label_color.getColor())&&/CanvasGradient|CanvasPattern/.test(q.constructor.name)&&(a.label_ctx.fillStyle=q,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)}validateValue(c){if(c===""||c=="''")return"";h=this.evaluator;c=c.toString().replace(this.parent.decimal_symbol_regexp,
".");d=c==parseFloat(c)?parseFloat(c):parseFloat(h.eval(h.parser.parse(c)));isNaN(d)&&(d=0);g=h.eval(this.min);e=h.eval(this.max);g===""&&(g=-Infinity);e===""&&(e=Infinity);d<g&&(d=g);d>e&&(d=e);this.discrete&&(c=h.eval(this.incr),d=c===0?0:c*Math.round(d/c));return d=parseFloat(parseFloat(d).toFixed(h.eval(this.decimals)))}formatValue(c){return c===""?c:super.formatValue(c)}changeValue(c){this.activeIfValue&&(this.value=this.validateValue(c),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())}evalAnswer(){return b.esCorrecto(this.answer,this.value,this.evaluator)}deactivate(){this.evaluator.setVariable(this.activoStr,0);this.evaluator.setVariable(this.activeStr,0)}addEvents(){let c=this;c.label.addEventListener("touchstart",b.preventDefault);c.label.addEventListener("mousedown",b.preventDefault);c.field.addEventListener("mousedown",function(v){c.parent.deactivateControls();
c.evaluator.setVariable(c.activoStr,1);c.evaluator.setVariable(c.activeStr,1);c.parent.update()});c.field.addEventListener("blur",function(v){c.drawIfValue&&c.changeValue(c.field.value,!0)});c.field.addEventListener("keydown",function(v){c.activeIfValue&&v.keyCode==13&&c.changeValue(c.field.value,!0)});c.field.addEventListener("click",function(v){this.focus()});c.cover.addEventListener("click",function(v){c.parent.deactivateControls();c.evaluator.setVariable(c.activoStr,1);c.evaluator.setVariable(c.activeStr,
1);c.parent.update();v=c.evaluator.eval(c.kbexp);c.activeIfValue&&c.parent.keyboard.show(c,c.kblayout,v[0][0]||0,v[0][1]||0,c.id,c.field,c.onlyText)})}}b.TextField=t})(descartesJS);
(b=>{let a,h=Math.abs,f,l,d,g,e,q,n,t,c,v,m;class k extends b.Control{constructor(r,p){function x(z){u.options=z.split(",");u.menuOptions=[];u.strVal=[];for(let A=0,w=u.options.length;A<w;A++)z=u.customSplit(u.options[A]),z.length==1?(u.menuOptions.push(z[0]),u.strVal.push(A.toString())):z.length==2&&(u.menuOptions.push(z[0]),z[1]==""?u.strVal.push(A.toString()):u.strVal.push(z[1]));for(let A=0,w=u.menuOptions.length;A<w;A++)/^\[.*\]$/.test(u.menuOptions[A])?u.menuOptions[A]=f.parse(u.menuOptions[A].slice(1,
-1)):u.menuOptions[A]=f.parse(`'${u.menuOptions[A]}'`);for(let A=0,w=u.strVal.length;A<w;A++)/^\[.*\]$/.test(u.strVal[A])?u.strVal[A]=f.parse(u.strVal[A].slice(1,-1)):u.strVal[A]=f.parse(u.strVal[A]);u.select.innerHTML="";for(let A of u.menuOptions)z=b.newHTML("option"),z.innerHTML=l.eval(A),u.select.appendChild(z);return 0}super(r,p);let u=this;f=u.parser;l=u.evaluator;u.label_color=u.label_color||new b.Color("e0e4e8",l);u.label_text_color=u.label_text_color||new b.Color("000000",l);u.options=p.options||
"";u.ok=0;u.tabindex=++r.tabindex;u.answer&&(/^krypto_/.test(u.answer)&&(u.answer=(new b.Krypto).decode(u.answer.substring(7))),u.answer=parseInt(u.answer.split(",")[0].replace("[",""))||0);u.name_str=u.name;/^&squot;.*&squot;$/.test(u.name)&&(u.name=u.name.replace("&squot;","\\u0027"));/^\[.*\]$/.test(u.name)?u.name=u.parser.parse(u.name.slice(1,-1)):u.name=u.parser.parse(`'${u.name}'`);u.evaluator.setFunction(u.id+".setOptions",x);u.containerControl=b.newHTML("div",{class:"DescartesMenuContainer",
id:u.id});u.label=b.newHTML("canvas",{class:"DescartesMenuLabel"});u.label_ctx=u.label.getContext("2d");u.ratio=r.ratio;u.select=b.newHTML("select",{id:u.id+"_menuSelect",class:"DescartesMenuSelect",tabindex:u.tabindex});u.field=b.newHTML("input",{type:"text",id:u.id+"_menuField",class:"DescartesMenuField",tabindex:u.tabindex});x(u.options);u.containerControl.appendChild(u.label);u.containerControl.appendChild(u.select);u.visible&&u.containerControl.appendChild(u.field);u.cover=b.newHTML("div",{class:"TextfieldCover"});
u.keyboard&&u.visible&&u.containerControl.appendChild(u.cover);u.addControlContainer(u.containerControl);u.addEvents();u.init()}init(r){a=this;l=a.evaluator;a.label.innerHTML=l.eval(a.name).toString();var p=a.label.textContent;a.fieldFontSize=l.eval(a.font_size)>0?l.eval(a.font_size):b.getFieldFontSize(a.h);a.text_object=new b.TextObject({parent:{decimal_symbol:a.parent.decimal_symbol},evaluator:l,decimals:a.decimals,fixed:!1,align:"left",anchor:"center_center",width:a.parser.parse("0"),font_size:a.parser.parse(""+
a.fieldFontSize),font_family:a.font_family,italics:a.italics,bold:a.bold},a.name_str);a.text_object.draw(a.label_ctx,a.label_text_color.getColor(),0,0,!0);var x=0,u=0;a.value=r?a.value:l.eval(a.valueExpr);a.idxVal=a.getIndex(a.value);for(let w=0,y=a.menuOptions.length;w<y;w++)r=b.getTextWidth(l.eval(a.menuOptions[w]).toString(),`${a.fieldFontSize}px ${b.sansserif_font}`),r>x&&(x=r,u=w);x+=25;r=b.getTextWidth(a.formatValue(l.eval(a.strVal[u])),`${a.fieldFontSize}px ${b.sansserif_font}`)+7;u=a.text_object.textNodes.metrics.w+
parseInt(a.fieldFontSize);p==""&&(u=0);a.visible||(r=0);for(p=a.w-r-u;p<x&&u>0;)u--,p++;for(;p<x&&r>0;)r--,p++;for(;u+p+r+1<a.w;)p++,r++;x=u;let z=x+p;r=a.w-z;let A=a.formatValue(l.eval(a.strVal[a.idxVal]));a.containerControl.setAttribute("style",`width:${a.w}px;height:${a.h}px;left:${a.x}px;top:${a.y}px;z-index:${a.zIndex};`);a.label.setAttribute("style",`font-size:${a.fieldFontSize}px;width:${u}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=u*a.ratio;a.label.height=a.h*a.ratio;a.field.value=A;a.field.setAttribute("style",`font-size:${a.fieldFontSize}px;width:${r}px;height:${a.h}px;left:${z}px;`);a.cover.setAttribute("style",`width:${r}px;height:${a.h}px;left:${z}px;`);a.select.setAttribute("style",`text-align:left;font-size:${a.fieldFontSize}px;width:${p}px;height:${a.h}px;left:${x}px;`);a.select.selectedIndex=a.idxVal;l.setVariable(a.id,parseFloat(A.replace(a.parent.decimal_symbol,".")));a.update()}update(){a=this;l=a.evaluator;
a.activeIfValue=l.eval(a.activeif)>0;a.drawIfValue=l.eval(a.drawif)>0;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(let r=0,p=a.menuOptions.length;r<p;r++)a.select.options[r].innerHTML=(l.eval(a.menuOptions[r])||"").replace(/\\u002C/g,",");a.value=l.getVariable(a.id);isNaN(a.value)&&(a.value=
0);a.field.value=a.formatValue(a.value);l.setVariable(a.id,parseFloat(a.value));a.select.selectedIndex=parseFloat(a.getIndex(a.value))}a.ok=a.value==a.answer?1:0;a.evaluator.setVariable(a.id+".ok",a.ok);a.updatePositionAndSize();a.label_ctx.setTransform(a.ratio,0,0,a.ratio,0,0);a.text_object.draw(a.label_ctx,a.label_text_color.getColor(),0,0);a.label_ctx.clearRect(0,0,a.label.width,a.label.height);(m=a.label_color.getColor())&&/CanvasGradient|CanvasPattern/.test(m.constructor.name)&&(a.label_ctx.fillStyle=
m,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)}customSplit(r){q=!1;n="";t=0;for(c=-1;t<r.length;){v=
r.charAt(t);if(v==="["&&c===-1){if(q||n!="")n+="\u00a6";c++}else v==="["?c++:v==="]"&&c===0?(q=!0,c--):r.charAt(t)=="]"&&(c=c<0?c:c-1);n+=r.charAt(t);t++}return n.split("\u00a6")}getIndex(r){r=parseFloat(r.toString().replace(this.parent.decimal_symbol,"."));d=-1;g=Infinity;for(let p=0,x=this.strVal.length;p<x;p++)e=h(r-parseFloat(this.evaluator.eval(this.strVal[p]))),e<=g&&(g=e,d=p);this.select.options[this.select.selectedIndex]&&this.evaluator.setVariable(this.id+".txt",this.select.options[this.select.selectedIndex].text);
return d}changeValue(r,p){a=this;a.activeIfValue&&(p&&(a.idxVal=a.getIndex(r),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())}addEvents(){let r=this;r.label.addEventListener("touchstart",b.preventDefault);r.label.addEventListener("mousedown",b.preventDefault);r.select.addEventListener("change",function(p){r.value=r.evaluator.eval(r.strVal[this.selectedIndex]);r.field.value=
r.formatValue(r.value);r.evaluator.setVariable(r.id,r.field.value);r.changeValue();p.preventDefault()});r.field.addEventListener("keydown",function(p){p.keyCode==13&&(r.idxVal=r.getIndex(r.field.value),r.value=r.evaluator.eval(r.strVal[r.idxVal]),r.field.value=r.formatValue(r.idxVal),r.select.selectedIndex=r.idxVal,r.changeValue())});r.field.addEventListener("blur",function(p){r.drawIfValue&&r.changeValue(r.field.value,!0)});r.field.addEventListener("click",function(p){r.field.focus()});r.cover.addEventListener("click",
function(p){p=r.evaluator.eval(r.kbexp);r.activeIfValue&&r.parent.keyboard.show(r,r.kblayout,p[0][0]||0,p[0][1]||0,r.id,r.field,r.onlyText)})}}b.Menu=k})(descartesJS);
(b=>{let a,h=Math.floor,f,l,d,g,e,q,n,t,c,v,m,k,r,p,x,u,z;class A extends b.Control{constructor(w,y){super(w,y);a=this;a.label_color=a.label_color||new b.Color("e0e4e8",w.evaluator);a.label_text_color=a.label_text_color||new b.Color("000000",w.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=w.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()}init(){a=this;f=a.evaluator;f.eval(a.decimals)==0?a.incr=1:a.incr=(f.eval(a.max)-f.eval(a.min))/100;a.value=a.validateValue(f.eval(a.valueExpr));l=a.formatValue(a.value);d=a.evaluator.eval(a.expresion)[0];
a.x=d[0];a.y=d[1];d.length==4&&(a.w=d[2],a.h=d[3]);a.orientation=a.w>=a.h?"h":"v";a.initScroll(l);a.changeScrollPosition();a.prePos=a.pos;f.setVariable(a.id,a.value)}initScroll(w){a=this;f=a.evaluator;a.label.innerHTML=f.eval(a.name).toString();u=a.label.textContent;var y=a.orientation==="v"?parseInt(19+5*(a.h-100)/100):a.h;a.fieldFontSize=f.eval(a.font_size)>0?f.eval(a.font_size):a.orientation==="v"?y-parseInt(a.h/20)-1:b.getFieldFontSize(y);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);w=b.getTextWidth(w+"_",a.fieldFontSize+"px "+b.sansserif_font);var D=a.parent.getSpaceById(a.spaceID).h;a.labelHeight=u==""?0:y;a.fieldHeight=a.visible==""?0:y;if(a.orientation==="v")a.canvasWidth=a.w,a.canvasHeight=
a.h-a.labelHeight-a.fieldHeight,a.canvasHeight+a.y-D>=18&&(a.canvasHeight=D),y=a.fieldHeight,w=y+a.canvasHeight,a.canvasX=0,a.canvasY=a.fieldHeight,a.labelWidth=a.w,a.labelY=w,a.upWidth=a.downW=a.w,a.upHeight=a.downH=a.w,a.upX=0,a.upY=a.fieldHeight,a.downX=0,a.downY=w-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>a.w*2?a.w:a.handlerH,
a.handlerH=a.handlerH<15?15:a.handlerH,a.limInf=w-a.downH-a.handlerH,a.limSup=y+a.downH;else{y=a.text_object.textNodes.metrics.w+parseInt(a.fieldFontSize);a.labelWidth=y;a.fieldWidth=w;u==""&&(a.labelWidth=0);a.visible||(a.fieldWidth=0);for(y=a.w-a.fieldWidth-a.labelWidth;y<58&&a.labelWidth>0;)a.labelWidth--,y++;for(;y<58&&a.fieldWidth>0;)a.fieldWidth--,y++;w=a.labelWidth;D=w+y;a.fieldWidth=a.w-D;a.canvasWidth=y;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=D-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>a.h*2?a.h:a.handlerW;a.handlerW=a.handlerW<15?15:a.handlerW;a.handlerH=a.h;a.limInf=w+a.downW;a.limSup=w+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:${a.orientation==="v"?0:
a.limInf}px;top:${a.orientation==="v"?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;`);a.fieldHeight===0&&(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}update(){a=this;f=a.evaluator;f.eval(a.decimals)==0?a.incr=1:a.incr=(f.eval(a.max)-f.eval(a.min))/100;a.activeIfValue=f.eval(a.activeif)>0;a.drawIfValue=f.eval(a.drawif)>0;a.field.disabled=!a.activeIfValue;a.drawIfValue?(a.container.style.display="block",a.draw()):a.container.style.display="none";a.updatePositionAndSize();let w=a.validateValue(f.getVariable(a.id));w==a.value||Math.abs(w-a.value)>0&&Math.abs(w-a.value)<1E-9||(a.value=
w,a.changeScrollPosition(),a.prePos=a.pos);a.value=w;a.field.value=a.formatValue(a.value);f.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);(z=a.label_color.getColor())&&/CanvasGradient|CanvasPattern/.test(z.constructor.name)&&(a.label_ctx.fillStyle=z,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)}draw(){a=this;g=a.ctx;q=h(a.w);e=h(a.h);g.fillStyle=a.color.getColor();g.fillRect(0,0,q,e);g.fillStyle="black";g.beginPath();a.orientation==="h"?(g.lineWidth=1,g.strokeStyle=
"rgba(0,0,0,0.3)",g.strokeRect(parseInt(a.labelWidth)+.5,.5,q-1-parseInt(a.labelWidth),e-1),g.lineWidth=Math.ceil(12*a.upWidth/100)||1,g.strokeStyle=a.colorInt.getColor(),g.moveTo(a.downX+62.215*a.upWidth/100,20*a.downH/100),g.lineTo(a.downX+32.449*a.upWidth/100,a.downH/2),g.lineTo(a.downX+62.215*a.upWidth/100,80*a.downH/100),g.moveTo(a.upX+32.449*a.upWidth/100,20*a.downH/100),g.lineTo(a.upX+62.215*a.upWidth/100,a.downH/2),g.lineTo(a.upX+32.449*a.upWidth/100,80*a.downH/100),g.stroke(),t=h(a.pos),
n=Math.ceil(e/10)||1,g.fillStyle=a.colorInt.getColor(),g.fillRect(t+.5,n,h(a.handlerW),e-n*2)):(g.lineWidth=1,g.strokeStyle="rgba(0,0,0,0.3)",g.strokeRect(.5,.5,q-1,e-parseInt(a.labelHeight)-.5),g.lineWidth=Math.ceil(12*a.upWidth/100)||1,g.strokeStyle=a.colorInt.getColor(),g.moveTo(20*a.upWidth/100,a.h-a.labelHeight-70*a.downH/100),g.lineTo(50*a.upWidth/100,a.h-a.labelHeight-40.237*a.downH/100),g.lineTo(80*a.upWidth/100,a.h-a.labelHeight-70*a.downH/100),g.moveTo(20*a.upWidth/100,a.upY+70*a.downH/
100),g.lineTo(50*a.upWidth/100,a.upY+40.237*a.downH/100),g.lineTo(80*a.upWidth/100,a.upY+70*a.downH/100),g.stroke(),t=h(a.pos),n=Math.ceil(q/10)||1,g.fillStyle=a.colorInt.getColor(),g.fillRect(n,t+.5,q-n*2,h(a.handlerH)));a.activeIfValue||(g.fillStyle="rgba(255,255,255,0.5)",g.fillRect(0,0,g.canvas.width,g.canvas.height))}validateValue(w){a=this;f=a.evaluator;c=w.toString();c=parseFloat(c.replace(a.parent.decimal_symbol,"."));isNaN(c)&&(c=0);a.minimo=f.eval(a.min);c<a.minimo&&(a.value=null,c=a.minimo);
a.maximo=f.eval(a.max);c>a.maximo&&(a.value=null,c=a.maximo);v=a.incr;c=v!=0?c*v/v:0;a.fixed&&(c=parseFloat(parseFloat(c).toFixed(f.eval(a.decimals))));return c}increase(){this.changeValue(parseFloat(this.value)+this.incr)}decrease(){this.changeValue(parseFloat(this.value)-this.incr)}increase10(){a=this;n=(a.evaluator.eval(a.max)-a.evaluator.eval(a.min))/10;a.orientation=="h"?a.clickPos.x>a.prePos&&a.changeValue(parseFloat(a.value)+n):a.clickPos.y<a.prePos&&a.changeValue(parseFloat(a.value)+n)}decrease10(){a=
this;n=(a.evaluator.eval(a.max)-a.evaluator.eval(a.min))/10;a.orientation=="h"?a.clickPos.x<a.prePos&&a.changeValue(parseFloat(a.value)-n):a.clickPos.y>a.prePos&&a.changeValue(parseFloat(a.value)-n)}changeValue(w){a=this;a.activeIfValue&&(m=a.validateValue(w),m!=a.value&&(a.value=m,a.field.value=a.formatValue(m),a.changeScrollPosition(),a.prePos=a.pos,a.evaluator.setVariable(a.id,a.value)),a.updateAndExecAction())}changeValueMovement(){f=this.evaluator;k=this.limInf;r=this.limSup;p=f.eval(this.min);
x=f.eval(this.max);v=this.incr;m=h((this.pos-k)*(x-p)/(r-k)/v)*v+p;m!=this.value&&(this.value=m,this.field.value=this.formatValue(m),f.setVariable(this.id,this.value),this.parent.updateControls(),this.actionExec.execute(),this.parent.update())}changeScrollPosition(){a=this;f=a.evaluator;k=a.limInf;r=a.limSup;p=f.eval(a.min);x=f.eval(a.max);v=a.incr;a.pos=(a.value-p)*(r-k)/(x-p)+k;a.handler.style[a.orientation=="h"?"left":"top"]=a.pos+"px"}addEvents(){function w(S,H,M,K){b.clearTimeout(O);(G.up||G.down||
G.canvasClick)&&Math.abs(G.value-K)>1E-7&&(H.call(G),S=M?S:30,O=b.setTimeout(function(){w(S,H,!1,K)},S))}function y(S){S.preventDefault();G.whichBtn=b.whichBtn(S);G.whichBtn=="L"&&G.activeIfValue&&(G.clickPos=b.getCursorPosition(S,G.container),G.canvasClick=!0,G.orientation=="h"?G.clickPos.x<G.prePos?w(350,G.decrease10,!0,G.minimo):w(350,G.increase10,!0,G.maximo):G.clickPos.y<G.prePos?w(350,G.increase10,!0,G.maximo):w(350,G.decrease10,!0,G.minimo))}function D(S){G.canvasClick=!1;b.clearTimeout(O)}
function F(S){G.canvasClick==1&&(G.clickPos=b.getCursorPosition(S,G.container),S.preventDefault())}function B(S){G.scrollClick=!1;G.prePos=G.pos;window.removeEventListener("mouseup",B,!1);window.removeEventListener("mousemove",E,!1);S.preventDefault()}function I(S){G.scrollClick=!1;G.prePos=G.pos;window.removeEventListener("touchend",I,!1);window.removeEventListener("touchmove",E,!1);S.preventDefault()}function E(S){let H=b.getCursorPosition(S,G.container);G.orientation=="h"?(G.pos=G.prePos-(G.initPos.x-
H.x),G.pos<G.limInf&&(G.pos=G.limInf),G.pos>G.limSup&&(G.pos=G.limSup),G.handler.setAttribute("style",`width:${G.handlerW}px;height:${G.h}px;left:${G.pos}px;top:0;`)):(G.pos=G.prePos-(G.initPos.y-H.y),G.pos>G.limInf&&(G.pos=G.limInf),G.pos<G.limSup&&(G.pos=G.limSup),G.handler.setAttribute("style",`width:${G.w}px;height:${G.handlerH}px;left:0;top:${G.pos}px;`));G.changeValueMovement();S.preventDefault()}function P(S){S.preventDefault();G.whichBtn=b.whichBtn(S);G.whichBtn=="L"&&G.activeIfValue&&(G.up=
!0,w(350,G.increase,!0,G.maximo))}function N(S){S.preventDefault();G.whichBtn=b.whichBtn(S);G.whichBtn=="L"&&G.activeIfValue&&(G.down=!0,w(350,G.decrease,!0,G.minimo))}function U(S){G.down=!1;b.clearTimeout(O);S.preventDefault()}function X(S){G.up=!1;b.clearTimeout(O);G.draw()}function L(S){G.down=!1;b.clearTimeout(O);G.draw()}let G=this,O;G.field.addEventListener("keydown",function(S){S.keyCode==13&&G.changeValue(G.field.value)});G.field.addEventListener("blur",function(S){G.drawIfValue&&G.changeValue(G.field.value,
!0)});G.canvas.addEventListener("touchstart",y);G.canvas.addEventListener("mousedown",y);G.divDown.addEventListener("mouseout",U);window.addEventListener("touchend",D);window.addEventListener("mouseup",D);G.canvas.addEventListener("touchmove",F);G.canvas.addEventListener("mousemove",F);G.handler.addEventListener("touchstart",function(S){G.activeIfValue&&(G.scrollClick=!0,G.initPos=b.getCursorPosition(S,G.container),window.addEventListener("touchend",I),window.addEventListener("touchmove",E),S.preventDefault())});
G.handler.addEventListener("mousedown",function(S){G.activeIfValue&&(G.scrollClick=!0,G.initPos=b.getCursorPosition(S,G.container),window.addEventListener("mouseup",B),window.addEventListener("mousemove",E),S.preventDefault())});G.divUp.addEventListener("touchstart",P);G.divUp.addEventListener("mousedown",P);G.divDown.addEventListener("touchstart",N);G.divDown.addEventListener("mousedown",N);G.divUp.addEventListener("mouseout",function(S){G.up=!1;b.clearTimeout(O);S.preventDefault()});G.divDown.addEventListener("mouseout",
U);window.addEventListener("touchend",X);window.addEventListener("mouseup",X);window.addEventListener("touchend",L);window.addEventListener("mouseup",L);G.cover.addEventListener("click",function(S){S=G.evaluator.eval(G.kbexp);G.activeIfValue&&G.parent.keyboard.show(G,G.kblayout,S[0][0]||0,S[0][1]||0,G.id,G.field,G.onlyText)})}}b.Scrollbar=A})(descartesJS);
(b=>{let a,h=Math.floor,f,l,d,g,e,q,n,t,c,v;class m extends b.Control{constructor(k,r){super(k,r);a=this;a.label_color=a.label_color||new b.Color("e0e4e8",k.evaluator);a.label_text_color=a.label_text_color||new b.Color("000000",k.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=k.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()}init(){a=this;f=a.evaluator;a.value=a.validateValue(f.eval(a.valueExpr));l=a.formatValue(a.value);d=a.evaluator.eval(a.expresion)[0];a.x=d[0];a.y=d[1];d.length==4&&(a.w=d[2],a.h=d[3]);a.orientation=a.w>=a.h?"h":"v";a.initSlider(l);a.changeSliderPosition();a.prePos=a.pos;f.setVariable(a.id,a.value)}initSlider(k){a=this;f=a.evaluator;a.label.innerHTML=f.eval(a.name).toString();c=a.label.textContent;
var r=a.orientation==="v"?parseInt(19+5*(a.h-100)/100):a.h;a.fieldFontSize=f.eval(a.font_size)>0?f.eval(a.font_size):a.orientation==="v"?r-parseInt(a.h/20)-1:b.getFieldFontSize(r);a.text_object=new b.TextObject({parent:{decimal_symbol:a.parent.decimal_symbol},evaluator:f,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);k=b.getTextWidth(k+"_",`${a.fieldFontSize}px ${b.sansserif_font}`);let p=a.parent.getSpaceById(a.spaceID).h;a.labelHeight=c==""?0:r;a.fieldHeight=a.visible==""?0:r;if(a.orientation==="v")a.canvasWidth=a.w,a.canvasHeight=a.h-a.labelHeight-a.fieldHeight,a.canvasHeight+a.y-p>=18&&(a.canvasHeight=p),r=a.fieldHeight+a.canvasHeight,a.canvasX=0,a.canvasY=a.fieldHeight,a.labelWidth=a.w,a.labelY=r,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{r=a.text_object.textNodes.metrics.w+parseInt(a.fieldFontSize);a.labelWidth=r;a.fieldWidth=k;c==""&&(a.labelWidth=0);a.visible||(a.fieldWidth=0);for(r=a.w-a.fieldWidth-a.labelWidth;r<58&&a.labelWidth>0;)a.labelWidth--,
r++;for(;r<58&&a.fieldWidth>0;)a.fieldWidth--,r++;a.fieldWidth=a.w-(a.labelWidth+r);a.canvasWidth=r;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;`);a.fieldHeight===0&&(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}update(){f=this.evaluator;this.activeIfValue=f.eval(this.activeif)>0;this.drawIfValue=f.eval(this.drawif)>0;this.activeIfValue?(this.field.disabled=this.sliderCtr.disabled=!1,this.sliderCtr.style.filter=""):(this.field.disabled=this.sliderCtr.disabled=!0,this.sliderCtr.style.filter="grayscale(60%)");this.drawIfValue?(this.container.style.display="block",this.draw()):this.container.style.display="none";this.updatePositionAndSize();
let k=this.validateValue(f.getVariable(this.id));k==this.value||Math.abs(k-this.value)>0&&Math.abs(k-this.value)<1E-9||(this.value=k,this.changeSliderPosition(),this.prePos=this.pos);this.value=k;this.field.value=this.formatValue(this.value);f.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);(v=this.label_color.getColor())&&
/CanvasGradient|CanvasPattern/.test(v.constructor.name)&&(this.label_ctx.fillStyle=v,this.label_ctx.fillRect(0,0,this.label_ctx.canvas.width,this.label_ctx.canvas.height));this.text_object.textNodes.metrics.w>this.label.width/this.ratio?(this.text_object.anchor="center_left",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),5,this.label.height/this.ratio/2)):(this.text_object.anchor="center_center",this.text_object.draw(this.label_ctx,this.label_text_color.getColor(),this.label.width/
this.ratio/2,this.label.height/this.ratio/2));this.label_ctx.setTransform(1,0,0,1,0,0)}draw(){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}validateValue(k){a=this;f=a.evaluator;g=k.toString();g=parseFloat(g.replace(a.parent.decimal_symbol,"."));isNaN(g)&&(g=0);a.minimo=f.eval(a.min);g<a.minimo&&(a.value=null,g=a.minimo);a.maximo=f.eval(a.max);g>a.maximo&&(a.value=null,g=a.maximo);
e=f.eval(a.incr);g=e!=0?g*e/e:0;a.fixed&&(g=parseFloat(parseFloat(g).toFixed(f.eval(a.decimals))));return g}changeValue(k){a=this;a.activeIfValue&&(q=a.validateValue(k),q!=a.value&&(a.value=q,a.field.value=a.formatValue(q),a.changeSliderPosition(),a.prePos=a.pos,a.evaluator.setVariable(a.id,a.value)),a.updateAndExecAction())}changeValueForSliderMovement(){f=this.evaluator;n=f.eval(this.min);t=f.eval(this.max);e=f.eval(this.incr);q=h(this.pos*(t-n)/100/e)*e+n;q!=this.value&&(this.value=q,this.field.value=
this.formatValue(q),f.setVariable(this.id,this.value),this.parent.updateControls(),this.actionExec.execute(),this.parent.update())}changeSliderPosition(){f=this.evaluator;n=f.eval(this.min);t=f.eval(this.max);e=f.eval(this.incr);this.pos=(this.value-n)*100/(t-n)}addEvents(){let k=this;k.field.addEventListener("keydown",function(r){r.keyCode==13&&k.changeValue(k.field.value)});k.field.addEventListener("blur",function(r){k.drawIfValue&&k.changeValue(k.field.value,!0)});k.cover.addEventListener("click",
function(r){r=k.evaluator.eval(k.kbexp);k.activeIfValue&&k.parent.keyboard.show(k,k.kblayout,r[0][0]||0,r[0][1]||0,k.id,k.field,k.onlyText)});k.sliderCtr.addEventListener("input",function(r){k.pos=r.target.value;k.changeValueForSliderMovement()})}}b.Slider=m})(descartesJS);
(b=>{let a,h,f;class l extends b.Control{constructor(d,g){super(d,g);let e=this;e.controls=g.controls||!0;e.file=g.file||"";e.oldDrawIf=0;d=e.evaluator.eval(e.expresion);g=d[0].length==4;e.w=g?d[0][2]:200;e.h=g?d[0][3]:28;e.audio=e.parent.getAudio(e.file);e.oldFile=e.file;/^\[.*\]$/.test(e.file)&&(e.file=e.evaluator.parser.parse(e.file.slice(1,-1)));e.autoplay&&(e.audio.setAttribute("autoplay","autoplay"),e.audio.play());e.loop&&e.audio.setAttribute("loop","loop");e.controls&&e.audio.setAttribute("controls",
"controls");e.audio.setAttribute("style",`position:absolute;width:${e.w}px;left:${e.x}px;top:${e.y}px;z-index:${e.zIndex};`);e.addControlContainer(e.audio);e.evaluator.setFunction(e.id+".play",function(){try{e.audio.play()}catch(q){}return 0});e.evaluator.setFunction(e.id+".pause",function(){try{e.audio.pause()}catch(q){}return 0});e.evaluator.setFunction(e.id+".stop",function(){try{e.audio.pause(),e.audio.currentTime=0}catch(q){}return 0});e.evaluator.setFunction(e.id+".currentTime",function(q){try{e.audio.currentTime=
parseFloat(q)}catch(n){}return 0});e.audio.addEventListener("timeupdate",function(){e.evaluator.setVariable(e.id+".currentTime",e.audio.currentTime);e.evaluator.setVariable(e.id+".playing",e.audio.paused?0:1);e.evaluator.setVariable(e.id+".duration",e.audio.duration)})}init(){this.audio.style.left=`${this.x}px`;this.audio.style.top=`${this.y}px`;this.update()}update(){a=this.evaluator;typeof this.file!=="string"&&(h=a.eval(this.file),this.old!==h&&(this.audio.src=this.old=h));f=a.eval(this.drawif)>
0;this.audio.style.display=f?"block":"none";f||f===this.oldDIF||this.audio.pause();this.oldDIF=f;this.updatePositionAndSize()}}b.Audio=l})(descartesJS);
(b=>{let a,h,f;class l extends b.Control{constructor(d,g){super(d,g);a=this;a.controls=g.controls||!0;a.file=g.file||"";a.oldDrawIf=0;h=a.evaluator;d=h.eval(a.expresion)[0];d.length==4?(a.w=d[2],a.h=d[3]):(a.w=null,a.h=null);d=a.file;g=d.lastIndexOf(".");g!=-1&&(d=a.file.substring(0,g));a.video=b.newHTML("video",{poster:d+".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:d+".mp4",type:"video/mp4"}),a.video.appendChild(g));a.video.canPlayType("video/ogg")&&(g=b.newHTML("source",{src:d+".ogg",type:"video/ogg"}),a.video.appendChild(g),g=b.newHTML("source",{src:d+".ogv",type:"video/ogg"}),a.video.appendChild(g));a.video.canPlayType("video/webm")&&
(g=b.newHTML("source",{src:d+".webm",type:"video/webm"}),a.video.appendChild(g));a.addControlContainer(a.video);h.setFunction(a.id+".play",function(){try{a.video.play()}catch(e){}return 0});h.setFunction(a.id+".pause",function(){try{a.video.pause()}catch(e){}return 0});h.setFunction(a.id+".stop",function(){try{a.video.pause(),a.video.currentTime=0}catch(e){}return 0});h.setFunction(a.id+".currentTime",function(e){try{a.video.currentTime=parseFloat(e)}catch(q){}return 0});a.video.addEventListener("timeupdate",
function(e){h.setVariable(a.id+".currentTime",a.video.currentTime)})}init(){this.video.style.left=this.x+"px";this.video.style.top=this.y+"px";this.update()}update(){a=this;h=a.evaluator;(f=h.eval(a.drawif)>0)?a.video.style.display="block":(a.video.style.display="none",f!==a.oldDrawIf&&a.video.pause());a.oldDrawIf=f;a.updatePositionAndSize()}}b.Video=l})(descartesJS);
(b=>{let a,h,f,l;class d extends b.Control{constructor(g,e){super(g,e);let q=this;q.font_family=e.font_family||"sansserif";q.style=e.style||",PLAIN,";q.font_size=e.font_size||12;typeof(q.font_size!=="number")&&(q.font_size=q.evaluator.eval(q.font_size));q.font=q.font_family+q.style+q.font_size;q.evaluator.setVariable(q.id+"._scroll_x",0);q.evaluator.setVariable(q.id+"._scroll_y",0);q.region="interior";q.tabindex=++g.tabindex;q.answer&&(/^krypto_/.test(q.answer)&&(q.answer=(new b.Krypto).decode(q.answer.substring(7))),
q.parent.lessonParser.parseText(q.answer));q.containerControl=b.newHTML("div",{class:"DescartesTextAreaContainer",id:q.id,spellcheck:"false"});q.textArea=b.newHTML("textarea",{class:"DescartesTextArea",spellcheck:"false"});q.textAreaAnswer=b.newHTML("div",{class:"DescartesTextArea"});q.showButton=b.newHTML("div",{class:"DJS_Gradient"});q.containerControl.appendChild(q.textArea);q.containerControl.appendChild(q.textAreaAnswer);q.containerControl.appendChild(q.showButton);q.cover=b.newHTML("div",{class:"TextfieldCover"});
q.keyboard&&q.containerControl.appendChild(q.cover);q.addControlContainer(q.containerControl);q.showAnswer=!1;q.text=q.rawText||"";q.evaluator.setVariable(q.id,q.text);let n;q.evaluator.setFunction(q.id+".insertAtCursor",function(t){n=q.textArea.selectionStart+t.length;q.textArea.value=q.textArea.value.substring(0,q.textArea.selectionStart)+t+q.textArea.value.substring(q.textArea.selectionEnd);q.textArea.selectionStart=q.textArea.selectionEnd=n;q.textArea.focus();return 0});q.evaluator.setFunction(q.id+
".update",()=>{q.update()});q.evaluator.setFunction(q.id+".scrollTo",t=>{q.textArea.scrollTop=t});q.addEvents();q.init()}init(){a=this;f=a.answer?30:7;h=a.evaluator;let g=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};`);let e=`width:${a.w-6}px;height:${a.h-f}px;font:${b.convertFont(a.font)};line-height:${a.font_size}px;`;a.textArea.setAttribute("style",e);a.textArea.value=g;a.textAreaAnswer.setAttribute("style",
`${e}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()}update(){a=this;h=a.evaluator;a.activeIfValue=h.eval(a.activeif)>0;a.drawIfValue=h.eval(a.drawif)>0;h.getVariable(a.id)!==a.oldValue&&(a.textArea.value=(h.getVariable(a.id)||"").replace(/\\n/g,"\n"));l=a.textArea.value||"";l=l.charAt(l.length-1)==="\n"?l.substring(0,l.length-1):l;l=l.replace(/\n/g,"\\n").replace(/\s/g," ");h.setVariable(a.id,l);a.oldFieldValue=l;a.oldValue=h.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"]=h.getVariable(a.id+"._scroll_x")>0?"auto":"unset";a.textArea.style["overflow-y"]=h.getVariable(a.id+"._scroll_y")>0?"auto":"unset";a.updatePositionAndSize()}changeValue(g){this.textArea.value=g;this.update()}addEvents(){let g=this;g.showButton.addEventListener("mousedown",function(e){e.preventDefault();g.showAnswer=!g.showAnswer;g.textAreaAnswer.style.display=g.showAnswer?"block":"none";g.showButton.childNodes[0].childNodes[0].textContent=
g.showAnswer?"T":"S";g.textArea.blur()});g.showButton.onmouseup=g.showButton.onmouseout=e=>{e.preventDefault()};g.textArea.addEventListener("blur",function(){g.cursorInd=window.getSelection().focusOffset});g.textArea.addEventListener("paste",e=>{e.preventDefault();document.execCommand("insertHTML",!1,e.clipboardData.getData("text/plain").replace(/\n/g,"<br>"))});g.textArea.addEventListener("keydown",function(e){if(e.key==="PageDown"||e.key==="PageUp")e.stopPropagation(),e.preventDefault()});g.cover.addEventListener("pointerdown",
function(e){e=g.evaluator.eval(g.kbexp);g.activeIfValue&&g.parent.keyboard.show(g,g.kblayout,e[0][0]||0,e[0][1]||0,g.id,g.textArea,!0)})}}b.TextArea=d})(descartesJS);
(b=>{let a;const h=Math.PI*2;let f,l,d,g,e,q,n,t,c,v,m,k;class r extends b.Control{constructor(p,x){super(p,x);l=p.evaluator.parser;a=this;a.spaceID=x.spaceID||"";a.text=x.text||"";a.size=x.size||l.parse("4");a.font=x.font||"Serif,PLAIN,12";a.image=new Image;a.image.onload=function(){this.ready=1};a.imageSrc=x.imageSrc||"";/^\[.*\]$/.test(a.imageSrc)?a.imageSrc=a.parser.parse(a.imageSrc.slice(1,-1)):a.imageSrc=a.parser.parse(`'${a.imageSrc}'`);a.font=b.convertFont(a.font);if(a.constraintExpr){a.constraint=
l.parse(a.constraintExpr);a.constraint.type=="(expr)"&&(a.constraint=l.parse(a.constraintExpr.substring(1,a.constraintExpr.length-1)));if(a.constraint.type=="compOperator"){x=a.constraint.childs[0];let u=a.constraint.childs[1];x.type!="identifier"||x.value!="y"||u.contains("y")?x.type!="identifier"||x.value!="x"||u.contains("x")?a.newt=new b.R2Newton(a.evaluator,a.constraint):(a.constVar="y",a.noConstVar="x",a.evalConst=a.evalConstXoY,a.constraint=u):(a.constVar="x",a.noConstVar="y",a.evalConst=a.evalConstXoY,
a.constraint=u)}else a.constraint=null;v=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";p=a.space.id!==""&&p.version!==2?a.space.id+".":"";a.mX=p+"mouse_x";a.mY=p+"mouse_y";a.mClicked=p+"mouse_clicked";a.mClicIzq=p+"clic_izquierdo";
a.init()}init(p){a=this;f=a.evaluator;m=b.hasTouchSupport;p||(p=f.eval(a.expresion)[0],a.x=p[0],a.y=p[1],f.setVariable(a.xStr,a.x),f.setVariable(a.yStr,a.y));a.img_src_eval=f.eval(a.imageSrc).toString().trim();a.img_src_eval==""||/vacio.gif$/i.test(a.img_src_eval)?(a.width=f.eval(a.size)*2,a.height=f.eval(a.size)*2,a._w=m&&a.width<48?48:a.width,a._h=m&&a.height<48?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";f.setVariable(a.activoStr,0);f.setVariable(a.activeStr,0);a.setImage=!1;a.update()}update(){a=this;f=a.evaluator;f.eval(a.imageSrc).toString().trim()!==a.img_src_eval&&a.init(!0);a.activeIfValue=
f.eval(a.activeif)>0;a.drawIfValue=f.eval(a.drawif)>0;a.x=f.getVariable(a.xStr);a.y=f.getVariable(a.yStr);d=a.space.getAbsoluteX(a.x);g=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(g-a._h/2)+"px";a.constraint&&a.evalConst();a.draw()}draw(){a=this;f=a.evaluator;a.drawIfValue&&(t=a.ctx,c=a.space.backgroundCtx,d=parseInt(a.space.getAbsoluteX(this.x))+.5,g=parseInt(a.space.getAbsoluteY(this.y))+
.5,a.text!=""&&a.drawText(d,g),a.image.ready?(e=a.image.width/2,q=a.image.height/2,a.image.complete&&!a.setImage&&t.drawImage(a.image,parseInt(d-e),parseInt(g-q)),a.trace&&(c.save(),c.translate(d,g),c.scale(parseInt(e),parseInt(q)),c.beginPath(),c.arc(0,0,1,0,h),c.restore(),c.lineWidth=1,c.strokeStyle=a.trace.getColor(),c.stroke())):(e=parseInt(a.width/2),t.beginPath(),t.arc(d,g,e,0,h),t.fillStyle=a.colorInt.getColor(),t.fill(),t.lineWidth=1,t.strokeStyle=a.color.getColor(),t.stroke(),a.active&&(t.strokeStyle=
a.colorInt.borderColor(),t.beginPath(),t.arc(d,g,e-2,0,h),t.stroke()),a.trace&&(c.strokeStyle=a.trace.getColor(),c.beginPath(),c.arc(d,g,e,0,h),c.stroke())))}evalConst(){v.set(this.x,this.y);n=this.newt.findZero(v,1/this.space.scale,!0);this.x=n.x;this.y=n.y;this.evaluator.setVariable(this.xStr,this.x);this.evaluator.setVariable(this.yStr,this.y)}evalConstXoY(){f=this.evaluator;k=f.getVariable(this.constVar);f.setVariable(this.constVar,this[this.constVar]);this[this.noConstVar]=f.eval(this.constraint);
f.setVariable(this.xStr,this.x);f.setVariable(this.yStr,this.y);f.setVariable(this.constVar,k)}drawText(p,x){a=this;f=a.evaluator;t=a.ctx;t.fillStyle=a.color.getColor();t.textBaseline="alphabetic";a.text.type=="simpleText"?(t.font=a.font,t.fillText(a.text.toString(f.eval(a.decimals),a.fixed),parseInt(p+1+a.width/2),parseInt(x-1-a.height/2))):(t.strokeStyle=a.color.getColor(),a.text.draw(t,parseInt(p+1+a.width/2),parseInt(x-1-a.height/2),a.decimals,a.fixed,"start",!0,a.color.getColor()))}getContainer(){let p=
this.parent.spaces;for(let x of p)if(x.id==this.spaceID)return x.addCtr(this),this.zIndex=x.zIndex,this.space=x,x.graphicControlContainer;p[0].addCtr(this);this.zIndex=p[0].zIndex;this.space=p[0];return p[0].graphicControlContainer}deactivate(){this.active=!1;this.evaluator.setVariable(this.activoStr,0);this.evaluator.setVariable(this.activeStr,0);this.evaluator.setVariable(this.mClicIzq,0)}addEvents(){function p(y){document.body.focus();y.preventDefault();w.whichBtn=b.whichBtn(y);w.whichBtn=="L"&&
w.activeIfValue&&(w.parent.deactivateControls(),w.click=w.active=!0,w.evaluator.setVariable(w.activoStr,1),w.evaluator.setVariable(w.activeStr,1),w.evaluator.setVariable(w.mClicked,0),w.evaluator.setVariable(w.mClicIzq,0),w.posAnte=b.getCursorPosition(y,w.container),w.prePos={x:w.space.getAbsoluteX(w.x),y:w.space.getAbsoluteY(w.y)},w.evaluator.setVariable(w.mX,w.space.getRelativeX(w.posAnte.x)),w.evaluator.setVariable(w.mY,w.space.getRelativeY(w.posAnte.y)),w.parent.update(),window.addEventListener("touchend",
x),window.addEventListener("touchmove",u),window.addEventListener("mouseup",x),window.addEventListener("mousemove",u))}function x(y){document.body.focus();y.preventDefault();y.stopPropagation();w.evaluator.setVariable(w.mClicked,1);w.evaluator.setVariable(w.mClicIzq,1);if(w.activeIfValue||w.active)w.click=!1,window.removeEventListener("mouseup",x),window.removeEventListener("mousemove",u),window.removeEventListener("touchend",x),window.removeEventListener("touchmove",u),A=b.getCursorPosition(y,w.container)||
A,w.posX=w.prePos.x-(w.posAnte.x-A.x),w.posY=w.prePos.y-(w.posAnte.y-A.y),w.evaluator.setVariable(w.xStr,w.space.getRelativeX(w.posX)),w.evaluator.setVariable(w.yStr,w.space.getRelativeY(w.posY)),w.evaluator.setVariable(w.mX,w.space.getRelativeX(A.x)),w.evaluator.setVariable(w.mY,w.space.getRelativeY(A.y)),w.parent.updateControls(),w.parent.update(),w.mouseCatcher.style.left=w.space.getAbsoluteX(w.x)-w._w/2+"px",w.mouseCatcher.style.top=w.space.getAbsoluteY(w.y)-w._h/2+"px";y=w.evaluator.getVariable(w.activeStr);
w.parent.deactivateControls();w.parent.updateControls();w.evaluator.setVariable(w.activoStr,y);w.evaluator.setVariable(w.activeStr,y);w.parent.update()}function u(y){y.preventDefault();w.evaluator.setVariable(w.mClicked,0);w.evaluator.setVariable(w.mClicIzq,0);A=b.getCursorPosition(y,w.container);w.posX=w.prePos.x-(w.posAnte.x-A.x);w.posY=w.prePos.y-(w.posAnte.y-A.y);w.evaluator.setVariable(w.xStr,w.space.getRelativeX(w.posX));w.evaluator.setVariable(w.yStr,w.space.getRelativeY(w.posY));w.evaluator.setVariable(w.mX,
w.space.getRelativeX(A.x));w.evaluator.setVariable(w.mY,w.space.getRelativeY(A.y));Date.now()-z>80&&(w.parent.updateControls(),w.parent.update(),z=Date.now())}let z=0,A,w=this;w.click=!1;w.over=!1;w.active=!1;w.mouseCatcher.addEventListener("touchstart",p);w.mouseCatcher.addEventListener("mousedown",p);w.mouseCatcher.addEventListener("mouseover",function(y){w.over=!0});w.mouseCatcher.addEventListener("mouseout",function(y){w.over=!1;w.click=!1})}}b.GraphicControl=r})(descartesJS);
((b,a)=>{function h(w){return w?w[0].toUpperCase()+w.substring(1):""}const f=/[\w-//]*(\.png|\.jpg|\.gif|\.svg|\.webp)/gi;let l,d,g,e,q,n,t,c,v,m,k,r,p,x,u,z;class A{constructor(w){this.parent=w;this.parser=w.evaluator.parser;this.RTFparser=new b.RTFParser(w.evaluator)}parseButtonsConfig(w){let y={rowsNorth:0,rowsSouth:0,widthEast:125,widthWest:125,height:23};w=this.split(w);for(let D=0,F=w.length;D<F;D++)switch(g=w[D][0],e=w[D][1],d=a[g],d){case "rowsNorth":case "rowsSouth":case "widthEast":case "widthWest":case "height":y[d]=
parseInt(e);break;case "about":case "config":case "init":case "clear":y[d]=a[e]==="true";break;default:console.warn(`Propiedad de botones no identificada: <${g}> valor: <${e}>`)}return y}parseSpace(w){q={};w=this.split(w);for(let y=0,D=w.length;y<D;y++)switch(g=w[y][0],e=w[y][1],d=a[g],b.DEBUG.paramName=g,b.DEBUG.objectName="Space",d){case "info":break;case "type":if(e==="R2"||e==="R3")e=a[e];q[d]=e;break;case "id":b.DEBUG.idName=e;case "x_axis":case "y_axis":case "cID":case "file":case "border_width":case "border_radius":q[d]=
e;break;case "fixed":case "numbers":case "sensitive_to_mouse_movements":case "3D":case "split":case "resizable":q[d]=a[e]==="true";break;case "bg_display":case "render":q[d]=a[e];break;case "border_color":case "net":case "net10":case "axes":case "text":q[d]="";e!=""&&(q[d]=a[e]==="false"?"":new b.Color(e,this.parent.evaluator));break;case "O.x":q.OxExpr=e;break;case "O.y":q.OyExpr=e;break;case "image":q.imageSrc=e;break;case "x":case "y":l=e.trim();let F=d==="x"?this.parent.container.width:this.parent.container.height;
l[l.length-1]==="%"?(q[d+"PercentExpr"]=l,l=(F*parseFloat(l)/100).toString()):l=e.trim();q[d+"Expr"]=this.parser.parse(l);break;case "width":case "height":l=e.trim();q[d[0]+"ModExpr"]=l;l[l.length-1]==="%"?(q[d[0]+"Expr"]=l,l=this.parent.container[d]*parseFloat(l)/100):(l=parseFloat(e),l!=e&&(l=this.parent.container[d],q[`_${d[0]}_`]=e.trim()));q[d[0]]=l;break;case "drawif":e!=""&&(q[d]=this.parser.parse(e));break;case "scale":l=parseFloat(e);isNaN(l)&&(l=48);q[d]=l;break;case "background":q[d]=new b.Color(e,
this.parent.evaluator);break;default:console.warn(`Propiedad del espacio no identificada: <${g}> valor: <${e}>`)}return new b["Space"+q.type](this.parent,q)}parseControl(w){n={type:"Numeric",gui:"Spinner"};w=this.split(w);for(let D=0,F=w.length;D<F;D++)switch(g=w[D][0],e=w[D][1],d=a[g],b.DEBUG.paramName=g,b.DEBUG.objectName="Control",d){case "info":break;case "type":l=a[e.trim()];l==="graphic"?l="GraphicControl":l==="text"&&(l="TextArea");n[d]=h(l);break;case "gui":l=a[e];l==="textfield"&&(l="TextField");
n[d]=h(l);break;case "id":b.DEBUG.idName=e;case "name":case "parameter":case "tooltip":case "tooltipFont":case "Explanation":case "ExplanationFont":case "cID":case "options":case "font":case "font_family":case "file":case "answer":case "cssClass":case "radio_group":case "extra_style":case "kblayout":n[d]=e;break;case "region":case "position":case "action":case "msg_pos":case "poster":case "text_align":case "image_align":case "btn_pos":n[d]=a[e];break;case "fixed":case "visible":case "discrete":case "onlyText":case "evaluate":case "autoplay":case "loop":case "controls":case "flat":case "keyboard":n[d]=
a[e]==="true";break;case "color":case "colorInt":case "label_color":case "label_text_color":case "trace":n[d]=new b.Color(e,this.parent.evaluator);break;case "font_size":case "drawif":case "activeif":case "decimals":case "min":case "max":case "size":e!==""&&(n[d]=this.parser.parse(e));break;case "constraint":n.constraintExpr=e;break;case "image":n.imageSrc=e;break;case "image_dec":n.image_dec_src=e;break;case "image_inc":n.image_inc_src=e;break;case "space":n.spaceID=e;break;case "expresion":case "kbexp":n[d]=
this.parser.parse(e.replace(")(",","));break;case "borderColor":n[d]=a[e]==="false"?"":e;break;case "bold":case "italics":a[e]!="false"&&(n[d]=d);break;case "underlined":a[e]!="false"&&(n.underlined=!0);break;case "value":var y=e.replace(/&squot;/g,"'").replace(/^\|(.*)\|$/,"'$1'");n.valueExpr=this.parser.parse(y);n.valueExprString=y;break;case "incr":e!=0&&(n[d]=this.parser.parse(e));break;case "exponentialif":n[d]=parseFloat(e);break;case "text":n.rawText=e;y=this.parseText(e);for(let I=0,E=y.length;I<
E;I++)y[I]=this.parser.parse(y[I],!1);n[d]=y;break;default:y=g.indexOf(".");let B=a[g.substring(0,y)];a[g.substring(y+1)]==="font"&&/parameter|Explanation|tooltip/.test(B)?n[B+"Font"]=e:console.warn(`Propiedad de control no identificada: <${g}> valor: <${e}>`)}return new b[n.type==="Numeric"?n.gui:n.type](this.parent,n)}parseGraphic(w,y,D,F){t={rotateExp:F,parameter:"t"};w=this.split(w);for(let B=0,I=w.length;B<I;B++)if(g=w[B][0],e=w[B][1],d=a[g],b.DEBUG.paramName=g,b.DEBUG.objectName="Graphic",e!=
"")switch(d){case "info":break;case "type":b.DEBUG.idName=e;t[d]=h(a[e]);break;case "align":case "anchor":case "lineDash":t[d]=a[e];break;case "background":case "abs_coord":case "visible":case "editable":case "fixed":case "vectors":case "bold":case "italics":case "underlined":t[d]=a[e]==="true";break;case "shadowColor":case "color":case "fill":case "fillP":case "fillM":case "arrow":case "trace":t[d]=a[e]==="false"?"":new b.Color(e,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":t[d]=
e;break;case "drawif":case "width":case "decimals":case "size":case "spear":case "center":case "radius":case "border_radius":case "opacity":case "inirot":case "inipos":case "range":case "clip":e!==""&&(t[d]=this.parser.parse(e));break;case "font_size":e=e.trim();/^\[.*\]$/.test(e)&&(e=e.slice(1,-1));e!==""&&(t[d]=this.parser.parse(e));break;case "space":t[d+"ID"]=e;break;case "expresion":e!==""&&(t.type!=="Macro"?(t[d]=this.parser.parse(e),t.expresionString=e):t[d]=e);break;case "text":t[d]=e;break;
case "file":F=e.replace(/&squot;/g,"'").trim();/^\[.*\]$/.test(F)&&(F=F.slice(1,-1));F.match(f)&&(F=`'${F}'`);F.startsWith("data:image/")?t[d]=this.parser.parse(`'${F}'`):t[d]=this.parser.parse(F);break;case "border":e!=""&&a[e]!="false"&&(t[d]=new b.Color(e,this.parent.evaluator));break;default:if(t.family!=void 0&&(F=t.family.length+1,g.substring(0,F)===t.family+".")){F=a[g.substring(F)];/interval|steps/.test(F)&&e!=""&&(t["family_"+F]=this.parser.parse(e));break}t.parameter!=void 0&&g.match(t.parameter+
".")?(F=g.substring(0,g.indexOf(t.parameter)+t.parameter.length),t.parameter!==F&&(t.parameter=F),F=a[g.substring(t.parameter.length+1)],/interval|steps/.test(F)&&e!=""&&(t["parameter_"+F]=this.parser.parse(e))):console.warn(`Propiedad del gr\u00e1fico no identificada: <${g}> valor: <${e}>`)}y&&(t.abs_coord=y);D&&(t.background=D);return new b[t.type](this.parent,t)}parse3DGraphic(w,y,D,F){t={rotateExp:F,parameter:"t"};w=this.split(w);for(let B=0,I=w.length;B<I;B++)switch(g=w[B][0],e=w[B][1],d=a[g],
b.DEBUG.paramName=g,b.DEBUG.objectName="Graphic3D",d){case "info":break;case "type":b.DEBUG.idName=e;l=a[e];t[d]=h(l);break;case "model":case "align":case "anchor":case "lineDash":t[d]=a[e];break;case "shadowColor":case "fill":t[d]=a[e]==="false"?"":new b.Color(e,this.parent.evaluator);break;case "background":case "fixed":case "split":case "bold":case "italics":case "underlined":t[d]=a[e]==="true";break;case "edges":a[e]==="false"?t[d]="":(a[e]==="true"&&(e="808080"),t[d]=new b.Color(e,this.parent.evaluator));
break;case "border":e!=""&&a[e]!="false"&&(t.border=new b.Color(e,this.parent.evaluator));break;case "color":case "backcolor":t[d]=new b.Color(e,this.parent.evaluator);break;case "drawif":case "width":case "length":case "height":case "R":case "r":case "decimals":case "Nu":case "Nv":case "inipos":case "endpos":case "offset_angle":case "offset_dist":case "font_size":e!=""&&(t[d]=this.parser.parse(e));break;case "border_size":case "shadowBlur":case "shadowOffsetX":case "shadowOffsetY":case "family":case "parameter":case "font":case "font_family":case "name":case "inirot":case "endrot":t[d]=
e;break;case "space":t[d+"ID"]=e;break;case "expresion":/Macro|Curve|Surface/.test(t.type)?t[d]=e.replace(/\\n/g,";"):(t[d]=this.parser.parse(e),t.expresionString=e);break;case "text":t.text=e;break;case "file":y=e.replace(/&squot;/g,"'").trim();/^\[.*\]$/.test(y)&&(y=y.slice(1,-1));/./.test(y)&&(y=`'${y}'`);t[d]=this.parser.parse(y);break;default:if(t.family!=void 0&&(y=t.family.length+1,g.substring(0,y)===t.family+".")){y=a[g.substring(y)];/interval|steps/.test(y)&&e!=""&&(t["family_"+y]=this.parser.parse(e));
break}console.warn(`Propiedad del gr\u00e1fico 3D no identificada: <${g}> valor: <${e}>`)}return new b[t.type+"3D"](this.parent,t)}parseAuxiliar(w){c={};w=this.split(w);for(let D=0,F=w.length;D<F;D++)w[D][1]=w[D][1].replace(/&squot;/g,"'");for(let D=0,F=w.length;D<F;D++)switch(g=w[D][0],e=w[D][1],d=a[g],b.DEBUG.paramName=g,b.DEBUG.objectName="Auxiliar",d){case "info":case "code":case "doc":break;case "id":b.DEBUG.idName=e;case "file":case "init":case "doExpr":case "whileExpr":case "range":case "local":case "expresion":case "condition":case "parameter":c[d]=
e.replace(/&squot;/g,"'");break;case "editable":case "constant":case "array":case "matrix":case "algorithm":case "event":case "sequence":c[d]=a[e]==="true";break;case "size":case "rows":case "columns":case "x":case "y":case "width":case "height":c[d]=this.parser.parse(e);break;case "evaluate":case "execution":case "msg_pos":case "action":case "type":c[d]=a[e];break;default:var y=g.indexOf(".");let B=a[g.substring(0,y)];y=a[g.substring(y+1)];B==="parameter"&&y==="font"?c[B+"Font"]=e:console.warn(`Propiedad del auxiliar no identificada: <${g}> valor: <${e}>`)}c.sequence?
c.type="sequence":c.constant?c.type="constant":c.algorithm&&c.evaluate?c.type="algorithm":c.array&&!c.matrix&&c.id.charAt(c.id.length-1)!=")"?c.type="vector":c.matrix&&c.id.charAt(c.id.length-1)!=")"?c.type="matrix":c.event&&c.id.charAt(c.id.length-1)!=")"?c.type="event":c.type==="library"?c.type="library":c.id.charAt(c.id.length-1)===")"?c.type="function":c.type="variable";b.DEBUG.typeName=c.type;switch(c.type){case "sequence":new b.Function(this.parent,c);break;case "constant":w=new b.Constant(this.parent,
c);c.evaluate&&c.evaluate==="always"&&this.parent.auxiliaries.push(w);break;case "algorithm":this.parent.auxiliaries.push(new b.Algorithm(this.parent,c));break;case "vector":w=new b.Vector(this.parent,c);c.evaluate&&c.evaluate==="always"&&this.parent.auxiliaries.push(w);break;case "matrix":w=new b.Matrix(this.parent,c);c.evaluate&&c.evaluate==="always"&&this.parent.auxiliaries.push(w);break;case "event":this.parent.events.push(new b.Event(this.parent,c));break;case "library":new b.Library(this.parent,
c);break;case "variable":new b.Variable(this.parent,c);break;default:new b.Function(this.parent,c)}}parseAction(w){return w.action?new (b[h(w.action)])(w.parent,w.parameter):{execute:()=>{}}}parseAnimation(w){let y={};w=this.split(w);for(let D=0,F=w.length;D<F;D++)switch(g=w[D][0],e=w[D][1],d=a[g],b.DEBUG.pName=g,b.DEBUG.objectName="Animation",d){case "info":break;case "id":case "delay":case "init":case "doExpr":case "whileExpr":y[d]=e.replace(/&squot;/g,"'");break;case "controls":case "auto":case "loop":case "algorithm":case "evaluate":y[d]=
a[e]==="true";break;default:console.warn(`Propiedad de la animaci\u00f3n no identificada: <${g}> valor: <${e}>`)}return new b.Animation(this.parent,y)}split(w){if(typeof w!=="string")return[];v=[];w=(w||"").replace(/\\'/g,"\u2019");m=k=p=0;for(r=x=!1;m<w.length;)w[m]!==" "||r||m++,w[m]===" "||r||(r=!0,p=m),w[m]!=="="||w[m+1]!=="'"||x||(x=!0,v[k]=[w.substring(p,m)],p=m+2,m+=2),x&&w[m]==="'"&&(r=x=!1,v[k].push(w.substring(p,m)),k++),w[m]!=="="||w[m+1]==="'"||x||(v[k]=[w.substring(p,m)],p=m+1,m++,u=
w.substring(m).indexOf("="),u===-1?u=z=w.length:(u+=m,z=w.substring(m,u).lastIndexOf(" "),z=z===-1?w.length:z+m),v[k].push(w.substring(p,z)),k++,r=!1,m=z),m++;return v}parseText(w=""){return/^\{\\rtf1/.test(w)?this.RTFparser.parse(w.substring(10)):new b.SimpleText(this.parent,w)}}b.LessonParser=A})(descartesJS,babel);
(b=>{function a(){return parseFloat(this.value)}function h(){return this.value.replace(/\\u0027/g,"'")}function f(J,Q){let aa=J.variables[this.value];if(typeof aa==="object"&&aa.length==void 0)return aa.evaluate(J);aa==void 0&&(Q||J.matrices[this.value]?aa=J.matrices[this.value]:J.vectors[this.value]&&(aa=J.vectors[this.value]));return aa!==void 0?aa:0}function l(J){try{let Q=J.getVector(this.value,this.childs[0].childs[0].evaluate(J));return Q!==void 0?Q:0}catch(Q){return 0}}function d(J){try{let Q=
J.getMatrix(this.value,this.childs[0].childs[0].evaluate(J),this.childs[0].childs[1].evaluate(J));return Q!==void 0?Q:0}catch(Q){return 0}}function g(J){return J.functions[this.value].apply(J,this.childs[0].childs.map(Q=>Q.evaluate(J)))}function e(J){var Q=this.childs[0].evaluate(J,!0);J=this.childs[1].evaluate(J,!0);if(Q.type!=="matrix"||J.type!=="matrix")return typeof Q=="number"&&typeof J=="string"?Q=b.removeNeedlessDecimals(Q.toString()):typeof Q=="string"&&typeof J=="number"&&(J=b.removeNeedlessDecimals(J.toString())),
Q+J;V=Q.rows;W=Q.cols;ba=X(V,W);for(R=0;R<V;R++)for(C=0;C<W;C++)ba[C][R]=Q[C][R]+J[C][R];return ba}function q(J){let Q=this.childs[0].evaluate(J,!0);J=this.childs[1].evaluate(J,!0);if(Q.type!=="matrix"||J.type!=="matrix")return Q-J;V=Q.rows;W=Q.cols;ba=X(V,W);for(R=0;R<V;R++)for(C=0;C<W;C++)ba[C][R]=Q[C][R]-J[C][R];return ba}function n(J){let Q=this.childs[0].evaluate(J,!0);J=this.childs[1].evaluate(J,!0);return Q.type!=="matrix"||J.type!=="matrix"?Q*J:L(Q,J)}function t(J){var Q=this.childs[0].evaluate(J,
!0);J=this.childs[1].evaluate(J,!0);if(Q.type!=="matrix"||J.type!=="matrix")return Q/J;{let ea=X(J.length,J.length);var aa=O(J);if(aa===0)J=0;else{aa=1/aa;if(J.length>1)for(let fa=0,da=J.length;fa<da;fa++){var ca=aa;for(let ja=0;ja<da;ja++)ea[ja][fa]=ca*O(G(fa,ja,J)),ca=-ca;aa=-aa}else ea[0][0]=aa;J=ea}}Q=J===0?X(Q.rows,Q.cols):L(Q,J);return Q}function c(J){let Q=this.childs[0].evaluate(J);J=this.childs[1].evaluate(J);return Q-S(Q/J)*J}function v(J){let Q=this.childs[0].evaluate(J);J=this.childs[1].evaluate(J);
return J>=0?U(Q,J):1/U(Q,-J)}function m(J){return+(this.childs[0].evaluate(J)<this.childs[1].evaluate(J))}function k(J){return+(this.childs[0].evaluate(J)<=this.childs[1].evaluate(J))}function r(J){return+(this.childs[0].evaluate(J)>this.childs[1].evaluate(J))}function p(J){return+(this.childs[0].evaluate(J)>=this.childs[1].evaluate(J))}function x(J){let Q=this.childs[0].evaluate(J);J=this.childs[1].evaluate(J);return typeof Q=="number"&&typeof J=="number"?+(Math.abs(Q-J)<1E-8):+(Q===J)}function u(J){let Q=
this.childs[0].evaluate(J);J=this.childs[1].evaluate(J);return typeof Q=="number"&&typeof J=="number"?+!(Math.abs(Q-J)<1E-8):+(Q!==J)}function z(J){return this.childs[0].evaluate(J)?this.childs[1].evaluate(J)?1:0:0}function A(J){return this.childs[0].evaluate(J)?1:this.childs[1].evaluate(J)?1:0}function w(J){return+!this.childs[0].evaluate(J)}function y(J){return this.childs[0].evaluate(J)>0?this.childs[1].evaluate(J):this.childs[2]?this.childs[2].evaluate(J):0}function D(J){return this.childs[0].evaluate(J)}
function F(J){return-this.childs[0].evaluate(J)}function B(J,Q){return this.childs[0].evaluate(J,Q)}function I(J){return this.childs.length===1&&this.childs[0].childs.length===1&&this.type==="(expr)"?this.childs[0].childs[0].evaluate(J):this.childs.map(Q=>Q.childs.map(aa=>aa.evaluate(J)))}function E(J){let Q=this.childs[0],aa=Q.childs[0]?Q.childs[0].childs:null,ca=this.childs[1].evaluate(J);J.setVector(Q.value,aa[0].evaluate(J),ca);return ca}function P(J){let Q=this.childs[0],aa=Q.childs[0]?Q.childs[0].childs:
null,ca=this.childs[1].evaluate(J);J.setMatrix(Q.value,aa[0].evaluate(J),aa[1].evaluate(J),ca);return ca}function N(J){let Q=this.childs[0],aa=this.childs[1].evaluate(J);return aa.type?J.matrices[Q.value]=aa:typeof J.variables[Q.value]!=="object"?J.variables[Q.value]=aa:0}function U(J,Q){if(Q==0)return 1;if(Q<0)return NaN;if(J>=0||S(Q)===Q)return Math.pow(J,Q);if(J<0){let aa=1/Q,ca=S(aa);if(ca===aa&&ca%2===1)return-Math.pow(-J,Q)}return NaN}function X(J,Q){ba=[];ba.type="matrix";ba.rows=J;ba.cols=
Q;R=0;for(Y=Q;R<Y;R++)ba[R]=Array(J).fill(0);return ba}function L(J,Q){V=J.rows;W=J.cols;ba=X(V,W);let aa;for(R=0;R<V;R++)for(C=0;C<W;C++){for(Y=aa=0;Y<W;Y++)aa+=J[Y][R]*Q[C][Y];ba[C][R]=aa}return ba}function G(J,Q,aa){let ca=X(aa.length-1,aa.length-1);for(let ea=0,fa=ca.length;ea<fa;ea++)for(let da=0;da<fa;da++)ca[ea][da]=ea<J?da<Q?aa[ea][da]:aa[ea][da+1]:ea<Q?aa[ea+1][da]:aa[ea+1][da+1];return ca}function O(J){if(J.cols>1){let Q=0,aa=1;for(let ca=0,ea=J.cols;ca<ea;ca++)Q+=aa*J[0][ca]*O(G(0,ca,J)),
aa=-aa;return Q}return J[0][0]}const S=Math.floor;let H,M,K,T,V,W,ba,C,R,Y;class Z{constructor(J,Q){this.sep="";this.type=J;this.value=Q;this.parent=null;this.childs=[]}getRoot(){return this.parent===null?this:this.parent.getRoot()}addChild(J){J.parent=this;this.childs.push(J)}replaceLastChild(J){M=this.childs.length-1;H=this.childs[M];H.parent=null;this.childs[M]=J;J.parent=this;return J}contains(J){return this.value===J?!0:this.childs.some(Q=>Q.contains(J))}equalToMinus(){return this.type==="compOperator"?
(this.type="operator",this.value="-",T=new Z("compOperator","=="),T.addChild(this),T.addChild(new Z("number","0")),K=this.getRoot(),K.setAllEvalFun(),K):this}getChildren(){if(this.type==="(expr)"||this.type==="[expr]"){if(this.childArray)return this.childArray;this.childArray=[];for(let J of this.childs)/square_bracket|parentheses/.test(J.type)&&this.childArray.push(...J.childs);return this.childArray}return null}setAllEvalFun(){this.setEvalFun();for(let J of this.childs)J.setAllEvalFun()}setEvalFun(){if(this.type===
"number")this.evaluate=a;else if(this.type==="string")this.evaluate=h;else if(this.type==="identifier"&&this.childs.length===0)this.evaluate=f;else if(this.type==="identifier"&&this.childs[0].type==="square_bracket"&&this.childs[0].childs.length===1)this.evaluate=l;else if(this.type==="identifier"&&this.childs[0].type==="square_bracket"&&this.childs[0].childs.length>1)this.evaluate=d;else if(this.type==="identifier"&&this.childs[0].type==="parentheses")this.evaluate=g;else if(this.type==="operator")this.value===
"+"?this.evaluate=e:this.value==="-"?this.evaluate=q:this.value==="*"?this.evaluate=n:this.value==="/"?this.evaluate=t:this.value==="%"?this.evaluate=c:this.value==="^"&&(this.evaluate=v);else if(this.type==="compOperator")this.value==="<"?this.evaluate=m:this.value==="<="?this.evaluate=k:this.value===">"?this.evaluate=r:this.value===">="?this.evaluate=p:this.value==="=="?this.evaluate=x:this.value==="!="&&(this.evaluate=u);else if(this.type==="boolOperator")this.value==="&"?this.evaluate=z:this.value===
"|"?this.evaluate=A:this.value==="!"&&(this.evaluate=w);else if(this.type==="conditional")this.evaluate=y;else if(this.type==="sign")this.evaluate=this.value==="sign+"?D:F;else if(this.type==="parentheses")this.evaluate=B;else if(this.type==="(expr)"||this.type==="[expr]")this.evaluate=I;else if(this.type==="assign"){let J=this.childs[0],Q=J.childs[0]?J.childs[0].childs:null;this.evaluate=J.childs.length===1&&J.childs[0].type==="square_bracket"&&Q.length===1?E:J.childs.length===1&&J.childs[0].type===
"square_bracket"&&Q.length===2?P:N}}}b.Node=Z})(descartesJS);
(b=>{let a,h,f,l,d,g,e,q,n=/^\s+/,t=/^[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]*)*/,c=/^([0-9]+[.][0-9]+|[.][0-9]+|[0-9]+)/,v=/^(==|!=|<=|<|>=|>|#)/,m=/^(!|~|&&|&|\|\||\|)/,k=/^(=|:=)/,r=/^[\?:]/,p=/^[\+\-\*\/%\^\u2212\u00b7\u00D7\u00F7]/,x=/^(\[|\])/,u=/^(\(|\))/,z=/^,/,A=/^;/,w=/\|/g,y=/\|\*/g,D=/\*\|/g,F=/^\/\//g,B=/:\/\//g,I,E=/rnd|pi|e|Infinity|-Infinity|sqr|sqrt|ra\u00edz|exp|log|log10|abs|ent|sgn|ind|sin|sen|cos|tan|cot|sec|csc|sinh|senh|cosh|tanh|coth|sech|csch|asin|asen|acos|atan|min|max/;class P{constructor(){}tokenize(N){function U(L,
G,O){h.push({type:L,value:G});g=g.slice(O);l+=O;q=L}if(a=N){N=N.replace(/\\u(\S+) /g,(L,G)=>parseInt(G,16)!==39?String.fromCharCode(parseInt(G,16)):L).replace(/&sup(.+?);/g,"^$1 ").replace(/&squot;/g,"'").replace(/\brnd\b/g,"random()");N.match(/=\|\*/g)&&(N=N.replace(y,"'").replace(D,"'"));N.match(/=\|/g)&&(N=N.replace(w,"'"));var X=N.trim();X[0]=="|"&&X[X.length-1]=="|"&&(N=X.replace(w,"'"))}h=[];f=!1;l=0;g=N;for(q="";N&&l<N.length;)if(f=l,g[0]=="'"){for(e=1;g[e]!="'";)if(e<g.length)e++;else return;
d=g.substring(1,e);U("string",d,d.length+2)}else{if(d=g.match(F))if(g.match(B))continue;else{l=2*N.length;break}if(d=g.match(n))g=g.slice(d[0].length),l+=d[0].length;else if(d=g.match(p))d[0]=d[0].replace(/\u00F7/g,"/").replace(/\u2212/g,"-").replace(/\u00b7/g,"*").replace(/\u00D7/g,"*"),U("operator",d[0],d[0].length);else if(d=g.match(t))q==="number"&&h.push({type:"operator",value:"*"}),U("identifier",d[0],d[0].length);else if(d=g.match(c))U("number",d[0],d[0].length);else if(d=g.match(v))X=d[0],
X=="#"&&(X="!="),U("compOperator",X,d[0].length);else if(d=g.match(m))X=d[0],X=="||"?X="|":X=="&&"?X="&":X=="~"&&(X="!"),U("boolOperator",X,d[0].length);else if((d=g.match(k))&&!/^==/.test(g))U("assign",d[0],d[0].length);else if(d=g.match(r))U("conditional",d[0],d[0].length);else if(d=g.match(x))U("square_bracket",d[0],d[0].length);else if(d=g.match(u))d=="("&&q==="number"&&h.push({type:"operator",value:"*"}),U("parentheses",d[0],d[0].length);else if(d=g.match(z))U("separator",d[0],d[0].length);else if(g.charCodeAt(0)===
178)h.push({type:"operator",value:"^"}),U("number",2,1);else if(g.charCodeAt(0)===179)h.push({type:"operator",value:"^"}),U("number",3,1);else if(d=g.match(A))U("final_of_expression",d[0],d[0].length);else if(f==l){b.DEBUG.setError(b.DEBUG.EXPRESSION,a);return}}return h}flatTokens(N=[],U=""){I="";for(let X of N)I=X.type=="string"?I+`&squot;${X.value}&squot;`:X.type!="identifier"||E.test(X.value)?I+X.value:I+(U+X.value);return I}}b.Tokenizer=P})(descartesJS);
(b=>{function a(r){switch(r){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 h(r){r=
String(r).trim().replace(/^'|'$/g,"");let p=parseFloat(r);return isNaN(p)||String(p)!==r?r:p}function f(r,p,x,u){console.info(`Error${r}: en la expresi\u00f3n \u300a${p}\u300b, en el token {valor: ${x}, tipo: ${u}}`)}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-";
let l,d,g,e,q,n,t,c,v,m;class k{constructor(r){this.evaluator=r;this.tokenizer=new b.Tokenizer;this.vectors={};this.matrices={};this.variables={};this.functions={};this.definitions={};this.registerDefaultValues();this.registerExternalValues&&this.registerExternalValues()}parse(r,p){(l=this.tokenizer.tokenize(r))||(l=[]);d=null;p=!p||!1;n=q=e=0;for(let x=0,u=l.length;x<u;x++){t=l[x];c=t.value;v=t.type;if(v==="identifier")if(l[x+1]&&l[x+1].type==="parentheses"&&l[x+1].value==="(")this.functions.hasOwnProperty(c)||
(this.functions[c]=()=>0);else if(l[x+1]&&l[x+1].type==="square_bracket"&&l[x+1].value==="[")l[x+3]&&l[x+3].type==="square_bracket"&&l[x+3].value==="]"?this.vectors.hasOwnProperty(c)||(this.vectors[c]=[0,0,0]):this.matrices.hasOwnProperty(c)||(this.matrices[c]=[[0,0,0],[0,0,0],[0,0,0]]);else{let z=c.match(/(\w*)(\.mouse_x|\.mouse_y|\.mouse_pressed|\.mouse_clicked|\.clic_izquierdo)$/);z&&(this.variables[z[1]+".DJS_NO_FIXED"]=1)}v==="assign"&&p&&c!=":="&&(v="compOperator",c="==");if(v==="assign")if(g=
new b.Node(v,c),d!=null){p=!0;if(d.type==="identifier")d.parent&&d.parent.replaceLastChild(g),g.addChild(d);else if(d.type==="square_bracket")g.addChild(d.parent);else{g.type="compOperator";for(g.value="==";d.parent&&a(d.parent.value)>=a(g.value);)d=d.parent;d.parent&&d.parent.replaceLastChild(g);g.addChild(d)}d=g}else{f(1,r,c,v);break}else if(v==="parentheses"&&c==="("||v==="square_bracket"&&c==="[")if(g=new b.Node(v,c),c==="("&&e++,c==="["&&q++,d===null)c==="("&&(new b.Node("(expr)","(expr)")).addChild(g),
c==="["&&(new b.Node("[expr]","[expr]")).addChild(g),d=g;else if(d.type==="operator"||d.type==="boolOperator"||d.type==="compOperator"||d.type==="conditional"||d.type==="assign")d.addChild(g),d=g;else if(d.type==="sign")d.addChild(g),d=g;else if(d.type==="parentheses"&&d.value==="(")d.addChild(g),d=g;else if(d.type==="square_bracket"&&d.value==="[")d.addChild(g),d=g;else if(d.type==="parentheses"&&d.value==="()")d.parent.addChild(g),d=g;else if(d.type==="square_bracket"&&d.value==="[]")d.parent.addChild(g),
d=g;else if(d.type==="identifier")d.addChild(g),d=g;else{f(2,r,c,v);break}else if(v==="parentheses"&&c===")")if(e--,d===null)f(3,r,c,v);else{for(;d&&d.parent&&(d.value!="("||d.value=="("&&d.type!="parentheses");)d=d.parent;if(d&&d.value==="(")d.value="()";else{f(4,r,c,v);break}}else if(v==="square_bracket"&&c==="]")if(q--,d===null)f(5,r,c,v);else{for(;d&&d.parent&&(d.value!="["||d.value=="["&&d.type!="square_bracket");)d=d.parent;if(d&&d.value==="[")d.value="[]";else{f(6,r,c,v);break}}else if(v===
"number"||v==="string"||v==="identifier")if(g=new b.Node(v,c),d===null)d=g;else if(d.type==="operator"||d.type==="compOperator"||d.type==="boolOperator"||d.type==="parentheses"&&d.value==="("||d.type==="square_bracket"&&d.value==="["||d.type==="sign"||d.type==="conditional"||d.type==="assign")d.addChild(g),d=g;else break;else if(v==="operator"||v==="compOperator"||v==="boolOperator")if(g=new b.Node(v,c),d===null)if(c==="-"||c==="+")g.type="sign",g.value="sign"+c,d=g;else if(c==="!")d=g;else{f(8,r,
c,v);break}else if(d.type==="operator"||d.type==="compOperator"||d.type==="boolOperator"||d.type==="assign"||d.type==="conditional"||d.type==="square_bracket"&&d.value==="["&&(c==="-"||c==="+"||c==="!")||d.type==="parentheses"&&d.value==="("&&(c==="-"||c==="+"||c==="!")){if(c==="-"||c==="+")g.type="sign",g.value="sign"+c;d.addChild(g);d=g}else if(d.type==="number"||d.type==="parentheses"&&d.value==="()"||d.type==="square_bracket"&&d.value==="[]"||d.type==="string"||d.type==="identifier"||d.type===
"conditional"||d.type==="assign"){for(;d.parent&&a(d.parent.value)>=a(g.value);)d=d.parent;d.parent&&d.parent.replaceLastChild(g);g.addChild(d);d=g}else{f(9,r,c,v);break}else if(v==="conditional")if(g=new b.Node(v,c),d!=null)if(g.value==="?"){for(n++;d.parent&&a(d.parent.value)>a(g.value);)d=d.parent;d.parent&&d.parent.replaceLastChild(g);g.addChild(d);d=g}else{for(n--;d&&d.parent&&(d.value!="?"||d.value=="?"&&d.type!="conditional");)d=d.parent;if(d&&d.value==="?")d.value="?:";else{f(10,r,c,v);break}}else{f(11,
r,c,v);break}else if(v==="separator")if(d!=null)for(;d.parent&&d.value!="("&&d.value!="[";)d=d.parent;else{f(12,r,c,v);break}else{f(13,r,c,v);break}}e>0&&b.DEBUG.setError(b.DEBUG.PARENTHESIS_CLOSING,r);e<0&&b.DEBUG.setError(b.DEBUG.PARENTHESIS_OPENING,r);q>0&&b.DEBUG.setError(b.DEBUG.BRACKET_CLOSING,r);q<0&&b.DEBUG.setError(b.DEBUG.BRACKET_OPENING,r);n!=0&&b.DEBUG.setError(b.DEBUG.INCOMPLETE_IF,r);(m=d?d.getRoot():null)&&m.setAllEvalFun();return m}registerDefaultValues(){let r=Date.now(),p=this;p.variables._NUM_MAX_ITE_ALG_=
1E5;p.variables.pi=p.variables["\u03c0"]=Math.PI;p.variables.e=Math.E;p.variables.Infinity=Infinity;p.variables["-Infinity"]=-Infinity;p.variables.isTouch=p.variables["esT\u00e1ctil"]=b.hasTouchSupport?1:0;p.variables.device=p.variables.dispositivo=function(){const B=navigator.userAgent;return/(tablet|ipad|playbook|silk)|(android(?!.*mobi))/i.test(B)?"tablet":/Mobile|iP(hone|od)|Android|BlackBerry|IEMobile|Kindle|Silk-Accelerated|(hpw|web)OS|Opera M(obi|ini)/.test(B)?"mobile":"desktop"}();Object.defineProperties(p.variables,
{screenOrientation:{get:function(){return window.matchMedia("(orientation: landscape)").matches?"landscape":"portrait"}},screenWidth:{get:function(){return window.innerWidth}},screenHeight:{get:function(){return window.innerHeight}}});p.variables["DJS.squote"]="\\u0027";p.variables["DJS.comma"]="\\u002C";let x={};p.functions._Eval_=function(B=""){if(B=="")return 0;if(typeof B=="number")return"NaN";var I=B.replace(",",".");/,/.test(B)&&parseFloat(I)==I&&(B=I);if(x[B]==void 0)if(I=B.match(/:=/g)?!0:
!1,/;/.test(B)){let E=!1,P,N=[],U=0;for(let X=0,L=B.length;X<L;X++)P=B[X],P==="'"&&(E=!E),E||P!==";"||(N.push(B.substring(U,X)),U=X+1);N.push(B.substring(U));x[B]=p.parse(`(${N.join(")(")})`,I)}else x[B]=p.parse(B,I);B=p.evaluator.eval(x[B]);return B!=void 0?B:"NaN"};p.functions.sqr=function(B){return B*B};p.functions.sqrt=p.functions["ra\u00edz"]=Math.sqrt;p.functions.exp=Math.exp;p.functions.log=Math.log;p.functions.log10=Math.log10?Math.log10:function(B){return Math.log(B)/Math.log(10)};p.functions.abs=
Math.abs;p.functions.ent=function(B){return Math.trunc(parseFloat(B)+Math.sign(B)*1E-16)};p.functions.sgn=Math.sign;p.functions.ind=function(B){return B?1:0};p.functions.sin=p.functions.sen=Math.sin;p.functions.cos=Math.cos;p.functions.tan=Math.tan;p.functions.cot=function(B){return 1/Math.tan(B)};p.functions.sec=function(B){return 1/Math.cos(B)};p.functions.csc=function(B){return 1/Math.sin(B)};p.functions.sinh=p.functions.senh=Math.sinh?Math.sinh:function(B){return(Math.exp(B)-Math.exp(-B))/2};
p.functions.cosh=Math.cosh?Math.cosh:function(B){return(Math.exp(B)+Math.exp(-B))/2};p.functions.tanh=Math.tanh?Math.tanh:function(B){return(Math.exp(B)-Math.exp(-B))/(Math.exp(B)+Math.exp(-B))};p.functions.coth=function(B){return 1/p.functions.tanh(B)};p.functions.sech=function(B){return 1/p.functions.cosh(B)};p.functions.csch=function(B){return 1/p.functions.sinh(B)};p.functions.asin=p.functions.asen=Math.asin;p.functions.acos=Math.acos;p.functions.atan=Math.atan;p.functions.atan2=Math.atan2;p.functions.floor=
p.functions.piso=Math.floor;p.functions.ceil=p.functions.techo=Math.ceil;p.functions.round=p.functions.redondeo=Math.round;p.functions.trunc=p.functions.truncamiento=Math.trunc;p.functions.min=Math.min;p.functions.max=Math.max;p.functions._Trace_=p.functions._Print_=function(){console.info.apply(console,arguments);return 0};p.functions._Num_=function(B){if(typeof B=="number")return"NaN";B=B.replace(",",".");return parseFloat(B)==B?parseFloat(B):"NaN"};p.functions.isNumber=p.functions["esN\u00famero"]=
function(B){return Number.isFinite(B)?1:0};p.functions.random=p.functions.aleatorio=function(B,I){B=isNaN(parseFloat(B))?0:parseFloat(B);I=isNaN(parseFloat(I))?1:parseFloat(I);B>I&&([B,I]=[I,B]);return B+Math.random()*(I-B)};p.functions._Stop_Audios_=function(){p.evaluator.parent.stopAudios()};window.parent!==window&&(p.functions["parent.set"]=function(B,I){window.parent.postMessage({type:"set",name:B,value:I},"*");return 0},p.functions["parent.update"]=function(){window.parent.postMessage({type:"update"},
"*");return 0},p.functions["parent.exec"]=function(B,I){window.parent.postMessage({type:"exec",name:B,value:I},"*");return 0});p.functions.toFixed=p.functions._NumToStr_=p.functions._NumACadena_=function(B,I){B=isNaN(parseFloat(B))?0:parseFloat(B);return B.toFixed(parseInt(I||0)).replace(".",p.evaluator.parent.decimal_symbol)};p.functions.charAt=p.functions._charAt_=p.functions._letraEn_=function(B,I){B=(B||"").toString();I=isNaN(parseInt(I))?0:parseInt(I);return B.charAt(I)};p.functions.substring=
p.functions._substring_=p.functions._subcadena_=function(B,I,E){B=(B||"").toString();I=isNaN(parseInt(I))?0:parseInt(I);E=isNaN(parseInt(E))?0:parseInt(E);return I>=0&&E>=0?B.substring(I,E):I<0&&E>=0?B.substring(E):E<0&&I>=0?B.substring(I):""};p.functions.strLength=p.functions._length_=p.functions._longitud_=function(B){return(B||"").toString().length};p.functions.indexOf=p.functions._indexOf_=p.functions["_\u00edndiceDe_"]=function(B,I){return(B||"").toString().indexOf((I||"").toString())};p.functions.lastIndexOf=
function(B,I){return(B||"").toString().lastIndexOf((I||"").toString())};p.functions.replace=p.functions._replace_=p.functions._reemplazar_=function(B,I,E){B=(B||"").toString();I=(I||"").toString();E=(E||"").toString();let P=B.indexOf(I);for(;P>=0;)B=B.substring(0,P)+E+B.substring(P+I.length),P=B.indexOf(I,P+E.length);return B};p.functions.toLowerCase=function(B){return(B||"").toString().toLowerCase()};p.functions.toUpperCase=function(B){return(B||"").toString().toUpperCase()};p.functions.trim=function(B){return(B||
"").toString().trim()};p.functions._Load_=function(B){var I="";B&&(I=(I=document.getElementById(B))&&I.type=="descartes/archivo"?I.text:b.openFile(B));return I||""};p.functions._GetValues_=function(B,I){return p.functions._ExecBlock_(p.functions._Load_(B).replace(/&brvbar;/g,String.fromCharCode("166")),I)};p.functions._GetMatrix_=function(B,I){return p.functions._StrToMatrix_(p.functions._Load_(B).replace(/&brvbar;/g,String.fromCharCode("166")),I)};p.functions._MatrixToStr_=function(B){let I=p.matrices[B];
if(I){let E="<"+B+">\\n",P=p.evaluator.getVariable(B+".columnas_usadas")||I.cols||0,N=p.evaluator.getVariable(B+".filas_usadas")||I.rows||0,U;for(let X=0;X<P;X++){for(let L=0;L<N;L++)U=I[X][L],U!==void 0&&(typeof U=="string"?U="'"+U+"'":typeof U=="number"&&(U=b.removeNeedlessDecimals(U.toFixed(6))),E+=U+(L<N-1?" \u00a6 ":""));E=E.replace(/(\u00A6 )$/g,"")+"\\n"}return E+"</"+B+">"}return""};p.functions._StrToMatrix_=function(B,I){let E=[];var P=!1;let N=!1;E.type="matrix";if(B){B=B.replace(/\r|\\r/g,
"").split(/\n|\\n/);for(let U=0,X=B.length;U<X;U++)B[U].match("<"+I+">")?(N=!0,P=B[U].trim().split(`<${I}>`),P.length==2&&P[1]!=""&&E.push(P[1].split(String.fromCharCode("166")).map(h)),P=!0):(B[U].match("</"+I+">")&&(P=B[U].trim().split("</"+I+">"),P.length==2&&P[0]!=""&&E.push(P[0].split(String.fromCharCode("166")).map(h)),P=!1,U=B.length),P&&E.push(B[U].split(String.fromCharCode("166")).map(h)));p.matrices[I]=E;p.matrices[I].rows=E&&E[0]&&E[0].length?E[0].length:0;p.matrices[I].cols=E&&E.length?
E.length:0;p.evaluator.setVariable(I+".filas",p.matrices[I].rows);p.evaluator.setVariable(I+".columnas",p.matrices[I].cols)}return N?"OK":"ERROR"};p.functions._GetVector_=function(B,I){return p.functions._StrToVector_(p.functions._Load_(B),I)};p.functions._VectorToStr_=function(B){let I=p.vectors[B];if(I){let E="<"+B+">\\n",P=p.evaluator.getVariable(B+".long_usada")||I._size_||0,N;for(let U=0;U<P;U++)N=I[U],N!==void 0?(typeof N=="number"&&(N=parseFloat(N)),E+=N+"\\n"):E+="0\\n";return E+"</"+B+">"}return""};
p.functions._StrToVector_=function(B,I){let E=[],P=!1,N=!1;E.type="vector";if(B){B=B.replace(/\r|\\r/g,"").split(/\n|\\n/);for(let U=0,X=B.length;U<X;U++)B[U].match("<"+I+">")?P=N=!0:(B[U].match("</"+I+">")&&(P=!1,U=B.length),P&&E.push(h(B[U])));E._size_=E.length;p.vectors[I]=E;p.evaluator.setVariable(I+".long",E.length);p.evaluator.setVariable(I+".long_usada",E.length)}return N?"OK":"ERROR"};p.functions._ExecStr_=function(B){return p.functions._ExecBlock_(B,"")};p.functions._ExecBlock_=function(B,
I){let E=[];var P=I=="";if(B){B=B.replace(/\r|\\r/g,"").split(/\n|\\n/);for(let N=0,U=B.length;N<U;N++)B[N].match("<"+I+">")?(P=B[N].trim().split("<"+I+">"),P.length==2&&P[1]!=""&&(E=E.concat(P[1].split(String.fromCharCode("166")))),P=!0):B[N].match("</"+I+">")?(P=B[N].trim().split("</"+I+">"),P.length==2&&P[0]!=""&&(E=E.concat(P[0].split(String.fromCharCode("166")))),P=!1):P&&(E=E.concat(B[N].split(String.fromCharCode("166"))));for(let N=0,U=E.length;N<U;N++)P=E[N].split("="),P[0]=P[0].trim(),P.length==
2&&P[0]!=""&&(isNaN(parseFloat(P[1]))?p.evaluator.setVariable(P[0],P[1].trim().replace(/^'|'$/g,"")):p.evaluator.setVariable(P[0],parseFloat(P[1])))}return 0};let u=b.newHTML("a",{target:"_blank"}),z,A=null;b.newBlobContent=null;p.functions._Save_=function(B,I){p.evaluator.parent.removeButtonClick();Date.now()-r>1500&&(r=Date.now(),document.body.appendChild(u),A=I.replace(/\\r/g,"").replace(/\\n/g,"\r\n").replace(/\\q/g,"'").replace(/\\_/g,"\\").replace(/\\br/g,"\\n"),z=new Blob(["\ufeff",A],{type:"text/plain;charset=utf-8"}),
u.setAttribute("href",window.URL.createObjectURL(z)),u.setAttribute("download",B),A!=b.newBlobContent&&(u.click(),b.newBlobContent=A),document.body.removeChild(u));return 0};let w=b.newHTML("a",{target:"_blank"});p.functions._SaveSpace_=function(B,I){p.evaluator.parent.removeButtonClick();Date.now()-r>1500&&(r=Date.now(),document.body.appendChild(w),A=I,w.setAttribute("href",A),w.setAttribute("download",B),A!=b.newBlobContent&&(w.click(),b.newBlobContent=A),document.body.removeChild(w));return 0};
let y,D,F=b.newHTML("input",{type:"file"});F.addEventListener("change",function(B){y=B.target.files;D=new FileReader;D.onload=function(I){b.addExternalFileContent(y[0].name,I.target.result);p.evaluator.setVariable("DJS.fileName",y[0].name);p.evaluator.setVariable("DJS.fileContent",I.target.result);if(I=p.evaluator.getFunction(p._callback))I.apply(p.evaluator,[]),p.evaluator.parent.update();F.value=""};y.length>0&&D.readAsText(y[0])});p.functions._Open_=function(B){p.evaluator.parent.removeButtonClick();
Date.now()-r>1500&&(p._callback=B,F.click(),r=Date.now());return 0};p.functions._AnchoDeCadena_=p.functions._strWidth_=function(B,I,E,P){return b.getTextWidth(B,b.convertFont(I+","+E+","+P))};p.functions.R=p.functions._Rojo_=p.functions._Red_=function(B){return(new b.Color(B)).r/255};p.functions.G=p.functions._Verde_=p.functions._Green_=function(B){return(new b.Color(B)).g/255};p.functions.B=p.functions._Azul_=p.functions._Blue_=function(B){return(new b.Color(B)).b/255};p.functions.HSV2RGB=function(B,
I,E){B<0&&(B+=360);B%=360;I*=E;let P=I*(1-Math.abs(B/60%2-1));E-=I;let N,U,X;0<=B&&B<60?(N=I,U=P,X=0):60<=B&&B<120?(N=P,U=I,X=0):120<=B&&B<180?(N=0,U=I,X=P):180<=B&&B<240?(N=0,U=P,X=I):240<=B&&B<300?(N=P,U=0,X=I):300<=B&&B<360&&(N=I,U=0,X=P);N=Math.round((N+E)*255);U=Math.round((U+E)*255);X=Math.round((X+E)*255);return`${N.toString(16).padStart(2,"0")}${U.toString(16).padStart(2,"0")}${X.toString(16).padStart(2,"0")}`};p.functions["DJS.typeof"]=function(B){return B.rows?"matrix":B._size_?"vector":
typeof B}}}b.Parser=k})(descartesJS);
(b=>{let a=Math.floor;class h{constructor(f){this.parent=f;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}setDefinition(f,l){this.definitions[f]=l}getDefinition(f){return this.definitions[f]}setVariable(f,l){this.variables[f]=l}getVariable(f){return this.variables[f]}setVector(f,l,d){l=l<0?0:a(l);this.vectors[f][l]=d}getVector(f,l){l=
l<0?0:a(l);return this.vectors[f][l]}setMatrix(f,l,d,g){l=l<0?0:a(l);d=d<0?0:a(d);this.matrices[f][l]==void 0&&(this.matrices[f][l]=[]);this.matrices[f][l][d]=g}getMatrix(f,l,d){l=l<0?0:a(l);d=d<0?0:a(d);return this.matrices[f][l][d]}setFunction(f,l){this.functions[f]=l}getFunction(f){return this.functions[f]}eval(f){return f?f.evaluate(this):0}}b.externalEvaluator=new h;b.Evaluator=h})(descartesJS);
(b=>{let a,h,f,l,d,g,e,q,n,t,c,v,m,k,r,p;class x{constructor(u,z){a=this;a.parent=u;a.evaluator=u.evaluator;a.decimals=u.decimals;a.fixed=u.fixed;a.align=u.align||"left";a.anchor=u.anchor||"a_top_left";a.decimal_symbol=u.parent.decimal_symbol;a.w=a.h=100;a.hasContent=z!=="";a.textStr=(z||"").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(z)?(a.type="rtfNode",a.text=z,a.textNodes=(new b.RTFParser(u.evaluator)).parse(z.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)}drawText(u,z,A,w,y){a=this;h=a.evaluator.eval(a.decimals);f=a.evaluator.eval(a.parent.width);l=a.evaluator.eval(a.parent.font_size);d=z.getColor?z.getColor():z;g=a.textToString(a.text,h,a.fixed).replace(/\\{/g,
"\\curlyBracketOpen ").replace(/\\}/g,"\\curlyBracketClose ").replace(/\\\[/g,"\\squareBracketOpen ").replace(/\\\]/g,"\\squareBracketClose ");g.indexOf("[")>=0&&(g=a.textToString(a.parseSimpleText(g),h,a.fixed));if(a.oldTextStr!==g||a.oldWidth!==f||a.oldSize!==l||a.oldColor!==d||a.oldPosX!==A||a.oldPoxY!==w)e=new b.TextStyle({size:l,family:a.parent.font_family||"arial",italic:a.parent.italics||!1,bold:a.parent.bold||!1,color:d,align:a.align,border:a.parent.border,border_size:a.parent.border_size,
shadowBlur:a.parent.shadowBlur,shadowOffsetX:a.parent.shadowOffsetX,shadowOffsetY:a.parent.shadowOffsetY,shadowColor:a.parent.shadowColor||"transparent"}),a.textNodes=a.descarTeXParser.parse(g,a.evaluator,e),a.textNodes.update(A,w,h,a.fixed,a.align,a.anchor,d,f);y||a.textNodes.draw(u);a.oldTextStr=g;a.oldWidth=f;a.oldSize=l;a.oldColor=d;a.oldPosX=A;a.oldPoxY=w}drawRTF(u,z,A,w,y){z=z.getColor?z.getColor():z;u.fillStyle=u.strokeStyle=z;u.textBaseline="alphabetic";this.textNodes.style.align!==this.align&&
this.textNodes.propagateStyle("align",this.align);this.textNodes.update(A,w,this.evaluator.eval(this.decimals),this.fixed,this.align,this.anchor,z,this.evaluator.eval(this.parent.width));y||this.textNodes.draw(u)}parseSimpleText(u){u=u.replace("&#x2013","\u2013").replace(/&squot;/g,"'");q=[];n="'";c=t=0;v=-1;for(r=u.length;t<r;)m=u.charAt(t),k=u.charAt(t-1),m==="["&&k==="\\"?(q.push(u.substring(c,t-1)+"["),c=t+1):m==="]"&&k==="\\"?(q.push(u.substring(c,t-1)+"]"),c=t+1):m==="["&&v===-1?(q.push(u.substring(c,
t)),c=t,v++):m==="["?v++:m==="]"&&v===0?(q.push(this.evaluator.parser.parse(u.substring(c,t+1))),c=t+1,v--):(u.charAt(t)=="]"&&(v=v<0?v:v-1),n+=u.charAt(t)),t++;q.push(u.substring(c,t));return q}textToString(u,z,A){n="";if(u.type!=="rtfNode")for(let w=0,y=u.length;w<y;w++)typeof u[w]==="string"?n+=u[w]:(p=this.evaluator.eval(u[w])[0][0],p!==""&&(typeof p==="string"?n+=p:p===Infinity?n+="Infinity":p===-Infinity?n+="-Infinity":isNaN(p)||p==="NaN"?n+="NaN":(p=parseFloat(p),p=A?p.toFixed(z):b.removeNeedlessDecimals(p.toFixed(z)),
n+=p.toString().replace(".",this.decimal_symbol))));return n}}b.TextObject=x})(descartesJS);
(b=>{var a;class h{constructor(){}tokenize(f){f=f.replace(/\\n/g,"\\newline ");var l=[],d=null,g=0,e=f.length;f.charAt(0);var q=!1,n=!1,t=0;a="";for(var c=0;c<e;c++){var v=f.charAt(c);var m=f.charAt(c+1);v==="\\"&&m==="$"&&(n=!0);v==="{"?t++:v==="}"&&(t--,n&&t===0&&(n=!1));n?v==="_"?m==="{"?a+="\\subindex":(a+="\\subindex{"+m+"}",c++):v==="^"?m==="{"?a+="\\superindex":(a+="\\superindex{"+m+"}",c++):a+=v:a+=v}f=a;m=f.charAt(0);for(e=f.length;g<e;)v=m,m=f.charAt(g+1),q&&(v==="{"||v==="["||v==="\\"||
v===" "?(q=!1,v===" "&&(d={type:"ignore"},l.push(d))):d.value+=v),q||v!=="\\"?q||v!=="{"&&v!=="["?q||v!=="}"&&v!=="]"?q||(d&&d.type==="text"?d.value+=v:d&&d.type==="ignore"?(l.pop(),d=l[l.length-1]):(d={type:"text",value:v},l.push(d))):(d={type:"close",value:v},l.push(d)):(d={type:"open",value:v},l.push(d)):(q=!0,d={type:"command",value:""},l.push(d)),g++;return l}}b.DescarTeXTokenizer=h})(descartesJS);
(b=>{class a{constructor(){this.tokenizer=new b.DescarTeXTokenizer}parse(h,f,l){h=this.tokenizer.tokenize(h);var d=new b.TextNode("","textBlock",l,null),g=new b.TextNode("","textLineBlock",l.clone(),null);d.addChild(g);for(var e=[],q=void 0,n=l,t=[l],c,v,m,k,r=!1,p=0,x=h.length;p<x;p++)if(h[p].type==="text")if(q==="color_parameter")v=new b.Color(h[p].value,f);else if(q==="text_size_parameter")m=parseFloat(h[p].value);else if(g.nodeType==="textLineBlock"){c=h[p].value.split(" ");for(var u=0,z=c.length;u<
z;u++)c[u]!==""&&g.addChild(new b.TextNode(c[u],"text",n.clone(),null)),u+1<z&&g.addChild(new b.TextNode(" ","space",n.clone(),null))}else g.addChild(new b.TextNode(h[p].value,"text",n.clone(),null));else h[p].type==="command"&&h[p].value==="curlyBracketOpen"?g.addChild(new b.TextNode("{","text",n.clone(),null)):h[p].type==="command"&&h[p].value==="curlyBracketClose"?g.addChild(new b.TextNode("}","text",n.clone(),null)):h[p].type==="command"&&h[p].value==="squareBracketOpen"?g.addChild(new b.TextNode("[",
"text",n.clone(),null)):h[p].type==="command"&&h[p].value==="squareBracketClose"?g.addChild(new b.TextNode("]","text",n.clone(),null)):h[p].type==="command"&&h[p].value==="newline"?(g.children.length===0&&g.addChild(new b.TextNode("","text",n.clone(),null)),g=new b.TextNode("","textLineBlock",l.clone(),null),d.addChild(g)):h[p].type==="command"&&h[p].value==="b"?(q="bold",e.push(q)):h[p].type==="command"&&h[p].value==="i"?(q="italic",e.push(q)):h[p].type==="command"&&h[p].value==="o"?(q="overline",
e.push(q)):h[p].type==="command"&&h[p].value==="u"?(q="underline",e.push(q)):h[p].type==="command"&&h[p].value==="color"?(q="color",e.push(q)):h[p].type==="command"&&h[p].value==="ts"?(q="text_size",e.push(q)):h[p].type==="command"&&h[p].value.toLowerCase()==="sansserif"?(q="sansserif",e.push(q)):h[p].type==="command"&&h[p].value.toLowerCase()==="serif"?(q="serif",e.push(q)):h[p].type==="command"&&h[p].value.toLowerCase()==="monospace"?(q="monospace",e.push(q)):h[p].type==="command"&&h[p].value===
"c"?(q="center",e.push(q)):h[p].type==="command"&&h[p].value==="l"?(q="left",e.push(q)):h[p].type==="command"&&h[p].value==="r"?(q="right",e.push(q)):h[p].type==="command"&&h[p].value==="j"?(q="justify",e.push(q)):h[p].type==="command"&&h[p].value==="$"?(q="formula",e.push(q),r=!0):h[p].type==="command"&&h[p].value==="sum"?(q="sum",e.push(q)):h[p].type==="command"&&h[p].value==="prod"?(q="prod",e.push(q)):h[p].type==="command"&&h[p].value==="int"?(q="integral",e.push(q)):h[p].type==="command"&&h[p].value===
"lim"?(q="limit",e.push(q)):h[p].type==="command"&&h[p].value==="sqrt"?(q="radical",e.push(q)):h[p].type==="command"&&h[p].value==="subindex"?(q="subIndex",e.push(q)):h[p].type==="command"&&h[p].value==="superindex"?(q="superIndex",e.push(q)):h[p].type==="command"&&h[p].value==="frac"?(q="numerator",e.push(q)):h[p].type==="open"&&h[p].value==="{"&&q!==void 0?q==="bold"||q==="italic"||q==="overline"||q==="underline"?(n=n.clone(),n[q]=!0,t.push(n)):q==="sansserif"?(n=n.clone(),n.family="sansserif",
t.push(n)):q==="serif"?(n=n.clone(),n.family="serif",t.push(n)):q==="monospace"?(n=n.clone(),n.family="monospaced",t.push(n)):q==="text_size"?q="text_size_parameter":q==="text_size_text"?(n=n.clone(),n.size=m,t.push(n)):q==="color"?q="color_parameter":q==="color_text"?(n=n.clone(),n.color=v,t.push(n)):q==="center"||q==="left"||q==="right"||q==="justify"?(n=n.clone(),n.align=q,t.push(n),g=new b.TextNode("","textLineBlock",n.clone(),null),d.addChild(g)):q==="formula"?(n=n.clone(),t.push(n),k=new b.TextNode("",
"formula",n.clone(),null),g.addChild(k),g=k):q==="subIndex"||q==="superIndex"?r?(n=n.clone(),t.push(n),k=new b.TextNode("",q,n.clone(),null),g.addChild(k),g=k):g.addChild(new b.TextNode(q==="subIndex"?"_":"^","text",n.clone(),null)):q==="radical"?r&&(k=new b.TextNode("","radical",n.clone(),null),g.addChild(k),g=k,n=n.clone(),t.push(n),k=new b.TextNode("","index",n.clone(),null),g.addChild(k),g=k,q="index"):q==="index"?r&&(t.pop(),n=t[t.length-1],k=new b.TextNode("","radicand",n.clone(),null),g.addChild(k),
g=k,q="radicand"):q==="sum"||q==="integral"||q==="limit"||q==="prod"?r&&(k=new b.TextNode("",q,n.clone(),null),g.addChild(k),g=k,n=n.clone(),t.push(n),k=new b.TextNode("","from",n.clone(),null),g.addChild(k),g=k,q="from",e[e.length-1]=q):q==="from"?r&&(k=new b.TextNode("","to",n.clone(),null),g.addChild(k),g=k,q="to",e[e.length-1]=q):q==="to"?r&&(t.pop(),n=t[t.length-1],k=new b.TextNode("","what",n.clone(),null),g.addChild(k),g=k,q="what",e[e.length-1]=q):q==="numerator"?r&&(k=new b.TextNode("","fraction",
n.clone(),null),g.addChild(k),g=k,n=n.clone(),t.push(n),k=new b.TextNode("","numerator",n.clone(),null),g.addChild(k),g=k,q="numerator"):q==="denominator"&&(k=new b.TextNode("",q,n.clone(),null),g.addChild(k),g=k):h[p].type==="close"&&h[p].value==="}"&&q!==void 0&&(q==="bold"||q==="italic"||q==="overline"||q==="underline"||q==="color_text"||q==="color"||q==="text_size_text"||q==="text_size"||q==="sansserif"||q==="serif"||q==="monospace"?(t.pop(),n=t[t.length-1],e.pop(),q=e[e.length-1]):q==="color_parameter"?
q="color_text":q==="text_size_parameter"?q="text_size_text":q==="center"||q==="left"||q==="right"||q==="justify"?(t.pop(),n=t[t.length-1],e.pop(),q=e[e.length-1],h[p+1]&&h[p+1].type==="command"&&h[p+1].value==="newline"?g=d:(g=new b.TextNode("","textLineBlock",n.clone(),null),d.addChild(g))):g.nodeType==="formula"?(r=!1,t.pop(),n=t[t.length-1],e.pop(),q=e[e.length-1],g=g.parent):g.nodeType==="subIndex"||g.nodeType==="superIndex"?r&&(t.pop(),n=t[t.length-1],e.pop(),q=e[e.length-1],g=g.parent):g.nodeType===
"index"?g=g.parent:g.nodeType==="radicand"?(e.pop(),q=e[e.length-1],g=g.parent.parent):g.nodeType==="from"?g=g.parent:g.nodeType==="to"?g=g.parent:g.nodeType==="what"?(e.pop(),q=e[e.length-1],g=g.parent.parent):g.nodeType==="numerator"?(q="denominator",g=g.parent):g.nodeType==="denominator"&&(t.pop(),n=t[t.length-1],e.pop(),q=e[e.length-1],g=g.parent.parent));var A,w,y=null,D=[];d.children.forEach(function(F){for(var B=0,I=F.children.length;B<I-1;B++)A=F.children[B],w=F.children[B+1],A.nodeType===
"text"&&w.nodeType==="text"&&A.style.equals(w.style)?(y===null&&(y=A,k=A.clone(),y.changeNodeType("word"),y.value="___"+k.value,y.addChild(k)),k=w.clone(),y.addChild(k),D.push(w),y.value+=k.value):y=null});D.forEach(function(F){F.parent.removeChild(F)});d.normalize();d.adjustFontSize();return d}}b.DescarTeXParser=a})(descartesJS);
(b=>{var a;class h{constructor(f){this.size=20;this.family="Arimo";this.overline=this.underline=this.bold=this.italic=!1;this.border=this.color=null;this.align="left";f=f||{};this.set(f)}clone(){return new h(Object.assign({},this))}set(f){Object.assign(this,f);this.math_str=this.str=null}equals(f){var l=!0,d;for(d in this)this.hasOwnProperty(d)&&(l=l&&this[d]===f[d]);return l}toString(f){if(f)return this.math_str||(this.math_str=this.toStringAux(f)),this.math_str;this.str||(this.str=this.toStringAux(f));
return this.str}toStringAux(f){/arial|sansserif/i.test(this.family)?a=b.sansserif_font:/times|serif/i.test(this.family)?a=f?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}}b.TextStyle=h})(descartesJS);
(b=>{function a(m,k){let r=0;for(let p=0;p<k;p++)r+=m[p];return r}function h(m){let k={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(m.trim()=="")return k;var r=parseInt(m.match(/[\d\.]+px/)[0]);m=m.includes("sansserif")?"sansserif":m.includes("serif")?"serif":"monospace";r/=v[m].unitsPerEm;k.ascent=Math.ceil((v[m].ascent+25)*r);k.descent=Math.ceil(Math.abs((v[m].descent-25)*r));k.h=k.ascent+k.descent;return k}let f=!1,l="#000000",d=2,g=!1,e;
const q="textLineBlock formula numerator denominator superIndex subIndex index radicand from to what element".split(" "),n="formula fraction superIndex subIndex radical sum integral prod limit matrix defparts dynamicText componentNumCtrl componentSpace".split(" "),t={textBlock:"drawTextBlock",textLineBlock:"drawTextLineBlock",formula:"drawFormula",superIndex:"drawSuperIndex",subIndex:"drawSubIndex",dynamicText:"drawDynamicText",fraction:"drawFraction",numerator:"drawNumDen",denominator:"drawNumDen",
radical:"drawRadical",limit:"drawLimit",integral:"drawIntegral",prod:"drawProd",sum:"drawSum",matrix:"drawMatrix",defparts:"drawDefparts",text:"drawText",newLine:"drawText",mathSymbol:"drawText",space:"drawSpace",word:"drawWord",hyperlink:"drawHyperlink",index:"drawGenericBlock",radicand:"drawGenericBlock",from:"drawGenericBlock",to:"drawGenericBlock",what:"drawGenericBlock",element:"drawGenericBlock",componentNumCtrl:"drawComponentNumCtrl",componentSpace:"drawComponentSpace"};class c{constructor(m,
k,r,p){this.type="rtfNode";this.evaluator=p;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=m;this.style=r;this.changeNodeType(k);this.drawBorder=b.in_editor?this.drawBorderSpecial:()=>{}}changeNodeType(m){this.nodeType=m;this.draw=this[t[m]||"drawText"];this.nodeType==="dynamicText"&&(this.decimal_symbol=this.evaluator.parent.decimal_symbol)}clone(){let m=new c(this.value,this.nodeType,this.style.clone());
for(let k of this.children)m.addChild(k.clone());return m}toStr(){let m=this.value;for(let k of this.children)m+=" "+k.toStr();return m}stringify(){let m=`{"NT":"${this.nodeType}", "V":"${this.value||""}", "C":[`;for(let k=0,r=this.children.length;k<r;k++)m+=this.children[k].stringify()+(k==r-1?"":",");return m+`], "S":${JSON.stringify(this.style)}}`}addChild(m,k){k&&m.parent!==null&&m.parent.removeChild(m);m.parent=this;this.children.push(m)}removeChild(m){let k=this.children.indexOf(m);k!=-1&&(m.parent=
null,this.children.splice(k,1))}getFirstTextNode(){let m=this;for(;m.children.length>0;)m=m.children[0];return m}getLastTextNode(){let m=this;for(;m.children.length>0;)m=m.children[m.children.length-1];return m}nextSibling(){if(!this.parent)return null;const m=this.parent.children.indexOf(this);return m!==-1&&m<this.parent.children.length-1?this.parent.children[m+1]:null}prevSibling(){if(!this.parent)return null;const m=this.parent.children.indexOf(this);return m>0?this.parent.children[m-1]:null}queryAll(m){let k=
[];for(let r of this.children)k.push(...r.queryAll(m));m.includes(this.nodeType)&&k.push(this);return k}insertBefore(m,k){m=this.children.indexOf(m);m!=-1&&(k.parent=this,this.children.splice(m,0,k))}insertAfter(m,k){m=this.children.indexOf(m);m!=-1&&(k.parent=this,this.children.splice(m+1,0,k))}normalize(){var m=this.queryAll(q);for(let k of m)k.children.length==0&&k.addChild(new c("","text",k.style));for(let k of this.queryAll(n))m=k.prevSibling(),(m===null||m!==null&&m.nodeType!="text")&&k.parent.insertBefore(k,
new c("","text",k.parent.style)),m=k.nextSibling(),(m===null||m!==null&&m.nodeType!="text")&&k.parent.insertAfter(k,new c("","text",k.parent.style));return this}removeEmptyText(){for(let m of this.queryAll(["text"]))m.value==""&&m.parent&&m.parent.removeChild(m)}adjustFontSize(m){let k=this.style.size;this.nodeType=="formula"&&(m=!0);for(let r of this.children)if(r.nodeType=="text"&&m)r.style.size=k,r.styleString=r.style.toString();else if("index to from numerator denominator subIndex superIndex".split(" ").includes(r.nodeType)){if(r.nodeType==
"index")r.style.size=Math.max(parseInt(k-k*.5),8);else if(r.nodeType=="to"||r.nodeType=="from")r.style.size=Math.max(parseInt(k-k*.2),8);else if(r.nodeType=="numerator"||r.nodeType=="denominator")r.style.size=Math.max(parseInt(k-k*.1),8);else if(r.nodeType==="subIndex"||r.nodeType==="superIndex")r.style.size=Math.max(parseInt(k-k*.33),8);r.styleString=r.style.toString();r.adjustFontSize(!0)}else m&&(r.style.size=k,r.styleString=r.style.toString()),r.adjustFontSize(m)}propagateStyle(m,k){this.style[m]=
k;this.styleString=this.style.toString();for(let r of this.children)r.propagateStyle(m,k)}update(m,k,r,p,x,u,z,A){d=r;g=p;l=z;this.metrics.w=this.metrics.h=0;r=k;if(A>=20)for(p=0;p<this.children.length;p++)this.children[p].breakLines(A);for(var w of this.children)w.updateLine(),w.metrics.offsetX=m,w.metrics.y=k,k+=parseInt(w.metrics.ascent+.5),w.metrics.offsetY=k,k+=parseInt(w.metrics.descent+.5)+parseInt(1.5+w.style.size*.05),this.metrics.h+=w.metrics.h,this.metrics.w=Math.max(this.metrics.w,w.metrics.w),
this.style.align=="justify"&&(this.metrics.w=Math.max(this.metrics.w,A));k=r;u=u||"";u.includes("right")?m-=this.metrics.w:u.includes("_center")&&(m-=this.metrics.w/2);u.includes("bottom")?k-=this.metrics.h:u.includes("center_")&&(k-=this.metrics.h/2);u=this.children;for(let y=0,D=u.length;y<D;y++)u[y].style.align=="left"?u[y].metrics.offsetX=m:u[y].style.align=="right"?u[y].metrics.offsetX=m+this.metrics.w-u[y].metrics.w:u[y].style.align=="center"?u[y].metrics.offsetX=m+(this.metrics.w-u[y].metrics.w)/
2:u[y].style.align=="justify"&&A>=20&&(w=y<D-1?u[y+1].value:null,u[y].metrics.offsetX=m,w=="wrap"&&u[y].justifyAux(A)),u[y].metrics.y=k,k+=parseInt(u[y].metrics.ascent+.5),u[y].metrics.offsetY=k,k+=parseInt(u[y].metrics.descent+.5)+parseInt(1.5+u[y].style.size*.05)}breakLines(m){let k,r=0,p=!1,x=[],u=this.style.align=="justify"?this.style.size/5:0;for(let z=0,A=this.children.length;z<A;z++)k=this.children[z],p?x.push(k):(k.nodeType=="text"||k.nodeType=="space"?k.metrics.w=b.getTextWidth(k.value,k.style.toString()):
k.nodeType=="word"?k.updateLine():k.nodeType=="formula"&&k.updateFormula(),r+=k.metrics.w,r>m+u&&k.nodeType!="space"&&z>0&&(p=!0,x.push(k)));if(x.length>0){m=new c("wrap","textLineBlock",this.style.clone(),null);this.parent.insertAfter(this,m);for(let z of x)z.parent&&z.parent.removeChild(z),m.addChild(z)}}updateLine(m){let k=this;if(this.nodeType=="textLineBlock"||this.nodeType=="word"){let p=this.metrics.w=this.metrics.ascent=this.metrics.descent=0,x=this.children,u;for(let z=0,A=x.length;z<A;z++){u=
x[z];if(u.nodeType=="text"){e=u.style.toString();var r=u.value!==""?u.value:b.in_editor?"\u200a":"";u.metrics=h(e);u.metrics.w=b.getTextWidth(r,e);u.metrics.offsetX=p;Object.defineProperties(u.metrics,{x:{get:function(){return k.metrics.offsetX+this.offsetX}},y:{get:function(){return k.metrics.offsetY+this.offsetY}}})}u.nodeType=="space"?(e=u.style.toString(),u.metrics=h(e),u.metrics.w=z==A-1?0:m?m:b.getTextWidth(" ",e),u.metrics.offsetX=p,Object.defineProperties(u.metrics,{x:{get:function(){return k.metrics.offsetX+
this.offsetX}},y:{get:function(){return k.metrics.offsetY+this.offsetY}}})):u.nodeType=="word"&&(u.updateLine(),u.metrics.offsetX_aux=p,Object.defineProperties(u.metrics,{offsetX:{get:function(){return k.metrics.offsetX+this.offsetX_aux}},offsetY:{get:function(){return k.metrics.offsetY}}}));u.nodeType=="hyperlink"&&(e=u.styleString,r=u.value!==""?u.value:b.in_editor?"\u200a":"",u.metrics=h(e),u.metrics.w=b.getTextWidth(r,e),u.metrics.offsetX=p,Object.defineProperties(u.metrics,{x:{get:function(){return k.metrics.offsetX+
this.offsetX}},y:{get:function(){return k.metrics.offsetY}}}),u.clickCatcher||(u.clickCatcher=b.newHTML("div",{style:`position:absolute;width:${u.metrics.w}px;height:${u.metrics.h}px;cursor:pointer;`}),u.clickCatcher.rtfNode=u,u.clickCatcher.action=new b.OpenURL(this.evaluator.parent,u.URL),u.clickCatcher.addEventListener("click",function(){this.rtfNode.click=!0;this.action.execute();this.rtfNode.draw(this.rtfNode.ctx)})));u.nodeType=="componentNumCtrl"&&(u.componentNumCtrl=this.evaluator.parent.getControlByCId(u.value),
u.metrics=h(u.styleString),u.metrics.w=u.componentNumCtrl.w,u.metrics.h=u.componentNumCtrl.h,u.metrics.offsetX=p,Object.defineProperties(u.metrics,{x:{get:function(){return k.metrics.offsetX+this.offsetX}},y:{get:function(){return k.metrics.offsetY}}}));u.nodeType=="componentSpace"?(u.componentSpace=this.evaluator.parent.getSpaceByCId(u.value),u.metrics=h(u.styleString),u.metrics.w=u.componentSpace.w,u.metrics.h=u.componentSpace.h,u.metrics.offsetX=p,Object.defineProperties(u.metrics,{x:{get:function(){return k.metrics.offsetX+
this.offsetX}},y:{get:function(){return k.metrics.offsetY}}})):u.nodeType=="formula"&&(u.updateFormula(),u.metrics.marginX=u.metrics.marginY=u.metrics.paddingX=u.metrics.paddingY=0,u.metrics.offsetX_aux=p,Object.defineProperties(u.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return k.metrics.offsetX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return k.metrics.offsetY}}}),u.metrics.w+=2*u.metrics.paddingX,u.metrics.ascent+=
u.metrics.paddingY,u.metrics.descent+=u.metrics.paddingY,u.metrics.h+=2*u.metrics.paddingY,p+=2*u.metrics.marginX);this.metrics.w+=u.metrics.w+2*u.metrics.marginX;this.metrics.ascent=Math.max(this.metrics.ascent,u.metrics.ascent);this.metrics.descent=Math.max(this.metrics.descent,u.metrics.descent);p+=u.metrics.w}this.metrics.h=this.metrics.ascent+this.metrics.descent}}updateFormula(){let m=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};
let k=this.children,r,p=0;var x={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(let E=0,P=k.length;E<P;E++){r=k[E];if(r.nodeType=="text"){e=r.style.toString(!0);var u=r.value!==""?r.value:b.in_editor?"\u200a":"";r.metrics=h(e);r.metrics.w=b.getTextWidth(u,e);r.metrics.offsetX=p;Object.defineProperties(r.metrics,{x:{get:function(){return m.metrics.offsetX+m.metrics.paddingX+this.offsetX}},y:{get:function(){return m.metrics.offsetY}}});
p+=m.metrics.marginX}else if(r.nodeType=="dynamicText"){u=r.decimals===void 0?d:r.evaluator.eval(r.decimals);var z=r.fixed===void 0?g:r.fixed,A=r.evaluator.eval(r.value);""+parseFloat(A)===""+A&&(A=z?parseFloat(A).toFixed(u):b.removeNeedlessDecimals(parseFloat(A).toFixed(u)),A=(""+A).replace(".",r.decimal_symbol));r.evalValue=A;e=r.style.toString(!0);r.metrics=h(e);r.metrics.marginX=r.metrics.paddingX=0;r.metrics.w=b.getTextWidth(A,e)+2*r.metrics.paddingX;r.metrics.offsetX_aux=p;Object.defineProperties(r.metrics,
{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return m.metrics.offsetX+m.metrics.paddingX+this.offsetX_aux+this.marginX}},offsetY:{get:function(){return m.metrics.offsetY}}});p+=2*r.metrics.marginX}if(r.nodeType=="superIndex")u=r,u.updateFormula(),u.metrics.marginX=u.metrics.paddingX=u.metrics.paddingY=0,u.metrics.offsetX_aux=p,u.metrics.prevChild=x,Object.defineProperties(u.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},
offsetX:{get:function(){return m.metrics.offsetX+m.metrics.paddingX+this.offsetX_aux+this.marginX}},offsetY:{get:function(){return m.metrics.offsetY+this.ascent+(this.prevChild.metrics.descent-this.prevChild.metrics.ascent)/2-this.h}}}),u.metrics.w+=2*u.metrics.paddingX,u.metrics.ascent+=u.metrics.paddingY,u.metrics.descent+=u.metrics.paddingY,u.metrics.h+=2*u.metrics.paddingY,u.metrics.tmp_ascent=u.metrics.h+(u.metrics.prevChild.metrics.ascent-u.metrics.prevChild.metrics.descent)/2,p+=2*u.metrics.marginX;
else if(r.nodeType=="subIndex")u=r,u.updateFormula(),u.metrics.marginX=u.metrics.paddingX=u.metrics.paddingY=0,u.metrics.offsetX_aux=p,u.metrics.prevChild=x,Object.defineProperties(u.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return m.metrics.offsetX+m.metrics.paddingX+this.offsetX_aux}},offsetY:{get:function(){return m.metrics.offsetY+this.ascent+(this.prevChild.metrics.descent-this.prevChild.metrics.ascent)/2}}}),u.metrics.w+=
u.metrics.paddingX,u.metrics.ascent+=u.metrics.paddingY,u.metrics.descent+=u.metrics.paddingY,u.metrics.h+=2*u.metrics.paddingY,this.metrics.descent=u.metrics.ascent+(u.metrics.prevChild.metrics.descent-u.metrics.prevChild.metrics.ascent)/2+u.metrics.descent,p+=u.metrics.marginX;else if(r.nodeType=="fraction"){u=r;u.updateFormula();A=u.children;z=A[0];A=A[1];u.metrics.marginX=parseInt(.5+this.style.size*.075);u.metrics.paddingX=u.metrics.paddingY=0;var w=Math.max(z.metrics.w,A.metrics.w)+2*u.metrics.paddingX;
u.metrics.prevChild=x;u.metrics.offsetX_aux=p;let N=parseInt(-x.metrics.descent+4*x.metrics.h/9);Object.defineProperties(u.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY+N}},offsetX:{get:function(){return m.metrics.offsetX+m.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return m.metrics.offsetY-N}}});Object.defineProperties(z.metrics,{parent:{value:u},maxWidth:{value:w},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},
offsetX:{get:function(){return this.parent.metrics.offsetX+parseInt((this.maxWidth-this.w)/2)}},offsetY:{get:function(){return this.parent.metrics.offsetY-this.descent-this.parent.metrics.paddingY}}});Object.defineProperties(A.metrics,{parent:{value:u},maxWidth:{value:w},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+parseInt((this.maxWidth-this.w)/2)}},offsetY:{get:function(){return this.parent.metrics.offsetY+
this.ascent+this.parent.metrics.paddingY}}});u.metrics.w=w;u.metrics.ascent=z.metrics.h+N+2*u.metrics.paddingY;u.metrics.descent=A.metrics.h-N+2*u.metrics.paddingY;u.metrics.h=z.metrics.h+A.metrics.h+4*u.metrics.paddingY;p+=2*u.metrics.marginX}else if(r.nodeType=="radical"){x=r;x.updateFormula();z=x.children;u=z[0];let N=z[1];x.metrics.marginX=parseInt(1.5+this.style.size*.075);x.metrics.paddingX=parseInt(1.5+this.style.size*.075);x.metrics.paddingY=parseInt(1.5+this.style.size*.05);x.metrics.offsetX_aux=
p;Object.defineProperties(x.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return m.metrics.offsetX+m.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return m.metrics.offsetY}}});z=x.style.size;x.radicalSign={w:z,scaleX:z/722,scaleY:N.metrics.h/1E3};A=parseInt(u.metrics.w-2*x.radicalSign.w/3);Object.defineProperties(x.radicalSign,{parent:{value:x},displaceIndex:{value:A},x:{get:function(){return this.parent.metrics.offsetX+
this.parent.metrics.paddingX+Math.max(this.displaceIndex,0)}},y:{get:function(){return m.metrics.offsetY-N.metrics.ascent}}});Object.defineProperties(u.metrics,{parent:{value:x},displaceIndex:{value:A},fontSize:{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+Math.max(this.displaceIndex,0)-this.displaceIndex}},offsetY:{get:function(){return m.metrics.offsetY-this.descent-
2*this.fontSize/5}}});Object.defineProperties(N.metrics,{parent:{value:x},displaceIndex:{value:A},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 m.metrics.offsetY}}});A=u.metrics.w<2*x.radicalSign.w/3?x.radicalSign.w:parseInt(u.metrics.w+x.radicalSign.w/3);x.metrics.w=A+2*x.metrics.paddingX+
N.metrics.w;x.metrics.ascent=Math.max(N.metrics.ascent,u.metrics.h+2*z/5)+x.metrics.paddingY;x.metrics.descent=N.metrics.descent+x.metrics.paddingY;x.metrics.h=x.metrics.ascent+x.metrics.descent;p+=2*x.metrics.marginX}else if(r.nodeType=="sum"){x=r;x.updateFormula();A=x.children;u=A[0];z=A[1];A=A[2];x.metrics.marginX=parseInt(1.5+this.style.size*.075);x.metrics.paddingX=parseInt(1.5+this.style.size*.075);x.metrics.paddingY=parseInt(1.5+this.style.size*.05);x.metrics.offsetX_aux=p;Object.defineProperties(x.metrics,
{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return m.metrics.offsetX+m.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return m.metrics.offsetY}}});let N=h(r.style.toString());w=parseInt(N.h*1.2);var y=parseInt(.5+w*780/1E3);x.sigmaSign={w:y,h:w,scale:w/1E3};y=Math.max(z.metrics.w,u.metrics.w,x.sigmaSign.w);x.sigmaSign.parent=x;Object.defineProperties(x.sigmaSign,{sumWidth:{value:y},x:{get:function(){return this.parent.metrics.offsetX+
this.parent.metrics.paddingX+parseInt((this.sumWidth-this.w)/2)}},y:{get:function(){return m.metrics.offsetY+N.descent-(this.h+N.h)/2}}});var D=N.descent-z.metrics.descent-(w+N.h)/2-x.metrics.paddingY;Object.defineProperties(z.metrics,{parent:{value:x},sumWidth:{value:y},newBaselineTo:{value:D},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 m.metrics.offsetY+this.newBaselineTo}}});w=u.metrics.ascent+N.descent+(w-N.h)/2+x.metrics.paddingY;Object.defineProperties(u.metrics,{parent:{value:x},sumWidth:{value:y},newBaselineFrom:{value:w},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.sumWidth-this.w)/2)}},offsetY:{get:function(){return m.metrics.offsetY+this.newBaselineFrom}}});
Object.defineProperties(A.metrics,{parent:{value:x},sumWidth:{value:y},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 m.metrics.offsetY}}});x.metrics.w=y+A.metrics.w+3*x.metrics.paddingX;x.metrics.ascent=Math.max(A.metrics.ascent,-D+z.metrics.ascent)+x.metrics.paddingY;x.metrics.descent=Math.max(A.metrics.descent,w+u.metrics.descent)+
x.metrics.paddingY;x.metrics.h=x.metrics.ascent+x.metrics.descent;p+=2*x.metrics.marginX}else if(r.nodeType=="integral"){x=r;x.updateFormula();A=x.children;u=A[0];z=A[1];A=A[2];x.metrics.marginX=parseInt(1.5+this.style.size*.075);x.metrics.paddingX=parseInt(1.5+this.style.size*.075);x.metrics.paddingY=parseInt(1.5+this.style.size*.05);x.metrics.offsetX_aux=p;Object.defineProperties(x.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return m.metrics.offsetX+
m.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return m.metrics.offsetY}}});let N=h(r.style.toString());w=parseInt(N.h*1.2);var F=parseInt(10.5+w*529/1E3);x.sign={w:F,h:w,scale:w/1E3};x.sign.parent=x;Object.defineProperties(x.sign,{x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX}},y:{get:function(){return m.metrics.offsetY+N.descent-(this.h+N.h)/2}}});y=N.descent-(w+N.h)/2-z.metrics.descent+w/3;Object.defineProperties(z.metrics,{parent:{value:x},
integralWidth:{value:F},newBaselineTo:{value:y},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt(4*this.integralWidth/5)}},offsetY:{get:function(){return m.metrics.offsetY+this.newBaselineTo}}});D=N.descent+u.metrics.ascent/2;Object.defineProperties(u.metrics,{parent:{value:x},integralWidth:{value:F},newBaselineFrom:{value:D},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 m.metrics.offsetY+this.newBaselineFrom}}});F=Math.max(parseInt(3*F/5)+z.metrics.w,parseInt(2*F/5+u.metrics.w))+x.metrics.paddingX;Object.defineProperties(A.metrics,{parent:{value:x},whatDisplace:{value:F},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+
this.whatDisplace}},offsetY:{get:function(){return m.metrics.offsetY}}});x.metrics.w=F+A.metrics.w+2*x.metrics.paddingX;x.metrics.ascent=Math.max(A.metrics.ascent,-y+z.metrics.ascent)+x.metrics.paddingY;x.metrics.descent=Math.max(A.metrics.descent,D+u.metrics.descent,w-x.metrics.ascent)+x.metrics.paddingY;x.metrics.h=Math.max(x.metrics.ascent+x.metrics.descent,w);p+=2*x.metrics.marginX}else if(r.nodeType=="prod"){x=r;x.updateFormula();A=x.children;u=A[0];z=A[1];A=A[2];x.metrics.marginX=parseInt(1.5+
this.style.size*.075);x.metrics.paddingX=parseInt(1.5+this.style.size*.075);x.metrics.paddingY=parseInt(1.5+this.style.size*.05);x.metrics.offsetX_aux=p;Object.defineProperties(x.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return m.metrics.offsetX+m.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return m.metrics.offsetY}}});let N=h(r.style.toString());w=parseInt(N.h*1.2);y=parseInt(.5+w*876/1E3);x.piSign=
{w:y,h:w,scale:w/1E3};y=Math.max(z.metrics.w,u.metrics.w,x.piSign.w);x.piSign.parent=x;Object.defineProperties(x.piSign,{prodWidth:{value:y},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.prodWidth-this.w)/2)}},y:{get:function(){return m.metrics.offsetY+N.descent-(this.h+N.h)/2}}});D=N.descent-z.metrics.descent-(w+N.h)/2-x.metrics.paddingY;Object.defineProperties(z.metrics,{parent:{value:x},prodWidth:{value:y},newBaselineTo:{value:D},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 m.metrics.offsetY+this.newBaselineTo}}});w=u.metrics.ascent+N.descent+(w-N.h)/2+x.metrics.paddingY;Object.defineProperties(u.metrics,{parent:{value:x},prodWidth:{value:y},newBaselineFrom:{value:w},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+
this.parent.metrics.paddingX+parseInt((this.prodWidth-this.w)/2)}},offsetY:{get:function(){return m.metrics.offsetY+this.newBaselineFrom}}});Object.defineProperties(A.metrics,{parent:{value:x},prodWidth:{value:y},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 m.metrics.offsetY}}});x.metrics.w=y+A.metrics.w+3*x.metrics.paddingX;x.metrics.ascent=
Math.max(A.metrics.ascent,-D+z.metrics.ascent)+x.metrics.paddingY;x.metrics.descent=Math.max(A.metrics.descent,w+u.metrics.descent)+x.metrics.paddingY;x.metrics.h=x.metrics.ascent+x.metrics.descent;p+=2*x.metrics.marginX}else if(r.nodeType=="limit"){x=r;x.updateFormula();z=x.children;let N=z[0];u=z[1];z=z[2];x.metrics.marginX=parseInt(1.5+this.style.size*.075);x.metrics.paddingX=parseInt(1.5+this.style.size*.075);x.metrics.paddingY=parseInt(1.5+this.style.size*.05);x.metrics.offsetX_aux=p;Object.defineProperties(x.metrics,
{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return m.metrics.offsetX+m.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return m.metrics.offsetY}}});e=r.style.toString();w=h(e);A=parseInt(.5+b.getTextWidth("l\u00edm",e));y=parseInt(.5+b.getTextWidth("\u2192",e));D=Math.max(A,N.metrics.w+y+u.metrics.w);x.limitText={parent:x};Object.defineProperties(x.limitText,{limitWidth:{value:D},limitTextWidth:{value:A},x:{get:function(){return this.parent.metrics.offsetX+
this.parent.metrics.paddingX+(this.limitWidth-this.limitTextWidth)/2}}});A=w.descent+Math.max(N.metrics.ascent,u.metrics.ascent,2*w.ascent/3)+x.metrics.paddingY;x.limitArrow={parent:x};Object.defineProperties(x.limitArrow,{newBaseline:{value:A},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+N.metrics.w}},y:{get:function(){return m.metrics.offsetY+this.newBaseline}}});Object.defineProperties(N.metrics,{parent:{value:x},newBaseline:{value:A},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 m.metrics.offsetY+this.newBaseline}}});Object.defineProperties(u.metrics,{parent:{value:x},arrowWidth:{value:y},newBaseline:{value:A},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+N.metrics.w+this.arrowWidth}},offsetY:{get:function(){return m.metrics.offsetY+
this.newBaseline}}});Object.defineProperties(z.metrics,{parent:{value:x},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 m.metrics.offsetY}}});x.metrics.w=D+z.metrics.w+3*x.metrics.paddingX;x.metrics.ascent=Math.max(z.metrics.ascent,w.ascent)+x.metrics.paddingY;w=0;z=Math.max(N.metrics.descent,u.metrics.descent,
z.metrics.descent);if(N.metrics.h!=0||u.metrics.h!=0)w=A,z=Math.max(N.metrics.descent,u.metrics.descent,z-w);x.metrics.descent=w+z+x.metrics.paddingY;x.metrics.h=x.metrics.ascent+x.metrics.descent;p+=2*x.metrics.marginX}else if(r.nodeType=="matrix"){x=r;x.updateFormula();u=x.children;z=x.rows;A=x.columns;x.metrics.marginX=parseInt(1.5+this.style.size*.075);x.metrics.paddingX=parseInt(5+this.style.size*.075);x.metrics.paddingY=parseInt(1.5+this.style.size*.05);x.metrics.offsetX_aux=p;Object.defineProperties(x.metrics,
{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return m.metrics.offsetX+m.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return m.metrics.offsetY}}});F=h(r.style.toString());w=[];y=[];var B=void 0;let N;for(let U=0,X=z*A;U<X;U++)B=parseInt(U/A),N=U%A,w[B]=Math.max(w[B]||0,u[U].metrics.h),y[N]=Math.max(y[N]||0,u[U].metrics.w);D=(1+A)*x.metrics.paddingX;for(var I=0;I<A;I++)D+=y[I];I=(1+z)*x.metrics.paddingY;for(B=0;B<
z;B++)I+=w[B];F=F.descent-F.h/2;for(let U=0,X=z*A;U<X;U++)B=parseInt(U/A),N=U%A,u[U].metrics.offsetX_aux=a(y,N)+(y[N]-u[U].metrics.w)/2+N*x.metrics.paddingX,u[U].metrics.offsetY_aux=a(w,B)+(w[B]-u[U].metrics.h)/2+(1+B)*x.metrics.paddingY,Object.defineProperties(u[U].metrics,{parent:{value:x},matrixH:{value:I},dispY:{value:F},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+this.offsetX_aux}},
offsetY:{get:function(){return m.metrics.offsetY-this.matrixH/2+this.ascent+this.offsetY_aux+this.dispY}}});x.metrics.w=D;x.metrics.ascent=I/2-F;x.metrics.descent=I/2+F;x.metrics.h=x.metrics.ascent+x.metrics.descent;p+=2*x.metrics.marginX}else if(r.nodeType=="defparts"){x=r;x.updateFormula();u=r.children;z=r.parts;x.metrics.marginX=parseInt(1.5+this.style.size*.075);x.metrics.paddingX=parseInt(1.5+this.style.size*.075);x.metrics.paddingY=parseInt(1.5+this.style.size*.05);x.metrics.offsetX_aux=p;Object.defineProperties(x.metrics,
{parent:{value:m},x:{get:function(){return this.offsetX-2*this.marginX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return m.metrics.offsetX+m.metrics.paddingX+3*this.marginX+this.offsetX_aux}},offsetY:{get:function(){return m.metrics.offsetY}}});y=h(r.style.toString());A=0;w=x.metrics.paddingY;y=y.descent-y.h/2;for(D=0;D<z;D++)u[D].metrics.offsetY_aux=w,A=Math.max(A,u[D].metrics.w),w+=u[D].metrics.h+x.metrics.paddingY,Object.defineProperties(u[D].metrics,{parent:{value:x},dispY:{value:y},
x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX}},offsetY:{get:function(){return m.metrics.offsetY-this.parent.metrics.defpartsH/2+this.ascent+this.offsetY_aux+this.dispY}}});x.metrics.defpartsH=w;x.metrics.w=A+4*x.metrics.paddingX;x.metrics.ascent=w/2-y;x.metrics.descent=w/2+y;x.metrics.h=x.metrics.ascent+x.metrics.descent;p+=2*x.metrics.marginX}else"numerator denominator index radicand from to what element".split(" ").includes(r.nodeType)&&
(r.updateFormula(),r.metrics.paddingX=parseInt(1.5+this.style.size*.075),r.metrics.paddingY=parseInt(1.5+this.style.size*.05),r.metrics.ascent+=r.metrics.paddingY,r.metrics.descent+=r.metrics.paddingY,r.metrics.h=r.metrics.ascent+r.metrics.descent,r.children.length==1&&r.children[0].nodeType=="text"&&r.children[0].value==""?(r.metrics.w=0,b.in_editor||(r.metrics.ascent=r.metrics.descent=r.metrics.h=0)):r.metrics.w+=2*r.metrics.paddingX);x=r;this.metrics.ascent=Math.max(this.metrics.ascent,r.metrics.tmp_ascent||
r.metrics.ascent);this.metrics.descent=Math.max(this.metrics.descent,r.metrics.descent);this.metrics.w+=r.metrics.w+2*r.metrics.marginX;this.metrics.h=this.metrics.ascent+this.metrics.descent;p+=r.metrics.w}}justifyAux(m){var k=this.children[this.children.length-1];k=k.nodeType=="text"&&k.value==""?1:0;let r=0;for(var p=this.children.length-1-k;p>=0&&this.children[p].nodeType=="space";p--)r++;let x=p=0;for(let u=0,z=this.children.length-r-k;u<z;u++)this.children[u].nodeType==="space"?p++:x+=this.children[u].metrics.w;
this.updateLine((m-x)/p)}drawTextBlock(m){m.fillStyle=l;m.shadowBlur=this.style.shadowBlur;m.shadowOffsetX=this.style.shadowOffsetX;m.shadowOffsetY=this.style.shadowOffsetY;m.shadowColor=this.style.shadowColor;for(let k of this.children)k.draw(m);m.shadowColor="transparent"}drawTextLineBlock(m){for(let k of this.children)f=!1,k.draw(m)}drawText(m){if(this.value!==""){var k=this.metrics.x,r=this.metrics.y;m.fillStyle=this.style.color!==null?this.style.color.getColor?this.style.color.getColor():this.style.color:
l;m.font=this.style.toString(f);m.beginPath();this.style.overline&&(m.rect(k,r-this.metrics.ascent+parseInt(1+this.style.size/25),this.metrics.w,parseInt(1+this.style.size/25)),m.fill());this.style.underline&&(m.rect(k,r+parseInt(1+this.style.size/10),this.metrics.w,parseInt(1+this.style.size/25)),m.fill());if(this.style.border){let p=m.strokeStyle;m.lineWidth=this.style.border_size&&parseInt(this.style.border_size)>0?parseInt(this.style.border_size):1+parseInt(this.style.size/8);m.lineJoin="round";
m.miterLimit=2;m.strokeStyle=this.style.border.getColor();m.strokeText(this.value,k,r);m.strokeStyle=p}m.fillText(this.value,k,r)}}drawWord(m){for(let k of this.children)k.draw(m)}drawSpace(m){let k=this.metrics.x,r=this.metrics.y;this.style.overline&&(m.rect(k,r-this.metrics.ascent+parseInt(1+this.style.size/25),this.metrics.w,parseInt(1+this.style.size/25)),m.fill());this.style.underline&&(m.rect(k,r+parseInt(1+this.style.size/10),this.metrics.w,parseInt(1+this.style.size/25)),m.fill())}drawDynamicText(m){let k=
this.metrics.x+this.metrics.paddingX,r=this.metrics.y;m.fillStyle=this.style.color!==null?this.style.color.getColor?this.style.color.getColor():this.style.color:l;m.font=this.style.toString(f);m.beginPath();this.style.overline&&(m.rect(k,r-this.metrics.ascent+parseInt(1+this.style.size/25),this.metrics.w,parseInt(1+this.style.size/25)),m.fill());this.style.underline&&(m.rect(k,r+parseInt(1+this.style.size/10),this.metrics.w,parseInt(1+this.style.size/25)),m.fill());m.fillText(this.evalValue,k,r);
this.drawBorder(m,"blue")}drawHyperlink(m){let k=this.metrics.x,r=this.metrics.y;this.ctx=m;this.clickCatcher.parentNode||(m.canvas.nextSibling.className?m.canvas.parentNode.insertBefore(this.clickCatcher,m.canvas.nextSibling.nextSibling):m.canvas.parentNode.insertBefore(this.clickCatcher,m.canvas.nextSibling));this.clickCatcher.style.left=k+"px";this.clickCatcher.style.top=r-this.metrics.ascent+"px";m.fillStyle="blue";this.click&&(m.fillStyle="white",m.fillRect(k,r-this.metrics.ascent,this.metrics.w,
this.metrics.h),m.fillStyle="red");m.font=this.style.toString(f);m.beginPath();m.rect(k,r+parseInt(1+this.style.size/10),this.metrics.w,parseInt(1+this.style.size/25));m.fill();m.fillText(this.value,k,r)}drawFormula(m){for(let k of this.children)f=!0,k.draw(m);this.drawBorder(m,"blue")}drawFraction(m){m.lineWidth=5;m.fillStyle=this.style.color!==null?this.style.color.getColor?this.style.color.getColor():this.style.color:l;m.beginPath();let k=parseInt(1+this.style.size/24);m.rect(this.metrics.x,this.metrics.offsetY-
parseInt(k/2),this.metrics.w,k);m.fill();this.children[0].draw(m);this.children[1].draw(m);this.drawBorder(m,"blue")}drawNumDen(m){for(let k of this.children)k.draw(m);this.drawBorder(m,"blue")}drawSuperIndex(m){for(let k of this.children)k.draw(m);this.drawBorder(m,"blue")}drawSubIndex(m){for(let k of this.children)k.draw(m);this.drawBorder(m,"blue")}drawRadical(m){m.fillStyle=this.style.color!==null?this.style.color.getColor?this.style.color.getColor():this.style.color:l;this.style.border&&(m.lineWidth=
this.style.border_size&&parseInt(this.style.border_size)>0?parseInt(this.style.border_size):1+parseInt(this.style.size/8),m.lineJoin="round",m.miterLimit=2,m.strokeStyle=this.style.border.getColor(),m.lineWidth/=Math.max(this.radicalSign.scaleX,this.radicalSign.scaleY));m.save();m.font="1000px DJS_symbol";m.translate(this.radicalSign.x,this.radicalSign.y);m.scale(this.radicalSign.scaleX,this.radicalSign.scaleY);this.style.border&&m.strokeText("\u221a",-70,800);m.fillText("\u221a",-70,800);m.restore();
m.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(let k of this.children)k.draw(m);this.drawBorder(m,"blue")}drawSum(m){m.fillStyle=this.style.color!==null?this.style.color.getColor?this.style.color.getColor():this.style.color:l;m.font=`${this.sigmaSign.w*1.9}px DJS_symbol`;this.style.border&&(m.lineWidth=this.style.border_size&&parseInt(this.style.border_size)>0?parseInt(this.style.border_size):1+parseInt(this.style.size/
8),m.lineJoin="round",m.miterLimit=2,m.strokeStyle=this.style.border.getColor(),m.strokeText("\u03a3",this.sigmaSign.x,this.sigmaSign.y+this.sigmaSign.h));m.fillText("\u03a3",this.sigmaSign.x,this.sigmaSign.y+this.sigmaSign.h);for(let k of this.children)k.draw(m);this.drawBorder(m,"blue")}drawIntegral(m){m.fillStyle=this.style.color!==null?this.style.color.getColor?this.style.color.getColor():this.style.color:l;m.font=`${this.sign.w*1.5}px DJS_symbol`;this.style.border&&(m.lineWidth=this.style.border_size&&
parseInt(this.style.border_size)>0?parseInt(this.style.border_size):1+parseInt(this.style.size/8),m.lineJoin="round",m.miterLimit=2,m.strokeStyle=this.style.border.getColor(),m.strokeText("\u222b",this.sign.x,this.sign.y+this.sign.h*3/4));m.fillText("\u222b",this.sign.x,this.sign.y+this.sign.h*3/4);for(let k of this.children)k.draw(m);this.drawBorder(m,"blue")}drawProd(m){m.fillStyle=this.style.color!==null?this.style.color.getColor?this.style.color.getColor():this.style.color:l;m.font=`${this.piSign.w*
1.5}px DJS_symbol`;this.style.border&&(m.lineWidth=this.style.border_size&&parseInt(this.style.border_size)>0?parseInt(this.style.border_size):1+parseInt(this.style.size/8),m.lineJoin="round",m.miterLimit=2,m.strokeStyle=this.style.border.getColor(),m.strokeText("\u03a0",this.piSign.x,this.piSign.y+this.piSign.h));m.fillText("\u03a0",this.piSign.x,this.piSign.y+this.piSign.h);for(let k of this.children)k.draw(m);this.drawBorder(m,"blue")}drawLimit(m){for(let k of this.children)k.draw(m);m.fillStyle=
this.style.color!==null?this.style.color.getColor?this.style.color.getColor():this.style.color:l;this.style.border&&(m.lineWidth=this.style.border_size&&parseInt(this.style.border_size)>0?parseInt(this.style.border_size):1+parseInt(this.style.size/8),m.lineJoin="round",m.miterLimit=2,m.strokeStyle=this.style.border.getColor());m.font=this.style.toString();this.style.border&&m.strokeText("l\u00edm",this.limitText.x,this.metrics.y);m.fillText("l\u00edm",this.limitText.x,this.metrics.y);this.children[1].metrics.h!=
0&&(this.style.border&&m.strokeText("\u2192",this.limitArrow.x,this.limitArrow.y),m.fillText("\u2192",this.limitArrow.x,this.limitArrow.y));this.drawBorder(m,"blue")}drawMatrix(m){for(var k of this.children)k.draw(m);var r=parseInt(1.5+this.style.size/25);k=r/2;m.lineWidth=r;m.strokeStyle=this.style.color!==null?this.style.color.getColor?this.style.color.getColor():this.style.color:l;m.beginPath();if(this.matrix_type==0)m.moveTo(this.metrics.x+k+1.5*this.metrics.marginX,this.metrics.y+k-this.metrics.ascent),
m.lineTo(this.metrics.x+k,this.metrics.y+k-this.metrics.ascent),m.lineTo(this.metrics.x+k,this.metrics.y+k-this.metrics.ascent+this.metrics.h),m.lineTo(this.metrics.x+k+1.5*this.metrics.marginX,this.metrics.y+k-this.metrics.ascent+this.metrics.h),m.moveTo(this.metrics.x+this.metrics.w-k-1.5*this.metrics.marginX,this.metrics.y+k-this.metrics.ascent),m.lineTo(this.metrics.x+this.metrics.w-k,this.metrics.y+k-this.metrics.ascent),m.lineTo(this.metrics.x+this.metrics.w-k,this.metrics.y+k-this.metrics.ascent+
this.metrics.h),m.lineTo(this.metrics.x+this.metrics.w-k-1.5*this.metrics.marginX,this.metrics.y+k-this.metrics.ascent+this.metrics.h);else if(this.matrix_type==1)m.moveTo(this.metrics.x+k+2*this.metrics.marginX,this.metrics.y+k-this.metrics.ascent),m.bezierCurveTo(this.metrics.x-k,this.metrics.y+k-this.metrics.ascent,this.metrics.x-k,this.metrics.y+k-this.metrics.ascent+this.metrics.h,this.metrics.x+k+2*this.metrics.marginX,this.metrics.y+k-this.metrics.ascent+this.metrics.h),m.moveTo(this.metrics.x+
this.metrics.w-k-2*this.metrics.marginX,this.metrics.y+k-this.metrics.ascent),m.bezierCurveTo(this.metrics.x+this.metrics.w+k,this.metrics.y+k-this.metrics.ascent,this.metrics.x+this.metrics.w+k,this.metrics.y+k-this.metrics.ascent+this.metrics.h,this.metrics.x+this.metrics.w-k-2*this.metrics.marginX,this.metrics.y+k-this.metrics.ascent+this.metrics.h);else if(this.matrix_type==2){r=3*this.metrics.marginX;let p=r/2;m.moveTo(this.metrics.x+k+r,this.metrics.y+k-this.metrics.ascent);m.bezierCurveTo(this.metrics.x+
k+p,this.metrics.y+k-this.metrics.ascent,this.metrics.x+k+p,this.metrics.y+k-this.metrics.ascent,this.metrics.x+k+p,this.metrics.y+k-this.metrics.ascent+2*this.metrics.marginX);m.lineTo(this.metrics.x+k+p,this.metrics.y+k-this.metrics.ascent+this.metrics.h/2-5*this.metrics.marginX);m.bezierCurveTo(this.metrics.x+k+p,this.metrics.y+k-this.metrics.ascent+this.metrics.h/2,this.metrics.x+k+p,this.metrics.y+k-this.metrics.ascent+this.metrics.h/2,this.metrics.x+k,this.metrics.y+k-this.metrics.ascent+this.metrics.h/
2);m.bezierCurveTo(this.metrics.x+k+p,this.metrics.y+k-this.metrics.ascent+this.metrics.h/2,this.metrics.x+k+p,this.metrics.y+k-this.metrics.ascent+this.metrics.h/2,this.metrics.x+k+p,this.metrics.y+k-this.metrics.ascent+this.metrics.h/2+5*this.metrics.marginX);m.lineTo(this.metrics.x+k+p,this.metrics.y+k-this.metrics.ascent+this.metrics.h-2*this.metrics.marginX);m.bezierCurveTo(this.metrics.x+k+p,this.metrics.y-k-this.metrics.ascent+this.metrics.h,this.metrics.x+k+p,this.metrics.y-k-this.metrics.ascent+
this.metrics.h,this.metrics.x+k+r,this.metrics.y-k-this.metrics.ascent+this.metrics.h);m.moveTo(this.metrics.x+this.metrics.w+k-r,this.metrics.y+k-this.metrics.ascent);m.bezierCurveTo(this.metrics.x+this.metrics.w+k-p,this.metrics.y+k-this.metrics.ascent,this.metrics.x+this.metrics.w+k-p,this.metrics.y+k-this.metrics.ascent,this.metrics.x+this.metrics.w+k-p,this.metrics.y+k-this.metrics.ascent+2*this.metrics.marginX);m.lineTo(this.metrics.x+this.metrics.w+k-p,this.metrics.y+k-this.metrics.ascent+
this.metrics.h/2-5*this.metrics.marginX);m.bezierCurveTo(this.metrics.x+this.metrics.w+k-p,this.metrics.y+k-this.metrics.ascent+this.metrics.h/2,this.metrics.x+this.metrics.w+k-p,this.metrics.y+k-this.metrics.ascent+this.metrics.h/2,this.metrics.x+this.metrics.w+k,this.metrics.y+k-this.metrics.ascent+this.metrics.h/2);m.bezierCurveTo(this.metrics.x+this.metrics.w+k-p,this.metrics.y+k-this.metrics.ascent+this.metrics.h/2,this.metrics.x+this.metrics.w+k-p,this.metrics.y+k-this.metrics.ascent+this.metrics.h/
2,this.metrics.x+this.metrics.w+k-p,this.metrics.y+k-this.metrics.ascent+this.metrics.h/2+5*this.metrics.marginX);m.lineTo(this.metrics.x+this.metrics.w+k-p,this.metrics.y+k-this.metrics.ascent+this.metrics.h-2*this.metrics.marginX);m.bezierCurveTo(this.metrics.x+this.metrics.w+k-p,this.metrics.y-k-this.metrics.ascent+this.metrics.h,this.metrics.x+this.metrics.w+k-p,this.metrics.y-k-this.metrics.ascent+this.metrics.h,this.metrics.x+this.metrics.w+k-r,this.metrics.y-k-this.metrics.ascent+this.metrics.h)}else this.matrix_type==
3?(m.moveTo(this.metrics.x+k,this.metrics.y+k-this.metrics.ascent),m.lineTo(this.metrics.x+k,this.metrics.y+k-this.metrics.ascent+this.metrics.h),m.moveTo(this.metrics.x+this.metrics.w-k,this.metrics.y+k-this.metrics.ascent),m.lineTo(this.metrics.x+this.metrics.w-k,this.metrics.y+k-this.metrics.ascent+this.metrics.h)):this.matrix_type==4&&(m.moveTo(this.metrics.x+k,this.metrics.y+k-this.metrics.ascent),m.lineTo(this.metrics.x+k,this.metrics.y+k-this.metrics.ascent+this.metrics.h),m.moveTo(this.metrics.x+
k+1.25*this.metrics.marginX,this.metrics.y+k-this.metrics.ascent),m.lineTo(this.metrics.x+k+1.25*this.metrics.marginX,this.metrics.y+k-this.metrics.ascent+this.metrics.h),m.moveTo(this.metrics.x+this.metrics.w-k,this.metrics.y+k-this.metrics.ascent),m.lineTo(this.metrics.x+this.metrics.w-k,this.metrics.y+k-this.metrics.ascent+this.metrics.h),m.moveTo(this.metrics.x+this.metrics.w-k-1.25*this.metrics.marginX,this.metrics.y+k-this.metrics.ascent),m.lineTo(this.metrics.x+this.metrics.w-k-1.25*this.metrics.marginX,
this.metrics.y+k-this.metrics.ascent+this.metrics.h));m.stroke();this.drawBorder(m,"blue")}drawDefparts(m){for(var k of this.children)k.draw(m);var r=parseInt(1.5+this.style.size/25);k=r/2;m.lineWidth=r;m.strokeStyle=this.style.color!==null?this.style.color.getColor?this.style.color.getColor():this.style.color:l;m.beginPath();r=3*this.metrics.marginX;let p=r/2;m.moveTo(this.metrics.x+k+r,this.metrics.y+k-this.metrics.ascent);m.bezierCurveTo(this.metrics.x+k+p,this.metrics.y+k-this.metrics.ascent,
this.metrics.x+k+p,this.metrics.y+k-this.metrics.ascent,this.metrics.x+k+p,this.metrics.y+k-this.metrics.ascent+2*this.metrics.marginX);m.lineTo(this.metrics.x+k+p,this.metrics.y+k-this.metrics.ascent+this.metrics.h/2-5*this.metrics.marginX);m.bezierCurveTo(this.metrics.x+k+p,this.metrics.y+k-this.metrics.ascent+this.metrics.h/2,this.metrics.x+k+p,this.metrics.y+k-this.metrics.ascent+this.metrics.h/2,this.metrics.x+k,this.metrics.y+k-this.metrics.ascent+this.metrics.h/2);m.bezierCurveTo(this.metrics.x+
k+p,this.metrics.y+k-this.metrics.ascent+this.metrics.h/2,this.metrics.x+k+p,this.metrics.y+k-this.metrics.ascent+this.metrics.h/2,this.metrics.x+k+p,this.metrics.y+k-this.metrics.ascent+this.metrics.h/2+5*this.metrics.marginX);m.lineTo(this.metrics.x+k+p,this.metrics.y+k-this.metrics.ascent+this.metrics.h-2*this.metrics.marginX);m.bezierCurveTo(this.metrics.x+k+p,this.metrics.y-k-this.metrics.ascent+this.metrics.h,this.metrics.x+k+p,this.metrics.y-k-this.metrics.ascent+this.metrics.h,this.metrics.x+
k+r,this.metrics.y-k-this.metrics.ascent+this.metrics.h);m.stroke();this.drawBorder(m,"blue")}drawGenericBlock(m){for(let k of this.children)k.draw(m);this.drawBorder(m,"blue")}drawComponentNumCtrl(m){this.componentNumCtrl.expresion=this.evaluator.parser.parse(`(${this.metrics.x},${this.metrics.y-this.metrics.ascent},${this.componentNumCtrl.w},${this.componentNumCtrl.h})`);this.componentNumCtrl&&this.componentNumCtrl.parent&&this.componentNumCtrl.parent.readyApp&&this.componentNumCtrl.update(!0)}drawComponentSpace(m){this.componentSpace.xExpr=
this.evaluator.parser.parse(""+this.metrics.x);this.componentSpace.yExpr=this.evaluator.parser.parse(""+(this.metrics.y-this.metrics.ascent));this.componentSpace&&this.componentSpace.parent&&this.componentSpace.parent.readyApp&&this.componentSpace.update(!0)}drawBorderSpecial(m,k){m.beginPath();m.setLineDash([1,2]);m.strokeStyle=k;m.lineWidth=1;m.rect(parseInt(this.metrics.x)+.5,parseInt(this.metrics.y-this.metrics.ascent)+.5,this.metrics.w,this.metrics.h);m.stroke();m.setLineDash([])}toRTF(){var m=
[];let k=[];let r="";this.mergeTextNodes();for(let x=0,u=this.children.length;x<u;x++){var p=this.children[x];p.nodeType=="textLineBlock"&&(r+=p.toRTFAux(m,k)+(u>1&&x<u-1?"\\par":""))}p="{\\fonttbl";for(let x=0,u=m.length;x<u;x++)p+="\\f"+x+"\\fcharset0 "+m[x]+";";m="";if(k.length>0){m="{\\colortbl";for(let x=0,u=k.length;x<u;x++)m+=k[x];m+="}"}return"{\\rtf1\\uc0"+(p+"}")+m+r+"}"}toRTFAux(m,k){let r,p,x=null,u="";let z,A,w,y;for(let F of this.children){var D=z="";A=this.addToFontTable(F.style.family,
m);w=F.style.size;y=this.addToColorTable(F.style.color,k);y===null&&k.length>0&&(y=this.addToColorTable(l,k));y!==x&&(D+="\\cf"+y,x=y);A!==r&&(D+="\\f"+A,r=A);w!==p&&(D+="\\fs"+w*2,p=w);F.style.italic&&(D+="\\i",z="\\i0"+z);F.style.bold&&(D+="\\b",z="\\b0"+z);F.style.underline&&(D+="\\ul",z="\\ulnone"+z);F.style.overline&&(D+="\\ol",z="\\olnone"+z);F.nodeType=="text"?(F.value=F.value.replace(/\\?([{}])/g,"\\$1"),D=D!==""?D+" "+F.value+z:u!==""&&u.charAt(u.length-1)!=="}"?" "+F.value:F.value,u+=D):
F.nodeType=="formula"?u+="{\\*\\mjaformula"+F.formulaToRTF(r,p,x,m,k)+"}":F.nodeType=="componentSpace"?u+="{\\*\\component\\Space "+F.value+"}":F.nodeType=="componentNumCtrl"&&(u+="{\\*\\component\\NumCtrl "+F.value+"}")}return u}formulaToRTF(m,k,r,p,x){let u="",z,A,w,y;for(let D of this.children)z=A="",w=this.addToFontTable(D.style.family,p),y=this.addToColorTable(D.style.color,x),y===null&&x.length>0&&(y=this.addToColorTable(l,x)),w!==m&&(z+="\\f"+w,m=w),y!==r&&(z+="\\cf"+y,D.nodeType!=="text"||
D.nodeType==="text"&&D.value!=="")&&(r=y),D.style.italic&&(z+="\\i",A="\\i0"+A),D.style.bold&&(z+="\\b",A="\\b0"+A),D.style.underline&&(z+="\\ul",A="\\ulnone"+A),D.style.overline&&(z+="\\ol",A="\\olnone"+A),D.nodeType=="text"&&D.value!==""?(D.value=D.value.replace(/\\?([{}])/g,"\\$1"),tmpRTF=z!==""?z+" "+D.value+A:u.charAt(u.length-1)!=="}"?" "+D.value:D.value,u+=tmpRTF):D.nodeType=="dynamicText"?(D.value=D.value===""?" ":D.value,u+=z+"{\\expr "+D.value+"\\decimals "+(D.decimals||2)+"\\fixed"+(D.fixed?
1:0)+"}"+A):"fraction radical index radicand sum integral prod limit from to what element".split(" ").includes(D.nodeType)?u+="{\\"+D.nodeType+D.formulaToRTF(m,k,r,p,x)+"}":D.nodeType=="numerator"?u+="{\\num"+D.formulaToRTF(m,k,r,p,x)+"}":D.nodeType=="denominator"?u+="{\\den"+D.formulaToRTF(m,k,r,p,x)+"}":D.nodeType=="superIndex"?u+="{\\supix"+D.formulaToRTF(m,k,r,p,x)+"}":D.nodeType=="subIndex"?u+="{\\subix"+D.formulaToRTF(m,k,r,p,x)+"}":D.nodeType=="matrix"?u+="{\\matrix\\rows "+(D.rows||2)+"\\columns "+
(D.columns||2)+D.formulaToRTF(m,k,r,p,x)+"}":D.nodeType=="defparts"&&(u+="{\\defparts\\parts "+(D.parts||2)+D.formulaToRTF(m,k,r,p,x)+"}");return u}addToFontTable(m,k){let r;/times/i.test(m)?r="Times New Roman":/courier/i.test(m)?r="Courier New":/arial/i.test(m)&&(r="Arial");m=k.indexOf(r);m===-1&&(m=k.length,k.push(r));return m}addToColorTable(m,k){if(m){m="\\red"+parseInt(m.slice(1,3),16)+"\\green"+parseInt(m.slice(3,5),16)+"\\blue"+parseInt(m.slice(5,7),16)+";";let r=k.indexOf(m);r==-1&&(r=k.length,
k.push(m));return r}return null}mergeTextNodes(){let m=[],k=null;for(let r of this.children)r.nodeType=="text"?k!==null&&k.nodeType=="text"&&k.style.equals(r.style)&&(r.value=k.value+r.value,m.push(k)):r.mergeTextNodes(),k=r;for(let r of m)this.removeChild(r)}}let v={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=c})(descartesJS);
(b=>{var a=String.fromCharCode,h,f,l,d,g,e,q,n,t,c,v;class m{constructor(){}tokenize(k){if(k)k=k.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[];h=[];f="";d=l=0;e=k.charAt(0);q=!1;for(n="text";l<k.length;)g=e,e=k.charAt(l+1),q?e==="\\"||e==="{"||e==="}"||e===" "||e===";"?(q=!1,f+=g,e===" "?(l++,e=k.charAt(l+
1),v=!0):v=!1,(t=f.match(/^'([0-9a-f]{2})/))?(c="",n==="text"&&(c=h.pop().value),f=c+=a(parseInt(t[1],16))+f.substring(3)):(t=f.match(/^u[0-9]+/))?(c="",n==="text"&&(c=h.pop().value),f=c+=a(t[0].substring(1))):(f==="{"||f==="}"||g=="\\"?(h.push({type:"text",value:f+(v?" ":"")}),n="text"):(h.push({type:"controlWord",value:f}),n="controlWord"),f="")):g=="{"||g=="}"||g=="\\"?(q=!1,h.push({type:"text",value:g}),n="text"):f+=g:g==="\\"?(q=!0,f!==""&&(h.push({type:"text",value:f}),n="text",f="")):g==="{"?
(d++,f!==""&&(h.push({type:"text",value:f}),f=""),h.push({type:"openBlock",value:d}),n="openBlock"):g==="}"?(f!==""&&(h.push({type:"text",value:f}),f=""),h.push({type:"closeBlock",value:d}),n="closeBlock",d--):f+=g,l++;f!==""&&h.push({type:"text",value:f});return h}}b.RTFTokenizer=m})(descartesJS);
(b=>{var a=Math.max,h,f,l,d,g,e,q,n,t,c,v,m,k,r,p,x,u,z,A,w,y,D,F,B,I,E,P,N,U,X,L;class G{constructor(O){this.evaluator=O;this.tokenizer=new b.RTFTokenizer}parse(O){h=this.tokenizer.tokenize(O);f={};d=2;if(h[0].type==="openBlock"&&h[1].value==="fonttbl"){for(l=h[0].value;h[d].type!=="closeBlock"&&h[d].value!==l;)f[h[d].value]=h[d+2].value.substring(0,h[d+2].value.length-1),d+=3;d++}g={};e=0;if(h[d].type==="openBlock"&&h[d+1].value==="colortbl"){l=h[d++].value;for(d++;h[d].type!=="closeBlock"&&h[d].value!==
l;)q=parseInt(h[d++].value.substring(3)).toString(16),n=parseInt(h[d++].value.substring(5)).toString(16),t=parseInt(h[d++].value.substring(4)).toString(16),h[d].value===";"&&d++,g[e++]="#"+(q.length<2?"0"+q:q)+(n.length<2?"0"+n:n)+(t.length<2?"0"+t:t);d++}r=k=m=null;U=N=P=y=w=A=z=u=x=p=!1;D=[new b.TextStyle];F=D[0];I=B=-1;E=[];c=X=new b.TextNode("","textBlock",F,this.evaluator);v=new b.TextNode("","textLineBlock",F,this.evaluator);c.addChild(v);X.stableWidth=!0;X.hasFormula=!1;O=d;for(var S=h.length;O<
S;O++){if(h[O].type=="controlWord")if(f[h[O].value])F.set({family:f[h[O].value]});else if(h[O].value.match(/^fs(\d+)/))F.set({size:parseInt(h[O].value.match(/^fs(\d+)/)[1]/2)});else if(h[O].value=="b")F.set({bold:!0}),E.length>0&&E[E.length-1].style.set({bold:!0});else if(h[O].value=="b0")F.set({bold:!1}),E.length>0&&E[E.length-1].style.set({bold:!1});else if(h[O].value=="i")F.set({italic:!0}),E.length>0&&E[E.length-1].style.set({italic:!0});else if(h[O].value=="i0")F.set({italic:!1}),E.length>0&&
E[E.length-1].style.set({italic:!1});else if(h[O].value=="ul")F.set({underline:!0}),E.length>0&&E[E.length-1].style.set({underline:!0});else if(h[O].value=="ulnone")F.set({underline:!1}),E.length>0&&E[E.length-1].style.set({underline:!1});else if(h[O].value=="ol")F.set({overline:!0}),E.length>0&&E[E.length-1].style.set({overline:!0});else if(h[O].value=="olnone")F.set({overline:!1}),E.length>0&&E[E.length-1].style.set({overline:!1});else if(h[O].value.match(/^cf(\d+)/))F.set({color:g[parseInt(h[O].value.substring(2))]}),
E.length>0&&(E[E.length-1].style.color=F.color);else if(h[O].value=="par"){c=new b.TextNode("","textLineBlock",F.clone(),this.evaluator);if(v.nodeType!="textBlock")for(v=v.parent;v.nodeType!="textBlock";)v=v.parent;v.addChild(c);v=c}else if(h[O].value=="mjaformula")X.hasFormula=!0,I=B,p=!0,c=new b.TextNode("","formula",F.clone(),this.evaluator),v.addChild(c),v=c,E[E.length-1]=c;else if(h[O].value=="fraction"||h[O].value=="radicand"||h[O].value=="radical"||h[O].value=="what"||h[O].value=="sum"||h[O].value==
"integral"||h[O].value=="limit"){var H=E[E.length-2].style.clone();c=new b.TextNode("",h[O].value,H,this.evaluator);E[E.length-2].addChild(c);E[E.length-1]=c}else h[O].value=="index"?(H=E[E.length-2].style.clone(),H.size=a(parseInt(H.size-H.size*.5),8),c=new b.TextNode("",h[O].value,H,this.evaluator),E[E.length-2].addChild(c),E[E.length-1]=c):h[O].value=="to"||h[O].value=="from"?(H=E[E.length-2].style.clone(),H.size=a(parseInt(H.size-H.size*.2),8),c=new b.TextNode("",h[O].value,H,this.evaluator),
E[E.length-2].addChild(c),E[E.length-1]=c):h[O].value=="num"||h[O].value=="den"?(H=E[E.length-2].style.clone(),H.size=a(Math.round(H.size-H.size*.1),8),h[O].value=="num"?c=new b.TextNode("","numerator",H,this.evaluator):h[O].value=="den"&&(c=new b.TextNode("","denominator",H,this.evaluator)),E[E.length-2].addChild(c),E[E.length-1]=c):h[O].value=="subix"||h[O].value=="supix"?(H=E[E.length-2].style.clone(),H.size=a(Math.floor(H.size-H.size*.33),8),h[O].value=="subix"?c=new b.TextNode("","subIndex",
H,this.evaluator):h[O].value=="supix"&&(c=new b.TextNode("","superIndex",H,this.evaluator)),c.originalStyle=E[E.length-2].style.clone(),E[E.length-2].addChild(c),E[E.length-1]=c):h[O].value=="defparts"||h[O].value=="matrix"||h[O].value=="element"?(H=E[E.length-2].style.clone(),c=new b.TextNode("",h[O].value,H,this.evaluator),E[E.length-2].addChild(c),E[E.length-1]=c,h[O].value=="defparts"?r=c:h[O].value=="matrix"&&(k=c,k.matrix_type=0)):h[O].value=="parts"?y=!0:h[O].value=="type"?z=!0:h[O].value==
"rows"?A=!0:h[O].value=="columns"?w=!0:h[O].value=="expr"?(X.stableWidth=!1,x=!0):h[O].value=="decimals"?u=!0:h[O].value=="fixed1"?m.fixed=!0:h[O].value=="fixed0"?m.fixed=!1:h[O].value!="component"&&(h[O].value=="NumCtrl"?P=!0:h[O].value=="Space"?N=!0:h[O].value=="hyperlink"&&(U=!0));if(h[O].type=="text")if(y)r.parts=parseInt(h[O].value),y=!1;else if(z)k.matrix_type=parseInt(h[O].value),z=!1;else if(A)k.rows=parseInt(h[O].value),A=!1;else if(w)k.columns=parseInt(h[O].value),w=!1;else if(u)m.decimals=
this.evaluator.parser.parse(h[O].value+""),u=!1;else if(U){L=h[O].value.split("|")[0];H=F.clone();c=new b.TextNode(L,"hyperlink",H,this.evaluator);c.URL=h[O].value.split("|")[1];if(v.nodeType!="textLineBlock")for(v=v.parent;v.nodeType!="textLineBlock";)v=v.parent;v.addChild(c);U=!1}else if(P)c=new b.TextNode(h[O].value,"componentNumCtrl",F.clone(),this.evaluator),v.addChild(c),P=!1;else if(N)c=new b.TextNode(h[O].value,"componentSpace",F.clone(),this.evaluator),v.addChild(c),N=!1;else if(x)H=E[E.length-
2].style.clone(),L=this.evaluator.parser.parse(h[O].value),c=new b.TextNode(L,"dynamicText",H,this.evaluator),E[E.length-2].addChild(c),m=E[E.length-1]=c,x=!1;else if(x||p)!x&&p&&(L=h[O].value,c=new b.TextNode(L,"text",E[E.length-1].style.clone(),this.evaluator),E[E.length-1].addChild(c));else{L=h[O].value;c=new b.TextNode(L,"text",F.clone(),this.evaluator);if(v.nodeType!="textLineBlock")for(v=v.parent;v.nodeType!="textLineBlock";)v=v.parent;v.addChild(c)}else if(h[O].type=="openBlock")B=h[O].value,
F=F.clone(),D.push(F),E.push(null);else if(h[O].type=="closeBlock")h[O].value==I&&(I=-1,p=!1,v=v.parent),D.pop(),F=D[D.length-1],E.pop();else if(h[O].type=="("||h[O].type==")")H=E[E.length-1].style.clone(),H.italic="",c=new b.TextNode(h[O].type,"mathSymbol",H,this.evaluator),E[E.length-1].addChild(c);else if(h[O].type=="+"||h[O].type=="-"||h[O].type=="*"||h[O].type=="=")c=new b.TextNode(h[O].type,"mathSymbol",E[E.length-1].style.clone(),this.evaluator),E[E.length-1].addChild(c)}return X.normalize()}}
b.RTFParser=G})(descartesJS);
(b=>{let a,h,f,l,d,g,e,q,n,t,c,v;class m{constructor(k,r){a=this;a.parent=k;a.evaluator=a.parent.evaluator;f=a.evaluator;l=f.parser;a.id=a.imageSrc=a.x_axis=a.y_axis=a.cID="";a.type="2D";a.xExpr=a.yExpr=l.parse("0");a.w=parseInt(k.container.width);a.h=parseInt(k.container.height);a.drawif=l.parse("1");a.fixed=a.text=a.numbers=a.sensitive_to_mouse_movements=!1;a.scale=48;a.Ox=a.Oy=a.mouse_x=a.mouse_y=a.border_width=a.border_radius=0;a.image=new Image;a.image.onload=function(){this.ready=1};a.bg_display=
"topleft";a.background=new b.Color("ffffff");a.net=new b.Color("b8c4c8");a.net10=new b.Color("889498");a.axes=new b.Color("405860");a.border_color=new b.Color("000000");a.ctrs=[];a.graphicsCtr=[];a.graphics=[];a.backGraphics=[];a.zIndex=k.zIndex;a.plecaHeight=k.plecaHeight||0;a.displaceRegionNorth=k.displaceRegionNorth||0;a.displaceRegionWest=k.displaceRegionWest||0;Object.assign(a,r);a.initSpace()}initSpace(){let k=this;h=k.parent;f=k.evaluator;d=k.id+".";k.resizable||(k.displaceRegionNorth=h.displaceRegionNorth||
0,k.displaceRegionSouth=h.displaceRegionSouth||0,k.displaceRegionEast=h.displaceRegionEast||0,k.displaceRegionWest=h.displaceRegionWest||0,n=parseInt(h.container.width),q=parseInt(h.container.height),k.wExpr!=void 0&&(k.w=parseInt(n-k.displaceRegionWest-k.displaceRegionEast)*parseFloat(k.wExpr)/100),k.hExpr!=void 0&&(k.h=parseInt(q-k.displaceRegionNorth-k.displaceRegionSouth)*parseFloat(k.hExpr)/100),k.xPercentExpr!=void 0&&(k.xExpr=f.parser.parse((parseInt(n-k.displaceRegionWest-k.displaceRegionEast)*
parseFloat(k.xPercentExpr)/100).toString())),k.yPercentExpr!=void 0&&(k.yExpr=f.parser.parse((parseInt(q-k.displaceRegionNorth-k.displaceRegionSouth)*parseFloat(k.yPercentExpr)/100).toString())),k.x=f.eval(k.xExpr)+k.displaceRegionWest,k.y=f.eval(k.yExpr)+k.plecaHeight+k.displaceRegionNorth,k.container&&(k.container.style.left=k.x+"px",k.container.style.top=k.y+"px"),k.y>=0?(g=q-k.y,k.h>g&&(k.h=g)):(g=k.h+k.y,k.h=g>=q?q:g),k.x>=0?(e=n-k.x,k.w>e&&(k.w=e)):(e=k.w+k.x,k.w=e>=n?n:e));k.imageSrc==""&&
/vacio.gif$/i.test(k.imageSrc.trim())||(k.image=h.getImage(k.imageSrc));k.OxExpr&&(c=k.OxExpr,c.endsWith("%")?k.Ox=k.w*parseFloat(c)/100:(t=parseFloat(c),t!=c&&(t=0),k.Ox=t));k.OyExpr&&(v=k.OyExpr,v.endsWith("%")?k.Oy=k.h*parseFloat(v)/100:(t=parseFloat(v),t!=v&&(t=0),k.Oy=t));k.id!==""&&h.version!==2?(f.setVariable(d+"_w",k.w),f.setVariable(d+"_h",k.h),f.setVariable(d+"escala",f.getVariable(d+"escala")||k.scale),f.setVariable(d+"Ox",f.getVariable(d+"Ox")||k.Ox),f.setVariable(d+"Oy",f.getVariable(d+
"Oy")||k.Oy),f.setVariable(d+"mouse_x",0),f.setVariable(d+"mouse_y",0),f.setVariable(d+"mouse_pressed",0),f.setVariable(d+"mouse_clicked",0),f.setVariable(d+"clic_izquierdo",0)):(t=f.getVariable("_w"),f.setVariable("_w",t===void 0?k.w:t),t=f.getVariable("_h"),t===void 0&&(t=k.h),f.setVariable("_h",t),t=f.getVariable("escala"),t===void 0&&(t=k.scale),f.setVariable("escala",t),t=f.getVariable("Ox"),t===void 0&&(t=k.Ox),f.setVariable("Ox",t),t=f.getVariable("Oy"),t===void 0&&(t=k.Oy),f.setVariable("Oy",
t),f.setVariable("mouse_x",0),f.setVariable("mouse_y",0),f.setVariable("mouse_pressed",0),f.setVariable("mouse_clicked",0),f.setVariable("clic_izquierdo",0),h.version==2&&k.x_axis===""&&k.y_axis===""&&(k.axes=""));k.w_2=k.w/2;k.h_2=k.h/2;f.setFunction(d+"download_image",function(r){k.evaluator.functions._SaveSpace_(r,k.canvas.toDataURL("image/png"))})}addCtr(k){k.type==="GraphicControl"?this.graphicsCtr.push(k):this.ctrs.push(k)}addGraph(k,r){this.type==="2D"&&r||this.type==="3D"&&!r||(k.background&&
this.type!=="3D"?this.backGraphics.push(k):this.graphics.push(k))}clearClick(){this.evaluator.setVariable(this.mclickedString,0);this.evaluator.setVariable(this.mclicizquierdoString,0)}getRelativeX(k){return(parseInt(k)-this.w_2-this.Ox)/this.scale}getRelativeY(k){return(-parseInt(k)+this.h_2+this.Oy)/this.scale}getAbsoluteX(k){return k*this.scale+this.w_2+this.Ox}getAbsoluteY(k){return-k*this.scale+this.h_2+this.Oy}}b.Space=m})(descartesJS);
(b=>{let a;class h{constructor(f){a=this;a.parent=f;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=[]}init(){function f(e){a.newPos=b.getCursorPosition(e,document.body);a.container.style.left=a.initialPosition.x+(a.newPos.x-a.oldPos.x)*b.cssScale+"px";a.container.style.top=a.initialPosition.y+(a.newPos.y-a.oldPos.y)*b.cssScale+"px"}function l(e){e.preventDefault();document.body.removeEventListener("mousemove",f);document.body.removeEventListener("mouseup",l)}a=this;document.body.appendChild(a.container);let d=a.parent.evaluator.parser;
a.numCtr=a.ctrs.length;a.ctrs.forEach((e,q)=>{e.expresion=d.parse(`(0,${a.vSpace+23+q*35},${a.width},35)`);e.update()});var g=new b.Button(a.parent,{region:"external",name:a.language=="english"?"about":"cr\u00e9ditos",font_size:d.parse("15"),expresion:d.parse(`(0,${a.vSpace},${a.width/2},25)`)});g.actionExec={execute:b.showAbout};g.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:a.language=="english"?"init":"inicio",font_size:d.parse("15"),action:"init",expresion:d.parse(`(0,${a.vSpace+23+a.numCtr*35},${a.width/2},25)`)})).update();(new b.Button(a.parent,{region:"external",name:a.language=="english"?"clear":"limpiar",font_size:d.parse("15"),action:"clear",expresion:d.parse(`(${a.width/2},${a.vSpace+23+a.numCtr*35},${a.width/2},25)`)})).update();g=new b.Button(a.parent,{region:"external",name:a.language=="english"?"close":"cerrar",
font_size:d.parse("15"),expresion:d.parse(`(${a.width/4},${a.vSpace+46+a.numCtr*35},${a.width/2},25)`)});g.update();g.btn.addEventListener("click",e=>{a.hide()});a.setPositionAndSize();a.movable.addEventListener("mousedown",function(e){e.preventDefault();a.oldPos=b.getCursorPosition(e,document.body);a.initialPosition={x:a.container.offsetLeft,y:a.container.offsetTop};document.body.addEventListener("mousemove",f);document.body.addEventListener("mouseup",l)});a.hide()}addCtr(f){this.ctrs.push(f)}show(){this.setPositionAndSize();
this.container.style.display="block"}hide(){this.container.style.display="none"}setPositionAndSize(){a=this;let f=a.vSpace+46+a.numCtr*35+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":f>window.innerHeight-10?window.innerHeight-10+"px":f+"px"}}b.SpaceExternal=h})(descartesJS);
(b=>{let a;const h=Math.PI*2,f="Italic 16px "+b.math_font,l=b.convertFont("Monospaced,PLAIN,12");let d=Math.floor,g=Math.round,e,q,n,t,c,v,m,k,r,p,x,u,z,A,w,y,D,F,B,I,E,P,N,U,X,L,G,O;var S,H;class M extends b.Space{constructor(K,T){super(K,T);a=this;a.ratio=K.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=`${a.border_width>0?"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.ctx.textRendering="optimizeSpeed";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);K.container.insertBefore(a.container,K.loader);T=a.id+".image";a.parent.images[T]=a.canvas;a.parent.images[T].ready=1;a.parent.images[T].complete=a.parent.images[T].canvas=!0;a.evaluator.setVariable(T,T);T=a.id+".back";a.parent.images[T]=a.backCanvas;a.parent.images[T].ready=1;a.parent.images[T].complete=a.parent.images[T].canvas=!0;a.evaluator.setVariable(T,T);T=a.id!==""&&K.version!==2?a.id+".":"";a.OxStr=T+"Ox";a.OyStr=T+"Oy";a.scaleStr=T+"escala";a.wStr=
T+"_w";a.hStr=T+"_h";a.mxStr=T+"mouse_x";a.myStr=T+"mouse_y";a.mpressedStr=T+"mouse_pressed";a.mclickedStr=T+"mouse_clicked";a.mclickIzqStr=T+"clic_izquierdo";a.click=0;a.resizable&&(a.wModExpr=K.evaluator.parser.parse(a.wModExpr),a.hModExpr=K.evaluator.parser.parse(a.hModExpr));a.id!=="descartesJS_stage"&&a.addEvents();K.evaluator.setVariable(a.id+"._refresh_back_",1)}init(){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")}update(K){a=this;e=a.evaluator;q=a.parent;if(a.resizable){if(G=a.evaluator.eval(a.wModExpr),O=a.evaluator.eval(a.hModExpr),a.old_w!=G||a.old_h!=O)a.w=G,a.h=O,a.w_2=a.w/2,a.h_2=a.h/2,e.setVariable(a.wStr,a.w),e.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",K=!0,a.backCtx.setTransform(a.ratio,0,0,a.ratio,0,0),a.drawBackground()}else e.setVariable(a.wStr,a.w),e.setVariable(a.hStr,a.h);a.drawIfValue=e.eval(a.drawif)>0;if(a.drawIfValue){t=a.x!==e.eval(a.xExpr)+a.displaceRegionWest;c=a.y!==e.eval(a.yExpr)+q.plecaHeight+a.displaceRegionNorth;a.spaceChange=K||t||c||a.drawBefore!==a.drawIfValue||a.Ox!==e.getVariable(a.OxStr)||a.Oy!==e.getVariable(a.OyStr)||a.scale!==e.getVariable(a.scaleStr)||
a.backColor!==a.background.getColor();a.x=t?e.eval(a.xExpr)+a.displaceRegionWest:a.x;a.y=c?e.eval(a.yExpr)+q.plecaHeight+a.displaceRegionNorth:a.y;a.Ox=e.getVariable(a.OxStr);a.Oy=e.getVariable(a.OyStr);a.scale=e.getVariable(a.scaleStr);a.drawBefore=a.drawIfValue;a.scale=Math.max(1E-6,Math.min(1E6,a.scale));e.setVariable(a.scaleStr,a.scale);if(t||c)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"}drawBackground(){a=this;e=a.evaluator;n=a.backCtx;n.clearRect(0,0,a.backCanvas.width,a.backCanvas.height);n.fillStyle=a.backColor=a.background.getColor();n.fillRect(0,0,a.backCanvas.width,a.backCanvas.height);a.image&&a.image.src!=""&&a.image.ready&&a.image.complete&&(a.bg_display==="topleft"?n.drawImage(a.image,0,0):a.bg_display===
"stretch"?n.drawImage(a.image,0,0,a.w,a.h):a.bg_display==="patch"?(n.fillStyle=n.createPattern(a.image,"repeat"),n.fillRect(0,0,a.w,a.h)):a.bg_display==="imgcenter"&&n.drawImage(a.image,(a.w-a.image.width)/2,(a.h-a.image.height)/2));v=a.scale;m=0;for(k=Math.max(0,a.w+a.h);v>k;)v/=10,m++;for(;v<k/10;)v*=10;n.lineWidth=1;a.net!==""&&(n.strokeStyle=a.net.getColor(),a.drawMarks(n,v/10,-1));if(a.parent.version!==2&&a.net10!==""||a.parent.version===2&&a.net!==""&&a.net10!=="")n.strokeStyle=a.net10.getColor(),
a.drawMarks(n,v,-1);if(a.axes!==""){let K="";a.x_axis=="no"&&(K+="x");a.y_axis=="no"&&(K+="y");n.strokeStyle=a.axes.getColor();n.beginPath();a.x_axis=="no"||a.x_axis===""&&a.parent.version===2||(n.moveTo(0,d(a.h/2+a.Oy)+.5),n.lineTo(a.w,d(a.h/2+a.Oy)+.5));a.y_axis=="no"||a.y_axis===""&&a.parent.version===2||(n.moveTo(d(a.w/2+a.Ox)+.5,0),n.lineTo(d(a.w/2+a.Ox)+.5,a.h));n.lineWidth=1.2;n.stroke();n.lineWidth=1;a.drawMarks(n,v,4,K);a.drawMarks(n,v/2,2,K);a.drawMarks(n,v/10,1,K)}if(a.x_axis!==""||a.y_axis!==
"")n.fillStyle=a.axes!==""?a.axes.getColor():"#000",n.font=f,n.textAlign="right",n.textBaseline="alphabetic",a.x_axis!="no"&&n.fillText(a.x_axis,d(a.w)-2,d(a.h/2+a.Oy)+12),a.y_axis!="no"&&n.fillText(a.y_axis,d(a.w/2+a.Ox)-2,12);a.numbers&&a.axes!=""&&(n.fillStyle=a.axes.getColor(),n.font=f,v>(a.w+a.h)/2?a.drawNumbers(n,v/5,v<=a.scale?m+1:m):v>(a.w+a.h)/4?a.drawNumbers(n,v/2,v<=a.scale?m+1:m):a.drawNumbers(n,v,m));for(let K of a.backGraphics)K.draw()}draw(){a=this;n=a.ctx;e.getVariable(a.id+"._refresh_back_")&&
n.clearRect(0,0,a.canvas.width,a.canvas.height);for(let K of a.graphics)K.trace!==""&&a.drawTrace&&K.drawTrace(),K.draw();for(let K of a.graphicsCtr)K.draw();a.text!=""&&a.click&&a.whichBtn==="L"&&(n.save(),n.strokeStyle=n.fillStyle=a.text.getColor(),n.lineWidth=1,n.font=l,n.textAlign="center",n.textBaseline="alphabetic",B=a.scale<=1?a.mouse_x.toFixed(0):a.mouse_x.toFixed(parseInt(a.scale).toString().length+1),I=a.scale<=1?a.mouse_y.toFixed(0):a.mouse_y.toFixed(parseInt(a.scale).toString().length+
1),E=`(${B},${I})`,P=d(n.measureText(E).width/2),N=a.getAbsoluteX(a.mouse_x),U=a.getAbsoluteY(a.mouse_y),X=d(N),L=d(U-10),X+P>a.w?X=a.w-P:X-P<0&&(X=P),L+1>a.h?L=a.h:L-14<0&&(L=15),n.fillText(E,X,L),n.beginPath(),n.arc(N,U,2.5,0,h),n.stroke(),n.restore())}drawMarks(K,T,V,W){r=this.w;p=this.h;D=w=0;y=r;F=p;z=d(r/2+this.Ox);A=d(p/2+this.Oy);V>=0&&(w=z-V,y=z+V,D=A-V,F=A+V);K.beginPath();if(!W||W&&!W.match("x"))for(V=-g(z/T);(x=z+g(V*T))<r;V++)K.moveTo(x+.5,D+.5),K.lineTo(x+.5,F+.5);if(!W||W&&!W.match("y"))for(W=
-g(A/T);(u=A+g(W*T))<p;W++)K.moveTo(w+.5,u+.5),K.lineTo(y+.5,u+.5);K.stroke()}drawNumbers(K,T,V){r=this.w;p=this.h;z=d(r/2+this.Ox);A=d(p/2+this.Oy);K.textAlign="center";K.textBaseline="bottom";for(V=-g(z/T);(x=z+g(V*T))<r;V++)K.fillText(parseFloat((V*T/this.scale).toFixed(4)),x+1,A-2);K.textAlign="start";K.textBaseline="middle";for(V=-g(A/T);(u=A+g(V*T))<p;V++)parseFloat(-V*T/this.scale)!==0&&K.fillText(parseFloat((-V*T/this.scale).toFixed(4)),z+5,u)}addEvents(){function K(R){window.focus();document.activeElement.blur();
if(C.evaluator.variables[C.id+".DJS_NO_FIXED"]||!C.fixed||C.sensitive_to_mouse_movements)C.click=0,C.evaluator.setVariable(C.mpressedStr,0),C.evaluator.setVariable(C.mclickedStr,1),C.evaluator.setVariable(C.mclickIzqStr,1),window.removeEventListener("touchmove",ba),window.removeEventListener("touchend",K),R.stopPropagation(),R.preventDefault(),C.parent.update()}function T(R){document.activeElement.blur();window.focus();R.stopPropagation();R.preventDefault();C.click=0;C.evaluator.setVariable(C.mpressedStr,
0);C.evaluator.setVariable(C.mclickedStr,1);C.evaluator.setVariable(C.mclickIzqStr,1);C.whichBtn==="R"&&(window.removeEventListener("mousemove",W),C.posZoom==C.posZoomNew&&b.showConfig&&(C.parent.externalSpace.show(),C.posZoom=!1,C.posZoomNew=!0));window.removeEventListener("mousemove",ba);window.removeEventListener("mouseup",T);C.parent.deactivateControls();C.parent.update()}function V(R){C.posAnte=b.getCursorPosition(R,C.container);C.mouse_x=C.getRelativeX(C.posAnte.x);C.mouse_y=C.getRelativeY(C.posAnte.y);
C.evaluator.setVariable(C.mxStr,C.mouse_x);C.evaluator.setVariable(C.myStr,C.mouse_y);C.evaluator.setVariable(C.mclickedStr,0);C.evaluator.setVariable(C.mclickIzqStr,0);C.parent.update()}function W(R){R.preventDefault();C.posZoomNew=b.getCursorPosition(R,C.container).y;C.evaluator.setVariable(C.scaleStr,C.tempScale+C.tempScale/45*((C.posZoom-C.posZoomNew)/10));C.parent.update()}function ba(R){R.preventDefault();R.stopPropagation();C.fixed||(C.posNext=b.getCursorPosition(R,C.container),S=C.posAnte.x-
C.posNext.x,H=C.posAnte.y-C.posNext.y,C.evaluator.setVariable(C.OxStr,C.Ox-S),C.evaluator.setVariable(C.OyStr,C.Oy-H));V(R)}let C=this;C.posZoom=C.posZoomNew=null;C.sensitive_to_mouse_movements&&C.canvas.addEventListener("touchmove",V);C.canvas.addEventListener("touchstart",function(R){window.focus();document.activeElement.blur();if(C.evaluator.variables[C.id+".DJS_NO_FIXED"]||!C.fixed||C.sensitive_to_mouse_movements)C.parent.clearClick(),C.click=1,C.evaluator.setVariable(C.mpressedStr,1),C.evaluator.setVariable(C.mclickedStr,
0),C.evaluator.setVariable(C.mclickIzqStr,0),C.parent.deactivateControls(),V(R),window.addEventListener("touchmove",ba),window.addEventListener("touchend",K),R.stopPropagation(),R.preventDefault()});C.sensitive_to_mouse_movements&&C.canvas.addEventListener("mousemove",V);C.canvas.addEventListener("mousedown",function(R){window.focus();document.activeElement.blur();R.stopPropagation();R.preventDefault();C.parent.clearClick();C.click=1;C.parent.deactivateControls();C.whichBtn=b.whichBtn(R);C.whichBtn===
"R"?(window.addEventListener("mouseup",T),C.posZoom=b.getCursorPosition(R,C.container).y,C.posZoomNew=C.posZoom,C.fixed||(C.tempScale=C.scale,window.addEventListener("mousemove",W))):C.whichBtn==="L"&&(C.evaluator.setVariable(C.mpressedStr,1),C.evaluator.setVariable(C.mclickedStr,0),C.evaluator.setVariable(C.mclickIzqStr,0),V(R),window.addEventListener("mousemove",ba),window.addEventListener("mouseup",T))});document.addEventListener("visibilitychange",function(R){T(R)});document.addEventListener("mouseleave",
function(R){C.click=0;C.evaluator.setVariable(C.mpressedStr,0);C.evaluator.setVariable(C.mclickedStr,1);C.evaluator.setVariable(C.mclickIzqStr,1);window.removeEventListener("mousemove",ba);window.removeEventListener("mouseup",T)})}}b.Space2D=M})(descartesJS);
(b=>{var a,h,f;function l(K,T){return T.depth-K.depth}let d=Math.floor,g=Math.max,e=Math.cos,q=Math.sin,n,t,c,v,m,k,r,p,x,u,z,A,w,y,D,F,B=[],I,E,P,N,U,X,L,G,O,S,H;class M extends b.Space{constructor(K,T){super(K,T);c=this;c.ratio=K.ratio;c.backCanvas=b.newHTML("canvas",{id:c.id+"_background",width:c.w*c.ratio+"px",height:c.h*c.ratio+"px"});c.canvas=b.newHTML("canvas",{id:c.id+"_canvas",width:c.w*c.ratio+"px",height:c.h*c.ratio+"px",class:"DescartesSpace3DCanvas",style:"z-index: "+c.zIndex+";"});c.ctx=
c.canvas.getContext("2d");c.ctx.imageSmoothingEnabled=!1;c.canvas.ratio=c.ratio;c.canvas.style=c.backCanvas.style=`${c.border_width>0?"border:"+c.border_width+"px solid "+c.border_color.getColor()+";":""}${c.border_radius?"border-radius:"+c.border_radius+"px;":""}`;T=c.id+".image";c.parent.images[T]=c.canvas;c.parent.images[T].ready=1;c.parent.images[T].complete=!0;c.parent.images[T].canvas=!0;c.evaluator.setVariable(T,T);c.graphicControlContainer=b.newHTML("div",{id:c.id+"_graphicControls",style:`position:absolute;left:0px;top:0px;z-index:${c.zIndex};`});
c.numCtrContainer=b.newHTML("div",{id:c.id+"_numericalControls",style:`position:absolute;left:0px;top:0px;z-index:${c.zIndex};`});c.container=b.newHTML("div",{id:c.id,class:"DescartesSpace3DContainer",style:`z-index:${c.zIndex};`});c.container.appendChild(c.backCanvas);c.container.appendChild(c.canvas);c.container.appendChild(c.graphicControlContainer);c.container.appendChild(c.numCtrContainer);K.container.insertBefore(c.container,K.loader);c.eye={x:0,y:0,z:0};c.lights=[{x:50,y:50,z:70},{x:50,y:-50,
z:30},{x:20,y:0,z:-80},{x:0,y:0,z:0}];for(let V=0,W=c.lights.length;V<W;V++)c.lights[V]=b.normalize3D(c.lights[V]);c.light3={x:0,y:0,z:0};c.intensity=[.4,.5,.3,0];c.userIntensity=0;c.dim=1;c.tmpIntensity=[];c.OxStr=c.id+".Ox";c.OyStr=c.id+".Oy";c.scaleStr=c.id+".escala";c.wStr=c.id+"._w";c.hStr=c.id+"._h";c.mxStr=c.id+".mouse_x";c.myStr=c.id+".mouse_y";c.mpressedStr=c.id+".mouse_pressed";c.mclickedStr=c.id+".mouse_clicked";c.mclickIzqStr=c.id+".clic_izquierdo";c.obsStr=c.id+".observador";c.ojoXStr=
c.id+".Ojo.x";c.ojoYStr=c.id+".Ojo.y";c.ojoZStr=c.id+".Ojo.z";c.rotZStr=c.id+".rot.z";c.rotYStr=c.id+".rot.y";c.userIDimStr=c.id+".userIlum.dim";c.userIIStr=c.id+".userIlum.I";c.userIxStr=c.id+".userIlum.x";c.userIyStr=c.id+".userIlum.y";c.userIzStr=c.id+".userIlum.z";c.evaluator.setVariable(c.rotZStr,0);c.evaluator.setVariable(c.rotYStr,0);c.evaluator.setVariable(c.userIDimStr,c.dim);c.evaluator.setVariable(c.userIIStr,c.userIntensity);c.evaluator.setVariable(c.userIxStr,0);c.evaluator.setVariable(c.userIyStr,
0);c.evaluator.setVariable(c.userIzStr,0);H=new b.Primitive3D({V:[new b.Vec4D],type:"vertex"},c);c.evaluator.setFunction(c.id+"._X3D2D_",function(V,W,ba){H.V[0].x=V;H.V[0].y=W;H.V[0].z=ba;H.computeDepth(c);return H.projV[0].x});c.evaluator.setFunction(c.id+"._Y3D2D_",function(V,W,ba){H.V[0].x=V;H.V[0].y=W;H.V[0].z=ba;H.computeDepth(c);return H.projV[0].y});c.resizable&&(c.wModExpr=K.evaluator.parser.parse(c.wModExpr),c.hModExpr=K.evaluator.parser.parse(c.hModExpr));c.addEvents()}init(K){c=this;c.initSpace();
c.canvas&&(c.old_w=c.w,c.old_h=c.h,c.canvas.width=c.backCanvas.width=c.w*c.ratio,c.canvas.height=c.backCanvas.height=c.h*c.ratio,c.canvas.style.width=c.backCanvas.style.width=c.w+"px",c.canvas.style.height=c.backCanvas.style.height=c.h+"px");c.w_2=c.w/2;c.h_2=c.h/2;c.w_plus_h=c.w+c.h;c.oldMouse={x:0,y:0};c.S={x:c.h/1080*(40/c.scale)*-20.6,y:0,z:0};c.Ojo={x:3*c.w_2,y:0,z:0};c.evaluator.setVariable(c.ojoXStr,c.Ojo.x);c.evaluator.setVariable(c.ojoYStr,c.Ojo.y);c.evaluator.setVariable(c.ojoZStr,c.Ojo.z)}update(K){c=
this;n=c.evaluator;t=c.parent;n.setVariable(c.wStr,c.w);n.setVariable(c.hStr,c.h);c.drawIfValue=n.eval(c.drawif)>0;if(c.drawIfValue){c.resizable&&(wModExpr=c.evaluator.eval(c.wModExpr),hModExpr=c.evaluator.eval(c.hModExpr),c.old_w!=wModExpr||c.old_h!=hModExpr)&&(c.w=wModExpr,c.h=hModExpr,c.w_2=c.w/2,c.h_2=c.h/2,n.setVariable(c.wStr,c.w),n.setVariable(c.hStr,c.h),c.old_w=c.w,c.old_h=c.h,c.canvas.width=c.backCanvas.width=c.w*c.ratio,c.canvas.height=c.backCanvas.height=c.h*c.ratio,c.canvas.style.width=
c.backCanvas.style.width=c.w+"px",c.canvas.style.height=c.backCanvas.style.height=c.h+"px",K=!0,c.S={x:c.h/1080*(40/c.scale)*-20.6,y:0,z:0},c.Ojo={x:3*c.w_2,y:0,z:0},c.evaluator.setVariable(c.ojoXStr,c.Ojo.x),c.evaluator.setVariable(c.ojoYStr,c.Ojo.y),c.evaluator.setVariable(c.ojoZStr,c.Ojo.z));k=c.x!==n.eval(c.xExpr)+c.displaceRegionWest;r=c.y!==n.eval(c.yExpr)+t.plecaHeight+c.displaceRegionNorth;c.spaceChange=K||k||r||c.drawBefore!==c.drawIfValue||c.Ox!==n.getVariable(c.OxStr)||c.Oy!==n.getVariable(c.OyStr)||
c.Ojo.x!==n.getVariable(c.ojoXStr)||c.Ojo.y!==n.getVariable(c.ojoYStr)||c.Ojo.z!==n.getVariable(c.ojoZStr)||c.scale!==n.getVariable(c.scaleStr);c.x=k?n.eval(c.xExpr)+c.displaceRegionWest:c.x;c.y=r?n.eval(c.yExpr)+t.plecaHeight+c.displaceRegionNorth:c.y;c.Ojo.x=n.getVariable(c.ojoXStr);c.Ojo.y=n.getVariable(c.ojoYStr);c.Ojo.z=n.getVariable(c.ojoZStr);c.Ox=n.getVariable(c.OxStr);c.Oy=n.getVariable(c.OyStr);c.scale=n.getVariable(c.scaleStr);c.drawBefore=c.drawIfValue;if(K||c.observer==void 0){for(let T=
0,V=c.parent.controls.length;T<V;T++)c.parent.controls[T].id===c.obsStr&&(S=!0);c.observer=S?n.getVariable(c.obsStr)||c.w_plus_h*2.5:c.w_plus_h*2.5;c.observer=g(c.observer,.25*c.w_plus_h);n.setVariable(c.obsStr,c.observer)}c.scale<1E-6?(c.scale=1E-6,n.setVariable(c.scaleStr,1E-6)):c.scale>1E6&&(c.scale=1E6,n.setVariable(c.scaleStr,1E6));if(k||r)c.container.style.left=c.x+"px",c.container.style.top=c.y+"px";c.container.style.display="block";c.dim=n.getVariable(c.userIDimStr);c.userIntensity=n.getVariable(c.userIIStr);
c.light3={x:parseInt(n.getVariable(c.userIxStr)),y:parseInt(n.getVariable(c.userIyStr)),z:parseInt(n.getVariable(c.userIzStr))};c.updateCamera();c.ctx.setTransform(c.ratio,0,0,c.ratio,0,0);c.draw()}else c.container.style.display="none"}updateCamera(){this.eye=b.scalarProd3D(this.Ojo,1/this.scale)}rotateVertex(K){u=b.degToRad(c.evaluator.getVariable(c.rotZStr));z=e(u);A=q(u);a=K.x*z-K.y*A;h=K.x*A+K.y*z;f=K.z;u=b.degToRad(c.evaluator.getVariable(c.rotYStr));z=e(u);A=q(u);return{x:f*A+a*z,y:h,z:f*z-
a*A}}project(K){let T=c.eye.x/(K.x-c.eye.x);return{x:c.getAbsoluteX(T*(c.eye.y-K.y)),y:c.getAbsoluteY(T*(c.eye.z-K.z)),z:c.eye.x-K.x}}computeColor(K,T,V){typeof K!="object"&&(K.match("rgba")?K=b.RGBAToHexColor(K):K.match("#")&&(K=new b.Color(K.substring(1))));N=b.subtract3D(this.eye,T.avg);U=b.norm3D(N);X=b.scalarProd3D(N,1/U);this.lights[3]=b.subtract3D(this.light3,T.avg);F=b.norm3D(this.lights[3]);for(let Y=0,Z=this.intensity.length-1;Y<Z;Y++)B[Y]=this.intensity[Y]*this.dim;B[3]=this.userIntensity*
this.userIntensity/F||0;I=V?this.dim/2:this.dim/4;E=0;P=T.direction<0?T.normal:b.scalarProd3D(T.normal,-1);for(let Y=0,Z=this.lights.length;Y<Z;Y++){if(V){T=Math;var W=T.max,ba=b,C=ba.dotProduct3D;var R=this.lights[Y];L=b.subtract3D(R,b.scalarProd3D(P,b.dotProduct3D(R,P)));G=b.add3D(R,b.scalarProd3D(L,-2));O=b.norm3D(G);R=O!==0?b.scalarProd3D(G,1/O):b.scalarProd3D(R,-1);E=W.call(T,0,C.call(ba,R,X));E*=E*E}else E=Math.max(0,b.dotProduct3D(this.lights[Y],P));I+=B[Y]*E}I=Math.min(I,1);w=d(K.r*I);y=d(K.g*
I);D=d(K.b*I);return"rgba("+w+","+y+","+D+","+K.a+")"}draw(){c=this;c.ctx.clearRect(0,0,c.canvas.width,c.canvas.height);c.ctx.fillStyle=c.background.getColor();c.ctx.fillRect(0,0,c.canvas.width,c.canvas.height);c.image&&c.image.src!=""&&c.image.ready&&c.image.complete&&(c.bg_display==="topleft"?c.ctx.drawImage(c.image,0,0):c.bg_display==="stretch"?c.ctx.drawImage(c.image,0,0,c.w,c.h):c.bg_display==="patch"?(c.ctx.fillStyle=ctx.createPattern(c.image,"repeat"),c.ctx.fillRect(0,0,c.canvas.width,c.canvas.height)):
c.bg_display==="center"&&c.ctx.drawImage(c.image,(c.w-c.image.width)/2,(c.h-c.image.height)/2));if(!c.click){for(var K of c.graphics)K.update();c.primitives=[];if(c.split)for(let T=0,V=c.graphics.length;T<V;T++){v=c.graphics[T];for(K=T+1;K<V;K++)m=c.graphics[K],v.splitFace(m),m.splitFace(v);c.primitives=c.primitives.concat(v.primitives||[])}else for(let T=0,V=this.graphics.length;T<V;T++){v=this.graphics[T];if(v.split)for(K=T+1;K<V;K++)m=this.graphics[K],m.split&&v.splitFace(m);this.primitives=this.primitives.concat(v.primitives||
[])}}for(let T of this.primitives)T.computeDepth(this);this.primitives=this.primitives.sort(l);if(this.render==="painter")this.drawPainter(this.primitives);else for(let T of this.primitives)T.draw(this.ctx,this);for(let T of this.graphicsCtr)T.draw()}drawPainter(K){let T=K.length;for(var V=0;V<T;V++)K[V].drawn=!1,K[V].draw(this.ctx,this);var W=[];V=[];let ba=0,C=K.length,R=.001,Y,Z;for(;;){Y=C;for(let J=0;J<T;J++)if(!K[J].drawn){Z=!0;for(let Q=0;Q<T;Q++)if(Q!=J&&!K[Q].drawn&&K[J].inFrontOf(W,K[Q],
R)){Z=!1;break}Z&&(C--,V[ba++]=K[J],K[J].drawn=!0)}if(C==0)break;else if(C==Y){if(R*=10,R>.1){for(W=0;W<T;W++)K[W].drawn||(V[ba++]=K[W],K[W].drawn=!0);break}}else R=.001}for(K=0;K<T;K++)V[K].draw(this.ctx,this)}rayFromEye(K,T){return{x:-this.eye.x,y:(K-(this.w_2+this.Ox))/this.scale-this.eye.y,z:(this.h_2+this.Oy-T)/this.scale-this.eye.z}}addEvents(){function K(R){window.focus();document.activeElement.blur();C.click=0;C.evaluator.setVariable(C.mpressedStr,0);window.removeEventListener("touchmove",
ba,!1);window.removeEventListener("touchend",K,!1);R.preventDefault();C.parent.update()}function T(R){document.body.focus();C.click=0;C.evaluator.setVariable(C.mpressedStr,0);R.preventDefault();C.whichBtn==="R"&&(window.removeEventListener("mousemove",W,!1),C.posZoom==C.posZoomNew&&b.showConfig&&C.parent.externalSpace.show());window.removeEventListener("mousemove",ba,!1);window.removeEventListener("mouseup",T,!1);C.parent.update()}function V(R){C.posAnte=b.getCursorPosition(R,C.container);C.mouse_x=
C.getRelativeX(C.posAnte.x);C.mouse_y=C.getRelativeY(C.posAnte.y);C.evaluator.setVariable(C.mxStr,C.mouse_x);C.evaluator.setVariable(C.myStr,C.mouse_y);C.parent.update()}function W(R){R.preventDefault();C.posZoomNew=b.getCursorPosition(R,C.container).y;C.evaluator.setVariable(C.scaleStr,C.tempScale+C.tempScale/45*((C.posZoom-C.posZoomNew)/10));C.posObserverNew=b.getCursorPosition(R,C.container).x;C.evaluator.setVariable(C.obsStr,C.tempObserver-(C.posObserver-C.posObserverNew)*2.5);C.parent.update()}
function ba(R){if(!C.fixed&&C.click){p=(C.getAbsoluteX(C.oldMouse.x)-C.getAbsoluteX(C.mouse_x))/4;x=(-C.getAbsoluteY(C.oldMouse.y)+C.getAbsoluteY(C.mouse_y))/4;if(p!==C.disp.x||x!==C.disp.y)C.alpha=b.degToRad(C.evaluator.getVariable(C.rotZStr)),C.beta=b.degToRad(-C.evaluator.getVariable(C.rotYStr)),C.alpha=b.radToDeg(C.alpha)-p,C.beta=b.radToDeg(C.beta)-x,C.evaluator.setVariable(C.rotZStr,C.alpha),C.evaluator.setVariable(C.rotYStr,-C.beta),C.disp.x=p,C.disp.y=x,C.oldMouse.x=C.getRelativeX(C.posAnte.x),
C.oldMouse.y=C.getRelativeY(C.posAnte.y);V(R);R.preventDefault()}}let C=this;C.canvas.addEventListener("touchstart",function(R){window.focus();document.activeElement.blur();C.click=1;C.evaluator.setVariable(C.mpressedStr,1);C.parent.deactivateControls();C.posAnte=b.getCursorPosition(R,C.container);C.oldMouse.x=C.getRelativeX(C.posAnte.x);C.oldMouse.y=C.getRelativeY(C.posAnte.y);V(R);window.addEventListener("touchmove",ba);window.addEventListener("touchend",K);R.preventDefault()});C.canvas.addEventListener("mousedown",
function(R){document.body.focus();C.click=1;C.parent.deactivateControls();C.whichBtn=b.whichBtn(R);C.whichBtn==="R"?(window.addEventListener("mouseup",T),C.posObserver=b.getCursorPosition(R,C.container).x,C.posObserverNew=C.posObserver,C.posZoom=b.getCursorPosition(R,C.container).y,C.posZoomNew=C.posZoom,C.fixed||(C.tempScale=C.scale,C.tempObserver=C.observer,window.addEventListener("mousemove",W))):C.whichBtn=="L"&&(C.evaluator.setVariable(C.mpressedStr,1),C.posAnte=b.getCursorPosition(R,C.container),
C.oldMouse.x=C.getRelativeX(C.posAnte.x),C.oldMouse.y=C.getRelativeY(C.posAnte.y),V(R),window.addEventListener("mousemove",ba),window.addEventListener("mouseup",T));R.preventDefault()});C.disp={x:0,y:0};document.addEventListener("visibilitychange",function(R){T(R)});document.addEventListener("mouseleave",function(R){T(R)})}}b.Space3D=M})(descartesJS);
(b=>{let a,h,f,l,d,g,e,q;class n extends b.Space{constructor(t,c){super(t,c);const v=this;h=v.parent.evaluator;v._w_!=void 0&&(t=h.parser.parse(v._w_),v._w_=t.type!="number"?t:void 0);v._h_!=void 0&&(t=h.parser.parse(v._h_),v._h_=t.type!="number"?t:void 0);v.isFirefox=/firefox/i.test(window.navigator.userAgent);v.file=v.file?v.file.trim():"";/^\[.*\]$/.test(v.file)?v.file=h.parser.parse(v.file.slice(1,-1)):/^'.*'$/.test(v.file)?v.file=h.parser.parse(v.file):v.file=h.parser.parse(`'${v.file}'`);v.oldFile=
h.eval(v.file);v.MyIFrame=b.newHTML("iframe",{marginheight:0,marginwidth:0,frameborder:0,scrolling:"auto",class:"DescartesSpaceIframe"});v.oldFile!=0&&v.MyIFrame.setAttribute("src",v.oldFile);v.container=b.newHTML("div",{id:v.id,class:"DescartesSpaceIframeContainer",style:`width:${v.w}px;height:${v.h}px;left:${v.x}px;top:${v.y}px;z-index:${v.zIndex};${b.isIOS?"overflow:scroll;-webkit-overflow-scrolling:touch;overflow-scrolling:touch;":""}`});v.container.appendChild(v.MyIFrame);v.imageSrc&&(v.container.style.backgroundImage=
`url(${v.imageSrc})`);v.parent.container.insertBefore(v.container,v.parent.loader);v.MyIFrame.onload=function(m){let k=this;v.evaluator.setFunction(v.id+".set",function(r,p){k.contentWindow.postMessage({type:"set",name:r,value:p},"*");return 0});v.evaluator.setFunction(v.id+".update",function(){k.contentWindow.postMessage({type:"update"},"*");return 0});v.evaluator.setFunction(v.id+".exec",function(r,p){k.contentWindow.postMessage({type:"exec",name:r,value:p},"*");return 0});v.evaluator.setFunction(v.id+
".changeConf",function(r){if(r){if(b.cacheFiles[r])var p=b.cacheFiles[r];else p=(p=document.getElementById(r))&&p.type==="descartes/embed"?p.textContent:b.openFile(r),p=(p=(new DOMParser).parseFromString(p,"text/html").querySelector("ajs"))?p.innerHTML:"",b.cacheFiles[r]=p;k.contentWindow.postMessage({type:"change_config",filename:r,content:p},"*")}return 0});v.evaluator.setFunction(v.id+".changeContent",function(r){r&&(r=(r=(new DOMParser).parseFromString(r.replace(/&sq;/g,"'"),"text/html").querySelector("ajs"))?
r.innerHTML:"",k.contentWindow.postMessage({type:"change_content",content:r},"*"))});v.ImReady=!v.isFirefox;v.isFirefox||(v.container.style.visibility="visible",v.container.style.opacity="1",v.container.style.zIndex=v.zIndex,v.container.style.display=v.drawIfValue?"block":"none");v.MyIFrame.style.visibility="visible";v.container.style.backgroundImage=""};v.update();v.evaluator.setVariable(v.id+"._scroll",0)}init(){this.initSpace()}update(t){a=this;f=a.container;h=a.evaluator;a.drawIfValue=h.eval(a.drawif)>
0;a.ImReady?f.style.display=a.drawIfValue?"block":"none":(f.style.visibility=a.drawIfValue?"visible":"hidden",f.style.opacity=a.drawIfValue?"1":"0",f.style.zIndex=a.drawIfValue?a.zIndex:-1E3);if(a.drawIfValue){t&&(a.x=a.y=Infinity);g=h.eval(a.xExpr)+a.displaceRegionWest;if(l=a.x!==g)a.x=g;g=h.eval(a.yExpr)+a.parent.plecaHeight+a.displaceRegionNorth;if(d=a.y!==g)a.y=g;a._w_!=void 0&&(g=h.eval(a._w_),a.w!==g&&(a.container.style.width=g+"px",a.w=g));a._h_!=void 0&&(g=h.eval(a._h_),a.h!==g&&(f.style.height=
g+"px",a.h=g));if(l||d)a.container.style.left=a.x+"px",a.container.style.top=a.y+"px";e=h.eval(a.file);e!==a.oldFile&&(a.ImReady=!1,a.isFirefox||(f.style.display="block",f.style.visibility=a.drawIfValue?"visible":"hidden",f.style.opacity=a.drawIfValue?"1":"0",f.style.zIndex=a.drawIfValue?a.zIndex:-1E3),a.imageSrc&&(f.style.backgroundImage=`url(${a.imageSrc})`),a.MyIFrame.style.visibility="hidden",a.oldFile=e,a.MyIFrame.contentWindow.location.replace(e));q=h.getVariable(a.id+"._scroll");q==1?(a.MyIFrame.setAttribute("scrolling",
"yes"),a.MyIFrame.style.overflow=""):q==-1?(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=n})(descartesJS);
(b=>{let a=1;class h{constructor(f){this.children=f.children;this.lessonParser=f.lessonParser;this.images=f.images;this.audios=f.audios;this.im_l=this.au_l=0;this.descartesApp=f;var l=document.querySelectorAll('script[type="descartes/imagen"]');for(let d of l)this.images[d.id]=new Image,this.images[d.id].onload=function(){this.ready=1},l=d.innerText.trim(),l.startsWith("data:image/svg+xml,")&&(l=encodeURIComponent(l).replace("data%3Aimage%2Fsvg%2Bxml%2C","data:image/svg+xml,")),this.images[d.id].src=
l;this.imgLoader=b.newHTML("div",{class:"DescartesLoaderImage"});this.progress=b.newHTML("progress",{class:"PBL",value:0,max:100});f.imgLoader?(f.loader.style.backgroundColor="transparent",this.imgLoader.setAttribute("style",`background-image:url(${f.imgLoader});background-size:contain;`)):(a=f.width<f.height?f.width/1144:f.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:${(f.width-726*a)/2}px;top:${f.height*33.5/100+940*a/2}px;width:${726*a}px;height:${14*a}px;`));f.loader.appendChild(this.imgLoader);f.loader.appendChild(this.progress);f.firstRun=!1;this.initPreloader()}initPreloader(){let f=this,l=f.children,d=f.images,g=f.audios,e=/[\w\.\-//]*(\.png|\.jpg|\.gif|\.svg|\.webp)/gi,q=/[\w\.\-//]*(\.ogg|\.oga|\.mp3|\.wav)/gi,n=/'macro'|'makro'/g;let t;let c,v;t=0;for(c=l.length;t<c;t++){if(l[t].value.match(n)){var m="";var k=void 0;var r=f.lessonParser.split(l[t].value);
for(let A=0,w=r.length;A<w;A++)babel[r[A][0]]==="expresion"&&(m=r[A][1]);m&&(k=(k=document.getElementById(m))&&k.type=="descartes/macro"?k.text:b.openFile(m));if(k&&(r=k.match(e)))for(m=0,v=r.length;m<v;m++){var p=r[m];p.toLowerCase().endsWith("vacio.gif")||p.substring(0,p.length-4)==""||d[p]||(d[p]=this.descartesApp.getImageAux(p))}}if(r=l[t].value.match(e))for(m=0,v=r.length;m<v;m++)p=r[m],p.toLowerCase().endsWith("vacio.gif")||p.substring(0,p.length-4)==""||d[p]||(d[p]=this.descartesApp.getImageAux(p));
if(r=l[t].value.match(q))for(m=0,p=r.length;m<p;m++)g[r[m]]||(g[r[m]]=this.descartesApp.getAudioAux(r[m]))}for(let A in d)d.hasOwnProperty(A)&&f.im_l++;for(let A in g)g.hasOwnProperty(A)&&f.au_l++;let x=f.im_l+f.au_l;x>0&&f.progress.setAttribute("max",x);let u,z=function(){u=0;for(let A in d)d.hasOwnProperty(A)&&(d[A].ready||d[A].errorload)&&u++;for(let A in g)g.hasOwnProperty(A)&&(g[A].ready||g[A].errorload)&&u++;f.progress.setAttribute("value",u);u!=x?f.timer=b.setTimeout(z,1):f.descartesApp.initBuildApp()};
z()}}b.DescartesLoader=h})(descartesJS);
(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})`}let h=/type='fill'|tipo='relleno'|tipus='ple'|mota='betea'|type='plein'|tipo='recheo'|tipo='curva_piena'|tipo='preencher'|tipus='ple'/;class f{constructor(l){this.animation={playing:!1,play:()=>{},stop:()=>
{},reinit:()=>{}};this.ratio=b._ratio;this.URL=window.location.href;this.applet=l;this.parentC=l.parentNode;this.width=parseFloat(l.getAttribute("width"));this.height=parseFloat(l.getAttribute("height"));this.decimal_symbol=".";this.decimal_symbol_regexp=RegExp("\\.","g");this.language="espa\u00f1ol";this.children=l.getElementsByTagName("param");this.code=l.getAttribute("code");this.images={};this.audios={};this.firstRun=!0;this.keyboard=new b.Keyboard(this);this.scaleToFit=()=>{};this.init()}init(){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 l=this.children;let d;for(d of l)if(babel[d.name]=="Buttons")this.buttonsConfig=this.lessonParser.parseButtonsConfig(d.value);else if(d.name=="image_loader")this.imgLoader=d.value;else if(d.name==
"expand")this.expand=d.value;else if(d.name=="docBase")document.head.appendChild(b.newHTML("base",{id:"descartesJS_base",href:d.value}));else if(d.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;this.container!=void 0&&(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);this.expand=="fit"&&(l=b.newHTML("style",{rel:"stylesheet",type:"text/css",id:"StyleDescartesAppsPrint"}),document.head.insertBefore(l,document.head.firstChild),
l.innerHTML=`@page{margin:0cm;size:${this.width}px ${this.height}px;}`,(l=document.querySelector("meta[name=viewport"))&&window.parent==window&&l.setAttribute("content","width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no,viewport-fit=cover"),document.body.style.margin=document.body.style.padding=0,document.body.style.width="100vw",document.body.style.height="100dvh",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());this.expand=="cover"&&(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(g){}if(this.spaces)for(const g of this.spaces)g.initSpace(),g.init(),g.update(!0)},this.scaleToFit());this.firstRun?(this.loader.style.display="block",new b.DescartesLoader(this)):this.initBuildApp()}initBuildApp(){b.showConfig=!0;let l=this,d=l.children,g,e=l.lessonParser,q=[],n=[],t=[],c=[],v=[],m=[];for(g of d)babel[g.name]=="editable"?b.showConfig=babel[g.value]!="false":babel[g.name]=="language"?l.language=g.value:babel[g.name]=="Buttons"?l.buttonsConfig=
e.parseButtonsConfig(g.value):babel[g.name]=="decimal_symbol"?(l.decimal_symbol=g.value,l.decimal_symbol_regexp=new RegExp("\\"+l.decimal_symbol,"g")):babel[g.name]=="version"?l.version=parseInt(g.value):g.name.startsWith("E_")?(/='HTMLIFrame'/.test(g.value)&&l.nIframes++,q.push(g.value)):g.name.startsWith("C_")?n.push(g.value):g.name.startsWith("A_")?t.push(g.value):g.name.startsWith("G_")?(h.test(g.value)&&(l.ratio=1),c.push(g.value)):g.name.startsWith("S_")?v.push(g.value):babel[g.name]=="Animation"&&
m.push(g.value);for(let k of q)l.spaces.push(e.parseSpace(k)),l.zIndex++;c.forEach((k,r)=>{b.DEBUG.elemIndex=r;if(k=e.parseGraphic(k))l.editableRegionVisible=l.editableRegionVisible||k.visible,k.space.addGraph(k)});v.forEach((k,r)=>{b.DEBUG.elemIndex=r;(k=e.parse3DGraphic(k))&&k.space.addGraph(k,!0)});for(let k of n)l.controls.push(e.parseControl(k));for(let k of t)e.parseAuxiliar(k);for(let k of m)l.animation=e.parseAnimation(k);l.configRegions();l.updateAuxiliaries();l.updateAuxiliaries();for(let k of l.controls)k.init();
l.updateControls();l.updateSpaces(!0);b.setTimeout(()=>{l.finishInit()},10*l.nIframes);document.addEventListener("keydown",function(k){if(k.ctrlKey&&k.shiftKey&&k.key==="C"||k.commandKey&&k.shiftKey&&k.key==="C")navigator.clipboard.writeText(l.applet.innerHTML),b.preventDefault(k)})}finishInit(){let l=this;l.evaluator.setVariable("decimalSymbol",l.decimal_symbol);l.update();l.loader.parentNode.removeChild(l.loader);window.parent!==window&&(l.parentC.style.margin=l.parentC.style.padding="0px",l.expand==
"fit"&&window.addEventListener("touchmove",d=>{d.preventDefault();d.stopPropagation()}),window.parent.postMessage({type:"reportSize",href:l.URL,width:l.width,height:l.height},"*"),window.parent.postMessage({type:"ready",value:l.URL},"*"),b.onResize());window.opener&&window.opener.postMessage({type:"isResizeNeeded",href:l.URL},"*");b.showConfig&&l.externalSpace.init();try{window.dispatchEvent(new CustomEvent("descartesReady",{detail:l}))}catch(d){console.warn("CustomEvents not supported in this browser")}l.evaluator.setFunction("openKB",
function(d,g,e,q,n,t,c,v,m,k,r){l.keyboard.show(null,d,g,e,q,{x:n,y:t,w:c,h:v,fs:m+"px",value:k+"",type:"custom",tagName:"textfield"},r)});l.readyApp=!0}adjustSize(){document.body.style.margin=document.body.style.padding=this.parentC.style.margin=this.parentC.style.padding="0px";const l=parseInt(this.width+30),d=parseInt(this.height+90);window.moveTo(parseInt(screen.width-l)/2,parseInt(screen.height-d)/2);window.resizeTo(l,d);b.onResize()}configRegions(){var l=this.evaluator.parser,d=this.buttonsConfig||
{},g=this.container,e=100,q=100;let n=0,t=0;let c=0;let v=0,m=0;var k=this.northSpace.controls,r=this.southSpace.controls;var p=this.eastSpace.controls;var x=this.westSpace.controls;if(d.rowsNorth>0||k.length>0||d.about||d.config){d.rowsNorth<=0?(n=d.height,d.rowsNorth=1):n=d.height*d.rowsNorth;var u=this.northSpace.container;u.id="descartesJS_north";u.setAttribute("style",`width:${g.width}px;height:${n}px;left:0;top:${this.plecaHeight}px;`);g.insertBefore(u,this.loader);u=g.width;var z=0;d.about?
(z=e,u-=z):e=0;d.config&&(u-=100);let A=Math.ceil(k.length/d.rowsNorth),w=u/A;for(let y=0,D=k.length;y<D;y++)k[y].expresion=l.parse(`(${z+y%A*w},${d.height*Math.floor(y/A)},${w},${d.height})`),k[y].init();d.about&&(k=new b.Button(this,{region:"north",name:this.language=="english"?"about":"cr\u00e9ditos",font_size:l.parse("15"),expresion:l.parse(`(0,0,${e},${n})`)}),k.actionExec={execute:b.showAbout},k.update());d.config&&(new b.Button(this,{region:"north",name:"config",font_size:l.parse("15"),action:"config",
expresion:l.parse(`(${u+e},0,100,${n})`)})).update()}if(d.rowsSouth>0||r.length>0||d.init||d.clear){d.rowsSouth<=0?(t=d.height,d.rowsSouth=1):t=d.height*d.rowsSouth;e=g.width;u=0;d.init?(u=q,e-=u):q=0;d.clear&&(e-=100);k=this.southSpace.container;k.id="descartesJS_south";k.setAttribute("style",`width:${g.width}px;height:${t}px;left:0;bottom:0;`);g.insertBefore(k,this.loader);k=Math.ceil(r.length/d.rowsSouth);z=e/k;for(let A=0,w=r.length;A<w;A++)r[A].expresion=l.parse(`(${u+A%k*z},${d.height*Math.floor(A/
k)},${z},${d.height})`),r[A].init();d.init&&(new b.Button(this,{region:"south",name:this.language=="english"?"init":"inicio",font_size:l.parse("15"),action:"init",expresion:l.parse(`(0,0,${q},${t})`)})).update();d.clear&&(new b.Button(this,{region:"south",name:this.language=="english"?"clear":"limpiar",font_size:l.parse("15"),action:"clear",expresion:l.parse(`(${e+q},0,100,${t})`)})).update()}if(p.length>0){q=g.height-n-t;v=d.widthEast;r=this.eastSpace.container;r.id="descartesJS_east";r.setAttribute("style",
`width:${v}px;height:${q}px;right:0;top:${n}px;`);g.insertBefore(r,this.loader);for(let A=0,w=p.length;A<w;A++)p[A].expresion=l.parse(`(0,${d.height*A},${v},${d.height})`),p[A].init()}if(x.length>0){p=g.height-n-t;m=d.widthWest;q=this.westSpace.container;q.id="descartesJS_west";q.setAttribute("style",`width:${m}px;height:${p}px;left:0;top:${n}px;`);g.insertBefore(q,this.loader);for(let A=0,w=x.length;A<w;A++)x[A].expresion=l.parse(`(0,${d.height*A},${m},${d.height}`),x[A].init()}if(this.editableRegionVisible){c=
d.height;l=this.editableRegion.container;l.id="descartesJS_editableRegion";l.setAttribute("style",`position:absolute;width:${g.width}px;height:${c}px;left:0;top:${g.height-t-d.height}px;`);g.insertBefore(l,this.loader);d=this.editableRegion.textFields;g=g.width/d.length;x=b.getFieldFontSize(c);for(let A=0,w=d.length;A<w;A++)d[A].type=="div"?(l.appendChild(d[A].container),d[A].container.setAttribute("style",`font-family:${b.sansserif_font};width:${g-4}px;height:${c}px;position:absolute;left:${A*g}px;top:0;`),
p=d[A].container.firstChild,p.setAttribute("style",`font-family:${b.sansserif_font};font-size:${x}px;padding-top:0;background-color:#e0e4e8;position:absolute;left:0;top:0;height:${c}px;text-align:center;line-height:${c}px;`),q=p.offsetWidth,p.style.width=q+"px",p.firstChild.textContent=p.firstChild.textContent.substring(3,p.firstChild.textContent.length-3),d[A].container.lastChild.setAttribute("style",`font-family:${b.monospace_font};font-size:${x}px;width:${g-q}px;height:${c}px;position:absolute;left:${q}px;top:0;border:2px groove white;`)):
(l.appendChild(d[A]),d[A].setAttribute("style",`font-family:${b.monospace_font};font-size:${x}px;width:${g}px;height:${c}px;position:absolute;left:${A*g}px;top:0;border:2px groove white;`))}this.displaceRegionNorth=n;this.displaceRegionSouth=t+(c||0);this.displaceRegionEast=v;this.displaceRegionWest=m;for(let A of this.spaces)A.init()}update(){this.updateAuxiliaries();this.updateControls();this.updateEvents();this.updateControls();this.updateSpaces()}clearClick(){for(let l of this.spaces)l.clearClick()}removeButtonClick(){b.newBlobContent=
null;for(let l of this.controls)l.buttonClick=!1}deactivateControls(){if(this.controls)for(let l of this.controls)l.deactivate&&l.deactivate()}updateAuxiliaries(){for(let l of this.auxiliaries)l.update()}updateEvents(){for(let l of this.events)l.update()}updateControls(){for(let l of this.controls)l.update()}updateSpaces(l){for(let d of this.spaces)d.update(l)}clear(){for(let l of this.spaces)l.spaceChange=!0,l.drawBackground&&l.drawBackground()}play(){this.animation.play()}stop(){this.animation.stop()}reinitAnimation(){this.animation.reinit()}stopAudios(){this.stop();
for(let l in this.audios)this.audios.hasOwnProperty(l)&&this.audios[l].pause&&(this.audios[l].pause(),this.audios[l].currentTime=0)}getImage(l){return l?(this.images[l]||(this.images[l]=this.getImageAux(l)),this.images[l]):new Image}getImageAux(l){const d=new Image;l.startsWith("http")&&(d.crossOrigin="Anonymous");d.onload=function(){this.ready=1};d.onerror=function(){this.errorload=1};d.src=l;return d}getAudio(l){return l?(this.audios[l]||(this.audios[l]=this.getAudioAux(l)),this.audios[l]):new Audio}getAudioAux(l){let d=
new Audio(l);d.filename=l;let g=function(){this.ready=1},e=function(){this.canPlayType("audio/"+this.filename.substring(this.filename.length-3))||this.filename.substring(this.filename.length-3)!="mp3"?(console.warn(`El archivo ${l} no puede ser reproducido`),this.errorload=1):(d=new Audio(this.filename.replace("mp3","ogg")),d.filename=this.filename.replace("mp3","ogg"),d.addEventListener("canplaythrough",g),d.addEventListener("load",g),d.addEventListener("error",e),d.load())};d.addEventListener("canplaythrough",
g);d.addEventListener("load",g);d.addEventListener("error",e);b.hasTouchSupport?(d.load(),d.play(),b.setTimeout(()=>{d.pause()},20),d.ready=1):d.load();return d}getControlByCId(l){return this.getControlById(l,!0)}getControlById(l,d){d=d?"cID":"id";for(let g of this.controls)if(g[d]==l)return g;return{update:()=>{},w:0,h:0}}getSpaceByCId(l){return this.getSpaceById(l,!0)}getSpaceById(l,d){d=d?"cID":"id";for(let g of this.spaces)if(g[d]==l)return g;return{update:()=>{},w:0,h:0}}getURLParameters(){var l=
this.URL;let d=l.indexOf("?");if(d!=-1){l=decodeURIComponent(l.substring(d+1)).split("&");for(let g of l)l=g.split("="),l.length==2&&this.evaluator.setVariable(`URL.${l[0]}`,+l[1]==+l[1]?parseFloat(l[1]):l[1])}}cleanCanvasImages(){this.container.querySelectorAll("canvas").forEach(l=>{l.width=l.height=1;l.style.width=l.style.height="1px"});this.spaces.forEach(l=>{l.canvas&&(l.canvas=l.ctx=null);l.backCanvas&&(l.backCanvas=l.backCtx=null)});for(let l in this.images)this.images[l].nodeName&&this.images[l].nodeName.toLowerCase()===
"canvas"&&delete this.images[l]}}b.DescartesApp=f})(descartesJS);
(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,h){a=`Error: ${a} en\u300a ${h} \u300b`;let f="";switch(b.DEBUG.objectName){case "Auxiliar":h=b.DEBUG.typeName==="event"||b.DEBUG.typeName==="algorithm"||b.DEBUG.typeName==="constant"?"En el programa ":
"En la definici\u00f3n ";if(babel[b.DEBUG.pName]=="doExpr"||babel[b.DEBUG.pName]=="init")f=" en la l\u00ednea "+(b.DEBUG.lineCount+1);a+=`${h}\u300c${b.DEBUG.idName}\u300d, en el par\u00e1metro \u300c${b.DEBUG.pName}\u300d${f}.`;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(babel[b.DEBUG.pName]=="doExpr"||babel[b.DEBUG.pName]=="init")f=" en la l\u00ednea "+(b.DEBUG.lineCount+
1);a+=`. En la Animaci\u00f3n, en el par\u00e1metro \u300c${b.DEBUG.pName}\u300d${f}.`}console.info(a)}}})(descartesJS);
(b=>{function a(){return(0,$jscomp.asyncExecutePromiseGeneratorFunction)(function*(){for(const l of"descartesJS_serif descartesJS_sansserif descartesJS_monospace descartesJS_math DJS_serif DJS_sansserif DJS_monospace".split(" "))document.fonts.load(`9px ${l}`),document.fonts.load(`bold 9px ${l}`),document.fonts.load(`italic 9px ${l}`),document.fonts.load(`bold italic 9px ${l}`);yield document.fonts.ready;b.getFeatures();if(b.hasCanvas){for(const l of document.querySelectorAll(".DescartesAppContainer"))l.remove();
for(const l of document.querySelectorAll("applet,ajs"))/Descartes|DescartesJS|DescartesWeb2_0/i.test(l.getAttribute("code"))&&(b.apps.push(new b.DescartesApp(l)),l.className="DescartesJS");window.addEventListener("resize",b.onResize)}else f.remove()})}var h={};b.apps=[];let f=document.getElementById("StyleDescartesApps");f&&f.remove();f=b.newHTML("style",{id:"StyleDescartesApps",type:"text/css",rel:"stylesheet"});f.innerHTML="applet.DescartesJS,applet,ajs.DescartesJS,ajs{display:none;}";document.head.appendChild(f);
b.onResize=function(){b.apps.length>0&&b.apps[0].scaleToFit()};b.onMessage=function(l){if(b.apps.length>0){let d=l.data;if(d)switch(d.type){case "set":typeof d.value=="string"||typeof d.value=="number"?b.apps[0].evaluator.setVariable(d.name,d.value):d.value&&d.value.rows!=void 0?b.apps[0].evaluator.matrices[d.name]=d.value:b.apps[0].evaluator.vectors[d.name]=d.value;break;case "update":b.apps[0].update();break;case "exec":(l=b.apps[0].evaluator.getFunction(d.name))&&l.apply(b.apps[0].evaluator,(""+
d.value).split(","));break;case "isResizeNeeded":l.source.postMessage({type:"doResize"},"*");break;case "doResize":b.apps[0].adjustSize();break;case "change_config":h[d.filename]?l=h[d.filename]:(l=(new DOMParser).parseFromString(d.content,"text/html").getElementsByTagName("param"),h[d.filename]=l);b.apps[0].children=l;b.apps[0].init();break;case "change_content":b.apps[0].children=(new DOMParser).parseFromString(d.content,"text/html").getElementsByTagName("param"),b.apps[0].init()}}};if(b.loadLib==
void 0){b.loadLib=!0;window.addEventListener("load",a);window.addEventListener("message",b.onMessage);for(let l of["webkitTransitionEnd","transitionend","oTransitionEnd","MSTransitionEnd"])window.addEventListener(l,b.onResize)}})(descartesJS);
