/*
 Joel Espinosa Longi
 jlongi@im.unam.mx
 https://github.com/jlongi/DescartesJS
 LGPL - http://www.gnu.org/licenses/lgpl.html
 2025-06-19
*/
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.arrayIteratorImpl=function(b){var a=0;return function(){return a<b.length?{done:!1,value:b[a++]}:{done:!0}}};$jscomp.arrayIterator=function(b){return{next:$jscomp.arrayIteratorImpl(b)}};$jscomp.makeIterator=function(b){var a="undefined"!=typeof Symbol&&Symbol.iterator&&b[Symbol.iterator];return a?a.call(b):$jscomp.arrayIterator(b)};$jscomp.arrayFromIterator=function(b){for(var a,d=[];!(a=b.next()).done;)d.push(a.value);return d};
$jscomp.arrayFromIterable=function(b){return b instanceof Array?b:$jscomp.arrayFromIterator($jscomp.makeIterator(b))};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.SIMPLE_FROUND_POLYFILL=!1;$jscomp.objectCreate=$jscomp.ASSUME_ES5||"function"==typeof Object.create?Object.create:function(b){var a=function(){};a.prototype=b;return new a};$jscomp.underscoreProtoCanBeSet=function(){var b={a:!0},a={};try{return a.__proto__=b,a.a}catch(d){}return!1};
$jscomp.setPrototypeOf="function"==typeof Object.setPrototypeOf?Object.setPrototypeOf:$jscomp.underscoreProtoCanBeSet()?function(b,a){b.__proto__=a;if(b.__proto__!==a)throw new TypeError(b+" is not extensible");return b}:null;
$jscomp.inherits=function(b,a){b.prototype=$jscomp.objectCreate(a.prototype);b.prototype.constructor=b;if($jscomp.setPrototypeOf){var d=$jscomp.setPrototypeOf;d(b,a)}else for(d in a)if("prototype"!=d)if(Object.defineProperties){var h=Object.getOwnPropertyDescriptor(a,d);h&&Object.defineProperty(b,d,h)}else b[d]=a[d];b.superClass_=a.prototype};$jscomp.getGlobal=function(b){return"undefined"!=typeof window&&window===b?b:"undefined"!=typeof global&&null!=global?global:b};$jscomp.global=$jscomp.getGlobal(this);
$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(b,a,d){b!=Array.prototype&&b!=Object.prototype&&(b[a]=d.value)};$jscomp.polyfill=function(b,a,d,h){if(a){d=$jscomp.global;b=b.split(".");for(h=0;h<b.length-1;h++){var q=b[h];q in d||(d[q]={});d=d[q]}b=b[b.length-1];h=d[b];a=a(h);a!=h&&null!=a&&$jscomp.defineProperty(d,b,{configurable:!0,writable:!0,value:a})}};$jscomp.FORCE_POLYFILL_PROMISE=!1;
$jscomp.polyfill("Promise",function(b){function a(){this.batch_=null}function d(a){return a instanceof q?a:new q(function(b,d){b(a)})}if(b&&!$jscomp.FORCE_POLYFILL_PROMISE)return b;a.prototype.asyncExecute=function(a){if(null==this.batch_){this.batch_=[];var b=this;this.asyncExecuteFunction(function(){b.executeBatch_()})}this.batch_.push(a)};var h=$jscomp.global.setTimeout;a.prototype.asyncExecuteFunction=function(a){h(a,0)};a.prototype.executeBatch_=function(){for(;this.batch_&&this.batch_.length;){var a=
this.batch_;this.batch_=[];for(var b=0;b<a.length;++b){var d=a[b];a[b]=null;try{d()}catch(c){this.asyncThrow_(c)}}}this.batch_=null};a.prototype.asyncThrow_=function(a){this.asyncExecuteFunction(function(){throw a;})};var q=function(a){this.state_=0;this.result_=void 0;this.onSettledCallbacks_=[];var b=this.createResolveAndReject_();try{a(b.resolve,b.reject)}catch(n){b.reject(n)}};q.prototype.createResolveAndReject_=function(){function a(a){return function(c){d||(d=!0,a.call(b,c))}}var b=this,d=!1;
return{resolve:a(this.resolveTo_),reject:a(this.reject_)}};q.prototype.resolveTo_=function(a){if(a===this)this.reject_(new TypeError("A Promise cannot resolve to itself"));else if(a instanceof q)this.settleSameAsPromise_(a);else{a:switch(typeof a){case "object":var b=null!=a;break a;case "function":b=!0;break a;default:b=!1}b?this.resolveToNonPromiseObj_(a):this.fulfill_(a)}};q.prototype.resolveToNonPromiseObj_=function(a){var b=void 0;try{b=a.then}catch(n){this.reject_(n);return}"function"==typeof b?
this.settleSameAsThenable_(b,a):this.fulfill_(a)};q.prototype.reject_=function(a){this.settle_(2,a)};q.prototype.fulfill_=function(a){this.settle_(1,a)};q.prototype.settle_=function(a,b){if(0!=this.state_)throw Error("Cannot settle("+a+", "+b+"): Promise already settled in state"+this.state_);this.state_=a;this.result_=b;this.executeOnSettledCallbacks_()};q.prototype.executeOnSettledCallbacks_=function(){if(null!=this.onSettledCallbacks_){for(var a=0;a<this.onSettledCallbacks_.length;++a)e.asyncExecute(this.onSettledCallbacks_[a]);
this.onSettledCallbacks_=null}};var e=new a;q.prototype.settleSameAsPromise_=function(a){var b=this.createResolveAndReject_();a.callWhenSettled_(b.resolve,b.reject)};q.prototype.settleSameAsThenable_=function(a,b){var d=this.createResolveAndReject_();try{a.call(b,d.resolve,d.reject)}catch(c){d.reject(c)}};q.prototype.then=function(a,b){function d(a,b){return"function"==typeof a?function(b){try{c(a(b))}catch(x){l(x)}}:b}var c,l,m=new q(function(a,b){c=a;l=b});this.callWhenSettled_(d(a,c),d(b,l));return m};
q.prototype.catch=function(a){return this.then(void 0,a)};q.prototype.callWhenSettled_=function(a,b){function d(){switch(c.state_){case 1:a(c.result_);break;case 2:b(c.result_);break;default:throw Error("Unexpected state: "+c.state_);}}var c=this;null==this.onSettledCallbacks_?e.asyncExecute(d):this.onSettledCallbacks_.push(d)};q.resolve=d;q.reject=function(a){return new q(function(b,d){d(a)})};q.race=function(a){return new q(function(b,e){for(var c=$jscomp.makeIterator(a),l=c.next();!l.done;l=c.next())d(l.value).callWhenSettled_(b,
e)})};q.all=function(a){var b=$jscomp.makeIterator(a),e=b.next();return e.done?d([]):new q(function(a,l){function c(b){return function(c){f[b]=c;p--;0==p&&a(f)}}var f=[],p=0;do f.push(void 0),p++,d(e.value).callWhenSettled_(c(f.length-1),l),e=b.next();while(!e.done)})};return q},"es6","es3");$jscomp.SYMBOL_PREFIX="jscomp_symbol_";$jscomp.initSymbol=function(){$jscomp.initSymbol=function(){};$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol)};
$jscomp.SymbolClass=function(b,a){this.$jscomp$symbol$id_=b;$jscomp.defineProperty(this,"description",{configurable:!0,writable:!0,value:a})};$jscomp.SymbolClass.prototype.toString=function(){return this.$jscomp$symbol$id_};$jscomp.Symbol=function(){function b(d){if(this instanceof b)throw new TypeError("Symbol is not a constructor");return new $jscomp.SymbolClass($jscomp.SYMBOL_PREFIX+(d||"")+"_"+a++,d)}var a=0;return b}();
$jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var b=$jscomp.global.Symbol.iterator;b||(b=$jscomp.global.Symbol.iterator=$jscomp.global.Symbol("Symbol.iterator"));"function"!=typeof Array.prototype[b]&&$jscomp.defineProperty(Array.prototype,b,{configurable:!0,writable:!0,value:function(){return $jscomp.iteratorPrototype($jscomp.arrayIteratorImpl(this))}});$jscomp.initSymbolIterator=function(){}};
$jscomp.initSymbolAsyncIterator=function(){$jscomp.initSymbol();var b=$jscomp.global.Symbol.asyncIterator;b||(b=$jscomp.global.Symbol.asyncIterator=$jscomp.global.Symbol("Symbol.asyncIterator"));$jscomp.initSymbolAsyncIterator=function(){}};$jscomp.iteratorPrototype=function(b){$jscomp.initSymbolIterator();b={next:b};b[$jscomp.global.Symbol.iterator]=function(){return this};return b};$jscomp.generator={};
$jscomp.generator.ensureIteratorResultIsObject_=function(b){if(!(b instanceof Object))throw new TypeError("Iterator result "+b+" is not an object");};$jscomp.generator.Context=function(){this.isRunning_=!1;this.yieldAllIterator_=null;this.yieldResult=void 0;this.nextAddress=1;this.finallyAddress_=this.catchAddress_=0;this.finallyContexts_=this.abruptCompletion_=null};
$jscomp.generator.Context.prototype.start_=function(){if(this.isRunning_)throw new TypeError("Generator is already running");this.isRunning_=!0};$jscomp.generator.Context.prototype.stop_=function(){this.isRunning_=!1};$jscomp.generator.Context.prototype.jumpToErrorHandler_=function(){this.nextAddress=this.catchAddress_||this.finallyAddress_};$jscomp.generator.Context.prototype.next_=function(b){this.yieldResult=b};
$jscomp.generator.Context.prototype.throw_=function(b){this.abruptCompletion_={exception:b,isException:!0};this.jumpToErrorHandler_()};$jscomp.generator.Context.prototype.return=function(b){this.abruptCompletion_={return:b};this.nextAddress=this.finallyAddress_};$jscomp.generator.Context.prototype.jumpThroughFinallyBlocks=function(b){this.abruptCompletion_={jumpTo:b};this.nextAddress=this.finallyAddress_};$jscomp.generator.Context.prototype.yield=function(b,a){this.nextAddress=a;return{value:b}};
$jscomp.generator.Context.prototype.yieldAll=function(b,a){b=$jscomp.makeIterator(b);var d=b.next();$jscomp.generator.ensureIteratorResultIsObject_(d);if(d.done)this.yieldResult=d.value,this.nextAddress=a;else return this.yieldAllIterator_=b,this.yield(d.value,a)};$jscomp.generator.Context.prototype.jumpTo=function(b){this.nextAddress=b};$jscomp.generator.Context.prototype.jumpToEnd=function(){this.nextAddress=0};
$jscomp.generator.Context.prototype.setCatchFinallyBlocks=function(b,a){this.catchAddress_=b;void 0!=a&&(this.finallyAddress_=a)};$jscomp.generator.Context.prototype.setFinallyBlock=function(b){this.catchAddress_=0;this.finallyAddress_=b||0};$jscomp.generator.Context.prototype.leaveTryBlock=function(b,a){this.nextAddress=b;this.catchAddress_=a||0};
$jscomp.generator.Context.prototype.enterCatchBlock=function(b){this.catchAddress_=b||0;b=this.abruptCompletion_.exception;this.abruptCompletion_=null;return b};$jscomp.generator.Context.prototype.enterFinallyBlock=function(b,a,d){d?this.finallyContexts_[d]=this.abruptCompletion_:this.finallyContexts_=[this.abruptCompletion_];this.catchAddress_=b||0;this.finallyAddress_=a||0};
$jscomp.generator.Context.prototype.leaveFinallyBlock=function(b,a){a=this.finallyContexts_.splice(a||0)[0];if(a=this.abruptCompletion_=this.abruptCompletion_||a){if(a.isException)return this.jumpToErrorHandler_();void 0!=a.jumpTo&&this.finallyAddress_<a.jumpTo?(this.nextAddress=a.jumpTo,this.abruptCompletion_=null):this.nextAddress=this.finallyAddress_}else this.nextAddress=b};$jscomp.generator.Context.prototype.forIn=function(b){return new $jscomp.generator.Context.PropertyIterator(b)};
$jscomp.generator.Context.PropertyIterator=function(b){this.object_=b;this.properties_=[];for(var a in b)this.properties_.push(a);this.properties_.reverse()};$jscomp.generator.Context.PropertyIterator.prototype.getNext=function(){for(;0<this.properties_.length;){var b=this.properties_.pop();if(b in this.object_)return b}return null};$jscomp.generator.Engine_=function(b){this.context_=new $jscomp.generator.Context;this.program_=b};
$jscomp.generator.Engine_.prototype.next_=function(b){this.context_.start_();if(this.context_.yieldAllIterator_)return this.yieldAllStep_(this.context_.yieldAllIterator_.next,b,this.context_.next_);this.context_.next_(b);return this.nextStep_()};
$jscomp.generator.Engine_.prototype.return_=function(b){this.context_.start_();var a=this.context_.yieldAllIterator_;if(a)return this.yieldAllStep_("return"in a?a["return"]:function(a){return{value:a,done:!0}},b,this.context_.return);this.context_.return(b);return this.nextStep_()};
$jscomp.generator.Engine_.prototype.throw_=function(b){this.context_.start_();if(this.context_.yieldAllIterator_)return this.yieldAllStep_(this.context_.yieldAllIterator_["throw"],b,this.context_.next_);this.context_.throw_(b);return this.nextStep_()};
$jscomp.generator.Engine_.prototype.yieldAllStep_=function(b,a,d){try{var h=b.call(this.context_.yieldAllIterator_,a);$jscomp.generator.ensureIteratorResultIsObject_(h);if(!h.done)return this.context_.stop_(),h;var q=h.value}catch(e){return this.context_.yieldAllIterator_=null,this.context_.throw_(e),this.nextStep_()}this.context_.yieldAllIterator_=null;d.call(this.context_,q);return this.nextStep_()};
$jscomp.generator.Engine_.prototype.nextStep_=function(){for(;this.context_.nextAddress;)try{var b=this.program_(this.context_);if(b)return this.context_.stop_(),{value:b.value,done:!1}}catch(a){this.context_.yieldResult=void 0,this.context_.throw_(a)}this.context_.stop_();if(this.context_.abruptCompletion_){b=this.context_.abruptCompletion_;this.context_.abruptCompletion_=null;if(b.isException)throw b.exception;return{value:b.return,done:!0}}return{value:void 0,done:!0}};
$jscomp.generator.Generator_=function(b){this.next=function(a){return b.next_(a)};this.throw=function(a){return b.throw_(a)};this.return=function(a){return b.return_(a)};$jscomp.initSymbolIterator();this[Symbol.iterator]=function(){return this}};$jscomp.generator.createGenerator=function(b,a){a=new $jscomp.generator.Generator_(new $jscomp.generator.Engine_(a));$jscomp.setPrototypeOf&&$jscomp.setPrototypeOf(a,b.prototype);return a};
$jscomp.asyncExecutePromiseGenerator=function(b){function a(a){return b.next(a)}function d(a){return b.throw(a)}return new Promise(function(h,q){function e(b){b.done?h(b.value):Promise.resolve(b.value).then(a,d).then(e,q)}e(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,d){if(null==b)throw new TypeError("The 'this' value for String.prototype."+d+" must not be null or undefined");if(a instanceof RegExp)throw new TypeError("First argument to String.prototype."+d+" must not be a regular expression");return b+""};
$jscomp.polyfill("String.prototype.repeat",function(b){return b?b:function(a){var b=$jscomp.checkStringArgs(this,null,"repeat");if(0>a||1342177279<a)throw new RangeError("Invalid count value");a|=0;for(var h="";a;)if(a&1&&(h+=b),a>>>=1)b+=b;return h}},"es6","es3");
$jscomp.polyfill("String.prototype.startsWith",function(b){return b?b:function(a,b){var d=$jscomp.checkStringArgs(this,a,"startsWith");a+="";var q=d.length,e=a.length;b=Math.max(0,Math.min(b|0,d.length));for(var g=0;g<e&&b<q;)if(d[b++]!=a[g++])return!1;return g>=e}},"es6","es3");
$jscomp.polyfill("String.prototype.endsWith",function(b){return b?b:function(a,b){var d=$jscomp.checkStringArgs(this,a,"endsWith");a+="";void 0===b&&(b=d.length);b=Math.max(0,Math.min(b|0,d.length));for(var q=a.length;0<q&&0<b;)if(d[--b]!=a[--q])return!1;return 0>=q}},"es6","es3");$jscomp.stringPadding=function(b,a){b=void 0!==b?String(b):" ";return 0<a&&b?b.repeat(Math.ceil(a/b.length)).substring(0,a):""};
$jscomp.polyfill("String.prototype.padStart",function(b){return b?b:function(a,b){var d=$jscomp.checkStringArgs(this,null,"padStart");return $jscomp.stringPadding(b,a-d.length)+d}},"es8","es3");$jscomp.owns=function(b,a){return Object.prototype.hasOwnProperty.call(b,a)};$jscomp.assign="function"==typeof Object.assign?Object.assign:function(b,a){for(var d=1;d<arguments.length;d++){var h=arguments[d];if(h)for(var q in h)$jscomp.owns(h,q)&&(b[q]=h[q])}return b};
$jscomp.polyfill("Object.assign",function(b){return b||$jscomp.assign},"es6","es3");$jscomp.polyfill("Array.prototype.fill",function(b){return b?b:function(a,b,h){var d=this.length||0;0>b&&(b=Math.max(0,d+b));if(null==h||h>d)h=d;h=Number(h);0>h&&(h=Math.max(0,d+h));for(b=Number(b||0);b<h;b++)this[b]=a;return this}},"es6","es3");$jscomp.findInternal=function(b,a,d){b instanceof String&&(b=String(b));for(var h=b.length,q=0;q<h;q++){var e=b[q];if(a.call(d,e,q,b))return{i:q,v:e}}return{i:-1,v:void 0}};
$jscomp.polyfill("Array.prototype.find",function(b){return b?b:function(a,b){return $jscomp.findInternal(this,a,b).v}},"es6","es3");$jscomp.polyfill("Object.is",function(b){return b?b:function(a,b){return a===b?0!==a||1/a===1/b:a!==a&&b!==b}},"es6","es3");
$jscomp.polyfill("Array.prototype.includes",function(b){return b?b:function(a,b){var d=this;d instanceof String&&(d=String(d));var q=d.length;b=b||0;for(0>b&&(b=Math.max(b+q,0));b<q;b++){var e=d[b];if(e===a||Object.is(e,a))return!0}return!1}},"es7","es3");$jscomp.polyfill("String.prototype.includes",function(b){return b?b:function(a,b){return-1!==$jscomp.checkStringArgs(this,a,"includes").indexOf(a,b||0)}},"es6","es3");
$jscomp.polyfill("Array.prototype.flat",function(b){return b?b:function(a){a=void 0===a?1:Number(a);for(var b=[],h=0;h<this.length;h++){var q=this[h];Array.isArray(q)&&0<a?(q=Array.prototype.flat.call(q,a-1),b.push.apply(b,q)):b.push(q)}return b}},"es9","es5");$jscomp.polyfill("Math.trunc",function(b){return b?b:function(a){a=Number(a);if(isNaN(a)||Infinity===a||-Infinity===a||0===a)return a;var b=Math.floor(Math.abs(a));return 0>a?-b:b}},"es6","es3");
$jscomp.polyfill("Math.sign",function(b){return b?b:function(a){a=Number(a);return 0===a||isNaN(a)?a:0<a?1:-1}},"es6","es3");$jscomp.polyfill("Number.isFinite",function(b){return b?b:function(a){return"number"!==typeof a?!1:!isNaN(a)&&Infinity!==a&&-Infinity!==a}},"es6","es3");$jscomp.checkEs6ConformanceViaProxy=function(){try{var b={},a=Object.create(new $jscomp.global.Proxy(b,{get:function(d,h,q){return d==b&&"q"==h&&q==a}}));return!0===a.q}catch(d){return!1}};
$jscomp.USE_PROXY_FOR_ES6_CONFORMANCE_CHECKS=!1;$jscomp.ES6_CONFORMANCE=$jscomp.USE_PROXY_FOR_ES6_CONFORMANCE_CHECKS&&$jscomp.checkEs6ConformanceViaProxy();
$jscomp.polyfill("WeakMap",function(b){function a(){if(!b||!Object.seal)return!1;try{var a=Object.seal({}),c=Object.seal({}),l=new b([[a,2],[c,3]]);if(2!=l.get(a)||3!=l.get(c))return!1;l.delete(a);l.set(c,4);return!l.has(a)&&4==l.get(c)}catch(m){return!1}}function d(){}function h(a){if(!$jscomp.owns(a,e)){var b=new d;$jscomp.defineProperty(a,e,{value:b})}}function q(a){var b=Object[a];b&&(Object[a]=function(a){if(a instanceof d)return a;h(a);return b(a)})}if($jscomp.USE_PROXY_FOR_ES6_CONFORMANCE_CHECKS){if(b&&
$jscomp.ES6_CONFORMANCE)return b}else if(a())return b;var e="$jscomp_hidden_"+Math.random();q("freeze");q("preventExtensions");q("seal");var g=0,p=function(a){this.id_=(g+=Math.random()+1).toString();if(a){a=$jscomp.makeIterator(a);for(var b;!(b=a.next()).done;)b=b.value,this.set(b[0],b[1])}};p.prototype.set=function(a,b){h(a);if(!$jscomp.owns(a,e))throw Error("WeakMap key fail: "+a);a[e][this.id_]=b;return this};p.prototype.get=function(a){return $jscomp.owns(a,e)?a[e][this.id_]:void 0};p.prototype.has=
function(a){return $jscomp.owns(a,e)&&$jscomp.owns(a[e],this.id_)};p.prototype.delete=function(a){return $jscomp.owns(a,e)&&$jscomp.owns(a[e],this.id_)?delete a[e][this.id_]:!1};return p},"es6","es3");$jscomp.MapEntry=function(){};
$jscomp.polyfill("Map",function(b){function a(){if($jscomp.ASSUME_NO_NATIVE_MAP||!b||"function"!=typeof b||!b.prototype.entries||"function"!=typeof Object.seal)return!1;try{var a=Object.seal({x:4}),c=new b($jscomp.makeIterator([[a,"s"]]));if("s"!=c.get(a)||1!=c.size||c.get({x:4})||c.set({x:4},"t")!=c||2!=c.size)return!1;var l=c.entries(),m=l.next();if(m.done||m.value[0]!=a||"s"!=m.value[1])return!1;m=l.next();return m.done||4!=m.value[0].x||"t"!=m.value[1]||!l.next().done?!1:!0}catch(f){return!1}}
if($jscomp.USE_PROXY_FOR_ES6_CONFORMANCE_CHECKS){if(b&&$jscomp.ES6_CONFORMANCE)return b}else if(a())return b;$jscomp.initSymbolIterator();var d=new WeakMap,h=function(a){this.data_={};this.head_=g();this.size=0;if(a){a=$jscomp.makeIterator(a);for(var b;!(b=a.next()).done;)b=b.value,this.set(b[0],b[1])}};h.prototype.set=function(a,b){a=0===a?0:a;var c=q(this,a);c.list||(c.list=this.data_[c.id]=[]);c.entry?c.entry.value=b:(c.entry={next:this.head_,previous:this.head_.previous,head:this.head_,key:a,
value:b},c.list.push(c.entry),this.head_.previous.next=c.entry,this.head_.previous=c.entry,this.size++);return this};h.prototype.delete=function(a){a=q(this,a);return a.entry&&a.list?(a.list.splice(a.index,1),a.list.length||delete this.data_[a.id],a.entry.previous.next=a.entry.next,a.entry.next.previous=a.entry.previous,a.entry.head=null,this.size--,!0):!1};h.prototype.clear=function(){this.data_={};this.head_=this.head_.previous=g();this.size=0};h.prototype.has=function(a){return!!q(this,a).entry};
h.prototype.get=function(a){return(a=q(this,a).entry)&&a.value};h.prototype.entries=function(){return e(this,function(a){return[a.key,a.value]})};h.prototype.keys=function(){return e(this,function(a){return a.key})};h.prototype.values=function(){return e(this,function(a){return a.value})};h.prototype.forEach=function(a,b){for(var c=this.entries(),m;!(m=c.next()).done;)m=m.value,a.call(b,m[1],m[0],this)};h.prototype[Symbol.iterator]=h.prototype.entries;var q=function(a,b){var c=b&&typeof b;"object"==
c||"function"==c?d.has(b)?c=d.get(b):(c=""+ ++p,d.set(b,c)):c="p_"+b;var m=a.data_[c];if(m&&$jscomp.owns(a.data_,c))for(a=0;a<m.length;a++){var f=m[a];if(b!==b&&f.key!==f.key||b===f.key)return{id:c,list:m,index:a,entry:f}}return{id:c,list:m,index:-1,entry:void 0}},e=function(a,b){var c=a.head_;return $jscomp.iteratorPrototype(function(){if(c){for(;c.head!=a.head_;)c=c.previous;for(;c.next!=c.head;)return c=c.next,{done:!1,value:b(c)};c=null}return{done:!0,value:void 0}})},g=function(){var a={};return a.previous=
a.next=a.head=a},p=0;return h},"es6","es3");$jscomp.polyfill("Array.from",function(b){return b?b:function(a,b,h){b=null!=b?b:function(a){return a};var d=[],e="undefined"!=typeof Symbol&&Symbol.iterator&&a[Symbol.iterator];if("function"==typeof e){a=e.call(a);for(var g=0;!(e=a.next()).done;)d.push(b.call(h,e.value,g++))}else for(e=a.length,g=0;g<e;g++)d.push(b.call(h,a[g],g));return d}},"es6","es3");
$jscomp.iteratorFromArray=function(b,a){$jscomp.initSymbolIterator();b instanceof String&&(b+="");var d=0,h={next:function(){if(d<b.length){var q=d++;return{value:a(q,b[q]),done:!1}}h.next=function(){return{done:!0,value:void 0}};return h.next()}};h[Symbol.iterator]=function(){return h};return h};$jscomp.polyfill("Array.prototype.values",function(b){return b?b:function(){return $jscomp.iteratorFromArray(this,function(a,b){return b})}},"es8","es3");
$jscomp.polyfill("Object.values",function(b){return b?b:function(a){var b=[],h;for(h in a)$jscomp.owns(a,h)&&b.push(a[h]);return b}},"es8","es3");$jscomp.polyfill("Array.prototype.entries",function(b){return b?b:function(){return $jscomp.iteratorFromArray(this,function(a,b){return[a,b]})}},"es6","es3");
var babel=function(b){if(b.loadLib)return b;b.loadLib=!0;b.no=b.ez=b.non=b["n\u00e3o"]=b.falso=b["false"]=b.fals=b.gezurra=b.faux=b.fals="false";b["s\u00ed"]=b.yes=b.bai=b.oui=b.si=b.sim=b.verdadero=b["true"]=b.veritable=b.egia=b.vrai=b.verdadeiro=b.veritable="true";b.negro=b.black=b.negre=b.beltza=b.noir=b.preto=b["#000000"]="#000000";b.maxenta=b.magenta=b["#ff00ff"]="#ff00ff";b.azul=b.blue=b.blau=b.urdina=b.bleu=b["#0000ff"]="#0000ff";b.turquesa=b.cyan=b.turkesa=b.turquoise=b["#00ffff"]="#00ffff";
b.verde=b.green=b.verd=b.berdea=b.vert=b["#00ff00"]="#00ff00";b.amarillo=b.yellow=b.groc=b.horia=b.jaune=b.amarelo=b["#ffff00"]="#ffff00";b.naranja=b.orange=b.taronja=b.laranja=b.laranxa=b["#ffc800"]="#ffc800";b.rojo=b.red=b.vermell=b.gorria=b.rouge=b.vermello=b.vermelho=b["#ff0000"]="#ff0000";b.pink=b.rosa=b.arrosa=b.rose=b["#ffafaf"]="#ffafaf";b.grisObscuro=b.darkGray=b.grisFosc=b["gris iluna"]=b.grisObscur=b.grisEscuro=b.cinzaEscuro=b["#404040"]="#404040";b.gris=b.gray=b.grisa=b.cinza=b["#808080"]=
"#808080";b.grisClaro=b.lightGray=b.grisClar=b["gris argia"]=b.grisClair=b.cinzaClaro=b["#c0c0c0"]="#c0c0c0";b.blanco=b.white=b.blanc=b.zuria=b.branco=b["#ffffff"]="#ffffff";b.escala=b.scale=b.eskala=b["\u00e9chelle"]="scale";b.nombre=b.name=b.nom=b.izena=b.nome="name";b.ikusgai=b["vis\u00edvel"]=b.visible="visible";b.rastro=b.trace=b.rastre=b.arrastoa="trace";b.fondo=b.background=b.fons=b.hondoa=b.fond=b.fundo="background";b["par\u00e1metro"]=b.parameter=b.parametroa=b["par\u00e2metro"]=b["par\u00e0metre"]=
"parameter";b["sucesi\u00f3n"]=b.sequence=b["successi\u00f3"]=b.segida=b.succession=b["seq\u00fc\u00eancia"]="sequence";b["tama\u00f1o"]=b.size=b.neurria=b.taille=b.tamanho=b["grand\u00e0ria"]="size";b.decimales=b.decimals=b.hamartarra=b["d\u00e9cimales"]=b.decimais="decimals";b.red=b.net=b.xarxa=b.sarea=b["r\u00e9seau"]=b.rede=b.malha="net";b.red10=b.net10=b.xarxa10=b.sarea10=b["r\u00e9seau10"]=b.rede10=b.malha10="net10";b.ejes=b.axes=b.eixos=b.ardatzak=b.eixes="axes";b["cr\u00e9ditos"]=b.about=
b["cr\u00e8dits"]=b.kreditoak=b["cr\u00e9dits"]=b.sobre="about";b.config=b.konfig=b["configura\u00e7\u00e3o"]="config";b.inicio=b.init=b.inici=b.hasiera=b.commencement=b["in\u00edcio"]="init";b.limpiar=b.clear=b.neteja=b.ezabatu=b.nettoye=b.limpar="clear";b.incr=b.gehi=b.incremento="incr";b.min=b.inf="min";b.max=b.sup=b["m\u00e1x"]="max";b.relleno=b.fill=b.ple=b.betea=b.plein=b.recheo=b.preencher="fill";b["relleno+"]=b["fill+"]=b["ple+"]=b["betea+"]=b["plein+"]=b["recheo+"]=b["preencher+"]=b.fillP=
"fillP";b["relleno-"]=b["fill-"]=b["ple-"]=b["betea-"]=b["plein-"]=b["recheo-"]=b["preencher-"]=b.fillM="fillM";b.flecha=b.arrow=b.fletxa=b.gezia=b["fl\u00e8che"]=b.frecha=b.seta="arrow";b.punta=b.spear=b.muturra=b.pointe=b.ponta="spear";b["regi\u00f3n"]=b.region=b["regi\u00f3"]=b.eskualde=b["r\u00e9gion"]=b["rexi\u00f3n"]=b["regi\u00e3o"]="region";b.norte=b.north=b.nord=b.ipar="north";b.sur=b.south=b.sud=b.hego=b.sul="south";b.este=b.east=b.est=b.ekialde=b.leste="east";b.oeste=b.west=b.oest=b.hegoalde=
b.ouest="west";b.exterior=b.external=b.kanpoalde=b.externo="external";b["expresi\u00f3n"]=b.expresion=b["expresi\u00f3"]=b.adierazpen=b["express\u00e3o"]="expresion";b.tipo=b.type=b.tipus=b.mota="type";b["posici\u00f3n"]=b.position=b["posici\u00f3"]=b.posizio=b["posi\u00e7\u00e3o"]="position";b["constricci\u00f3n"]=b.constraint=b["constricci\u00f3"]=b.beharte=b.constriction=b["constrici\u00f3n"]=b["restri\u00e7\u00e3o"]="constraint";b.valor=b.value=b.balio=b.valeur="value";b["ecuaci\u00f3n"]=b.equation=
b["equaci\u00f3"]=b.ekuazio=b["\u00e9quation"]=b["equa\u00e7\u00e3o"]="equation";b.curva=b.curve=b.corba=b.kurba=b.courbe="curve";b.texto=b.text=b.testu=b.texte=b.testua="text";b.punto=b.point=b.punt=b.puntu=b.ponto=b.dot="point";b.segmento=b.segment=b.zuzenki="segment";b.arco=b.arc=b.arku="arc";b["pol\u00edgono"]=b.polygon=b["pol\u00edgon"]=b.poligono=b.polygone="polygon";b.imagen=b.image=b.imatge=b.irudi=b.imaxe=b.imagem=b.bg_image=b.irudia=b.imagem_de_fundo=b.irundia="image";b["Versi\u00f3n"]=
b.Version=b["Versi\u00f3"]=b["Vers\u00e3o"]=b.version="version";b.Idioma=b.Language=b.Hizkuntza=b.Langue=b.language="language";b["O.x"]="O.x";b["O.y"]="O.y";b.Botones=b.Buttons=b.Botons=b.Botoiak=b.Boutons=b["Bot\u00f3ns"]=b["Bot\u00f5es"]=b.Botons="Buttons";b["Animaci\u00f3n"]=b.Animation=b["Animaci\u00f3"]=b.Animazio=b["Anima\u00e7\u00e3o"]="Animation";b.constante=b.constant=b.Konstante="constant";b.fuente=b.font=b.iturri=b.source=b.fonte="font";b["num\u00e9rico"]=b.numeric=b["num\u00e8ric"]=b.zenbakizko=
b["num\u00e9rique"]="numeric";b["gr\u00e1fico"]=b.graphic=b["gr\u00e0fic"]=b.grafiko=b.graphique="graphic";b.hacer=b["do"]=b.fer=b.egin=b.faire=b.facer=b.fazer=b.doExpr="doExpr";b.mientras=b["while"]=b.mentre=b.bitartean=b["tandis que"]=b.mentres=b.enquanto=b.whileExpr="whileExpr";b.evaluar=b.evaluate=b.avalua=b.ebaluatu=b["\u00e9valuer"]=b.avaliar="evaluate";b.variable=b.aldagaia=b["vari\u00e1vel"]="variable";b["funci\u00f3n"]=b["function"]=b["funci\u00f3"]=b.funtzio=b.fonction=b["fun\u00e7\u00e3o"]=
"function";b.algoritmo=b.algorithm=b.algorisme=b.algorithme="algorithm";b.vector=b.array=b.bektore=b.vecteur=b.matriz="array";b["dibujar-si"]=b["draw-if"]=b["marraztu-baldin"]=b["dessiner-si"]=b["debuxar-se"]=b["desenhar-se"]=b["dibuixa-si"]=b.drawif="drawif";b.dominio=b.range=b.domini=b["izate-eremua"]=b.domain=b["dom\u00ednio"]="range";b.pausa=b.delay=b.eten="delay";b["eje-x"]=b["x-axis"]=b["eix-x"]=b["x-ardatza"]=b["axe-x"]=b["eixe-x"]=b["eixo-x"]=b.x_axis="x_axis";b["eje-y"]=b["y-axis"]=b["eix-y"]=
b["y-ardatza"]=b["axe-y"]=b["eixe-y"]=b["eixo-y"]=b.y_axis="y_axis";b["n\u00fameros"]=b.numbers=b.nombres=b.zenbakiak="numbers";b["exponencial-si"]=b["exponential-if"]=b["esponentzial-baldin"]=b["exponentiel-si"]=b["exponencial-se"]=b.exponentialif="exponentialif";b.familia=b.family=b["fam\u00edlia"]=b.famille="family";b.intervalo=b.interval=b.tarte=b.intervalle="interval";b.pasos=b.steps=b.passos=b.pausoak=b.pas="steps";b.centro=b.center=b.centre=b.zentro="center";b.radio=b.radius=b.radi=b.erradio=
b.rayon=b.raio="radius";b.fin=b.end=b.fi=b.bukaera=b.fim="end";b["una-sola-vez"]=b["only-once"]=b["una-sola-vegada"]=b["behin-bakarrik"]=b["une-seule-fois"]=b["unha-soa-vez"]=b["apenas-uma-vez"]=b.onlyOnce="onlyOnce";b.siempre=b.always=b.sempre=b.beti=b.toujours="always";b["color-int"]=b["int-colour"]=b["barruko-kolore"]=b["couleur-int"]=b["cor-int"]=b.colorInt="colorInt";b.repetir=b.loop=b.repeteix=b.errepikatu=b["r\u00e9p\u00e9ter"]="loop";b.controles=b.controls=b.kontrolak=b["contr\u00f4les"]=
b.controis="controls";b.animar=b.animate=b.anima=b.animatu=b.animer="animate";b.auto="auto";b.y=b.top="y";b.espacio=b.space=b.espai=b.espazio=b.espace=b.espazo=b["espa\u00e7o"]="space";b.Nu="Nu";b.Nv="Nv";b.alto=b.height=b.alt=b.altu=b.haut=b.altura=b["al\u00e7ada"]=b.hauteur=b.alto="height";b.ancho=b.depth=b.amplada=b.zabalera=b.largeur=b.profundidade=b.amplada=b.width=b.ample=b.large=b.largura="width";b.largo=b.length=b.llargada=b.luzera=b.longueur=b.longo=b.comprimento=b.llargada="length";b.color_reverso=
b.backcolor=b.color_revers=b["atzealde kolorea"]=b.couleur_revers=b.cor_reverso=b.cor_de_fundo="backcolor";b.aristas=b.edges=b.arestes=b.ertzak=b["ar\u00eates"]=b.arestas="edges";b.rotini=b.inirot="inirot";b.posini=b.inipos="inipos";b["tri\u00e1ngulo"]=b.triangle=b.hirukia=b["tri\u00e2ngulo"]="triangle";b.cara=b.face=b.aurpegi="face";b.polireg=b.regpoly=b["pol\u00edgonoRegular"]="polireg";b.superficie=b.surface=b["superf\u00edcie"]=b.azalera="surface";b.cubo=b.cube=b.cub=b.kubo="cube";b["paralelep\u00edpedo"]=
b.box=b["paral\u00b7lelep\u00edpede"]=b.paralelepipedo=b["parall\u00e9l\u00e9pip\u00e8de"]="box";b.cono=b.cone=b.con=b.kono=b["c\u00f4ne"]="cone";b.cilindro=b.cylinder=b.cilindre=b.zilindro=b.cylindre="cylinder";b.esfera=b.sphere=b["sph\u00e8re"]="sphere";b.tetraedro=b.tetrahedron=b.tetraedre=b["t\u00e9tra\u00e8dre"]="tetrahedron";b.octaedro=b.octahedron=b.octaedre=b.oktaedro=b["octa\u00e8dre"]="octahedron";b.dodecaedro=b.dodecahedron=b.dodecaedre=b.dodekaedro=b["dod\u00e9ca\u00e8dre"]="dodecahedron";
b.icosaedro=b.icosahedron=b.icosaedre=b.ikosaedro=b["icosa\u00e8dre"]="icosahedron";b.elipsoide=b.ellipsoid=b["el\u00b7lipsoide"]=b["ellipso\u00efde"]=b["elips\u00f3ide"]="ellipsoid";b.macro=b.makro="macro";b.id="id";b.modelo=b.model=b.eredu=b["mod\u00e8le"]="model";b.color=b.kolore=b.couleur=b.cor=b.colour=b.kolorea="color";b.luz=b.light=b.llum=b.argia=b["lumi\u00e8re"]="light";b.metal=b.metall=b["m\u00e9tal"]="metal";b.alambre=b.wire=b.filferro=b.alanbre=b["fil de fer"]=b.arame="wire";b.cortar=
b.split=b.talla=b.moztu=b.couper=b.dividir="split";b.despliegue=b.render=b.desplegament=b.zabaltze=b["d\u00e8ploiement"]=b.despregamento=b.processar="render";b.orden=b.sort=b.ordre=b.ordena=b.orde=b.ordenar="sort";b.pintor=b.painter=b.margolari=b.peintre="painter";b["trazado de rayos"]=b["ray trace"]=b["tra\u00e7at de raigs"]=b["izpi trazadura"]=b["trace de rayons"]=b["trazado de raios"]=b["tra\u00e7ado de raios"]=b.raytrace="raytrace";b.despl_imagen=b.bg_display=b.despl_imatge=b["irudi desplazamendu"]=
b.despl_image=b.despr_imaxe=b["apresenta\u00e7\u00e3o_de_imagem"]="bg_display";b["arr-izq"]=b.topleft=b["dalt-esq"]=b["goi-ezk"]=b["au-dessus-gau"]=b["arr-esq"]=b["acima-esquerda"]="topleft";b["expand."]=b.stretch=b.hedatu=b["expandir "]="stretch";b.mosaico=b.patch=b.mosaic=b.mosaiko=b["mosa\u00efque"]="patch";b.centrada=b.zentratu=b["centr\u00e9e"]=b.centrado=b.imgcenter="imgcenter";b.archivo=b.file=b.fitxer=b.artxibo=b.fichier=b.arquivo="file";b.filas_norte=b.rows_north=b.files_nord=b["HTML kodea"]=
b.files_nord=b.filas_norte=b.linhas_norte=b.files_nord=b.rowsNorth="rowsNorth";b.filas_sur=b.rows_south=b.files_sud=b.ipar_lerro=b.files_sud=b.filas_sur=b.linhas_sul=b.files_sud=b.rowsSouth="rowsSouth";b.ancho_este=b.width_east=b.ample_est=b.hego_lerro=b.ample_est=b.ancho_leste=b.largura_leste=b.ample_est=b.widthEast="widthEast";b.ancho_oeste=b.width_west=b.ample_oest=b.ekialde_zabalera=b.ample_ouest=b.ancho_oeste=b.largura_oeste=b.ample_oest=b.widthWest="widthWest";b.fijo=b.fixed=b.fix=b.hegoalde_zabalera=
b.fixe=b.fixo="fixed";b["Reiniciar Animaci\u00f3n"]=b["Init Animation"]=b["Reinicia Animaci\u00f3"]=b.finko=b["Recommencer l'Animation"]=b["Reiniciar Anima\u00e7\u00e3o"]=b.initAnimation="initAnimation";b["Explicaci\u00f3n"]=b.Explanation=b.Azalpena=b.Explication=b["Explica\u00e7\u00e3o"]=b["Explicaci\u00f3"]="Explanation";b.tooltip=b.dica="tooltip";b.discreto=b.discrete=b.discret=b.diskretu="discrete";b.interfaz=b.gui=b["interf\u00edcie"]=b.interfaze=b["interface"]="gui";b.pulsador=b.spinner=b.polsador=
b.pultsadore=b.bouton="spinner";b["campo de texto"]=b.textfield=b["camp de text"]=b["testu esarrua"]=b["champ de texte"]="textfield";b["men\u00fa"]=b.choice=b.menu=b.escolha="menu";b.barra=b.scrollbar=b.barre="scrollbar";b.opciones=b.options=b.opcions=b.aukerak=b["opci\u00f3ns"]=b["op\u00e7\u00f5es"]="options";b.interior=b.barruko=b["int\u00e9rieur"]="interior";b["condici\u00f3n"]=b.condition=b["condici\u00f3"]=b.baldintza=b["condi\u00e7\u00e3o"]="condition";b["acci\u00f3n"]=b.action=b["acci\u00f3"]=
b.ekintza=b["a\u00e7\u00e3o"]="action";b.evento=b.event=b.esdeveniment=b.gertaera=b["\u00e9v\u00e9nement"]="event";b["abrir URL"]=b["open URL"]=b["obre URL"]=b["URL zabaldu"]=b["ouvrir URL"]=b.openURL="openURL";b["abrir Escena"]=b["open Scene"]=b["obre Escena"]=b["eszena zabaldu"]=b["ouvrir Escena"]=b["abrir Cena"]=b.openScene="openScene";b["bot\u00f3n"]=b.button=b["bot\u00f3"]=b.botoi=b.bouton=b["bot\u00e3o"]="button";b.mensaje=b.message=b.mezua=b.mensaxe=b.mensagem=b.missatge="message";b.alternar=
b.alternate=b.alterna=b.txandakatu=b.alterner="alternate";b["ejecuci\u00f3n"]=b.execution=b["execuci\u00f3"]=b.gauzatze=b["ex\u00e9cution"]=b["execuci\u00f3n"]=b["execu\u00e7\u00e3o"]="execution";b.calcular=b.calculate=b.calcula=b.kalkulatu=b.calculer="calculate";b.coord_abs=b.abs_coord=b.koor_abs="abs_coord";b.negrita=b.bold=b.negreta=b.lodi=b["caract\u00e8re gras"]=b.negra=b.negrito="bold";b.cursiva=b.italics=b.etzana=b.italique=b["it\u00e1lico"]="italics";b.subrayada=b.underlined=b.subratllat=
b.azpimarratua=b.soulignement=b["subli\u00f1ada"]=b.sublinhado="underlined";b.pos_mensajes=b.msg_pos=b.pos_missatges=b.mezuen_pos=b.pos_messages=b.pos_mensaxes="msg_pos";b.izquierda=b.left=b.esquerra=b.eskerrean=b.gauche=b.esquerda=b.esquerda=b.esquerra=b.x="x";b.derecha=b.right=b.dreta=b.eskuinan=b.droite=b.dereita=b.direita=b.dreta="right";b["sensible_a_los_movimientos_del_rat\u00f3n"]=b.sensitive_to_mouse_movements=b["sensible_als_moviments_del_ratol\u00ed"]=b["xagu mugimenduarekiko sentikorra"]=
b.sensible_aux_mouvements_du_souris=b.sensible_aos_movementos_do_rato=b["sens\u00edvel_aos_movimentos_do_mouse"]="sensitive_to_mouse_movements";b.reproducir=b.play=b.reprodueix=b.erreproduzitu=b.reproduire=b.reproduzir=b.playAudio="playAudio";b["activo-si"]=b["active-if"]=b["actiu-si"]=b["altiboa-baldin"]=b["actif-si"]=b["activo-se"]=b["ativo-se"]=b.activeif="activeif";b.rotfin=b.finrot=b.bukrot=b.endrot="endrot";b.posfin=b.finpos=b.bukpos=b.endpos="endpos";b.editable=b.editagarria=b["edit\u00e1vel"]=
"editable";b.R2="2D";b.R3="3D";b.vectores=b.bektoreak=b.vecteurs=b.vetores=b.vectors="vectors";b["fuente puntos"]=b["font size"]=b["font punts"]=b["puntu iturria"]=b["source points"]=b["fonte puntos"]=b["fonte pontos"]=b.font_size="font_size";b.escenario=b.scenario=b.escenari=b.agertoki=b["sc\u00e8ne"]=b["cen\u00e1rio"]="scenario";b.cID="cID";b.matriz=b.matrix=b.matriu=b.matrice="matrix";b.filas=b.rows=b.files="rows";b.columnas=b.columns=b.colonnes="columns";b.solo_texto=b.only_text=b.seulement_texte=
b["s\u00f3_texto"]=b.tan_sols_texte=b.onlyText="onlyText";b.respuesta=b.answer="answer";b.peso=b.weight=b.pes="weight";b.decimal_symbol=b["signo decimal"]=b["decimal symbol"]="decimal_symbol";b.info="info";b.library="library";b.color_contorn_text=b.color_text_border=b.color_borde_texto=b.muga_testuaren_kolorea=b.couleur_contour_texte=b.cor_borde_texto=b.colore_bordo_testo=b.cor_borda_texto=b.color_contorn_text=b.border="border";b.video=b["vid\u00e9o"]="video";b.audio=b["\u00e0udio"]="audio";b.autoplay=
"autoplay";b.poster="poster";b.opacidad=b.opacity=b["opacit\u00e9"]=b.opacitat=b.opacidade="opacity";b.alinear=b.align=b["ali\u00f1ar"]=b.aligner="align";b.anchor="anchor";b.a_left="left";b.a_center="center";b.a_right="right";b.a_justify="justify";b.a_top_left="top_left";b.a_top_center="top_center";b.a_top_right="top_right";b.a_center_left="center_left";b.a_center_center="center_center";b.a_center_right="center_right";b.a_bottom_left="bottom_left";b.a_bottom_center="bottom_center";b.a_bottom_right=
"bottom_right";b.malla=b.mesh="mesh";b.local=b.Local="local";b.rectangle=b["rect\u00e1ngulo"]="rectangle";b.lineDash="lineDash";b.solid="solid";b.dot="dot";b.dash="dash";b.dash_dot="dash_dot";b.offset_dist="offset_dist";b.offset_angle="offset_angle";b.flat="flat";b.borderColor="borderColor";b.text_align="text_align";b.image_align="image_align";b.checkbox="checkbox";b.torus=b.toro="torus";b.R="R";b.r="r";b.border_radius="border_radius";b.radio_group="radio_group";b.font_family="font_family";b.resizable=
"resizable";b.slider="slider";b.antialias="antialias";b.image_loader="image_loader";b.expand="expand";b.cover=b.cubrir="cover";b.fit=b.escalar="fit";b.code="code";b.doc="doc";b.image_dec="image_dec";b.image_inc="image_inc";b.btn_pos="btn_pos";b.border_width="border_width";b.border_color="border_color";b.v_left="v_left";b.v_right="v_right";b.h_left="h_left";b.h_right="h_right";b.h_left_right="h_left_right";b.label_color="label_color";b.label_text_color="label_text_color";b.shadowColor="shadowColor";
b.shadowBlur="shadowBlur";b.shadowOffsetX="shadowOffsetX";b.shadowOffsetY="shadowOffsetY";b.border_size="border_size";b.clip="clip";b.keyboard="keyboard";b.kblayout="kblayout";b.kbexp="kbexp";b.extra_style="extra_style";return b}(babel||Object.create(null)),descartesJS=function(b){if(b.loadLib)return b;b.addFonts=function(){var a={sansserif:{},serif:{},monospace:{},math:{}};a.sansserif.normal_bold=" ";
a.sansserif.italic_bold=" ";
a.sansserif.italic_normal=" ";
a.sansserif.normal_normal=" ";
a.monospace.normal_bold=" ";
a.monospace.italic_bold=" ";
a.monospace.italic_normal=" ";
a.monospace.normal_normal=" ";
a.serif.normal_bold=" ";
a.serif.italic_bold=" ";
a.serif.italic_normal=" ";
a.serif.normal_normal=" ";
a.math.normal_bold=a.math.italic_bold=" ";
a.math.italic_normal=a.math.normal_normal=" ";
for(var b=[["normal","bold"],["italic","bold"],["italic","normal"],["normal","normal"]],h="",q=$jscomp.makeIterator(["sansserif","monospace","serif","math"]),e=q.next();!e.done;e=q.next()){e=e.value;for(var g=$jscomp.makeIterator(b),p=g.next();!p.done;p=g.next())p=p.value,h+="@font-face{font-family:'DJS_"+e+"';src:url('data:font/woff2;charset=utf-8;base64,"+a[e][p[0]+"_"+p[1]]+"') format('woff2');font-style:"+p[0]+";font-weight:"+p[1]+";} "}return h};return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;b.addSymbolFont=function(){for(var a="",b=$jscomp.makeIterator([["normal","bold"],["italic","bold"],["italic","normal"],["normal","normal"]]),h=b.next();!h.done;h=b.next())h=h.value,a+="@font-face{font-family:'DJS_symbol';src:url('data:font/woff2;charset=utf-8;base64, ') format('woff2');font-style:"+
h[0]+";font-weight:"+h[1]+";} ";return a};return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,d,h,q={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(e){if(""==e)return"";a=e.split(",");d="";d+=b.getFontStyle(a[1])+" ";d+=a[2]+"px ";return d+=b.getFontName(a[0].split(" ")[0])};b.getFontName=function(a){a=a.toLowerCase();h=b.monospace_font;/sansserif|arial|helvetica/.test(a)?h=b.sansserif_font:/serif|times/.test(a)&&(h=b.serif_font);return h};b.getFontStyle=function(a){return q[a.toLowerCase()]||""};
b.getTextWidth=function(a,d){b.ctx.font=d;return Math.round(b.ctx.measureText(a).width)};b.getFieldFontSize=function(a){a=Math.min(50,a);return a=24<=a?Math.floor(a/2+2-a/16):20<=a?12:17<=a?11:15<=a?10:9};return b}(descartesJS||{});
descartesJS=function(b){function a(){var a,b,c,d,p,e,l;Number.prototype.oToFixed=Number.prototype.toFixed;Number.prototype.toFixed=function(m){m=Math.max(0,parseInt(void 0===m?0:m));a=this.toString();-1!==a.indexOf("e")&&(d=a.split("e"),e="-"===d[0][0]?"-":"",p="-"===e?parseFloat(d[0].substring(1)).oToFixed(11):parseFloat(d[0]).oToFixed(11),l=parseInt(d[1]),b=p.indexOf("."),p=p.replace(".",""),0>b+l?(b=0>b?1:b,a=e+"0."+"0".repeat(Math.abs(b+l))+p):a=e+p+"0".repeat(l-p.length+1));b=a.indexOf(".");
-1===b?0<m&&(a+="."+"0".repeat(m)):(c=a.length-b-1,a=c>=m?11>=m?parseFloat(a).oToFixed(m):a.substring(0,b+m+1):a+"0".repeat(m-c));return a}}if(b.loadLib)return b;var d=360/(2*Math.PI),h=2*Math.PI/360,q=.0192/255,e=Math.floor,g,p,n,c,l;b.rangeOK=1;b.cssScale=1;b.radToDeg=function(a){return a*d};b.degToRad=function(a){return a*h};b.getFeatures=function(){var c="";try{c=navigator.appVersion.toLowerCase()}catch(f){console.warn("navigator.appVersion is deprecated")}b.hasTouchSupport="ontouchstart"in window||
/android/i.test(c);b.isIOS=/iPad|iPhone/i.test(navigator.userAgent);c=b.newHTML("canvas");b.hasCanvas=c.getContext&&c.getContext("2d");b.hasCanvas&&(c.width=c.height=1,b.ctx=b.hasCanvas,b._ratio=2);a()};b.removeNeedlessDecimals=function(a){if("string"==typeof a&&(c=a.indexOf("."),-1!==c)){l=a.substring(c);if(0==parseFloat(l))return a.substring(0,c);for(var b=l.length-1;0<b;b--)if("0"!==l[b])return a.substring(0,c+b+1)}return a};b.whichBtn=function(a){return a.pointerType&&/touch|pen/.test(a.pointerType)||
a.touches?"L":0===a.button?"L":1===a.button?"M":"R"};b.createGradient=function(a,b,c){a=void 0===a?0:a;b=void 0===b?100:b;c="linear-gradient("+(void 0===c?0:c)+"deg,";for(var m=2*a;a<b;a++)g=e(65-a),c+="rgba(0,0,0,"+g*g*q+") "+(2*a-m)+"%, ";return c+"rgba(0,0,0,0.1) 100%)"};b.getCursorPosition=function(a,c){p=a;a.touches&&0<a.touches.length&&(p=a.touches[0]);if(!p||"undefined"===typeof p.clientX)return null;n=c.getBoundingClientRect();return{x:(p.clientX-n.left)/b.cssScale,y:(p.clientY-n.top)/b.cssScale}};
b.splitSeparator=function(a){a=a.replace(/\\n/g,"\n");for(var b=!1,c,m=[],d=0,p=0,e=a.length;p<e;p++)c=a[p],"'"===c&&(b=!b),b||";"!==c&&"\n"!==c||(m.push(a.substring(d,p).replace(/\n/g,"\\n")),d=p+1);m.push(a.substring(d).replace(/\n/g,"\\n"));return m};b.preventDefault=function(a){a.stopPropagation();a.preventDefault();return!1};b.convertHTMLEntities=function(a){var c=b.newHTML("textarea");c.innerHTML=a;return c.value};b.newHTML=function(a,b){a=document.createElement(a);for(var c in b)a.setAttribute(c,
b[c]);return a};window.requestAnimationFrame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame;window.cancelAnimationFrame=window.cancelAnimationFrame||window.mozCancelAnimationFrame;b.setInterval=function(a,b){function c(){Date.now()-m>=b&&(a.call(),m=Date.now());d.value=requestAnimationFrame(c)}if(!requestAnimationFrame)return setInterval(a,b);var m=Date.now(),d={};d.value=requestAnimationFrame(c);return d};b.clearInterval=
function(a){a&&(cancelAnimationFrame?cancelAnimationFrame(a.value):clearInterval(a))};b.setTimeout=function(a,b){function c(){Date.now()-d>=b?a.call():m.value=requestAnimationFrame(c)}if(!requestAnimationFrame)return setTimeout(a,b);var d=Date.now(),m={};m.value=requestAnimationFrame(c);return m};b.clearTimeout=function(a){a&&(cancelAnimationFrame?cancelAnimationFrame(a.value):clearTimeout(a))};b.showAbout=function(){window.open("https://arquimedes.matem.unam.mx/Descartes5/creditos/","cr\u00e9ditos",
"width=700,height=500,titlebar=0,toolbar=0,location=0,menubar=0,resizable=0,scrollbars=0,status=0")};return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;b.cacheFiles=Object.create(null);b.openFile=function(a){if(b.cacheFiles[a])return b.cacheFiles[a];var d=null,h=new XMLHttpRequest;h.open("GET",a,!1);try{h.send(null),d=200===h.status||304===h.status?h.responseText:h.responseText||"",d=404===h.status?"":d,d.match(String.fromCharCode(65533))&&(h.open("GET",a,!1),h.overrideMimeType("text/plain;charset=ISO-8859-1"),h.send(null),d=h.responseText)}catch(q){d=null}return d};b.addExternalFileContent=function(a,
d){b.cacheFiles[a]=d};return b}(descartesJS||{});
descartesJS=function(b){function a(a){a=a.replace(/\+/g,"\\+").replace(/\*/g,"\\*");q=a.trim();a={ignoreAccents:!1,ignoreCaps:!1,regExp:null};/^'.*'$/.test(q)&&(a.ignoreCaps=!0,q=q.slice(1,-1),/^`.*\u00b4$/.test(q)&&(a.ignoreAccents=!0,q=q.slice(1,-1)));/^`.*\u00b4$/.test(q)&&(a.ignoreAccents=!0,q=q.slice(1,-1),/^'.*'$/.test(q)&&(a.ignoreCaps=!0,q=q.slice(1,-1)));q.startsWith("\\*")&&!q.endsWith("\\*")?q=q.substring(2)+"$":!q.startsWith("\\*")&&q.endsWith("\\*")?q="^"+q.substring(0,q.length-2):q.startsWith("\\*")||
q.endsWith("\\*")?q.startsWith("\\*")&&q.endsWith("\\*")&&(q=q.substring(2,q.length-2)):q="^"+q+"$";a.regExp=q.replace(/\?/g,"[\\S\\s]{1}");return a}function d(a,b){a=void 0===a?"":a;var c={},d=a.match(/^\s*(\(|\[)(.*)(\)|\])\s*$/);d?(c.type=d[1]+d[3],d=d[2].split(","),c.min=b.parser.parse(d[0]),c.max=b.parser.parse(d[1])):(c.type="[]",c.min=c.max=b.parser.parse(a));return c}function h(a){return(void 0===a?"":a).toString().normalize("NFD").replace(/[\u0300-\u036f]/g,"")}if(b.loadLib)return b;var q,
e,g,p;b.answerRegEx=function(b,c,p){b=void 0===b?"":b;p&&/^\(|\)$/.test(b)&&(b=b.slice(1,-1));b=b.replace(/&squot;/g,"'").replace(/&amp;/g,"&").split("|");for(var m=0,f=b.length;m<f;m++){e=b[m].split("&");g=[];for(var l=$jscomp.makeIterator(e),h=l.next();!h.done;h=l.next())h=h.value,p?g.push(a(h)):g.push(d(h,c));b[m]=g}return b};b.esCorrecto=function(a,b,d){b=(void 0===b?"":b)+"";a=$jscomp.makeIterator(a);for(var c=a.next();!c.done;c=a.next()){c=c.value;p=!0;c=$jscomp.makeIterator(c);for(var e=c.next();!e.done;e=
c.next())if(e=e.value,q=e.regExp)e.ignoreAccents&&(b=h(b),q=h(q)),e.ignoreCaps&&(b=b.toLowerCase(),q=h(q).toLowerCase()),p=p&&!!b.match(q);else{var l;if(l=p){l=b;var g=d;l=parseFloat(l);var n=g.eval(e.min);g=g.eval(e.max);g=")"==e.type[1]?l<g:l<g||1E-9>Math.abs(g-l);l=("("==e.type[0]?n<l:n<l||1E-9>Math.abs(n-l))&&g}p=l}if(p)return 1}return 0};return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;b.loaderImg=new Image;b.loaderImg.src="data:image/svg+xml;base64,"+btoa("<svg xmlns='http://www.w3.org/2000/svg' width='880' height='840' viewBox='0 0 880 840'><path d='M440 80c-132.5 0-240 107.5-240 240s107.5 240 240 240 240-107.5 240-240S572.5 80 440 80zm-11.1 462.2c-122.7 0-224.4-99.5-224.4-222.2S306.2 97.8 428.9 97.8 651.1 197.3 651.1 320s-99.5 222.2-222.2 222.2zm-11.1-426.6c-112.9 0-208.9 91.5-208.9 204.4s96 204.4 208.9 204.4S622.2 432.9 622.2 320s-91.5-204.4-204.4-204.4zm-11.1 391.1c-103.1 0-193.3-83.6-193.3-186.7s90.2-186.7 193.3-186.7S593.3 216.9 593.3 320s-83.5 186.7-186.6 186.7zm-11.1-355.6c-93.3 0-177.8 75.6-177.8 168.9s84.5 168.9 177.8 168.9S564.4 413.3 564.4 320c0-93.3-75.6-168.9-168.8-168.9zm-11.2 320c-83.5 0-162.2-67.7-162.2-151.1S301 168.9 384.4 168.9 535.6 236.5 535.6 320s-67.7 151.1-151.2 151.1zm-11.1-284.4c-73.6 0-146.7 59.7-146.7 133.3s73 133.3 146.7 133.3S506.7 393.6 506.7 320 447 186.7 373.3 186.7zm-11.1 248.9c-63.8 0-131.1-51.7-131.1-115.6s67.3-115.6 131.1-115.6S477.8 256.2 477.8 320 426 435.6 362.2 435.6zm-11.1-213.4c-54 0-115.6 43.8-115.6 97.8s61.6 97.8 115.6 97.8c54 0 97.8-43.8 97.8-97.8s-43.8-97.8-97.8-97.8zM340 400c-44.2 0-100-35.8-100-80s55.8-80 100-80 80 35.8 80 80-35.8 80-80 80z' fill='#2daae4'/><path d='M115.8 600.7c32.5 0 48.8 24.8 48.8 49.7 0 24.9-16.2 49.6-48.8 49.6H80.2v-99.3zm0 85c23 0 34.6-17.6 34.6-35.2s-11.6-35.4-34.6-35.4H94.5v70.6zm118.2 0V700h-60.6v-99.3h60.5V615h-46v28h45v14.5h-45l-.05 28.2zm42.2.9c10.6 0 22.3-6 22.3-16.2 0-1-.1-2.1-.4-3.4-1.7-7.5-11.9-8.8-21.9-9.8-15.5-1.6-33.7-5-35.2-25.65-.6-6.65 1.1-13.25 5.4-18.85 6.7-8.7 18.6-13.2 30.1-13.2 15.3 0 31.2 8 33.8 26.1l-14.3.7c-2-8.9-11.6-12.8-20.3-12.6-6.7.1-14.1 2.4-18 7.5-2 2.6-2.7 5.8-2.4 9.2.7 10.2 11.9 11.5 22.6 12.5 13.6 1.7 30.5 5.3 34.4 21.2.4 2.1.7 4.5.7 6.5 0 19.2-19 30.2-36.9 30.2-15.3 0-33.9-9.1-35.8-26.8l-.1-2.7 14.5-.3.1 1.8c1 8.9 12.2 13.8 21.4 13.8zm58-71.7c8.7-8.9 20.9-14.8 34.4-14.8 22.7 0 40.6 14.2 46.3 36.6h-14.2c-5.3-14.9-17.5-22.4-32.1-22.4-9.5 0-18.2 4.1-24.4 10.7-6.2 6.5-10.2 15.3-10.2 25.6 0 9.9 4 18.7 10.2 25.3 6.2 6.6 14.9 10.6 24.4 10.6 15.1 0 27.8-8.7 32.9-23.7h14.1c-5.7 22.6-23.9 37.9-47 37.9-13.5 0-25.7-5.7-34.4-14.8-8.5-9.1-14.2-21.6-14.2-35.4 0-14 5.7-26.5 14.2-35.6zm144.6 55.8h-35.6c-3.8 9.1-8.8 21-11.9 29.3h-15.5l39.9-100.7h10.5L506 700h-15.3zm-30.3-13.4h24.7L461 622.2zm96.9-7.7c12.1 0 18-8.7 18-17.3 0-8.5-6-17.2-18-17.2h-22V700h-14.2v-99.4h36.2c21.6 0 32.4 15.9 32.4 31.7 0 14.1-8.7 27.4-25.7 30.4l31.4 37.3h-18.6l-36.2-43.6-.05-6.8zm64.9 50.8v-85.3h-30.1v-14.5h74.4v14.5h-30v85.3zm112.2-14.7V700H662v-99.3h60.5V615h-46v28h45v14.5h-45l-.05 28.2zm42.3.9c10.6 0 22.3-6 22.3-16.2 0-1-.1-2.1-.4-3.4-1.7-7.5-11.9-8.8-21.9-9.8-15.5-1.6-33.7-5-35.2-25.65-.6-6.65 1.1-13.25 5.4-18.85 6.7-8.7 18.6-13.2 30.1-13.2 15.3 0 31.2 8 33.8 26.1l-14.3.7c-2-8.9-11.6-12.8-20.3-12.6-6.7.1-14.1 2.4-18 7.5-2 2.6-2.7 5.8-2.4 9.2.7 10.2 11.9 11.5 22.6 12.5 13.6 1.7 30.5 5.3 34.4 21.2.4 2.1.7 4.5.7 6.5 0 19.2-19 30.2-36.9 30.2-15.3 0-33.9-9.1-35.8-26.8l-.1-2.7 14.5-.3.1 1.8c1 8.9 12.2 13.8 21.4 13.8z' fill='#868686'/></svg>");b.getSvgArrowUp=
function(a,b){return"data:image/svg+xml;base64,"+btoa('<svg xmlns=\'http://www.w3.org/2000/svg\' width="24" height="24" viewBox="0 0 24 24"><path transform="rotate('+(a?90:0)+',12,12)" d="m19.5 17.5-7.5-12-7.5 12z" fill="#'+(void 0===b?"24c":b)+'"/></svg>')};b.getSvgArrowDown=function(a,b){return"data:image/svg+xml;base64,"+btoa('<svg xmlns=\'http://www.w3.org/2000/svg\' width="24" height="24" viewBox="0 0 24 24"><path transform="rotate('+(a?90:0)+',12,12)" d="m19.5 5-7.5 12-7.5-12z" fill="#'+(void 0===
b?"d00018":b)+'"/></svg>')};b.getSvgMenu=function(){return"data:image/svg+xml;base64,"+btoa("<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'><path d='M6.64 8L12 12.962 17.36 8 19 9.519 12 16 5 9.519z'/></svg>")};b.getSvgCheckbox=function(){return"data:image/svg+xml;base64,"+btoa("<svg xmlns='http://www.w3.org/2000/svg' width='45' height='45' viewBox='0 0 45 45'><path d='M37.095 6.284L15.473 27.905l-7.568-7.567L2.5 25.743l12.973 12.973L42.5 11.69z' fill='#1e272e'/></svg>")};
b.getSvgRadio=function(){return"data:image/svg+xml;base64,"+btoa('<svg xmlns=\'http://www.w3.org/2000/svg\' width="45" height="45" viewBox="0 0 45 45"><circle cx="22.5" cy="22.5" r="15" fill="#1e272e"/></svg>')};return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=Math.floor,d=/[\w-//]*(\.png|\.jpg|\.gif|\.svg|\.webp)/gi,h,q,e,g,p,n,c,l,m,f,w,u,x,r,v,z,y,A,B=function(a,b){this.r=this.g=this.b=0;this.a=1;this.evaluator=b;this.getColor=this.getColorStr;if(!a)this.colorStr="rgba("+this.r+","+this.g+","+this.b+","+this.a+")";else if(/^GradL/.test(a)){a=this.splitComa(a.substring(6,a.length-1));this.x1=this.evaluator.parser.parse(a[0]);this.y1=this.evaluator.parser.parse(a[1]);this.x2=this.evaluator.parser.parse(a[2]);
this.y2=this.evaluator.parser.parse(a[3]);this.stops=[];for(var c=4;c<a.length;c++)""!=a[c]&&(b=a[c].split("|"),this.stops.push({percentage:this.evaluator.parser.parse(b[1]),color:"#"+b[2]}));this.getColor=this.getLinearGradient}else if(/^Pattern/.test(a))this.img_src=a.substring(8,a.length-1),this.img_src.match(d)&&(this.img_src="'"+this.img_src+"'"),this.img_src=this.evaluator.parser.parse(this.img_src),this.getColor=this.getPattern;else if(babel[a])"net"===babel[a]&&(a="rojo"),a=babel[a],this.r=
toHex(a.substring(1,3)),this.g=toHex(a.substring(3,5)),this.b=toHex(a.substring(5,7)),this.colorStr=a;else if(6===a.length)this.r=toHex(a.substring(0,2)),this.g=toHex(a.substring(2,4)),this.b=toHex(a.substring(4,6)),this.colorStr="#"+a;else if(8===a.length)this.a=1-toHex(a.substring(0,2))/255,this.r=toHex(a.substring(2,4)),this.g=toHex(a.substring(4,6)),this.b=toHex(a.substring(6,8)),this.colorStr="rgba("+this.r+","+this.g+","+this.b+","+this.a+")";else if("("===a[0]){q=[];e=this.splitComa(a.substring(1,
a.length-1));a=0;for(b=e.length;a<b;a++)n=e[a],g=parseInt(n,16),n!==g.toString(16)&&n!=="0"+g.toString(16)?("["===n.charAt(0)&&"]"===n.charAt(n.length-1)&&(n=n.substring(1,n.length-1)),q.push(this.evaluator.parser.parse(n))):q.push(this.evaluator.parser.parse((g/255).toString()));this.rExpr=q[0];this.gExpr=q[1];this.bExpr=q[2];this.aExpr=q[3];this.getColor=this.getColorExp}};B.prototype.splitComa=function(a){p=[];for(var b=c=l=m=0,d=a.length;b<d;b++)f=a[b],"("===f?c++:")"===f?c--:"["===f?l++:"]"===
f?l--:","===f&&0===c&&0===l&&(p.push(a.substring(m,b)),m=b+1);p.push(a.substring(m));return p};B.prototype.getColorStr=function(){return this.colorStr};B.prototype.getColorExp=function(){h=this.evaluator;this.r=a(255*h.eval(this.rExpr));this.g=a(255*h.eval(this.gExpr));this.b=a(255*h.eval(this.bExpr));this.a=1-h.eval(this.aExpr);return"rgba("+this.r+","+this.g+","+this.b+","+this.a+")"};B.prototype.getLinearGradient=function(){h=this.evaluator;z=b.ctx.createLinearGradient(h.eval(this.x1),h.eval(this.y1),
h.eval(this.x2),h.eval(this.y2));for(var a=0;a<this.stops.length;a++)v=h.eval(this.stops[a].percentage),v=Math.max(0,Math.min(1,v)),z.addColorStop(v,this.stops[a].color);return z};B.prototype.getPattern=function(){A=this.evaluator.parent;if(y=A.getImage(this.evaluator.eval(this.img_src)))try{return b.ctx.createPattern(y,"repeat")}catch(E){}return"ff00ff"};B.prototype.borderColor=function(){return 380>this.r+this.g+this.b?"#ffffff":"#000000"};toHex=function(a){return parseInt("0x"+a,16)};b.RGBAToHexColor=
function(a){a=a.substring(5,a.length-1).split(",");w=parseInt(a[0]).toString(16).padStart(2,"0");u=parseInt(a[1]).toString(16).padStart(2,"0");x=parseInt(a[2]).toString(16).padStart(2,"0");r=(255-parseInt(255*parseFloat(a[3]))).toString(16).padStart(2,"0");return new B(r+w+u+x)};b.Color=B;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=function(a){var d=this;this.parent=a;this.container=b.newHTML("div",{class:"DescartesKeyboardContainer"});this.display=b.newHTML("textarea",{class:"DescartesKeyboardDisplay",spellcheck:"false",inputmode:"none"});this.container.appendChild(this.display);this.keyContainer=b.newHTML("div",{style:"position:absolute; padding-bottom:5px;",class:"DescartesKeysContainer"});this.container.appendChild(this.keyContainer);this.additionalKeys=b.newHTML("div",
{style:"position:absolute; padding: 0 5px 5px 0; display:none;",class:"DescartesKeysContainer"});this.container.appendChild(this.additionalKeys);this.newLine=b.newHTML("div",{style:"position:absolute; background-color:white; margin:0; font-family:DJS_sansserif; font-size:17px; font-weight:normal; line-height:38px",class:"new_line_btn"});this.newLine.textContent="\\n";this.newLine.addEventListener("pointerup",function(){d.insert("\n")});this.container.appendChild(this.newLine);this.display.addEventListener("keydown",
function(a){d.keypressed=!0;if(27===a.keyCode)d.close();else if(13===a.keyCode)d.onEnter()});this.key_pressed=this.delete_pressed=!1;var q,e;this.keyContainer.addEventListener("pointerdown",function(a){if(/^(k_op|k_dot|k_a|k_e|k_i|k_o|k_u)$/.test(a.target.id)){a.target.onpointerleave=function(){clearTimeout(q)};var b=a.target.textContent.trim().toLowerCase();q=setTimeout(function(){d.key_pressed=!0;d.showadditionalKeys(b)},600)}else"k_del"==a.target.id&&(a.target.onpointerleave=function(){clearTimeout(e)},
e=setInterval(function(){d.delete_pressed=!0;d.delete()},200))});this.keyContainer.addEventListener("pointerup",function(a){if(a.target!=d.keyContainer&&a.target!=d.container)if(a.preventDefault(),a.stopPropagation(),"k_left"==a.target.id)d.display.selectionStart=d.display.selectionEnd=Math.max(0,d.display.selectionStart-1);else if("k_right"==a.target.id)d.display.selectionStart=d.display.selectionEnd=Math.min(d.display.value.length,d.display.selectionStart+1);else if("k_del"==a.target.id)d.delete_pressed||
d.delete(),clearTimeout(e),d.delete_pressed=!1;else if("k_\u221a"==a.target.id)d.insert("\u221a(");else if("k_space"==a.target.id)d.insert(" ");else if("k_esc"==a.target.id)d.close();else if("k_shift"==a.target.id){a=d.keyContainer.querySelectorAll("div");var b=d.additionalKeys.querySelectorAll("div");d.shift=!d.shift;d.shift?(a.forEach(function(a){1==a.textContent.trim().length&&(a.textContent=a.textContent.toUpperCase());"k_point_comma"==a.getAttribute("id")&&(a.textContent=",")}),b.forEach(function(a){a.textContent=
a.textContent.toUpperCase()})):(a.forEach(function(a){1==a.textContent.trim().length&&(a.textContent=a.textContent.toLowerCase());"k_point_comma"==a.getAttribute("id")&&(a.textContent=".")}),b.forEach(function(a){a.textContent=a.textContent.toLowerCase()}))}else if("k_num_layout"==a.target.id)d["setLayout_"+d.layout_mode.replace("alfa","num")]();else if("k_alfa_layout"==a.target.id)d["setLayout_"+d.layout_mode.replace("num","alfa")]();else if("k_clear"==a.target.id)d.display.value="";else if(/^(k_op|k_dot|k_a|k_e|k_i|k_o|k_u)$/.test(a.target.id))clearTimeout(q),
d.key_pressed||(d.insert(a.target.textContent.trim()),d.additionalKeys.style.display="none"),d.key_pressed=!1;else if("k_return"==a.target.id)d.onEnter();else a=a.target.textContent.trim(),d.insert(a),d.additionalKeys.style.display="none";d.display.focus()});this.keyContainer.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation()});var g=!1;this.additionalKeys.addEventListener("pointerdown",function(){g=!0});this.additionalKeys.addEventListener("pointerup",function(a){g&&(a.target!=
d.keyContainer&&a.target!=d.container&&(a.preventDefault(),a.stopPropagation(),d.insert(a.target.textContent.trim())),d.key_pressed=!1,d.additionalKeys.style.display="none");g=!1;d.display.focus()})};a.prototype.insert=function(a){this.display.setRangeText(a);this.display.selectionStart+=a.length;this.display.selectionStart=this.display.selectionEnd;this.display.focus()};a.prototype.delete=function(){this.display.selectionStart==this.display.selectionEnd&&(this.display.selectionStart=Math.max(0,this.display.selectionStart-
1));this.display.setRangeText("")};a.prototype.addKey=function(a,b,q){return"<div "+(b?"id='"+b+"'":"")+" "+(q?"style='"+q+"'":"")+">"+a+"</div>"};a.prototype.addKeys=function(a){var b="";a=$jscomp.makeIterator(a);for(var d=a.next();!d.done;d=a.next())d=d.value,b="object"===typeof d?b+this.addKey(d.val,d.id,d.style):b+this.addKey(d);return b};a.prototype.showadditionalKeys=function(a){var b=[];"."==a?b=",;:-_\u00bf?\u00a1!()".split(""):"+"==a?b=["-","\u00d7","\u00f7","^"]:"a"==a?b=["\u00e1","\u00e0",
"\u00e4","\u00e2"]:"e"==a?b=["\u00e9","\u00e8","\u00eb","\u00ea"]:"i"==a?b=["\u00ed","\u00ec","\u00ef","\u00ee"]:"o"==a?b=["\u00f3","\u00f2","\u00f6","\u00f4"]:"u"==a&&(b=["\u00fa","\u00f9","\u00fc","\u00fb"]);this.additionalKeys.innerHTML=this.addKeys(b);this.shift&&(this.additionalKeys.innerHTML=this.additionalKeys.innerHTML.toUpperCase());this.additionalKeys.style.display="flex";this.additionalKeys.style.left=this.keyContainer.style.left;this.additionalKeys.style.top=parseFloat(this.keyContainer.style.top)-
50+"px"};a.prototype.setLayout_14x1=function(){this.keyContainer.innerHTML=this.addKeys([1,2,3,4,5,6,7,8,9,0,{val:this.parent.decimal_symbol},"-",{val:"\u232b",id:"k_del"},{val:"\u21b5",id:"k_return"}]);this.keyContainer.style.width="635px"};a.prototype.setLayout_7x2=function(){this.keyContainer.innerHTML=this.addKeys([1,2,3,4,5,{val:this.parent.decimal_symbol},{val:"\u232b",id:"k_del"},6,7,8,9,0,"-",{val:"\u21b5",id:"k_return"}]);this.keyContainer.style.width="320px"};a.prototype.setLayout_10x2=
function(){this.keyContainer.innerHTML=this.addKeys(["(",1,2,3,4,5,"\u00b2","/","\u00d7",{val:"\u232b",id:"k_del"},")",6,7,8,9,0,{val:this.parent.decimal_symbol},"-","+",{val:"\u21b5",id:"k_return"}]);this.keyContainer.style.width="455px"};a.prototype.setLayout_4x4=function(){this.keyContainer.innerHTML=this.addKeys([7,8,9,{val:"\u232b",id:"k_del"},4,5,6,"+",1,2,3,"-",{val:0,style:"width:85px;"},{val:this.parent.decimal_symbol},{val:"\u21b5",id:"k_return"}]);this.keyContainer.style.width="185px"};
a.prototype.setLayout_5x4=function(){this.keyContainer.innerHTML=this.addKeys([7,8,9,"\u00b2",{val:"\u232b",id:"k_del"},4,5,6,"/","\u00d7",1,2,3,"\u2212","+",{val:0,style:"width:85px;"},".",{val:"\u21b5",id:"k_return",style:"margin-left:50px;"}]);this.keyContainer.style.width="230px"};a.prototype.setLayout_11x3=function(){this.keyContainer.innerHTML=this.addKeys(["q","w",{val:"e",id:"k_e"},"r","t","y",{val:"u",id:"k_u"},{val:"i",id:"k_i"},{val:"o",id:"k_o"},"p",{val:"\u232b",id:"k_del"},{val:"a",
id:"k_a"},"s","d","f","g","h","j","k","l","\u00f1",{val:".",id:"k_dot"},{val:"\u21c5",id:"k_shift"},"z","x","c","v","b","n","m",{val:"",id:"k_space",style:"width:85px;"},{val:"\u21b5",id:"k_return"}]);this.keyContainer.style.width="500px";this.shift=!1};a.prototype.setLayout_11x4=function(){this.keyContainer.innerHTML=this.addKeys([1,2,3,4,5,6,7,8,9,0,{val:"\u232b",id:"k_del"},"q","w",{val:"e",id:"k_e"},"r","t","y",{val:"u",id:"k_u"},{val:"i",id:"k_i"},{val:"o",id:"k_o"},"p",{val:"+",id:"k_op"},{val:"a",
id:"k_a"},"s","d","f","g","h","j","k","l","\u00f1",{val:".",id:"k_dot"},{val:"\u21c5",id:"k_shift"},"z","x","c","v","b","n","m",{val:"",id:"k_space",style:"width:85px;"},{val:"\u21b5",id:"k_return"}]);this.keyContainer.style.width="500px"};a.prototype.setLayout_10x4_alfa=function(){this.keyContainer.innerHTML=this.addKeys(["q","w",{val:"e",id:"k_e"},"r","t","y",{val:"u",id:"k_u"},{val:"i",id:"k_i"},{val:"o",id:"k_o"},"p",{val:"a",id:"k_a"},"s","d","f","g","h","j","k","l","\u00f1",{val:"\u21c5",id:"k_shift",
style:"width:62.5px;"},"z","x","c","v","b","n","m",{val:"\u232b",id:"k_del",style:"width:62.5px;"},{val:"123",id:"k_num_layout",style:"width:85px;"},{val:"",id:"k_space",style:"width:220px;transform:none !important;"},{val:"/",id:"k_slash"},{val:".",id:"k_dot"},{val:"\u21b5",id:"k_return"}]);this.keyContainer.style.width="455px"};a.prototype.setLayout_10x4_num=function(){this.keyContainer.innerHTML=this.addKeys(["1","2","3","4","5","6","7","8","9","0","@",'"',"$","_","-","+","(",")","/","*","&","|",
"\u00ba",":",";","\u00a1","!","\u00bf","?",{val:"\u232b",id:"k_del"},{val:"ABC",id:"k_alfa_layout",style:"width:85px;"},{val:"",id:"k_space",style:"width:220px;transform:none !important;"},{val:",",id:"k_slash"},{val:".",id:"k_dot"},{val:"\u21b5",id:"k_return"}]);this.keyContainer.style.width="455px"};a.prototype.showCustomKB=function(a){var b=a.querySelectorAll("div");a=parseInt(a.getAttribute("cols")||b.length);var d=[],e,g;b=$jscomp.makeIterator(b);for(e=b.next();!e.done;e=b.next()){var p=e.value;
e={val:p.textContent};if(g=p.getAttribute("id"))e.id=g;if(g=p.getAttribute("size"))e.style="width:"+(40*parseInt(g)+5*(parseInt(g)-1))+"px;transform:none !important;";d.push(e)}this.keyContainer.innerHTML=this.addKeys(d);this.keyContainer.style.width=5+45*a+"px"};a.prototype.setLayout=function(a){this.layout_mode=a;var b=document.getElementById("kb_"+a);b?this.showCustomKB(b):"14x1"==a?this.setLayout_14x1():"7x2"==a?this.setLayout_7x2():"10x2"==a?this.setLayout_10x2():"4x4"==a?this.setLayout_4x4():
"5x4"==a?this.setLayout_5x4():"11x3"==a?this.setLayout_11x3():"11x4"==a?this.setLayout_11x4():"10x4_alfa"==a?this.setLayout_10x4_alfa():"10x4_num"==a?this.setLayout_10x4_num():this.setLayout_14x1()};a.prototype.show=function(a,b,q,e,g,p,n){this.ctr=a;this.var_id=g;this.onlyText=n;this.container.parentNode||this.parent.container.appendChild(this.container);this.container.style.display="block";this.setDisplay(p);this.setLayout(b);this.keyContainer.style.left=q+"px";this.keyContainer.style.top=e+"px";
this.additionalKeys.style.display="none"};a.prototype.close=function(){this.container.style.display="none";this.parent.deactivateControls();this.parent.update()};a.prototype.setDisplay=function(a){if("custom"==a.type){var d=a.x;var q=a.y;var e=a.w;var g=a.h;var p=a.fs}else q=this.container.getBoundingClientRect(),g=a.getBoundingClientRect(),d=g.left/b.cssScale-q.left/b.cssScale,q=g.top/b.cssScale-q.top/b.cssScale,e=g.width/b.cssScale,g=g.height/b.cssScale,p=a.style.fontSize;"textarea"==a.tagName.toLowerCase()?
(this.display.setAttribute("style","left:"+d+"px;top:"+q+"px;width:"+e+"px;height:"+g+"px;font-size:"+p+";line-height:1.2em;padding:5px;font:"+a.style.font+";"),this.newLine.style.left=d+e-42+"px",this.newLine.style.top=q+g-42+"px",this.newLine.style.display="block"):(this.display.setAttribute("style","left:"+d+"px;top:"+q+"px;width:"+e+"px;height:"+g+"px;font-size:"+p+";line-height:"+g+"px;white-space:nowrap;"),this.newLine.style.display="none");this.display.value=a.value||"";this.display.focus();
this.display.selectionStart=this.display.selectionEnd=this.display.value.length};a.prototype.onEnter=function(){var a=this.display.value;if(!this.onlyText){var b=this.parent.evaluator.parser.parse(a.replace(/\u221a/g,"sqrt"));try{b&&(a=this.parent.evaluator.eval(b))}catch(g){a=0}}if(this.ctr)this.ctr.changeValue(a,!0);else if(this.var_id=(this.var_id+"").trim(),b=this.var_id.indexOf("["),-1==b)this.parent.evaluator.setVariable(this.var_id,a);else{var q=this.var_id.indexOf(","),e=this.var_id.substring(0,
b);-1==q?this.parent.evaluator.setVector(e,parseInt(this.var_id.substring(b+1)),a):this.parent.evaluator.setMatrix(e,parseInt(this.var_id.substring(b+1)),parseInt(this.var_id.substring(q+1)),a)}this.close()};b.Keyboard=a;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=document.head,d=b.newHTML("meta",{name:"viewport",content:"width=device-width,initial-scale=1.0,user-scalable=yes"});a.querySelector("meta[name=viewport]")||a.appendChild(d);d=b.newHTML("meta",{name:"mobile-web-app-capable",content:"yes"});a.appendChild(d);d=b.newHTML("meta",{name:"apple-mobile-web-app-capable",content:"yes"});a.appendChild(d);d=b.newHTML("meta",{name:"apple-mobile-web-app-status-bar-style",content:"black"});a.appendChild(d);(a=
document.getElementById("StyleDescartesApps2"))&&a.remove();a=b.newHTML("style",{rel:"stylesheet",type:"text/css",id:"StyleDescartesApps2"});document.head.insertBefore(a,document.head.firstChild);a.innerHTML="body{-webkit-font-smoothing:antialiased;}\n#descartesJS_north,#descartesJS_south,#descartesJS_east,#descartesJS_west{background:#c0c0c0;position:absolute;z-index:100;}\n.PBL{position:absolute;background-color:#f2f2f2;border:none;-webkit-appearance:none;-moz-appearance:none;appearance:none;color:#2daae4;visibility:hidden;border-radius:100vw;}\n.PBL::-moz-progress-bar{background:#2daae4;border-radius:inherit;}\n.PBL::-webkit-progress-bar{background:#f2f2f2;border-radius:100vw;}\n.PBL::-webkit-progress-value{background:#2daae4;border-radius:inherit;}\n.PBL::-ms-fill{background:#2daae4;border-radius:inherit;}\n.DescartesAppContainer *,.DescartesAppContainer *:before,.DescartesAppContainer *:after{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;transform:translate3d(0,0,0);}\n.DescartesAppContainer{border:none;overflow:hidden;position:relative;top:0;left:0;}\n.DescartesCatcher{background-color:rgba(0,0,0,0);cursor:pointer;position:absolute;}\n.DescartesLoader{background-color:#fff;overflow:hidden;position:absolute;top:0;left:0;z-index:1000;width:100%;height:100%;display:none;}\n.DescartesLoaderImage{position:absolute;background-repeat:no-repeat;background-position:center;overflow:hidden;top:0;left:0;width:100%;height:100%;}\n.DescartesSpace2DCanvas,.DescartesSpace3DCanvas,.blocker{touch-action:none;position:absolute;overflow:hidden;left:0;top:0;}\n.DescartesSpace2DContainer,.DescartesSpace3DContainer{position:absolute;overflow:hidden;line-height:0;}\n.DescartesSpaceIframe{position:absolute;left:0;top:0;width:inherit;height:inherit;}\n.DescartesSpaceIframeContainer{position:absolute;background-repeat:no-repeat;background-position:center;}\n.DescartesCheckboxContainer input[type=checkbox],.DescartesCheckboxContainer input[type=radio]{display: none;}\n.DescartesCheckboxContainer input[type=checkbox]+label::after{position:absolute;left:0px;content:'';padding:0;margin:0;width:100%;height:100%;background:#fff;border:1px solid gray;}\n.DescartesCheckboxContainer input[type=checkbox]:checked+label::after{content:'';background:url("+
b.getSvgCheckbox()+") center center no-repeat;background-size:contain;background-color:#fff;}\n.DescartesCheckboxContainer input[type=radio]+label::after{position:absolute;left:0px;content:'';padding:0;margin:0;width:100%;height:100%;background:#fff;border:1px solid gray;border-radius:50%;}\n.DescartesCheckboxContainer input[type=radio]:checked+label::after{content:'';background:url("+b.getSvgRadio()+") center center no-repeat;background-size:contain;background-color:#fff;}\n.DescartesCheckbox{position:absolute;}\n.TextfieldCover{position:absolute;overflow:hidden;background-color:transparent;cursor:pointer;}\ninput[type=text]{-webkit-appearance:none;}\n.DescartesButton{position:absolute;cursor:pointer;}\n.DescartesButtonContainer,.DescartesSpinnerContainer,.DescartesCheckboxContainer,.DescartesTextFieldContainer,.DescartesMenuContainer{position:absolute;overflow:hidden;}\n.DescartesSpinnerContainer input,.DescartesCheckboxContainer,.DescartesTextFieldContainer input,.DescartesMenuContainer select{border-radius:0;}\n.DescartesSpinnerField,.DescartesTextFieldField,.DescartesMenuField,.DescartesScrollbarField,.DescartesSliderField{font-family:"+
b.sansserif_font+";padding:0 2px;border:solid #666 1px;position:absolute;  outline: none;}\n.DescartesSpinnerField:focus,.DescartesTextFieldField:focus,.DescartesMenuField:focus,.DescartesScrollbarField:focus,.DescartesSliderField:focus{border:2px solid #3f88fb;}\ninput[type=text]:disabled,.DescartesMenuSelect:disabled{background-color:#e3e3e3;cursor:not-allowed;opacity:1;}\n.DescartesSpinnerLabel,.DescartesCheckboxLabel,.DescartesMenuLabel,.DescartesScrollbarLabel,.DescartesSliderLabel,.DescartesTextFieldLabel{font-family:"+
b.sansserif_font+";font-weight:normal;text-align:center;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;position:absolute;left:0;top:0;}\n.DescartesGraphicControl{cursor:pointer;background-color:transparent;touch-action:none;border-style:none;position:absolute;}\n.DescartesTextAreaContainer{position:absolute;overflow:hidden;background:#F7F7F7;border:solid #666 1px;}\n.DescartesTextArea {position:absolute;padding:5px;left:2px;top:2px;background-color:white;text-align:left;border:none;outline:none;resize:none;}\n.DescartesTextArea:focus {outline:3px solid #3f88fb;}\n.DescartesMenuSelect{font-family:"+
b.sansserif_font+";padding-top:0;text-align:center;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;position:absolute;border:1px solid #7a8a99; background:#fff url('"+b.getSvgMenu()+"') 100%/22px no-repeat;padding:0 22px 0 5px;-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:none;}\n.DescartesMenuSelect::-ms-expand{display:none;}\n.DescartesScrollbarContainer,.DescartesSliderContainer{touch-action:none;background:#eee;overflow:hidden;position:absolute;}\n.DescartesSliderContainer{background:transparent;}\n.DescartesRange{-webkit-appearance:none;appearance:none;background:transparent;cursor: pointer;}\n.DescartesRange::-webkit-slider-runnable-track{background:var(--track_color);height:var(--track_h);border-radius:var(--track_h);}\n.DescartesRange::-moz-range-track{background:var(--track_color);height:var(--track_h);border-radius:var(--track_h);}\n.DescartesRange::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;margin-top:calc(var(--track_h) / 2 - var(--thumb_size) / 2);border-radius:50%;background-color:var(--thumb_color);height:var(--thumb_size);width:var(--thumb_size);}\n.DescartesRange::-moz-range-thumb{border:none;border-radius:50%;background-color:var(--thumb_color);height:var(--thumb_size);width:var(--thumb_size);}\n.DJS_Up,.DJS_Down{cursor:pointer;position:absolute;border-width:1px 0 1px 1px;background-size:cover;background-repeat:none;background-position:center;}\n.DJS_Up[horizontal=false]{background-color:#f0f8ff;background-image:"+
b.createGradient(50,100)+", url('"+b.getSvgArrowUp()+"');}\n.DJS_Up[horizontal=true]{background-color:#f0f8ff;background-image:"+b.createGradient(50,100,90)+", url('"+b.getSvgArrowUp(!0)+"');}\n.DJS_Up[active=false]::after{cursor:not-allowed;content:'';position:absolute;left:0;top:0;width:100%;height:100%;background:rgba(255,255,255,0.3);}\n.DJS_Down[horizontal=false]{background-color:#f0f8ff;background-image:"+b.createGradient(0,50)+", url('"+b.getSvgArrowDown()+"');}\n.DJS_Down[horizontal=true]{background-color:#f0f8ff;background-image:"+
b.createGradient(50,100,-90)+", url('"+b.getSvgArrowDown(!0)+"');}\n.DJS_Down[active=false]::after{cursor:not-allowed;content:'';position:absolute;left:0;top:0;width:100%;height:100%;background:rgba(255,255,255,0.3);}\n.DescartesKeyboardContainer{position:absolute;left:0;top:0;width:100%;height:100%;background-color:rgba(0,0,0,0.1);z-index:1000;}\n.DescartesKeysContainer{display:flex;flex-direction:row;flex-wrap:wrap;background-color:#c0c0c0;border-radius:4px;border:1px solid rgba(0,0,0,0.3);box-shadow:0 0 8px 0 rgba(0,0,0,0.75);box-sizing: content-box;}\n.DescartesKeysContainer > div, .new_line_btn{margin:5px 0 0 5px;display:inline-block;min-width:40px;min-height:40px;max-height:40px;line-height:35px;background-color:#ebeff3;font-family:"+
b.math_font+";font-size:18px;font-weight:bold;color:black;cursor:pointer;text-align:center;border-radius:4px;border:1px solid rgba(0,0,0,0.3);box-shadow:0 1px 2px 0 rgba(0,0,0,0.25);transform-origin:center;user-select:none;}\n.DescartesKeysContainer > div:hover, .new_line_btn:hover{background-color:rgba(0,0,0,0.05);transform:scale(1.1);}\n.DescartesKeysContainer > div:active, .new_line_btn:active{transform:scale(0.95);}\n.DescartesKeyboardDisplay{font-family:"+b.sansserif_font+";padding:0 2px;border:solid #666 1px;text-align:left;background-color:white;position:absolute;overflow:hidden;outline:2px solid black; resize: none;}\n.custom_keyboard{display:none;}\n.DJS_Gradient{position:absolute;display:none;}\n"+
(b.addSymbolFont?b.addSymbolFont():"")+(b.addFonts?b.addFonts():"")+"@media print{body{margin:0;padding:0;}\n.DescartesAppContainer{transform:none !important;left:0 !important;top:0 !important;}\ndiv:has(.DescartesAppContainer){overflow:unset !important;width:100% !important;height:100% !important;}}";return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=Math.sin,d=Math.floor,h=Math.random,q=Math.round,e=Math.abs,g=String.fromCharCode,p,n,c,l,m,f,w,u,x,r,v=function(a){this.key=(void 0===a?0:a).toString()};v.prototype.getKey=function(b){p=[];for(var c=0;256>c;c++)p[c]=g(this.alfanum(d(e(7.5*(a(1*c-b)+a(1.4*c+b)+a(.6*c-b)+a(2.2*c+b))))));return p.join("")};v.prototype.encode=function(a){n=d(31*h());this.key=this.getKey(n);return g(this.alfanum(n))+this.encripta(a)};v.prototype.decode=function(a){n=
this.numalfa(a.charCodeAt(0));this.key=this.getKey(n);return this.desencripta(a.substring(1))};v.prototype.encripta=function(a){return this.bytesToString(this.encriptaAux(this.stringToBytes(a)))};v.prototype.encriptaAux=function(a){if(null==a||null==this.key)return null;f=Array(3*a.length);for(var b=0,c=a.length;b<c;b++)x=256*d(a[b]+128)+q(255*h())+65536*q(255*h()),r=d((x<<this.shift(b))/256),f[3*b]=this.alfanum(r%32),f[3*b+1]=this.alfanum(r/32%32),f[3*b+2]=this.alfanum(r/1024%32);return f};v.prototype.desencripta=
function(a){return this.bytesToString(this.desencriptaAux(this.stringToBytes(a)))};v.prototype.desencriptaAux=function(a){if(null==a||null==this.key)return null;w=Array(a.length/3);for(var b=0,c=w.length;b<c;b++)r=this.numalfa(a[3*b])+32*this.numalfa(a[3*b+1])+1024*this.numalfa(a[3*b+2]),x=d(256*r>>this.shift(b)),u=d(x/256)%256-128,0>u&&(u+=256),w[b]=u;return w};v.prototype.alfanum=function(a){return(10>a?48:87)+d(a)};v.prototype.numalfa=function(a){return a-(58>a?48:87)};v.prototype.stringToBytes=
function(a){l=[];for(var b=0,c=a.length;b<c;b++)l.push(a.charCodeAt(b));return l};v.prototype.bytesToString=function(a){for(var b=0,c=a.length;b<c;b++)a[b]=g(a[b]);return a.join("")};v.prototype.shift=function(a){c=this.key.charCodeAt(a%this.key.length);l=this.numalfa(c);m=d(l/2%8);0==m&&(m=4);return m};v.prototype.parseByte=function(a){a=parseInt(a);a=0>a?0:a;return 255<a?255:a};b.Krypto=v;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,d=function(a,d){var e=this;e.parent=a;var g=a.evaluator;a=g.parser;e.delay=a.parse(d.delay?d.delay:"60");e.loop=d.loop?d.loop:!1;e.auto=void 0==d.auto?!0:d.auto;e.controls=d.controls;b.parseExpr(e,d,a);e.animExec=function(){for(var a=$jscomp.makeIterator(e.doExpr),d=a.next();!d.done;d=a.next())g.eval(d.value);e.parent.update();e.playing&&(0<g.eval(e.whileExpr)||e.loop)?e.timer=b.setTimeout(e.animExec,g.eval(e.delay)):(e.stop(),e.pause=!1,e.parent.update())};
e.playing=!1;e.auto&&e.play()};d.prototype.play=function(){a=this;a.playing?(a.pause=!0,a.stop()):(a.pause||a.reinit(),a.playing=!0,a.pause=!1,a.timer=b.setTimeout(a.animExec,Math.max(10,a.parent.evaluator.eval(a.delay))))};d.prototype.stop=function(){this.playing=!1;b.clearTimeout(this.timer)};d.prototype.reinit=function(){for(var a=$jscomp.makeIterator(this.init),b=a.next();!b.done;b=a.next())this.parent.evaluator.eval(b.value)};b.Animation=d;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=function(a,b){this.parent=a;this.parameter=(void 0===b?"":b).replace(/\\n/g,"\n").replace(/&squot;/g,"'")};a.prototype.execute=function(){alert(this.parameter)};b.Message=a;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=function(a,h){var d=this;this.parent=a;h=b.splitSeparator(((void 0===h?"":h)||"").replace(/&squot;/g,"'"));this.inst=h.map(function(a){return d.parent.evaluator.parser.parse(a,!0)}).filter(function(a){return a})};a.prototype.execute=function(){for(var a=$jscomp.makeIterator(this.inst),b=a.next();!b.done;b=a.next())this.parent.evaluator.eval(b.value)};b.Calculate=a;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=function(a,b){this.parent=a;this.param=b.trim();this.target="_blank"};a.prototype.execute=function(a){a=void 0===a?"":a;var d=this.param,e=d.match(/^(.*)\s*target=(.*)/);e&&(d=e[1].trim(),this.target=e[2].trim());/^\[.*\]$/.test(d)&&(d=this.parent.evaluator.eval(this.parent.evaluator.parser.parse(d.slice(1,-1))));if(e=d.match(/^javascript:(.*)$/)){d=new b.SimpleText(this.parent,e[1].replace(/&squot;/g,"'"));try{(new Function(d.toString()))()}catch(g){}}else/^(http|www)/.test(d)||
(e=window.__dirname||window.location.href,d=e.substring(0,e.lastIndexOf("/")+1)+d),d.startsWith("www.")&&(d="https://"+d),window.open(d,this.target,a)};var d=function(b,d){return a.call(this,b,d)||this};$jscomp.inherits(d,a);d.prototype.execute=function(){a.prototype.execute.call(this,"width="+this.parent.width+",height="+this.parent.height+",left="+(window.screen.width-this.parent.width)/2+",top="+(window.screen.height-this.parent.height)/2+",location=0,menubar=0,scrollbars=0,status=0,titlebar=0,toolbar=0")};
b.OpenURL=a;b.OpenScene=d;return b}(descartesJS||{});descartesJS=function(b){if(b.loadLib)return b;var a=function(a){this.parent=a};a.prototype.execute=function(){this.parent.editor?this.parent.editor.show():window.open("about:blank","_blank","width=800px,height=600px,location=no,menubar=no,scrollbars=yes").document.write("<xmp style='width:100%;height:100%;'>"+this.parent.applet.outerHTML.replace(/<applet/g,"<ajs").replace(/<\/applet/g,"</ajs")+"</xmp>")};b.Config=a;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=function(a){this.parent=a};a.prototype.execute=function(){this.parent.init()};b.Init=a;return b}(descartesJS||{});descartesJS=function(b){if(b.loadLib)return b;var a=function(a){this.parent=a};a.prototype.execute=function(){this.parent.clear()};b.Clear=a;return b}(descartesJS||{});descartesJS=function(b){if(b.loadLib)return b;var a=function(a){this.parent=a};a.prototype.execute=function(){this.parent.play()};b.Animate=a;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=function(a){this.parent=a};a.prototype.execute=function(){this.parent.reinitAnimation()};b.InitAnimation=a;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=function(a,b){b=void 0===b?"":b;this.parent=a;(a=b.match(/[\w\.\-//]*(\.ogg|\.oga|\.mp3|\.wav)/gi))?this.filename=this.parent.evaluator.parser.parse("'"+a+"'"):(/^\[.*\]$/.test(b)&&(b=b.slice(1,-1)),this.filename=this.parent.evaluator.parser.parse(b))};a.prototype.execute=function(){var a=this.parent.getAudio(this.parent.evaluator.eval(this.filename));a.paused?a.play():(a.pause(),a.currentTime=0)};b.PlayAudio=a;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,d,h,q=function(b,d){a=this;a.parent=b;a.evaluator=b.evaluator;a.id=a.expresion=a.init=a.privateVars=a.doExpr=a.whileExpr="";a.evaluate="onlyOnce";Object.assign(a,d)};q.prototype.firstRun=function(){};q.prototype.update=function(){};b.splitInstructions=function(a,d){d=d?b.splitSeparator(d):[""];return d.map(function(d,e){b.DEBUG.lineCount=e;return a.parse(d,!0)}).filter(function(a){return a})};b.parseExpr=function(a,d,p){b.DEBUG.pName="inicio";a.init=
b.splitInstructions(p,d.init);b.DEBUG.pName="local";a.privateVars=b.getPrivateVariables(p,d.local);b.DEBUG.pName="hacer";a.doExpr=b.splitInstructions(p,d.doExpr);b.DEBUG.pName="mientras";a.whileExpr=p.parse(d.whileExpr)};b.getPrivateVariables=function(a,b){d=[];b=b?b.split(/;|,/):[""];b=$jscomp.makeIterator(b);for(var e=b.next();!e.done;e=b.next())(h=a.parse(e.value,!0))&&d.push(h);a=0;for(b=d.length;a<b;a++)d[a]="assign"===d[a].type?d[a].childs[0].value:"identifier"===d[a].type?d[a].value:"";return d};
b.Auxiliary=q;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=function(a,h){h=b.Auxiliary.call(this,a,h)||this;var d=h.evaluator;h.expresionString=h.expresion;h.expresion=d.parser.parse(h.expresionString);h.expresion&&d.setVariable(h.id,h.expresion);h.editable&&(h.registerTextField(),a.editableRegionVisible=!0);return h};$jscomp.inherits(a,b.Auxiliary);a.prototype.registerTextField=function(){var a=this,h=a.evaluator,q=b.newHTML("div"),e=b.newHTML("label");e.appendChild(document.createTextNode("___"+a.id+"=___"));
var g=b.newHTML("input");g.value=a.expresionString;g.disabled=!a.editable;q.appendChild(e);q.appendChild(g);g.onkeydown=function(b){13==b.keyCode&&(a.expresion=parser.parse(this.value),h.setVariable(a.id,a.expresion),a.parent.update())};a.parent.editableRegion.textFields.push({container:q,type:"div"})};b.Variable=a;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=function(a,h){a=b.Auxiliary.call(this,a,h)||this;a.expresion=a.evaluator.parser.parse(a.expresion);a.update();return a};$jscomp.inherits(a,b.Auxiliary);a.prototype.update=function(){this.evaluator.setVariable(this.id,this.evaluator.eval(this.expresion))};b.Constant=a;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,d,h,q,e,g=function(d,e){a=e=b.Auxiliary.call(this,d,e)||this;h=d.evaluator.parser;a.size=a.size||h.parse("3");a.expresion=a.expresion.split(";");a.parseFile=h.parse(a.file);a.update();return e};$jscomp.inherits(g,b.Auxiliary);g.prototype.update=function(){var p=this;a=this;var g=a.expresion,c;d=a.evaluator;h=d.parser;a.oldFile=a.file;if(q=d.eval(a.parseFile))a.file=q;a.file&&(e=(c=document.getElementById(a.file))&&"descartes/vectorFile"==c.type?
c.text:b.openFile(a.file),null!=e&&(e=e.replace(/\r/g,"").split("\n"),e=e.filter(function(a){return""!==a.trim()})),null==e||1==e.length&&""==e[0]?(e=[],a.size=h.parse("0")):(g=e,a.size=null),null===a.size&&(a.size=h.parse(g.length+"")));var l,m;g=g.map(function(b,c){(m=h.parse(b,!0))&&"assign"!==m.type&&(l=NaN,","==p.parent.decimal_symbol&&(l=parseFloat(b.replace(",","."))),m=h.parse(a.id+"["+c+"]="+(isNaN(l)?b:l),!0));return m});c=Array(parseInt(Math.abs(d.eval(a.size)))).fill(0);c._size_=c.length;
d.vectors[a.id]=c;d.setVariable(a.id+".long",c._size_);g=$jscomp.makeIterator(g);for(c=g.next();!c.done;c=g.next())d.eval(c.value)};b.Vector=g;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,d,h,q,e,g,p,n=/'[^']*'|"[^"]*"|[^,']+/g,c=/'[^']*'|"[^"]*"|[^;']+/g,l=function(m,l){a=l=b.Auxiliary.call(this,m,l)||this;d=m.evaluator;h=d.parser;a.rows=a.rows||h.parse("3");a.columns=a.columns||h.parse("3");if(a.file){var f=document.getElementById(a.file);p=f&&"descartes/matrixFile"==f.type?f.text:b.openFile(a.file);var u,x;null!=p&&(e=0,q=null,p=p.replace(/\r/g,"").split("\n"),a.expresion=[],p.forEach(function(b){b&&(u="."==m.decimal_symbol?b.trim().match(n)||
[]:b.trim().match(c)||[],null==q&&(q=u.length),u.forEach(function(b,c){b=b.trim();x="."==m.decimal_symbol?parseFloat(b):parseFloat(b.replace(",","."));isNaN(x)&&!/^'.*'$/.test(b)?(x=b.replace(/^"(.*)"$/,"$1"),x="'"+x+"'"):(","==m.decimal_symbol&&(b=b.replace(",",".")),x=b);a.expresion.push(h.parse(a.id+"["+e+","+c+"]:="+x))}),e++)}),a.rows=h.parse(q+""),a.columns=h.parse(e+""));if(null==p||1==p.length&&""==p[0])a.expresion=[],a.rows=h.parse("0"),a.columns=h.parse("0")}else a.expresion=b.splitInstructions(h,
a.expresion),q=d.eval(a.rows),e=d.eval(a.columns);g=[];g.type="matrix";f=0;for(var r=e;f<r;f++)g[f]=Array(q).fill(0);d.matrices[a.id]=g;a.update();return l};$jscomp.inherits(l,b.Auxiliary);l.prototype.update=function(){a=this;d=a.evaluator;g=d.matrices[a.id];g.rows=d.eval(a.rows);g.cols=d.eval(a.columns);d.setVariable(a.id+".filas",g.rows);d.setVariable(a.id+".columnas",g.cols);for(var b=$jscomp.makeIterator(a.expresion),c=b.next();!c.done;c=b.next())d.eval(c.value)};b.Matrix=l;return b}(descartesJS||
{});
descartesJS=function(b){if(b.loadLib)return b;var a=function(a,h){var d=b.Auxiliary.call(this,a,h)||this;var e=d.evaluator;a=e.parser;h=d.id.indexOf("(");d.name=d.id.substring(0,h);d.params=d.id.substring(h+1,d.id.indexOf(")"));d.domain=d.range?a.parse(d.range):a.parse("1");d.params=""===d.params?[]:d.params.split(",");d.numParams=d.params.length;d.algorithm||(d.init=d.doExpr=d.whileExpr="");b.parseExpr(d,d,a);d.expresion=a.parse(d.expresion);var g;d.functionExec=function(){var a=arguments,h=0;if(d.numParams<=
arguments.length){for(var c=[],l=$jscomp.makeIterator(d.privateVars),m=l.next();!m.done;m=l.next())m=m.value,c.push(e.getVariable(m)),e.setVariable(m,0);var f=[];d.params.forEach(function(b,c){f.push(e.getVariable(b));e.setVariable(b,a[c])});l=$jscomp.makeIterator(d.init);for(m=l.next();!m.done;m=l.next())e.eval(m.value);g=e.getVariable("_NUM_MAX_ITE_ALG_")||1E5;do{l=$jscomp.makeIterator(d.doExpr);for(m=l.next();!m.done;m=l.next())e.eval(m.value);if(++h>g)return console.warn("se ha excedido el l\u00edmite de "+
g+" repeticiones en la funci\u00f3n \u00ab"+d.name+"\u00bb"),0}while(0<e.eval(d.whileExpr));h=e.eval(d.expresion);b.rangeOK=e.eval(d.domain);d.params.forEach(function(a,b){e.setVariable(a,f[b])});d.privateVars.forEach(function(a,b){e.setVariable(a,c[b])});return h}return 0};e.setFunction(d.name,d.functionExec);return d};$jscomp.inherits(a,b.Auxiliary);b.Function=a;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,d,h=function(a,d){a=b.Auxiliary.call(this,a,d)||this;b.parseExpr(a,a,a.evaluator.parser);return a};$jscomp.inherits(h,b.Auxiliary);h.prototype.algorithmExec=function(){var b=0;d=this.evaluator;a=d.getVariable("_NUM_MAX_ITE_ALG_")||1E5;for(var e=$jscomp.makeIterator(this.init),g=e.next();!g.done;g=e.next())d.eval(g.value);do{e=$jscomp.makeIterator(this.doExpr);for(g=e.next();!g.done;g=e.next())d.eval(g.value);if(++b>a)return console.warn("se ha excedido el l\u00edmite de "+
a+" repeticiones en el algoritmo \u00ab"+this.name+"\u00bb"),0}while(0<d.eval(this.whileExpr))};h.prototype.update=function(){this.algorithmExec();"onlyOnce"===this.evaluate&&(this.update=function(){})};b.Algorithm=h;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=function(a,h){var d=b.Auxiliary.call(this,a,h)||this;a=d.evaluator;delete d.evaluate;d.condition=a.parser.parse(d.condition);d.lastEval=!1;d.action=d.parent.lessonParser.parseAction(d);"onlyOnce"==d.execution&&(d.eventExec=function(){0<d.evaluator.eval(d.condition)&&!d.lastEval&&(d.lastEval=!0,d.action.execute())});"alternate"==d.execution&&(d.eventExec=function(){var a=0<d.evaluator.eval(d.condition);a&&!d.lastEval?(d.action.execute(),d.lastEval=
!0):!a&&d.lastEval&&(d.lastEval=!1)});"always"==d.execution&&(d.eventExec=function(){0<d.evaluator.eval(d.condition)&&d.action.execute()});return d};$jscomp.inherits(a,b.Auxiliary);a.prototype.update=function(){this.eventExec()};b.Event=a;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=function(a,h){var d=b.Auxiliary.call(this,a,h)||this;h=h.file;var e=null;h&&(e=(e=document.getElementById(h))&&"descartes/library"===e.type?e.text:b.openFile(h));if(e)for(e=b.convertHTMLEntities(e).replace(/\r/g,"").split("\n"),h=$jscomp.makeIterator(e),e=h.next();!e.done;e=h.next())e=e.value,""!==e.trim()&&a.lessonParser.parseAuxiliar(e);return d};$jscomp.inherits(a,b.Auxiliary);b.Library=a;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,d,h,q,e,g,p,n,c=function(c,d){a=this;a.parent=c;a.evaluator=c.evaluator;var e=a.evaluator.parser;a.spaceID=a.type=a.trace=a.family=a.text="";a.background=a.visible=a.editable=!1;a.drawif=e.parse("1");a.abs_coord=d&&d.type&&"text"===d.type.toLowerCase();a.color=new b.Color("20303a");a.expresion=e.parse("(0,0)");a.family_interval=e.parse("[0,1]");a.family_steps=e.parse("8");a.font="SansSerif,PLAIN,"+(5<=a.parent.version?"18":"12");a.fixed=!0;a.decimals=
e.parse("2");Object.assign(this,d);a.space=a.getSpace();a.canvas=a.background?a.space.backCanvas:a.space.canvas;a.ctx=a.canvas.getContext("2d");a.trace&&(a.traceCtx=a.space.backCtx);a.font_str=a.font;a.font=b.convertFont(a.font);a.fontSize=a.font.match(/([\d\.]+)px/);a.fontSize=a.fontSize?parseFloat(a.fontSize[1]):10;a.font_style=b.getFontStyle(a.font_str.split(",")[1]);if("boolean"===typeof a.bold||"boolean"===typeof a.italics)a.font_style=(a.italics?"Italic ":"")+(a.bold?"Bold ":"");a.font_family||
(a.font_family=a.font_str.split(",")[0]);a.font_family=b.getFontName(a.font_family);"undefined"===typeof a.font_size&&(a.font_size=c.evaluator.parser.parse(a.fontSize.toString()))};c.prototype.getSpace=function(){var a=this;return this.parent.spaces.find(function(b){return b.id===a.spaceID})||this.parent.spaces[0]};c.prototype.getFamilyValues=function(){a=this;d=a.evaluator;var b=$jscomp.makeIterator(d.eval(a.family_interval)[0]);a.fInf=b.next().value;a.fSup=b.next().value;a.fSteps=Math.round(d.eval(a.family_steps));
a.fSep=0<a.fSteps?(a.fSup-a.fInf)/a.fSteps:0};c.prototype.drawFamilyAux=function(b,c,e){a=this;d=a.evaluator;a.getFamilyValues();h=d.getVariable(a.family);if(0<=a.fSteps)for(var m=0,l=a.fSteps;m<=l;m++)d.setVariable(a.family,a.fInf+m*a.fSep),0<d.eval(a.drawif)&&(a.update(),a.drawAux(b,c,e));d.setVariable("_Text_H_",0);d.setVariable(a.family,h)};c.prototype.draw=function(a,b){""!==this.family?this.drawFamilyAux(this.ctx,a,b):0<this.evaluator.eval(this.drawif)&&(this.update(),this.drawAux(this.ctx,
a,b));this.ctx.setLineDash([])};c.prototype.drawTrace=function(a,b){""!=this.family?this.drawFamilyAux(this.traceCtx,a,b):0<this.evaluator.eval(this.drawif)&&(this.update(),this.drawAux(this.traceCtx,a,b))};c.prototype.rotate=function(a,b,c){p=Math.cos(c);n=Math.sin(c);return{x:a*p-b*n,y:a*n+b*p}};c.prototype.dashStyle=function(){g=this.ctx;g.lineCap="butt";switch(this.lineDash){case "dot":g.setLineDash([g.lineWidth,g.lineWidth]);break;case "dash":g.setLineDash([4*g.lineWidth,3*g.lineWidth]);break;
case "dash_dot":g.setLineDash([4*g.lineWidth,2*g.lineWidth,g.lineWidth,2*g.lineWidth]);break;default:g.lineCap="round",g.setLineDash([])}};c.prototype.drawText=function(a,b,c,p,g,h,r,n,z,y,A){a.textNode=b;if("rtfNode"===b.type)a.fillStyle=a.strokeStyle=g.getColor(),a.textBaseline="alphabetic",a.textNode.pos={x:c,y:p},b.update(a,c,p,z,y,r,A,g.getColor());else for("simpleText"===b.type&&(b=b.toString(z,y).split("\\n")),d=this.evaluator,a.fillStyle=g.getColor(),a.font=h,a.textAlign=r,a.textBaseline=
n,e=1.2*this.fontSize||0,g=0,h=b.length;g<h;g++)q=b[g],this.border&&(a.strokeStyle=this.border.getColor(),a.lineWidth=4,a.lineJoin="round",a.miterLimit=2,a.strokeText(q,c,p+e*g)),a.fillText(q,c,p+e*g)};b.Graphic=c;return b}(descartesJS||{});
descartesJS=function(b){function a(a,d,e){e=void 0===e?"":e;for(var c=$jscomp.makeIterator(a),l=c.next();!l.done;l=c.next())if(l=l.value,"identifier"===l.type&&!(b.reservedIds+e).match("-"+l.value+"-")||"R"===l.value||"G"===l.value||"B"===l.value)l.value=d+"."+l.value;return a}function d(b,d,e,c){d=e.tokenize(d.replace(/&squot;/g,"'"));d=a(d,c);return/^\\expr/.test(b)?"\\expr ":"\\decimals "+e.flatTokens(d)}if(b.loadLib)return b;var h,q=/[\w\.\-//]*(\.png|\.jpg|\.gif|\.svg|\.webp)/gi,e=function(e,
p,n,c){var l;h=l=b.Graphic.call(this,e,p)||this;h.hasExpresion=h.hasExpresion||!1;h.graphics=[];Object.assign(h,p);h.hasExpresion=void 0!==h.expresion;if(!h.hasExpresion)return l;"'"!==String(h.expresion).charAt(0)&&(h.expresion="'"+h.expresion+"'");h.expresion=h.evaluator.parser.parse(h.expresion);p=h.evaluator.eval(h.expresion);if(p)var m=(m=document.getElementById(p))&&"descartes/macro"===m.type?m.text:b.openFile(p);if(m){p=b.convertHTMLEntities(m).replace(/\r/g,"").split("\n");m=[];e=e.lessonParser;
var f=new b.Tokenizer,g;p=$jscomp.makeIterator(p);for(g=p.next();!g.done;g=p.next())if(g=g.value,g.includes("=")){g=e.split(g);for(var u=$jscomp.makeIterator(g),x=u.next();!x.done;x=u.next())if((x=x.value)&&1<g.length&&("id"===babel[x[0]]||"type"===babel[x[0]])){m.push(g);break}}x=0;for(var r=m.length;x<r;x++){g=(p=m[x]||[],p[0])&&"id"===p[0][0];u=!1;for(var v=0,z=p.length;v<z;v++){var y=p[v][0];var A=p[v][1];var B=y.indexOf(".");-1===B||g?B=babel[y]:(B=babel[y.substring(B+1)],p[v][0]=h.name+"."+
y);"type"===B&&"surface"===babel[A]&&(u=!0);if(n.includes("3D")){if(("font"===B||"font_family"===B||("fill"===B||"color"===B||"backcolor"===B||"arrow"===B)&&"("!==p[v][1].charAt(0)||"file"===B&&p[v][1].match(q)||"id"!==B&&void 0!==babel[p[v][1]])&&"width"!==B&&"height"!==B&&"length"!==B)continue}else if(("font"===B||"font_family"===B||("fill"===B||"color"===B||"border"===B||"arrow"===B)&&"("!==p[v][1].charAt(0)||"file"===B&&p[v][1].match(q)||"id"!==B&&void 0!==babel[p[v][1]])&&"radius"!==B)continue;
if(u&&"expresion"===B){for(var E=p[v][1].split(" "),I="",D=0,G=E.length;D<G;D++){for(var H=E[D].replace(/&squot;/g,"'").split(";"),C=0,J=H.length;C<J;C++)y=a(H[C].replace(/\\n/g,";"),h.name,n.includes("3D")?"-x-y-z-u-v-":""),H[C]=f.flatTokens(y);I+=H.join(";")+" "}p[v][1]=I}if("text"===B)if(/\{\\rtf1/.test(A))A=A.replace(/\\expr\s*([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,function(a,b){return d(a,b,f,h.name)}).replace(/\\decimals\s*([a-zA-Z_0-9\u00C0-\u021B+*/%|&^#!?:()><.'\+\-]*)/gi,function(a,
b){return d(a,b,f,h.name)});else{A=e.parseText(A).txtEleMacros;B=0;for(E=A.length;B<E;B++)y=f.tokenize(A[B].replace(/&squot;/g,"'")),y=a(y,h.name),A[B]=f.flatTokens(y).replace(/&squot;/g,"'").replace(/'\+\(/g,"[").replace(/\)\+'/g,"]"),A[B]=A[B].slice(1,-1);A=A.join("")}else{A=A.replace(/&squot;/g,"'").split(";");B=0;for(E=A.length;B<E;B++)y=f.tokenize(A[B].replace(/\\n/g,";")),y=a(y,h.name,n.includes("3D")?"-Euler-":""),A[B]=f.flatTokens(y);A=A.join(";")}p[v][1]=A}}u=0;for(x=m.length;u<x;u++)if(m[u][0]){p=
"";g=!1;r=0;for(v=m[u].length;r<v;r++)"type"===babel[m[u][r][0]]&&c.includes("-"+babel[m[u][r][1]]+"-")&&(g=!0),p+=m[u][r][0]+"='"+m[u][r][1]+"' ";m[u]=p+(g?" space='"+h.spaceID+"'":"");g?h.graphics.push(e[n](m[u],h.abs_coord,h.background,h.inirot)):e.parseAuxiliar(m[u])}}return l};$jscomp.inherits(e,b.Graphic);b.BaseMacro=e;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,d,h,q,e,g,p,n=function(b,d){this.text=d=d.replace("&#x2013","\u2013").replace(/&squot;/g,"'");this.txtEle=[];this.txtEleMacros=[];this.parent=b;this.evaluator=b.evaluator;this.type="simpleText";a="'";q=h=0;for(e=-1;h<d.length;)g=d.charAt(h),p=d.charAt(h-1),"["===g&&"\\"===p?(this.txtEle.push(d.substring(q,h-1)+"["),this.txtEleMacros.push("'"+d.substring(q,h-1)+"['"),q=h+1):"]"===g&&"\\"===p?(this.txtEle.push(d.substring(q,h-1)+"]"),this.txtEleMacros.push("'"+
d.substring(q,h-1)+"]'"),q=h+1):"["===g&&-1===e?(this.txtEle.push(d.substring(q,h)),this.txtEleMacros.push("'"+d.substring(q,h)+"'"),q=h,e++):"["===g?e++:"]"===g&&0===e?(this.txtEle.push(this.evaluator.parser.parse(d.substring(q,h+1))),this.txtEleMacros.push("["+d.substring(q,h+1)+"]"),q=h+1,e--):("]"==d.charAt(h)&&(e=0>e?e:e-1),a+=d.charAt(h)),h++;this.txtEle.push(d.substring(q,h));this.txtEleMacros.push("'"+d.substring(q,h)+"'")};n.prototype.toString=function(c,e){a="";for(var m=$jscomp.makeIterator(this.txtEle),
p=m.next();!p.done;p=m.next())p=p.value,"string"===typeof p?a+=p:(d=this.evaluator.eval(p)[0][0],""!==d&&("string"===typeof d?a+=d:Infinity==d?a+="Infinity":-Infinity==d?a+="-Infinity":isNaN(d)||"NaN"==d?a+="NaN":(d=parseFloat(d),d=e?d.toFixed(c):b.removeNeedlessDecimals(d.toFixed(c)),a+=d.toString().replace(".",this.parent.decimal_symbol))));return a};b.SimpleText=n;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,d,h,q,e,g,p,n,c,l,m,f,w,u,x,r,v,z,y,A,B,E,I,D,G,H,C,J,O,Q,M,P,N,F,K=function(a,c){c=b.Graphic.call(this,a,c)||this;c.width=c.width||a.evaluator.parser.parse("1");c.fillP=c.fillP||"";c.fillM=c.fillM||"";c.parseExpression();c.visible=2===c.parent.version&&void 0==c.visible?!0:c.visible;c.visible&&c.registerTextField();f=new b.R2;w=new b.R2;u=new b.R2;x=new b.R2;v=new b.R2;c.cInd=0;return c};$jscomp.inherits(K,b.Graphic);K.prototype.parseExpression=
function(){if("compOperator"===this.expresion.type){var a=this.expresion.childs[0],c=this.expresion.childs[1];"identifier"!=a.type||"y"!=a.value||c.contains("y")?"identifier"!=c.type||"y"!=c.value||a.contains("y")?"identifier"!=a.type||"x"!=a.value||c.contains("x")?"identifier"!=c.type||"x"!=c.value||a.contains("x")||(this.funExpr=c,this.of_y=!0,this.drawAux=this.drawAuxFun):(this.funExpr=c,this.of_y=!0,this.drawAux=this.drawAuxFun):(this.funExpr=a,this.of_y=!1,this.drawAux=this.drawAuxFun):(this.funExpr=
c,this.of_y=!1,this.drawAux=this.drawAuxFun)}this.newt=new b.R2Newton(this.evaluator,this.expresion)};K.prototype.update=function(){};K.prototype.draw=function(){""!=this.family?this.drawFamilyAux(this.ctx,this.fill,this.color):(this.update(),this.drawAux(this.ctx,this.fill,this.color))};K.prototype.drawFamilyAux=function(a,b,c){h=this.evaluator;this.getFamilyValues();d=h.getVariable(this.family);if(0<=this.fSteps)for(var e=0,m=this.fSteps;e<=m;e++)h.setVariable(this.family,this.fInf+e*this.fSep),
this.update(),this.drawAux(a,b,c);h.setVariable(this.family,d)};K.prototype.drawTrace=function(){b.Graphic.prototype.drawTrace.call(this,this.fill,this.trace)};K.prototype.drawAux=function(d,R,K){if(!(0>=this.evaluator.eval(this.drawif))){this.cInd=0;h=this.evaluator;q=this.space;e=h.eval(this.width);d.strokeStyle=this.color.getColor();d.lineWidth=e;g=h.getVariable("x");p=h.getVariable("y");n=q.w+24;c=q.h+24;l=n/9;3>l&&(l=3);m=c/7;3>m&&(m=3);0==this.cInd?(a=[],this.cInd++):this.cInd=(this.cInd+1)%
1E7;f.set(0,0);w.set(0,0);u.set(0,0);N=.25;F=8;this.abs_coord||(N/=q.scale,F/=q.scale);d.beginPath();for(C=parseInt(m/2);C<c;C+=m)for(H=parseInt(l/2);H<n;H+=l){if(this.abs_coord){v.set(H,C);r=this.newt.findZero(v,N);if(null==r)continue;h.setVariable("x",r.x);h.setVariable("y",r.y);x.set(r.x,r.y)}else{v.set(q.getRelativeX(H),q.getRelativeY(C));r=this.newt.findZero(v,N);if(null==r)continue;h.setVariable("x",r.x);h.setVariable("y",r.y);x.set(q.getAbsoluteX(r.x),q.getAbsoluteY(r.y))}z=x.ix();y=x.iy();
if(-12<=z&&z<n+24&&-12<=y&&y<c+24){if(a[z+12+(y+12)*q.w]===this.cInd)continue;a[z+12+(y+12)*q.w]=this.cInd}b.rangeOK&&(d.moveTo(z,y),d.lineTo(z,y));f.x=r.x;f.y=r.y;w.x=r.x;w.y=r.y;A=this.newt.getUnitNormal();if(0!=A.x||0!=A.y)for(A.rotL90(),u.x=A.x,u.y=A.y,E=B=0,I=!1;2>E;)if(I&&(u.x=-A.x,u.y=-A.y,r.x=f.x,r.y=f.y,w.x=r.x,w.y=r.y,this.abs_coord?x.set(r.x,r.y):x.set(q.getAbsoluteX(r.x),q.getAbsoluteY(r.y)),z=x.ix(),y=x.iy(),I=!1,B=0),r.x+=F*u.x,r.y+=F*u.y,r=this.newt.findZero(r,N),null!=r){h.setVariable("x",
r.x);h.setVariable("y",r.y);u.x=r.x-w.x;u.y=r.y-w.y;u.normalize();if(0==u.x&&0==u.y)break;w.x=r.x;w.y=r.y;this.abs_coord?x.set(r.x,r.y):x.set(q.getAbsoluteX(r.x),q.getAbsoluteY(r.y));D=parseInt(x.ix());G=parseInt(x.iy());if(D!=z||G!=y)if(J=z,O=y,z=D,y=G,-12<=z&&z<n+24&&-12<=y&&y<c+24){B=0;Q=a[z+12+(y+12)*q.w];a[z+12+(y+12)*q.w]=this.cInd;for(R=1;8>R;R++)M=J+Math.round((z-J)*R/8),P=O+Math.round((y-O)*R/8),0<=M&&M<n&&0<=P&&P<c&&(a[M+12+(P+12)*q.w]=this.cInd);b.rangeOK&&(d.moveTo(J,O),d.lineTo(z,y));
if(Q===this.cInd)break}else I=!0,E++;else 4<++B&&(I=!0,E++)}}d.stroke();h.setVariable("x",g);h.setVariable("y",p)}};K.prototype.X=function(a,b,c){c||(b=this.space.w/2+this.space.Ox+this.space.scale*b);b<-a&&(b=-a);b>this.space.w+a&&(b=this.space.w+a);return b};K.prototype.Y=function(a,b,c){c||(b=this.space.h/2+this.space.Oy-this.space.scale*b);b<-a&&(b=-a);b>this.space.h+a&&(b=this.space.h+a);return b};K.prototype.XX=function(a,b,c){return Math.round(this.X(a,b,c))};K.prototype.YY=function(a,b,c){return Math.round(this.Y(a,
b,c))};K.prototype.extrapolate=function(a,c,d,e,m,p){h=this.evaluator;for(var l=h.getVariable(c),f=p/2,g=0,q,r,n,B,u,w;1E-15<Math.abs(f);){q=h.getVariable(c);r=h.getVariable(c)+f;h.setVariable(c,r);n=!0;try{B=m,m=h.eval(this.funExpr),h.setVariable(d,m),0<h.eval(a)?(u=new b.R2(Math.min(B,m),Math.max(B,m)),w=0,w=0<p?this.Singularity(Math.abs(f),c,e,q,B,r,m,u):this.Singularity(Math.abs(f),c,e,r,m,q,B,u),0<w&&(n=!1)):n=!1}catch(ea){n=!1}n?g+=f:h.setVariable(c,q);f/=2}h.setVariable(c,l);return new b.R2(g/
Math.abs(p),m)};K.prototype.extrapolateOnSingularity=function(a,c,d,e,m,p){h=this.evaluator;e=h.getVariable(c);for(var f=p/2,l=0,g=m,q;1E-15<Math.abs(f);){h.setVariable(c,h.getVariable(c)+f);q=!0;if(0<h.eval(a))try{g=h.eval(this.funExpr),h.setVariable(d,g),0>=h.eval(a)&&(q=!1)}catch(Z){q=!1}else q=!1;q?l+=f:h.setVariable(c,h.getVariable(c)-f);f/=2}if(0==l)for(f=p/2,l=p,g=m;1E-15<Math.abs(f);){h.setVariable(c,h.getVariable(c)-f);d=!0;if(0<h.eval(a))try{g=h.eval(this.funExpr)}catch(Z){d=!1}else d=!1;
d?l+=-f:h.setVariable(c,h.getVariable(c)+f);f/=2}h.setVariable(c,e);return new b.R2(l/Math.abs(p),g)};K.prototype.Singularity=function(a,b,c,d,e,m,p,f){h=this.evaluator;if(isNaN(p)||isNaN(e)||isNaN(f.y)||isNaN(f.x)||d>=m)return 2;var l=h.getVariable(b),g=0;try{if(1E-15>Math.abs(m-d)||1E-12>Math.abs(m-d)&&Math.abs(p-e)>Math.abs(a))return h.setVariable(b,l),1;var q=(d+m)/2;h.setVariable(b,q);var r=NaN;try{r=h.eval(this.funExpr)}catch(ca){return 2}if(isNaN(r))return 5;if(Math.abs(p-e)>a){h.setVariable(b,
d-1E-12);var n=h.eval(this.funExpr);n=(e-n)/1E-12;h.setVariable(b,m+1E-12);var B=(h.eval(this.funExpr)-p)/1E-12;if((10>Math.abs(B)||10>Math.abs(n))&&(0<=B&&0<=n||0>=B&&0>=n)&&4*Math.abs(B)<Math.abs((p-e)/(m-d)))return h.setVariable(b,l),2}if(isNaN(f.x)||isNaN(f.y)||isNaN(r))return 2;if(!(f.x<=r&&r<=f.y)){h.setVariable(b,q);f.x=Math.min(e,r);f.y=Math.max(e,r);var u=this.Singularity(a/2,b,c,d,e,q,r,f);h.setVariable(b,m);f.x=Math.min(p,r);f.y=Math.max(p,r);var w=this.Singularity(a/2,b,c,q,r,m,p,f);g=
Math.max(u,w)}}catch(ca){g=1}h.setVariable(b,l);return g};K.prototype.drawAuxFun=function(a,c,d){h=this.evaluator;g=h.getVariable("x");p=h.getVariable("y");b.rangeOK=1;c="x";var e="y";this.of_y&&(c="y",e="x");var m=this.drawif,f=h.eval(this.width),l=!1,q=new b.R2(this.space.w/2+this.space.Ox,this.space.h/2+this.space.Oy),r=this.of_y?q.ix():q.iy(),n=0,B=0,u=0,w=0,x=1/this.space.scale;q=x*(this.of_y?-this.space.h+q.y:-q.x);var v=0;this.abs_coord&&(q=0,x=1);for(var y,E,G,z,A,C,H,N,D,P=this.of_y?this.space.h+
2:this.space.w+2;u<=P;){y=!0;E=0;h.setVariable(c,q);try{G=h.eval(this.funExpr),isNaN(G)||(h.setVariable(e,G),0<h.eval(this.drawif)&&b.rangeOK?(l?(z=Math.min(v,G),A=Math.max(v,G),C=new b.R2(z,A),E=this.Singularity(x,c,0,q-x,v,q,G,C),0===E?(v<=G?(v=C.x,G=C.y):(G=C.x,v=C.y),H=parseInt(this.of_y?this.XX(f,v,this.abs_coord):this.YY(f,v,this.abs_coord)),n=this.abs_coord?Math.round(G):parseInt(this.of_y?this.XX(f,G,this.abs_coord):this.YY(f,G,this.abs_coord)),this.fillM&&n>r&&(a.lineWidth=1,a.strokeStyle=
this.fillM.getColor(),a.beginPath(),this.of_y?(a.moveTo(r+1,this.space.h-u+.5),a.lineTo(n,this.space.h-u+.5)):(a.moveTo(u+.5,r+1),a.lineTo(u+.5,n)),a.stroke()),this.fillP&&n<r&&(a.lineWidth=1,a.strokeStyle=this.fillP.getColor(),a.beginPath(),this.of_y?(a.moveTo(r-1,this.space.h-u+.5),a.lineTo(n,this.space.h-u+.5)):(a.moveTo(u+.5,r-1),a.lineTo(u+.5,n)),a.stroke()),a.lineWidth=f,a.strokeStyle=d.getColor(),a.beginPath(),this.of_y?(a.moveTo(H+.5,this.space.h-w),a.lineTo(n+.5,this.space.h-u)):(a.moveTo(w+
.5,H),a.lineTo(u+.5,n)),a.stroke()):1===E?(h.setVariable(c,q-x),N=this.extrapolate(m,c,e,0,v,x),n=this.of_y?this.XX(f,N.y,this.abs_coord):this.YY(f,N.y,this.abs_coord),a.lineWidth=f,a.strokeStyle=d.getColor(),a.beginPath(),this.of_y?(a.moveTo(B+.5,this.space.h-w),a.lineTo(n+.5,this.space.h-w+Math.round(N.x))):(a.moveTo(w+.5,B),a.lineTo(w+Math.round(N.x)+.5,n)),h.setVariable(c,q),D=this.extrapolate(m,c,e,0,G,-x),B=this.of_y?this.XX(f,D.y,this.abs_coord):this.YY(f,D.y,this.abs_coord),n=this.of_y?this.XX(f,
G,this.abs_coord):this.YY(f,G,this.abs_coord),a.lineWidth=f,a.strokeStyle=d.getColor(),a.beginPath(),this.of_y?(a.moveTo(B+.5,this.space.h-u),a.lineTo(n+.5,this.space.h-u)):(a.moveTo(u+.5,B),a.lineTo(u+.5,n)),a.stroke()):2===E&&(n=this.of_y?this.XX(f,G,this.abs_coord):this.YY(f,G,this.abs_coord),a.lineWidth=f,a.strokeStyle=d.getColor(),a.beginPath(),this.of_y?(a.moveTo(B+.5,this.space.h-u),a.lineTo(n+.5,this.space.h-u)):(a.moveTo(u+.5,B),a.lineTo(u+.5,n)))):(D=this.extrapolateOnSingularity(m,c,e,
0,G,-x),B=this.of_y?this.XX(f,D.y,this.abs_coord):this.YY(f,D.y,this.abs_coord),n=this.of_y?this.XX(f,G,this.abs_coord):this.YY(f,G,this.abs_coord),a.lineWidth=f,a.strokeStyle=d.getColor(),a.beginPath(),this.of_y?(a.moveTo(B,this.space.h-(u+Math.round(D.x))+.5),a.lineTo(n,this.space.h-u+.5)):(a.moveTo(u+Math.round(D.x),B),a.lineTo(u,n)),a.stroke()),v=G):y=!1)}catch(fa){y=!1}l&&!y&&(h.setVariable(c,q-x),h.setVariable(e,v),N=this.extrapolate(m,c,e,0,v,x),n=parseInt(this.of_y?this.XX(f,N.y,this.abs_coord):
this.YY(f,N.y,this.abs_coord)),0<h.eval(this.drawif)&&b.rangeOK&&(a.lineWidth=f,a.strokeStyle=d.getColor(),a.beginPath(),this.of_y?(a.moveTo(B,this.space.h-(w+Math.round(N.x))+.5),a.lineTo(n,this.space.h-(w+Math.round(N.x))+.5)):(a.moveTo(w+Math.round(N.x)+.5,B),a.lineTo(w+Math.round(N.x)+.5,n)),a.stroke()),h.setVariable(c,q));l=y;q+=x;B=n;w=u++}h.setVariable("x",g);h.setVariable("y",p)};K.prototype.registerTextField=function(){var a=this,c=b.newHTML("input");c.value=a.expresionString;c.disabled=
!a.editable;c.onkeydown=function(b){13==b.keyCode&&(a.expresion=a.evaluator.parser.parse(this.value),a.parseExpression(),a.parent.update())};a.parent.editableRegion.textFields.push(c)};b.Equation=K;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=Math.round,d,h,q,e,g,p,n=function(a,d){d=b.Graphic.call(this,a,d)||this;d.param=d.param||"t";d.parameter_interval=d.parameter_interval||a.evaluator.parser.parse("[0,1]");d.parameter_steps=d.parameter_steps||a.evaluator.parser.parse("8");d.width=d.width||a.evaluator.parser.parse("1");d.fill=d.fill||"";d.visible=2===d.parent.version&&void 0==d.visible?!0:d.visible;d.visible&&d.registerTextField();return d};$jscomp.inherits(n,b.Graphic);n.prototype.update=
function(){d=this.evaluator;var a=$jscomp.makeIterator(d.eval(this.parameter_interval)[0]);this.paraInf=a.next().value;this.paraSup=a.next().value;this.pSteps=d.eval(this.parameter_steps);this.paraSep=0<this.pSteps?Math.abs(this.paraSup-this.paraInf)/this.pSteps:0};n.prototype.draw=function(){b.Graphic.prototype.draw.call(this,this.fill,this.color)};n.prototype.drawTrace=function(){b.Graphic.prototype.drawTrace.call(this,this.fill,this.trace)};n.prototype.drawAux=function(c,l,m){d=this.evaluator;
h=this.space;c.lineWidth=Math.max(1E-6,a(d.eval(this.width)));c.lineCap=c.lineJoin="round";c.strokeStyle=m.getColor();q=d.getVariable(this.param);c.beginPath();d.setVariable(this.param,this.paraInf);e=d.eval(this.expresion)[0];this.X=a(this.abs_coord?e[0]:h.getAbsoluteX(e[0]));this.Y=a(this.abs_coord?e[1]:h.getAbsoluteY(e[1]));this.rotateExp&&(g=b.degToRad(d.eval(this.rotateExp)),p=this.rotate(e[0],e[1],g),this.X=a(this.abs_coord?p.x:h.getAbsoluteX(p.x)),this.Y=a(this.abs_coord?p.y:h.getAbsoluteY(p.y)));
c.moveTo(this.X+.5,this.Y+.5);for(m=1;m<=this.pSteps;m++)d.setVariable(this.param,this.paraInf+m*this.paraSep),e=d.eval(this.expresion)[0],this.rotateExp&&(p=this.rotate(e[0],e[1],g),e[0]=p.x,e[1]=p.y),this.X=a(this.abs_coord?e[0]:h.getAbsoluteX(e[0])),this.Y=a(this.abs_coord?e[1]:h.getAbsoluteY(e[1])),!isNaN(this.X)&&!isNaN(this.Y)&&-1E6<this.X&&1E6>this.X&&-1E6<this.Y&&1E6>this.Y&&c.lineTo(this.X+.5,this.Y+.5);this.fill&&(c.fillStyle=l.getColor(),c.fill("evenodd"));this.dashStyle();c.stroke();c.setLineDash([]);
d.setVariable(this.param,q)};n.prototype.registerTextField=function(){var a=this,d=b.newHTML("input");d.value=a.expresionString;d.disabled=!a.editable;d.onkeydown=function(b){13==b.keyCode&&(a.expresion=a.evaluator.parser.parse(this.value),a.parent.update())};a.parent.editableRegion.textFields.push(d);console.log(a.parent.editableRegion.textFields)};b.Curve=n;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=2*Math.PI,d=Math.round,h,q,e,g,p,n,c,l,m,f=function(a,c){c=b.Graphic.call(this,a,c)||this;c.size=c.size||a.evaluator.parser.parse("2");c.range=c.range||a.evaluator.parser.parse("[1, 100]");c.visible=2===c.parent.version&&void 0==c.visible?!0:c.visible;c.visible&&c.registerTextField();return c};$jscomp.inherits(f,b.Graphic);f.prototype.update=function(){h=this.evaluator;var a=$jscomp.makeIterator(h.eval(this.expresion)[0]);this.X=a.next().value;this.Y=
a.next().value;this.rotateExp&&(e=this.rotate(this.X,this.Y,b.degToRad(h.eval(this.rotateExp))),this.X=e.x,this.Y=e.y);n=h.eval(this.range)[0];this.rangeInf=n[0];this.rangeMax=n[1]};f.prototype.draw=function(){b.Graphic.prototype.draw.call(this,this.color,this.color)};f.prototype.drawTrace=function(){b.Graphic.prototype.drawTrace.call(this,this.trace,this.trace)};f.prototype.drawAux=function(e,f){h=this.evaluator;q=this.space;l=c=Math.ceil(h.eval(this.size)-.4);e.fillStyle=f.getColor();e.beginPath();
this.rangeInf>this.rangeMax&&(m=this.rangeInf,this.rangeInf=this.rangeMax,this.rangeMax=m);f=h.getVariable("n");for(var n=this.rangeInf,r=this.rangeMax;n<=r;n++){h.setVariable("n",n);var u=$jscomp.makeIterator(h.eval(this.expresion)[0]);this.X=u.next().value;this.Y=u.next().value;g=d(this.abs_coord?this.X:q.getAbsoluteX(this.X));p=d(this.abs_coord?this.Y:q.getAbsoluteY(this.Y));e.beginPath();e.arc(g,p,c,0,a);e.fill()}e.fill();this.text!=[""]&&(this.fontSize=Math.max(5,h.eval(this.font_size)),this.font=
this.font_style+" "+this.fontSize+"px "+this.font_family,b.Graphic.prototype.drawText.call(this,e,this.text,g+l,p-l,this.color,this.font,"start","alphabetic",h.eval(this.decimals),this.fixed,!0));h.setVariable("n",f)};f.prototype.registerTextField=function(){var a=this,c=b.newHTML("input");c.value=a.expresionString;c.disabled=!a.editable;c.onkeydown=function(b){13==b.keyCode&&(a.expresion=a.evaluator.parser.parse(this.value),a.parent.update())};a.parent.editableRegion.textFields.push(c)};b.Sequence=
f;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=2*Math.PI,d=Math.round,h,q,e,g,p,n,c=function(a,c){c=b.Graphic.call(this,a,c)||this;c.size=c.size||a.evaluator.parser.parse("2");c.text=new b.TextObject(c,c.text);return c};$jscomp.inherits(c,b.Graphic);c.prototype.update=function(){h=this.evaluator;var a=$jscomp.makeIterator(h.eval(this.expresion)[0]);this.X=a.next().value;this.Y=a.next().value;this.rotateExp&&(e=this.rotate(this.X,this.Y,b.degToRad(h.eval(this.rotateExp))),this.X=e.x,this.Y=e.y)};
c.prototype.draw=function(){b.Graphic.prototype.draw.call(this,this.color,this.color)};c.prototype.drawTrace=function(){b.Graphic.prototype.drawTrace.call(this,this.trace,this.trace)};c.prototype.drawAux=function(b,c){q=this.space;b.fillStyle=c.getColor();g=d(this.abs_coord?this.X:q.getAbsoluteX(this.X));p=d(this.abs_coord?this.Y:q.getAbsoluteY(this.Y));n=d(this.evaluator.eval(this.size));0<n&&(b.beginPath(),b.arc(g,p,n,0,a),b.fill());this.text.hasContent&&this.text.draw(b,c,g,p)};b.Point=c;return b}(descartesJS||
{});
descartesJS=function(b){if(b.loadLib)return b;var a=Math.round,d=2*Math.PI,h,q,e,g,p,n,c,l,m,f,w,u=function(a,c){c=b.Graphic.call(this,a,c)||this;c.width=c.width||a.evaluator.parser.parse("1");c.size=c.size||a.evaluator.parser.parse("2");c.text=new b.TextObject(c,c.text);return c};$jscomp.inherits(u,b.Graphic);u.prototype.update=function(){h=this.evaluator;e=h.eval(this.expresion);this.points=[];for(var a=0,c=e.length;a<c;a++)this.points[a]={x:e[a][0],y:e[a][1]};if(this.rotateExp)for(g=b.degToRad(h.eval(this.rotateExp)),a=
0,c=this.points.length;a<c;a++)this.points[a]=this.rotate(this.points[a].x,this.points[a].y,g)};u.prototype.draw=function(){b.Graphic.prototype.draw.call(this,this.color,this.color)};u.prototype.drawTrace=function(){b.Graphic.prototype.drawTrace.call(this,this.trace,this.trace)};u.prototype.drawAux=function(b,e,g){h=this.evaluator;q=this.space;w=a(h.eval(this.width));b.lineWidth=Math.max(1E-6,w);p=h.eval(this.size);b.fillStyle=e.getColor();b.strokeStyle=g.getColor();b.lineCap="round";n=0==b.lineWidth%
2?0:.5;this.abs_coord?(c=a(this.points[0].x),l=a(this.points[0].y),m=a(this.points[1].x),f=a(this.points[1].y)):(c=a(q.getAbsoluteX(this.points[0].x)),l=a(q.getAbsoluteY(this.points[0].y)),m=a(q.getAbsoluteX(this.points[1].x)),f=a(q.getAbsoluteY(this.points[1].y)));b.beginPath();b.moveTo(c+n,l+n);b.lineTo(m+n,f+n);this.dashStyle();b.stroke();0<p&&(b.beginPath(),b.arc(c,l,p,0,d),b.arc(m,f,p,0,d),b.fill());b.setLineDash([]);this.text.hasContent&&this.text.draw(b,g,parseInt((c+m)/2)-3,parseInt((l+f)/
2)+3)};b.Segment=u;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=Math.floor,d=Math.round,h,q,e,g,p,n,c,l,m,f,w,u,x,r=function(a,c){c=b.Graphic.call(this,a,c)||this;c.width=c.width||a.evaluator.parser.parse("5");c.size=c.size||a.evaluator.parser.parse("2");c.spear=c.spear||a.evaluator.parser.parse("8");c.arrow=c.arrow||new b.Color("ee0022");c.text=new b.TextObject(c,c.text);c.V=new b.Vector2D(0,0);c.points=[];return c};$jscomp.inherits(r,b.Graphic);r.prototype.update=function(){h=this.evaluator;q=h.eval(this.expresion);
for(var a=0,c=q.length;a<c;a++)this.points[a]={x:q[a][0],y:q[a][1]};if(this.rotateExp)for(e=b.degToRad(h.eval(this.rotateExp)),a=0,c=this.points.length;a<c;a++)this.points[a]=this.rotate(this.points[a].x,this.points[a].y,e)};r.prototype.draw=function(){b.Graphic.prototype.draw.call(this,this.arrow,this.color)};r.prototype.drawTrace=function(){b.Graphic.prototype.drawTrace.call(this,this.arrow,this.trace)};r.prototype.drawAux=function(b,e,r){h=this.evaluator;g=this.space;q=this.points;p=Math.max(0,
h.eval(this.width));n=Math.ceil(p/2);c=g.scale;this.V.x=q[1].x-q[0].x;this.V.y=q[1].y-q[0].y;l=this.V.vLength();this.angle=Math.atan2(this.V.y,this.V.x);b.fillStyle=e.getColor();b.strokeStyle=r.getColor();b.lineWidth=2;this.abs_coord?(m=d(q[0].x),f=d(q[0].y),w=d(q[1].x),u=d(q[1].y)):(m=d(g.getAbsoluteX(q[0].x)),f=d(g.getAbsoluteY(q[0].y)),w=d(g.getAbsoluteX(q[1].x)),u=d(g.getAbsoluteY(q[1].y)));x=Math.max(0,h.eval(this.spear));b.save();b.translate(m,f);this.abs_coord?b.rotate(this.angle):(l*=c,b.rotate(-this.angle));
b.beginPath();b.moveTo(-n,a(-n));b.lineTo(a(l-x-p),a(-n));b.lineTo(a(l-2*x),a(-x-n));b.lineTo(a(l),0);b.lineTo(a(l-2*x),a(x+n));b.lineTo(a(l-x-p),a(n));b.lineTo(-n,a(n));b.closePath();b.stroke();b.fill();b.restore();this.text.hasContent&&this.text.draw(b,r,parseInt((m+w)/2)-3,parseInt((f+u)/2)+3)};b.Arrow=r;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=Math.round,d,h,q,e,g,p,n,c,l=function(a,c){c=b.Graphic.call(this,a,c)||this;c.width=c.width||a.evaluator.parser.parse("1");c.fill=c.fill||"";c.points=[];return c};$jscomp.inherits(l,b.Graphic);l.prototype.update=function(){d=this.evaluator;q=d.eval(this.expresion);for(var a=0,c=q.length;a<c;a++)this.points[a]={x:q[a][0],y:q[a][1]};if(this.rotateExp)for(e=b.degToRad(d.eval(this.rotateExp)),a=0,c=this.points.length;a<c;a++)this.points[a]=this.rotate(this.points[a].x,
this.points[a].y,e)};l.prototype.draw=function(){b.Graphic.prototype.draw.call(this,this.fill,this.color)};l.prototype.drawTrace=function(){b.Graphic.prototype.drawTrace.call(this,this.trace,this.trace)};l.prototype.drawAux=function(b,e,l){d=this.evaluator;h=this.space;g=a(d.eval(this.width));b.lineWidth=Math.max(1E-6,g);b.strokeStyle=l.getColor();b.lineCap=b.lineJoin="round";p=0<g?.5:0;n=a(this.abs_coord?this.points[0].x:h.getAbsoluteX(this.points[0].x));c=a(this.abs_coord?this.points[0].y:h.getAbsoluteY(this.points[0].y));
b.beginPath();b.moveTo(n+p,c+p);l=1;for(var f=this.points.length;l<f;l++)n=a(this.abs_coord?this.points[l].x:h.getAbsoluteX(this.points[l].x)),c=a(this.abs_coord?this.points[l].y:h.getAbsoluteY(this.points[l].y)),b.lineTo(n+p,c+p);this.fill&&(b.fillStyle=e.getColor(),b.fill());this.dashStyle();b.stroke();b.setLineDash([])};b.Polygon=l;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=Math.round,d=Math.min,h=Math.max,q=Math.abs,e,g,p,n,c,l,m,f,w,u,x,r,v=function(a,c){c=b.Graphic.call(this,a,c)||this;c.width=c.width||a.evaluator.parser.parse("1");c.fill=c.fill||"";c.border_radius=c.border_radius||a.evaluator.parser.parse("0");return c};$jscomp.inherits(v,b.Graphic);v.prototype.update=function(){e=this.evaluator;l=e.eval(this.expresion);this.X=l[0][0];this.Y=l[0][1];this.w=150;this.h=100;this.rotateExp&&(p=this.rotate(l[0][0],l[0][1],
b.degToRad(e.eval(this.rotateExp))),this.X=p.x,this.Y=p.y);4<=l[0].length&&(this.w=l[0][2],this.h=l[0][3]);l[1]&&2==l[1].length&&(this.w=l[1][0],this.h=l[1][1]);this.w=h(0,this.w);this.h=h(0,this.h)};v.prototype.draw=function(){b.Graphic.prototype.draw.call(this,this.fill,this.color)};v.prototype.drawTrace=function(){b.Graphic.prototype.drawTrace.call(this,this.fill,this.trace,"trace")};v.prototype.drawAux=function(b,p,l,B){e=this.evaluator;g=this.space;n=a(e.eval(this.width));b.lineWidth=h(1E-6,
n);b.strokeStyle=l.getColor();b.lineCap="round";b.lineJoin="miter";c=0<n?.5:0;m=a(this.abs_coord?this.X:g.getAbsoluteX(this.X))+c;f=a(this.abs_coord?this.Y:g.getAbsoluteY(this.Y))+c;w=this.abs_coord?this.w:this.w*g.scale;u=this.abs_coord?this.h:-this.h*g.scale;x=d(h(0,e.eval(this.border_radius)),.5*q(w),.5*q(u));r=this.abs_coord?1:-1;b.beginPath();0==x?(b.moveTo(m,f),b.lineTo(m+w,f),b.lineTo(m+w,f+u),b.lineTo(m,f+u)):(b.moveTo(m+x,f),b.lineTo(m+w-x,f),b.arcTo(m+w,f,m+w,f+r*x,x),b.lineTo(m+w,f+u-r*
x),b.arcTo(m+w,f+u,m+w-x,f+u,x),b.lineTo(m+x,f+u),b.arcTo(m,f+u,m,f+u-r*x,x),b.lineTo(m,f+r*x),b.arcTo(m,f,m+x,f,x));b.closePath();this.fill&&(b.fillStyle=p.getColor(),b.fill());this.dashStyle();b.stroke();b.setLineDash([])};b.Rectangle=v;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=Math.PI,d=a/2,h=2*a,q=Math.round,e=Math.min,g=Math.max,p=Math.acos,n=Math.sqrt,c,l,m,f,w,u,x,r,v,z,y,A,B,E,I,D,G,H,C=function(a,c){c=b.Graphic.call(this,a,c)||this;c.width=c.width||a.evaluator.parser.parse("1");c.fill=c.fill||"";c.center=c.center||a.evaluator.parser.parse("(0,0)");c.radius=c.radius||a.evaluator.parser.parse("1");c.init=c.init||"0";c.end=c.end||"90";c.init.startsWith("_(")&&(c.iFlag=!0,c.init=c.init.slice(1));c.end.startsWith("_(")&&
(c.eFlag=!0,c.end=c.end.slice(1));c.initExpr=a.evaluator.parser.parse(c.init);c.endExpr=a.evaluator.parser.parse(c.end);c.text=new b.TextObject(c,c.text);return c};$jscomp.inherits(C,b.Graphic);C.prototype.update=function(){c=this.evaluator;var q=$jscomp.makeIterator(c.eval(this.center)[0]);this.X=q.next().value;this.Y=q.next().value;l=0;this.rotateExp&&(l=b.degToRad(c.eval(this.rotateExp)),m=Math.cos(l),f=Math.sin(l),w=this.X*m-this.Y*f,u=this.X*f+this.Y*m,this.X=w,this.Y=u);var G=c.eval(this.initExpr);
q=c.eval(this.endExpr);/^(\(|\[).*(\)|\])$/i.test(this.initExpr.type)&&/^(\(|\[).*(\)|\])$/i.test(this.endExpr.type)?(G=$jscomp.makeIterator(G[0]),x=G.next().value,r=G.next().value,q=$jscomp.makeIterator(q[0]),v=q.next().value,z=q.next().value,this.vectors?this.abs_coord&&(r=-r,z=-z):(x-=this.X,r=-r+this.Y,v-=this.X,z=-z+this.Y,this.abs_coord||(r=-r,z=-z)),y=0==x?0>r?3*d:d:p(1*x/n(x*x+r*r)),A=0==v?0>z?3*d:d:p(1*v/n(v*v+z*z)),y+=l,A+=l,0<x&&0<r&&this.abs_coord&&(y=h-y),0<x&&0>r&&!this.abs_coord&&(y=
h-y),0>x&&0>r&&!this.abs_coord&&(y=h-y),0>x&&0<r&&this.abs_coord&&(y=h-y),0<v&&0<z&&this.abs_coord&&(A=h-A),0<v&&0>z&&!this.abs_coord&&(A=h-A),0>v&&0>z&&!this.abs_coord&&(A=h-A),0>v&&0<z&&this.abs_coord&&(A=h-A),this.iFlag?(B=y,y=A,A=B):(B=e(y,A),E=g(y,A),y=B,A=E,A-y>a&&this.abs_coord&&(y=E,A=B),A-y<=a&&!this.abs_coord&&(y=E,A=B)),this.iniAng=y,this.endAng=A,this.drawPoints=!0):(this.iniAng=b.degToRad(G)+l,this.endAng=b.degToRad(q)+l,this.drawAngle=!0)};C.prototype.draw=function(){b.Graphic.prototype.draw.call(this,
this.fill,this.color)};C.prototype.drawTrace=function(){b.Graphic.prototype.drawTrace.call(this,this.fill,this.trace)};C.prototype.drawAux=function(a,b,d){c=this.evaluator;I=this.space;H=Math.max(0,c.eval(this.radius));a.lineWidth=Math.max(1E-6,q(c.eval(this.width)));a.lineCap="round";a.strokeStyle=d.getColor();this.abs_coord?(D=q(this.X),G=q(this.Y)):(D=q(I.getAbsoluteX(this.X)),G=q(I.getAbsoluteY(this.Y)),H*=I.scale,this.iniAng=-this.iniAng,this.endAng=-this.endAng);this.drawAngle&&this.iniAng>
this.endAng&&(d=$jscomp.makeIterator([this.endAng,this.iniAng]),this.iniAng=d.next().value,this.endAng=d.next().value);this.fill&&(a.fillStyle=b.getColor(),a.beginPath(),a.moveTo(D,G),a.arc(D,G,H,this.iniAng,this.endAng,void 0),a.fill());a.beginPath();a.arc(D,G,H,this.iniAng,this.endAng,void 0);this.dashStyle();a.stroke();this.text.hasContent&&this.text.draw(a,this.color,D,G)};b.Arc=C;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,d,h,q,e=function(a,d){d=b.Graphic.call(this,a,d)||this;d.width=d.width||a.evaluator.parser.parse("0");d.align||(d.align="left");d.anchor||(d.anchor="top_left");d.shadowColor=d.shadowColor?d.shadowColor.getColor():"transparent";d.text=new b.TextObject(d,d.text);return d};$jscomp.inherits(e,b.Graphic);e.prototype.update=function(){a=this.evaluator;var e=$jscomp.makeIterator(a.eval(this.expresion)[0]);this.X=e.next().value;this.Y=e.next().value;this.rotateExp&&
(d=this.rotate(this.X,this.Y,b.degToRad(a.eval(this.rotateExp))),this.X=d.x,this.Y=d.y)};e.prototype.draw=function(){b.Graphic.prototype.draw.call(this,this.color)};e.prototype.drawTrace=function(){b.Graphic.prototype.drawTrace.call(this,this.trace)};e.prototype.drawAux=function(a,b){this.abs_coord?(h=parseInt(this.X),q=parseInt(this.Y)):(h=parseInt(this.space.getAbsoluteX(this.X)),q=parseInt(this.space.getAbsoluteY(this.Y)));this.text.draw(a,b,h,q)};b.Text=e;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=Math.round,d,h,q,e,g,p,n,c,l,m,f,w=function(a,c){f=c=b.Graphic.call(this,a,c)||this;f.file=f.file||"";f.inirot=f.inirot||a.evaluator.parser.parse("0");f.img=new Image;f.scaleX=f.scaleY=1;f.ratio=a.ratio;a=f.expresion.getChildren();f.x_e=a[0];f.y_e=a[1];2<a.length&&(f.centered=!0,f.s_x_e=a[2],f.s_y_e=3<a.length?a[3]:a[2]);f.evaluator.eval(f.clip)&&(f.clip=f.clip.getChildren());f.update();return c};$jscomp.inherits(w,b.Graphic);w.prototype.update=
function(){var a=this;d=a.evaluator;a.X=d.eval(a.x_e);a.Y=d.eval(a.y_e);a.rotateExp&&(h=a.rotate(a.X,a.Y,b.degToRad(d.eval(a.rotateExp))),a.X=h.x,a.Y=h.y);a.centered&&(a.scaleX=d.eval(a.s_x_e),a.scaleY=d.eval(a.s_y_e),0==a.scaleX&&(a.scaleX=1E-5),0==a.scaleY&&(a.scaleY=1E-5));if((q=d.eval(a.file))||""==q)a.img=a.parent.getImage(q),a.img.hasUpdate||(a.img.hasUpdate=!0,a.img.addEventListener("load",function(){a.space.update(!0)}))};w.prototype.draw=function(){b.Graphic.prototype.draw.call(this)};w.prototype.drawTrace=
function(){b.Graphic.prototype.drawTrace.call(this)};w.prototype.drawAux=function(h){f=this;d=f.evaluator;f.img&&f.img.ready&&f.img.complete&&(f.clip?(l=d.eval(f.clip[2]),m=d.eval(f.clip[3])):(l=f.img.width,m=f.img.height,f.img.canvas&&(l=a(l/f.img.ratio),m=a(m/f.img.ratio))),e=f.centered?0:a(l/2),g=f.centered?0:a(m/2),p=a(f.abs_coord?f.X:f.space.getAbsoluteX(f.X)),n=a(f.abs_coord?f.Y:f.space.getAbsoluteY(f.Y)),c=b.degToRad(-d.eval(f.inirot)),h.save(),h.translate(p+e,n+g),h.rotate(c),f.opacity&&(h.globalAlpha=
d.eval(f.opacity)),h.scale(f.scaleX,f.scaleY),f.clip?f.img.canvas?h.drawImage(f.img,d.eval(f.clip[0])*f.img.ratio,d.eval(f.clip[1])*f.img.ratio,l*f.img.ratio,m*f.img.ratio,-l/2,-m/2,l,m):h.drawImage(f.img,d.eval(f.clip[0]),d.eval(f.clip[1]),l,m,-l/2,-m/2,l,m):h.drawImage(f.img,-l/2,-m/2,l,m),h.restore())};b.Image=w;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,d,h,q,e,g,p,n=document.createElement("canvas").getContext("2d");n.canvas.width=1;n.canvas.height=1;var c=function(a,c){return b.Graphic.call(this,a,c)||this};$jscomp.inherits(c,b.Graphic);c.prototype.update=function(){var a=$jscomp.makeIterator(this.evaluator.eval(this.expresion)[0]);this.X=a.next().value;this.Y=a.next().value};c.prototype.draw=function(){b.Graphic.prototype.draw.call(this,this.color,this.color)};c.prototype.drawTrace=function(){b.Graphic.prototype.drawTrace.call(this,
this.trace,this.trace)};c.prototype.drawAux=function(b,c){c=c.getColor();n.clearRect(0,0,1,1);n.fillStyle=c;n.fillRect(0,0,1,1);c=(new Uint32Array(n.getImageData(0,0,1,1).data.buffer))[0];g=b.getImageData(0,0,this.space.w,this.space.h);p=new Uint32Array(g.data.buffer);a=parseInt(this.abs_coord?this.X:this.space.getAbsoluteX(this.X));d=parseInt(this.abs_coord?this.Y:this.space.getAbsoluteY(this.Y));var f=g.width;q=0>a||0>d||a>=f||d>=g.height?-1:p[a+d*f];if(-1!=q&&c!=q){h=[a,d];for(e=0;0<h.length&&
!(e++,d=h.pop(),a=h.pop(),f=g.width,q==(0>a||0>d||a>=f||d>=g.height?-1:p[a+d*f])&&(p[a+d*g.width]=c,h.push(a-1,d),h.push(a+1,d),h.push(a,d-1),h.push(a,d+1)),e>=this.space.w*this.space.h););b.putImageData(g,0,0)}};b.Fill=c;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,d=function(a,d){var e=b.BaseMacro.call(this,a,d,"parseGraphic","-text-image-point-polygon-arc-segment-arrow-macro-curve-equation-sequence-rectangle-fill-")||this;e.inirot=e.inirot||a.evaluator.parser.parse("0");e.inipos=e.inipos||a.evaluator.parser.parse("(0,0)");Object.assign(e,d);return e};$jscomp.inherits(d,b.BaseMacro);d.prototype.update=function(){a=this.evaluator.eval(this.inipos)[0];this.iniPosX=a[0];this.iniPosY=a[1]};d.prototype.drawAux=
function(a){for(var b=0,d=this.graphics.length;b<d;b++)this.graphics[b]&&(a.save(),this.graphics[b].abs_coord?a.translate(this.iniPosX,this.iniPosY):a.translate(this.iniPosX*this.space.scale,-this.iniPosY*this.space.scale),this.graphics[b].draw(),a.restore())};b.Macro=d;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=Math.sqrt,d=Math.sin,h=Math.cos,q=Math.abs,e=function(a,b,c,d){a=void 0===a?0:a;b=void 0===b?0:b;c=void 0===c?0:c;d=void 0===d?1:d;this.D=new Float32Array(4);this.set(a,b,c,d)};e.prototype.set=function(a,b,c,d){this.D[0]=a;this.D[1]=b;this.D[2]=c;this.D[3]=d;return this};e.prototype.norm3D=function(){var b=this.D[0],d=this.D[1],c=this.D[2];return a(b*b+d*d+c*c)};e.prototype.normalize3D=function(a){a=void 0===a?new e:a;var b=this.norm3D();if(0===
b)return a.set(0,0,0,this.w);b=1/b;return a.set(this.D[0]*b,this.D[1]*b,this.D[2]*b,this.w)};e.prototype.dotProduct3D=function(a){return this.D[0]*a.D[0]+this.D[1]*a.D[1]+this.D[2]*a.D[2]};e.prototype.crossProduct3D=function(a,b){b=void 0===b?new e:b;var c=$jscomp.makeIterator(this.D),d=c.next().value,m=c.next().value;c=c.next().value;var f=$jscomp.makeIterator(a.D);a=f.next().value;var p=f.next().value;f=f.next().value;return b.set(m*f-c*p,c*a-d*f,d*p-m*a,b.w)};e.prototype.scalarProd3D=function(a,
b){b=void 0===b?new e:b;return b.set(this.D[0]*a,this.D[1]*a,this.D[2]*a,this.w)};e.prototype.subtract3D=function(a,b){b=void 0===b?new e:b;return b.set(this.D[0]-a.D[0],this.D[1]-a.D[1],this.D[2]-a.D[2],this.w)};e.prototype.add3D=function(a,b){b=void 0===b?new e:b;return b.set(this.D[0]+a.D[0],this.D[1]+a.D[1],this.D[2]+a.D[2],this.w)};e.prototype.equals3D=function(a,b){return q(this.D[0]-a.D[0])<=b&&q(this.D[1]-a.D[1])<=b&&q(this.D[2]-a.D[2])<=b};e.prototype.clone=function(){return new e(this.D[0],
this.D[1],this.D[2],this.D[3])};$jscomp.global.Object.defineProperties(e.prototype,{x:{configurable:!0,enumerable:!0,get:function(){return this.D[0]},set:function(a){this.D[0]=a}},y:{configurable:!0,enumerable:!0,get:function(){return this.D[1]},set:function(a){this.D[1]=a}},z:{configurable:!0,enumerable:!0,get:function(){return this.D[2]},set:function(a){this.D[2]=a}},w:{configurable:!0,enumerable:!0,get:function(){return this.D[3]},set:function(a){this.D[3]=a}}});var g=function(a,b,c,d,e,f,g,h,
q,r,v,z,y,A,B,E){a=void 0===a?0:a;b=void 0===b?0:b;c=void 0===c?0:c;d=void 0===d?0:d;e=void 0===e?0:e;f=void 0===f?0:f;g=void 0===g?0:g;h=void 0===h?0:h;q=void 0===q?0:q;r=void 0===r?0:r;v=void 0===v?0:v;z=void 0===z?0:z;y=void 0===y?0:y;A=void 0===A?0:A;B=void 0===B?0:B;E=void 0===E?0:E;this.D=new Float32Array(16);this.set(a,b,c,d,e,f,g,h,q,r,v,z,y,A,B,E)};g.prototype.set=function(a,b,c,d,e,f,g,h,q,r,v,z,y,A,B,E){var m=this.D;m[0]=a;m[1]=b;m[2]=c;m[3]=d;m[4]=e;m[5]=f;m[6]=g;m[7]=h;m[8]=q;m[9]=r;
m[10]=v;m[11]=z;m[12]=y;m[13]=A;m[14]=B;m[15]=E;return this};g.prototype.setIdentity=function(){var a=this.D;a[0]=1;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=1;a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=1;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return this};g.prototype.mulV4=function(a,b){b=void 0===b?new e:b;var c=this.D,d=a.D;a=b.D;var m=d[0],f=d[1],p=d[2];d=d[3];a[0]=m*c[0]+f*c[4]+p*c[8]+d*c[12];a[1]=m*c[1]+f*c[5]+p*c[9]+d*c[13];a[2]=m*c[2]+f*c[6]+p*c[10]+d*c[14];a[3]=m*c[3]+f*c[7]+p*c[11]+d*c[15];return b};g.prototype.translate=
function(a,b){b=void 0===b?(new g).setIdentity():b;var c=this.D,d=b.D;a instanceof e||(a=new e(a.x,a.y,a.z,a.w));var m=a.D[0],f=a.D[1];a=a.D[2];d[0]=c[0];d[1]=c[1];d[2]=c[2];d[3]=c[3];d[4]=c[4];d[5]=c[5];d[6]=c[6];d[7]=c[7];d[8]=c[8];d[9]=c[9];d[10]=c[10];d[11]=c[11];d[12]=c[0]*m+c[4]*f+c[8]*a+c[12];d[13]=c[1]*m+c[5]*f+c[9]*a+c[13];d[14]=c[2]*m+c[6]*f+c[10]*a+c[14];d[15]=c[3]*m+c[7]*f+c[11]*a+c[15];return b};g.prototype.rotateX=function(a,b){b=void 0===b?(new g).setIdentity():b;var c=this.D,e=b.D,
m=d(a);a=h(a);e[0]=c[0];e[1]=c[1];e[2]=c[2];e[3]=c[3];e[4]=c[4]*a+c[8]*m;e[5]=c[5]*a+c[9]*m;e[6]=c[6]*a+c[10]*m;e[7]=c[7]*a+c[11]*m;e[8]=c[4]*-m+c[8]*a;e[9]=c[5]*-m+c[9]*a;e[10]=c[6]*-m+c[10]*a;e[11]=c[7]*-m+c[11]*a;e[12]=c[12];e[13]=c[13];e[14]=c[14];e[15]=c[15];return b};g.prototype.rotateY=function(a,b){b=void 0===b?(new g).setIdentity():b;var c=this.D,e=b.D,m=d(a);a=h(a);e[0]=c[0]*a+c[8]*-m;e[1]=c[1]*a+c[9]*-m;e[2]=c[2]*a+c[10]*-m;e[3]=c[3]*a+c[11]*-m;e[4]=c[4];e[5]=c[5];e[6]=c[6];e[7]=c[7];e[8]=
c[0]*m+c[8]*a;e[9]=c[1]*m+c[9]*a;e[10]=c[2]*m+c[10]*a;e[11]=c[3]*m+c[11]*a;e[12]=c[12];e[13]=c[13];e[14]=c[14];e[15]=c[15];return b};g.prototype.rotateZ=function(a,b){b=void 0===b?(new g).setIdentity():b;var c=this.D,e=b.D,m=d(a);a=h(a);e[0]=c[0]*a+c[4]*m;e[1]=c[1]*a+c[5]*m;e[2]=c[2]*a+c[6]*m;e[3]=c[3]*a+c[7]*m;e[4]=c[0]*-m+c[4]*a;e[5]=c[1]*-m+c[5]*a;e[6]=c[2]*-m+c[6]*a;e[7]=c[3]*-m+c[7]*a;e[8]=c[8];e[9]=c[9];e[10]=c[10];e[11]=c[11];e[12]=c[12];e[13]=c[13];e[14]=c[14];e[15]=c[15];return b};g.prototype.clone=
function(){var a=new g;a.D.set(this.D);return a};b.norm3D=function(a){a instanceof e||(a=new e(a.x,a.y,a.z,a.w));return a.norm3D()};b.normalize3D=function(a){a instanceof e||(a=new e(a.x,a.y,a.z,a.w));return a.normalize3D().clone()};b.dotProduct3D=function(a,b){a instanceof e||(a=new e(a.x,a.y,a.z,a.w));b instanceof e||(b=new e(b.x,b.y,b.z,b.w));return a.dotProduct3D(b)};b.crossProduct3D=function(a,b){a instanceof e||(a=new e(a.x,a.y,a.z,a.w));b instanceof e||(b=new e(b.x,b.y,b.z,b.w));return a.crossProduct3D(b).clone()};
b.scalarProd3D=function(a,b){a instanceof e||(a=new e(a.x,a.y,a.z,a.w));return a.scalarProd3D(b).clone()};b.subtract3D=function(a,b){a instanceof e||(a=new e(a.x,a.y,a.z,a.w));b instanceof e||(b=new e(b.x,b.y,b.z,b.w));return a.subtract3D(b).clone()};b.add3D=function(a,b){a instanceof e||(a=new e(a.x,a.y,a.z,a.w));b instanceof e||(b=new e(b.x,b.y,b.z,b.w));return a.add3D(b).clone()};b.equals3D=function(a,b,c){a instanceof e||(a=new e(a.x,a.y,a.z,a.w));b instanceof e||(b=new e(b.x,b.y,b.z,b.w));return a.equals3D(b,
c)};b.Vec4D=e;b.Mat4=g;return b}(descartesJS||{});
descartesJS=function(b){function a(a){a.textNode=null;0!==parseInt(this.size)&&(a.lineWidth=1,a.fillStyle=this.backColor,a.strokeStyle=this.frontColor,a.beginPath(),a.arc(this.projV[0].x,this.projV[0].y,this.size,0,p),a.fill(),a.stroke())}function d(a,b){a.textNode=null;a.lineCap=a.lineJoin="round";a.lineWidth=.4;a.beginPath();a.moveTo(this.projV[0].x,this.projV[0].y);for(var c=1,d=this.projV.length;c<d;c++)a.lineTo(this.projV[c].x,this.projV[c].y);a.closePath();a.strokeStyle=a.fillStyle;"color"===
this.model?(a.fillStyle=0>this.direction?this.backColor:this.frontColor,a.stroke(),a.fill()):"light"===this.model||"metal"===this.model?(a.fillStyle=b.computeColor(0>this.direction?this.backColor:this.frontColor,this,"metal"===this.model),a.stroke(),a.fill()):"wire"===this.model&&(a.lineWidth=1.25,a.strokeStyle=this.frontColor,a.stroke());this.edges&&"wire"!==this.model&&(a.lineWidth=1,a.strokeStyle=this.edges,a.stroke())}function h(a){a.textNode=null;u=this.evaluator.getVariable(this.family);this.evaluator.setVariable(this.family,
this.fVal);this.fontSize=l(5,this.evaluator.eval(this.font_size));this.font=this.font_style+" "+this.fontSize+"px "+this.font_family;this.drawText(a,this.text,this.projV[0].x,this.projV[0].y,this.frontColor,this.font,"left","alphabetic",this.decimals,this.fixed,!0);this.evaluator.setVariable(this.family,u)}function q(a){a.textNode=null;a.lineCap="butt";a.lineJoin="round";a.lineWidth=this.lineWidth;a.strokeStyle=this.frontColor;a.beginPath();a.moveTo(this.projV[0].x,this.projV[0].y);a.lineTo(this.projV[1].x,
this.projV[1].y);"dot"===this.lineDash?a.setLineDash([a.lineWidth,a.lineWidth]):"dash"===this.lineDash?a.setLineDash([4*a.lineWidth,3*a.lineWidth]):"dash_dot"===this.lineDash?a.setLineDash([4*a.lineWidth,2*a.lineWidth,a.lineWidth,2*a.lineWidth]):(a.lineCap="round",a.setLineDash([]));a.stroke()}function e(a,c,d){return b.normalize3D(b.crossProduct3D(b.subtract3D(a,c),b.subtract3D(a,d)))}if(b.loadLib)return b;var g,p=2*Math.PI,n=Math.abs,c=Math.min,l=Math.max,m,f,w,u,x,r,v,z,y,A=function(b,c){Object.assign(this,
b);g=this;g.space=c;g.projV=[];g.spaceV=[];g.newProjV=[];g.newSpaceV=[];"vertex"===g.type?g.draw=a:"face"===g.type?(g.normal=e(g.V[0],g.V[1],g.V[2]),g.draw=d):"text"===g.type?g.draw=h:"edge"===g.type&&(g.draw=q);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]})};A.prototype.computeDepth=function(a){g=this;g.space=a;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};for(var d=g.V.length,f=
0;f<d;f++)g.spaceV[f]=a.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=a.project(g.avg);g.depth=b.norm3D(b.subtract3D(a.eye,g.avg));2<g.V.length&&(g.normal=e(g.spaceV[0],g.spaceV[1],g.spaceV[2]));d=0;for(f=g.V.length;d<f;d++)g.newSpaceV[d]=g.spaceV[d],g.projV[d]=g.newProjV[d]=a.project(g.spaceV[d]);2<g.V.length&&(g.direction=e(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;d=0;for(f=g.V.length;d<f;d++)r=b.norm3D(b.subtract3D(g.spaceV[d],a.eye)),g.minDistToEye=c(g.minDistToEye,r),g.maxDistToEye=l(g.maxDistToEye,r);a=0;for(d=g.V.length;a<d;a++)g.minX>g.projV[a].x&&(g.minX=g.projV[a].x),g.maxX<g.projV[a].x&&(g.maxX=g.projV[a].x),g.minY>g.projV[a].y&&(g.minY=g.projV[a].y),g.maxY<g.projV[a].y&&(g.maxY=g.projV[a].y)};A.prototype.removeDoubles=function(){g=this;if("edge"!==g.type){x=[];for(var a=0,b=g.V.length;a<
b;a++)(1E-8<n(g.V[a].x-g.V[(a+1)%b].x)||1E-8<n(g.V[a].y-g.V[(a+1)%b].y)||1E-8<n(g.V[a].z-g.V[(a+1)%b].z)||1E-8<n(g.V[a].w-g.V[(a+1)%b].w))&&x.push(g.V[a]);0===x.length&&x.push(g.V[0]);g.V=x}};A.prototype.drawText=function(a,c,d,e,g,l,p,h,q,r,n){m=this.evaluator;a.textNode=c;l=m.eval(this.offset_dist);p=-b.degToRad(m.eval(this.offset_angle));d+=l*Math.cos(p);e+=l*Math.sin(p);a.textNode.pos={x:d,y:e};c.hasContent&&(c.draw(a,g,d,e,!0),w=this.fromPoint?c.textNodes.metrics.w/2:0,f=this.fromPoint?c.textNodes.metrics.h/
2:0,c.draw(a,g,d-w,e-f))};A.prototype.splitFace=function(a){if(this.intersects(a)){var c=null,d=null,e=0,f=0,m,g=this.V,l=a.V;var p=0;for(m=l.length;p<m;p++){var h=this.intersection(l[p],l[(p+1)%m]);if(null!==h)if(null===c){if(c=h,e=p,2===l.length){d=c;break}}else if(!b.equals3D(h,c,1E-8)){d=h;f=p;break}}if(null!==c&&null!==d){p=this.isInterior(c)||this.isInterior(d);var q=m=null;if(!p&&3<=l.length){var r=0;for(g=g.length;r<g;r++)if(h=a.intersection(this.V[r],this.V[(r+1)%g]),null!==h)if(null===m)m=
h;else if(!b.equals3D(h,m,1E-8)){q=h;break}}if(p||null!==m&&null!==q&&a.isInterior(m)&&a.isInterior(q)){q=!0;g=h=null;if(2===l.length)b.equals3D(c,l[0],1E-8)||b.equals3D(c,l[1],1E-8)?q=!1:(h=[],h[0]=l[0],h[1]=c,g=[],g[0]=c,g[1]=l[1]);else for(h=[],g=[],r=k=m=p=0;r<l.length;r++)r<e?h[p++]=l[r]:r==e?(h[p++]=l[r],h[p++]=c,g[m++]=c):r<f?g[m++]=l[r]:r==f?(g[m++]=l[r],g[m++]=d,h[p++]=d):h[p++]=l[r];if(q){c=[];c[0]=new A({V:h,type:"face",frontColor:a.frontColor,backColor:a.backColor,edges:a.edges,model:a.model},
this.space);c[0].removeDoubles();c[0].normal=a.normal;c[1]=new A({V:g,type:"face",frontColor:a.frontColor,backColor:a.backColor,edges:a.edges,model:a.model},this.space);c[1].removeDoubles();c[1].normal=a.normal;if(2<c[0].V.length)return 2<c[1].V.length?c:[c[0]];if(2<c[1].V.length)return[c[1]]}}}}return[a]};A.prototype.intersects=function(a){return this.intersectsPlane(a)&&a.intersectsPlane(this)};A.prototype.intersectsPlane=function(a){var c=this.V;var d=a.V;if(0<c.length){var e=b.dotProduct3D(d[0],
a.normal);var f=b.dotProduct3D(c[0],a.normal);if(1E-8>n(e-f))return!0;for(var m=1,g=c.length;m<g;m++)if(d=b.dotProduct3D(c[m],a.normal),1E-8>n(e-d)||d>e&&f<e||d<e&&f>e)return!0}return!1};A.prototype.intersection=function(a,c){var d=this.V;if(0<d.length){c=b.subtract3D(c,a);var e=b.dotProduct3D(c,this.normal);if(0!==e&&(d=b.dotProduct3D(b.subtract3D(d[0],a),this.normal)/e,-1E-8<d&&1.00000001>d))return b.add3D(a,b.scalarProd3D(c,d))}return null};A.prototype.isInterior=function(a){var c=this.V;if(0<
c.length)for(var d=0,e=b.subtract3D(c[0],a),f=0,m=c.length;f<m;f++){var g=b.subtract3D(c[(f+1)%m],a),l=b.dotProduct3D(b.crossProduct3D(e,g),this.normal);if(1E-8>n(l)){if(0>b.dotProduct3D(e,g))break}else{if(0>d&&0<l||0<d&&0>l)return!1;e=g;d=l}}return!0};A.prototype.inFrontOf=function(a,b,c){if(this.minDistToEye>=b.maxDistToEye||this.maxX<=b.minX||this.minX>=b.maxX||this.maxY<=b.minY||this.minY>=b.maxY)return!1;for(y=0;3>y;y++)if(v=null,v=0===y?this.intersections(b):1===y?b.verticesContainedIn(this):
this.verticesContainedIn(b),null!=v&&0<v.length){for(var d=$jscomp.makeIterator(v),e=d.next();!e.done;e=d.next())a.push(e.value);d=$jscomp.makeIterator(v);for(e=d.next();!e.done;e=d.next()){e=e.value;z=this.space.rayFromEye(e.x,e.y);try{t=this.distanceToEyeAlong(z)-b.distanceToEyeAlong(z);if(t<=-c)return!0;if(t>=c)return!1}catch(H){}}}return!1};A.prototype.intersections=function(a){for(var c=[],d,e,f,m=new b.R2,g=this.newSpaceV,l=a.newSpaceV,p=this.newProjV,h=a.newProjV,q=0,r=g.length;q<r;q++){a=
g[q];d=g[(q+1)%r];for(var n=0,w=l.length;n<w;n++)e=l[n],f=l[(n+1)%w],a!=e&&a!=f&&d!=e&&d!=f&&(e=m.intersection(p[q],p[(q+1)%r],h[n],h[(n+1)%w]),null!=e&&c.push(e))}return c};A.prototype.distanceToEyeAlong=function(a){a=b.dotProduct3D(this.normal,a);if(1E-6<n(a))return b.dotProduct3D(b.subtract3D(this.avg,this.space.eye),this.normal)/a;throw new Exception("Face is invisible");};A.prototype.verticesContainedIn=function(a){for(var b=[],c=this.newSpaceV,d=this.newProjV,e=0,f=c.length;e<f;e++)!a.isVertex(c[e])&&
a.appearsToContain(d[e])&&b.push(d[e]);return b};A.prototype.appearsToContain=function(a){for(var b=0,d,e=this.newProjV,f=0,m=this.newSpaceV.length;f<m;f++){d=(e[f].x-a.x)*(e[(f+1)%m].y-a.y)-(e[(f+1)%m].x-a.x)*(e[f].y-a.y);if(0!=b)if(1E-8>n(d)){if(1E-8<n(e[f].x-e[(f+1)%m].x))return c(e[f].x,e[(f+1)%m].x)<=a.x+1E-8&&a.x<=l(e[f].x,e[(f+1)%m].x)+1E-8;if(1E-8<n(e[f].y-e[(f+1)%m].y))return c(e[f].y,e[(f+1)%m].y)<=a.y+1E-8&&a.y<=l(e[f].y,e[(f+1)%m].y)+1E-8}else if(0<b&&0>d||0>b&&0<d)return!1;b=d}return!0};
A.prototype.isVertex=function(a){for(var c=$jscomp.makeIterator(this.newSpaceV),d=c.next();!d.done;d=c.next())if(b.equals3D(a,d.value,1E-8))return!0;return!1};b.Primitive3D=A;return b}(descartesJS||{});
descartesJS=function(b){function a(a){for(var b=[],c=0,d,e=a.length,m=a.length-1;-1<m;m--)d=a.charAt(m),0==c?"="==d&&(c=1):1==c?" "!=d&&(c="<"===d||">"===d?0:2):2==c&&" "==d&&(b.unshift(a.substring(m+1,e)),e=m,c=0);b.unshift(a.substring(0,e));return b}if(b.loadLib)return b;var d,h=b.degToRad,q,e,g,p,n,c,l=function(a,e){d=this;d.parent=a;d.evaluator=a.evaluator;var f=a.evaluator.parser;d.spaceID="E0";d.background=!1;d.type="";d.color=new b.Color("eeffaa");d.backcolor=new b.Color("6090a0");d.Nu=d.Nv=
d.evaluator.parser.parse("7");d.drawif=f.parse("1");d.abs_coord=!1;d.family="";d.family_interval=f.parse("[0,1]");d.family_steps=f.parse("8");d.font="SansSerif,PLAIN,18";d.fixed=!0;d.text="";d.decimals=f.parse("2");d.inirot=d.endrot="(0,0,0)";d.inirotEuler=d.endrotEuler=!1;d.inipos=d.endpos=f.parse("(0,0,0)");d.model="color";Object.assign(d,e);void 0==d.expresion&&"macro"!==d.type&&(d.expresion=f.parse("(0,0)"));d.space=d.getSpace();d.canvas=d.background?d.space.backCanvas:d.space.canvas;d.ctx=d.canvas.getContext("2d");
d.font_str=d.font;d.font=b.convertFont(d.font);d.fontSize=d.font.match(/([\d\.]+)px/);d.fontSize=d.fontSize?parseFloat(d.fontSize[1]):10;d.font_style=b.getFontStyle(d.font_str.split(",")[1]);if("boolean"===typeof d.bold||"boolean"===typeof d.italics)d.font_style=(d.italics?"Italic ":"")+(d.bold?"Bold ":"");d.font_family||(d.font_family=d.font_str.split(",")[0]);d.font_family=b.getFontName(d.font_family);"undefined"===typeof d.font_size&&(d.font_size=a.evaluator.parser.parse(d.fontSize.toString()));
d.inirot.includes("Euler")&&(d.inirot=d.inirot.replace("Euler",""),d.inirotEuler=!0);d.endrot.includes("Euler")&&(d.endrot=d.endrot.replace("Euler",""),d.endrotEuler=!0);d.inirot=f.parse(d.inirot);d.endrot=f.parse(d.endrot);d.inirotM=new b.Mat4;d.inirotM_X=new b.Mat4;d.inirotM_Y=new b.Mat4;d.inirotM_Z=new b.Mat4;d.iniposM=new b.Mat4;d.endrotM=new b.Mat4;d.endrotM_X=new b.Mat4;d.endrotM_Y=new b.Mat4;d.endrotM_Z=new b.Mat4;d.endposM=new b.Mat4;c=new b.Mat4};l.prototype.getSpace=function(){var a=this;
return this.parent.spaces.find(function(b){return b.id===a.spaceID})||this.parent.spaces[0]};l.prototype.getFamilyValues=function(){d=this;q=d.evaluator;var a=$jscomp.makeIterator(q.eval(d.family_interval)[0]);d.fInf=a.next().value;d.fSup=a.next().value;d.fSteps=Math.round(q.eval(d.family_steps));d.fSep=0<d.fSteps?(d.fSup-d.fInf)/d.fSteps:0};l.prototype.buildFamilyPrimitives=function(){d=this;q=d.evaluator;d.getFamilyValues();e=q.getVariable(d.family);if(0<=d.fSteps)for(var a=0,b=d.fSteps;a<=b;a++)d.fVal=
d.fInf+a*d.fSep,q.setVariable(d.family,d.fVal),q.eval(d.drawif)&&d.buildPrimitives();q.setVariable(d.family,e)};l.prototype.update=function(){d=this;d.primitives=[];d.evaluator.eval(d.drawif)&&(d.family||d.buildPrimitives());d.family&&d.buildFamilyPrimitives()};l.prototype.updateMVMatrix=function(){d=this;g=d.evaluator.eval(d.inirot)[0];d.inirotEuler?(d.inirotM.setIdentity(),d.inirotM=d.inirotM.rotateZ(h(g[0])),d.inirotM=d.inirotM.rotateX(h(g[1])),d.inirotM=d.inirotM.rotateZ(h(g[2]))):(c.setIdentity(),
c.rotateX(h(g[0]),d.inirotM_X),c.rotateY(h(g[1]),d.inirotM_Y),c.rotateZ(h(g[2]),d.inirotM_Z));g=d.evaluator.eval(d.inipos)[0];d.iniposM=d.iniposM.setIdentity().translate({x:g[0],y:g[1],z:g[2]});g=d.evaluator.eval(d.endrot)[0];d.endrotEuler?(d.endrotM.setIdentity(),d.endrotM=d.endrotM.rotateZ(h(g[0])),d.endrotM=d.endrotM.rotateX(h(g[1])),d.endrotM=d.endrotM.rotateZ(h(g[2]))):(c.setIdentity(),c.rotateX(h(g[0]),d.endrotM_X),c.rotateY(h(g[1]),d.endrotM_Y),c.rotateZ(h(g[2]),d.endrotM_Z));g=d.evaluator.eval(d.endpos)[0];
d.endposM=d.endposM.setIdentity().translate({x:g[0],y:g[1],z:g[2]})};l.prototype.transformVertex=function(a){d=this;p=d.inirotEuler?d.inirotM.mulV4(a):d.inirotM_Z.mulV4(d.inirotM_Y.mulV4(d.inirotM_X.mulV4(a)));p=d.iniposM.mulV4(p);p=d.endrotEuler?d.endrotM.mulV4(p):d.endrotM_Z.mulV4(d.endrotM_Y.mulV4(d.endrotM_X.mulV4(p)));p=d.endposM.mulV4(p);d.macroChildren&&(p=d.applyMacroTransform(p));return p};l.prototype.applyMacroTransform=function(a){d=this;p=d.macro_inirotEuler?d.macro_inirotM.mulV4(a):d.macro_inirotM_Z.mulV4(d.macro_inirotM_Y.mulV4(d.macro_inirotM_X.mulV4(a)));
p=d.macro_iniposM.mulV4(p);p=d.macro_endrotEuler?d.macro_endrotM.mulV4(p):d.macro_endrotM_Z.mulV4(d.macro_endrotM_Y.mulV4(d.macro_endrotM_X.mulV4(p)));return p=d.macro_endposM.mulV4(p)};l.prototype.parseExpression=function(){for(var b=[],c=$jscomp.makeIterator(this.expresion.split(";")),d=c.next();!d.done;d=c.next())d=d.value,""!==d.trim()&&b.push.apply(b,$jscomp.arrayFromIterable(a(d)));c=0;for(d=b.length;c<d;c++)b[c]=this.evaluator.parser.parse(b[c],!0);return b};l.prototype.splitFace=function(a){for(var b=
$jscomp.makeIterator(this.primitives),c=b.next();!c.done;c=b.next())if(c=c.value,n=[],"face"===c.type){for(var d=$jscomp.makeIterator(a.primitives),e=d.next();!e.done;e=d.next())e=e.value,"face"===e.type?n.push.apply(n,$jscomp.arrayFromIterable(c.splitFace(e))):n.push(e);a.primitives=n}};b.Graphic3D=l;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,d,h,q,e,g,p=function(a,c){return b.Graphic3D.call(this,a,c)||this};$jscomp.inherits(p,b.Graphic3D);p.prototype.buildPrimitives=function(){a=this;d=a.evaluator;a.updateMVMatrix();h=d.eval(a.expresion)[0];q=h[0];e=h[1];g=h[2];a.primitives.push(new b.Primitive3D({V:[a.transformVertex(new b.Vec4D(q,e,g))],type:"vertex",backColor:a.backcolor.getColor(),frontColor:a.color.getColor(),size:d.eval(a.width)}));""!==a.text&&(a.offset_dist=a.offset_dist||d.parser.parse("10"),
a.offset_angle=a.offset_angle||d.parser.parse("270"),a.primitives.push(new b.Primitive3D({V:[a.transformVertex(new b.Vec4D(q,e,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:d.eval(a.decimals),fixed:a.fixed,evaluator:d,text:new b.TextObject(a,a.text),family:a.family,familyValue:a.fVal,offset_dist:a.offset_dist,offset_angle:a.offset_angle},a.space)))};b.Point3D=p;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,d,h,q,e=function(a,d){d=b.Graphic3D.call(this,a,d)||this;d.width=d.width||a.evaluator.parser.parse("1");return d};$jscomp.inherits(e,b.Graphic3D);e.prototype.buildPrimitives=function(){a=this;h=a.evaluator;a.updateMVMatrix();d=h.getVariable("u");h.setVariable("u",a.Nu);q=h.eval(a.expresion);a.primitives.push(new b.Primitive3D({V:[a.transformVertex(new b.Vec4D(q[0][0],q[0][1],q[0][2])),a.transformVertex(new b.Vec4D(q[1][0],q[1][1],q[1][2]))],type:"edge",
lineDash:a.lineDash,frontColor:a.color.getColor(),lineWidth:h.eval(a.width)},a.space));h.setVariable("u",d)};b.Segment3D=e;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,d,h,q,e,g,p,n,c,l,m,f=function(c,d){a=d=b.Graphic3D.call(this,c,d)||this;a.param=a.param||"t";a.parameter_interval=a.parameter_interval||c.evaluator.parser.parse("[0,1]");a.parameter_steps=a.parameter_steps||c.evaluator.parser.parse("8");a.expresion=a.parseExpression();return d};$jscomp.inherits(f,b.Graphic3D);f.prototype.buildPrimitives=function(){a=this;d=a.evaluator;a.updateMVMatrix();e=d.getVariable("x");g=d.getVariable("y");p=d.getVariable("z");
h=d.getVariable("u");q=d.getVariable("v");d.setVariable("u",0);d.setVariable("v",0);n=parseInt(d.eval(a.Nu));c=parseInt(d.eval(a.Nv));l=[];for(var f=0;f<=n;f++){d.setVariable("u",f/n);for(var u=0;u<=c;u++){d.setVariable("v",u/c);for(var x=$jscomp.makeIterator(a.expresion),r=x.next();!r.done;r=x.next())d.eval(r.value);l.push(a.transformVertex(new b.Vec4D(d.getVariable("x"),d.getVariable("y"),d.getVariable("z"))))}}f=a.color.getColor();u=a.backcolor.getColor();x=a.edges?a.edges.getColor():"";for(r=
0;r<n;r++)for(var v=0;v<c;v++)m=[],m.push(l[v+r*c+r]),m.push(l[v+1+r*c+r]),m.push(l[v+2+(r+1)*c+r]),m.push(l[v+1+(r+1)*c+r]),a.primitives.push(new b.Primitive3D({V:m,type:"face",frontColor:f,backColor:u,edges:x,model:a.model},a.space));d.setVariable("x",e);d.setVariable("y",g);d.setVariable("z",p);d.setVariable("u",h);d.setVariable("v",q)};b.Surface3D=f;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,d,h,q,e=function(a,d){d=b.Graphic3D.call(this,a,d)||this;d.width=d.width||a.evaluator.parser.parse("1");return d};$jscomp.inherits(e,b.Graphic3D);e.prototype.buildPrimitives=function(){a=this;d=a.evaluator;a.updateMVMatrix();h=d.eval(a.expresion);q=a.color.getColor();for(var e=0,p=h.length-1;e<p;e++)a.primitives.push(new b.Primitive3D({V:[a.transformVertex(new b.Vec4D(h[e][0],h[e][1],h[e][2])),a.transformVertex(new b.Vec4D(h[e+1][0],h[e+1][1],h[e+
1][2]))],type:"edge",frontColor:q,lineWidth:d.eval(a.width)},a.space))};b.Polygon3D=e;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,d,h,q,e,g,p,n,c=function(c,d){a=d=b.Graphic3D.call(this,c,d)||this;a.width=a.width||c.evaluator.parser.parse("1");a.expresion=a.parseExpression();return d};$jscomp.inherits(c,b.Graphic3D);c.prototype.buildPrimitives=function(){a=this;n=a.evaluator;a.updateMVMatrix();e=n.getVariable("x");g=n.getVariable("y");p=n.getVariable("z");q=n.getVariable("u");n.setVariable("u",0);h=n.eval(a.Nu);d=[];for(var c=0;c<=h;c++){n.setVariable("u",c/h);for(var m=$jscomp.makeIterator(a.expresion),
f=m.next();!f.done;f=m.next())n.eval(f.value);d.push(a.transformVertex(new b.Vec4D(n.getVariable("x"),n.getVariable("y"),n.getVariable("z"))))}c=0;for(m=d.length-1;c<m;c++)a.primitives.push(new b.Primitive3D({V:[d[c],d[c+1]],type:"edge",frontColor:a.color.getColor(),lineWidth:n.eval(a.width)},a.space));a.fill&&2<d.length&&a.primitives.push(new b.Primitive3D({V:d,type:"face",frontColor:a.fill.getColor(),backColor:a.fill.getColor(),edges:"",model:a.model},a.space));n.setVariable("x",e);n.setVariable("y",
g);n.setVariable("z",p);n.setVariable("u",q)};b.Curve3D=c;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,d,h,q=function(a,d){return b.Graphic3D.call(this,a,d)||this};$jscomp.inherits(q,b.Graphic3D);q.prototype.buildPrimitives=function(){a=this;d=a.evaluator;a.updateMVMatrix();h=d.eval(a.expresion);a.primitives.push(new b.Primitive3D({V:[a.transformVertex(new b.Vec4D(h[0][0],h[0][1],h[0][2])),a.transformVertex(new b.Vec4D(h[2][0],h[2][1],h[2][2])),a.transformVertex(new b.Vec4D(h[1][0],h[1][1],h[1][2]))],type:"face",frontColor:a.color.getColor(),backColor:a.backcolor.getColor(),
edges:a.edges?a.edges.getColor():"",model:a.model},a.space))};b.Triangle3D=q;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,d,h,q,e=function(a,d){return b.Graphic3D.call(this,a,d)||this};$jscomp.inherits(e,b.Graphic3D);e.prototype.buildPrimitives=function(){a=this;h=a.evaluator;a.updateMVMatrix();q=h.eval(a.expresion);d=[];for(var e=q.length-1;0<=e;e--)d.push(a.transformVertex(new b.Vec4D(q[e][0],q[e][1],q[e][2])));a.primitives.push(new b.Primitive3D({V:d,type:"face",frontColor:a.color.getColor(),backColor:a.backcolor.getColor(),edges:a.edges?a.edges.getColor():"",model:a.model},
a.space))};b.Face3D=e;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,d,h,q,e,g,p,n=function(c,d){a=d=b.Graphic3D.call(this,c,d)||this;a.width=a.width||c.evaluator.parser.parse("2");a.length=a.length||c.evaluator.parser.parse("2");return d};$jscomp.inherits(n,b.Graphic3D);n.prototype.buildPrimitives=function(){a=this;p=a.evaluator;a.updateMVMatrix();d=p.eval(a.Nu);h=[a.transformVertex(new b.Vec4D)];q=p.eval(a.width)/2;e=p.eval(a.length)/2;g=2*Math.PI/d;for(var c=0;c<d;c++)h.push(a.transformVertex(new b.Vec4D(q*Math.cos(g*
c),e*Math.sin(g*c),0)));c=a.color.getColor();for(var l=a.backcolor.getColor(),m=a.edges?a.edges.getColor():"",f=0;f<d;f++)a.primitives.push(new b.Primitive3D({V:[h[0],f+2<=d?h[f+2]:h[1],h[f+1]],type:"face",frontColor:c,backColor:l,edges:m,model:a.model},a.space))};b.Polireg3D=n;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,d,h,q=function(a,d){a=b.Graphic3D.call(this,a,d)||this;a.shadowColor=a.shadowColor?a.shadowColor.getColor():"transparent";return a};$jscomp.inherits(q,b.Graphic3D);q.prototype.buildPrimitives=function(){a=this;d=a.evaluator;h=d.eval(a.expresion)[0];a.primitives.push(new b.Primitive3D({V:[new b.Vec4D(h[0],h[1],0)],type:"text",frontColor:a.color.getColor(),font_size:a.font_size,font_style:a.font_style,font_family:a.font_family,decimals:d.eval(a.decimals),
fixed:a.fixed,displace:0,isText:!0,evaluator:d,text:new b.TextObject(a,a.text),family:a.family,familyValue:a.fVal},a.space))};b.Text3D=q;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,d,h,q,e=b.degToRad,g=0,p=function(d,c){var e;a=e=b.BaseMacro.call(this,d,c,"parse3DGraphic","-point-segment-polygon-curve-triangle-face-polireg-surface-text-cube-box-tetrahedron-octahedron-sphere-dodecahedron-icosahedron-ellipsoid-cone-cylinder-torus-mesh-macro-")||this;a.inirot=a.inirot||"(0,0,0)";a.inirotEuler=a.inirotEuler||!1;a.inipos=a.inipos||d.evaluator.parser.parse("(0,0,0)");a.endrot=a.endrot||"(0,0,0)";a.endrotEuler=a.endrotEuler||!1;a.endpos=
a.endpos||d.evaluator.parser.parse("(0,0,0)");a.name=a.name||"_M_"+g++;Object.assign(a,c);"string"===typeof a.inirot&&a.inirot.includes("Euler")&&(a.inirot=a.inirot.replace("Euler",""),a.inirotEuler=!0);"string"===typeof a.endrot&&a.endrot.includes("Euler")&&(a.endrot=a.endrot.replace("Euler",""),a.endrotEuler=!0);a.inirot=a.evaluator.parser.parse(a.inirot);a.endrot=a.evaluator.parser.parse(a.endrot);a.inirotM=new b.Mat4;a.inirotM_X=new b.Mat4;a.inirotM_Y=new b.Mat4;a.inirotM_Z=new b.Mat4;a.iniposM=
new b.Mat4;a.endrotM=new b.Mat4;a.endrotM_X=new b.Mat4;a.endrotM_Y=new b.Mat4;a.endrotM_Z=new b.Mat4;a.endposM=new b.Mat4;h=new b.Mat4;d=$jscomp.makeIterator(a.graphics);for(c=d.next();!c.done;c=d.next())c.value.macroChildren=!0;return e};$jscomp.inherits(p,b.BaseMacro);p.prototype.buildFamilyPrimitives=function(){a=this;d=a.evaluator;a.getFamilyValues();var b=d.getVariable(a.family);if(0<=a.fSteps)for(var c=0,e=a.fSteps;c<=e;c++)a.fVal=a.fInf+c*a.fSep,d.setVariable(a.family,a.fVal),d.eval(a.drawif)&&
a.updateMacro();d.setVariable(a.family,b)};p.prototype.update=function(){a=this;a.primitives=[];a.evaluator.eval(a.drawif)&&(a.family||a.updateMacro());a.family&&a.buildFamilyPrimitives()};p.prototype.updateMacro=function(){a=this;a.updateTransformation();if(a.inipos){var b=a.evaluator.eval(a.inipos)[0];a.iniPosX=b[0];a.iniPosY=b[1]}b=$jscomp.makeIterator(a.graphics);for(var c=b.next();!c.done;c=b.next())c=c.value,c.macro_inirotEuler=a.inirotEuler,c.macro_inirotM=a.inirotM,c.macro_inirotM_X=a.inirotM_X,
c.macro_inirotM_Y=a.inirotM_Y,c.macro_inirotM_Z=a.inirotM_Z,c.macro_iniposM=a.iniposM,c.macro_endrotEuler=a.endrotEuler,c.macro_endrotM=a.endrotM,c.macro_endrotM_X=a.endrotM_X,c.macro_endrotM_Y=a.endrotM_Y,c.macro_endrotM_Z=a.endrotM_Z,c.macro_endposM=a.endposM,c.update();b=0;for(c=a.graphics.length;b<c;b++){var d=a.graphics[b];if(d.split||a.split)for(var e=b+1;e<c;e++){var f=a.graphics[e];(f.split||a.split)&&d.splitFace(f)}a.primitives=a.primitives.concat(d.primitives||[])}};p.prototype.updateTransformation=
function(){a=this;q=a.evaluator.eval(a.inirot)[0];a.inirotEuler?(a.inirotM.setIdentity(),a.inirotM=a.inirotM.rotateZ(e(q[0])),a.inirotM=a.inirotM.rotateX(e(q[1])),a.inirotM=a.inirotM.rotateZ(e(q[2]))):(h.setIdentity(),h.rotateX(e(q[0]),a.inirotM_X),h.rotateY(e(q[1]),a.inirotM_Y),h.rotateZ(e(q[2]),a.inirotM_Z));q=a.evaluator.eval(a.inipos)[0];a.iniposM=a.iniposM.setIdentity().translate({x:q[0],y:q[1],z:q[2]});q=a.evaluator.eval(a.endrot)[0];a.endrotEuler?(a.endrotM.setIdentity(),a.endrotM=a.endrotM.rotateZ(e(q[0])),
a.endrotM=a.endrotM.rotateX(e(q[1])),a.endrotM=a.endrotM.rotateZ(e(q[2]))):(h.setIdentity(),h.rotateX(e(q[0]),a.endrotM_X),h.rotateY(e(q[1]),a.endrotM_Y),h.rotateZ(e(q[2]),a.endrotM_Z));q=a.evaluator.eval(a.endpos)[0];a.endposM=a.endposM.setIdentity().translate({x:q[0],y:q[1],z:q[2]})};p.prototype.drawAux=function(a){};b.Macro3D=p;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,d=Math.PI,h=2*d,q=Math.sqrt(3),e=Math.sin,g=Math.cos,p,n,c,l,m,f,w,u,x,r,v,z,y=function(c,d){a=d=b.Graphic3D.call(this,c,d)||this;a.width=a.width||c.evaluator.parser.parse("2");a.height=a.height||c.evaluator.parser.parse("2");a.length=a.length||c.evaluator.parser.parse("2");a.R=a.R||c.evaluator.parser.parse("2");a.r=a.r||c.evaluator.parser.parse("1");p=b.Vec4D;return d};$jscomp.inherits(y,b.Graphic3D);y.prototype.buildPrimitives=function(){a=this;
n=a.evaluator;a.updateMVMatrix();a.buildGeometry(n.eval(a.width),n.eval(a.height),n.eval(a.length),n.eval(a.Nu),n.eval(a.Nv));for(var d=a.color.getColor(),e=a.backcolor.getColor(),f=a.edges?a.edges.getColor():"",m=$jscomp.makeIterator(a.faces),g=m.next();!g.done;g=m.next()){g=g.value;c=[];g=$jscomp.makeIterator(g);for(var l=g.next();!l.done;l=g.next())c.push(a.transformVertex(a.V[l.value]));a.primitives.push(new b.Primitive3D({V:c,type:"face",frontColor:d,backColor:e,edges:f,model:a.model},a.space))}};
y.prototype.changeGeometry=function(a,b,c,d,e){return this.oldW===a&&this.oldH===b&&this.oldL===c&&this.oldNu===d&&this.oldNv===e};y.prototype.updateValues=function(a,b,c,d,e){this.oldW=a;this.oldH=b;this.oldL=c;this.oldNv=e;this.oldNu=d};var A=function(a,b){a=y.call(this,a,b)||this;a.faces=[[2,3,1,0],[1,5,4,0],[5,7,6,4],[6,7,3,2],[4,6,2,0],[3,7,5,1]];return a};$jscomp.inherits(A,y);A.prototype.buildGeometry=function(a,b,c,d,e){a/=2;b/=2;c/=2;this.changeGeometry(a,b,c,d,e)||(this.V=[new p(a,c,b),
new p(a,-c,b),new p(a,c,-b),new p(a,-c,-b),new p(-a,c,b),new p(-a,-c,b),new p(-a,c,-b),new p(-a,-c,-b)],this.updateValues(a,b,c,d,e))};var B=function(a,b){return A.call(this,a,b)||this};$jscomp.inherits(B,A);B.prototype.buildGeometry=function(a,b,c,d,e){b=a/q;A.prototype.buildGeometry.call(this,b,b,b,d,e)};var E=function(a,b){a=y.call(this,a,b)||this;a.faces=[[1,3,2],[0,1,2],[0,2,3],[0,3,1]];return a};$jscomp.inherits(E,y);E.prototype.buildGeometry=function(a,b,c,d,e){a/=2;if(!this.changeGeometry(a,
b,c,d,e)){var f=h/3,m=Math.cos(f),g=Math.sin(f);f=2*a*Math.sqrt(2)/3;var l=-a/3,q=f*m+0*g;m=-f*g+0*m;this.V=[new p(0,0,a),new p(q,m,l),new p(q,-m,l),new p(f,0,l)];this.updateValues(a,b,c,d,e)}};var I=function(a,b){a=y.call(this,a,b)||this;a.faces=[[3,1,0],[2,3,0],[1,4,0],[4,2,0],[1,3,5],[3,2,5],[4,1,5],[2,4,5]];return a};$jscomp.inherits(I,y);I.prototype.buildGeometry=function(a,b,c,d,e){a/=2;this.changeGeometry(a,b,c,d,e)||(this.V=[new p(0,0,a),new p(a,0,0),new p(-a,0,0),new p(0,a,0),new p(0,-a,
0),new p(0,0,-a)],this.updateValues(a,b,c,d,e))};var D=function(a,b){return y.call(this,a,b)||this};$jscomp.inherits(D,y);D.prototype.buildGeometry=function(a,b,c,f,q){a/=2;b/=2;c/=2;if(!this.changeGeometry(a,b,c,f,q)){this.V=[new p(0,0,b)];for(var r=1;r<f;r++){m=r*d/f;for(var n=0;n<q;n++)l=n*h/q,this.V.push(new p(a*e(m)*g(l),c*e(m)*e(l),b*g(m)))}this.V.push(new p(0,0,-b));this.faces=[];for(r=0;r<q;r++)this.faces.push([0,(r+1)%q+1,r%q+1]);for(r=1;r<f-1;r++)for(n=0;n<q;n++)this.faces.push([n+1+(r-
1)*q,(n+1)%q+1+(r-1)*q,(n+1)%q+1+r*q,n+1+r*q]);for(r=0;r<q;r++)this.faces.push([this.V.length-1,this.V.length-1-q+r,this.V.length-1-q+(r+1)%q]);this.updateValues(a,b,c,f,q)}};var G=function(a,b){return D.call(this,a,b)||this};$jscomp.inherits(G,D);G.prototype.buildGeometry=function(a,b,c,d,e){D.prototype.buildGeometry.call(this,a,a,a,d,e)};var H=function(a,b){a=y.call(this,a,b)||this;a.faces=[[0,16,2,10,8],[12,1,17,16,0],[8,4,14,12,0],[2,16,17,3,13],[13,15,6,10,2],[6,18,4,8,10],[3,17,1,9,11],[13,
3,11,7,15],[1,12,14,5,9],[11,9,5,19,7],[5,14,4,18,19],[6,15,7,19,18]];return a};$jscomp.inherits(H,y);H.prototype.buildGeometry=function(a,c,e,f,m){a/=Math.PI;if(!this.changeGeometry(a,c,e,f,m)){u=a/1.6180339887;x=1.6180339887*a;this.V=[new p(a,a,a),new p(a,a,-a),new p(a,-a,a),new p(a,-a,-a),new p(-a,a,a),new p(-a,a,-a),new p(-a,-a,a),new p(-a,-a,-a),new p(0,u,x),new p(0,u,-x),new p(0,-u,x),new p(0,-u,-x),new p(u,x,0),new p(u,-x,0),new p(-u,x,0),new p(-u,-x,0),new p(x,0,u),new p(x,0,-u),new p(-x,
0,u),new p(-x,0,-u)];r=(new b.Mat4).setIdentity().rotateY(-d/6);for(var g=0,l=this.V.length;g<l;g++)this.V[g]=r.mulV4(this.V[g]);this.updateValues(a,c,e,f,m)}};var C=function(a,b){a=y.call(this,a,b)||this;a.faces=[[10,0,2],[0,8,2],[8,5,2],[5,7,2],[7,10,2],[6,0,10],[11,6,10],[7,11,10],[7,3,11],[5,3,7],[9,3,5],[8,9,5],[4,9,8],[0,4,8],[6,4,0],[11,3,1],[6,11,1],[4,6,1],[9,4,1],[3,9,1]];return a};$jscomp.inherits(C,y);C.prototype.buildGeometry=function(a,c,d,e,f){a/=3.8;if(!this.changeGeometry(a,c,d,e,
f)){x=1.6180339887*a;this.V=[new p(0,a,x),new p(0,a,-x),new p(0,-a,x),new p(0,-a,-x),new p(a,x,0),new p(a,-x,0),new p(-a,x,0),new p(-a,-x,0),new p(x,0,a),new p(x,0,-a),new p(-x,0,a),new p(-x,0,-a)];r=(new b.Mat4).setIdentity().rotateY(-1.0285);for(var m=0,g=this.V.length;m<g;m++)this.V[m]=r.mulV4(this.V[m]);this.updateValues(a,c,d,e,f)}};var J=function(a,b){return y.call(this,a,b)||this};$jscomp.inherits(J,y);J.prototype.buildGeometry=function(a,b,c,d,f){a/=2;b/=2;c/=2;if(!this.changeGeometry(a,b,
c,d,f)){this.V=[];for(var m=0;m<f;m++)for(var l=0;l<d;l++)this.V.push(new p(a*(f-m)/f*g(l*h/d),c*(f-m)/f*e(l*h/d),b-2*m*b/f));this.V.push(new p(0,0,-b));this.faces=[];for(m=0;m<f-1;m++)for(l=0;l<d;l++)this.faces.push([l+m*d,(l+1)%d+m*d,(l+1)%d+(m+1)*d,l+(m+1)*d]);for(m=0;m<d;m++)this.faces.push([this.V.length-1,this.V.length-1-d+m,this.V.length-1-d+(m+1)%d]);this.updateValues(a,b,c,d,f)}};var O=function(a,b){return y.call(this,a,b)||this};$jscomp.inherits(O,y);O.prototype.buildGeometry=function(a,
b,c,d,f){a/=2;b/=2;c/=2;if(!this.changeGeometry(a,b,c,d,f)){this.V=[];for(var m=0;m<f+1;m++)for(var l=0;l<d;l++)this.V.push(new p(a*g(l*h/d),c*e(l*h/d),b-2*m*b/f));this.faces=[];for(m=0;m<f;m++)for(l=0;l<d;l++)this.faces.push([l+m*d,(l+1)%d+m*d,(l+1)%d+(m+1)*d,l+(m+1)*d]);this.updateValues(a,b,c,d,f)}};var Q=function(a,b){return y.call(this,a,b)||this};$jscomp.inherits(Q,y);Q.prototype.buildGeometry=function(a,b,c,d,m){a/=2;b/=2;c/=2;f=n.eval(this.R);w=n.eval(this.r);if(!this.changeGeometry(a,b,c,
d,m)){this.V=[];for(var l=0;l<m+1;l++)for(var q=0;q<d;q++)this.V.push(new p(-(f+w*e(h*q/d))*e(h*l/m),(f+w*e(h*q/d))*g(h*l/m),w*g(h*q/d)));this.faces=[];for(l=0;l<m;l++)for(q=0;q<d;q++)this.faces.push([q+l*d,q+(l+1)*d,(q+1)%d+(l+1)*d,(q+1)%d+l*d]);this.updateValues(a,b,c,d,m)}};var M=function(c,d){c=y.call(this,c,d)||this;a.fileData=b.openFile(a.evaluator.eval(a.file)).split(/\r/);return c};$jscomp.inherits(M,y);M.prototype.buildGeometry=function(){this.V=[];this.faces=[];for(var a=0,b=this.fileData.length;a<
b;a++)v=this.fileData[a],v.startsWith("V")?(z=v.slice(2,-1).split(",").map(parseFloat),this.V.push(new p(z[0]||0,z[1]||0,z[2]||0))):v.startsWith("F")&&(z=v.slice(2,-1).split(",").map(parseInt),this.faces.push(z.reverse()))};b.OtherGeometry3D=y;b.Cube3D=B;b.Box3D=A;b.Tetrahedron3D=E;b.Octahedron3D=I;b.Sphere3D=G;b.Ellipsoid3D=D;b.Dodecahedron3D=H;b.Icosahedron3D=C;b.Cone3D=J;b.Cylinder3D=O;b.Torus3D=Q;b.Mesh3D=M;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=Math.max,d=Math.min,h=Math.PI,q=Math.cos,e=Math.sin,g=Math.abs,p=Math.round,n,c,l,m,f,w,u,x,r,v,z,y,A,B,E,I,D,G,H=function(a,b){this.x=void 0===a?0:a;this.y=void 0===b?0:b};H.prototype.set=function(a,b){this.x=void 0===a?0:a;this.y=void 0===b?0:b;return this};H.prototype.copy=function(){return new H(this.x,this.y)};H.prototype.ix=function(){return p(a(d(this.x,32E3),-32E3))};H.prototype.iy=function(){return p(a(d(this.y,32E3),-32E3))};H.prototype.equals=
function(a){return this.x===a.x&&this.y===a.y};H.prototype.norm2=function(){return this.x*this.x+this.y*this.y};H.prototype.norm=function(){return Math.sqrt(this.norm2())};H.prototype.distance=function(a){c=this.copy();c.sub(a);return c.norm()};H.prototype.dot=function(a){return this.x*a.x+this.y*a.y};H.prototype.det=function(a){return this.x*a.y-this.y*a.x};H.prototype.mul=function(a){this.x*=a;this.y*=a};H.prototype.div=function(a){this.x/=a;this.y/=a};H.prototype.add=function(a){this.x+=a.x;this.y+=
a.y};H.prototype.sub=function(a){this.x-=a.x;this.y-=a.y};H.prototype.normalize=function(){n=this.norm();0!=n&&this.div(n)};H.prototype.rotR90=function(){n=this.x;this.x=this.y;this.y=-n};H.prototype.rotL90=function(){n=this.x;this.x=-this.y;this.y=n};H.prototype.rot=function(a){l=this.copy();w=q(a);u=e(a);this.x=l.x*w-l.y*u;this.y=l.x*u+l.y*w};H.prototype.rot2=function(a){this.rot(a*h/180)};H.prototype.intersection=function(b,c,e,l){x=c.x-b.x;r=e.x-l.x;v=e.x-b.x;z=c.y-b.y;y=e.y-l.y;A=e.y-b.y;G=x*
y-r*z;return 1E-6<g(G)?(m=(v*y-A*r)/G,f=(-v*z+A*x)/G,0<=m&&1>=m&&0<=f&&1>=f?new H(b.x+x*m,b.y+z*m):null):(c.x-e.x)*A!=(c.y-e.y)*v?null:b.x!=c.x?(B=d(b.x,c.x),E=a(b.x,c.x),B<=e.x&&e.x<=E?e:B<=l.x&&l.x<=E?l:null):e.x!=l.x?(I=d(e.x,l.x),D=a(e.x,l.x),I<=b.x&&b.x<=D?b:I<=c.x&&c.x<=D?c:null):b.y!=c.y?(B=d(b.y,c.y),E=a(b.y,c.y),B<=e.y&&e.y<=E?e:B<=l.y&&l.y<=E?l:null):e.y!=l.y?(I=d(e.y,l.y),D=a(e.y,l.y),I<=b.y&&b.y<=D?b:I<=c.y&&c.y<=D?c:null):b.x==e.x&&b.y==e.y?b:null};b.R2=H;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,d,h,q,e,g,p,n,c,l=function(a,d){this.evaluator=a;this.constraint=d;/==|<|>|<=|>=/.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);e=new b.R2(0,0);c=new b.R2(0,0)};l.prototype.getUnitNormal=function(){this.normal.normalize();return c.set(this.normal.x,this.normal.y)};
l.prototype.gradient=function(b){a=this.evaluator;g.x=0;g.y=0;p=a.getVariable("x");n=a.getVariable("y");a.setVariable("x",b.x);a.setVariable("y",b.y);this.f0=a.eval(this.constraint);a.setVariable("x",a.getVariable("x")+1E-6);d=a.eval(this.constraint);g.x=(d-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);d=a.eval(this.constraint);g.y=(d-this.f0)/1E-6;g.y=isNaN(g.y)?Infinity:g.y;a.setVariable("x",p);a.setVariable("y",n);
return g};l.prototype.findZero=function(b,c,d){a=this.evaluator;e.x=b.x;e.y=b.y;p=a.getVariable("x");n=a.getVariable("y");a.setVariable("x",b.x);a.setVariable("y",b.y);this.f0=a.eval(this.constraint);if("<"==this.sign&&0>=this.f0||">"==this.sign&&0<=this.f0)return e;a.setVariable("x",p);a.setVariable("y",n);for(var f=0;16>f;f++)if(h=e.x,q=e.y,this.normal=this.gradient(e),0!=this.normal.norm2()&&this.normal.mul(-this.f0/this.normal.norm2()),e.x=h+this.normal.x,e.y=q+this.normal.y,this.normal.norm()<
c)return 0===this.normal.x&&0===this.normal.y&&(this.normal.x=e.x-b.x,this.normal.y=e.y-b.y),e;return d?e:null};b.R2Newton=l;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=function(a,b){this.x=a;this.y=b};a.prototype.vLength=function(){return Math.sqrt(this.x*this.x+this.y*this.y)};a.prototype.dotProduct=function(a){return this.x*a.x+this.y*a.y};a.prototype.angleBetweenVectors=function(a){return Math.acos(this.dotProduct(a)/(this.vLength()*a.vLength()))};a.AXIS_X=new a(1,0);a.AXIS_Y=new a(0,1);b.Vector2D=a;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,d=Math.round,h=Math.floor,q,e,g,p,n,c,l,m,f,w,u,x=function(c,e){a=this;a.parent=c;a.evaluator=c.evaluator;var f=a.parser=c.evaluator.parser;a.id="GraphicControl"!==e.type?"C":"G";a.region="south";a.x=a.y=0;a.w="Video"!==e.type?100:350;a.h="Video"!==e.type?23:120;a.keyboard=!1;a.kblayout="1x16";"GraphicControl"!==e.type&&"Audio"!==e.type&&"Video"!==e.type?"TextArea"!==e.type?a.expresion=f.parse("(0,0,100,23)"):(a.expresion=f.parse("(0,0,300,200)"),
a.w=300,a.h=200):a.expresion=f.parse("(0,0)");a.fixed=a.visible=!0;a.color=new b.Color("Scrollbar"==e.gui?"e0e4e8":"222222");a.colorInt="cc0022";"Scrollbar"==e.gui?a.colorInt="182C61":"GraphicControl"!==e.type&&(a.colorInt="f0f8ff");a.colorInt=new b.Color(a.colorInt);a.font_size=f.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=f.parse("1");a.valueExpr=
f.parse("0");a.decimals=f.parse("2");a.min=f.parse("-Infinity");a.max=f.parse("Infinity");a.incr=f.parse("0.1");a.discrete=a.exponentialif=!1;a.zIndex=-1;Object.assign(a,e);/Video|Audio/.test(a.type)&&(a.region="interior");void 0==a.name&&(a.name=2==a.parent.version?a.id:"_nada_");a.name=/_\._|_nada_|_void_/.test(a.name)?"":a.name;e=a.evaluator.eval(a.expresion)[0];a.x=d(e[0]);a.y=d(e[1]);4==e.length&&(a.w=d(e[2]),a.h=d(e[3]));a.actionExec=c.lessonParser.parseAction(a)};x.prototype.init=function(){};
x.prototype.update=function(){};x.prototype.draw=function(){};x.prototype.getContainer=function(){a=this;var b=a.parent.spaces;if("interior"===a.region)for(var c=$jscomp.makeIterator(b),d=c.next();!d.done;d=c.next()){if(d=d.value,d.id===a.spaceID)return d.addCtr(a),a.zIndex=d.zIndex,a.space=d,d.numCtrContainer}else{if("external"===a.region)return a.parent.externalSpace.addCtr(a),a.parent.externalSpace.container;if("scenario"===a.region)return a.cID?(a.expresion=a.evaluator.parser.parse("(0,-1000,"+
a.w+","+a.h+")"),a.parent.stage.stageSpace.addCtr(a),a.zIndex=a.parent.stage.stageSpace.zIndex,a.parent.stage.stageSpace.numCtrContainer):a.parent.externalSpace.container;if(/north|south|east|west/.test(a.region))return a.parent[a.region+"Space"].controls.push(a),a.parent[a.region+"Space"].container}b[0].addCtr(a);a.zIndex=b[0].zIndex;return b[0].numCtrContainer};x.prototype.addControlContainer=function(a){this.getContainer().appendChild(a)};x.prototype.updatePositionAndSize=function(){a=this;q=e=
g=p=!1;n=a.evaluator.eval(a.expresion)[0];c=d(n[0]);q=d(a.x)!==c;a.x=c;c=d(n[1]);e=d(a.y)!==c;a.y=c;4===n.length&&(c=d(n[2]),g=d(a.w)!==c,a.w=c,c=d(n[3]),p=d(a.h)!==c,a.h=c);if(g||p||q||e)a.init(!0,!0),a.draw()};x.prototype.formatValue=function(b){a=this;u=a.parent;l=b+"";m=a.evaluator.eval(a.decimals);f=l.indexOf(".");-1!=f&&(w=l.substring(f+1),w.length>m&&(l=parseFloat(l).toFixed(m)));a.fixed&&(2!==u.version||2===u.version&&!a.exponentialif)&&(l=parseFloat(b).toFixed(m));a.exponentialif&&0!=parseFloat(l)&&
(l=a.fixed&&2!==u.version?parseFloat(l).toExponential(m):parseFloat(l).toExponential(),l=l.toUpperCase().replace("+",""));return l.replace(".",u.decimal_symbol)};x.prototype.updateAndExecAction=function(){u=this.parent;u.updateControls();"init"===this.action&&(this.click=!1);this.actionExec.execute();u.updateControls();"animate"!==this.action&&u.update();u.updateControls()};x.prototype.createGradient=function(a,b){this.linearGradient=this.ctx.createLinearGradient(0,0,0,b);hh=b*b;for(a=0;a<b;a++)di=
h(a-35*b/100),this.linearGradient.addColorStop(a/b,"rgba(0,0,0,"+di*di*192/hh/255+")")};b.Control=x;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,d=/[\w\.\-//]*(\.gif)/gi,h=/CanvasGradient|CanvasPattern/,q=Math.floor,e=Math.abs,g,p,n,c,l,m,f,w,u,x,r,v,z,y,A,B,E,I,D,G,H,C,J,O,Q,M,P,N,F,K,L,R,U,Y,X,T,S=function(c,d){var e;a=e=b.Control.call(this,c,d)||this;a.imageSrc=d.imageSrc||"";a.image=d.image||new Image;a.imageOver=d.imageOver||new Image;a.imageDown=d.imageDown||new Image;a.flat=d.flat||!1;a.borderColor=d.borderColor||!1;a.text_align=d.text_align||"center_center";a.image_align=d.image_align||
"center_center";a.font_family=b.getFontName(d.font_family||"arial");a.ratio=c.ratio;-1===a.font_size&&(a.noFSize=!0);a.borderColor&&(a.borderColor=new b.Color(a.borderColor));a.text_align=a.text_align.split("_");a.image_align=a.image_align.split("_");a.oName=a.name;/^\[.*\]$/.test(a.name)?a.name=a.parser.parse(a.name.slice(1,-1)):a.name=a.parser.parse("'"+a.name+"'");a.classContainer=a.cssClass?" "+a.cssClass+" ":"";a.extra_style=a.extra_style||"";/^_STYLE_/.test(a.imageSrc.trim())&&(a.imageSrc="vacio.gif",
a.extra_style=a.imageSrc.trim().substring(8));if(a.extra_style){a.customStyle=!0;a.btnStyle=[];a.conStyle=[];a.conStyle.textBorder=3;var f;c=$jscomp.makeIterator(a.extra_style.split("|"));for(d=c.next();!d.done;d=c.next()){d=(f=d.value.trim().match(/(.*)=(.*)/))?f[1].trim():"";f=f?f[2].trim():"";var m=f.match(/rgb/g)?"":"#";"class"===d?a.classContainer=" "+f:"border"===d?(a.btnStyle.push({type:"border-style",value:"solid"}),a.btnStyle.push({type:"border-width",value:f+"px"})):"borderRadius"===d?(a.btnStyle.push({type:"border-radius",
value:f+"px"}),a.conStyle.push({type:"border-radius",value:f+"px"})):"borderColor"===d?a.btnStyle.push({type:"border-color",value:m+f}):/^(overColor|downColor|inactiveColor|inactiveColorBorder|shadowTextColor|shadowBoxColor|shadowInsetBoxColor)$/.test(d)?a.conStyle[d]=m+f:"font"===d?a.conStyle[d]=f.toLowerCase():/^(shadowTextBlur|shadowTextOffsetX|shadowTextOffsetY|shadowBoxBlur|shadowBoxOffsetX|shadowBoxOffsetY|shadowInsetBoxBlur|shadowInsetBoxOffsetX|shadowInsetBoxOffsetY|textBorder|imgSizeW|imgSizeH)$/.test(d)?
a.conStyle[d]=parseFloat(f)||0:"flat"===d&&(a[d]=1==parseInt(f))}}a.imageSrc.startsWith("_COLORES_")&&(c=a.imageSrc.split("_"),a.colorInt=new b.Color(c[2]),a.color=new b.Color(c[3]),a.font_size=a.parser.parse(c[5]),a.imageSrc="");/^\[.*\]$/.test(a.imageSrc)?a.imageSrc=a.parser.parse(a.imageSrc.slice(1,-1)):a.imageSrc=a.parser.parse("'"+a.imageSrc+"'");c=a.evaluator.eval(a.imageSrc).toString().trim();if(""!=c)if(K=c.substr(0,c.lastIndexOf(".")),L=c.substr(c.lastIndexOf(".")),c.match(/vacio.gif$/i))e.imageSrc=
e.parser.parse("'vacio.gif'"),e.image.ready=1,3===e.parent.version&&(e.name=e.parser.parse("")),e.emptyImage={ready:!0},e.parser.parse("'vacio.gif'");else if(e.image=e.parent.getImage(c),K)try{e.imageOver=e.parent.getImage(K+"_over"+L),e.imageDown=e.parent.getImage(K+"_down"+L)}catch(da){}a.container=b.newHTML("div",{class:"DescartesButtonContainer"+a.classContainer,id:a.id,style:"width:"+a.w+"px;height:"+a.h+"px;left:"+a.x+"px;top:"+a.y+"px;z-index:"+a.zIndex+";"});a.btn=b.newHTML("canvas",{width:a.w*
a.ratio,height:a.h*a.ratio,style:"position:absolute;left:0;top:0;width:"+a.w+"px;height:"+a.h+"px;"});a.ctx=a.btn.getContext("2d");a.ctx.imageSmoothingEnabled=!1;a.tooltip&&(a.btn.title=a.tooltip);a.container.appendChild(a.btn);a.addControlContainer(a.container);a.addEvents();a.init();return e};$jscomp.inherits(S,b.Control);S.prototype.init=function(d){a=this;g=a.evaluator;G=a.container;p=a.btn;n=a.ctx;c=g.eval(a.expresion)[0];a.x=c[0];a.y=c[1];4==c.length&&(a.w=parseInt(c[2]),a.h=parseInt(c[3]));
p.width=a.w*a.ratio;p.height=a.h*a.ratio;p.setAttribute("style","position:absolute;left:0;top:0;width:"+a.w+"px;height:"+a.h+"px;box-sizing:border-box;");G.setAttribute("style","width:"+a.w+"px;height:"+a.h+"px;left:"+a.x+"px;top:"+a.y+"px;z-index:"+a.zIndex+";display:block;");if(a.btnStyle)for(var e=$jscomp.makeIterator(a.btnStyle),f=e.next();!f.done;f=e.next())f=f.value,p.style[f.type]=f.value;if(a.conStyle){e=$jscomp.makeIterator(a.conStyle);for(f=e.next();!f.done;f=e.next())f=f.value,G.style[f.type]=
f.value;a.conStyle.shadowBoxColor&&(G.style.boxShadow=(a.conStyle.shadowBoxOffsetX||0)+"px "+(a.conStyle.shadowBoxOffsetY||2)+"px "+(a.conStyle.shadowBoxBlur||2)+"px 1px "+a.conStyle.shadowBoxColor);a.conStyle.shadowInsetBoxColor&&(p.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);G.style.display=0<g.eval(a.drawif)?"block":"none";n.lineJoin="round";n.font=a.italics+" "+a.bold+" "+a.fs_evaluated+"px "+a.font_family;a.text_object=new b.TextObject({parent:{decimal_symbol:a.parent.decimal_symbol},evaluator: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(d)};S.prototype.update=function(){a=this;g=a.evaluator;G=a.container;a.activeIfValue=0<g.eval(a.activeif);a.drawIfValue=0<
g.eval(a.drawif);(a.space?a.space.drawIfValue:1)&&a.drawIfValue?(G.style.display="block",a.draw(),G.style.cursor=a.btn.style.cursor=a.activeIfValue?"pointer":"not-allowed",G.setAttribute("active",a.activeIfValue),a.updatePositionAndSize()):(G.style.display="none",a.buttonClick=!1)};S.prototype.draw=function(c){a=this;G=a.container;g=a.evaluator;p=a.btn;n=a.ctx;m=g.eval(a.name);a.text_object.draw(b.ctx,"#000000",0,0);m=a.text_object.textNodes.toStr();f=a.evaluator.eval(a.imageSrc).toString().trim();
if(!c&&(H=a.over===a.oldOver,C=a.buttonClick===a.oldButtonClick,J=a.activeIfValue===a.oldActiveIfValue,O=a.drawIfValue===a.oldDrawIfValue,Q=m===a.oldName,M=f===a.oldImageSrc,P=a.colorInt.getColor()===a.oldBackColor,N=a.color.getColor()===a.oldTextColor,F=a.image.ready===a.oldImageReady,a.oldOver=a.over,a.oldButtonClick=a.buttonClick,a.oldActiveIfValue=a.activeIfValue,a.oldDrawIfValue=a.drawIfValue,a.oldName=m,a.oldImageSrc=f,a.oldBackColor=a.colorInt.getColor(),a.oldTextColor=a.color.getColor(),a.oldImageReady=
a.image.ready,H&&C&&J&&O&&Q&&M&&P&&N&&F))return;n.save();n.setTransform(a.ratio,0,0,a.ratio,0,0);l=a.fs_evaluated;G.setAttribute("data-name",m);f?(w="vacio.gif"===f?this.emptyImage:this.parent.getImage(f),K=f.substr(0,f.lastIndexOf(".")),L=f.substr(f.lastIndexOf(".")),R=K+"_over"+L,U=K+"_down"+L,Y="vacio.gif"===f?this.emptyImage:this.parent.getImage(R),X="vacio.gif"===f?this.emptyImage:this.parent.getImage(U)):w=Y=X=a.emptyImg;n.clearRect(0,0,a.w,a.h);x=r=a.buttonClick?1:0;a.text_object.draw(n,a.color.getColor(),
0,0,!0);v=a.text_object.textNodes.metrics.w;z=a.text_object.textNodes.metrics.h;"center"==a.text_align[1]?I=q(a.w/2+x)-.5:"left"==a.text_align[1]?I=v/2+5+x:"right"==a.text_align[1]&&(I=a.w-v/2+x-5);"center"==a.text_align[0]?D=q(a.h/2+r)-.5:"top"==a.text_align[0]?D=z/2+r+4:"bottom"==a.text_align[0]&&(D=a.h-z/2+r-3);if(w){if(y=a.imgSizeW||w.width,A=a.imgSizeH||w.height,"center"==a.image_align[1]?B=parseInt((a.w-y)/2)+x:"left"==a.image_align[1]?B=x:"right"==a.image_align[1]&&(B=a.w-y+x),"center"==a.image_align[0]?
E=parseInt((a.h-A)/2)+r:"top"==a.image_align[0]?E=r:"bottom"==a.image_align[0]&&(E=a.h-A+r),w&&w.ready)if(w!==a.emptyImg&&w.complete)if(f.match(d))p.style.backgroundRepeat="no-repeat",p.style.backgroundImage="url('"+f+"')",p.style.backgroundPosition=B+"px "+E+"px";else{if("center"!=a.image_align[0]||"center"!=a.image_align[1])(T=a.colorInt.getColor())&&h.test(T.constructor.name)?(n.fillStyle=T,n.fillRect(0,0,a.w,a.h)):G.style.backgroundColor=T;n.drawImage(w,0,0,w.width,w.height,B,E,y,A)}else a.emptyImg&&
a.customStyle&&((T=a.colorInt.getColor())&&h.test(T.constructor.name)?(n.fillStyle=T,n.fillRect(0,0,a.w,a.h)):G.style.backgroundColor=T)}else(T=a.colorInt.getColor())&&h.test(T.constructor.name)?(n.fillStyle=T,n.fillRect(0,0,a.w,a.h)):(G.style.backgroundColor=T,a.flat||(a.buttonClick||(a.drawLine(n,a.w-1,0,a.w-1,a.h,"rgba(0,0,0,0.5)"),a.drawLine(n,0,0,0,a.h,"rgba(0,0,0,0.09)"),a.drawLine(n,1,0,1,a.h,"rgba(0,0,0,0.03)")),n.fillStyle=a.linearGradient,n.fillRect(0,0,a.w,a.h)));a.activeIfValue&&(Y!==
a.emptyImg&&a.over&&Y.ready&&Y.complete?R.match(d)?(p.style.backgroundImage="url('"+R+"')",p.style.backgroundPosition=B+"px "+E+"px"):n.drawImage(Y,B,E):a.customStyle&&a.conStyle.overColor&&a.over&&(G.style.backgroundColor=a.conStyle.overColor));a.activeIfValue?X!==a.emptyImg&&a.buttonClick&&X.ready&&X.complete?U.match(d)?(p.style.backgroundImage="url('"+U+"')",p.style.backgroundPosition=B+"px "+E+"px"):n.drawImage(X,B,E):a.customStyle&&a.conStyle.downColor&&a.buttonClick&&(G.style.backgroundColor=
a.conStyle.downColor):a.buttonClick&&!w&&(n.fillStyle="rgba(0,0,0,0.09)",n.fillRect(0,0,a.w,a.h));n.fillStyle=a.color.getColor();a.customStyle&&a.conStyle.shadowTextColor&&0<a.conStyle.textBorder&&(n.lineWidth=a.conStyle.textBorder,n.strokeStyle=a.conStyle.shadowTextColor);a.borderColor&&(n.lineWidth=parseInt(l/6),n.strokeStyle=a.borderColor.getColor());a.text_object.draw(n,a.color.getColor(),I,D);a.underlined&&(n.strokeStyle=a.color.getColor(),n.lineWidth=q(.1*l)||2,n.lineCap="round",n.beginPath(),
n.moveTo(I-v/2+x,D+q(l/2)+q(l/5)-1.5),n.lineTo(I+v/2+x,D+q(l/2)+q(l/5)-1.5),n.stroke());a.activeIfValue||(a.customStyle&&a.conStyle.inactiveColor?G.style.backgroundColor=a.conStyle.inactiveColor:(n.fillStyle="rgba(240,240,240,0.6)",n.fillRect(0,0,a.w,a.h)));n.restore();a._image_pos_x=B;a._image_pos_y=E};S.prototype.drawLine=function(a,b,c,d,e,f,m){a.lineWidth=void 0===m?1:m;a.strokeStyle=void 0===f?"black":f;u=a.lineWidth%2*.5;a.beginPath();a.moveTo(q(b)+u,q(c)+u);a.lineTo(q(d)+u,q(e)+u);a.stroke()};
S.prototype.drawTextBorder=function(){this.colorInt.getColor();this.color.getColor();return!(.5>(e(this.colorInt.r-this.color.r)+e(this.colorInt.g-this.color.g)+e(this.colorInt.b-this.color.b))/255)};S.prototype.addEvents=function(){function a(c,d,m){b.clearTimeout(f);e.buttonClick&&e.drawIfValue&&e.activeIfValue&&(d.call(e),c=m?c:100,f=b.setTimeout(function(){a(c,d,!1)},c))}function c(c){e.parent.deactivateControls();this.focus();c.preventDefault();c.stopPropagation();document.activeElement!=document.body&&
document.activeElement.blur();e.whichBtn=b.whichBtn(c);"L"==e.whichBtn&&e.activeIfValue&&(e.buttonClick=!0,e.draw(),"calculate"==e.action&&(e.evaluator.setVariable(e.id,e.evaluator.eval(e.valueExpr)),a(1E3,e.updateAndExecAction,!0)),e.btn.removeEventListener("touchend",d),e.btn.addEventListener("touchend",d),e.btn.removeEventListener("mouseup",d),e.btn.addEventListener("mouseup",d))}function d(a){b.newBlobContent=null;this.focus();a.preventDefault();a.stopPropagation();e.activeIfValue||e.buttonClick?
(e.buttonClick=!1,e.draw(),"calculate"!=e.action&&(e.evaluator.setVariable(e.id,e.evaluator.eval(e.valueExpr)),e.updateAndExecAction()),e.btn.removeEventListener("touchend",d),e.btn.removeEventListener("mouseup",d)):e.parent.update()}var e=this,f;this.over=this.buttonClick=!1;this.btn.addEventListener("touchstart",c);this.btn.addEventListener("mousedown",c);this.btn.addEventListener("mouseover",function(a){a.preventDefault();a.stopPropagation();e.over=!0;e.draw()});this.btn.addEventListener("mouseout",
function(a){b.newBlobContent=null;a.preventDefault();a.stopPropagation();e.over=!1;e.buttonClick=!1;e.draw()});document.addEventListener("visibilitychange",function(a){b.newBlobContent=null;e.buttonClick=!1})};b.Button=S;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,d,h,q,e,g,p,n,c,l,m,f,w,u,x,r=function(c,d){a=d=b.Control.call(this,c,d)||this;a.flat=a.image_dec_src&&a.image_inc_src;a.btn_pos=a.btn_pos||"v_left";a.horizontal="h_left"===a.btn_pos||"h_right"===a.btn_pos||"h_left_right"===a.btn_pos;a.label_color=a.label_color||new b.Color("e0e4e8",c.evaluator);a.label_text_color=a.label_text_color||new b.Color("000000",c.evaluator);a.tabindex=++c.tabindex;a.name_str=a.name;a.initial_value=0;try{a.initial_value=
a.evaluator.eval(a.parser.parse(a.valueExprString))}catch(y){console.log(y)}/^\[.*\]$/.test(a.name)?a.name=a.parser.parse(a.name.slice(1,-1)):a.name=a.parser.parse("'"+a.name+"'");a.container=b.newHTML("div",{class:"DescartesSpinnerContainer",id:a.id});a.divUp=b.newHTML("div",{class:"DJS_Up"});a.divDown=b.newHTML("div",{class:"DJS_Down"});a.field=b.newHTML("input",{type:"text",id:a.id+"_spinner",class:"DescartesSpinnerField",tabindex:a.tabindex});a.label=b.newHTML("canvas",{class:"DescartesSpinnerLabel"});
a.label_ctx=a.label.getContext("2d");a.ratio=c.ratio;a.container.appendChild(a.label);a.container.appendChild(a.field);a.container.appendChild(a.divUp);a.container.appendChild(a.divDown);a.cover=b.newHTML("div",{class:"TextfieldCover"});a.keyboard&&a.visible&&a.container.appendChild(a.cover);a.addControlContainer(a.container);f=a.evaluator.parser.parse("1");a.originalIncr=a.incr;if(0>a.evaluator.eval(a.decimals)||0===a.evaluator.eval(a.incr))c=a.evaluator.eval(a.incr),0<c?a.originalIncr=a.incr=a.evaluator.parser.parse(parseInt(c).toString()):
a.incr=f;a.image_dec_src&&(/^\[.*\]$/.test(a.image_dec_src)?a.image_dec_src=a.parser.parse(a.image_dec_src.slice(1,-1)):a.image_dec_src=a.parser.parse("'"+a.image_dec_src+"'"),a.old_image_dec_src=a.evaluator.eval(a.image_dec_src).toString().trim(),a.image_dec=a.parent.getImage(a.old_image_dec_src));a.image_inc_src&&(/^\[.*\]$/.test(a.image_inc_src)?a.image_inc_src=a.parser.parse(a.image_inc_src.slice(1,-1)):a.image_inc_src=a.parser.parse("'"+a.image_inc_src+"'"),a.old_image_inc_src=a.evaluator.eval(a.image_inc_src).toString().trim(),
a.image_inc=a.parent.getImage(a.old_image_inc_src));a.addEvents();a.init();return d};$jscomp.inherits(r,b.Control);r.prototype.init=function(c,e){a=this;d=a.evaluator;a.label.innerHTML=d.eval(a.name).toString();c=a.label.textContent;e||(a.value=a.validateValue(d.eval(a.valueExpr)));e=a.formatValue(a.value);a.fieldFontSize=0<d.eval(a.font_size)?d.eval(a.font_size):b.getFieldFontSize(a.h);a.text_object=new b.TextObject({parent:{decimal_symbol:a.parent.decimal_symbol},evaluator:d,decimals:a.decimals,
fixed:!1,align:"left",anchor:"center_center",width:a.parser.parse("0"),font_size:a.parser.parse(""+a.fieldFontSize),font_family:a.font_family,italics:a.italics,bold:a.bold},a.name_str);a.text_object.draw(a.label_ctx,a.label_text_color.getColor(),0,0,!0);var f=2!==a.parent.version?"__":"_____",m=b.getTextWidth(e+"_",a.fieldFontSize+"px "+b.sansserif_font);if(a.horizontal){var l=parseInt(a.h),g=parseInt(a.w/2-l);f=a.text_object.textNodes.metrics.w+parseInt(a.fieldFontSize);a.visible||(g=a.w-2*l,m=0);
g<f&&(g=f);""==c&&(g=0);a.w-g-l<m&&(g=a.w-l-m);0>g&&(g=0);c=a.w-(g+2*l);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:"+l+"px;height:"+l+"px;"+("h_left"===a.btn_pos?"left:"+(g+l):"right:0")+"px;top:0;"+(a.flat?"border-width:0;":""));a.divDown.setAttribute("style","width:"+l+"px;height:"+l+"px;left:"+(g+("h_right"===a.btn_pos?c:0))+"px;top:0;"+(a.flat?"border-width:0;":
""));a.field.setAttribute("style","font-family:"+b.sansserif_font+";font-size:"+a.fieldFontSize+"px;width:"+c+"px;height:"+a.h+"px;left:"+(l+g+("h_left"===a.btn_pos?l:"h_right"===a.btn_pos?-l:0))+"px;text-align:center;");a.cover.setAttribute("style","width:"+c+"px;height:"+a.h+"px;left:"+(l+g+("h_left"===a.btn_pos?l:"h_right"===a.btn_pos?-l:0))+"px;text-align:center;");a.field.value=e;a.visible||(a.field.style.display="none");a.label.setAttribute("style","font-size:"+a.fieldFontSize+"px;width:"+g+
"px;height:"+a.h+"px;line-height:"+a.h+"px;background-color:"+a.label_color.getColor()+";color:"+a.label_text_color.getColor()+";");a.label.width=g*a.ratio}else l=2+parseInt(a.h/2),g=parseInt(a.w/2-l/2),f=b.getTextWidth(c+f,a.fieldFontSize+"px "+b.sansserif_font),a.visible||(g=a.w-l,m=0),g<f&&(g=f),""==c&&(g=0),a.w-g-l<m&&(g=a.w-l-m),0>g&&(g=0),c=a.w-(g+l),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;"),
m="width:"+l+"px;left:"+(g+("v_right"===a.btn_pos?c:0))+"px;",a.divUp.setAttribute("style",m+";height:"+(a.h/2+1)+"px;top:0;"+(a.flat?"border-width:0;":"")),a.divDown.setAttribute("style",m+";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:"+c+"px;height:"+a.h+"px;left:"+(("v_left"===a.btn_pos?l:0)+g)+"px;"),a.cover.setAttribute("style","width:"+c+"px;height:"+a.h+"px;left:"+
(("v_left"===a.btn_pos?l:0)+g)+"px;"),a.field.value=e,a.visible||(a.field.style.display="none"),a.label.setAttribute("style","font-size:"+a.fieldFontSize+"px;width:"+g+"px;height:"+a.h+"px;line-height:"+a.h+"px;background-color:"+a.label_color.getColor()+";color:"+a.label_text_color.getColor()+";"),a.label.width=g*a.ratio;a.label.height=a.h*a.ratio;a.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);d.setVariable(a.id,a.value)};r.prototype.update=function(){a=this;d=a.evaluator;0>d.eval(a.decimals)?(h=d.eval(a.incr),0<h?a.originalIncr=a.incr=d.parser.parse(parseInt(h).toString()):a.incr=f):a.incr=0!==d.eval(a.originalIncr)?a.originalIncr:f;a.activeIfValue=0<d.eval(a.activeif);a.drawIfValue=0<d.eval(a.drawif);a.field.disabled=!a.activeIfValue;a.divUp.setAttribute("active",
!a.field.disabled);a.divDown.setAttribute("active",!a.field.disabled);a.drawIfValue?(a.updateStyle(),a.container.style.display="block"):(a.click=!1,a.container.style.display="none");a.image_dec&&(w=a.evaluator.eval(a.image_dec_src).toString().trim(),a.old_image_dec_src!==w&&(a.divDown.style["background-image"]="url("+w+")",a.old_image_dec_src=w));a.image_inc&&(u=a.evaluator.eval(a.image_inc_src).toString().trim(),a.old_image_inc_src!==u&&(a.divUp.style["background-image"]="url("+u+")",a.image_inc_src=
u));a.updatePositionAndSize();a.parent.animation.playing&&document.activeElement==a.field||(q=a.field.value,e=a.value,a.value=a.validateValue(d.getVariable(a.id)),a.field.value=a.formatValue(a.value),a.value==e&&a.field.value!=q&&(a.value=a.validateValue(q),a.field.value=a.formatValue(a.value)),d.setVariable(a.id,a.value));a.label_ctx.setTransform(a.ratio,0,0,a.ratio,0,0);a.text_object.draw(a.label_ctx,a.label_text_color.getColor(),0,0);a.label_ctx.clearRect(0,0,a.label.width,a.label.height);(x=a.label_color.getColor())&&
/CanvasGradient|CanvasPattern/.test(x.constructor.name)&&(a.label_ctx.fillStyle=x,a.label_ctx.fillRect(0,0,a.label_ctx.canvas.width,a.label_ctx.canvas.height));a.text_object.textNodes.metrics.w>a.label.width/a.ratio?(a.text_object.anchor="center_left",a.text_object.draw(a.label_ctx,a.label_text_color.getColor(),5,a.label.height/a.ratio/2)):(a.text_object.anchor="center_center",a.text_object.draw(a.label_ctx,a.label_text_color.getColor(),a.label.width/a.ratio/2,a.label.height/a.ratio/2));a.label_ctx.setTransform(1,
0,0,1,0,0)};r.prototype.updateStyle=function(){a=this;a.divUp.style.borderStyle=a.up?"inset":"outset";a.divUp.style.borderColor=a.up?"gray":"#f0f8ff";a.divUp.style.backgroundColor=a.up?"#bfbfbf":"";a.divUp.style.backgroundColor=a.flat?"transparent":a.divUp.style.backgroundColor;a.divUp.style.backgroundPosition=a.up?"calc(50% + 1px) calc(50% + 1px)":"center";a.divDown.style.borderStyle=a.down?"inset":"outset";a.divDown.style.borderColor=a.down?"gray":"#f0f8ff";a.divDown.style.backgroundColor=a.down?
"#bfbfbf":"";a.divDown.style.backgroundColor=a.flat?"transparent":a.divDown.style.backgroundColor;a.divDown.style.backgroundPosition=a.down?"calc(50% + 1px) calc(50% + 1px)":"center"};r.prototype.validateValue=function(a){d=this.evaluator;isNaN(parseFloat(a))||a.toString().includes("e")&&(a=parseFloat(a).toFixed(20));a=void 0!=a?a.toString():"0";a=a.replace(this.parent.decimal_symbol,".");g=a==parseFloat(a)?parseFloat(a):parseFloat(d.eval(d.parser.parse(a)));isNaN(g)&&(g=0);c=d.eval(this.min);l=d.eval(this.max);
""===c&&(c=-Infinity);""===l&&(l=Infinity);g=Math.min(Math.max(g,c),l);this.discrete&&(p=d.eval(this.incr),g=0==p?0:this.initial_value+p*Math.round((g-this.initial_value)/p));n=d.eval(this.decimals);0>=n&&(n=0);return g=parseFloat(parseFloat(g).toFixed(n))};r.prototype.increase=function(){this.changeValue(parseFloat(this.value)+this.evaluator.eval(this.incr))};r.prototype.decrease=function(){this.changeValue(parseFloat(this.value)-this.evaluator.eval(this.incr))};r.prototype.changeValue=function(a){this.activeIfValue&&
(this.value=this.validateValue(a),this.field.value=this.formatValue(this.value),this.evaluator.setVariable(this.id,this.value),this.updateAndExecAction())};r.prototype.addEvents=function(){function a(c,d,e){b.clearTimeout(h);if(l.up||l.down)d.call(l),c=e?c:10,h=b.setTimeout(function(){a(c,d)},c)}function c(c){c.preventDefault();l.whichBtn=b.whichBtn(c);"L"==l.whichBtn&&l.activeIfValue&&(l.up=!0,a(g,l.increase,!0))}function d(c){c.preventDefault();l.whichBtn=b.whichBtn(c);"L"==l.whichBtn&&l.activeIfValue&&
(l.down=!0,a(g,l.decrease,!0))}function e(a){l.up=!1;b.clearTimeout(h);l.updateStyle()}function f(a){l.down=!1;b.clearTimeout(h);l.updateStyle()}m=b.hasTouchSupport;var l=this,g=m?500:200,h;l.label.addEventListener("touchstart",b.preventDefault);l.label.addEventListener("mousedown",b.preventDefault);l.field.addEventListener("keydown",function(a){13==a.keyCode&&l.changeValue(l.field.value)});l.divUp.addEventListener("touchstart",c);l.divUp.addEventListener("mousedown",c);l.divDown.addEventListener("touchstart",
d);l.divDown.addEventListener("mousedown",d);l.divUp.addEventListener("mouseout",function(a){l.up=!1;b.clearTimeout(h);a.preventDefault();l.updateStyle()});l.divDown.addEventListener("mouseout",function(a){l.down=!1;b.clearTimeout(h);a.preventDefault();l.updateStyle()});l.divUp.addEventListener("touchend",e);window.addEventListener("touchend",e);l.divUp.addEventListener("mouseup",e);window.addEventListener("mouseup",e);l.divDown.addEventListener("touchend",f);window.addEventListener("touchend",f);
l.divDown.addEventListener("mouseup",f);window.addEventListener("mouseup",f);document.addEventListener("visibilitychange",function(a){l.up=l.down=!1;b.clearTimeout(h);l.updateStyle()});l.field.addEventListener("blur",function(a){l.drawIfValue&&l.changeValue(l.field.value,!0)});l.field.addEventListener("click",function(a){this.focus()});l.cover.addEventListener("click",function(a){a=l.evaluator.eval(l.kbexp);l.activeIfValue&&l.parent.keyboard.show(l,l.kblayout,a[0][0]||0,a[0][1]||0,l.id,l.field,l.onlyText)})};
b.Spinner=r;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,d,h,q=function(d,g){var e;a=e=b.Control.call(this,d,g)||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;/^\[.*\]$/.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();return e};$jscomp.inherits(q,b.Control);q.prototype.init=function(e){a=this;d=a.evaluator;a.label.innerHTML=d.eval(a.name).toString();a.labelFontSize=0<d.eval(a.font_size)?d.eval(a.font_size):b.getFieldFontSize(a.h);e=Math.max(a.w-a.h,0);a.text_object=new b.TextObject({parent:{decimal_symbol:a.parent.decimal_symbol},
evaluator:d,decimals:a.decimals,fixed:!1,align:"left",anchor:"center_center",width:a.parser.parse("0"),font_size:a.parser.parse(""+a.labelFontSize),font_family:a.font_family,italics:a.italics,bold:a.bold},a.name_str);a.text_object.draw(a.label_ctx,a.label_text_color.getColor(),0,0,!0);a.containerControl.setAttribute("style","width:"+a.w+"px;height:"+a.h+"px;left:"+a.x+"px;top:"+a.y+"px;z-index:"+a.zIndex+";");"right"==a.position?(a.dummyLabel.setAttribute("style","position:absolute;width:"+a.h+"px;height:"+
a.h+"px;left:"+e+"px;"),a.checkbox.setAttribute("style","width:"+a.h+"px;height:"+a.h+"px;left:"+e+"px;"),a.label.setAttribute("style","font-size:"+a.labelFontSize+"px;width:"+e+"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:"+e+"px;height:"+a.h+"px;line-height:"+a.h+"px;background-color:"+a.label_color.getColor()+";color:"+a.label_text_color.getColor()+";left:"+a.h+"px"));a.checkbox.checked=0!=d.getVariable(a.id);a.label.width=e*a.ratio;a.label.height=a.h*a.ratio;a.update()};q.prototype.update=function(){a=this;d=a.evaluator;a.activeIfValue=0<d.eval(a.activeif);a.drawIfValue=0<d.eval(a.drawif);a.checkbox.disabled=!a.activeIfValue;a.containerControl.style.display=a.drawIfValue?"block":
"none";if(!a.parent.animation.playing||document.activeElement!=a.checkbox){var b=0!==d.getVariable(a.id)?1:0;if(""===a.radio_group)a.pressed?(a.value=a.checkbox.checked?1:0,a.pressed=!1):(a.value=b,a.checkbox.checked=0!==a.value),d.setVariable(a.id,a.value);else{a.value=d.getVariable(a.id);d.setVariable(a.radio_group,0);b=document.querySelectorAll("[name="+a.radio_group+"]");var g=-1;if(a.pressed){for(g=b.length-1;0<=g;g--)d.setVariable(b[g].internalID,0),b[g].checked=!1;d.setVariable(a.id,1);a.checkbox.checked=
!0;a.value=1;d.setVariable(a.radio_group,a.id);a.pressed=0}else{for(var p=b.length-1;0<=p;p--)g=0!=d.getVariable(b[p].internalID)?p:g,d.setVariable(b[p].internalID,0),b[p].checked=!1;0<=g&&(d.setVariable(b[g].internalID,1),b[g].checked=!0,d.setVariable(a.radio_group,b[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);
(h=a.label_color.getColor())&&/CanvasGradient|CanvasPattern/.test(h.constructor.name)&&(a.label_ctx.fillStyle=h,a.label_ctx.fillRect(0,0,a.label_ctx.canvas.width,a.label_ctx.canvas.height));a.text_object.textNodes.metrics.w>a.label.width/a.ratio?(a.text_object.anchor="center_left",a.text_object.draw(a.label_ctx,a.label_text_color.getColor(),5,a.label.height/a.ratio/2)):(a.text_object.anchor="center_center",a.text_object.draw(a.label_ctx,a.label_text_color.getColor(),a.label.width/a.ratio/2,a.label.height/
a.ratio/2));a.label_ctx.setTransform(1,0,0,1,0,0)};q.prototype.addEvents=function(){var a=this;a.label.ontouchstart=a.label.onmousedown=a.dummyLabel.onmousedown=b.preventDefault;a.checkbox.addEventListener("click",function(){a.pressed=!0;a.updateAndExecAction()})};b.Checkbox=q;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,d,h,q,e,g,p,n,c,l=function(d,e){a=e=b.Control.call(this,d,e)||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.name_str=a.name;/^\[.*\]$/.test(a.name)?a.name=a.parser.parse(a.name.slice(1,-1)):a.name=a.parser.parse("'"+a.name.trim()+"'");void 0===a.valueExprString&&(a.valueExprString=a.onlyText?"0":"");a.emptyString=!1;a.ok=0;a.tabindex=++d.tabindex;if(a.answer&&
a.evaluate){if(c=a.answer.match(/^krypto_(.*)$/))a.answer=(new b.Krypto).decode(c[1]);a.answer=b.answerRegEx(a.answer,a.evaluator,a.onlyText)}a.onlyText&&(/^'.*'$/.test(a.valueExprString)||(a.valueExpr=a.evaluator.parser.parse("'"+a.valueExprString+"'")),a.validateValue=function(a){a=a.toString();return"''"==a||"'"==a?"":a&&/^'.*'$/.test(a)?a.slice(1,-1):a},a.formatValue=function(a){return a.toString()});a.containerControl=b.newHTML("div",{class:"DescartesTextFieldContainer",id:a.id});a.field=b.newHTML("input",
{type:"text",id:a.id+"TextField",class:"DescartesTextFieldField",tabindex:a.tabindex});a.label=b.newHTML("canvas",{class:"DescartesTextFieldLabel"});a.label_ctx=a.label.getContext("2d");a.ratio=d.ratio;a.containerControl.appendChild(a.label);a.containerControl.appendChild(a.field);a.cover=b.newHTML("div",{class:"TextfieldCover"});a.keyboard&&a.containerControl.appendChild(a.cover);a.activoStr=a.id+".activo";a.activeStr=a.id+".active";a.addControlContainer(a.containerControl);a.addEvents();a.init();
return e};$jscomp.inherits(l,b.Control);l.prototype.init=function(c){a=this;d=a.evaluator;a.label.innerHTML=d.eval(a.name).toString();var e=a.label.textContent;c||(a.value=a.validateValue(d.eval(a.valueExpr)));c=a.formatValue(a.value);a.fieldFontSize=0<d.eval(a.font_size)?d.eval(a.font_size):b.getFieldFontSize(a.h);a.text_object=new b.TextObject({parent:{decimal_symbol:a.parent.decimal_symbol},evaluator:d,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),l=parseInt(a.w/2),g=a.text_object.textNodes.metrics.w+parseInt(a.fieldFontSize);a.visible||(l=a.w,m=0);l<g&&(l=g);""==e&&(l=0);a.w-l<m&&(l=a.w-m);0>l&&(l=0);e=a.w-l;a.containerControl.setAttribute("style","width:"+a.w+"px;height:"+a.h+"px;left:"+a.x+"px;top:"+a.y+"px;z-index:"+a.zIndex+
";");a.field.setAttribute("style","font-size:"+a.fieldFontSize+"px;width:"+e+"px;height:"+a.h+"px;left:"+l+"px; font-family:"+("Serif"==a.font_family?b.serif_font:"Monospaced"==a.font_family?b.monospace_font:b.sansserif_font)+";");a.field.value=c;a.cover.setAttribute("style",";width:"+e+"px;height:"+a.h+"px;left:"+l+"px;");a.label.setAttribute("style","font-size:"+a.fieldFontSize+"px;width:"+l+"px;height:"+a.h+"px;line-height:"+a.h+"px;background-color:"+a.label_color.getColor()+";color:"+a.label_text_color.getColor()+
";");a.label.width=l*a.ratio;a.label.height=a.h*a.ratio;a.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()};l.prototype.update=function(){a=this;d=a.evaluator;a.activeIfValue=0<d.eval(a.activeif);a.drawIfValue=0<d.eval(a.drawif);a.field.disabled=!a.activeIfValue;a.containerControl.style.display=a.drawIfValue?"block":"none";a.parent.animation.playing&&document.activeElement==a.field||(h=a.field.value,q=a.value,
a.value=a.validateValue(d.getVariable(a.id)),a.field.value=a.formatValue(a.value),a.value===q&&a.field.value!=h&&(a.value=a.validateValue(h),a.field.value=a.formatValue(a.value)),d.setVariable(a.id,a.value));a.updatePositionAndSize();a.label_ctx.setTransform(a.ratio,0,0,a.ratio,0,0);a.text_object.draw(a.label_ctx,a.label_text_color.getColor(),0,0);a.label_ctx.clearRect(0,0,a.label.width,a.label.height);(n=a.label_color.getColor())&&/CanvasGradient|CanvasPattern/.test(n.constructor.name)&&(a.label_ctx.fillStyle=
n,a.label_ctx.fillRect(0,0,a.label_ctx.canvas.width,a.label_ctx.canvas.height));a.text_object.textNodes.metrics.w>a.label.width/a.ratio?(a.text_object.anchor="center_left",a.text_object.draw(a.label_ctx,a.label_text_color.getColor(),5,a.label.height/a.ratio/2)):(a.text_object.anchor="center_center",a.text_object.draw(a.label_ctx,a.label_text_color.getColor(),a.label.width/a.ratio/2,a.label.height/a.ratio/2));a.label_ctx.setTransform(1,0,0,1,0,0)};l.prototype.validateValue=function(a){if(""===a||"''"==
a)return"";d=this.evaluator;a=a.toString().replace(this.parent.decimal_symbol_regexp,".");e=a==parseFloat(a)?parseFloat(a):parseFloat(d.eval(d.parser.parse(a)));isNaN(e)&&(e=0);g=d.eval(this.min);p=d.eval(this.max);""===g&&(g=-Infinity);""===p&&(p=Infinity);e<g&&(e=g);e>p&&(e=p);this.discrete&&(a=d.eval(this.incr),e=0===a?0:a*Math.round(e/a));return e=parseFloat(parseFloat(e).toFixed(d.eval(this.decimals)))};l.prototype.formatValue=function(a){return""===a?a:b.Control.prototype.formatValue.call(this,
a)};l.prototype.changeValue=function(a){this.activeIfValue&&(this.value=this.validateValue(a),this.field.value=this.formatValue(this.value),this.evaluate&&(this.ok=this.evalAnswer()),this.evaluator.setVariable(this.id,this.value),this.evaluator.setVariable(this.id+".ok",this.ok),this.updateAndExecAction())};l.prototype.evalAnswer=function(){return b.esCorrecto(this.answer,this.value,this.evaluator)};l.prototype.deactivate=function(){this.evaluator.setVariable(this.activoStr,0);this.evaluator.setVariable(this.activeStr,
0)};l.prototype.addEvents=function(){var a=this;a.label.addEventListener("touchstart",b.preventDefault);a.label.addEventListener("mousedown",b.preventDefault);a.field.addEventListener("mousedown",function(b){a.parent.deactivateControls();a.evaluator.setVariable(a.activoStr,1);a.evaluator.setVariable(a.activeStr,1);a.parent.update()});a.field.addEventListener("blur",function(b){a.drawIfValue&&a.changeValue(a.field.value,!0)});a.field.addEventListener("keydown",function(b){a.activeIfValue&&13==b.keyCode&&
a.changeValue(a.field.value,!0)});a.field.addEventListener("click",function(a){this.focus()});a.cover.addEventListener("click",function(b){a.parent.deactivateControls();a.evaluator.setVariable(a.activoStr,1);a.evaluator.setVariable(a.activeStr,1);a.parent.update();b=a.evaluator.eval(a.kbexp);a.activeIfValue&&a.parent.keyboard.show(a,a.kblayout,b[0][0]||0,b[0][1]||0,a.id,a.field,a.onlyText)})};b.TextField=l;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,d=Math.abs,h,q,e,g,p,n,c,l,m,f,w,u=function(a,c){function d(a){f.options=a.split(",");f.menuOptions=[];f.strVal=[];for(var c=0,d=f.options.length;c<d;c++)a=f.customSplit(f.options[c]),1==a.length?(f.menuOptions.push(a[0]),f.strVal.push(c.toString())):2==a.length&&(f.menuOptions.push(a[0]),""==a[1]?f.strVal.push(c.toString()):f.strVal.push(a[1]));a=0;for(c=f.menuOptions.length;a<c;a++)/^\[.*\]$/.test(f.menuOptions[a])?f.menuOptions[a]=h.parse(f.menuOptions[a].slice(1,
-1)):f.menuOptions[a]=h.parse("'"+f.menuOptions[a]+"'");a=0;for(c=f.strVal.length;a<c;a++)/^\[.*\]$/.test(f.strVal[a])?f.strVal[a]=h.parse(f.strVal[a].slice(1,-1)):f.strVal[a]=h.parse(f.strVal[a]);f.select.innerHTML="";a=$jscomp.makeIterator(f.menuOptions);for(c=a.next();!c.done;c=a.next())d=c.value,c=b.newHTML("option"),c.innerHTML=q.eval(d),f.select.appendChild(c);return 0}var e,f=e=b.Control.call(this,a,c)||this;h=f.parser;q=f.evaluator;f.label_color=f.label_color||new b.Color("e0e4e8",q);f.label_text_color=
f.label_text_color||new b.Color("000000",q);f.options=c.options||"";f.ok=0;f.tabindex=++a.tabindex;f.answer&&(/^krypto_/.test(f.answer)&&(f.answer=(new b.Krypto).decode(f.answer.substring(7))),console.log(f.answer),f.answer=parseInt(f.answer.split(",")[0].replace("[",""))||0);f.name_str=f.name;/^\[.*\]$/.test(f.name)?f.name=f.parser.parse(f.name.slice(1,-1)):f.name=f.parser.parse("'"+f.name+"'");f.evaluator.setFunction(f.id+".setOptions",d);f.containerControl=b.newHTML("div",{class:"DescartesMenuContainer",
id:f.id});f.label=b.newHTML("canvas",{class:"DescartesMenuLabel"});f.label_ctx=f.label.getContext("2d");f.ratio=a.ratio;f.select=b.newHTML("select",{id:f.id+"_menuSelect",class:"DescartesMenuSelect",tabindex:f.tabindex});f.field=b.newHTML("input",{type:"text",id:f.id+"_menuField",class:"DescartesMenuField",tabindex:f.tabindex});d(f.options);f.containerControl.appendChild(f.label);f.containerControl.appendChild(f.select);f.visible&&f.containerControl.appendChild(f.field);f.cover=b.newHTML("div",{class:"TextfieldCover"});
f.keyboard&&f.visible&&f.containerControl.appendChild(f.cover);f.addControlContainer(f.containerControl);f.addEvents();f.init();return e};$jscomp.inherits(u,b.Control);u.prototype.init=function(c){a=this;q=a.evaluator;a.label.innerHTML=q.eval(a.name).toString();var d=a.label.textContent;a.fieldFontSize=0<q.eval(a.font_size)?q.eval(a.font_size):b.getFieldFontSize(a.h);a.text_object=new b.TextObject({parent:{decimal_symbol:a.parent.decimal_symbol},evaluator:q,decimals:a.decimals,fixed:!1,align:"left",
anchor:"center_center",width:a.parser.parse("0"),font_size:a.parser.parse(""+a.fieldFontSize),font_family:a.font_family,italics:a.italics,bold:a.bold},a.name_str);a.text_object.draw(a.label_ctx,a.label_text_color.getColor(),0,0,!0);var e=0,f=0;a.value=c?a.value:q.eval(a.valueExpr);a.idxVal=a.getIndex(a.value);for(var l=0,m=a.menuOptions.length;l<m;l++)c=b.getTextWidth(q.eval(a.menuOptions[l]).toString(),a.fieldFontSize+"px "+b.sansserif_font),c>e&&(e=c,f=l);e+=25;c=b.getTextWidth(a.formatValue(q.eval(a.strVal[f])),
a.fieldFontSize+"px "+b.sansserif_font)+7;f=a.text_object.textNodes.metrics.w+parseInt(a.fieldFontSize);""==d&&(f=0);a.visible||(c=0);for(d=a.w-c-f;d<e&&0<f;)f--,d++;for(;d<e&&0<c;)c--,d++;for(;f+d+c+1<a.w;)d++,c++;e=f;l=e+d;c=a.w-l;m=a.formatValue(q.eval(a.strVal[a.idxVal]));a.containerControl.setAttribute("style","width:"+a.w+"px;height:"+a.h+"px;left:"+a.x+"px;top:"+a.y+"px;z-index:"+a.zIndex+";");a.label.setAttribute("style","font-size:"+a.fieldFontSize+"px;width:"+f+"px;height:"+a.h+"px;line-height:"+
a.h+"px;background-color:"+a.label_color.getColor()+";color:"+a.label_text_color.getColor()+";");a.label.width=f*a.ratio;a.label.height=a.h*a.ratio;a.field.value=m;a.field.setAttribute("style","font-size:"+a.fieldFontSize+"px;width:"+c+"px;height:"+a.h+"px;left:"+l+"px;");a.cover.setAttribute("style","width:"+c+"px;height:"+a.h+"px;left:"+l+"px;");a.select.setAttribute("style","text-align:left;font-size:"+a.fieldFontSize+"px;width:"+d+"px;height:"+a.h+"px;left:"+e+"px;");a.select.selectedIndex=a.idxVal;
q.setVariable(a.id,parseFloat(m.replace(a.parent.decimal_symbol,".")));a.update()};u.prototype.update=function(){a=this;q=a.evaluator;a.activeIfValue=0<q.eval(a.activeif);a.drawIfValue=0<q.eval(a.drawif);a.field.disabled=a.activeIfValue?!1:!0;a.select.disabled=a.activeIfValue?!1:!0;a.drawIfValue?a.containerControl.style.display="block":(a.click=!1,a.containerControl.style.display="none");if(!a.parent.animation.playing||document.activeElement!=a.select){for(var b=0,c=a.menuOptions.length;b<c;b++)a.select.options[b].innerHTML=
(q.eval(a.menuOptions[b])||"").replace(/\\u002C/g,",");a.value=q.getVariable(a.id);isNaN(a.value)&&(a.value=0);a.field.value=a.formatValue(a.value);q.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);
(w=a.label_color.getColor())&&/CanvasGradient|CanvasPattern/.test(w.constructor.name)&&(a.label_ctx.fillStyle=w,a.label_ctx.fillRect(0,0,a.label_ctx.canvas.width,a.label_ctx.canvas.height));a.text_object.textNodes.metrics.w>a.label.width/a.ratio?(a.text_object.anchor="center_left",a.text_object.draw(a.label_ctx,a.label_text_color.getColor(),5,a.label.height/a.ratio/2)):(a.text_object.anchor="center_center",a.text_object.draw(a.label_ctx,a.label_text_color.getColor(),a.label.width/a.ratio/2,a.label.height/
a.ratio/2));a.label_ctx.setTransform(1,0,0,1,0,0)};u.prototype.customSplit=function(a){n=!1;c="";l=0;for(m=-1;l<a.length;){f=a.charAt(l);if("["===f&&-1===m){if(n||""!=c)c+="\u00a6";m++}else"["===f?m++:"]"===f&&0===m?(n=!0,m--):"]"==a.charAt(l)&&(m=0>m?m:m-1);c+=a.charAt(l);l++}return c.split("\u00a6")};u.prototype.getIndex=function(a){a=parseFloat(a.toString().replace(this.parent.decimal_symbol,"."));e=-1;g=Infinity;for(var b=0,c=this.strVal.length;b<c;b++)p=d(a-parseFloat(this.evaluator.eval(this.strVal[b]))),
p<=g&&(g=p,e=b);this.evaluator.setVariable(this.id+".txt",this.select.options[this.select.selectedIndex].text);return e};u.prototype.changeValue=function(b,c){a=this;a.activeIfValue&&(c&&(a.idxVal=a.getIndex(b),a.value=a.evaluator.eval(a.strVal[a.idxVal]),a.field.value=a.formatValue(a.idxVal),a.select.selectedIndex=a.idxVal),a.evaluator.setVariable(a.id,a.value),a.updateAndExecAction())};u.prototype.addEvents=function(){var a=this;a.label.addEventListener("touchstart",b.preventDefault);a.label.addEventListener("mousedown",
b.preventDefault);a.select.addEventListener("change",function(b){a.value=a.evaluator.eval(a.strVal[this.selectedIndex]);a.field.value=a.formatValue(a.value);a.evaluator.setVariable(a.id,a.field.value);a.changeValue();b.preventDefault()});a.field.addEventListener("keydown",function(b){13==b.keyCode&&(a.idxVal=a.getIndex(a.field.value),a.value=a.evaluator.eval(a.strVal[a.idxVal]),a.field.value=a.formatValue(a.idxVal),a.select.selectedIndex=a.idxVal,a.changeValue())});a.field.addEventListener("blur",
function(b){a.drawIfValue&&a.changeValue(a.field.value,!0)});a.field.addEventListener("click",function(b){a.field.focus()});a.cover.addEventListener("click",function(b){b=a.evaluator.eval(a.kbexp);a.activeIfValue&&a.parent.keyboard.show(a,a.kblayout,b[0][0]||0,b[0][1]||0,a.id,a.field,a.onlyText)})};b.Menu=u;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,d=Math.floor,h,q,e,g,p,n,c,l,m,f,w,u,x,r,v,z,y,A=function(c,d){a=d=b.Control.call(this,c,d)||this;a.label_color=a.label_color||new b.Color("e0e4e8",c.evaluator);a.label_text_color=a.label_text_color||new b.Color("000000",c.evaluator);a.name_str=a.name;/^\[.*\]$/.test(a.name)?a.name=a.parser.parse(a.name.slice(1,-1)):a.name=a.parser.parse("'"+a.name+"'");a.orientation=a.w>=a.h?"h":"v";a.container=b.newHTML("div",{class:"DescartesScrollbarContainer",
id:a.id});a.canvas=b.newHTML("canvas");a.divUp=b.newHTML("div",{class:"DescartesCatcher up"});a.divDown=b.newHTML("div",{class:"DescartesCatcher down"});a.field=b.newHTML("input",{type:"text",id:a.id+"scrollbar",class:"DescartesScrollbarField"});a.handler=b.newHTML("div",{class:"DescartesCatcher manipulator"});a.label=b.newHTML("canvas",{class:"DescartesScrollbarLabel"});a.label_ctx=a.label.getContext("2d");a.ratio=c.ratio;a.container.appendChild(a.canvas);a.container.appendChild(a.label);a.container.appendChild(a.divUp);
a.container.appendChild(a.divDown);a.container.appendChild(a.field);a.container.appendChild(a.handler);a.cover=b.newHTML("div",{class:"TextfieldCover"});a.keyboard&&a.visible&&a.container.appendChild(a.cover);a.addControlContainer(a.container);a.addEvents();a.init();return d};$jscomp.inherits(A,b.Control);A.prototype.init=function(){a=this;h=a.evaluator;0==h.eval(a.decimals)?a.incr=1:a.incr=(h.eval(a.max)-h.eval(a.min))/100;a.value=a.validateValue(h.eval(a.valueExpr));q=a.formatValue(a.value);e=a.evaluator.eval(a.expresion)[0];
a.x=e[0];a.y=e[1];4==e.length&&(a.w=e[2],a.h=e[3]);a.orientation=a.w>=a.h?"h":"v";a.initScroll(q);a.changeScrollPosition();a.prePos=a.pos;h.setVariable(a.id,a.value)};A.prototype.initScroll=function(c){a=this;h=a.evaluator;a.label.innerHTML=h.eval(a.name).toString();z=a.label.textContent;var d="v"===a.orientation?parseInt(19+5*(a.h-100)/100):a.h;a.fieldFontSize=0<h.eval(a.font_size)?h.eval(a.font_size):"v"===a.orientation?d-parseInt(a.h/20)-1:b.getFieldFontSize(d);a.text_object=new b.TextObject({parent:{decimal_symbol:a.parent.decimal_symbol},
evaluator:a.evaluator,decimals:a.decimals,fixed:!1,align:"left",anchor:"center_center",width:a.parser.parse("0"),font_size:a.parser.parse(""+a.fieldFontSize),font_family:a.font_family,italics:a.italics,bold:a.bold},a.name_str);a.text_object.draw(a.label_ctx,a.label_text_color.getColor(),0,0,!0);c=b.getTextWidth(c+"_",a.fieldFontSize+"px "+b.sansserif_font);var e=a.parent.getSpaceById(a.spaceID).h;a.labelHeight=""==z?0:d;a.fieldHeight=""==a.visible?0:d;if("v"===a.orientation)a.canvasWidth=a.w,a.canvasHeight=
a.h-a.labelHeight-a.fieldHeight,18<=a.canvasHeight+a.y-e&&(a.canvasHeight=e),d=a.fieldHeight,c=d+a.canvasHeight,a.canvasX=0,a.canvasY=a.fieldHeight,a.labelWidth=a.w,a.labelY=c,a.upWidth=a.downW=a.w,a.upHeight=a.downH=a.w,a.upX=0,a.upY=a.fieldHeight,a.downX=0,a.downY=c-a.downH,a.fieldWidth=a.w,a.fieldX=0,a.handlerW=a.w,a.handlerH=parseInt((a.canvasHeight-a.upHeight-a.downH-a.labelHeight-a.fieldHeight)/10),a.handlerH=a.canvasHeight-a.upHeight-a.downH-a.labelHeight-a.fieldHeight>2*a.w?a.w:a.handlerH,
a.handlerH=15>a.handlerH?15:a.handlerH,a.limInf=c-a.downH-a.handlerH,a.limSup=d+a.downH;else{d=a.text_object.textNodes.metrics.w+parseInt(a.fieldFontSize);a.labelWidth=d;a.fieldWidth=c;""==z&&(a.labelWidth=0);a.visible||(a.fieldWidth=0);for(d=a.w-a.fieldWidth-a.labelWidth;58>d&&0<a.labelWidth;)a.labelWidth--,d++;for(;58>d&&0<a.fieldWidth;)a.fieldWidth--,d++;c=a.labelWidth;e=c+d;a.fieldWidth=a.w-e;a.canvasWidth=d;a.canvasHeight=a.h;a.canvasX=a.labelWidth;a.canvasY=0;a.fieldX=a.canvasWidth+a.labelWidth;
a.labelHeight=a.h;a.labelY=0;a.upWidth=a.downW=a.h;a.upHeight=a.downH=a.h;a.upX=e-a.downW;a.upY=0;a.downX=a.labelWidth;a.downY=0;a.handlerW=parseInt((a.canvasWidth-a.upWidth-a.downW)/10);a.handlerW=a.canvasWidth-a.upWidth-a.downW>2*a.h?a.h:a.handlerW;a.handlerW=15>a.handlerW?15:a.handlerW;a.handlerH=a.h;a.limInf=c+a.downW;a.limSup=c+a.canvasWidth-a.downW-a.handlerW}a.container.setAttribute("style","width:"+a.w+"px;height:"+a.h+"px;left:"+a.x+"px;top:"+a.y+"px;z-index:"+a.zIndex+";");a.canvas.setAttribute("width",
a.w+"px");a.canvas.setAttribute("height",a.h+"px");a.canvas.setAttribute("style","position:absolute;left:0;top:0;");a.ctx=a.canvas.getContext("2d");a.ctx.imageSmoothingEnabled=!1;a.divUp.setAttribute("style","width:"+a.upWidth+"px;height:"+a.upHeight+"px;left:"+a.upX+"px;top:"+a.upY+"px;");a.divDown.setAttribute("style","width:"+a.downW+"px;height:"+a.downH+"px;left:"+a.downX+"px;top:"+a.downY+"px;");a.handler.setAttribute("style","width:"+a.handlerW+"px;height:"+a.handlerH+"px;left:"+("v"===a.orientation?
0:a.limInf)+"px;top:"+("v"===a.orientation?a.limInf:0)+"px;");a.field.setAttribute("style","font-size:"+a.fieldFontSize+"px;width:"+a.fieldWidth+"px;height:"+a.fieldHeight+"px;left:"+a.fieldX+"px;top:0;");a.cover.setAttribute("style","width:"+a.fieldWidth+"px;height:"+a.fieldHeight+"px;left:"+a.fieldX+"px;top:0;");0===a.fieldHeight&&(a.field.style.display="none");a.label.setAttribute("style","font-size:"+a.fieldFontSize+"px;width:"+a.labelWidth+"px;height:"+a.labelHeight+"px;line-height:"+a.labelHeight+
"px;left:0;top:"+a.labelY+"px;background-color:"+a.label_color.getColor()+";color:"+a.label_text_color.getColor()+";");a.label.width=a.labelWidth*a.ratio;a.label.height=a.labelHeight*a.ratio};A.prototype.update=function(){a=this;h=a.evaluator;0==h.eval(a.decimals)?a.incr=1:a.incr=(h.eval(a.max)-h.eval(a.min))/100;a.activeIfValue=0<h.eval(a.activeif);a.drawIfValue=0<h.eval(a.drawif);a.field.disabled=!a.activeIfValue;a.drawIfValue?(a.container.style.display="block",a.draw()):a.container.style.display=
"none";a.updatePositionAndSize();var b=a.validateValue(h.getVariable(a.id));b==a.value||0<Math.abs(b-a.value)&&1E-9>Math.abs(b-a.value)||(a.value=b,a.changeScrollPosition(),a.prePos=a.pos);a.value=b;a.field.value=a.formatValue(a.value);h.setVariable(a.id,a.value);a.label_ctx.setTransform(a.ratio,0,0,a.ratio,0,0);a.text_object.draw(a.label_ctx,a.label_text_color.getColor(),0,0);a.label_ctx.clearRect(0,0,a.label.width,a.label.height);(y=a.label_color.getColor())&&/CanvasGradient|CanvasPattern/.test(y.constructor.name)&&
(a.label_ctx.fillStyle=y,a.label_ctx.fillRect(0,0,a.label_ctx.canvas.width,a.label_ctx.canvas.height));a.text_object.textNodes.metrics.w>a.label.width/a.ratio?(a.text_object.anchor="center_left",a.text_object.draw(a.label_ctx,a.label_text_color.getColor(),5,a.label.height/a.ratio/2)):(a.text_object.anchor="center_center",a.text_object.draw(a.label_ctx,a.label_text_color.getColor(),a.label.width/a.ratio/2,a.label.height/a.ratio/2));a.label_ctx.setTransform(1,0,0,1,0,0)};A.prototype.draw=function(){a=
this;g=a.ctx;n=d(a.w);p=d(a.h);g.fillStyle=a.color.getColor();g.fillRect(0,0,n,p);g.fillStyle="black";g.beginPath();"h"===a.orientation?(g.lineWidth=1,g.strokeStyle="rgba(0,0,0,0.3)",g.strokeRect(parseInt(a.labelWidth)+.5,.5,n-1-parseInt(a.labelWidth),p-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(),l=d(a.pos),c=Math.ceil(p/10)||1,g.fillStyle=a.colorInt.getColor(),g.fillRect(l+.5,c,d(a.handlerW),p-2*c)):(g.lineWidth=1,g.strokeStyle="rgba(0,0,0,0.3)",g.strokeRect(.5,.5,n-1,p-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(),l=d(a.pos),c=Math.ceil(n/10)||1,g.fillStyle=a.colorInt.getColor(),g.fillRect(c,l+.5,n-2*c,d(a.handlerH)));a.activeIfValue||(g.fillStyle="rgba(255,255,255,0.5)",g.fillRect(0,0,g.canvas.width,g.canvas.height))};A.prototype.validateValue=
function(b){a=this;h=a.evaluator;m=b.toString();m=parseFloat(m.replace(a.parent.decimal_symbol,"."));isNaN(m)&&(m=0);a.minimo=h.eval(a.min);m<a.minimo&&(a.value=null,m=a.minimo);a.maximo=h.eval(a.max);m>a.maximo&&(a.value=null,m=a.maximo);f=a.incr;m=0!=f?m*f/f:0;a.fixed&&(m=parseFloat(parseFloat(m).toFixed(h.eval(a.decimals))));return m};A.prototype.increase=function(){this.changeValue(parseFloat(this.value)+this.incr)};A.prototype.decrease=function(){this.changeValue(parseFloat(this.value)-this.incr)};
A.prototype.increase10=function(){a=this;c=(a.evaluator.eval(a.max)-a.evaluator.eval(a.min))/10;"h"==a.orientation?a.clickPos.x>a.prePos&&a.changeValue(parseFloat(a.value)+c):a.clickPos.y<a.prePos&&a.changeValue(parseFloat(a.value)+c)};A.prototype.decrease10=function(){a=this;c=(a.evaluator.eval(a.max)-a.evaluator.eval(a.min))/10;"h"==a.orientation?a.clickPos.x<a.prePos&&a.changeValue(parseFloat(a.value)-c):a.clickPos.y>a.prePos&&a.changeValue(parseFloat(a.value)-c)};A.prototype.changeValue=function(b){a=
this;a.activeIfValue&&(w=a.validateValue(b),w!=a.value&&(a.value=w,a.field.value=a.formatValue(w),a.changeScrollPosition(),a.prePos=a.pos,a.evaluator.setVariable(a.id,a.value)),a.updateAndExecAction())};A.prototype.changeValueMovement=function(){a=this;h=a.evaluator;u=a.limInf;x=a.limSup;r=h.eval(a.min);v=h.eval(a.max);f=a.incr;w=d((a.pos-u)*(v-r)/(x-u)/f)*f+r;w!=a.value&&(a.value=w,a.field.value=a.formatValue(w),h.setVariable(a.id,a.value),a.parent.updateControls(),a.actionExec.execute(),a.parent.update())};
A.prototype.changeScrollPosition=function(){a=this;h=a.evaluator;u=a.limInf;x=a.limSup;r=h.eval(a.min);v=h.eval(a.max);f=a.incr;a.pos=(a.value-r)*(x-u)/(v-r)+u;a.handler.style["h"==a.orientation?"left":"top"]=a.pos+"px"};A.prototype.addEvents=function(){function a(c,d,e,f){b.clearTimeout(u);(n.up||n.down||n.canvasClick)&&1E-7<Math.abs(n.value-f)&&(d.call(n),c=e?c:30,u=b.setTimeout(function(){a(c,d,!1,f)},c))}function c(c){c.preventDefault();n.whichBtn=b.whichBtn(c);"L"==n.whichBtn&&n.activeIfValue&&
(n.clickPos=b.getCursorPosition(c,n.container),n.canvasClick=!0,"h"==n.orientation?n.clickPos.x<n.prePos?a(350,n.decrease10,!0,n.minimo):a(350,n.increase10,!0,n.maximo):n.clickPos.y<n.prePos?a(350,n.increase10,!0,n.maximo):a(350,n.decrease10,!0,n.minimo))}function d(a){n.canvasClick=!1;b.clearTimeout(u)}function e(a){1==n.canvasClick&&(n.clickPos=b.getCursorPosition(a,n.container),a.preventDefault())}function f(a){n.scrollClick=!1;n.prePos=n.pos;window.removeEventListener("mouseup",f,!1);window.removeEventListener("mousemove",
m,!1);a.preventDefault()}function l(a){n.scrollClick=!1;n.prePos=n.pos;window.removeEventListener("touchend",l,!1);window.removeEventListener("touchmove",m,!1);a.preventDefault()}function m(a){var c=b.getCursorPosition(a,n.container);"h"==n.orientation?(n.pos=n.prePos-(n.initPos.x-c.x),n.pos<n.limInf&&(n.pos=n.limInf),n.pos>n.limSup&&(n.pos=n.limSup),n.handler.setAttribute("style","width:"+n.handlerW+"px;height:"+n.h+"px;left:"+n.pos+"px;top:0;")):(n.pos=n.prePos-(n.initPos.y-c.y),n.pos>n.limInf&&
(n.pos=n.limInf),n.pos<n.limSup&&(n.pos=n.limSup),n.handler.setAttribute("style","width:"+n.w+"px;height:"+n.handlerH+"px;left:0;top:"+n.pos+"px;"));n.changeValueMovement();a.preventDefault()}function g(c){c.preventDefault();n.whichBtn=b.whichBtn(c);"L"==n.whichBtn&&n.activeIfValue&&(n.up=!0,a(350,n.increase,!0,n.maximo))}function h(c){c.preventDefault();n.whichBtn=b.whichBtn(c);"L"==n.whichBtn&&n.activeIfValue&&(n.down=!0,a(350,n.decrease,!0,n.minimo))}function p(a){n.down=!1;b.clearTimeout(u);a.preventDefault()}
function q(a){n.up=!1;b.clearTimeout(u);n.draw()}function r(a){n.down=!1;b.clearTimeout(u);n.draw()}var n=this,u;n.field.addEventListener("keydown",function(a){13==a.keyCode&&n.changeValue(n.field.value)});n.field.addEventListener("blur",function(a){n.drawIfValue&&n.changeValue(n.field.value,!0)});n.canvas.addEventListener("touchstart",c);n.canvas.addEventListener("mousedown",c);n.divDown.addEventListener("mouseout",p);window.addEventListener("touchend",d);window.addEventListener("mouseup",d);n.canvas.addEventListener("touchmove",
e);n.canvas.addEventListener("mousemove",e);n.handler.addEventListener("touchstart",function(a){n.activeIfValue&&(n.scrollClick=!0,n.initPos=b.getCursorPosition(a,n.container),window.addEventListener("touchend",l),window.addEventListener("touchmove",m),a.preventDefault())});n.handler.addEventListener("mousedown",function(a){n.activeIfValue&&(n.scrollClick=!0,n.initPos=b.getCursorPosition(a,n.container),window.addEventListener("mouseup",f),window.addEventListener("mousemove",m),a.preventDefault())});
n.divUp.addEventListener("touchstart",g);n.divUp.addEventListener("mousedown",g);n.divDown.addEventListener("touchstart",h);n.divDown.addEventListener("mousedown",h);n.divUp.addEventListener("mouseout",function(a){n.up=!1;b.clearTimeout(u);a.preventDefault()});n.divDown.addEventListener("mouseout",p);window.addEventListener("touchend",q);window.addEventListener("mouseup",q);window.addEventListener("touchend",r);window.addEventListener("mouseup",r);n.cover.addEventListener("click",function(a){a=n.evaluator.eval(n.kbexp);
n.activeIfValue&&n.parent.keyboard.show(n,n.kblayout,a[0][0]||0,a[0][1]||0,n.id,n.field,n.onlyText)})};b.Scrollbar=A;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,d=Math.floor,h,q,e,g,p,n,c,l,m,f,w=function(c,d){a=d=b.Control.call(this,c,d)||this;a.label_color=a.label_color||new b.Color("e0e4e8",c.evaluator);a.label_text_color=a.label_text_color||new b.Color("000000",c.evaluator);a.name_str=a.name;/^\[.*\]$/.test(a.name)?a.name=a.parser.parse(a.name.slice(1,-1)):a.name=a.parser.parse("'"+a.name+"'");a.orientation=a.w>=a.h?"h":"v";a.container=b.newHTML("div",{class:"DescartesSliderContainer",id:a.id});a.field=
b.newHTML("input",{type:"text",id:a.id+"slider",class:"DescartesSliderField"});a.sliderCtr=b.newHTML("input",{type:"range",id:a.id+"range",min:0,max:100,step:"any",class:"DescartesRange"});a.label=b.newHTML("canvas",{class:"DescartesSliderLabel"});a.label_ctx=a.label.getContext("2d");a.ratio=c.ratio;a.container.appendChild(a.label);a.container.appendChild(a.field);a.container.appendChild(a.sliderCtr);a.cover=b.newHTML("div",{class:"TextfieldCover"});a.keyboard&&a.visible&&a.container.appendChild(a.cover);
a.addControlContainer(a.container);a.addEvents();a.init();return d};$jscomp.inherits(w,b.Control);w.prototype.init=function(){a=this;h=a.evaluator;a.value=a.validateValue(h.eval(a.valueExpr));q=a.formatValue(a.value);e=a.evaluator.eval(a.expresion)[0];a.x=e[0];a.y=e[1];4==e.length&&(a.w=e[2],a.h=e[3]);a.orientation=a.w>=a.h?"h":"v";a.initSlider(q);a.changeSliderPosition();a.prePos=a.pos;h.setVariable(a.id,a.value)};w.prototype.initSlider=function(c){a=this;h=a.evaluator;a.label.innerHTML=h.eval(a.name).toString();
m=a.label.textContent;var d="v"===a.orientation?parseInt(19+5*(a.h-100)/100):a.h;a.fieldFontSize=0<h.eval(a.font_size)?h.eval(a.font_size):"v"===a.orientation?d-parseInt(a.h/20)-1:b.getFieldFontSize(d);a.text_object=new b.TextObject({parent:{decimal_symbol:a.parent.decimal_symbol},evaluator:h,decimals:a.decimals,fixed:!1,align:"left",anchor:"center_center",width:a.parser.parse("0"),font_size:a.parser.parse(""+a.fieldFontSize),font_family:a.font_family,italics:a.italics,bold:a.bold},a.name_str);a.text_object.draw(a.label_ctx,
a.label_text_color.getColor(),0,0,!0);c=b.getTextWidth(c+"_",a.fieldFontSize+"px "+b.sansserif_font);var e=a.parent.getSpaceById(a.spaceID).h;a.labelHeight=""==m?0:d;a.fieldHeight=""==a.visible?0:d;if("v"===a.orientation)a.canvasWidth=a.w,a.canvasHeight=a.h-a.labelHeight-a.fieldHeight,18<=a.canvasHeight+a.y-e&&(a.canvasHeight=e),d=a.fieldHeight+a.canvasHeight,a.canvasX=0,a.canvasY=a.fieldHeight,a.labelWidth=a.w,a.labelY=d,a.upWidth=a.downW=a.w,a.upHeight=a.downH=a.w,a.fieldWidth=a.w,a.fieldX=0,a.sliderCtr.style=
"position:absolute;left:0;top:"+a.canvasY+"px;width:"+a.canvasHeight+"px;height:"+a.canvasWidth+"px;transform-origin:"+a.canvasWidth/2+"px "+a.canvasWidth/2+"px;transform:rotate(90deg);margin:0;padding:0;--thumb_size:"+a.canvasWidth+"px;--track_h:"+parseInt(a.canvasWidth/3)+"px;";else{d=a.text_object.textNodes.metrics.w+parseInt(a.fieldFontSize);a.labelWidth=d;a.fieldWidth=c;""==m&&(a.labelWidth=0);a.visible||(a.fieldWidth=0);for(d=a.w-a.fieldWidth-a.labelWidth;58>d&&0<a.labelWidth;)a.labelWidth--,
d++;for(;58>d&&0<a.fieldWidth;)a.fieldWidth--,d++;a.fieldWidth=a.w-(a.labelWidth+d);a.canvasWidth=d;a.canvasHeight=a.h;a.canvasX=a.labelWidth;a.canvasY=0;a.fieldX=a.canvasWidth+a.labelWidth;a.labelHeight=a.h;a.labelY=0;a.upWidth=a.downW=a.h;a.upHeight=a.downH=a.h;a.sliderCtr.style="position:absolute;left:"+a.canvasX+"px;top:0;width:"+a.canvasWidth+"px;height:"+a.canvasHeight+"px;margin:0;padding:0;--thumb_size:"+a.canvasHeight+"px;--track_h:"+parseInt(a.canvasHeight/3)+"px;"}a.container.setAttribute("style",
"width:"+a.w+"px;height:"+a.h+"px;left:"+a.x+"px;top:"+a.y+"px;z-index:"+a.zIndex+";");a.field.setAttribute("style","font-size:"+a.fieldFontSize+"px;width:"+a.fieldWidth+"px;height:"+a.fieldHeight+"px;left:"+a.fieldX+"px;top:0;");a.cover.setAttribute("style","width:"+a.fieldWidth+"px;height:"+a.fieldHeight+"px;left:"+a.fieldX+"px;top:0;");0===a.fieldHeight&&(a.field.style.display="none");a.label.setAttribute("style","font-size:"+a.fieldFontSize+"px;width:"+a.labelWidth+"px;height:"+a.labelHeight+
"px;line-height:"+a.labelHeight+"px;left:0;top:"+a.labelY+"px;background-color:"+a.label_color.getColor()+";color:"+a.label_text_color.getColor()+";");a.label.width=a.labelWidth*a.ratio;a.label.height=a.labelHeight*a.ratio};w.prototype.update=function(){a=this;h=a.evaluator;a.activeIfValue=0<h.eval(a.activeif);a.drawIfValue=0<h.eval(a.drawif);a.field.disabled=!a.activeIfValue;a.drawIfValue?(a.container.style.display="block",a.draw()):a.container.style.display="none";a.updatePositionAndSize();var b=
a.validateValue(h.getVariable(a.id));b==a.value||0<Math.abs(b-a.value)&&1E-9>Math.abs(b-a.value)||(a.value=b,a.changeSliderPosition(),a.prePos=a.pos);a.value=b;a.field.value=a.formatValue(a.value);h.setVariable(a.id,a.value);a.label_ctx.setTransform(a.ratio,0,0,a.ratio,0,0);a.text_object.draw(a.label_ctx,a.label_text_color.getColor(),0,0);a.label_ctx.clearRect(0,0,a.label.width,a.label.height);(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)};w.prototype.draw=function(){a=this;a.sliderCtr.style.setProperty("--track_color",
a.color.getColor());a.sliderCtr.style.setProperty("--thumb_color",a.colorInt.getColor());a.sliderCtr.value=a.pos};w.prototype.validateValue=function(b){a=this;h=a.evaluator;g=b.toString();g=parseFloat(g.replace(a.parent.decimal_symbol,"."));isNaN(g)&&(g=0);a.minimo=h.eval(a.min);g<a.minimo&&(a.value=null,g=a.minimo);a.maximo=h.eval(a.max);g>a.maximo&&(a.value=null,g=a.maximo);p=h.eval(a.incr);g=0!=p?g*p/p:0;a.fixed&&(g=parseFloat(parseFloat(g).toFixed(h.eval(a.decimals))));return g};w.prototype.changeValue=
function(b){a=this;a.activeIfValue&&(n=a.validateValue(b),n!=a.value&&(a.value=n,a.field.value=a.formatValue(n),a.changeSliderPosition(),a.prePos=a.pos,a.evaluator.setVariable(a.id,a.value)),a.updateAndExecAction())};w.prototype.changeValueForSliderMovement=function(){a=this;h=a.evaluator;c=h.eval(a.min);l=h.eval(a.max);p=h.eval(a.incr);n=d(a.pos*(l-c)/100/p)*p+c;n!=a.value&&(a.value=n,a.field.value=a.formatValue(n),h.setVariable(a.id,a.value),a.parent.updateControls(),a.actionExec.execute(),a.parent.update())};
w.prototype.changeSliderPosition=function(){h=this.evaluator;c=h.eval(this.min);l=h.eval(this.max);p=h.eval(this.incr);this.pos=100*(this.value-c)/(l-c)};w.prototype.addEvents=function(){var a=this;a.field.addEventListener("keydown",function(b){13==b.keyCode&&a.changeValue(a.field.value)});a.field.addEventListener("blur",function(b){a.drawIfValue&&a.changeValue(a.field.value,!0)});a.cover.addEventListener("click",function(b){b=a.evaluator.eval(a.kbexp);a.activeIfValue&&a.parent.keyboard.show(a,a.kblayout,
b[0][0]||0,b[0][1]||0,a.id,a.field,a.onlyText)});a.sliderCtr.addEventListener("input",function(b){a.pos=b.target.value;a.changeValueForSliderMovement()})};b.Slider=w;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,d,h,q=function(a,d){var e=b.Control.call(this,a,d)||this;e.controls=d.controls||!0;e.file=d.file||"";e.oldDrawIf=0;a=e.evaluator.eval(e.expresion);d=4==a[0].length;e.w=d?a[0][2]:200;e.h=d?a[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(n){}return 0});e.evaluator.setFunction(e.id+".pause",function(){try{e.audio.pause()}catch(n){}return 0});e.evaluator.setFunction(e.id+".stop",function(){try{e.audio.pause(),e.audio.currentTime=0}catch(n){}return 0});e.evaluator.setFunction(e.id+
".currentTime",function(a){try{e.audio.currentTime=parseFloat(a)}catch(c){}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)});return e};$jscomp.inherits(q,b.Control);q.prototype.init=function(){this.audio.style.left=this.x+"px";this.audio.style.top=this.y+"px";this.update()};q.prototype.update=function(){a=
this.evaluator;"string"!==typeof this.file&&(d=a.eval(this.file),this.old!==d&&(this.audio.src=this.old=d));h=0<a.eval(this.drawif);this.audio.style.display=h?"block":"none";h||h===this.oldDIF||this.audio.pause();this.oldDIF=h;this.updatePositionAndSize()};b.Audio=q;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,d,h,q=function(e,g){a=e=b.Control.call(this,e,g)||this;a.controls=g.controls||!0;a.file=g.file||"";a.oldDrawIf=0;d=a.evaluator;g=d.eval(a.expresion)[0];4==g.length?(a.w=g[2],a.h=g[3]):(a.w=null,a.h=null);g=a.file;var h=g.lastIndexOf(".");-1!=h&&(g=a.file.substring(0,h));a.video=b.newHTML("video",{poster:g+".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")&&(h=b.newHTML("source",{src:g+".mp4",type:"video/mp4"}),a.video.appendChild(h));a.video.canPlayType("video/ogg")&&(h=b.newHTML("source",{src:g+".ogg",type:"video/ogg"}),a.video.appendChild(h),h=b.newHTML("source",{src:g+".ogv",type:"video/ogg"}),a.video.appendChild(h));a.video.canPlayType("video/webm")&&
(h=b.newHTML("source",{src:g+".webm",type:"video/webm"}),a.video.appendChild(h));a.addControlContainer(a.video);d.setFunction(a.id+".play",function(){try{a.video.play()}catch(n){}return 0});d.setFunction(a.id+".pause",function(){try{a.video.pause()}catch(n){}return 0});d.setFunction(a.id+".stop",function(){try{a.video.pause(),a.video.currentTime=0}catch(n){}return 0});d.setFunction(a.id+".currentTime",function(b){try{a.video.currentTime=parseFloat(b)}catch(c){}return 0});a.video.addEventListener("timeupdate",
function(b){d.setVariable(a.id+".currentTime",a.video.currentTime)});return e};$jscomp.inherits(q,b.Control);q.prototype.init=function(){this.video.style.left=this.x+"px";this.video.style.top=this.y+"px";this.update()};q.prototype.update=function(){a=this;d=a.evaluator;(h=0<d.eval(a.drawif))?a.video.style.display="block":(a.video.style.display="none",h!==a.oldDrawIf&&a.video.pause());a.oldDrawIf=h;a.updatePositionAndSize()};b.Video=q;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,d,h,q,e=function(d,e){var g;a=g=b.Control.call(this,d,e)||this;a.font_family=e.font_family||"sansserif";a.style=e.style||",PLAIN,";a.font_size=e.font_size||12;typeof("number"!==a.font_size)&&(a.font_size=a.evaluator.eval(a.font_size));a.font=a.font_family+a.style+a.font_size;a.evaluator.setVariable(a.id+"._scroll_x",0);a.evaluator.setVariable(a.id+"._scroll_y",0);a.region="interior";a.tabindex=++d.tabindex;a.answer&&(/^krypto_/.test(a.answer)&&(a.answer=
(new b.Krypto).decode(a.answer.substring(7))),a.parent.lessonParser.parseText(a.answer));a.containerControl=b.newHTML("div",{class:"DescartesTextAreaContainer",id:a.id,spellcheck:"false"});a.textArea=b.newHTML("textarea",{class:"DescartesTextArea",spellcheck:"false"});a.textAreaAnswer=b.newHTML("div",{class:"DescartesTextArea"});a.showButton=b.newHTML("div",{class:"DJS_Gradient"});a.containerControl.appendChild(a.textArea);a.containerControl.appendChild(a.textAreaAnswer);a.containerControl.appendChild(a.showButton);
a.cover=b.newHTML("div",{class:"TextfieldCover"});a.keyboard&&a.containerControl.appendChild(a.cover);a.addControlContainer(a.containerControl);a.showAnswer=!1;a.text=a.rawText||"";a.evaluator.setVariable(a.id,a.text);var c;a.evaluator.setFunction(a.id+".insertAtCursor",function(b){c=a.textArea.selectionStart+b.length;a.textArea.value=a.textArea.value.substring(0,a.textArea.selectionStart)+b+a.textArea.value.substring(a.textArea.selectionEnd);a.textArea.selectionStart=a.textArea.selectionEnd=c;a.textArea.focus();
return 0});a.evaluator.setFunction(a.id+".update",function(){a.update()});a.evaluator.setFunction(a.id+".scrollTo",function(b){a.textArea.scrollTop=b});a.addEvents();a.init();return g};$jscomp.inherits(e,b.Control);e.prototype.init=function(){a=this;h=a.answer?30:7;d=a.evaluator;var e=a.text.replace(/\\n/g,"\n");a.containerControl.setAttribute("style","width:"+a.w+"px;height:"+a.h+"px;left:"+a.x+"px;top:"+a.y+"px;z-index:"+a.zIndex+";");var q="width:"+(a.w-6)+"px;height:"+(a.h-h)+"px;font:"+b.convertFont(a.font)+
";line-height:"+a.font_size+"px;";a.textArea.setAttribute("style",q);a.textArea.value=e;a.textAreaAnswer.setAttribute("style",q+"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()};e.prototype.update=function(){a=this;d=a.evaluator;a.activeIfValue=0<d.eval(a.activeif);a.drawIfValue=0<d.eval(a.drawif);d.getVariable(a.id)!==a.oldValue&&(a.textArea.value=(d.getVariable(a.id)||"").replace(/\\n/g,"\n"));q=a.textArea.value||"";q="\n"===q.charAt(q.length-1)?q.substring(0,q.length-1):q;q=q.replace(/\n/g,"\\n").replace(/\s/g," ");d.setVariable(a.id,
q);a.oldFieldValue=q;a.oldValue=d.getVariable(a.id);a.activeIfValue?a.textArea.removeAttribute("disabled"):a.textArea.setAttribute("disabled",!0);a.containerControl.style.display=a.drawIfValue?"block":"none";a.textArea.style["overflow-x"]=0<d.getVariable(a.id+"._scroll_x")?"auto":"unset";a.textArea.style["overflow-y"]=0<d.getVariable(a.id+"._scroll_y")?"auto":"unset";a.updatePositionAndSize()};e.prototype.changeValue=function(a){this.textArea.value=a;this.update()};e.prototype.addEvents=function(){var a=
this;a.showButton.addEventListener("mousedown",function(b){b.preventDefault();a.showAnswer=!a.showAnswer;a.textAreaAnswer.style.display=a.showAnswer?"block":"none";a.showButton.childNodes[0].childNodes[0].textContent=a.showAnswer?"T":"S";a.textArea.blur()});a.showButton.onmouseup=a.showButton.onmouseout=function(a){a.preventDefault()};a.textArea.addEventListener("blur",function(){a.cursorInd=window.getSelection().focusOffset});a.textArea.addEventListener("paste",function(a){a.preventDefault();document.execCommand("insertHTML",
!1,a.clipboardData.getData("text/plain").replace(/\n/g,"<br>"))});a.textArea.addEventListener("keydown",function(a){if("PageDown"===a.key||"PageUp"===a.key)a.stopPropagation(),a.preventDefault()});a.cover.addEventListener("pointerdown",function(b){b=a.evaluator.eval(a.kbexp);a.activeIfValue&&a.parent.keyboard.show(a,a.kblayout,b[0][0]||0,b[0][1]||0,a.id,a.textArea,!0)})};b.TextArea=e;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,d=2*Math.PI,h,q,e,g,p,n,c,l,m,f,w,u,x=function(c,d){var e=b.Control.call(this,c,d)||this;q=c.evaluator.parser;a=e;a.spaceID=d.spaceID||"";a.text=d.text||"";a.size=d.size||q.parse("4");a.font=d.font||"Serif,PLAIN,12";a.image=new Image;a.image.onload=function(){this.ready=1};a.imageSrc=d.imageSrc||"";/^\[.*\]$/.test(a.imageSrc)?a.imageSrc=a.parser.parse(a.imageSrc.slice(1,-1)):a.imageSrc=a.parser.parse("'"+a.imageSrc+"'");a.font=b.convertFont(a.font);
if(a.constraintExpr){a.constraint=q.parse(a.constraintExpr);"(expr)"==a.constraint.type&&(a.constraint=q.parse(a.constraintExpr.substring(1,a.constraintExpr.length-1)));if("compOperator"==a.constraint.type){d=a.constraint.childs[0];var l=a.constraint.childs[1];"identifier"!=d.type||"y"!=d.value||l.contains("y")?"identifier"!=d.type||"x"!=d.value||l.contains("x")?a.newt=new b.R2Newton(a.evaluator,a.constraint):(a.constVar="y",a.noConstVar="x",a.evalConst=a.evalConstXoY,a.constraint=l):(a.constVar=
"x",a.noConstVar="y",a.evalConst=a.evalConstXoY,a.constraint=l)}else a.constraint=null;f=new b.R2(0,0)}a.container=a.getContainer();a.mouseCatcher=b.newHTML("div",{class:"DescartesGraphicControl",id:a.id,dragged:!0,tabindex:"-1",style:"z-index:"+a.zIndex+";"});a.ctx=a.space.ctx;a.container.appendChild(a.mouseCatcher);a.addEvents();a.xStr=a.id+".x";a.yStr=a.id+".y";a.activoStr=a.id+".activo";a.activeStr=a.id+".active";c=""!==a.space.id&&2!==c.version?a.space.id+".":"";a.mX=c+"mouse_x";a.mY=c+"mouse_y";
a.mClicked=c+"mouse_clicked";a.mClicIzq=c+"clic_izquierdo";a.init();return e};$jscomp.inherits(x,b.Control);x.prototype.init=function(c){a=this;h=a.evaluator;w=b.hasTouchSupport;c||(c=h.eval(a.expresion)[0],a.x=c[0],a.y=c[1],h.setVariable(a.xStr,a.x),h.setVariable(a.yStr,a.y));a.img_src_eval=h.eval(a.imageSrc).toString().trim();""==a.img_src_eval||/vacio.gif$/i.test(a.img_src_eval)?(a.width=2*h.eval(a.size),a.height=2*h.eval(a.size),a._w=w&&48>a.width?48:a.width,a._h=w&&48>a.height?48:a.height,a.mouseCatcher.style.borderRadius=
parseInt(Math.min(a._w,a._h)/2)+"px"):(a.image=a.parent.getImage(a.img_src_eval),a.width=a.image.width,a.height=a.image.height,a._w=Math.max(a.width,32),a._h=Math.max(a.height,32));a.mouseCatcher.style.width=a._w+"px";a.mouseCatcher.style.height=a._h+"px";a.mouseCatcher.style.left=parseInt(a.space.getAbsoluteX(a.x)-a._w/2)+"px";a.mouseCatcher.style.top=parseInt(a.space.getAbsoluteY(a.y)-a._h/2)+"px";h.setVariable(a.activoStr,0);h.setVariable(a.activeStr,0);a.setImage=!1;a.update()};x.prototype.update=
function(){a=this;h=a.evaluator;h.eval(a.imageSrc).toString().trim()!==a.img_src_eval&&a.init(!0);a.activeIfValue=0<h.eval(a.activeif);a.drawIfValue=0<h.eval(a.drawif);a.x=h.getVariable(a.xStr);a.y=h.getVariable(a.yStr);e=a.space.getAbsoluteX(a.x);g=a.space.getAbsoluteY(a.y);a.mouseCatcher.style.display=a.activeIfValue?"block":"none";a.mouseCatcher.style.left=parseInt(e-a._w/2)+"px";a.mouseCatcher.style.top=parseInt(g-a._h/2)+"px";a.constraint&&a.evalConst();a.draw()};x.prototype.draw=function(){a=
this;h=a.evaluator;a.drawIfValue&&(l=a.ctx,m=a.space.backgroundCtx,e=parseInt(a.space.getAbsoluteX(this.x))+.5,g=parseInt(a.space.getAbsoluteY(this.y))+.5,""!=a.text&&a.drawText(e,g),a.image.ready?(p=a.image.width/2,n=a.image.height/2,a.image.complete&&!a.setImage&&l.drawImage(a.image,parseInt(e-p),parseInt(g-n)),a.trace&&(m.save(),m.translate(e,g),m.scale(parseInt(p),parseInt(n)),m.beginPath(),m.arc(0,0,1,0,d),m.restore(),m.lineWidth=1,m.strokeStyle=a.trace.getColor(),m.stroke())):(p=parseInt(a.width/
2),l.beginPath(),l.arc(e,g,p,0,d),l.fillStyle=a.colorInt.getColor(),l.fill(),l.lineWidth=1,l.strokeStyle=a.color.getColor(),l.stroke(),a.active&&(l.strokeStyle=a.colorInt.borderColor(),l.beginPath(),l.arc(e,g,p-2,0,d),l.stroke()),a.trace&&(m.strokeStyle=a.trace.getColor(),m.beginPath(),m.arc(e,g,p,0,d),m.stroke())))};x.prototype.evalConst=function(){f.set(this.x,this.y);c=this.newt.findZero(f,1/this.space.scale,!0);this.x=c.x;this.y=c.y;this.evaluator.setVariable(this.xStr,this.x);this.evaluator.setVariable(this.yStr,
this.y)};x.prototype.evalConstXoY=function(){h=this.evaluator;u=h.getVariable(this.constVar);h.setVariable(this.constVar,this[this.constVar]);this[this.noConstVar]=h.eval(this.constraint);h.setVariable(this.xStr,this.x);h.setVariable(this.yStr,this.y);h.setVariable(this.constVar,u)};x.prototype.drawText=function(b,c){a=this;h=a.evaluator;l=a.ctx;l.fillStyle=a.color.getColor();l.textBaseline="alphabetic";"simpleText"==a.text.type?(l.font=a.font,l.fillText(a.text.toString(h.eval(a.decimals),a.fixed),
parseInt(b+1+a.width/2),parseInt(c-1-a.height/2))):(l.strokeStyle=a.color.getColor(),a.text.draw(l,parseInt(b+1+a.width/2),parseInt(c-1-a.height/2),a.decimals,a.fixed,"start",!0,a.color.getColor()))};x.prototype.getContainer=function(){for(var a=this.parent.spaces,b=$jscomp.makeIterator(a),c=b.next();!c.done;c=b.next())if(c=c.value,c.id==this.spaceID)return c.addCtr(this),this.zIndex=c.zIndex,this.space=c,c.graphicControlContainer;a[0].addCtr(this);this.zIndex=a[0].zIndex;this.space=a[0];return a[0].graphicControlContainer};
x.prototype.deactivate=function(){this.active=!1;this.evaluator.setVariable(this.activoStr,0);this.evaluator.setVariable(this.activeStr,0);this.evaluator.setVariable(this.mClicIzq,0)};x.prototype.addEvents=function(){function a(a){document.body.focus();a.preventDefault();l.whichBtn=b.whichBtn(a);"L"==l.whichBtn&&l.activeIfValue&&(l.parent.deactivateControls(),l.click=l.active=!0,l.evaluator.setVariable(l.activoStr,1),l.evaluator.setVariable(l.activeStr,1),l.evaluator.setVariable(l.mClicked,0),l.evaluator.setVariable(l.mClicIzq,
0),l.posAnte=b.getCursorPosition(a,l.container),l.prePos={x:l.space.getAbsoluteX(l.x),y:l.space.getAbsoluteY(l.y)},l.evaluator.setVariable(l.mX,l.space.getRelativeX(l.posAnte.x)),l.evaluator.setVariable(l.mY,l.space.getRelativeY(l.posAnte.y)),l.parent.update(),window.addEventListener("touchend",c),window.addEventListener("touchmove",d),window.addEventListener("mouseup",c),window.addEventListener("mousemove",d))}function c(a){document.body.focus();a.preventDefault();a.stopPropagation();l.evaluator.setVariable(l.mClicked,
1);l.evaluator.setVariable(l.mClicIzq,1);if(l.activeIfValue||l.active)l.click=!1,window.removeEventListener("mouseup",c),window.removeEventListener("mousemove",d),window.removeEventListener("touchend",c),window.removeEventListener("touchmove",d),f=b.getCursorPosition(a,l.container)||f,l.posX=l.prePos.x-(l.posAnte.x-f.x),l.posY=l.prePos.y-(l.posAnte.y-f.y),l.evaluator.setVariable(l.xStr,l.space.getRelativeX(l.posX)),l.evaluator.setVariable(l.yStr,l.space.getRelativeY(l.posY)),l.evaluator.setVariable(l.mX,
l.space.getRelativeX(f.x)),l.evaluator.setVariable(l.mY,l.space.getRelativeY(f.y)),l.parent.updateControls(),l.parent.update(),l.mouseCatcher.style.left=l.space.getAbsoluteX(l.x)-l._w/2+"px",l.mouseCatcher.style.top=l.space.getAbsoluteY(l.y)-l._h/2+"px";a=l.evaluator.getVariable(l.activeStr);l.parent.deactivateControls();l.parent.updateControls();l.evaluator.setVariable(l.activoStr,a);l.evaluator.setVariable(l.activeStr,a);l.parent.update()}function d(a){a.preventDefault();l.evaluator.setVariable(l.mClicked,
0);l.evaluator.setVariable(l.mClicIzq,0);f=b.getCursorPosition(a,l.container);l.posX=l.prePos.x-(l.posAnte.x-f.x);l.posY=l.prePos.y-(l.posAnte.y-f.y);l.evaluator.setVariable(l.xStr,l.space.getRelativeX(l.posX));l.evaluator.setVariable(l.yStr,l.space.getRelativeY(l.posY));l.evaluator.setVariable(l.mX,l.space.getRelativeX(f.x));l.evaluator.setVariable(l.mY,l.space.getRelativeY(f.y));80<Date.now()-e&&(l.parent.updateControls(),l.parent.update(),e=Date.now())}var e=0,f,l=this;l.click=!1;l.over=!1;l.active=
!1;l.mouseCatcher.addEventListener("touchstart",a);l.mouseCatcher.addEventListener("mousedown",a);l.mouseCatcher.addEventListener("mouseover",function(a){l.over=!0});l.mouseCatcher.addEventListener("mouseout",function(a){l.over=!1;l.click=!1})};b.GraphicControl=x;return b}(descartesJS||{});
descartesJS=function(b,a){function d(a){return a?a[0].toUpperCase()+a.substring(1):""}if(b.loadLib)return b;var h=/[\w-//]*(\.png|\.jpg|\.gif|\.svg|\.webp)/gi,q,e,g,p,n,c,l,m,f,w,u,x,r,v,z,y,A=function(a){this.parent=a;this.parser=a.evaluator.parser;this.RTFparser=new b.RTFParser(a.evaluator)};A.prototype.parseButtonsConfig=function(b){var c={rowsNorth:0,rowsSouth:0,widthEast:125,widthWest:125,height:23};b=this.split(b);for(var d=0,f=b.length;d<f;d++)switch(g=b[d][0],p=b[d][1],e=a[g],e){case "rowsNorth":case "rowsSouth":case "widthEast":case "widthWest":case "height":c[e]=
parseInt(p);break;case "about":case "config":case "init":case "clear":c[e]="true"===a[p];break;default:console.warn("Propiedad de botones no identificada: <"+g+"> valor: <"+p+">")}return c};A.prototype.parseSpace=function(c){n={};c=this.split(c);for(var d=0,f=c.length;d<f;d++)switch(g=c[d][0],p=c[d][1],e=a[g],b.DEBUG.paramName=g,b.DEBUG.objectName="Space",e){case "info":break;case "type":if("R2"===p||"R3"===p)p=a[p];n[e]=p;break;case "id":b.DEBUG.idName=p;case "x_axis":case "y_axis":case "cID":case "file":case "border_width":case "border_radius":n[e]=
p;break;case "fixed":case "numbers":case "sensitive_to_mouse_movements":case "3D":case "split":case "resizable":n[e]="true"===a[p];break;case "bg_display":case "render":n[e]=a[p];break;case "border_color":case "net":case "net10":case "axes":case "text":n[e]="";""!=p&&(n[e]="false"===a[p]?"":new b.Color(p,this.parent.evaluator));break;case "O.x":n.OxExpr=p;break;case "O.y":n.OyExpr=p;break;case "image":n.imageSrc=p;break;case "x":case "y":q=p.trim();var l="x"===e?this.parent.container.width:this.parent.container.height;
"%"===q[q.length-1]?(n[e+"PercentExpr"]=q,q=(l*parseFloat(q)/100).toString()):q=p.trim();n[e+"Expr"]=this.parser.parse(q);break;case "width":case "height":q=p.trim();n[e[0]+"ModExpr"]=q;"%"===q[q.length-1]?(n[e[0]+"Expr"]=q,q=this.parent.container[e]*parseFloat(q)/100):(q=parseFloat(p),q!=p&&(q=this.parent.container[e],n["_"+e[0]+"_"]=p.trim()));n[e[0]]=q;break;case "drawif":""!=p&&(n[e]=this.parser.parse(p));break;case "scale":q=parseFloat(p);isNaN(q)&&(q=48);n[e]=q;break;case "background":n[e]=
new b.Color(p,this.parent.evaluator);break;default:console.warn("Propiedad del espacio no identificada: <"+g+"> valor: <"+p+">")}return new b["Space"+n.type](this.parent,n)};A.prototype.parseControl=function(f){c={type:"Numeric",gui:"Spinner"};f=this.split(f);for(var l=0,m=f.length;l<m;l++)switch(g=f[l][0],p=f[l][1],e=a[g],b.DEBUG.paramName=g,b.DEBUG.objectName="Control",e){case "info":break;case "type":q=a[p.trim()];"graphic"===q?q="GraphicControl":"text"===q&&(q="TextArea");c[e]=d(q);break;case "gui":q=
a[p];"textfield"===q&&(q="TextField");c[e]=d(q);break;case "id":b.DEBUG.idName=p;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":c[e]=p;break;case "region":case "position":case "action":case "msg_pos":case "poster":case "text_align":case "image_align":case "btn_pos":c[e]=a[p];break;case "fixed":case "visible":case "discrete":case "onlyText":case "evaluate":case "autoplay":case "loop":case "controls":case "flat":case "keyboard":c[e]=
"true"===a[p];break;case "color":case "colorInt":case "label_color":case "label_text_color":case "trace":c[e]=new b.Color(p,this.parent.evaluator);break;case "font_size":case "drawif":case "activeif":case "decimals":case "min":case "max":case "size":""!==p&&(c[e]=this.parser.parse(p));break;case "constraint":c.constraintExpr=p;break;case "image":c.imageSrc=p;break;case "image_dec":c.image_dec_src=p;break;case "image_inc":c.image_inc_src=p;break;case "space":c.spaceID=p;break;case "expresion":case "kbexp":c[e]=
this.parser.parse(p.replace(")(",","));break;case "borderColor":c[e]="false"===a[p]?"":p;break;case "bold":case "italics":"false"!=a[p]&&(c[e]=e);break;case "underlined":"false"!=a[p]&&(c.underlined=!0);break;case "value":var h=p.replace(/&squot;/g,"'").replace(/^\|(.*)\|$/,"'$1'");c.valueExpr=this.parser.parse(h);c.valueExprString=h;break;case "incr":0!=p&&(c[e]=this.parser.parse(p));break;case "exponentialif":c[e]=parseFloat(p);break;case "text":c.rawText=p;h=this.parseText(p);for(var n=0,r=h.length;n<
r;n++)h[n]=this.parser.parse(h[n],!1);c[e]=h;break;default:h=g.indexOf("."),n=a[g.substring(0,h)],"font"===a[g.substring(h+1)]&&/parameter|Explanation|tooltip/.test(n)?c[n+"Font"]=p:console.warn("Propiedad de control no identificada: <"+g+"> valor: <"+p+">")}return new b["Numeric"===c.type?c.gui:c.type](this.parent,c)};A.prototype.parseGraphic=function(c,f,m,q){l={rotateExp:q,parameter:"t"};c=this.split(c);q=0;for(var n=c.length;q<n;q++)if(g=c[q][0],p=c[q][1],e=a[g],b.DEBUG.paramName=g,b.DEBUG.objectName=
"Graphic",""!=p)switch(e){case "info":break;case "type":b.DEBUG.idName=p;l[e]=d(a[p]);break;case "align":case "anchor":case "lineDash":l[e]=a[p];break;case "background":case "abs_coord":case "visible":case "editable":case "fixed":case "vectors":case "bold":case "italics":case "underlined":l[e]="true"===a[p];break;case "shadowColor":case "color":case "fill":case "fillP":case "fillM":case "arrow":case "trace":l[e]="false"===a[p]?"":new b.Color(p,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":l[e]=
p;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":""!==p&&(l[e]=this.parser.parse(p));break;case "font_size":p=p.trim();/^\[.*\]$/.test(p)&&(p=p.slice(1,-1));""!==p&&(l[e]=this.parser.parse(p));break;case "space":l[e+"ID"]=p;break;case "expresion":""!==p&&("Macro"!==l.type?(l[e]=this.parser.parse(p),l.expresionString=p):l[e]=p);break;case "text":l[e]=p;break;
case "file":var r=p.replace(/&squot;/g,"'").trim();/^\[.*\]$/.test(r)&&(r=r.slice(1,-1));r.match(h)&&(r="'"+r+"'");r.startsWith("data:image/")?l[e]=this.parser.parse("'"+r+"'"):l[e]=this.parser.parse(r);break;case "border":""!=p&&"false"!=a[p]&&(l[e]=new b.Color(p,this.parent.evaluator));break;default:if(void 0!=l.family&&(r=l.family.length+1,g.substring(0,r)===l.family+".")){r=a[g.substring(r)];/interval|steps/.test(r)&&""!=p&&(l["family_"+r]=this.parser.parse(p));break}void 0!=l.parameter&&g.match(l.parameter+
".")?(r=g.substring(0,g.indexOf(l.parameter)+l.parameter.length),l.parameter!==r&&(l.parameter=r),r=a[g.substring(l.parameter.length+1)],/interval|steps/.test(r)&&""!=p&&(l["parameter_"+r]=this.parser.parse(p))):console.warn("Propiedad del gr\u00e1fico no identificada: <"+g+"> valor: <"+p+">")}f&&(l.abs_coord=f);m&&(l.background=m);return new b[l.type](this.parent,l)};A.prototype.parse3DGraphic=function(c,f,m,h){l={rotateExp:h,parameter:"t"};c=this.split(c);f=0;for(m=c.length;f<m;f++)switch(g=c[f][0],
p=c[f][1],e=a[g],b.DEBUG.paramName=g,b.DEBUG.objectName="Graphic3D",e){case "info":break;case "type":b.DEBUG.idName=p;q=a[p];l[e]=d(q);break;case "model":case "align":case "anchor":case "lineDash":l[e]=a[p];break;case "shadowColor":case "fill":l[e]="false"===a[p]?"":new b.Color(p,this.parent.evaluator);break;case "background":case "fixed":case "split":case "bold":case "italics":case "underlined":l[e]="true"===a[p];break;case "edges":"false"===a[p]?l[e]="":("true"===a[p]&&(p="808080"),l[e]=new b.Color(p,
this.parent.evaluator));break;case "border":""!=p&&"false"!=a[p]&&(l.border=new b.Color(p,this.parent.evaluator));break;case "color":case "backcolor":l[e]=new b.Color(p,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":""!=p&&(l[e]=this.parser.parse(p));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":l[e]=
p;break;case "space":l[e+"ID"]=p;break;case "expresion":/Macro|Curve|Surface/.test(l.type)?l[e]=p.replace(/\\n/g,";"):(l[e]=this.parser.parse(p),l.expresionString=p);break;case "text":l.text=p;break;case "file":h=p.replace(/&squot;/g,"'").trim();/^\[.*\]$/.test(h)&&(h=h.slice(1,-1));/./.test(h)&&(h="'"+h+"'");l[e]=this.parser.parse(h);break;default:if(void 0!=l.family&&(h=l.family.length+1,g.substring(0,h)===l.family+".")){h=a[g.substring(h)];/interval|steps/.test(h)&&""!=p&&(l["family_"+h]=this.parser.parse(p));
break}console.warn("Propiedad del gr\u00e1fico 3D no identificada: <"+g+"> valor: <"+p+">")}return new b[l.type+"3D"](this.parent,l)};A.prototype.parseAuxiliar=function(c){m={};c=this.split(c);for(var d=0,f=c.length;d<f;d++)c[d][1]=c[d][1].replace(/&squot;/g,"'");d=0;for(f=c.length;d<f;d++)switch(g=c[d][0],p=c[d][1],e=a[g],b.DEBUG.paramName=g,b.DEBUG.objectName="Auxiliar",e){case "info":case "code":case "doc":break;case "id":b.DEBUG.idName=p;case "file":case "init":case "doExpr":case "whileExpr":case "range":case "local":case "expresion":case "condition":case "parameter":m[e]=
p.replace(/&squot;/g,"'");break;case "editable":case "constant":case "array":case "matrix":case "algorithm":case "event":case "sequence":m[e]="true"===a[p];break;case "size":case "rows":case "columns":case "x":case "y":case "width":case "height":m[e]=this.parser.parse(p);break;case "evaluate":case "execution":case "msg_pos":case "action":case "type":m[e]=a[p];break;default:var l=g.indexOf("."),h=a[g.substring(0,l)];l=a[g.substring(l+1)];"parameter"===h&&"font"===l?m[h+"Font"]=p:console.warn("Propiedad del auxiliar no identificada: <"+
g+"> valor: <"+p+">")}m.sequence?m.type="sequence":m.constant?m.type="constant":m.algorithm&&m.evaluate?m.type="algorithm":m.array&&!m.matrix&&")"!=m.id.charAt(m.id.length-1)?m.type="vector":m.matrix&&")"!=m.id.charAt(m.id.length-1)?m.type="matrix":m.event&&")"!=m.id.charAt(m.id.length-1)?m.type="event":"library"===m.type?m.type="library":")"===m.id.charAt(m.id.length-1)?m.type="function":m.type="variable";b.DEBUG.typeName=m.type;switch(m.type){case "sequence":new b.Function(this.parent,m);break;
case "constant":c=new b.Constant(this.parent,m);m.evaluate&&"always"===m.evaluate&&this.parent.auxiliaries.push(c);break;case "algorithm":this.parent.auxiliaries.push(new b.Algorithm(this.parent,m));break;case "vector":c=new b.Vector(this.parent,m);m.evaluate&&"always"===m.evaluate&&this.parent.auxiliaries.push(c);break;case "matrix":c=new b.Matrix(this.parent,m);m.evaluate&&"always"===m.evaluate&&this.parent.auxiliaries.push(c);break;case "event":this.parent.events.push(new b.Event(this.parent,m));
break;case "library":new b.Library(this.parent,m);break;case "variable":new b.Variable(this.parent,m);break;default:new b.Function(this.parent,m)}};A.prototype.parseAction=function(a){return a.action?new (b[d(a.action)])(a.parent,a.parameter):{execute:function(){}}};A.prototype.parseAnimation=function(c){var d={};c=this.split(c);for(var f=0,l=c.length;f<l;f++)switch(g=c[f][0],p=c[f][1],e=a[g],b.DEBUG.pName=g,b.DEBUG.objectName="Animation",e){case "info":break;case "id":case "delay":case "init":case "doExpr":case "whileExpr":d[e]=
p.replace(/&squot;/g,"'");break;case "controls":case "auto":case "loop":case "algorithm":case "evaluate":d[e]="true"===a[p];break;default:console.warn("Propiedad de la animaci\u00f3n no identificada: <"+g+"> valor: <"+p+">")}return new b.Animation(this.parent,d)};A.prototype.split=function(a){if("string"!==typeof a)return[];f=[];a=(a||"").replace(/\\'/g,"\u2019");w=u=r=0;for(x=v=!1;w<a.length;)" "!==a[w]||x||w++," "===a[w]||x||(x=!0,r=w),"="!==a[w]||"'"!==a[w+1]||v||(v=!0,f[u]=[a.substring(r,w)],
r=w+2,w+=2),v&&"'"===a[w]&&(x=v=!1,f[u].push(a.substring(r,w)),u++),"="!==a[w]||"'"===a[w+1]||v||(f[u]=[a.substring(r,w)],r=w+1,w++,z=a.substring(w).indexOf("="),-1===z?z=y=a.length:(z+=w,y=a.substring(w,z).lastIndexOf(" "),y=-1===y?a.length:y+w),f[u].push(a.substring(r,y)),u++,x=!1,w=y),w++;return f};A.prototype.parseText=function(a){a=void 0===a?"":a;return/^\{\\rtf1/.test(a)?this.RTFparser.parse(a.substring(10)):new b.SimpleText(this.parent,a)};b.LessonParser=A;return b}(descartesJS||{},babel);
descartesJS=function(b){function a(){return parseFloat(this.value)}function d(){return this.value.replace(/\\u0027/g,"'")}function h(a,b){var c=a.variables[this.value];if("object"===typeof c&&void 0==c.length)return c.evaluate(a);void 0==c&&(b||a.matrices[this.value]?c=a.matrices[this.value]:a.vectors[this.value]&&(c=a.vectors[this.value]));return void 0!==c?c:0}function q(a){try{var b=a.getVector(this.value,this.childs[0].childs[0].evaluate(a));return void 0!==b?b:0}catch(ba){return 0}}function e(a){try{var b=
a.getMatrix(this.value,this.childs[0].childs[0].evaluate(a),this.childs[0].childs[1].evaluate(a));return void 0!==b?b:0}catch(ba){return 0}}function g(a){return a.functions[this.value].apply(a,this.childs[0].childs.map(function(b){return b.evaluate(a)}))}function p(a){var c=this.childs[0].evaluate(a,!0);a=this.childs[1].evaluate(a,!0);if("matrix"!==c.type||"matrix"!==a.type)return"number"==typeof c&&"string"==typeof a?c=b.removeNeedlessDecimals(c.toString()):"string"==typeof c&&"number"==typeof a&&
(a=b.removeNeedlessDecimals(a.toString())),c+a;X=c.rows;T=c.cols;S=M(X,T);for(V=0;V<X;V++)for(W=0;W<T;W++)S[W][V]=c[W][V]+a[W][V];return S}function n(a){var b=this.childs[0].evaluate(a,!0);a=this.childs[1].evaluate(a,!0);if("matrix"!==b.type||"matrix"!==a.type)return b-a;X=b.rows;T=b.cols;S=M(X,T);for(V=0;V<X;V++)for(W=0;W<T;W++)S[W][V]=b[W][V]-a[W][V];return S}function c(a){var b=this.childs[0].evaluate(a,!0);a=this.childs[1].evaluate(a,!0);return"matrix"!==b.type||"matrix"!==a.type?b*a:P(b,a)}function l(a){var b=
this.childs[0].evaluate(a,!0);a=this.childs[1].evaluate(a,!0);if("matrix"!==b.type||"matrix"!==a.type)return b/a;var c=M(a.length,a.length),d=F(a);if(0===d)a=0;else{d=1/d;if(1<a.length)for(var e=0,f=a.length;e<f;e++){var l=d;for(var m=0;m<f;m++)c[m][e]=l*F(N(e,m,a)),l=-l;d=-d}else c[0][0]=d;a=c}b=0===a?M(b.rows,b.cols):P(b,a);return b}function m(a){var b=this.childs[0].evaluate(a);a=this.childs[1].evaluate(a);return b-K(b/a)*a}function f(a){var b=this.childs[0].evaluate(a);a=this.childs[1].evaluate(a);
return 0<=a?Q(b,a):1/Q(b,-a)}function w(a){return+(this.childs[0].evaluate(a)<this.childs[1].evaluate(a))}function u(a){return+(this.childs[0].evaluate(a)<=this.childs[1].evaluate(a))}function x(a){return+(this.childs[0].evaluate(a)>this.childs[1].evaluate(a))}function r(a){return+(this.childs[0].evaluate(a)>=this.childs[1].evaluate(a))}function v(a){var b=this.childs[0].evaluate(a);a=this.childs[1].evaluate(a);return"number"==typeof b&&"number"==typeof a?+(1E-8>Math.abs(b-a)):+(b===a)}function z(a){var b=
this.childs[0].evaluate(a);a=this.childs[1].evaluate(a);return"number"==typeof b&&"number"==typeof a?+!(1E-8>Math.abs(b-a)):+(b!==a)}function y(a){return this.childs[0].evaluate(a)?this.childs[1].evaluate(a)?1:0:0}function A(a){return this.childs[0].evaluate(a)?1:this.childs[1].evaluate(a)?1:0}function B(a){return+!this.childs[0].evaluate(a)}function E(a){return 0<this.childs[0].evaluate(a)?this.childs[1].evaluate(a):this.childs[2]?this.childs[2].evaluate(a):0}function I(a){return this.childs[0].evaluate(a)}
function D(a){return-this.childs[0].evaluate(a)}function G(a,b){return this.childs[0].evaluate(a,b)}function H(a){return 1===this.childs.length&&1===this.childs[0].childs.length&&"(expr)"===this.type?this.childs[0].childs[0].evaluate(a):this.childs.map(function(b){return b.childs.map(function(b){return b.evaluate(a)})})}function C(a){var b=this.childs[0],c=b.childs[0]?b.childs[0].childs:null,d=this.childs[1].evaluate(a);a.setVector(b.value,c[0].evaluate(a),d);return d}function J(a){var b=this.childs[0],
c=b.childs[0]?b.childs[0].childs:null,d=this.childs[1].evaluate(a);a.setMatrix(b.value,c[0].evaluate(a),c[1].evaluate(a),d);return d}function O(a){var b=this.childs[0],c=this.childs[1].evaluate(a);return c.type?a.matrices[b.value]=c:"object"!==typeof a.variables[b.value]?a.variables[b.value]=c:0}function Q(a,b){if(0==b)return 1;if(0>b)return NaN;if(0<=a||K(b)===b)return Math.pow(a,b);if(0>a){var c=1/b,d=K(c);if(d===c&&1===d%2)return-Math.pow(-a,b)}return NaN}function M(a,b){S=[];S.type="matrix";S.rows=
a;S.cols=b;V=0;for(aa=b;V<aa;V++)S[V]=Array(a).fill(0);return S}function P(a,b){X=a.rows;T=a.cols;S=M(X,T);var c;for(V=0;V<X;V++)for(W=0;W<T;W++){for(aa=c=0;aa<T;aa++)c+=a[aa][V]*b[W][aa];S[W][V]=c}return S}function N(a,b,c){for(var d=M(c.length-1,c.length-1),e=0,f=d.length;e<f;e++)for(var l=0;l<f;l++)d[e][l]=e<a?l<b?c[e][l]:c[e][l+1]:e<b?c[e+1][l]:c[e+1][l+1];return d}function F(a){if(1<a.cols){for(var b=0,c=1,d=0,e=a.cols;d<e;d++)b+=c*a[0][d]*F(N(0,d,a)),c=-c;return b}return a[0][0]}if(b.loadLib)return b;
var K=Math.floor,L,R,U,Y,X,T,S,W,V,aa,Z=function(a,b){this.sep="";this.type=a;this.value=b;this.parent=null;this.childs=[]};Z.prototype.getRoot=function(){return null===this.parent?this:this.parent.getRoot()};Z.prototype.addChild=function(a){a.parent=this;this.childs.push(a)};Z.prototype.replaceLastChild=function(a){R=this.childs.length-1;L=this.childs[R];L.parent=null;this.childs[R]=a;a.parent=this;return a};Z.prototype.contains=function(a){return this.value===a?!0:this.childs.some(function(b){return b.contains(a)})};
Z.prototype.equalToMinus=function(){return"compOperator"===this.type?(this.type="operator",this.value="-",Y=new Z("compOperator","=="),Y.addChild(this),Y.addChild(new Z("number","0")),U=this.getRoot(),U.setAllEvalFun(),U):this};Z.prototype.getChildren=function(){if("(expr)"===this.type||"[expr]"===this.type){if(this.childArray)return this.childArray;this.childArray=[];for(var a=$jscomp.makeIterator(this.childs),b=a.next();!b.done;b=a.next())b=b.value,/square_bracket|parentheses/.test(b.type)&&this.childArray.push.apply(this.childArray,
$jscomp.arrayFromIterable(b.childs));return this.childArray}return null};Z.prototype.setAllEvalFun=function(){this.setEvalFun();for(var a=$jscomp.makeIterator(this.childs),b=a.next();!b.done;b=a.next())b.value.setAllEvalFun()};Z.prototype.setEvalFun=function(){if("number"===this.type)this.evaluate=a;else if("string"===this.type)this.evaluate=d;else if("identifier"===this.type&&0===this.childs.length)this.evaluate=h;else if("identifier"===this.type&&"square_bracket"===this.childs[0].type&&1===this.childs[0].childs.length)this.evaluate=
q;else if("identifier"===this.type&&"square_bracket"===this.childs[0].type&&1<this.childs[0].childs.length)this.evaluate=e;else if("identifier"===this.type&&"parentheses"===this.childs[0].type)this.evaluate=g;else if("operator"===this.type)"+"===this.value?this.evaluate=p:"-"===this.value?this.evaluate=n:"*"===this.value?this.evaluate=c:"/"===this.value?this.evaluate=l:"%"===this.value?this.evaluate=m:"^"===this.value&&(this.evaluate=f);else if("compOperator"===this.type)"<"===this.value?this.evaluate=
w:"<="===this.value?this.evaluate=u:">"===this.value?this.evaluate=x:">="===this.value?this.evaluate=r:"=="===this.value?this.evaluate=v:"!="===this.value&&(this.evaluate=z);else if("boolOperator"===this.type)"&"===this.value?this.evaluate=y:"|"===this.value?this.evaluate=A:"!"===this.value&&(this.evaluate=B);else if("conditional"===this.type)this.evaluate=E;else if("sign"===this.type)this.evaluate="sign+"===this.value?I:D;else if("parentheses"===this.type)this.evaluate=G;else if("(expr)"===this.type||
"[expr]"===this.type)this.evaluate=H;else if("assign"===this.type){var b=this.childs[0],Y=b.childs[0]?b.childs[0].childs:null;this.evaluate=1===b.childs.length&&"square_bracket"===b.childs[0].type&&1===Y.length?C:1===b.childs.length&&"square_bracket"===b.childs[0].type&&2===Y.length?J:O}};b.Node=Z;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,d,h,q,e,g,p,n,c=/^\s+/,l=/^[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]*)*/,m=/^([0-9]+[.][0-9]+|[.][0-9]+|[0-9]+)/,f=/^(==|!=|<=|<|>=|>|#)/,w=/^(!|~|&&|&|\|\||\|)/,u=/^(=|:=)/,x=/^[\?:]/,r=/^[\+\-\*\/%\^\u2212\u00b7\u00D7\u00F7]/,v=/^(\[|\])/,z=/^(\(|\))/,y=/^,/,A=/^;/,B=/\|/g,E=/\|\*/g,I=/\*\|/g,D=/^\/\//g,G=/:\/\//g,H,C=/rnd|pi|e|Infinity|-Infinity|sqr|sqrt|ra\u00edz|exp|log|log10|abs|ent|sgn|ind|sin|sen|cos|tan|cot|sec|csc|sinh|senh|cosh|tanh|coth|sech|csch|asin|asen|acos|atan|min|max/,
J=function(){};J.prototype.tokenize=function(C){function H(a,b,c){d.push({type:a,value:b});g=g.slice(c);q+=c;n=a}if(a=C){C=C.replace(/\\u(\S+) /g,function(a,b){return 39!==parseInt(b,16)?String.fromCharCode(parseInt(b,16)):a}).replace(/&sup(.+?);/g,"^$1 ").replace(/&squot;/g,"'").replace(/\brnd\b/g,"random()");C.match(/=\|\*/g)&&(C=C.replace(E,"'").replace(I,"'"));C.match(/=\|/g)&&(C=C.replace(B,"'"));var J=C.trim();"|"==J[0]&&"|"==J[J.length-1]&&(C=J.replace(B,"'"))}d=[];h=!1;q=0;g=C;for(n="";C&&
q<C.length;)if(h=q,"'"==g[0]){for(p=1;"'"!=g[p];)if(p<g.length)p++;else return;e=g.substring(1,p);H("string",e,e.length+2)}else{if(e=g.match(D))if(g.match(G))continue;else{q=2*C.length;break}if(e=g.match(c))g=g.slice(e[0].length),q+=e[0].length;else if(e=g.match(r))e[0]=e[0].replace(/\u00F7/g,"/").replace(/\u2212/g,"-").replace(/\u00b7/g,"*").replace(/\u00D7/g,"*"),H("operator",e[0],e[0].length);else if(e=g.match(l))"number"===n&&d.push({type:"operator",value:"*"}),H("identifier",e[0],e[0].length);
else if(e=g.match(m))H("number",e[0],e[0].length);else if(e=g.match(f))J=e[0],"#"==J&&(J="!="),H("compOperator",J,e[0].length);else if(e=g.match(w))J=e[0],"||"==J?J="|":"&&"==J?J="&":"~"==J&&(J="!"),H("boolOperator",J,e[0].length);else if((e=g.match(u))&&!/^==/.test(g))H("assign",e[0],e[0].length);else if(e=g.match(x))H("conditional",e[0],e[0].length);else if(e=g.match(v))H("square_bracket",e[0],e[0].length);else if(e=g.match(z))"("==e&&"number"===n&&d.push({type:"operator",value:"*"}),H("parentheses",
e[0],e[0].length);else if(e=g.match(y))H("separator",e[0],e[0].length);else if(178===g.charCodeAt(0))d.push({type:"operator",value:"^"}),H("number",2,1);else if(179===g.charCodeAt(0))d.push({type:"operator",value:"^"}),H("number",3,1);else if(e=g.match(A))H("final_of_expression",e[0],e[0].length);else if(h==q){b.DEBUG.setError(b.DEBUG.EXPRESSION,a);return}}return d};J.prototype.flatTokens=function(a,b){a=void 0===a?[]:a;b=void 0===b?"":b;H="";a=$jscomp.makeIterator(a);for(var c=a.next();!c.done;c=
a.next())c=c.value,H="string"==c.type?H+("&squot;"+c.value+"&squot;"):"identifier"!=c.type||C.test(c.value)?H+c.value:H+(b+c.value);return H};b.Tokenizer=J;return b}(descartesJS||{});
descartesJS=function(b){function a(a){switch(a){case "=":return 1;case ":=":return 1;case "(":return 2;case "[":return 2;case "?":return 2;case ":":return 3;case "?:":return 3;case "|":return 6;case "&":return 7;case "<":return 5;case "<=":return 5;case ">":return 5;case ">=":return 5;case "==":return 5;case "!=":return 5;case "+":return 6;case "-":return 6;case "/":return 7;case "*":return 7;case "sign-":return 7;case "sign+":return 7;case "!":return 8;case "%":return 8;case "^":return 9;default:return 9}}
function d(a){a=String(a).trim().replace(/^'|'$/g,"");var b=parseFloat(a);return isNaN(b)||String(b)!==a?a:b}function h(a,b,c,d){console.info("Error"+a+": en la expresi\u00f3n \u300a"+b+"\u300b, en el token {valor: "+c+", tipo: "+d+"}")}if(b.loadLib)return b;b.reservedIds="-_-_NUM_MAX_ITE_ALG_-rnd-pi-\u03c0-e-Infinity-isTouch-esT\u00e1ctil-device-dispositivo-screenOrientation-screenWidth-screenHeight-sqr-sqrt-ra\u00edz-exp-log-log10-abs-ent-sgn-ind-sin-sen-cos-tan-cot-sec-csc-sinh-senh-cosh-tanh-coth-sech-csch-asin-asen-acos-atan-atan2-floor-piso-ceil-techo-round-redondeo-trunc-truncamiento-min-max-_Trace_-_Print_-_Num_-isNumber-esN\u00famero-random-aleatorio-_Stop_Audios_-parent.set-parent.update-parent.exec-toFixed-_NumToStr_-_NumACadena_-charAt-_charAt_-_letraEn_-substring-_substring_-_subcadena_-strLength-_length_-_longitud_-indexOf-_indexOf_-\u00edndiceDe-lastIndexOf-replace-_replace_-_reemplazar_-toLowerCase-toUpperCase-trim-_Load_-_GetValues_-_GetMatrix_-_MatrixToStr_-_StrToMatrix_-_GetVector_-_VectorToStr_-_StrToVector_-_ExecStr_-_ExecBlock_-_Save_-_SaveSpace_-_Open_-_SaveState_-_OpenState_-_AnchoDeCadena_-_strWidth_-R-G-B-_Rojo_-_Red_-_Verde_-_Green_-_Azul_-_Blue_-DJS.typeof-DJS.squote-DJS.comma-DJS.w-DJS.h-";
var q,e,g,p,n,c,l,m,f,w,u=function(a){this.evaluator=a;this.tokenizer=new b.Tokenizer;this.vectors={};this.matrices={};this.variables={};this.functions={};this.definitions={};this.registerDefaultValues();this.registerExternalValues&&this.registerExternalValues()};u.prototype.parse=function(d,r){(q=this.tokenizer.tokenize(d))||(q=[]);e=null;r=!r||!1;for(var u=c=n=p=0,x=q.length;u<x;u++){l=q[u];m=l.value;f=l.type;if("identifier"===f)if(q[u+1]&&"parentheses"===q[u+1].type&&"("===q[u+1].value)this.functions.hasOwnProperty(m)||
(this.functions[m]=function(){return 0});else if(q[u+1]&&"square_bracket"===q[u+1].type&&"["===q[u+1].value)q[u+3]&&"square_bracket"===q[u+3].type&&"]"===q[u+3].value?this.vectors.hasOwnProperty(m)||(this.vectors[m]=[0,0,0]):this.matrices.hasOwnProperty(m)||(this.matrices[m]=[[0,0,0],[0,0,0],[0,0,0]]);else{var y=m.match(/^\w*(\.mouse_x|\.mouse_y|\.mouse_pressed|\.mouse_clicked|\.clic_izquierdo)$/);y&&(this.variables[y[1]+".DJS_NO_FIXED"]=1)}"assign"===f&&r&&":="!=m&&(f="compOperator",m="==");if("assign"===
f)if(g=new b.Node(f,m),null!=e){r=!0;if("identifier"===e.type)e.parent&&e.parent.replaceLastChild(g),g.addChild(e);else if("square_bracket"===e.type)g.addChild(e.parent);else{g.type="compOperator";for(g.value="==";e.parent&&a(e.parent.value)>=a(g.value);)e=e.parent;e.parent&&e.parent.replaceLastChild(g);g.addChild(e)}e=g}else{h(1,d,m,f);break}else if("parentheses"===f&&"("===m||"square_bracket"===f&&"["===m)if(g=new b.Node(f,m),"("===m&&p++,"["===m&&n++,null===e)"("===m&&(new b.Node("(expr)","(expr)")).addChild(g),
"["===m&&(new b.Node("[expr]","[expr]")).addChild(g),e=g;else if("operator"===e.type||"boolOperator"===e.type||"compOperator"===e.type||"conditional"===e.type||"assign"===e.type)e.addChild(g),e=g;else if("sign"===e.type)e.addChild(g),e=g;else if("parentheses"===e.type&&"("===e.value)e.addChild(g),e=g;else if("square_bracket"===e.type&&"["===e.value)e.addChild(g),e=g;else if("parentheses"===e.type&&"()"===e.value)e.parent.addChild(g),e=g;else if("square_bracket"===e.type&&"[]"===e.value)e.parent.addChild(g),
e=g;else if("identifier"===e.type)e.addChild(g),e=g;else{h(2,d,m,f);break}else if("parentheses"===f&&")"===m)if(p--,null===e)h(3,d,m,f);else{for(;e&&e.parent&&("("!=e.value||"("==e.value&&"parentheses"!=e.type);)e=e.parent;if(e&&"("===e.value)e.value="()";else{h(4,d,m,f);break}}else if("square_bracket"===f&&"]"===m)if(n--,null===e)h(5,d,m,f);else{for(;e&&e.parent&&("["!=e.value||"["==e.value&&"square_bracket"!=e.type);)e=e.parent;if(e&&"["===e.value)e.value="[]";else{h(6,d,m,f);break}}else if("number"===
f||"string"===f||"identifier"===f)if(g=new b.Node(f,m),null===e)e=g;else if("operator"===e.type||"compOperator"===e.type||"boolOperator"===e.type||"parentheses"===e.type&&"("===e.value||"square_bracket"===e.type&&"["===e.value||"sign"===e.type||"conditional"===e.type||"assign"===e.type)e.addChild(g),e=g;else break;else if("operator"===f||"compOperator"===f||"boolOperator"===f)if(g=new b.Node(f,m),null===e)if("-"===m||"+"===m)g.type="sign",g.value="sign"+m,e=g;else if("!"===m)e=g;else{h(8,d,m,f);break}else if("operator"===
e.type||"compOperator"===e.type||"boolOperator"===e.type||"assign"===e.type||"conditional"===e.type||"square_bracket"===e.type&&"["===e.value&&("-"===m||"+"===m||"!"===m)||"parentheses"===e.type&&"("===e.value&&("-"===m||"+"===m||"!"===m)){if("-"===m||"+"===m)g.type="sign",g.value="sign"+m;e.addChild(g);e=g}else if("number"===e.type||"parentheses"===e.type&&"()"===e.value||"square_bracket"===e.type&&"[]"===e.value||"string"===e.type||"identifier"===e.type||"conditional"===e.type||"assign"===e.type){for(;e.parent&&
a(e.parent.value)>=a(g.value);)e=e.parent;e.parent&&e.parent.replaceLastChild(g);g.addChild(e);e=g}else{h(9,d,m,f);break}else if("conditional"===f)if(g=new b.Node(f,m),null!=e)if("?"===g.value){for(c++;e.parent&&a(e.parent.value)>a(g.value);)e=e.parent;e.parent&&e.parent.replaceLastChild(g);g.addChild(e);e=g}else{for(c--;e&&e.parent&&("?"!=e.value||"?"==e.value&&"conditional"!=e.type);)e=e.parent;if(e&&"?"===e.value)e.value="?:";else{h(10,d,m,f);break}}else{h(11,d,m,f);break}else if("separator"===
f)if(null!=e)for(;e.parent&&"("!=e.value&&"["!=e.value;)e=e.parent;else{h(12,d,m,f);break}else{h(13,d,m,f);break}}0<p&&b.DEBUG.setError(b.DEBUG.PARENTHESIS_CLOSING,d);0>p&&b.DEBUG.setError(b.DEBUG.PARENTHESIS_OPENING,d);0<n&&b.DEBUG.setError(b.DEBUG.BRACKET_CLOSING,d);0>n&&b.DEBUG.setError(b.DEBUG.BRACKET_OPENING,d);0!=c&&b.DEBUG.setError(b.DEBUG.INCOMPLETE_IF,d);(w=e?e.getRoot():null)&&w.setAllEvalFun();return w};u.prototype.registerDefaultValues=function(){var a=Date.now(),c=this;c.variables._NUM_MAX_ITE_ALG_=
1E5;c.variables.pi=c.variables["\u03c0"]=Math.PI;c.variables.e=Math.E;c.variables.Infinity=Infinity;c.variables["-Infinity"]=-Infinity;c.variables.isTouch=c.variables["esT\u00e1ctil"]=b.hasTouchSupport?1:0;c.variables.device=c.variables.dispositivo=function(){var a=navigator.userAgent;return/(tablet|ipad|playbook|silk)|(android(?!.*mobi))/i.test(a)?"tablet":/Mobile|iP(hone|od)|Android|BlackBerry|IEMobile|Kindle|Silk-Accelerated|(hpw|web)OS|Opera M(obi|ini)/.test(a)?"mobile":"desktop"}();Object.defineProperties(c.variables,
{screenOrientation:{get:function(){return window.matchMedia("(orientation: landscape)").matches?"landscape":"portrait"}},screenWidth:{get:function(){return window.innerWidth}},screenHeight:{get:function(){return window.innerHeight}}});c.variables["DJS.squote"]="\\u0027";c.variables["DJS.comma"]="\\u002C";var e={};c.functions._Eval_=function(a){a=void 0===a?"":a;if(""==a)return 0;if("number"==typeof a)return"NaN";var b=a.replace(",",".");/,/.test(a)&&parseFloat(b)==b&&(a=b);if(void 0==e[a])if(b=a.match(/:=/g)?
!0:!1,/;/.test(a)){for(var d=!1,f,l=[],m=0,g=0,h=a.length;g<h;g++)f=a[g],"'"===f&&(d=!d),d||";"!==f||(l.push(a.substring(m,g)),m=g+1);l.push(a.substring(m));e[a]=c.parse("("+l.join(")(")+")",b)}else e[a]=c.parse(a,b);a=c.evaluator.eval(e[a]);return void 0!=a?a:"NaN"};c.functions.sqr=function(a){return a*a};c.functions.sqrt=c.functions["ra\u00edz"]=Math.sqrt;c.functions.exp=Math.exp;c.functions.log=Math.log;c.functions.log10=Math.log10?Math.log10:function(a){return Math.log(a)/Math.log(10)};c.functions.abs=
Math.abs;c.functions.ent=function(a){return Math.trunc(parseFloat(a)+1E-16*Math.sign(a))};c.functions.sgn=Math.sign;c.functions.ind=function(a){return a?1:0};c.functions.sin=c.functions.sen=Math.sin;c.functions.cos=Math.cos;c.functions.tan=Math.tan;c.functions.cot=function(a){return 1/Math.tan(a)};c.functions.sec=function(a){return 1/Math.cos(a)};c.functions.csc=function(a){return 1/Math.sin(a)};c.functions.sinh=c.functions.senh=Math.sinh?Math.sinh:function(a){return(Math.exp(a)-Math.exp(-a))/2};
c.functions.cosh=Math.cosh?Math.cosh:function(a){return(Math.exp(a)+Math.exp(-a))/2};c.functions.tanh=Math.tanh?Math.tanh:function(a){return(Math.exp(a)-Math.exp(-a))/(Math.exp(a)+Math.exp(-a))};c.functions.coth=function(a){return 1/c.functions.tanh(a)};c.functions.sech=function(a){return 1/c.functions.cosh(a)};c.functions.csch=function(a){return 1/c.functions.sinh(a)};c.functions.asin=c.functions.asen=Math.asin;c.functions.acos=Math.acos;c.functions.atan=Math.atan;c.functions.atan2=Math.atan2;c.functions.floor=
c.functions.piso=Math.floor;c.functions.ceil=c.functions.techo=Math.ceil;c.functions.round=c.functions.redondeo=Math.round;c.functions.trunc=c.functions.truncamiento=Math.trunc;c.functions.min=Math.min;c.functions.max=Math.max;c.functions._Trace_=c.functions._Print_=function(){console.info.apply(console,arguments);return 0};c.functions._Num_=function(a){if("number"==typeof a)return"NaN";a=a.replace(",",".");return parseFloat(a)==a?parseFloat(a):"NaN"};c.functions.isNumber=c.functions["esN\u00famero"]=
function(a){return Number.isFinite(a)?1:0};c.functions.random=c.functions.aleatorio=function(a,b){a=isNaN(parseFloat(a))?0:parseFloat(a);b=isNaN(parseFloat(b))?1:parseFloat(b);a>b&&(b=$jscomp.makeIterator([b,a]),a=b.next().value,b=b.next().value);return a+Math.random()*(b-a)};c.functions._Stop_Audios_=function(){c.evaluator.parent.stopAudios()};window.parent!==window&&(c.functions["parent.set"]=function(a,b){window.parent.postMessage({type:"set",name:a,value:b},"*");return 0},c.functions["parent.update"]=
function(){window.parent.postMessage({type:"update"},"*");return 0},c.functions["parent.exec"]=function(a,b){window.parent.postMessage({type:"exec",name:a,value:b},"*");return 0});c.functions.toFixed=c.functions._NumToStr_=c.functions._NumACadena_=function(a,b){a=isNaN(parseFloat(a))?0:parseFloat(a);return a.toFixed(parseInt(b||0)).replace(".",c.evaluator.parent.decimal_symbol)};c.functions.charAt=c.functions._charAt_=c.functions._letraEn_=function(a,b){a=(a||"").toString();b=isNaN(parseInt(b))?0:
parseInt(b);return a.charAt(b)};c.functions.substring=c.functions._substring_=c.functions._subcadena_=function(a,b,c){a=(a||"").toString();b=isNaN(parseInt(b))?0:parseInt(b);c=isNaN(parseInt(c))?0:parseInt(c);return 0<=b&&0<=c?a.substring(b,c):0>b&&0<=c?a.substring(c):0>c&&0<=b?a.substring(b):""};c.functions.strLength=c.functions._length_=c.functions._longitud_=function(a){return(a||"").toString().length};c.functions.indexOf=c.functions._indexOf_=c.functions["_\u00edndiceDe_"]=function(a,b){return(a||
"").toString().indexOf((b||"").toString())};c.functions.lastIndexOf=function(a,b){return(a||"").toString().lastIndexOf((b||"").toString())};c.functions.replace=c.functions._replace_=c.functions._reemplazar_=function(a,b,c){a=(a||"").toString();b=(b||"").toString();c=(c||"").toString();for(var d=a.indexOf(b);0<=d;)a=a.substring(0,d)+c+a.substring(d+b.length),d=a.indexOf(b,d+c.length);return a};c.functions.toLowerCase=function(a){return(a||"").toString().toLowerCase()};c.functions.toUpperCase=function(a){return(a||
"").toString().toUpperCase()};c.functions.trim=function(a){return(a||"").toString().trim()};c.functions._Load_=function(a){var c="";a&&(c=(c=document.getElementById(a))&&"descartes/archivo"==c.type?c.text:b.openFile(a));return c||""};c.functions._GetValues_=function(a,b){return c.functions._ExecBlock_(c.functions._Load_(a).replace(/&brvbar;/g,String.fromCharCode("166")),b)};c.functions._GetMatrix_=function(a,b){return c.functions._StrToMatrix_(c.functions._Load_(a).replace(/&brvbar;/g,String.fromCharCode("166")),
b)};c.functions._MatrixToStr_=function(a){var d=c.matrices[a];if(d){for(var e="<"+a+">\\n",f=c.evaluator.getVariable(a+".columnas_usadas")||d.cols||0,l=c.evaluator.getVariable(a+".filas_usadas")||d.rows||0,m,g=0;g<f;g++){for(var h=0;h<l;h++)m=d[g][h],void 0!==m&&("string"==typeof m?m="'"+m+"'":"number"==typeof m&&(m=b.removeNeedlessDecimals(m.toFixed(6))),e+=m+(h<l-1?" \u00a6 ":""));e=e.replace(/(\u00A6 )$/g,"")+"\\n"}return e+"</"+a+">"}return""};c.functions._StrToMatrix_=function(a,b){var e=[],
f=!1,l=!1;e.type="matrix";if(a){a=a.replace(/\r|\\r/g,"").split(/\n|\\n/);for(var m=0,g=a.length;m<g;m++)a[m].match("<"+b+">")?(l=!0,f=a[m].trim().split("<"+b+">"),2==f.length&&""!=f[1]&&e.push(f[1].split(String.fromCharCode("166")).map(d)),f=!0):(a[m].match("</"+b+">")&&(f=a[m].trim().split("</"+b+">"),2==f.length&&""!=f[0]&&e.push(f[0].split(String.fromCharCode("166")).map(d)),f=!1,m=a.length),f&&e.push(a[m].split(String.fromCharCode("166")).map(d)));c.matrices[b]=e;c.matrices[b].rows=e&&e[0]&&
e[0].length?e[0].length:0;c.matrices[b].cols=e&&e.length?e.length:0;c.evaluator.setVariable(b+".filas",c.matrices[b].rows);c.evaluator.setVariable(b+".columnas",c.matrices[b].cols)}return l?"OK":"ERROR"};c.functions._GetVector_=function(a,b){return c.functions._StrToVector_(c.functions._Load_(a),b)};c.functions._VectorToStr_=function(a){var b=c.vectors[a];if(b){for(var d="<"+a+">\\n",e=c.evaluator.getVariable(a+".long_usada")||b._size_||0,f,l=0;l<e;l++)f=b[l],void 0!==f?("number"==typeof f&&(f=parseFloat(f)),
d+=f+"\\n"):d+="0\\n";return d+"</"+a+">"}return""};c.functions._StrToVector_=function(a,b){var e=[],f=!1,l=!1;e.type="vector";if(a){a=a.replace(/\r|\\r/g,"").split(/\n|\\n/);for(var m=0,g=a.length;m<g;m++)a[m].match("<"+b+">")?f=l=!0:(a[m].match("</"+b+">")&&(f=!1,m=a.length),f&&e.push(d(a[m])));e._size_=e.length;c.vectors[b]=e;c.evaluator.setVariable(b+".long",e.length);c.evaluator.setVariable(b+".long_usada",e.length)}return l?"OK":"ERROR"};c.functions._ExecStr_=function(a){return c.functions._ExecBlock_(a,
"")};c.functions._ExecBlock_=function(a,b){var d=[],e=""==b;if(a){a=a.replace(/\r|\\r/g,"").split(/\n|\\n/);for(var f=0,l=a.length;f<l;f++)a[f].match("<"+b+">")?(e=a[f].trim().split("<"+b+">"),2==e.length&&""!=e[1]&&(d=d.concat(e[1].split(String.fromCharCode("166")))),e=!0):a[f].match("</"+b+">")?(e=a[f].trim().split("</"+b+">"),2==e.length&&""!=e[0]&&(d=d.concat(e[0].split(String.fromCharCode("166")))),e=!1):e&&(d=d.concat(a[f].split(String.fromCharCode("166"))));a=0;for(b=d.length;a<b;a++)e=d[a].split("="),
e[0]=e[0].trim(),2==e.length&&""!=e[0]&&(isNaN(parseFloat(e[1]))?c.evaluator.setVariable(e[0],e[1].trim().replace(/^'|'$/g,"")):c.evaluator.setVariable(e[0],parseFloat(e[1])))}return 0};var f=b.newHTML("a",{target:"_blank"}),l,m=null;b.newBlobContent=null;c.functions._Save_=function(d,e){c.evaluator.parent.removeButtonClick();1500<Date.now()-a&&(a=Date.now(),document.body.appendChild(f),m=e.replace(/\\r/g,"").replace(/\\n/g,"\r\n").replace(/\\q/g,"'").replace(/\\_/g,"\\").replace(/\\br/g,"\\n"),l=
new Blob(["\ufeff",m],{type:"text/plain;charset=utf-8"}),f.setAttribute("href",window.URL.createObjectURL(l)),f.setAttribute("download",d),m!=b.newBlobContent&&(f.click(),b.newBlobContent=m),document.body.removeChild(f));return 0};var g=b.newHTML("a",{target:"_blank"});c.functions._SaveSpace_=function(d,e){c.evaluator.parent.removeButtonClick();1500<Date.now()-a&&(a=Date.now(),document.body.appendChild(g),m=e,g.setAttribute("href",m),g.setAttribute("download",d),m!=b.newBlobContent&&(g.click(),b.newBlobContent=
m),document.body.removeChild(g));return 0};var h,q,p=b.newHTML("input",{type:"file"});p.addEventListener("change",function(a){h=a.target.files;q=new FileReader;q.onload=function(a){b.addExternalFileContent(h[0].name,a.target.result);c.evaluator.setVariable("DJS.fileName",h[0].name);c.evaluator.setVariable("DJS.fileContent",a.target.result);if(a=c.evaluator.getFunction(c._callback))a.apply(c.evaluator,[]),c.evaluator.parent.update();p.value=""};0<h.length&&q.readAsText(h[0])});c.functions._Open_=function(b){c.evaluator.parent.removeButtonClick();
1500<Date.now()-a&&(c._callback=b,p.click(),a=Date.now());return 0};c.functions._AnchoDeCadena_=c.functions._strWidth_=function(a,c,d,e){return b.getTextWidth(a,b.convertFont(c+","+d+","+e))};c.functions.R=c.functions._Rojo_=c.functions._Red_=function(a){return(new b.Color(a)).r/255};c.functions.G=c.functions._Verde_=c.functions._Green_=function(a){return(new b.Color(a)).g/255};c.functions.B=c.functions._Azul_=c.functions._Blue_=function(a){return(new b.Color(a)).b/255};c.functions.HSV2RGB=function(a,
b,c){a=parseInt(a)%360;b*=c;var d=b*(1-Math.abs(a/60%2-1));c-=b;if(0<=a&&60>a){var e=b;var f=d;var l=0}else 60<=a&&120>a?(e=d,f=b,l=0):120<=a&&180>a?(e=0,f=b,l=d):180<=a&&240>a?(e=0,f=d,l=b):240<=a&&300>a?(e=d,f=0,l=b):300<=a&&360>a&&(e=b,f=0,l=d);e=parseInt(255*(e+c));f=parseInt(255*(f+c));l=parseInt(255*(l+c));return""+e.toString(16).padStart(2,"0")+f.toString(16).padStart(2,"0")+l.toString(16).padStart(2,"0")};c.functions["DJS.typeof"]=function(a){return a.rows?"matrix":a._size_?"vector":typeof a}};
b.Parser=u;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=Math.floor,d=function(a){this.parent=a;this.parser=new b.Parser(this);this.variables=this.parser.variables;this.functions=this.parser.functions;this.vectors=this.parser.vectors;this.matrices=this.parser.matrices;this.definitions=this.parser.definitions};d.prototype.setDefinition=function(a,b){this.definitions[a]=b};d.prototype.getDefinition=function(a){return this.definitions[a]};d.prototype.setVariable=function(a,b){this.variables[a]=b};d.prototype.getVariable=
function(a){return this.variables[a]};d.prototype.setVector=function(b,d,e){d=0>d?0:a(d);this.vectors[b][d]=e};d.prototype.getVector=function(b,d){d=0>d?0:a(d);return this.vectors[b][d]};d.prototype.setMatrix=function(b,d,e,g){d=0>d?0:a(d);e=0>e?0:a(e);void 0==this.matrices[b][d]&&(this.matrices[b][d]=[]);this.matrices[b][d][e]=g};d.prototype.getMatrix=function(b,d,e){d=0>d?0:a(d);e=0>e?0:a(e);return this.matrices[b][d][e]};d.prototype.setFunction=function(a,b){this.functions[a]=b};d.prototype.getFunction=
function(a){return this.functions[a]};d.prototype.eval=function(a){return a?a.evaluate(this):0};b.externalEvaluator=new d;b.Evaluator=d;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,d,h,q,e,g,p,n,c,l,m,f,w,u,x,r,v=function(c,d){a=this;a.parent=c;a.evaluator=c.evaluator;a.decimals=c.decimals;a.fixed=c.fixed;a.align=c.align||"left";a.anchor=c.anchor||"a_top_left";a.decimal_symbol=c.parent.decimal_symbol;a.w=a.h=100;a.hasContent=""!==d;a.textStr=(d||"").replace(/\\{/g,"\\curlyBracketOpen ").replace(/\\}/g,"\\curlyBracketClose ").replace(/\\\[/g,"\\squareBracketOpen ").replace(/\\\]/g,"\\squareBracketClose ");a.oldTextStr=a.oldWidth=
a.oldSize=a.oldColor=a.oldPosX=a.oldPoxY=null;/^\{\\rtf1/.test(d)?(a.type="rtfNode",a.text=d,a.textNodes=(new b.RTFParser(c.evaluator)).parse(d.substring(10)),a.draw=a.drawRTF):(a.descarTeXParser=new b.DescarTeXParser,a.text=a.parseSimpleText(a.textStr),a.textNodes=new b.TextNode("","txtLineBlock",null,null),a.draw=a.drawText)};v.prototype.drawText=function(c,f,l,m,n){a=this;d=a.evaluator.eval(a.decimals);h=a.evaluator.eval(a.parent.width);q=a.evaluator.eval(a.parent.font_size);e=f.getColor?f.getColor():
f;g=a.textToString(a.text,d,a.fixed).replace(/\\{/g,"\\curlyBracketOpen ").replace(/\\}/g,"\\curlyBracketClose ").replace(/\\\[/g,"\\squareBracketOpen ").replace(/\\\]/g,"\\squareBracketClose ");0<=g.indexOf("[")&&(g=a.textToString(a.parseSimpleText(g),d,a.fixed));if(a.oldTextStr!==g||a.oldWidth!==h||a.oldSize!==q||a.oldColor!==e||a.oldPosX!==l||a.oldPoxY!==m)p=new b.TextStyle({size:q,family:a.parent.font_family||"arial",italic:a.parent.italics||!1,bold:a.parent.bold||!1,color:e,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,p),a.textNodes.update(l,m,d,a.fixed,a.align,a.anchor,e,h);n||a.textNodes.draw(c);a.oldTextStr=g;a.oldWidth=h;a.oldSize=q;a.oldColor=e;a.oldPosX=l;a.oldPoxY=m};v.prototype.drawRTF=function(a,b,c,d,e){b=b.getColor?b.getColor():b;a.fillStyle=a.strokeStyle=b;a.textBaseline=
"alphabetic";this.textNodes.style.align!==this.align&&this.textNodes.propagateStyle("align",this.align);this.textNodes.update(c,d,this.evaluator.eval(this.decimals),this.fixed,this.align,this.anchor,b,this.evaluator.eval(this.parent.width));e||this.textNodes.draw(a)};v.prototype.parseSimpleText=function(a){a=a.replace("&#x2013","\u2013").replace(/&squot;/g,"'");n=[];c="'";m=l=0;f=-1;for(x=a.length;l<x;)w=a.charAt(l),u=a.charAt(l-1),"["===w&&"\\"===u?(n.push(a.substring(m,l-1)+"["),m=l+1):"]"===w&&
"\\"===u?(n.push(a.substring(m,l-1)+"]"),m=l+1):"["===w&&-1===f?(n.push(a.substring(m,l)),m=l,f++):"["===w?f++:"]"===w&&0===f?(n.push(this.evaluator.parser.parse(a.substring(m,l+1))),m=l+1,f--):("]"==a.charAt(l)&&(f=0>f?f:f-1),c+=a.charAt(l)),l++;n.push(a.substring(m,l));return n};v.prototype.textToString=function(a,d,e){c="";if("rtfNode"!==a.type)for(var f=0,l=a.length;f<l;f++)"string"===typeof a[f]?c+=a[f]:(r=this.evaluator.eval(a[f])[0][0],""!==r&&("string"===typeof r?c+=r:Infinity===r?c+="Infinity":
-Infinity===r?c+="-Infinity":isNaN(r)||"NaN"===r?c+="NaN":(r=parseFloat(r),r=e?r.toFixed(d):b.removeNeedlessDecimals(r.toFixed(d)),c+=r.toString().replace(".",this.decimal_symbol))));return c};b.TextObject=v;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,d=function(){};d.prototype.tokenize=function(b){b=b.replace(/\\n/g,"\\newline ");var d=[],e=null,g=0,h=b.length;b.charAt(0);var n=!1,c=!1,l=0;a="";for(var m=0;m<h;m++){var f=b.charAt(m);var w=b.charAt(m+1);"\\"===f&&"$"===w&&(c=!0);"{"===f?l++:"}"===f&&(l--,c&&0===l&&(c=!1));c?"_"===f?"{"===w?a+="\\subindex":(a+="\\subindex{"+w+"}",m++):"^"===f?"{"===w?a+="\\superindex":(a+="\\superindex{"+w+"}",m++):a+=f:a+=f}b=a;w=b.charAt(0);for(h=b.length;g<
h;)f=w,w=b.charAt(g+1),n&&("{"===f||"["===f||"\\"===f||" "===f?(n=!1," "===f&&(e={type:"ignore"},d.push(e))):e.value+=f),n||"\\"!==f?n||"{"!==f&&"["!==f?n||"}"!==f&&"]"!==f?n||(e&&"text"===e.type?e.value+=f:e&&"ignore"===e.type?(d.pop(),e=d[d.length-1]):(e={type:"text",value:f},d.push(e))):(e={type:"close",value:f},d.push(e)):(e={type:"open",value:f},d.push(e)):(n=!0,e={type:"command",value:""},d.push(e)),g++;return d};b.DescarTeXTokenizer=d;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=function(){this.tokenizer=new b.DescarTeXTokenizer};a.prototype.parse=function(a,h,q){a=this.tokenizer.tokenize(a);var d=new b.TextNode("","textBlock",q,null),g=new b.TextNode("","textLineBlock",q.clone(),null);d.addChild(g);for(var p=[],n=void 0,c=q,l=[q],m,f,w,u,x=!1,r=0,v=a.length;r<v;r++)if("text"===a[r].type)if("color_parameter"===n)f=new b.Color(a[r].value,h);else if("text_size_parameter"===n)w=parseFloat(a[r].value);else if("textLineBlock"===
g.nodeType){m=a[r].value.split(" ");for(var z=0,y=m.length;z<y;z++)""!==m[z]&&g.addChild(new b.TextNode(m[z],"text",c.clone(),null)),z+1<y&&g.addChild(new b.TextNode(" ","space",c.clone(),null))}else g.addChild(new b.TextNode(a[r].value,"text",c.clone(),null));else"command"===a[r].type&&"curlyBracketOpen"===a[r].value?g.addChild(new b.TextNode("{","text",c.clone(),null)):"command"===a[r].type&&"curlyBracketClose"===a[r].value?g.addChild(new b.TextNode("}","text",c.clone(),null)):"command"===a[r].type&&
"squareBracketOpen"===a[r].value?g.addChild(new b.TextNode("[","text",c.clone(),null)):"command"===a[r].type&&"squareBracketClose"===a[r].value?g.addChild(new b.TextNode("]","text",c.clone(),null)):"command"===a[r].type&&"newline"===a[r].value?(0===g.children.length&&g.addChild(new b.TextNode("","text",c.clone(),null)),g=new b.TextNode("","textLineBlock",q.clone(),null),d.addChild(g)):"command"===a[r].type&&"b"===a[r].value?(n="bold",p.push(n)):"command"===a[r].type&&"i"===a[r].value?(n="italic",
p.push(n)):"command"===a[r].type&&"o"===a[r].value?(n="overline",p.push(n)):"command"===a[r].type&&"u"===a[r].value?(n="underline",p.push(n)):"command"===a[r].type&&"color"===a[r].value?(n="color",p.push(n)):"command"===a[r].type&&"ts"===a[r].value?(n="text_size",p.push(n)):"command"===a[r].type&&"sansserif"===a[r].value.toLowerCase()?(n="sansserif",p.push(n)):"command"===a[r].type&&"serif"===a[r].value.toLowerCase()?(n="serif",p.push(n)):"command"===a[r].type&&"monospace"===a[r].value.toLowerCase()?
(n="monospace",p.push(n)):"command"===a[r].type&&"c"===a[r].value?(n="center",p.push(n)):"command"===a[r].type&&"l"===a[r].value?(n="left",p.push(n)):"command"===a[r].type&&"r"===a[r].value?(n="right",p.push(n)):"command"===a[r].type&&"j"===a[r].value?(n="justify",p.push(n)):"command"===a[r].type&&"$"===a[r].value?(n="formula",p.push(n),x=!0):"command"===a[r].type&&"sum"===a[r].value?(n="sum",p.push(n)):"command"===a[r].type&&"prod"===a[r].value?(n="prod",p.push(n)):"command"===a[r].type&&"int"===
a[r].value?(n="integral",p.push(n)):"command"===a[r].type&&"lim"===a[r].value?(n="limit",p.push(n)):"command"===a[r].type&&"sqrt"===a[r].value?(n="radical",p.push(n)):"command"===a[r].type&&"subindex"===a[r].value?(n="subIndex",p.push(n)):"command"===a[r].type&&"superindex"===a[r].value?(n="superIndex",p.push(n)):"command"===a[r].type&&"frac"===a[r].value?(n="numerator",p.push(n)):"open"===a[r].type&&"{"===a[r].value&&void 0!==n?"bold"===n||"italic"===n||"overline"===n||"underline"===n?(c=c.clone(),
c[n]=!0,l.push(c)):"sansserif"===n?(c=c.clone(),c.family="sansserif",l.push(c)):"serif"===n?(c=c.clone(),c.family="serif",l.push(c)):"monospace"===n?(c=c.clone(),c.family="monospaced",l.push(c)):"text_size"===n?n="text_size_parameter":"text_size_text"===n?(c=c.clone(),c.size=w,l.push(c)):"color"===n?n="color_parameter":"color_text"===n?(c=c.clone(),c.color=f,l.push(c)):"center"===n||"left"===n||"right"===n||"justify"===n?(c=c.clone(),c.align=n,l.push(c),g=new b.TextNode("","textLineBlock",c.clone(),
null),d.addChild(g)):"formula"===n?(c=c.clone(),l.push(c),u=new b.TextNode("","formula",c.clone(),null),g.addChild(u),g=u):"subIndex"===n||"superIndex"===n?x?(c=c.clone(),l.push(c),u=new b.TextNode("",n,c.clone(),null),g.addChild(u),g=u):g.addChild(new b.TextNode("subIndex"===n?"_":"^","text",c.clone(),null)):"radical"===n?x&&(u=new b.TextNode("","radical",c.clone(),null),g.addChild(u),g=u,c=c.clone(),l.push(c),u=new b.TextNode("","index",c.clone(),null),g.addChild(u),g=u,n="index"):"index"===n?x&&
(l.pop(),c=l[l.length-1],u=new b.TextNode("","radicand",c.clone(),null),g.addChild(u),g=u,n="radicand"):"sum"===n||"integral"===n||"limit"===n||"prod"===n?x&&(u=new b.TextNode("",n,c.clone(),null),g.addChild(u),g=u,c=c.clone(),l.push(c),u=new b.TextNode("","from",c.clone(),null),g.addChild(u),g=u,n="from",p[p.length-1]=n):"from"===n?x&&(u=new b.TextNode("","to",c.clone(),null),g.addChild(u),g=u,n="to",p[p.length-1]=n):"to"===n?x&&(l.pop(),c=l[l.length-1],u=new b.TextNode("","what",c.clone(),null),
g.addChild(u),g=u,n="what",p[p.length-1]=n):"numerator"===n?x&&(u=new b.TextNode("","fraction",c.clone(),null),g.addChild(u),g=u,c=c.clone(),l.push(c),u=new b.TextNode("","numerator",c.clone(),null),g.addChild(u),g=u,n="numerator"):"denominator"===n&&(u=new b.TextNode("",n,c.clone(),null),g.addChild(u),g=u):"close"===a[r].type&&"}"===a[r].value&&void 0!==n&&("bold"===n||"italic"===n||"overline"===n||"underline"===n||"color_text"===n||"color"===n||"text_size_text"===n||"text_size"===n||"sansserif"===
n||"serif"===n||"monospace"===n?(l.pop(),c=l[l.length-1],p.pop(),n=p[p.length-1]):"color_parameter"===n?n="color_text":"text_size_parameter"===n?n="text_size_text":"center"===n||"left"===n||"right"===n||"justify"===n?(l.pop(),c=l[l.length-1],p.pop(),n=p[p.length-1],a[r+1]&&"command"===a[r+1].type&&"newline"===a[r+1].value?g=d:(g=new b.TextNode("","textLineBlock",c.clone(),null),d.addChild(g))):"formula"===g.nodeType?(x=!1,l.pop(),c=l[l.length-1],p.pop(),n=p[p.length-1],g=g.parent):"subIndex"===g.nodeType||
"superIndex"===g.nodeType?x&&(l.pop(),c=l[l.length-1],p.pop(),n=p[p.length-1],g=g.parent):"index"===g.nodeType?g=g.parent:"radicand"===g.nodeType?(p.pop(),n=p[p.length-1],g=g.parent.parent):"from"===g.nodeType?g=g.parent:"to"===g.nodeType?g=g.parent:"what"===g.nodeType?(p.pop(),n=p[p.length-1],g=g.parent.parent):"numerator"===g.nodeType?(n="denominator",g=g.parent):"denominator"===g.nodeType&&(l.pop(),c=l[l.length-1],p.pop(),n=p[p.length-1],g=g.parent.parent));var A,B,E=null,I=[];d.children.forEach(function(a){for(var b=
0,c=a.children.length;b<c-1;b++)A=a.children[b],B=a.children[b+1],"text"===A.nodeType&&"text"===B.nodeType&&A.style.equals(B.style)?(null===E&&(E=A,u=A.clone(),E.changeNodeType("word"),E.value="___"+u.value,E.addChild(u)),u=B.clone(),E.addChild(u),I.push(B),E.value+=u.value):E=null});I.forEach(function(a){a.parent.removeChild(a)});d.normalize();d.adjustFontSize();return d};b.DescarTeXParser=a;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,d=function(a){this.size=20;this.family="Arimo";this.overline=this.underline=this.bold=this.italic=!1;this.border=this.color=null;this.align="left";a=a||{};this.set(a)};d.prototype.clone=function(){return new d(Object.assign({},this))};d.prototype.set=function(a){Object.assign(this,a)};d.prototype.equals=function(a){var b=!0,d;for(d in this)this.hasOwnProperty(d)&&(b=b&&this[d]===a[d]);return b};d.prototype.toString=function(d){/arial|sansserif/i.test(this.family)?
a=b.sansserif_font:/times|serif/i.test(this.family)?a=d?b.math_font:b.serif_font:/courier|monospaced/i.test(this.family)&&(a=b.monospace_font);return((this.bold?"bold":"")+" "+(this.italic?"italic":"")+" "+this.size+"px "+a).trim()};b.TextStyle=d;return b}(descartesJS||{});
descartesJS=function(b){function a(a,b){for(var c=0,d=0;d<b;d++)c+=a[d];return c}function d(a){var b={ascent:0,descent:0,h:0,w:0,x:0,y:0,offsetX:0,offsetY:0,marginX:0,marginY:0,paddingX:0,paddingY:0};if(""==a.trim())return b;var c=parseInt(a.match(/(\d+\.*)+px/)[0]);a=a.match("sansserif")?"sansserif":a.match("serif")?"serif":"monospace";b.ascent=Math.ceil((n[a].ascent+25)*c/n[a].unitsPerEm);b.descent=Math.ceil(Math.abs((n[a].descent-25)*c/n[a].unitsPerEm));b.h=b.ascent+b.descent;return b}if(b.loadLib)return b;
var h=!1,q="#000000",e=2,g=!1,p=function(a,d,e,f){this.type="rtfNode";this.evaluator=f;this.parent=null;this.children=[];this.metrics={ascent:0,descent:0,h:0,w:0,x:0,y:0,offsetX:0,offsetY:0,marginX:0,marginY:0,paddingX:0,paddingY:0};this.value=a;this.style=e;this.changeNodeType(d);this.drawBorder=b.in_editor?this.drawBorderSpecial:function(){}};p.prototype.changeNodeType=function(a){this.nodeType=a;this.draw=null;switch(this.nodeType){case "textBlock":this.draw=this.drawTextBlock;break;case "textLineBlock":this.draw=
this.drawTextLineBlock;break;case "formula":this.draw=this.drawFormula;break;case "superIndex":this.draw=this.drawSuperIndex;break;case "subIndex":this.draw=this.drawSubIndex;break;case "dynamicText":this.draw=this.drawDynamicText;this.decimal_symbol=this.evaluator.parent.decimal_symbol;break;case "fraction":this.draw=this.drawFraction;break;case "numerator":case "denominator":this.draw=this.drawNumDen;break;case "radical":this.draw=this.drawRadical;break;case "limit":this.draw=this.drawLimit;break;
case "integral":this.draw=this.drawIntegral;break;case "prod":this.draw=this.drawProd;break;case "sum":this.draw=this.drawSum;break;case "matrix":this.draw=this.drawMatrix;break;case "defparts":this.draw=this.drawDefparts;break;case "text":case "newLine":case "mathSymbol":this.draw=this.drawText;break;case "space":this.draw=this.drawSpace;break;case "word":this.draw=this.drawWord;break;case "hyperlink":this.draw=this.drawHyperlink;break;case "index":case "radicand":case "from":case "to":case "what":case "element":this.draw=
this.drawGenericBlock;break;case "componentNumCtrl":this.draw=this.drawComponentNumCtrl;break;case "componentSpace":this.draw=this.drawComponentSpace}};p.prototype.clone=function(){for(var a=new p(this.value,this.nodeType,this.style.clone()),b=0,d=this.children.length;b<d;b++)a.addChild(this.children[b].clone());return a};p.prototype.toStr=function(){for(var a=this.value,b=0,d=this.children.length;b<d;b++)a+=" "+this.children[b].toStr();return a};p.prototype.stringify=function(){var a="{"+('"NT":"'+
this.nodeType+'",');a+='"V":"'+(this.value||"")+'",';a+='"C":[';for(var b=0,d=this.children.length;b<d;b++)a+=this.children[b].stringify()+(b==d-1?"":",");a=a+"],"+('"S":'+JSON.stringify(this.style));return a+"}"};p.prototype.addChild=function(a,b){b&&null!==a.parent&&a.parent.removeChild(a);a.parent=this;this.children.push(a)};p.prototype.removeChild=function(a){var b=this.children.indexOf(a);-1!==b&&(a.parent=null,this.children.splice(b,1))};p.prototype.getFirstTextNode=function(){for(var a=this;0<
a.children.length;)a=a.children[0];return a};p.prototype.getLastTextNode=function(){for(var a=this;0<a.children.length;)a=a.children[a.children.length-1];return a};p.prototype.nextSibling=function(){if(this.parent)for(var a=null,b=0,d=this.parent.children.length;b<d;b++){if(a)return this.parent.children[b];this.parent.children[b]===this&&(a=!0)}return null};p.prototype.prevSibling=function(){if(this.parent)for(var a=0,b=this.parent.children.length-1;a<b;a++)if(this.parent.children[a+1]===this)return this.parent.children[a];
return null};p.prototype.queryAll=function(a){var b=[];"string"===typeof a&&(a=new RegExp(a));for(var c=0,d=this.children.length;c<d;c++)b=b.concat(this.children[c].queryAll(a));this.nodeType.match(a)&&b.push(this);return b};p.prototype.insertBefore=function(a,b){a=this.children.indexOf(a);-1!==a&&(b.parent=this,this.children.splice(a,0,b))};p.prototype.insertAfter=function(a,b){a=this.children.indexOf(a);-1!==a&&(b.parent=this,this.children.splice(a+1,0,b))};p.prototype.normalize=function(){for(var a=
this.queryAll(/textLineBlock|formula|numerator|denominator|superIndex|subIndex|index|subIndex|radicand|from|to|what|element/),b=0,d=a.length;b<d;b++)0===a[b].children.length&&a[b].addChild(new p("","text",a[b].style));a=this.queryAll(/formula|fraction|superIndex|subIndex|radical|sum|integral|prod|limit|matrix|defparts|dynamicText|componentNumCtrl|componentSpace/);b=0;for(d=a.length;b<d;b++){var e=a[b];(null===e.prevSibling()||null!==e.prevSibling()&&"text"!==e.prevSibling().nodeType)&&e.parent.insertBefore(e,
new p("","text",e.parent.style));(null===e.nextSibling()||null!==e.nextSibling()&&"text"!==e.nextSibling().nodeType)&&e.parent.insertAfter(e,new p("","text",e.parent.style))}return this};p.prototype.removeEmptyText=function(){for(var a=this.queryAll(/text/),b=0,d=a.length;b<d;b++)""===a[b].value&&a[b].parent&&a[b].parent.removeChild(a[b])};p.prototype.adjustFontSize=function(a){var b=this.style.size;"formula"===this.nodeType&&(a=!0);for(var c=0,d=this.children.length;c<d;c++)"text"===this.children[c].nodeType&&
a?(this.children[c].style.size=b,this.children[c].styleString=this.children[c].style.toString()):"index"===this.children[c].nodeType?(this.children[c].style.size=Math.max(parseInt(b-.5*b),8),this.children[c].styleString=this.children[c].style.toString(),this.children[c].adjustFontSize(!0)):"to"===this.children[c].nodeType||"from"===this.children[c].nodeType?(this.children[c].style.size=Math.max(parseInt(b-.2*b),8),this.children[c].styleString=this.children[c].style.toString(),this.children[c].adjustFontSize(!0)):
"numerator"===this.children[c].nodeType||"denominator"===this.children[c].nodeType?(this.children[c].style.size=Math.max(parseInt(b-.1*b),8),this.children[c].styleString=this.children[c].style.toString(),this.children[c].adjustFontSize(!0)):"subIndex"===this.children[c].nodeType||"superIndex"===this.children[c].nodeType?(this.children[c].style.size=Math.max(parseInt(b-.33*b),8),this.children[c].styleString=this.children[c].style.toString(),this.children[c].adjustFontSize(!0)):(a&&(this.children[c].style.size=
b,this.children[c].styleString=this.children[c].style.toString()),this.children[c].adjustFontSize(a))};p.prototype.propagateStyle=function(a,b){this.style[a]=b;this.styleString=this.style.toString();for(var c=0,d=this.children.length;c<d;c++)this.children[c].propagateStyle(a,b)};p.prototype.update=function(a,b,d,f,h,p,n,r){e=d;g=f;q=n;this.metrics.w=this.metrics.h=0;n=b;if(20<=r)for(d=0;d<this.children.length;d++)this.children[d].breakLines(r);d=0;for(f=this.children.length;d<f;d++){var c=this.children[d];
c.updateLine();c.metrics.offsetX=a;c.metrics.y=b;b+=parseInt(c.metrics.ascent+.5);c.metrics.offsetY=b;h=parseInt(c.metrics.descent+.5)+parseInt(1.5+.05*c.style.size);b+=h;this.metrics.h+=c.metrics.h;this.metrics.w=Math.max(this.metrics.w,c.metrics.w)}b=n;p=p||"";p.match("right")?a-=this.metrics.w:p.match("_center")&&(a-=this.metrics.w/2);p.match("bottom")?b-=this.metrics.h:p.match("center_")&&(b-=this.metrics.h/2);p=this.children;d=0;for(f=p.length;d<f;d++)"left"===p[d].style.align?p[d].metrics.offsetX=
a:"right"===p[d].style.align?p[d].metrics.offsetX=a+this.metrics.w-p[d].metrics.w:"center"===p[d].style.align?p[d].metrics.offsetX=a+(this.metrics.w-p[d].metrics.w)/2:"justify"===p[d].style.align&&20<=r&&(h=d<f-1?p[d+1].value:null,p[d].metrics.offsetX=a,"wrap"===h&&p[d].justifyAux(r)),p[d].metrics.y=b,b+=parseInt(p[d].metrics.ascent+.5),p[d].metrics.offsetY=b,h=parseInt(p[d].metrics.descent+.5)+parseInt(1.5+.05*p[d].style.size),b+=h};p.prototype.breakLines=function(a){for(var c,d=0,e=!1,g=[],h=0,
q=this.children.length;h<q;h++)c=this.children[h],e?g.push(c):("text"===c.nodeType||"space"===c.nodeType?(b.ctx.font=c.style.toString(),c.metrics.w=b.ctx.measureText(c.value).width):"word"===c.nodeType?c.updateLine():"formula"===c.nodeType&&c.updateFormula(),d+=c.metrics.w,d>a&&"space"!==c.nodeType&&0<h&&(e=!0,g.push(c)));if(0<g.length)for(a=new p("wrap","textLineBlock",this.style.clone(),null),this.parent.insertAfter(this,a),h=0,q=g.length;h<q;h++)g[h].parent&&g[h].parent.removeChild(g[h]),a.addChild(g[h])};
p.prototype.updateLine=function(a){var c=this;if("textLineBlock"===this.nodeType||"word"===this.nodeType){this.metrics.w=0;this.metrics.ascent=0;for(var e=this.metrics.descent=0,f=this.children,g,h=0,p=f.length;h<p;h++){g=f[h];if("text"===g.nodeType){b.ctx.font=g.style.toString();var q=""!==g.value?g.value:b.in_editor?"\u200a":"";g.metrics=d(b.ctx.font);g.metrics.w=b.ctx.measureText(q).width;g.metrics.offsetX=e;Object.defineProperties(g.metrics,{x:{get:function(){return c.metrics.offsetX+this.offsetX}},
y:{get:function(){return c.metrics.offsetY+this.offsetY}}})}"space"===g.nodeType?(b.ctx.font=g.style.toString(),g.metrics=d(b.ctx.font),g.metrics.w=h===p-1?0:a?a:b.ctx.measureText(" ").width,g.metrics.offsetX=e,Object.defineProperties(g.metrics,{x:{get:function(){return c.metrics.offsetX+this.offsetX}},y:{get:function(){return c.metrics.offsetY+this.offsetY}}})):"word"===g.nodeType&&(g.updateLine(),g.metrics.offsetX_aux=e,Object.defineProperties(g.metrics,{offsetX:{get:function(){return c.metrics.offsetX+
this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY}}}));"hyperlink"===g.nodeType&&(b.ctx.font=g.styleString,q=""!==g.value?g.value:b.in_editor?"\u200a":"",g.metrics=d(b.ctx.font),g.metrics.w=b.ctx.measureText(q).width,g.metrics.offsetX=e,Object.defineProperties(g.metrics,{x:{get:function(){return c.metrics.offsetX+this.offsetX}},y:{get:function(){return c.metrics.offsetY}}}),g.clickCatcher||(g.clickCatcher=b.newHTML("div",{style:"position:absolute;width:"+g.metrics.w+"px;height:"+
g.metrics.h+"px;cursor:pointer;"}),g.clickCatcher.rtfNode=g,g.clickCatcher.action=new b.OpenURL(this.evaluator.parent,g.URL),g.clickCatcher.addEventListener("click",function(a){this.rtfNode.click=!0;this.action.execute();this.rtfNode.draw(this.rtfNode.ctx)})));"componentNumCtrl"===g.nodeType&&(g.componentNumCtrl=this.evaluator.parent.getControlByCId(g.value),b.ctx.font=g.styleString,g.metrics=d(b.ctx.font),g.metrics.w=g.componentNumCtrl.w,g.metrics.h=g.componentNumCtrl.h,g.metrics.offsetX=e,Object.defineProperties(g.metrics,
{x:{get:function(){return c.metrics.offsetX+this.offsetX}},y:{get:function(){return c.metrics.offsetY}}}));"componentSpace"===g.nodeType?(g.componentSpace=this.evaluator.parent.getSpaceByCId(g.value),b.ctx.font=g.styleString,g.metrics=d(b.ctx.font),g.metrics.w=g.componentSpace.w,g.metrics.h=g.componentSpace.h,g.metrics.offsetX=e,Object.defineProperties(g.metrics,{x:{get:function(){return c.metrics.offsetX+this.offsetX}},y:{get:function(){return c.metrics.offsetY}}})):"formula"===g.nodeType&&(g.updateFormula(),
g.metrics.marginX=g.metrics.marginY=g.metrics.paddingX=g.metrics.paddingY=0,g.metrics.offsetX_aux=e,Object.defineProperties(g.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY}}}),g.metrics.w+=2*g.metrics.paddingX,g.metrics.ascent+=g.metrics.paddingY,g.metrics.descent+=g.metrics.paddingY,g.metrics.h+=2*g.metrics.paddingY,e+=2*g.metrics.marginX);
this.metrics.w+=g.metrics.w+2*g.metrics.marginX;this.metrics.ascent=Math.max(this.metrics.ascent,g.metrics.ascent);this.metrics.descent=Math.max(this.metrics.descent,g.metrics.descent);e+=g.metrics.w}this.metrics.h=this.metrics.ascent+this.metrics.descent}};p.prototype.updateFormula=function(){var c=this;this.metrics={ascent:0,descent:0,h:0,w:0,x:0,y:0,offsetX:0,offsetY:0,marginX:0,marginY:0,paddingX:0,paddingY:0};for(var l=this.children,m,f=0,h={metrics:{ascent:0,descent:0,h:0,w:0,x:0,y:0,offsetX:0,
offsetY:0,marginX:0,marginY:0,paddingX:0,paddingY:0}},p=0,q=l.length;p<q;p++){m=l[p];if("text"===m.nodeType){b.ctx.font=m.style.toString(!0);var n=""!==m.value?m.value:b.in_editor?"\u200a":"";m.metrics=d(b.ctx.font);m.metrics.w=b.ctx.measureText(n).width;m.metrics.offsetX=f;Object.defineProperties(m.metrics,{x:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.offsetX}},y:{get:function(){return c.metrics.offsetY}}});f+=c.metrics.marginX}else if("dynamicText"===m.nodeType){n=void 0===
m.decimals?e:m.evaluator.eval(m.decimals);var v=void 0===m.fixed?g:m.fixed,z=m.evaluator.eval(m.value);parseFloat(z).toString()===z.toString()&&(z=v?parseFloat(z).toFixed(n):b.removeNeedlessDecimals(parseFloat(z).toFixed(n)),z=(""+z).replace(".",m.decimal_symbol));m.evalValue=z;b.ctx.font=m.style.toString(!0);m.metrics=d(b.ctx.font);m.metrics.marginX=0;m.metrics.paddingX=0;m.metrics.w=b.ctx.measureText(z).width+2*m.metrics.paddingX;m.metrics.offsetX_aux=f;Object.defineProperties(m.metrics,{x:{get:function(){return this.offsetX}},
y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.offsetX_aux+this.marginX}},offsetY:{get:function(){return c.metrics.offsetY}}});f+=2*m.metrics.marginX}if("superIndex"===m.nodeType)n=m,n.updateFormula(),n.metrics.marginX=0,n.metrics.paddingX=0,n.metrics.paddingY=0,n.metrics.offsetX_aux=f,n.metrics.prevChild=h,Object.defineProperties(n.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+
c.metrics.paddingX+this.offsetX_aux+this.marginX}},offsetY:{get:function(){return c.metrics.offsetY+this.ascent+(this.prevChild.metrics.descent-this.prevChild.metrics.ascent)/2-this.h}}}),n.metrics.w+=2*n.metrics.paddingX,n.metrics.ascent+=n.metrics.paddingY,n.metrics.descent+=n.metrics.paddingY,n.metrics.h+=2*n.metrics.paddingY,n.metrics.tmp_ascent=n.metrics.h+(n.metrics.prevChild.metrics.ascent-n.metrics.prevChild.metrics.descent)/2,f+=2*n.metrics.marginX;else if("subIndex"===m.nodeType)n=m,n.updateFormula(),
n.metrics.marginX=0,n.metrics.paddingX=0,n.metrics.paddingY=0,n.metrics.offsetX_aux=f,n.metrics.prevChild=h,Object.defineProperties(n.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY+this.ascent+(this.prevChild.metrics.descent-this.prevChild.metrics.ascent)/2}}}),n.metrics.w+=n.metrics.paddingX,n.metrics.ascent+=n.metrics.paddingY,
n.metrics.descent+=n.metrics.paddingY,n.metrics.h+=2*n.metrics.paddingY,this.metrics.descent=n.metrics.ascent+(n.metrics.prevChild.metrics.descent-n.metrics.prevChild.metrics.ascent)/2+n.metrics.descent,f+=n.metrics.marginX;else if("fraction"===m.nodeType){v=m;v.updateFormula();n=v.children;z=n[0];n=n[1];v.metrics.marginX=parseInt(.5+.075*this.style.size);v.metrics.paddingX=0;v.metrics.paddingY=0;var y=Math.max(z.metrics.w,n.metrics.w)+2*v.metrics.paddingX;v.metrics.prevChild=h;v.metrics.offsetX_aux=
f;var A=parseInt(-h.metrics.descent+4*h.metrics.h/9);Object.defineProperties(v.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY+A}},offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY-A}}});Object.defineProperties(z.metrics,{parent:{value:v},maxWidth:{value:y},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+
parseInt((this.maxWidth-this.w)/2)}},offsetY:{get:function(){return this.parent.metrics.offsetY-this.descent-this.parent.metrics.paddingY}}});Object.defineProperties(n.metrics,{parent:{value:v},maxWidth:{value:y},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+parseInt((this.maxWidth-this.w)/2)}},offsetY:{get:function(){return this.parent.metrics.offsetY+this.ascent+this.parent.metrics.paddingY}}});v.metrics.w=
y;v.metrics.ascent=z.metrics.h+A+2*v.metrics.paddingY;v.metrics.descent=n.metrics.h-A+2*v.metrics.paddingY;v.metrics.h=z.metrics.h+n.metrics.h+4*v.metrics.paddingY;f+=2*v.metrics.marginX}else if("radical"===m.nodeType){h=m;h.updateFormula();n=h.children;v=n[0];var B=n[1];h.metrics.marginX=parseInt(1.5+.075*this.style.size);h.metrics.paddingX=parseInt(1.5+.075*this.style.size);h.metrics.paddingY=parseInt(1.5+.05*this.style.size);h.metrics.offsetX_aux=f;Object.defineProperties(h.metrics,{x:{get:function(){return this.offsetX}},
y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY}}});n=h.style.size;h.radicalSign={w:n,scaleX:n/722,scaleY:B.metrics.h/1E3};z=parseInt(v.metrics.w-2*h.radicalSign.w/3);Object.defineProperties(h.radicalSign,{parent:{value:h},displaceIndex:{value:z},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+Math.max(this.displaceIndex,0)}},
y:{get:function(){return c.metrics.offsetY-B.metrics.ascent}}});Object.defineProperties(v.metrics,{parent:{value:h},displaceIndex:{value:z},fontSize:{value:n},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+Math.max(this.displaceIndex,0)-this.displaceIndex}},offsetY:{get:function(){return c.metrics.offsetY-this.descent-2*this.fontSize/5}}});Object.defineProperties(B.metrics,{parent:{value:h},
displaceIndex:{value:z},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+this.parent.radicalSign.w+Math.max(this.displaceIndex,0)}},offsetY:{get:function(){return c.metrics.offsetY}}});z=v.metrics.w<2*h.radicalSign.w/3?h.radicalSign.w:parseInt(v.metrics.w+h.radicalSign.w/3);h.metrics.w=z+2*h.metrics.paddingX+B.metrics.w;h.metrics.ascent=Math.max(B.metrics.ascent,v.metrics.h+2*n/5)+
h.metrics.paddingY;h.metrics.descent=B.metrics.descent+h.metrics.paddingY;h.metrics.h=h.metrics.ascent+h.metrics.descent;f+=2*h.metrics.marginX}else if("sum"===m.nodeType){v=m;v.updateFormula();n=v.children;z=n[0];y=n[1];var E=n[2];v.metrics.marginX=parseInt(1.5+.075*this.style.size);v.metrics.paddingX=parseInt(1.5+.075*this.style.size);v.metrics.paddingY=parseInt(1.5+.05*this.style.size);v.metrics.offsetX_aux=f;Object.defineProperties(v.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},
offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY}}});b.ctx.font=m.style.toString();var I=d(b.ctx.font);h=parseInt(1.2*I.h);n=parseInt(.5+780*h/1E3);v.sigmaSign={w:n,h:h,scale:h/1E3};var D=Math.max(y.metrics.w,z.metrics.w,v.sigmaSign.w);v.sigmaSign.parent=v;Object.defineProperties(v.sigmaSign,{sumWidth:{value:D},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.sumWidth-
this.w)/2)}},y:{get:function(){return c.metrics.offsetY+I.descent-(this.h+I.h)/2}}});n=I.descent-y.metrics.descent-(h+I.h)/2-v.metrics.paddingY;Object.defineProperties(y.metrics,{parent:{value:v},sumWidth:{value:D},newBaselineTo:{value:n},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.sumWidth-this.w)/2)}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaselineTo}}});
h=z.metrics.ascent+I.descent+(h-I.h)/2+v.metrics.paddingY;Object.defineProperties(z.metrics,{parent:{value:v},sumWidth:{value:D},newBaselineFrom:{value:h},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.sumWidth-this.w)/2)}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaselineFrom}}});Object.defineProperties(E.metrics,{parent:{value:v},sumWidth:{value:D},
x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+2*this.parent.metrics.paddingX+this.sumWidth}},offsetY:{get:function(){return c.metrics.offsetY}}});v.metrics.w=D+E.metrics.w+3*v.metrics.paddingX;v.metrics.ascent=Math.max(E.metrics.ascent,-n+y.metrics.ascent)+v.metrics.paddingY;v.metrics.descent=Math.max(E.metrics.descent,h+z.metrics.descent)+v.metrics.paddingY;v.metrics.h=v.metrics.ascent+v.metrics.descent;
f+=2*v.metrics.marginX}else if("integral"===m.nodeType){v=m;v.updateFormula();n=v.children;z=n[0];y=n[1];E=n[2];v.metrics.marginX=parseInt(1.5+.075*this.style.size);v.metrics.paddingX=parseInt(1.5+.075*this.style.size);v.metrics.paddingY=parseInt(1.5+.05*this.style.size);v.metrics.offsetX_aux=f;Object.defineProperties(v.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.marginX+this.offsetX_aux}},
offsetY:{get:function(){return c.metrics.offsetY}}});b.ctx.font=m.style.toString();I=d(b.ctx.font);D=parseInt(1.2*I.h);var G=parseInt(10.5+529*D/1E3);v.sign={w:G,h:D,scale:D/1E3};v.sign.parent=v;Object.defineProperties(v.sign,{x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX}},y:{get:function(){return c.metrics.offsetY+I.descent-(this.h+I.h)/2}}});n=I.descent-(D+I.h)/2-y.metrics.descent+D/3;Object.defineProperties(y.metrics,{parent:{value:v},integralWidth:{value:G},
newBaselineTo:{value:n},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt(4*this.integralWidth/5)}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaselineTo}}});h=I.descent+z.metrics.ascent/2;Object.defineProperties(z.metrics,{parent:{value:v},integralWidth:{value:G},newBaselineFrom:{value:h},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},
offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt(2*this.integralWidth/5)}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaselineFrom}}});G=Math.max(parseInt(3*G/5)+y.metrics.w,parseInt(2*G/5+z.metrics.w))+v.metrics.paddingX;Object.defineProperties(E.metrics,{parent:{value:v},whatDisplace:{value:G},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+
this.whatDisplace}},offsetY:{get:function(){return c.metrics.offsetY}}});v.metrics.w=G+E.metrics.w+2*v.metrics.paddingX;v.metrics.ascent=Math.max(E.metrics.ascent,-n+y.metrics.ascent)+v.metrics.paddingY;v.metrics.descent=Math.max(E.metrics.descent,h+z.metrics.descent,D-v.metrics.ascent)+v.metrics.paddingY;v.metrics.h=Math.max(v.metrics.ascent+v.metrics.descent,D);f+=2*v.metrics.marginX}else if("prod"===m.nodeType)v=m,v.updateFormula(),n=v.children,z=n[0],y=n[1],E=n[2],v.metrics.marginX=parseInt(1.5+
.075*this.style.size),v.metrics.paddingX=parseInt(1.5+.075*this.style.size),v.metrics.paddingY=parseInt(1.5+.05*this.style.size),v.metrics.offsetX_aux=f,Object.defineProperties(v.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY}}}),b.ctx.font=m.style.toString(),I=d(b.ctx.font),h=parseInt(1.2*I.h),n=parseInt(.5+
876*h/1E3),v.piSign={w:n,h:h,scale:h/1E3},D=Math.max(y.metrics.w,z.metrics.w,v.piSign.w),v.piSign.parent=v,Object.defineProperties(v.piSign,{prodWidth:{value:D},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.prodWidth-this.w)/2)}},y:{get:function(){return c.metrics.offsetY+I.descent-(this.h+I.h)/2}}}),n=I.descent-y.metrics.descent-(h+I.h)/2-v.metrics.paddingY,Object.defineProperties(y.metrics,{parent:{value:v},prodWidth:{value:D},newBaselineTo:{value:n},
x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.prodWidth-this.w)/2)}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaselineTo}}}),h=z.metrics.ascent+I.descent+(h-I.h)/2+v.metrics.paddingY,Object.defineProperties(z.metrics,{parent:{value:v},prodWidth:{value:D},newBaselineFrom:{value:h},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},
offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+parseInt((this.prodWidth-this.w)/2)}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaselineFrom}}}),Object.defineProperties(E.metrics,{parent:{value:v},prodWidth:{value:D},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+2*this.parent.metrics.paddingX+this.prodWidth}},offsetY:{get:function(){return c.metrics.offsetY}}}),
v.metrics.w=D+E.metrics.w+3*v.metrics.paddingX,v.metrics.ascent=Math.max(E.metrics.ascent,-n+y.metrics.ascent)+v.metrics.paddingY,v.metrics.descent=Math.max(E.metrics.descent,h+z.metrics.descent)+v.metrics.paddingY,v.metrics.h=v.metrics.ascent+v.metrics.descent,f+=2*v.metrics.marginX;else if("limit"===m.nodeType){h=m;h.updateFormula();n=h.children;var H=n[0];v=n[1];n=n[2];h.metrics.marginX=parseInt(1.5+.075*this.style.size);h.metrics.paddingX=parseInt(1.5+.075*this.style.size);h.metrics.paddingY=
parseInt(1.5+.05*this.style.size);h.metrics.offsetX_aux=f;Object.defineProperties(h.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY}}});b.ctx.font=m.style.toString();I=d(b.ctx.font);z=parseInt(.5+b.ctx.measureText("l\u00edm").width);y=parseInt(.5+b.ctx.measureText("\u2192").width);E=Math.max(z,H.metrics.w+y+v.metrics.w);
h.limitText={parent:h};Object.defineProperties(h.limitText,{limitWidth:{value:E},limitTextWidth:{value:z},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+(this.limitWidth-this.limitTextWidth)/2}}});z=I.descent+Math.max(H.metrics.ascent,v.metrics.ascent,2*I.ascent/3)+h.metrics.paddingY;h.limitArrow={parent:h};Object.defineProperties(h.limitArrow,{newBaseline:{value:z},x:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+H.metrics.w}},y:{get:function(){return c.metrics.offsetY+
this.newBaseline}}});Object.defineProperties(H.metrics,{parent:{value:h},newBaseline:{value:z},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaseline}}});Object.defineProperties(v.metrics,{parent:{value:h},arrowWidth:{value:y},newBaseline:{value:z},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},
offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+H.metrics.w+this.arrowWidth}},offsetY:{get:function(){return c.metrics.offsetY+this.newBaseline}}});Object.defineProperties(n.metrics,{parent:{value:h},limitWidth:{value:E},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+2*this.parent.metrics.paddingX+this.limitWidth}},offsetY:{get:function(){return c.metrics.offsetY}}});
h.metrics.w=E+n.metrics.w+3*h.metrics.paddingX;h.metrics.ascent=Math.max(n.metrics.ascent,I.ascent)+h.metrics.paddingY;y=0;n=Math.max(H.metrics.descent,v.metrics.descent,n.metrics.descent);if(0!=H.metrics.h||0!=v.metrics.h)y=z,n=Math.max(H.metrics.descent,v.metrics.descent,n-y);h.metrics.descent=y+n+h.metrics.paddingY;h.metrics.h=h.metrics.ascent+h.metrics.descent;f+=2*h.metrics.marginX}else if("matrix"===m.nodeType){z=m;z.updateFormula();n=z.children;y=z.rows;E=z.columns;z.metrics.marginX=parseInt(1.5+
.075*this.style.size);z.metrics.paddingX=parseInt(5+.075*this.style.size);z.metrics.paddingY=parseInt(1.5+.05*this.style.size);z.metrics.offsetX_aux=f;Object.defineProperties(z.metrics,{x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+this.marginX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY}}});b.ctx.font=m.style.toString();I=d(b.ctx.font);D=[];G=[];h=0;for(var C=y*E;h<C;h++){var J=
parseInt(h/E);var O=h%E;D[J]=Math.max(D[J]||0,n[h].metrics.h);G[O]=Math.max(G[O]||0,n[h].metrics.w)}var Q=(1+E)*z.metrics.paddingX;for(h=0;h<E;h++)Q+=G[h];var M=(1+y)*z.metrics.paddingY;for(h=0;h<y;h++)M+=D[h];v=I.descent-I.h/2;h=0;for(C=y*E;h<C;h++)J=parseInt(h/E),O=h%E,n[h].metrics.offsetX_aux=a(G,O)+(G[O]-n[h].metrics.w)/2+O*z.metrics.paddingX,n[h].metrics.offsetY_aux=a(D,J)+(D[J]-n[h].metrics.h)/2+(1+J)*z.metrics.paddingY,Object.defineProperties(n[h].metrics,{parent:{value:z},matrixH:{value:M},
dispY:{value:v},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY-this.matrixH/2+this.ascent+this.offsetY_aux+this.dispY}}});z.metrics.w=Q;z.metrics.ascent=M/2-v;z.metrics.descent=M/2+v;z.metrics.h=z.metrics.ascent+z.metrics.descent;f+=2*z.metrics.marginX}else if("defparts"===m.nodeType){z=m;z.updateFormula();n=m.children;
y=m.parts;z.metrics.marginX=parseInt(1.5+.075*this.style.size);z.metrics.paddingX=parseInt(1.5+.075*this.style.size);z.metrics.paddingY=parseInt(1.5+.05*this.style.size);z.metrics.offsetX_aux=f;Object.defineProperties(z.metrics,{parent:{value:c},x:{get:function(){return this.offsetX-2*this.marginX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return c.metrics.offsetX+c.metrics.paddingX+3*this.marginX+this.offsetX_aux}},offsetY:{get:function(){return c.metrics.offsetY}}});b.ctx.font=
m.style.toString();I=d(b.ctx.font);E=0;D=z.metrics.paddingY;v=I.descent-I.h/2;for(h=0;h<y;h++)n[h].metrics.offsetY_aux=D,E=Math.max(E,n[h].metrics.w),D+=n[h].metrics.h+z.metrics.paddingY,Object.defineProperties(n[h].metrics,{parent:{value:z},dispY:{value:v},x:{get:function(){return this.offsetX}},y:{get:function(){return this.offsetY}},offsetX:{get:function(){return this.parent.metrics.offsetX+this.parent.metrics.paddingX}},offsetY:{get:function(){return c.metrics.offsetY-this.parent.metrics.defpartsH/
2+this.ascent+this.offsetY_aux+this.dispY}}});z.metrics.defpartsH=D;z.metrics.w=E+4*z.metrics.paddingX;z.metrics.ascent=D/2-v;z.metrics.descent=D/2+v;z.metrics.h=z.metrics.ascent+z.metrics.descent;f+=2*z.metrics.marginX}else if("numerator"===m.nodeType||"denominator"===m.nodeType||"index"===m.nodeType||"radicand"===m.nodeType||"from"===m.nodeType||"to"===m.nodeType||"what"===m.nodeType||"element"===m.nodeType)m.updateFormula(),m.metrics.paddingX=parseInt(1.5+.075*this.style.size),m.metrics.paddingY=
parseInt(1.5+.05*this.style.size),m.metrics.ascent+=m.metrics.paddingY,m.metrics.descent+=m.metrics.paddingY,m.metrics.h=m.metrics.ascent+m.metrics.descent,1==m.children.length&&"text"==m.children[0].nodeType&&""==m.children[0].value?(m.metrics.w=0,b.in_editor||(m.metrics.ascent=m.metrics.descent=m.metrics.h=0)):m.metrics.w+=2*m.metrics.paddingX;h=m;this.metrics.ascent=Math.max(this.metrics.ascent,m.metrics.tmp_ascent||m.metrics.ascent);this.metrics.descent=Math.max(this.metrics.descent,m.metrics.descent);
this.metrics.w+=m.metrics.w+2*m.metrics.marginX;this.metrics.h=this.metrics.ascent+this.metrics.descent;f+=m.metrics.w}};p.prototype.justifyAux=function(a){for(var b=0,c=0,d=0,e=this.children.length;d<e-1;d++)"space"===this.children[d].nodeType?b++:c+=this.children[d].metrics.w;this.updateLine((a-c)/b)};p.prototype.drawTextBlock=function(a){a.fillStyle=q;a.shadowBlur=this.style.shadowBlur;a.shadowOffsetX=this.style.shadowOffsetX;a.shadowOffsetY=this.style.shadowOffsetY;a.shadowColor=this.style.shadowColor;
for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);a.shadowColor="transparent"};p.prototype.drawTextLineBlock=function(a){for(var b=0,c=this.children.length;b<c;b++)h=!1,this.children[b].draw(a)};p.prototype.drawText=function(a){if(""!==this.value){var b=this.metrics.x,c=this.metrics.y;a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:q;a.font=this.style.toString(h);a.beginPath();this.style.overline&&(a.rect(b,c-this.metrics.ascent+
parseInt(1+this.style.size/25),this.metrics.w,parseInt(1+this.style.size/25)),a.fill());this.style.underline&&(a.rect(b,c+parseInt(1+this.style.size/10),this.metrics.w,parseInt(1+this.style.size/25)),a.fill());if(this.style.border){var d=a.strokeStyle;a.lineWidth=this.style.border_size&&0<parseInt(this.style.border_size)?parseInt(this.style.border_size):1+parseInt(this.style.size/8);a.lineJoin="round";a.miterLimit=2;a.strokeStyle=this.style.border.getColor();a.strokeText(this.value,b,c);a.strokeStyle=
d}a.fillText(this.value,b,c)}};p.prototype.drawWord=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a)};p.prototype.drawSpace=function(a){};p.prototype.drawDynamicText=function(a){var b=this.metrics.x+this.metrics.paddingX,c=this.metrics.y;a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:q;a.font=this.style.toString(h);a.beginPath();this.style.overline&&(a.rect(b,c-this.metrics.ascent+parseInt(1+this.style.size/
25),this.metrics.w,parseInt(1+this.style.size/25)),a.fill());this.style.underline&&(a.rect(b,c+parseInt(1+this.style.size/10),this.metrics.w,parseInt(1+this.style.size/25)),a.fill());a.fillText(this.evalValue,b,c);this.drawBorder(a,"blue")};p.prototype.drawHyperlink=function(a){var b=this.metrics.x,c=this.metrics.y;this.ctx=a;this.clickCatcher.parentNode||(a.canvas.nextSibling.className?a.canvas.parentNode.insertBefore(this.clickCatcher,a.canvas.nextSibling.nextSibling):a.canvas.parentNode.insertBefore(this.clickCatcher,
a.canvas.nextSibling));this.clickCatcher.style.left=b+"px";this.clickCatcher.style.top=c-this.metrics.ascent+"px";a.fillStyle="blue";this.click&&(a.fillStyle="white",a.fillRect(b,c-this.metrics.ascent,this.metrics.w,this.metrics.h),a.fillStyle="red");a.font=this.style.toString(h);a.beginPath();a.rect(b,c+parseInt(1+this.style.size/10),this.metrics.w,parseInt(1+this.style.size/25));a.fill();a.fillText(this.value,b,c)};p.prototype.drawFormula=function(a){for(var b=0,c=this.children.length;b<c;b++)h=
!0,this.children[b].draw(a);this.drawBorder(a,"blue")};p.prototype.drawFraction=function(a){a.lineWidth=5;a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:q;a.beginPath();var b=parseInt(1+this.style.size/24);a.rect(this.metrics.x,this.metrics.offsetY-parseInt(b/2),this.metrics.w,b);a.fill();this.children[0].draw(a);this.children[1].draw(a);this.drawBorder(a,"blue")};p.prototype.drawNumDen=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);
this.drawBorder(a,"blue")};p.prototype.drawSuperIndex=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};p.prototype.drawSubIndex=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};p.prototype.drawRadical=function(a){a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:q;this.style.border&&(a.lineWidth=this.style.border_size&&0<parseInt(this.style.border_size)?
parseInt(this.style.border_size):1+parseInt(this.style.size/8),a.lineJoin="round",a.miterLimit=2,a.strokeStyle=this.style.border.getColor(),a.lineWidth/=Math.max(this.radicalSign.scaleX,this.radicalSign.scaleY));a.save();a.font="1000px DJS_symbol";a.translate(this.radicalSign.x,this.radicalSign.y);a.scale(this.radicalSign.scaleX,this.radicalSign.scaleY);this.style.border&&a.strokeText("\u221a",-70,800);a.fillText("\u221a",-70,800);a.restore();a.fillRect(this.children[1].metrics.x+2.5,this.radicalSign.y-
.5,this.children[1].metrics.w-1.5,parseInt(1+this.style.size/18));for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};p.prototype.drawSum=function(a){a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:q;a.font=1.9*this.sigmaSign.w+"px DJS_symbol";this.style.border&&(a.lineWidth=this.style.border_size&&0<parseInt(this.style.border_size)?parseInt(this.style.border_size):1+parseInt(this.style.size/8),a.lineJoin=
"round",a.miterLimit=2,a.strokeStyle=this.style.border.getColor(),a.strokeText("\u03a3",this.sigmaSign.x,this.sigmaSign.y+this.sigmaSign.h));a.fillText("\u03a3",this.sigmaSign.x,this.sigmaSign.y+this.sigmaSign.h);for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};p.prototype.drawIntegral=function(a){a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:q;a.font=1.5*this.sign.w+"px DJS_symbol";this.style.border&&
(a.lineWidth=this.style.border_size&&0<parseInt(this.style.border_size)?parseInt(this.style.border_size):1+parseInt(this.style.size/8),a.lineJoin="round",a.miterLimit=2,a.strokeStyle=this.style.border.getColor(),a.strokeText("\u222b",this.sign.x,this.sign.y+3*this.sign.h/4));a.fillText("\u222b",this.sign.x,this.sign.y+3*this.sign.h/4);for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};p.prototype.drawProd=function(a){a.fillStyle=null!==this.style.color?
this.style.color.getColor?this.style.color.getColor():this.style.color:q;a.font=1.5*this.piSign.w+"px DJS_symbol";this.style.border&&(a.lineWidth=this.style.border_size&&0<parseInt(this.style.border_size)?parseInt(this.style.border_size):1+parseInt(this.style.size/8),a.lineJoin="round",a.miterLimit=2,a.strokeStyle=this.style.border.getColor(),a.strokeText("\u03a0",this.piSign.x,this.piSign.y+this.piSign.h));a.fillText("\u03a0",this.piSign.x,this.piSign.y+this.piSign.h);for(var b=0,c=this.children.length;b<
c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};p.prototype.drawLimit=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);a.fillStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:q;this.style.border&&(a.lineWidth=this.style.border_size&&0<parseInt(this.style.border_size)?parseInt(this.style.border_size):1+parseInt(this.style.size/8),a.lineJoin="round",a.miterLimit=2,a.strokeStyle=this.style.border.getColor());
a.font=this.style.toString();this.style.border&&a.strokeText("l\u00edm",this.limitText.x,this.metrics.y);a.fillText("l\u00edm",this.limitText.x,this.metrics.y);0!=this.children[1].metrics.h&&(this.style.border&&a.strokeText("\u2192",this.limitArrow.x,this.limitArrow.y),a.fillText("\u2192",this.limitArrow.x,this.limitArrow.y));this.drawBorder(a,"blue")};p.prototype.drawMatrix=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);c=parseInt(1.5+this.style.size/25);b=c/2;a.lineWidth=
c;a.strokeStyle=null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:q;a.beginPath();if(0==this.matrix_type)a.moveTo(this.metrics.x+b+1.5*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+b,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.lineTo(this.metrics.x+b+1.5*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.moveTo(this.metrics.x+
this.metrics.w-b-1.5*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+this.metrics.w-b,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+this.metrics.w-b,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.lineTo(this.metrics.x+this.metrics.w-b-1.5*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent+this.metrics.h);else if(1==this.matrix_type)a.moveTo(this.metrics.x+b+2*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent),a.bezierCurveTo(this.metrics.x-
b,this.metrics.y+b-this.metrics.ascent,this.metrics.x-b,this.metrics.y+b-this.metrics.ascent+this.metrics.h,this.metrics.x+b+2*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.moveTo(this.metrics.x+this.metrics.w-b-2*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent),a.bezierCurveTo(this.metrics.x+this.metrics.w+b,this.metrics.y+b-this.metrics.ascent,this.metrics.x+this.metrics.w+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h,this.metrics.x+this.metrics.w-
b-2*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent+this.metrics.h);else if(2==this.matrix_type){c=3*this.metrics.marginX;var d=c/2;a.moveTo(this.metrics.x+b+c,this.metrics.y+b-this.metrics.ascent);a.bezierCurveTo(this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent,this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent,this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+2*this.metrics.marginX);a.lineTo(this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2-5*this.metrics.marginX);
a.bezierCurveTo(this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2);a.bezierCurveTo(this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2+5*this.metrics.marginX);a.lineTo(this.metrics.x+
b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h-2*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+b+d,this.metrics.y-b-this.metrics.ascent+this.metrics.h,this.metrics.x+b+d,this.metrics.y-b-this.metrics.ascent+this.metrics.h,this.metrics.x+b+c,this.metrics.y-b-this.metrics.ascent+this.metrics.h);a.moveTo(this.metrics.x+this.metrics.w+b-c,this.metrics.y+b-this.metrics.ascent);a.bezierCurveTo(this.metrics.x+this.metrics.w+b-d,this.metrics.y+b-this.metrics.ascent,this.metrics.x+this.metrics.w+
b-d,this.metrics.y+b-this.metrics.ascent,this.metrics.x+this.metrics.w+b-d,this.metrics.y+b-this.metrics.ascent+2*this.metrics.marginX);a.lineTo(this.metrics.x+this.metrics.w+b-d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2-5*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+this.metrics.w+b-d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+this.metrics.w+b-d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+this.metrics.w+b,this.metrics.y+b-this.metrics.ascent+
this.metrics.h/2);a.bezierCurveTo(this.metrics.x+this.metrics.w+b-d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+this.metrics.w+b-d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+this.metrics.w+b-d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2+5*this.metrics.marginX);a.lineTo(this.metrics.x+this.metrics.w+b-d,this.metrics.y+b-this.metrics.ascent+this.metrics.h-2*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+this.metrics.w+b-d,this.metrics.y-
b-this.metrics.ascent+this.metrics.h,this.metrics.x+this.metrics.w+b-d,this.metrics.y-b-this.metrics.ascent+this.metrics.h,this.metrics.x+this.metrics.w+b-c,this.metrics.y-b-this.metrics.ascent+this.metrics.h)}else 3==this.matrix_type?(a.moveTo(this.metrics.x+b,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.moveTo(this.metrics.x+this.metrics.w-b,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+this.metrics.w-b,this.metrics.y+
b-this.metrics.ascent+this.metrics.h)):4==this.matrix_type&&(a.moveTo(this.metrics.x+b,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.moveTo(this.metrics.x+b+1.25*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+b+1.25*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.moveTo(this.metrics.x+this.metrics.w-b,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+
this.metrics.w-b,this.metrics.y+b-this.metrics.ascent+this.metrics.h),a.moveTo(this.metrics.x+this.metrics.w-b-1.25*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent),a.lineTo(this.metrics.x+this.metrics.w-b-1.25*this.metrics.marginX,this.metrics.y+b-this.metrics.ascent+this.metrics.h));a.stroke();this.drawBorder(a,"blue")};p.prototype.drawDefparts=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);c=parseInt(1.5+this.style.size/25);b=c/2;a.lineWidth=c;a.strokeStyle=
null!==this.style.color?this.style.color.getColor?this.style.color.getColor():this.style.color:q;a.beginPath();c=3*this.metrics.marginX;var d=c/2;a.moveTo(this.metrics.x+b+c,this.metrics.y+b-this.metrics.ascent);a.bezierCurveTo(this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent,this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent,this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+2*this.metrics.marginX);a.lineTo(this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2-
5*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2);a.bezierCurveTo(this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2,this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h/2+5*this.metrics.marginX);
a.lineTo(this.metrics.x+b+d,this.metrics.y+b-this.metrics.ascent+this.metrics.h-2*this.metrics.marginX);a.bezierCurveTo(this.metrics.x+b+d,this.metrics.y-b-this.metrics.ascent+this.metrics.h,this.metrics.x+b+d,this.metrics.y-b-this.metrics.ascent+this.metrics.h,this.metrics.x+b+c,this.metrics.y-b-this.metrics.ascent+this.metrics.h);a.stroke();this.drawBorder(a,"blue")};p.prototype.drawGenericBlock=function(a){for(var b=0,c=this.children.length;b<c;b++)this.children[b].draw(a);this.drawBorder(a,"blue")};
p.prototype.drawComponentNumCtrl=function(a){this.componentNumCtrl.expresion=this.evaluator.parser.parse("("+this.metrics.x+","+(this.metrics.y-this.metrics.ascent)+","+this.componentNumCtrl.w+","+this.componentNumCtrl.h+")");this.componentNumCtrl&&this.componentNumCtrl.parent&&this.componentNumCtrl.parent.readyApp&&this.componentNumCtrl.update(!0)};p.prototype.drawComponentSpace=function(a){this.componentSpace.xExpr=this.evaluator.parser.parse(this.metrics.x.toString());this.componentSpace.yExpr=
this.evaluator.parser.parse((this.metrics.y-this.metrics.ascent).toString());this.componentSpace&&this.componentSpace.parent&&this.componentSpace.parent.readyApp&&this.componentSpace.update(!0)};p.prototype.drawBorderSpecial=function(a,b){a.beginPath();a.setLineDash([1,2]);a.strokeStyle=b;a.lineWidth=1;a.rect(parseInt(this.metrics.x)+.5,parseInt(this.metrics.y-this.metrics.ascent)+.5,this.metrics.w,this.metrics.h);a.stroke();a.setLineDash([])};p.prototype.toRTF=function(){var a=[],b=[],d="";this.mergeTextNodes();
for(var e=0,g=this.children.length;e<g;e++){var h=this.children[e];"textLineBlock"===h.nodeType&&(d+=h.toRTFAux(a,b)+(1<g&&e<g-1?"\\par":""))}h="{\\fonttbl";e=0;for(g=a.length;e<g;e++)h+="\\f"+e+"\\fcharset0 "+a[e]+";";a="";if(0<b.length){a="{\\colortbl";e=0;for(g=b.length;e<g;e++)a+=b[e];a+="}"}return"{\\rtf1\\uc0"+(h+"}")+a+d+"}"};p.prototype.toRTFAux=function(a,b){for(var c,d,e,g=null,h="",l,p,n,y,A,B=0,E=this.children.length;B<E;B++)l=p="",c=this.children[B],n=this.addToFontTable(c.style.family,
a),y=c.style.size,A=this.addToColorTable(c.style.color,b),null===A&&0<b.length&&(A=this.addToColorTable(q,b)),A!==g&&(l+="\\cf"+A,g=A),n!==d&&(l+="\\f"+n,d=n),y!==e&&(l+="\\fs"+2*y,e=y),c.style.italic&&(l+="\\i",p="\\i0"+p),c.style.bold&&(l+="\\b",p="\\b0"+p),c.style.underline&&(l+="\\ul",p="\\ulnone"+p),c.style.overline&&(l+="\\ol",p="\\olnone"+p),"text"===c.nodeType?(c.value=c.value.replace(/\\{/g,"{").replace(/\\}/g,"}").replace(/{/g,"\\{").replace(/}/g,"\\}"),c=""!==l?l+" "+c.value+p:""!==h&&
"}"!==h.charAt(h.length-1)?" "+c.value:c.value,h+=c):"formula"===c.nodeType?h+="{\\*\\mjaformula"+c.formulaToRTF(d,e,g,a,b)+"}":"componentSpace"===c.nodeType?h+="{\\*\\component\\Space "+c.value+"}":"componentNumCtrl"===c.nodeType&&(h+="{\\*\\component\\NumCtrl "+c.value+"}");return h};p.prototype.formulaToRTF=function(a,b,d,e,g){for(var c,f="",h,l,m,p,n=0,w=this.children.length;n<w;n++)h=l="",c=this.children[n],m=this.addToFontTable(c.style.family,e),p=this.addToColorTable(c.style.color,g),null===
p&&0<g.length&&(p=this.addToColorTable(q,g)),m!==a&&(h+="\\f"+m,a=m),p!==d&&(h+="\\cf"+p,"text"!==c.nodeType||"text"===c.nodeType&&""!==c.value)&&(d=p),c.style.italic&&(h+="\\i",l="\\i0"+l),c.style.bold&&(h+="\\b",l="\\b0"+l),c.style.underline&&(h+="\\ul",l="\\ulnone"+l),c.style.overline&&(h+="\\ol",l="\\olnone"+l),"text"===c.nodeType&&""!==c.value?(c.value=c.value.replace(/\\{/g,"{").replace(/\\}/g,"}").replace(/{/g,"\\{").replace(/}/g,"\\}"),tmpRTF=""!==h?h+" "+c.value+l:"}"!==f.charAt(f.length-
1)?" "+c.value:c.value,f+=tmpRTF):"dynamicText"===c.nodeType?(c.value=""===c.value?" ":c.value,f+=h+"{\\expr "+c.value+"\\decimals "+(c.decimals||2)+"\\fixed"+(c.fixed?1:0)+"}"+l):"fraction"===c.nodeType||"radical"===c.nodeType||"index"===c.nodeType||"radicand"===c.nodeType||"sum"===c.nodeType||"integral"===c.nodeType||"prod"===c.nodeType||"limit"===c.nodeType||"from"===c.nodeType||"to"===c.nodeType||"what"===c.nodeType||"element"===c.nodeType?f+="{\\"+c.nodeType+c.formulaToRTF(a,b,d,e,g)+"}":"numerator"===
c.nodeType?f+="{\\num"+c.formulaToRTF(a,b,d,e,g)+"}":"denominator"===c.nodeType?f+="{\\den"+c.formulaToRTF(a,b,d,e,g)+"}":"superIndex"===c.nodeType?f+="{\\supix"+c.formulaToRTF(a,b,d,e,g)+"}":"subIndex"===c.nodeType?f+="{\\subix"+c.formulaToRTF(a,b,d,e,g)+"}":"matrix"===c.nodeType?f+="{\\matrix\\rows "+(c.rows||2)+"\\columns "+(c.columns||2)+c.formulaToRTF(a,b,d,e,g)+"}":"defparts"===c.nodeType&&(f+="{\\defparts\\parts "+(c.parts||2)+c.formulaToRTF(a,b,d,e,g)+"}");return f};p.prototype.addToFontTable=
function(a,b){var c;a.match(/times/i)?c="Times New Roman":a.match(/courier/i)?c="Courier New":a.match(/arial/i)&&(c="Arial");a=b.indexOf(c);-1===a&&(a=b.length,b.push(c));return a};p.prototype.addToColorTable=function(a,b){if(a){a="\\red"+parseInt(a.substring(1,3),16)+"\\green"+parseInt(a.substring(3,5),16)+"\\blue"+parseInt(a.substring(5,7),16)+";";var c=b.indexOf(a);-1===c&&(c=b.length,b.push(a));return c}return null};p.prototype.mergeTextNodes=function(){for(var a=[],b=null,d=0,e=this.children.length;d<
e;d++)"text"===this.children[d].nodeType?null!==b&&"text"===b.nodeType&&b.style.equals(this.children[d].style)&&(this.children[d].value=b.value+this.children[d].value,a.push(b)):this.children[d].mergeTextNodes(),b=this.children[d];d=0;for(e=a.length;d<e;d++)this.removeChild(a[d])};var n={sansserif:{ascent:1854,descent:-434,lineGap:67,capHeight:1409,xHeight:1082,unitsPerEm:2048},serif:{ascent:1825,descent:-443,lineGap:87,capHeight:1341,xHeight:940,unitsPerEm:2048},monospace:{ascent:1705,descent:-615,
lineGap:0,capHeight:1349,xHeight:1082,unitsPerEm:2048}};b.TextNode=p;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=String.fromCharCode,d,h,q,e,g,p,n,c,l,m,f,w=function(){};w.prototype.tokenize=function(b){if(b)b=b.replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&quote;/g,"''").replace(/&squot;/g,"'").replace(/\\rquote /g,"'").replace(/\\endash /g,"-").replace(/\n/g," ").replace(/\r/g,"").replace(/\\uc(\d+) /g,"").replace(/\\uc(\d+)/g,"");else return[];d=[];h="";e=q=0;p=b.charAt(0);n=!1;for(c="text";q<b.length;)g=p,p=b.charAt(q+1),n?"\\"===p||"{"===p||"}"===
p||" "===p||";"===p?(n=!1,h+=g," "===p?(q++,p=b.charAt(q+1),f=!0):f=!1,(l=h.match(/^'([0-9a-f]{2})/))?(m="","text"===c&&(m=d.pop().value),h=m+=a(parseInt(l[1],16))+h.substring(3)):(l=h.match(/^u[0-9]+/))?(m="","text"===c&&(m=d.pop().value),h=m+=a(l[0].substring(1))):("{"===h||"}"===h||"\\"==g?(d.push({type:"text",value:h+(f?" ":"")}),c="text"):(d.push({type:"controlWord",value:h}),c="controlWord"),h="")):"{"==g||"}"==g||"\\"==g?(n=!1,d.push({type:"text",value:g}),c="text"):h+=g:"\\"===g?(n=!0,""!==
h&&(d.push({type:"text",value:h}),c="text",h="")):"{"===g?(e++,""!==h&&(d.push({type:"text",value:h}),h=""),d.push({type:"openBlock",value:e}),c="openBlock"):"}"===g?(""!==h&&(d.push({type:"text",value:h}),h=""),d.push({type:"closeBlock",value:e}),c="closeBlock",e--):h+=g,q++;""!==h&&d.push({type:"text",value:h});return d};b.RTFTokenizer=w;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=Math.max,d,h,q,e,g,p,n,c,l,m,f,w,u,x,r,v,z,y,A,B,E,I,D,G,H,C,J,O,Q,M,P,N=function(a){this.evaluator=a;this.tokenizer=new b.RTFTokenizer};N.prototype.parse=function(F){d=this.tokenizer.tokenize(F);h={};e=2;if("openBlock"===d[0].type&&"fonttbl"===d[1].value){for(q=d[0].value;"closeBlock"!==d[e].type&&d[e].value!==q;)h[d[e].value]=d[e+2].value.substring(0,d[e+2].value.length-1),e+=3;e++}g={};p=0;if("openBlock"===d[e].type&&"colortbl"===d[e+1].value){q=
d[e++].value;for(e++;"closeBlock"!==d[e].type&&d[e].value!==q;)n=parseInt(d[e++].value.substring(3)).toString(16),c=parseInt(d[e++].value.substring(5)).toString(16),l=parseInt(d[e++].value.substring(4)).toString(16),";"===d[e].value&&e++,g[p++]="#"+(2>n.length?"0"+n:n)+(2>c.length?"0"+c:c)+(2>l.length?"0"+l:l);e++}x=u=w=null;Q=O=J=E=B=A=y=z=v=r=!1;I=[new b.TextStyle];D=I[0];H=G=-1;C=[];m=M=new b.TextNode("","textBlock",D,this.evaluator);f=new b.TextNode("","textLineBlock",D,this.evaluator);m.addChild(f);
M.stableWidth=!0;M.hasFormula=!1;F=e;for(var K=d.length;F<K;F++){if("controlWord"==d[F].type)if(h[d[F].value])D.set({family:h[d[F].value]});else if(d[F].value.match(/^fs(\d+)/))D.set({size:parseInt(d[F].value.match(/^fs(\d+)/)[1]/2)});else if("b"==d[F].value)D.set({bold:!0}),0<C.length&&C[C.length-1].style.set({bold:!0});else if("b0"==d[F].value)D.set({bold:!1}),0<C.length&&C[C.length-1].style.set({bold:!1});else if("i"==d[F].value)D.set({italic:!0}),0<C.length&&C[C.length-1].style.set({italic:!0});
else if("i0"==d[F].value)D.set({italic:!1}),0<C.length&&C[C.length-1].style.set({italic:!1});else if("ul"==d[F].value)D.set({underline:!0}),0<C.length&&C[C.length-1].style.set({underline:!0});else if("ulnone"==d[F].value)D.set({underline:!1}),0<C.length&&C[C.length-1].style.set({underline:!1});else if("ol"==d[F].value)D.set({overline:!0}),0<C.length&&C[C.length-1].style.set({overline:!0});else if("olnone"==d[F].value)D.set({overline:!1}),0<C.length&&C[C.length-1].style.set({overline:!1});else if(d[F].value.match(/^cf(\d+)/))D.set({color:g[parseInt(d[F].value.substring(2))]}),
0<C.length&&(C[C.length-1].style.color=D.color);else if("par"==d[F].value){m=new b.TextNode("","textLineBlock",D.clone(),this.evaluator);if("textBlock"!=f.nodeType)for(f=f.parent;"textBlock"!=f.nodeType;)f=f.parent;f.addChild(m);f=m}else if("mjaformula"==d[F].value)M.hasFormula=!0,H=G,r=!0,m=new b.TextNode("","formula",D.clone(),this.evaluator),f.addChild(m),f=m,C[C.length-1]=m;else if("fraction"==d[F].value||"radicand"==d[F].value||"radical"==d[F].value||"what"==d[F].value||"sum"==d[F].value||"integral"==
d[F].value||"limit"==d[F].value){var L=C[C.length-2].style.clone();m=new b.TextNode("",d[F].value,L,this.evaluator);C[C.length-2].addChild(m);C[C.length-1]=m}else"index"==d[F].value?(L=C[C.length-2].style.clone(),L.size=a(parseInt(L.size-.5*L.size),8),m=new b.TextNode("",d[F].value,L,this.evaluator),C[C.length-2].addChild(m),C[C.length-1]=m):"to"==d[F].value||"from"==d[F].value?(L=C[C.length-2].style.clone(),L.size=a(parseInt(L.size-.2*L.size),8),m=new b.TextNode("",d[F].value,L,this.evaluator),C[C.length-
2].addChild(m),C[C.length-1]=m):"num"==d[F].value||"den"==d[F].value?(L=C[C.length-2].style.clone(),L.size=a(Math.round(L.size-.1*L.size),8),"num"==d[F].value?m=new b.TextNode("","numerator",L,this.evaluator):"den"==d[F].value&&(m=new b.TextNode("","denominator",L,this.evaluator)),C[C.length-2].addChild(m),C[C.length-1]=m):"subix"==d[F].value||"supix"==d[F].value?(L=C[C.length-2].style.clone(),L.size=a(Math.floor(L.size-.33*L.size),8),"subix"==d[F].value?m=new b.TextNode("","subIndex",L,this.evaluator):
"supix"==d[F].value&&(m=new b.TextNode("","superIndex",L,this.evaluator)),m.originalStyle=C[C.length-2].style.clone(),C[C.length-2].addChild(m),C[C.length-1]=m):"defparts"==d[F].value||"matrix"==d[F].value||"element"==d[F].value?(L=C[C.length-2].style.clone(),m=new b.TextNode("",d[F].value,L,this.evaluator),C[C.length-2].addChild(m),C[C.length-1]=m,"defparts"==d[F].value?x=m:"matrix"==d[F].value&&(u=m,u.matrix_type=0)):"parts"==d[F].value?E=!0:"type"==d[F].value?y=!0:"rows"==d[F].value?A=!0:"columns"==
d[F].value?B=!0:"expr"==d[F].value?(M.stableWidth=!1,v=!0):"decimals"==d[F].value?z=!0:"fixed1"==d[F].value?w.fixed=!0:"fixed0"==d[F].value?w.fixed=!1:"component"!=d[F].value&&("NumCtrl"==d[F].value?J=!0:"Space"==d[F].value?O=!0:"hyperlink"==d[F].value&&(Q=!0));if("text"==d[F].type)if(E)x.parts=parseInt(d[F].value),E=!1;else if(y)u.matrix_type=parseInt(d[F].value),y=!1;else if(A)u.rows=parseInt(d[F].value),A=!1;else if(B)u.columns=parseInt(d[F].value),B=!1;else if(z)w.decimals=this.evaluator.parser.parse(d[F].value+
""),z=!1;else if(Q){P=d[F].value.split("|")[0];L=D.clone();m=new b.TextNode(P,"hyperlink",L,this.evaluator);m.URL=d[F].value.split("|")[1];if("textLineBlock"!=f.nodeType)for(f=f.parent;"textLineBlock"!=f.nodeType;)f=f.parent;f.addChild(m);Q=!1}else if(J)m=new b.TextNode(d[F].value,"componentNumCtrl",D.clone(),this.evaluator),f.addChild(m),J=!1;else if(O)m=new b.TextNode(d[F].value,"componentSpace",D.clone(),this.evaluator),f.addChild(m),O=!1;else if(v)L=C[C.length-2].style.clone(),P=this.evaluator.parser.parse(d[F].value),
m=new b.TextNode(P,"dynamicText",L,this.evaluator),C[C.length-2].addChild(m),w=C[C.length-1]=m,v=!1;else if(v||r)!v&&r&&(P=d[F].value,m=new b.TextNode(P,"text",C[C.length-1].style.clone(),this.evaluator),C[C.length-1].addChild(m));else{P=d[F].value;m=new b.TextNode(P,"text",D.clone(),this.evaluator);if("textLineBlock"!=f.nodeType)for(f=f.parent;"textLineBlock"!=f.nodeType;)f=f.parent;f.addChild(m)}else if("openBlock"==d[F].type)G=d[F].value,D=D.clone(),I.push(D),C.push(null);else if("closeBlock"==
d[F].type)d[F].value==H&&(H=-1,r=!1,f=f.parent),I.pop(),D=I[I.length-1],C.pop();else if("("==d[F].type||")"==d[F].type)L=C[C.length-1].style.clone(),L.italic="",m=new b.TextNode(d[F].type,"mathSymbol",L,this.evaluator),C[C.length-1].addChild(m);else if("+"==d[F].type||"-"==d[F].type||"*"==d[F].type||"="==d[F].type)m=new b.TextNode(d[F].type,"mathSymbol",C[C.length-1].style.clone(),this.evaluator),C[C.length-1].addChild(m)}return M.normalize()};b.RTFParser=N;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,d,h,q,e,g,p,n,c,l,m,f,w=function(c,d){a=this;a.parent=c;a.evaluator=a.parent.evaluator;h=a.evaluator;q=h.parser;a.id=a.imageSrc=a.x_axis=a.y_axis=a.cID="";a.type="2D";a.xExpr=a.yExpr=q.parse("0");a.w=parseInt(c.container.width);a.h=parseInt(c.container.height);a.drawif=q.parse("1");a.fixed=a.text=a.numbers=a.sensitive_to_mouse_movements=!1;a.scale=48;a.Ox=a.Oy=a.mouse_x=a.mouse_y=a.border_width=a.border_radius=0;a.image=new Image;a.image.onload=
function(){this.ready=1};a.bg_display="topleft";a.background=new b.Color("ffffff");a.net=new b.Color("b8c4c8");a.net10=new b.Color("889498");a.axes=new b.Color("405860");a.border_color=new b.Color("000000");a.ctrs=[];a.graphicsCtr=[];a.graphics=[];a.backGraphics=[];a.zIndex=c.zIndex;a.plecaHeight=c.plecaHeight||0;a.displaceRegionNorth=c.displaceRegionNorth||0;a.displaceRegionWest=c.displaceRegionWest||0;Object.assign(a,d);a.initSpace()};w.prototype.initSpace=function(){a=this;d=a.parent;h=a.evaluator;
e=a.id+".";a.resizable||(a.displaceRegionNorth=d.displaceRegionNorth||0,a.displaceRegionSouth=d.displaceRegionSouth||0,a.displaceRegionEast=d.displaceRegionEast||0,a.displaceRegionWest=d.displaceRegionWest||0,c=parseInt(d.container.width),n=parseInt(d.container.height),void 0!=a.wExpr&&(a.w=parseInt(c-a.displaceRegionWest-a.displaceRegionEast)*parseFloat(a.wExpr)/100),void 0!=a.hExpr&&(a.h=parseInt(n-a.displaceRegionNorth-a.displaceRegionSouth)*parseFloat(a.hExpr)/100),void 0!=a.xPercentExpr&&(a.xExpr=
h.parser.parse((parseInt(c-a.displaceRegionWest-a.displaceRegionEast)*parseFloat(a.xPercentExpr)/100).toString())),void 0!=a.yPercentExpr&&(a.yExpr=h.parser.parse((parseInt(n-a.displaceRegionNorth-a.displaceRegionSouth)*parseFloat(a.yPercentExpr)/100).toString())),a.x=h.eval(a.xExpr)+a.displaceRegionWest,a.y=h.eval(a.yExpr)+a.plecaHeight+a.displaceRegionNorth,a.container&&(a.container.style.left=a.x+"px",a.container.style.top=a.y+"px"),0<=a.y?(g=n-a.y,a.h>g&&(a.h=g)):(g=a.h+a.y,a.h=g>=n?n:g),0<=a.x?
(p=c-a.x,a.w>p&&(a.w=p)):(p=a.w+a.x,a.w=p>=c?c:p));""==a.imageSrc&&/vacio.gif$/i.test(a.imageSrc.trim())||(a.image=d.getImage(a.imageSrc));a.OxExpr&&(m=a.OxExpr,m.endsWith("%")?a.Ox=a.w*parseFloat(m)/100:(l=parseFloat(m),l!=m&&(l=0),a.Ox=l));a.OyExpr&&(f=a.OyExpr,f.endsWith("%")?a.Oy=a.h*parseFloat(f)/100:(l=parseFloat(f),l!=f&&(l=0),a.Oy=l));""!==a.id&&2!==d.version?(h.setVariable(e+"_w",a.w),h.setVariable(e+"_h",a.h),h.setVariable(e+"escala",h.getVariable(e+"escala")||a.scale),h.setVariable(e+"Ox",
h.getVariable(e+"Ox")||a.Ox),h.setVariable(e+"Oy",h.getVariable(e+"Oy")||a.Oy),h.setVariable(e+"mouse_x",0),h.setVariable(e+"mouse_y",0),h.setVariable(e+"mouse_pressed",0),h.setVariable(e+"mouse_clicked",0),h.setVariable(e+"clic_izquierdo",0)):(l=h.getVariable("_w"),h.setVariable("_w",void 0===l?a.w:l),l=h.getVariable("_h"),void 0===l&&(l=a.h),h.setVariable("_h",l),l=h.getVariable("escala"),void 0===l&&(l=a.scale),h.setVariable("escala",l),l=h.getVariable("Ox"),void 0===l&&(l=a.Ox),h.setVariable("Ox",
l),l=h.getVariable("Oy"),void 0===l&&(l=a.Oy),h.setVariable("Oy",l),h.setVariable("mouse_x",0),h.setVariable("mouse_y",0),h.setVariable("mouse_pressed",0),h.setVariable("mouse_clicked",0),h.setVariable("clic_izquierdo",0),2==d.version&&""===a.x_axis&&""===a.y_axis&&(a.axes=""));a.w_2=a.w/2;a.h_2=a.h/2;h.setFunction(e+"download_image",function(b){a.evaluator.functions._SaveSpace_(b,a.canvas.toDataURL("image/png"))})};w.prototype.addCtr=function(a){"GraphicControl"===a.type?this.graphicsCtr.push(a):
this.ctrs.push(a)};w.prototype.addGraph=function(a,b){"2D"===this.type&&b||"3D"===this.type&&!b||(a.background&&"3D"!==this.type?this.backGraphics.push(a):this.graphics.push(a))};w.prototype.getRelativeX=function(a){return(parseInt(a)-this.w_2-this.Ox)/this.scale};w.prototype.getRelativeY=function(a){return(-parseInt(a)+this.h_2+this.Oy)/this.scale};w.prototype.getAbsoluteX=function(a){return a*this.scale+this.w_2+this.Ox};w.prototype.getAbsoluteY=function(a){return-a*this.scale+this.h_2+this.Oy};
w.prototype.getDistance=function(a,b){var c=a.clientX-b.clientX;a=a.clientY-b.clientY;return Math.sqrt(c*c+a*a)};w.prototype.clearClick=function(){this.evaluator.setVariable(this.mclickedStr,0);this.evaluator.setVariable(this.mclickIzqStr,0)};w.prototype.addEvents=function(){function a(){0!==g.click&&(g.click=0,g.evaluator.setVariable(g.mpressedStr,0),g.evaluator.setVariable(g.mclickedStr,1),g.evaluator.setVariable(g.mclickIzqStr,1),g.activePointers.clear(),g.initialPinchDistance=null,g.whichBtn=
null,g.posZoom=g.posZoomNew=null,window.removeEventListener("pointermove",c),window.removeEventListener("pointerup",d),window.removeEventListener("pointercancel",d),g.parent.update())}function c(a){a.preventDefault();a.stopPropagation();g.activePointers.has(a.pointerId)&&g.activePointers.set(a.pointerId,a);1===g.activePointers.size?"R"!==g.whichBtn||g.fixed?"L"===g.whichBtn&&(g.fixed||g._handleDragMove(a),e(a)):(g.posZoomNew=b.getCursorPosition(a,g.container).y,g.evaluator.setVariable(g.scaleStr,
g.tempScale+g.tempScale/45*((g.posZoom-g.posZoomNew)/10)),g.parent.update()):2===g.activePointers.size&&(a=Array.from(g.activePointers.values()),a=g.getDistance(a[0],a[1]),0<g.initialPinchDistance&&(g.evaluator.setVariable(g.scaleStr,a/g.initialPinchDistance*g.tempScale),g.parent.update()))}function d(a){a.preventDefault();a.stopPropagation();g.click=0;g.evaluator.setVariable(g.mpressedStr,0);g.evaluator.setVariable(g.mclickedStr,1);g.evaluator.setVariable(g.mclickIzqStr,1);"R"===g.whichBtn&&g.posZoom==
g.posZoomNew&&b.showConfig&&g.parent.externalSpace.show();g.activePointers.delete(a.pointerId);0===g.activePointers.size?(window.removeEventListener("pointermove",c),window.removeEventListener("pointerup",d),window.removeEventListener("pointercancel",d),g.whichBtn=null):2>g.activePointers.size&&(g.initialPinchDistance=null);g.parent.update()}function e(a){g.posAnte=b.getCursorPosition(a,g.container);g.mouse_x=g.getRelativeX(g.posAnte.x);g.mouse_y=g.getRelativeY(g.posAnte.y);g.evaluator.setVariable(g.mxStr,
g.mouse_x);g.evaluator.setVariable(g.myStr,g.mouse_y);g.clearClick();g.parent.update()}function f(a){0===g.click&&e(a)}var g=this;g.activePointers=new Map;g.initialPinchDistance=null;g.whichBtn=null;g.disp={x:0,y:0};g.canvas.addEventListener("pointerdown",function(a){a.preventDefault();a.stopPropagation();window.focus();document.activeElement.blur();g.parent.clearClick();g.parent.deactivateControls();g.activePointers.set(a.pointerId,a);window.addEventListener("pointermove",c);window.addEventListener("pointerup",
d);window.addEventListener("pointercancel",d);1===g.activePointers.size?(g.click=1,g.whichBtn="mouse"===a.pointerType?b.whichBtn(a):"L","R"===g.whichBtn?(g.posZoom=b.getCursorPosition(a,g.container).y,g.posZoomNew=g.posZoom,g.fixed||(g.tempScale=g.scale)):"L"===g.whichBtn&&(g.evaluator.setVariable(g.mpressedStr,1),g.evaluator.setVariable(g.mclickedStr,0),g.evaluator.setVariable(g.mclickIzqStr,0),g._handleDragStart(a),e(a))):2===g.activePointers.size&&(a=Array.from(g.activePointers.values()),g.initialPinchDistance=
g.getDistance(a[0],a[1]),g.tempScale=g.scale)});g.sensitive_to_mouse_movements&&g.canvas.addEventListener("pointermove",f);window.addEventListener("blur",a);document.documentElement.addEventListener("mouseleave",a)};w.prototype._handleDragStart=function(a){};w.prototype._handleDragMove=function(a){};b.Space=w;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,d=function(d){a=this;a.parent=d;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=[]};d.prototype.init=function(){function d(d){a.newPos=b.getCursorPosition(d,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 q(a){a.preventDefault();document.body.removeEventListener("mousemove",
d);document.body.removeEventListener("mouseup",q)}a=this;document.body.appendChild(a.container);var e=a.parent.evaluator.parser;a.numCtr=a.ctrs.length;a.ctrs.forEach(function(b,d){b.expresion=e.parse("(0,"+(a.vSpace+23+35*d)+","+a.width+",35)");b.update()});var g=new b.Button(a.parent,{region:"external",name:"english"==a.language?"about":"cr\u00e9ditos",font_size:e.parse("15"),expresion:e.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:e.parse("15"),action:"config",expresion:e.parse("("+a.width/2+","+a.vSpace+","+a.width/2+",25)")})).update();(new b.Button(a.parent,{region:"external",name:"english"==a.language?"init":"inicio",font_size:e.parse("15"),action:"init",expresion:e.parse("(0,"+(a.vSpace+23+35*a.numCtr)+","+a.width/2+",25)")})).update();(new b.Button(a.parent,{region:"external",name:"english"==a.language?"clear":"limpiar",font_size:e.parse("15"),action:"clear",expresion:e.parse("("+
a.width/2+","+(a.vSpace+23+35*a.numCtr)+","+a.width/2+",25)")})).update();g=new b.Button(a.parent,{region:"external",name:"english"==a.language?"close":"cerrar",font_size:e.parse("15"),expresion:e.parse("("+a.width/4+","+(a.vSpace+46+35*a.numCtr)+","+a.width/2+",25)")});g.update();g.btn.addEventListener("click",function(b){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",d);document.body.addEventListener("mouseup",q)});a.hide()};d.prototype.addCtr=function(a){this.ctrs.push(a)};d.prototype.show=function(){this.setPositionAndSize();this.container.style.display="block"};d.prototype.hide=function(){this.container.style.display="none"};d.prototype.setPositionAndSize=function(){a=this;var b=a.vSpace+46+35*a.numCtr+25+10;a.container.style.left=Math.max(parseInt(window.innerWidth-a.width)/2,0)+"px";a.container.style.top=
"5px";a.container.style.height=window.innerHeight<a.vSpace+75?a.vSpace+75+"px":b>window.innerHeight-10?window.innerHeight-10+"px":b+"px"};b.SpaceExternal=d;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,d=2*Math.PI,h=b.convertFont("Serif,BOLD+ITALIC,16"),q=b.convertFont("Monospaced,PLAIN,12"),e=Math.floor,g=Math.round,p,n,c,l,m,f,w,u,x,r,v,z,y,A,B,E,I,D,G,H,C,J,O,Q,M,P,N,F,K=function(c,d){a=d=b.Space.call(this,c,d)||this;a.ratio=c.ratio;a.canvas=b.newHTML("canvas",{id:a.id+"_canvas",class:"DescartesSpace2DCanvas",width:a.w*a.ratio+"px",height:a.h*a.ratio+"px"});a.backCanvas=b.newHTML("canvas",{id:a.id+"_background",width:a.w*a.ratio+"px",height:a.h*
a.ratio+"px"});a.canvas.style=a.backCanvas.style=(0<a.border_width?"border:"+a.border_width+"px solid "+a.border_color.getColor()+";":"")+(a.border_radius?"border-radius:"+a.border_radius+"px;":"");a.canvas.style.zIndex=a.zIndex;a.canvas.style.width=a.backCanvas.style.width=a.w+"px";a.canvas.style.height=a.backCanvas.style.height=a.h+"px";a.ctx=a.canvas.getContext("2d");a.backCtx=a.backCanvas.getContext("2d");a.ctx.imageSmoothingEnabled=a.backCtx.imageSmoothingEnabled=!1;a.canvas.ratio=a.ratio;a.backCanvas.ratio=
a.ratio;a.graphicControlContainer=b.newHTML("div",{id:a.id+"_graphicControls",style:"position:absolute;left:0;top:0;z-index:"+a.zIndex+";"});a.numCtrContainer=b.newHTML("div",{id:a.id+"_numericalControls",style:"position:absolute;left:0;top:0;z-index:"+a.zIndex+";"});a.container=b.newHTML("div",{id:a.id,class:"DescartesSpace2DContainer",style:"z-index:"+a.zIndex+";"});a.container.appendChild(a.backCanvas);a.container.appendChild(a.canvas);a.container.appendChild(a.graphicControlContainer);a.container.appendChild(a.numCtrContainer);
c.container.insertBefore(a.container,c.loader);var e=a.id+".image";a.parent.images[e]=a.canvas;a.parent.images[e].ready=1;a.parent.images[e].complete=a.parent.images[e].canvas=!0;a.evaluator.setVariable(e,e);e=a.id+".back";a.parent.images[e]=a.backCanvas;a.parent.images[e].ready=1;a.parent.images[e].complete=a.parent.images[e].canvas=!0;a.evaluator.setVariable(e,e);e=""!==a.id&&2!==c.version?a.id+".":"";a.OxStr=e+"Ox";a.OyStr=e+"Oy";a.scaleStr=e+"escala";a.wStr=e+"_w";a.hStr=e+"_h";a.mxStr=e+"mouse_x";
a.myStr=e+"mouse_y";a.mpressedStr=e+"mouse_pressed";a.mclickedStr=e+"mouse_clicked";a.mclickIzqStr=e+"clic_izquierdo";a.click=0;a.resizable&&(a.wModExpr=c.evaluator.parser.parse(a.wModExpr),a.hModExpr=c.evaluator.parser.parse(a.hModExpr));"descartesJS_stage"!==a.id&&a.addEvents();c.evaluator.setVariable(a.id+"._refresh_back_",1);return d};$jscomp.inherits(K,b.Space);K.prototype.init=function(){a=this;a.initSpace();a.canvas&&(a.old_w=a.w,a.old_h=a.h,a.canvas.width=a.backCanvas.width=a.w*a.ratio,a.canvas.height=
a.backCanvas.height=a.h*a.ratio,a.canvas.style.width=a.backCanvas.style.width=a.w+"px",a.canvas.style.height=a.backCanvas.style.height=a.h+"px")};K.prototype.update=function(b){a=this;p=a.evaluator;n=a.parent;if(a.resizable){if(N=a.evaluator.eval(a.wModExpr),F=a.evaluator.eval(a.hModExpr),a.old_w!=N||a.old_h!=F)a.w=N,a.h=F,a.w_2=a.w/2,a.h_2=a.h/2,p.setVariable(a.wStr,a.w),p.setVariable(a.hStr,a.h),a.old_w=a.w,a.old_h=a.h,a.canvas.width=a.backCanvas.width=a.w*a.ratio,a.canvas.height=a.backCanvas.height=
a.h*a.ratio,a.canvas.style.width=a.backCanvas.style.width=a.w+"px",a.canvas.style.height=a.backCanvas.style.height=a.h+"px",b=!0}else p.setVariable(a.wStr,a.w),p.setVariable(a.hStr,a.h);a.drawIfValue=0<p.eval(a.drawif);if(a.drawIfValue){l=a.x!==p.eval(a.xExpr)+a.displaceRegionWest;m=a.y!==p.eval(a.yExpr)+n.plecaHeight+a.displaceRegionNorth;a.spaceChange=b||l||m||a.drawBefore!==a.drawIfValue||a.Ox!==p.getVariable(a.OxStr)||a.Oy!==p.getVariable(a.OyStr)||a.scale!==p.getVariable(a.scaleStr)||a.backColor!==
a.background.getColor();a.x=l?p.eval(a.xExpr)+a.displaceRegionWest:a.x;a.y=m?p.eval(a.yExpr)+n.plecaHeight+a.displaceRegionNorth:a.y;a.Ox=p.getVariable(a.OxStr);a.Oy=p.getVariable(a.OyStr);a.scale=p.getVariable(a.scaleStr);a.drawBefore=a.drawIfValue;a.scale=Math.max(1E-6,Math.min(1E6,a.scale));p.setVariable(a.scaleStr,a.scale);if(l||m)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"};K.prototype.drawBackground=function(){a=this;p=a.evaluator;c=a.backCtx;c.clearRect(0,0,a.backCanvas.width,a.backCanvas.height);c.fillStyle=a.backColor=a.background.getColor();c.fillRect(0,0,a.backCanvas.width,a.backCanvas.height);a.image&&""!=a.image.src&&a.image.ready&&a.image.complete&&("topleft"===a.bg_display?c.drawImage(a.image,0,0):
"stretch"===a.bg_display?c.drawImage(a.image,0,0,a.w,a.h):"patch"===a.bg_display?(c.fillStyle=c.createPattern(a.image,"repeat"),c.fillRect(0,0,a.w,a.h)):"imgcenter"===a.bg_display&&c.drawImage(a.image,(a.w-a.image.width)/2,(a.h-a.image.height)/2));f=a.scale;w=0;for(u=Math.max(0,a.w+a.h);f>u;)f/=10,w++;for(;f<u/10;)f*=10;c.lineWidth=1;""!==a.net&&(c.strokeStyle=a.net.getColor(),a.drawMarks(c,f/10,-1));if(2!==a.parent.version&&""!==a.net10||2===a.parent.version&&""!==a.net&&""!==a.net10)c.strokeStyle=
a.net10.getColor(),a.drawMarks(c,f,-1);if(""!==a.axes){var b="";"no"==a.x_axis&&(b+="x");"no"==a.y_axis&&(b+="y");c.strokeStyle=a.axes.getColor();c.beginPath();"no"==a.x_axis||""===a.x_axis&&2===a.parent.version||(c.moveTo(0,e(a.h/2+a.Oy)+.5),c.lineTo(a.w,e(a.h/2+a.Oy)+.5));"no"==a.y_axis||""===a.y_axis&&2===a.parent.version||(c.moveTo(e(a.w/2+a.Ox)+.5,0),c.lineTo(e(a.w/2+a.Ox)+.5,a.h));c.lineWidth=1.2;c.stroke();c.lineWidth=1;a.drawMarks(c,f,4,b);a.drawMarks(c,f/2,2,b);a.drawMarks(c,f/10,1,b)}if(""!==
a.x_axis||""!==a.y_axis)c.fillStyle=""!==a.axes?a.axes.getColor():"#000",c.font=h,c.textAlign="right",c.textBaseline="alphabetic","no"!=a.x_axis&&c.fillText(a.x_axis,e(a.w)-2,e(a.h/2+a.Oy)+12),"no"!=a.y_axis&&c.fillText(a.y_axis,e(a.w/2+a.Ox)-2,12);a.numbers&&""!=a.axes&&(c.fillStyle=a.axes.getColor(),c.font=h,c.textAlign="start",c.textBaseline="bottom",f>(a.w+a.h)/2?a.drawNumbers(c,f/5,f<=a.scale?w+1:w):f>(a.w+a.h)/4?a.drawNumbers(c,f/2,f<=a.scale?w+1:w):a.drawNumbers(c,f,w));b=$jscomp.makeIterator(a.backGraphics);
for(var d=b.next();!d.done;d=b.next())d.value.draw()};K.prototype.draw=function(){a=this;c=a.ctx;p.getVariable(a.id+"._refresh_back_")&&c.clearRect(0,0,a.canvas.width,a.canvas.height);for(var b=$jscomp.makeIterator(a.graphics),f=b.next();!f.done;f=b.next())f=f.value,""!==f.trace&&a.drawTrace&&f.drawTrace(),f.draw();b=$jscomp.makeIterator(a.graphicsCtr);for(f=b.next();!f.done;f=b.next())f.value.draw();""!=a.text&&a.click&&"L"===a.whichBtn&&(c.save(),c.strokeStyle=c.fillStyle=a.text.getColor(),c.lineWidth=
1,c.font=q,c.textAlign="center",c.textBaseline="alphabetic",G=1>=a.scale?a.mouse_x.toFixed(0):a.mouse_x.toFixed(parseInt(a.scale).toString().length+1),H=1>=a.scale?a.mouse_y.toFixed(0):a.mouse_y.toFixed(parseInt(a.scale).toString().length+1),C="("+G+","+H+")",J=e(c.measureText(C).width/2),O=a.getAbsoluteX(a.mouse_x),Q=a.getAbsoluteY(a.mouse_y),M=e(O),P=e(Q-10),M+J>a.w?M=a.w-J:0>M-J&&(M=J),P+1>a.h?P=a.h:0>P-14&&(P=15),c.fillText(C,M,P),c.beginPath(),c.arc(O,Q,2.5,0,d),c.stroke(),c.restore())};K.prototype.drawMarks=
function(a,b,c,d){x=this.w;r=this.h;I=B=0;E=x;D=r;y=e(x/2+this.Ox);A=e(r/2+this.Oy);0<=c&&(B=y-c,E=y+c,I=A-c,D=A+c);a.beginPath();if(!d||d&&!d.match("x"))for(c=-g(y/b);(v=y+g(c*b))<x;c++)a.moveTo(v+.5,I+.5),a.lineTo(v+.5,D+.5);if(!d||d&&!d.match("y"))for(d=-g(A/b);(z=A+g(d*b))<r;d++)a.moveTo(B+.5,z+.5),a.lineTo(E+.5,z+.5);a.stroke()};K.prototype.drawNumbers=function(a,b,c){x=this.w;r=this.h;y=e(x/2+this.Ox);A=e(r/2+this.Oy);for(c=-g(y/b);(v=y+g(c*b))<x;c++)a.fillText(parseFloat((c*b/this.scale).toFixed(4)),
v+1,A-2);for(c=-g(A/b);(z=A+g(c*b))<r;c++)0!==parseFloat(-c*b/this.scale)&&a.fillText(parseFloat((-c*b/this.scale).toFixed(4)),y+5,z+5)};K.prototype._handleDragStart=function(a){this.posAnte=b.getCursorPosition(a,this.container)};K.prototype._handleDragMove=function(c){a=this;c=b.getCursorPosition(c,a.container);a.evaluator.setVariable(a.OxStr,a.Ox-a.posAnte.x+c.x);a.evaluator.setVariable(a.OyStr,a.Oy-a.posAnte.y+c.y);a.posAnte=c};b.Space2D=K;return b}(descartesJS||{});
descartesJS=function(b){var a,d,h;function q(a,c){N=b.subtract3D(a,b.scalarProd3D(c,b.dotProduct3D(a,c)));F=b.add3D(a,b.scalarProd3D(N,-2));K=b.norm3D(F);return 0!==K?b.scalarProd3D(F,1/K):b.scalarProd3D(a,-1)}function e(a,b){return b.depth-a.depth}if(b.loadLib)return b;var g=Math.floor,p=Math.max,n=Math.cos,c=Math.sin,l,m,f,w,u,x,r,v,z,y,A,B,E,I,D,G,H=[],C,J,O,Q,M,P,N,F,K,L,R,U=function(a,c){f=c=b.Space.call(this,a,c)||this;f.ratio=a.ratio;f.backCanvas=b.newHTML("canvas",{id:f.id+"_background",width:f.w*
f.ratio+"px",height:f.h*f.ratio+"px"});f.canvas=b.newHTML("canvas",{id:f.id+"_canvas",width:f.w*f.ratio+"px",height:f.h*f.ratio+"px",class:"DescartesSpace3DCanvas",style:"z-index: "+f.zIndex+";"});f.ctx=f.canvas.getContext("2d");f.ctx.imageSmoothingEnabled=!1;f.canvas.ratio=f.ratio;f.canvas.style=f.backCanvas.style=(0<f.border_width?"border:"+f.border_width+"px solid "+f.border_color.getColor()+";":"")+(f.border_radius?"border-radius:"+f.border_radius+"px;":"");var d=f.id+".image";f.parent.images[d]=
f.canvas;f.parent.images[d].ready=1;f.parent.images[d].complete=!0;f.parent.images[d].canvas=!0;f.evaluator.setVariable(d,d);f.graphicControlContainer=b.newHTML("div",{id:f.id+"_graphicControls",style:"position:absolute;left:0px;top:0px;z-index:"+f.zIndex+";"});f.numCtrContainer=b.newHTML("div",{id:f.id+"_numericalControls",style:"position:absolute;left:0px;top:0px;z-index:"+f.zIndex+";"});f.container=b.newHTML("div",{id:f.id,class:"DescartesSpace3DContainer",style:"z-index:"+f.zIndex+";"});f.container.appendChild(f.backCanvas);
f.container.appendChild(f.canvas);f.container.appendChild(f.graphicControlContainer);f.container.appendChild(f.numCtrContainer);a.container.insertBefore(f.container,a.loader);f.eye={x:0,y:0,z:0};f.lights=[{x:50,y:50,z:70},{x:50,y:-50,z:30},{x:20,y:0,z:-80},{x:0,y:0,z:0}];d=0;for(var e=f.lights.length;d<e;d++)f.lights[d]=b.normalize3D(f.lights[d]);f.light3={x:0,y:0,z:0};f.intensity=[.4,.5,.3,0];f.userIntensity=0;f.dim=1;f.tmpIntensity=[];f.OxStr=f.id+".Ox";f.OyStr=f.id+".Oy";f.scaleStr=f.id+".escala";
f.wStr=f.id+"._w";f.hStr=f.id+"._h";f.mxStr=f.id+".mouse_x";f.myStr=f.id+".mouse_y";f.mpressedStr=f.id+".mouse_pressed";f.mclickedStr=f.id+".mouse_clicked";f.mclickIzqStr=f.id+".clic_izquierdo";f.obsStr=f.id+".observador";f.ojoXStr=f.id+".Ojo.x";f.ojoYStr=f.id+".Ojo.y";f.ojoZStr=f.id+".Ojo.z";f.rotZStr=f.id+".rot.z";f.rotYStr=f.id+".rot.y";f.userIDimStr=f.id+".userIlum.dim";f.userIIStr=f.id+".userIlum.I";f.userIxStr=f.id+".userIlum.x";f.userIyStr=f.id+".userIlum.y";f.userIzStr=f.id+".userIlum.z";
f.evaluator.setVariable(f.rotZStr,0);f.evaluator.setVariable(f.rotYStr,0);f.evaluator.setVariable(f.userIDimStr,f.dim);f.evaluator.setVariable(f.userIIStr,f.userIntensity);f.evaluator.setVariable(f.userIxStr,0);f.evaluator.setVariable(f.userIyStr,0);f.evaluator.setVariable(f.userIzStr,0);R=new b.Primitive3D({V:[new b.Vec4D],type:"vertex"},f);f.evaluator.setFunction(f.id+"._X3D2D_",function(a,b,c){R.V[0].x=a;R.V[0].y=b;R.V[0].z=c;R.computeDepth(f);return R.projV[0].x});f.evaluator.setFunction(f.id+
"._Y3D2D_",function(a,b,c){R.V[0].x=a;R.V[0].y=b;R.V[0].z=c;R.computeDepth(f);return R.projV[0].y});f.resizable&&(f.wModExpr=a.evaluator.parser.parse(f.wModExpr),f.hModExpr=a.evaluator.parser.parse(f.hModExpr));f.addEvents();return c};$jscomp.inherits(U,b.Space);U.prototype.init=function(a){f=this;f.initSpace();f.canvas&&(f.old_w=f.w,f.old_h=f.h,f.canvas.width=f.backCanvas.width=f.w*f.ratio,f.canvas.height=f.backCanvas.height=f.h*f.ratio,f.canvas.style.width=f.backCanvas.style.width=f.w+"px",f.canvas.style.height=
f.backCanvas.style.height=f.h+"px");f.w_2=f.w/2;f.h_2=f.h/2;f.w_plus_h=f.w+f.h;f.oldMouse={x:0,y:0};f.S={x:f.h/1080*-20.6*(40/f.scale),y:0,z:0};f.Ojo={x:3*f.w_2,y:0,z:0};f.evaluator.setVariable(f.ojoXStr,f.Ojo.x);f.evaluator.setVariable(f.ojoYStr,f.Ojo.y);f.evaluator.setVariable(f.ojoZStr,f.Ojo.z)};U.prototype.update=function(a){f=this;l=f.evaluator;m=f.parent;l.setVariable(f.wStr,f.w);l.setVariable(f.hStr,f.h);f.drawIfValue=0<l.eval(f.drawif);if(f.drawIfValue){f.resizable&&(wModExpr=f.evaluator.eval(f.wModExpr),
hModExpr=f.evaluator.eval(f.hModExpr),f.old_w!=wModExpr||f.old_h!=hModExpr)&&(f.w=wModExpr,f.h=hModExpr,f.w_2=f.w/2,f.h_2=f.h/2,l.setVariable(f.wStr,f.w),l.setVariable(f.hStr,f.h),f.old_w=f.w,f.old_h=f.h,f.canvas.width=f.backCanvas.width=f.w*f.ratio,f.canvas.height=f.backCanvas.height=f.h*f.ratio,f.canvas.style.width=f.backCanvas.style.width=f.w+"px",f.canvas.style.height=f.backCanvas.style.height=f.h+"px",a=!0,f.S={x:f.h/1080*-20.6*(40/f.scale),y:0,z:0},f.Ojo={x:3*f.w_2,y:0,z:0},f.evaluator.setVariable(f.ojoXStr,
f.Ojo.x),f.evaluator.setVariable(f.ojoYStr,f.Ojo.y),f.evaluator.setVariable(f.ojoZStr,f.Ojo.z));x=f.x!==l.eval(f.xExpr)+f.displaceRegionWest;r=f.y!==l.eval(f.yExpr)+m.plecaHeight+f.displaceRegionNorth;f.spaceChange=a||x||r||f.drawBefore!==f.drawIfValue||f.Ox!==l.getVariable(f.OxStr)||f.Oy!==l.getVariable(f.OyStr)||f.Ojo.x!==l.getVariable(f.ojoXStr)||f.Ojo.y!==l.getVariable(f.ojoYStr)||f.Ojo.z!==l.getVariable(f.ojoZStr)||f.scale!==l.getVariable(f.scaleStr);f.x=x?l.eval(f.xExpr)+f.displaceRegionWest:
f.x;f.y=r?l.eval(f.yExpr)+m.plecaHeight+f.displaceRegionNorth:f.y;f.Ojo.x=l.getVariable(f.ojoXStr);f.Ojo.y=l.getVariable(f.ojoYStr);f.Ojo.z=l.getVariable(f.ojoZStr);f.Ox=l.getVariable(f.OxStr);f.Oy=l.getVariable(f.OyStr);f.scale=l.getVariable(f.scaleStr);f.drawBefore=f.drawIfValue;if(a||void 0==f.observer){a=0;for(var b=f.parent.controls.length;a<b;a++)f.parent.controls[a].id===f.obsStr&&(L=!0);f.observer=L?l.getVariable(f.obsStr)||2.5*f.w_plus_h:2.5*f.w_plus_h;f.observer=p(f.observer,.25*f.w_plus_h);
l.setVariable(f.obsStr,f.observer)}1E-6>f.scale?(f.scale=1E-6,l.setVariable(f.scaleStr,1E-6)):1E6<f.scale&&(f.scale=1E6,l.setVariable(f.scaleStr,1E6));if(x||r)f.container.style.left=f.x+"px",f.container.style.top=f.y+"px";f.container.style.display="block";f.dim=l.getVariable(f.userIDimStr);f.userIntensity=l.getVariable(f.userIIStr);f.light3={x:parseInt(l.getVariable(f.userIxStr)),y:parseInt(l.getVariable(f.userIyStr)),z:parseInt(l.getVariable(f.userIzStr))};f.updateCamera();f.ctx.setTransform(f.ratio,
0,0,f.ratio,0,0);f.draw()}else f.container.style.display="none"};U.prototype.updateCamera=function(){this.eye=b.scalarProd3D(this.Ojo,1/this.scale)};U.prototype.rotateVertex=function(e){y=b.degToRad(f.evaluator.getVariable(f.rotZStr));A=n(y);B=c(y);a=e.x*A-e.y*B;d=e.x*B+e.y*A;h=e.z;y=b.degToRad(f.evaluator.getVariable(f.rotYStr));A=n(y);B=c(y);return{x:h*B+a*A,y:d,z:h*A-a*B}};U.prototype.project=function(a){var b=f.eye.x/(a.x-f.eye.x);return{x:f.getAbsoluteX(b*(f.eye.y-a.y)),y:f.getAbsoluteY(b*(f.eye.z-
a.z)),z:f.eye.x-a.x}};U.prototype.computeColor=function(a,c,d){"object"!=typeof a&&(a.match("rgba")?a=b.RGBAToHexColor(a):a.match("#")&&(a=new b.Color(a.substring(1))));Q=b.subtract3D(this.eye,c.avg);M=b.norm3D(Q);P=b.scalarProd3D(Q,1/M);this.lights[3]=b.subtract3D(this.light3,c.avg);G=b.norm3D(this.lights[3]);for(var e=0,f=this.intensity.length-1;e<f;e++)H[e]=this.intensity[e]*this.dim;H[3]=this.userIntensity*this.userIntensity/G||0;C=d?this.dim/2:this.dim/4;J=0;O=0>c.direction?c.normal:b.scalarProd3D(c.normal,
-1);c=0;for(e=this.lights.length;c<e;c++)d?(J=Math.max(0,b.dotProduct3D(q(this.lights[c],O),P)),J*=J*J):J=Math.max(0,b.dotProduct3D(this.lights[c],O)),C+=H[c]*J;C=Math.min(C,1);E=g(a.r*C);I=g(a.g*C);D=g(a.b*C);return"rgba("+E+","+I+","+D+","+a.a+")"};U.prototype.draw=function(){f=this;f.ctx.clearRect(0,0,f.canvas.width,f.canvas.height);f.ctx.fillStyle=f.background.getColor();f.ctx.fillRect(0,0,f.canvas.width,f.canvas.height);f.image&&""!=f.image.src&&f.image.ready&&f.image.complete&&("topleft"===
f.bg_display?f.ctx.drawImage(f.image,0,0):"stretch"===f.bg_display?f.ctx.drawImage(f.image,0,0,f.w,f.h):"patch"===f.bg_display?(f.ctx.fillStyle=ctx.createPattern(f.image,"repeat"),f.ctx.fillRect(0,0,f.canvas.width,f.canvas.height)):"center"===f.bg_display&&f.ctx.drawImage(f.image,(f.w-f.image.width)/2,(f.h-f.image.height)/2));if(!f.click){for(var a=$jscomp.makeIterator(f.graphics),b=a.next();!b.done;b=a.next())b.value.update();f.primitives=[];if(f.split)for(a=0,b=f.graphics.length;a<b;a++){w=f.graphics[a];
for(var c=a+1;c<b;c++)u=f.graphics[c],w.splitFace(u),u.splitFace(w);f.primitives=f.primitives.concat(w.primitives||[])}else for(a=0,b=this.graphics.length;a<b;a++){w=this.graphics[a];if(w.split)for(c=a+1;c<b;c++)u=this.graphics[c],u.split&&w.splitFace(u);this.primitives=this.primitives.concat(w.primitives||[])}}b=$jscomp.makeIterator(this.primitives);for(a=b.next();!a.done;a=b.next())a.value.computeDepth(this);this.primitives=this.primitives.sort(e);if("painter"===this.render)this.drawPainter(this.primitives);
else for(b=$jscomp.makeIterator(this.primitives),a=b.next();!a.done;a=b.next())a.value.draw(this.ctx,this);a=$jscomp.makeIterator(this.graphicsCtr);for(b=a.next();!b.done;b=a.next())b.value.draw()};U.prototype.drawPainter=function(a){for(var b=a.length,c=0;c<b;c++)a[c].drawn=!1,a[c].draw(this.ctx,this);var d=[];c=[];for(var e=0,f=a.length,g=.001,h,l;;){h=f;for(var m=0;m<b;m++)if(!a[m].drawn){l=!0;for(var p=0;p<b;p++)if(p!=m&&!a[p].drawn&&a[m].inFrontOf(d,a[p],g)){l=!1;break}l&&(f--,c[e++]=a[m],a[m].drawn=
!0)}if(0==f)break;else if(f==h){if(g*=10,.1<g){for(d=0;d<b;d++)a[d].drawn||(c[e++]=a[d],a[d].drawn=!0);break}}else g=.001}for(a=0;a<b;a++)c[a].draw(this.ctx,this)};U.prototype.rayFromEye=function(a,b){return{x:-this.eye.x,y:(a-(this.w_2+this.Ox))/this.scale-this.eye.y,z:(this.h_2+this.Oy-b)/this.scale-this.eye.z}};U.prototype._handleDragStart=function(a){f=this;f.posAnte=b.getCursorPosition(a,f.container);f.oldMouse.x=f.getRelativeX(f.posAnte.x);f.oldMouse.y=f.getRelativeY(f.posAnte.y)};U.prototype._handleDragMove=
function(a){f=this;v=(f.getAbsoluteX(f.oldMouse.x)-f.getAbsoluteX(f.mouse_x))/4;z=(-f.getAbsoluteY(f.oldMouse.y)+f.getAbsoluteY(f.mouse_y))/4;if(v!==f.disp.x||z!==f.disp.y)f.alpha=b.degToRad(f.evaluator.getVariable(f.rotZStr)),f.beta=b.degToRad(-f.evaluator.getVariable(f.rotYStr)),f.alpha=b.radToDeg(f.alpha)-v,f.beta=b.radToDeg(f.beta)-z,f.evaluator.setVariable(f.rotZStr,f.alpha),f.evaluator.setVariable(f.rotYStr,-f.beta),f.disp.x=v,f.disp.y=z,f.oldMouse.x=f.mouse_x,f.oldMouse.y=f.mouse_y};b.Space3D=
U;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a,d,h,q,e,g,p,n;b.SpaceHTMLIFrame=function(a,e){var c=b.Space.call(this,a,e)||this;d=c.parent.evaluator;void 0!=c._w_&&(a=d.parser.parse(c._w_),c._w_="number"!=a.type?a:void 0);void 0!=c._h_&&(a=d.parser.parse(c._h_),c._h_="number"!=a.type?a:void 0);c.isFirefox=/firefox/i.test(window.navigator.userAgent);c.file=c.file?c.file.trim():"";/^\[.*\]$/.test(c.file)?c.file=d.parser.parse(c.file.slice(1,-1)):/^'.*'$/.test(c.file)?c.file=d.parser.parse(c.file):
c.file=d.parser.parse("'"+c.file+"'");c.oldFile=d.eval(c.file);c.MyIFrame=b.newHTML("iframe",{marginheight:0,marginwidth:0,frameborder:0,scrolling:"auto",class:"DescartesSpaceIframe"});0!=c.oldFile&&c.MyIFrame.setAttribute("src",c.oldFile);c.container=b.newHTML("div",{id:c.id,class:"DescartesSpaceIframeContainer",style:"width:"+c.w+"px;height:"+c.h+"px;left:"+c.x+"px;top:"+c.y+"px;z-index:"+c.zIndex+";"+(b.isIOS?"overflow:scroll;-webkit-overflow-scrolling:touch;overflow-scrolling:touch;":"")});c.container.appendChild(c.MyIFrame);
c.imageSrc&&(c.container.style.backgroundImage="url("+c.imageSrc+")");c.parent.container.insertBefore(c.container,c.parent.loader);c.MyIFrame.onload=function(a){var d=this;c.evaluator.setFunction(c.id+".set",function(a,b){d.contentWindow.postMessage({type:"set",name:a,value:b},"*");return 0});c.evaluator.setFunction(c.id+".update",function(){d.contentWindow.postMessage({type:"update"},"*");return 0});c.evaluator.setFunction(c.id+".exec",function(a,b){d.contentWindow.postMessage({type:"exec",name:a,
value:b},"*");return 0});c.evaluator.setFunction(c.id+".changeConf",function(a){if(a){if(b.cacheFiles[a])var c=b.cacheFiles[a];else c=(c=document.getElementById(a))&&"descartes/embed"===c.type?c.textContent:b.openFile(a),c=(c=(new DOMParser).parseFromString(c,"text/html").querySelector("ajs"))?c.innerHTML:"",b.cacheFiles[a]=c;d.contentWindow.postMessage({type:"change_config",filename:a,content:c},"*")}return 0});c.evaluator.setFunction(c.id+".changeContent",function(a){a&&(a=(a=(new DOMParser).parseFromString(a.replace(/&sq;/g,
"'"),"text/html").querySelector("ajs"))?a.innerHTML:"",d.contentWindow.postMessage({type:"change_content",content:a},"*"))});c.ImReady=!c.isFirefox;c.isFirefox||(c.container.style.visibility="visible",c.container.style.opacity="1",c.container.style.zIndex=c.zIndex,c.container.style.display=c.drawIfValue?"block":"none");c.MyIFrame.style.visibility="visible";c.container.style.backgroundImage=""};c.update();c.evaluator.setVariable(c.id+"._scroll",0);return c};$jscomp.inherits(b.SpaceHTMLIFrame,b.Space);
b.SpaceHTMLIFrame.prototype.init=function(){this.initSpace()};b.SpaceHTMLIFrame.prototype.update=function(b){a=this;h=a.container;d=a.evaluator;a.drawIfValue=0<d.eval(a.drawif);a.ImReady?h.style.display=a.drawIfValue?"block":"none":(h.style.visibility=a.drawIfValue?"visible":"hidden",h.style.opacity=a.drawIfValue?"1":"0",h.style.zIndex=a.drawIfValue?a.zIndex:-1E3);if(a.drawIfValue){b&&(a.x=a.y=Infinity);g=d.eval(a.xExpr)+a.displaceRegionWest;if(q=a.x!==g)a.x=g;g=d.eval(a.yExpr)+a.parent.plecaHeight+
a.displaceRegionNorth;if(e=a.y!==g)a.y=g;void 0!=a._w_&&(g=d.eval(a._w_),a.w!==g&&(a.container.style.width=g+"px",a.w=g));void 0!=a._h_&&(g=d.eval(a._h_),a.h!==g&&(h.style.height=g+"px",a.h=g));if(q||e)a.container.style.left=a.x+"px",a.container.style.top=a.y+"px";p=d.eval(a.file);p!==a.oldFile&&(a.ImReady=!1,a.isFirefox||(h.style.display="block",h.style.visibility=a.drawIfValue?"visible":"hidden",h.style.opacity=a.drawIfValue?"1":"0",h.style.zIndex=a.drawIfValue?a.zIndex:-1E3),a.imageSrc&&(h.style.backgroundImage=
"url("+a.imageSrc+")"),a.MyIFrame.style.visibility="hidden",a.oldFile=p,a.MyIFrame.contentWindow.location.replace(p));n=d.getVariable(a.id+"._scroll");1==n?(a.MyIFrame.setAttribute("scrolling","yes"),a.MyIFrame.style.overflow=""):-1==n?(a.MyIFrame.setAttribute("scrolling","no"),a.MyIFrame.style.overflow="hidden"):(a.MyIFrame.setAttribute("scrolling","auto"),a.MyIFrame.style.overflow="")}else a.MyIFrame.contentWindow.blur()};return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;var a=1,d=function(d){this.children=d.children;this.lessonParser=d.lessonParser;this.images=d.images;this.audios=d.audios;this.im_l=this.au_l=0;this.descartesApp=d;var h=document.querySelectorAll('script[type="descartes/imagen"]');h=$jscomp.makeIterator(h);for(var e=h.next();!e.done;e=h.next())e=e.value,this.images[e.id]=new Image,this.images[e.id].onload=function(){this.ready=1},this.images[e.id].src=e.innerText.trim();this.imgLoader=b.newHTML("div",
{class:"DescartesLoaderImage"});this.progress=b.newHTML("progress",{class:"PBL",value:0,max:100});d.imgLoader?(d.loader.style.backgroundColor="transparent",this.imgLoader.setAttribute("style","background-image:url("+d.imgLoader+");background-size:contain;")):(a=d.width<d.height?d.width/1144:d.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:"+
(d.width-726*a)/2+"px;top:"+(33.5*d.height/100+940*a/2)+"px;width:"+726*a+"px;height:"+14*a+"px;"));d.loader.appendChild(this.imgLoader);d.loader.appendChild(this.progress);d.firstRun=!1;this.initPreloader()};d.prototype.initPreloader=function(){var a=this,d=a.children,e=a.images,g=a.audios,p=/[\w\.\-//]*(\.png|\.jpg|\.gif|\.svg|\.webp)/gi,n=/[\w\.\-//]*(\.ogg|\.oga|\.mp3|\.wav)/gi,c=/'macro'|'makro'/g,l;var m=0;for(l=d.length;m<l;m++){if(d[m].value.match(c)){var f="";var w=void 0;var u=a.lessonParser.split(d[m].value);
var x=0;for(var r=u.length;x<r;x++)"expresion"===babel[u[x][0]]&&(f=u[x][1]);f&&(w=(w=document.getElementById(f))&&"descartes/macro"==w.type?w.text:b.openFile(f));if(w&&(w=w.match(p)))for(f=0,x=w.length;f<x;f++)u=w[f],u.toLowerCase().endsWith("vacio.gif")||""==u.substring(0,u.length-4)||e[u]||(e[u]=this.descartesApp.getImageAux(u))}if(w=d[m].value.match(p))for(f=0,x=w.length;f<x;f++)u=w[f],u.toLowerCase().endsWith("vacio.gif")||""==u.substring(0,u.length-4)||e[u]||(e[u]=this.descartesApp.getImageAux(u));
if(w=d[m].value.match(n))for(f=0,u=w.length;f<u;f++)g[w[f]]||(g[w[f]]=this.descartesApp.getAudioAux(w[f]))}for(var v in e)e.hasOwnProperty(v)&&a.im_l++;for(var z in g)g.hasOwnProperty(z)&&a.au_l++;var y=a.im_l+a.au_l;0<y&&a.progress.setAttribute("max",y);var A,B=function(){A=0;for(var c in e)e.hasOwnProperty(c)&&(e[c].ready||e[c].errorload)&&A++;for(var d in g)g.hasOwnProperty(d)&&(g[d].ready||g[d].errorload)&&A++;a.progress.setAttribute("value",A);A!=y?a.timer=b.setTimeout(B,1):a.descartesApp.initBuildApp()};
B()};b.DescartesLoader=d;return b}(descartesJS||{});
descartesJS=function(b){function a(){b.cssScale=Math.min(window.innerWidth/this.width,window.innerHeight/this.height);this.container.parentNode.style.width=window.innerWidth+"px";this.container.parentNode.style.height=window.innerHeight+"px";this.container.style.transform="translate(-50%, -50%) scale("+b.cssScale+")"}if(b.loadLib)return b;var d=/type='fill'|tipo='relleno'|tipus='ple'|mota='betea'|type='plein'|tipo='recheo'|tipo='curva_piena'|tipo='preencher'|tipus='ple'/,h=function(a){this.animation=
{playing:!1,play:function(){},stop:function(){},reinit:function(){}};this.ratio=b._ratio;this.URL=window.location.href;this.applet=a;this.parentC=a.parentNode;this.width=parseFloat(a.getAttribute("width"));this.height=parseFloat(a.getAttribute("height"));this.decimal_symbol=".";this.decimal_symbol_regexp=/\./g;this.language="espa\u00f1ol";this.children=a.getElementsByTagName("param");this.code=a.getAttribute("code");this.images={};this.audios={};this.firstRun=!0;this.keyboard=new b.Keyboard(this);
this.scaleToFit=function(){};this.init()};h.prototype.init=function(){this.stop();this.evaluator=new b.Evaluator(this);this.evaluator.setVariable("DJS.w",this.width);this.evaluator.setVariable("DJS.h",this.height);this.evaluator.setVariable("DJS.container_w",this.width);this.evaluator.setVariable("DJS.container_h",this.height);this.getURLParameters();this.lessonParser=new b.LessonParser(this);var d,e=$jscomp.makeIterator(this.children);for(d=e.next();!d.done;d=e.next())if(d=d.value,"Buttons"==babel[d.name])this.buttonsConfig=
this.lessonParser.parseButtonsConfig(d.value);else if("image_loader"==d.name)this.imgLoader=d.value;else if("expand"==d.name)this.expand=d.value;else if("docBase"==d.name)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;void 0!=this.container&&(this.cleanCanvasImages(),this.parentC.removeChild(this.container),delete this.container,delete this.loader);this.container=
b.newHTML("div");this.loader=b.newHTML("div",{class:"DescartesLoader"});this.container.addEventListener("contextmenu",b.preventDefault);this.parentC.insertBefore(this.container,this.parentC.firstChild);this.container.width=this.loader.width=this.width;this.container.height=this.loader.height=this.height;this.container.className="DescartesAppContainer";this.container.setAttribute("style","width:"+this.width+"px;height:"+this.height+"px;");this.container.appendChild(this.loader);"fit"==this.expand&&
(e=b.newHTML("style",{rel:"stylesheet",type:"text/css",id:"StyleDescartesAppsPrint"}),document.head.insertBefore(e,document.head.firstChild),e.innerHTML="@page{margin:0;size:"+this.width+"px "+this.height+"px;}",document.body.style.margin=document.body.style.padding=0,document.body.style.overflow="hidden",this.container.parentNode.removeAttribute("align"),this.container.parentNode.style.overflow="hidden",this.container.style.left=this.container.style.top="50%",this.container.style.transformOrigin=
"50% 50%",this.scaleToFit=a,this.scaleToFit());"cover"==this.expand&&(this.scaleToFit=function(){this.container.width=this.width=window.innerWidth;this.container.height=this.height=window.innerHeight;this.container.setAttribute("style","width:"+this.width+"px;height:"+this.height+"px;");this.evaluator.setVariable("DJS.container_w",this.container.width);this.evaluator.setVariable("DJS.container_h",this.container.height);try{this.update()}catch(n){}if(this.spaces)for(var a=$jscomp.makeIterator(this.spaces),
b=a.next();!b.done;b=a.next())b=b.value,b.initSpace(),b.init(),b.update(!0)},this.scaleToFit());this.firstRun?(this.loader.style.display="block",new b.DescartesLoader(this)):this.initBuildApp()};h.prototype.initBuildApp=function(){b.showConfig=!0;var a=this,e,g=a.lessonParser,h=[],n=[],c=[],l=[],m=[],f=[],w=$jscomp.makeIterator(a.children);for(e=w.next();!e.done;e=w.next())e=e.value,"editable"==babel[e.name]?b.showConfig="false"!=babel[e.value]:"language"==babel[e.name]?a.language=e.value:"Buttons"==
babel[e.name]?a.buttonsConfig=g.parseButtonsConfig(e.value):"decimal_symbol"==babel[e.name]?(a.decimal_symbol=e.value,a.decimal_symbol_regexp=new RegExp("\\"+a.decimal_symbol,"g")):"version"==babel[e.name]?a.version=parseInt(e.value):e.name.startsWith("E_")?(/='HTMLIFrame'/.test(e.value)&&a.nIframes++,h.push(e.value)):e.name.startsWith("C_")?n.push(e.value):e.name.startsWith("A_")?c.push(e.value):e.name.startsWith("G_")?(d.test(e.value)&&(a.ratio=1),l.push(e.value)):e.name.startsWith("S_")?m.push(e.value):
"Animation"==babel[e.name]&&f.push(e.value);h=$jscomp.makeIterator(h);for(w=h.next();!w.done;w=h.next())a.spaces.push(g.parseSpace(w.value)),a.zIndex++;l.forEach(function(c,d){b.DEBUG.elemIndex=d;if(c=g.parseGraphic(c))a.editableRegionVisible=a.editableRegionVisible||c.visible,c.space.addGraph(c)});m.forEach(function(a,c){b.DEBUG.elemIndex=c;(a=g.parse3DGraphic(a))&&a.space.addGraph(a,!0)});n=$jscomp.makeIterator(n);for(l=n.next();!l.done;l=n.next())a.controls.push(g.parseControl(l.value));c=$jscomp.makeIterator(c);
for(n=c.next();!n.done;n=c.next())g.parseAuxiliar(n.value);f=$jscomp.makeIterator(f);for(c=f.next();!c.done;c=f.next())a.animation=g.parseAnimation(c.value);a.configRegions();a.updateAuxiliaries();a.updateAuxiliaries();f=$jscomp.makeIterator(a.controls);for(c=f.next();!c.done;c=f.next())c.value.init();a.updateControls();a.updateSpaces(!0);b.setTimeout(function(){a.finishInit()},a.nIframes);document.addEventListener("keydown",function(c){(c.ctrlKey||c.commandKey)&&c.shiftKey&&"C"===c.key&&(navigator.clipboard.writeText(a.applet.innerHTML),
b.preventDefault(c))})};h.prototype.finishInit=function(){var a=this;a.evaluator.setVariable("decimalSymbol",a.decimal_symbol);a.update();a.loader.parentNode.removeChild(a.loader);window.parent!==window&&(a.parentC.style.margin=a.parentC.style.padding="0","fit"==a.expand&&window.addEventListener("touchmove",function(a){a.preventDefault();a.stopPropagation()}),window.parent.postMessage({type:"reportSize",href:a.URL,width:a.width,height:a.height},"*"),window.parent.postMessage({type:"ready",value:a.URL},
"*"),b.onResize());window.opener&&window.opener.postMessage({type:"isResizeNeeded",href:a.URL},"*");b.showConfig&&a.externalSpace.init();window.dispatchEvent(new CustomEvent("descartesReady",{detail:a}));a.evaluator.setFunction("openKB",function(b,d,h,n,c,l,m,f,q,u,x){a.keyboard.show(null,b,d,h,n,{x:c,y:l,w:m,h:f,fs:q+"px",value:u+"",type:"custom",tagName:"textfield"},x)});a.readyApp=!0};h.prototype.adjustSize=function(){document.body.style.margin=document.body.style.padding=this.parentC.style.margin=
this.parentC.style.padding="0";var a=parseInt(this.width+30),d=parseInt(this.height+90);window.moveTo(parseInt(screen.width-a)/2,parseInt(screen.height-d)/2);window.resizeTo(a,d);b.onResize()};h.prototype.configRegions=function(){var a=this.buttonsConfig||{},d=this.container,g=this.evaluator.parser,h=this._configHorizontalRegion(a,d,g,"north",this.northSpace,a.rowsNorth,[{show:a.about,width:100,name:"english"===this.language?"about":"cr\u00e9ditos",action:{execute:b.showAbout},position:"left"},{show:a.config,
width:100,name:"config",action:"config",position:"right"}]),n=this._configHorizontalRegion(a,d,g,"south",this.southSpace,a.rowsSouth,[{show:a.init,width:100,name:"english"===this.language?"init":"inicio",action:"init",position:"left"},{show:a.clear,width:100,name:"english"===this.language?"clear":"limpiar",action:"clear",position:"right"}]),c=this._configVerticalRegion(a,d,g,"west",this.westSpace,a.widthWest,h,n);g=this._configVerticalRegion(a,d,g,"east",this.eastSpace,a.widthEast,h,n);a=this.editableRegionVisible?
this._configEditableRegion(a,d,n):0;this.displaceRegionNorth=h;this.displaceRegionSouth=n+a;this.displaceRegionWest=c;this.displaceRegionEast=g;h=$jscomp.makeIterator(this.spaces);for(n=h.next();!n.done;n=h.next())n.value.init()};h.prototype._configHorizontalRegion=function(a,d,g,h,n,c,l){var e=n.controls;l=l.filter(function(a){return a.show});if(0>=c&&0===e.length&&0===l.length)return 0;var f=0<c?c:1;c=a.height*f;n=n.container;n.id="descartesJS_"+h;n.setAttribute("style","width:"+d.width+"px;height:"+
c+"px;left:0;"+("north"===h?"top:"+this.plecaHeight+"px;":"bottom:0;"));d.insertBefore(n,this.loader);var p=d.width;n=0;for(var q=$jscomp.makeIterator(l),x=q.next();!x.done;x=q.next())x=x.value,p-=x.width,"left"===x.position&&(n+=x.width);if(0<e.length)for(f=Math.ceil(e.length/f),p/=f,q=0,x=e.length;q<x;q++)e[q].expresion=g.parse("("+(n+q%f*p)+","+a.height*Math.floor(q/f)+","+p+","+a.height+")"),e[q].init();a=0;e=$jscomp.makeIterator(l);for(l=e.next();!l.done;l=e.next())l=l.value,f=void 0,"left"===
l.position?f=n-l.width:(f=d.width-a-l.width,a+=l.width),f={region:h,name:l.name,font_size:g.parse("15"),expresion:g.parse("("+f+",0,"+l.width+","+c+")")},"string"===typeof l.action&&(f.action=l.action),f=new b.Button(this,f),"object"===typeof l.action&&(f.actionExec=l.action),f.update();return c};h.prototype._configVerticalRegion=function(a,b,d,h,n,c,l,m){var e=n.controls;if(0===e.length||!c)return 0;m=b.height-l-m;n=n.container;n.id="descartesJS_"+h;n.setAttribute("style","width:"+c+"px;height:"+
m+"px;"+("west"===h?"left:0;":"right:0;")+"top:"+l+"px;");b.insertBefore(n,this.loader);b=0;for(h=e.length;b<h;b++)e[b].expresion=d.parse("(0,"+a.height*b+","+c+","+a.height+")"),e[b].init();return c};h.prototype._configEditableRegion=function(a,d,g){a=a.height;var e=this.editableRegion.container;e.id="descartesJS_editableRegion";e.setAttribute("style","position:absolute;width:"+d.width+"px;height:"+a+"px;left:0;top:"+(d.height-g-a)+"px;");d.insertBefore(e,this.loader);g=this.editableRegion.textFields;
d=d.width/g.length;for(var h=b.getFieldFontSize(a),c=0,l=g.length;c<l;c++){var m=g[c];if("div"===m.type){e.appendChild(m.container);m.container.setAttribute("style","font-family:"+b.sansserif_font+";width:"+(d-4)+"px;height:"+a+"px;position:absolute;left:"+c*d+"px;top:0;");var f=m.container.firstChild;f.firstChild.textContent=f.firstChild.textContent.substring(3,f.firstChild.textContent.length-3);f.setAttribute("style","font-family:"+b.sansserif_font+";font-size:"+h+"px;padding-top:0;background-color:#e0e4e8;position:absolute;left:0;top:0;height:"+
a+"px;text-align:center;line-height:"+a+"px;");var q=f.offsetWidth;f.style.width=q+"px";m.container.lastChild.setAttribute("style","font-family:"+b.monospace_font+";font-size:"+h+"px;width:"+(d-q)+"px;height:"+a+"px;position:absolute;left:"+q+"px;top:0;border:2px groove white;")}else e.appendChild(m),m.setAttribute("style","font-family:"+b.monospace_font+";font-size:"+h+"px;width:"+d+"px;height:"+a+"px;position:absolute;left:"+c*d+"px;top:0;border:2px groove white;")}return a};h.prototype.update=
function(){this.updateAuxiliaries();this.updateControls();this.updateEvents();this.updateControls();this.updateSpaces()};h.prototype.clearClick=function(){for(var a=$jscomp.makeIterator(this.spaces),b=a.next();!b.done;b=a.next())b.value.clearClick()};h.prototype.removeButtonClick=function(){b.newBlobContent=null;for(var a=$jscomp.makeIterator(this.controls),d=a.next();!d.done;d=a.next())d.value.buttonClick=!1};h.prototype.deactivateControls=function(){if(this.controls)for(var a=$jscomp.makeIterator(this.controls),
b=a.next();!b.done;b=a.next())b=b.value,b.deactivate&&b.deactivate()};h.prototype.updateAuxiliaries=function(){for(var a=$jscomp.makeIterator(this.auxiliaries),b=a.next();!b.done;b=a.next())b.value.update()};h.prototype.updateEvents=function(){for(var a=$jscomp.makeIterator(this.events),b=a.next();!b.done;b=a.next())b.value.update()};h.prototype.updateControls=function(){for(var a=$jscomp.makeIterator(this.controls),b=a.next();!b.done;b=a.next())b.value.update()};h.prototype.updateSpaces=function(a){for(var b=
$jscomp.makeIterator(this.spaces),d=b.next();!d.done;d=b.next())d.value.update(a)};h.prototype.clear=function(){for(var a=$jscomp.makeIterator(this.spaces),b=a.next();!b.done;b=a.next())b=b.value,b.spaceChange=!0,b.drawBackground&&b.drawBackground()};h.prototype.play=function(){this.animation.play()};h.prototype.stop=function(){this.animation.stop()};h.prototype.reinitAnimation=function(){this.animation.reinit()};h.prototype.stopAudios=function(){this.stop();for(var a=$jscomp.makeIterator(Object.values(this.audios)),
b=a.next();!b.done;b=a.next())(b=b.value)&&"function"==typeof b.pause&&(b.pause(),b.currentTime=0)};h.prototype.getImage=function(a){return a?(this.images[a]||(this.images[a]=this.getImageAux(a)),this.images[a]):new Image};h.prototype.getImageAux=function(a){var b=new Image;a.startsWith("http")&&(b.crossOrigin="Anonymous");b.onload=function(){this.ready=1};b.onerror=function(){this.errorload=1};b.src=a;return b};h.prototype.getAudio=function(a){return a?(this.audios[a]||(this.audios[a]=this.getAudioAux(a)),
this.audios[a]):new Audio};h.prototype.getAudioAux=function(a){var d=new Audio(a);d.filename=a;var g=function(){this.ready=1},h=function(){this.canPlayType("audio/"+this.filename.substring(this.filename.length-3))||"mp3"!=this.filename.substring(this.filename.length-3)?(console.warn("El archivo "+a+" no puede ser reproducido"),this.errorload=1):(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",h),d.load())};d.addEventListener("canplaythrough",g);d.addEventListener("load",g);d.addEventListener("error",h);b.hasTouchSupport?(d.load(),d.play(),b.setTimeout(function(){d.pause()},20),d.ready=1):d.load();return d};h.prototype.getControlByCId=function(a){return this.getControlById(a,!0)};h.prototype.getControlById=function(a,b){b=b?"cID":"id";for(var d=$jscomp.makeIterator(this.controls),e=d.next();!e.done;e=d.next())if(e=e.value,e[b]==a)return e;return{update:function(){},
w:0,h:0}};h.prototype.getSpaceByCId=function(a){return this.getSpaceById(a,!0)};h.prototype.getSpaceById=function(a,b){b=b?"cID":"id";for(var d=$jscomp.makeIterator(this.spaces),e=d.next();!e.done;e=d.next())if(e=e.value,e[b]==a)return e;return{update:function(){},w:0,h:0}};h.prototype.getURLParameters=function(){for(var a=$jscomp.makeIterator((new URLSearchParams(window.location.search)).entries()),b=a.next();!b.done;b=a.next()){var d=$jscomp.makeIterator(b.value);b=d.next().value;d=d.next().value;
this.evaluator.setVariable("URL."+b,+d==+d?parseFloat(d):d)}};h.prototype.cleanCanvasImages=function(){for(var a=$jscomp.makeIterator(this.container.querySelectorAll("canvas")),b=a.next();!b.done;b=a.next())b=b.value,b.width=b.height=1,b.style.width=b.style.height="1px";a=$jscomp.makeIterator(this.spaces);for(b=a.next();!b.done;b=a.next())b=b.value,b.canvas&&(b.canvas=b.ctx=null),b.backCanvas&&(b.backCanvas=b.backCtx=null);for(var d in this.images)this.images[d].nodeName&&"canvas"===this.images[d].nodeName.toLowerCase()&&
delete this.images[d]};b.DescartesApp=h;return b}(descartesJS||{});
descartesJS=function(b){if(b.loadLib)return b;b.DEBUG={PARENTHESIS_CLOSING:"Faltan par\u00e9ntesis por cerrar",PARENTHESIS_OPENING:"Faltan par\u00e9ntesis por abrir",BRACKET_CLOSING:"Faltan corchetes por cerrar",BRACKET_OPENING:"Faltan corchetes por abrir",INCOMPLETE_IF:"Condicional incompleta",EXPRESSION:"En la expresi\u00f3n",setError:function(a,d){a="Error: "+a+" en\u300a "+d+" \u300b";var h="";switch(b.DEBUG.objectName){case "Auxiliar":d="event"===b.DEBUG.typeName||"algorithm"===b.DEBUG.typeName||
"constant"===b.DEBUG.typeName?"En el programa ":"En la definici\u00f3n ";if("doExpr"==babel[b.DEBUG.pName]||"init"==babel[b.DEBUG.pName])h=" en la l\u00ednea "+(b.DEBUG.lineCount+1);a+=d+"\u300c"+b.DEBUG.idName+"\u300d, en el par\u00e1metro \u300c"+b.DEBUG.pName+"\u300d"+h+".";break;case "Graphic":a+="En el gr\u00e1fico #"+(b.DEBUG.elemIndex+1)+" de tipo \u300c"+b.DEBUG.idName+"\u300d, en el par\u00e1metro \u300c"+b.DEBUG.pName+"\u300d.";break;case "Animation":if("doExpr"==babel[b.DEBUG.pName]||"init"==
babel[b.DEBUG.pName])h=" en la l\u00ednea "+(b.DEBUG.lineCount+1);a+=". En la Animaci\u00f3n, en el par\u00e1metro \u300c"+b.DEBUG.pName+"\u300d"+h+"."}console.info(a)}};return b}(descartesJS||{});
descartesJS=function(b){function a(){d().forEach(function(a){b.apps.push(new b.DescartesApp(a));a.className="DescartesJS"})}function d(){return[].concat($jscomp.arrayFromIterable(document.querySelectorAll("applet,ajs"))).filter(function(a){return/Descartes|DescartesJS|DescartesWeb2_0/i.test(a.getAttribute("code"))})}function h(){document.querySelectorAll(".DescartesAppContainer").forEach(function(a){a.remove()})}function q(){var d,e;return $jscomp.asyncExecutePromiseGeneratorProgram(function(g){switch(g.nextAddress){case 1:return g.setCatchFinallyBlocks(2),
d=[],["descartesJS_serif","descartesJS_sansserif","descartesJS_monospace","DJS_symbol","DJS_math"].forEach(function(a){d.push(document.fonts.load("9px "+a));d.push(document.fonts.load("bold 9px "+a));d.push(document.fonts.load("italic 9px "+a));d.push(document.fonts.load("bold italic 9px "+a))}),g.yield(Promise.all(d),4);case 4:g.leaveTryBlock(3);break;case 2:return e=g.enterCatchBlock(),console.log(e),g.return();case 3:b.getFeatures(),b.hasCanvas?(window.scrollTo(0,100),h(),a(),window.addEventListener("resize",
b.onResize),window.scrollTo(0,0)):document.getElementById("StyleDescartesApps").innerHTML="applet.DescartesJS,applet,ajs.DescartesJS,ajs{display:block;}",g.jumpToEnd()}})}if(b.loadLib)return b;b.apps=[];b.getDescartesApps=function(){return b.apps};(function(){var a=document.getElementById("StyleDescartesApps");a&&a.remove();a=b.newHTML("style",{id:"StyleDescartesApps",type:"text/css",rel:"stylesheet"});a.innerHTML="applet.DescartesJS,applet,ajs.DescartesJS,ajs{display:none;}";document.head.appendChild(a)})();
b.onResize=function(){0<b.apps.length&&b.apps[0].scaleToFit()};var e={};b.onMessage=function(a){if(0<b.apps.length){var d=a.data;if(d)switch(d.type){case "set":"string"==typeof d.value||"number"==typeof d.value?b.apps[0].evaluator.setVariable(d.name,d.value):d.value&&void 0!=d.value.rows?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":(a=b.apps[0].evaluator.getFunction(d.name))&&a.apply(b.apps[0].evaluator,
d.value.toString().split(","));break;case "isResizeNeeded":a.source.postMessage({type:"doResize"},"*");break;case "doResize":0<b.apps.length&&b.apps[0].adjustSize();break;case "change_config":e[d.filename]?a=e[d.filename]:(a=b.newHTML("div"),a.innerHTML=d.content,a=a.getElementsByTagName("param"),e[d.filename]=a);b.apps[0].children=a;b.apps[0].init();break;case "change_content":a=b.newHTML("div"),a.innerHTML=d.content,a=a.getElementsByTagName("param"),b.apps[0].children=a,b.apps[0].init()}}};void 0==
b.loadLib&&(b.loadLib=!0,window.addEventListener("load",q),window.addEventListener("message",b.onMessage),["webkitTransitionEnd","transitionend","oTransitionEnd","MSTransitionEnd"].forEach(function(a){window.addEventListener(a,function(a){b.onResize(a)})}));return b}(descartesJS||{});
