forked from jscad/OpenJSCAD.org
-
Notifications
You must be signed in to change notification settings - Fork 1
/
openscad-openjscad-translator.js
executable file
·58 lines (50 loc) · 94.3 KB
/
openscad-openjscad-translator.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/**
* almond 0.2.5 Copyright (c) 2011-2012, The Dojo Foundation All Rights Reserved.
* Available via the MIT or new BSD license.
* see: http://github.com/jrburke/almond for details
*/
// Copyright 2010 David Bau, all rights reserved.
// 1. Redistributions of source code must retain the above copyright
// 2. Redistributions in binary form must reproduce the above copyright
// Copyright (c) 2007 James Coglan
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// The above copyright notice and this permission notice shall be included
/*
# Module: STL.js
#
# Description: decode STL 3D file
# modified Devon Govett's bmp.js
#
# Reference:
# STL specs. http://en.wikipedia.org/wiki/STL_%28file_format%29#Binary_STL
# BMP.js http://devongovett.github.com/bmp.js/
#
# Author(s): Devon Govett provide a bmp decoding example.
# C.T. Yeung modify to decode STL.
#
# History:
# 20Dec11 1st crack at it cty
# 23Dec11 loading vertexies OK
# need to test normal when rendering shades
# rotation is off when passed 180 degrees cty
#
# MIT LICENSE
# Copyright (c) 2011 CT Yeung
# Copyright (c) 2011 Devon Govett
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this
# software and associated documentation files (the "Software"), to deal in the Software
# without restriction, including without limitation the rights to use, copy, modify, merge,
# publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
# to whom the Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all copies or
# substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
# BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
(function(e,t){typeof define=="function"&&define.amd?define(["underscore"],t):e.openscadOpenJscadParser=t(e._)})(this,function(e){var t,n,r;return function(e){function d(e,t){return h.call(e,t)}function v(e,t){var n,r,i,s,o,u,a,f,c,h,p=t&&t.split("/"),d=l.map,v=d&&d["*"]||{};if(e&&e.charAt(0)===".")if(t){p=p.slice(0,p.length-1),e=p.concat(e.split("/"));for(f=0;f<e.length;f+=1){h=e[f];if(h===".")e.splice(f,1),f-=1;else if(h===".."){if(f===1&&(e[2]===".."||e[0]===".."))break;f>0&&(e.splice(f-1,2),f-=2)}}e=e.join("/")}else e.indexOf("./")===0&&(e=e.substring(2));if((p||v)&&d){n=e.split("/");for(f=n.length;f>0;f-=1){r=n.slice(0,f).join("/");if(p)for(c=p.length;c>0;c-=1){i=d[p.slice(0,c).join("/")];if(i){i=i[r];if(i){s=i,o=f;break}}}if(s)break;!u&&v&&v[r]&&(u=v[r],a=f)}!s&&u&&(s=u,o=a),s&&(n.splice(0,o,s),e=n.join("/"))}return e}function m(t,n){return function(){return s.apply(e,p.call(arguments,0).concat([t,n]))}}function g(e){return function(t){return v(t,e)}}function y(e){return function(t){a[e]=t}}function b(t){if(d(f,t)){var n=f[t];delete f[t],c[t]=!0,i.apply(e,n)}if(!d(a,t)&&!d(c,t))throw new Error("No "+t);return a[t]}function w(e){var t,n=e?e.indexOf("!"):-1;return n>-1&&(t=e.substring(0,n),e=e.substring(n+1,e.length)),[t,e]}function E(e){return function(){return l&&l.config&&l.config[e]||{}}}var i,s,o,u,a={},f={},l={},c={},h=Object.prototype.hasOwnProperty,p=[].slice;o=function(e,t){var n,r=w(e),i=r[0];return e=r[1],i&&(i=v(i,t),n=b(i)),i?n&&n.normalize?e=n.normalize(e,g(t)):e=v(e,t):(e=v(e,t),r=w(e),i=r[0],e=r[1],i&&(n=b(i))),{f:i?i+"!"+e:e,n:e,pr:i,p:n}},u={require:function(e){return m(e)},exports:function(e){var t=a[e];return typeof t!="undefined"?t:a[e]={}},module:function(e){return{id:e,uri:"",exports:a[e],config:E(e)}}},i=function(t,n,r,i){var s,l,h,p,v,g=[],w;i=i||t;if(typeof r=="function"){n=!n.length&&r.length?["require","exports","module"]:n;for(v=0;v<n.length;v+=1){p=o(n[v],i),l=p.f;if(l==="require")g[v]=u.require(t);else if(l==="exports")g[v]=u.exports(t),w=!0;else if(l==="module")s=g[v]=u.module(t);else if(d(a,l)||d(f,l)||d(c,l))g[v]=b(l);else{if(!p.p)throw new Error(t+" missing "+l);p.p.load(p.n,m(i,!0),y(l),{}),g[v]=a[l]}}h=r.apply(a[t],g);if(t)if(s&&s.exports!==e&&s.exports!==a[t])a[t]=s.exports;else if(h!==e||!w)a[t]=h}else t&&(a[t]=r)},t=n=s=function(t,n,r,a,f){return typeof t=="string"?u[t]?u[t](n):b(o(t,n).f):(t.splice||(l=t,n.splice?(t=n,n=r,r=null):t=e),n=n||function(){},typeof r=="function"&&(r=a,a=f),a?i(e,t,n,r):setTimeout(function(){i(e,t,n,r)},4),s)},s.config=function(e){return l=e,l.deps&&s(l.deps,l.callback),s},r=function(e,t,n){t.splice||(n=t,t=[]),!d(a,e)&&!d(f,e)&&(f[e]=[e,t,n])},r.amd={jQuery:!0}}(),r("../tools/almond",function(){}),r("Globals",[],function(){function i(e){return/^\".*\"$/.test(e)?e.match(/^\"(.*)\"$/)[1]:e}function s(t){if(e.isString(t))return i(t);if(e.isArray(t)){var n=e.map(t,function(e,t,n){return s(e)});return"["+n.join(",")+"]"}return t}function o(e){return e.replace(r,"").replace(t,n)}var t=/(module\s*\w*\([^\)]*\)[\w\n]*)([^{};]*);/gm,n="$1 {$2;};",r=/((?:\/\*(?:[^*]|(?:\*+[^*\/]))*\*+\/)|(?:\/\/.*))/gm;return{DEFAULT_RESOLUTION:16,DEFAULT_2D_RESOLUTION:16,FN_DEFAULT:0,FS_DEFAULT:2,FA_DEFAULT:12,module_stack:[],context_stack:[],stripString:i,convertForStrFunction:s,preParse:o,importedObjectRegex:/import\([^\"]*\"([^\)]*)\"[,]?.*\);?/gm,usedLibraryRegex:/use <([^>]*)>;?/gm,includedLibraryRegex:/include <([^>]*)>;?/gm}}),function(e,t,n,r,i,s,o){function u(e){var t,r,i=this,s=e.length,o=0,u=i.i=i.j=i.m=0;i.S=[],i.c=[],s||(e=[s++]);while(o<n)i.S[o]=o++;for(o=0;o<n;o++)t=i.S[o],u=l(u+t+e[o%s]),r=i.S[u],i.S[o]=r,i.S[u]=t;i.g=function(t){var r=i.S,s=l(i.i+1),o=r[s],u=l(i.j+o),a=r[u];r[s]=a,r[u]=o;var f=r[l(o+a)];while(--t)s=l(s+1),o=r[s],u=l(u+o),a=r[u],r[s]=a,r[u]=o,f=f*n+r[l(o+a)];return i.i=s,i.j=u,f},i.g(n)}function a(e,t,n,r,i){n=[],i=typeof e;if(t&&i=="object")for(r in e)if(r.indexOf("S")<5)try{n.push(a(e[r],t-1))}catch(s){}return n.length?n:e+(i!="string"?"\0":"")}function f(e,t,n,r){e+="",n=0;for(r=0;r<e.length;r++)t[l(r)]=l((n^=t[l(r)]*19)+e.charCodeAt(r));e="";for(r in t)e+=String.fromCharCode(t[r]);return e}function l(e){return e&n-1}t.seedrandom=function(c,h){var p=[],d;return c=f(a(h?[c,e]:arguments.length?c:[(new Date).getTime(),e,window],3),p),d=new u(p),f(d.S,e),t.random=function(){var t=d.g(r),u=o,a=0;while(t<i)t=(t+a)*n,u*=n,a=d.g(1);while(t>=s)t/=2,u/=2,a>>>=1;return(t+a)/u},c},o=t.pow(n,r),i=t.pow(2,i),s=i*2,f(t.random(),e)}([],Math,256,6,52),r("openscad-parser-support",function(){}),r("Context",["Globals","openscad-parser-support"],function(t,n){function r(e){this.vars=e?{}:{$fn:t.FN_DEFAULT,$fs:t.FS_DEFAULT,$fa:t.FA_DEFAULT},this.parentContext=e,this.inst_p,this.functions_p={},this.modules_p={},t.context_stack.push(this)}function i(e){return e*(180/Math.PI)}function s(e){return e*Math.PI/180}r.prototype.setVariable=function(e,t){t!==undefined&&(this.vars[e]=t)},r.prototype.args=function(e,t,n,r){for(var i=0;i<e.length;i++)i<t.length&&t[i]!==undefined?this.setVariable(e[i],t[i].evaluate(this.parentContext)):this.setVariable(e[i],undefined);var s=0;for(var i=0;i<n.length;i++)n[i]===undefined?s<e.length&&this.setVariable(e[s++],r[i]):this.setVariable(n[i],r[i])},r.prototype.lookupVariable=function(t){return e.has(this.vars,t)?this.vars[t]:this.parentContext!==undefined?this.parentContext.lookupVariable(t):undefined},r.prototype.evaluateFunction=function(t,n,r){return e.has(this.functions_p,t)?this.functions_p[t].evaluate(this,n,r):e.has(o,t)?o[t].apply(this,r):this.parentContext!==undefined?this.parentContext.evaluateFunction(t,n,r):(console.log("WARNING: Ignoring unknown function '"+t+"'."),undefined)},r.prototype.evaluateModule=function(t,n){var r=this,i=e.find(this.modules_p,function(e){return e.name==t.name});if(i!==undefined)return i.evaluate(this,t);if(t.isSubmodule===undefined||!t.isSubmodule){var s=n.getAdaptor(t);if(s!==undefined)return s.evaluate(this,t)}return this.parentContext?this.parentContext.evaluateModule(t,n):(console.log("WARNING: Ignoring unknown module: "+t.name),undefined)},r.newContext=function(e,t,n,i){var s=new r(e);return s.args(t,n,i.argnames,i.argvalues),s},r.contextVariableLookup=function(e,t,n){var r=e.lookupVariable(t);return r===undefined&&(r=n),r},r.printContext=function(e){console.log(e.vars),e.parentContext&&r.printContext(e.parentContext)},r.get_fragments_from_r=function(e,n){var i=r.contextVariableLookup(n,"$fn",t.FN_DEFAULT),s=r.contextVariableLookup(n,"$fs",t.FS_DEFAULT),o=r.contextVariableLookup(n,"$fa",t.FA_DEFAULT),u=1e-6;return e<u?0:i>0?parseInt(i):parseInt(Math.ceil(Math.max(Math.min(360/o,e*2*Math.PI/s),5)))};var o={cos:function(t){return e.isUndefined(t)||e.isNaN(t)?undefined:Math.cos(s(t))},sin:function(t){return e.isUndefined(t)||e.isNaN(t)?undefined:Math.sin(s(t))},acos:function(t){return e.isUndefined(t)||e.isNaN(t)?undefined:i(Math.acos(t))},asin:function(t){return e.isUndefined(t)||e.isNaN(t)?undefined:i(Math.asin(t))},atan:function(t){return e.isUndefined(t)||e.isNaN(t)?undefined:i(Math.atan(t))},atan2:function(t,n){return e.isUndefined(t)||e.isNaN(t)||e.isUndefined(n)||e.isNaN(n)?undefined:i(Math.atan2(t,n))},tan:function(t){return e.isUndefined(t)||e.isNaN(t)?undefined:Math.tan(s(t))},rands:function(e,t,n,r){var i=[];r!==undefined&&Math.seedrandom(r);for(var s=0;s<n;s++){var o=e+Math.random()*(t-e);i[s]=o}return i},round:function(t){return e.isUndefined(t)||e.isNaN(t)?undefined:t<0?-Math.round(Math.abs(t)):Math.round(t)},exp:function(t){return e.isUndefined(t)||e.isNaN(t)?undefined:Math.exp(t)},abs:function(t){return e.isUndefined(t)||e.isNaN(t)?undefined:Math.abs(t)},max:function(){return Math.max.apply(null,e.map(arguments,function(e){return e?e:-Infinity}))},min:function(){return Math.min.apply(null,e.map(arguments,function(e){return e?e:Infinity}))},pow:function(t){return e.isUndefined(t)||e.isNaN(t)?undefined:Math.pow(t)},ln:function(t){return e.isUndefined(t)||e.isNaN(t)?undefined:Math.log(t)},ceil:function(t){return e.isUndefined(t)||e.isNaN(t)?undefined:Math.ceil(t)},floor:function(t){return e.isUndefined(t)||e.isNaN(t)?undefined:Math.floor(t)},sqrt:function(t){return e.isUndefined(t)||e.isNaN(t)?undefined:Math.sqrt(t)},len:function(n){if(e.isUndefined(n)||e.isNaN(n))return undefined;var r=e.isString(n)?t.stripString(n):n;return r.length},log:function(){return arguments.length==2?e.isUndefined(arguments[0])||e.isNaN(arguments[0])||e.isUndefined(arguments[1])||e.isNaN(arguments[1])?undefined:Math.log(arguments[1])/Math.log(arguments[0]):arguments.length==1?e.isUndefined(arguments[0])||e.isNaN(arguments[0])?undefined:Math.log(arguments[0])/Math.log(10):undefined},str:function(){var n=[];return e.each(arguments,function(e){n.push(t.convertForStrFunction(e))}),n.join("")},sign:function(t){return e.isUndefined(t)||e.isNaN(t)?undefined:t>0?1:t<0?-1:0},lookup:function(){var t,n,r,i;if(arguments.length<2)return console.log("Lookup arguments are invalid. Incorrect parameter count. "+arguments),undefined;var s=arguments[0],o=arguments[1];if(!e.isNumber(s)||!e.isArray(o)||o.length<2||o.length>=2&&!e.isArray(o[0]))return console.log("Lookup arguments are invalid. Incorrect parameters. "+arguments),undefined;if(o[0].length!=2)return console.log("Lookup arguments are invalid. First vector has incorrect number of values. "+s+", "+o),undefined;t=o[0][0],n=o[0][1],r=t,i=n,e.each(o.slice(1),function(e){if(e.length==2){var o=e[0],u=e[1];o<=s&&(o>t||t>s)&&(t=o,n=u),o>=s&&(o<r||r<s)&&(r=o,i=u)}});if(s<=t)return n;if(s>=r)return i;var u=(s-t)/(r-t);return i*u+n*(1-u)}};return r}),r("Module",["Context","Globals"],function(t,n){function r(e){this.name=e,this.children=[],this.assignments_var={},this.functions={},this.modules=[],this.argnames=[],this.argexpr=[]}return r.prototype.evaluate=function(r,i){var s=[],o=new t(r);r===undefined&&(o.setVariable("$fn",n.DEFAULT_RESOLUTION),o.setVariable("$fs",2),o.setVariable("$fa",12)),i!==undefined&&(o.args(this.argnames,this.argexpr,i.argnames,i.argvalues),o.setVariable("$children",i.children.length)),o.inst_p=i,o.functions_p=this.functions,o.modules_p=this.modules,e.each(this.assignments_var,function(e,t,n){o.setVariable(t,e.evaluate(o))});var u=e.filter(this.children,function(e){return e&&e.name=="echo"});e.each(u,function(e,t,n){e.evaluate(o)});var a=e.reject(this.children,function(e){return!e||e.name=="echo"}),f=[];e.each(a,function(t,n,r){var i=t.evaluate(o);i==undefined||e.isArray(i)&&e.isEmpty(i)||f.push(i)});var l=e.compact(f);return l.length==1?s.push(l[0]):l.length>1&&s.push(e.first(l)+".union(["+e.rest(l)+"])"),s},r}),r("FunctionDef",["Globals","Context"],function(e,t){function n(){this.argnames=[],this.argexpr=[],this.expr}return n.prototype.evaluate=function(e,n,r){var i=new t(e);return i.args(this.argnames,this.argexpr,n,r),this.expr!==undefined?this.expr.evaluate(i):undefined},n}),r("openscad-parser-ext",["Module","Context","Globals","FunctionDef","openscad-parser-support"],function(t,n,r,i,s){function u(){o=new t("root"),r.context_stack=[],r.module_stack=[]}function a(t){var i=[];i.push("function main(){"),i.push("\n");var s=undefined;t.context!==undefined?s=t.context:s=new n,t.importCache!==undefined&&s.setVariable("importCache",t.importCache);var a=o.evaluate(s),f=e.flatten(a);f.length==1?i.push("return "+f[0]+";"):f.length>1&&(i.push("return "+e.first(f)+".union(["),i.push(e.rest(f)),i.push("]);")),i.push("};");var l={lines:i,context:r.context_stack[r.context_stack.length-1]};return u(),l}function f(e,n,i){var s=o;r.module_stack.push(o),o=new t(e),s.modules.push(o),o.argnames=n,o.argexpr=i}function l(){r.module_stack.length>0&&(o=r.module_stack.pop())}function c(e){o.children.push(e)}function h(e,t){o.assignments_var[e]=t}function p(e,t,n,r){var s=new i;s.argnames=n,s.argexpr=r,s.expr=t,o.functions[e]=s}var o=new t("root");return{processModule:a,stashModule:f,popModule:l,addModuleChild:c,addModuleAssignmentVar:h,addModuleFunction:p}}),r("ArgContainer",[],function(){return function(){this.argname,this.argexpr}}),r("ArgsContainer",[],function(){return function(){this.argnames=[],this.argexpr=[]}}),r("Range",[],function(){function e(e,t,n){this.begin=e,this.step=t,this.end=n}return e}),r("lib/sylvester",[],function(){function t(){}function n(){}function r(){}function i(){}var e={version:"0.1.3",precision:1e-6};return t.prototype={e:function(e){return e<1||e>this.elements.length?null:this.elements[e-1]},dimensions:function(){return this.elements.length},modulus:function(){return Math.sqrt(this.dot(this))},eql:function(t){var n=this.elements.length,r=t.elements||t;if(n!=r.length)return!1;do if(Math.abs(this.elements[n-1]-r[n-1])>e.precision)return!1;while(--n);return!0},dup:function(){return t.create(this.elements)},map:function(e){var n=[];return this.each(function(t,r){n.push(e(t,r))}),t.create(n)},each:function(e){var t=this.elements.length,n=t,r;do r=n-t,e(this.elements[r],r+1);while(--t)},toUnitVector:function(){var e=this.modulus();return e===0?this.dup():this.map(function(t){return t/e})},angleFrom:function(e){var t=e.elements||e,n=this.elements.length,r=n,i;if(n!=t.length)return null;var s=0,o=0,u=0;this.each(function(e,n){s+=e*t[n-1],o+=e*e,u+=t[n-1]*t[n-1]}),o=Math.sqrt(o),u=Math.sqrt(u);if(o*u===0)return null;var a=s/(o*u);return a<-1&&(a=-1),a>1&&(a=1),Math.acos(a)},isParallelTo:function(t){var n=this.angleFrom(t);return n===null?null:n<=e.precision},isAntiparallelTo:function(t){var n=this.angleFrom(t);return n===null?null:Math.abs(n-Math.PI)<=e.precision},isPerpendicularTo:function(t){var n=this.dot(t);return n===null?null:Math.abs(n)<=e.precision},add:function(e){var t=e.elements||e;return this.elements.length!=t.length?null:this.map(function(e,n){return e+t[n-1]})},subtract:function(e){var t=e.elements||e;return this.elements.length!=t.length?null:this.map(function(e,n){return e-t[n-1]})},multiply:function(e){return this.map(function(t){return t*e})},x:function(e){return this.multiply(e)},dot:function(e){var t=e.elements||e,n,r=0,i=this.elements.length;if(i!=t.length)return null;do r+=this.elements[i-1]*t[i-1];while(--i);return r},cross:function(e){var n=e.elements||e;if(this.elements.length!=3||n.length!=3)return null;var r=this.elements;return t.create([r[1]*n[2]-r[2]*n[1],r[2]*n[0]-r[0]*n[2],r[0]*n[1]-r[1]*n[0]])},max:function(){var e=0,t=this.elements.length,n=t,r;do r=n-t,Math.abs(this.elements[r])>Math.abs(e)&&(e=this.elements[r]);while(--t);return e},indexOf:function(e){var t=null,n=this.elements.length,r=n,i;do i=r-n,t===null&&this.elements[i]==e&&(t=i+1);while(--n);return t},toDiagonalMatrix:function(){return n.Diagonal(this.elements)},round:function(){return this.map(function(e){return Math.round(e)})},snapTo:function(t){return this.map(function(n){return Math.abs(n-t)<=e.precision?t:n})},distanceFrom:function(e){if(e.anchor)return e.distanceFrom(this);var t=e.elements||e;if(t.length!=this.elements.length)return null;var n=0,r;return this.each(function(e,i){r=e-t[i-1],n+=r*r}),Math.sqrt(n)},liesOn:function(e){return e.contains(this)},liesIn:function(e){return e.contains(this)},rotate:function(e,r){var i,s,o,u,a;switch(this.elements.length){case 2:i=r.elements||r;if(i.length!=2)return null;return s=n.Rotation(e).elements,o=this.elements[0]-i[0],u=this.elements[1]-i[1],t.create([i[0]+s[0][0]*o+s[0][1]*u,i[1]+s[1][0]*o+s[1][1]*u]);case 3:if(!r.direction)return null;var f=r.pointClosestTo(this).elements;return s=n.Rotation(e,r.direction).elements,o=this.elements[0]-f[0],u=this.elements[1]-f[1],a=this.elements[2]-f[2],t.create([f[0]+s[0][0]*o+s[0][1]*u+s[0][2]*a,f[1]+s[1][0]*o+s[1][1]*u+s[1][2]*a,f[2]+s[2][0]*o+s[2][1]*u+s[2][2]*a]);default:return null}},reflectionIn:function(e){if(e.anchor){var n=this.elements.slice(),r=e.pointClosestTo(n).elements;return t.create([r[0]+(r[0]-n[0]),r[1]+(r[1]-n[1]),r[2]+(r[2]-(n[2]||0))])}var i=e.elements||e;return this.elements.length!=i.length?null:this.map(function(e,t){return i[t-1]+(i[t-1]-e)})},to3D:function(){var e=this.dup();switch(e.elements.length){case 3:break;case 2:e.elements.push(0);break;default:return null}return e},inspect:function(){return"["+this.elements.join(", ")+"]"},setElements:function(e){return this.elements=(e.elements||e).slice(),this}},t.create=function(e){var n=new t;return n.setElements(e)},t.i=t.create([1,0,0]),t.j=t.create([0,1,0]),t.k=t.create([0,0,1]),t.Random=function(e){var n=[];do n.push(Math.random());while(--e);return t.create(n)},t.Zero=function(e){var n=[];do n.push(0);while(--e);return t.create(n)},n.prototype={e:function(e,t){return e<1||e>this.elements.length||t<1||t>this.elements[0].length?null:this.elements[e-1][t-1]},row:function(e){return e>this.elements.length?null:t.create(this.elements[e-1])},col:function(e){if(e>this.elements[0].length)return null;var n=[],r=this.elements.length,i=r,s;do s=i-r,n.push(this.elements[s][e-1]);while(--r);return t.create(n)},dimensions:function(){return{rows:this.elements.length,cols:this.elements[0].length}},rows:function(){return this.elements.length},cols:function(){return this.elements[0].length},eql:function(t){var r=t.elements||t;typeof r[0][0]=="undefined"&&(r=n.create(r).elements);if(this.elements.length!=r.length||this.elements[0].length!=r[0].length)return!1;var i=this.elements.length,s=i,o,u,a=this.elements[0].length,f;do{o=s-i,u=a;do{f=a-u;if(Math.abs(this.elements[o][f]-r[o][f])>e.precision)return!1}while(--u)}while(--i);return!0},dup:function(){return n.create(this.elements)},map:function(e){var t=[],r=this.elements.length,i=r,s,o,u=this.elements[0].length,a;do{s=i-r,o=u,t[s]=[];do a=u-o,t[s][a]=e(this.elements[s][a],s+1,a+1);while(--o)}while(--r);return n.create(t)},isSameSizeAs:function(e){var t=e.elements||e;return typeof t[0][0]=="undefined"&&(t=n.create(t).elements),this.elements.length==t.length&&this.elements[0].length==t[0].length},add:function(e){var t=e.elements||e;return typeof t[0][0]=="undefined"&&(t=n.create(t).elements),this.isSameSizeAs(t)?this.map(function(e,n,r){return e+t[n-1][r-1]}):null},subtract:function(e){var t=e.elements||e;return typeof t[0][0]=="undefined"&&(t=n.create(t).elements),this.isSameSizeAs(t)?this.map(function(e,n,r){return e-t[n-1][r-1]}):null},canMultiplyFromLeft:function(e){var t=e.elements||e;return typeof t[0][0]=="undefined"&&(t=n.create(t).elements),this.elements[0].length==t.length},multiply:function(e){if(!e.elements)return this.map(function(t){return t*e});var t=e.modulus?!0:!1,r=e.elements||e;typeof r[0][0]=="undefined"&&(r=n.create(r).elements);if(!this.canMultiplyFromLeft(r))return null;var i=this.elements.length,s=i,o,u,a=r[0].length,f,l=this.elements[0].length,c=[],h,p,d;do{o=s-i,c[o]=[],u=a;do{f=a-u,h=0,p=l;do d=l-p,h+=this.elements[o][d]*r[d][f];while(--p);c[o][f]=h}while(--u)}while(--i);var r=n.create(c);return t?r.col(1):r},x:function(e){return this.multiply(e)},minor:function(e,t,r,i){var s=[],o=r,u,a,f,l=this.elements.length,c=this.elements[0].length;do{u=r-o,s[u]=[],a=i;do f=i-a,s[u][f]=this.elements[(e+u-1)%l][(t+f-1)%c];while(--a)}while(--o);return n.create(s)},transpose:function(){var e=this.elements.length,t=this.elements[0].length,r=[],i=t,s,o,u;do{s=t-i,r[s]=[],o=e;do u=e-o,r[s][u]=this.elements[u][s];while(--o)}while(--i);return n.create(r)},isSquare:function(){return this.elements.length==this.elements[0].length},max:function(){var e=0,t=this.elements.length,n=t,r,i,s=this.elements[0].length,o;do{r=n-t,i=s;do o=s-i,Math.abs(this.elements[r][o])>Math.abs(e)&&(e=this.elements[r][o]);while(--i)}while(--t);return e},indexOf:function(e){var t=null,n=this.elements.length,r=n,i,s,o=this.elements[0].length,u;do{i=r-n,s=o;do{u=o-s;if(this.elements[i][u]==e)return{i:i+1,j:u+1}}while(--s)}while(--n);return null},diagonal:function(){if(!this.isSquare)return null;var e=[],n=this.elements.length,r=n,i;do i=r-n,e.push(this.elements[i][i]);while(--n);return t.create(e)},toRightTriangular:function(){var e=this.dup(),t,n=this.elements.length,r=n,i,s,o=this.elements[0].length,u;do{i=r-n;if(e.elements[i][i]==0)for(j=i+1;j<r;j++)if(e.elements[j][i]!=0){t=[],s=o;do u=o-s,t.push(e.elements[i][u]+e.elements[j][u]);while(--s);e.elements[i]=t;break}if(e.elements[i][i]!=0)for(j=i+1;j<r;j++){var a=e.elements[j][i]/e.elements[i][i];t=[],s=o;do u=o-s,t.push(u<=i?0:e.elements[j][u]-e.elements[i][u]*a);while(--s);e.elements[j]=t}}while(--n);return e},toUpperTriangular:function(){return this.toRightTriangular()},determinant:function(){if(!this.isSquare())return null;var e=this.toRightTriangular(),t=e.elements[0][0],n=e.elements.length-1,r=n,i;do i=r-n+1,t*=e.elements[i][i];while(--n);return t},det:function(){return this.determinant()},isSingular:function(){return this.isSquare()&&this.determinant()===0},trace:function(){if(!this.isSquare())return null;var e=this.elements[0][0],t=this.elements.length-1,n=t,r;do r=n-t+1,e+=this.elements[r][r];while(--t);return e},tr:function(){return this.trace()},rank:function(){var t=this.toRightTriangular(),n=0,r=this.elements.length,i=r,s,o,u=this.elements[0].length,a;do{s=i-r,o=u;do{a=u-o;if(Math.abs(t.elements[s][a])>e.precision){n++;break}}while(--o)}while(--r);return n},rk:function(){return this.rank()},augment:function(e){var t=e.elements||e;typeof t[0][0]=="undefined"&&(t=n.create(t).elements);var r=this.dup(),i=r.elements[0].length,s=r.elements.length,o=s,u,a,f=t[0].length,l;if(s!=t.length)return null;do{u=o-s,a=f;do l=f-a,r.elements[u][i+l]=t[u][l];while(--a)}while(--s);return r},inverse:function(){if(!this.isSquare()||this.isSingular())return null;var e=this.elements.length,t=e,r,i,s=this.augment(n.I(e)).toRightTriangular(),o,u=s.elements[0].length,a,f,l,c=[],h;do{r=e-1,f=[],o=u,c[r]=[],l=s.elements[r][r];do a=u-o,h=s.elements[r][a]/l,f.push(h),a>=t&&c[r].push(h);while(--o);s.elements[r]=f;for(i=0;i<r;i++){f=[],o=u;do a=u-o,f.push(s.elements[i][a]-s.elements[r][a]*s.elements[i][r]);while(--o);s.elements[i]=f}}while(--e);return n.create(c)},inv:function(){return this.inverse()},round:function(){return this.map(function(e){return Math.round(e)})},snapTo:function(t){return this.map(function(n){return Math.abs(n-t)<=e.precision?t:n})},inspect:function(){var e=[],n=this.elements.length,r=n,i;do i=r-n,e.push(t.create(this.elements[i]).inspect());while(--n);return e.join("\n")},setElements:function(e){var t,n=e.elements||e;if(typeof n[0][0]!="undefined"){var r=n.length,i=r,s,o,u;this.elements=[];do{t=i-r,s=n[t].length,o=s,this.elements[t]=[];do u=o-s,this.elements[t][u]=n[t][u];while(--s)}while(--r);return this}var a=n.length,f=a;this.elements=[];do t=f-a,this.elements.push([n[t]]);while(--a);return this}},n.create=function(e){var t=new n;return t.setElements(e)},n.I=function(e){var t=[],r=e,i,s,o;do{i=r-e,t[i]=[],s=r;do o=r-s,t[i][o]=i==o?1:0;while(--s)}while(--e);return n.create(t)},n.Diagonal=function(e){var t=e.length,r=t,i,s=n.I(t);do i=r-t,s.elements[i][i]=e[i];while(--t);return s},n.Rotation=function(e,t){if(!t)return n.create([[Math.cos(e),-Math.sin(e)],[Math.sin(e),Math.cos(e)]]);var r=t.dup();if(r.elements.length!=3)return null;var i=r.modulus(),s=r.elements[0]/i,o=r.elements[1]/i,u=r.elements[2]/i,a=Math.sin(e),f=Math.cos(e),l=1-f;return n.create([[l*s*s+f,l*s*o-a*u,l*s*u+a*o],[l*s*o+a*u,l*o*o+f,l*o*u-a*s],[l*s*u-a*o,l*o*u+a*s,l*u*u+f]])},n.RotationX=function(e){var t=Math.cos(e),r=Math.sin(e);return n.create([[1,0,0],[0,t,-r],[0,r,t]])},n.RotationY=function(e){var t=Math.cos(e),r=Math.sin(e);return n.create([[t,0,r],[0,1,0],[-r,0,t]])},n.RotationZ=function(e){var t=Math.cos(e),r=Math.sin(e);return n.create([[t,-r,0],[r,t,0],[0,0,1]])},n.Random=function(e,t){return n.Zero(e,t).map(function(){return Math.random()})},n.Zero=function(e,t){var r=[],i=e,s,o,u;do{s=e-i,r[s]=[],o=t;do u=t-o,r[s][u]=0;while(--o)}while(--i);return n.create(r)},r.prototype={eql:function(e){return this.isParallelTo(e)&&this.contains(e.anchor)},dup:function(){return r.create(this.anchor,this.direction)},translate:function(e){var t=e.elements||e;return r.create([this.anchor.elements[0]+t[0],this.anchor.elements[1]+t[1],this.anchor.elements[2]+(t[2]||0)],this.direction)},isParallelTo:function(t){if(t.normal)return t.isParallelTo(this);var n=this.direction.angleFrom(t.direction);return Math.abs(n)<=e.precision||Math.abs(n-Math.PI)<=e.precision},distanceFrom:function(e){if(e.normal)return e.distanceFrom(this);if(e.direction){if(this.isParallelTo(e))return this.distanceFrom(e.anchor);var t=this.direction.cross(e.direction).toUnitVector().elements,n=this.anchor.elements,r=e.anchor.elements;return Math.abs((n[0]-r[0])*t[0]+(n[1]-r[1])*t[1]+(n[2]-r[2])*t[2])}var i=e.elements||e,n=this.anchor.elements,s=this.direction.elements,o=i[0]-n[0],u=i[1]-n[1],a=(i[2]||0)-n[2],f=Math.sqrt(o*o+u*u+a*a);if(f===0)return 0;var l=(o*s[0]+u*s[1]+a*s[2])/f,c=1-l*l;return Math.abs(f*Math.sqrt(c<0?0:c))},contains:function(t){var n=this.distanceFrom(t);return n!==null&&n<=e.precision},liesIn:function(e){return e.contains(this)},intersects:function(t){return t.normal?t.intersects(this):!this.isParallelTo(t)&&this.distanceFrom(t)<=e.precision},intersectionWith:function(e){if(e.normal)return e.intersectionWith(this);if(!this.intersects(e))return null;var n=this.anchor.elements,r=this.direction.elements,i=e.anchor.elements,s=e.direction.elements,o=r[0],u=r[1],a=r[2],f=s[0],l=s[1],c=s[2],h=n[0]-i[0],p=n[1]-i[1],d=n[2]-i[2],v=-o*h-u*p-a*d,m=f*h+l*p+c*d,g=o*o+u*u+a*a,y=f*f+l*l+c*c,b=o*f+u*l+a*c,w=(v*y/g+b*m)/(y-b*b);return t.create([n[0]+w*o,n[1]+w*u,n[2]+w*a])},pointClosestTo:function(e){if(e.direction){if(this.intersects(e))return this.intersectionWith(e);if(this.isParallelTo(e))return null;var n=this.direction.elements,r=e.direction.elements,s=n[0],o=n[1],u=n[2],a=r[0],f=r[1],l=r[2],c=u*a-s*l,h=s*f-o*a,p=o*l-u*f,d=t.create([c*l-h*f,h*a-p*l,p*f-c*a]),v=i.create(e.anchor,d);return v.intersectionWith(this)}var v=e.elements||e;if(this.contains(v))return t.create(v);var m=this.anchor.elements,n=this.direction.elements,s=n[0],o=n[1],u=n[2],g=m[0],y=m[1],b=m[2],c=s*(v[1]-y)-o*(v[0]-g),h=o*((v[2]||0)-b)-u*(v[1]-y),p=u*(v[0]-g)-s*((v[2]||0)-b),w=t.create([o*c-u*p,u*h-s*c,s*p-o*h]),E=this.distanceFrom(v)/w.modulus();return t.create([v[0]+w.elements[0]*E,v[1]+w.elements[1]*E,(v[2]||0)+w.elements[2]*E])},rotate:function(e,i){typeof i.direction=="undefined"&&(i=r.create(i.to3D(),t.k));var s=n.Rotation(e,i.direction).elements,o=i.pointClosestTo(this.anchor).elements,u=this.anchor.elements,a=this.direction.elements,f=o[0],l=o[1],c=o[2],h=u[0],p=u[1],d=u[2],v=h-f,m=p-l,g=d-c;return r.create([f+s[0][0]*v+s[0][1]*m+s[0][2]*g,l+s[1][0]*v+s[1][1]*m+s[1][2]*g,c+s[2][0]*v+s[2][1]*m+s[2][2]*g],[s[0][0]*a[0]+s[0][1]*a[1]+s[0][2]*a[2],s[1][0]*a[0]+s[1][1]*a[1]+s[1][2]*a[2],s[2][0]*a[0]+s[2][1]*a[1]+s[2][2]*a[2]])},reflectionIn:function(e){if(e.normal){var t=this.anchor.elements,n=this.direction.elements,i=t[0],s=t[1],o=t[2],u=n[0],a=n[1],f=n[2],l=this.anchor.reflectionIn(e).elements,c=i+u,h=s+a,p=o+f,d=e.pointClosestTo([c,h,p]).elements,v=[d[0]+(d[0]-c)-l[0],d[1]+(d[1]-h)-l[1],d[2]+(d[2]-p)-l[2]];return r.create(l,v)}if(e.direction)return this.rotate(Math.PI,e);var m=e.elements||e;return r.create(this.anchor.reflectionIn([m[0],m[1],m[2]||0]),this.direction)},setVectors:function(e,n){e=t.create(e),n=t.create(n),e.elements.length==2&&e.elements.push(0),n.elements.length==2&&n.elements.push(0);if(e.elements.length>3||n.elements.length>3)return null;var r=n.modulus();return r===0?null:(this.anchor=e,this.direction=t.create([n.elements[0]/r,n.elements[1]/r,n.elements[2]/r]),this)}},r.create=function(e,t){var n=new r;return n.setVectors(e,t)},r.X=r.create(t.Zero(3),t.i),r.Y=r.create(t.Zero(3),t.j),r.Z=r.create(t.Zero(3),t.k),i.prototype={eql:function(e){return this.contains(e.anchor)&&this.isParallelTo(e)},dup:function(){return i.create(this.anchor,this.normal)},translate:function(e){var t=e.elements||e;return i.create([this.anchor.elements[0]+t[0],this.anchor.elements[1]+t[1],this.anchor.elements[2]+(t[2]||0)],this.normal)},isParallelTo:function(t){var n;return t.normal?(n=this.normal.angleFrom(t.normal),Math.abs(n)<=e.precision||Math.abs(Math.PI-n)<=e.precision):t.direction?this.normal.isPerpendicularTo(t.direction):null},isPerpendicularTo:function(t){var n=this.normal.angleFrom(t.normal);return Math.abs(Math.PI/2-n)<=e.precision},distanceFrom:function(e){if(this.intersects(e)||this.contains(e))return 0;if(e.anchor){var t=this.anchor.elements,n=e.anchor.elements,r=this.normal.elements;return Math.abs((t[0]-n[0])*r[0]+(t[1]-n[1])*r[1]+(t[2]-n[2])*r[2])}var i=e.elements||e,t=this.anchor.elements,r=this.normal.elements;return Math.abs((t[0]-i[0])*r[0]+(t[1]-i[1])*r[1]+(t[2]-(i[2]||0))*r[2])},contains:function(t){if(t.normal)return null;if(t.direction)return this.contains(t.anchor)&&this.contains(t.anchor.add(t.direction));var n=t.elements||t,r=this.anchor.elements,i=this.normal.elements,s=Math.abs(i[0]*(r[0]-n[0])+i[1]*(r[1]-n[1])+i[2]*(r[2]-(n[2]||0)));return s<=e.precision},intersects:function(e){return typeof e.direction=="undefined"&&typeof e.normal=="undefined"?null:!this.isParallelTo(e)},intersectionWith:function(e){if(!this.intersects(e))return null;if(e.direction){var i=e.anchor.elements,s=e.direction.elements,o=this.anchor.elements,u=this.normal.elements,a=(u[0]*(o[0]-i[0])+u[1]*(o[1]-i[1])+u[2]*(o[2]-i[2]))/(u[0]*s[0]+u[1]*s[1]+u[2]*s[2]);return t.create([i[0]+s[0]*a,i[1]+s[1]*a,i[2]+s[2]*a])}if(e.normal){var f=this.normal.cross(e.normal).toUnitVector(),u=this.normal.elements,i=this.anchor.elements,l=e.normal.elements,c=e.anchor.elements,h=n.Zero(2,2),p=0;while(h.isSingular())p++,h=n.create([[u[p%3],u[(p+1)%3]],[l[p%3],l[(p+1)%3]]]);var d=h.inverse().elements,v=u[0]*i[0]+u[1]*i[1]+u[2]*i[2],m=l[0]*c[0]+l[1]*c[1]+l[2]*c[2],g=[d[0][0]*v+d[0][1]*m,d[1][0]*v+d[1][1]*m],y=[];for(var b=1;b<=3;b++)y.push(p==b?0:g[(b+(5-p)%3)%3]);return r.create(y,f)}},pointClosestTo:function(e){var n=e.elements||e,r=this.anchor.elements,i=this.normal.elements,s=(r[0]-n[0])*i[0]+(r[1]-n[1])*i[1]+(r[2]-(n[2]||0))*i[2];return t.create([n[0]+i[0]*s,n[1]+i[1]*s,(n[2]||0)+i[2]*s])},rotate:function(e,t){var r=n.Rotation(e,t.direction).elements,s=t.pointClosestTo(this.anchor).elements,o=this.anchor.elements,u=this.normal.elements,a=s[0],f=s[1],l=s[2],c=o[0],h=o[1],p=o[2],d=c-a,v=h-f,m=p-l;return i.create([a+r[0][0]*d+r[0][1]*v+r[0][2]*m,f+r[1][0]*d+r[1][1]*v+r[1][2]*m,l+r[2][0]*d+r[2][1]*v+r[2][2]*m],[r[0][0]*u[0]+r[0][1]*u[1]+r[0][2]*u[2],r[1][0]*u[0]+r[1][1]*u[1]+r[1][2]*u[2],r[2][0]*u[0]+r[2][1]*u[1]+r[2][2]*u[2]])},reflectionIn:function(e){if(e.normal){var t=this.anchor.elements,n=this.normal.elements,r=t[0],s=t[1],o=t[2],u=n[0],a=n[1],f=n[2],l=this.anchor.reflectionIn(e).elements,c=r+u,h=s+a,p=o+f,d=e.pointClosestTo([c,h,p]).elements,v=[d[0]+(d[0]-c)-l[0],d[1]+(d[1]-h)-l[1],d[2]+(d[2]-p)-l[2]];return i.create(l,v)}if(e.direction)return this.rotate(Math.PI,e);var m=e.elements||e;return i.create(this.anchor.reflectionIn([m[0],m[1],m[2]||0]),this.normal)},setVectors:function(e,n,r){e=t.create(e),e=e.to3D();if(e===null)return null;n=t.create(n),n=n.to3D();if(n===null)return null;if(typeof r=="undefined")r=null;else{r=t.create(r),r=r.to3D();if(r===null)return null}var i=e.elements[0],s=e.elements[1],o=e.elements[2],u=n.elements[0],a=n.elements[1],f=n.elements[2],l,c;if(r!==null){var h=r.elements[0],p=r.elements[1],d=r.elements[2];l=t.create([(a-s)*(d-o)-(f-o)*(p-s),(f-o)*(h-i)-(u-i)*(d-o),(u-i)*(p-s)-(a-s)*(h-i)]),c=l.modulus();if(c===0)return null;l=t.create([l.elements[0]/c,l.elements[1]/c,l.elements[2]/c])}else{c=Math.sqrt(u*u+a*a+f*f);if(c===0)return null;l=t.create([n.elements[0]/c,n.elements[1]/c,n.elements[2]/c])}return this.anchor=e,this.normal=l,this}},i.create=function(e,t,n){var r=new i;return r.setVectors(e,t,n)},i.XY=i.create(t.Zero(3),t.k),i.YZ=i.create(t.Zero(3),t.i),i.ZX=i.create(t.Zero(3),t.j),i.YX=i.XY,i.ZY=i.YZ,i.XZ=i.ZX,{$V:t.create,$M:n.create,$L:r.create,$P:i.create,Matrix:n,Vector:t,Plane:i}}),r("Expression",["Range","lib/sylvester"],function(t,n){function r(e){this.children=[],this.const_value=e,this.var_name,this.call_funcname,this.call_argnames=[],this.type="C"}function i(t){return e.isArray(t)&&e.isArray(t[0])}function s(t){return e.isArray(t)&&!e.isArray(t[0])}function o(e){return i(e)?n.$M(e):s(e)?n.$V(e):e}return n.Matrix.prototype.toString=function(){var t=e.map(this.elements,function(e){return"["+e.join(",")+"]"});return"["+t.join(",")+"]"},n.Vector.prototype.toString=function(){return"["+this.elements.join(",")+"]"},r.prototype.evaluate=function(n){switch(this.type){case"!":return!this.children[0].evaluate(n);case"&&":var r=this.children[0].evaluate(n),u=this.children[1].evaluate(n);if(e.isUndefined(r)||e.isUndefined(u)||e.isNaN(r)||e.isNaN(u))return!1;if(e.isArray(r)||e.isArray(u))return!0;return r&&u;case"||":var r=this.children[0].evaluate(n),u=this.children[1].evaluate(n);if(e.isUndefined(r)||e.isUndefined(u)||e.isNaN(r)||e.isNaN(u))return!0;if(e.isArray(r)||e.isArray(u))return!0;return r||u;case"*":var r=this.children[0].evaluate(n),u=this.children[1].evaluate(n);if(e.isUndefined(r)||e.isUndefined(u)||e.isNaN(r)||e.isNaN(u))return undefined;if(e.isArray(r)||e.isArray(u)){var a=o(r),f=o(u);return s(r)&&s(u)?a.dot(f):s(r)&&i(u)?[a.dot(f.col(1)),a.dot(f.col(2)),a.dot(f.col(3))]:e.isNumber(r)?f.multiply(a):a.multiply(f)}return r*u;case"/":var r=this.children[0].evaluate(n),u=this.children[1].evaluate(n);if(e.isUndefined(r)||e.isUndefined(u)||e.isNaN(r)||e.isNaN(u))return undefined;if(e.isArray(r)||e.isArray(u)){var a=o(r),f=o(u);if(e.isArray(r)&&e.isArray(u))return undefined;if(i(r)&&e.isNumber(u))return a.multiply(1/f);if(e.isNumber(r)&&i(u)){var l=[];for(var c=0;c<u.length;c++){var h=[];for(var p=0;p<u[c].length;p++)h[p]=r/u[c][p];l.push(h)}return l}if(s(r)&&e.isNumber(u))return a.multiply(1/f);if(e.isNumber(r)&&s(u))return f.multiply(1/a)}return r/u;case"%":var r=this.children[0].evaluate(n),u=this.children[1].evaluate(n);if(e.isUndefined(r)||e.isUndefined(u)||e.isNaN(r)||e.isNaN(u))return undefined;if(e.isArray(r)||e.isArray(u))return undefined;return r%u;case"+":var r=this.children[0].evaluate(n),u=this.children[1].evaluate(n);if(e.isUndefined(r)||e.isUndefined(u)||e.isNaN(r)||e.isNaN(u))return undefined;if(e.isArray(r)&&e.isArray(u)){if(i(r)&&i(u)){var d=Math.min(r.length,u.length),l=[];for(var c=0;c<d;c++){var h=[];for(var p=0;p<r[c].length;p++)h[p]=r[c][p]+u[c][p];l.push(h)}return l}return i(r)||i(u)?undefined:[r[0]+u[0],r[1]+u[1],r[2]+u[2]]}return e.isArray(r)||e.isArray(u)?undefined:r+u;case"-":var r=this.children[0].evaluate(n),u=this.children[1].evaluate(n);if(e.isUndefined(r)||e.isUndefined(u)||e.isNaN(r)||e.isNaN(u))return undefined;if(e.isArray(r)&&e.isArray(u)){if(e.isArray(r[0])&&e.isArray(u[0])){var d=Math.min(r.length,u.length),l=[];for(var c=0;c<d;c++){var h=[];for(var p=0;p<r[c].length;p++)h[p]=r[c][p]-u[c][p];l.push(h)}return l}return[r[0]-u[0],r[1]-u[1],r[2]-u[2]]}return e.isArray(r)||e.isArray(u)?undefined:r-u;case"<":var r=this.children[0].evaluate(n),u=this.children[1].evaluate(n);if(e.isUndefined(r)||e.isUndefined(u)||e.isNaN(r)||e.isNaN(u))return!1;if(e.isArray(r)||e.isArray(u))return!1;return r<u;case"<=":var r=this.children[0].evaluate(n),u=this.children[1].evaluate(n);if(e.isUndefined(r)||e.isUndefined(u)||e.isNaN(r)||e.isNaN(u))return!0;if(e.isArray(r)||e.isArray(u))return!0;return r<=u;case"==":var r=this.children[0].evaluate(n),u=this.children[1].evaluate(n);if(e.isUndefined(r)||e.isUndefined(u)||e.isNaN(r)||e.isNaN(u))return!1;if(s(r)&&s(u)||i(r)&&i(u)){var a=o(r),f=o(u);return a.eql(f)}if(e.isArray(r)||e.isArray(u))return!1;return r==u;case"!=":var r=this.children[0].evaluate(n),u=this.children[1].evaluate(n);if(e.isUndefined(r)||e.isUndefined(u)||e.isNaN(r)||e.isNaN(u))return!1;if(s(r)&&s(u)||i(r)&&i(u)){var a=o(r),f=o(u);return!a.eql(f)}if(e.isArray(r)||e.isArray(u))return!0;return r!=u;case">=":var r=this.children[0].evaluate(n),u=this.children[1].evaluate(n);if(e.isUndefined(r)||e.isUndefined(u)||e.isNaN(r)||e.isNaN(u))return!0;if(e.isArray(r)||e.isArray(u))return!0;return r>=u;case">":var r=this.children[0].evaluate(n),u=this.children[1].evaluate(n);if(e.isUndefined(r)||e.isUndefined(u)||e.isNaN(r)||e.isNaN(u))return!1;if(e.isArray(r)||e.isArray(u))return!1;return r>u;case"?:":var v=this.children[0].evaluate(n);return this.children[v?1:2].evaluate(n);case"I":return-this.children[0].evaluate(n);case"C":return this.const_value;case"R":var a=this.children[0].evaluate(n),f=this.children[1].evaluate(n),m=this.children[2].evaluate(n);if(e.isNumber(a)&&e.isNumber(f)&&e.isNumber(m))return new t(a,f,m);return undefined;case"V":var g=[];for(var c=0;c<this.children.length;c++)g.push(this.children[c].evaluate(n));return g;case"L":return n.lookupVariable(this.var_name);case"[]":return this.children[0].evaluate(n)[this.children[1].evaluate(n)];case"F":var y=[];for(var c=0;c<this.children.length;c++)y.push(this.children[c].evaluate(n));return n.evaluateFunction(this.call_funcname,this.call_argnames,y);default:console.log("todo - evaluate expression",this)}},r}),r("PrimitiveModules",["Globals","Context"],function(t,n){function r(){}function i(e){r.call(this,e)}function s(e){r.call(this,e)}function o(e){r.call(this,e)}function u(e){r.call(this,e)}function a(e){r.call(this,e)}function f(e){r.call(this,e)}function l(e){r.call(this,e)}return i.prototype.evaluate=function(t,r){var i=new n(t),s=["r","$fn"],o=[];i.args(s,o,r.argnames,r.argvalues);var u=n.contextVariableLookup(i,"r",1),a=n.get_fragments_from_r(u,i),f={center:[0,0,0],resolution:a,radius:u};return e.template("CSG.sphere({center: [<%=String(center)%>], radius: <%= radius %>, resolution: <%= resolution%>})",f)},s.prototype.evaluate=function(r,i){var s=new n(r),o=["h","r1","r2","center","$fn","$fa","$fs"],u=[];s.args(o,u,i.argnames,i.argvalues);var a={start:[0,0,0],end:[0,0,1],radiusStart:1,radiusEnd:1,resolution:t.DEFAULT_RESOLUTION},f=n.contextVariableLookup(s,"center",!1),l=n.contextVariableLookup(s,"h",1),c=n.contextVariableLookup(s,"r",1),h=n.contextVariableLookup(s,"r1",undefined),p=n.contextVariableLookup(s,"r2",undefined),d=f?-(l/2):0,v=f?l/2:l;return a.start=[0,0,d],a.end=[0,0,v],e.has(s.vars,"r")&&(a.radiusStart=c,a.radiusEnd=c),e.has(s.vars,"r1")&&(a.radiusStart=h),e.has(s.vars,"r2")&&(a.radiusEnd=p),a.resolution=n.get_fragments_from_r(Math.max(a.radiusStart,a.radiusEnd),s),a.radiusStart==0&&a.radiusEnd==0?undefined:e.template("CSG.cylinder({start: [<%=start%>], end: [<%=end%>],radiusStart: <%=radiusStart%>, radiusEnd: <%=radiusEnd%>, resolution: <%=resolution%>})",a)},o.prototype.evaluate=function(r,i){var s=n.newContext(r,["size","center"],[],i),o={resolution:t.DEFAULT_RESOLUTION},u=n.contextVariableLookup(s,"center",!1),a=n.contextVariableLookup(s,"size",1);return a instanceof Array?o.radius=[a[0]/2,a[1]/2,a[2]/2]:o.radius=[a/2,a/2,a/2],u?o.centerVector=[0,0,0]:o.centerVector=[o.radius[0],o.radius[1],o.radius[2]],e.template("CSG.cube({center: [<%=String(centerVector)%>],radius: [<%= radius %>], resolution: <%= resolution%>})",o)},u.prototype.evaluate=function(t,r){var i=n.newContext(t,["r","$fn"],[],r),s=n.contextVariableLookup(i,"r",1),o=n.get_fragments_from_r(s,i);return e.template("CAG.circle({center: [0,0], radius: <%=r%>, resolution: <%=resolution%>})",{r:s,resolution:o})},a.prototype.evaluate=function(t,r){var i=n.newContext(t,["size","center"],[],r),s=n.contextVariableLookup(i,"size",[.5,.5]),o=n.contextVariableLookup(i,"center",!1),u=e.isArray(s)?u=[s[0]/2,s[1]/2]:[s/2,s/2],a=[0,0];return o||(a=[s[0]/2,s[1]/2]),e.template("CAG.rectangle({center: [<%=centerPoint%>], radius: [<%=radius%>]})",{centerPoint:a,radius:u})},f.prototype.evaluate=function(t,r){function a(t){return e.map(t,function(t){return e.template("[<%=x%>]",{x:t})})}var i=n.newContext(t,["points","paths","convexity"],[],r),s=n.contextVariableLookup(i,"points",[]),o=n.contextVariableLookup(i,"paths",[]),u=[];if(e.isEmpty(o))return e.template("CAG.fromPoints([<%=points%>])",{points:a(s)});if(o.length>1){var f="";e.each(e.first(o),function(e){u.push(s[e])}),f+=e.template("(new CSG.Path2D([<%=points%>],true)).innerToCAG().subtract([",{points:a(u)});var l=[];return e.each(e.rest(o),function(t){u=[],e.each(t,function(e){u.push(s[e])}),l.push(e.template("(new CSG.Path2D([<%=points%>],true)).innerToCAG()",{points:a(u)}))}),f+=l.join(",")+"])",f}return e.each(o[0],function(e){u.push(s[e])}),e.template("(new CSG.Path2D([<%=points%>],true)).innerToCAG()",{points:a(u)})},l.prototype.evaluate=function(t,r){var i=n.newContext(t,["points","triangles","convexity"],[],r),s=n.contextVariableLookup(i,"points",[]),o=n.contextVariableLookup(i,"triangles",[]),u=[];return e.each(o,function(t){u.push(e.template("new CSG.Polygon([new CSG.Vertex(new CSG.Vector3D([<%=vec1%>])),new CSG.Vertex(new CSG.Vector3D([<%=vec2%>])),new CSG.Vertex(new CSG.Vector3D([<%=vec3%>]))])",{vec1:s[t[2]],vec2:s[t[1]],vec3:s[t[0]]}))}),e.template("CSG.fromPolygons([<%=polygons%>])",{polygons:u})},{Sphere:i,Cube:o,Cylinder:s,Circle:u,Square:a,Polygon:f,Polyhedron:l}}),r("TransformModules",["Globals","Context"],function(t,n){function r(t){var t=t;this.transformChildren=function(n,r,i){var s=[];for(var o=0;o<n.length;o++){var u=n[o];u.argvalues=[],e.each(u.argexpr,function(e,t,n){u.argvalues.push(e.evaluate(r))});var a=t.getAdaptor(u),f=a.evaluate(r,u);f&&(f+=i(),s.push(f))}if(s.length==1)return s[0];if(s.length>1)return e.first(s)+".union(["+e.rest(s)+"])"}}function i(e){r.call(this,e)}function s(e){r.call(this,e)}function o(e){r.call(this,e)}function u(e){r.call(this,e)}function a(e){r.call(this,e)}function f(e){r.call(this,e)}function l(t){r.call(this,t),this.transposeMatrix=function(t){var n=[],r=0;for(var i in e.range(4))for(var s in e.range(4))n[r++]=t[s][i];return n}}function c(e){r.call(this,e)}i.prototype.evaluate=function(r,i){i.argvalues=[],e.each(i.argexpr,function(e,t,n){i.argvalues.push(e.evaluate(r))});var s=n.newContext(r,["c","alpha"],[],i),o=n.contextVariableLookup(s,"c",undefined),u="white";o!==undefined&&(u=e.isString(o)?h[t.stripString(o.toLowerCase())]:o);var a=n.contextVariableLookup(s,"alpha",undefined);return a!==undefined&&(u[3]=a),this.transformChildren(i.children,s,function(){return e.template(".setColor(<%=color%>)",{color:u})})},s.prototype.evaluate=function(t,r){r.argvalues=[],e.each(r.argexpr,function(e,n,i){r.argvalues.push(e.evaluate(t))});var i=n.newContext(t,["v"],[],r),s=n.contextVariableLookup(i,"v",[0,0,0]);if(!(s instanceof Array)){var o=s;s=[o,o,o]}return this.transformChildren(r.children,i,function(){return e.template(".mirrored(CSG.Plane.fromNormalAndPoint([<%=v%>], [0,0,0]))",{v:s})})},o.prototype.evaluate=function(t,r){r.argvalues=[],e.each(r.argexpr,function(e,n,i){r.argvalues.push(e.evaluate(t))});var i=n.newContext(t,["a","v"],[],r),s=n.contextVariableLookup(i,"a",undefined);if(e.isArray(s))return this.transformChildren(r.children,i,function(){return e.template(".rotateX(<%=degreeX%>).rotateY(<%=degreeY%>).rotateZ(<%=degreeZ%>)",{degreeX:s[0],degreeY:s[1],degreeZ:s[2]})});var o=n.contextVariableLookup(i,"v",undefined);return this.transformChildren(r.children,i,function(){if(o===undefined||o.toString()=="0,0,0")o=[0,0,1];return e.template(".transform(CSG.Matrix4x4.rotation([0,0,0], [<%=vector%>], <%=degree%>))",{degree:s,vector:o})})},u.prototype.evaluate=function(t,r){r.argvalues=[],e.each(r.argexpr,function(e,n,i){r.argvalues.push(e.evaluate(t))});var i=n.newContext(t,["v"],[],r),s=n.contextVariableLookup(i,"v",[0,0,0]);if(!(s instanceof Array)){var o=s;s=[o,o,o]}return this.transformChildren(r.children,i,function(){return e.template(".scale([<%=v%>])",{v:s})})},a.prototype.evaluate=function(t,r){r.argvalues=[],e.each(r.argexpr,function(e,n,i){r.argvalues.push(e.evaluate(t))});var i=n.newContext(t,["v"],[],r),s=n.contextVariableLookup(i,"v",[0,0,0]);return this.transformChildren(r.children,i,function(){return e.template(".translate([<%=v%>])",{v:s})})},f.prototype.evaluate=function(t,r){r.argvalues=[],e.each(r.argexpr,function(e,n,i){r.argvalues.push(e.evaluate(t))});var i=n.newContext(t,[],[],r),s=0;return r.argvalues[0]!==undefined&&(s=r.argvalues[0]),this.transformChildren(r.children,i,function(){return""})},l.prototype.evaluate=function(t,r){r.argvalues=[],e.each(r.argexpr,function(e,n,i){r.argvalues.push(e.evaluate(t))});var i=n.newContext(t,["m"],[],r),s=n.contextVariableLookup(i,"m",undefined),o;return s!==undefined&&(o=this.transposeMatrix(s)),this.transformChildren(r.children,i,function(){return e.template(".transform(new CSG.Matrix4x4( [<%= matrix %>] ))",{matrix:o})})},c.prototype.evaluate=function(r,i){i.argvalues=[],e.each(i.argexpr,function(e,t,n){i.argvalues.push(e.evaluate(r))});var s=n.newContext(r,["file","layer","height","origin","scale","center","twist","slices","$fn","$fs","$fa"],[],i),o=n.contextVariableLookup(s,"height",100),u=n.contextVariableLookup(s,"center",!1),a=Number(n.contextVariableLookup(s,"twist",0))/-1,f=n.contextVariableLookup(s,"slices",undefined),l=n.contextVariableLookup(s,"$fn",t.FN_DEFAULT),c=n.contextVariableLookup(s,"$fs",t.FS_DEFAULT),h=n.contextVariableLookup(s,"$fa",t.FA_DEFAULT);return f===undefined&&(f=parseInt(Math.max(2,Math.abs(n.get_fragments_from_r(o,s)*a/360)))),this.transformChildren(i.children,s,function(){var t=e.template(".extrude({offset: [0, 0, <%=height%>], twistangle: <%=twist%>,twiststeps: <%=slices%>})",{height:o,twist:a,slices:f});if(u){var n=-o/2;t+=e.template(".translate([0,0,<%=offset%>])",{offset:n})}return t})};var h={indianred:[.804,.361,.361],lightcoral:[.941,.502,.502],salmon:[.98,.502,.447],darksalmon:[.914,.588,.478],lightsalmon:[1,.627,.478],red:[1,0,0],crimson:[.863,.078,.235],firebrick:[.698,.133,.133],darkred:[.545,0,0],pink:[1,.753,.796],lightpink:[1,.714,.757],hotpink:[1,.412,.706],deeppink:[1,.078,.576],mediumvioletred:[.78,.082,.522],palevioletred:[.859,.439,.576],lightsalmon:[1,.627,.478],coral:[1,.498,.314],tomato:[1,.388,.278],orangered:[1,.271,0],darkorange:[1,.549,0],orange:[1,.647,0],gold:[1,.843,0],yellow:[1,1,0],lightyellow:[1,1,.878],lemonchiffon:[1,.98,.804],lightgoldenrodyellow:[.98,.98,.824],papayawhip:[1,.937,.835],moccasin:[1,.894,.71],peachpuff:[1,.855,.725],palegoldenrod:[.933,.91,.667],khaki:[.941,.902,.549],darkkhaki:[.741,.718,.42],lavender:[.902,.902,.98],thistle:[.847,.749,.847],plum:[.867,.627,.867],violet:[.933,.51,.933],orchid:[.855,.439,.839],fuchsia:[1,0,1],magenta:[1,0,1],mediumorchid:[.729,.333,.827],mediumpurple:[.576,.439,.859],blueviolet:[.541,.169,.886],darkviolet:[.58,0,.827],darkorchid:[.6,.196,.8],darkmagenta:[.545,0,.545],purple:[.502,0,.502],indigo:[.294,0,.51],darkslateblue:[.282,.239,.545],slateblue:[.416,.353,.804],mediumslateblue:[.482,.408,.933],greenyellow:[.678,1,.184],chartreuse:[.498,1,0],lawngreen:[.486,.988,0],lime:[0,1,0],limegreen:[.196,.804,.196],palegreen:[.596,.984,.596],lightgreen:[.565,.933,.565],mediumspringgreen:[0,.98,.604],springgreen:[0,1,.498],mediumseagreen:[.235,.702,.443],seagreen:[.18,.545,.341],forestgreen:[.133,.545,.133],green:[0,.502,0],darkgreen:[0,.392,0],yellowgreen:[.604,.804,.196],olivedrab:[.42,.557,.137],olive:[.502,.502,0],darkolivegreen:[.333,.42,.184],mediumaquamarine:[.4,.804,.667],darkseagreen:[.561,.737,.561],lightseagreen:[.125,.698,.667],darkcyan:[0,.545,.545],teal:[0,.502,.502],aqua:[0,1,1],cyan:[0,1,1],lightcyan:[.878,1,1],paleturquoise:[.686,.933,.933],aquamarine:[.498,1,.831],turquoise:[.251,.878,.816],mediumturquoise:[.282,.82,.8],darkturquoise:[0,.808,.82],cadetblue:[.373,.62,.627],steelblue:[.275,.51,.706],lightsteelblue:[.69,.769,.871],powderblue:[.69,.878,.902],lightblue:[.678,.847,.902],skyblue:[.529,.808,.922],lightskyblue:[.529,.808,.98],deepskyblue:[0,.749,1],dodgerblue:[.118,.565,1],cornflowerblue:[.392,.584,.929],royalblue:[.255,.412,.882],blue:[0,0,1],mediumblue:[0,0,.804],darkblue:[0,0,.545],navy:[0,0,.502],midnightblue:[.098,.098,.439],cornsilk:[1,.973,.863],blanchedalmond:[1,.922,.804],bisque:[1,.894,.769],navajowhite:[1,.871,.678],wheat:[.961,.871,.702],burlywood:[.871,.722,.529],tan:[.824,.706,.549],rosybrown:[.737,.561,.561],sandybrown:[.957,.643,.376],goldenrod:[.855,.647,.125],darkgoldenrod:[.722,.525,.043],peru:[.804,.522,.247],chocolate:[.824,.412,.118],saddlebrown:[.545,.271,.075],sienna:[.627,.322,.176],brown:[.647,.165,.165],maroon:[.502,0,0],white:[1,1,1],snow:[1,.98,.98],honeydew:[.941,1,.941],mintcream:[.961,1,.98],azure:[.941,1,1],aliceblue:[.941,.973,1],ghostwhite:[.973,.973,1],whitesmoke:[.961,.961,.961],seashell:[1,.961,.933],beige:[.961,.961,.863],oldlace:[.992,.961,.902],floralwhite:[1,.98,.941],ivory:[1,1,.941],antiquewhite:[.98,.922,.843],linen:[.98,.941,.902],lavenderblush:[1,.941,.961],mistyrose:[1,.894,.882],gainsboro:[.863,.863,.863],lightgrey:[.827,.827,.827],silver:[.753,.753,.753],darkgray:[.663,.663,.663],gray:[.502,.502,.502],dimgray:[.412,.412,.412],lightslategray:[.467,.533,.6],slategray:[.439,.502,.565],darkslategray:[.184,.31,.31],black:[0,0,0]};return{Translate:a,Scale:u,Rotate:o,Mirror:s,Color:i,Render:f,Multimatrix:l,Extrude:c}}),r("ControlModules",["Globals","Context","Range"],function(t,n,r){function i(e){this.factory=e}function s(e){i.call(this,e)}function o(t,s){i.call(this,t),this.csgOp=s.csgOp,this.evaluatedChildren=[],this.forEval=function(t,i,s,o,u,a){this.evaluatedChildren=t;if(o.length>s){var f=o[s],l=u[s],c=new n(a);if(l instanceof r){var h=l;if(h.end<h.begin){var p=h.begin;h.begin=h.end,h.end=p}if(h.step>0&&(h.begin-h.end)/h.step<1e4)for(var d=h.begin;d<=h.end;d+=h.step)c.setVariable(f,d),this.forEval(this.evaluatedChildren,i,s+1,o,u,c)}else if(e.isArray(l))for(var d=0;d<l.length;d++)c.setVariable(f,l[d]),this.forEval(this.evaluatedChildren,i,s+1,o,u,c)}else if(s>0){var v=i.evaluateChildren(a);e.isArray(v)?this.evaluatedChildren=this.evaluatedChildren.concat(v):this.evaluatedChildren.push(v)}e.isArray(this.evaluatedChildren)&&(this.evaluatedChildren=e.reject(this.evaluatedChildren,function(t){return e.isEmpty(t)}));if(e.isArray(this.evaluatedChildren)&&this.evaluatedChildren.length>1){var m=e.first(this.evaluatedChildren)+"."+this.csgOp+"(["+e.rest(this.evaluatedChildren)+"])";this.evaluatedChildren=[m]}return this.evaluatedChildren}}function u(e){i.call(this,e)}return s.prototype.evaluate=function(t,r){r.argvalues=[],e.each(r.argexpr,function(e,n,i){r.argvalues.push(e.evaluate(t))});var i=n.newContext(t,[],[],r),s=r.argvalues.length>0&&r.argvalues[0]?r.children:r.else_children,o=[];for(var u=0;u<s.length;u++){var a=s[u];a.argvalues=[],e.each(a.argexpr,function(e,t,n){a.argvalues.push(e.evaluate(i))});var f=this.factory.getAdaptor(a);o.push(f.evaluate(i,a))}return e.isEmpty(o)?undefined:o.length>1?e.first(o)+".union(["+e.rest(o)+"])":o[0]},o.prototype.evaluate=function(e,t){return t.context===undefined&&(t.context=e),this.forEval([],t,0,t.argnames,t.argvalues,t.context)},u.prototype.evaluate=function(r,i){var s=new n(r),o=[];return e.each(i.argexpr,function(e,n,r){o.push(t.convertForStrFunction(e.evaluate(s)))}),console.log(e.template("ECHO: <%=argvalues%>",{argvalues:o})),undefined},{Echo:u,ForLoopStatement:o,IfStatement:s}}),r("CSGModule",["Globals","Context"],function(t,n){function r(e,t){this.csgOperation=t,this.factory=e}return r.prototype.evaluate=function(t,r){var i=new n(t),s=[];for(var o=0;o<r.children.length;o++){var u=r.children[o];u.argvalues=[],e.each(u.argexpr,function(e,t,n){u.argvalues.push(e.evaluate(i))});var a=this.factory.getAdaptor(u),f=a.evaluate(t,u);f!==undefined&&s.push(f)}return s.length<=1?s[0]:s[0]+"."+this.csgOperation+"(["+s.slice(1).join(",\n")+"])"},r}),r("ChildModule",["Globals","Context"],function(t,n){function r(e){this.factory=e}return r.prototype.evaluate=function(r,i){i.argvalues=[],e.each(i.argexpr,function(e,t,n){i.argvalues.push(e.evaluate(r))});var s=n.newContext(r,[],[],i),o=0;i.argvalues[0]!==undefined&&(o=i.argvalues[0]);var u=[];for(var a=t.context_stack.length-1;a>=0;a--){var f=t.context_stack[a];if(f.inst_p!==undefined){if(o<f.inst_p.children.length){var l=f.inst_p.children[o];e.each(l.argexpr,function(e,t,n){l.argvalues.push(e.evaluate(f.inst_p.ctx))});var c=this.factory.getAdaptor(l);u.push(c.evaluate(f.inst_p.ctx,l))}return u}f=f.parentContext}return undefined},r}),r("ModuleAdaptor",["Globals","Context"],function(e,t){function n(){}return n.prototype.evaluate=function(e,t){return t.isSubmodule=!0,e.evaluateModule(t)},n}),r("StlDecoder",[],function(){function n(e){var n=new ArrayBuffer(e.length);this.data=new Uint8Array(n);for(var r=0,i=e.length;r<i;r++)this.data[r]=e.charCodeAt(r);this.TYPE_ASCII="ascii",this.TYPE_BINARY="binary",this.dataType="",this.ASCII_TITLE="solid",this.TYPE_VERTEX="vertex",this.TYPE_NORMAL="normal",this.TYPE_END="end",this.NOT_ASCII=-1,this.listVertex=null,this.listNormal=null,this.pos=0;if(this.data.length<t+4)throw"STL file too small: "+this.data.length}var t=80;return n.prototype.findEndPos=function(e){var t=e;while(t<this.data.length-1){if(this.data[t]==10)return t;t++}return this.data.length-1},n.prototype.bin2String=function(e,t){var n="";for(var r=e;r<t;r++){var i=this.data[r].toString();n+=String.fromCharCode(i)}return n.replace("\r","")},n.prototype.readUInt16=function(){var e,t;return e=this.data[this.pos++],t=this.data[this.pos++]<<8,e|t},n.prototype.readUInt32=function(){var e,t,n,r;e=this.data[this.pos++],t=this.data[this.pos++]<<8,n=this.data[this.pos++]<<16,r=this.data[this.pos++]<<24;var i=e|t|n|r;return i},n.prototype.readReal32=function(){if(this.data.length<=this.pos+4)return 0;var e=[0,0,0,0];e[3]=this.data[this.pos++],e[2]=this.data[this.pos++],e[1]=this.data[this.pos++],e[0]=this.data[this.pos++];var t=this.parseSign(e),n=this.parseExponent(e),r=this.parseSignificand(e),i=t*n*r;return i},n.prototype.parseSign=function(e){return e[0]&128?-1:1},n.prototype.parseExponent=function(e){var t=e[0]&127;return t<<=1,0!=(e[1]&128)&&(t+=1),t=Math.pow(2,t-127),t},n.prototype.parseSignificand=function(e){var t=0,n,r=64;for(var i=1;i<8;i++)0!=(e[1]&r)&&(t+=1/Math.pow(2,i)),r>>=1;r=128;for(var s=0;s<8;s++)0!=(e[2]&r)&&(t+=1/Math.pow(2,s+8)),r>>=1;r=128;for(var o=0;o<8;o++)0!=(e[2]&r)&&(t+=1/Math.pow(2,o+16)),r>>=1;return t+1},n.prototype.readNormal=function(e){var t=this.listNormal[e],n=this.findEndPos(t),r=this.bin2String(t,n),i=r.indexOf(this.TYPE_NORMAL);r=r.substring(i+this.TYPE_NORMAL.length+1,r.length);var s=r.split(" "),o=new Array;for(var u=0;u<s.length;u++)s[u].length&&o.push(Number(s[u]));return s.length<3?null:o},n.prototype.readVertex=function(e){var t=this.listVertex[e],n=this.findEndPos(t),r=this.bin2String(t,n),i=r.indexOf(this.TYPE_VERTEX);r=r.substring(i+this.TYPE_VERTEX.length+1,r.length);var s=r.split(" "),o=new Array;for(var u=0;u<s.length;u++)s[u].length&&o.push(Number(s[u]));return o.length!=3?null:o},n.prototype.decode=function(){if(this.dataType.length)return this.dataType;var e=this.bin2String(0,10).toLocaleLowerCase(),t=0,n=0;if(e.indexOf(this.ASCII_TITLE)>=0){this.dataType=this.TYPE_ASCII,this.listVertex=new Array,this.listNormal=new Array;while(t<this.data.length-1)t=this.findEndPos(n),e=this.bin2String(n,t),e.indexOf(this.TYPE_VERTEX)>=0?this.listVertex.push(n):e.indexOf(this.TYPE_NORMAL)>=0&&this.listNormal.push(n),n=t+1}else this.dataType=this.TYPE_BINARY;return this.dataType},n.prototype.getCSG=function(){var e=[],n;this.dataType==this.TYPE_BINARY?(this.pos=t,n=this.readUInt32()):(this.pos=0,n=this.listVertex.length/3);if(this.dataType==this.TYPE_BINARY)for(i=0;i<n;i++){var r=[],s=[0,0,0];for(var o=0;o<3;o++)s[o]=this.readReal32();var u=new CSG.Vector3D(s),a=new CSG.Plane(u,1);for(var o=0;o<3;o++){var f=this.readReal32(),l=this.readReal32(),c=this.readReal32();r.push(new CSG.Vertex(new CSG.Vector3D(f,l,c)))}this.pos+=2,e.push(new CSG.Polygon(r,null,a))}else for(i=0;i<n;i++){var r=[];for(var o=0;o<3;o++){var h=this.readVertex(i*3+o);r.push(new CSG.Vertex(new CSG.Vector3D(h)))}e.push(new CSG.Polygon(r,null))}return CSG.fromPolygons(e)},n.prototype.getCSGString=function(){var n=[],r;this.dataType==this.TYPE_BINARY?(this.pos=t,r=this.readUInt32()):(this.pos=0,r=this.listVertex.length/3);if(this.dataType==this.TYPE_BINARY)for(i=0;i<r;i++){var s=[],o=[0,0,0];for(var u=0;u<3;u++)o[u]=this.readReal32();var a=e.template("new CSG.Plane(new CSG.Vector3D([<%=normal%>]), 1)",{normal:o});for(var u=0;u<3;u++){var f=this.readReal32(),l=this.readReal32(),c=this.readReal32();s.push(e.template("new CSG.Vertex(new CSG.Vector3D([<%=vertex%>]))",{vertex:[f,l,c]}))}this.pos+=2,n.push(e.template("new CSG.Polygon([<%=vertices%>], null)",{vertices:s}))}else for(i=0;i<r;i++){var s=[];for(var u=0;u<3;u++){var h=this.readVertex(i*3+u);s.push(e.template("new CSG.Vertex(new CSG.Vector3D([<%=vertex%>]))",{vertex:h}))}n.push(e.template("new CSG.Polygon([<%=vertices%>], null)",{vertices:s}))}return e.template("CSG.fromPolygons([<%=polygons%>])",{polygons:n})},n.prototype.drawWireFrame=function(e,n,r,i,s,o,u){var a,f;this.dataType==this.TYPE_BINARY?(this.pos=t,a=this.readUInt32()):a=this.listVertex.length/3;if(this.dataType==this.TYPE_BINARY)for(f=0;f<a;f++){var l=[0,0,0];for(var c=0;c<3;c++)l[c]=this.readReal32();this.drawTriangles(e,n,r,i,s,o,u),this.pos+=2}else for(f=0;f<a;f++)this.triangleIndex=f,this.drawTriangles(e,n,r,i,s,o,u)},n.prototype.drawTriangles=function(e,t,n,r,i,s,o){var u=[0,0,0],a=[0,0,0],f=t/2,l=n/2;e.beginPath();var c=Math.PI/180*i,h=Math.PI/180*s,p=Math.PI/180*o;for(var d=0;d<3;d++){this.dataType==this.TYPE_ASCII?a=this.readVertex(this.triangleIndex*3+d):(a[0]=this.readReal32(),a[1]=this.readReal32(),a[2]=this.readReal32());var v=a[1],m=a[2];a[1]=Math.cos(c)*v-Math.sin(c)*m,a[2]=Math.sin(c)*v+Math.cos(c)*m;var g=a[0];m=a[2],a[0]=Math.cos(h)*g+Math.sin(h)*m,a[2]=-Math.sin(h)*g+Math.cos(h)*m,d==0?(e.moveTo(a[0]*r+f,a[1]*r+l),u[0]=a[0],u[1]=a[1],u[2]=a[2]):e.lineTo(a[0]*r+f,a[1]*r+l)}e.lineTo(u[0]*r+f,u[1]*r+l),e.stroke(),e.closePath()},n}),r("ImportModule",["Globals","Context","StlDecoder"],function(e,t,n){function r(e){this.factory=e}return r.prototype.evaluate=function(e,r){var i=new t(e),s=["file","filename","convexity"],o=[];i.args(s,o,r.argnames,r.argvalues);var u=t.contextVariableLookup(i,"file",null)||t.contextVariableLookup(i,"filename",null),a=t.contextVariableLookup(i,"convexity",5),f=t.contextVariableLookup(i,"importCache",{}),l=f[u];if(l!==undefined){var c=new n(atob(l));return c.decode(),c.getCSGString()}return undefined},r}),r("OpenjscadSolidFactory",["Context","Globals","PrimitiveModules","TransformModules","ControlModules","CSGModule","ChildModule","ModuleAdaptor","ImportModule"],function(e,t,n,r,i,s,o,u,a){function f(){}return f.prototype.getAdaptor=function(e){switch(e.name){case"cube":return new n.Cube;case"sphere":return new n.Sphere;case"cylinder":return new n.Cylinder;case"polyhedron":return new n.Polyhedron;case"circle":return new n.Circle;case"square":return new n.Square;case"polygon":return new n.Polygon;case"union":return new s(this,"union");case"difference":return new s(this,"subtract");case"intersect":case"intersection":return new s(this,"intersect");case"translate":return new r.Translate(this);case"scale":return new r.Scale(this);case"rotate":return new r.Rotate(this);case"mirror":return new r.Mirror(this);case"linear_extrude":return new r.Extrude(this);case"color":return new r.Color(this);case"multmatrix":return new r.Multimatrix(this);case"render":case"assign":return new r.Render(this);case"echo":return new i.Echo(this);case"for":return new i.ForLoopStatement(this,{csgOp:"union"});case"intersection_for":return new i.ForLoopStatement(this,{csgOp:"intersect"});case"if":return new i.IfStatement(this);case"import":return new a(this);case"child":return new o(this);default:return new u}},f}),r("OpenjscadSolidFactorySingleton",["OpenjscadSolidFactory"],function(e){var t=new e;return{getInstance:function(){return t}}}),r("ModuleInstantiation",["Globals","OpenjscadSolidFactorySingleton"],function(t,n){function r(){this.name,this.argnames=[],this.argvalues=[],this.argexpr=[],this.children=[],this.isSubmodule=!1,this.context}return r.prototype.evaluate=function(t){var r,i=this;return this.argvalues=[],e.each(this.argexpr,function(e,n,r){i.argvalues.push(e.evaluate(t))}),i.context=t,r=t.evaluateModule(i,n.getInstance()),i.context=null,i.argvalues=[],r},r.prototype.evaluateChildren=function(e){var t=[];for(var n=0;n<this.children.length;n++){var r=this.children[n],i=r.evaluate(e);i!==undefined&&t.push(i)}return t},r}),r("IfElseModuleInstantiation",["ModuleInstantiation"],function(e){function t(){e.call(this),this.name="if",this.else_children=[]}return t.prototype=new e,t.prototype.constructor=t,t}),r("openscad-parser",["openscad-parser-ext","ArgContainer","ArgsContainer","Expression","ModuleInstantiation","IfElseModuleInstantiation"],function(e,t,n,r,i,s){var o={trace:function(){},yy:{},symbols_:{error:2,program:3,input:4,statement:5,inner_input:6,statement_begin:7,statement_end:8,TOK_MODULE:9,TOK_ID:10,"(":11,arguments_decl:12,optional_commas:13,")":14,";":15,"{":16,"}":17,module_instantiation:18,"=":19,expr:20,TOK_FUNCTION:21,BR:22,children_instantiation:23,module_instantiation_list:24,if_statement:25,TOK_IF:26,ifelse_statement:27,TOK_ELSE:28,single_module_instantiation:29,arguments_call:30,"!":31,"#":32,"%":33,"*":34,TOK_TRUE:35,TOK_FALSE:36,TOK_UNDEF:37,".":38,TOK_STRING:39,TOK_NUMBER:40,"[":41,":":42,"]":43,vector_expr:44,"/":45,"+":46,"-":47,"<":48,LE:49,EQ:50,NE:51,GE:52,">":53,AND:54,OR:55,"?":56,",":57,argument_decl:58,argument_call:59,$accept:0,$end:1},terminals_:{2:"error",9:"TOK_MODULE",10:"TOK_ID",11:"(",14:")",15:";",16:"{",17:"}",19:"=",21:"TOK_FUNCTION",22:"BR",26:"TOK_IF",28:"TOK_ELSE",31:"!",32:"#",33:"%",34:"*",35:"TOK_TRUE",36:"TOK_FALSE",37:"TOK_UNDEF",38:".",39:"TOK_STRING",40:"TOK_NUMBER",41:"[",42:":",43:"]",45:"/",46:"+",47:"-",48:"<",49:"LE",50:"EQ",51:"NE",52:"GE",53:">",54:"AND",55:"OR",56:"?",57:","},productions_:[0,[3,1],[4,0],[4,2],[6,0],[6,2],[5,2],[7,0],[7,6],[8,1],[8,3],[8,1],[8,4],[8,9],[8,1],[23,1],[23,3],[25,5],[27,1],[27,3],[18,2],[18,2],[18,1],[24,0],[24,2],[29,4],[29,2],[29,2],[29,2],[29,2],[20,1],[20,1],[20,1],[20,1],[20,3],[20,1],[20,1],[20,5],[20,7],[20,3],[20,4],[20,3],[20,3],[20,3],[20,3],[20,3],[20,3],[20,3],[20,3],[20,3],[20,3],[20,3],[20,3],[20,3],[20,2],[20,2],[20,2],[20,3],[20,5],[20,4],[20,4],[13,2],[13,0],[44,1],[44,4],[12,0],[12,1],[12,4],[58,1],[58,3],[30,0],[30,1],[30,4],[59,1],[59,3]],performAction:function(u,a,f,l,c,h,p){var d=h.length-1;switch(c){case 1:return e.processModule(l);case 8:e.stashModule(h[d-4],h[d-2].argnames,h[d-2].argexpr),delete h[d-2];break;case 9:break;case 10:e.popModule();break;case 11:e.addModuleChild(h[d]);break;case 12:e.addModuleAssignmentVar(h[d-3],h[d-1]);break;case 13:e.addModuleFunction(h[d-7],h[d-1],h[d-5].argnames,h[d-5].argexpr),delete h[d-5];break;case 15:this.$=new i,h[d]&&this.$.children.push(h[d]);break;case 16:this.$=h[d-1];break;case 17:this.$=new s,this.$.argnames.push(""),this.$.argexpr.push(h[d-2]);if(this.$)this.$.children=h[d].children;else for(var v=0;v<h[d].children.size();v++)delete h[d].children[v];delete h[d];break;case 18:this.$=h[d];break;case 19:this.$=h[d-2];if(this.$)this.$.else_children=h[d].children;else for(var v=0;v<h[d].children.size();v++)delete h[d].children[v];delete h[d];break;case 20:this.$=h[d-1];break;case 21:this.$=h[d-1];if(this.$)this.$.children=h[d].children;else for(var v=0;v<h[d].children.length;v++)delete h[d].children[v];delete h[d];break;case 22:this.$=h[d];break;case 23:this.$=new i;break;case 24:this.$=h[d-1],this.$?h[d]&&this.$.children.push(h[d]):delete h[d];break;case 25:this.$=new i,this.$.name=h[d-3],this.$.argnames=h[d-1].argnames,this.$.argexpr=h[d-1].argexpr,delete h[d-1];break;case 26:this.$=h[d],this.$&&(this.$.tag_root=!0);break;case 27:this.$=h[d],this.$&&(this.$.tag_highlight=!0);break;case 28:delete h[d],this.$=undefined;break;case 29:delete h[d],this.$=undefined;break;case 30:this.$=new r(!0);break;case 31:this.$=new r(!1);break;case 32:this.$=new r(undefined);break;case 33:this.$=new r,this.$.type="L",this.$.var_name=h[d];break;case 34:this.$=new r,this.$.type="N",this.$.children.push(h[d-2]),this.$.var_name=h[d];break;case 35:this.$=new r(String(h[d]));break;case 36:this.$=new r(Number(h[d]));break;case 37:var m=new r(1);this.$=new r,this.$.type="R",this.$.children.push(h[d-3]),this.$.children.push(m),this.$.children.push(h[d-1]);break;case 38:this.$=new r,this.$.type="R",this.$.children.push(h[d-5]),this.$.children.push(h[d-3]),this.$.children.push(h[d-1]);break;case 39:this.$=new r([]);break;case 40:this.$=h[d-2];break;case 41:this.$=new r,this.$.type="*",this.$.children.push(h[d-2]),this.$.children.push(h[d]);break;case 42:this.$=new r,this.$.type="/",this.$.children.push(h[d-2]),this.$.children.push(h[d]);break;case 43:this.$=new r,this.$.type="%",this.$.children.push(h[d-2]),this.$.children.push(h[d]);break;case 44:this.$=new r,this.$.type="+",this.$.children.push(h[d-2]),this.$.children.push(h[d]);break;case 45:this.$=new r,this.$.type="-",this.$.children.push(h[d-2]),this.$.children.push(h[d]);break;case 46:this.$=new r,this.$.type="<",this.$.children.push(h[d-2]),this.$.children.push(h[d]);break;case 47:this.$=new r,this.$.type="<=",this.$.children.push(h[d-2]),this.$.children.push(h[d]);break;case 48:this.$=new r,this.$.type="==",this.$.children.push(h[d-2]),this.$.children.push(h[d]);break;case 49:this.$=new r,this.$.type="!=",this.$.children.push(h[d-2]),this.$.children.push(h[d]);break;case 50:this.$=new r,this.$.type=">=",this.$.children.push(h[d-2]),this.$.children.push(h[d]);break;case 51:this.$=new r,this.$.type=">",this.$.children.push(h[d-2]),this.$.children.push(h[d]);break;case 52:this.$=new r,this.$.type="&&",this.$.children.push(h[d-2]),this.$.children.push(h[d]);break;case 53:this.$=new r,this.$.type="||",this.$.children.push(h[d-2]),this.$.children.push(h[d]);break;case 54:this.$=h[d];break;case 55:this.$=new r,this.$.type="I",this.$.children.push(h[d]);break;case 56:this.$=new r,this.$.type="!",this.$.children.push(h[d]);break;case 57:this.$=h[d-1];break;case 58:this.$=new r,this.$.type="?:",this.$.children.push(h[d-4]),this.$.children.push(h[d-2]),this.$.children.push(h[d]);break;case 59:this.$=new r,this.$.type="[]",this.$.children.push(h[d-3]),this.$.children.push(h[d-1]);break;case 60:this.$=new r,this.$.type="F",this.$.call_funcname=h[d-3],this.$.call_argnames=h[d-1].argnames,this.$.children=h[d-1].argexpr,delete h[d-1];break;case 63:this.$=new r,this.$.type="V",this.$.children.push(h[d]);break;case 64:this.$=h[d-3],this.$.children.push(h[d]);break;case 65:this.$=new n;break;case 66:this.$=new n,this.$.argnames.push(h[d].argname),this.$.argexpr.push(h[d].argexpr),delete h[d];break;case 67:this.$=h[d-3],this.$.argnames.push(h[d].argname),this.$.argexpr.push(h[d].argexpr),delete h[d];break;case 68:this.$=new t,this.$.argname=h[d],this.$.argexpr=undefined;break;case 69:this.$=new t,this.$.argname=h[d-2],this.$.argexpr=h[d];break;case 70:this.$=new n;break;case 71:this.$=new n,this.$.argnames.push(h[d].argname),this.$.argexpr.push(h[d].argexpr),delete h[d];break;case 72:this.$=h[d-3],this.$.argnames.push(h[d].argname),this.$.argexpr.push(h[d].argexpr),delete h[d];break;case 73:this.$=new t,this.$.argexpr=h[d];break;case 74:this.$=new t,this.$.argname=h[d-2],this.$.argexpr=h[d]}},table:[{1:[2,2],3:1,4:2,9:[2,2],10:[2,2],15:[2,2],16:[2,2],21:[2,2],22:[2,2],26:[2,2],31:[2,2],32:[2,2],33:[2,2],34:[2,2]},{1:[3]},{1:[2,1],5:3,7:4,9:[1,5],10:[2,7],15:[2,7],16:[2,7],21:[2,7],22:[2,7],26:[2,7],31:[2,7],32:[2,7],33:[2,7],34:[2,7]},{1:[2,3],9:[2,3],10:[2,3],15:[2,3],16:[2,3],21:[2,3],22:[2,3],26:[2,3],31:[2,3],32:[2,3],33:[2,3],34:[2,3]},{8:6,10:[1,10],15:[1,7],16:[1,8],18:9,21:[1,11],22:[1,12],25:19,26:[1,20],27:14,29:13,31:[1,15],32:[1,16],33:[1,17],34:[1,18]},{10:[1,21]},{1:[2,6],9:[2,6],10:[2,6],15:[2,6],16:[2,6],17:[2,6],21:[2,6],22:[2,6],26:[2,6],31:[2,6],32:[2,6],33:[2,6],34:[2,6]},{1:[2,9],9:[2,9],10:[2,9],15:[2,9],16:[2,9],17:[2,9],21:[2,9],22:[2,9],26:[2,9],31:[2,9],32:[2,9],33:[2,9],34:[2,9]},{6:22,9:[2,4],10:[2,4],15:[2,4],16:[2,4],17:[2,4],21:[2,4],22:[2,4],26:[2,4],31:[2,4],32:[2,4],33:[2,4],34:[2,4]},{1:[2,11],9:[2,11],10:[2,11],15:[2,11],16:[2,11],17:[2,11],21:[2,11],22:[2,11],26:[2,11],31:[2,11],32:[2,11],33:[2,11],34:[2,11]},{11:[1,24],19:[1,23]},{10:[1,25]},{1:[2,14],9:[2,14],10:[2,14],15:[2,14],16:[2,14],17:[2,14],21:[2,14],22:[2,14],26:[2,14],31:[2,14],32:[2,14],33:[2,14],34:[2,14]},{10:[1,30],15:[1,26],16:[1,29],18:28,23:27,25:19,26:[1,20],27:14,29:13,31:[1,15],32:[1,16],33:[1,17],34:[1,18]},{1:[2,22],9:[2,22],10:[2,22],15:[2,22],16:[2,22],17:[2,22],21:[2,22],22:[2,22],26:[2,22],28:[2,22],31:[2,22],32:[2,22],33:[2,22],34:[2,22]},{10:[1,30],29:31,31:[1,15],32:[1,16],33:[1,17],34:[1,18]},{10:[1,30],29:32,31:[1,15],32:[1,16],33:[1,17],34:[1,18]},{10:[1,30],29:33,31:[1,15],32:[1,16],33:[1,17],34:[1,18]},{10:[1,30],29:34,31:[1,15],32:[1,16],33:[1,17],34:[1,18]},{1:[2,18],9:[2,18],10:[2,18],15:[2,18],16:[2,18],17:[2,18],21:[2,18],22:[2,18],26:[2,18],28:[1,35],31:[2,18],32:[2,18],33:[2,18],34:[2,18]},{11:[1,36]},{11:[1,37]},{5:39,7:4,9:[1,5],10:[2,7],15:[2,7],16:[2,7],17:[1,38],21:[2,7],22:[2,7],26:[2,7],31:[2,7],32:[2,7],33:[2,7],34:[2,7]},{10:[1,44],11:[1,51],20:40,31:[1,50],35:[1,41],36:[1,42],37:[1,43],39:[1,45],40:[1,46],41:[1,47],46:[1,48],47:[1,49]},{10:[1,55],11:[1,51],14:[2,70],20:54,30:52,31:[1,50],35:[1,41],36:[1,42],37:[1,43],39:[1,45],40:[1,46],41:[1,47],46:[1,48],47:[1,49],57:[2,70],59:53},{11:[1,56]},{1:[2,20],9:[2,20],10:[2,20],15:[2,20],16:[2,20],17:[2,20],21:[2,20],22:[2,20],26:[2,20],28:[2,20],31:[2,20],32:[2,20],33:[2,20],34:[2,20]},{1:[2,21],9:[2,21],10:[2,21],15:[2,21],16:[2,21],17:[2,21],21:[2,21],22:[2,21],26:[2,21],28:[2,21],31:[2,21],32:[2,21],33:[2,21],34:[2,21]},{1:[2,15],9:[2,15],10:[2,15],15:[2,15],16:[2,15],17:[2,15],21:[2,15],22:[2,15],26:[2,15],28:[2,15],31:[2,15],32:[2,15],33:[2,15],34:[2,15]},{10:[2,23],17:[2,23],24:57,26:[2,23],31:[2,23],32:[2,23],33:[2,23],34:[2,23]},{11:[1,24]},{10:[2,26],15:[2,26],16:[2,26],26:[2,26],31:[2,26],32:[2,26],33:[2,26],34:[2,26]},{10:[2,27],15:[2,27],16:[2,27],26:[2,27],31:[2,27],32:[2,27],33:[2,27],34:[2,27]},{10:[2,28],15:[2,28],16:[2,28],26:[2,28],31:[2,28],32:[2,28],33:[2,28],34:[2,28]},{10:[2,29],15:[2,29],16:[2,29],26:[2,29],31:[2,29],32:[2,29],33:[2,29],34:[2,29]},{10:[1,30],16:[1,29],18:28,23:58,25:19,26:[1,20],27:14,29:13,31:[1,15],32:[1,16],33:[1,17],34:[1,18]},{10:[1,44],11:[1,51],20:59,31:[1,50],35:[1,41],36:[1,42],37:[1,43],39:[1,45],40:[1,46],41:[1,47],46:[1,48],47:[1,49]},{10:[1,62],12:60,14:[2,65],57:[2,65],58:61},{1:[2,10],9:[2,10],10:[2,10],15:[2,10],16:[2,10],17:[2,10],21:[2,10],22:[2,10],26:[2,10],31:[2,10],32:[2,10],33:[2,10],34:[2,10]},{9:[2,5],10:[2,5],15:[2,5],16:[2,5],17:[2,5],21:[2,5],22:[2,5],26:[2,5],31:[2,5],32:[2,5],33:[2,5],34:[2,5]},{15:[1,63],33:[1,67],34:[1,65],38:[1,64],41:[1,79],45:[1,66],46:[1,68],47:[1,69],48:[1,70],49:[1,71],50:[1,72],51:[1,73],52:[1,74],53:[1,75],54:[1,76],55:[1,77],56:[1,78]},{14:[2,30],15:[2,30],33:[2,30],34:[2,30],38:[2,30],41:[2,30],42:[2,30],43:[2,30],45:[2,30],46:[2,30],47:[2,30],48:[2,30],49:[2,30],50:[2,30],51:[2,30],52:[2,30],53:[2,30],54:[2,30],55:[2,30],56:[2,30],57:[2,30]},{14:[2,31],15:[2,31],33:[2,31],34:[2,31],38:[2,31],41:[2,31],42:[2,31],43:[2,31],45:[2,31],46:[2,31],47:[2,31],48:[2,31],49:[2,31],50:[2,31],51:[2,31],52:[2,31],53:[2,31],54:[2,31],55:[2,31],56:[2,31],57:[2,31]},{14:[2,32],15:[2,32],33:[2,32],34:[2,32],38:[2,32],41:[2,32],42:[2,32],43:[2,32],45:[2,32],46:[2,32],47:[2,32],48:[2,32],49:[2,32],50:[2,32],51:[2,32],52:[2,32],53:[2,32],54:[2,32],55:[2,32],56:[2,32],57:[2,32]},{11:[1,80],14:[2,33],15:[2,33],33:[2,33],34:[2,33],38:[2,33],41:[2,33],42:[2,33],43:[2,33],45:[2,33],46:[2,33],47:[2,33],48:[2,33],49:[2,33],50:[2,33],51:[2,33],52:[2,33],53:[2,33],54:[2,33],55:[2,33],56:[2,33],57:[2,33]},{14:[2,35],15:[2,35],33:[2,35],34:[2,35],38:[2,35],41:[2,35],42:[2,35],43:[2,35],45:[2,35],46:[2,35],47:[2,35],48:[2,35],49:[2,35],50:[2,35],51:[2,35],52:[2,35],53:[2,35],54:[2,35],55:[2,35],56:[2,35],57:[2,35]},{14:[2,36],15:[2,36],33:[2,36],34:[2,36],38:[2,36],41:[2,36],42:[2,36],43:[2,36],45:[2,36],46:[2,36],47:[2,36],48:[2,36],49:[2,36],50:[2,36],51:[2,36],52:[2,36],53:[2,36],54:[2,36],55:[2,36],56:[2,36],57:[2,36]},{10:[1,44],11:[1,51],13:82,20:81,31:[1,50],35:[1,41],36:[1,42],37:[1,43],39:[1,45],40:[1,46],41:[1,47],43:[2,62],44:83,46:[1,48],47:[1,49],57:[1,84]},{10:[1,44],11:[1,51],20:85,31:[1,50],35:[1,41],36:[1,42],37:[1,43],39:[1,45],40:[1,46],41:[1,47],46:[1,48],47:[1,49]},{10:[1,44],11:[1,51],20:86,31:[1,50],35:[1,41],36:[1,42],37:[1,43],39:[1,45],40:[1,46],41:[1,47],46:[1,48],47:[1,49]},{10:[1,44],11:[1,51],20:87,31:[1,50],35:[1,41],36:[1,42],37:[1,43],39:[1,45],40:[1,46],41:[1,47],46:[1,48],47:[1,49]},{10:[1,44],11:[1,51],20:88,31:[1,50],35:[1,41],36:[1,42],37:[1,43],39:[1,45],40:[1,46],41:[1,47],46:[1,48],47:[1,49]},{14:[1,89],57:[1,90]},{14:[2,71],57:[2,71]},{14:[2,73],33:[1,67],34:[1,65],38:[1,64],41:[1,79],45:[1,66],46:[1,68],47:[1,69],48:[1,70],49:[1,71],50:[1,72],51:[1,73],52:[1,74],53:[1,75],54:[1,76],55:[1,77],56:[1,78],57:[2,73]},{11:[1,80],14:[2,33],19:[1,91],33:[2,33],34:[2,33],38:[2,33],41:[2,33],45:[2,33],46:[2,33],47:[2,33],48:[2,33],49:[2,33],50:[2,33],51:[2,33],52:[2,33],53:[2,33],54:[2,33],55:[2,33],56:[2,33],57:[2,33]},{10:[1,62],12:92,14:[2,65],57:[2,65],58:61},{10:[1,30],17:[1,93],18:94,25:19,26:[1,20],27:14,29:13,31:[1,15],32:[1,16],33:[1,17],34:[1,18]},{1:[2,19],9:[2,19],10:[2,19],15:[2,19],16:[2,19],17:[2,19],21:[2,19],22:[2,19],26:[2,19],28:[2,19],31:[2,19],32:[2,19],33:[2,19],34:[2,19]},{14:[1,95],33:[1,67],34:[1,65],38:[1,64],41:[1,79],45:[1,66],46:[1,68],47:[1,69],48:[1,70],49:[1,71],50:[1,72],51:[1,73],52:[1,74],53:[1,75],54:[1,76],55:[1,77],56:[1,78]},{13:96,14:[2,62],57:[1,97]},{14:[2,66],57:[2,66]},{14:[2,68],19:[1,98],57:[2,68]},{1:[2,12],9:[2,12],10:[2,12],15:[2,12],16:[2,12],17:[2,12],21:[2,12],22:[2,12],26:[2,12],31:[2,12],32:[2,12],33:[2,12],34:[2,12]},{10:[1,99]},{10:[1,44],11:[1,51],20:100,31:[1,50],35:[1,41],36:[1,42],37:[1,43],39:[1,45],40:[1,46],41:[1,47],46:[1,48],47:[1,49]},{10:[1,44],11:[1,51],20:101,31:[1,50],35:[1,41],36:[1,42],37:[1,43],39:[1,45],40:[1,46],41:[1,47],46:[1,48],47:[1,49]},{10:[1,44],11:[1,51],20:102,31:[1,50],35:[1,41],36:[1,42],37:[1,43],39:[1,45],40:[1,46],41:[1,47],46:[1,48],47:[1,49]},{10:[1,44],11:[1,51],20:103,31:[1,50],35:[1,41],36:[1,42],37:[1,43],39:[1,45],40:[1,46],41:[1,47],46:[1,48],47:[1,49]},{10:[1,44],11:[1,51],20:104,31:[1,50],35:[1,41],36:[1,42],37:[1,43],39:[1,45],40:[1,46],41:[1,47],46:[1,48],47:[1,49]},{10:[1,44],11:[1,51],20:105,31:[1,50],35:[1,41],36:[1,42],37:[1,43],39:[1,45],40:[1,46],41:[1,47],46:[1,48],47:[1,49]},{10:[1,44],11:[1,51],20:106,31:[1,50],35:[1,41],36:[1,42],37:[1,43],39:[1,45],40:[1,46],41:[1,47],46:[1,48],47:[1,49]},{10:[1,44],11:[1,51],20:107,31:[1,50],35:[1,41],36:[1,42],37:[1,43],39:[1,45],40:[1,46],41:[1,47],46:[1,48],47:[1,49]},{10:[1,44],11:[1,51],20:108,31:[1,50],35:[1,41],36:[1,42],37:[1,43],39:[1,45],40:[1,46],41:[1,47],46:[1,48],47:[1,49]},{10:[1,44],11:[1,51],20:109,31:[1,50],35:[1,41],36:[1,42],37:[1,43],39:[1,45],40:[1,46],41:[1,47],46:[1,48],47:[1,49]},{10:[1,44],11:[1,51],20:110,31:[1,50],35:[1,41],36:[1,42],37:[1,43],39:[1,45],40:[1,46],41:[1,47],46:[1,48],47:[1,49]},{10:[1,44],11:[1,51],20:111,31:[1,50],35:[1,41],36:[1,42],37:[1,43],39:[1,45],40:[1,46],41:[1,47],46:[1,48],47:[1,49]},{10:[1,44],11:[1,51],20:112,31:[1,50],35:[1,41],36:[1,42],37:[1,43],39:[1,45],40:[1,46],41:[1,47],46:[1,48],47:[1,49]},{10:[1,44],11:[1,51],20:113,31:[1,50],35:[1,41],36:[1,42],37:[1,43],39:[1,45],40:[1,46],41:[1,47],46:[1,48],47:[1,49]},{10:[1,44],11:[1,51],20:114,31:[1,50],35:[1,41],36:[1,42],37:[1,43],39:[1,45],40:[1,46],41:[1,47],46:[1,48],47:[1,49]},{10:[1,55],11:[1,51],14:[2,70],20:54,30:115,31:[1,50],35:[1,41],36:[1,42],37:[1,43],39:[1,45],40:[1,46],41:[1,47],46:[1,48],47:[1,49],57:[2,70],59:53},{33:[1,67],34:[1,65],38:[1,64],41:[1,79],42:[1,116],43:[2,63],45:[1,66],46:[1,68],47:[1,69],48:[1,70],49:[1,71],50:[1,72],51:[1,73],52:[1,74],53:[1,75],54:[1,76],55:[1,77],56:[1,78],57:[2,63]},{43:[1,117]},{13:118,43:[2,62],57:[1,119]},{10:[2,62],11:[2,62],13:120,14:[2,62],31:[2,62],35:[2,62],36:[2,62],37:[2,62],39:[2,62],40:[2,62],41:[2,62],43:[2,62],46:[2,62],47:[2,62],57:[1,84]},{14:[2,54],15:[2,54],33:[1,67],34:[1,65],38:[1,64],41:[1,79],42:[2,54],43:[2,54],45:[1,66],46:[2,54],47:[2,54],48:[2,54],49:[2,54],50:[2,54],51:[2,54],52:[2,54],53:[2,54],54:[2,54],55:[2,54],56:[2,54],57:[2,54]},{14:[2,55],15:[2,55],33:[1,67],34:[1,65],38:[1,64],41:[1,79],42:[2,55],43:[2,55],45:[1,66],46:[2,55],47:[2,55],48:[2,55],49:[2,55],50:[2,55],51:[2,55],52:[2,55],53:[2,55],54:[2,55],55:[2,55],56:[2,55],57:[2,55]},{14:[2,56],15:[2,56],33:[1,67],34:[1,65],38:[1,64],41:[1,79],42:[2,56],43:[2,56],45:[1,66],46:[2,56],47:[2,56],48:[2,56],49:[2,56],50:[2,56],51:[2,56],52:[2,56],53:[2,56],54:[2,56],55:[2,56],56:[2,56],57:[2,56]},{14:[1,121],33:[1,67],34:[1,65],38:[1,64],41:[1,79],45:[1,66],46:[1,68],47:[1,69],48:[1,70],49:[1,71],50:[1,72],51:[1,73],52:[1,74],53:[1,75],54:[1,76],55:[1,77],56:[1,78]},{10:[2,25],15:[2,25],16:[2,25],26:[2,25],31:[2,25],32:[2,25],33:[2,25],34:[2,25]},{10:[2,62],11:[2,62],13:122,31:[2,62],35:[2,62],36:[2,62],37:[2,62],39:[2,62],40:[2,62],41:[2,62],46:[2,62],47:[2,62],57:[1,84]},{10:[1,44],11:[1,51],20:123,31:[1,50],35:[1,41],36:[1,42],37:[1,43],39:[1,45],40:[1,46],41:[1,47],46:[1,48],47:[1,49]},{13:124,14:[2,62],57:[1,97]},{1:[2,16],9:[2,16],10:[2,16],15:[2,16],16:[2,16],17:[2,16],21:[2,16],22:[2,16],26:[2,16],28:[2,16],31:[2,16],32:[2,16],33:[2,16],34:[2,16]},{10:[2,24],17:[2,24],26:[2,24],31:[2,24],32:[2,24],33:[2,24],34:[2,24]},{10:[1,30],16:[1,29],18:28,23:125,25:19,26:[1,20],27:14,29:13,31:[1,15],32:[1,16],33:[1,17],34:[1,18]},{14:[1,126]},{10:[2,62],13:127,14:[2,62],57:[1,84]},{10:[1,44],11:[1,51],20:128,31:[1,50],35:[1,41],36:[1,42],37:[1,43],39:[1,45],40:[1,46],41:[1,47],46:[1,48],47:[1,49]},{14:[2,34],15:[2,34],33:[2,34],34:[2,34],38:[2,34],41:[2,34],42:[2,34],43:[2,34],45:[2,34],46:[2,34],47:[2,34],48:[2,34],49:[2,34],50:[2,34],51:[2,34],52:[2,34],53:[2,34],54:[2,34],55:[2,34],56:[2,34],57:[2,34]},{14:[2,41],15:[2,41],33:[2,41],34:[2,41],38:[1,64],41:[1,79],42:[2,41],43:[2,41],45:[2,41],46:[2,41],47:[2,41],48:[2,41],49:[2,41],50:[2,41],51:[2,41],52:[2,41],53:[2,41],54:[2,41],55:[2,41],56:[2,41],57:[2,41]},{14:[2,42],15:[2,42],33:[2,42],34:[2,42],38:[1,64],41:[1,79],42:[2,42],43:[2,42],45:[2,42],46:[2,42],47:[2,42],48:[2,42],49:[2,42],50:[2,42],51:[2,42],52:[2,42],53:[2,42],54:[2,42],55:[2,42],56:[2,42],57:[2,42]},{14:[2,43],15:[2,43],33:[2,43],34:[2,43],38:[1,64],41:[1,79],42:[2,43],43:[2,43],45:[2,43],46:[2,43],47:[2,43],48:[2,43],49:[2,43],50:[2,43],51:[2,43],52:[2,43],53:[2,43],54:[2,43],55:[2,43],56:[2,43],57:[2,43]},{14:[2,44],15:[2,44],33:[1,67],34:[1,65],38:[1,64],41:[1,79],42:[2,44],43:[2,44],45:[1,66],46:[2,44],47:[2,44],48:[2,44],49:[2,44],50:[2,44],51:[2,44],52:[2,44],53:[2,44],54:[2,44],55:[2,44],56:[2,44],57:[2,44]},{14:[2,45],15:[2,45],33:[1,67],34:[1,65],38:[1,64],41:[1,79],42:[2,45],43:[2,45],45:[1,66],46:[2,45],47:[2,45],48:[2,45],49:[2,45],50:[2,45],51:[2,45],52:[2,45],53:[2,45],54:[2,45],55:[2,45],56:[2,45],57:[2,45]},{14:[2,46],15:[2,46],33:[1,67],34:[1,65],38:[1,64],41:[1,79],42:[2,46],43:[2,46],45:[1,66],46:[1,68],47:[1,69],48:[2,46],49:[2,46],50:[1,72],51:[1,73],52:[2,46],53:[2,46],54:[2,46],55:[2,46],56:[2,46],57:[2,46]},{14:[2,47],15:[2,47],33:[1,67],34:[1,65],38:[1,64],41:[1,79],42:[2,47],43:[2,47],45:[1,66],46:[1,68],47:[1,69],48:[2,47],49:[2,47],50:[1,72],51:[1,73],52:[2,47],53:[2,47],54:[2,47],55:[2,47],56:[2,47],57:[2,47]},{14:[2,48],15:[2,48],33:[1,67],34:[1,65],38:[1,64],41:[1,79],42:[2,48],43:[2,48],45:[1,66],46:[1,68],47:[1,69],48:[2,48],49:[2,48],50:[2,48],51:[2,48],52:[2,48],53:[2,48],54:[2,48],55:[2,48],56:[2,48],57:[2,48]},{14:[2,49],15:[2,49],33:[1,67],34:[1,65],38:[1,64],41:[1,79],42:[2,49],43:[2,49],45:[1,66],46:[1,68],47:[1,69],48:[2,49],49:[2,49],50:[2,49],51:[2,49],52:[2,49],53:[2,49],54:[2,49],55:[2,49],56:[2,49],57:[2,49]},{14:[2,50],15:[2,50],33:[1,67],34:[1,65],38:[1,64],41:[1,79],42:[2,50],43:[2,50],45:[1,66],46:[1,68],47:[1,69],48:[2,50],49:[2,50],50:[1,72],51:[1,73],52:[2,50],53:[2,50],54:[2,50],55:[2,50],56:[2,50],57:[2,50]},{14:[2,51],15:[2,51],33:[1,67],34:[1,65],38:[1,64],41:[1,79],42:[2,51],43:[2,51],45:[1,66],46:[1,68],47:[1,69],48:[2,51],49:[2,51],50:[1,72],51:[1,73],52:[2,51],53:[2,51],54:[2,51],55:[2,51],56:[2,51],57:[2,51]},{14:[2,52],15:[2,52],33:[1,67],34:[1,65],38:[1,64],41:[1,79],42:[2,52],43:[2,52],45:[1,66],46:[1,68],47:[1,69],48:[1,70],49:[1,71],50:[1,72],51:[1,73],52:[1,74],53:[1,75],54:[2,52],55:[2,52],56:[2,52],57:[2,52]},{14:[2,53],15:[2,53],33:[1,67],34:[1,65],38:[1,64],41:[1,79],42:[2,53],43:[2,53],45:[1,66],46:[1,68],47:[1,69],48:[1,70],49:[1,71],50:[1,72],51:[1,73],52:[1,74],53:[1,75],54:[1,76],55:[2,53],56:[2,53],57:[2,53]},{33:[1,67],34:[1,65],38:[1,64],41:[1,79],42:[1,129],45:[1,66],46:[1,68],47:[1,69],48:[1,70],49:[1,71],50:[1,72],51:[1,73],52:[1,74],53:[1,75],54:[1,76],55:[1,77],56:[1,78]},{33:[1,67],34:[1,65],38:[1,64],41:[1,79],43:[1,130],45:[1,66],46:[1,68],47:[1,69],48:[1,70],49:[1,71],50:[1,72],51:[1,73],52:[1,74],53:[1,75],54:[1,76],55:[1,77],56:[1,78]},{14:[1,131],57:[1,90]},{10:[1,44],11:[1,51],20:132,31:[1,50],35:[1,41],36:[1,42],37:[1,43],39:[1,45],40:[1,46],41:[1,47],46:[1,48],47:[1,49]},{14:[2,39],15:[2,39],33:[2,39],34:[2,39],38:[2,39],41:[2,39],42:[2,39],43:[2,39],45:[2,39],46:[2,39],47:[2,39],48:[2,39],49:[2,39],50:[2,39],51:[2,39],52:[2,39],53:[2,39],54:[2,39],55:[2,39],56:[2,39],57:[2,39]},{43:[1,133]},{10:[2,62],11:[2,62],13:134,31:[2,62],35:[2,62],36:[2,62],37:[2,62],39:[2,62],40:[2,62],41:[2,62],43:[2,62],46:[2,62],47:[2,62],57:[1,84]},{10:[2,61],11:[2,61],14:[2,61],31:[2,61],35:[2,61],36:[2,61],37:[2,61],39:[2,61],40:[2,61],41:[2,61],43:[2,61],46:[2,61],47:[2,61]},{14:[2,57],15:[2,57],33:[2,57],34:[2,57],38:[2,57],41:[2,57],42:[2,57],43:[2,57],45:[2,57],46:[2,57],47:[2,57],48:[2,57],49:[2,57],50:[2,57],51:[2,57],52:[2,57],53:[2,57],54:[2,57],55:[2,57],56:[2,57],57:[2,57]},{10:[1,55],11:[1,51],20:54,31:[1,50],35:[1,41],36:[1,42],37:[1,43],39:[1,45],40:[1,46],41:[1,47],46:[1,48],47:[1,49],59:135},{14:[2,74],33:[1,67],34:[1,65],38:[1,64],41:[1,79],45:[1,66],46:[1,68],47:[1,69],48:[1,70],49:[1,71],50:[1,72],51:[1,73],52:[1,74],53:[1,75],54:[1,76],55:[1,77],56:[1,78],57:[2,74]},{14:[1,136]},{1:[2,17],9:[2,17],10:[2,17],15:[2,17],16:[2,17],17:[2,17],21:[2,17],22:[2,17],26:[2,17],28:[2,17],31:[2,17],32:[2,17],33:[2,17],34:[2,17]},{10:[2,8],15:[2,8],16:[2,8],21:[2,8],22:[2,8],26:[2,8],31:[2,8],32:[2,8],33:[2,8],34:[2,8]},{10:[1,62],14:[2,61],58:137},{14:[2,69],33:[1,67],34:[1,65],38:[1,64],41:[1,79],45:[1,66],46:[1,68],47:[1,69],48:[1,70],49:[1,71],50:[1,72],51:[1,73],52:[1,74],53:[1,75],54:[1,76],55:[1,77],56:[1,78],57:[2,69]},{10:[1,44],11:[1,51],20:138,31:[1,50],35:[1,41],36:[1,42],37:[1,43],39:[1,45],40:[1,46],41:[1,47],46:[1,48],47:[1,49]},{14:[2,59],15:[2,59],33:[2,59],34:[2,59],38:[2,59],41:[2,59],42:[2,59],43:[2,59],45:[2,59],46:[2,59],47:[2,59],48:[2,59],49:[2,59],50:[2,59],51:[2,59],52:[2,59],53:[2,59],54:[2,59],55:[2,59],56:[2,59],57:[2,59]},{14:[2,60],15:[2,60],33:[2,60],34:[2,60],38:[2,60],41:[2,60],42:[2,60],43:[2,60],45:[2,60],46:[2,60],47:[2,60],48:[2,60],49:[2,60],50:[2,60],51:[2,60],52:[2,60],53:[2,60],54:[2,60],55:[2,60],56:[2,60],57:[2,60]},{33:[1,67],34:[1,65],38:[1,64],41:[1,79],42:[1,140],43:[1,139],45:[1,66],46:[1,68],47:[1,69],48:[1,70],49:[1,71],50:[1,72],51:[1,73],52:[1,74],53:[1,75],54:[1,76],55:[1,77],56:[1,78]},{14:[2,40],15:[2,40],33:[2,40],34:[2,40],38:[2,40],41:[2,40],42:[2,40],43:[2,40],45:[2,40],46:[2,40],47:[2,40],48:[2,40],49:[2,40],50:[2,40],51:[2,40],52:[2,40],53:[2,40],54:[2,40],55:[2,40],56:[2,40],57:[2,40]},{10:[1,44],11:[1,51],20:141,31:[1,50],35:[1,41],36:[1,42],37:[1,43],39:[1,45],40:[1,46],41:[1,47],43:[2,61],46:[1,48],47:[1,49]},{14:[2,72],57:[2,72]},{19:[1,142]},{14:[2,67],57:[2,67]},{14:[2,58],15:[2,58],33:[1,67],34:[1,65],38:[1,64],41:[1,79],42:[2,58],43:[2,58],45:[1,66],46:[1,68],47:[1,69],48:[1,70],49:[1,71],50:[1,72],51:[1,73],52:[1,74],53:[1,75],54:[1,76],55:[1,77],56:[1,78],57:[2,58]},{14:[2,37],15:[2,37],33:[2,37],34:[2,37],38:[2,37],41:[2,37],42:[2,37],43:[2,37],45:[2,37],46:[2,37],47:[2,37],48:[2,37],49:[2,37],50:[2,37],51:[2,37],52:[2,37],53:[2,37],54:[2,37],55:[2,37],56:[2,37],57:[2,37]},{10:[1,44],11:[1,51],20:143,31:[1,50],35:[1,41],36:[1,42],37:[1,43],39:[1,45],40:[1,46],41:[1,47],46:[1,48],47:[1,49]},{33:[1,67],34:[1,65],38:[1,64],41:[1,79],43:[2,64],45:[1,66],46:[1,68],47:[1,69],48:[1,70],49:[1,71],50:[1,72],51:[1,73],52:[1,74],53:[1,75],54:[1,76],55:[1,77],56:[1,78],57:[2,64]},{10:[1,44],11:[1,51],20:144,31:[1,50],35:[1,41],36:[1,42],37:[1,43],39:[1,45],40:[1,46],41:[1,47],46:[1,48],47:[1,49]},{33:[1,67],34:[1,65],38:[1,64],41:[1,79],43:[1,145],45:[1,66],46:[1,68],47:[1,69],48:[1,70],49:[1,71],50:[1,72],51:[1,73],52:[1,74],53:[1,75],54:[1,76],55:[1,77],56:[1,78]},{15:[1,146],33:[1,67],34:[1,65],38:[1,64],41:[1,79],45:[1,66],46:[1,68],47:[1,69],48:[1,70],49:[1,71],50:[1,72],51:[1,73],52:[1,74],53:[1,75],54:[1,76],55:[1,77],56:[1,78]},{14:[2,38],15:[2,38],33:[2,38],34:[2,38],38:[2,38],41:[2,38],42:[2,38],43:[2,38],45:[2,38],46:[2,38],47:[2,38],48:[2,38],49:[2,38],50:[2,38],51:[2,38],52:[2,38],53:[2,38],54:[2,38],55:[2,38],56:[2,38],57:[2,38]},{1:[2,13],9:[2,13],10:[2,13],15:[2,13],16:[2,13],17:[2,13],21:[2,13],22:[2,13],26:[2,13],31:[2,13],32:[2,13],33:[2,13],34:[2,13]}],defaultActions:{},parseError:function(t,n){throw new Error(t)},parse:function(t){function v(e){r.length=r.length-2*e,i.length=i.length-e,s.length=s.length-e}function m(){var e;return e=n.lexer.lex()||1,typeof e!="number"&&(e=n.symbols_[e]||e),e}var n=this,r=[0],i=[null],s=[],o=this.table,u="",a=0,f=0,l=0,c=2,h=1;this.lexer.setInput(t),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,this.yy.parser=this,typeof this.lexer.yylloc=="undefined"&&(this.lexer.yylloc={});var p=this.lexer.yylloc;s.push(p);var d=this.lexer.options&&this.lexer.options.ranges;typeof this.yy.parseError=="function"&&(this.parseError=this.yy.parseError);var g,y,b,w,E,S,x={},T,N,C,k;for(;;){b=r[r.length-1];if(this.defaultActions[b])w=this.defaultActions[b];else{if(g===null||typeof g=="undefined")g=m();w=o[b]&&o[b][g]}if(typeof w=="undefined"||!w.length||!w[0]){var L="";if(!l){k=[];for(T in o[b])this.terminals_[T]&&T>2&&k.push("'"+this.terminals_[T]+"'");this.lexer.showPosition?L="Parse error on line "+(a+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+k.join(", ")+", got '"+(this.terminals_[g]||g)+"'":L="Parse error on line "+(a+1)+": Unexpected "+(g==1?"end of input":"'"+(this.terminals_[g]||g)+"'"),this.parseError(L,{text:this.lexer.match,token:this.terminals_[g]||g,line:this.lexer.yylineno,loc:p,expected:k})}}if(w[0]instanceof Array&&w.length>1)throw new Error("Parse Error: multiple actions possible at state: "+b+", token: "+g);switch(w[0]){case 1:r.push(g),i.push(this.lexer.yytext),s.push(this.lexer.yylloc),r.push(w[1]),g=null,y?(g=y,y=null):(f=this.lexer.yyleng,u=this.lexer.yytext,a=this.lexer.yylineno,p=this.lexer.yylloc,l>0&&l--);break;case 2:N=this.productions_[w[1]][1],x.$=i[i.length-N],x._$={first_line:s[s.length-(N||1)].first_line,last_line:s[s.length-1].last_line,first_column:s[s.length-(N||1)].first_column,last_column:s[s.length-1].last_column},d&&(x._$.range=[s[s.length-(N||1)].range[0],s[s.length-1].range[1]]),S=this.performAction.call(x,u,f,a,this.yy,w[1],i,s);if(typeof S!="undefined")return S;N&&(r=r.slice(0,-1*N*2),i=i.slice(0,-1*N),s=s.slice(0,-1*N)),r.push(this.productions_[w[1]][0]),i.push(x.$),s.push(x._$),C=o[r[r.length-2]][r[r.length-1]],r.push(C);break;case 3:return!0}}return!0}},u=function(){var e={EOF:1,parseError:function(t,n){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,n)},setInput:function(e){return this._input=e,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var e=this._input[0];this.yytext+=e,this.yyleng++,this.offset++,this.match+=e,this.matched+=e;var t=e.match(/(?:\r\n?|\n).*/g);return t?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),e},unput:function(e){var t=e.length,n=e.split(/(?:\r\n?|\n)/g);this._input=e+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-t-1),this.offset-=t;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-t},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-t]),this},more:function(){return this._more=!0,this},less:function(e){this.unput(this.match.slice(e))},pastInput:function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?"...":"")+e.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var e=this.match;return e.length<20&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var e=this.pastInput(),t=(new Array(e.length+1)).join("-");return e+this.upcomingInput()+"\n"+t+"^"},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var e,t,n,r,i,s;this._more||(this.yytext="",this.match="");var o=this._currentRules();for(var u=0;u<o.length;u++){n=this._input.match(this.rules[o[u]]);if(n&&(!t||n[0].length>t[0].length)){t=n,r=u;if(!this.options.flex)break}}if(t){s=t[0].match(/(?:\r\n?|\n).*/g),s&&(this.yylineno+=s.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:s?s[s.length-1].length-s[s.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],e=this.performAction.call(this,this.yy,this,o[r],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1);if(e)return e;return}return this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return typeof t!="undefined"?t:this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(t){this.begin(t)}};return e.options={flex:!0},e.performAction=function(t,n,r,i){var s=i;switch(r){case 0:this.begin("cond_include");break;case 1:t.filepath=n.yytext;break;case 2:t.filename=n.yytext;break;case 3:this.popState();break;case 4:this.begin("cond_use");break;case 5:t.filename=n.yytext;break;case 6:this.popState();break;case 7:return 9;case 8:return 21;case 9:return 26;case 10:return 28;case 11:return 35;case 12:return 36;case 13:return 37;case 14:stringcontents+=" ";break;case 15:stringcontents+="\n";break;case 16:stringcontents+='"';break;case 17:stringcontents+="\r";break;case 18:stringcontents+="\\";break;case 19:stringcontents+="\0";break;case 20:stringcontents+="a";break;case 21:stringcontents+="\b";break;case 22:stringcontents+=" ";break;case 23:stringcontents+="\n";break;case 24:stringcontents+="";break;case 25:stringcontents+="\f";break;case 26:stringcontents+="e";break;case 27:stringcontents+=n.yytext;break;case 28:return this.popState(),n.yytext=stringcontents,39;case 29:this.begin("cond_string"),stringcontents="";break;case 30:break;case 31:break;case 32:break;case 33:break;case 34:return 40;case 35:return 40;case 36:return 40;case 37:return 10;case 38:return 49;case 39:return 52;case 40:return 50;case 41:return 51;case 42:return 54;case 43:return 55;case 44:return n.yytext;case 45:console.log(n.yytext)}},e.rules=[/^(?:include[ \t\r\n>]*<)/,/^(?:[^\t\r\n>]*\/)/,/^(?:[^\t\r\n>/]+)/,/^(?:>)/,/^(?:use[ \t\r\n>]*<)/,/^(?:[^\t\r\n>]+)/,/^(?:>)/,/^(?:module)/,/^(?:function)/,/^(?:if)/,/^(?:else)/,/^(?:true)/,/^(?:false)/,/^(?:undef)/,/^(?:\\t)/,/^(?:\\n)/,/^(?:\\")/,/^(?:\\r)/,/^(?:\\\\)/,/^(?:\\0)/,/^(?:\\a)/,/^(?:\\b)/,/^(?:\\t)/,/^(?:\\n)/,/^(?:\\v)/,/^(?:\\f)/,/^(?:\\e)/,/^(?:[^\\\n\"]+)/,/^(?:")/,/^(?:[\"])/,/^(?:[\n])/,/^(?:[\r\t ])/,/^(?:\/\/[^\n]*\n?)/,/^(?:\/\*.+\*\/)/,/^(?:([0-9])*\.([0-9])+([Ee][+-]?([0-9])+)?)/,/^(?:([0-9])+\.([0-9])*([Ee][+-]?([0-9])+)?)/,/^(?:([0-9])+([Ee][+-]?([0-9])+)?)/,/^(?:\$?[a-zA-Z0-9_]+)/,/^(?:<=)/,/^(?:>=)/,/^(?:==)/,/^(?:!=)/,/^(?:&&)/,/^(?:\|\|)/,/^(?:.)/,/^(?:.)/],e.conditions={cond_include:{rules:[0,1,2,3,4,7,8,9,10,11,12,13,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45],inclusive:!0},cond_use:{rules:[0,4,5,6,7,8,9,10,11,12,13,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45],inclusive:!0},cond_comment:{rules:[0,4,7,8,9,10,11,12,13,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45],inclusive:!0},cond_string:{rules:[0,4,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45],inclusive:!0},cond_import:{rules:[0,4,7,8,9,10,11,12,13,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45],inclusive:!0},INITIAL:{rules:[0,4,7,8,9,10,11,12,13,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45],inclusive:!0}},e}();return o.lexer=u,o}),r("openscadOpenJscadParser",["require","openscad-parser","Globals","openscad-parser-support"],function(e){var t=e("openscad-parser"),n=e("Globals"),r=e("openscad-parser-support");return{parser:t,parse:function(e){t.yy===undefined&&(t.yy={});var r=n.preParse(e),i=t.parse(r);return i.lines.join("\n")}}}),r("underscore",function(){return e}),n("openscadOpenJscadParser")});